wait for proof before broadcasting#7810
wait for proof before broadcasting#7810AdoAdoAdo wants to merge 4 commits intofeat/supernova-async-execfrom
Conversation
There was a problem hiding this comment.
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.NewDelayedBlockBroadcasterwiring 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 Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
| dbb.processMetachainHeaderBroadcast(headerHandler, headerHash) | ||
| } | ||
|
|
||
| func (dbb *delayedBlockBroadcaster) receivedProof(proof data.HeaderProofHandler) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
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?