Skip to content

Full Unbond in Staking#3811

Merged
Ank4n merged 71 commits intoparitytech:masterfrom
dharjeezy:dami/full_unbond
Apr 21, 2025
Merged

Full Unbond in Staking#3811
Ank4n merged 71 commits intoparitytech:masterfrom
dharjeezy:dami/full_unbond

Conversation

@dharjeezy
Copy link
Copy Markdown
Contributor

@dharjeezy dharjeezy commented Mar 24, 2024

closes #414

Polkadot address: 12GyGD3QhT4i2JJpNzvMf96sxxBLWymz4RdGCxRH5Rj5agKW

@dharjeezy dharjeezy changed the title Dami/full unbond Full Unbond in Staking Mar 24, 2024
@dharjeezy
Copy link
Copy Markdown
Contributor Author

@Ank4n according to @kianenigma we want to fully unbond everything after chilling. Therefore, the extrinsic don't need to take any value, also there will be no need to add a check for minimum active bond which you suggested earlier here. #3629 (comment)

Also, if we want to do a chill also when we expect a value, we can definitely do that in the unbond extrinsic. should i go ahead and include that?

@Ank4n
Copy link
Copy Markdown
Contributor

Ank4n commented Mar 27, 2024

@kianenigma wdyt about call::unbond doing chill implicitly if it is a full unbond (unbond value == ledger.total)?

@kianenigma
Copy link
Copy Markdown
Contributor

@kianenigma wdyt about call::unbond doing chill implicitly if it is a full unbond (unbond value == ledger.total)?

This is also fine with me, no strong opinion. I like your idea better as it improves UX without wallets needing to do much.

@dharjeezy
Copy link
Copy Markdown
Contributor Author

OK. So, should we still keep the full unbond extrinsic and also implement the implicit one that @Ank4n is suggesting?

@paritytech-review-bot paritytech-review-bot bot requested a review from a team April 9, 2024 09:14
# Conflicts:
#	polkadot/runtime/westend/src/weights/pallet_staking.rs
#	substrate/frame/staking/src/benchmarking.rs
#	substrate/frame/staking/src/pallet/impls.rs
#	substrate/frame/staking/src/pallet/mod.rs
#	substrate/frame/staking/src/weights.rs
@dharjeezy
Copy link
Copy Markdown
Contributor Author

dharjeezy commented Apr 10, 2024

@Ank4n @kianenigma
I have implicitly added the chill for unbonding

please help review again

Copy link
Copy Markdown
Contributor

@kianenigma kianenigma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, needs more tests (for unbond fully calling chill) and better prdoc and bench etc.

@Ank4n
Copy link
Copy Markdown
Contributor

Ank4n commented Mar 1, 2025

bot fmt

@command-bot
Copy link
Copy Markdown

command-bot bot commented Mar 1, 2025

@Ank4n https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/8297709 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/fmt/fmt.sh". Check out https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/pipelines?page=1&scope=all&username=group_605_bot to know what else is being executed currently.

Comment bot cancel 1-2aa2aa3b-d7d6-4478-8215-5bc6cd36cbda to cancel this command or bot cancel to cancel all commands in this pull request.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 1, 2025

We have migrated the command bot to GHA

Please, see the new usage instructions here or here. Soon the old commands will be disabled.

@command-bot
Copy link
Copy Markdown

command-bot bot commented Mar 1, 2025

@Ank4n Command "$PIPELINE_SCRIPTS_DIR/commands/fmt/fmt.sh" has finished. Result: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/8297709 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/8297709/artifacts/download.

# Conflicts:
#	substrate/frame/staking/src/pallet/impls.rs
@dharjeezy
Copy link
Copy Markdown
Contributor Author

@Ank4n can we get this merge please. 🙏

@Ank4n Ank4n added this pull request to the merge queue Apr 21, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 21, 2025
@Ank4n Ank4n added this pull request to the merge queue Apr 21, 2025
Merged via the queue into paritytech:master with commit fe46832 Apr 21, 2025
233 of 244 checks passed
@Ank4n
Copy link
Copy Markdown
Contributor

Ank4n commented Apr 21, 2025

@kianenigma can you tip @dharjeezy?

@kianenigma
Copy link
Copy Markdown
Contributor

/tip medium

@substrate-tip-bot
Copy link
Copy Markdown

@kianenigma A referendum for a medium (80 DOT) tip was successfully submitted for @dharjeezy (12GyGD3QhT4i2JJpNzvMf96sxxBLWymz4RdGCxRH5Rj5agKW on polkadot).

Referendum number: 1534.
tip

@substrate-tip-bot
Copy link
Copy Markdown

The referendum has appeared on Polkassembly.

castillax pushed a commit that referenced this pull request May 12, 2025
closes #414

Polkadot address: 12GyGD3QhT4i2JJpNzvMf96sxxBLWymz4RdGCxRH5Rj5agKW

---------

Co-authored-by: Ankan <10196091+Ank4n@users.noreply.github.com>
Co-authored-by: command-bot <>
Co-authored-by: Gonçalo Pestana <g6pestana@gmail.com>
Co-authored-by: Ankan <ankan.anurag@gmail.com>
github-merge-queue bot pushed a commit that referenced this pull request Jun 10, 2025
## Changes
- Introduced a new `min_bond` value, which is the minimum of
`MinValidatorBond` and `MinNominatorBond`, with a fallback to
`ExistentialDeposit`. Since ED on AH is much lower than on RC, this
ensures we enforce some min bonds for staking to cover storage costs for
staking ledger and related data.
- Added an upper bound on era duration, protecting against anomalous
conditions that could otherwise lead to excessive inflation.
- Some refactors to gracefully handle unexpected validator activation in
RC.


## TODO
- [ ] Set `MaxEraDuration` in WAH.
- [ ] Port [full
unbond](#3811) (will do
in a separate PR)

---------

Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
pgherveou pushed a commit that referenced this pull request Jun 11, 2025
## Changes
- Introduced a new `min_bond` value, which is the minimum of
`MinValidatorBond` and `MinNominatorBond`, with a fallback to
`ExistentialDeposit`. Since ED on AH is much lower than on RC, this
ensures we enforce some min bonds for staking to cover storage costs for
staking ledger and related data.
- Added an upper bound on era duration, protecting against anomalous
conditions that could otherwise lead to excessive inflation.
- Some refactors to gracefully handle unexpected validator activation in
RC.


## TODO
- [ ] Set `MaxEraDuration` in WAH.
- [ ] Port [full
unbond](#3811) (will do
in a separate PR)

---------

Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
alvicsam pushed a commit that referenced this pull request Oct 17, 2025
## Changes
- Introduced a new `min_bond` value, which is the minimum of
`MinValidatorBond` and `MinNominatorBond`, with a fallback to
`ExistentialDeposit`. Since ED on AH is much lower than on RC, this
ensures we enforce some min bonds for staking to cover storage costs for
staking ledger and related data.
- Added an upper bound on era duration, protecting against anomalous
conditions that could otherwise lead to excessive inflation.
- Some refactors to gracefully handle unexpected validator activation in
RC.


## TODO
- [ ] Set `MaxEraDuration` in WAH.
- [ ] Port [full
unbond](#3811) (will do
in a separate PR)

---------

Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
github-merge-queue bot pushed a commit that referenced this pull request Jan 14, 2026
…10502)

## Context
We want to make nominators unslashable (configurable via a storage set),
and once they are unslashable, they can also unbond and withdraw in 2
era instead of the full BondingDuration (28 eras).

## Storage Changes
- `AreNominatorsSlashable: StorageValue<bool>` (default: true):
Runtime-configurable flag. Made this a storage value (not a config
constant) so it can be enabled together with MinValidatorBond and
MinCommission via `set_staking_configs`.
- `ErasNominatorsSlashable: StorageMap<EraIndex, bool>` (default: true):
Per-era snapshot of slashability setting. This ensures offences are
processed with the rules that were in effect at the time of the offence,
not the current rules. Cleaned up automatically for eras outside bonding
window.
- `LastValidatorEra` to track if a staker was a validator in a recent
era and hence needs to follow full unbonding time. Does not need
migration as long as we disable nominator slash (in other words: reduce
their unbond time) at least one era after these changes are applied.

## Slashing logic
- Added `process_offence_validator_only` as a separate code path instead
of overloading the same function. See `process_offence_for_era` in
`substrate/frame/staking-async/src/slashing.rs`.
- We might want to remove nominator slashing code completely at some
point.

## Unbonding logic:
- Introduce new config constant `NominatorFastUnbondDuration` that
determines the fast unbond duration (recommended value: 2 eras) when
nominators are not slashable.
- Added `nominator_bonding_duration()` to `StakingInterface` trait
(returns `NominatorFastUnbondDuration` era when not slashable, full
unbond duration otherwise).
- Nomination pools now use `nominator_bonding_duration()`, so pool
members also benefit from fast unbonding.
- Ported auto-chill on full unbond from pallet-staking (PR #3811) to
prevent `InsufficientBond` errors.
- Nominators unbonding the era before the nominators become unslashable
will still have 28 days of unbonding.

## Era pruning:
- Moved pruning of `ValidatorSlashInEra` as well as
`ErasNominatorsSlashable` in lazy pruning. This has a minor (I believe
acceptable) side effect that they will be cleaned up in 84 eras instead
of 28 eras.
---

## TODO
- [x] Ensure delegator slash works correctly (nomination pool). 
- [x] Ensure pool members can unbond in 1 day as well.
- [x] Benchmark update.
- [x] Document how all three can be changed in one go: `MinCommission`,
`MinValidatorBond`, and `AreNominatorsSlashable`.
- [x] Regenerate weight
- [x] Make nominator unbonding time configurable and set it to 2 eras.
- [x] Refactor compute slash to avoid calling `slash_nominator`
completely.

---------

Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T2-pallets This PR/Issue is related to a particular pallet.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Staking force_unbond

7 participants