Skip to content

Commit 54d130d

Browse files
Merge 0f00f9f into f3efb28
2 parents f3efb28 + 0f00f9f commit 54d130d

File tree

3 files changed

+34
-4
lines changed

3 files changed

+34
-4
lines changed

src/core/SSVBasedApps.sol

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,9 +343,7 @@ contract SSVBasedApps is
343343
_delegateTo(SSVCoreModules.SSV_PROTOCOL_MANAGER);
344344
}
345345

346-
function updateDisabledFeatures(
347-
uint32 disabledFeatures
348-
) external onlyOwner {
346+
function updateDisabledFeatures(uint32 value) external onlyOwner {
349347
_delegateTo(SSVCoreModules.SSV_PROTOCOL_MANAGER);
350348
}
351349

src/core/modules/StrategyManager.sol

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@ contract StrategyManager is ReentrancyGuardTransient, IStrategyManager {
183183

184184
ValidationLib.validateArrayLengths(tokens, obligationPercentages);
185185

186+
if (!s.registeredBApps[bApp]) {
187+
revert IBasedAppManager.BAppNotRegistered();
188+
}
189+
186190
// Check if a strategy exists for the given bApp.
187191
// It is not possible opt-in to the same bApp twice with the same strategy owner.
188192
if (s.accountBAppStrategy[msg.sender][bApp] != 0) {

test/modules/StrategyManager.t.sol

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pragma solidity 0.8.29;
44
import { IERC20, BasedAppMock } from "@ssv/test/helpers/Setup.t.sol";
55
import { BasedAppsManagerTest } from "@ssv/test/modules/BasedAppsManager.t.sol";
66
import { IStrategyManager } from "@ssv/src/core/interfaces/IStrategyManager.sol";
7-
import { IStrategyManager } from "@ssv/src/core/interfaces/IStrategyManager.sol";
7+
import { IBasedAppManager } from "@ssv/src/core/interfaces/IBasedAppManager.sol";
88
import { UtilsTest } from "@ssv/test/helpers/Utils.t.sol";
99
import { ValidationLib } from "@ssv/src/core/libraries/ValidationLib.sol";
1010

@@ -1041,6 +1041,34 @@ contract StrategyManagerTest is UtilsTest, BasedAppsManagerTest {
10411041
vm.stopPrank();
10421042
}
10431043

1044+
function testRevertStrategyOptingInToNonExistingBApp(
1045+
uint32 percentage
1046+
) public {
1047+
vm.assume(
1048+
percentage > 0 && percentage <= proxiedManager.maxPercentage()
1049+
);
1050+
testCreateStrategies();
1051+
vm.startPrank(USER1);
1052+
address[] memory tokensInput = new address[](0);
1053+
uint32[] memory obligationPercentagesInput = new uint32[](0);
1054+
for (uint256 i = 0; i < bApps.length; i++) {
1055+
vm.expectRevert(
1056+
abi.encodeWithSelector(
1057+
IBasedAppManager.BAppNotRegistered.selector,
1058+
address(erc20mock2)
1059+
)
1060+
);
1061+
proxiedManager.optInToBApp(
1062+
STRATEGY1,
1063+
address(bApps[i]),
1064+
tokensInput,
1065+
obligationPercentagesInput,
1066+
abi.encodePacked("0x00")
1067+
);
1068+
}
1069+
vm.stopPrank();
1070+
}
1071+
10441072
function testStrategyOwnerDepositERC20WithNoObligation(
10451073
uint256 amount
10461074
) public {

0 commit comments

Comments
 (0)