-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Allow validators to block and kick their nominator set. #7930
Conversation
/benchmark runtime pallet pallet_staking |
Finished benchmark for branch: gav-freeze-staking Benchmark: Benchmark Runtime Pallet cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_staking --extrinsic="*" --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/staking/src/weights.rs --template=./.maintain/frame-weight-template.hbs ResultsPallet: "pallet_staking", Extrinsic: "bond", Lowest values: [], Highest values: [], Steps: [50], Repeat: 20
|
…/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_staking --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/staking/src/weights.rs --template=./.maintain/frame-weight-template.hbs
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, one potential improvement is that the migration is a one-time use and while we haven't made anything standard yet, it is better to make standalone ones that don't rely on a particular T: Config
, as such. Then the migration can live forever and re-used much nicer. But it is a bit of hassle to set up and since not everyone is doing it, I am not sure how valuable it is
.take(MAX_NOMINATIONS) | ||
.map(|t| T::Lookup::lookup(t)) | ||
.map(|t| T::Lookup::lookup(t).map_err(DispatchError::from)) | ||
.map(|n| n.and_then(|n| if old.contains(&n) || !Validators::<T>::get(&n).blocked { |
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.
I think this reads nicer if the if-else
body is indented.
The huge issue with this is that it quickly becomes painful to support multiple migrations, each with their own datastructures, when they change on top of each other. Our storage |
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This allows validators to curate their nominator set if desired. Default behaviour remains unchanged.
Two main changes:
ValidatorPrefs
now contains an additionalbool
field:blocked
. This isfalse
by default (which give current behaviour), but if set totrue
, then nobody who is not already nominating the validator may nominate it.kick
. This is called by a validator (controller account) and takes a list of nominator (stash accounts); afterwards those accounts are no longer nominating the validator.You'll typically use it by:
kick
themCC @jacogr @kianenigma @shawntabrizi
Polkadot companion: paritytech/polkadot#2290