Skip to content

Commit 3b8d801

Browse files
authored
refactor: slashing UAM (#357)
* refactor: uam * feat: add uam interfaces * fix: lookahead period to blocks * fix: tests * chore: storage report
1 parent 2246b7d commit 3b8d801

28 files changed

+331
-275
lines changed

docs/storage-report/InstantSlasher.md

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11

2-
╭----------------+-------------+------+--------+-------+------------------------------------------------╮
3-
| Name | Type | Slot | Offset | Bytes | Contract |
4-
+=======================================================================================================+
5-
| _initialized | uint8 | 0 | 0 | 1 | src/slashers/InstantSlasher.sol:InstantSlasher |
6-
|----------------+-------------+------+--------+-------+------------------------------------------------|
7-
| _initializing | bool | 0 | 1 | 1 | src/slashers/InstantSlasher.sol:InstantSlasher |
8-
|----------------+-------------+------+--------+-------+------------------------------------------------|
9-
| serviceManager | address | 0 | 2 | 20 | src/slashers/InstantSlasher.sol:InstantSlasher |
10-
|----------------+-------------+------+--------+-------+------------------------------------------------|
11-
| slasher | address | 1 | 0 | 20 | src/slashers/InstantSlasher.sol:InstantSlasher |
12-
|----------------+-------------+------+--------+-------+------------------------------------------------|
13-
| nextRequestId | uint256 | 2 | 0 | 32 | src/slashers/InstantSlasher.sol:InstantSlasher |
14-
|----------------+-------------+------+--------+-------+------------------------------------------------|
15-
| __gap | uint256[47] | 3 | 0 | 1504 | src/slashers/InstantSlasher.sol:InstantSlasher |
16-
╰----------------+-------------+------+--------+-------+------------------------------------------------╯
2+
╭---------------+-------------+------+--------+-------+------------------------------------------------╮
3+
| Name | Type | Slot | Offset | Bytes | Contract |
4+
+======================================================================================================+
5+
| _initialized | uint8 | 0 | 0 | 1 | src/slashers/InstantSlasher.sol:InstantSlasher |
6+
|---------------+-------------+------+--------+-------+------------------------------------------------|
7+
| _initializing | bool | 0 | 1 | 1 | src/slashers/InstantSlasher.sol:InstantSlasher |
8+
|---------------+-------------+------+--------+-------+------------------------------------------------|
9+
| slasher | address | 0 | 2 | 20 | src/slashers/InstantSlasher.sol:InstantSlasher |
10+
|---------------+-------------+------+--------+-------+------------------------------------------------|
11+
| nextRequestId | uint256 | 1 | 0 | 32 | src/slashers/InstantSlasher.sol:InstantSlasher |
12+
|---------------+-------------+------+--------+-------+------------------------------------------------|
13+
| __gap | uint256[48] | 2 | 0 | 1536 | src/slashers/InstantSlasher.sol:InstantSlasher |
14+
╰---------------+-------------+------+--------+-------+------------------------------------------------╯
1715

docs/storage-report/SlasherBase.md

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11

2-
╭----------------+-------------+------+--------+-------+-----------------------------------------------╮
3-
| Name | Type | Slot | Offset | Bytes | Contract |
4-
+======================================================================================================+
5-
| _initialized | uint8 | 0 | 0 | 1 | src/slashers/base/SlasherBase.sol:SlasherBase |
6-
|----------------+-------------+------+--------+-------+-----------------------------------------------|
7-
| _initializing | bool | 0 | 1 | 1 | src/slashers/base/SlasherBase.sol:SlasherBase |
8-
|----------------+-------------+------+--------+-------+-----------------------------------------------|
9-
| serviceManager | address | 0 | 2 | 20 | src/slashers/base/SlasherBase.sol:SlasherBase |
10-
|----------------+-------------+------+--------+-------+-----------------------------------------------|
11-
| slasher | address | 1 | 0 | 20 | src/slashers/base/SlasherBase.sol:SlasherBase |
12-
|----------------+-------------+------+--------+-------+-----------------------------------------------|
13-
| nextRequestId | uint256 | 2 | 0 | 32 | src/slashers/base/SlasherBase.sol:SlasherBase |
14-
|----------------+-------------+------+--------+-------+-----------------------------------------------|
15-
| __gap | uint256[47] | 3 | 0 | 1504 | src/slashers/base/SlasherBase.sol:SlasherBase |
16-
╰----------------+-------------+------+--------+-------+-----------------------------------------------╯
2+
╭---------------+-------------+------+--------+-------+-----------------------------------------------╮
3+
| Name | Type | Slot | Offset | Bytes | Contract |
4+
+=====================================================================================================+
5+
| _initialized | uint8 | 0 | 0 | 1 | src/slashers/base/SlasherBase.sol:SlasherBase |
6+
|---------------+-------------+------+--------+-------+-----------------------------------------------|
7+
| _initializing | bool | 0 | 1 | 1 | src/slashers/base/SlasherBase.sol:SlasherBase |
8+
|---------------+-------------+------+--------+-------+-----------------------------------------------|
9+
| slasher | address | 0 | 2 | 20 | src/slashers/base/SlasherBase.sol:SlasherBase |
10+
|---------------+-------------+------+--------+-------+-----------------------------------------------|
11+
| nextRequestId | uint256 | 1 | 0 | 32 | src/slashers/base/SlasherBase.sol:SlasherBase |
12+
|---------------+-------------+------+--------+-------+-----------------------------------------------|
13+
| __gap | uint256[48] | 2 | 0 | 1536 | src/slashers/base/SlasherBase.sol:SlasherBase |
14+
╰---------------+-------------+------+--------+-------+-----------------------------------------------╯
1715

docs/storage-report/SlasherStorage.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11

2-
╭----------------+-------------+------+--------+-------+-----------------------------------------------------╮
3-
| Name | Type | Slot | Offset | Bytes | Contract |
4-
+============================================================================================================+
5-
| serviceManager | address | 0 | 0 | 20 | src/slashers/base/SlasherStorage.sol:SlasherStorage |
6-
|----------------+-------------+------+--------+-------+-----------------------------------------------------|
7-
| slasher | address | 1 | 0 | 20 | src/slashers/base/SlasherStorage.sol:SlasherStorage |
8-
|----------------+-------------+------+--------+-------+-----------------------------------------------------|
9-
| nextRequestId | uint256 | 2 | 0 | 32 | src/slashers/base/SlasherStorage.sol:SlasherStorage |
10-
|----------------+-------------+------+--------+-------+-----------------------------------------------------|
11-
| __gap | uint256[47] | 3 | 0 | 1504 | src/slashers/base/SlasherStorage.sol:SlasherStorage |
12-
╰----------------+-------------+------+--------+-------+-----------------------------------------------------╯
2+
╭---------------+-------------+------+--------+-------+-----------------------------------------------------╮
3+
| Name | Type | Slot | Offset | Bytes | Contract |
4+
+===========================================================================================================+
5+
| slasher | address | 0 | 0 | 20 | src/slashers/base/SlasherStorage.sol:SlasherStorage |
6+
|---------------+-------------+------+--------+-------+-----------------------------------------------------|
7+
| nextRequestId | uint256 | 1 | 0 | 32 | src/slashers/base/SlasherStorage.sol:SlasherStorage |
8+
|---------------+-------------+------+--------+-------+-----------------------------------------------------|
9+
| __gap | uint256[48] | 2 | 0 | 1536 | src/slashers/base/SlasherStorage.sol:SlasherStorage |
10+
╰---------------+-------------+------+--------+-------+-----------------------------------------------------╯
1311

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
╭------------------+----------------------------------------------------------+------+--------+-------+--------------------------------------------------╮
3+
| Name | Type | Slot | Offset | Bytes | Contract |
4+
+========================================================================================================================================================+
5+
| _initialized | uint8 | 0 | 0 | 1 | src/slashers/VetoableSlasher.sol:VetoableSlasher |
6+
|------------------+----------------------------------------------------------+------+--------+-------+--------------------------------------------------|
7+
| _initializing | bool | 0 | 1 | 1 | src/slashers/VetoableSlasher.sol:VetoableSlasher |
8+
|------------------+----------------------------------------------------------+------+--------+-------+--------------------------------------------------|
9+
| slasher | address | 0 | 2 | 20 | src/slashers/VetoableSlasher.sol:VetoableSlasher |
10+
|------------------+----------------------------------------------------------+------+--------+-------+--------------------------------------------------|
11+
| nextRequestId | uint256 | 1 | 0 | 32 | src/slashers/VetoableSlasher.sol:VetoableSlasher |
12+
|------------------+----------------------------------------------------------+------+--------+-------+--------------------------------------------------|
13+
| __gap | uint256[48] | 2 | 0 | 1536 | src/slashers/VetoableSlasher.sol:VetoableSlasher |
14+
|------------------+----------------------------------------------------------+------+--------+-------+--------------------------------------------------|
15+
| vetoCommittee | address | 50 | 0 | 20 | src/slashers/VetoableSlasher.sol:VetoableSlasher |
16+
|------------------+----------------------------------------------------------+------+--------+-------+--------------------------------------------------|
17+
| slashingRequests | mapping(uint256 => struct ISlasherTypes.SlashingRequest) | 51 | 0 | 32 | src/slashers/VetoableSlasher.sol:VetoableSlasher |
18+
╰------------------+----------------------------------------------------------+------+--------+-------+--------------------------------------------------╯
19+

src/RegistryCoordinator.sol

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ pragma solidity ^0.8.27;
33

44
import {IPauserRegistry} from "eigenlayer-contracts/src/contracts/interfaces/IPauserRegistry.sol";
55
import {ISignatureUtils} from "eigenlayer-contracts/src/contracts/interfaces/ISignatureUtils.sol";
6-
import {IAVSDirectory } from "eigenlayer-contracts/src/contracts/interfaces/IAVSDirectory.sol";
76
import {IStrategy } from "eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol";
8-
import { IAllocationManager, OperatorSet, IAllocationManagerTypes} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
7+
import {IAllocationManager, OperatorSet, IAllocationManagerTypes} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
98
import {ISocketUpdater} from "./interfaces/ISocketUpdater.sol";
109
import {IBLSApkRegistry} from "./interfaces/IBLSApkRegistry.sol";
1110
import {IStakeRegistry, StakeType} from "./interfaces/IStakeRegistry.sol";
@@ -65,9 +64,16 @@ contract RegistryCoordinator is
6564
IStakeRegistry _stakeRegistry,
6665
IBLSApkRegistry _blsApkRegistry,
6766
IIndexRegistry _indexRegistry,
67+
IAllocationManager _allocationManager,
6868
IPauserRegistry _pauserRegistry
6969
)
70-
RegistryCoordinatorStorage(_serviceManager, _stakeRegistry, _blsApkRegistry, _indexRegistry)
70+
RegistryCoordinatorStorage(
71+
_serviceManager,
72+
_stakeRegistry,
73+
_blsApkRegistry,
74+
_indexRegistry,
75+
_allocationManager
76+
)
7177
EIP712("AVSRegistryCoordinator", "v0.0.1")
7278
Pausable(_pauserRegistry)
7379
{
@@ -278,13 +284,6 @@ contract RegistryCoordinator is
278284

279285
function enableOperatorSets() external onlyOwner {
280286
require(!isOperatorSetAVS, OperatorSetsEnabled());
281-
/// Triggers the updates to use operator sets ie setsAVSRegistrar
282-
/// Opens up the AVS Registrar Hooks on this contract to be callable by the ALM
283-
/// Allows creation of quorums with slashable and total delegated stake for operator sets
284-
/// Sets all quorums created before this call as m2 quorums in a mapping so that we can gate function calls to deregister
285-
/// M2 Registrations turn off once migrated. M2 deregistration remain open for only m2 quorums
286-
// Set this contract as the AVS registrar in the service manager
287-
serviceManager.setAVSRegistrar(IAVSRegistrar(address(this)));
288287

289288
// Set all existing quorums as m2 quorums
290289
for (uint8 i = 0; i < quorumCount; i++) {
@@ -389,8 +388,7 @@ contract RegistryCoordinator is
389388
// - all quorums should exist (checked against `quorumCount` in orderedBytesArrayToBitmap)
390389
// - there should be no duplicates in `quorumNumbers`
391390
// - there should be one list of operators per quorum
392-
uint192 quorumBitmap =
393-
uint192(BitmapUtils.orderedBytesArrayToBitmap(quorumNumbers, quorumCount));
391+
BitmapUtils.orderedBytesArrayToBitmap(quorumNumbers, quorumCount);
394392
require(
395393
operatorsPerQuorum.length == quorumNumbers.length,
396394
InputLengthMismatch()
@@ -703,8 +701,7 @@ contract RegistryCoordinator is
703701
}
704702

705703
function _checkAllocationManager() internal view {
706-
address allocationManager = address(serviceManager.allocationManager());
707-
require(msg.sender == allocationManager, OnlyAllocationManager());
704+
require(msg.sender == address(allocationManager), OnlyAllocationManager());
708705
}
709706

710707
/**
@@ -967,7 +964,10 @@ contract RegistryCoordinator is
967964
operatorSetId: quorumNumber,
968965
strategies: strategies
969966
});
970-
serviceManager.createOperatorSets(createSetParams);
967+
allocationManager.createOperatorSets({
968+
avs: address(serviceManager),
969+
params: createSetParams
970+
});
971971
}
972972
// Initialize stake registry based on stake type
973973
if (stakeType == StakeType.TOTAL_DELEGATED) {

src/RegistryCoordinatorStorage.sol

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {IStakeRegistry} from "./interfaces/IStakeRegistry.sol";
66
import {IIndexRegistry} from "./interfaces/IIndexRegistry.sol";
77
import {IServiceManager} from "./interfaces/IServiceManager.sol";
88
import {IAVSDirectory} from "eigenlayer-contracts/src/contracts/interfaces/IAVSDirectory.sol";
9+
import {IAllocationManager, OperatorSet, IAllocationManagerTypes} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
910
import {IRegistryCoordinator} from "./interfaces/IRegistryCoordinator.sol";
1011

1112
abstract contract RegistryCoordinatorStorage is IRegistryCoordinator {
@@ -40,8 +41,10 @@ abstract contract RegistryCoordinatorStorage is IRegistryCoordinator {
4041
IStakeRegistry public immutable stakeRegistry;
4142
/// @notice the Index Registry contract that will keep track of operators' indexes
4243
IIndexRegistry public immutable indexRegistry;
43-
/// @notice the AVS Directory that tracks operator registrations to AVS and operator sets
44-
IAVSDirectory public immutable avsDirectory;
44+
45+
/// EigenLayer contracts
46+
/// @notice the AllocationManager that tracks OperatorSets and Slashing in EigenLayer
47+
IAllocationManager public immutable allocationManager;
4548

4649
/*******************************************************************************
4750
STATE
@@ -84,12 +87,14 @@ abstract contract RegistryCoordinatorStorage is IRegistryCoordinator {
8487
IServiceManager _serviceManager,
8588
IStakeRegistry _stakeRegistry,
8689
IBLSApkRegistry _blsApkRegistry,
87-
IIndexRegistry _indexRegistry
90+
IIndexRegistry _indexRegistry,
91+
IAllocationManager _allocationManager
8892
) {
8993
serviceManager = _serviceManager;
9094
stakeRegistry = _stakeRegistry;
9195
blsApkRegistry = _blsApkRegistry;
9296
indexRegistry = _indexRegistry;
97+
allocationManager = _allocationManager;
9398
}
9499

95100
// storage gap for upgradeability

0 commit comments

Comments
 (0)