Skip to content
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

Merged
merged 1 commit into from
Jun 1, 2023

Conversation

rjl493456442
Copy link
Member

@rjl493456442 rjl493456442 commented May 24, 2023

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.

Copy link
Contributor

@holiman holiman left a 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
Copy link
Contributor

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.

Copy link
Contributor

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

@fjl fjl merged commit 15bd21f into ethereum:master Jun 1, 2023
devopsbo3 pushed a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
…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.
devopsbo3 added a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
devopsbo3 added a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
Francesco4203 added a commit to Francesco4203/ronin that referenced this pull request Oct 1, 2024
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
Francesco4203 added a commit to Francesco4203/ronin that referenced this pull request Oct 1, 2024
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
Francesco4203 added a commit to Francesco4203/ronin that referenced this pull request Oct 3, 2024
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
huyngopt1994 pushed a commit to axieinfinity/ronin that referenced this pull request Oct 3, 2024
* 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
Francesco4203 added a commit to axieinfinity/ronin that referenced this pull request Oct 17, 2024
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants