Skip to content

Commit

Permalink
clarify that the estimated l1 size is scaled up by 1e6 (#418)
Browse files Browse the repository at this point in the history
  • Loading branch information
roberto-bayardo authored Oct 29, 2024
1 parent 5c98784 commit 11064f6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core/types/rollup_cost.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ func NewL1CostFuncFjord(l1BaseFee, l1BlobBaseFee, baseFeeScalar, blobFeeScalar *
calldataCostPerByte := new(big.Int).Mul(scaledL1BaseFee, sixteen)
blobCostPerByte := new(big.Int).Mul(blobFeeScalar, l1BlobBaseFee)
l1FeeScaled := new(big.Int).Add(calldataCostPerByte, blobCostPerByte)
estimatedSize := EstimatedL1Size(costData)
estimatedSize := EstimatedL1SizeScaled(costData)
l1CostScaled := new(big.Int).Mul(estimatedSize, l1FeeScaled)
l1Cost := new(big.Int).Div(l1CostScaled, fjordDivisor)

Expand All @@ -375,9 +375,9 @@ func NewL1CostFuncFjord(l1BaseFee, l1BlobBaseFee, baseFeeScalar, blobFeeScalar *
}
}

// EstimatedL1Size estimates the number of bytes the transaction will occupy in its L1 batch, using
// the Fjord linear regression model.
func EstimatedL1Size(costData RollupCostData) *big.Int {
// EstimatedL1Size estimates the number of bytes the transaction will occupy in its L1 batch using
// the Fjord linear regression model, and returns this value scaled up by 1e6.
func EstimatedL1SizeScaled(costData RollupCostData) *big.Int {
fastLzSize := new(big.Int).SetUint64(costData.FastLzSize)
estimatedSize := new(big.Int).Add(L1CostIntercept, new(big.Int).Mul(L1CostFastlzCoef, fastLzSize))

Expand Down

0 comments on commit 11064f6

Please sign in to comment.