From 83cd119b9f3f4870c0b5552372369d30411f8d9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Thu, 22 May 2025 09:46:35 +0200 Subject: [PATCH] remove the random state tests using `BLOCKHASH` Remove the only state test which uses the `BLOCKHASH` instruction. This is a random test which actually fails because of the stack underflow so the result of the `BLOCKHASH` instruction doesn't affect the post state at all. Any other test for `BLOCKHASH` has been converted to the blockchain test format where the block hashes are properly defined. This is the disassembled code of the test. It fails at DUP11 because of the stack underflow. ``` // Inputs[5] // { // @0063 block.blockHash(0x0000000000000000000000000000000000000000000000000000000000000000) // @0085 msg.data[0x01:0x21] // @00A8 stack[-7] // @00A9 stack[-11] // @00AF memory[0x00:0x20] // } 0000 7F PUSH32 0x000000000000000000000000000000000000000000000000000000000000c350 0021 7F PUSH32 0x0000000000000000000000000000000000000000000000000000000000000001 0042 7F PUSH32 0x0000000000000000000000000000000000000000000000000000000000000000 0063 40 BLOCKHASH 0064 7F PUSH32 0x0000000000000000000000000000000000000000000000000000000000000001 0085 35 CALLDATALOAD 0086 7F PUSH32 0x0000000000000000000000000000000000000000000000000000000000000001 00A7 0B SIGNEXTEND 00A8 8A DUP11 00A9 9E SWAP15 00AA 12 SLT 00AB 01 ADD 00AC 05 SDIV 00AD 60 PUSH1 0x00 00AF 51 MLOAD 00B0 55 SSTORE // Stack delta = +1 // Outputs[3] // { // @0000 stack[0] = 0x000000000000000000000000000000000000000000000000000000000000c350 // @00A9 stack[-11] = stack[-7] // @00B0 storage[memory[0x00:0x20]] = ((stack[-11] i< signextend(0x0000000000000000000000000000000000000000000000000000000000000001, msg.data[0x01:0x21])) + block.blockHash(0x0000000000000000000000000000000000000000000000000000000000000000)) i/ 0x0000000000000000000000000000000000000000000000000000000000000001 // } ``` --- .../stRandom/randomStatetest101.json | 104 ------------------ .../stRandom/randomStatetest101Filler.json | 83 -------------- 2 files changed, 187 deletions(-) delete mode 100644 Constantinople/GeneralStateTests/stRandom/randomStatetest101.json delete mode 100644 src/LegacyTests/Constantinople/GeneralStateTestsFiller/stRandom/randomStatetest101Filler.json diff --git a/Constantinople/GeneralStateTests/stRandom/randomStatetest101.json b/Constantinople/GeneralStateTests/stRandom/randomStatetest101.json deleted file mode 100644 index 9259db40c..000000000 --- a/Constantinople/GeneralStateTests/stRandom/randomStatetest101.json +++ /dev/null @@ -1,104 +0,0 @@ -{ - "randomStatetest101" : { - "_info" : { - "comment" : "", - "filledwith" : "testeth 1.7.0-alpha.0+commit.2b11ce5c", - "lllcversion" : "Version: 0.5.0-develop.2018.11.9+commit.9709dfe0.Linux.g++", - "source" : "src/GeneralStateTestsFiller/stRandom/randomStatetest101Filler.json", - "sourceHash" : "d2cb546ccb87ed6c4e7676707da405d5901164626a1aecd84592039f293245e6" - }, - "env" : { - "currentCoinbase" : "0x945304eb96065b2a98b57a48a06ae28d285a71b5", - "currentDifficulty" : "0x020000", - "currentGasLimit" : "0x7fffffffffffffff", - "currentNumber" : "0x01", - "currentTimestamp" : "0x03e8", - "previousHash" : "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" - }, - "post" : { - "Byzantium" : [ - { - "hash" : "0xdce115ce0dcd7b7bfb76329a14d665a803e5cf266cf1235dfea7d20c03e83d18", - "indexes" : { - "data" : 0, - "gas" : 0, - "value" : 0 - }, - "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" - } - ], - "Constantinople" : [ - { - "hash" : "0xdce115ce0dcd7b7bfb76329a14d665a803e5cf266cf1235dfea7d20c03e83d18", - "indexes" : { - "data" : 0, - "gas" : 0, - "value" : 0 - }, - "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" - } - ], - "ConstantinopleFix" : [ - { - "hash" : "0xdce115ce0dcd7b7bfb76329a14d665a803e5cf266cf1235dfea7d20c03e83d18", - "indexes" : { - "data" : 0, - "gas" : 0, - "value" : 0 - }, - "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" - } - ], - "Homestead" : [ - { - "hash" : "0xdce115ce0dcd7b7bfb76329a14d665a803e5cf266cf1235dfea7d20c03e83d18", - "indexes" : { - "data" : 0, - "gas" : 0, - "value" : 0 - }, - "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" - } - ] - }, - "pre" : { - "0x095e7baea6a6c7c4c2dfeb977efac326af552d87" : { - "balance" : "0x00", - "code" : "0x7f000000000000000000000000000000000000000000000000000000000000c3507f00000000000000000000000000000000000000000000000000000000000000017f0000000000000000000000000000000000000000000000000000000000000000407f0000000000000000000000000000000000000000000000000000000000000001357f00000000000000000000000000000000000000000000000000000000000000010b8a9e12010560005155", - "nonce" : "0x00", - "storage" : { - } - }, - "0x945304eb96065b2a98b57a48a06ae28d285a71b5" : { - "balance" : "0x2e", - "code" : "0x6000355415600957005b60203560003555", - "nonce" : "0x00", - "storage" : { - } - }, - "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "0x0de0b6b3a7640000", - "code" : "0x", - "nonce" : "0x00", - "storage" : { - } - } - }, - "transaction" : { - "data" : [ - "0x7f000000000000000000000000000000000000000000000000000000000000c3507f00000000000000000000000000000000000000000000000000000000000000017f0000000000000000000000000000000000000000000000000000000000000000407f0000000000000000000000000000000000000000000000000000000000000001357f00000000000000000000000000000000000000000000000000000000000000010b8a9e120105" - ], - "gasLimit" : [ - "0x0be49f43" - ], - "gasPrice" : "0x01", - "nonce" : "0x00", - "secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "sender" : "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b", - "to" : "0x095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : [ - "0x70551123" - ] - } - } -} diff --git a/src/LegacyTests/Constantinople/GeneralStateTestsFiller/stRandom/randomStatetest101Filler.json b/src/LegacyTests/Constantinople/GeneralStateTestsFiller/stRandom/randomStatetest101Filler.json deleted file mode 100644 index eb2ff7287..000000000 --- a/src/LegacyTests/Constantinople/GeneralStateTestsFiller/stRandom/randomStatetest101Filler.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "randomStatetest101" : { - "env" : { - "currentCoinbase" : "945304eb96065b2a98b57a48a06ae28d285a71b5", - "currentDifficulty" : "0x20000", - "currentGasLimit" : "0x7fffffffffffffff", - "currentNumber" : "1", - "currentTimestamp" : "1000", - "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" - }, - "expect" : [ - { - "indexes" : { - "data" : -1, - "gas" : -1, - "value" : -1 - }, - "network" : ["Byzantium", "Homestead"], - "result" : { - "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { - "balance" : "0", - "code" : "0x7f000000000000000000000000000000000000000000000000000000000000c3507f00000000000000000000000000000000000000000000000000000000000000017f0000000000000000000000000000000000000000000000000000000000000000407f0000000000000000000000000000000000000000000000000000000000000001357f00000000000000000000000000000000000000000000000000000000000000010b8a9e12010560005155", - "nonce" : "0", - "storage" : { - } - }, - "945304eb96065b2a98b57a48a06ae28d285a71b5" : { - "balance" : "199532401", - "code" : "0x6000355415600957005b60203560003555", - "nonce" : "0", - "storage" : { - } - }, - "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "999999999800467645", - "code" : "0x", - "nonce" : "1", - "storage" : { - } - } - } - } - ], - "pre" : { - "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { - "balance" : "0", - "code" : "0x7f000000000000000000000000000000000000000000000000000000000000c3507f00000000000000000000000000000000000000000000000000000000000000017f0000000000000000000000000000000000000000000000000000000000000000407f0000000000000000000000000000000000000000000000000000000000000001357f00000000000000000000000000000000000000000000000000000000000000010b8a9e12010560005155", - "nonce" : "0", - "storage" : { - } - }, - "945304eb96065b2a98b57a48a06ae28d285a71b5" : { - "balance" : "46", - "code" : "0x6000355415600957005b60203560003555", - "nonce" : "0", - "storage" : { - } - }, - "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "1000000000000000000", - "code" : "0x", - "nonce" : "0", - "storage" : { - } - } - }, - "transaction" : { - "data" : [ - "0x7f000000000000000000000000000000000000000000000000000000000000c3507f00000000000000000000000000000000000000000000000000000000000000017f0000000000000000000000000000000000000000000000000000000000000000407f0000000000000000000000000000000000000000000000000000000000000001357f00000000000000000000000000000000000000000000000000000000000000010b8a9e120105" - ], - "gasLimit" : [ - "0x0be49f43" - ], - "gasPrice" : "1", - "nonce" : "0", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : [ - "1884623139" - ] - } - } -}