-
Notifications
You must be signed in to change notification settings - Fork 20.6k
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
cmd, core, trie: verkle-capable geth init
#28270
Merged
+1,120
−54
Merged
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
3249aa6
cmd, core, trie: verkle-capable `geth init`
gballet 9a95be4
review feedback + root node resolution in OpenTrie
gballet 30daf0a
more review feedback
gballet 6bd9981
add a trie parameter to OpenStorageTrie
gballet a02c50c
review feedback + add test
gballet 40ebb2b
adding some (failing) tests
gballet 412075b
core, trie: fix failed test
rjl493456442 d326ba1
core, light, trie: polish code (#303)
rjl493456442 8754ebc
update go-verkle
gballet 1379079
trie/utils: address comment from martin
rjl493456442 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
add a trie parameter to OpenStorageTrie
commit 6bd99818e8f3d0dfff353423a7754468a9beb765
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,7 +46,7 @@ type Database interface { | |
OpenTrie(root common.Hash) (Trie, error) | ||
|
||
// OpenStorageTrie opens the storage trie of an account. | ||
OpenStorageTrie(stateRoot common.Hash, address common.Address, root common.Hash) (Trie, error) | ||
OpenStorageTrie(stateRoot common.Hash, address common.Address, root common.Hash, trie Trie) (Trie, error) | ||
|
||
// CopyTrie returns an independent copy of the given trie. | ||
CopyTrie(Trie) Trie | ||
|
@@ -195,7 +195,13 @@ func (db *cachingDB) OpenTrie(root common.Hash) (Trie, error) { | |
} | ||
|
||
// OpenStorageTrie opens the storage trie of an account. | ||
func (db *cachingDB) OpenStorageTrie(stateRoot common.Hash, address common.Address, root common.Hash) (Trie, error) { | ||
func (db *cachingDB) OpenStorageTrie(stateRoot common.Hash, address common.Address, root common.Hash, self Trie) (Trie, error) { | ||
// In the verkle case, there is only one tree. But the two-tree structure | ||
// is hardcoded in the codebase. So we need to return the same trie in this | ||
// case. | ||
if db.triedb.IsVerkle() { | ||
return self, nil | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. see comment above: returning the unique verkle tree in that case. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What if the passed trie is nil? |
||
tr, err := trie.NewStateTrie(trie.StorageTrieID(stateRoot, crypto.Keccak256Hash(address.Bytes()), root), db.triedb) | ||
if err != nil { | ||
return nil, err | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@rjl493456442 I added this
trie
parameter, which is a reference to the account trie. Since there is only one verkle tree, this is the trick that I use to make sure that storage writes also go to the main tree.