Skip to content

Commit 3bf5a72

Browse files
lightclientzzyalbert
authored andcommitted
cmd/evm: add gasUsed to t8n result (#23919)
* cmd/evm: add gas used accumulator to t8n result * cmd/evm: update t8n tests to include gas used field
1 parent b02f0f9 commit 3bf5a72

File tree

10 files changed

+26
-15
lines changed

10 files changed

+26
-15
lines changed

cmd/evm/internal/t8ntool/execution.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ type ExecutionResult struct {
5555
Receipts types.Receipts `json:"receipts"`
5656
Rejected []*rejectedTx `json:"rejected,omitempty"`
5757
Difficulty *math.HexOrDecimal256 `json:"currentDifficulty" gencodec:"required"`
58+
GasUsed math.HexOrDecimal64 `json:"gasUsed"`
5859
}
5960

6061
type ommer struct {
@@ -255,6 +256,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
255256
Receipts: receipts,
256257
Rejected: rejectedTxs,
257258
Difficulty: (*math.HexOrDecimal256)(vmContext.Difficulty),
259+
GasUsed: (math.HexOrDecimal64)(gasUsed),
258260
}
259261
return statedb, execRs, nil
260262
}

cmd/evm/testdata/1/exp.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"error": "nonce too low: address 0x8A8eAFb1cf62BfBeb1741769DAE1a9dd47996192, tx: 0 state: 1"
3939
}
4040
],
41-
"currentDifficulty": "0x20000"
41+
"currentDifficulty": "0x20000",
42+
"gasUsed": "0x5208"
4243
}
43-
}
44+
}

cmd/evm/testdata/13/exp2.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"transactionIndex": "0x1"
3434
}
3535
],
36-
"currentDifficulty": "0x20000"
36+
"currentDifficulty": "0x20000",
37+
"gasUsed": "0x109a0"
3738
}
3839
}

cmd/evm/testdata/14/exp.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"logsHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
77
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
88
"currentDifficulty": "0x2000020000000",
9-
"receipts": []
9+
"receipts": [],
10+
"gasUsed": "0x0"
1011
}
11-
}
12+
}

cmd/evm/testdata/14/exp2.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"logsHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
77
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
88
"receipts": [],
9-
"currentDifficulty": "0x1ff8020000000"
9+
"currentDifficulty": "0x1ff8020000000",
10+
"gasUsed": "0x0"
1011
}
11-
}
12+
}

cmd/evm/testdata/14/exp_berlin.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"logsHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
77
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
88
"receipts": [],
9-
"currentDifficulty": "0x1ff9000000000"
9+
"currentDifficulty": "0x1ff9000000000",
10+
"gasUsed": "0x0"
1011
}
11-
}
12+
}

cmd/evm/testdata/19/exp_arrowglacier.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"logsHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
77
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
88
"currentDifficulty": "0x2000000200000",
9-
"receipts": []
9+
"receipts": [],
10+
"gasUsed": "0x0"
1011
}
11-
}
12+
}

cmd/evm/testdata/19/exp_london.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"logsHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
77
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
88
"currentDifficulty": "0x2000080000000",
9-
"receipts": []
9+
"receipts": [],
10+
"gasUsed": "0x0"
1011
}
11-
}
12+
}

cmd/evm/testdata/3/exp.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"transactionIndex": "0x0"
3333
}
3434
],
35-
"currentDifficulty": "0x20000"
35+
"currentDifficulty": "0x20000",
36+
"gasUsed": "0x521f"
3637
}
3738
}

cmd/evm/testdata/5/exp.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"logsHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
1818
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
1919
"receipts": [],
20-
"currentDifficulty": "0x20000"
20+
"currentDifficulty": "0x20000",
21+
"gasUsed": "0x0"
2122
}
2223
}

0 commit comments

Comments
 (0)