trie: introduce UpdateBatch#32448
Open
rjl493456442 wants to merge 1 commit into
Open
Conversation
jwasinger
reviewed
Aug 18, 2025
| hkey := keybytesToHex(key) | ||
| ikeys[hkey[0]] = append(ikeys[hkey[0]], hkey) | ||
| ivals[hkey[0]] = append(ivals[hkey[0]], values[i]) | ||
| } |
Contributor
There was a problem hiding this comment.
Suggested change
| } | |
| } | |
| if len(keys) > 0 { | |
| fn.flags = t.newFlag() | |
| } |
We need to reset the flag of the root node if there are any mutations. Otherwise, when it comes time to hash, the previous hashed node will be cached in the root.
gballet
reviewed
Aug 19, 2025
Comment on lines
+189
to
+222
| func (t *VerkleTrie) UpdateStorageBatch(address common.Address, keys [][]byte, values [][]byte) error { | ||
| if len(keys) != len(values) { | ||
| return fmt.Errorf("keys and values length mismatch: %d != %d", len(keys), len(values)) | ||
| } | ||
| for i, key := range keys { | ||
| if err := t.UpdateStorage(address, key, values[i]); err != nil { | ||
| return err | ||
| } | ||
| } | ||
| return nil | ||
| } | ||
|
|
cd191ed to
a160896
Compare
Closed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This feature is an optimization used in the BAL, mostly for experimental purpose.