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
2 changes: 1 addition & 1 deletion .github/workflows/storage-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: v1.3.5
version: nightly

- name: "Generate and prepare the storage reports for current branch"
run: |
Expand Down
20 changes: 20 additions & 0 deletions CHANGELOG/CHANGELOG-2.0.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# v2.0.0 UX Improvements

This release brings 2 UX improvements to the middleware repo. We increment the major release due to the new `createSlashableStakeQuorum` interface.

🚀 New Features

- NonSigner View Function for Bn254 Table Calculator: Constructs nonsigner witness onchain by passing in a list of signers

⛔ Breaking Changes
- Update `createSlashableStakeQuorum` to take in a slasher address

🔧 Improvements
- Update `foundry.toml` solc to 0.8.29

## Changelog


- feat: update registry coordinator for new createOperatorSets [PR #548](https://github.com/layr-labs/eigenlayer-middleware/pull/548)
- feat: nonsigner view and operator index [PR #545](https://github.com/Layr-Labs/eigenlayer-middleware/pull/542)
- chore: update readMe for middlewarev2 deployment [PR #539](https://github.com/layr-labs/eigenlayer-middleware/pull/539)
75 changes: 49 additions & 26 deletions docs/SlashingRegistryCoordinator.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,31 @@ struct OperatorSetParam {
#### `createTotalDelegatedStakeQuorum`

```solidity
/**
* @notice Creates a new quorum that tracks total delegated stake for operators.
* @param operatorSetParams Configures the quorum's max operator count and churn parameters.
* @param minimumStake Sets the minimum stake required for an operator to register or remain registered.
* @param strategyParams A list of strategies and multipliers used by the StakeRegistry to calculate
* an operator's stake weight for the quorum.
* @dev For m2 AVS this function has the same behavior as createQuorum before.
* @dev For migrated AVS that enable operator sets this will create a quorum that measures total delegated stake for operator set.
* @dev The slasher is set to DELEGATED_STAKE_SLASHER for total delegated stake quorums. This address cannot slash an operatorSet.
*/
function createTotalDelegatedStakeQuorum(
OperatorSetParam memory operatorSetParams,
uint96 minimumStake,
IStakeRegistryTypes.StrategyParams[] memory strategyParams
)
external
) external;
```

This function creates a new quorum that tracks the total delegated stake for operators. The quorum is initialized with the provided parameters and integrated with the underlying registry contracts.

Note that this function *does not* allow for stake to be slashed. To create a quorum with slashable delegated stake, see [`createSlashableStakeQuorum`](#createslashablestakequorum).

*Effects:*
* Increments the `quorumCount` by 1
* Sets the operator set parameters for the new quorum
* Creates an operator set in the `AllocationManager`
* Creates an operator set in the `AllocationManager` with a slasher address that is the the `DELEGATED_STAKE_SLASHER`
* Initializes the quorum in all registry contracts:
* `StakeRegistry`: Sets minimum stake and strategy parameters
* `IndexRegistry`: Prepares the quorum for tracking operator indices
Expand All @@ -93,19 +104,31 @@ This function creates a new quorum that tracks the total delegated stake for ope
#### `createSlashableStakeQuorum`

```solidity
/**
* @notice Creates a new quorum that tracks slashable stake for operators.
* @param operatorSetParams Configures the quorum's max operator count and churn parameters.
* @param minimumStake Sets the minimum stake required for an operator to register or remain registered.
* @param strategyParams A list of strategies and multipliers used by the StakeRegistry to calculate
* an operator's stake weight for the quorum.
* @param lookAheadPeriod The number of blocks to look ahead when calculating slashable stake.
* @param slasher The address of the slasher to use for the operatorSet (quorum) in EigenLayer core
* @dev Can only be called when operator sets are enabled.
*/
function createSlashableStakeQuorum(
OperatorSetParam memory operatorSetParams,
uint96 minimumStake,
IStakeRegistryTypes.StrategyParams[] memory strategyParams,
uint32 lookAheadPeriod
)
external
uint32 lookAheadPeriod,
address slasher
) external;
```

This function creates a new quorum that specifically tracks slashable stake for operators. This type of quorum provides slashing enforcement through the `AllocationManager`.

*Effects:*
* Same as `createTotalDelegatedStakeQuorum`, but initializes the quorum with slashable stake type
* Same as `createTotalDelegatedStakeQuorum`, but
- initializes the quorum with slashable stake type
- Sets the `slasher` to an address that is controlled by the AVS
* Additionally configures the `lookAheadPeriod` for slashable stake calculation

*Requirements:*
Expand All @@ -117,7 +140,7 @@ This function creates a new quorum that specifically tracks slashable stake for
function setOperatorSetParams(
uint8 quorumNumber,
OperatorSetParam memory operatorSetParams
)
)
external
```

Expand Down Expand Up @@ -151,7 +174,7 @@ function registerOperator(
address avs,
uint32[] calldata operatorSetIds,
bytes calldata data
)
)
external
onlyAllocationManager
onlyWhenNotPaused(PAUSED_REGISTER_OPERATOR)
Expand Down Expand Up @@ -184,7 +207,7 @@ function deregisterOperator(
address operator,
address avs,
uint32[] calldata operatorSetIds
)
)
external
onlyAllocationManager
onlyWhenNotPaused(PAUSED_REGISTER_OPERATOR)
Expand All @@ -210,7 +233,7 @@ This function is called by the `AllocationManager` when an operator wants to der
```solidity
function updateSocket(
string memory socket
)
)
external
```

Expand All @@ -229,7 +252,7 @@ This function allows a registered operator to update their socket information.
function ejectOperator(
address operator,
bytes memory quorumNumbers
)
)
external
onlyEjector
```
Expand Down Expand Up @@ -261,7 +284,7 @@ The `SlashingRegistryCoordinator` manages operator stakes through the `StakeRegi
function updateOperatorsForQuorum(
address[][] memory operatorsPerQuorum,
bytes calldata quorumNumbers
)
)
external
```

Expand Down Expand Up @@ -308,18 +331,18 @@ The contract implements two helper functions to calculate these thresholds:
function _individualKickThreshold(
uint96 operatorStake,
OperatorSetParam memory setParams
)
internal
pure
)
internal
pure
```

```solidity
function _totalKickThreshold(
uint96 totalStake,
OperatorSetParam memory setParams
)
internal
pure
)
internal
pure
```

#### Churn Approval
Expand All @@ -340,7 +363,7 @@ function calculateOperatorChurnApprovalDigestHash(
OperatorKickParam[] memory operatorKickParams,
bytes32 salt,
uint256 expiry
)
)
public
```

Expand All @@ -349,7 +372,7 @@ function calculateOperatorChurnApprovalDigestHash(
```solidity
function setChurnApprover(
address _churnApprover
)
)
external
```

Expand Down Expand Up @@ -377,11 +400,11 @@ The `SlashingRegistryCoordinator` integrates with `AllocationManager`, and is id
```solidity
function setAVS(
address _avs
)
)
external
```

This function sets the AVS address for the AVS (this identitiy is used for UAM integration). Note: updating this will break existing operator sets, this value should only be set once.
This function sets the AVS address for the AVS (this identitiy is used for UAM integration). Note: updating this will break existing operator sets, this value should only be set once.
This value should be the address of the `ServiceManager` contract.

*Effects:*
Expand All @@ -395,7 +418,7 @@ This value should be the address of the `ServiceManager` contract.
```solidity
function supportsAVS(
address _avs
)
)
public
```

Expand All @@ -420,7 +443,7 @@ These functions allow the contract owner to configure various parameters and rol
```solidity
function setEjector(
address _ejector
)
)
external
```

Expand All @@ -438,7 +461,7 @@ This function updates the address that is authorized to forcibly eject operators
```solidity
function setEjectionCooldown(
uint256 _ejectionCooldown
)
)
external
```

Expand Down
2 changes: 1 addition & 1 deletion foundry.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"lib/eigenlayer-contracts": {
"rev": "31aade2fc3bf6e2c0160cc2e7c7be1a6017296e5"
"rev": "1564be7b5ac19af78ef58cd3b153bd88ef9fcad4"
},
"lib/forge-std": {
"rev": "77041d2ce690e692d6e03cc812b57d1ddaa4d505"
Expand Down
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

]
# Specifies the exact version of Solidity to use, overriding auto-detection.
solc_version = '0.8.27'
solc_version = '0.8.29'
# If enabled, treats Solidity compiler warnings as errors, preventing artifact generation if warnings are present.
deny_warnings = false
# If set to true, changes compilation pipeline to go through the new IR optimizer.
Expand Down
2 changes: 1 addition & 1 deletion lib/eigenlayer-contracts
8 changes: 1 addition & 7 deletions src/RegistryCoordinator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -289,13 +289,7 @@ contract RegistryCoordinator is SlashingRegistryCoordinator, RegistryCoordinator
* @notice Returns the version of the contract
* @return The version string
*/
function version()
public
view
virtual
override(ISemVerMixin, SemVerMixin)
returns (string memory)
{
function version() public view virtual override(SemVerMixin) returns (string memory) {
return "v0.0.1";
}
}
22 changes: 14 additions & 8 deletions src/SlashingRegistryCoordinator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ contract SlashingRegistryCoordinator is
minimumStake,
strategyParams,
IStakeRegistryTypes.StakeType.TOTAL_DELEGATED,
0
0,
DELEGATED_STAKE_SLASHER
);
}

Expand All @@ -134,14 +135,16 @@ contract SlashingRegistryCoordinator is
OperatorSetParam memory operatorSetParams,
uint96 minimumStake,
IStakeRegistryTypes.StrategyParams[] memory strategyParams,
uint32 lookAheadPeriod
uint32 lookAheadPeriod,
address slasher
) external virtual onlyOwner {
_createQuorum(
operatorSetParams,
minimumStake,
strategyParams,
IStakeRegistryTypes.StakeType.TOTAL_SLASHABLE,
lookAheadPeriod
lookAheadPeriod,
slasher
);
}

Expand Down Expand Up @@ -780,13 +783,15 @@ contract SlashingRegistryCoordinator is
* registered
* @param strategyParams a list of strategies and multipliers used by the StakeRegistry to
* calculate an operator's stake weight for the quorum
* @param slasher the address of the slasher to use for the quorum (operatorSet)
*/
function _createQuorum(
OperatorSetParam memory operatorSetParams,
uint96 minimumStake,
IStakeRegistryTypes.StrategyParams[] memory strategyParams,
IStakeRegistryTypes.StakeType stakeType,
uint32 lookAheadPeriod
uint32 lookAheadPeriod,
address slasher
) internal {
// The previous quorum count is the new quorum's number,
// this is because quorum numbers begin from index 0.
Expand All @@ -803,8 +808,8 @@ contract SlashingRegistryCoordinator is
_setOperatorSetParams(quorumNumber, operatorSetParams);

// Create array of CreateSetParams for the new quorum
IAllocationManagerTypes.CreateSetParams[] memory createSetParams =
new IAllocationManagerTypes.CreateSetParams[](1);
IAllocationManagerTypes.CreateSetParamsV2[] memory createSetParams =
new IAllocationManagerTypes.CreateSetParamsV2[](1);

// Extract strategies from strategyParams
IStrategy[] memory strategies = new IStrategy[](strategyParams.length);
Expand All @@ -813,9 +818,10 @@ contract SlashingRegistryCoordinator is
}

// Initialize CreateSetParams with quorumNumber as operatorSetId
createSetParams[0] = IAllocationManagerTypes.CreateSetParams({
createSetParams[0] = IAllocationManagerTypes.CreateSetParamsV2({
operatorSetId: quorumNumber,
strategies: strategies
strategies: strategies,
slasher: slasher
});
allocationManager.createOperatorSets({avs: avs, params: createSetParams});

Expand Down
4 changes: 4 additions & 0 deletions src/SlashingRegistryCoordinatorStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ abstract contract SlashingRegistryCoordinatorStorage is ISlashingRegistryCoordin
/// @notice the Index Registry contract that will keep track of operators' indexes
IIndexRegistry public immutable indexRegistry;

/// @notice For delegated stake quorums, the address that is set to slash
/// @dev This address is set to the burn address as 0 addresses are not valid slasher addresses
address public constant DELEGATED_STAKE_SLASHER = 0x00000000000000000000000000000000000E16E4;

/// EigenLayer contracts
/// @notice the AllocationManager that tracks OperatorSets and Slashing in EigenLayer
IAllocationManager public immutable allocationManager;
Expand Down
Loading
Loading