Skip to content

Commit

Permalink
Test gas refund and EF-prefixed creation failure
Browse files Browse the repository at this point in the history
  • Loading branch information
chfast authored and winsvega committed Oct 30, 2023
1 parent 38a9951 commit 3e855f2
Show file tree
Hide file tree
Showing 6 changed files with 1,602 additions and 0 deletions.
636 changes: 636 additions & 0 deletions BlockchainTests/GeneralStateTests/stCreateTest/CREATE2_RefundEF.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

128 changes: 128 additions & 0 deletions GeneralStateTests/stCreateTest/CREATE2_RefundEF.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
{
"CREATE2_RefundEF" : {
"_info" : {
"comment" : "Test combination of gas refund and EF-prefixed CREATE2 failure.\n",
"filling-rpc-server" : "evm version 1.13.5-unstable-233db64c-20231027",
"filling-tool-version" : "retesteth-0.3.1-cancun+commit.c768ec72.Linux.g++",
"generatedTestHash" : "043d7ca1c39878a6a4b63cc0bb251d6719dca8286acd1f7e018f2d52ce45bc0e",
"lllcversion" : "Version: 0.5.14-develop.2023.7.11+commit.c58ab2c6.mod.Linux.g++",
"solidity" : "Version: 0.8.21+commit.d9974bed.Linux.g++",
"source" : "src/GeneralStateTestsFiller/stCreateTest/CREATE2_RefundEFFiller.yml",
"sourceHash" : "8438c3be6eacdde0b540bb6da43293901a9eaf30a83faf47480e5d4893d06178"
},
"env" : {
"currentBaseFee" : "0x0a",
"currentBeaconRoot" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"currentCoinbase" : "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"currentDifficulty" : "0x01",
"currentGasLimit" : "0x0f4240",
"currentNumber" : "0x01",
"currentRandom" : "0x0000000000000000000000000000000000000000000000000000000000000001",
"currentTimestamp" : "0x03e8",
"currentWithdrawalsRoot" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"previousHash" : "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"post" : {
"Berlin" : [
{
"hash" : "0x9ded3dabb4f1a06234adcad45bcb091a941e89cc2509a2e68c7da31181524e72",
"indexes" : {
"data" : 0,
"gas" : 0,
"value" : 0
},
"logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"txbytes" : "0xf860800a830186a094000000000000000000000000000000000c5ea70580801ba0be1a87855d5fb33c626d3ffe010a72025f2e49bbdfea9990f7673e0accac0106a07772ddb064c02f526a94d0efbc15f386f98524e3d23a36400835a66121dde245"
}
],
"Cancun" : [
{
"hash" : "0x87d4489229f31582e552e7d10210c874578cefba9f6a855af8b334c63c0d4089",
"indexes" : {
"data" : 0,
"gas" : 0,
"value" : 0
},
"logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"txbytes" : "0xf860800a830186a094000000000000000000000000000000000c5ea70580801ba0be1a87855d5fb33c626d3ffe010a72025f2e49bbdfea9990f7673e0accac0106a07772ddb064c02f526a94d0efbc15f386f98524e3d23a36400835a66121dde245"
}
],
"London" : [
{
"hash" : "0x87d4489229f31582e552e7d10210c874578cefba9f6a855af8b334c63c0d4089",
"indexes" : {
"data" : 0,
"gas" : 0,
"value" : 0
},
"logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"txbytes" : "0xf860800a830186a094000000000000000000000000000000000c5ea70580801ba0be1a87855d5fb33c626d3ffe010a72025f2e49bbdfea9990f7673e0accac0106a07772ddb064c02f526a94d0efbc15f386f98524e3d23a36400835a66121dde245"
}
],
"Merge" : [
{
"hash" : "0x87d4489229f31582e552e7d10210c874578cefba9f6a855af8b334c63c0d4089",
"indexes" : {
"data" : 0,
"gas" : 0,
"value" : 0
},
"logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"txbytes" : "0xf860800a830186a094000000000000000000000000000000000c5ea70580801ba0be1a87855d5fb33c626d3ffe010a72025f2e49bbdfea9990f7673e0accac0106a07772ddb064c02f526a94d0efbc15f386f98524e3d23a36400835a66121dde245"
}
],
"Shanghai" : [
{
"hash" : "0x87d4489229f31582e552e7d10210c874578cefba9f6a855af8b334c63c0d4089",
"indexes" : {
"data" : 0,
"gas" : 0,
"value" : 0
},
"logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"txbytes" : "0xf860800a830186a094000000000000000000000000000000000c5ea70580801ba0be1a87855d5fb33c626d3ffe010a72025f2e49bbdfea9990f7673e0accac0106a07772ddb064c02f526a94d0efbc15f386f98524e3d23a36400835a66121dde245"
}
]
},
"pre" : {
"0x00000000000000000000000000000000005ef94d" : {
"balance" : "0x00",
"code" : "0x6000805500",
"nonce" : "0x00",
"storage" : {
"0x00" : "0x01"
}
},
"0x000000000000000000000000000000000c5ea705" : {
"balance" : "0x00",
"code" : "0x6000601980601183398180f560005500fe600080808080625ef94d61c350f15060ef60005360016000f3",
"nonce" : "0x00",
"storage" : {
}
},
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "0x5af3107a4000",
"code" : "0x",
"nonce" : "0x00",
"storage" : {
}
}
},
"transaction" : {
"data" : [
"0x"
],
"gasLimit" : [
"0x0186a0"
],
"gasPrice" : "0x0a",
"nonce" : "0x00",
"secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
"sender" : "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"to" : "0x000000000000000000000000000000000c5ea705",
"value" : [
"0x00"
]
}
}
}
124 changes: 124 additions & 0 deletions GeneralStateTests/stCreateTest/CreateTransactionRefundEF.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
{
"CreateTransactionRefundEF" : {
"_info" : {
"comment" : "Test combination of gas refund and EF-prefixed create transaction failure.\n",
"filling-rpc-server" : "evm version 1.13.5-unstable-233db64c-20231027",
"filling-tool-version" : "retesteth-0.3.1-cancun+commit.c768ec72.Linux.g++",
"generatedTestHash" : "4c0a6fa32e25e51659184cf918d5773e50a42c2714520d447b789e44befe392d",
"labels" : {
"0" : "refund_EF"
},
"lllcversion" : "Version: 0.5.14-develop.2023.7.11+commit.c58ab2c6.mod.Linux.g++",
"solidity" : "Version: 0.8.21+commit.d9974bed.Linux.g++",
"source" : "src/GeneralStateTestsFiller/stCreateTest/CreateTransactionRefundEFFiller.yml",
"sourceHash" : "3fbcdc2eeb5c6678c72f56062411d9d667adcd242150c39ed3eb92257cb07c13"
},
"env" : {
"currentBaseFee" : "0x0a",
"currentBeaconRoot" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"currentCoinbase" : "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"currentDifficulty" : "0x01",
"currentGasLimit" : "0x0f4240",
"currentNumber" : "0x01",
"currentRandom" : "0x0000000000000000000000000000000000000000000000000000000000000001",
"currentTimestamp" : "0x03e8",
"currentWithdrawalsRoot" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"previousHash" : "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"post" : {
"Berlin" : [
{
"hash" : "0xb45f4612111abe68be9eabbed3ac1d3ef54ae0143093fd58ed714c1969ec98d9",
"indexes" : {
"data" : 0,
"gas" : 0,
"value" : 0
},
"logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"txbytes" : "0xf865800a830186a0808099600080808080625ef94d61c350f15060ef60005360016000f31ca0b2905a92bfc7f3f0d932179176c4e631b32924b2c9060453a47ca4bdaac9da0aa0486e74e5ede0039eb79463d9db165afbf0d1d0505826f04175c50146e4d8e132"
}
],
"Cancun" : [
{
"hash" : "0x4b1bc97fd4a78def80c3b4b6471400e9170f5d8850fe17170119c21adcec5f21",
"indexes" : {
"data" : 0,
"gas" : 0,
"value" : 0
},
"logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"txbytes" : "0xf865800a830186a0808099600080808080625ef94d61c350f15060ef60005360016000f31ca0b2905a92bfc7f3f0d932179176c4e631b32924b2c9060453a47ca4bdaac9da0aa0486e74e5ede0039eb79463d9db165afbf0d1d0505826f04175c50146e4d8e132"
}
],
"London" : [
{
"hash" : "0x4b1bc97fd4a78def80c3b4b6471400e9170f5d8850fe17170119c21adcec5f21",
"indexes" : {
"data" : 0,
"gas" : 0,
"value" : 0
},
"logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"txbytes" : "0xf865800a830186a0808099600080808080625ef94d61c350f15060ef60005360016000f31ca0b2905a92bfc7f3f0d932179176c4e631b32924b2c9060453a47ca4bdaac9da0aa0486e74e5ede0039eb79463d9db165afbf0d1d0505826f04175c50146e4d8e132"
}
],
"Merge" : [
{
"hash" : "0x4b1bc97fd4a78def80c3b4b6471400e9170f5d8850fe17170119c21adcec5f21",
"indexes" : {
"data" : 0,
"gas" : 0,
"value" : 0
},
"logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"txbytes" : "0xf865800a830186a0808099600080808080625ef94d61c350f15060ef60005360016000f31ca0b2905a92bfc7f3f0d932179176c4e631b32924b2c9060453a47ca4bdaac9da0aa0486e74e5ede0039eb79463d9db165afbf0d1d0505826f04175c50146e4d8e132"
}
],
"Shanghai" : [
{
"hash" : "0x4b1bc97fd4a78def80c3b4b6471400e9170f5d8850fe17170119c21adcec5f21",
"indexes" : {
"data" : 0,
"gas" : 0,
"value" : 0
},
"logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"txbytes" : "0xf865800a830186a0808099600080808080625ef94d61c350f15060ef60005360016000f31ca0b2905a92bfc7f3f0d932179176c4e631b32924b2c9060453a47ca4bdaac9da0aa0486e74e5ede0039eb79463d9db165afbf0d1d0505826f04175c50146e4d8e132"
}
]
},
"pre" : {
"0x00000000000000000000000000000000005ef94d" : {
"balance" : "0x00",
"code" : "0x6000805500",
"nonce" : "0x00",
"storage" : {
"0x00" : "0x01"
}
},
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "0x5af3107a4000",
"code" : "0x",
"nonce" : "0x00",
"storage" : {
}
}
},
"transaction" : {
"data" : [
"0x600080808080625ef94d61c350f15060ef60005360016000f3"
],
"gasLimit" : [
"0x0186a0"
],
"gasPrice" : "0x0a",
"nonce" : "0x00",
"secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
"sender" : "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"to" : "",
"value" : [
"0x00"
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
CREATE2_RefundEF:
_info:
comment: |
Test combination of gas refund and EF-prefixed CREATE2 failure.
env:
currentCoinbase: a94f5374fce5edbc8e2a8697c15331677e6ebf0b
currentDifficulty: 1
currentGasLimit: 1000000
currentNumber: 1
currentTimestamp: 1000
previousHash: 5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6
pre:
a94f5374fce5edbc8e2a8697c15331677e6ebf0b:
nonce: 0
balance: 100000000000000
storage: { }
code: ''

# Provides gas refund.
00000000000000000000000000000000005ef94d:
nonce: 0
balance: 0
storage:
0: 1
code: |
:yul london {
sstore(0,0)
}
# Contract creator.
000000000000000000000000000000000c5ea705:
nonce: 0
balance: 0
storage: { }
code: |
:yul london object "C" {
code {
let s := datasize("initcode")
let o := dataoffset("initcode")
codecopy(0, o, s)
let r := create2(0, 0, s, 0)
sstore(0, r)
stop()
}
object "initcode" {
code {
// call gas refund provider
let r := call(50000, 0x5ef94d, 0, 0, 0, 0, 0)
// return 0xEF
mstore8(0,0xEF)
return(0,1)
}
}
}
transaction:
data: [ '' ]
gasLimit: [ 100000 ]
gasPrice: 10
nonce: 0
secretKey: 45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8
to: 000000000000000000000000000000000c5ea705
value: [ 0 ]
expect:
- network:
- "Berlin"
result:
00000000000000000000000000000000005ef94d:
storage:
0: 0
be8f87148d0767989cce2e6a6a5d91c7d0c840e0:
code: '0xEF'
- network:
- ">=London"
result:
00000000000000000000000000000000005ef94d:
storage:
0: 1
be8f87148d0767989cce2e6a6a5d91c7d0c840e0:
shouldnotexist: true
Loading

0 comments on commit 3e855f2

Please sign in to comment.