Skip to content

Conversation

@karalabe
Copy link
Member

@karalabe karalabe commented Apr 26, 2024

There are two cases in state object updates that have unexpected leftovers:

  • Single tx sets slot from A -> B -> A. In this case the current code will mark the slot marked as updated, but won't prefetch it (that part was smarter). Later the commit (stateObject.updateTrie) will try to fetch the trie from the prefetcher, failing, after which it makes a fresh one from the db, only to throw it out because the slot didn't really change.
  • Tx1 sets slot from A -> B; after which tx2 sets the same slot from B -> A within the same block. The effect is similar, but the cause slightly different. Tx1 marks the slot updated, and tx2 leaves it as updated, even though it reverted to it's original.

The fix in this PR is fairly simple: whenever a slot is change back to it's original (during tx finalization), remove the update marker off of it (pending).

The PR also adds a log to stateObject.updateTrie to detect if we missed a similar case and be noisy about it.

Screenshot 2024-04-26 at 11 11 44

@karalabe karalabe added this to the 1.14.1 milestone Apr 26, 2024
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

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.

3 participants