ethereum / retesteth

testeth via RPC. Test run, generation by t8ntool protocol
http://retesteth.ethdevops.io/
GNU General Public License v3.0
114 stars 75 forks source link

state transition tool for test generation #88

Closed winsvega closed 4 years ago

winsvega commented 4 years ago

Suggestion:

Each client that want to be able to generate the tests or debug certain state transition implements a state-transition tool as an alternative to test-rpc methods. The state-transition tool takes input like this (to be discussed):

{
    "genesis" : {
        "Coinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
        "Difficulty" : "0x020000",
        "GasLimit" : "0x0f4240",
        "Nonce" : "0x0000000000000000",
        "ExtraData" : "0x00",
        "Timestamp" : "0x00",
        "Mixhash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
        "Alloc" : {
            "0x095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
                "balance" : "0x0de0b6b3a7640000",
                "code" : "0x600160010160005500",
                "nonce" : "0x00",
                "storage" : {
                }
            },
            "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
                "balance" : "0x0de0b6b3a7640000",
                "code" : "0x",
                "nonce" : "0x00",
                "storage" : {
                }
            }
        },
        "Config" : {
            "HomesteadBlock" : 0,
            "EIP150Block" : 0,
            "EIP155Block" : 0,
            "EIP158Block" : 0,
            "ByzantiumBlock" : 0,
            "ConstantinopleBlock" : 0,
            "PetersburgBlock" : 0,
            "IstanbulBlock" : 0
        }
    },
    "transactions": [
      {
        "gas": "0x5208",
        "gasPrice": "0x2",
        "hash": "0x0557bacce3375c98d806609b8d5043072f0b6a8bae45ae5a67a00d3a1a18d673",
        "input": "0x",
        "nonce": "0x0",
        "r": "0x9500e8ba27d3c33ca7764e107410f44cbd8c19794bde214d694683a7aa998cdb",
        "s": "0x7235ae07e4bd6e0206d102b1f8979d6adab280466b6a82d2208ee08951f1f600",
        "to": "0x8a8eafb1cf62bfbeb1741769dae1a9dd47996192",
        "v": "0x1b",
        "value": "0x1"
      },
      { 
        "gas": "0x5208",
        "gasPrice": "0x2",
        "hash": "0x0557bacce3375c98d806609b8d5043072f0b6a8bae45ae5a67a00d3a1a18d673",
        "input": "0x",
        "nonce": "0x0",
        "r": "0x9500e8ba27d3c33ca7764e107410f44cbd8c19794bde214d694683a7aa998cdb",
        "s": "0x7235ae07e4bd6e0206d102b1f8979d6adab280466b6a82d2208ee08951f1f600",
        "to": "0x8a8eafb1cf62bfbeb1741769dae1a9dd47996192",
        "v": "0x1b",
        "value": "0x1"
      }
  ]
}

and produces an output like this (to be discussed):

                "blockHeader" : {
                    "bloom" : "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
                    "coinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
                    "difficulty" : "0x20000",
                    "extraData" : "0x00",
                    "gasLimit" : "0xf460f",
                    "gasUsed" : "0xa034",
                    "hash" : "0xb264d43a3f23b55eb20e71c2c42676beda6086bb5b9582ba703ebe973d8da915",
                    "mixHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
                    "nonce" : "0x0000000000000000",
                    "number" : "0x1",
                    "parentHash" : "0x3a90b4fc4c29d3e867c974fa900b7c97e80776443c769892e327712c5abf4ebf",
                    "receiptTrie" : "0x5a0b89fb1e5f44d02b5900c39683a1796c591b2c3b08e3b1bfc94f5aa4f3c44d",
                    "stateRoot" : "0x23c7b48b8252701eb5a28a96a77497ad794a54a093f502b21698351d7dd01c0b",
                    "timestamp" : "0x3e8",
                    "transactionsTrie" : "0x93ca2a18d52e7c1846f7b104e2fc1e5fdc71ebe38187248f9437d39e74f43aab",
                    "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
                },
        "Post" : {
            "0x095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
                "balance" : "0x0de0b6b3a7640000",
                "code" : "0x600160010160005500",
                "nonce" : "0x00",
                "storage" : {
                }
            },
            "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
                "balance" : "0x0de0b6b3a7640000",
                "code" : "0x",
                "nonce" : "0x00",
                "storage" : {
                }
            }
       }
winsvega commented 4 years ago

support implemented