go-ethereum/cmd/evm/testdata/14
lightclient fbdeff99ce
cmd/evm: calc base fee if parent data is present (#26051)
Currently, in order to chain together sequential valid t8n transitions the caller must manually calculate the block base fee. This PR adds support for the necessary parent fee market data to calculate the base fee for the current transition.

Concretely, env is extended to accept the following:

    parentBaseFee
    parentGasUsed
    parentGasLimit

Example usage can be found in ./cmd/evm/testdata/25.

Co-authored-by: Martin Holst Swende <martin@swende.se>
2022-10-28 12:25:37 +02:00
..
alloc.json cmd/evm: add difficulty calculation to t8n tool (#23353) 2021-08-25 15:04:26 +02:00
env.json cmd/evm: add tests for evm t8n (#23507) 2021-09-02 09:22:43 +02:00
env.uncles.json cmd/evm: add tests for evm t8n (#23507) 2021-09-02 09:22:43 +02:00
exp2.json cmd/evm: calc base fee if parent data is present (#26051) 2022-10-28 12:25:37 +02:00
exp_berlin.json cmd/evm: calc base fee if parent data is present (#26051) 2022-10-28 12:25:37 +02:00
exp.json cmd/evm: calc base fee if parent data is present (#26051) 2022-10-28 12:25:37 +02:00
readme.md cmd/evm: add tests for evm t8n (#23507) 2021-09-02 09:22:43 +02:00
txs.json cmd/evm: add difficulty calculation to t8n tool (#23353) 2021-08-25 15:04:26 +02:00

Difficulty calculation

This test shows how the evm t8n can be used to calculate the (ethash) difficulty, if none is provided by the caller.

Calculating it (with an empty set of txs) using London rules (and no provided unclehash for the parent block):

[user@work evm]$ ./evm t8n --input.alloc=./testdata/14/alloc.json --input.txs=./testdata/14/txs.json --input.env=./testdata/14/env.json --output.result=stdout --state.fork=London
INFO [08-30|20:43:09.352] Trie dumping started                     root=6f0588..7f4bdc
INFO [08-30|20:43:09.352] Trie dumping complete                    accounts=2 elapsed="82.533µs"
INFO [08-30|20:43:09.352] Wrote file                               file=alloc.json
{
  "result": {
    "stateRoot": "0x6f058887ca01549716789c380ede95aecc510e6d1fdc4dbf67d053c7c07f4bdc",
    "txRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
    "receiptRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
    "logsHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
    "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "receipts": [],
    "currentDifficulty": "0x2000020000000"
  }
}

Same thing, but this time providing a non-empty (and non-emptyKeccak) unclehash, which leads to a slightly different result:

[user@work evm]$ ./evm t8n --input.alloc=./testdata/14/alloc.json --input.txs=./testdata/14/txs.json --input.env=./testdata/14/env.uncles.json --output.result=stdout --state.fork=London
INFO [08-30|20:44:33.102] Trie dumping started                     root=6f0588..7f4bdc
INFO [08-30|20:44:33.102] Trie dumping complete                    accounts=2 elapsed="72.91µs"
INFO [08-30|20:44:33.102] Wrote file                               file=alloc.json
{
  "result": {
    "stateRoot": "0x6f058887ca01549716789c380ede95aecc510e6d1fdc4dbf67d053c7c07f4bdc",
    "txRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
    "receiptRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
    "logsHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
    "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "receipts": [],
    "currentDifficulty": "0x1ff8020000000"
  }
}