feat(builder): observe beacon node blocks - #48
Closed
krisoshea-eth wants to merge 19 commits into
Closed
krisoshea-eth wants to merge 19 commits into
krisoshea-eth wants to merge 19 commits into
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
krisoshea-eth
marked this pull request as draft
August 10, 2026 21:03
…-events-and-retrieve-fork-correct
7 tasks
…-events-and-retrieve-fork-correct
This was referenced Aug 13, 2026
…-events-and-retrieve-fork-correct
…2-api-02-consume-bn-block-events-and-retrieve-fork-correct # Conflicts: # packages/builder/src/builder.ts
…2-api-02-consume-bn-block-events-and-retrieve-fork-correct # Conflicts: # packages/builder/src/builder.ts
…2-api-02-consume-bn-block-events-and-retrieve-fork-correct
10 tasks
…2-api-02-consume-bn-block-events-and-retrieve-fork-correct
…2-api-02-consume-bn-block-events-and-retrieve-fork-correct
…2-api-02-consume-bn-block-events-and-retrieve-fork-correct
…2-api-02-consume-bn-block-events-and-retrieve-fork-correct
…-events-and-retrieve-fork-correct
…-events-and-retrieve-fork-correct
Owner
Author
|
Superseded by upstream ChainSafe#9931. The upstream PR now carries the current implementation, review discussion, and evidence. |
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.
Motivation
The Lodestar Builder needs a source beacon node REST fallback for learning that a proposer selected a bid without joining libp2p. API-02 implements that bounded observation path.
The standardized external Builder flow merged in beacon-APIs ChainSafe#630 and implemented by draft Lodestar ChainSafe#9832 can instead forward the signed winning beacon block directly to the selected Builder. This draft asks maintainers whether
packages/buildershould keep API-02 as a compatibility and recovery fallback, or whether directsubmitSignedBeaconBlockdelivery should replace it as the primary path.Behavior
blockSSE topic.getBlockV2, using the Builder abort signal for both SSE and HTTP.BUILDER_INDEX_SELF_BUILD.runOnBlockcallbacks. One slow, cancelled, or failing consumer does not prevent the others from running.The observer starts after the existing genesis, configuration, readiness, Gloas, and Builder identity gates. It joins the clock and
BuilderStatusTrackeras a long-lived Builder duty and shares their abort controller.This PR does not add p2p,
block_gossip, canonical-chain filtering, local-bid matching, reveal behavior, metrics, reconnect, replay, restart recovery, multi-BN failover, or a new API endpoint.API audit
The standard
blockevent contains the slot, beacon block root, and execution optimism, but not the fork version, selected Builder index, or execution block hash.getBlockV2supplies the signed fork-correct block andEth-Consensus-Versionmetadata. The standard flow is sufficient for the API-02 fallback at the cost of one fetch per newly observed post-Gloas block.headandhead_v2are not substitutes because an imported non-head block can be omitted.Lodestar emits
blockafter state transition and fork-choice import. Root lookup checks fork choice for presence, then serves the block from the seen-block input cache or database. The current import and retrieval order provides no expected Lodestar event-before-block 404 window. The Beacon API does not require equivalent ordering across clients, so bounded 404 retry remains a cross-client precaution.The audit and decision record are in Builder docs PR #13. Implementation evidence was posted to beacon-APIs #599. The optional event-design notebook was introduced in Builder docs PR #14, refreshed in merged PR #16, and reconciled with current PoC and review evidence in PR #17. SPEC-01 owns that separate cross-client decision.
Marco's open Lodestar PRs #9854, #9875, #9876, and #9896 compare enriched
block, two complete-bid event shapes, andblock_v2. Nico's draft #9832 separately implements the standardized proposer-to-external-Builder flow from beacon-APIs ChainSafe#630. The relationship between that direct block-forwarding flow, API-02, and beacon-APIs ChainSafe#599 is the primary architecture question for upstream review.Upstream reconciliation
Current
unstablebase:2fba076c28.Integrated incrementally through merge commit
03d4ebd1b4:The API-02 diff remains limited to five Builder files. The merge preserved upstream's clock, identity, metrics, epoch polling, shared test-helper, and payload-cache patterns.
Specification baseline: consensus-specs
v1.7.0-alpha.14.Project issue: krisoshea-eth/lodestar#12.
Testing
Validated with Node 24.13.0 and pnpm 11.0.0:
git diff --check.Earlier validation on the same implementation also passed the Builder package build and build-import check. The latest upstream merge does not touch
packages/builder.Coverage includes SSE wiring, shared cancellation, Builder startup and shutdown wiring, Gloas and Heze fork-correct output, exact signed-bid identity, returned-slot consistency, sequential and concurrent deduplication, bounded transient recovery, terminal failure retention, retry classification, decoding failures, fork and body guards, FIFO eviction, self-build, stream failure and closure handling, and concurrent callback isolation.
This PR should remain a draft while maintainers decide the observer's role relative to direct
submitSignedBeaconBlockdelivery. LOD-12 remains open until the issue-specific real-BN event-to-block and shutdown smoke is recorded if this fallback remains part of the agreed architecture.AI assistance disclosure