Open mattsse opened 1 month ago
Can i get assigned to this ?
doing some search - sounds what being described in this thread could be the cause for https://github.com/paradigmxyz/reth/issues/11234 ?!
I’d like to resolve this.
My Developer Background: I am a developer with experience in blockchain technologies and RPC implementations. I have worked on various projects that require efficient data retrieval and error handling. My focus is on building robust systems that can gracefully handle edge cases like reorgs to ensure a seamless user experience.
My Proposed Solution To Tackle The Issue:
Retry Mechanism: Implement a retry mechanism that triggers a lookup for the Latest block if the initial retrieval results in a "block not found" error.
Error Handling: Ensure that the retry only occurs when the block ID is tagged as Latest.
Documentation: Update the documentation to include information about this change, detailing why we are implementing this retry strategy and how it addresses reorg-related issues.
@mattsse Can i take up this issue I'd like to resolve this
Can I jump on this task?
Describe the feature
in rpc we use a caching layer when fetching blocks, if a block is requested by a tag (Latest) then this can end up returning an error if there's a reorg in process:
because the cache operates on block hashes, we encounter a reorg after we looked up the latest hash and before we try to find the block:
https://github.com/paradigmxyz/reth/blob/52848a352a241cb1d16ef5040ef2c4b16b0cac15/crates/rpc/rpc-eth-api/src/helpers/block.rs#L236-L247
this isn't easily solvable, we can do two things, either do the id -> hash conversion during the cache lookup. or simply retry once if we encounter a block not found error and the blockid is latest.
imo simply retrying once is the best solution here and should guard against most reorg related issues.
TODO
Additional context
No response