2

I'm migrating a project from substrate-node-template to substrate-parachain-template and I'm encountering an issue when running tests. I understand that this is completely dependent of my local code and probably result of a merge issue, nevertheless I would be thankful if somebody can give me some advice. The problem I am facing is the following compilation error:

  error[E0599]: the function or associated item `try_runtime_upgrade` exists for struct `frame_executive::Executive<Runtime, sp_runtime::generic::Block<sp_runtime::generic::Header<u32, BlakeTwo256>, sp_runtime::generic::UncheckedExtrinsic<MultiAddress<sp_runtime::AccountId32, ()>, RuntimeCall, MultiSignature, (CheckNonZeroSender<Runtime>, CheckSpecVersion<Runtime>, CheckTxVersion<Runtime>, CheckGenesis<Runtime>, CheckEra<Runtime>, CheckNonce<Runtime>, CheckWeight<Runtime>, ChargeTransactionPayment<Runtime>)>>, ChainContext<Runtime>, Runtime, (frame_system::Pallet<Runtime>, cumulus_pallet_parachain_system::Pallet<Runtime>, pallet_timestamp::Pallet<Runtime>, parachain_info::Pallet<Runtime>, pallet_sudo::Pallet<Runtime>, pallet_treasury::Pallet<Runtime>, pallet_balances::Pallet<Runtime>, pallet_transaction_payment::Pallet<Runtime>, pallet_authorship::Pallet<Runtime>, pallet_collator_selection::Pallet<Runtime>, pallet_session::Pallet<Runtime>, pallet_aura::Pallet<Runtime>, cumulus_pallet_aura_ext::Pallet<Runtime>, cumulus_pallet_xcmp_queue::Pallet<Runtime>, pallet_xcm::Pallet<Runtime>, cumulus_pallet_xcm::Pallet<Runtime>, cumulus_pallet_dmp_queue::Pallet<Runtime>, pallet_utility::Pallet<Runtime>, pallet_vesting::Pallet<Runtime>, pallet_scheduler::Pallet<Runtime>, pallet_uniques::Pallet<Runtime>)>`, but its trait bounds were not satisfied
     --> /substrate-parachain-template/runtime/src/lib.rs:972:31
      |
  972 |       let weight = Executive::try_runtime_upgrade().unwrap();

note: the following trait bounds were not satisfied: 
      `(frame_system::Pallet<Runtime>, cumulus_pallet_parachain_system::Pallet<Runtime>, pallet_timestamp::Pallet<Runtime>, parachain_info::Pallet<Runtime>, pallet_sudo::Pallet<Runtime>, pallet_treasury::Pallet<Runtime>, pallet_balances::Pallet<Runtime>, pallet_transaction_payment::Pallet<Runtime>, pallet_authorship::Pallet<Runtime>, pallet_collator_selection::Pallet<Runtime>, pallet_session::Pallet<Runtime>, pallet_aura::Pallet<Runtime>, cumulus_pallet_aura_ext::Pallet<Runtime>, cumulus_pallet_xcmp_queue::Pallet<Runtime>, pallet_xcm::Pallet<Runtime>, cumulus_pallet_xcm::Pallet<Runtime>, cumulus_pallet_dmp_queue::Pallet<Runtime>, pallet_utility::Pallet<Runtime>, pallet_vesting::Pallet<Runtime>, pallet_scheduler::Pallet<Runtime>, pallet_uniques::Pallet<Runtime>): TryState<u32>`

I've checked the definition of Executive, it's as follows:

/// Executive: handles dispatch to the various modules.
pub type Executive =
  frame_executive::Executive<Runtime, Block, frame_system::ChainContext<Runtime>, Runtime, AllPalletsWithSystem>;

It means that AllPalletsWithSystem was not created with all the pallets and the system. I know this type is generated in construct_runtime and the pallets are of course declared there:

// Create the runtime by composing the FRAME pallets that were previously configured.
construct_runtime!(
  pub enum Runtime where
    Block = Block,
    NodeBlock = opaque::Block,
    UncheckedExtrinsic = UncheckedExtrinsic,
  {
    // System support stuff.
    System: frame_system::{Pallet, Call, Config, Storage, Event<T>} = 0,
    ParachainSystem: cumulus_pallet_parachain_system::{
      Pallet, Call, Config, Storage, Inherent, Event<T>, ValidateUnsigned,
    } = 1,
    Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 2,
    ParachainInfo: parachain_info::{Pallet, Storage, Config} = 3,
    Sudo: pallet_sudo = 7,
    Treasury: pallet_treasury = 8,

    // Monetary stuff.
    Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 10,
    TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Event<T>} = 11,


    // Collator support. The order of these 4 are important and shall not change.
    Authorship: pallet_authorship::{Pallet, Call, Storage} = 20,
    CollatorSelection: pallet_collator_selection::{Pallet, Call, Storage, Event<T>, Config<T>} = 21,
    Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>} = 22,
    Aura: pallet_aura::{Pallet, Storage, Config<T>} = 23,
    AuraExt: cumulus_pallet_aura_ext::{Pallet, Storage, Config} = 24,

    // XCM helpers.
    XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 30,
    PolkadotXcm: pallet_xcm::{Pallet, Call, Event<T>, Origin, Config} = 31,
    CumulusXcm: cumulus_pallet_xcm::{Pallet, Event<T>, Origin} = 32,
    DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 33,

    // Customizations
    Utility: pallet_utility::{Pallet, Call, Event} = 40,
    // Vesting. Usable initially, but removed once all vesting is finished.
    Vesting: pallet_vesting::{Pallet, Call, Storage, Event<T>, Config<T>} = 41,
    Scheduler: pallet_scheduler = 42,
    Uniques: pallet_uniques::{Pallet, Call, Storage, Event<T>} = 43,
  }
);

So where is the problem coming from?

1 Answer 1

5

You are probably not passing the try-runtime feature down to all the pallets in your runtime.
The feature needs to be propagated to all pallets (Example) and ideally also dependencies, otherwise the AllPalletsWithSystem will not implement TryState.

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.