-
Notifications
You must be signed in to change notification settings - Fork 2
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
test: StateAccount.Extra
via trie.StateTrie.{Update,Get}Account()
#45
Conversation
This is a purely defensive approach in case future tests forget to clean up.
testonly.OrPanic(func() {}) | ||
} | ||
|
||
eNil := e == nil || e.t == nil |
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.
This was moved from the test file, unchanged.
) | ||
|
||
// OrPanic runs `fn` i.f.f. called from within a testing environment. | ||
func OrPanic(fn func()) { |
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.
This was abstracted from params/config.libevm.go
, unchanged except for the call to fn()
and the size of the pc
slice.
require.NoErrorf(t, state.UpdateAccount(addr, acct), "%T.UpdateAccount(...)", state) | ||
assert.Equalf(t, tt.wantTrieHash, state.Hash(), "%T.Hash() after UpdateAccount()", 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.
Can can we also add testing for Copy & Snapshot/Revert being handled properly?
For example statedb.Copy makes a shallow copy of the accounts modified, so we should ensure that setting the extras on the origin does not impact the copied statedb & the other way around.
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.
Snapshot/Revert covered in #48
I'm about to test Copy too. If it fails then I'll see how much needs to change and might start a new PR if the fix spreads too far.
Why this should be merged
Integration test of the new
StateAccount.Extra
payloads introduced in #44, originally with unit tests only.How this works
trie.StateTrie
round trip viaUpdateAccount()
and thenGetAccount()
, confirming that not only are the payloads correctly echoed but that they also modify theStateTrie
's root hash as expected.How this was tested
n/a