I would like to schedule the dispatch call authorize_upgrade inside a custom pallet. For this I need the call enum variant of the cumulus_pallet_parachain_system pallet. How can I get this? Via the config parameters?

1 Answer 1

cumulus_pallet_parachain_system::Call::<T>::authorize_upgrade { code_hash }

This gives you access in your pallet to the parachain system Call. T needs to implement cumulus_pallet_parachain_system::Config.

In your config you need to add:

trait Config {
    type Call: From<cumulus_pallet_parachain_system::Call> + frame_support::dispatch::Dispatchable;

This is required to be able to convert the parachain system call into the runtime call and to dispatch the call.

  • Do I need to tightly couple cumulus_pallet_parachain_system::Config to my pallet? Do you have an example? I can't get it working. How to call the authorize_upgrade with your Call parameter inside my pallet. How to set the config parameter in the runtime?
    – Chralt
    Commented Jan 15, 2023 at 16:44
  • Got it with your help. It is exactly as you described, but I didn't know that I can just pass in the whole Call struct of the runtime (type Call = Call;). I tightly coupled it with + cumulus_pallet_parachain_system::Config. Thanks a lot Bastian!
    – Chralt
    Commented Jan 15, 2023 at 16:57
  • Good to hear that you made it :)
    – bkchr
    Commented Jan 15, 2023 at 22:39

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.