Skip to content

Commit 799e94d

Browse files
authored
feat: ux updates
# 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 - Move to foundry v1.5.0 and update formatting - Upgrade solc to 0.8.29 ## Changelog - feat: update registry coordinator for new createOperatorSets [PR #548](#548) - feat: nonsigner view and operator index [PR #545](#542) - chore: update readMe for middlewarev2 deployment [PR #539](#539)
2 parents 7314aef + 4d10bb4 commit 799e94d

31 files changed

+978
-208
lines changed

.github/workflows/storage-report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Install Foundry
2323
uses: foundry-rs/foundry-toolchain@v1
2424
with:
25-
version: v1.3.5
25+
version: nightly
2626

2727
- name: "Generate and prepare the storage reports for current branch"
2828
run: |

CHANGELOG/CHANGELOG-2.0.0.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# v2.0.0 UX Improvements
2+
3+
This release brings 2 UX improvements to the middleware repo. We increment the major release due to the new `createSlashableStakeQuorum` interface.
4+
5+
🚀 New Features
6+
7+
- NonSigner View Function for Bn254 Table Calculator: Constructs nonsigner witness onchain by passing in a list of signers
8+
9+
⛔ Breaking Changes
10+
- Update `createSlashableStakeQuorum` to take in a slasher address
11+
12+
🔧 Improvements
13+
- Update `foundry.toml` solc to 0.8.29
14+
15+
## Changelog
16+
17+
18+
- feat: update registry coordinator for new createOperatorSets [PR #548](https://github.com/layr-labs/eigenlayer-middleware/pull/548)
19+
- feat: nonsigner view and operator index [PR #545](https://github.com/Layr-Labs/eigenlayer-middleware/pull/542)
20+
- chore: update readMe for middlewarev2 deployment [PR #539](https://github.com/layr-labs/eigenlayer-middleware/pull/539)

docs/SlashingRegistryCoordinator.md

Lines changed: 49 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -66,20 +66,31 @@ struct OperatorSetParam {
6666
#### `createTotalDelegatedStakeQuorum`
6767

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

7786
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.
7887

88+
Note that this function *does not* allow for stake to be slashed. To create a quorum with slashable delegated stake, see [`createSlashableStakeQuorum`](#createslashablestakequorum).
89+
7990
*Effects:*
8091
* Increments the `quorumCount` by 1
8192
* Sets the operator set parameters for the new quorum
82-
* Creates an operator set in the `AllocationManager`
93+
* Creates an operator set in the `AllocationManager` with a slasher address that is the the `DELEGATED_STAKE_SLASHER`
8394
* Initializes the quorum in all registry contracts:
8495
* `StakeRegistry`: Sets minimum stake and strategy parameters
8596
* `IndexRegistry`: Prepares the quorum for tracking operator indices
@@ -93,19 +104,31 @@ This function creates a new quorum that tracks the total delegated stake for ope
93104
#### `createSlashableStakeQuorum`
94105

95106
```solidity
107+
/**
108+
* @notice Creates a new quorum that tracks slashable stake for operators.
109+
* @param operatorSetParams Configures the quorum's max operator count and churn parameters.
110+
* @param minimumStake Sets the minimum stake required for an operator to register or remain registered.
111+
* @param strategyParams A list of strategies and multipliers used by the StakeRegistry to calculate
112+
* an operator's stake weight for the quorum.
113+
* @param lookAheadPeriod The number of blocks to look ahead when calculating slashable stake.
114+
* @param slasher The address of the slasher to use for the operatorSet (quorum) in EigenLayer core
115+
* @dev Can only be called when operator sets are enabled.
116+
*/
96117
function createSlashableStakeQuorum(
97118
OperatorSetParam memory operatorSetParams,
98119
uint96 minimumStake,
99120
IStakeRegistryTypes.StrategyParams[] memory strategyParams,
100-
uint32 lookAheadPeriod
101-
)
102-
external
121+
uint32 lookAheadPeriod,
122+
address slasher
123+
) external;
103124
```
104125

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

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

111134
*Requirements:*
@@ -117,7 +140,7 @@ This function creates a new quorum that specifically tracks slashable stake for
117140
function setOperatorSetParams(
118141
uint8 quorumNumber,
119142
OperatorSetParam memory operatorSetParams
120-
)
143+
)
121144
external
122145
```
123146

@@ -151,7 +174,7 @@ function registerOperator(
151174
address avs,
152175
uint32[] calldata operatorSetIds,
153176
bytes calldata data
154-
)
177+
)
155178
external
156179
onlyAllocationManager
157180
onlyWhenNotPaused(PAUSED_REGISTER_OPERATOR)
@@ -184,7 +207,7 @@ function deregisterOperator(
184207
address operator,
185208
address avs,
186209
uint32[] calldata operatorSetIds
187-
)
210+
)
188211
external
189212
onlyAllocationManager
190213
onlyWhenNotPaused(PAUSED_REGISTER_OPERATOR)
@@ -210,7 +233,7 @@ This function is called by the `AllocationManager` when an operator wants to der
210233
```solidity
211234
function updateSocket(
212235
string memory socket
213-
)
236+
)
214237
external
215238
```
216239

@@ -229,7 +252,7 @@ This function allows a registered operator to update their socket information.
229252
function ejectOperator(
230253
address operator,
231254
bytes memory quorumNumbers
232-
)
255+
)
233256
external
234257
onlyEjector
235258
```
@@ -261,7 +284,7 @@ The `SlashingRegistryCoordinator` manages operator stakes through the `StakeRegi
261284
function updateOperatorsForQuorum(
262285
address[][] memory operatorsPerQuorum,
263286
bytes calldata quorumNumbers
264-
)
287+
)
265288
external
266289
```
267290

@@ -308,18 +331,18 @@ The contract implements two helper functions to calculate these thresholds:
308331
function _individualKickThreshold(
309332
uint96 operatorStake,
310333
OperatorSetParam memory setParams
311-
)
312-
internal
313-
pure
334+
)
335+
internal
336+
pure
314337
```
315338

316339
```solidity
317340
function _totalKickThreshold(
318341
uint96 totalStake,
319342
OperatorSetParam memory setParams
320-
)
321-
internal
322-
pure
343+
)
344+
internal
345+
pure
323346
```
324347

325348
#### Churn Approval
@@ -340,7 +363,7 @@ function calculateOperatorChurnApprovalDigestHash(
340363
OperatorKickParam[] memory operatorKickParams,
341364
bytes32 salt,
342365
uint256 expiry
343-
)
366+
)
344367
public
345368
```
346369

@@ -349,7 +372,7 @@ function calculateOperatorChurnApprovalDigestHash(
349372
```solidity
350373
function setChurnApprover(
351374
address _churnApprover
352-
)
375+
)
353376
external
354377
```
355378

@@ -377,11 +400,11 @@ The `SlashingRegistryCoordinator` integrates with `AllocationManager`, and is id
377400
```solidity
378401
function setAVS(
379402
address _avs
380-
)
403+
)
381404
external
382405
```
383406

384-
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.
407+
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.
385408
This value should be the address of the `ServiceManager` contract.
386409

387410
*Effects:*
@@ -395,7 +418,7 @@ This value should be the address of the `ServiceManager` contract.
395418
```solidity
396419
function supportsAVS(
397420
address _avs
398-
)
421+
)
399422
public
400423
```
401424

@@ -420,7 +443,7 @@ These functions allow the contract owner to configure various parameters and rol
420443
```solidity
421444
function setEjector(
422445
address _ejector
423-
)
446+
)
424447
external
425448
```
426449

@@ -438,7 +461,7 @@ This function updates the address that is authorized to forcibly eject operators
438461
```solidity
439462
function setEjectionCooldown(
440463
uint256 _ejectionCooldown
441-
)
464+
)
442465
external
443466
```
444467

foundry.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"lib/eigenlayer-contracts": {
3-
"rev": "31aade2fc3bf6e2c0160cc2e7c7be1a6017296e5"
3+
"rev": "1564be7b5ac19af78ef58cd3b153bd88ef9fcad4"
44
},
55
"lib/forge-std": {
66
"rev": "77041d2ce690e692d6e03cc812b57d1ddaa4d505"

foundry.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
]
2626
# Specifies the exact version of Solidity to use, overriding auto-detection.
27-
solc_version = '0.8.27'
27+
solc_version = '0.8.29'
2828
# If enabled, treats Solidity compiler warnings as errors, preventing artifact generation if warnings are present.
2929
deny_warnings = false
3030
# If set to true, changes compilation pipeline to go through the new IR optimizer.

lib/eigenlayer-contracts

src/RegistryCoordinator.sol

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -289,13 +289,7 @@ contract RegistryCoordinator is SlashingRegistryCoordinator, RegistryCoordinator
289289
* @notice Returns the version of the contract
290290
* @return The version string
291291
*/
292-
function version()
293-
public
294-
view
295-
virtual
296-
override(ISemVerMixin, SemVerMixin)
297-
returns (string memory)
298-
{
292+
function version() public view virtual override(SemVerMixin) returns (string memory) {
299293
return "v0.0.1";
300294
}
301295
}

src/SlashingRegistryCoordinator.sol

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ contract SlashingRegistryCoordinator is
125125
minimumStake,
126126
strategyParams,
127127
IStakeRegistryTypes.StakeType.TOTAL_DELEGATED,
128-
0
128+
0,
129+
DELEGATED_STAKE_SLASHER
129130
);
130131
}
131132

@@ -134,14 +135,16 @@ contract SlashingRegistryCoordinator is
134135
OperatorSetParam memory operatorSetParams,
135136
uint96 minimumStake,
136137
IStakeRegistryTypes.StrategyParams[] memory strategyParams,
137-
uint32 lookAheadPeriod
138+
uint32 lookAheadPeriod,
139+
address slasher
138140
) external virtual onlyOwner {
139141
_createQuorum(
140142
operatorSetParams,
141143
minimumStake,
142144
strategyParams,
143145
IStakeRegistryTypes.StakeType.TOTAL_SLASHABLE,
144-
lookAheadPeriod
146+
lookAheadPeriod,
147+
slasher
145148
);
146149
}
147150

@@ -780,13 +783,15 @@ contract SlashingRegistryCoordinator is
780783
* registered
781784
* @param strategyParams a list of strategies and multipliers used by the StakeRegistry to
782785
* calculate an operator's stake weight for the quorum
786+
* @param slasher the address of the slasher to use for the quorum (operatorSet)
783787
*/
784788
function _createQuorum(
785789
OperatorSetParam memory operatorSetParams,
786790
uint96 minimumStake,
787791
IStakeRegistryTypes.StrategyParams[] memory strategyParams,
788792
IStakeRegistryTypes.StakeType stakeType,
789-
uint32 lookAheadPeriod
793+
uint32 lookAheadPeriod,
794+
address slasher
790795
) internal {
791796
// The previous quorum count is the new quorum's number,
792797
// this is because quorum numbers begin from index 0.
@@ -803,8 +808,8 @@ contract SlashingRegistryCoordinator is
803808
_setOperatorSetParams(quorumNumber, operatorSetParams);
804809

805810
// Create array of CreateSetParams for the new quorum
806-
IAllocationManagerTypes.CreateSetParams[] memory createSetParams =
807-
new IAllocationManagerTypes.CreateSetParams[](1);
811+
IAllocationManagerTypes.CreateSetParamsV2[] memory createSetParams =
812+
new IAllocationManagerTypes.CreateSetParamsV2[](1);
808813

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

815820
// Initialize CreateSetParams with quorumNumber as operatorSetId
816-
createSetParams[0] = IAllocationManagerTypes.CreateSetParams({
821+
createSetParams[0] = IAllocationManagerTypes.CreateSetParamsV2({
817822
operatorSetId: quorumNumber,
818-
strategies: strategies
823+
strategies: strategies,
824+
slasher: slasher
819825
});
820826
allocationManager.createOperatorSets({avs: avs, params: createSetParams});
821827

src/SlashingRegistryCoordinatorStorage.sol

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ abstract contract SlashingRegistryCoordinatorStorage is ISlashingRegistryCoordin
4545
/// @notice the Index Registry contract that will keep track of operators' indexes
4646
IIndexRegistry public immutable indexRegistry;
4747

48+
/// @notice For delegated stake quorums, the address that is set to slash
49+
/// @dev This address is set to the burn address as 0 addresses are not valid slasher addresses
50+
address public constant DELEGATED_STAKE_SLASHER = 0x00000000000000000000000000000000000E16E4;
51+
4852
/// EigenLayer contracts
4953
/// @notice the AllocationManager that tracks OperatorSets and Slashing in EigenLayer
5054
IAllocationManager public immutable allocationManager;

0 commit comments

Comments
 (0)