2

When I add and run a new benchmark via

cargo test --package pallet-<name>  --features runtime-benchmarks

I get an error which is unclear and unrelated to the actual benchmark i added:

error: recursion limit reached while expanding `stringify!`
   --> frame/assets/src/benchmarking.rs:154:1
    |
154 | / benchmarks_instance_pallet! {
155 | |     create {
156 | |         let caller: T::AccountId = whitelisted_caller();
157 | |         let caller_lookup = T::Lookup::unlookup(caller.clone());
...   |
485 | |     impl_benchmark_test_suite!(Assets, crate::mock::new_test_ext(), crate::mock::Test)
486 | | }
    | |_^
    |
    = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`pallet_assets`)
    = note: this error originates in the macro `$crate::impl_bench_name_tests` which comes from the expansion of the macro `benchmarks_instance_pallet` (in Nightly builds, run with -Z macro-backtrace for more info)

error: could not compile `pallet-assets` due to previous error
warning: build failed, waiting for other jobs to finish...

UPDATE: This is a permalink to the benchmark which I added that lead to this error: https://github.com/paritytech/substrate/blob/2d3b6507817d66f6e2e697074bfc806e4a6eb2a8/frame/assets/src/benchmarking.rs#L180-L180

1 Answer 1

2

Looks like you are the first one to find the case where there are too many benchmarks in a file and the macro fails.
This is easily fixed in your case by putting #![recursion_limit = "1024"] at the top of your lib.rs file.
Often these "expansion limit reached" mean that something went wrong, but in this case it's just the large number of benchmarks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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