Skip to content

Commit

Permalink
Fix baseFeeCostIncrease calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
PlasmaPower committed Mar 1, 2024
1 parent 3db7246 commit b5f2bf2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions arbnode/dataposter/data_poster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit b5f2bf2

Please sign in to comment.