Skip to content

Commit

Permalink
feat(protocol): request zk proofs(risc0 & sp1) in mainnet
Browse files Browse the repository at this point in the history
  • Loading branch information
YoGhurt111 committed Nov 8, 2024
1 parent 591ee8e commit 76d6d25
Showing 1 changed file with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ import "src/layer1/tiers/TierProviderBase.sol";
/// @custom:security-contact security@taiko.xyz
contract MainnetTierRouter is ITierRouter, TierProviderBase {
address public immutable DAO_FALLBACK_PROPOSER;
uint8 public counter;

constructor(address _daoFallbackProposer) {
// 0x68d30f47F19c07bCCEf4Ac7FAE2Dc12FCa3e0dC9
DAO_FALLBACK_PROPOSER = _daoFallbackProposer;
counter = 0;
}

/// @inheritdoc ITierRouter
Expand All @@ -31,15 +33,20 @@ contract MainnetTierRouter is ITierRouter, TierProviderBase {
}

/// @inheritdoc ITierProvider
function getMinTier(
address, /*_proposer*/
uint256 /*_rand*/
)
public
pure
override
returns (uint16)
{
function getMinTier(address _proposer, uint256 _rand) public pure override returns (uint16) {
if (_proposer == DAO_FALLBACK_PROPOSER) {
if (counter == 0) {
counter ++;
return LibTiers.TIER_ZKVM_SP1;
} else if (counter == 1) {
counter ++;
return LibTiers.TIER_ZKVM_RISC0;
} else {
if (_rand % 1000 == 0) return LibTiers.TIER_ZKVM_RISC0;
else if (_rand % 1000 == 1) return LibTiers.TIER_ZKVM_SP1;
else return LibTiers.TIER_SGX;
}
}
return LibTiers.TIER_SGX;
}
}

0 comments on commit 76d6d25

Please sign in to comment.