From 3dd3bec3562b34c3dda08842f2c33f9635a71690 Mon Sep 17 00:00:00 2001 From: g11tech Date: Thu, 9 May 2024 22:35:09 +0530 Subject: [PATCH] vm: fix the gathering of stateroot only after requests have been accumulated (#3413) --- packages/vm/src/buildBlock.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/vm/src/buildBlock.ts b/packages/vm/src/buildBlock.ts index eb3a4655ee..8eaacdf6e4 100644 --- a/packages/vm/src/buildBlock.ts +++ b/packages/vm/src/buildBlock.ts @@ -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 })) @@ -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,