cmd/evm: add difficulty calculation to t8n tool (#23353)
This PR adds functionality to the evm t8n to calculate ethash difficulty. If the caller does not provide a currentDifficulty, but instead provides the parentTimestamp (well, semi-optional, will default to 0 if not given), and parentDifficulty, we can calculate it for him. The caller can also provide a parentUncleHash. In most, but not all cases, the parent uncle hash also affects the formula. If no such hash is provided (or, if the empty all-zero hash is provided), it's assumed that there were no uncles.
Showing
- cmd/evm/internal/t8ntool/execution.go 49 additions, 21 deletionscmd/evm/internal/t8ntool/execution.go
- cmd/evm/internal/t8ntool/gen_stenv.go 36 additions, 19 deletionscmd/evm/internal/t8ntool/gen_stenv.go
- cmd/evm/internal/t8ntool/transition.go 14 additions, 0 deletionscmd/evm/internal/t8ntool/transition.go
- cmd/evm/testdata/14/alloc.json 12 additions, 0 deletionscmd/evm/testdata/14/alloc.json
- cmd/evm/testdata/14/env.json 9 additions, 0 deletionscmd/evm/testdata/14/env.json
- cmd/evm/testdata/14/env.uncles.json 10 additions, 0 deletionscmd/evm/testdata/14/env.uncles.json
- cmd/evm/testdata/14/readme.md 41 additions, 0 deletionscmd/evm/testdata/14/readme.md
- cmd/evm/testdata/14/txs.json 1 addition, 0 deletionscmd/evm/testdata/14/txs.json
Loading
Please register or sign in to comment