-
Notifications
You must be signed in to change notification settings - Fork 20.3k
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
core/state: mark account as dirty when resetObject occurs #27339
Conversation
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.
LGTM
@@ -162,7 +163,7 @@ func (ch resetObjectChange) revert(s *StateDB) { | |||
} | |||
|
|||
func (ch resetObjectChange) dirtied() *common.Address { | |||
return nil | |||
return ch.account |
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 address field here is not needed because resetObjectChange
already contains the stateObject
.
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.
For future readers: the semantics behind dirtied()
is, that it it supposed to spit out which, if any, address
was made dirty
by the change. And dirty
means that it affects the state trie, so needs to update the stateroot.
For example, the refundChange
do not mark something dirty
, because it only affects the runtime but has no persistent effect on the state. Same with accessListAddAccountChange
,addPreimageChange
, addLogChange
and transientStorageChange
…7339) This changes the journal logic to mark the state object dirty immediately when it is reset. We're mostly adding this change to appease the fuzzer. Marking it dirty immediately makes no difference in practice because accounts will always be modified by EVM right after creation.
…hereum#27339)" This reverts commit 68dea62.
…hereum#27339)" This reverts commit 68dea62.
journal.go: in resetObjectChange - add account in resetObjectChange (ref ethereum/go-ethereum#27339) - add prevAccount and prevStorage (ref ethereum/go-ethereum#27376) - add prevAccountOrigin and prevStorageOrigin to track changes state_object.go: add origin for tracking the original StateAccount before change statedb.go: - add accountsOrigin and storagesOrigin, same functions as above - stateObjectsDestruct now track the previous state before destruct - add functions for handle destructing old states
journal.go: in resetObjectChange - add account in resetObjectChange (ref ethereum/go-ethereum#27339) - add prevAccount and prevStorage (ref ethereum/go-ethereum#27376) - add prevAccountOrigin and prevStorageOrigin to track changes state_object.go: add origin for tracking the original StateAccount before change statedb.go: - add accountsOrigin and storagesOrigin, same functions as above - stateObjectsDestruct now track the previous state before destruct - add functions for handle destructing old states
journal.go: in resetObjectChange - add account in resetObjectChange (ref ethereum/go-ethereum#27339) - add prevAccount and prevStorage (ref ethereum/go-ethereum#27376) - add prevAccountOrigin and prevStorageOrigin to track changes state_object.go: add origin for tracking the original StateAccount before change statedb.go: - add accountsOrigin and storagesOrigin, same functions as above - stateObjectsDestruct now track the previous state before destruct - add functions for handle destructing old states
* trie: triestate/Set to track changes * core/state: track state changes journal.go: in resetObjectChange - add account in resetObjectChange (ref ethereum/go-ethereum#27339) - add prevAccount and prevStorage (ref ethereum/go-ethereum#27376) - add prevAccountOrigin and prevStorageOrigin to track changes state_object.go: add origin for tracking the original StateAccount before change statedb.go: - add accountsOrigin and storagesOrigin, same functions as above - stateObjectsDestruct now track the previous state before destruct - add functions for handle destructing old states * all: apply changes to tests
* trie: triestate/Set to track changes * core/state: track state changes journal.go: in resetObjectChange - add account in resetObjectChange (ref ethereum/go-ethereum#27339) - add prevAccount and prevStorage (ref ethereum/go-ethereum#27376) - add prevAccountOrigin and prevStorageOrigin to track changes state_object.go: add origin for tracking the original StateAccount before change statedb.go: - add accountsOrigin and storagesOrigin, same functions as above - stateObjectsDestruct now track the previous state before destruct - add functions for handle destructing old states * all: apply changes to tests
* trie: triestate/Set to track changes * core/state: track state changes journal.go: in resetObjectChange - add account in resetObjectChange (ref ethereum/go-ethereum#27339) - add prevAccount and prevStorage (ref ethereum/go-ethereum#27376) - add prevAccountOrigin and prevStorageOrigin to track changes state_object.go: add origin for tracking the original StateAccount before change statedb.go: - add accountsOrigin and storagesOrigin, same functions as above - stateObjectsDestruct now track the previous state before destruct - add functions for handle destructing old states * all: apply changes to tests
* trie: triestate/Set to track changes * core/state: track state changes journal.go: in resetObjectChange - add account in resetObjectChange (ref ethereum/go-ethereum#27339) - add prevAccount and prevStorage (ref ethereum/go-ethereum#27376) - add prevAccountOrigin and prevStorageOrigin to track changes state_object.go: add origin for tracking the original StateAccount before change statedb.go: - add accountsOrigin and storagesOrigin, same functions as above - stateObjectsDestruct now track the previous state before destruct - add functions for handle destructing old states * all: apply changes to tests
This PR aligns the dirty marker behavior in state journal. It's OK to not mark it as dirty in resetObject, but would be nice to align the behavior with other changes.