@@ -10,53 +10,141 @@ import {ISlashingRegistryCoordinator} from "../../src/interfaces/ISlashingRegist
10
10
import {ProxyAdmin} from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol " ;
11
11
import {TransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol " ;
12
12
import {EmptyContract} from "eigenlayer-contracts/src/test/mocks/EmptyContract.sol " ;
13
+ import {AllocationManager} from "eigenlayer-contracts/src/contracts/core/AllocationManager.sol " ;
14
+ import {PermissionController} from "eigenlayer-contracts/src/contracts/permissions/PermissionController.sol " ;
15
+ import {PauserRegistry} from "eigenlayer-contracts/src/contracts/permissions/PauserRegistry.sol " ;
16
+ import {DelegationMock} from "../mocks/DelegationMock.sol " ;
17
+ import {SlashingRegistryCoordinator} from "../../src/SlashingRegistryCoordinator.sol " ;
18
+ import {IBLSApkRegistry} from "../../src/interfaces/IBLSApkRegistry.sol " ;
19
+ import {IStakeRegistry} from "../../src/interfaces/IStakeRegistry.sol " ;
20
+ import {IIndexRegistry} from "../../src/interfaces/IIndexRegistry.sol " ;
21
+ import {ISocketRegistry} from "../../src/interfaces/ISocketRegistry.sol " ;
13
22
14
23
contract VetoableSlasherTest is Test {
15
24
VetoableSlasher public vetoableSlasher;
16
25
VetoableSlasher public vetoableSlasherImplementation;
17
26
ProxyAdmin public proxyAdmin;
18
27
EmptyContract public emptyContract;
28
+ AllocationManager public allocationManager;
29
+ AllocationManager public allocationManagerImplementation;
30
+ PermissionController public permissionController;
31
+ PauserRegistry public pauserRegistry;
32
+ DelegationMock public delegationMock;
33
+ SlashingRegistryCoordinator public slashingRegistryCoordinator;
34
+ SlashingRegistryCoordinator public slashingRegistryCoordinatorImplementation;
19
35
20
- address public allocationManager;
21
- address public slashingRegistryCoordinator;
22
36
address public vetoCommittee;
23
37
address public slasher;
38
+ address public serviceManager;
24
39
address public operator;
25
40
IStrategy public mockStrategy;
26
41
address public proxyAdminOwner = address (uint160 (uint256 (keccak256 ("proxyAdminOwner " ))));
42
+ address public pauser = address (uint160 (uint256 (keccak256 ("pauser " ))));
43
+ address public unpauser = address (uint160 (uint256 (keccak256 ("unpauser " ))));
44
+ address public churnApprover = address (uint160 (uint256 (keccak256 ("churnApprover " ))));
45
+ address public ejector = address (uint160 (uint256 (keccak256 ("ejector " ))));
27
46
28
47
uint256 constant VETO_PERIOD = 3 days ;
48
+ uint32 constant DEALLOCATION_DELAY = 7 days ;
49
+ uint32 constant ALLOCATION_CONFIGURATION_DELAY = 1 days ;
29
50
30
51
function setUp () public {
31
- allocationManager = address (0x1 );
52
+ serviceManager = address (0x1 );
32
53
vetoCommittee = address (0x2 );
33
54
slasher = address (0x3 );
34
55
operator = address (0x4 );
35
56
mockStrategy = IStrategy (address (0x5 ));
36
- slashingRegistryCoordinator = address (0x6 );
37
57
38
58
vm.startPrank (proxyAdminOwner);
39
59
proxyAdmin = new ProxyAdmin ();
40
60
emptyContract = new EmptyContract ();
41
61
42
- vetoableSlasher = VetoableSlasher (
62
+ address [] memory pausers = new address [](1 );
63
+ pausers[0 ] = pauser;
64
+ pauserRegistry = new PauserRegistry (pausers, unpauser);
65
+
66
+ delegationMock = new DelegationMock ();
67
+
68
+ permissionController = new PermissionController ();
69
+
70
+ allocationManagerImplementation = new AllocationManager (
71
+ delegationMock,
72
+ pauserRegistry,
73
+ permissionController,
74
+ DEALLOCATION_DELAY,
75
+ ALLOCATION_CONFIGURATION_DELAY
76
+ );
77
+
78
+ allocationManager = AllocationManager (
79
+ address (
80
+ new TransparentUpgradeableProxy (
81
+ address (allocationManagerImplementation),
82
+ address (proxyAdmin),
83
+ ""
84
+ )
85
+ )
86
+ );
87
+
88
+ allocationManager.initialize (proxyAdminOwner, 0 );
89
+
90
+ // Deploy and set up SlashingRegistryCoordinator
91
+ slashingRegistryCoordinatorImplementation = new SlashingRegistryCoordinator (
92
+ IStakeRegistry (address (0 )), // Mock stake registry
93
+ IBLSApkRegistry (address (0 )), // Mock BLS APK registry
94
+ IIndexRegistry (address (0 )), // Mock index registry
95
+ ISocketRegistry (address (0 )), // Mock socket registry
96
+ allocationManager,
97
+ pauserRegistry
98
+ );
99
+
100
+ slashingRegistryCoordinator = SlashingRegistryCoordinator (
43
101
address (
44
- new TransparentUpgradeableProxy (address (emptyContract), address (proxyAdmin), "" )
102
+ new TransparentUpgradeableProxy (
103
+ address (slashingRegistryCoordinatorImplementation),
104
+ address (proxyAdmin),
105
+ ""
106
+ )
45
107
)
46
108
);
47
109
110
+ slashingRegistryCoordinator.initialize (
111
+ proxyAdminOwner,
112
+ churnApprover,
113
+ ejector,
114
+ 0 , // Initial paused status
115
+ serviceManager
116
+ );
117
+
48
118
vetoableSlasherImplementation = new VetoableSlasher (
49
119
IAllocationManager (allocationManager),
50
120
ISlashingRegistryCoordinator (slashingRegistryCoordinator)
51
121
);
52
122
123
+ vetoableSlasher = VetoableSlasher (
124
+ address (
125
+ new TransparentUpgradeableProxy (
126
+ address (emptyContract),
127
+ address (proxyAdmin),
128
+ ""
129
+ )
130
+ )
131
+ );
132
+
53
133
proxyAdmin.upgrade (
54
134
TransparentUpgradeableProxy (payable (address (vetoableSlasher))),
55
135
address (vetoableSlasherImplementation)
56
136
);
57
137
vm.stopPrank ();
58
138
59
139
vetoableSlasher.initialize (vetoCommittee, slasher);
140
+
141
+ vm.prank (serviceManager);
142
+ permissionController.setAppointee (
143
+ address (serviceManager),
144
+ address (vetoableSlasher),
145
+ address (allocationManager),
146
+ AllocationManager.slashOperator.selector
147
+ );
60
148
}
61
149
62
150
function test_initialization () public {
@@ -150,7 +238,7 @@ contract VetoableSlasherTest is Test {
150
238
}
151
239
152
240
function test_fulfillSlashingRequest () public {
153
- vm.skip (true );
241
+ vm.skip (true ); /// TODO:
154
242
IAllocationManagerTypes.SlashingParams memory params = _createMockSlashingParams ();
155
243
156
244
vm.prank (slasher);
0 commit comments