refactor(v10): check storage existence only for zeros#3790
Conversation
|
Claude finished @brbrr's task in 2m 21s —— View job Code Review —
|
There was a problem hiding this comment.
Pull request overview
Refactors the v10 StorageAt RPC handler to avoid always probing contract existence, by only doing the existence check when the storage slot value is zero (where “unset slot” and “missing contract” can both appear as zero on the head reader).
Changes:
- Fetch storage first and only perform a
ContractClassHashexistence probe when the returned storage value is zero. - Update
StorageAtunit tests to reflect the new call sequence/behavior and add a test asserting non-zero values skip the probe. - Minor gofmt-driven test formatting adjustments.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| rpc/v10/storage.go | Changes StorageAt to probe contract existence only when storage returns zero. |
| rpc/v10/storage_test.go | Updates mocks/expectations and adds a test to verify probe is skipped on non-zero values. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3790 +/- ##
==========================================
- Coverage 75.34% 75.11% -0.23%
==========================================
Files 438 438
Lines 39528 39602 +74
==========================================
- Hits 29781 29748 -33
- Misses 7676 7752 +76
- Partials 2071 2102 +31 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
rodrodros
left a comment
There was a problem hiding this comment.
benchmark numbers please
|
Looks good 👍 , you've good findings from Copilot and Claude |
|
@rodrodros i've addressed the bot's feedback and added bench results to the description. please take a look. |
|
Claude finished @brbrr's task in 1m 35s —— View job Re-review after addressing feedback
Both pieces of bot feedback are addressed correctly, and the change is a strict improvement over the prior revision. 👍 1. Copilot's point — skip the probe for historical readers ( The existence probe now only runs on head-type readers: if value.IsZero() && (id.IsLatest() || id.IsPreConfirmed()) {I traced
So the 2. Logging nit ( The internal-error path on the primary Test coverage — good. The new Summary
Note: I could not execute |
Bench results:
(Generated using sepolia snapshot, 1 block temp db wasn't representative, as the data was hot, and results were marginal)
Note that only for the missing contract on the latest block we would face degradation.