Skip to content

Commit

Permalink
Update core/types/rollup_cost.go
Browse files Browse the repository at this point in the history
Co-authored-by: protolambda <[email protected]>
  • Loading branch information
2 people authored and Roberto Bayardo committed Jan 9, 2024
1 parent be81fa4 commit c887e59
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 @@ -194,14 +194,14 @@ func newL1CostFuncEcotone(l1Basefee, l1BlobBasefee, l1BasefeeScalar, l1BlobBasef

// Ecotone L1 cost function:
//
// (gas/16)*(l1Basefee*16*l1BasefeeScalar + l1BlobBasefee*l1BlobBasefeeScalar)/1e6
// (calldataGas/16)*(l1Basefee*16*l1BasefeeScalar + l1BlobBasefee*l1BlobBasefeeScalar)/1e6
//
// We divide "gas" by 16 to change from units of calldata gas to "estimated # of bytes when
// compressed".
// We divide "calldataGas" by 16 to change from units of calldata gas to "estimated # of bytes when
// compressed". Known as "compressedTxSize" in the spec.
//
// Function is actually computed as follows for better precision under integer arithmetic:
//
// gas*(l1Basefee*16*l1BasefeeScalar + l1BlobBasefee*l1BlobBasefeeScalar)/16e6
// calldataGas*(l1Basefee*16*l1BasefeeScalar + l1BlobBasefee*l1BlobBasefeeScalar)/16e6

calldataCostPerByte := new(big.Int).Set(l1Basefee)
calldataCostPerByte = calldataCostPerByte.Mul(calldataCostPerByte, sixteen)
Expand Down

0 comments on commit c887e59

Please sign in to comment.