Skip to content

Commit

Permalink
feat(protocol): change min base fee to 0.01 gwei (#16914)
Browse files Browse the repository at this point in the history
  • Loading branch information
dantaik committed Apr 29, 2024
1 parent b8c6674 commit 8028614
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/protocol/contracts/L2/LibL2Config.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ library LibL2Config {
config_.gasTargetPerL1Block = 60_000_000;
config_.basefeeAdjustmentQuotient = 8;

// This value is picked to make the min base fee close to but slightly smaller than 0.1gwei
config_.gasExcessMinValue = 18_435_000_000;
// This value is picked to make the min base fee be 0.01gwei
config_.gasExcessMinValue = 17_331_548_325;
}
}
18 changes: 13 additions & 5 deletions packages/protocol/test/L2/Lib1559Math.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,24 @@ contract TestLib1559Math is TaikoTest {
uint256 i;

baseFee = Lib1559Math.basefee(config.gasExcessMinValue, adjustmentFactor);
assertEq(baseFee, 99_627_953); // slightly smaller than 0.1gwei
console2.log("gasExcessMinValue:", config.gasExcessMinValue);
console2.log("min base fee:", baseFee);
assertEq(baseFee, 0.01 gwei); // 0.01gwei
console2.log("gasExcessMinValue:", config.gasExcessMinValue, "min base fee:", baseFee);

for (; baseFee < 0.1 gwei; ++i) {
baseFee = Lib1559Math.basefee(config.gasTargetPerL1Block * i, adjustmentFactor);
console2.log("base fee:", i, baseFee);
}

// base fee will reach 1 gwei if gasExcess > 18540000000
console2.log("base fee will reach 0.1 gwei if gasExcess >", config.gasTargetPerL1Block * i);
assertEq(i, 309);

for (; baseFee < 1 gwei; ++i) {
baseFee = Lib1559Math.basefee(config.gasTargetPerL1Block * i, adjustmentFactor);
console2.log("base fee:", i, baseFee);
}

// base fee will reach 1 gwei if gasExcess > 19620000000
// base fee will reach 10 gwei if gasExcess > 19620000000
console2.log("base fee will reach 1 gwei if gasExcess >", config.gasTargetPerL1Block * i);
assertEq(i, 327);

Expand All @@ -33,7 +41,7 @@ contract TestLib1559Math is TaikoTest {
}

// base fee will reach 10 gwei if gasExcess > 20760000000
console2.log("base fee will reach 10 gwei if gasExcess >", config.gasTargetPerL1Block * i);
console2.log("base fee will reach 1 gwei if gasExcess >", config.gasTargetPerL1Block * i);
assertEq(i, 346);
}
}

0 comments on commit 8028614

Please sign in to comment.