4

I'm attempting to integrate try-runtime into substrate-contracts-node and I get the following error when I call Executive::try_runtime_upgrade():

Compiling contracts-node-runtime v0.24.0 (/Users/bruno/src/substrate-contracts-node/runtime)
  error[E0599]: the function or associated item `try_runtime_upgrade` exists for struct `Executive<Runtime, Block<Header<u32, BlakeTwo256>, ...>, ..., ..., ..., ...>`, but its trait bounds were not satisfied
     --> /Users/bruno/src/substrate-contracts-node/runtime/src/lib.rs:600:28
      |
  600 |             let weight = Executive::try_runtime_upgrade(checks).unwrap();
      |                                     ^^^^^^^^^^^^^^^^^^^ function or associated item cannot be called due to unsatisfied trait bounds
      |
      = note: the full type name has been written to '/Users/bruno/src/substrate-contracts-node/target/release/wbuild/contracts-node-runtime/target/wasm32-unknown-unknown/release/deps/contracts_node_runtime-51f958c1a37e4242.long-type-8782138364158150179.txt'
      = note: the following trait bounds were not satisfied:
              `(frame_system::Pallet<Runtime>, pallet_utility::Pallet<Runtime>, pallet_randomness_collective_flip::Pallet<Runtime>, pallet_timestamp::Pallet<Runtime>, pallet_balances::Pallet<Runtime>, pallet_authorship::Pallet<Runtime>, pallet_transaction_payment::Pallet<Runtime>, pallet_sudo::Pallet<Runtime>, pallet_contracts::Pallet<Runtime>, pallet_assets::Pallet<Runtime>): hidden_include::traits::TryState<u32>`

  error[E0599]: the function or associated item `try_execute_block` exists for struct `Executive<Runtime, Block<Header<u32, BlakeTwo256>, ...>, ..., ..., ..., ...>`, but its trait bounds were not satisfied
     --> /Users/bruno/src/substrate-contracts-node/runtime/src/lib.rs:612:15
      |
  612 |             Executive::try_execute_block(block, state_root_check, signature_check, select).expect("execute-block failed")
      |                        ^^^^^^^^^^^^^^^^^ function or associated item cannot be called due to unsatisfied trait bounds
      |
      = note: the full type name has been written to '/Users/bruno/src/substrate-contracts-node/target/release/wbuild/contracts-node-runtime/target/wasm32-unknown-unknown/release/deps/contracts_node_runtime-51f958c1a37e4242.long-type-8782138364158150179.txt'
      = note: the following trait bounds were not satisfied:
              `(frame_system::Pallet<Runtime>, pallet_utility::Pallet<Runtime>, pallet_randomness_collective_flip::Pallet<Runtime>, pallet_timestamp::Pallet<Runtime>, pallet_balances::Pallet<Runtime>, pallet_authorship::Pallet<Runtime>, pallet_transaction_payment::Pallet<Runtime>, pallet_sudo::Pallet<Runtime>, pallet_contracts::Pallet<Runtime>, pallet_assets::Pallet<Runtime>): hidden_include::traits::TryState<u32>`

Here all the code changes that I have done:

1 Answer 1

5

You are missing features on the pallet crates.
The following patch fixed this:

diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml
index 9a8d59f..4eebddd 100644
--- a/runtime/Cargo.toml
+++ b/runtime/Cargo.toml
@@ -94,9 +94,13 @@ try-runtime = [
    "frame-executive/try-runtime",
    "frame-system/try-runtime",
    "frame-support/try-runtime",
+   "pallet-assets/try-runtime",
    "pallet-authorship/try-runtime",
    "pallet-balances/try-runtime",
+   "pallet-contracts/try-runtime",
+   "pallet-randomness-collective-flip/try-runtime",
    "pallet-sudo/try-runtime",
    "pallet-timestamp/try-runtime",
    "pallet-transaction-payment/try-runtime",
+   "pallet-utility/try-runtime",
 ]

But it is a duplicate of AllPalletsWithSystem trait not implemented for Executive when running tests.

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.