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_memberhas a complexity parameter that is not taken into account in the actual accounting of every membership function callingmembership::do_remove_membershipin the wot instance. - The
pallet::membership::revoke_membershiphas a hidden complexity parameter, bonded byT::MaxPastReevalof the universal-dividend pallet, which poses a problem becauseT::MaxPastReevalis not accessible in the membership pallet, and secondly, because it is an instance pallet. One way to get past that is to use theDispatchResultWithPostInfowith 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_membertopallet_membership::do_remove_membership. -
Correct hook weight using the propagated weight. -
Compute the extrinsic weight using membership::do_remove_membershipwith the worst-case scenario ofT::MaxPastReevali.e. arbitrary high block number during benchmark. -
Use the DispatchResultWithPostInfoand the propagated weight to correct the weight used by the wot instance.
Edited by Benjamin Gallois