diff options
author | Jose Hugo De la cruz Romero <jhugodc@gmail.com> | 2018-11-23 11:45:47 +0800 |
---|---|---|
committer | Jose Hugo De la cruz Romero <jhugodc@gmail.com> | 2018-11-23 11:45:47 +0800 |
commit | a1ca775592b32201b82d3e95f37e2ad2aab01cb9 (patch) | |
tree | 34959fefca586499ad53141ceca690065a19af50 | |
parent | 9371878dcd1d03c9bc8741cab52ed508b90ae19c (diff) | |
download | dexon-tests-a1ca775592b32201b82d3e95f37e2ad2aab01cb9.tar dexon-tests-a1ca775592b32201b82d3e95f37e2ad2aab01cb9.tar.gz dexon-tests-a1ca775592b32201b82d3e95f37e2ad2aab01cb9.tar.bz2 dexon-tests-a1ca775592b32201b82d3e95f37e2ad2aab01cb9.tar.lz dexon-tests-a1ca775592b32201b82d3e95f37e2ad2aab01cb9.tar.xz dexon-tests-a1ca775592b32201b82d3e95f37e2ad2aab01cb9.tar.zst dexon-tests-a1ca775592b32201b82d3e95f37e2ad2aab01cb9.zip |
extcodehash for deleted account in state, extcodehash for deleted account created in same transaction
10 files changed, 813 insertions, 3 deletions
diff --git a/GeneralStateTests/stExtCodeHash/extCodeHashDeletedAccount.json b/GeneralStateTests/stExtCodeHash/extCodeHashDeletedAccount.json new file mode 100644 index 000000000..8db6aa910 --- /dev/null +++ b/GeneralStateTests/stExtCodeHash/extCodeHashDeletedAccount.json @@ -0,0 +1,77 @@ +{ + "extCodeHashDeletedAccount" : { + "_info" : { + "comment" : "Get account A (deadbeef00000000000000000000000000000000) code hash\nCalls Account A's code which causes self destruction of A\nGet account A codehash\nIt is still getting the same codehash because selfdestruct is performed\nat the end of transaction during state finalization stage.\n", + "filledwith" : "testeth 1.5.0-alpha.6-49+commit.4897b8bb", + "lllcversion" : "Version: 0.5.0-develop.2018.11.8+commit.20481055.Linux.g++", + "source" : "src/GeneralStateTestsFiller/stExtCodeHash/extCodeHashDeletedAccountFiller.yml", + "sourceHash" : "7e7b94fd1a8c3ab4e26a5cdb4a3bc73a0d97eb319c9884b24d26cfc8731607a2" + }, + "env" : { + "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "0x20000", + "currentGasLimit" : "0x0f4240", + "currentNumber" : "0x01", + "currentTimestamp" : "0x03e8", + "previousHash" : "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "post" : { + "Constantinople" : [ + { + "hash" : "0x1e31f5c7570f4fcf9694c3db8cc4b819d7bf16eb3c73f86e81a545bca1f14da1", + "indexes" : { + "data" : 0, + "gas" : 0, + "value" : 0 + }, + "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + } + ] + }, + "pre" : { + "0x095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "0x0de0b6b3a7640000", + "code" : "0x6020600060006000600073aaaaaaaa00000000000000000000000000000000620249f0f1506020600060003e6000516000556020600060006000600073deadbeef00000000000000000000000000000000620249f0f1506020600060006000600073aaaaaaaa00000000000000000000000000000000620249f0f1506020600060003e600051600155", + "nonce" : "0x00", + "storage" : { + } + }, + "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0x0de0b6b3a7640000", + "code" : "0x00", + "nonce" : "0x00", + "storage" : { + } + }, + "0xaaaaaaaa00000000000000000000000000000000" : { + "balance" : "0x0de0b6b3a7640000", + "code" : "0x73deadbeef000000000000000000000000000000003f60005260206000f3", + "nonce" : "0x00", + "storage" : { + } + }, + "0xdeadbeef00000000000000000000000000000000" : { + "balance" : "0x0de0b6b3a7640000", + "code" : "0x73deadbeef0000000000000000000000000000000031ff", + "nonce" : "0x00", + "storage" : { + } + } + }, + "transaction" : { + "data" : [ + "0x" + ], + "gasLimit" : [ + "0x061a80" + ], + "gasPrice" : "0x01", + "nonce" : "0x00", + "secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "0x095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : [ + "0x01" + ] + } + } +}
\ No newline at end of file diff --git a/GeneralStateTests/stExtCodeHash/extCodeHashDeletedAccount1.json b/GeneralStateTests/stExtCodeHash/extCodeHashDeletedAccount1.json new file mode 100644 index 000000000..766204cc5 --- /dev/null +++ b/GeneralStateTests/stExtCodeHash/extCodeHashDeletedAccount1.json @@ -0,0 +1,77 @@ +{ + "extCodeHashDeletedAccount1" : { + "_info" : { + "comment" : "1) Account A already exists in the state and contains code\nCall to Account B do the following:\n- stores Account A hash to 1\n- Run selfdestruct on A\n- stores Account A hash to 2.\n", + "filledwith" : "testeth 1.5.0-alpha.6-49+commit.4897b8bb", + "lllcversion" : "Version: 0.5.0-develop.2018.11.8+commit.20481055.Linux.g++", + "source" : "src/GeneralStateTestsFiller/stExtCodeHash/extCodeHashDeletedAccount1Filler.yml", + "sourceHash" : "72463d1d8e18459910285be058e643d43948d7ee590300c15201098d92bd101f" + }, + "env" : { + "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "0x20000", + "currentGasLimit" : "0x0f4240", + "currentNumber" : "0x01", + "currentTimestamp" : "0x03e8", + "previousHash" : "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "post" : { + "Constantinople" : [ + { + "hash" : "0xb569620a56ecedea5a178f5699f38793819792851ba197f9159cd94042710af0", + "indexes" : { + "data" : 0, + "gas" : 0, + "value" : 0 + }, + "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + } + ] + }, + "pre" : { + "0x095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "0x0de0b6b3a7640000", + "code" : "0x6020600060006000600073bbbbbbbb00000000000000000000000000000000620249f0f1", + "nonce" : "0x00", + "storage" : { + } + }, + "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0x0de0b6b3a7640000", + "code" : "0x00", + "nonce" : "0x00", + "storage" : { + } + }, + "0xaaaaaaaa00000000000000000000000000000000" : { + "balance" : "0x0de0b6b3a7640000", + "code" : "0x73deadbeef0000000000000000000000000000000031ff", + "nonce" : "0x00", + "storage" : { + } + }, + "0xbbbbbbbb00000000000000000000000000000000" : { + "balance" : "0x0de0b6b3a7640000", + "code" : "0x73aaaaaaaa000000000000000000000000000000003f6000526000516001556020600060006000600073aaaaaaaa00000000000000000000000000000000620249f0f15073aaaaaaaa000000000000000000000000000000003f602052602051600255", + "nonce" : "0x00", + "storage" : { + } + } + }, + "transaction" : { + "data" : [ + "0x" + ], + "gasLimit" : [ + "0x061a80" + ], + "gasPrice" : "0x01", + "nonce" : "0x00", + "secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "0x095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : [ + "0x01" + ] + } + } +}
\ No newline at end of file diff --git a/GeneralStateTests/stExtCodeHash/extCodeHashDeletedAccount2.json b/GeneralStateTests/stExtCodeHash/extCodeHashDeletedAccount2.json new file mode 100644 index 000000000..0d2f38437 --- /dev/null +++ b/GeneralStateTests/stExtCodeHash/extCodeHashDeletedAccount2.json @@ -0,0 +1,77 @@ +{ + "extCodeHashDeletedAccount2" : { + "_info" : { + "comment" : "2) Account A already exists in the state and contains code\nCall to Account B stores Account A hash to 1\nCall to Account C runs self destruct on A\nCall to Account B stores Account A hash to 2\n", + "filledwith" : "testeth 1.5.0-alpha.6-49+commit.4897b8bb", + "lllcversion" : "Version: 0.5.0-develop.2018.11.8+commit.20481055.Linux.g++", + "source" : "src/GeneralStateTestsFiller/stExtCodeHash/extCodeHashDeletedAccount2Filler.yml", + "sourceHash" : "1388059a01de87d0a075657fc4508d9acc4ce4129deb9257fc162166b66b38d6" + }, + "env" : { + "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "0x20000", + "currentGasLimit" : "0x0f4240", + "currentNumber" : "0x01", + "currentTimestamp" : "0x03e8", + "previousHash" : "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "post" : { + "Constantinople" : [ + { + "hash" : "0x8e358d0c5cc69178264070688679cd9557571baeaa65e7796f2310fe1c9ea4af", + "indexes" : { + "data" : 0, + "gas" : 0, + "value" : 0 + }, + "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + } + ] + }, + "pre" : { + "0x095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "0x0de0b6b3a7640000", + "code" : "0x60016000526020600060206000600073bbbbbbbb00000000000000000000000000000000620249f0f1506020600060006000600073aaaaaaaa00000000000000000000000000000000620249f0f15060026020526020600060206020600073bbbbbbbb00000000000000000000000000000000620249f0f1", + "nonce" : "0x00", + "storage" : { + } + }, + "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0x0de0b6b3a7640000", + "code" : "0x00", + "nonce" : "0x00", + "storage" : { + } + }, + "0xaaaaaaaa00000000000000000000000000000000" : { + "balance" : "0x0de0b6b3a7640000", + "code" : "0x73deadbeef0000000000000000000000000000000031ff", + "nonce" : "0x00", + "storage" : { + } + }, + "0xbbbbbbbb00000000000000000000000000000000" : { + "balance" : "0x0de0b6b3a7640000", + "code" : "0x6020600060003773aaaaaaaa000000000000000000000000000000003f60005155", + "nonce" : "0x00", + "storage" : { + } + } + }, + "transaction" : { + "data" : [ + "0x" + ], + "gasLimit" : [ + "0x061a80" + ], + "gasPrice" : "0x01", + "nonce" : "0x00", + "secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "0x095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : [ + "0x01" + ] + } + } +}
\ No newline at end of file diff --git a/GeneralStateTests/stExtCodeHash/extCodeHashDeletedAccount3.json b/GeneralStateTests/stExtCodeHash/extCodeHashDeletedAccount3.json new file mode 100644 index 000000000..8798512be --- /dev/null +++ b/GeneralStateTests/stExtCodeHash/extCodeHashDeletedAccount3.json @@ -0,0 +1,77 @@ +{ + "extCodeHashDeletedAccount3" : { + "_info" : { + "comment" : "3) Call creates Account A (0x95ab1c33798981918da6d27056f70376674878d2)\nCall to Account B do the following:\n- stores Account A hash to 1\n- Run selfdestruct on A\n- stores Account A hash to 2\n", + "filledwith" : "testeth 1.5.0-alpha.6-49+commit.4897b8bb", + "lllcversion" : "Version: 0.5.0-develop.2018.11.8+commit.20481055.Linux.g++", + "source" : "src/GeneralStateTestsFiller/stExtCodeHash/extCodeHashDeletedAccount3Filler.yml", + "sourceHash" : "0f465ca1787b4fffe81d8612e2cd5079a4ae824bb19cd099ed537c9dcc556de2" + }, + "env" : { + "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "0x20000", + "currentGasLimit" : "0x0f4240", + "currentNumber" : "0x01", + "currentTimestamp" : "0x03e8", + "previousHash" : "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "post" : { + "Constantinople" : [ + { + "hash" : "0x856f8e352ff31e93aee1829316295795d831b5cef1ab1153c0c07c6ae4337ee3", + "indexes" : { + "data" : 0, + "gas" : 0, + "value" : 0 + }, + "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + } + ] + }, + "pre" : { + "0x095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "0x0de0b6b3a7640000", + "code" : "0x6000603c80603f60003960006000f56000526000516000556020600060006000600073bbbbbbbb00000000000000000000000000000000620249f0f15000fe73cccccccc000000000000000000000000000000003b6000526000516000602073cccccccc000000000000000000000000000000003c6000516020f3", + "nonce" : "0x00", + "storage" : { + } + }, + "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0x0de0b6b3a7640000", + "code" : "0x00", + "nonce" : "0x00", + "storage" : { + } + }, + "0xbbbbbbbb00000000000000000000000000000000" : { + "balance" : "0x0de0b6b3a7640000", + "code" : "0x7395ab1c33798981918da6d27056f70376674878d23f600155602060006000600060007395ab1c33798981918da6d27056f70376674878d2620249f0f1507395ab1c33798981918da6d27056f70376674878d23f600255", + "nonce" : "0x00", + "storage" : { + } + }, + "0xcccccccc00000000000000000000000000000000" : { + "balance" : "0x00", + "code" : "0x73bbbbbbbb00000000000000000000000000000000ff", + "nonce" : "0x00", + "storage" : { + } + } + }, + "transaction" : { + "data" : [ + "0x" + ], + "gasLimit" : [ + "0x061a80" + ], + "gasPrice" : "0x01", + "nonce" : "0x00", + "secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "0x095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : [ + "0x01" + ] + } + } +}
\ No newline at end of file diff --git a/GeneralStateTests/stExtCodeHash/extCodeHashDeletedAccount4.json b/GeneralStateTests/stExtCodeHash/extCodeHashDeletedAccount4.json new file mode 100644 index 000000000..afa0c4ec9 --- /dev/null +++ b/GeneralStateTests/stExtCodeHash/extCodeHashDeletedAccount4.json @@ -0,0 +1,84 @@ +{ + "extCodeHashDeletedAccount4" : { + "_info" : { + "comment" : "4) Call creates Account A\nCall to Account B stores Account A hash to 1\nCall to Account C runs self destruct on A\nCall to Account B stores Account a hash to 2\n", + "filledwith" : "testeth 1.5.0-alpha.6-49+commit.4897b8bb", + "lllcversion" : "Version: 0.5.0-develop.2018.11.8+commit.20481055.Linux.g++", + "source" : "src/GeneralStateTestsFiller/stExtCodeHash/extCodeHashDeletedAccount4Filler.yml", + "sourceHash" : "24625c2a6c24a105b23b4f409b04eceffa8ff0b4a54a06678a2326ea8119d68d" + }, + "env" : { + "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "0x20000", + "currentGasLimit" : "0x0f4240", + "currentNumber" : "0x01", + "currentTimestamp" : "0x03e8", + "previousHash" : "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "post" : { + "Constantinople" : [ + { + "hash" : "0x19690f40fea7615f844d758927da36f681fedc5a59984e42102bd1b0ddd0c409", + "indexes" : { + "data" : 0, + "gas" : 0, + "value" : 0 + }, + "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + } + ] + }, + "pre" : { + "0x095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "0x0de0b6b3a7640000", + "code" : "0x6000603c80609360003960006000f560005260005160005560016020526020600060206020600073bbbbbbbb00000000000000000000000000000000620249f0f1506020600060006000600073cccccccc00000000000000000000000000000000620249f0f15060026040526020600060206040600073bbbbbbbb00000000000000000000000000000000620249f0f15000fe73dddddddd000000000000000000000000000000003b6000526000516000602073dddddddd000000000000000000000000000000003c6000516020f3", + "nonce" : "0x00", + "storage" : { + } + }, + "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0x0de0b6b3a7640000", + "code" : "", + "nonce" : "0x00", + "storage" : { + } + }, + "0xbbbbbbbb00000000000000000000000000000000" : { + "balance" : "0x0de0b6b3a7640000", + "code" : "0x6020600060003773e713449c212d891357cc2966816b1d528cfb59e03f60005155", + "nonce" : "0x00", + "storage" : { + } + }, + "0xcccccccc00000000000000000000000000000000" : { + "balance" : "0x00", + "code" : "0x6020600060006000600073e713449c212d891357cc2966816b1d528cfb59e0620249f0f1", + "nonce" : "0x00", + "storage" : { + } + }, + "0xdddddddd00000000000000000000000000000000" : { + "balance" : "0x00", + "code" : "0x73bbbbbbbb00000000000000000000000000000000ff", + "nonce" : "0x00", + "storage" : { + } + } + }, + "transaction" : { + "data" : [ + "0x" + ], + "gasLimit" : [ + "0x061a80" + ], + "gasPrice" : "0x01", + "nonce" : "0x00", + "secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "0x095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : [ + "0x01" + ] + } + } +}
\ No newline at end of file diff --git a/src/GeneralStateTestsFiller/stExtCodeHash/extCodeHashDeletedAccount1Filler.yml b/src/GeneralStateTestsFiller/stExtCodeHash/extCodeHashDeletedAccount1Filler.yml new file mode 100644 index 000000000..61cec84fd --- /dev/null +++ b/src/GeneralStateTestsFiller/stExtCodeHash/extCodeHashDeletedAccount1Filler.yml @@ -0,0 +1,91 @@ +# EXTCODEHASH to a deleted account +--- +extCodeHashDeletedAccount1: + _info: + comment: | + 1) Account A already exists in the state and contains code + Call to Account B do the following: + - stores Account A hash to 1 + - Run selfdestruct on A + - stores Account A hash to 2. + env: + currentCoinbase: 2adc25665018aa1fe0e6bc666dac8fc2697ff9ba + currentDifficulty: '0x20000' + currentGasLimit: "1000000" + currentNumber: "1" + currentTimestamp: "1000" + previousHash: 5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6 + pre: + 095e7baea6a6c7c4c2dfeb977efac326af552d87: + balance: '1000000000000000000' + code: | + { + (CALL 150000 0xbbbbbbbb00000000000000000000000000000000 0 0 0 0 32) + } + nonce: '0' + storage: {} + # Account A: already exists in the state + # contains selfdestruct code + aaaaaaaa00000000000000000000000000000000: + balance: '1000000000000000000' + code: | + { + (SELFDESTRUCT (BALANCE 0xdeadbeef00000000000000000000000000000000)) + } + nonce: '0' + storage: {} + # Account B + # Stores Account A hash to [1] + # Run selfdestruct on A + # Stores Account A hash to [2] + bbbbbbbb00000000000000000000000000000000: + balance: '1000000000000000000' + code: | + { + (MSTORE 0 (EXTCODEHASH 0xaaaaaaaa00000000000000000000000000000000)) + [[1]] (MLOAD 0) + + (CALL 150000 0xaaaaaaaa00000000000000000000000000000000 0 0 0 0 32) + + (MSTORE 32 (EXTCODEHASH 0xaaaaaaaa00000000000000000000000000000000)) + [[2]] (MLOAD 32) + } + nonce: '0' + storage: {} + a94f5374fce5edbc8e2a8697c15331677e6ebf0b: + balance: '1000000000000000000' + code: '0x00' + nonce: '0' + storage: {} + expect: + - indexes: + data: !!int -1 + gas: !!int -1 + value: !!int -1 + network: + - '>=Constantinople' + result: + 095e7baea6a6c7c4c2dfeb977efac326af552d87: + balance: '1000000000000000001' + storage: { + + } + aaaaaaaa00000000000000000000000000000000: + shouldnotexist: '1' + bbbbbbbb00000000000000000000000000000000: + balance: '1000000000000000000' + storage: { + 1: '0x9dff858fbcae72e5644a465fa893f46deb3e03b9cd5a8b531109cd577f7fb293', + 2: '0x9dff858fbcae72e5644a465fa893f46deb3e03b9cd5a8b531109cd577f7fb293' + } + transaction: + data: + - '' + gasLimit: + - '400000' + gasPrice: '1' + nonce: '0' + secretKey: 45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8 + to: 095e7baea6a6c7c4c2dfeb977efac326af552d87 + value: + - '1' diff --git a/src/GeneralStateTestsFiller/stExtCodeHash/extCodeHashDeletedAccount2Filler.yml b/src/GeneralStateTestsFiller/stExtCodeHash/extCodeHashDeletedAccount2Filler.yml new file mode 100644 index 000000000..35b102551 --- /dev/null +++ b/src/GeneralStateTestsFiller/stExtCodeHash/extCodeHashDeletedAccount2Filler.yml @@ -0,0 +1,88 @@ +# EXTCODEHASH to a deleted account +--- +extCodeHashDeletedAccount2: + _info: + comment: | + 2) Account A already exists in the state and contains code + Call to Account B stores Account A hash to 1 + Call to Account C runs self destruct on A + Call to Account B stores Account A hash to 2 + env: + currentCoinbase: 2adc25665018aa1fe0e6bc666dac8fc2697ff9ba + currentDifficulty: '0x20000' + currentGasLimit: "1000000" + currentNumber: "1" + currentTimestamp: "1000" + previousHash: 5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6 + pre: + 095e7baea6a6c7c4c2dfeb977efac326af552d87: + balance: '1000000000000000000' + code: | + { + (MSTORE 0 0x01) + (CALL 150000 0xbbbbbbbb00000000000000000000000000000000 0 0 32 0 32) + + (CALL 150000 0xaaaaaaaa00000000000000000000000000000000 0 0 0 0 32) + + (MSTORE 32 0x02) + (CALL 150000 0xbbbbbbbb00000000000000000000000000000000 0 32 32 0 32) + } + nonce: '0' + storage: {} + # Acount A: already exists in the state + # contains selfdestruct code + aaaaaaaa00000000000000000000000000000000: + balance: '1000000000000000000' + code: | + { + (SELFDESTRUCT (BALANCE 0xdeadbeef00000000000000000000000000000000)) + } + nonce: '0' + storage: {} + # Account B + # Receives storage key as call data + bbbbbbbb00000000000000000000000000000000: + balance: '1000000000000000000' + code: | + { + (CALLDATACOPY 0 0 32) + (SSTORE (MLOAD 0) (EXTCODEHASH 0xaaaaaaaa00000000000000000000000000000000)) + } + nonce: '0' + storage: {} + a94f5374fce5edbc8e2a8697c15331677e6ebf0b: + balance: '1000000000000000000' + code: '0x00' + nonce: '0' + storage: {} + expect: + - indexes: + data: !!int -1 + gas: !!int -1 + value: !!int -1 + network: + - '>=Constantinople' + result: + 095e7baea6a6c7c4c2dfeb977efac326af552d87: + balance: '1000000000000000001' + storage: {} + aaaaaaaa00000000000000000000000000000000: + shouldnotexist: '1' + bbbbbbbb00000000000000000000000000000000: + balance: '1000000000000000000' + storage: { + 1: '0x9dff858fbcae72e5644a465fa893f46deb3e03b9cd5a8b531109cd577f7fb293', + 2: '0x9dff858fbcae72e5644a465fa893f46deb3e03b9cd5a8b531109cd577f7fb293' + } + transaction: + data: + - '' + gasLimit: + - '400000' + gasPrice: '1' + nonce: '0' + secretKey: 45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8 + to: 095e7baea6a6c7c4c2dfeb977efac326af552d87 + value: + - '1' + diff --git a/src/GeneralStateTestsFiller/stExtCodeHash/extCodeHashDeletedAccount3Filler.yml b/src/GeneralStateTestsFiller/stExtCodeHash/extCodeHashDeletedAccount3Filler.yml new file mode 100644 index 000000000..13c16efcb --- /dev/null +++ b/src/GeneralStateTestsFiller/stExtCodeHash/extCodeHashDeletedAccount3Filler.yml @@ -0,0 +1,107 @@ +# EXTCODEHASH to a deleted account +--- +extCodeHashDeletedAccount3: + _info: + comment: | + 3) Call creates Account A (0x95ab1c33798981918da6d27056f70376674878d2) + Call to Account B do the following: + - stores Account A hash to 1 + - Run selfdestruct on A + - stores Account A hash to 2 + env: + currentCoinbase: 2adc25665018aa1fe0e6bc666dac8fc2697ff9ba + currentDifficulty: '0x20000' + currentGasLimit: "1000000" + currentNumber: "1" + currentTimestamp: "1000" + previousHash: 5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6 + pre: + 095e7baea6a6c7c4c2dfeb977efac326af552d87: + balance: '1000000000000000000' + code: | + { + ;; Creates Account A using code in existing account C + (MSTORE 0 + (CREATE2 0 0 + (lll + { + (MSTORE 0 (EXTCODESIZE 0xcccccccc00000000000000000000000000000000)) + (EXTCODECOPY 0xcccccccc00000000000000000000000000000000 + 32 + 0 + (MLOAD 0)) + (RETURN 32 (MLOAD 0)) + } + 0) + 0)) + + ;; Stores new Account A address + [[0]] (MLOAD 0) + + ;; Call Account B: + (CALL 150000 0xbbbbbbbb00000000000000000000000000000000 0 0 0 0 32) + (STOP) + } + nonce: '0' + storage: {} + bbbbbbbb00000000000000000000000000000000: + balance: '1000000000000000000' + code: | + { + ;; Stores Account A hash to 1 + [[1]] (EXTCODEHASH 0x95ab1c33798981918da6d27056f70376674878d2) + + ;; Run self destruct on Account A + (CALL 150000 0x95ab1c33798981918da6d27056f70376674878d2 0 0 0 0 32) + + ;; Stores Account A hash to 2 + [[2]] (EXTCODEHASH 0x95ab1c33798981918da6d27056f70376674878d2) + } + nonce: '0' + storage: {} + cccccccc00000000000000000000000000000000: + balance: '0' + code: | + { + (SELFDESTRUCT 0xbbbbbbbb00000000000000000000000000000000) + } + nonce: '0' + storage: {} + a94f5374fce5edbc8e2a8697c15331677e6ebf0b: + balance: '1000000000000000000' + code: '0x00' + nonce: '0' + storage: {} + expect: + - indexes: + data: !!int -1 + gas: !!int -1 + value: !!int -1 + network: + - '>=Constantinople' + result: + 095e7baea6a6c7c4c2dfeb977efac326af552d87: + balance: '1000000000000000001' + storage: { + 0: '0x95ab1c33798981918da6d27056f70376674878d2' + } + bbbbbbbb00000000000000000000000000000000: + balance: '1000000000000000000' + storage: { + 1: '0xb05d47e0911e4f67786f4cdc582608ee5f731e845a1e95ddc99759e2b3da81bf', + 2: '0xb05d47e0911e4f67786f4cdc582608ee5f731e845a1e95ddc99759e2b3da81bf' + } + 95ab1c33798981918da6d27056f70376674878d2: + shouldnotexist: '1' + transaction: + data: + - '' + gasLimit: + - '400000' + gasPrice: '1' + nonce: '0' + secretKey: 45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8 + to: 095e7baea6a6c7c4c2dfeb977efac326af552d87 + value: + - '1' + diff --git a/src/GeneralStateTestsFiller/stExtCodeHash/extCodeHashDeletedAccount4Filler.yml b/src/GeneralStateTestsFiller/stExtCodeHash/extCodeHashDeletedAccount4Filler.yml new file mode 100644 index 000000000..c9d420289 --- /dev/null +++ b/src/GeneralStateTestsFiller/stExtCodeHash/extCodeHashDeletedAccount4Filler.yml @@ -0,0 +1,125 @@ +# EXTCODEHASH to a deleted account +--- +extCodeHashDeletedAccount4: + _info: + comment: | + 4) Call creates Account A + Call to Account B stores Account A hash to 1 + Call to Account C runs self destruct on A + Call to Account B stores Account a hash to 2 + env: + currentCoinbase: 2adc25665018aa1fe0e6bc666dac8fc2697ff9ba + currentDifficulty: '0x20000' + currentGasLimit: "1000000" + currentNumber: "1" + currentTimestamp: "1000" + previousHash: 5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6 + pre: + 095e7baea6a6c7c4c2dfeb977efac326af552d87: + balance: '1000000000000000000' + code: | + { + ;; Creates Account A using code in existing account D + (MSTORE 0 + (CREATE2 0 0 + (lll + { + (MSTORE 0 (EXTCODESIZE 0xdddddddd00000000000000000000000000000000)) + (EXTCODECOPY 0xdddddddd00000000000000000000000000000000 + 32 + 0 + (MLOAD 0)) + (RETURN 32 (MLOAD 0)) + } + 0) + 0)) + + ;; Stores new Account A address + [[0]] (MLOAD 0) + + ;; Call Account B: + ;; Stores Account A hash to 1 + (MSTORE 32 0x01) + (CALL 150000 0xbbbbbbbb00000000000000000000000000000000 0 32 32 0 32) + + ;; Call Account C: + ;; Runs self Destructs on Account A + (CALL 150000 0xcccccccc00000000000000000000000000000000 0 0 0 0 32) + + ;; Call Account B: + ;; Stores Account B hash to 2 + (MSTORE 64 0x02) + (CALL 150000 0xbbbbbbbb00000000000000000000000000000000 0 64 32 0 32) + + (STOP) + } + nonce: '0' + storage: {} + bbbbbbbb00000000000000000000000000000000: + balance: '1000000000000000000' + code: | + { + ;; get key from call data + (CALLDATACOPY 0 0 32) + + ;; store Account A code hash + [[(MLOAD 0)]] (EXTCODEHASH 0xe713449c212d891357cc2966816b1d528cfb59e0) + + } + nonce: '0' + storage: {} + cccccccc00000000000000000000000000000000: + balance: '0' + code: | + { + ;; Run self destruct on Account A + (CALL 150000 0xe713449c212d891357cc2966816b1d528cfb59e0 0 0 0 0 32) + } + nonce: '0' + storage: {} + dddddddd00000000000000000000000000000000: + balance: '0' + code: | + { + (SELFDESTRUCT 0xbbbbbbbb00000000000000000000000000000000) + } + nonce: '0' + storage: {} + a94f5374fce5edbc8e2a8697c15331677e6ebf0b: + balance: '1000000000000000000' + code: '' + nonce: '0' + storage: {} + expect: + - indexes: + data: !!int -1 + gas: !!int -1 + value: !!int -1 + network: + - '>=Constantinople' + result: + 095e7baea6a6c7c4c2dfeb977efac326af552d87: + balance: '1000000000000000001' + storage: { + 0: '0xe713449c212d891357cc2966816b1d528cfb59e0' + } + bbbbbbbb00000000000000000000000000000000: + balance: '1000000000000000000' + storage: { + 1: '0xb05d47e0911e4f67786f4cdc582608ee5f731e845a1e95ddc99759e2b3da81bf', + 2: '0xb05d47e0911e4f67786f4cdc582608ee5f731e845a1e95ddc99759e2b3da81bf' + } + e713449c212d891357cc2966816b1d528cfb59e0: + shouldnotexist: '1' + transaction: + data: + - '' + gasLimit: + - '400000' + gasPrice: '1' + nonce: '0' + secretKey: 45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8 + to: 095e7baea6a6c7c4c2dfeb977efac326af552d87 + value: + - '1' + diff --git a/src/GeneralStateTestsFiller/stExtCodeHash/extCodeHashDeletedAccountFiller.yml b/src/GeneralStateTestsFiller/stExtCodeHash/extCodeHashDeletedAccountFiller.yml index 2e63f88bd..cd13cbb39 100644 --- a/src/GeneralStateTestsFiller/stExtCodeHash/extCodeHashDeletedAccountFiller.yml +++ b/src/GeneralStateTestsFiller/stExtCodeHash/extCodeHashDeletedAccountFiller.yml @@ -1,6 +1,13 @@ -# EXTCODEHASH to a deleted account +# EXTCODEHASH to a deleted account same transaction --- extCodeHashDeletedAccount: + _info: + comment: | + Get account A (deadbeef00000000000000000000000000000000) code hash + Calls Account A's code which causes self destruction of A + Get account A codehash + It is still getting the same codehash because selfdestruct is performed + at the end of transaction during state finalization stage. env: currentCoinbase: 2adc25665018aa1fe0e6bc666dac8fc2697ff9ba currentDifficulty: '0x20000' @@ -54,13 +61,13 @@ extCodeHashDeletedAccount: gas: !!int -1 value: !!int -1 network: - - '>Byzantium' + - '>=Constantinople' result: 095e7baea6a6c7c4c2dfeb977efac326af552d87: balance: '1000000000000000001' storage: { 0: '0x9dff858fbcae72e5644a465fa893f46deb3e03b9cd5a8b531109cd577f7fb293', - 1: '0' + 1: '0x9dff858fbcae72e5644a465fa893f46deb3e03b9cd5a8b531109cd577f7fb293' } deadbeef00000000000000000000000000000000: shouldnotexist: '1' |