Skip to content

Commit 9eac860

Browse files
committed
test: full coverage SlashEscrowFactory + SlashEscrow (#1403)
**Motivation:** We want to ensure we have full coverage unit tests for `SlashEscrowFactory` and `SlashEscrow` in preparation for audits. **Modifications:** - Adds checks for all view methods. **Result:** Brings coverage up to 100% for all branches/fns/etc.
1 parent c79ae54 commit 9eac860

File tree

4 files changed

+180
-127
lines changed

4 files changed

+180
-127
lines changed

src/contracts/core/SlashEscrowFactory.sol

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -339,20 +339,7 @@ contract SlashEscrowFactory is Initializable, SlashEscrowFactoryStorage, Ownable
339339
}
340340

341341
/// @inheritdoc ISlashEscrowFactory
342-
function getPendingStrategiesForSlashIds() public view returns (IStrategy[][][] memory strategies) {
343-
bytes32[] memory operatorSetKeys = _pendingOperatorSets.values();
344-
345-
uint256 length = operatorSetKeys.length;
346-
347-
strategies = new IStrategy[][][](length);
348-
349-
for (uint256 i = 0; i < length; ++i) {
350-
strategies[i] = getPendingStrategiesForSlashIds(operatorSetKeys[i].decode());
351-
}
352-
}
353-
354-
/// @inheritdoc ISlashEscrowFactory
355-
function getPendingStrategiesForSlashIdCount(
342+
function getTotalPendingStrategiesForSlashId(
356343
OperatorSet calldata operatorSet,
357344
uint256 slashId
358345
) external view returns (uint256) {

src/contracts/interfaces/ISlashEscrowFactory.sol

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -163,20 +163,13 @@ interface ISlashEscrowFactory is ISlashEscrowFactoryErrors, ISlashEscrowFactoryE
163163
OperatorSet calldata operatorSet
164164
) external view returns (IStrategy[][] memory strategies);
165165

166-
/**
167-
* @notice Returns all pending strategies for all slash IDs for all operator sets.
168-
* @dev This is a variant that returns all pending strategies for all slash IDs for all operator sets.
169-
* @return strategies The nested list of strategies that are pending strategies.
170-
*/
171-
function getPendingStrategiesForSlashIds() external view returns (IStrategy[][][] memory strategies);
172-
173166
/**
174167
* @notice Returns the number of pending strategies for a slash ID for an operator set.
175168
* @param operatorSet The operator set whose pending strategies are being queried.
176169
* @param slashId The slash ID of the strategies that are being queried.
177170
* @return The number of pending strategies.
178171
*/
179-
function getPendingStrategiesForSlashIdCount(
172+
function getTotalPendingStrategiesForSlashId(
180173
OperatorSet calldata operatorSet,
181174
uint256 slashId
182175
) external view returns (uint256);

src/test/unit/AllocationManagerUnit.t.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3826,15 +3826,15 @@ contract AllocationManagerUnitTests_createRedistributingOperatorSets is Allocati
38263826
}
38273827

38283828
function testRevert_createRedistributingOperatorSets_ZeroAddress(Randomness r) public rand(r) {
3829-
address avs = r.Address();
3829+
address avs = address(0x12345);
38303830
address[] memory redistributionRecipients = new address[](1);
38313831
redistributionRecipients[0] = address(0);
38323832

38333833
cheats.prank(avs);
38343834
allocationManager.updateAVSMetadataURI(avs, "https://example.com");
38353835

3836-
cheats.expectRevert(IPausable.InputAddressZero.selector);
38373836
cheats.prank(avs);
3837+
cheats.expectRevert(IPausable.InputAddressZero.selector);
38383838
allocationManager.createRedistributingOperatorSets(
38393839
avs, CreateSetParams(defaultOperatorSet.id, defaultStrategies).toArray(), redistributionRecipients
38403840
);

0 commit comments

Comments
 (0)