-
Notifications
You must be signed in to change notification settings - Fork 773
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tx: ensure eip3860 txs can have more than max_initcode_size data if t…
…o field is non-empty (#2575)
- Loading branch information
1 parent
1d65ea0
commit 26a8dcd
Showing
5 changed files
with
77 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import { Chain, Common, Hardfork } from '@ethereumjs/common' | ||
import { Address } from '@ethereumjs/util' | ||
import * as tape from 'tape' | ||
|
||
import { TransactionFactory } from '../src' | ||
|
||
const common = new Common({ | ||
chain: Chain.Mainnet, | ||
hardfork: Hardfork.Merge, | ||
eips: [3860, 4844, 4895], | ||
}) | ||
|
||
const maxInitCodeSize = common.param('vm', 'maxInitCodeSize') | ||
const txTypes = [0, 1, 2, 5] | ||
const addressZero = Address.zero() | ||
|
||
tape('[EIP3860 tests]', function (t) { | ||
t.test('Should instantiate create txs with MAX_INITCODE_SIZE', (st) => { | ||
const data = Buffer.alloc(Number(maxInitCodeSize)) | ||
for (const txType of txTypes) { | ||
try { | ||
TransactionFactory.fromTxData({ data, type: txType }, { common }) | ||
st.ok('Instantiated create tx with MAX_INITCODE_SIZE data') | ||
} catch (e) { | ||
st.fail('Did not instantiate create tx with MAX_INITCODE_SIZE') | ||
} | ||
} | ||
st.end() | ||
}) | ||
|
||
t.test('Should instantiate txs with MAX_INITCODE_SIZE data', (st) => { | ||
const data = Buffer.alloc(Number(maxInitCodeSize)) | ||
for (const txType of txTypes) { | ||
try { | ||
TransactionFactory.fromTxData({ data, type: txType, to: addressZero }, { common }) | ||
st.ok('Instantiated tx with MAX_INITCODE_SIZE') | ||
} catch (e) { | ||
st.fail('Did not instantiated tx with MAX_INITCODE_SIZE') | ||
} | ||
} | ||
st.end() | ||
}) | ||
|
||
t.test('Should not instantiate create txs with MAX_INITCODE_SIZE+1 data', (st) => { | ||
const data = Buffer.alloc(Number(maxInitCodeSize) + 1) | ||
for (const txType of txTypes) { | ||
try { | ||
TransactionFactory.fromTxData({ data, type: txType }, { common }) | ||
st.fail('Instantiated create tx with MAX_INITCODE_SIZE+1') | ||
} catch (e) { | ||
st.ok('Did not instantiate create tx with MAX_INITCODE_SIZE+1') | ||
} | ||
} | ||
st.end() | ||
}) | ||
|
||
t.test('Should instantiate txs with MAX_INITCODE_SIZE+1 data', (st) => { | ||
const data = Buffer.alloc(Number(maxInitCodeSize) + 1) | ||
for (const txType of txTypes) { | ||
try { | ||
TransactionFactory.fromTxData({ data, type: txType, to: addressZero }, { common }) | ||
st.ok('Instantiated tx with MAX_INITCODE_SIZE+1') | ||
} catch (e) { | ||
st.fail('Did not instantiate tx with MAX_INITCODE_SIZE+1') | ||
} | ||
} | ||
st.end() | ||
}) | ||
}) |
26a8dcd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold
2
.Block 9422907
7727
ops/sec (±4.48%
)15876
ops/sec (±1.64%
)2.05
This comment was automatically generated by workflow using github-action-benchmark.