Skip to content

Subrounds timing by epoch - #7881

Merged
sstanculeanu merged 13 commits into
feat/testnet-fixesfrom
subrounds-timing-by-epoch
Jun 30, 2026
Merged

Subrounds timing by epoch#7881
sstanculeanu merged 13 commits into
feat/testnet-fixesfrom
subrounds-timing-by-epoch

Conversation

@sstanculeanu

Copy link
Copy Markdown
Collaborator

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:

  • was the PR targeted to the correct branch?
  • if this is a larger feature that probably needs more than one PR, is there a feat branch created?
  • if this is a feat branch merging, do all satellite projects have a proper tag inside go.mod?

@sstanculeanu sstanculeanu self-assigned this Jun 16, 2026
@sstanculeanu sstanculeanu added the ignore-for-release-notes Do not include item in release notes label Jun 16, 2026
@codecov

codecov Bot commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.26752% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.70%. Comparing base (4884240) to head (1e36a24).
⚠️ Report is 14 commits behind head on feat/testnet-fixes.

Files with missing lines Patch % Lines
consensus/spos/bls/proxy/subroundsHandler.go 86.53% 4 Missing and 3 partials ⚠️
common/configs/commonConfigs.go 96.00% 2 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*optional: keep the constants for v1, and update the factory only for v2

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tried to keep similar flow

Comment thread cmd/node/config/config.toml Outdated
Comment on lines +113 to +117
SubroundStartStartTime = 0.0,
SubroundStartEndTime = 0.05,
SubroundBlockStartTime = 0.05,
SubroundBlockEndTime = 0.25,
SubroundSignatureStartTime = 0.25,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*optional: remove Subround prefix

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it would be clear enough, StartStartTime, BlockStartTime, etc

@AdoAdoAdo
AdoAdoAdo self-requested a review June 24, 2026 13:47
Comment thread consensus/spos/bls/v2/subroundBlock.go Outdated
currentEpoch := headerHandler.GetEpoch()

sigSubroundEndTime := time.Duration(float64(sr.RoundHandler().TimeDuration()) * srSignatureEndTime)
sigSubroundEndTime := time.Duration(sr.EndTime())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread cmd/node/config/config.toml Outdated
},
{
EnableEpoch = 1,
NumRoundsToWaitBeforeSignalingChronologyStuck = 10,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this is identical with the previous config, we can probably remove it from the config?

Comment thread cmd/node/config/config.toml Outdated
}
},
{
EnableEpoch = 2,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

ConsensusConfigsByEpoch = [
{ EnableEpoch = 0, NumRoundsToWaitBeforeSignalingChronologyStuck = 10 },
{ EnableEpoch = 2, NumRoundsToWaitBeforeSignalingChronologyStuck = 100 },
{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

Comment on lines +119 to +120
round := uint64(fct.consensusCore.RoundHandler().Index())
timing := fct.commonConfigsHandler.GetSubroundsTimingByRound(round)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, fixed

AdoAdoAdo
AdoAdoAdo previously approved these changes Jun 30, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ConsensusConfigsByRound and SubroundTiming to 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 CommonConfigsHandler based 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.

Comment thread common/configs/errors.go Outdated
Comment thread common/configs/commonConfigs.go Outdated
Comment thread common/configs/commonConfigs_test.go Outdated
Comment on lines +84 to +88
// RoundConfirmed is called when a new round is confirmed
func (s *SubroundsHandler) RoundConfirmed(round uint64, _ uint64) {
s.mutReInit.Lock()
defer s.mutReInit.Unlock()

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

@ssd04

ssd04 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

no other things from me

AdoAdoAdo
AdoAdoAdo previously approved these changes Jun 30, 2026
@sstanculeanu
sstanculeanu merged commit f93bba8 into feat/testnet-fixes Jun 30, 2026
11 checks passed
@sstanculeanu
sstanculeanu deleted the subrounds-timing-by-epoch branch June 30, 2026 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ignore-for-release-notes Do not include item in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants