Skip to content

Commit

Permalink
feat: start updating spec for v0.8 (#150)
Browse files Browse the repository at this point in the history
Co-authored-by: howy <[email protected]>
  • Loading branch information
adamegyed and howydev authored Aug 26, 2024
1 parent e2211d1 commit ec59fe8
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 198 deletions.
2 changes: 1 addition & 1 deletion src/account/ModuleManagerInternals.sol
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ abstract contract ModuleManagerInternals is IModularAccount {
revert ArrayLengthMismatch();
}

// Hook uninstall data is provided in the order of pre-validation hooks, then permission hooks.
// Hook uninstall data is provided in the order of pre validation hooks, then permission hooks.
uint256 hookIndex = 0;
for (uint256 i = 0; i < _validationData.preValidationHooks.length; ++i) {
bytes calldata hookData = hookUninstallDatas[hookIndex];
Expand Down
10 changes: 5 additions & 5 deletions src/account/ReferenceModularAccount.sol
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ contract ReferenceModularAccount is
}
}

// Run the pre hooks and copy their return data to the post hooks array, if an associated post-exec hook
// Run the pre hooks and copy their return data to the post hooks array, if an associated post exec hook
// exists.
for (uint256 i = 0; i < hooksLength; ++i) {
HookConfig hookConfig = toHookConfig(executionHooks.at(i));
Expand All @@ -452,7 +452,7 @@ contract ReferenceModularAccount is

preExecHookReturnData = _runPreExecHook(hookConfig.moduleEntity(), data);

// If there is an associated post-exec hook, save the return data.
// If there is an associated post exec hook, save the return data.
if (hookConfig.hasPostHook()) {
postHooksToRun[i].preExecHookReturnData = preExecHookReturnData;
}
Expand Down Expand Up @@ -523,15 +523,15 @@ contract ReferenceModularAccount is
/**
* Order of operations:
* 1. Check if the sender is the entry point, the account itself, or the selector called is public.
* - Yes: Return an empty array, there are no post-permissionHooks.
* - Yes: Return an empty array, there are no post permissionHooks.
* - No: Continue
* 2. Check if the called selector (msg.sig) is included in the set of selectors the msg.sender can
* directly call.
* - Yes: Continue
* - No: Revert, the caller is not allowed to call this selector
* 3. If there are runtime validation hooks associated with this caller-sig combination, run them.
* 4. Run the pre-permissionHooks associated with this caller-sig combination, and return the
* post-permissionHooks to run later.
* 4. Run the pre permissionHooks associated with this caller-sig combination, and return the
* post permissionHooks to run later.
*/
function _checkPermittedCallerAndAssociatedHooks()
internal
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/Constants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity ^0.8.25;
// Index marking the start of the data for the validation function.
uint8 constant RESERVED_VALIDATION_DATA_INDEX = type(uint8).max;

// Maximum number of pre-validation hooks that can be registered.
// Maximum number of pre validation hooks that can be registered.
uint8 constant MAX_PRE_VALIDATION_HOOKS = type(uint8).max;

// Magic value for the Entity ID of direct call validation.
Expand Down
6 changes: 3 additions & 3 deletions src/interfaces/IModularAccount.sol
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ interface IModularAccount {
/// @param selectors The selectors to install the validation function for.
/// @param installData Optional data to be decoded and used by the module to setup initial module state.
/// @param hooks Optional hooks to install, associated with the validation function. These may be
/// pre-validation hooks or execution hooks. The expected format is a bytes26 HookConfig, followed by the
/// pre validation hooks or execution hooks. The expected format is a bytes26 HookConfig, followed by the
/// install data, if any.
function installValidation(
ValidationConfig validationConfig,
Expand All @@ -79,8 +79,8 @@ interface IModularAccount {
/// @param uninstallData Optional data to be decoded and used by the module to clear module data for the
/// account.
/// @param hookUninstallData Optional data to be used by hooks for cleanup. If any are provided, the array must
/// be of a length equal to existing pre-validation hooks plus permission hooks. Hooks are indexed by
/// pre-validation hook order first, then permission hooks.
/// be of a length equal to existing pre validation hooks plus permission hooks. Hooks are indexed by
/// pre validation hook order first, then permission hooks.
function uninstallValidation(
ModuleEntity validationFunction,
bytes calldata uninstallData,
Expand Down
Loading

0 comments on commit ec59fe8

Please sign in to comment.