Open
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## preconf-dev #3005 +/- ##
===============================================
- Coverage 62.69% 61.50% -1.19%
===============================================
Files 357 366 +9
Lines 17226 17862 +636
===============================================
+ Hits 10799 10986 +187
- Misses 5572 5998 +426
- Partials 855 878 +23
🚀 New features to boost your workflow:
|
48fad0a to
89cd61e
Compare
89cd61e to
92b8c7f
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Implements beacon-kit support for a preconfirmation flow, adding a sequencer-side HTTP payload server plus validator-side fetching/fallback, and wiring this through config/DI and Kurtosis/e2e scaffolding.
Changes:
- Add
beacon/preconfmodule (config, whitelist/JWT loading, HTTP server, HTTP client) and integrate it into validator and blockchain optimistic-building logic. - Extend configuration + CLI flags + templates to enable preconf modes (sequencer vs validator fetching).
- Add Kurtosis + e2e support for spinning up a preconf devnet and validating basic behavior/fallback.
Reviewed changes
Copilot reviewed 45 out of 45 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| testing/simulated/components.go | Includes preconf providers in simulated test component wiring. |
| testing/e2e/suite/suite.go | Adds helper to remove a Kurtosis service via Starlark to simulate outages. |
| testing/e2e/suite/options.go | Adds suite option to run e2e with preconf-enabled config. |
| testing/e2e/suite/logs.go | Adds Kurtosis service log collection helpers for assertions. |
| testing/e2e/e2e_preconf_test.go | Adds an e2e_preconf test validating serving/fetching and fallback behavior. |
| testing/e2e/config/defaults.go | Adds PreconfE2ETestConfig for preconf-enabled e2e runs. |
| testing/e2e/config/config.go | Extends e2e config schema with PreconfConfig. |
| scripts/build/testing.mk | Adds make test-e2e-preconf targets. |
| payload/builder/payload.go | Adds PayloadBuilder.GetPayloadBySlot for serving cached payloads to validators. |
| payload/builder/interfaces.go | Renames cache interface arg names to reflect “blockRoot” semantics. |
| node-core/components/validator_service.go | Injects preconf client/whitelist into validator service. |
| node-core/components/service_registry.go | Registers preconf server (sequencer mode) in service registry. |
| node-core/components/preconf_server.go | Depinject provider for preconf HTTP server. |
| node-core/components/preconf_client.go | Depinject provider for preconf HTTP client. |
| node-core/components/preconf.go | Depinject provider for loading/constructing the preconf whitelist. |
| node-core/components/chain_service.go | Injects preconf config/whitelist into blockchain service. |
| kurtosis/src/services/sequencer/launcher.star | Adds launcher for a dedicated sequencer EL service (bera-sequencer). |
| kurtosis/src/services/flashblock-monitor/launcher.star | Adds a simple websocat-based flashblock monitor service. |
| kurtosis/src/preconf/config.star | Generates whitelist/JWT artifacts and preconf CLI flags for devnet. |
| kurtosis/src/nodes/nodes.star | Adds parsing support for a dedicated sequencer node. |
| kurtosis/src/nodes/execution/reth/config.star | Adds reth sequencer-mode args + flashblock WS port wiring. |
| kurtosis/src/nodes/execution/execution.star | Enables sequencer-mode configuration for dedicated sequencer node. |
| kurtosis/src/nodes/consensus/beacond/node.star | Adds support for appending preconf flags to beacond start command. |
| kurtosis/src/nodes/consensus/beacond/launcher.star | Wires preconf artifacts/env into CL node configs; adjusts genesis ceremony return shape. |
| kurtosis/main.star | Adds preconf args handling; deploys dedicated sequencer node when enabled; launches related services. |
| kurtosis/beaconkit-preconf.yaml | Adds Kurtosis args file to run a preconf-enabled devnet (with sequencer_node). |
| kurtosis/Makefile | Adds targets to start/stop/remove a preconf devnet. |
| config/template/template.go | Adds TOML template section for [beacon-kit.preconf]. |
| config/config.go | Adds preconf config to global node config defaults and struct. |
| cmd/beacond/defaults.go | Adds preconf providers to default component list. |
| cli/flags/flags.go | Adds CLI flags for preconf config. |
| beacon/validator/service.go | Extends validator service to hold preconf cfg/client/whitelist. |
| beacon/validator/block_builder.go | Attempts sequencer fetch before local build when configured/whitelisted. |
| beacon/preconf/whitelist.go | Adds whitelist interface + implementation. |
| beacon/preconf/types.go | Defines request/response types and envelope conversion helpers. |
| beacon/preconf/server_test.go | Adds unit tests for server auth/method handling. |
| beacon/preconf/server.go | Implements JWT-authenticated preconf payload server endpoint. |
| beacon/preconf/loader_test.go | Adds unit tests for whitelist/JWT loader helpers. |
| beacon/preconf/loader.go | Implements whitelist/JWT secret file loaders. |
| beacon/preconf/config.go | Adds preconf config struct + defaults + helper predicates. |
| beacon/preconf/client.go | Implements HTTP client for fetching payloads from sequencer. |
| beacon/blockchain/service.go | Adds preconf cfg/whitelist + optimistic-build trigger tracking to blockchain service. |
| beacon/blockchain/process_proposal.go | Adds sequencer-mode proposer detection + optimistic build triggering based on whitelist. |
| beacon/blockchain/payload_test.go | Updates blockchain tests to pass new constructor args. |
| beacon/blockchain/finalize_block.go | Adds FinalizeBlock fallback to trigger optimistic build when ProcessProposal is skipped. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
43712f1 to
fb4a434
Compare
fb4a434 to
354d20d
Compare
354d20d to
4cdc1dd
Compare
…d kurtosis devnet improvements
e5f5da4 to
455ffc7
Compare
8794989 to
3e32cca
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
This PR implements the beacon-kit portion of the preconfirmation system which significantly reduces transaction inclusion latency for users who opt into the preconfirmation network.
Berachain's standard block time is ~2 seconds. The preconfirmation system provides a fast path where a sequencer emits partial blocks (flashblocks) every ~200ms (not implemented in this PR), which are then finalized when the full block is proposed through CometBFT consensus. If any component fails, the chain seamlessly falls back to normal block building.
Design
The preconfirmation network consists of a sequencer and a set of whitelisted validators. Each runs beacon-kit with different roles:
Sequencer Mode:
N, looks up the proposer for slotN+1forkchoiceUpdateto begin payload construction early/eth/v1/preconf/payload) where validators fetch their pre-built payloadsValidator Mode (whitelisted):
newPayloadon the local execution clientValidator Mode (not in whitelist):
Robustness: Race Condition Handling
The optimistic payload build is triggered from
ProcessProposalin a background goroutine. This introduces two race conditions that are handled by:GetPayloadBySlotretries up to 5 times (50ms intervals, 250ms max) onErrPayloadIDNotFound(cache miss) orErrUnknownPayload(EL still building).ProcessProposalentirely if a proposal arrives after the propose timeout (the block goes directly toFinalizeBlock). AnoptimisticBuildTriggeredatomic flag tracks whetherProcessProposaltriggered a build. IfFinalizeBlockfinds the flag unset,sequencerFinalizeOptimisticBuildtriggers the build as a fallback.Kurtosis Devnet
The kurtosis devnet config (kurtosis/beaconkit-preconf.yaml) sets up a multi-node network with a dedicated sequencer:
--sequencer-enabled, flashblock WebSocket (port8548), and a signing key--flashblocks-urlto consume the sequencer's flashblock stream. This node serves standard JSON-RPC with. flashblock-aware stateTest Plan
Checkout branch
sequencer-devfrom feat: add sequencer/rpc mode for flashblock preconfirmations bera-reth#214 locally and runmake docker-build-localin the bera-reth directoryRun
make start-devnet-preconfto start local kurtosis devnetView
flashblock-monitorcontainer logs and you should see flashblocks produced every 200msOutstanding Issues
sequencerFinalizeOptimisticBuildfallback: I haven't been able to get this to happen locally after introducing this fallback, though it happened a few times before.