Substrate: Error while running benchmarks: Export ext_benchmarking_commit_db_version_1 not found

Created on 28 Jul 2020  路  3Comments  路  Source: paritytech/substrate

I am on rc-5 and trying to run benchmarks. Keep getting the following error no matter what pallet I try to benchmark unless I follow a pattern that I describe later.

Cannot create a runtime: Instantiation("Instantiation: Export ext_benchmarking_commit_db_version_1 not found")
Error: Input("Error executing runtime benchmark: Other(\"Instantiation: Export ext_benchmarking_commit_db_version_1 not found\")")

I am running the following command for benchmarking from node directory and have tried clearing the database before running

cargo run --features runtime-benchmarks -- benchmark --extrinsic=transfer --pallet=balances

Even after commenting out all benchmarking code from my modules and the add_benchmark! in dispatch_benchmark for my modules, i get the same error as above. This is how dispatch_benchmark looks (taken from substrate repo's bin/node/runtime)

fn dispatch_benchmark(
            pallet: Vec<u8>,
            benchmark: Vec<u8>,
            lowest_range_values: Vec<u32>,
            highest_range_values: Vec<u32>,
            steps: Vec<u32>,
            repeat: u32,
        ) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {
                       use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark};
                       use frame_system_benchmarking::Module as SystemBench;
                       impl frame_system_benchmarking::Trait for Runtime {}

                       let whitelist = vec![];

                       let mut batches = Vec::<BenchmarkBatch>::new();
                       let params = (&pallet, &benchmark, &lowest_range_values, &highest_range_values, &steps, repeat, &whitelist);

                       add_benchmark!(params, batches, balances, Balances);
                       add_benchmark!(params, batches, frame_system, SystemBench::<Runtime>);

                       if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
                       Ok(batches)

I followed the discussion in this issue https://github.com/paritytech/substrate/issues/6644 and checked with the linked PR but don't see the difference that can cause this.

However, I can get this to work if I follow the steps in the following sequence:

  • clear db
  • run benchmark with above-mentioned command - this will crash with the above-mentioned error
  • run node in dev mode - this will crash as well with the same error
  • build without benchmark (cargo build) - this will work
  • run benchmark with above-mentioned command - this produces the benchmark

The code I am running is here.

Z0-unconfirmed

Most helpful comment

You are not registering the benchmarking host functions, as shown here: https://github.com/paritytech/substrate/blob/master/bin/node/executor/src/lib.rs#L30

All 3 comments

You are not registering the benchmarking host functions, as shown here: https://github.com/paritytech/substrate/blob/master/bin/node/executor/src/lib.rs#L30

@bkchr Thanks. Your suggestion works. I am closing this issue but can you please explain why build sequence mentioned in the issue worked?

Not sure how that worked :shrug:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jiangfuyao picture jiangfuyao  路  3Comments

gavofyork picture gavofyork  路  4Comments

athei picture athei  路  4Comments

xlc picture xlc  路  6Comments

jiangfuyao picture jiangfuyao  路  5Comments