Pools: Add ability to configure commission claiming permissions (#2474)
Addresses #409. This request has been raised by multiple community members - the ability for the nomination pool root role to configure permissionless commission claiming: > Would it be possible to have a claim_commission_other extrinsic for claiming commission of nomination pools permissionless? This PR does not quite introduce this additional call, but amends `do_claim_commission` to check a new `claim_permission` field in the `Commission` struct, configured by an enum: ``` enum CommissionClaimPermission { Permissionless, Account(AccountId), } ``` This can be optionally set in a bonded pool's `commission.claim_permission` field: ``` struct BondedPool { commission: { <snip> claim_permission: Option<CommissionClaimPermission<T::AccountId>>, }, <snip> } ``` This is a new field and requires a migration to add it to existing pools. This will be `None` on pool creation, falling back to the `root` role having sole access to claim commission if it is not set; this is the behaviour as it is today. Once set, the field _can_ be set to `None` again. #### Changes - [x] Add `commision.claim_permission` field. - [x] Add `can_claim_commission` and amend `do_claim_commission`. - [x] Add `set_commission_claim_permission` call. - [x] Test to cover new configs and call. - [x] Add and amend benchmarks. - [x] Generate new weights + slot into call `set_commission_claim_permission`. - [x] Add migration to introduce `commission.claim_permission`, bump storage version. - [x] Update Westend weights. - [x] Migration working. --------- Co-authored-by: command-bot <>
parent
2ac23d24
Showing
- polkadot/runtime/westend/src/lib.rs 1 addition, 2 deletionspolkadot/runtime/westend/src/lib.rs
- polkadot/runtime/westend/src/weights/pallet_nomination_pools.rs 149 additions, 127 deletions...ot/runtime/westend/src/weights/pallet_nomination_pools.rs
- substrate/frame/nomination-pools/benchmarking/src/lib.rs 35 additions, 6 deletionssubstrate/frame/nomination-pools/benchmarking/src/lib.rs
- substrate/frame/nomination-pools/src/lib.rs 55 additions, 3 deletionssubstrate/frame/nomination-pools/src/lib.rs
- substrate/frame/nomination-pools/src/migration.rs 77 additions, 0 deletionssubstrate/frame/nomination-pools/src/migration.rs
- substrate/frame/nomination-pools/src/tests.rs 194 additions, 17 deletionssubstrate/frame/nomination-pools/src/tests.rs
- substrate/frame/nomination-pools/src/weights.rs 285 additions, 238 deletionssubstrate/frame/nomination-pools/src/weights.rs
Please register or sign in to comment