forked from taikoxyz/taiko-mono
-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
c46e659
commit ae52e6e
Showing
18 changed files
with
544 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.24; | ||
|
||
import "../based/TaikoL1.sol"; | ||
|
||
/// @title SurgeTaikoL1 | ||
/// @dev Labeled in AddressResolver as "taiko" | ||
contract SurgeTaikoL1 is TaikoL1 { | ||
uint64 private immutable chainId; | ||
|
||
constructor(uint64 _chainId) { | ||
chainId = _chainId; | ||
} | ||
|
||
/// @inheritdoc ITaikoL1 | ||
function getConfig() public view override returns (TaikoData.Config memory) { | ||
return TaikoData.Config({ | ||
chainId: chainId, | ||
blockMaxProposals: 324_000, | ||
blockRingBufferSize: 360_000, | ||
maxBlocksToVerify: 16, | ||
blockMaxGasLimit: 240_000_000, | ||
livenessBond: 0.07 ether, | ||
stateRootSyncInternal: 16, | ||
maxAnchorHeightOffset: 64, | ||
baseFeeConfig: LibSharedData.BaseFeeConfig({ | ||
adjustmentQuotient: 8, | ||
sharingPctg: 75, | ||
gasIssuancePerSecond: 5_000_000, | ||
minGasExcess: 1_340_000_000, | ||
maxGasIssuancePerBlock: 600_000_000 | ||
}), | ||
ontakeForkHeight: 1 | ||
}); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
packages/protocol/contracts/layer1/surge/SurgeTierProviderBase.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,53 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.24; | ||
|
||
import "src/shared/common/LibStrings.sol"; | ||
import "../tiers/ITierProvider.sol"; | ||
import "../tiers/LibTiers.sol"; | ||
|
||
/// @title SurgeTierProviderBase | ||
/// @notice This contract is a version of Taiko's TierProviderBase modified for Nethermind's Surge | ||
/// @dev Modification include: | ||
/// - Removed guardian tiers | ||
/// - Only one proving tier i.e TWO_OF_THREE | ||
/// - No contestation for the proof | ||
abstract contract SurgeTierProviderBase is ITierProvider { | ||
uint96 public constant BOND_UNIT = 0.04 ether; | ||
|
||
/// @inheritdoc ITierProvider | ||
function getTier(uint16 _tierId) public pure virtual returns (ITierProvider.Tier memory) { | ||
if (_tierId == LibTiers.TIER_TWO_OF_THREE) { | ||
// No validity or contestation period | ||
return _buildTier(LibStrings.B_TIER_TWO_OF_THREE, 0, 0, 180); | ||
} | ||
|
||
revert TIER_NOT_FOUND(); | ||
} | ||
|
||
/// @dev Builds a generic tier with specified parameters. | ||
/// @param _verifierName The name of the verifier. | ||
/// @param _validityBondUnits The units of validity bonds. | ||
/// @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( | ||
bytes32 _verifierName, | ||
uint8 _validityBondUnits, | ||
uint16 _cooldownWindow, | ||
uint16 _provingWindow | ||
) | ||
private | ||
pure | ||
returns (ITierProvider.Tier memory) | ||
{ | ||
uint96 validityBond = BOND_UNIT * _validityBondUnits; | ||
return ITierProvider.Tier({ | ||
verifierName: _verifierName, | ||
validityBond: validityBond, | ||
contestBond: validityBond / 10_000 * 65_625, | ||
cooldownWindow: _cooldownWindow, | ||
provingWindow: _provingWindow, | ||
maxBlocksToVerifyPerProof: 0 | ||
}); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
packages/protocol/contracts/layer1/surge/SurgeTierRouter.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,24 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.24; | ||
|
||
import "./SurgeTierProviderBase.sol"; | ||
import "../tiers/ITierRouter.sol"; | ||
|
||
/// @title SurgeTierRouter | ||
contract SurgeTierRouter is SurgeTierProviderBase, ITierRouter { | ||
/// @inheritdoc ITierRouter | ||
function getProvider(uint256) external view returns (address) { | ||
return address(this); | ||
} | ||
|
||
/// @inheritdoc ITierProvider | ||
function getTierIds() external pure returns (uint16[] memory tiers_) { | ||
tiers_ = new uint16[](1); | ||
tiers_[0] = LibTiers.TIER_TWO_OF_THREE; | ||
} | ||
|
||
/// @inheritdoc ITierProvider | ||
function getMinTier(address, uint256) public pure override returns (uint16) { | ||
return LibTiers.TIER_TWO_OF_THREE; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ import "src/shared/common/LibStrings.sol"; | |
import "./ComposeVerifier.sol"; | ||
|
||
/// @title TwoOfThreeVerifier | ||
/// @custom:security-contact [email protected] | ||
/// @dev Surge: Allows using any two of the three verifier from SGX / RISC0 / SP1 | ||
contract TwoOfThreeVerifier is ComposeVerifier { | ||
uint256[50] private __gap; | ||
|
||
|
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
Oops, something went wrong.