diff --git a/src/core/SSVBasedApps.sol b/src/core/SSVBasedApps.sol index 31b81362..b9e9f80b 100644 --- a/src/core/SSVBasedApps.sol +++ b/src/core/SSVBasedApps.sol @@ -343,9 +343,7 @@ contract SSVBasedApps is _delegateTo(SSVCoreModules.SSV_PROTOCOL_MANAGER); } - function updateDisabledFeatures( - uint32 disabledFeatures - ) external onlyOwner { + function updateDisabledFeatures(uint32 value) external onlyOwner { _delegateTo(SSVCoreModules.SSV_PROTOCOL_MANAGER); } diff --git a/src/core/modules/StrategyManager.sol b/src/core/modules/StrategyManager.sol index fb8425b2..4056c8ac 100644 --- a/src/core/modules/StrategyManager.sol +++ b/src/core/modules/StrategyManager.sol @@ -183,6 +183,10 @@ contract StrategyManager is ReentrancyGuardTransient, IStrategyManager { ValidationLib.validateArrayLengths(tokens, obligationPercentages); + if (!s.registeredBApps[bApp]) { + revert IBasedAppManager.BAppNotRegistered(); + } + // Check if a strategy exists for the given bApp. // It is not possible opt-in to the same bApp twice with the same strategy owner. if (s.accountBAppStrategy[msg.sender][bApp] != 0) { diff --git a/test/modules/StrategyManager.t.sol b/test/modules/StrategyManager.t.sol index 49f2f668..8c66040f 100644 --- a/test/modules/StrategyManager.t.sol +++ b/test/modules/StrategyManager.t.sol @@ -4,7 +4,7 @@ pragma solidity 0.8.29; import { IERC20, BasedAppMock } from "@ssv/test/helpers/Setup.t.sol"; import { BasedAppsManagerTest } from "@ssv/test/modules/BasedAppsManager.t.sol"; import { IStrategyManager } from "@ssv/src/core/interfaces/IStrategyManager.sol"; -import { IStrategyManager } from "@ssv/src/core/interfaces/IStrategyManager.sol"; +import { IBasedAppManager } from "@ssv/src/core/interfaces/IBasedAppManager.sol"; import { UtilsTest } from "@ssv/test/helpers/Utils.t.sol"; import { ValidationLib } from "@ssv/src/core/libraries/ValidationLib.sol"; @@ -1041,6 +1041,34 @@ contract StrategyManagerTest is UtilsTest, BasedAppsManagerTest { vm.stopPrank(); } + function testRevertStrategyOptingInToNonExistingBApp( + uint32 percentage + ) public { + vm.assume( + percentage > 0 && percentage <= proxiedManager.maxPercentage() + ); + testCreateStrategies(); + vm.startPrank(USER1); + address[] memory tokensInput = new address[](0); + uint32[] memory obligationPercentagesInput = new uint32[](0); + for (uint256 i = 0; i < bApps.length; i++) { + vm.expectRevert( + abi.encodeWithSelector( + IBasedAppManager.BAppNotRegistered.selector, + address(erc20mock2) + ) + ); + proxiedManager.optInToBApp( + STRATEGY1, + address(bApps[i]), + tokensInput, + obligationPercentagesInput, + abi.encodePacked("0x00") + ); + } + vm.stopPrank(); + } + function testStrategyOwnerDepositERC20WithNoObligation( uint256 amount ) public {