2

While trying to run benchmark with the following command, I am getting errors:

target/debug/imbue-collator benchmark --chain=pukimak.json --steps=100 --repeat=200 --pallet=proposals --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=example_weights.rs --template=./scripts/frame-weight-template.hbs

Error:

Error: Input("Error getting benchmark list: Other: Exported method Benchmark_benchmark_metadata is not found")

Used local chain spec via this command:

./target/debug/imbue-collator build-spec --chain imbue-dev --raw --disable-default-bootnode > pukimak.json

Update: Able to run benchmark help command using the collator on CLI:

imbue-collator 2.0.0-c68dc56-x86_64-linux-gnu
imbue <https://github.com/ImbueNetwork>
imbue testnet

The command-line arguments provided first will be passed to the parachain node, while the arguments
provided after -- will be passed to the relaychain node.

imbue-collator [parachain-args] -- [relaychain-args]

USAGE:
    imbue-collator [OPTIONS] [-- <RELAYCHAIN_ARGS>...]
    imbue-collator <SUBCOMMAND>

ARGS:
    <RELAYCHAIN_ARGS>...
            Relaychain arguments

OPTIONS:
        --alice
            Shortcut for `--name Alice --validator` with session keys for `Alice` added to keystore```
6
  • 3
    How did you create pukimak.json? Probably you need to update this to the latest version of Substrate.
    – Shawn Tabrizi
    Apr 4, 2022 at 23:05
  • Generated the chain spec using the imbue collator with this command: Used local chain spec via this command: ./target/debug/imbue-collator build-spec --chain imbue-dev --raw --disable-default-bootnode > pukimak.json
    – Kanthan
    Apr 5, 2022 at 2:57
  • 3
    You need to build the chain with the --features=runtime-benchmarks flag
    – Shawn Tabrizi
    Apr 5, 2022 at 3:02
  • @ShawnTabrizi, I am trying what you suggested to better understand the chain spec dependency. ./target/debug/imbue-collator build-spec --chain imbue-dev --raw --disable-default-bootnode --features=runtime-benchmarks > pukimak.json, it errors out with the following: error: Found argument '--features' which wasn't expected, or isn't valid in this context If you tried to supply `--features` as a value rather than a flag, use `-- --features` USAGE: imbue-collator build-spec --chain <CHAIN_SPEC> For more information try --help
    – Kanthan
    Apr 11, 2022 at 12:29
  • 1
    Features should be before build-spec
    – Shawn Tabrizi
    Apr 11, 2022 at 16:01

1 Answer 1

0

try add your proposal pallet into benchmark metadata like this

Code change based on the input provided above:

    impl frame_benchmarking::Benchmark<Block> for Runtime {
        fn benchmark_metadata(extra: bool) -> (
            Vec<frame_benchmarking::BenchmarkList>,
            Vec<frame_support::traits::StorageInfo>,
        ) {
            use frame_benchmarking::{baseline, Benchmarking, BenchmarkList};
            use frame_support::traits::StorageInfoTrait;
            use frame_system_benchmarking::Pallet as SystemBench;
            use baseline::Pallet as BaselineBench;

            let mut list = Vec::<BenchmarkList>::new();
            list_benchmarks!(list, extra);

            let storage_info = AllPalletsWithSystem::storage_info();

            return (list, storage_info)
        }

        fn dispatch_benchmark(
            config: frame_benchmarking::BenchmarkConfig
        ) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {
            use frame_benchmarking::{baseline, Benchmarking, BenchmarkBatch, TrackedStorageKey};

            use frame_system_benchmarking::Pallet as SystemBench;
            use baseline::Pallet as BaselineBench;

            impl frame_system_benchmarking::Config for Runtime {}
            impl baseline::Config for Runtime {}

            let whitelist: Vec<TrackedStorageKey> = vec![
                // Block Number
                hex_literal::hex!("XXX1").to_vec().into(),
                // Total Issuance
                hex_literal::hex!("XXX2").to_vec().into(),
                // Execution Phase
                hex_literal::hex!("XXX3").to_vec().into(),
                // Event Count
                hex_literal::hex!("XXX4").to_vec().into(),
                // System Events
                hex_literal::hex!("XXX5").to_vec().into(),
            ];

            let mut batches = Vec::<BenchmarkBatch>::new();
            let params = (&config, &whitelist);
            add_benchmarks!(params, batches);

            Ok(batches)
        }
    }```
3
  • This worked. Thank you so much !!! Benchmark code reference: github.com/ImbueNetwork/imbue/commit/… File updated: runtime/development/src/lib.rs
    – Kanthan
    Apr 6, 2022 at 11:50
  • Consider copying the relevant code into the answer itself, otherwise when the link stops working the answer will not make any sense.
    – Dcompoze
    Apr 6, 2022 at 13:01
  • Answer updated, @DanielChmielewski. Thanks.
    – Kanthan
    Apr 11, 2022 at 12:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.