Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
26 changes: 26 additions & 0 deletions CHANGELOG/CHANGELOG-1.5.0.md
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)
2 changes: 1 addition & 1 deletion lib/eigenlayer-contracts
Submodule eigenlayer-contracts updated 45 files
+14 −6 .github/workflows/certora-prover.yml
+32 −4 .github/workflows/checks.yml
+13 −3 .github/workflows/foundry-post-merge.yml
+52 −12 .github/workflows/foundry.yml
+7 −8 .github/workflows/validate-deployment-scripts.yml
+33 −0 CHANGELOG/CHANGELOG-1.8.0.md
+92 −29 README.md
+503 −0 docs/avs/task/TaskMailbox.md
+1 −1 docs/multichain/source/CrossChainRegistry.md
+64 −2 pkg/bindings/BN254CertificateVerifier/binding.go
+63 −1 pkg/bindings/BN254CertificateVerifierStorage/binding.go
+1 −1 pkg/bindings/CrossChainRegistry/binding.go
+10 −10 pkg/bindings/ECDSACertificateVerifier/binding.go
+21 −21 pkg/bindings/ECDSACertificateVerifierStorage/binding.go
+325 −0 pkg/bindings/IAVSTaskHook/binding.go
+63 −1 pkg/bindings/IBN254CertificateVerifier/binding.go
+63 −1 pkg/bindings/IBaseCertificateVerifier/binding.go
+21 −21 pkg/bindings/IECDSACertificateVerifier/binding.go
+1 −32 pkg/bindings/IKeyRegistrar/binding.go
+1,870 −0 pkg/bindings/ITaskMailbox/binding.go
+2 −33 pkg/bindings/KeyRegistrar/binding.go
+1 −32 pkg/bindings/KeyRegistrarStorage/binding.go
+1 −1 pkg/bindings/OperatorTableUpdater/binding.go
+2,283 −0 pkg/bindings/TaskMailbox/binding.go
+1,870 −0 pkg/bindings/TaskMailboxStorage/binding.go
+15 −0 script/releases/Env.sol
+104 −0 script/releases/v1.8.0-hourglass/1-deployDestinationChainProxies.s.sol
+102 −0 script/releases/v1.8.0-hourglass/2-deployDestinationChainImpls.s.sol
+146 −0 script/releases/v1.8.0-hourglass/3-instantiateDestinationChainProxies.s.sol
+19 −0 script/releases/v1.8.0-hourglass/upgrade.json
+573 −0 src/contracts/avs/task/TaskMailbox.sol
+56 −0 src/contracts/avs/task/TaskMailboxStorage.sol
+4 −7 src/contracts/core/ReleaseManager.sol
+1 −1 src/contracts/core/ReleaseManagerStorage.sol
+62 −0 src/contracts/interfaces/IAVSTaskHook.sol
+3 −0 src/contracts/interfaces/IReleaseManager.sol
+447 −0 src/contracts/interfaces/ITaskMailbox.sol
+113 −0 src/test/mocks/AVSTaskHookReentrantAttacker.sol
+37 −0 src/test/mocks/MockAVSTaskHook.sol
+126 −0 src/test/mocks/MockBN254CertificateVerifier.sol
+131 −0 src/test/mocks/MockBN254CertificateVerifierFailure.sol
+121 −0 src/test/mocks/MockECDSACertificateVerifier.sol
+121 −0 src/test/mocks/MockECDSACertificateVerifierFailure.sol
+17 −0 src/test/mocks/MockSimpleERC20.sol
+3,041 −0 src/test/unit/TaskMailboxUnit.t.sol
91 changes: 91 additions & 0 deletions src/avs/task/TaskAVSRegistrarBase.sol
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);
}
}
22 changes: 22 additions & 0 deletions src/avs/task/TaskAVSRegistrarBaseStorage.sol
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;
}
78 changes: 78 additions & 0 deletions src/interfaces/ITaskAVSRegistrarBase.sol
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);
}
31 changes: 31 additions & 0 deletions test/mocks/MockTaskAVSRegistrar.sol
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);
}
}
Loading
Loading