-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(tests): cleanup tests to prepare for tokenomics testing (#11316)
- Loading branch information
1 parent
9837fa3
commit d63fae3
Showing
55 changed files
with
2,198 additions
and
1,447 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
packages/protocol/contracts/test/L1/TestTaikoL1EnableTokenomics.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// SPDX-License-Identifier: MIT | ||
// | ||
// ╭━━━━╮╱╱╭╮╱╱╱╱╱╭╮╱╱╱╱╱╭╮ | ||
// ┃╭╮╭╮┃╱╱┃┃╱╱╱╱╱┃┃╱╱╱╱╱┃┃ | ||
// ╰╯┃┃┣┻━┳┫┃╭┳━━╮┃┃╱╱╭━━┫╰━┳━━╮ | ||
// ╱╱┃┃┃╭╮┣┫╰╯┫╭╮┃┃┃╱╭┫╭╮┃╭╮┃━━┫ | ||
// ╱╱┃┃┃╭╮┃┃╭╮┫╰╯┃┃╰━╯┃╭╮┃╰╯┣━━┃ | ||
// ╱╱╰╯╰╯╰┻┻╯╰┻━━╯╰━━━┻╯╰┻━━┻━━╯ | ||
pragma solidity ^0.8.9; | ||
|
||
import {IProofVerifier} from "../../L1/ProofVerifier.sol"; | ||
import "../../L1/TaikoL1.sol"; | ||
|
||
contract TestTaikoL1EnableTokenomics is TaikoL1, IProofVerifier { | ||
function getConfig() | ||
public | ||
pure | ||
override | ||
returns (TaikoData.Config memory config) | ||
{ | ||
config.chainId = 167; | ||
// up to 2048 pending blocks | ||
config.maxNumBlocks = 2048; | ||
config.blockHashHistory = 3; | ||
// This number is calculated from maxNumBlocks to make | ||
// the 'the maximum value of the multiplier' close to 20.0 | ||
config.zkProofsPerBlock = 1; | ||
config.maxVerificationsPerTx = 2; | ||
config.commitConfirmations = 1; | ||
config.maxProofsPerForkChoice = 5; | ||
config.blockMaxGasLimit = 30000000; // TODO | ||
config.maxTransactionsPerBlock = 20; // TODO | ||
config.maxBytesPerTxList = 10240; // TODO | ||
config.minTxGasLimit = 21000; // TODO | ||
config.anchorTxGasLimit = 250000; | ||
config.feePremiumLamda = 590; | ||
config.rewardBurnBips = 100; // 100 basis points or 1% | ||
config.proposerDepositPctg = 25; // 25% | ||
|
||
// Moving average factors | ||
config.feeBaseMAF = 1024; | ||
config.blockTimeMAF = 64; | ||
config.proofTimeMAF = 64; | ||
|
||
config.rewardMultiplierPctg = 400; // 400% | ||
config.feeGracePeriodPctg = 125; // 125% | ||
config.feeMaxPeriodPctg = 375; // 375% | ||
config.blockTimeCap = 48 seconds; | ||
config.proofTimeCap = 5 seconds; | ||
config.bootstrapDiscountHalvingPeriod = 1 seconds; | ||
config.initialUncleDelay = 1 seconds; | ||
config.enableTokenomics = true; | ||
config.enablePublicInputsCheck = false; | ||
} | ||
|
||
function verifyZKP( | ||
bytes memory /*verificationKey*/, | ||
bytes calldata /*zkproof*/, | ||
bytes32 /*blockHash*/, | ||
address /*prover*/, | ||
bytes32 /*txListHash*/ | ||
) public pure override returns (bool) { | ||
return true; | ||
} | ||
|
||
function verifyMKP( | ||
bytes memory /*key*/, | ||
bytes memory /*value*/, | ||
bytes memory /*proof*/, | ||
bytes32 /*root*/ | ||
) public pure override returns (bool) { | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// SPDX-License-Identifier: MIT | ||
// | ||
// ╭━━━━╮╱╱╭╮╱╱╱╱╱╭╮╱╱╱╱╱╭╮ | ||
// ┃╭╮╭╮┃╱╱┃┃╱╱╱╱╱┃┃╱╱╱╱╱┃┃ | ||
// ╰╯┃┃┣┻━┳┫┃╭┳━━╮┃┃╱╱╭━━┫╰━┳━━╮ | ||
// ╱╱┃┃┃╭╮┣┫╰╯┫╭╮┃┃┃╱╭┫╭╮┃╭╮┃━━┫ | ||
// ╱╱┃┃┃╭╮┃┃╭╮┫╰╯┃┃╰━╯┃╭╮┃╰╯┣━━┃ | ||
// ╱╱╰╯╰╯╰┻┻╯╰┻━━╯╰━━━┻╯╰┻━━┻━━╯ | ||
pragma solidity ^0.8.9; | ||
|
||
import "../../L2/TaikoL2.sol"; | ||
|
||
contract TestTaikoL2 is TaikoL2 { | ||
constructor(address _addressManager) TaikoL2(_addressManager) {} | ||
|
||
function getConfig() | ||
public | ||
pure | ||
override | ||
returns (TaikoData.Config memory config) | ||
{ | ||
config.chainId = 167; | ||
// up to 2048 pending blocks | ||
config.maxNumBlocks = 4; | ||
config.blockHashHistory = 3; | ||
// This number is calculated from maxNumBlocks to make | ||
// the 'the maximum value of the multiplier' close to 20.0 | ||
config.zkProofsPerBlock = 1; | ||
config.maxVerificationsPerTx = 2; | ||
config.commitConfirmations = 1; | ||
config.maxProofsPerForkChoice = 5; | ||
config.blockMaxGasLimit = 30000000; // TODO | ||
config.maxTransactionsPerBlock = 20; // TODO | ||
config.maxBytesPerTxList = 10240; // TODO | ||
config.minTxGasLimit = 21000; // TODO | ||
config.anchorTxGasLimit = 250000; | ||
config.feePremiumLamda = 590; | ||
config.rewardBurnBips = 100; // 100 basis points or 1% | ||
config.proposerDepositPctg = 25; // 25% | ||
|
||
// Moving average factors | ||
config.feeBaseMAF = 1024; | ||
config.blockTimeMAF = 64; | ||
config.proofTimeMAF = 64; | ||
|
||
config.rewardMultiplierPctg = 400; // 400% | ||
config.feeGracePeriodPctg = 125; // 125% | ||
config.feeMaxPeriodPctg = 375; // 375% | ||
config.blockTimeCap = 48 seconds; | ||
config.proofTimeCap = 60 minutes; | ||
config.bootstrapDiscountHalvingPeriod = 180 days; | ||
config.initialUncleDelay = 1 minutes; | ||
config.enableTokenomics = true; | ||
config.enablePublicInputsCheck = false; | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
packages/protocol/contracts/test/L1/TestTaikoL2EnablePublicInputsCheck.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// SPDX-License-Identifier: MIT | ||
// | ||
// ╭━━━━╮╱╱╭╮╱╱╱╱╱╭╮╱╱╱╱╱╭╮ | ||
// ┃╭╮╭╮┃╱╱┃┃╱╱╱╱╱┃┃╱╱╱╱╱┃┃ | ||
// ╰╯┃┃┣┻━┳┫┃╭┳━━╮┃┃╱╱╭━━┫╰━┳━━╮ | ||
// ╱╱┃┃┃╭╮┣┫╰╯┫╭╮┃┃┃╱╭┫╭╮┃╭╮┃━━┫ | ||
// ╱╱┃┃┃╭╮┃┃╭╮┫╰╯┃┃╰━╯┃╭╮┃╰╯┣━━┃ | ||
// ╱╱╰╯╰╯╰┻┻╯╰┻━━╯╰━━━┻╯╰┻━━┻━━╯ | ||
pragma solidity ^0.8.9; | ||
|
||
import "../../L2/TaikoL2.sol"; | ||
|
||
contract TestTaikoL2EnablePublicInputsCheck is TaikoL2 { | ||
constructor(address _addressManager) TaikoL2(_addressManager) {} | ||
|
||
function getConfig() | ||
public | ||
pure | ||
override | ||
returns (TaikoData.Config memory config) | ||
{ | ||
config.chainId = 167; | ||
// up to 2048 pending blocks | ||
config.maxNumBlocks = 4; | ||
config.blockHashHistory = 3; | ||
// This number is calculated from maxNumBlocks to make | ||
// the 'the maximum value of the multiplier' close to 20.0 | ||
config.zkProofsPerBlock = 1; | ||
config.maxVerificationsPerTx = 2; | ||
config.commitConfirmations = 1; | ||
config.maxProofsPerForkChoice = 5; | ||
config.blockMaxGasLimit = 30000000; // TODO | ||
config.maxTransactionsPerBlock = 20; // TODO | ||
config.maxBytesPerTxList = 10240; // TODO | ||
config.minTxGasLimit = 21000; // TODO | ||
config.anchorTxGasLimit = 250000; | ||
config.feePremiumLamda = 590; | ||
config.rewardBurnBips = 100; // 100 basis points or 1% | ||
config.proposerDepositPctg = 25; // 25% | ||
|
||
// Moving average factors | ||
config.feeBaseMAF = 1024; | ||
config.blockTimeMAF = 64; | ||
config.proofTimeMAF = 64; | ||
|
||
config.rewardMultiplierPctg = 400; // 400% | ||
config.feeGracePeriodPctg = 125; // 125% | ||
config.feeMaxPeriodPctg = 375; // 375% | ||
config.blockTimeCap = 48 seconds; | ||
config.proofTimeCap = 60 minutes; | ||
config.bootstrapDiscountHalvingPeriod = 180 days; | ||
config.initialUncleDelay = 1 minutes; | ||
config.enableTokenomics = true; | ||
config.enablePublicInputsCheck = true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.9; | ||
import "../../L1/TkoToken.sol"; | ||
|
||
contract TestTkoToken is TkoToken { | ||
function mintAnyone(address account, uint256 amount) public { | ||
_mint(account, amount); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.