From b5f2bf27e9035f19e19ae845062b4bb8340acdc3 Mon Sep 17 00:00:00 2001 From: Lee Bousfield Date: Thu, 29 Feb 2024 22:05:48 -0600 Subject: [PATCH] Fix baseFeeCostIncrease calculation --- arbnode/dataposter/data_poster.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arbnode/dataposter/data_poster.go b/arbnode/dataposter/data_poster.go index f9522703f9..495e9eb0e9 100644 --- a/arbnode/dataposter/data_poster.go +++ b/arbnode/dataposter/data_poster.go @@ -620,10 +620,11 @@ func (p *DataPoster) feeAndTipCaps(ctx context.Context, nonce uint64, gasLimit u targetNonBlobCost := arbmath.BigSub(targetMaxCost, targetBlobCost) newBaseFeeCap := arbmath.BigDivByUint(targetNonBlobCost, gasLimit) if lastTx != nil && numBlobs > 0 && arbmath.BigDivToBips(newBaseFeeCap, lastTx.GasFeeCap()) < minRbfIncrease { - // Reduce the blobfee cap to ensure that the basefee meats the minimum rbf increase + // Increase the non-blob fee cap to the minimum rbf increase newBaseFeeCap = arbmath.BigMulByBips(lastTx.GasFeeCap(), minRbfIncrease) newNonBlobCost := arbmath.BigMulByUint(newBaseFeeCap, gasLimit) - baseFeeCostIncrease := arbmath.BigSub(targetNonBlobCost, newNonBlobCost) + // Increasing the non-blob fee cap requires lowering the blob fee cap to compensate + baseFeeCostIncrease := arbmath.BigSub(newNonBlobCost, targetNonBlobCost) newBlobCost := arbmath.BigSub(targetBlobCost, baseFeeCostIncrease) newBlobFeeCap = arbmath.BigDivByUint(newBlobCost, blobGasUsed) }