-
Notifications
You must be signed in to change notification settings - Fork 176
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
[EVM] Adding account/slot/code iterators to the base storage #6555
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6555 +/- ##
==========================================
+ Coverage 41.28% 41.54% +0.25%
==========================================
Files 2033 2035 +2
Lines 145981 181915 +35934
==========================================
+ Hits 60269 75568 +15299
- Misses 79486 100107 +20621
- Partials 6226 6240 +14
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
Nice! I left some minor comments.
@@ -0,0 +1,163 @@ | |||
package state |
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.
should this perhaps be in util somewhere?
require.Equal(t, nonces[acc.Address], acc.Nonce) | ||
require.Equal(t, balances[acc.Address].Uint64(), acc.Balance.Uint64()) | ||
require.Equal(t, codeHashes[acc.Address], acc.CodeHash) |
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.
The deletion ensures we see all unique account. Otherwise, returning the same account would also pass the tests.
require.Equal(t, nonces[acc.Address], acc.Nonce) | |
require.Equal(t, balances[acc.Address].Uint64(), acc.Balance.Uint64()) | |
require.Equal(t, codeHashes[acc.Address], acc.CodeHash) | |
require.Equal(t, nonces[acc.Address], acc.Nonce) | |
delete(nonces, acc.Address) | |
require.Equal(t, balances[acc.Address].Uint64(), acc.Balance.Uint64()) | |
delete(balances, acc.Address) | |
require.Equal(t, codeHashes[acc.Address], acc.CodeHash) | |
delete(codeHashes, acc.Address) |
require.Equal(t, codeByCodeHash[cic.Hash], cic.Code) | ||
require.Equal(t, refCountByCodeHash[cic.Hash], cic.RefCounts) |
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.
require.Equal(t, codeByCodeHash[cic.Hash], cic.Code) | |
require.Equal(t, refCountByCodeHash[cic.Hash], cic.RefCounts) | |
require.Equal(t, codeByCodeHash[cic.Hash], cic.Code) | |
delete(codeByCodeHash, cic.Hash) | |
require.Equal(t, refCountByCodeHash[cic.Hash], cic.RefCounts) | |
delete(refCountByCodeHash, cic.Hash) |
break | ||
} | ||
require.Equal(t, addr, slot.Address) | ||
require.Equal(t, values[slot.Key], slot.Value) |
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.
same here
This PR adds some utility methods to the base storage, for iterating over accounts, codes and slots. This functionality is used later by an evm state exporter utility command (follow up PRs are coming).