Skip to content

Commit 3d896c2

Browse files
committed
fix
1 parent cbdf4b2 commit 3d896c2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

rollup/fees/rollup_fee.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,8 @@ func calculateTxCompressedSize(data []byte, blockNumber uint64, blockTime uint64
233233

234234
if len(compressed) < len(data) {
235235
return new(big.Int).SetUint64(uint64(len(compressed))), nil
236-
} else {
237-
return new(big.Int).SetUint64(uint64(len(data))), nil
238236
}
237+
return new(big.Int).SetUint64(uint64(len(data))), nil
239238
}
240239

241240
// calculatePenalty computes the penalty multiplier based on compression ratio
@@ -335,6 +334,11 @@ func calculateEncodedL1DataFeeGalileo(
335334
penaltyFactor *big.Int,
336335
compressedSize *big.Int,
337336
) *big.Int {
337+
// Sanitize penalty factor.
338+
if penaltyFactor.Cmp(common.Big0) == 0 {
339+
penaltyFactor = common.Big1
340+
}
341+
338342
// feePerByte = (execScalar * l1BaseFee) + (blobScalar * l1BlobBaseFee)
339343
execGas := new(big.Int).Mul(execScalar, l1BaseFee)
340344
blobGas := new(big.Int).Mul(blobScalar, l1BlobBaseFee)

0 commit comments

Comments
 (0)