2

In pallet_balances I found this syntax for annotating weight and it confused me a bit :

#[pallet::call(weight(<T as Config<I>>::WeightInfo))]
impl<T: Config<I>, I: 'static> Pallet<T, I> {

How does it work? Does it automatically annotate the correct functions with that from T::WeightInfo?

1 Answer 1

1

This update simplifies weight annotation by eliminating the need to manually annotate the weight for every call. However, you still have the option to specify it manually, which will overwrite the default value.

For more detailed information, please refer to the PR description at https://github.com/paritytech/substrate/pull/13932.

2
  • I believe it won't work for weights where an argument like a vec length is expected? Aug 7, 2023 at 6:30
  • 1
    Yep it only works for the most trivial ones where no arg is needed. Aug 7, 2023 at 19:28

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.