Skip to content

Commit 25a25f2

Browse files
committed
feat: rename executeWithAuthorization to executeWithRuntimeValidation (#184)
1 parent 307639c commit 25a25f2

17 files changed

+50
-45
lines changed

src/account/ReferenceModularAccount.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ contract ReferenceModularAccount is
184184
}
185185

186186
/// @inheritdoc IModularAccount
187-
function executeWithAuthorization(bytes calldata data, bytes calldata authorization)
187+
function executeWithRuntimeValidation(bytes calldata data, bytes calldata authorization)
188188
external
189189
payable
190190
returns (bytes memory)
@@ -704,7 +704,7 @@ contract ReferenceModularAccount is
704704
// To prevent arbitrarily-deep recursive checking, we limit the depth of self-calls to one
705705
// for the purposes of batching.
706706
// This means that all self-calls must occur at the top level of the batch.
707-
// Note that modules of other contracts using `executeWithAuthorization` may still
707+
// Note that modules of other contracts using `executeWithRuntimeValidation` may still
708708
// independently call into this account with a different validation function, allowing
709709
// composition of multiple batches.
710710
revert SelfCallRecursionDepthExceeded();

src/helpers/KnownSelectors.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ library KnownSelectors {
2828
|| selector == IModularAccount.installValidation.selector
2929
|| selector == IModularAccount.uninstallValidation.selector || selector == IModularAccount.execute.selector
3030
|| selector == IModularAccount.executeBatch.selector
31-
|| selector == IModularAccount.executeWithAuthorization.selector
31+
|| selector == IModularAccount.executeWithRuntimeValidation.selector
3232
|| selector == IModularAccount.accountId.selector
3333
// check against IERC165 methods
3434
|| selector == IERC165.supportsInterface.selector

src/interfaces/IModularAccount.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ interface IModularAccount {
7070
/// @param data The calldata to send to the account.
7171
/// @param authorization The authorization data to use for the call. The first 24 bytes specifies which runtime
7272
/// validation to use, and the rest is sent as a parameter to runtime validation.
73-
function executeWithAuthorization(bytes calldata data, bytes calldata authorization)
73+
function executeWithRuntimeValidation(bytes calldata data, bytes calldata authorization)
7474
external
7575
payable
7676
returns (bytes memory);

src/interfaces/IValidationHookModule.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ interface IValidationHookModule is IModule {
2424
/// @param sender The caller address.
2525
/// @param value The call value.
2626
/// @param data The calldata sent.
27+
/// @param authorization Additional data for the hook to use.
2728
function preRuntimeValidationHook(
2829
uint32 entityId,
2930
address sender,

standard/ERCs/erc-6900.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ interface IModularAccount {
154154
/// @param data The calldata to send to the account.
155155
/// @param authorization The authorization data to use for the call. The first 24 bytes specifies which runtime
156156
/// validation to use, and the rest is sent as a parameter to runtime validation.
157-
function executeWithAuthorization(bytes calldata data, bytes calldata authorization)
157+
function executeWithRuntimeValidation(bytes calldata data, bytes calldata authorization)
158158
external
159159
payable
160160
returns (bytes memory);
@@ -372,6 +372,7 @@ interface IValidationHookModule is IModule {
372372
/// @param sender The caller address.
373373
/// @param value The call value.
374374
/// @param data The calldata sent.
375+
/// @param authorization Additional data for the hook to use.
375376
function preRuntimeValidationHook(
376377
uint32 entityId,
377378
address sender,
@@ -517,18 +518,19 @@ During execution uninstallation, the account MUST correctly clear flags and othe
517518
#### Execution Hooks Data Format
518519

519520
For accounts that implement execution hooks, accounts MUST conform to these execution hook formats:
521+
520522
1. For `executeUserOp` calls, for execution hooks associated with a validation function, accounts MUST send the full `msg.data`, including the `executeUserOp` selector.
521523
2. For `executeUserOp` calls, for execution hooks associated with a selector, accounts MUST send `PackedUserOperation.callData` for `executeUserOp` calls, excluding `executeUserOp.selector` and the rest of the `PackedUserOperation`.
522-
3. For `executeWithAuthorization` calls, for all execution hooks, accounts MUST send the inner `data`.
523-
4. For all other calls, for execution hooks associated with a selector, accounts MUST send over `msg.data`.
524+
3. For `executeWithRuntimeValidation` calls, for all execution hooks, accounts MUST send the inner `data`.
525+
4. For all other calls, for execution hooks associated with a selector, accounts MUST send over `msg.data`.
524526

525527
#### Hook Execution Order
526528

527529
It is RECOMMENDED that an account implementer runs hooks in first installed first executed order. However, an account MAY implement a different execution order.
528530

529531
### Validation Call Flow
530532

531-
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.
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 `executeWithRuntimeValidation`, or when using direct call validation. Signature validation happens within the account's implementation of the function `isValidSignature`, defined in ERC-1271.
532534

533535
For each of these validation types, an account implementation MAY specify its own format for selecting which validation function to use, as well as any per-hook data for validation hooks.
534536

@@ -552,13 +554,13 @@ Installed validations have two flag variables indicating what they may be used f
552554

553555
#### Direct Call Validation
554556

555-
If a validation function is installed with the entity ID of `0xffffffff`, it may be used as direct call validation. This occurs when a module or other address calls a function on the modular account, without wrapping its call in the dispatcher function `executeWithAuthorization` to use as a selection mechanism for a runtime validation function.
557+
If a validation function is installed with the entity ID of `0xffffffff`, it may be used as direct call validation. This occurs when a module or other address calls a function on the modular account, without wrapping its call in the dispatcher function `executeWithRuntimeValidation` to use as a selection mechanism for a runtime validation function.
556558

557559
To implement direct call validation, the modular account MUST treat direct function calls that are not from the modular account itself or the EntryPoint as an attempt to validate using the caller's address and the entity ID of `0xffffffff`. If such a validation function is installed, and applies to the function intended to be called, the modular account MUST allow it to continue, without performing runtime validation. Any pre validation hooks and execution hooks installed to this validation function MUST still run.
558560

559561
### Execution Call Flow
560562

561-
For all non-view functions within `IModularAccount` except `executeWithAuthorization`, all module-defined execution functions, and any additional native functions that the modular account MAY wish to include, the modular account MUST adhere to these steps during execution:
563+
For all non-view functions within `IModularAccount` except `executeWithRuntimeValidation`, all module-defined execution functions, and any additional native functions that the modular account MAY wish to include, the modular account MUST adhere to these steps during execution:
562564

563565
If the caller is not the EntryPoint or the account, the account MUST check access control for direct call validation.
564566

test/account/AccountReturnData.t.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ contract AccountReturnDataTest is AccountTestBase {
6262

6363
// Tests the ability to read the results of contracts called via IModularAccount.execute
6464
function test_returnData_singular_execute() public {
65-
bytes memory returnData = account1.executeWithAuthorization(
65+
bytes memory returnData = account1.executeWithRuntimeValidation(
6666
abi.encodeCall(
6767
account1.execute,
6868
(address(regularResultContract), 0, abi.encodeCall(RegularResultContract.foo, ()))
@@ -89,7 +89,7 @@ contract AccountReturnDataTest is AccountTestBase {
8989
data: abi.encodeCall(RegularResultContract.bar, ())
9090
});
9191

92-
bytes memory retData = account1.executeWithAuthorization(
92+
bytes memory retData = account1.executeWithRuntimeValidation(
9393
abi.encodeCall(account1.executeBatch, (calls)),
9494
_encodeSignature(_signerValidation, GLOBAL_VALIDATION, "")
9595
);
@@ -110,7 +110,7 @@ contract AccountReturnDataTest is AccountTestBase {
110110
assertTrue(result);
111111
}
112112

113-
// Tests the ability to read data via executeWithAuthorization
113+
// Tests the ability to read data via executeWithRuntimeValidation
114114
function test_returnData_authorized_exec() public {
115115
bool result = ResultConsumerModule(address(account1)).checkResultExecuteWithAuthorization(
116116
address(regularResultContract), keccak256("bar")

test/account/GlobalValidationTest.t.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ contract GlobalValidationTest is AccountTestBase {
6464
factory.createAccount(owner2, 0);
6565

6666
vm.prank(owner2);
67-
account2.executeWithAuthorization(
67+
account2.executeWithRuntimeValidation(
6868
abi.encodeCall(ReferenceModularAccount.execute, (ethRecipient, 1 wei, "")),
6969
_encodeSignature(_signerValidation, GLOBAL_VALIDATION, "")
7070
);

test/account/MultiValidation.t.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@ contract MultiValidationTest is AccountTestBase {
6868
abi.encodeWithSignature("NotAuthorized()")
6969
)
7070
);
71-
account1.executeWithAuthorization(
71+
account1.executeWithRuntimeValidation(
7272
abi.encodeCall(IModularAccount.execute, (address(0), 0, "")),
7373
_encodeSignature(
7474
ModuleEntityLib.pack(address(validator2), TEST_DEFAULT_VALIDATION_ENTITY_ID), GLOBAL_VALIDATION, ""
7575
)
7676
);
7777

7878
vm.prank(owner2);
79-
account1.executeWithAuthorization(
79+
account1.executeWithRuntimeValidation(
8080
abi.encodeCall(IModularAccount.execute, (address(0), 0, "")),
8181
_encodeSignature(
8282
ModuleEntityLib.pack(address(validator2), TEST_DEFAULT_VALIDATION_ENTITY_ID), GLOBAL_VALIDATION, ""

test/account/PerHookData.t.sol

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ contract PerHookDataTest is CustomValidationTestBase {
281281
preValidationHookData[0] = PreValidationHookData({index: 0, validationData: abi.encodePacked(_counter)});
282282

283283
vm.prank(owner1);
284-
account1.executeWithAuthorization(
284+
account1.executeWithRuntimeValidation(
285285
abi.encodeCall(
286286
ReferenceModularAccount.execute, (address(_counter), 0 wei, abi.encodeCall(Counter.increment, ()))
287287
),
@@ -307,7 +307,7 @@ contract PerHookDataTest is CustomValidationTestBase {
307307
abi.encodeWithSignature("Error(string)", "Proof doesn't match target")
308308
)
309309
);
310-
account1.executeWithAuthorization(
310+
account1.executeWithRuntimeValidation(
311311
abi.encodeCall(
312312
ReferenceModularAccount.execute, (address(_counter), 0 wei, abi.encodeCall(Counter.increment, ()))
313313
),
@@ -325,7 +325,7 @@ contract PerHookDataTest is CustomValidationTestBase {
325325
abi.encodeWithSignature("Error(string)", "Proof doesn't match target")
326326
)
327327
);
328-
account1.executeWithAuthorization(
328+
account1.executeWithRuntimeValidation(
329329
abi.encodeCall(
330330
ReferenceModularAccount.execute, (address(_counter), 0 wei, abi.encodeCall(Counter.increment, ()))
331331
),
@@ -342,7 +342,7 @@ contract PerHookDataTest is CustomValidationTestBase {
342342
vm.expectRevert(
343343
abi.encodeWithSelector(SparseCalldataSegmentLib.ValidationSignatureSegmentMissing.selector)
344344
);
345-
account1.executeWithAuthorization(
345+
account1.executeWithRuntimeValidation(
346346
abi.encodeCall(
347347
ReferenceModularAccount.execute, (address(_counter), 0 wei, abi.encodeCall(Counter.increment, ()))
348348
),
@@ -360,7 +360,7 @@ contract PerHookDataTest is CustomValidationTestBase {
360360
preValidationHookData[1] = PreValidationHookData({index: 1, validationData: abi.encodePacked(_counter)});
361361

362362
vm.prank(owner1);
363-
account1.executeWithAuthorization(
363+
account1.executeWithRuntimeValidation(
364364
abi.encodeCall(
365365
ReferenceModularAccount.execute, (address(_counter), 0 wei, abi.encodeCall(Counter.increment, ()))
366366
),
@@ -379,7 +379,7 @@ contract PerHookDataTest is CustomValidationTestBase {
379379

380380
vm.prank(owner1);
381381
vm.expectRevert(abi.encodeWithSelector(SparseCalldataSegmentLib.SegmentOutOfOrder.selector));
382-
account1.executeWithAuthorization(
382+
account1.executeWithRuntimeValidation(
383383
abi.encodeCall(
384384
ReferenceModularAccount.execute, (address(_counter), 0 wei, abi.encodeCall(Counter.increment, ()))
385385
),
@@ -400,7 +400,7 @@ contract PerHookDataTest is CustomValidationTestBase {
400400
abi.encodeWithSignature("Error(string)", "Target not allowed")
401401
)
402402
);
403-
account1.executeWithAuthorization(
403+
account1.executeWithRuntimeValidation(
404404
abi.encodeCall(ReferenceModularAccount.execute, (beneficiary, 1 wei, "")),
405405
_encodeSignature(_signerValidation, GLOBAL_VALIDATION, preValidationHookData, "")
406406
);
@@ -412,7 +412,7 @@ contract PerHookDataTest is CustomValidationTestBase {
412412

413413
vm.prank(owner1);
414414
vm.expectRevert(abi.encodeWithSelector(SparseCalldataSegmentLib.NonCanonicalEncoding.selector));
415-
account1.executeWithAuthorization(
415+
account1.executeWithRuntimeValidation(
416416
abi.encodeCall(
417417
ReferenceModularAccount.execute, (address(_counter), 0 wei, abi.encodeCall(Counter.increment, ()))
418418
),
@@ -426,7 +426,7 @@ contract PerHookDataTest is CustomValidationTestBase {
426426

427427
vm.prank(owner1);
428428
vm.expectRevert(abi.encodeWithSelector(SparseCalldataSegmentLib.NonCanonicalEncoding.selector));
429-
account1.executeWithAuthorization(
429+
account1.executeWithRuntimeValidation(
430430
abi.encodeCall(
431431
ReferenceModularAccount.execute, (address(_counter), 0 wei, abi.encodeCall(Counter.increment, ()))
432432
),

test/account/ReferenceModularAccount.t.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ contract ReferenceModularAccountTest is AccountTestBase {
497497

498498
//show working rt validation
499499
vm.startPrank(address(owner1));
500-
account1.executeWithAuthorization(
500+
account1.executeWithRuntimeValidation(
501501
abi.encodeCall(ReferenceModularAccount.execute, (ethRecipient, 1 wei, "")),
502502
_encodeSignature(
503503
ModuleEntityLib.pack(address(singleSignerValidationModule), newEntityId), GLOBAL_VALIDATION, ""

0 commit comments

Comments
 (0)