Skip to content

Commit

Permalink
Add note for binary search algorithm used for EstimateGas
Browse files Browse the repository at this point in the history
  • Loading branch information
m-Peter committed Nov 26, 2024
1 parent 21b3c4c commit affe39d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions services/requester/requester.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,9 @@ func (e *EVM) EstimateGas(
height uint64,
stateOverrides *ethTypes.StateOverride,
) (uint64, error) {
// Note: The following algorithm, is largely inspired from
// https://github.com/onflow/go-ethereum/blob/master/eth/gasestimator/gasestimator.go#L49-L192,
// and adapted to fit our use-case.
// Binary search the gas limit, as it may need to be higher than the amount used
var (
failingGasLimit uint64 // lowest-known gas limit where tx execution fails
Expand Down

0 comments on commit affe39d

Please sign in to comment.