Skip to content

Membership handler weight accounting

Currently, an extrinsic and a hook in the pallet membership call do_remove_membership, which in turn calls the membership handler. This handler either calls remove_member in the authority-members pallet or on_removed_member in the universal-dividend pallet.

  • universal-dividend::on_removed_member has a complexity parameter that is not taken into account in the actual accounting of every membership function calling membership::do_remove_membership in the wot instance.
  • The pallet::membership::revoke_membership has a hidden complexity parameter, bonded by T::MaxPastReeval of the universal-dividend pallet, which poses a problem because T::MaxPastReeval is not accessible in the membership pallet, and secondly, because it is an instance pallet. One way to get past that is to use the DispatchResultWithPostInfo with weight accounting inside the extrinsic that will be instance-dependent and include the complexity parameter to avoid overcounting.

To do:

  • Propagate weight through the provider from universal-dividend::on_removed_member to pallet_membership::do_remove_membership.
  • Correct hook weight using the propagated weight.
  • Compute the extrinsic weight using membership::do_remove_membership with the worst-case scenario of T::MaxPastReeval i.e. arbitrary high block number during benchmark.
  • Use the DispatchResultWithPostInfo and the propagated weight to correct the weight used by the wot instance.
Edited by Benjamin Gallois
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information