@@ -111,12 +111,91 @@ contract EjectionManagerUnitTests is MockAVSDeployer {
111
111
);
112
112
}
113
113
114
- function testEjectOperators_MultipleOperatorInsideRatelimit () public {
114
+ /// @dev Tests that ejecting multiple operators in one call h
115
+ function testEjectOperators_singleCall () public {
115
116
uint8 operatorsToEject = 10 ;
116
117
uint8 numOperators = 100 ;
117
118
uint96 stake = 1 ether ;
118
119
_registerOperators (numOperators, stake);
119
120
121
+ // Get quroums to deregister
122
+ bytes32 [][] memory operatorIds = new bytes32 [][](numQuorums);
123
+ for (uint8 i = 0 ; i < numQuorums; i++ ) {
124
+ operatorIds[i] = new bytes32 [](operatorsToEject);
125
+ for (uint256 j = 0 ; j < operatorsToEject; j++ ) {
126
+ operatorIds[i][j] =
127
+ registryCoordinator.getOperatorId (_incrementAddress (defaultOperator, j));
128
+ }
129
+ }
130
+
131
+ cheats.prank (ejector);
132
+ ejectionManager.ejectOperators (operatorIds);
133
+
134
+ for (uint8 i = 0 ; i < operatorsToEject - 1 ; i++ ) {
135
+ assertEq (
136
+ uint8 (registryCoordinator.getOperatorStatus (_incrementAddress (defaultOperator, i))),
137
+ uint8 (ISlashingRegistryCoordinatorTypes.OperatorStatus.DEREGISTERED)
138
+ );
139
+ }
140
+
141
+ // The 10th operator should not be ejected
142
+ assertEq (
143
+ uint8 (
144
+ registryCoordinator.getOperatorStatus (
145
+ _incrementAddress (defaultOperator, operatorsToEject - 1 )
146
+ )
147
+ ),
148
+ uint8 (ISlashingRegistryCoordinatorTypes.OperatorStatus.REGISTERED)
149
+ );
150
+ }
151
+
152
+ /// @dev Same test as above, but with multiple calls, end state should be the same
153
+ function testEjectOperators_multipleCalls () public {
154
+ uint8 operatorsToEject = 10 ;
155
+ uint8 numOperators = 100 ;
156
+ uint96 stake = 1 ether ;
157
+ _registerOperators (numOperators, stake);
158
+
159
+ for (uint8 i = 0 ; i < operatorsToEject; i++ ) {
160
+ // Setup operatorIds for next call
161
+ uint8 operatorsToEjectPerCall = 1 ;
162
+ bytes32 [][] memory operatorIds = new bytes32 [][](numQuorums);
163
+ for (uint8 j = 0 ; j < numQuorums; j++ ) {
164
+ operatorIds[j] = new bytes32 [](operatorsToEjectPerCall);
165
+ for (uint256 k = 0 ; k < operatorsToEjectPerCall; k++ ) {
166
+ operatorIds[j][k] =
167
+ registryCoordinator.getOperatorId (_incrementAddress (defaultOperator, i));
168
+ }
169
+ }
170
+
171
+ cheats.prank (ejector);
172
+ ejectionManager.ejectOperators (operatorIds);
173
+ }
174
+
175
+ for (uint8 i = 0 ; i < operatorsToEject - 1 ; i++ ) {
176
+ assertEq (
177
+ uint8 (registryCoordinator.getOperatorStatus (_incrementAddress (defaultOperator, i))),
178
+ uint8 (ISlashingRegistryCoordinatorTypes.OperatorStatus.DEREGISTERED)
179
+ );
180
+ }
181
+
182
+ // The 10th operator should not be ejected
183
+ assertEq (
184
+ uint8 (
185
+ registryCoordinator.getOperatorStatus (
186
+ _incrementAddress (defaultOperator, operatorsToEject - 1 )
187
+ )
188
+ ),
189
+ uint8 (ISlashingRegistryCoordinatorTypes.OperatorStatus.REGISTERED)
190
+ );
191
+ }
192
+
193
+ function testEjectOperators_MultipleOperatorInsideRatelimit () public {
194
+ uint8 operatorsToEject = 9 ;
195
+ uint8 numOperators = 100 ;
196
+ uint96 stake = 1 ether ;
197
+ _registerOperators (numOperators, stake);
198
+
120
199
bytes32 [][] memory operatorIds = new bytes32 [][](numQuorums);
121
200
for (uint8 i = 0 ; i < numQuorums; i++ ) {
122
201
operatorIds[i] = new bytes32 [](operatorsToEject);
@@ -388,7 +467,7 @@ contract EjectionManagerUnitTests is MockAVSDeployer {
388
467
}
389
468
390
469
function testEjectOperators_MultipleOperatorAfterRatelimitReset () public {
391
- uint8 operatorsToEject = 10 ;
470
+ uint8 operatorsToEject = 9 ;
392
471
uint8 numOperators = 100 ;
393
472
uint96 stake = 1 ether ;
394
473
0 commit comments