Skip to content
Unverified Commit 282eaaa5 authored by Ankan's avatar Ankan Committed by GitHub
Browse files

[Staking] Delegators can stake but stakers can't delegate (#4904)

Related: https://github.com/paritytech/polkadot-sdk/pull/4804.
Fixes the try state error in Westend:
https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/6564522.
Passes here:
https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/6580393

## Context
Currently in Kusama and Polkadot, an account can do both, directly
stake, and join a pool.

With the migration of pools to `DelegateStake` (See
https://github.com/paritytech/polkadot-sdk/pull/3905), the funds of pool
members are locked in a different way than for direct stakers.
- Pool member funds uses `holds`.
- `pallet-staking` uses deprecated locks (analogous to freeze) which can
overlap with holds.

An existing delegator can stake directly since pallet-staking only uses
free balance. But once an account becomes staker, we cannot allow them
to be delegator as this risks an account to use already staked (frozen)
funds in pools.

When an account gets into a situation where it is participating in both
pools and staking, it would no longer would be able to add any extra
bond to the pool but they can still withdraw funds.

## Changes
- Add test for the above scenario.
- Removes the assumption that a delegator cannot be a staker.
parent b6f18232
Pipeline #483805 waiting for manual action with stages
in 1 hour, 20 minutes, and 12 seconds