Skip to content

Commit 0fbd371

Browse files
committed
fix: review fixes
1 parent c1c2821 commit 0fbd371

File tree

6 files changed

+28
-23
lines changed

6 files changed

+28
-23
lines changed

src/account/ModuleManagerInternals.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ abstract contract ModuleManagerInternals is IModularAccount {
286286
revert ArrayLengthMismatch();
287287
}
288288

289-
// Hook uninstall data is provided in the order of pre-validation hooks, then permission hooks.
289+
// Hook uninstall data is provided in the order of pre validation hooks, then permission hooks.
290290
uint256 hookIndex = 0;
291291
for (uint256 i = 0; i < _validationData.preValidationHooks.length; ++i) {
292292
bytes calldata hookData = hookUninstallDatas[hookIndex];

src/account/ReferenceModularAccount.sol

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ contract ReferenceModularAccount is
442442
}
443443
}
444444

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

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

455-
// If there is an associated post-exec hook, save the return data.
455+
// If there is an associated post exec hook, save the return data.
456456
if (hookConfig.hasPostHook()) {
457457
postHooksToRun[i].preExecHookReturnData = preExecHookReturnData;
458458
}
@@ -523,15 +523,15 @@ contract ReferenceModularAccount is
523523
/**
524524
* Order of operations:
525525
* 1. Check if the sender is the entry point, the account itself, or the selector called is public.
526-
* - Yes: Return an empty array, there are no post-permissionHooks.
526+
* - Yes: Return an empty array, there are no post permissionHooks.
527527
* - No: Continue
528528
* 2. Check if the called selector (msg.sig) is included in the set of selectors the msg.sender can
529529
* directly call.
530530
* - Yes: Continue
531531
* - No: Revert, the caller is not allowed to call this selector
532532
* 3. If there are runtime validation hooks associated with this caller-sig combination, run them.
533-
* 4. Run the pre-permissionHooks associated with this caller-sig combination, and return the
534-
* post-permissionHooks to run later.
533+
* 4. Run the pre permissionHooks associated with this caller-sig combination, and return the
534+
* post permissionHooks to run later.
535535
*/
536536
function _checkPermittedCallerAndAssociatedHooks()
537537
internal

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.25;
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 pre-validation hooks that can be registered.
7+
// Maximum number of pre validation hooks that can be registered.
88
uint8 constant MAX_PRE_VALIDATION_HOOKS = type(uint8).max;
99

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

src/interfaces/IModularAccount.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ interface IModularAccount {
6565
/// @param selectors The selectors to install the validation function for.
6666
/// @param installData Optional data to be decoded and used by the module to setup initial module state.
6767
/// @param hooks Optional hooks to install, associated with the validation function. These may be
68-
/// pre-validation hooks or execution hooks. The expected format is a bytes26 HookConfig, followed by the
68+
/// pre validation hooks or execution hooks. The expected format is a bytes26 HookConfig, followed by the
6969
/// install data, if any.
7070
function installValidation(
7171
ValidationConfig validationConfig,
@@ -79,8 +79,8 @@ interface IModularAccount {
7979
/// @param uninstallData Optional data to be decoded and used by the module to clear module data for the
8080
/// account.
8181
/// @param hookUninstallData Optional data to be used by hooks for cleanup. If any are provided, the array must
82-
/// be of a length equal to existing pre-validation hooks plus permission hooks. Hooks are indexed by
83-
/// pre-validation hook order first, then permission hooks.
82+
/// be of a length equal to existing pre validation hooks plus permission hooks. Hooks are indexed by
83+
/// pre validation hook order first, then permission hooks.
8484
function uninstallValidation(
8585
ModuleEntity validationFunction,
8686
bytes calldata uninstallData,

standard/ERCs/erc-6900.md

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ requires: 165, 4337
1313

1414
## Abstract
1515

16-
This proposal standardizes smart contract accounts and account modules, which are smart contract interfaces that allow for composable logic within smart contract accounts. This proposal is compliant with [ERC-4337](./eip-4337.md). This standard emphasizes secure permissioning of modules, and maximal interoperability between all spec compliant accounts and modules.
16+
This proposal standardizes smart contract accounts and account modules, which are smart contract interfaces that allow for composable logic within smart contract accounts. This proposal is compliant with [ERC-4337](./eip-4337.md). This standard emphasizes secure permissioning of modules, and maximal interoperability between all spec-compliant accounts and modules.
1717

1818
This modular approach splits account functionality into three categories, implements them in external contracts, and defines an expected execution flow from accounts.
1919

@@ -29,7 +29,7 @@ We propose a standard that coordinates the implementation work between module de
2929

3030
![diagram showing relationship between accounts and modules with modular functions](../assets/eip-6900/MSCA_Shared_Components_Diagram.svg)
3131

32-
These modules can contain execution logic, validation functions, and hooks. Validation functions define the circumstances under which the smart contract account will approve actions taken on its behalf, while hooks allow for pre- and post-execution controls.
32+
These modules can contain execution logic, validation functions, and hooks. Validation functions define the circumstances under which the smart contract account will approve actions taken on its behalf, while hooks allow for pre and post execution controls.
3333

3434
Accounts adopting this standard will support modular, upgradable execution and validation logic. Defining this as a standard for smart contract accounts will make modules easier to develop securely and will allow for greater interoperability.
3535

@@ -45,8 +45,8 @@ The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "S
4545
- **Execution functions** execute custom logic allowed by the account.
4646
- **Hooks** execute custom logic and checks before and/or after an execution function or validation function.
4747
There are two types of hooks:
48-
- **Validation Hook** functions run before a validation function. These can enforce permissions on actions authorized by a validation function.
49-
- **Execution Hook** functions run can run before and/or after an execution function. The pre execution hook may optionally return data to be consumed by a post execution hook functions.
48+
- **Validation hook** functions run before a validation function. These can enforce permissions on actions authorized by a validation function.
49+
- **Execution hook** functions run can run before and/or after an execution function. The pre execution hook may optionally return data to be consumed by a post execution hook functions.
5050
- A **native function** refers to a function implemented by the modular account, as opposed to a function added by a module.
5151
- A **module** is a deployed smart contract that hosts any amount of the above three kinds of modular functions.
5252
- A module **manifest** describes the execution functions, interface ids, and hooks that should be installed on the account.
@@ -67,8 +67,7 @@ Each step is modular, supporting different implementations, that allows for open
6767

6868
- `IAccount.sol` from [ERC-4337](./eip-4337.md).
6969
- `IAccountExecute.sol` from [ERC-4337](./eip-4337.md).
70-
- `IModularAccount.sol` to support installing and uninstalling modules.
71-
- `IStandardExecutor.sol` to support open-ended execution.
70+
- `IModularAccount.sol` to support module management and usage, and account identification.
7271

7372
**Modular Smart Contract Accounts** **MAY** implement
7473

@@ -154,7 +153,7 @@ interface IModularAccount {
154153
/// @param selectors The selectors to install the validation function for.
155154
/// @param installData Optional data to be decoded and used by the module to setup initial module state.
156155
/// @param hooks Optional hooks to install, associated with the validation function. These may be
157-
/// pre-validation hooks or execution hooks. The expected format is a bytes26 HookConfig, followed by the
156+
/// pre validation hooks or execution hooks. The expected format is a bytes26 HookConfig, followed by the
158157
/// install data, if any.
159158
function installValidation(
160159
ValidationConfig validationConfig,
@@ -168,8 +167,8 @@ interface IModularAccount {
168167
/// @param uninstallData Optional data to be decoded and used by the module to clear module data for the
169168
/// account.
170169
/// @param hookUninstallData Optional data to be used by hooks for cleanup. If any are provided, the array must
171-
/// be of a length equal to existing pre-validation hooks plus permission hooks. Hooks are indexed by
172-
/// pre-validation hook order first, then permission hooks.
170+
/// be of a length equal to existing pre validation hooks plus permission hooks. Hooks are indexed by
171+
/// pre validation hook order first, then permission hooks.
173172
function uninstallValidation(
174173
ModuleEntity validationFunction,
175174
bytes calldata uninstallData,
@@ -186,6 +185,12 @@ interface IModularAccount {
186185
ExecutionManifest calldata manifest,
187186
bytes calldata moduleUninstallData
188187
) external;
188+
189+
/// @notice Return a unique identifier for the account implementation.
190+
/// @dev This function MUST return a string in the format "vendor.account.semver". The vendor and account
191+
/// names MUST NOT contain a period character.
192+
/// @return The account ID.
193+
function accountId() external view returns (string memory);
189194
}
190195
191196
```
@@ -583,7 +588,7 @@ The modular smart contract accounts themselves are trusted components. Installed
583588

584589
Users should perform careful due diligence before installing a module and should be mindful of the fact that modules are potentially dangerous. The module's manifest can give users an understanding of the potential risks they are exposed to for that particular module. For instance, a request to install certain validation functions and/or hooks on certain execution selectors could potentially be a vector for DOS.
585590

586-
Execution hooks have no awareness of other execution hooks being performed in the same function selector execution setting. Since execution hooks can perform state changes, this reveals an important security consideration: An execution hook can only assure that at the time of its own execution, certain conditions are met, but this can not be generalized to the entire pre-execution context of potentially multiple pre-execution hooks. For example, a pre-execution hook cannot be assured that the storage it performed validation upon does not get further updated in subsequent pre-execution hooks. Even a post-execution hook potentially repeating the validation cannot assure that the storage remains unmodified because a prior post-execution hook may have reset the state. As long as the requirements checked by a module as part of an execution hook are only modifiable by the module itself, this can be considered safe.
591+
Execution hooks have no awareness of other execution hooks being performed in the same function selector execution setting. Since execution hooks can perform state changes, this reveals an important security consideration: An execution hook can only assure that at the time of its own execution, certain conditions are met, but this can not be generalized to the entire pre execution context of potentially multiple pre execution hooks. For example, a pre execution hook cannot be assured that the storage it performed validation upon does not get further updated in subsequent pre execution hooks. Even a post execution hook potentially repeating the validation cannot assure that the storage remains unmodified because a prior post execution hook may have reset the state. As long as the requirements checked by a module as part of an execution hook are only modifiable by the module itself, this can be considered safe.
587592

588593
## Copyright
589594

test/utils/AccountTestBase.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ abstract contract AccountTestBase is OptimizedTest {
229229
return sig;
230230
}
231231

232-
// overload for the case where there are no pre-validation hooks
232+
// overload for the case where there are no pre validation hooks
233233
function _encodeSignature(ModuleEntity validationFunction, uint8 globalOrNot, bytes memory validationData)
234234
internal
235235
pure
@@ -239,7 +239,7 @@ abstract contract AccountTestBase is OptimizedTest {
239239
return _encodeSignature(validationFunction, globalOrNot, emptyPreValidationHookData, validationData);
240240
}
241241

242-
// overload for the case where there are no pre-validation hooks
242+
// overload for the case where there are no pre validation hooks
243243
function _encode1271Signature(ModuleEntity validationFunction, bytes memory validationData)
244244
internal
245245
pure
@@ -249,7 +249,7 @@ abstract contract AccountTestBase is OptimizedTest {
249249
return _encode1271Signature(validationFunction, emptyPreValidationHookData, validationData);
250250
}
251251

252-
// helper function to pack pre-validation hook datas, according to the sparse calldata segment spec.
252+
// helper function to pack pre validation hook datas, according to the sparse calldata segment spec.
253253
function _packPreHookDatas(PreValidationHookData[] memory preValidationHookData)
254254
internal
255255
pure

0 commit comments

Comments
 (0)