feat(preconf): rebuild sequencer payload on consensus round change to keep flashblocks flowing#3068
Conversation
9146c51 to
bb1e57b
Compare
bb1e57b to
032b2be
Compare
There was a problem hiding this comment.
Pull request overview
This PR addresses a preconf failure mode where, after CometBFT advances past round 0 at a given height, the sequencer continues serving a stale cached payload and stops producing fresh flashblocks. It adds a CometBFT EventNewRound subscription so the sequencer can detect round changes early, invalidate its payload cache, and trigger a fresh optimistic payload build.
Changes:
- Subscribe to CometBFT
EventNewRoundafter node start and route round-change events into the beacon blockchain service. - Add a
LocalBuilder.InvalidatePayload(slot, parentBlockRoot)API and implement it in the payload builder/cache. - Add an e2e test that forces a multi-round scenario and asserts sequencer rebuild + flashblock monitor evidence.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| testing/e2e/preconf/round_change_test.go | New e2e that induces a round change and checks for rebuild logs + flashblock rebuild evidence. |
| payload/builder/builder.go | Adds InvalidatePayload to delete cached payload IDs for a slot/root. |
| node-core/components/interfaces.go | Extends the node-core LocalBuilder interface with InvalidatePayload. |
| consensus/cometbft/service/service.go | Hooks round-change subscription into CometBFT service startup. |
| consensus/cometbft/service/round_change.go | New CometBFT event-bus subscription handler for EventNewRound. |
| beacon/blockchain/round_change.go | New HandleRoundChange implementation to whitelist-check, invalidate cache, and rebuild payload. |
| beacon/blockchain/mocks/local_builder.mock.go | Updates mock to include InvalidatePayload. |
| beacon/blockchain/interfaces.go | Extends blockchain interfaces with InvalidatePayload and HandleRoundChange. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
032b2be to
5c86102
Compare
… keep flashblocks flowing
5c86102 to
6701b2c
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## preconf-dev #3068 +/- ##
===============================================
- Coverage 61.49% 58.93% -2.57%
===============================================
Files 366 378 +12
Lines 17862 19432 +1570
===============================================
+ Hits 10985 11452 +467
- Misses 5999 7018 +1019
- Partials 878 962 +84
🚀 New features to boost your workflow:
|
bar-bera
left a comment
There was a problem hiding this comment.
lgtm, just maybe we should rename the existing round_rotation_test.go to something more appropriate since now round_change_test.go tests the detection of the round ratation, while the former tests the behavior of the network under the round rotation condition. or maybe they could be merged
Updated the e2e test so that we start a background routine that sends txs after first payload and then verifies that at least 1 gets included in the next payload |
… picks up new txs
When consensus goes to multiple rounds, the sequencer only builds a payload and emits flashblocks for round 0. If round 0 times out and a new proposer is selected, no fresh flashblocks are produced for any subsequent rounds. RPC nodes continue serving stale round-0 state, and the new proposer receives the same cached payload with no new transactions.
Detecting the round change in
ProcessProposalis too late. By that point the new proposer has already fetched and proposed. There is also no round information in the ABCIPrepareProposalRequestorProcessProposalRequest.This PR aims to circumvent this by subscribing to CometBFT's local
EventNewRoundmessage through its message bus on the sequencer. This event should fires before the new proposer entersPrepareProposal, giving the sequencer enough time to invalidate the stale payload cache and trigger a fresh optimistic build with up-to-date transactions.Note that no
bera-rethchanges should be needed because when a new index-0 flashblock arrives with a different payload ID, the RPC node's flashblock service discards the stale round-0 sequence and starts tracking the new one.Test plan
The following e2e test stops a single validator to trigger a multi round and verifies that cometbft on sequencer sent a new round message and that flashblocks were emitted for round1: