Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion contracts/hooks/MultiHookRouter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ contract MultiHookRouter is ERC165, IACPHook, ReentrancyGuardTransient, Ownable
/// @param jobId The job ID
/// @param selector The hookable function selector
/// @param hook The sub-hook address to remove
/// @dev Preserves the relative order of the remaining hooks. Order matters
/// because beforeAction/afterAction iterate _jobHooks in storage order
/// and _splitHookData binds per-hook optParams to hooks by index.
function removeHook(
uint256 jobId,
bytes4 selector,
Expand All @@ -202,7 +205,11 @@ contract MultiHookRouter is ERC165, IACPHook, ReentrancyGuardTransient, Ownable

for (uint256 i; i < len; ) {
if (hooks[i] == hook) {
hooks[i] = hooks[len - 1];
// Shift remaining elements left so removal is order-preserving.
for (uint256 j = i; j + 1 < len; ) {
hooks[j] = hooks[j + 1];
unchecked { ++j; }
}
hooks.pop();
emit HookRemoved(jobId, selector, hook);
return;
Expand Down