Subrounds timing by epoch - #7881
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## feat/testnet-fixes #7881 +/- ##
====================================================
Coverage 77.69% 77.70%
====================================================
Files 885 885
Lines 125677 125781 +104
====================================================
+ Hits 97649 97742 +93
- Misses 21562 21570 +8
- Partials 6466 6469 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
*optional: keep the constants for v1, and update the factory only for v2
There was a problem hiding this comment.
tried to keep similar flow
| SubroundStartStartTime = 0.0, | ||
| SubroundStartEndTime = 0.05, | ||
| SubroundBlockStartTime = 0.05, | ||
| SubroundBlockEndTime = 0.25, | ||
| SubroundSignatureStartTime = 0.25, |
There was a problem hiding this comment.
*optional: remove Subround prefix
There was a problem hiding this comment.
I don't think it would be clear enough, StartStartTime, BlockStartTime, etc
| currentEpoch := headerHandler.GetEpoch() | ||
|
|
||
| sigSubroundEndTime := time.Duration(float64(sr.RoundHandler().TimeDuration()) * srSignatureEndTime) | ||
| sigSubroundEndTime := time.Duration(sr.EndTime()) |
There was a problem hiding this comment.
I think this needs to be set back to the srSignatureEndTime, as here we are triggering optimistically the signing that ends at the end of subround signature.
| }, | ||
| { | ||
| EnableEpoch = 1, | ||
| NumRoundsToWaitBeforeSignalingChronologyStuck = 10, |
There was a problem hiding this comment.
if this is identical with the previous config, we can probably remove it from the config?
| } | ||
| }, | ||
| { | ||
| EnableEpoch = 2, |
There was a problem hiding this comment.
For Supernova I think we need also the round activation for the timing change - so only on both conditions we should change the timing there.
| ConsensusConfigsByEpoch = [ | ||
| { EnableEpoch = 0, NumRoundsToWaitBeforeSignalingChronologyStuck = 10 }, | ||
| { EnableEpoch = 2, NumRoundsToWaitBeforeSignalingChronologyStuck = 100 }, | ||
| { |
There was a problem hiding this comment.
can you create a validation func for each epoch config where it is loaded into the component requiring it/init?
e.g
- non negative values
- every subround has a start and end value, start<end
- no overlapping range between subrounds
- increasing values between subrounds (start subround n+1 > end subround n)
- max value < 1.
| round := uint64(fct.consensusCore.RoundHandler().Index()) | ||
| timing := fct.commonConfigsHandler.GetSubroundsTimingByRound(round) |
There was a problem hiding this comment.
in RoundConfirmed we are setting timings based on received round, and here based on current consensus round, i'm thinking if they might not match; if RoundConfirmed is triggered from the processing flow, then they might be fetched for different rounds
There was a problem hiding this comment.
good catch, fixed
There was a problem hiding this comment.
Pull request overview
This PR introduces round-based consensus timing configuration, allowing subround start/end ratios and processing thresholds to be selected by round boundary and applied to BLS subround generation (v1/v2), including re-generation when timing boundaries change.
Changes:
- Adds
ConsensusConfigsByRoundandSubroundTimingto the node configuration model and TOML, with validation and getters in the common configs handler. - Updates BLS subround factories (v1/v2) to derive subround timings and processing thresholds from
CommonConfigsHandlerbased on the current round. - Extends the proxy subrounds handler to listen for round changes and re-generate subrounds when the active timing boundary changes; updates related stubs/tests/config fixtures accordingly.
Reviewed changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| testscommon/generalConfig.go | Adds default ConsensusConfigsByRound to test general config. |
| testscommon/epochStartConfigsHandlerStub.go | Updates common configs stub creation and adds stub methods for timing-by-round. |
| testscommon/components/configs.go | Adds default ConsensusConfigsByRound to component test config. |
| node/chainSimulator/components/coreComponents.go | Passes ConsensusConfigsByRound into common configs handler construction. |
| node/chainSimulator/components/coreComponents_test.go | Adds ConsensusConfigsByRound to simulator test args. |
| integrationTests/testProcessorNode.go | Adjusts imports and provides a RoundNotifierField in default core components for integration tests. |
| factory/core/coreComponents.go | Passes ConsensusConfigsByRound into common configs handler construction. |
| factory/consensus/consensusComponents.go | Wires CommonConfigsHandler and RoundNotifier into consensus component args. |
| factory/consensus/consensusComponents_test.go | Adds a RoundChangeNotifier stub to consensus factory test args. |
| consensus/spos/bls/v2/subroundBlock.go | Makes signature subround end time configurable via constructor field. |
| consensus/spos/bls/v2/subroundBlock_test.go | Updates constructor calls to include configured signature subround end time. |
| consensus/spos/bls/v2/export_test.go | Replaces exported internal constants with test-local config defaults passed into generators. |
| consensus/spos/bls/v2/constants.go | Removes hardcoded processing/timing constants (now config-driven). |
| consensus/spos/bls/v2/blsSubroundsFactory.go | Uses CommonConfigsHandler timing-by-round to build subrounds (and passes signature end time to block subround). |
| consensus/spos/bls/v2/blsSubroundsFactory_test.go | Updates factory construction and GenerateSubrounds signature; adds tests around passing the round into timing selection. |
| consensus/spos/bls/v1/export_test.go | Mirrors v2 export_test changes using test-local config defaults. |
| consensus/spos/bls/v1/constants.go | Removes hardcoded processing/timing constants (now config-driven). |
| consensus/spos/bls/v1/blsSubroundsFactory.go | Uses CommonConfigsHandler timing-by-round to build subrounds and updates GenerateSubrounds signature. |
| consensus/spos/bls/v1/blsSubroundsFactory_test.go | Updates factory construction and GenerateSubrounds signature; adds nil-common-configs-handler coverage. |
| consensus/spos/bls/proxy/subroundsHandler.go | Adds round-change handling to re-generate subrounds when the active timing boundary changes; introduces synchronization/state fields. |
| consensus/spos/bls/proxy/subroundsHandler_test.go | Updates handler args and adds nil round notifier coverage; adjusts flag checks. |
| consensus/spos/bls/proxy/errors.go | Adds ErrNilRoundNotifier. |
| consensus/chronology/chronology.go | Removes an outdated TODO comment during Supernova transition handling. |
| config/config.go | Introduces ConsensusConfigByRound + SubroundTiming and adds ConsensusConfigsByRound to general settings. |
| common/interface.go | Extends CommonConfigsHandler with timing-by-round getters. |
| common/configs/errors.go | Adds consensus-by-round validation errors. |
| common/configs/commonConfigs.go | Stores/validates consensus-by-round configs; adds getters for timing and active boundary round. |
| common/configs/commonConfigs_test.go | Expands tests for consensus-by-round validation and getter behavior. |
| cmd/node/config/config.toml | Adds ConsensusConfigsByRound examples to node config. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // RoundConfirmed is called when a new round is confirmed | ||
| func (s *SubroundsHandler) RoundConfirmed(round uint64, _ uint64) { | ||
| s.mutReInit.Lock() | ||
| defer s.mutReInit.Unlock() | ||
|
|
|
no other things from me |
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?