Skip to content

Commit

Permalink
Merge branch 'main' into lyova-fix-flaky-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ly0va authored Feb 11, 2025
2 parents b56065f + ff8273d commit b2e5ebf
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/managers/HookManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -77,24 +77,24 @@ abstract contract HookManager is IHookManager, SelfAuth {

// Runs the execution hooks that are enabled by the account before and after _executeTransaction
modifier runExecutionHooks(Transaction calldata transaction) {
EnumerableSet.AddressSet storage hookList = _executionHooks();
uint256 totalHooks = hookList.length();
address[] memory hookList = _executionHooks().values();
uint256 totalHooks = hookList.length;
bytes[] memory context = new bytes[](totalHooks);

for (uint256 i = 0; i < totalHooks; i++) {
context[i] = IExecutionHook(hookList.at(i)).preExecutionHook(transaction);
context[i] = IExecutionHook(hookList[i]).preExecutionHook(transaction);
}

_;

// If we removed any hooks, we have to update totalHooks.
// If we added any hooks, we don't want them to run yet.
if (totalHooks > hookList.length()) {
totalHooks = hookList.length();
}
EnumerableSet.AddressSet storage newHookList = _executionHooks();

for (uint256 i = 0; i < totalHooks; i++) {
IExecutionHook(hookList.at(i)).postExecutionHook(context[i]);
// Only execute hooks which are both in the old `hookList` and the `newHookList`,
// and we don't want to execute hooks that were removed and/or added during this transaction.
if (newHookList.contains(hookList[i])) {
IExecutionHook(hookList[i]).postExecutionHook(context[i]);
}
}
}

Expand Down

0 comments on commit b2e5ebf

Please sign in to comment.