Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests for EIP-3860: Limit and meter initcode #990

Merged
merged 5 commits into from
Nov 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

107 changes: 107 additions & 0 deletions GeneralStateTests/stEIP3860/create2InitCodeSizeLimit.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{
"create2InitCodeSizeLimit" : {
"_info" : {
"comment" : "",
"filling-rpc-server" : "evm version 1.11.0-unstable-f4542605-20221109",
"filling-tool-version" : "retesteth-0.2.3-postmerge+commit.1de2b4bd.Linux.g++",
"generatedTestHash" : "d9d5365a2c781ab26671cfac3d8a48d852fb6aa7e14b60566b86bd913d3b5615",
"labels" : {
"0" : "valid",
"1" : "invalid"
},
"lllcversion" : "Error getting LLLC Version",
"solidity" : "Version: 0.8.17-develop.2022.9.30+commit.8df45f5f.Linux.clang",
"source" : "src/GeneralStateTestsFiller/stEIP3860/create2InitCodeSizeLimitFiller.yml",
"sourceHash" : "bbdf711aad58bc3ca6266f7508440c279e72d5077c6006f3b89e0e8871fa5d8c"
},
"env" : {
"currentBaseFee" : "0x0a",
"currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentDifficulty" : "0x020000",
"currentGasLimit" : "0x01312d00",
"currentNumber" : "0x01",
"currentRandom" : "0x0000000000000000000000000000000000000000000000000000000000020000",
"currentTimestamp" : "0x03e8",
"previousHash" : "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"post" : {
"Merge" : [
{
"hash" : "0x91919fd9e9bd89632e9f43f859b93f078826e0bd3cf74afe6eef00f34c8be161",
"indexes" : {
"data" : 0,
"gas" : 0,
"value" : 0
},
"logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"txbytes" : "0xf880800a83e4e1c094b94f5374fce5edbc8e2a8697c15331677e6ebf0b80a0000000000000000000000000000000000000000000000000000000000000c0001ba0110f52aeb16c3e91943160d2e89c416b06dc47c7484a882324c6d0d362a26cd0a0774c7a35a3503be3867e7bb56885a9056ab1b7e5bfad19b1b0a3550d49a89d6f"
},
{
"hash" : "0x72a8647bfb3a00104bc799cc8317312a61101db77598678fdd918455669f9fc3",
"indexes" : {
"data" : 1,
"gas" : 0,
"value" : 0
},
"logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"txbytes" : "0xf880800a83e4e1c094b94f5374fce5edbc8e2a8697c15331677e6ebf0b80a0000000000000000000000000000000000000000000000000000000000000c0011ca0fa5e0f7c53cba5169bd5b239b479ba8668cf69d8c06d24b00a585b995a1c2c67a056382ddd27880d6393b3f905dc75db8a0c30eeb1c9a8443ac53723ca4feba37c"
}
],
"Merge+3860" : [
{
"hash" : "0xbc6ec94a191c2a51b198b7041ddc7aaaf580ee5354139617618f733588c41f03",
"indexes" : {
"data" : 0,
"gas" : 0,
"value" : 0
},
"logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"txbytes" : "0xf880800a83e4e1c094b94f5374fce5edbc8e2a8697c15331677e6ebf0b80a0000000000000000000000000000000000000000000000000000000000000c0001ba0110f52aeb16c3e91943160d2e89c416b06dc47c7484a882324c6d0d362a26cd0a0774c7a35a3503be3867e7bb56885a9056ab1b7e5bfad19b1b0a3550d49a89d6f"
},
{
"hash" : "0x46dca2d3f7dc62c6262488db7a65f3a10851748b9f530d79f573077b2fcc4890",
"indexes" : {
"data" : 1,
"gas" : 0,
"value" : 0
},
"logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"txbytes" : "0xf880800a83e4e1c094b94f5374fce5edbc8e2a8697c15331677e6ebf0b80a0000000000000000000000000000000000000000000000000000000000000c0011ca0fa5e0f7c53cba5169bd5b239b479ba8668cf69d8c06d24b00a585b995a1c2c67a056382ddd27880d6393b3f905dc75db8a0c30eeb1c9a8443ac53723ca4feba37c"
}
]
},
"pre" : {
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "0x0bebc200",
"code" : "0x",
"nonce" : "0x00",
"storage" : {
}
},
"0xb94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "0x00",
"code" : "0x7f600a80600080396000f3000000000000000000000000000000000000000000006000526000355a600082600080f55a8203600a558060005560018055505050",
"nonce" : "0x00",
"storage" : {
}
}
},
"transaction" : {
"data" : [
"0x000000000000000000000000000000000000000000000000000000000000c000",
"0x000000000000000000000000000000000000000000000000000000000000c001"
],
"gasLimit" : [
"0xe4e1c0"
],
"gasPrice" : "0x0a",
"nonce" : "0x00",
"secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
"sender" : "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"to" : "0xb94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"value" : [
"0x00"
]
}
}
}
107 changes: 107 additions & 0 deletions GeneralStateTests/stEIP3860/createInitCodeSizeLimit.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{
"createInitCodeSizeLimit" : {
"_info" : {
"comment" : "",
"filling-rpc-server" : "evm version 1.11.0-unstable-f4542605-20221109",
"filling-tool-version" : "retesteth-0.2.3-postmerge+commit.1de2b4bd.Linux.g++",
"generatedTestHash" : "4f37573384dee7c1c015e32dd7b260405c83cae49a615fced19c5e7ee48a69ae",
"labels" : {
"0" : "valid",
"1" : "invalid"
},
"lllcversion" : "Error getting LLLC Version",
"solidity" : "Version: 0.8.17-develop.2022.9.30+commit.8df45f5f.Linux.clang",
"source" : "src/GeneralStateTestsFiller/stEIP3860/createInitCodeSizeLimitFiller.yml",
"sourceHash" : "166699a98f634ae792035ae345b45e6e383522f98890defe1b61da9f5b7d191f"
},
"env" : {
"currentBaseFee" : "0x0a",
"currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentDifficulty" : "0x020000",
"currentGasLimit" : "0x01312d00",
"currentNumber" : "0x01",
"currentRandom" : "0x0000000000000000000000000000000000000000000000000000000000020000",
"currentTimestamp" : "0x03e8",
"previousHash" : "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"post" : {
"Merge" : [
{
"hash" : "0x150699ad823e7d079fad2b574f929c81fa962752564c27cc873d238c54068946",
"indexes" : {
"data" : 0,
"gas" : 0,
"value" : 0
},
"logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"txbytes" : "0xf880800a83e4e1c094b94f5374fce5edbc8e2a8697c15331677e6ebf0b80a0000000000000000000000000000000000000000000000000000000000000c0001ba0110f52aeb16c3e91943160d2e89c416b06dc47c7484a882324c6d0d362a26cd0a0774c7a35a3503be3867e7bb56885a9056ab1b7e5bfad19b1b0a3550d49a89d6f"
},
{
"hash" : "0x08fdfe2b2c1ce03d3d879c140bd0c2f809a030aaf4f5654f7636225910d5d34d",
"indexes" : {
"data" : 1,
"gas" : 0,
"value" : 0
},
"logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"txbytes" : "0xf880800a83e4e1c094b94f5374fce5edbc8e2a8697c15331677e6ebf0b80a0000000000000000000000000000000000000000000000000000000000000c0011ca0fa5e0f7c53cba5169bd5b239b479ba8668cf69d8c06d24b00a585b995a1c2c67a056382ddd27880d6393b3f905dc75db8a0c30eeb1c9a8443ac53723ca4feba37c"
}
],
"Merge+3860" : [
{
"hash" : "0x972831e08af5f60350afb977e576ca952ef0fc832221288c41ef2c9b60e679bd",
"indexes" : {
"data" : 0,
"gas" : 0,
"value" : 0
},
"logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"txbytes" : "0xf880800a83e4e1c094b94f5374fce5edbc8e2a8697c15331677e6ebf0b80a0000000000000000000000000000000000000000000000000000000000000c0001ba0110f52aeb16c3e91943160d2e89c416b06dc47c7484a882324c6d0d362a26cd0a0774c7a35a3503be3867e7bb56885a9056ab1b7e5bfad19b1b0a3550d49a89d6f"
},
{
"hash" : "0x318c8bb6725dee48041bfb137a23af54688b9ef798cb2cf85f03a5bc698d68c2",
"indexes" : {
"data" : 1,
"gas" : 0,
"value" : 0
},
"logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"txbytes" : "0xf880800a83e4e1c094b94f5374fce5edbc8e2a8697c15331677e6ebf0b80a0000000000000000000000000000000000000000000000000000000000000c0011ca0fa5e0f7c53cba5169bd5b239b479ba8668cf69d8c06d24b00a585b995a1c2c67a056382ddd27880d6393b3f905dc75db8a0c30eeb1c9a8443ac53723ca4feba37c"
}
]
},
"pre" : {
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "0x0bebc200",
"code" : "0x",
"nonce" : "0x00",
"storage" : {
}
},
"0xb94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "0x00",
"code" : "0x7f600a80600080396000f3000000000000000000000000000000000000000000006000526000355a81600080f05a8203600a558060005560018055505050",
"nonce" : "0x00",
"storage" : {
}
}
},
"transaction" : {
"data" : [
"0x000000000000000000000000000000000000000000000000000000000000c000",
"0x000000000000000000000000000000000000000000000000000000000000c001"
],
"gasLimit" : [
"0xe4e1c0"
],
"gasPrice" : "0x0a",
"nonce" : "0x00",
"secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
"sender" : "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"to" : "0xb94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"value" : [
"0x00"
]
}
}
}
101 changes: 101 additions & 0 deletions GeneralStateTests/stEIP3860/creationTxInitCodeSizeLimit.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# CREATE2 with max allowed init code size
create2InitCodeSizeLimit:
env:
currentCoinbase: 2adc25665018aa1fe0e6bc666dac8fc2697ff9ba
currentDifficulty: '0x020000'
currentGasLimit: '20000000'
currentBaseFee: '10'
currentNumber: '1'
currentTimestamp: '1000'
previousHash: 5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6

pre:
a94f5374fce5edbc8e2a8697c15331677e6ebf0b:
balance: 200000000
code: ''
nonce: 0
storage: {}
b94f5374fce5edbc8e2a8697c15331677e6ebf0b:
balance: 0
code: |
:yul
{
// :yul { codecopy(0x00, 0x00, 0x0a) return(0x00, 0x0a) }
mstore(0, 0x600a80600080396000f300000000000000000000000000000000000000000000)
// get initcode size from calldata
let initcode_size := calldataload(0)
let gas_before := gas()
let create_result := create2(0, 0, initcode_size, 0)
sstore(10, sub(gas_before, gas()))
sstore(0, create_result)
sstore(1, 1)
}
nonce: 0
storage: {}

transaction:
data:
# Valid initcode size = 49152 bytes
- ':label valid :raw 0x000000000000000000000000000000000000000000000000000000000000c000'
# Invalid initcode size = 49153 bytes
- ':label invalid :raw 0x000000000000000000000000000000000000000000000000000000000000c001'
gasLimit:
- 15000000
gasPrice: 10
nonce: 0
secretKey: 45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8
to: 'b94f5374fce5edbc8e2a8697c15331677e6ebf0b'
value:
- 0

expect:
- indexes:
data: ':label valid'
network:
- 'Merge'
result:
a94f5374fce5edbc8e2a8697c15331677e6ebf0b:
nonce: 1
b94f5374fce5edbc8e2a8697c15331677e6ebf0b:
storage:
'0': '7b453b2ba212f731bec025f8f441f01547d79bfb'
'1': 1
'10': 52467
7b453b2ba212f731bec025f8f441f01547d79bfb:
balance: 0
code: '0x600a80600080396000f3'
nonce: 1
storage: {}

- indexes:
data: ':label invalid'
network:
- 'Merge'
result:
a94f5374fce5edbc8e2a8697c15331677e6ebf0b:
nonce: 1
b94f5374fce5edbc8e2a8697c15331677e6ebf0b:
storage:
'0': '094147686c565aa7ccac18000c3b7b4d099f92d3'
'1': 1
'10': 52482
094147686c565aa7ccac18000c3b7b4d099f92d3:
balance: 0
code: '0x600a80600080396000f3'
nonce: 1
storage: {}

- indexes:
data: ':label valid'
network:
- 'Merge+3860'
result:
a94f5374fce5edbc8e2a8697c15331677e6ebf0b:
nonce: 1
b94f5374fce5edbc8e2a8697c15331677e6ebf0b:
storage:
'0': '7b453b2ba212f731bec025f8f441f01547d79bfb'
'1': 1
# Difference with Merge is the charge for initcode 49152 // 32 * 2 = 3072 gas
'10': 55539
7b453b2ba212f731bec025f8f441f01547d79bfb:
balance: 0
code: '0x600a80600080396000f3'
nonce: 1
storage: {}

- indexes:
data: ':label invalid'
network:
- 'Merge+3860'
result:
a94f5374fce5edbc8e2a8697c15331677e6ebf0b:
nonce: 1
b94f5374fce5edbc8e2a8697c15331677e6ebf0b:
storage:
'0': 0
'1': 1
'10': 53532
094147686c565aa7ccac18000c3b7b4d099f92d3:
shouldnotexist: 1
Loading