Skip to content

Reuse deposit trie root in ProcessDepositLog#16764

Open
wissyLeeei wants to merge 1 commit into
OffchainLabs:developfrom
wissyLeeei:ProcessDepositLog
Open

Reuse deposit trie root in ProcessDepositLog#16764
wissyLeeei wants to merge 1 commit into
OffchainLabs:developfrom
wissyLeeei:ProcessDepositLog

Conversation

@wissyLeeei
Copy link
Copy Markdown

Was looking at deposit log processing and noticed ProcessDepositLog calls HashTreeRoot() twice on the same unchanged trie state — once before InsertDeposit, then again in the chainstart/pending branch. getRoot walks the tree recursively, so we pay that hash cost twice per log for no reason. Just keep the root from the first call and use it in both branches.

Was looking at deposit log processing and noticed `ProcessDepositLog` calls `HashTreeRoot()` twice on the same unchanged trie state — once before `InsertDeposit`, then again in the chainstart/pending branch. `getRoot` walks the tree recursively, so we pay that hash cost twice per log for no reason. Just keep the `root` from the first call and use it in both branches.
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.

1 participant