-
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.
feat(protocol): add
OptimisticTierProvider
for client testing (#15645)
- Loading branch information
1 parent
15f6995
commit 6569264
Showing
3 changed files
with
61 additions
and
1 deletion.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
packages/protocol/contracts/L1/tiers/OptimisticTierProvider.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,51 @@ | ||
// SPDX-License-Identifier: MIT | ||
// _____ _ _ _ _ | ||
// |_ _|_ _(_) |_____ | | __ _| |__ ___ | ||
// | |/ _` | | / / _ \ | |__/ _` | '_ (_-< | ||
// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ | ||
// | ||
// Email: security@taiko.xyz | ||
// Website: https://taiko.xyz | ||
// GitHub: https://github.com/taikoxyz | ||
// Discord: https://discord.gg/taikoxyz | ||
// Twitter: https://twitter.com/taikoxyz | ||
// Blog: https://mirror.xyz/labs.taiko.eth | ||
// Youtube: https://www.youtube.com/@taikoxyz | ||
|
||
pragma solidity 0.8.24; | ||
|
||
import "../../common/EssentialContract.sol"; | ||
import "./ITierProvider.sol"; | ||
|
||
contract OptimisticTierProvider is EssentialContract, ITierProvider { | ||
error TIER_NOT_FOUND(); | ||
|
||
/// @notice Initializes the contract with the provided address manager. | ||
function init() external initializer { | ||
__Essential_init(); | ||
} | ||
|
||
function getTier(uint16 tierId) public pure override returns (ITierProvider.Tier memory) { | ||
if (tierId == LibTiers.TIER_OPTIMISTIC) { | ||
return ITierProvider.Tier({ | ||
verifierName: "tier_optimistic", | ||
validityBond: 250 ether, // TKO | ||
contestBond: 500 ether, // TKO | ||
cooldownWindow: 24 hours, | ||
provingWindow: 2 hours, | ||
maxBlocksToVerifyPerProof: 10 | ||
}); | ||
} | ||
|
||
revert TIER_NOT_FOUND(); | ||
} | ||
|
||
function getTierIds() public pure override returns (uint16[] memory tiers) { | ||
tiers = new uint16[](1); | ||
tiers[0] = LibTiers.TIER_OPTIMISTIC; | ||
} | ||
|
||
function getMinTier(uint256 rand) public pure override returns (uint16) { | ||
return LibTiers.TIER_OPTIMISTIC; | ||
} | ||
} |
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