fix(rpcv10): recompute trace if initial_reads requested#3583
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes an ordering issue in the RPC v10 block trace cache where a cached trace computed without initial reads could be incorrectly reused for a later request with RETURN_INITIAL_READS.
Changes:
- Adjusts
traceBlockTransactionscache-hit logic to re-trace via VM when initial reads are requested but missing in the cached entry. - Avoids re-fetching from feeder gateway when cached traces already exist, while still returning an empty
InitialReadswhen requested (since GW can’t supply them). - Adds tests to verify cache coherence across different call orderings (
TraceTransactionthenTraceBlockTransactions, repeat calls, and flag/no-flag sequences).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
rpc/v10/trace.go |
Updates cache-hit and feeder-gateway logic to prevent returning a cached response missing initial reads when RETURN_INITIAL_READS is requested. |
rpc/v10/trace_test.go |
Adds regression tests that validate the cache is not “poisoned” by earlier calls without initial reads and that cache reuse behaves as intended. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3583 +/- ##
==========================================
+ Coverage 75.77% 75.85% +0.07%
==========================================
Files 380 380
Lines 34190 34187 -3
==========================================
+ Hits 25909 25932 +23
+ Misses 6456 6427 -29
- Partials 1825 1828 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
EgeCaner
approved these changes
Apr 28, 2026
Contributor
EgeCaner
left a comment
There was a problem hiding this comment.
Looks good to me, thank you!
MaksymMalicki
approved these changes
Apr 28, 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.
There is an ordering issue with RPC trace cache for block transactions - we cache only by block hash, so we could end up with a situation where the cache was populated with trace without initial reads, and when the caller request same tries but with
initial_reads, we'd just return cached response (with missinginitial_reads)