mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 13:46:43 +00:00
Cap maximum gas allowance to EIP-7825 in gas estimates only for osaka
This commit is contained in:
parent
1bb15004a3
commit
c0f4b07fa4
1 changed files with 16 additions and 2 deletions
|
|
@ -62,9 +62,23 @@ func Estimate(ctx context.Context, call *core.Message, opts *Options, gasCap uin
|
||||||
if call.GasLimit >= params.TxGas {
|
if call.GasLimit >= params.TxGas {
|
||||||
hi = call.GasLimit
|
hi = call.GasLimit
|
||||||
}
|
}
|
||||||
if hi >= params.MaxTxGas {
|
|
||||||
|
// Cap the maximum gas allowance according to EIP-7825 if the estimation targets Osaka
|
||||||
|
if hi > params.MaxTxGas {
|
||||||
|
blockNumber, blockTime := opts.Header.Number, opts.Header.Time
|
||||||
|
if opts.BlockOverrides != nil {
|
||||||
|
if opts.BlockOverrides.Number != nil {
|
||||||
|
blockNumber = opts.BlockOverrides.Number.ToInt()
|
||||||
|
}
|
||||||
|
if opts.BlockOverrides.Time != nil {
|
||||||
|
blockTime = uint64(*opts.BlockOverrides.Time)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if opts.Config.IsOsaka(blockNumber, blockTime) {
|
||||||
hi = params.MaxTxGas
|
hi = params.MaxTxGas
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Normalize the max fee per gas the call is willing to spend.
|
// Normalize the max fee per gas the call is willing to spend.
|
||||||
var feeCap *big.Int
|
var feeCap *big.Int
|
||||||
if call.GasFeeCap != nil {
|
if call.GasFeeCap != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue