I would like to add more validation to a third party pallet before calling it from my pallet. The setup I have is:

  - base_extrinsic(...)

 - custom_base_extrinsic(...)

What i would like to do is run some custom code (like extra validation) before invoking ThirdPartyPallet.base_extrinsic().

In MyPallet I have "inherited" from ThirdPartyPallet:

pub trait Config: SendTransactionTypes<Call<Self>> + system::Config + third_party_pallet::Config

and i can call base_extrinsic like this:

fn custom_base_extrinsic(origin) -> DispatchResult {
  let signer = ensure_signed(origin)?;
  //Custom code will go here

  //Here i will call the third party pallet's extrinsic
  third_party_pallet::Module::<T>::base_extrinsic(<T as frame_system::Config>::Origin::from(RawOrigin::Signed(signer)))?;


This feels like a workaround so my question is, is this allowed/supported. Is there a better way to do this?

I know there is a dispatch() method but I haven't seen any examples where the Call is constructed within the runtime. All usages of dispatch() are from Call passed as a parameter to an extrinsic.


1 Answer 1


In general, the best thing would be if the third party pallet exposed a set of APIs which would allow it to be extensible out of the box and in ways that would be helpful for you.

However, your approach is totally okay, and something that I wrote about a long while back.

The important thing to do as a follow up to this is to make sure that this pallet you are extending is not callable by setting up a call filter, or hiding the Call attribute in your construct_runtime!, otherwise someone will just bypass your checks by calling the original pallet.

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.