-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Add WeightInfo to Babe and Grandpa Pallet
#7155
Conversation
WeightInfo to Babe PalletWeightInfo to Babe and Grandpa Pallet
gui1117
left a comment
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 <[email protected]>
|
bot merge |
|
Trying merge. |
* Add `WeightInfo` to Babe Pallet * Also grandpa * Update frame/grandpa/src/default_weights.rs Co-authored-by: André Silva <[email protected]> Co-authored-by: André Silva <[email protected]>
This PR makes no logical changes to the Babe or Grandpa Pallet. It simply refactors the custom weight formula into the
WeightInfopattern we have used across the other pallets.polkadot companion: paritytech/polkadot#1736