-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Ensure withdrawals don’t bypass slashing #9079
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Ank4n
merged 33 commits into
master
from
ankn-prevent-withdraw-while-processing-offence
Jul 28, 2025
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
941fb48
only allow withdraw until the eras for which offences have been proce…
Ank4n 857016b
cargo fmt
Ank4n 34e5ca6
set active era instead of current
Ank4n 737fe41
withdrawal blocking test
Ank4n 5276b42
add test
Ank4n f69886c
minor fixes
Ank4n f9b3af9
make offence queue eras to be weak bounded vec as technically this ca…
Ank4n c65d61c
try state checks to ensure slash health
Ank4n ed04173
drop offences older than slashdeferduration - 1 old. 4 test failing
Ank4n 5520308
test for discarding old offences
Ank4n 899d8f9
fmt
Ank4n 0bb1281
only ignore offence if slash deferral set
Ank4n 1ff876a
almost there, need to block if unapplied slashes from last era.
Ank4n fe43897
finally everything works (fingers crossed); I am dead
Ank4n c0ae8aa
fmt
Ank4n fed49f3
Merge branch 'master' into ankn-prevent-withdraw-while-processing-off…
Ank4n 822f6ab
fix ahm test
Ank4n 6d174b6
fmt
Ank4n 472433b
Merge branch 'master' into ankn-prevent-withdraw-while-processing-off…
Ank4n 9208866
Update crate doc
Ank4n e824c10
update doc
Ank4n e2d3640
fmt
Ank4n 12e0c43
minor edits
Ank4n 60c247a
Merge branch 'master' into ankn-prevent-withdraw-while-processing-off…
Ank4n ed8bbd8
prdoc
Ank4n 1a34989
fix pallet name in prdoc
Ank4n ca46e1a
remove rc client from prdoc
Ank4n c7c1346
Merge branch 'master' into ankn-prevent-withdraw-while-processing-off…
Ank4n 2ed74ef
Merge branch 'master' into ankn-prevent-withdraw-while-processing-off…
Ank4n 45f15d2
Merge branch 'master' into ankn-prevent-withdraw-while-processing-off…
Ank4n 7361c29
fix kian feedback
Ank4n 07a93cf
Merge branch 'master' into ankn-prevent-withdraw-while-processing-off…
Ank4n c25589d
Merge branch 'master' into ankn-prevent-withdraw-while-processing-off…
Ank4n File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| title: "Prevent withdrawals while processing offences" | ||
|
|
||
| doc: | ||
| - audience: Runtime Dev | ||
| description: | | ||
| Adds withdrawal restrictions to prevent users from withdrawing unbonded funds while | ||
| there are unprocessed offences that could result in slashing. This is a defensive | ||
| measure that ensures slashing guarantees are maintained even in extreme edge cases. | ||
|
|
||
| Key changes: | ||
| - Withdrawals are blocked if there are unapplied slashes from the previous era | ||
| (returns `UnappliedSlashesInPreviousEra` error). This occurs when all unapplied | ||
| slashes for an era could not be applied within one era worth of blocks. While | ||
| one era is reserved for applying slashes page by page, if the era rolls over | ||
| before completion, these slashes can only be applied via the permissionless | ||
| `apply_slash` call. | ||
| - Withdrawals are restricted to the minimum of the active era and the last fully | ||
| processed offence era | ||
| - Unbonding chunks are now keyed by active era instead of current era | ||
| - Offences arriving after their intended application era are rejected and emit | ||
| `OffenceTooOld` event | ||
|
|
||
| Both the `UnappliedSlashesInPreviousEra` error and withdrawal restrictions due to | ||
| delayed offence processing are extremely rare scenarios that should not occur under | ||
| normal operation. These are defensive measures to handle edge cases where slash | ||
| processing is delayed beyond expected timelines. | ||
|
|
||
| crates: | ||
| - name: pallet-staking-async | ||
| bump: major |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.