Skip to content
  • Ross Bulat's avatar
    Pools: Add ability to configure commission claiming permissions (#2474) · 75062717
    Ross Bulat authored
    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 <>
    75062717