Skip to content

Commit

Permalink
fix: v0.8 review and polish (#186)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaypaik authored Oct 1, 2024
1 parent 0bb2bfa commit 64ddec2
Show file tree
Hide file tree
Showing 5 changed files with 128 additions and 131 deletions.
2 changes: 1 addition & 1 deletion src/interfaces/IExecutionHookModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface IExecutionHookModule is IModule {
/// be more than one.
/// @param sender The caller address.
/// @param value The call value.
/// @param data The calldata sent.
/// @param data The calldata sent. For `executeUserOp` calls, hook modules should receive the full msg.data.
/// @return Context to pass to a post execution hook, if present. An empty bytes array MAY be returned.
function preExecutionHook(uint32 entityId, address sender, uint256 value, bytes calldata data)
external
Expand Down
52 changes: 24 additions & 28 deletions src/interfaces/IModularAccount.sol
Original file line number Diff line number Diff line change
Expand Up @@ -66,34 +66,40 @@ interface IModularAccount {
/// @return An array containing the return data from the calls.
function executeBatch(Call[] calldata calls) external payable returns (bytes[] memory);

/// @notice Execute a call using a specified runtime validation.
/// @notice Execute a call using the specified runtime validation.
/// @param data The calldata to send to the account.
/// @param authorization The authorization data to use for the call. The first 24 bytes specifies which runtime
/// validation to use, and the rest is sent as a parameter to runtime validation.
/// @param authorization The authorization data to use for the call. The first 24 bytes is a ModuleEntity which
/// specifies which runtime validation to use, and the rest is sent as a parameter to runtime validation.
function executeWithRuntimeValidation(bytes calldata data, bytes calldata authorization)
external
payable
returns (bytes memory);

/// @notice Install a module to the modular account.
/// @param module The module to install.
/// @param manifest the manifest describing functions to install
/// @param moduleInstallData Optional data to be used by the account to handle the initial execution setup,
/// data encoding is implementation-specific.
function installExecution(
address module,
ExecutionManifest calldata manifest,
bytes calldata moduleInstallData
) external;
/// @param manifest the manifest describing functions to install.
/// @param installData Optional data to be used by the account to handle the initial execution setup. Data
/// encoding
/// is implementation-specific.
function installExecution(address module, ExecutionManifest calldata manifest, bytes calldata installData)
external;

/// @notice Uninstall a module from the modular account.
/// @param module The module to uninstall.
/// @param manifest the manifest describing functions to uninstall.
/// @param uninstallData Optional data to be used by the account to handle the execution uninstallation. Data
/// encoding is implementation-specific.
function uninstallExecution(address module, ExecutionManifest calldata manifest, bytes calldata uninstallData)
external;

/// @notice Installs a validation function across a set of execution selectors, and optionally mark it as a
/// global validation.
/// global validation function.
/// @dev This does not validate anything against the manifest - the caller must ensure validity.
/// @param validationConfig The validation function to install, along with configuration flags.
/// @param selectors The selectors to install the validation function for.
/// @param installData Optional data to be used by the account to handle the initial validation setup, data
/// @param installData Optional data to be used by the account to handle the initial validation setup. Data
/// encoding is implementation-specific.
/// @param hooks Optional hooks to install and associate with the validation function, data encoding is
/// @param hooks Optional hooks to install and associate with the validation function. Data encoding is
/// implementation-specific.
function installValidation(
ValidationConfig validationConfig,
Expand All @@ -104,27 +110,17 @@ interface IModularAccount {

/// @notice Uninstall a validation function from a set of execution selectors.
/// @param validationFunction The validation function to uninstall.
/// @param uninstallData Optional data to be used by the account to handle the validation uninstallation, data
/// encoding is implementation-specific.
/// @param hookUninstallData Optional data to be used by the account to handle hook uninstallation, data
/// @param uninstallData Optional data to be used by the account to handle the validation uninstallation. Data
/// encoding is implementation-specific.
/// @param hookUninstallData Optional data to be used by the account to handle hook uninstallation. Data
/// encoding
/// is implementation-specific.
function uninstallValidation(
ModuleEntity validationFunction,
bytes calldata uninstallData,
bytes[] calldata hookUninstallData
) external;

/// @notice Uninstall a module from the modular account.
/// @param module The module to uninstall.
/// @param manifest the manifest describing functions to uninstall.
/// @param moduleUninstallData Optional data to be used by the account to handle the execution uninstallation,
/// data encoding is implementation-specific.
function uninstallExecution(
address module,
ExecutionManifest calldata manifest,
bytes calldata moduleUninstallData
) external;

/// @notice Return a unique identifier for the account implementation.
/// @dev This function MUST return a string in the format "vendor.account.semver". The vendor and account
/// names MUST NOT contain a period character.
Expand Down
12 changes: 6 additions & 6 deletions src/interfaces/IModularAccountView.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity ^0.8.20;

import {HookConfig, ModuleEntity} from "../interfaces/IModularAccount.sol";

// Represents data associated with a specifc function selector.
/// @dev Represents data associated with a specific function selector.
struct ExecutionDataView {
// The module that implements this execution function.
// If this is a native function, the address must remain address(0).
Expand All @@ -20,9 +20,9 @@ struct ExecutionDataView {
}

struct ValidationDataView {
// Whether or not this validation can be used as a global validation function.
// Whether or not this validation function can be used as a global validation function.
bool isGlobal;
// Whether or not this validation is a signature validator.
// Whether or not this validation function is a signature validator.
bool isSignatureValidation;
// Whether or not this validation is a user operation validator.
bool isUserOpValidation;
Expand All @@ -38,13 +38,13 @@ interface IModularAccountView {
/// @notice Get the execution data for a selector.
/// @dev If the selector is a native function, the module address will be the address of the account.
/// @param selector The selector to get the data for.
/// @return ExecutionData The module address for this selector.
/// @return The execution data for this selector.
function getExecutionData(bytes4 selector) external view returns (ExecutionDataView memory);

/// @notice Get the validation data for a validation.
/// @notice Get the validation data for a validation function.
/// @dev If the selector is a native function, the module address will be the address of the account.
/// @param validationFunction The validation function to get the data for.
/// @return ValidationData The module address for this selector.
/// @return The validation data for this validation function.
function getValidationData(ModuleEntity validationFunction)
external
view
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/IValidationModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ interface IValidationModule is IModule {
/// @param sender the address that sent the ERC-1271 request to the smart account
/// @param hash the hash of the ERC-1271 request
/// @param signature the signature of the ERC-1271 request
/// @return the ERC-1271 `MAGIC_VALUE` if the signature is valid, or 0xFFFFFFFF if invalid.
/// @return The ERC-1271 `MAGIC_VALUE` if the signature is valid, or 0xFFFFFFFF if invalid.
function validateSignature(
address account,
uint32 entityId,
Expand Down
Loading

0 comments on commit 64ddec2

Please sign in to comment.