-
Notifications
You must be signed in to change notification settings - Fork 823
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
[Staking] Bounded Slashing: Paginated Offence Processing & Slash Application #7424
Merged
Conversation
This file contains 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
…into gpestana/epm-mb
kianenigma
approved these changes
Feb 15, 2025
github-merge-queue bot
pushed a commit
that referenced
this pull request
Feb 15, 2025
## Multi Block Election Pallet This PR adds the first iteration of the multi-block staking pallet. From this point onwards, the staking and its election provider pallets are being customized to work in AssetHub. While usage in solo-chains is still possible, it is not longer the main focus of this pallet. For a safer usage, please fork and user an older version of this pallet. --- ## Replaces - [x] #6034 - [x] #5272 ## Related PRs: - [x] #7483 - [ ] #7357 - [ ] #7424 - [ ] paritytech/polkadot-staking-miner#955 This branch can be periodically merged into #7358 -> #6996 ## TODOs: - [x] rebase to master - Benchmarking for staking critical path - [x] snapshot - [x] election result - Benchmarking for EPMB critical path - [x] snapshot - [x] verification - [x] submission - [x] unsigned submission - [ ] election results fetching - [ ] Fix deletion weights. Either of - [ ] Garbage collector + lazy removal of all paged storage items - [ ] Confirm that deletion is small PoV footprint. - [ ] Move election prediction to be push based. @tdimitrov - [ ] integrity checks for bounds - [ ] Properly benchmark this as a part of CI -- for now I will remove them as they are too slow - [x] add try-state to all pallets - [x] Staking to allow genesis dev accounts to be created internally - [x] Decouple miner config so @niklasad1 can work on the miner 72841b7 - [x] duplicate snapshot page reported by @niklasad1 - [ ] #6520 or equivalent -- during snapshot, `VoterList` must be locked - [ ] Move target snapshot to a separate block --------- Co-authored-by: Gonçalo Pestana <[email protected]> Co-authored-by: Ankan <[email protected]> Co-authored-by: command-bot <> Co-authored-by: Guillaume Thiolliere <[email protected]> Co-authored-by: Giuseppe Re <[email protected]> Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 task
All GitHub workflows were cancelled due to failure one of the required jobs. |
rockbmb
reviewed
Feb 17, 2025
tdimitrov
approved these changes
Feb 17, 2025
12 tasks
seadanda
approved these changes
Feb 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
High level LGTM
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
closes #3610.
helps #6344, but need to migrate storage
Offences::Reports
before we can remove exposure dependency in RC pallets.replaces #6788.
Context
Slashing in staking is unbounded currently, which is a major blocker until staking can move to a parachain (AH).
Current Slashing Process (Unbounded)
Offence Reported
Slash Applied
Proposed Slashing Process (Bounded)
Offence Queueing
Paged Offence Processing (Computing Slash)
EraIndex
(Validator, SlashFraction, PageIndex)
— a unique identifier for each slash pagePaged Slash Application
Worst-Case Block Calculation for Slash Application
Polkadot:
Kusama:
Worst-Case Assumptions:
Calculation:
There might be a more accurate way to calculate this worst-case number, and this estimate could be significantly higher than necessary, but it shouldn’t exceed this value.
Blocks needed: 250 + 20k/256 = ~330 blocks.
Potential Improvement:
Summary of Changes
Storage
New:
OffenceQueue
(StorageDoubleMap)OffenceRecord
OffenceQueueEras
(StorageValue)BoundedVec<EraIndex, BoundingDuration>
ProcessingOffence
(StorageValue)(Era, offending validator account, OffenceRecord)
Changed:
UnappliedSlashes
:StorageMap<K -> Era, V -> Vec<UnappliedSlash>>
StorageDoubleMap<K1 -> Era, K2 -> (validator_acc, perbill, page_index), V -> UnappliedSlash>
Events
SlashComputed { offence_era, slash_era, offender, page }
SlashCancelled { slash_era, slash_key, payout }
Error
InvalidSlashIndex
→ Renamed toInvalidSlashRecord
NotSortedAndUnique
EraNotStarted
Call
cancel_deferred_slash(era, slash_indices: Vec<u32>)
→ Now takes
Vec<(validator_acc, slash_fraction, page_index)>
apply_slash(slash_era, slash_key: (validator_acc, slash_fraction, page_index))
Runtime Config
FullIdentification
is now set to a unit type (()
) / null identity,replacing the previous exposure type for all runtimes using
pallet_session::historical
.TODO
CancelDeferredSlashes
.Followups (tracker link)