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
This pull request was closed.
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