You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: standard/ERCs/erc-6900.md
+47-40Lines changed: 47 additions & 40 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -90,12 +90,37 @@ Each step is modular, supporting different implementations, that allows for open
90
90
Module execution and management interface. Modular Smart Contract Accounts **MUST** implement this interface to support installing and uninstalling modules, and open-ended execution.
91
91
92
92
```solidity
93
-
93
+
/// A packed representation of a module function.
94
+
/// Consists of the following, left-aligned:
95
+
/// Module address: 20 bytes
96
+
/// Entity ID: 4 bytes
94
97
type ModuleEntity is bytes24;
95
98
96
-
type ValidationConfig is bytes26;
97
-
98
-
type HookConfig is bytes26;
99
+
/// A packed representation of a validation function and its associated flags.
100
+
/// Consists of the following, left-aligned:
101
+
/// Module address: 20 bytes
102
+
/// Entity ID: 4 bytes
103
+
/// Flags: 1 byte
104
+
///
105
+
/// Validation flags layout:
106
+
/// 0b00000___ // unused
107
+
/// 0b_____A__ // isGlobal
108
+
/// 0b______B_ // isSignatureValidation
109
+
/// 0b_______C // isUserOpValidation
110
+
type ValidationConfig is bytes25;
111
+
112
+
/// A packed representation of a hook function and its associated flags.
113
+
/// Consists of the following, left-aligned:
114
+
/// Module address: 20 bytes
115
+
/// Entity ID: 4 bytes
116
+
/// Flags: 1 byte
117
+
///
118
+
/// Hook flags layout:
119
+
/// 0b00000___ // unused
120
+
/// 0b_____A__ // hasPre (exec only)
121
+
/// 0b______B_ // hasPost (exec only)
122
+
/// 0b_______C // hook type (0 for exec, 1 for validation)
123
+
type HookConfig is bytes25;
99
124
100
125
struct Call {
101
126
// The target address for the account to call.
@@ -137,9 +162,9 @@ interface IModularAccount {
137
162
138
163
/// @notice Install a module to the modular account.
139
164
/// @param module The module to install.
140
-
/// @param manifest the manifest describing functions to install
141
-
/// @param moduleInstallData Optional data to be decoded and used by the module to setup initial module data
142
-
/// for the modular account.
165
+
/// @param manifest the manifest describing functions to install.
166
+
/// @param moduleInstallData Optional data to be used by the account to handle the initial execution setup,
167
+
/// data encoding is implementation-specific.
143
168
function installExecution(
144
169
address module,
145
170
ExecutionManifest calldata manifest,
@@ -151,10 +176,10 @@ interface IModularAccount {
151
176
/// @dev This does not validate anything against the manifest - the caller must ensure validity.
152
177
/// @param validationConfig The validation function to install, along with configuration flags.
153
178
/// @param selectors The selectors to install the validation function for.
154
-
/// @param installData Optional data to be decoded and used by the module to setup initial module state.
155
-
/// @param hooks Optional hooks to install, associated with the validation function. These may be
156
-
/// pre validation hooks or execution hooks. The expected format is a bytes26 HookConfig, followed by the
157
-
/// install data, if any.
179
+
/// @param installData Optional data to be used by the account to handle the initial validation setup, data
180
+
/// encoding is implementation-specific.
181
+
/// @param hooks Optional hooks to install and associate with the validation function, data encoding is
182
+
/// implementation-specific.
158
183
function installValidation(
159
184
ValidationConfig validationConfig,
160
185
bytes4[] calldata selectors,
@@ -164,11 +189,10 @@ interface IModularAccount {
164
189
165
190
/// @notice Uninstall a validation function from a set of execution selectors.
166
191
/// @param validationFunction The validation function to uninstall.
167
-
/// @param uninstallData Optional data to be decoded and used by the module to clear module data for the
168
-
/// account.
169
-
/// @param hookUninstallData Optional data to be used by hooks for cleanup. If any are provided, the array must
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.
192
+
/// @param uninstallData Optional data to be used by the account to handle the validation uninstallation, data
193
+
/// encoding is implementation-specific.
194
+
/// @param hookUninstallData Optional data to be used by the account to handle hook uninstallation, data encoding
195
+
/// is implementation-specific.
172
196
function uninstallValidation(
173
197
ModuleEntity validationFunction,
174
198
bytes calldata uninstallData,
@@ -178,8 +202,8 @@ interface IModularAccount {
178
202
/// @notice Uninstall a module from the modular account.
179
203
/// @param module The module to uninstall.
180
204
/// @param manifest the manifest describing functions to uninstall.
181
-
/// @param moduleUninstallData Optional data to be decoded and used by the module to clear module data for the
182
-
/// modular account.
205
+
/// @param moduleUninstallData Optional data to be used by the account to handle the execution uninstallation, data
206
+
/// encoding is implementation-specific.
183
207
function uninstallExecution(
184
208
address module,
185
209
ExecutionManifest calldata manifest,
@@ -378,20 +402,17 @@ interface IValidationHookModule is IModule {
378
402
bytes calldata authorization
379
403
) external;
380
404
381
-
// TODO: support this hook type within the account & in the manifest
382
-
383
405
/// @notice Run the pre signature validation hook specified by the `entityId`.
384
406
/// @dev To indicate the call should revert, the function MUST revert.
385
407
/// @param entityId An identifier that routes the call to different internal implementations, should there
386
408
/// be more than one.
387
409
/// @param sender The caller address.
388
410
/// @param hash The hash of the message being signed.
389
411
/// @param signature The signature of the message.
390
-
// function preSignatureValidationHook(uint32 entityId, address sender, bytes32 hash, bytes calldata
391
-
// signature)
392
-
// external
393
-
// view
394
-
// returns (bytes4);
412
+
function preSignatureValidationHook(uint32 entityId, address sender, bytes32 hash, bytes calldata signature)
413
+
external
414
+
view
415
+
returns (bytes4);
395
416
}
396
417
```
397
418
@@ -462,8 +483,6 @@ interface IExecutionHookModule is IModule {
462
483
463
484
### Expected behavior
464
485
465
-
TODO for v0.8
466
-
467
486
#### Validations and their installation /uninstallation
468
487
469
488
An account can have more than one validation module/function installed.
@@ -509,18 +528,6 @@ During execution uninstallation, the account MUST correctly clear flags and othe
509
528
- the account SHOULD call `onUnInstall` on the execution module to initialize the states and track call success if required by user.
510
529
- the account MUST emit `ExecutionUninstalled` as defined in the interface for all uninstalled executions.
511
530
512
-
#### Responsibilties of `StandardExecutor` and `ModuleExecutor`
513
-
514
-
`StandardExecutor` functions are used for open-ended calls to external addresses.
515
-
516
-
`ModuleExecutor` functions are specifically used by modules to request the account to execute with account's context. Explicit permissions are required for modules to use `ModuleExecutor`.
517
-
518
-
The following behavior MUST be followed:
519
-
520
-
-`StandardExecutor` can NOT call module execution functions and/or `ModuleExecutor`. This is guaranteed by checking whether the call's target implements the `IModule` interface via ERC-165 as required.
521
-
-`StandardExecutor` can NOT be called by module execution functions and/or `ModuleExecutor`.
522
-
- Module execution functions MUST NOT request access to `StandardExecutor`, they MAY request access to `ModuleExecutor`.
523
-
524
531
### Validation Call Flow
525
532
526
533
Modular accounts support three different calls flows for validation: user op validation, runtime validation, and signature validation. User op validation happens within the account's implementation of the function `validateUserOp`, defined in the ERC-4337 interface `IAccount`. Runtime validation happens through the dispatcher function `executeWithAuthorization`, or when using direct call validation. Signature validation happens within the account's implementation of the function `isValidSignature`, defined in ERC-1271.
@@ -569,7 +576,7 @@ Module execution functions where the field `isPublic` is set to true, or native
569
576
570
577
### Extension
571
578
572
-
#### Semi-modular account
579
+
#### Semi-Modular Account
573
580
574
581
Account implementers MAY choose to design a semi-modular account, where certain features, such as default validation, are integrated into the core account. This approach SHOULD ensure compatibility with fully modular accounts, as defined in this proposal, to maintain interoperability across different implementations.
0 commit comments