From b68aa1426ccfb36e8aca6dc90397758d2c554008 Mon Sep 17 00:00:00 2001 From: David Date: Fri, 3 Jan 2025 13:14:46 +0800 Subject: [PATCH] fix(taiko-client): fix proposing fee estimation --- .../taiko-client/proposer/transaction_builder/fallback.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/taiko-client/proposer/transaction_builder/fallback.go b/packages/taiko-client/proposer/transaction_builder/fallback.go index a97970f431..9305e7ec69 100644 --- a/packages/taiko-client/proposer/transaction_builder/fallback.go +++ b/packages/taiko-client/proposer/transaction_builder/fallback.go @@ -150,13 +150,12 @@ func (b *TxBuilderWithFallback) estimateCandidateCost( } log.Debug("Suggested gas price", "gasTipCap", gasTipCap, "baseFee", baseFee, "blobBaseFee", blobBaseFee) - gasPrice := new(big.Int).Add(baseFee, gasTipCap) + gasFeeCap := new(big.Int).Add(baseFee, gasTipCap) gasUsed, err := b.rpc.L1.EstimateGas(ctx, ethereum.CallMsg{ From: txmgr.From(), To: candidate.To, Gas: candidate.GasLimit, - GasPrice: gasPrice, - GasFeeCap: gasPrice, + GasFeeCap: gasFeeCap, GasTipCap: gasTipCap, Value: candidate.Value, Data: candidate.TxData, @@ -165,7 +164,7 @@ func (b *TxBuilderWithFallback) estimateCandidateCost( return nil, fmt.Errorf("failed to estimate gas used: %w", err) } - feeWithoutBlob := new(big.Int).Mul(gasPrice, new(big.Int).SetUint64(gasUsed)) + feeWithoutBlob := new(big.Int).Mul(gasFeeCap, new(big.Int).SetUint64(gasUsed)) // If its a type-2 transaction, we won't calculate blob fee. if len(candidate.Blobs) == 0 {