Repository navigation
Conversation
…kup misses When Reth commits canonical headers, the primary Headers table is immediately available while the secondary HeaderNumbers (hash -> number) index can lag. In try_to_read_block_header, if provider.header(&parent_hash) returns None, fall back to provider.header_by_number(block - 1) and verify hash_slow(). If the hashes match, return Ok(header) immediately instead of polling.
Contributor
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
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
Resolves #853. When
provider.header(&parent_hash)returnsNonedue to Reth secondary index lag, falls back toprovider.header_by_number(block - 1)and verifieshash_slow() == parent_hashbefore entering the polling sleep loop.Problem
In Reth, canonical commits write to the primary
Headerstable before updating the secondaryHeaderNumbers(BlockHash -> BlockNumber) index. During slot transitions,provider.header(&parent_hash)can returnNonefor hundreds of milliseconds.try_to_read_block_headerqueriedprovider.header_by_numberbut discarded the header and returned an error, forcingwait_for_block_headerinto repeated polling sleeps and delaying block building.Solution
provider.header(&parent_hash)?yieldsNone, inspectprovider.header_by_number(block - 1).header.hash_slow() == parent_hash, returnOk(header)immediately.block.checked_sub(1).Testing
crates/rbuilder/src/live_builder/mod.rs