Skip to content

Commit

Permalink
cmd/evm: add gasUsed to t8n result (#23919)
Browse files Browse the repository at this point in the history
* cmd/evm: add gas used accumulator to t8n result

* cmd/evm: update t8n tests to include gas used field
  • Loading branch information
lightclient committed Nov 16, 2021
1 parent abc74a5 commit b0b708b
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 15 deletions.
2 changes: 2 additions & 0 deletions cmd/evm/internal/t8ntool/execution.go
Expand Up @@ -55,6 +55,7 @@ type ExecutionResult struct {
Receipts types.Receipts `json:"receipts"`
Rejected []*rejectedTx `json:"rejected,omitempty"`
Difficulty *math.HexOrDecimal256 `json:"currentDifficulty" gencodec:"required"`
GasUsed math.HexOrDecimal64 `json:"gasUsed"`
}

type ommer struct {
Expand Down Expand Up @@ -255,6 +256,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
Receipts: receipts,
Rejected: rejectedTxs,
Difficulty: (*math.HexOrDecimal256)(vmContext.Difficulty),
GasUsed: (math.HexOrDecimal64)(gasUsed),
}
return statedb, execRs, nil
}
Expand Down
5 changes: 3 additions & 2 deletions cmd/evm/testdata/1/exp.json
Expand Up @@ -38,6 +38,7 @@
"error": "nonce too low: address 0x8A8eAFb1cf62BfBeb1741769DAE1a9dd47996192, tx: 0 state: 1"
}
],
"currentDifficulty": "0x20000"
"currentDifficulty": "0x20000",
"gasUsed": "0x5208"
}
}
}
3 changes: 2 additions & 1 deletion cmd/evm/testdata/13/exp2.json
Expand Up @@ -33,6 +33,7 @@
"transactionIndex": "0x1"
}
],
"currentDifficulty": "0x20000"
"currentDifficulty": "0x20000",
"gasUsed": "0x109a0"
}
}
5 changes: 3 additions & 2 deletions cmd/evm/testdata/14/exp.json
Expand Up @@ -6,6 +6,7 @@
"logsHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"currentDifficulty": "0x2000020000000",
"receipts": []
"receipts": [],
"gasUsed": "0x0"
}
}
}
5 changes: 3 additions & 2 deletions cmd/evm/testdata/14/exp2.json
Expand Up @@ -6,6 +6,7 @@
"logsHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"receipts": [],
"currentDifficulty": "0x1ff8020000000"
"currentDifficulty": "0x1ff8020000000",
"gasUsed": "0x0"
}
}
}
5 changes: 3 additions & 2 deletions cmd/evm/testdata/14/exp_berlin.json
Expand Up @@ -6,6 +6,7 @@
"logsHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"receipts": [],
"currentDifficulty": "0x1ff9000000000"
"currentDifficulty": "0x1ff9000000000",
"gasUsed": "0x0"
}
}
}
5 changes: 3 additions & 2 deletions cmd/evm/testdata/19/exp_arrowglacier.json
Expand Up @@ -6,6 +6,7 @@
"logsHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"currentDifficulty": "0x2000000200000",
"receipts": []
"receipts": [],
"gasUsed": "0x0"
}
}
}
5 changes: 3 additions & 2 deletions cmd/evm/testdata/19/exp_london.json
Expand Up @@ -6,6 +6,7 @@
"logsHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"currentDifficulty": "0x2000080000000",
"receipts": []
"receipts": [],
"gasUsed": "0x0"
}
}
}
3 changes: 2 additions & 1 deletion cmd/evm/testdata/3/exp.json
Expand Up @@ -32,6 +32,7 @@
"transactionIndex": "0x0"
}
],
"currentDifficulty": "0x20000"
"currentDifficulty": "0x20000",
"gasUsed": "0x521f"
}
}
3 changes: 2 additions & 1 deletion cmd/evm/testdata/5/exp.json
Expand Up @@ -17,6 +17,7 @@
"logsHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"receipts": [],
"currentDifficulty": "0x20000"
"currentDifficulty": "0x20000",
"gasUsed": "0x0"
}
}

0 comments on commit b0b708b

Please sign in to comment.