Skip to content

Commit

Permalink
Unused returns fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
jcsec-security committed Jan 23, 2025
1 parent 1f8f164 commit 180ff26
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion slither.config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"filter_paths": "(test|src/test|scripts|node_modules)",
"detectors_to_exclude": "uninitialized-local,unused-returns",
"detectors_to_exclude": "uninitialized-local",
"exclude_dependencies": true,
"compile_force_framework": "foundry",
"foundry_ignore_compile": false,
Expand Down
12 changes: 8 additions & 4 deletions src/managers/HookManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,11 @@ abstract contract HookManager is IHookManager, Auth {
}

if (isValidation) {
_validationHooks().add(hook);
bool success = _validationHooks().add(hook);
require(success, "Validation hook already exists");
} else {
_executionHooks().add(hook);
bool success = _executionHooks().add(hook);
require(success, "Execution hook already exists");
}

IModule(hook).onInstall(initData);
Expand All @@ -107,9 +109,11 @@ abstract contract HookManager is IHookManager, Auth {

function _removeHook(address hook, bool isValidation) internal {
if (isValidation) {
_validationHooks().remove(hook);
bool success = _validationHooks().remove(hook);
require(success, "Validation hook not found");
} else {
_executionHooks().remove(hook);
bool success = _executionHooks().remove(hook);
require(success, "Execution hook not found");
}

emit HookRemoved(hook);
Expand Down
6 changes: 4 additions & 2 deletions src/managers/OwnerManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@ abstract contract OwnerManager is IOwnerManager, Auth {
}

function _k1AddOwner(address addr) internal {
_k1Owners().add(addr);
bool success = _k1Owners().add(addr);
require(success, "K1 Owner already exists");

emit K1AddOwner(addr);
}

function _k1RemoveOwner(address addr) internal {
_k1Owners().remove(addr);
bool success = _k1Owners().remove(addr);
require(success, "K1 Owner not found");

emit K1RemoveOwner(addr);
}
Expand Down
7 changes: 5 additions & 2 deletions src/managers/ValidatorManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,17 @@ abstract contract ValidatorManager is IValidatorManager, Auth {
revert Errors.VALIDATOR_ERC165_FAIL(validator);
}

_moduleValidators().add(validator);
bool success = _moduleValidators().add(validator);
require(success, "Module validator already exists");

IModule(validator).onInstall(initData);

emit ValidatorAdded(validator);
}

function _removeModuleValidator(address validator) internal {
_moduleValidators().remove(validator);
bool success = _moduleValidators().remove(validator);
require(success, "Module validator not found");

emit ValidatorRemoved(validator);
}
Expand Down

0 comments on commit 180ff26

Please sign in to comment.