Skip to content

Commit

Permalink
EIP-3860 tests: CREATE/CREATE2 fails with OOG if size above limit
Browse files Browse the repository at this point in the history
  • Loading branch information
gumb0 authored and winsvega committed Jan 6, 2023
1 parent 0d14b3f commit b0ec571
Show file tree
Hide file tree
Showing 6 changed files with 399 additions and 227 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

23 changes: 15 additions & 8 deletions GeneralStateTests/EIPTests/stEIP3860/create2InitCodeSizeLimit.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
"create2InitCodeSizeLimit" : {
"_info" : {
"comment" : "",
"filling-rpc-server" : "evm version 1.11.0-unstable-77e8a6f0-20221227",
"filling-rpc-server" : "evm version 1.11.0-unstable-f485063a-20230102",
"filling-tool-version" : "retesteth-0.2.3-postmerge+commit.9190dff4.Linux.g++",
"generatedTestHash" : "5f7cb357367d95942b1a0e94b1170e24e178a1649ba5c651bb182db89769f1fd",
"generatedTestHash" : "e03b0a5061cd2b29f0558d77a2ce847216f17467d7aa534d559ab9f0d4b8c34a",
"labels" : {
"0" : "valid",
"1" : "invalid"
},
"lllcversion" : "Version: 0.5.14-develop.2021.4.29+commit.14c9d5de.Linux.clang",
"solidity" : "Version: 0.8.17-develop.2022.9.30+commit.8df45f5f.Linux.clang",
"source" : "src/GeneralStateTestsFiller/EIPTests/stEIP3860/create2InitCodeSizeLimitFiller.yml",
"sourceHash" : "18c064ae536aeaeb5ef8b6bcd721527275d3b08b9b28583e37df0d04263245d8"
"sourceHash" : "16280ab980346bcb7a218d61003dd42e9d6d4c10b2ebccedaf3ce0164e58b882"
},
"env" : {
"currentBaseFee" : "0x0a",
Expand All @@ -27,7 +27,7 @@
"post" : {
"Merge" : [
{
"hash" : "0x6bf918e6647897b16434aba8858a1fdfcf84eb23f3deabe8ab8a23f185824639",
"hash" : "0xedacd100b4cc31f6ea378bd5871113718551c73e8f0e78e0265cda28b45bbe96",
"indexes" : {
"data" : 0,
"gas" : 0,
Expand All @@ -37,7 +37,7 @@
"txbytes" : "0xf880800a83e4e1c094b94f5374fce5edbc8e2a8697c15331677e6ebf0b80a0000000000000000000000000000000000000000000000000000000000000c0001ba0110f52aeb16c3e91943160d2e89c416b06dc47c7484a882324c6d0d362a26cd0a0774c7a35a3503be3867e7bb56885a9056ab1b7e5bfad19b1b0a3550d49a89d6f"
},
{
"hash" : "0xbde23ba49fe9f9a149957c4079615cf284aa318a9432a3c438c86a55ea5eea82",
"hash" : "0x51235df0a4a90e09f020115aced82b4bf568295160740e002264e966e8454a69",
"indexes" : {
"data" : 1,
"gas" : 0,
Expand All @@ -49,7 +49,7 @@
],
"Merge+3860" : [
{
"hash" : "0xf9477cfb86d7b7ab9ede76fb61c3ca06a1581d36d9d3d5612eeeabd5a5b5ea99",
"hash" : "0x812b09db30c2a7eb6ddb5d973f5ec54790cc7368528392fb729e8468e248d051",
"indexes" : {
"data" : 0,
"gas" : 0,
Expand All @@ -59,7 +59,7 @@
"txbytes" : "0xf880800a83e4e1c094b94f5374fce5edbc8e2a8697c15331677e6ebf0b80a0000000000000000000000000000000000000000000000000000000000000c0001ba0110f52aeb16c3e91943160d2e89c416b06dc47c7484a882324c6d0d362a26cd0a0774c7a35a3503be3867e7bb56885a9056ab1b7e5bfad19b1b0a3550d49a89d6f"
},
{
"hash" : "0xf9eaaf90d4ce373df38f0f125761072061694b2872d35f0ab1b91486d28528f6",
"hash" : "0x94f5d6edcef1db40d0aeab8586a8980b952ce1f94d579e2d873148cbfec620a9",
"indexes" : {
"data" : 1,
"gas" : 0,
Expand All @@ -80,7 +80,14 @@
},
"0xb94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "0x00",
"code" : "0x7f600a80600080396000f3000000000000000000000000000000000000000000006000526000355a63deadbeef82600080f55a8203600a558060005560018055505050",
"code" : "0x6000356000526000803660008073c94f5374fce5edbc8e2a8697c15331677e6ebf0b62989680f1806000556001805550",
"nonce" : "0x00",
"storage" : {
}
},
"0xc94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "0x00",
"code" : "0x7f600a80600080396000f3000000000000000000000000000000000000000000006000526000355a63deadbeef82600080f55a8203600a5580600055505050",
"nonce" : "0x00",
"storage" : {
}
Expand Down
29 changes: 18 additions & 11 deletions GeneralStateTests/EIPTests/stEIP3860/createInitCodeSizeLimit.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
"createInitCodeSizeLimit" : {
"_info" : {
"comment" : "",
"filling-rpc-server" : "evm version 1.11.0-unstable-8b819aea-20221123",
"filling-tool-version" : "retesteth-0.2.3-postmerge+commit.1de2b4bd.Linux.g++",
"generatedTestHash" : "b330c887912eb92c0e69dea6f127cbe8aa6910eba091355d21070b2c1db518e5",
"filling-rpc-server" : "evm version 1.11.0-unstable-f485063a-20230102",
"filling-tool-version" : "retesteth-0.2.3-postmerge+commit.9190dff4.Linux.g++",
"generatedTestHash" : "f6a1fe88b1ac8b42357e2cca65f56a5496230ccfc70af854e5e6c2a57532848c",
"labels" : {
"0" : "valid",
"1" : "invalid"
},
"lllcversion" : "Error getting LLLC Version",
"lllcversion" : "Version: 0.5.14-develop.2021.4.29+commit.14c9d5de.Linux.clang",
"solidity" : "Version: 0.8.17-develop.2022.9.30+commit.8df45f5f.Linux.clang",
"source" : "src/GeneralStateTestsFiller/EIPTests/stEIP3860/createInitCodeSizeLimitFiller.yml",
"sourceHash" : "861b77bf26c2f94a76086292fe35ee5fb4f9fb037e1c2caaccfb8a78ffc4bbbe"
"sourceHash" : "222d6b843a2b945ebaf102eaa07e959f6c6eb4501257563d62ee223653f0b908"
},
"env" : {
"currentBaseFee" : "0x0a",
Expand All @@ -27,7 +27,7 @@
"post" : {
"Merge" : [
{
"hash" : "0x150699ad823e7d079fad2b574f929c81fa962752564c27cc873d238c54068946",
"hash" : "0xab66169bc16a65cfe02912507c76b534aefefbbd471644beece2eeaedfb73b4d",
"indexes" : {
"data" : 0,
"gas" : 0,
Expand All @@ -37,7 +37,7 @@
"txbytes" : "0xf880800a83e4e1c094b94f5374fce5edbc8e2a8697c15331677e6ebf0b80a0000000000000000000000000000000000000000000000000000000000000c0001ba0110f52aeb16c3e91943160d2e89c416b06dc47c7484a882324c6d0d362a26cd0a0774c7a35a3503be3867e7bb56885a9056ab1b7e5bfad19b1b0a3550d49a89d6f"
},
{
"hash" : "0x08fdfe2b2c1ce03d3d879c140bd0c2f809a030aaf4f5654f7636225910d5d34d",
"hash" : "0x56b9238a5c3cc3e0e8dd77d6e376444c62081b3a86ea68ded1a5450e87e518a7",
"indexes" : {
"data" : 1,
"gas" : 0,
Expand All @@ -49,7 +49,7 @@
],
"Merge+3860" : [
{
"hash" : "0x972831e08af5f60350afb977e576ca952ef0fc832221288c41ef2c9b60e679bd",
"hash" : "0x3f3ccd2d0daae88cd08551e0c993d6c1729b4910fbf87b74346682f5d78e34d1",
"indexes" : {
"data" : 0,
"gas" : 0,
Expand All @@ -59,7 +59,7 @@
"txbytes" : "0xf880800a83e4e1c094b94f5374fce5edbc8e2a8697c15331677e6ebf0b80a0000000000000000000000000000000000000000000000000000000000000c0001ba0110f52aeb16c3e91943160d2e89c416b06dc47c7484a882324c6d0d362a26cd0a0774c7a35a3503be3867e7bb56885a9056ab1b7e5bfad19b1b0a3550d49a89d6f"
},
{
"hash" : "0x96efede720d48405f640c41837a8da4775e970271046b2bfa00a2491572775f4",
"hash" : "0x695742bae619ff06d6bf217f9b24480a3d5b7911adbd7eb3f88810777c40484c",
"indexes" : {
"data" : 1,
"gas" : 0,
Expand All @@ -80,7 +80,14 @@
},
"0xb94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "0x00",
"code" : "0x7f600a80600080396000f3000000000000000000000000000000000000000000006000526000355a81600080f05a8203600a558060005560018055505050",
"code" : "0x6000356000526000803660008073c94f5374fce5edbc8e2a8697c15331677e6ebf0b62989680f1806000556001805550",
"nonce" : "0x00",
"storage" : {
}
},
"0xc94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "0x00",
"code" : "0x7f600a80600080396000f3000000000000000000000000000000000000000000006000526000355a81600080f05a8203600a5580600055505050",
"nonce" : "0x00",
"storage" : {
}
Expand All @@ -104,4 +111,4 @@
]
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ create2InitCodeSizeLimit:
nonce: 0
storage: {}
b94f5374fce5edbc8e2a8697c15331677e6ebf0b:
balance: 0
code: |
:yul
{
mstore(0, calldataload(0))
let call_result := call(10000000, 0xc94f5374fce5edbc8e2a8697c15331677e6ebf0b, 0, 0, calldatasize(), 0, 0)
sstore(0, call_result)
sstore(1, 1)
}
nonce: 0
storage: {}
c94f5374fce5edbc8e2a8697c15331677e6ebf0b:
balance: 0
code: |
:yul
Expand All @@ -28,7 +40,6 @@ create2InitCodeSizeLimit:
let create_result := create2(0, 0, initcode_size, 0xdeadbeef)
sstore(10, sub(gas_before, gas()))
sstore(0, create_result)
sstore(1, 1)
}
nonce: 0
storage: {}
Expand Down Expand Up @@ -58,10 +69,13 @@ create2InitCodeSizeLimit:
nonce: 1
b94f5374fce5edbc8e2a8697c15331677e6ebf0b:
storage:
'0': 'd6a6b48801accf08b474a42d01d4b82666e4952c'
'1': 1
'10': 52467
d6a6b48801accf08b474a42d01d4b82666e4952c:
'0': 1 # subcall successful
'1': 1 # test successful, no OOG
c94f5374fce5edbc8e2a8697c15331677e6ebf0b:
storage:
'0': '9e7a3337d18c31fe4c1fe51ab2da6cfd3629923d' # created account
'10': 52467 # gas used by CREATE
9e7a3337d18c31fe4c1fe51ab2da6cfd3629923d:
balance: 0
code: '0x600a80600080396000f3'
nonce: 1
Expand All @@ -76,10 +90,13 @@ create2InitCodeSizeLimit:
nonce: 1
b94f5374fce5edbc8e2a8697c15331677e6ebf0b:
storage:
'0': '23cebc55ea992f8b7d924cdbeee710e66d9bfd3b'
'1': 1
'10': 52482
23cebc55ea992f8b7d924cdbeee710e66d9bfd3b:
'0': 1 # subcall successful
'1': 1 # test successful, no OOG
c94f5374fce5edbc8e2a8697c15331677e6ebf0b:
storage:
'0': '67d49ae27e912b3b508d62ce1e463298db6edf32' # created account
'10': 52482 # gas used by CREATE
67d49ae27e912b3b508d62ce1e463298db6edf32:
balance: 0
code: '0x600a80600080396000f3'
nonce: 1
Expand All @@ -94,11 +111,14 @@ create2InitCodeSizeLimit:
nonce: 1
b94f5374fce5edbc8e2a8697c15331677e6ebf0b:
storage:
'0': 'd6a6b48801accf08b474a42d01d4b82666e4952c'
'1': 1
'0': 1 # subcall successful
'1': 1 # test successful, no OOG
c94f5374fce5edbc8e2a8697c15331677e6ebf0b:
storage:
'0': '9e7a3337d18c31fe4c1fe51ab2da6cfd3629923d' # created account
# Difference with Merge is the charge for initcode 49152 // 32 * 2 = 3072 gas
'10': 55539
d6a6b48801accf08b474a42d01d4b82666e4952c:
'10': 55539 # gas used by CREATE
9e7a3337d18c31fe4c1fe51ab2da6cfd3629923d:
balance: 0
code: '0x600a80600080396000f3'
nonce: 1
Expand All @@ -114,8 +134,9 @@ create2InitCodeSizeLimit:
b94f5374fce5edbc8e2a8697c15331677e6ebf0b:
nonce: 0
storage:
'0': 0
'1': 1
'10': 41236
23cebc55ea992f8b7d924cdbeee710e66d9bfd3b:
'0': 0 # subcall aborted
'1': 1 # test successful, no OOG
c94f5374fce5edbc8e2a8697c15331677e6ebf0b:
storage: {}
67d49ae27e912b3b508d62ce1e463298db6edf32:
shouldnotexist: 1
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ createInitCodeSizeLimit:
nonce: 0
storage: {}
b94f5374fce5edbc8e2a8697c15331677e6ebf0b:
balance: 0
code: |
:yul
{
mstore(0, calldataload(0))
let call_result := call(10000000, 0xc94f5374fce5edbc8e2a8697c15331677e6ebf0b, 0, 0, calldatasize(), 0, 0)
sstore(0, call_result)
sstore(1, 1)
}
nonce: 0
storage: {}
c94f5374fce5edbc8e2a8697c15331677e6ebf0b:
balance: 0
code: |
:yul
Expand All @@ -28,7 +40,6 @@ createInitCodeSizeLimit:
let create_result := create(0, 0, initcode_size)
sstore(10, sub(gas_before, gas()))
sstore(0, create_result)
sstore(1, 1)
}
nonce: 0
storage: {}
Expand Down Expand Up @@ -58,10 +69,13 @@ createInitCodeSizeLimit:
nonce: 1
b94f5374fce5edbc8e2a8697c15331677e6ebf0b:
storage:
'0': 'f1ecf98489fa9ed60a664fc4998db699cfa39d40'
'1': 1
'10': 43248
f1ecf98489fa9ed60a664fc4998db699cfa39d40:
'0': 1 # subcall successful
'1': 1 # test successful, no OOG
c94f5374fce5edbc8e2a8697c15331677e6ebf0b:
storage:
'0': '682327124c5d2dc0cd2158ba65d37ac3d2140c91' # created account
'10': 43248 # gas used by CREATE
682327124c5d2dc0cd2158ba65d37ac3d2140c91:
balance: 0
code: '0x600a80600080396000f3'
nonce: 1
Expand All @@ -76,10 +90,13 @@ createInitCodeSizeLimit:
nonce: 1
b94f5374fce5edbc8e2a8697c15331677e6ebf0b:
storage:
'0': 'f1ecf98489fa9ed60a664fc4998db699cfa39d40'
'1': 1
'10': 43257
f1ecf98489fa9ed60a664fc4998db699cfa39d40:
'0': 1 # subcall successful
'1': 1 # test successful, no OOG
c94f5374fce5edbc8e2a8697c15331677e6ebf0b:
storage:
'0': '682327124c5d2dc0cd2158ba65d37ac3d2140c91' # created account
'10': 43257 # gas used by CREATE
682327124c5d2dc0cd2158ba65d37ac3d2140c91:
balance: 0
code: '0x600a80600080396000f3'
nonce: 1
Expand All @@ -94,11 +111,14 @@ createInitCodeSizeLimit:
nonce: 1
b94f5374fce5edbc8e2a8697c15331677e6ebf0b:
storage:
'0': 'f1ecf98489fa9ed60a664fc4998db699cfa39d40'
'1': 1
'0': 1 # subcall successful
'1': 1 # test successful, no OOG
c94f5374fce5edbc8e2a8697c15331677e6ebf0b:
storage:
'0': '682327124c5d2dc0cd2158ba65d37ac3d2140c91' # created account
# Difference with Merge is the charge for initcode 49152 // 32 * 2 = 3072 gas
'10': 46320
f1ecf98489fa9ed60a664fc4998db699cfa39d40:
'10': 46320 # gas used by CREATE
682327124c5d2dc0cd2158ba65d37ac3d2140c91:
balance: 0
code: '0x600a80600080396000f3'
nonce: 1
Expand All @@ -114,8 +134,9 @@ createInitCodeSizeLimit:
b94f5374fce5edbc8e2a8697c15331677e6ebf0b:
nonce: 0
storage:
'0': 0
'1': 1
'10': 41233
f1ecf98489fa9ed60a664fc4998db699cfa39d40:
'0': 0 # subcall aborted
'1': 1 # test successful, no OOG
c94f5374fce5edbc8e2a8697c15331677e6ebf0b:
storage: {}
682327124c5d2dc0cd2158ba65d37ac3d2140c91:
shouldnotexist: 1

0 comments on commit b0ec571

Please sign in to comment.