Skip to content
Snippets Groups Projects
  • Ankan's avatar
    Introduces: Delegated Staking Pallet (#3904) · 4d47b443
    Ankan authored
    This is the second PR in preparation for
    https://github.com/paritytech/polkadot-sdk/issues/454.
    
    ## Also see
    - **Precursor** https://github.com/paritytech/polkadot-sdk/pull/3889.
    - **Follow up** https://github.com/paritytech/polkadot-sdk/pull/3905.
    
    Overall changes are documented here (lot more visual 😍
    
    ):
    https://hackmd.io/@ak0n/454-np-governance
    
    ## Changes
    ### Delegation Interface
    Provides delegation primitives for staking. 
    
    Introduces two new roles:
    - Agent: These are accounts who receive delegation from other accounts
    (delegators) and stakes on behalf of them. The funds are held in
    delegator accounts.
    - Delegator: Accounts who delegate their funds to an agent authorising
    them to use it for staking.
    
    Supports
    - A way for delegators to add or withdraw delegation to an agent.
    - A way for an agent to slash a delegator during a slashing event.
    
    ### Pallet Delegated Staking
    - Implements `DelegationInterface`.
    - Lazy slashing: Any slashes to an Agent is posted in a ledger but not
    immediately slashed. The agent can call
    `DelegationInterface::delegator_slash` to slash the member and clear the
    corresponding slash from its ledger.
    - Consumes `StakingInterface` to provide `CoreStaking` features. In
    reality, this will be `pallet-staking`.
    - Ensures bookkeeping for agent and delegator are correct but leaves the
    management of reward and slash logic upto the consumer of this pallet.
    - While it does not expose any calls yet, it is written with the intent
    of exposing these primitives via extrinsics.
    
    ## TODO
    - [x] Improve unit tests in the pallet.
    - [x] Separate slash reward perbill for rewarding the slash reporters?
    - [x] Review if we should add more events.
    
    ---------
    
    Co-authored-by: default avatarKian Paimani <5588131+kianenigma@users.noreply.github.com>
    Co-authored-by: default avatarGonçalo Pestana <g6pestana@gmail.com>
    Co-authored-by: default avatargeorgepisaltu <52418509+georgepisaltu@users.noreply.github.com>
    Unverified
    4d47b443
Code owners
Assign users and groups as approvers for specific file changes. Learn more.