-
Notifications
You must be signed in to change notification settings - Fork 19.5k
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
base: master
Are you sure you want to change the base?
Conversation
8e190d8
to
ea9d92e
Compare
005bb86
to
60746bb
Compare
354717c
to
bd6b20a
Compare
2fe48c1
to
2089fdb
Compare
core/state/state_object.go
Outdated
// Note, this map will be reset for each transaction before byzantium fork. | ||
needCommit Storage |
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.
Modified but not yet committed, this sounds a lot like dirtyStorage
. Please add some clarification so a reader understands what's different between those two things
2089fdb
to
3d70c5b
Compare
This pull request has been deployed full sync for a few days, since the genesis. It can sync more than 16m blocks with no error. |
3d70c5b
to
d940577
Compare
d940577
to
7b1ff9b
Compare
type accountDelete struct { | ||
address common.Address // address is the unique account identifier | ||
origin []byte // origin is the original value of account data in slim-RLP encoding. | ||
storagesOrigin map[common.Hash][]byte // storagesOrigin stores the original values of mutated slots in prefix-zero-trimmed RLP format. |
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.
Are these the original values of the mutated slots, or are these all the slots?
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 original values of these all the slots
if prev.Root == types.EmptyRootHash { | ||
continue | ||
} | ||
// Remove storage slots belong to the account. | ||
// Remove storage slots belonging to the account. | ||
slots, set, err := s.deleteStorage(addr, addrHash, prev.Root) |
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.
Nitpick but didn't have a better place to dump it, could you fix the doc of the deleteStorage method to get rid of
"// It could potentially be terminated if the storage size is excessively large, potentially leading to an out-of-memory panic."?
AFAIK since SELFDESTRUCT was dropped, there's no more OOM protection.
This pull request rewrites the statedb by introducing a state update struct.
A state update struct will be constructed once the
statedb.Commit
is invoked. It contains all the statechanges caused by previous state transition, e.g.
Instead of committing the state change into state snapshot and trie database blindly, the state update
will be returned and then can be consumed by different state database implementation in different
ways. It gives more flexibilities to design database abstraction for different purposes.
What's more, the statedb has been simplified significantly, especially in state change construction.