-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Add WeightInfo
to Babe and Grandpa Pallet
#7155
Conversation
WeightInfo
to Babe PalletWeightInfo
to Babe and Grandpa Pallet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
// calculate the weight but we set a floor of 100 validators. | ||
let validator_count = validator_count.max(100) as u64; | ||
|
||
// worst case we are considering is that the given offender |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andresilva you should keep an eye on this: https://github.com/paritytech/substrate/issues/6641
TLDR; It is really nonsensical that we store all backers of a validators and slash all of them but reward only a portion of them (top 64). I am considering making this always top 64, so here you can always ensure that MAX_NOMINATORS = 64;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good! That way we can drop this assumption and have a strict upper bound on the number of nominators a slash will affect.
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
bot merge |
Trying merge. |
* Add `WeightInfo` to Babe Pallet * Also grandpa * Update frame/grandpa/src/default_weights.rs Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com> Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
This PR makes no logical changes to the Babe or Grandpa Pallet. It simply refactors the custom weight formula into the
WeightInfo
pattern we have used across the other pallets.polkadot companion: paritytech/polkadot#1736