Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(protocol): update HeklaTierProvider to introduce sp1 proof #18022

Merged
merged 3 commits into from
Sep 2, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions packages/protocol/contracts/hekla/HeklaTierProvider.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,37 @@
pragma solidity 0.8.24;

import "../L1/tiers/TierProviderBase.sol";
import "../L1/tiers/ITierRouter.sol";

/// @title HeklaTierProvider
/// @custom:security-contact [email protected]
contract HeklaTierProvider is TierProviderBase {
contract HeklaTierProvider is TierProviderBase, ITierRouter {
address public constant LAB_PROPOSER = 0xD3f681bD6B49887A48cC9C9953720903967E9DC0;

/// @inheritdoc ITierRouter
function getProvider(uint256) external view returns (address) {
return address(this);
}

/// @inheritdoc ITierProvider
function getTierIds() public pure override returns (uint16[] memory tiers_) {
tiers_ = new uint16[](5);
tiers_ = new uint16[](6);
tiers_[0] = LibTiers.TIER_OPTIMISTIC;
tiers_[1] = LibTiers.TIER_SGX;
tiers_[2] = LibTiers.TIER_ZKVM_RISC0;
tiers_[3] = LibTiers.TIER_GUARDIAN_MINORITY;
tiers_[4] = LibTiers.TIER_GUARDIAN;
tiers_[5] = LibTiers.TIER_ZKVM_SP1;
}

/// @inheritdoc ITierProvider
function getMinTier(address _proposer, uint256 _rand) public pure override returns (uint16) {
if (_proposer == LAB_PROPOSER && _rand % 1000 == 0) {
// 0.1% of the total blocks will require ZKVM proofs.
// 0.1% of the total blocks will require ZKVM Risc0 proofs.
return LibTiers.TIER_ZKVM_RISC0;
} else if (_proposer == LAB_PROPOSER && _rand % 1000 == 1) {
// 0.1% of the total blocks will require ZKVM Sp1 proofs.
return LibTiers.TIER_ZKVM_SP1;
} else if (_rand % 2 == 0) {
// 50% of the total blocks will require SGX proofs.
return LibTiers.TIER_SGX;
Expand Down