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): improve precision for slot-availability multipliers #13108

Merged
merged 4 commits into from
Feb 8, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/protocol/contracts/L1/TaikoData.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ library TaikoData {
uint256 maxBytesPerTxList;
uint256 minTxGasLimit;
uint256 anchorTxGasLimit;
uint256 feePremiumLamda;
uint256 slotSmoothingFactor;
uint256 rewardBurnBips;
uint256 proposerDepositPctg;
// Moving average factors
Expand Down
10 changes: 6 additions & 4 deletions packages/protocol/contracts/L1/libs/LibUtils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,14 @@ library LibUtils {
uint256 feeBase
) internal view returns (uint256) {
// m is the `n'` in the whitepaper
uint256 m = config.maxNumBlocks - 1 + config.feePremiumLamda;
uint256 m = 1000 *
(config.maxNumBlocks - 1) +
config.slotSmoothingFactor;
// n is the number of unverified blocks
uint256 n = state.nextBlockId - state.latestVerifiedId - 1;
uint256 n = 1000 * (state.nextBlockId - state.latestVerifiedId - 1);
// k is `m − n + 1` or `m − n - 1`in the whitepaper
uint256 k = isProposal ? m - n - 1 : m - n + 1;
return (feeBase * (m - 1) * m) / (m - n) / k;
uint256 k = isProposal ? m - n - 1000 : m - n + 1000;
return (feeBase * (m - 1000) * m) / (m - n) / k;
}

// Implement "Bootstrap Discount Multipliers", see the whitepaper.
Expand Down
2 changes: 1 addition & 1 deletion packages/protocol/contracts/libs/LibSharedConfig.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ library LibSharedConfig {
maxBytesPerTxList: 10240, // TODO
minTxGasLimit: 21000, // TODO
anchorTxGasLimit: 250000,
feePremiumLamda: 590,
slotSmoothingFactor: 590000,
rewardBurnBips: 100, // 100 basis points or 1%
proposerDepositPctg: 25, // 25%
// Moving average factors
Expand Down
2 changes: 1 addition & 1 deletion packages/protocol/contracts/test/L1/TestTaikoL1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ contract TestTaikoL1 is TaikoL1, IProofVerifier {
config.maxBytesPerTxList = 10240; // TODO
config.minTxGasLimit = 21000; // TODO
config.anchorTxGasLimit = 250000;
config.feePremiumLamda = 590;
config.slotSmoothingFactor = 590000;
config.rewardBurnBips = 100; // 100 basis points or 1%
config.proposerDepositPctg = 25; // 25%

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ contract TestTaikoL1EnableTokenomics is TaikoL1, IProofVerifier {
config.maxBytesPerTxList = 10240; // TODO
config.minTxGasLimit = 21000; // TODO
config.anchorTxGasLimit = 250000;
config.feePremiumLamda = 590;
config.slotSmoothingFactor = 590000;
config.rewardBurnBips = 100; // 100 basis points or 1%
config.proposerDepositPctg = 25; // 25%

Expand Down
2 changes: 1 addition & 1 deletion packages/protocol/contracts/test/L1/TestTaikoL2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ contract TestTaikoL2 is TaikoL2 {
config.maxBytesPerTxList = 10240; // TODO
config.minTxGasLimit = 21000; // TODO
config.anchorTxGasLimit = 250000;
config.feePremiumLamda = 590;
config.slotSmoothingFactor = 590000;
config.rewardBurnBips = 100; // 100 basis points or 1%
config.proposerDepositPctg = 25; // 25%

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ contract TestTaikoL2EnablePublicInputsCheck is TaikoL2 {
config.maxBytesPerTxList = 10240; // TODO
config.minTxGasLimit = 21000; // TODO
config.anchorTxGasLimit = 250000;
config.feePremiumLamda = 590;
config.slotSmoothingFactor = 590000;
config.rewardBurnBips = 100; // 100 basis points or 1%
config.proposerDepositPctg = 25; // 25%

Expand Down