Skip to content

Commit c0e193d

Browse files
committed
test: not-installed validator uninstall reverts per TOB-KERNEL-12
1 parent 6fabfea commit c0e193d

2 files changed

Lines changed: 13 additions & 10 deletions

File tree

‎test/btt/Kernel.uninstallModule.t.sol‎

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@ import {MockSigner} from "../mock/MockSigner.sol";
1111
import {IValidator} from "src/interfaces/IERC7579Modules.sol";
1212
import {validatorToIdentifier, permissionToIdentifier} from "src/lib/Utils.sol";
1313
import {PermissionId} from "src/types/Types.sol";
14-
import {Unauthorized, NotImplemented, InvalidPermissionUninstallOrder, InvalidPermissionId} from "src/types/Error.sol";
14+
import {
15+
Unauthorized,
16+
NotImplemented,
17+
InvalidPermissionUninstallOrder,
18+
InvalidPermissionId,
19+
InvalidVid
20+
} from "src/types/Error.sol";
1521

1622
/// @title Kernel.uninstallModule BTT Tests
1723
/// @notice Tests for uninstallModule following Branching Tree Technique
@@ -69,17 +75,14 @@ abstract contract Kernel_uninstallModule is BTTModifiers {
6975
whenTheCallerIsTheEntryPointOrSelfUninstall
7076
givenModuleTypeIsValidatorUninstall
7177
{
72-
// it should be a no-op and leave root unchanged
78+
// it should revert with InvalidVid (TOB-KERNEL-12: no onUninstall callback may reach a
79+
// module that is not installed under the given type)
7380
MockValidator mockValidator = new MockValidator();
7481

75-
// Validator is NOT installed - uninstall should be a no-op
76-
kernel.uninstallModule(1, address(mockValidator), abi.encode(hex"", hex""));
77-
78-
// Verify it remains uninstalled (hook is still address(0))
79-
assertFalse(
80-
kernel.validationInfo(validatorToIdentifier(IValidator(address(mockValidator)))).installed,
81-
"Validator should remain uninstalled"
82+
vm.expectRevert(
83+
abi.encodeWithSelector(InvalidVid.selector, validatorToIdentifier(IValidator(address(mockValidator))))
8284
);
85+
kernel.uninstallModule(1, address(mockValidator), abi.encode(hex"", hex""));
8386
}
8487

8588
function test_GivenModuleTypeIsValidatorUninstall()

‎test/btt/Kernel.uninstallModule.tree‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Kernel_uninstallModule
66
│ ├── given the validator is installed Uninstall
77
│ │ └── it should clear validator hook state
88
│ └── given the validator is not installed Uninstall
9-
│ └── it should be a no-op and leave root unchanged
9+
│ └── it should revert with InvalidVid error
1010
├── given moduleType is Executor Uninstall
1111
│ └── it should clear executor hook
1212
├── given moduleType is Fallback Uninstall

0 commit comments

Comments
 (0)