Skip to content

Commit

Permalink
chore: simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
howydev committed Jun 17, 2024
1 parent 827f4d0 commit 54a2f70
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/account/UpgradeableModularAccount.sol
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,14 @@ contract UpgradeableModularAccount is

FunctionReference userOpValidationFunction = FunctionReference.wrap(bytes21(userOp.signature[:21]));

PostExecToRun[] memory postExecHooks = _doPreHooks(
getAccountStorage().selectorData[bytes4(userOp.callData[4:8])].executionHooks, abi.encode(userOp), true
);

PostExecToRun[] memory postPermissionHooks = _doPreHooks(
getAccountStorage().validationData[userOpValidationFunction].permissionHooks, abi.encode(userOp), true
);

PostExecToRun[] memory postExecHooks = _doPreHooks(
getAccountStorage().selectorData[bytes4(userOp.callData[4:8])].executionHooks, abi.encode(userOp), true
);

(bool success, bytes memory result) = address(this).call(userOp.callData[4:]);

if (!success) {
Expand Down Expand Up @@ -563,13 +563,12 @@ contract UpgradeableModularAccount is

// Run the pre hooks and copy their return data to the post hooks array, if an associated post-exec hook
// exists.
bool callNotToExecuteUserOp = msg.sig != this.executeUserOp.selector;
for (uint256 i = 0; i < hooksLength; ++i) {
bytes32 key = executionHooks.at(i);
(FunctionReference hookFunction, bool isPreHook, bool isPostHook, bool requireUOContext) =
toExecutionHook(key);

if (requireUOContext && callNotToExecuteUserOp) {
if (!isPackedUO && requireUOContext) {
revert RequireUserOperationContext();
}

Expand Down

0 comments on commit 54a2f70

Please sign in to comment.