trigger recovery hardening - #7991
Open
AdoAdoAdo wants to merge 18 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens epoch-start trigger recovery by shifting shard-block epoch mismatch handling to the epoch start trigger, introducing Supernova-specific recovery tracking (candidates + generation), and extending request handling to support epoch-stamped meta-header requests.
Changes:
- Delegate epoch mismatch remediation from
shardProcessor.checkEpochCorrectnesstoEpochStartTrigger.RequestEpochStartIfNeeded. - Add Supernova epoch-start recovery state machine (candidates/pending data + generation gating + close/reset behavior) and broaden related test coverage.
- Extend the epochStart
RequestHandlerAPI to support epoch-aware meta-header-by-hash/nonce requests and update callers/tests accordingly.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| process/mock/endOfEpochTriggerStub.go | Extends the epoch start trigger stub to allow observing RequestEpochStartIfNeeded calls in tests. |
| process/block/shardblock.go | Replaces local “evict + request” logic with trigger notification on epoch mismatch. |
| process/block/shardblock_test.go | Updates tests to assert trigger notification instead of header eviction/request side effects. |
| epochStart/shardchain/triggerRegistry.go | Resets pending recovery state after loading trigger state. |
| epochStart/shardchain/triggerRegistry_test.go | Adjusts cloning/equality logic to account for new recovery fields/generation. |
| epochStart/shardchain/trigger.go | Implements Supernova recovery tracking, generation-based stale-state protection, and epoch-stamped neighbor requests. |
| epochStart/shardchain/trigger_test.go | Adds targeted tests for Supernova recovery flows and generation/close behavior. |
| epochStart/mock/validatorInfoSyncerStub.go | Makes the syncer stub callbacks configurable for new recovery tests. |
| epochStart/interface.go | Extends request handler interface with epoch-aware meta-header request methods. |
Suppressed comments (2)
epochStart/shardchain/trigger_test.go:754
- Using a fixed
time.Sleep(50ms)to assert that no second sync happens can make the test nondeterministic (it may pass/fail depending on timing). It’s more robust to assert the invariants hold for a short bounded interval.
tr.RequestEpochStartIfNeeded(header)
time.Sleep(50 * time.Millisecond)
require.Equal(t, int32(1), syncCalls.Load())
require.Equal(t, 1, numRecoveryCandidates(tr))
epochStart/shardchain/trigger_test.go:799
- Same flakiness concern here: a single
time.Sleep(50ms)doesn’t reliably prove no second async call occurs. Consider checking the counters remain stable over a bounded interval instead.
tr.RequestEpochStartIfNeeded(header)
time.Sleep(50 * time.Millisecond)
require.Equal(t, int32(1), syncCalls.Load())
require.Equal(t, 1, numRecoveryCandidates(tr))
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+1077
to
+1099
| @@ -713,13 +1096,24 @@ func (t *trigger) pendingEpochStartDataSnapshot() (map[string]pendingEpochStartP | |||
| pendingHeaders[epoch] = struct{}{} | |||
| } | |||
|
|
|||
| return pending, pendingHeaders | |||
| return t.epoch, pending, pendingHeaders, t.recoveryGeneration | |||
Base automatically changed from
epoch-start-trigger-fix
to
refactor-contended-headers-gate
August 27, 2026 09:11
raduchis
approved these changes
Aug 28, 2026
ssd04
approved these changes
Aug 28, 2026
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.
Reasoning behind the pull request
Proposed changes
Testing procedure
Pre-requisites
Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:
featbranch created?featbranch merging, do all satellite projects have a proper tag insidego.mod?