-
Notifications
You must be signed in to change notification settings - Fork 20.1k
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/snapshot, core/types, eth: move account definition to type #27323
Conversation
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.
LGTM
data, err := rlp.EncodeToBytes(slim) | ||
if err != nil { | ||
panic(err) | ||
} |
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.
This panic
here can probably be omitted, -- we can ignore the err
, right?
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.
We can omit the error and commit "rlp encode can never be failed".
Note, in original implementation, we also panic in case error occurs. I am fine with both approaches.
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.
I'm also fine with either (hence I approved it), but since rlp encoding cannot fail, I think we should omit the panic
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.
I found another case that RLP encode can fail.
var acct types.StateAccount
rlp.EncodeBytes(acct)
In this case, pointer of types.StateAccount
is required as the parameter. I just want to say that rlp may or may not will fail, but panic is better than ignore error silently.
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.
SGTM
…ethereum#27323) * core/state/snapshot, core/types, eth: move account definition to type * core, eth: revert snapshot Account API change
… to type (ethereum#27323)" This reverts commit 1b82886.
… to type (ethereum#27323)" This reverts commit 1b82886.
* core/state: move account definition to core/types Reference: ethereum/go-ethereum#27323 * trie: add path base utils * triedb: implement history and adding some test utils * trie/triedb/pathdb: implement difflayer and disklayer * Fix some issues related to history, and add logic checking maxbyte when is zero for retrieving ancient ranges with maxbyte is zero * trie/triedb/pathdb: implement database.go * freezer: Add unit test and docs for support freezer reading with no limit size * trie/triedb/pathdb: add database and difflayer tests * triedb/pathdb: implement journal and add more comments --------- Co-authored-by: Huy Ngo <huyngopt1994@gmail.com>
* core/state: move account definition to core/types Reference: ethereum/go-ethereum#27323 * trie: add path base utils * triedb: implement history and adding some test utils * trie/triedb/pathdb: implement difflayer and disklayer * Fix some issues related to history, and add logic checking maxbyte when is zero for retrieving ancient ranges with maxbyte is zero * trie/triedb/pathdb: implement database.go * freezer: Add unit test and docs for support freezer reading with no limit size * trie/triedb/pathdb: add database and difflayer tests * triedb/pathdb: implement journal and add more comments --------- Co-authored-by: Huy Ngo <huyngopt1994@gmail.com>
* all: clean up overall structure, preparing for path-based (#594) * trie/triedb/pathdb: init pathdb components * core, trie: track state change with address instead of hash Reference: ethereum/go-ethereum@817553c * trie: refactor * rawdb: implement freezer resettable & state freezer (#596) * rawdb: implement freezer resettable * rawdb: implement state freezer * rawdb: update description * trie: path based scheme implementing (#598) * core/state: move account definition to core/types Reference: ethereum/go-ethereum#27323 * trie: add path base utils * triedb: implement history and adding some test utils * trie/triedb/pathdb: implement difflayer and disklayer * Fix some issues related to history, and add logic checking maxbyte when is zero for retrieving ancient ranges with maxbyte is zero * trie/triedb/pathdb: implement database.go * freezer: Add unit test and docs for support freezer reading with no limit size * trie/triedb/pathdb: add database and difflayer tests * triedb/pathdb: implement journal and add more comments --------- Co-authored-by: Huy Ngo <huyngopt1994@gmail.com> --------- Co-authored-by: Francesco4203 <100074926+Francesco4203@users.noreply.github.com>
* all: clean up overall structure, preparing for path-based (#594) * trie/triedb/pathdb: init pathdb components * core, trie: track state change with address instead of hash Reference: ethereum/go-ethereum@817553c * trie: refactor * rawdb: implement freezer resettable & state freezer (#596) * rawdb: implement freezer resettable * rawdb: implement state freezer * rawdb: update description * trie: path based scheme implementing (#598) * core/state: move account definition to core/types Reference: ethereum/go-ethereum#27323 * trie: add path base utils * triedb: implement history and adding some test utils * trie/triedb/pathdb: implement difflayer and disklayer * Fix some issues related to history, and add logic checking maxbyte when is zero for retrieving ancient ranges with maxbyte is zero * trie/triedb/pathdb: implement database.go * freezer: Add unit test and docs for support freezer reading with no limit size * trie/triedb/pathdb: add database and difflayer tests * triedb/pathdb: implement journal and add more comments --------- Co-authored-by: Huy Ngo <huyngopt1994@gmail.com> --------- Co-authored-by: Francesco4203 <100074926+Francesco4203@users.noreply.github.com>
* all: clean up overall structure, preparing for path-based (#594) * trie/triedb/pathdb: init pathdb components * core, trie: track state change with address instead of hash Reference: ethereum/go-ethereum@817553c * trie: refactor * rawdb: implement freezer resettable & state freezer (#596) * rawdb: implement freezer resettable * rawdb: implement state freezer * rawdb: update description * trie: path based scheme implementing (#598) * core/state: move account definition to core/types Reference: ethereum/go-ethereum#27323 * trie: add path base utils * triedb: implement history and adding some test utils * trie/triedb/pathdb: implement difflayer and disklayer * Fix some issues related to history, and add logic checking maxbyte when is zero for retrieving ancient ranges with maxbyte is zero * trie/triedb/pathdb: implement database.go * freezer: Add unit test and docs for support freezer reading with no limit size * trie/triedb/pathdb: add database and difflayer tests * triedb/pathdb: implement journal and add more comments --------- Co-authored-by: Huy Ngo <huyngopt1994@gmail.com> --------- Co-authored-by: Francesco4203 <100074926+Francesco4203@users.noreply.github.com>
This PR moves all "slim account" notion to
types
package.It's a prerequsite of tracking state diffs in path-based storage scheme. Originally
"slim-rlp" format is only used in snapshot to minimize the storage size of accounts,
but will be used in state diffs in path-based as well.
types
is the better locationto put these common utilities.