3

We are doing upgrade to polkadot version 29. Everything works fine until we run the command

cargo build -r --features try-runtime

we got error trait bounds. In this version there was change from execute_block_no_check to try_execute_block

Here we change to this in runtime

and here is the error we see in the console

Are we missing something ? We could not find any issue.

Here is the link to repo

Thanks for any help.

1 Answer 1

4

The auto-generated implementation for the TryState trait is feature gated behind try-runtime.
This requires all pallets to support try-runtime as well.
You can try it out for a single pallet by putting this line above the error-producing try_execute_block:

<frame_system::Pallet<Runtime> as frame_support::traits::TryState<_>>::try_state();

This will produce an error claiming that frame_system::Pallet does not implement TryState. It can be fixed by adding frame-system/try-runtime, frame-support/try-runtime and frame-executive/try-runtime to the try-runtime feature list of the runtime Cargo.toml.
Sadly it looks like some pallets that you have deployed do currently not support that feature.
They need to be updated to support the feature and propagate it to all dependencies.

The feature system of Rust is really annoying when it comes to this. We are slowly cleaning up Substrate and remove any feature-bleed; eg https://github.com/paritytech/substrate/pull/11976 and https://github.com/paritytech/substrate/pull/12341.
In this case we case it is a bit unfortunate that the pallets all need to support it. If you are really lucky you can try removing this line and do some feature hacking to maybe get it working without that.
But then you have non-production hooks in production code; also not good.

7

Your Answer

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

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