Skip to content

Commit dd3fe66

Browse files
committed
chore: rename validation associated hooks to module entity associated hooks
1 parent c9b256c commit dd3fe66

4 files changed

Lines changed: 22 additions & 22 deletions

File tree

src/account/AccountStorage.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ struct ValidationStorage {
3333
ValidationFlags validationFlags;
3434
// The validation hooks for this validation function.
3535
HookConfig[] validationHooks;
36-
// Execution hooks to run with this validation function.
36+
// Execution hooks associated with this entity, to be run when this validation is used.
3737
EnumerableSet.Bytes32Set executionHooks;
3838
// The set of selectors that may be validated by this validation function.
3939
EnumerableSet.Bytes32Set selectors;

src/account/ReferenceModularAccount.sol

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,13 @@ contract ReferenceModularAccount is
8989
// Wraps execution of a native function with runtime validation and hooks
9090
// Used for upgradeTo, upgradeToAndCall, execute, executeBatch, installExecution, uninstallExecution
9191
modifier wrapNativeFunction() {
92-
(PostExecToRun[] memory postValidatorExecHooks, PostExecToRun[] memory postSelectorExecHooks) =
92+
(PostExecToRun[] memory postExecHooksForEntity, PostExecToRun[] memory postExecHooksForSelector) =
9393
_checkPermittedCallerAndAssociatedHooks();
9494

9595
_;
9696

97-
_doCachedPostExecHooks(postSelectorExecHooks);
98-
_doCachedPostExecHooks(postValidatorExecHooks);
97+
_doCachedPostExecHooks(postExecHooksForSelector);
98+
_doCachedPostExecHooks(postExecHooksForEntity);
9999
}
100100

101101
constructor(IEntryPoint anEntryPoint) {
@@ -115,7 +115,7 @@ contract ReferenceModularAccount is
115115
if (execModule == address(0)) {
116116
revert UnrecognizedFunction(msg.sig);
117117
}
118-
(PostExecToRun[] memory postValidatorExecHooks, PostExecToRun[] memory postSelectorExecHooks) =
118+
(PostExecToRun[] memory postExecHooksForEntity, PostExecToRun[] memory postExecHooksForSelector) =
119119
_checkPermittedCallerAndAssociatedHooks();
120120

121121
// execute the function, bubbling up any reverts
@@ -128,8 +128,8 @@ contract ReferenceModularAccount is
128128
}
129129
}
130130

131-
_doCachedPostExecHooks(postSelectorExecHooks);
132-
_doCachedPostExecHooks(postValidatorExecHooks);
131+
_doCachedPostExecHooks(postExecHooksForSelector);
132+
_doCachedPostExecHooks(postExecHooksForEntity);
133133

134134
return execReturnData;
135135
}
@@ -144,7 +144,7 @@ contract ReferenceModularAccount is
144144

145145
ModuleEntity userOpValidationFunction = ModuleEntity.wrap(bytes24(userOp.signature[:24]));
146146

147-
PostExecToRun[] memory postValidatorExecHooks =
147+
PostExecToRun[] memory postExecHooksForEntity =
148148
_doPreHooks(getAccountStorage().validationStorage[userOpValidationFunction].executionHooks, msg.data);
149149

150150
(bool success, bytes memory result) = address(this).call(userOp.callData[4:]);
@@ -156,7 +156,7 @@ contract ReferenceModularAccount is
156156
}
157157
}
158158

159-
_doCachedPostExecHooks(postValidatorExecHooks);
159+
_doCachedPostExecHooks(postExecHooksForEntity);
160160
}
161161

162162
/// @inheritdoc IModularAccount
@@ -207,8 +207,8 @@ contract ReferenceModularAccount is
207207

208208
_doRuntimeValidation(runtimeValidationFunction, data, authorization[25:]);
209209

210-
// If runtime validation passes, run exec hooks associated with the validator
211-
PostExecToRun[] memory postValidatorExecHooks =
210+
// If runtime validation passes, run exec hooks associated with the entity
211+
PostExecToRun[] memory postExecHooksForEntity =
212212
_doPreHooks(getAccountStorage().validationStorage[runtimeValidationFunction].executionHooks, data);
213213

214214
// Execute the call
@@ -220,7 +220,7 @@ contract ReferenceModularAccount is
220220
}
221221
}
222222

223-
_doCachedPostExecHooks(postValidatorExecHooks);
223+
_doCachedPostExecHooks(postExecHooksForEntity);
224224

225225
return returnData;
226226
}
@@ -365,7 +365,7 @@ contract ReferenceModularAccount is
365365
isGlobalValidation ? ValidationCheckingType.GLOBAL : ValidationCheckingType.SELECTOR
366366
);
367367

368-
// Check if there are execution hooks associated with the validator, and revert if the call isn't to
368+
// Check if there are execution hooks associated with the entity, and revert if the call isn't to
369369
// `executeUserOp`
370370
// This check must be here because if context isn't passed, we can't tell in execution which hooks should
371371
// have ran
@@ -549,16 +549,16 @@ contract ReferenceModularAccount is
549549
* directly call.
550550
* - Yes: Continue
551551
* - No: Revert, the caller is not allowed to call this selector
552-
* 3. If there are runtime validation hooks associated with this caller-sig combination, run them.
553-
* 4. Run the pre executionHooks associated with this caller-sig combination, and return the
552+
* 3. If there are runtime validation hooks associated with this entity, run them.
553+
* 4. Run the pre executionHooks associated with this entity, and return the
554554
* post executionHooks to run later.
555555
*/
556556
function _checkPermittedCallerAndAssociatedHooks()
557557
internal
558558
returns (PostExecToRun[] memory, PostExecToRun[] memory)
559559
{
560560
AccountStorage storage _storage = getAccountStorage();
561-
PostExecToRun[] memory postValidatorExecutionHooks;
561+
PostExecToRun[] memory postExecHooksForEntity;
562562

563563
// We only need to handle execution hooks when the sender is not the entry point or the account itself,
564564
// and the selector isn't public.
@@ -582,16 +582,16 @@ contract ReferenceModularAccount is
582582
_doPreRuntimeValidationHook(preRuntimeValidationHooks[i].moduleEntity(), msg.data, "");
583583
}
584584

585-
// Execution hooks associated with the validator
586-
postValidatorExecutionHooks =
585+
// Execution hooks associated with the entity
586+
postExecHooksForEntity =
587587
_doPreHooks(_storage.validationStorage[directCallValidationKey].executionHooks, msg.data);
588588
}
589589

590590
// Exec hooks associated with the selector
591-
PostExecToRun[] memory postSelectorExecutionHooks =
591+
PostExecToRun[] memory postExecHooksForSelector =
592592
_doPreHooks(_storage.executionStorage[msg.sig].executionHooks, msg.data);
593593

594-
return (postValidatorExecutionHooks, postSelectorExecutionHooks);
594+
return (postExecHooksForEntity, postExecHooksForSelector);
595595
}
596596

597597
function _execUserOpValidation(

src/helpers/Constants.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pragma solidity ^0.8.20;
44
// Index marking the start of the data for the validation function.
55
uint8 constant RESERVED_VALIDATION_DATA_INDEX = type(uint8).max;
66

7-
// Maximum number of validation-associated hooks that can be registered.
7+
// Maximum number of entity associated hooks that can be registered.
88
uint8 constant MAX_VALIDATION_ASSOC_HOOKS = type(uint8).max;
99

1010
// Magic value for the Entity ID of direct call validation.

src/interfaces/IExecutionHookModule.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ interface IExecutionHookModule is IModule {
1010
/// be more than one.
1111
/// @param sender The caller address.
1212
/// @param value The call value.
13-
/// @param data The calldata sent. For `executeUserOp` calls of validation-associated hooks, hook modules
13+
/// @param data The calldata sent. For `executeUserOp` calls of entity associated hooks, hook modules
1414
/// should receive the full calldata.
1515
/// @return Context to pass to a post execution hook, if present. An empty bytes array MAY be returned.
1616
function preExecutionHook(uint32 entityId, address sender, uint256 value, bytes calldata data)

0 commit comments

Comments
 (0)