Skip to content

Commit

Permalink
Fix logical error in eth_estimateGas endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
m-Peter committed Dec 2, 2024
1 parent 386044f commit 0e107bf
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions services/requester/requester.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ func (e *EVM) EstimateGas(
}
tx.Gas = passingGasLimit
// We first execute the transaction at the highest allowable gas limit,
// since if this fails we can return error immediately.
// since if this fails we can return the error immediately.
result, err := e.dryRunTx(tx, from, height, stateOverrides)
if err != nil {
return 0, err
Expand Down Expand Up @@ -402,8 +402,7 @@ func (e *EVM) EstimateGas(
// transaction had run without error at least once before.
return 0, err
}
resultSummary := result.ResultSummary()
if resultSummary.ErrorCode == evmTypes.ExecutionErrCodeOutOfGas {
if result.Failed() {
failingGasLimit = optimisticGasLimit
} else {
passingGasLimit = optimisticGasLimit
Expand Down Expand Up @@ -431,8 +430,7 @@ func (e *EVM) EstimateGas(
if err != nil {
return 0, err
}
resultSummary := result.ResultSummary()
if resultSummary.ErrorCode == evmTypes.ExecutionErrCodeOutOfGas {
if result.Failed() {
failingGasLimit = mid
} else {
passingGasLimit = mid
Expand Down

0 comments on commit 0e107bf

Please sign in to comment.