Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(protocol): change min base fee to 0.01 gwei #16914

Merged
merged 3 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// base fee will reach 1 gwei if gasExcess > 18540000000
// base fee will reach 0.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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// base fee will reach 10 gwei if gasExcess > 19620000000
// base fee will reach 1 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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
console2.log("base fee will reach 1 gwei if gasExcess >", config.gasTargetPerL1Block * i);
console2.log("base fee will reach 10 gwei if gasExcess >", config.gasTargetPerL1Block * i);

assertEq(i, 346);
}
}