-
Notifications
You must be signed in to change notification settings - Fork 114
feat: hourglass #515
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
Merged
Merged
feat: hourglass #515
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,26 @@ | ||
| # v1.5.0 Hourglass | ||
|
|
||
| The Hourglass release consists of a framework that supports the creation of task-based AVSs. The task-based AVSs are enabled through a `TaskMailbox` core contract deployed to all chains that support a `CertificateVerifier`. Additionally AVSs deploy their `TaskAVSRegistrar`. The release has 3 components: | ||
|
|
||
| 1. Core Contracts | ||
| 2. AVS Contracts | ||
| 3. Offchain Infrastructure | ||
|
|
||
| The below release notes cover AVS Contracts. For more information on the end to end protocol, see our [docs](https://github.com/Layr-Labs/hourglass-monorepo/blob/master/README.md). | ||
|
|
||
| ## Release Manager | ||
|
|
||
| @0xrajath | ||
|
|
||
| ## Highlights | ||
|
|
||
| This hourglass release only introduces new contracts. As a result, there are no breaking changes or deprecations. | ||
|
|
||
| 🚀 New Features | ||
|
|
||
| - `TaskAVSRegistrar`: An instanced (per-AVS) eigenlayer middleware contract on L1 that is responsible for handling operator registration for specific operator sets of your AVS and providing the offchain components with socket endpoints for the Aggregator and Executor operators. It also keeps track of which operator sets are the aggregator and executors. It works by default, but can be extended to include additional onchain logic for your AVS. | ||
|
|
||
| ## Changelog | ||
|
|
||
| - chore: bump up core deps | ||
| - feat: hourglass [PR #507](https://github.com/layr-labs/eigenlayer-middleware/pull/507) |
Submodule eigenlayer-contracts
updated
42 files
This file contains hidden or 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,91 @@ | ||
| // SPDX-License-Identifier: BUSL-1.1 | ||
| pragma solidity ^0.8.27; | ||
|
|
||
| import {OwnableUpgradeable} from "@openzeppelin-upgrades/contracts/access/OwnableUpgradeable.sol"; | ||
| import {Initializable} from "@openzeppelin-upgrades/contracts/proxy/utils/Initializable.sol"; | ||
| import {IAllocationManager} from | ||
| "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol"; | ||
| import {IKeyRegistrar} from "eigenlayer-contracts/src/contracts/interfaces/IKeyRegistrar.sol"; | ||
| import {AVSRegistrarWithSocket} from | ||
| "../../middlewareV2/registrar/presets/AVSRegistrarWithSocket.sol"; | ||
| import {ITaskAVSRegistrarBase} from "../../interfaces/ITaskAVSRegistrarBase.sol"; | ||
| import {TaskAVSRegistrarBaseStorage} from "./TaskAVSRegistrarBaseStorage.sol"; | ||
|
|
||
| /** | ||
| * @title TaskAVSRegistrarBase | ||
| * @author Layr Labs, Inc. | ||
| * @notice Abstract AVS Registrar for task-based AVSs | ||
| */ | ||
| abstract contract TaskAVSRegistrarBase is | ||
| Initializable, | ||
| OwnableUpgradeable, | ||
| AVSRegistrarWithSocket, | ||
| TaskAVSRegistrarBaseStorage | ||
| { | ||
| /** | ||
| * @dev Constructor that passes parameters to parent | ||
| * @param _avs The address of the AVS | ||
| * @param _allocationManager The AllocationManager contract address | ||
| * @param _keyRegistrar The KeyRegistrar contract address | ||
| */ | ||
| constructor( | ||
| address _avs, | ||
| IAllocationManager _allocationManager, | ||
| IKeyRegistrar _keyRegistrar | ||
| ) AVSRegistrarWithSocket(_avs, _allocationManager, _keyRegistrar) { | ||
| _disableInitializers(); | ||
| } | ||
|
|
||
| /** | ||
| * @dev Initializer for the upgradeable contract | ||
| * @param _owner The owner of the contract | ||
| * @param _initialConfig The initial AVS configuration | ||
| */ | ||
| function __TaskAVSRegistrarBase_init( | ||
| address _owner, | ||
| AvsConfig memory _initialConfig | ||
| ) internal onlyInitializing { | ||
| __Ownable_init(); | ||
| _transferOwnership(_owner); | ||
| _setAvsConfig(_initialConfig); | ||
| } | ||
|
|
||
| /// @inheritdoc ITaskAVSRegistrarBase | ||
| function setAvsConfig( | ||
| AvsConfig memory config | ||
| ) external onlyOwner { | ||
| _setAvsConfig(config); | ||
| } | ||
|
|
||
| /// @inheritdoc ITaskAVSRegistrarBase | ||
| function getAvsConfig() external view returns (AvsConfig memory) { | ||
| return avsConfig; | ||
| } | ||
|
|
||
| /** | ||
| * @notice Internal function to set the AVS configuration | ||
| * @param config The AVS configuration to set | ||
| * @dev The executorOperatorSetIds must be monotonically increasing. | ||
| */ | ||
| function _setAvsConfig( | ||
| AvsConfig memory config | ||
| ) internal { | ||
| // Require at least one executor operator set | ||
| require(config.executorOperatorSetIds.length > 0, ExecutorOperatorSetIdsEmpty()); | ||
|
|
||
| // Check monotonically increasing order and no aggregator overlap in one pass | ||
| for (uint256 i = 0; i < config.executorOperatorSetIds.length; i++) { | ||
| require( | ||
| config.aggregatorOperatorSetId != config.executorOperatorSetIds[i], | ||
| InvalidAggregatorOperatorSetId() | ||
| ); | ||
| require( | ||
| i == 0 || config.executorOperatorSetIds[i] > config.executorOperatorSetIds[i - 1], | ||
| DuplicateExecutorOperatorSetId() | ||
| ); | ||
| } | ||
|
|
||
| avsConfig = config; | ||
| emit AvsConfigSet(config.aggregatorOperatorSetId, config.executorOperatorSetIds); | ||
| } | ||
| } |
This file contains hidden or 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,22 @@ | ||
| // SPDX-License-Identifier: BUSL-1.1 | ||
| pragma solidity ^0.8.27; | ||
|
|
||
| import {ITaskAVSRegistrarBase} from "../../interfaces/ITaskAVSRegistrarBase.sol"; | ||
|
|
||
| /** | ||
| * @title TaskAVSRegistrarBaseStorage | ||
| * @author Layr Labs, Inc. | ||
| * @notice Storage contract for TaskAVSRegistrarBase | ||
| * @dev This contract holds the storage variables for TaskAVSRegistrarBase | ||
| */ | ||
| abstract contract TaskAVSRegistrarBaseStorage is ITaskAVSRegistrarBase { | ||
| /// @notice Configuration for this AVS | ||
| AvsConfig public avsConfig; | ||
|
|
||
| /** | ||
| * @dev This empty reserved space is put in place to allow future versions to add new | ||
| * variables without shifting down storage in the inheritance chain. | ||
| * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps | ||
| */ | ||
| uint256[48] private __gap; | ||
| } |
This file contains hidden or 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,78 @@ | ||
| // SPDX-License-Identifier: BUSL-1.1 | ||
| pragma solidity ^0.8.27; | ||
|
|
||
| import {IAVSRegistrar} from "eigenlayer-contracts/src/contracts/interfaces/IAVSRegistrar.sol"; | ||
| import {IAVSRegistrarInternal} from "./IAVSRegistrarInternal.sol"; | ||
| import {ISocketRegistry} from "./ISocketRegistryV2.sol"; | ||
|
|
||
| /** | ||
| * @title ITaskAVSRegistrarBaseTypes | ||
| * @notice Interface defining the type structures used in the TaskAVSRegistrarBase | ||
| */ | ||
| interface ITaskAVSRegistrarBaseTypes { | ||
| /** | ||
| * @notice Configuration for the Task-based AVS | ||
| * @param aggregatorOperatorSetId The operator set ID responsible for aggregating results | ||
| * @param executorOperatorSetIds Array of operator set IDs responsible for executing tasks | ||
| */ | ||
| struct AvsConfig { | ||
| uint32 aggregatorOperatorSetId; | ||
| uint32[] executorOperatorSetIds; | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * @title ITaskAVSRegistrarBaseErrors | ||
| * @notice Interface defining errors that can be thrown by the TaskAVSRegistrarBase | ||
| */ | ||
| interface ITaskAVSRegistrarBaseErrors { | ||
| /// @notice Thrown when an aggregator operator set id is also an executor operator set id | ||
| error InvalidAggregatorOperatorSetId(); | ||
|
|
||
| /// @notice Thrown when executor operator set ids are not in monotonically increasing order (duplicate or unsorted) | ||
| error DuplicateExecutorOperatorSetId(); | ||
|
|
||
| /// @notice Thrown when executor operator set ids are empty | ||
| error ExecutorOperatorSetIdsEmpty(); | ||
| } | ||
|
|
||
| /** | ||
| * @title ITaskAVSRegistrarBaseEvents | ||
| * @notice Interface defining events emitted by the TaskAVSRegistrarBase | ||
| */ | ||
| interface ITaskAVSRegistrarBaseEvents is ITaskAVSRegistrarBaseTypes { | ||
| /** | ||
| * @notice Emitted when the AVS configuration is set | ||
| * @param aggregatorOperatorSetId The operator set ID responsible for aggregating results | ||
| * @param executorOperatorSetIds Array of operator set IDs responsible for executing tasks | ||
| */ | ||
| event AvsConfigSet(uint32 aggregatorOperatorSetId, uint32[] executorOperatorSetIds); | ||
| } | ||
|
|
||
| /** | ||
| * @title ITaskAVSRegistrarBase | ||
| * @author Layr Labs, Inc. | ||
| * @notice Interface for TaskAVSRegistrarBase contract that manages AVS configuration | ||
| */ | ||
| interface ITaskAVSRegistrarBase is | ||
| ITaskAVSRegistrarBaseErrors, | ||
| ITaskAVSRegistrarBaseEvents, | ||
| IAVSRegistrar, | ||
| IAVSRegistrarInternal, | ||
| ISocketRegistry | ||
| { | ||
| /** | ||
| * @notice Sets the configuration for this AVS | ||
| * @param config Configuration for the AVS | ||
| * @dev The executorOperatorSetIds must be monotonically increasing. | ||
| */ | ||
| function setAvsConfig( | ||
| AvsConfig memory config | ||
| ) external; | ||
|
|
||
| /** | ||
| * @notice Gets the configuration for this AVS | ||
| * @return Configuration for the AVS | ||
| */ | ||
| function getAvsConfig() external view returns (AvsConfig memory); | ||
| } |
This file contains hidden or 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,31 @@ | ||
| // SPDX-License-Identifier: BUSL-1.1 | ||
| pragma solidity ^0.8.27; | ||
|
|
||
| import {IAllocationManager} from | ||
| "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol"; | ||
| import {IKeyRegistrar} from "eigenlayer-contracts/src/contracts/interfaces/IKeyRegistrar.sol"; | ||
|
|
||
| import {TaskAVSRegistrarBase} from "../../src/avs/task/TaskAVSRegistrarBase.sol"; | ||
|
|
||
| contract MockTaskAVSRegistrar is TaskAVSRegistrarBase { | ||
| /** | ||
| * @dev Constructor that passes parameters to parent TaskAVSRegistrarBase | ||
| * @param _avs The address of the AVS | ||
| * @param _allocationManager The AllocationManager contract address | ||
| * @param _keyRegistrar The KeyRegistrar contract address | ||
| */ | ||
| constructor( | ||
| address _avs, | ||
| IAllocationManager _allocationManager, | ||
| IKeyRegistrar _keyRegistrar | ||
| ) TaskAVSRegistrarBase(_avs, _allocationManager, _keyRegistrar) {} | ||
|
|
||
| /** | ||
| * @dev Initializer that calls parent initializer | ||
| * @param _owner The owner of the contract | ||
| * @param _initialConfig The initial AVS configuration | ||
| */ | ||
| function initialize(address _owner, AvsConfig memory _initialConfig) external initializer { | ||
| __TaskAVSRegistrarBase_init(_owner, _initialConfig); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.