Skip to content

Commit 9f90dbb

Browse files
committed
feat(ethclient): add maxUsedGas to simulate call results ethereum#34820
1 parent a68ecb4 commit 9f90dbb

3 files changed

Lines changed: 13 additions & 0 deletions

File tree

ethclient/ethclient.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,7 @@ type SimulateCallResult struct {
833833
ReturnValue []byte `json:"returnData"`
834834
Logs []*types.Log `json:"logs"`
835835
GasUsed uint64 `json:"gasUsed"`
836+
MaxUsedGas uint64 `json:"maxUsedGas"`
836837
Status uint64 `json:"status"`
837838
Error *CallError `json:"error,omitempty"`
838839
}

ethclient/ethclient_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -917,6 +917,12 @@ func TestSimulateV1(t *testing.T) {
917917
if results[0].Calls[0].Error != nil {
918918
t.Errorf("expected no error, got %v", results[0].Calls[0].Error)
919919
}
920+
if results[0].Calls[0].MaxUsedGas == 0 {
921+
t.Error("expected maxUsedGas to be set")
922+
}
923+
if results[0].Calls[0].MaxUsedGas < results[0].Calls[0].GasUsed {
924+
t.Errorf("expected maxUsedGas >= gasUsed, got %d < %d", results[0].Calls[0].MaxUsedGas, results[0].Calls[0].GasUsed)
925+
}
920926
}
921927

922928
// TestSimulateV1WithBlockOverrides tests simulate v 1 with block overrides.

ethclient/gen_simulate_call_result.go

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)