Reduce clones and cleanup in block cache path#6431
Merged
incrypto32 merged 5 commits intomasterfrom Mar 11, 2026
Merged
Conversation
lutter
approved these changes
Mar 10, 2026
Collaborator
lutter
left a comment
There was a problem hiding this comment.
Nice! Just a few very minor comments, feel free to ignore
Use the typed `blocks()` method instead of `blocks_as_json()` so that block comparisons go through the same alloy serialization on both the cached and provider sides. This gives a fairer diff by normalizing both blocks through the same types, and only compares the block data (without receipts) since `eth_getBlockByHash` does not return receipts.
All callers now use the typed `blocks()` method. The resolver serializes the CachedBlock to JSON at the GraphQL boundary. This eliminates the separate raw-JSON code path from the trait.
Arc-wrap the Light variant to avoid expensive deep clones of AnyBlock. into_light_block now borrows self and returns Arc via cheap refcount bumps.
Remove the single-consumer EthereumJsonBlock wrapper and inline its deserialization and patching logic directly into CachedBlock::from_json.
a904dbe to
1a06f0d
Compare
1a06f0d to
1024a1b
Compare
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.
Addresses review feedback from #6400.
check_blocksto use typedblocks()instead of raw JSONblocks_as_jsonfromChainStoretraitLightEthereumBlockinArcinsideCachedBlock::Lightto avoid expensive deep clonesEthereumJsonBlockintoCachedBlock::from_jsonand delete the wrapper