Skip to content

Commit

Permalink
feat(protocol): improve precision for slot-availability multipliers (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
dantaik committed Feb 8, 2023
1 parent 00366f2 commit 3ed5138
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 10 deletions.
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 @@ -124,12 +124,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

0 comments on commit 3ed5138

Please sign in to comment.