Skip to content

wait for proof before broadcasting#7810

Open
AdoAdoAdo wants to merge 4 commits intofeat/supernova-async-execfrom
improve-delayed-broadcast
Open

wait for proof before broadcasting#7810
AdoAdoAdo wants to merge 4 commits intofeat/supernova-async-execfrom
improve-delayed-broadcast

Conversation

@AdoAdoAdo
Copy link
Copy Markdown
Contributor

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?

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 updates the consensus delayed block broadcast flow to optionally wait for an equivalent proof (metachain) before broadcasting shard block data, gated by the Andromeda enable-epochs flag.

Changes:

  • Extend sposFactory.GetBroadcastMessenger / broadcast.NewDelayedBlockBroadcaster wiring to pass a headers getter, proofs pool, and enable-epochs handler.
  • Add a proofs-pool callback path so delayed broadcasting can be triggered when the proof arrives (not only when the header arrives).
  • Expand/adjust tests to cover new nil-arg validations and proof-gated broadcast behavior.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
node/chainSimulator/components/testOnlyProcessingNode.go Pass headers getter, proofs pool, and enable-epochs handler into broadcast messenger creation for chain simulator nodes.
integrationTests/testProcessorNode.go Update test node initialization to provide the new broadcast-messenger dependencies (headers getter, proofs pool, enable-epochs handler).
integrationTests/testFullNode.go Same as above for full-node integration tests.
factory/consensus/consensusComponents.go Wire new dependencies into production consensus components factory when building the broadcast messenger.
consensus/spos/sposFactory/sposFactory.go Extend GetBroadcastMessenger signature and plumb new fields into ArgsDelayedBlockBroadcaster.
consensus/spos/sposFactory/sposFactory_test.go Update factory tests to match the new function signature and required dependencies.
consensus/spos/errors.go Add ErrNilHeadersPool for validating delayed broadcaster construction.
consensus/interface.go Introduce HeadersPoolGetter interface to retrieve headers by hash from the headers pool.
consensus/broadcast/delayedBroadcast.go Add headers-pool/proofs-pool/enable-epochs dependencies; gate processing on proof availability; register proof handler.
consensus/broadcast/export.go Export ReceivedProof method for test access to the proofs callback.
consensus/broadcast/delayedBroadcast_test.go Add/adjust tests for new nil validations and for proof-gated broadcast timing behavior.
consensus/broadcast/shardChainMessenger_test.go Update delayed broadcaster args in tests to include new required dependencies.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 30, 2026

Codecov Report

❌ Patch coverage is 76.36364% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.58%. Comparing base (3f8d81a) to head (8fb71e5).
⚠️ Report is 5 commits behind head on feat/supernova-async-exec.

Files with missing lines Patch % Lines
consensus/broadcast/delayedBroadcast.go 77.27% 7 Missing and 3 partials ⚠️
...hainSimulator/components/testOnlyProcessingNode.go 0.00% 3 Missing ⚠️
Additional details and impacted files
@@                    Coverage Diff                     @@
##           feat/supernova-async-exec    #7810   +/-   ##
==========================================================
  Coverage                      77.58%   77.58%           
==========================================================
  Files                            882      882           
  Lines                         123941   123990   +49     
==========================================================
+ Hits                           96155    96200   +45     
- Misses                         21416    21418    +2     
- Partials                        6370     6372    +2     

☔ View full report in Codecov by Sentry.
📢 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.

@AdoAdoAdo AdoAdoAdo marked this pull request as ready for review March 30, 2026 12:52
dbb.processMetachainHeaderBroadcast(headerHandler, headerHash)
}

func (dbb *delayedBlockBroadcaster) receivedProof(proof data.HeaderProofHandler) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

there is a slight chance both methods will trigger processMetachainHeaderBroadcast for the same block, if header and proof are received roughly at the same time, leading to double broadcast.. should we worry about this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

right, problem would be duplicated goroutines, and some processing done twice. It gets deduplicated further down when dealing with the alarm, but I have added now deduplication at the processMetachainHeaderBroadcast.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants