File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -206,8 +206,8 @@ func calculateEncodedRollupFeeFeeFeynman(
206
206
// tx size (RLP-encoded)
207
207
txSize := big .NewInt (int64 (len (data )))
208
208
209
- // compression_ratio(tx) = 1 (placeholder)
210
- compressionRatio := big .NewInt (1 )
209
+ // compression_ratio(tx) = 1 (placeholder, scaled to match scalars precision )
210
+ compressionRatio := big .NewInt (rcfg . Precision . Int64 () )
211
211
212
212
// compute gas components
213
213
execGas := new (big.Int ).Mul (execScalar , l1BaseFee )
@@ -216,11 +216,13 @@ func calculateEncodedRollupFeeFeeFeynman(
216
216
// fee per byte = execGas + blobGas
217
217
feePerByte := new (big.Int ).Add (execGas , blobGas )
218
218
219
- // fee = compression_ratio * tx_size * (execGas + blobGas)
219
+ // rollupFee = compression_ratio * tx_size * feePerByte
220
220
rollupFee := new (big.Int ).Mul (compressionRatio , txSize )
221
221
rollupFee .Mul (rollupFee , feePerByte )
222
222
223
- rollupFee = new (big.Int ).Quo (rollupFee , rcfg .Precision )
223
+ // Divide by rcfg.Precision (once for ratio, once for scalar)
224
+ rollupFee .Div (rollupFee , rcfg .Precision )
225
+ rollupFee .Div (rollupFee , rcfg .Precision )
224
226
225
227
return rollupFee
226
228
}
You can’t perform that action at this time.
0 commit comments