Add extra check for competing proof + sort by nonce on ring buffer#7891
Add extra check for competing proof + sort by nonce on ring buffer#7891sstanculeanu wants to merge 5 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## feat/testnet-fixes #7891 +/- ##
===================================================
Coverage 77.74% 77.74%
===================================================
Files 887 887
Lines 126451 126462 +11
===================================================
+ Hits 98309 98318 +9
Misses 21644 21644
- Partials 6498 6500 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…-chain-go into medium-findings # Conflicts: # consensus/spos/bls/v2/subroundEndRound.go
There was a problem hiding this comment.
Pull request overview
This PR tightens consensus behavior and sync heuristics by adding an extra guard when a competing proof exists, and by adjusting nonce sequence detection logic to be nonce-ordered rather than arrival-ordered. It also introduces/validates a new process config knob used by the sync logic and updates test defaults accordingly.
Changes:
- Drop received signature shares during EndRound when a competing block proof is detected.
- Sort the “recent desynced nonces” sample before checking consecutivity to better handle out-of-order proof arrivals.
- Add
RoundModulusTriggerWhenSyncIsStuckdefaults + validation, and extend unit tests to cover the new validation.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| testscommon/components/configs.go | Adds the new round-level process config default used in tests/common setups. |
| consensus/spos/bls/v2/subroundEndRound.go | Drops signatures early when a competing proof is present. |
| consensus/spos/bls/ntpsync/roundSyncController.go | Sorts nonce samples before consecutivity check to make resync trigger independent of arrival order. |
| common/configs/processConfigs.go | Validates RoundModulusTriggerWhenSyncIsStuck is non-zero to prevent modulo-by-zero. |
| common/configs/processConfigs_test.go | Updates configs used in tests and adds a test for the new validation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -95,6 +96,8 @@ func areNoncesInAscendingOrder(nonces []uint64) bool { | |||
| return false | |||
| } | |||
|
|
|||
| slices.Sort(nonces) | |||
| if cfg.RoundModulusTriggerWhenSyncIsStuck == 0 { | ||
| return fmt.Errorf("%w for RoundModulusTriggerWhenSyncIsStuck", process.ErrInvalidValue) | ||
| } |
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?