Skip to content

Commit

Permalink
internal/ethapi: recap higher args.Gas with block GasLimit in DoEstim…
Browse files Browse the repository at this point in the history
…ateGas (#29738)

* internal/ethapi: recap higher args.Gas with block GasLimit in DoEstimateGas

* internal/ethapi: fix gas estimator capping code

* internal/ethapi: fix test

* fix goimports lint (remove space)

---------

Co-authored-by: Péter Szilágyi <peterke@gmail.com>
  • Loading branch information
SangIlMo and karalabe authored Jun 4, 2024
1 parent 68c0ec0 commit 682ae83
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1199,10 +1199,16 @@ func DoEstimateGas(ctx context.Context, b Backend, args TransactionArgs, blockNr
State: state,
ErrorRatio: estimateGasErrorRatio,
}
// Set any required transaction default, but make sure the gas cap itself is not messed with
// if it was not specified in the original argument list.
if args.Gas == nil {
args.Gas = new(hexutil.Uint64)
}
if err := args.CallDefaults(gasCap, header.BaseFee, b.ChainConfig().ChainID); err != nil {
return 0, err
}
call := args.ToMessage(header.BaseFee)

// Run the gas estimation and wrap any revertals into a custom return

This comment has been minimized.

Copy link
@OATEF4313

OATEF4313 Jun 6, 2024

تشغيل تلغاز

This comment has been minimized.

Copy link
@OATEF4313

OATEF4313 Jun 6, 2024

تشغيل الجهاز

estimate, revert, err := gasestimator.Estimate(ctx, call, opts, gasCap)
if err != nil {
Expand Down

0 comments on commit 682ae83

Please sign in to comment.