Repository navigation
🤖 [claude] Derive Firehose finality from the block's Parlia attestation (fixes wrong LIB on fork blocks) - #5
Merged
Johnaverse merged 1 commit intoSep 9, 2026
Conversation
Register ChainTracingConfig::finalized_for_block (pinax-network/bnb-reth tag bnb-bf76323c-fh3.1-2) with a resolver that reads the Parlia snapshot of the emitted block and returns its attestation's finalized checkpoint (Snapshot::get_finalized_number, i.e. vote_data.source), the same rule parlia_getFinalizedNumber exposes. Every node derives the same value for the same block and it lies on the block's own ancestry. Before, the finalized ref was this node's canonical finalized head at execution time: node state that produced readers disagreeing on the LIB of identical blocks (merger "forked" duplicates), LIB regressions within one reader, and fork-branch block 120653743 (e3d67571) carrying canonical finalized 120653740 so a downstream forkdb finalized the fork's 2c97928d (2026-09-08 08:24 UTC, reported by Phantom). Cargo.lock: same reth crate set, new bnb-reth commit. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YHvxpuVpZfzefJgwgqjAzn
2 tasks
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.
Summary
Root-cause fix for the finality signal reported by Phantom (bsc mainnet block
120653740, 2026-09-08 08:24 UTC) and for two related production symptoms.Defect. reth-firehose stamped every traced block with the node's canonical finalized head at execution time (
canonical_in_memory_state().get_finalized_num_hash()in the engine payload validator;provider().finalized_block_num_hash()in the ExEx runner). That is node state — it depends on which Parlia votes this node had received — and it is not necessarily an ancestor of a side-chain block being traced. On BSC fast finality (head−1…3) this produced:120653743 (e3d67571)was emitted with LIB120653740; on its own ancestry that height is2c97928d, which Phantom's forkdb then finalized and locked onto the dead branch.x91andx827), so the merger sees two canonical names for one block and files one as "forked" — ~50k such files inbsc-sf-v5-forked-blocks.x91: 120772186→LIB …184, 120772187→LIB …183), the same behaviour the geth-era tracer clamped.Fix.
pinax-network/bnb-rethfirehose/develop@73cdbc6(tagbnb-bf76323c-fh3.1-2): newChainTracingConfig::finalized_for_blockresolver;mapper::finalized_ref_for_block()uses it exclusively when set (aNoneresult emits no finalized ref — fireeth falls back toblock − 200— never node state); both engine call sites and the ExEx runner switched. Chains without the hook and the staged-sync path are unchanged.firehose_finalized_for_block()inmain.rsreads the Parlia snapshot of the emitted block and returns its attestation's finalized checkpoint (Snapshot::get_finalized_number()=vote_data.source, the same ruleparlia_getFinalizedNumberexposes) with the matching hash. Deterministic per block, identical on every node, on the block's own ancestry by construction.bnb-bf76323c-fh3.1-2;Cargo.locksame crate set, new commit. CHANGELOG fordev-049d306-fh3.1-2.Compiled only by CI (no local toolchain) — expect this PR's checks to be the first build.
Test plan
dev-049d306-fh3.1-2, bumpeosn-sf-bsc4-test, deploy onbsc-sfdm40(test mode)x40one-block names carry LIB = attestation source (head−2 steady state); no LIB regressions; test-mode diff shows only the knownsizedeltas🤖 Created by Claude Code Fable 5.1 (effort: high)
🤖 Generated with Claude Code
https://claude.ai/code/session_01YHvxpuVpZfzefJgwgqjAzn