Skip to content

Commit 2c007cf

Browse files
authored
accounts/abi/bind/backend: use requested header for gas prices and gas limits (#28280)
1 parent 5e43ed0 commit 2c007cf

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

accounts/abi/bind/backends/simulated.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -606,8 +606,7 @@ func (b *SimulatedBackend) callContract(ctx context.Context, call ethereum.CallM
606606
if call.GasPrice != nil && (call.GasFeeCap != nil || call.GasTipCap != nil) {
607607
return nil, errors.New("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified")
608608
}
609-
head := b.blockchain.CurrentHeader()
610-
if !b.blockchain.Config().IsLondon(head.Number) {
609+
if !b.blockchain.Config().IsLondon(header.Number) {
611610
// If there's no basefee, then it must be a non-1559 execution
612611
if call.GasPrice == nil {
613612
call.GasPrice = new(big.Int)
@@ -629,13 +628,13 @@ func (b *SimulatedBackend) callContract(ctx context.Context, call ethereum.CallM
629628
// Backfill the legacy gasPrice for EVM execution, unless we're all zeroes
630629
call.GasPrice = new(big.Int)
631630
if call.GasFeeCap.BitLen() > 0 || call.GasTipCap.BitLen() > 0 {
632-
call.GasPrice = math.BigMin(new(big.Int).Add(call.GasTipCap, head.BaseFee), call.GasFeeCap)
631+
call.GasPrice = math.BigMin(new(big.Int).Add(call.GasTipCap, header.BaseFee), call.GasFeeCap)
633632
}
634633
}
635634
}
636635
// Ensure message is initialized properly.
637636
if call.Gas == 0 {
638-
call.Gas = 50000000
637+
call.Gas = 10 * header.GasLimit
639638
}
640639
if call.Value == nil {
641640
call.Value = new(big.Int)

0 commit comments

Comments
 (0)