Skip to content

Commit 449a9e2

Browse files
committed
fix the vm build
1 parent 2c1efa8 commit 449a9e2

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

packages/block/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ export * from './header/index.js'
66
export {
77
genRequestsTrieRoot,
88
genTransactionsTrieRoot,
9+
genTransactionsSszRoot,
910
genWithdrawalsTrieRoot,
11+
genWithdrawalsSszRoot,
1012
getDifficulty,
1113
valuesArrayToHeaderData,
1214
} from './helpers.js'

packages/vm/src/buildBlock.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import {
22
createBlock,
33
createSealedCliqueBlock,
44
genRequestsTrieRoot,
5-
genTransactionsTrieRoot,
65
genTransactionsSszRoot,
7-
genWithdrawalsTrieRoot,
6+
genTransactionsTrieRoot,
87
genWithdrawalsSszRoot,
8+
genWithdrawalsTrieRoot,
99
} from '@ethereumjs/block'
1010
import { ConsensusType, Hardfork } from '@ethereumjs/common'
1111
import { RLP } from '@ethereumjs/rlp'
@@ -151,6 +151,16 @@ export class BlockBuilder {
151151
: genTransactionsTrieRoot(this.transactions, new Trie({ common: this.vm.common }))
152152
}
153153

154+
public async withdrawalsTrie() {
155+
if (this.withdrawals === undefined) {
156+
return
157+
}
158+
159+
return this.vm.common.isActivatedEIP(6493)
160+
? genWithdrawalsSszRoot(this.withdrawals)
161+
: genWithdrawalsTrieRoot(this.withdrawals, new Trie({ common: this.vm.common }))
162+
}
163+
154164
/**
155165
* Calculates and returns the logs bloom for the block.
156166
*/
@@ -326,11 +336,7 @@ export class BlockBuilder {
326336
await this.processWithdrawals()
327337

328338
const transactionsTrie = await this.transactionsTrie()
329-
const withdrawalsRoot = this.withdrawals
330-
? this.vm.common.isActivatedEIP(6493)
331-
? genWithdrawalsSszRoot(this.withdrawals)
332-
: genWithdrawalsTrieRoot(this.withdrawals, new Trie({ common: this.vm.common }))
333-
: undefined
339+
const withdrawalsRoot = await this.withdrawalsTrie()
334340
const receiptTrie = await this.receiptTrie()
335341
const logsBloom = this.logsBloom()
336342
const gasUsed = this.gasUsed

0 commit comments

Comments
 (0)