Skip to content

trie: introduce UpdateBatch#32448

Open
rjl493456442 wants to merge 1 commit into
ethereum:masterfrom
rjl493456442:trie-concurrent-insert
Open

trie: introduce UpdateBatch#32448
rjl493456442 wants to merge 1 commit into
ethereum:masterfrom
rjl493456442:trie-concurrent-insert

Conversation

@rjl493456442
Copy link
Copy Markdown
Member

@rjl493456442 rjl493456442 commented Aug 15, 2025

This feature is an optimization used in the BAL, mostly for experimental purpose.

Comment thread trie/trie.go
hkey := keybytesToHex(key)
ikeys[hkey[0]] = append(ikeys[hkey[0]], hkey)
ivals[hkey[0]] = append(ivals[hkey[0]], values[i])
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread trie/verkle.go
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
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

either implement it, or panic

@jwasinger jwasinger mentioned this pull request Mar 2, 2026
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.

3 participants