Skip to content

Commit

Permalink
chore: constants for magic numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
LHerskind committed Nov 20, 2024
1 parent 86f9aa1 commit 0608944
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions l1-contracts/test/fees/MinimalFeeModel.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ contract MinimalFeeModel is TimeFns {
// with the block.blobbasefee value if using cheatcodes to alter it.
Vm internal constant VM = Vm(address(uint160(uint256(keccak256("hevm cheat code")))));

uint256 internal constant BLOB_GAS_PER_BLOB = 2 ** 17;
uint256 internal constant GAS_PER_BLOB_POINT_EVALUATION = 50_000;

Slot public constant LIFETIME = Slot.wrap(5);
Slot public constant LAG = Slot.wrap(2);
Timestamp public immutable GENESIS_TIMESTAMP;
Expand Down Expand Up @@ -57,11 +60,12 @@ contract MinimalFeeModel is TimeFns {
returns (ManaBaseFeeComponents memory)
{
L1Fees memory fees = getCurrentL1Fees();
uint256 dataCost =
Math.mulDiv(_blobsUsed * 2 ** 17, fees.blob_fee, FeeMath.MANA_TARGET, Math.Rounding.Ceil);
uint256 casUsed = FeeMath.L1_GAS_PER_BLOCK_PROPOSED + _blobsUsed * 50_000
uint256 dataCost = Math.mulDiv(
_blobsUsed * BLOB_GAS_PER_BLOB, fees.blob_fee, FeeMath.MANA_TARGET, Math.Rounding.Ceil
);
uint256 gasUsed = FeeMath.L1_GAS_PER_BLOCK_PROPOSED + _blobsUsed * GAS_PER_BLOB_POINT_EVALUATION
+ FeeMath.L1_GAS_PER_EPOCH_VERIFIED / EPOCH_DURATION;
uint256 gasCost = Math.mulDiv(casUsed, fees.base_fee, FeeMath.MANA_TARGET, Math.Rounding.Ceil);
uint256 gasCost = Math.mulDiv(gasUsed, fees.base_fee, FeeMath.MANA_TARGET, Math.Rounding.Ceil);
uint256 provingCost = getProvingCost();

uint256 congestionMultiplier = FeeMath.congestionMultiplier(calcExcessMana());
Expand Down

0 comments on commit 0608944

Please sign in to comment.