-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes getStorageAt undeployed contract response #2250
Conversation
a070ef8
to
ab431d2
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2250 +/- ##
==========================================
+ Coverage 75.25% 75.35% +0.09%
==========================================
Files 106 106
Lines 11229 11238 +9
==========================================
+ Hits 8450 8468 +18
+ Misses 2138 2133 -5
+ Partials 641 637 -4 ☔ View full report in Codecov by Sentry. |
ab431d2
to
47b8084
Compare
fix Revert "Fixes getStorageAt undeployed contract response" This reverts commit bd44ef2d79ace6abe9358c053ea3b640dc389bb0. fix fix test fix fix
47b8084
to
3e3564b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to me that the problem you are describing would be better solved by returning an error from stateReader.ContractStorage
when the key doesn't exist, right?
If the key doesn't exist, it will return a zero value for The problem is that we need a way to check if a contract exists. Since we put contract fields (i.e. nonce, balance, storage) in different buckets, we have no choice but to add an additional DB lookup (in this case using If we condensed the contract fields into a single bucket (see #2224), we only need to do a single DB lookup to check if a contract exists or not. |
Trie.Get
by default returns no error and zero value for non-existent key. To check if a contract is deployed, we have no choice by to check if the nonce also exists (which is a redundant DB IO).