-
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.
refactor(protocol): refactor tier provider & address caching and add …
…ComposeVerifier (#17960) Co-authored-by: dantaik <dantaik@users.noreply.github.com> Co-authored-by: D <51912515+adaki2004@users.noreply.github.com>
- Loading branch information
1 parent
80176a1
commit ee464ca
Showing
47 changed files
with
1,097 additions
and
630 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,34 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.24; | ||
|
||
/// @title LibTiers | ||
/// @dev Tier ID cannot be zero! | ||
/// @custom:security-contact security@taiko.xyz | ||
library LibTiers { | ||
/// @notice Optimistic tier ID. | ||
uint16 public constant TIER_OPTIMISTIC = 100; | ||
|
||
/// @notice SGX proof | ||
uint16 public constant TIER_SGX = 200; | ||
|
||
/// @notice TDX proof | ||
uint16 public constant TIER_TDX = 200; | ||
|
||
/// @notice Any TEE proof | ||
uint16 public constant TIER_TEE_ANY = 200; | ||
|
||
/// @notice Risc0's ZKVM proof | ||
uint16 public constant TIER_ZKVM_RISC0 = 290; | ||
|
||
/// @notice SP1's ZKVM proof | ||
uint16 public constant TIER_ZKVM_SP1 = 290; | ||
|
||
/// @notice Any ZKVM proof | ||
uint16 public constant TIER_ZKVM_ANY = 290; | ||
|
||
/// @notice Guardian tier ID with minority approval. | ||
uint16 public constant TIER_GUARDIAN_MINORITY = 900; | ||
|
||
/// @notice Guardian tier ID with majority approval. | ||
uint16 public constant TIER_GUARDIAN = 1000; | ||
} |
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 was deleted.
Oops, something went wrong.
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
55 changes: 0 additions & 55 deletions
55
packages/protocol/contracts/mainnet/LibRollupAddressCache.sol
This file was deleted.
Oops, something went wrong.
43 changes: 43 additions & 0 deletions
43
packages/protocol/contracts/mainnet/addrcache/AddressCache.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,43 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.24; | ||
|
||
/// @title AddressCache | ||
/// @custom:security-contact security@taiko.xyz | ||
abstract contract AddressCache { | ||
/// @notice This function retrieves the address associated with a given chain ID and name. | ||
/// If the address is not found in the cache, it falls back to the provided function. | ||
/// @param _chainId The chain ID for which the address is to be retrieved. | ||
/// @param _name The name associated with the address to be retrieved. | ||
/// @param _fallbackFunc The fallback function to be used if the address is not found in the | ||
/// cache. | ||
/// @return The address associated with the given chain ID and name. | ||
function getAddress( | ||
uint64 _chainId, | ||
bytes32 _name, | ||
function (uint64, bytes32) view returns (address) _fallbackFunc | ||
) | ||
internal | ||
view | ||
returns (address) | ||
{ | ||
(bool found, address addr) = getCachedAddress(_chainId, _name); | ||
return found ? addr : _fallbackFunc(_chainId, _name); | ||
} | ||
|
||
/// @notice This function retrieves the cached address associated with a given chain ID and | ||
/// name. | ||
/// @dev This function is virtual and should be overridden in derived contracts. | ||
/// @param _chainId The chain ID for which the address is to be retrieved. | ||
/// @param _name The name associated with the address to be retrieved. | ||
/// @return found_ A boolean indicating whether the address was found in the cache. | ||
/// @return addr_ The address associated with the given chain ID and name, if found in the | ||
/// cache. | ||
function getCachedAddress( | ||
uint64 _chainId, | ||
bytes32 _name | ||
) | ||
internal | ||
pure | ||
virtual | ||
returns (bool found_, address addr_); | ||
} |
Oops, something went wrong.