feat(beefy): allow non-consecutive validator set updates within a trusting period#1802
Draft
yrong wants to merge 2 commits into
Draft
feat(beefy): allow non-consecutive validator set updates within a trusting period#1802yrong wants to merge 2 commits into
yrong wants to merge 2 commits into
Conversation
…sting period Permit a commitment from a later session to be authenticated against the current validator set (a "skip-ahead"), instead of requiring a consecutive handover per session. This is gated to remain safe: - canSkipAhead requires the id to be strictly ahead of the next set AND the era to be confirmed-stable (current.root == next.root), so signatures legitimately verify against the current root. - A skip is only allowed while the current set is within `trustingPeriod` (14 days, < Polkadot's 28-day unbonding) measured by Ethereum's block.timestamp, so the set is provably still bonded and its honest-supermajority assumption holds. Past the window it reverts TrustingPeriodExpired. - applySkip fast-forwards the current id (root preserved) and loads next from the leaf, but never refreshes currentSetActivatedAt, preventing a ratchet of the trust window. Genuine handovers re-anchor it, which keeps skips available across long eras (every era boundary forces a witnessed handover). Wired into submitInitial, submitFinal, submitFiatShamir and createFiatShamirFinalBitfield. Adds BeefyClientSkipAhead.t.sol covering the interactive skip success (id advances, root preserved, no ratchet), window-expiry rejection on both paths, era-change-pending rejection, stale-id rejection, and handover re-anchoring. Note: the relayer Go binding needs regenerating for the new currentSetActivatedAt and trustingPeriod getters.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1802 +/- ##
==========================================
- Coverage 78.90% 78.70% -0.21%
==========================================
Files 24 24
Lines 986 1019 +33
Branches 187 197 +10
==========================================
+ Hits 778 802 +24
- Misses 185 191 +6
- Partials 23 26 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Context
#1137 (comment)
Permit a commitment from a later session to be authenticated against the current validator set (a "skip-ahead"), instead of requiring a consecutive handover per session. This is gated to remain safe:
trustingPeriod(14 days, < Polkadot's 28-day unbonding) measured by Ethereum's block.timestamp, so the set is provably still bonded and its honest-supermajority assumption holds. Past the window it reverts TrustingPeriodExpired.Wired into submitInitial, submitFinal, submitFiatShamir and createFiatShamirFinalBitfield.
Note: the relayer Go binding needs regenerating for the new currentSetActivatedAt and trustingPeriod getters.