Staking: Add `deprecate_controller_batch` AdminOrigin call (#2589)
Partially Addresses #2500
Adds a `deprecate_controller_batch` call to the staking pallet that is
callable by `Root` and `StakingAdmin`. To be used for controller account
deprecation and removed thereafter. Adds
`MaxControllersDeprecationBatch` pallet constant that defines max
possible deprecations per call.
- [x] Add `deprecate_controller_batch` call, and
`MaxControllersInDeprecationBatch` constant.
- [x] Add tests, benchmark, weights. Tests that weight is only consumed
if unique pair.
- [x] Adds `StakingAdmin` origin to staking's `AdminOrigin` type in
westend runtime.
- [x] Determined that worst case 5,900 deprecations does fit into
`maxBlock` `proofSize` and `refTime` in both normal and operational
thresholds, meaning we can deprecate all controllers for each network in
one call.
## Block Weights
By querying `consts.system.blockWeights` we can see that the
`deprecate_controller_batch` weights fit within the `normal` threshold
on Polkadot.
#### `controller_deprecation_batch` where i = 5900:
#### Ref time: 69,933,325,300
#### Proof size: 21,040,390
### Polkadot
```
// consts.query.blockWeights
maxBlock: {
refTime: 2,000,000,000,000
proofSize: 18,446,744,073,709,551,615
}
normal: {
maxExtrinsic: {
refTime: 1,479,873,955,000
proofSize: 13,650,590,614,545,068,195
}
maxTotal: {
refTime: 1,500,000,000,000
proofSize: 13,835,058,055,282,163,711
}
}
```
### Kusama
```
// consts.query.blockWeights
maxBlock: {
refTime: 2,000,000,000,000
proofSize: 18,446,744,073,709,551,615
}
normal: {
maxExtrinsic: {
refTime: 1,479,875,294,000
proofSize: 13,650,590,614,545,068,195
}
maxTotal: {
refTime: 1,500,000,000,000
proofSize: 13,835,058,055,282,163,711
}
}
```
---------
Co-authored-by: command-bot <>
Co-authored-by:
Gonçalo Pestana <g6pestana@gmail.com>
Showing
- polkadot/runtime/test-runtime/src/lib.rs 1 addition, 0 deletionspolkadot/runtime/test-runtime/src/lib.rs
- polkadot/runtime/westend/src/lib.rs 3 additions, 1 deletionpolkadot/runtime/westend/src/lib.rs
- polkadot/runtime/westend/src/weights/pallet_staking.rs 118 additions, 96 deletionspolkadot/runtime/westend/src/weights/pallet_staking.rs
- substrate/bin/node/runtime/src/lib.rs 2 additions, 0 deletionssubstrate/bin/node/runtime/src/lib.rs
- substrate/frame/babe/src/mock.rs 1 addition, 0 deletionssubstrate/frame/babe/src/mock.rs
- substrate/frame/beefy/src/mock.rs 1 addition, 0 deletionssubstrate/frame/beefy/src/mock.rs
- substrate/frame/election-provider-multi-phase/test-staking-e2e/src/mock.rs 1 addition, 0 deletions...lection-provider-multi-phase/test-staking-e2e/src/mock.rs
- substrate/frame/fast-unstake/src/mock.rs 1 addition, 0 deletionssubstrate/frame/fast-unstake/src/mock.rs
- substrate/frame/grandpa/src/mock.rs 1 addition, 0 deletionssubstrate/frame/grandpa/src/mock.rs
- substrate/frame/nomination-pools/benchmarking/src/mock.rs 1 addition, 0 deletionssubstrate/frame/nomination-pools/benchmarking/src/mock.rs
- substrate/frame/nomination-pools/test-staking/src/mock.rs 1 addition, 0 deletionssubstrate/frame/nomination-pools/test-staking/src/mock.rs
- substrate/frame/offences/benchmarking/src/mock.rs 1 addition, 0 deletionssubstrate/frame/offences/benchmarking/src/mock.rs
- substrate/frame/root-offences/src/mock.rs 1 addition, 0 deletionssubstrate/frame/root-offences/src/mock.rs
- substrate/frame/session/benchmarking/src/mock.rs 1 addition, 0 deletionssubstrate/frame/session/benchmarking/src/mock.rs
- substrate/frame/staking/src/benchmarking.rs 34 additions, 0 deletionssubstrate/frame/staking/src/benchmarking.rs
- substrate/frame/staking/src/mock.rs 2 additions, 0 deletionssubstrate/frame/staking/src/mock.rs
- substrate/frame/staking/src/pallet/mod.rs 53 additions, 3 deletionssubstrate/frame/staking/src/pallet/mod.rs
- substrate/frame/staking/src/tests.rs 178 additions, 1 deletionsubstrate/frame/staking/src/tests.rs
- substrate/frame/staking/src/weights.rs 223 additions, 184 deletionssubstrate/frame/staking/src/weights.rs
Please register or sign in to comment