0

If we return Weight::zero() for an extrinsic that returns DispatchResultWithPostInfo, does that mean that we discard extrinsic base weight which is included for every transaction?

1 Answer 1

1

Yes.

Lets start with where we execute a block from the executive pallet, more specifically execute_extrinsics_with_bookkeeping. Then, we are going to apply_extrinsic where we get the dispatch info of a particular extrinsic (ref) (run cargo expand on your pallet to find the implementation).

Followed in the next line we will apply the extrinsic which (assuming it is a signed tx) calls the pre_dispatch implementation of the SignedExtensions of your runtime (you can find them configured here). As for the check_weight SignedExtension implementation it will call do_pre_dispatch which calls check_block_weight -> calculate_consumed_weight. Here you will see that the base_extrinsic weight is added to the dispatch info mentioned above.

2
  • So that's a yes to ExtrinsicBaseWeight being unconditionally being added even though my extrinisic returns 0 weight consumed?
    – b0zero
    Commented Sep 18, 2023 at 13:31
  • Yep, since the base weight is the effort done by FRAME, not by your code. Commented Sep 18, 2023 at 13:35

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.