Skip to content

Commit a75c55c

Browse files
block: swap withdrawal/opts in constructor (ethereumjs#2715)
* block: swap withdrawal/opts in constructor * blockchain: fix pkg * vm: fix test runner --------- Co-authored-by: Holger Drewes <[email protected]>
1 parent dd80af6 commit a75c55c

File tree

5 files changed

+17
-11
lines changed

5 files changed

+17
-11
lines changed

packages/block/src/block.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export class Block {
127127

128128
const withdrawals = withdrawalsData?.map(Withdrawal.fromWithdrawalData)
129129

130-
return new Block(header, transactions, uncleHeaders, opts, withdrawals)
130+
return new Block(header, transactions, uncleHeaders, withdrawals, opts)
131131
}
132132

133133
/**
@@ -212,7 +212,7 @@ export class Block {
212212
}))
213213
?.map(Withdrawal.fromWithdrawalData)
214214

215-
return new Block(header, transactions, uncleHeaders, opts, withdrawals)
215+
return new Block(header, transactions, uncleHeaders, withdrawals, opts)
216216
}
217217

218218
/**
@@ -370,8 +370,8 @@ export class Block {
370370
header?: BlockHeader,
371371
transactions: TypedTransaction[] = [],
372372
uncleHeaders: BlockHeader[] = [],
373-
opts: BlockOptions = {},
374-
withdrawals?: Withdrawal[]
373+
withdrawals?: Withdrawal[],
374+
opts: BlockOptions = {}
375375
) {
376376
this.header = header ?? BlockHeader.fromHeaderData({}, opts)
377377
this._common = this.header._common

packages/block/test/mergeBlock.spec.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ tape('[Header]: Casper PoS / The Merge Functionality', function (t) {
4040
const header = BlockHeader.fromHeaderData({}, { common })
4141
validateMergeHeader(st, header)
4242

43-
const block = new Block(undefined, undefined, undefined, { common })
43+
const block = new Block(undefined, undefined, undefined, undefined, { common })
4444
validateMergeHeader(st, block.header)
4545

4646
st.end()
@@ -106,9 +106,15 @@ tape('[Header]: Casper PoS / The Merge Functionality', function (t) {
106106

107107
t.test('test that a PoS block with uncles cannot be produced', function (st) {
108108
try {
109-
new Block(undefined, undefined, [BlockHeader.fromHeaderData(undefined, { common })], {
110-
common,
111-
})
109+
new Block(
110+
undefined,
111+
undefined,
112+
[BlockHeader.fromHeaderData(undefined, { common })],
113+
undefined,
114+
{
115+
common,
116+
}
117+
)
112118
st.fail('should have thrown')
113119
} catch (e: any) {
114120
st.pass('should throw')

packages/blockchain/src/blockchain.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ export class Blockchain implements BlockchainInterface {
418418
try {
419419
const block =
420420
item instanceof BlockHeader
421-
? new Block(item, undefined, undefined, {
421+
? new Block(item, undefined, undefined, undefined, {
422422
common: item._common,
423423
})
424424
: item

packages/blockchain/test/util.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export const generateConsecutiveBlock = (
9898
}
9999
)
100100

101-
const block = new Block(header, undefined, undefined, { common })
101+
const block = new Block(header, undefined, undefined, undefined, { common })
102102

103103
return block
104104
}

packages/vm/test/tester/runners/GeneralStateTestsRunner.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ async function runTestCase(options: any, testData: any, t: tape.Test) {
7979

8080
// Have to create a blockchain with empty block as genesisBlock for Merge
8181
// Otherwise mainnet genesis will throw since this has difficulty nonzero
82-
const genesisBlock = new Block(undefined, undefined, undefined, { common })
82+
const genesisBlock = new Block(undefined, undefined, undefined, undefined, { common })
8383
const blockchain = await Blockchain.create({ genesisBlock, common })
8484
const state = new Trie({ useKeyHashing: true })
8585
const stateManager = new DefaultStateManager({

0 commit comments

Comments
 (0)