Skip to content

Commit

Permalink
vm: fix the gathering of stateroot only after requests have been accu…
Browse files Browse the repository at this point in the history
…mulated (#3413)
  • Loading branch information
g11tech committed May 9, 2024
1 parent 0e06ddf commit 3dd3bec
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/vm/src/buildBlock.ts
Expand Up @@ -304,7 +304,6 @@ export class BlockBuilder {
}
await this.processWithdrawals()

const stateRoot = await this.vm.stateManager.getStateRoot()
const transactionsTrie = await this.transactionsTrie()
const withdrawalsRoot = this.withdrawals
? await Block.genWithdrawalsTrieRoot(this.withdrawals, new Trie({ common: this.vm.common }))
Expand All @@ -328,6 +327,8 @@ export class BlockBuilder {
// Do other validations per request type
}

// get stateRoot after all the accumulateRequests etc have been done
const stateRoot = await this.vm.stateManager.getStateRoot()
const headerData = {
...this.headerData,
stateRoot,
Expand Down

0 comments on commit 3dd3bec

Please sign in to comment.