Skip to content

Commit 80687a7

Browse files
0xClandestineypatil12
authored andcommitted
refactor: small cleanup
refactor small cleanup chore: `forge fmt` fix: `getQueuedWithdrawals` + test fix: add constructor back test: `totalQueued` > `withdrawal.strategies.length` test(wip): `completeQueuedWithdrawals` currently failing fix: effectBlock test(wip): @8sunyuan patch fix: one flaky test fix: second flaky test
1 parent 1777a64 commit 80687a7

File tree

7 files changed

+464
-5
lines changed

7 files changed

+464
-5
lines changed

src/contracts/core/AllocationManager.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ contract AllocationManager is
6363
// Check that the operator set exists and the operator is registered to it
6464
OperatorSet memory operatorSet = OperatorSet(avs, params.operatorSetId);
6565
bool isOperatorSlashable = _isOperatorSlashable(params.operator, operatorSet);
66+
require(params.strategies.length == params.wadsToSlash.length, InputArrayLengthMismatch());
6667
require(_operatorSets[operatorSet.avs].contains(operatorSet.id), InvalidOperatorSet());
6768
require(isOperatorSlashable, OperatorNotSlashable());
6869

src/contracts/core/DelegationManager.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,7 @@ contract DelegationManager is
942942
for (uint256 j; j < withdrawals[i].strategies.length; ++j) {
943943
shares[i][j] = SlashingLib.scaleForCompleteWithdrawal({
944944
scaledShares: withdrawals[i].scaledShares[j],
945-
slashingFactor: slashingFactors[i]
945+
slashingFactor: slashingFactors[j]
946946
});
947947
}
948948
}

src/contracts/interfaces/IAllocationManager.sol

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ pragma solidity >=0.5.0;
44
import {OperatorSet} from "../libraries/OperatorSetLib.sol";
55
import "./IPauserRegistry.sol";
66
import "./IStrategy.sol";
7-
import "./ISignatureUtils.sol";
87
import "./IAVSRegistrar.sol";
98

109
interface IAllocationManagerErrors {
@@ -213,7 +212,7 @@ interface IAllocationManagerEvents is IAllocationManagerTypes {
213212
event StrategyRemovedFromOperatorSet(OperatorSet operatorSet, IStrategy strategy);
214213
}
215214

216-
interface IAllocationManager is ISignatureUtils, IAllocationManagerErrors, IAllocationManagerEvents {
215+
interface IAllocationManager is IAllocationManagerErrors, IAllocationManagerEvents {
217216
/**
218217
* @dev Initializes the initial owner and paused status.
219218
*/

src/test/unit/AllocationManagerUnit.t.sol

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,15 @@ contract AllocationManagerUnitTests_SlashOperator is AllocationManagerUnitTests
613613
allocationManager.slashOperator(defaultAVS, _randSlashingParams(random().Address(), 0));
614614
}
615615

616+
function test_revert_InputArrayLengthMismatch() public {
617+
SlashingParams memory slashingParams = _randSlashingParams(defaultOperator, 0);
618+
slashingParams.strategies = slashingParams.strategies.setLength(2);
619+
620+
cheats.prank(defaultAVS);
621+
cheats.expectRevert(InputArrayLengthMismatch.selector);
622+
allocationManager.slashOperator(defaultAVS, slashingParams);
623+
}
624+
616625
function test_revert_StrategiesMustBeInAscendingOrder() public {
617626
IStrategy[] memory strategies = new IStrategy[](3);
618627
strategies[0] = IStrategy(address(3));

0 commit comments

Comments
 (0)