Merged
Conversation
…} reverse of RuntimeCache.blocks (which is {block: block_hash}
…sure that we do not cache when `None` is passed, and to attempt to retrieve the block hash or block from the cache if its previously been requested.
ibraheem-abe
approved these changes
Feb 12, 2026
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.
Adds a reverse dict of the RuntimeCache.blocks (
{block_number: block_hash}mapping) to RuntimeCache.blocks_reverse which is a{block_hash: block_number}mapping, to make it simpler to interact with the newadd_known_versionsmethod.Also optimises the caching of block hashes and numbers in both the sync and async versions for
get_block_hashandget_block_number, whereNoneis no longer cached (Noneimplies get the chain tip, which is constantly changing), there's first a lookup to see if the reverse has happened (e.g. you got the block hash for block 5_000_002 and now you want to get the block number for that block's hash), and then finally passes it to the cached retrieval method, which then adds the mapping to the RuntimeCache for future updates.Adds caching in general to the
get_block_numberasync version, which was for some reason not cached.