-
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.
- Loading branch information
Showing
4 changed files
with
22 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,8 @@ import "../tiers/TierProviderBase.sol"; | |
import "../tiers/ITierRouter.sol"; | ||
|
||
/// @title HeklaTierRouter | ||
/// @dev Any changes to the configuration in this file must be announced and documented on our site. | ||
/// Ensure all modifications are reviewed by the devrel team. | ||
/// @custom:security-contact [email protected] | ||
contract HeklaTierRouter is TierProviderBase, ITierRouter { | ||
address public immutable DAO_FALLBACK_PROPOSER; | ||
|
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 |
---|---|---|
|
@@ -5,6 +5,8 @@ import "src/layer1/tiers/ITierRouter.sol"; | |
import "src/layer1/tiers/TierProviderBase.sol"; | ||
|
||
/// @title MainnetTierRouter | ||
/// @dev Any changes to the configuration in this file must be announced and documented on our site. | ||
/// Ensure all modifications are reviewed by the devrel team. | ||
/// @dev Labeled in AddressResolver as "tier_router" | ||
/// @custom:security-contact [email protected] | ||
contract MainnetTierRouter is ITierRouter, TierProviderBase { | ||
|
@@ -29,6 +31,7 @@ contract MainnetTierRouter is ITierRouter, TierProviderBase { | |
} | ||
|
||
/// @inheritdoc ITierProvider | ||
// solhint-disable-next-line no-unused-vars | ||
function getMinTier(address _proposer, uint256 _rand) public view override returns (uint16) { | ||
return LibTiers.TIER_SGX; | ||
} | ||
|
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 |
---|---|---|
|
@@ -6,6 +6,8 @@ import "./ITierProvider.sol"; | |
import "./LibTiers.sol"; | ||
|
||
/// @title TierProviderBase | ||
/// @dev Any changes to the configuration in this file must be announced and documented on our site. | ||
/// Ensure all modifications are reviewed by the devrel team. | ||
/// @custom:security-contact [email protected] | ||
abstract contract TierProviderBase is ITierProvider { | ||
/// @dev Grace period for block proving service. | ||
|
@@ -21,8 +23,8 @@ abstract contract TierProviderBase is ITierProvider { | |
/// previous tier. Additionally, each tier's contest bond is 6.5625 times its validity bond. | ||
function getTier(uint16 _tierId) public pure virtual returns (ITierProvider.Tier memory) { | ||
if (_tierId == LibTiers.TIER_OPTIMISTIC) { | ||
// cooldownWindow is 24 hours and provingWindow is 15 minutes | ||
return _buildTier("", BOND_UNIT, 24, 15); | ||
// cooldownWindow is 1440 minutes and provingWindow is 15 minutes | ||
return _buildTier("", BOND_UNIT, 1440, 15); | ||
} | ||
|
||
// TEE Tiers | ||
|
@@ -34,23 +36,20 @@ abstract contract TierProviderBase is ITierProvider { | |
if (_tierId == LibTiers.TIER_ZKVM_RISC0) return _buildZkTier(LibStrings.B_TIER_ZKVM_RISC0); | ||
if (_tierId == LibTiers.TIER_ZKVM_SP1) return _buildZkTier(LibStrings.B_TIER_ZKVM_SP1); | ||
if (_tierId == LibTiers.TIER_ZKVM_ANY) return _buildZkTier(LibStrings.B_TIER_ZKVM_ANY); | ||
|
||
// ZKVM+TEE Tier | ||
if (_tierId == LibTiers.TIER_ZKVM_AND_TEE) { | ||
// cooldownWindow is 2 hours and provingWindow is 3 hours | ||
return _buildTier(LibStrings.B_TIER_ZKVM_AND_TEE, BOND_UNIT * 4, 2, 180); | ||
return _buildZkTier(LibStrings.B_TIER_ZKVM_AND_TEE); | ||
} | ||
|
||
// Guardian Minority Tiers | ||
if (_tierId == LibTiers.TIER_GUARDIAN_MINORITY) { | ||
// cooldownWindow is 4 hours | ||
return _buildTier(LibStrings.B_TIER_GUARDIAN_MINORITY, BOND_UNIT * 4, 4, 0); | ||
// cooldownWindow is 240 minutes and provingWindow is 2880 minutes | ||
return _buildTier(LibStrings.B_TIER_GUARDIAN_MINORITY, BOND_UNIT * 3, 240, 0); | ||
} | ||
|
||
// Guardian Major Tiers | ||
if (_tierId == LibTiers.TIER_GUARDIAN) { | ||
// cooldownWindow is 4 hours | ||
return _buildTier(LibStrings.B_TIER_GUARDIAN, 0, 4, 0); | ||
// cooldownWindow is 1440 minutes and provingWindow is 2880 minutes | ||
return _buildTier(LibStrings.B_TIER_GUARDIAN, 0, 240, 0); | ||
} | ||
|
||
revert TIER_NOT_FOUND(); | ||
|
@@ -64,22 +63,22 @@ abstract contract TierProviderBase is ITierProvider { | |
pure | ||
returns (ITierProvider.Tier memory) | ||
{ | ||
// cooldownWindow is 4 hours and provingWindow is 60 minutes | ||
return _buildTier(_verifierName, BOND_UNIT * 2, 4, 60); | ||
// cooldownWindow is 1440 minutes and provingWindow is 60 minutes | ||
return _buildTier(_verifierName, BOND_UNIT * 2, 240, 60); | ||
} | ||
|
||
/// @dev Builds a ZK tier with a specific verifier name. | ||
/// @param _verifierName The name of the verifier. | ||
/// @return A Tier struct with predefined parameters for ZK. | ||
function _buildZkTier(bytes32 _verifierName) private pure returns (ITierProvider.Tier memory) { | ||
// cooldownWindow is 4 hours and provingWindow is 3 hours | ||
return _buildTier(_verifierName, BOND_UNIT * 3, 4, 180); | ||
// cooldownWindow is 1440 minutes and provingWindow is 180 minutes | ||
return _buildTier(_verifierName, BOND_UNIT * 3, 240, 180); | ||
} | ||
|
||
/// @dev Builds a generic tier with specified parameters. | ||
/// @param _verifierName The name of the verifier. | ||
/// @param _validityBond The validity bond amount. | ||
/// @param _cooldownWindow The cooldown window duration in hours. | ||
/// @param _cooldownWindow The cooldown window duration in minutes. | ||
/// @param _provingWindow The proving window duration in minutes. | ||
/// @return A Tier struct with the provided parameters. | ||
function _buildTier( | ||
|
@@ -96,7 +95,7 @@ abstract contract TierProviderBase is ITierProvider { | |
verifierName: _verifierName, | ||
validityBond: _validityBond, | ||
contestBond: _validityBond / 10_000 * 65_625, | ||
cooldownWindow: _cooldownWindow * 60, | ||
cooldownWindow: _cooldownWindow, | ||
provingWindow: GRACE_PERIOD + _provingWindow, | ||
maxBlocksToVerifyPerProof: 0 | ||
}); | ||
|