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: introduce stateupdate structure #29530

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

rjl493456442
Copy link
Member

@rjl493456442 rjl493456442 commented Apr 15, 2024

This pull request rewrites the statedb by introducing a state update struct.

A state update object will be constructed once the statedb.Commit is invoked. It contains all the state
changes, e.g.

  • original state root and post-execute state root
  • deleted accounts along with their original value
  • updated accounts along with their original value
  • dirty contract codes
  • dirty trie nodes (state hasher)

Instead of committing the state change into state snapshot and trie database blindly, the state update
can be consumed by different state database implementation in different ways. e.g.

  • state update can be ignored if it's a read-only statedb
  • flat state changes can be ignored if it's a trie-only statedb
  • trie changes can be ignored if it's a flat-state only statedb
  • etc

What's more, the statedb has been simplified significantly, especially in flat state change construction.

@rjl493456442 rjl493456442 force-pushed the state-update branch 3 times, most recently from 8e190d8 to ea9d92e Compare April 18, 2024 07:05
@rjl493456442 rjl493456442 force-pushed the state-update branch 4 times, most recently from 005bb86 to 60746bb Compare April 29, 2024 07:50
@rjl493456442 rjl493456442 force-pushed the state-update branch 3 times, most recently from 8ccd274 to b4a9c20 Compare May 6, 2024 08:45
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.

None yet

1 participant