@@ -2151,6 +2151,7 @@ type CallBundleArgs struct {
21512151 Timeout * int64 `json:"timeout"`
21522152 GasLimit * uint64 `json:"gasLimit"`
21532153 Difficulty * big.Int `json:"difficulty"`
2154+ BaseFee * big.Int `json:"baseFee"`
21542155}
21552156
21562157// CallBundle will simulate a bundle of transactions at the top of a given block
@@ -2205,13 +2206,20 @@ func (s *BundleAPI) CallBundle(ctx context.Context, args CallBundleArgs) (map[st
22052206 if args .GasLimit != nil {
22062207 gasLimit = * args .GasLimit
22072208 }
2209+ var baseFee * big.Int
2210+ if args .BaseFee != nil {
2211+ baseFee = args .BaseFee
2212+ } else if s .b .ChainConfig ().IsLondon (big .NewInt (args .BlockNumber .Int64 ())) {
2213+ baseFee = misc .CalcBaseFee (s .b .ChainConfig (), parent )
2214+ }
22082215 header := & types.Header {
22092216 ParentHash : parent .Hash (),
22102217 Number : blockNumber ,
22112218 GasLimit : gasLimit ,
22122219 Time : timestamp ,
22132220 Difficulty : difficulty ,
22142221 Coinbase : coinbase ,
2222+ BaseFee : baseFee ,
22152223 }
22162224
22172225 // Setup context so it may be cancelled the call has completed
@@ -2264,7 +2272,11 @@ func (s *BundleAPI) CallBundle(ctx context.Context, args CallBundleArgs) (map[st
22642272 "toAddress" : to ,
22652273 }
22662274 totalGasUsed += receipt .GasUsed
2267- gasFeesTx := new (big.Int ).Mul (big .NewInt (int64 (receipt .GasUsed )), tx .GasPrice ())
2275+ gasPrice , err := tx .EffectiveGasTip (header .BaseFee )
2276+ if err != nil {
2277+ return nil , fmt .Errorf ("err: %w; txhash %s" , err , tx .Hash ())
2278+ }
2279+ gasFeesTx := new (big.Int ).Mul (big .NewInt (int64 (receipt .GasUsed )), gasPrice )
22682280 gasFees .Add (gasFees , gasFeesTx )
22692281 bundleHash .Write (tx .Hash ().Bytes ())
22702282 if result .Err != nil {
0 commit comments