diff --git a/src/account/AccountLoupe.sol b/src/account/AccountLoupe.sol index 803d075d..ff451712 100644 --- a/src/account/AccountLoupe.sol +++ b/src/account/AccountLoupe.sol @@ -2,14 +2,12 @@ pragma solidity ^0.8.25; import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol"; - import {EnumerableMap} from "@openzeppelin/contracts/utils/structs/EnumerableMap.sol"; import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import {HookConfigLib} from "../helpers/HookConfigLib.sol"; import {ExecutionDataView, IAccountLoupe, ValidationDataView} from "../interfaces/IAccountLoupe.sol"; -import {HookConfig, IModuleManager, ModuleEntity} from "../interfaces/IModuleManager.sol"; -import {IStandardExecutor} from "../interfaces/IStandardExecutor.sol"; +import {HookConfig, IModularAccount, ModuleEntity} from "../interfaces/IModularAccount.sol"; import {ExecutionData, ValidationData, getAccountStorage} from "./AccountStorage.sol"; abstract contract AccountLoupe is IAccountLoupe { @@ -20,10 +18,10 @@ abstract contract AccountLoupe is IAccountLoupe { /// @inheritdoc IAccountLoupe function getExecutionData(bytes4 selector) external view override returns (ExecutionDataView memory data) { if ( - selector == IStandardExecutor.execute.selector || selector == IStandardExecutor.executeBatch.selector + selector == IModularAccount.execute.selector || selector == IModularAccount.executeBatch.selector || selector == UUPSUpgradeable.upgradeToAndCall.selector - || selector == IModuleManager.installExecution.selector - || selector == IModuleManager.uninstallExecution.selector + || selector == IModularAccount.installExecution.selector + || selector == IModularAccount.uninstallExecution.selector ) { data.module = address(this); data.allowGlobalValidation = true; diff --git a/src/account/AccountStorage.sol b/src/account/AccountStorage.sol index f488e325..c01b671d 100644 --- a/src/account/AccountStorage.sol +++ b/src/account/AccountStorage.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.25; import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; -import {HookConfig, ModuleEntity} from "../interfaces/IModuleManager.sol"; +import {HookConfig, ModuleEntity} from "../interfaces/IModularAccount.sol"; // bytes = keccak256("ERC6900.UpgradeableModularAccount.Storage") bytes32 constant _ACCOUNT_STORAGE_SLOT = 0x9f09680beaa4e5c9f38841db2460c401499164f368baef687948c315d9073e40; diff --git a/src/account/ModuleManagerInternals.sol b/src/account/ModuleManagerInternals.sol index d11c8c6e..6bb3c52f 100644 --- a/src/account/ModuleManagerInternals.sol +++ b/src/account/ModuleManagerInternals.sol @@ -2,7 +2,6 @@ pragma solidity ^0.8.25; import {ERC165Checker} from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol"; - import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import {MAX_PRE_VALIDATION_HOOKS} from "../helpers/Constants.sol"; @@ -11,8 +10,8 @@ import {KnownSelectors} from "../helpers/KnownSelectors.sol"; import {ModuleEntityLib} from "../helpers/ModuleEntityLib.sol"; import {ValidationConfigLib} from "../helpers/ValidationConfigLib.sol"; import {ExecutionManifest, ManifestExecutionHook} from "../interfaces/IExecutionModule.sol"; +import {HookConfig, IModularAccount, ModuleEntity, ValidationConfig} from "../interfaces/IModularAccount.sol"; import {IModule} from "../interfaces/IModule.sol"; -import {HookConfig, IModuleManager, ModuleEntity, ValidationConfig} from "../interfaces/IModuleManager.sol"; import { AccountStorage, ExecutionData, @@ -22,7 +21,7 @@ import { toSetValue } from "./AccountStorage.sol"; -abstract contract ModuleManagerInternals is IModuleManager { +abstract contract ModuleManagerInternals is IModularAccount { using EnumerableSet for EnumerableSet.Bytes32Set; using ModuleEntityLib for ModuleEntity; using ValidationConfigLib for ValidationConfig; diff --git a/src/account/SemiModularAccount.sol b/src/account/SemiModularAccount.sol index 94946690..8fe637a4 100644 --- a/src/account/SemiModularAccount.sol +++ b/src/account/SemiModularAccount.sol @@ -7,7 +7,7 @@ import {PackedUserOperation} from "@eth-infinitism/account-abstraction/interface import {ModuleEntityLib} from "../helpers/ModuleEntityLib.sol"; -import {ModuleEntity, ValidationConfig} from "../interfaces/IModuleManager.sol"; +import {ModuleEntity, ValidationConfig} from "../interfaces/IModularAccount.sol"; import {MessageHashUtils} from "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol"; import {SignatureChecker} from "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol"; diff --git a/src/account/UpgradeableModularAccount.sol b/src/account/UpgradeableModularAccount.sol index 8c897879..a3eb7047 100644 --- a/src/account/UpgradeableModularAccount.sol +++ b/src/account/UpgradeableModularAccount.sol @@ -2,7 +2,6 @@ pragma solidity ^0.8.25; import {BaseAccount} from "@eth-infinitism/account-abstraction/core/BaseAccount.sol"; - import {IAccountExecute} from "@eth-infinitism/account-abstraction/interfaces/IAccountExecute.sol"; import {IEntryPoint} from "@eth-infinitism/account-abstraction/interfaces/IEntryPoint.sol"; import {PackedUserOperation} from "@eth-infinitism/account-abstraction/interfaces/PackedUserOperation.sol"; @@ -12,20 +11,15 @@ import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeab import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol"; import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; +import {DIRECT_CALL_VALIDATION_ENTITYID} from "../helpers/Constants.sol"; import {HookConfig, HookConfigLib} from "../helpers/HookConfigLib.sol"; import {ModuleEntityLib} from "../helpers/ModuleEntityLib.sol"; - import {SparseCalldataSegmentLib} from "../helpers/SparseCalldataSegmentLib.sol"; import {ValidationConfigLib} from "../helpers/ValidationConfigLib.sol"; import {_coalescePreValidation, _coalesceValidation} from "../helpers/ValidationResHelpers.sol"; - -import {DIRECT_CALL_VALIDATION_ENTITYID} from "../helpers/Constants.sol"; - import {IExecutionHookModule} from "../interfaces/IExecutionHookModule.sol"; import {ExecutionManifest} from "../interfaces/IExecutionModule.sol"; -import {IModuleManager, ModuleEntity, ValidationConfig} from "../interfaces/IModuleManager.sol"; -import {Call, IStandardExecutor} from "../interfaces/IStandardExecutor.sol"; - +import {Call, IModularAccount, ModuleEntity, ValidationConfig} from "../interfaces/IModularAccount.sol"; import {IValidationHookModule} from "../interfaces/IValidationHookModule.sol"; import {IValidationModule} from "../interfaces/IValidationModule.sol"; import {AccountExecutor} from "./AccountExecutor.sol"; @@ -35,13 +29,13 @@ import {AccountStorageInitializable} from "./AccountStorageInitializable.sol"; import {ModuleManagerInternals} from "./ModuleManagerInternals.sol"; contract UpgradeableModularAccount is + IModularAccount, AccountExecutor, AccountLoupe, AccountStorageInitializable, BaseAccount, IERC165, IERC1271, - IStandardExecutor, IAccountExecute, ModuleManagerInternals, UUPSUpgradeable @@ -152,7 +146,7 @@ contract UpgradeableModularAccount is _doCachedPostExecHooks(postPermissionHooks); } - /// @inheritdoc IStandardExecutor + /// @inheritdoc IModularAccount /// @notice May be validated by a global validation. function execute(address target, uint256 value, bytes calldata data) external @@ -164,7 +158,7 @@ contract UpgradeableModularAccount is result = _exec(target, value, data); } - /// @inheritdoc IStandardExecutor + /// @inheritdoc IModularAccount /// @notice May be validated by a global validation function. function executeBatch(Call[] calldata calls) external @@ -181,7 +175,7 @@ contract UpgradeableModularAccount is } } - /// @inheritdoc IStandardExecutor + /// @inheritdoc IModularAccount function executeWithAuthorization(bytes calldata data, bytes calldata authorization) external payable @@ -214,7 +208,7 @@ contract UpgradeableModularAccount is return returnData; } - /// @inheritdoc IModuleManager + /// @inheritdoc IModularAccount /// @notice May be validated by a global validation. function installExecution( address module, @@ -224,7 +218,7 @@ contract UpgradeableModularAccount is _installExecution(module, manifest, moduleInstallData); } - /// @inheritdoc IModuleManager + /// @inheritdoc IModularAccount /// @notice May be validated by a global validation. function uninstallExecution( address module, @@ -245,7 +239,7 @@ contract UpgradeableModularAccount is _installValidation(validationConfig, selectors, installData, hooks); } - /// @inheritdoc IModuleManager + /// @inheritdoc IModularAccount /// @notice May be validated by a global validation. function installValidation( ValidationConfig validationConfig, @@ -256,7 +250,7 @@ contract UpgradeableModularAccount is _installValidation(validationConfig, selectors, installData, hooks); } - /// @inheritdoc IModuleManager + /// @inheritdoc IModularAccount /// @notice May be validated by a global validation. function uninstallValidation( ModuleEntity validationFunction, @@ -651,7 +645,7 @@ contract UpgradeableModularAccount is _checkIfValidationAppliesSelector(outerSelector, validationFunction, isGlobal); - if (outerSelector == IStandardExecutor.execute.selector) { + if (outerSelector == IModularAccount.execute.selector) { (address target,,) = abi.decode(callData[4:], (address, uint256, bytes)); if (target == address(this)) { @@ -659,7 +653,7 @@ contract UpgradeableModularAccount is // the calldata as a top-level call. revert SelfCallRecursionDepthExceeded(); } - } else if (outerSelector == IStandardExecutor.executeBatch.selector) { + } else if (outerSelector == IModularAccount.executeBatch.selector) { // executeBatch may be used to batch account actions together, by targetting the account itself. // If this is done, we must ensure all of the inner calls are allowed by the provided validation // function. @@ -671,8 +665,8 @@ contract UpgradeableModularAccount is bytes4 nestedSelector = bytes4(calls[i].data); if ( - nestedSelector == IStandardExecutor.execute.selector - || nestedSelector == IStandardExecutor.executeBatch.selector + nestedSelector == IModularAccount.execute.selector + || nestedSelector == IModularAccount.executeBatch.selector ) { // To prevent arbitrarily-deep recursive checking, we limit the depth of self-calls to one // for the purposes of batching. diff --git a/src/helpers/HookConfigLib.sol b/src/helpers/HookConfigLib.sol index 9c94e4bd..81eaf0f4 100644 --- a/src/helpers/HookConfigLib.sol +++ b/src/helpers/HookConfigLib.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.25; -import {HookConfig, ModuleEntity} from "../interfaces/IModuleManager.sol"; +import {HookConfig, ModuleEntity} from "../interfaces/IModularAccount.sol"; // Hook types: // Exec hook: bools for hasPre, hasPost diff --git a/src/helpers/KnownSelectors.sol b/src/helpers/KnownSelectors.sol index c14d2944..84c400cf 100644 --- a/src/helpers/KnownSelectors.sol +++ b/src/helpers/KnownSelectors.sol @@ -8,13 +8,10 @@ import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeab import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol"; import {IAccountLoupe} from "../interfaces/IAccountLoupe.sol"; - import {IExecutionHookModule} from "../interfaces/IExecutionHookModule.sol"; import {IExecutionModule} from "../interfaces/IExecutionModule.sol"; +import {IModularAccount} from "../interfaces/IModularAccount.sol"; import {IModule} from "../interfaces/IModule.sol"; -import {IModuleManager} from "../interfaces/IModuleManager.sol"; -import {IStandardExecutor} from "../interfaces/IStandardExecutor.sol"; - import {IValidationHookModule} from "../interfaces/IValidationHookModule.sol"; import {IValidationModule} from "../interfaces/IValidationModule.sol"; @@ -25,18 +22,18 @@ library KnownSelectors { return // check against IAccount methods selector == IAccount.validateUserOp.selector - // check against IModuleManager methods - || selector == IModuleManager.installExecution.selector - || selector == IModuleManager.uninstallExecution.selector + // check against module manager methods + || selector == IModularAccount.installExecution.selector + || selector == IModularAccount.uninstallExecution.selector // check against IERC165 methods || selector == IERC165.supportsInterface.selector // check against UUPSUpgradeable methods || selector == UUPSUpgradeable.proxiableUUID.selector || selector == UUPSUpgradeable.upgradeToAndCall.selector - // check against IStandardExecutor methods - || selector == IStandardExecutor.execute.selector || selector == IStandardExecutor.executeBatch.selector - || selector == IStandardExecutor.executeWithAuthorization.selector - // check against IAccountLoupe methods + // check against IModularAccount methods + || selector == IModularAccount.execute.selector || selector == IModularAccount.executeBatch.selector + || selector == IModularAccount.executeWithAuthorization.selector + // check against account loupe methods || selector == IAccountLoupe.getExecutionData.selector || selector == IAccountLoupe.getValidationData.selector; } diff --git a/src/helpers/ModuleEntityLib.sol b/src/helpers/ModuleEntityLib.sol index d8473a5b..06f51222 100644 --- a/src/helpers/ModuleEntityLib.sol +++ b/src/helpers/ModuleEntityLib.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.25; -import {ModuleEntity} from "../interfaces/IModuleManager.sol"; +import {ModuleEntity} from "../interfaces/IModularAccount.sol"; library ModuleEntityLib { // Magic value for hooks that should always revert. diff --git a/src/helpers/ValidationConfigLib.sol b/src/helpers/ValidationConfigLib.sol index 1c127c3b..cad994c3 100644 --- a/src/helpers/ValidationConfigLib.sol +++ b/src/helpers/ValidationConfigLib.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.25; -import {ModuleEntity, ValidationConfig} from "../interfaces/IModuleManager.sol"; +import {ModuleEntity, ValidationConfig} from "../interfaces/IModularAccount.sol"; // Validation config is a packed representation of a validation function and flags for its configuration. // Layout: diff --git a/src/interfaces/IAccountLoupe.sol b/src/interfaces/IAccountLoupe.sol index 778a52f8..10421f0a 100644 --- a/src/interfaces/IAccountLoupe.sol +++ b/src/interfaces/IAccountLoupe.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: CC0-1.0 pragma solidity ^0.8.25; -import {HookConfig, ModuleEntity} from "../interfaces/IModuleManager.sol"; +import {HookConfig, ModuleEntity} from "../interfaces/IModularAccount.sol"; // Represents data associated with a specifc function selector. struct ExecutionDataView { diff --git a/src/interfaces/IModuleManager.sol b/src/interfaces/IModularAccount.sol similarity index 69% rename from src/interfaces/IModuleManager.sol rename to src/interfaces/IModularAccount.sol index ab8ccbe4..f6212b54 100644 --- a/src/interfaces/IModuleManager.sol +++ b/src/interfaces/IModularAccount.sol @@ -9,12 +9,44 @@ type ValidationConfig is bytes26; type HookConfig is bytes26; -interface IModuleManager { +struct Call { + // The target address for the account to call. + address target; + // The value to send with the call. + uint256 value; + // The calldata for the call. + bytes data; +} + +interface IModularAccount { event ExecutionInstalled(address indexed module, ExecutionManifest manifest); event ExecutionUninstalled(address indexed module, bool onUninstallSucceeded, ExecutionManifest manifest); event ValidationInstalled(address indexed module, uint32 indexed entityId); event ValidationUninstalled(address indexed module, uint32 indexed entityId, bool onUninstallSucceeded); + /// @notice Standard execute method. + /// @param target The target address for the account to call. + /// @param value The value to send with the call. + /// @param data The calldata for the call. + /// @return The return data from the call. + function execute(address target, uint256 value, bytes calldata data) external payable returns (bytes memory); + + /// @notice Standard executeBatch method. + /// @dev If the target is a module, the call SHOULD revert. If any of the calls revert, the entire batch MUST + /// revert. + /// @param calls The array of calls. + /// @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. + /// @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. + function executeWithAuthorization(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 diff --git a/src/interfaces/IStandardExecutor.sol b/src/interfaces/IStandardExecutor.sol deleted file mode 100644 index c757feef..00000000 --- a/src/interfaces/IStandardExecutor.sol +++ /dev/null @@ -1,36 +0,0 @@ -// SPDX-License-Identifier: CC0-1.0 -pragma solidity ^0.8.25; - -struct Call { - // The target address for the account to call. - address target; - // The value to send with the call. - uint256 value; - // The calldata for the call. - bytes data; -} - -interface IStandardExecutor { - /// @notice Standard execute method. - /// @param target The target address for the account to call. - /// @param value The value to send with the call. - /// @param data The calldata for the call. - /// @return The return data from the call. - function execute(address target, uint256 value, bytes calldata data) external payable returns (bytes memory); - - /// @notice Standard executeBatch method. - /// @dev If the target is a module, the call SHOULD revert. If any of the calls revert, the entire batch MUST - /// revert. - /// @param calls The array of calls. - /// @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. - /// @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. - function executeWithAuthorization(bytes calldata data, bytes calldata authorization) - external - payable - returns (bytes memory); -} diff --git a/src/modules/ERC20TokenLimitModule.sol b/src/modules/ERC20TokenLimitModule.sol index 6eb93ea8..790a67a2 100644 --- a/src/modules/ERC20TokenLimitModule.sol +++ b/src/modules/ERC20TokenLimitModule.sol @@ -13,8 +13,8 @@ import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import {IExecutionHookModule} from "../interfaces/IExecutionHookModule.sol"; +import {Call, IModularAccount} from "../interfaces/IModularAccount.sol"; import {IModule, ModuleMetadata} from "../interfaces/IModule.sol"; -import {Call, IStandardExecutor} from "../interfaces/IStandardExecutor.sol"; import {BaseModule, IERC165} from "./BaseModule.sol"; @@ -59,12 +59,12 @@ contract ERC20TokenLimitModule is BaseModule, IExecutionHookModule { { (bytes4 selector, bytes memory callData) = _getSelectorAndCalldata(data); - if (selector == IStandardExecutor.execute.selector) { + if (selector == IModularAccount.execute.selector) { (address token,, bytes memory innerCalldata) = abi.decode(callData, (address, uint256, bytes)); if (_tokenList.contains(msg.sender, SetValue.wrap(bytes30(bytes20(token))))) { _decrementLimit(entityId, token, innerCalldata); } - } else if (selector == IStandardExecutor.executeBatch.selector) { + } else if (selector == IModularAccount.executeBatch.selector) { Call[] memory calls = abi.decode(callData, (Call[])); for (uint256 i = 0; i < calls.length; i++) { if (_tokenList.contains(msg.sender, SetValue.wrap(bytes30(bytes20(calls[i].target))))) { diff --git a/src/modules/NativeTokenLimitModule.sol b/src/modules/NativeTokenLimitModule.sol index 967f2ab3..568fac62 100644 --- a/src/modules/NativeTokenLimitModule.sol +++ b/src/modules/NativeTokenLimitModule.sol @@ -6,9 +6,8 @@ import {PackedUserOperation} from "@eth-infinitism/account-abstraction/interface import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import {IExecutionHookModule} from "../interfaces/IExecutionHookModule.sol"; +import {Call, IModularAccount} from "../interfaces/IModularAccount.sol"; import {IModule, ModuleMetadata} from "../interfaces/IModule.sol"; -import {Call, IStandardExecutor} from "../interfaces/IStandardExecutor.sol"; - import {IValidationHookModule} from "../interfaces/IValidationHookModule.sol"; import {BaseModule, IERC165} from "./BaseModule.sol"; @@ -146,9 +145,9 @@ contract NativeTokenLimitModule is BaseModule, IExecutionHookModule, IValidation uint256 value; // Get value being sent - if (selector == IStandardExecutor.execute.selector) { + if (selector == IModularAccount.execute.selector) { (, value) = abi.decode(callData, (address, uint256)); - } else if (selector == IStandardExecutor.executeBatch.selector) { + } else if (selector == IModularAccount.executeBatch.selector) { Call[] memory calls = abi.decode(callData, (Call[])); for (uint256 i = 0; i < calls.length; i++) { value += calls[i].value; diff --git a/src/modules/permissionhooks/AllowlistModule.sol b/src/modules/permissionhooks/AllowlistModule.sol index 0302a4a6..9ccc4e61 100644 --- a/src/modules/permissionhooks/AllowlistModule.sol +++ b/src/modules/permissionhooks/AllowlistModule.sol @@ -5,7 +5,7 @@ import {PackedUserOperation} from "@eth-infinitism/account-abstraction/interface import {ModuleMetadata} from "../../interfaces/IModule.sol"; -import {Call, IStandardExecutor} from "../../interfaces/IStandardExecutor.sol"; +import {Call, IModularAccount} from "../../interfaces/IModularAccount.sol"; import {IValidationHookModule} from "../../interfaces/IValidationHookModule.sol"; import {BaseModule} from "../../modules/BaseModule.sol"; @@ -110,10 +110,10 @@ contract AllowlistModule is IValidationHookModule, BaseModule { } function checkAllowlistCalldata(uint32 entityId, bytes calldata callData) public view { - if (bytes4(callData[:4]) == IStandardExecutor.execute.selector) { + if (bytes4(callData[:4]) == IModularAccount.execute.selector) { (address target,, bytes memory data) = abi.decode(callData[4:], (address, uint256, bytes)); _checkCallPermission(entityId, msg.sender, target, data); - } else if (bytes4(callData[:4]) == IStandardExecutor.executeBatch.selector) { + } else if (bytes4(callData[:4]) == IModularAccount.executeBatch.selector) { Call[] memory calls = abi.decode(callData[4:], (Call[])); for (uint256 i = 0; i < calls.length; i++) { diff --git a/test/account/AccountLoupe.t.sol b/test/account/AccountLoupe.t.sol index ae988924..1ead8dfb 100644 --- a/test/account/AccountLoupe.t.sol +++ b/test/account/AccountLoupe.t.sol @@ -6,8 +6,7 @@ import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeab import {HookConfigLib} from "../../src/helpers/HookConfigLib.sol"; import {ModuleEntity, ModuleEntityLib} from "../../src/helpers/ModuleEntityLib.sol"; import {ExecutionDataView, ValidationDataView} from "../../src/interfaces/IAccountLoupe.sol"; -import {HookConfig, IModuleManager} from "../../src/interfaces/IModuleManager.sol"; -import {IStandardExecutor} from "../../src/interfaces/IStandardExecutor.sol"; +import {HookConfig, IModularAccount} from "../../src/interfaces/IModularAccount.sol"; import {ComprehensiveModule} from "../mocks/modules/ComprehensiveModule.sol"; import {CustomValidationTestBase} from "../utils/CustomValidationTestBase.sol"; @@ -34,15 +33,15 @@ contract AccountLoupeTest is CustomValidationTestBase { function test_moduleLoupe_getExecutionData_native() public { bytes4[] memory selectorsToCheck = new bytes4[](5); - selectorsToCheck[0] = IStandardExecutor.execute.selector; + selectorsToCheck[0] = IModularAccount.execute.selector; - selectorsToCheck[1] = IStandardExecutor.executeBatch.selector; + selectorsToCheck[1] = IModularAccount.executeBatch.selector; selectorsToCheck[2] = UUPSUpgradeable.upgradeToAndCall.selector; - selectorsToCheck[3] = IModuleManager.installExecution.selector; + selectorsToCheck[3] = IModularAccount.installExecution.selector; - selectorsToCheck[4] = IModuleManager.uninstallExecution.selector; + selectorsToCheck[4] = IModularAccount.uninstallExecution.selector; for (uint256 i = 0; i < selectorsToCheck.length; i++) { ExecutionDataView memory data = account1.getExecutionData(selectorsToCheck[i]); diff --git a/test/account/AccountReturnData.t.sol b/test/account/AccountReturnData.t.sol index 3542f3db..08611074 100644 --- a/test/account/AccountReturnData.t.sol +++ b/test/account/AccountReturnData.t.sol @@ -3,8 +3,8 @@ pragma solidity ^0.8.19; import {DIRECT_CALL_VALIDATION_ENTITYID} from "../../src/helpers/Constants.sol"; import {ValidationConfigLib} from "../../src/helpers/ValidationConfigLib.sol"; -import {Call} from "../../src/interfaces/IStandardExecutor.sol"; -import {IStandardExecutor} from "../../src/interfaces/IStandardExecutor.sol"; +import {Call} from "../../src/interfaces/IModularAccount.sol"; +import {IModularAccount} from "../../src/interfaces/IModularAccount.sol"; import { RegularResultContract, @@ -41,7 +41,7 @@ contract AccountReturnDataTest is AccountTestBase { }); // Allow the result consumer module to perform direct calls to the account bytes4[] memory selectors = new bytes4[](1); - selectors[0] = IStandardExecutor.execute.selector; + selectors[0] = IModularAccount.execute.selector; account1.installValidation( ValidationConfigLib.pack(address(resultConsumerModule), DIRECT_CALL_VALIDATION_ENTITYID, false, false), selectors, @@ -58,7 +58,7 @@ contract AccountReturnDataTest is AccountTestBase { assertEq(result, keccak256("bar")); } - // Tests the ability to read the results of contracts called via IStandardExecutor.execute + // Tests the ability to read the results of contracts called via IModularAccount.execute function test_returnData_singular_execute() public { bytes memory returnData = account1.executeWithAuthorization( abi.encodeCall( @@ -73,7 +73,7 @@ contract AccountReturnDataTest is AccountTestBase { assertEq(result, keccak256("bar")); } - // Tests the ability to read the results of multiple contract calls via IStandardExecutor.executeBatch + // Tests the ability to read the results of multiple contract calls via IModularAccount.executeBatch function test_returnData_executeBatch() public { Call[] memory calls = new Call[](2); calls[0] = Call({ diff --git a/test/account/DirectCallsFromModule.t.sol b/test/account/DirectCallsFromModule.t.sol index 9534035c..f77b7fd5 100644 --- a/test/account/DirectCallsFromModule.t.sol +++ b/test/account/DirectCallsFromModule.t.sol @@ -6,7 +6,7 @@ import {UpgradeableModularAccount} from "../../src/account/UpgradeableModularAcc import {HookConfigLib} from "../../src/helpers/HookConfigLib.sol"; import {ModuleEntity, ModuleEntityLib} from "../../src/helpers/ModuleEntityLib.sol"; import {ValidationConfig, ValidationConfigLib} from "../../src/helpers/ValidationConfigLib.sol"; -import {Call, IStandardExecutor} from "../../src/interfaces/IStandardExecutor.sol"; +import {Call, IModularAccount} from "../../src/interfaces/IModularAccount.sol"; import {DirectCallModule} from "../mocks/modules/DirectCallModule.sol"; import {AccountTestBase} from "../utils/AccountTestBase.sol"; @@ -32,7 +32,7 @@ contract DirectCallsFromModuleTest is AccountTestBase { function test_Fail_DirectCallModuleNotInstalled() external { vm.prank(address(_module)); - vm.expectRevert(_buildDirectCallDisallowedError(IStandardExecutor.execute.selector)); + vm.expectRevert(_buildDirectCallDisallowedError(IModularAccount.execute.selector)); account1.execute(address(0), 0, ""); } @@ -42,7 +42,7 @@ contract DirectCallsFromModuleTest is AccountTestBase { _uninstallValidation(); vm.prank(address(_module)); - vm.expectRevert(_buildDirectCallDisallowedError(IStandardExecutor.execute.selector)); + vm.expectRevert(_buildDirectCallDisallowedError(IModularAccount.execute.selector)); account1.execute(address(0), 0, ""); } @@ -52,7 +52,7 @@ contract DirectCallsFromModuleTest is AccountTestBase { Call[] memory calls = new Call[](0); vm.prank(address(_module)); - vm.expectRevert(_buildDirectCallDisallowedError(IStandardExecutor.executeBatch.selector)); + vm.expectRevert(_buildDirectCallDisallowedError(IModularAccount.executeBatch.selector)); account1.executeBatch(calls); } @@ -100,7 +100,7 @@ contract DirectCallsFromModuleTest is AccountTestBase { _uninstallValidation(); vm.prank(address(_module)); - vm.expectRevert(_buildDirectCallDisallowedError(IStandardExecutor.execute.selector)); + vm.expectRevert(_buildDirectCallDisallowedError(IModularAccount.execute.selector)); account1.execute(address(0), 0, ""); } @@ -110,7 +110,7 @@ contract DirectCallsFromModuleTest is AccountTestBase { function _installValidation() internal { bytes4[] memory selectors = new bytes4[](1); - selectors[0] = IStandardExecutor.execute.selector; + selectors[0] = IModularAccount.execute.selector; bytes[] memory hooks = new bytes[](1); hooks[0] = abi.encodePacked( diff --git a/test/account/MultiValidation.t.sol b/test/account/MultiValidation.t.sol index 78de0657..c85dc900 100644 --- a/test/account/MultiValidation.t.sol +++ b/test/account/MultiValidation.t.sol @@ -11,8 +11,8 @@ import {UpgradeableModularAccount} from "../../src/account/UpgradeableModularAcc import {ModuleEntityLib} from "../../src/helpers/ModuleEntityLib.sol"; import {ValidationConfigLib} from "../../src/helpers/ValidationConfigLib.sol"; -import {ModuleEntity} from "../../src/interfaces/IModuleManager.sol"; -import {IStandardExecutor} from "../../src/interfaces/IStandardExecutor.sol"; + +import {IModularAccount, ModuleEntity} from "../../src/interfaces/IModularAccount.sol"; import {SingleSignerValidationModule} from "../../src/modules/validation/SingleSignerValidationModule.sol"; import {AccountTestBase} from "../utils/AccountTestBase.sol"; @@ -69,7 +69,7 @@ contract MultiValidationTest is AccountTestBase { ) ); account1.executeWithAuthorization( - abi.encodeCall(IStandardExecutor.execute, (address(0), 0, "")), + abi.encodeCall(IModularAccount.execute, (address(0), 0, "")), _encodeSignature( ModuleEntityLib.pack(address(validator2), TEST_DEFAULT_VALIDATION_ENTITY_ID), GLOBAL_VALIDATION, "" ) @@ -77,7 +77,7 @@ contract MultiValidationTest is AccountTestBase { vm.prank(owner2); account1.executeWithAuthorization( - abi.encodeCall(IStandardExecutor.execute, (address(0), 0, "")), + abi.encodeCall(IModularAccount.execute, (address(0), 0, "")), _encodeSignature( ModuleEntityLib.pack(address(validator2), TEST_DEFAULT_VALIDATION_ENTITY_ID), GLOBAL_VALIDATION, "" ) diff --git a/test/account/ReplaceModule.t.sol b/test/account/ReplaceModule.t.sol index 9de8247b..e1fb03b9 100644 --- a/test/account/ReplaceModule.t.sol +++ b/test/account/ReplaceModule.t.sol @@ -15,8 +15,7 @@ import { import {HookConfigLib} from "../../src/helpers/HookConfigLib.sol"; import {IExecutionHookModule} from "../../src/interfaces/IExecutionHookModule.sol"; -import {IModuleManager, ModuleEntity} from "../../src/interfaces/IModuleManager.sol"; -import {Call, IStandardExecutor} from "../../src/interfaces/IStandardExecutor.sol"; +import {Call, IModularAccount, ModuleEntity} from "../../src/interfaces/IModularAccount.sol"; import {IValidationHookModule} from "../../src/interfaces/IValidationHookModule.sol"; import {SingleSignerValidationModule} from "../../src/modules/validation/SingleSignerValidationModule.sol"; import {MockModule} from "../mocks/MockModule.sol"; @@ -73,14 +72,14 @@ contract UpgradeModuleTest is AccountTestBase { target: address(account1), value: 0, data: abi.encodeCall( - IModuleManager.uninstallExecution, (address(moduleV1), moduleV1.executionManifest(), "") + IModularAccount.uninstallExecution, (address(moduleV1), moduleV1.executionManifest(), "") ) }); calls[1] = Call({ target: address(account1), value: 0, data: abi.encodeCall( - IModuleManager.installExecution, (address(moduleV2), moduleV2.executionManifest(), "") + IModularAccount.installExecution, (address(moduleV2), moduleV2.executionManifest(), "") ) }); account1.executeWithAuthorization( @@ -133,7 +132,7 @@ contract UpgradeModuleTest is AccountTestBase { ); // Test that setup worked. Pre val + pre exec hooks should run vm.startPrank(owner1); - bytes memory callData = abi.encodeCall(IStandardExecutor.execute, (address(target), sendAmount, "")); + bytes memory callData = abi.encodeCall(IModularAccount.execute, (address(target), sendAmount, "")); vm.expectEmit(true, true, true, true); emit ReceivedCall( abi.encodeCall( @@ -166,14 +165,14 @@ contract UpgradeModuleTest is AccountTestBase { target: address(account1), value: 0, data: abi.encodeCall( - IModuleManager.uninstallValidation, (currModuleEntity, abi.encode(validationEntityId1), emptyBytesArr) + IModularAccount.uninstallValidation, (currModuleEntity, abi.encode(validationEntityId1), emptyBytesArr) ) }); calls[1] = Call({ target: address(account1), value: 0, data: abi.encodeCall( - IModuleManager.installValidation, + IModularAccount.installValidation, ( ValidationConfigLib.pack(newModuleEntity, true, false), new bytes4[](0), @@ -191,11 +190,11 @@ contract UpgradeModuleTest is AccountTestBase { vm.expectRevert( abi.encodePacked( UpgradeableModularAccount.ValidationFunctionMissing.selector, - abi.encode(IStandardExecutor.execute.selector) + abi.encode(IModularAccount.execute.selector) ) ); account1.executeWithAuthorization( - abi.encodeCall(IStandardExecutor.execute, (target, sendAmount, "")), + abi.encodeCall(IModularAccount.execute, (target, sendAmount, "")), _encodeSignature(currModuleEntity, GLOBAL_VALIDATION, "") ); diff --git a/test/account/SelfCallAuthorization.t.sol b/test/account/SelfCallAuthorization.t.sol index ed158a30..f0ce35cb 100644 --- a/test/account/SelfCallAuthorization.t.sol +++ b/test/account/SelfCallAuthorization.t.sol @@ -9,7 +9,7 @@ import {UpgradeableModularAccount} from "../../src/account/UpgradeableModularAcc import {ModuleEntity, ModuleEntityLib} from "../../src/helpers/ModuleEntityLib.sol"; import {ValidationConfigLib} from "../../src/helpers/ValidationConfigLib.sol"; -import {Call, IStandardExecutor} from "../../src/interfaces/IStandardExecutor.sol"; +import {Call, IModularAccount} from "../../src/interfaces/IModularAccount.sol"; import {ComprehensiveModule} from "../mocks/modules/ComprehensiveModule.sol"; import {AccountTestBase} from "../utils/AccountTestBase.sol"; @@ -100,7 +100,7 @@ contract SelfCallAuthorizationTest is AccountTestBase { calls[0] = Call(address(account1), 0, abi.encodeCall(ComprehensiveModule.foo, ())); _runUserOp( - abi.encodeCall(IStandardExecutor.executeBatch, (calls)), + abi.encodeCall(IModularAccount.executeBatch, (calls)), abi.encodeWithSelector( IEntryPoint.FailedOpWithRevert.selector, 0, @@ -135,7 +135,7 @@ contract SelfCallAuthorizationTest is AccountTestBase { _runUserOp( abi.encodePacked( - IAccountExecute.executeUserOp.selector, abi.encodeCall(IStandardExecutor.executeBatch, (calls)) + IAccountExecute.executeUserOp.selector, abi.encodeCall(IModularAccount.executeBatch, (calls)) ), abi.encodeWithSelector( IEntryPoint.FailedOpWithRevert.selector, @@ -176,9 +176,8 @@ contract SelfCallAuthorizationTest is AccountTestBase { calls[0] = Call(address(account1), 0, abi.encodeCall(ComprehensiveModule.foo, ())); calls[1] = Call(address(account1), 0, abi.encodeCall(ComprehensiveModule.foo, ())); - PackedUserOperation memory userOp = _generateUserOpWithComprehensiveModuleValidation( - abi.encodeCall(IStandardExecutor.executeBatch, (calls)) - ); + PackedUserOperation memory userOp = + _generateUserOpWithComprehensiveModuleValidation(abi.encodeCall(IModularAccount.executeBatch, (calls))); PackedUserOperation[] memory userOps = new PackedUserOperation[](1); userOps[0] = userOp; @@ -196,7 +195,7 @@ contract SelfCallAuthorizationTest is AccountTestBase { PackedUserOperation memory userOp = _generateUserOpWithComprehensiveModuleValidation( abi.encodePacked( - IAccountExecute.executeUserOp.selector, abi.encodeCall(IStandardExecutor.executeBatch, (calls)) + IAccountExecute.executeUserOp.selector, abi.encodeCall(IModularAccount.executeBatch, (calls)) ) ); @@ -216,7 +215,7 @@ contract SelfCallAuthorizationTest is AccountTestBase { vm.expectCall(address(comprehensiveModule), abi.encodeCall(ComprehensiveModule.foo, ()), 2); account1.executeWithAuthorization( - abi.encodeCall(IStandardExecutor.executeBatch, (calls)), + abi.encodeCall(IModularAccount.executeBatch, (calls)), _encodeSignature(comprehensiveModuleValidation, SELECTOR_ASSOCIATED_VALIDATION, "") ); } @@ -228,10 +227,10 @@ contract SelfCallAuthorizationTest is AccountTestBase { innerCalls[0] = Call(address(account1), 0, abi.encodeCall(ComprehensiveModule.foo, ())); Call[] memory outerCalls = new Call[](1); - outerCalls[0] = Call(address(account1), 0, abi.encodeCall(IStandardExecutor.executeBatch, (innerCalls))); + outerCalls[0] = Call(address(account1), 0, abi.encodeCall(IModularAccount.executeBatch, (innerCalls))); PackedUserOperation memory userOp = _generateUserOpWithComprehensiveModuleValidation( - abi.encodeCall(IStandardExecutor.executeBatch, (outerCalls)) + abi.encodeCall(IModularAccount.executeBatch, (outerCalls)) ); PackedUserOperation[] memory userOps = new PackedUserOperation[](1); @@ -255,12 +254,11 @@ contract SelfCallAuthorizationTest is AccountTestBase { innerCalls[0] = Call(address(account1), 0, abi.encodeCall(ComprehensiveModule.foo, ())); Call[] memory outerCalls = new Call[](1); - outerCalls[0] = Call(address(account1), 0, abi.encodeCall(IStandardExecutor.executeBatch, (innerCalls))); + outerCalls[0] = Call(address(account1), 0, abi.encodeCall(IModularAccount.executeBatch, (innerCalls))); PackedUserOperation memory userOp = _generateUserOpWithComprehensiveModuleValidation( abi.encodePacked( - IAccountExecute.executeUserOp.selector, - abi.encodeCall(IStandardExecutor.executeBatch, (outerCalls)) + IAccountExecute.executeUserOp.selector, abi.encodeCall(IModularAccount.executeBatch, (outerCalls)) ) ); @@ -285,11 +283,11 @@ contract SelfCallAuthorizationTest is AccountTestBase { innerCalls[0] = Call(address(account1), 0, abi.encodeCall(ComprehensiveModule.foo, ())); Call[] memory outerCalls = new Call[](1); - outerCalls[0] = Call(address(account1), 0, abi.encodeCall(IStandardExecutor.executeBatch, (innerCalls))); + outerCalls[0] = Call(address(account1), 0, abi.encodeCall(IModularAccount.executeBatch, (innerCalls))); vm.expectRevert(abi.encodeWithSelector(UpgradeableModularAccount.SelfCallRecursionDepthExceeded.selector)); account1.executeWithAuthorization( - abi.encodeCall(IStandardExecutor.executeBatch, (outerCalls)), + abi.encodeCall(IModularAccount.executeBatch, (outerCalls)), _encodeSignature(comprehensiveModuleValidation, SELECTOR_ASSOCIATED_VALIDATION, "") ); } @@ -299,7 +297,7 @@ contract SelfCallAuthorizationTest is AccountTestBase { // self-call. bytes4[] memory selectors = new bytes4[](1); - selectors[0] = IStandardExecutor.executeBatch.selector; + selectors[0] = IModularAccount.executeBatch.selector; vm.prank(owner1); account1.executeWithAuthorization( diff --git a/test/account/UpgradeableModularAccount.t.sol b/test/account/UpgradeableModularAccount.t.sol index 7e9eb8b7..b5671145 100644 --- a/test/account/UpgradeableModularAccount.t.sol +++ b/test/account/UpgradeableModularAccount.t.sol @@ -14,10 +14,10 @@ import {ModuleManagerInternals} from "../../src/account/ModuleManagerInternals.s import {SemiModularAccount} from "../../src/account/SemiModularAccount.sol"; import {UpgradeableModularAccount} from "../../src/account/UpgradeableModularAccount.sol"; -import {ExecutionDataView, IAccountLoupe} from "../../src/interfaces/IAccountLoupe.sol"; import {ExecutionManifest} from "../../src/interfaces/IExecutionModule.sol"; -import {IModuleManager} from "../../src/interfaces/IModuleManager.sol"; -import {Call} from "../../src/interfaces/IStandardExecutor.sol"; + +import {ExecutionDataView} from "../../src/interfaces/IAccountLoupe.sol"; +import {Call} from "../../src/interfaces/IModularAccount.sol"; import {TokenReceiverModule} from "../../src/modules/TokenReceiverModule.sol"; import {SingleSignerValidationModule} from "../../src/modules/validation/SingleSignerValidationModule.sol"; @@ -249,14 +249,13 @@ contract UpgradeableModularAccountTest is AccountTestBase { vm.expectEmit(true, true, true, true); emit ExecutionInstalled(address(tokenReceiverModule), tokenReceiverModule.executionManifest()); - IModuleManager(account1).installExecution({ + account1.installExecution({ module: address(tokenReceiverModule), manifest: tokenReceiverModule.executionManifest(), moduleInstallData: abi.encode(uint48(1 days)) }); - ExecutionDataView memory data = - IAccountLoupe(account1).getExecutionData(TokenReceiverModule.onERC721Received.selector); + ExecutionDataView memory data = account1.getExecutionData(TokenReceiverModule.onERC721Received.selector); assertEq(data.module, address(tokenReceiverModule)); } @@ -267,7 +266,7 @@ contract UpgradeableModularAccountTest is AccountTestBase { MockModule mockModuleWithBadPermittedExec = new MockModule(m); - IModuleManager(account1).installExecution({ + account1.installExecution({ module: address(mockModuleWithBadPermittedExec), manifest: mockModuleWithBadPermittedExec.executionManifest(), moduleInstallData: "" @@ -284,14 +283,14 @@ contract UpgradeableModularAccountTest is AccountTestBase { ExecutionManifest memory m; - IModuleManager(account1).installExecution({module: address(badModule), manifest: m, moduleInstallData: ""}); + account1.installExecution({module: address(badModule), manifest: m, moduleInstallData: ""}); } function test_installExecution_alreadyInstalled() public { ExecutionManifest memory m = tokenReceiverModule.executionManifest(); vm.prank(address(entryPoint)); - IModuleManager(account1).installExecution({ + account1.installExecution({ module: address(tokenReceiverModule), manifest: m, moduleInstallData: abi.encode(uint48(1 days)) @@ -304,7 +303,7 @@ contract UpgradeableModularAccountTest is AccountTestBase { TokenReceiverModule.onERC721Received.selector ) ); - IModuleManager(account1).installExecution({ + account1.installExecution({ module: address(tokenReceiverModule), manifest: m, moduleInstallData: abi.encode(uint48(1 days)) @@ -315,7 +314,7 @@ contract UpgradeableModularAccountTest is AccountTestBase { vm.startPrank(address(entryPoint)); ComprehensiveModule module = new ComprehensiveModule(); - IModuleManager(account1).installExecution({ + account1.installExecution({ module: address(module), manifest: module.executionManifest(), moduleInstallData: "" @@ -323,13 +322,13 @@ contract UpgradeableModularAccountTest is AccountTestBase { vm.expectEmit(true, true, true, true); emit ExecutionUninstalled(address(module), true, module.executionManifest()); - IModuleManager(account1).uninstallExecution({ + account1.uninstallExecution({ module: address(module), manifest: module.executionManifest(), moduleUninstallData: "" }); - ExecutionDataView memory data = IAccountLoupe(account1).getExecutionData(module.foo.selector); + ExecutionDataView memory data = account1.getExecutionData(module.foo.selector); assertEq(data.module, address(0)); } @@ -338,7 +337,7 @@ contract UpgradeableModularAccountTest is AccountTestBase { module = new MockModule(_manifest); - IModuleManager(account1).installExecution({ + account1.installExecution({ module: address(module), manifest: module.executionManifest(), moduleInstallData: "" diff --git a/test/libraries/HookConfigLib.t.sol b/test/libraries/HookConfigLib.t.sol index 7a4671b8..f1efa395 100644 --- a/test/libraries/HookConfigLib.t.sol +++ b/test/libraries/HookConfigLib.t.sol @@ -5,7 +5,7 @@ import {Test} from "forge-std/Test.sol"; import {HookConfigLib} from "../../src/helpers/HookConfigLib.sol"; import {ModuleEntityLib} from "../../src/helpers/ModuleEntityLib.sol"; -import {HookConfig, ModuleEntity} from "../../src/interfaces/IModuleManager.sol"; +import {HookConfig, ModuleEntity} from "../../src/interfaces/IModularAccount.sol"; contract HookConfigLibTest is Test { using ModuleEntityLib for ModuleEntity; diff --git a/test/libraries/ModuleEntityLib.t.sol b/test/libraries/ModuleEntityLib.t.sol index 205e53b9..f43a238c 100644 --- a/test/libraries/ModuleEntityLib.t.sol +++ b/test/libraries/ModuleEntityLib.t.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.19; import {Test} from "forge-std/Test.sol"; import {ModuleEntityLib} from "../../src/helpers/ModuleEntityLib.sol"; -import {ModuleEntity} from "../../src/interfaces/IModuleManager.sol"; +import {ModuleEntity} from "../../src/interfaces/IModularAccount.sol"; contract ModuleEntityLibTest is Test { using ModuleEntityLib for ModuleEntity; diff --git a/test/libraries/ValidationConfigLib.t.sol b/test/libraries/ValidationConfigLib.t.sol index 4d49c383..da46f2cf 100644 --- a/test/libraries/ValidationConfigLib.t.sol +++ b/test/libraries/ValidationConfigLib.t.sol @@ -3,9 +3,8 @@ pragma solidity ^0.8.25; import {Test} from "forge-std/Test.sol"; -import {ModuleEntityLib} from "../../src/helpers/ModuleEntityLib.sol"; -import {ValidationConfigLib} from "../../src/helpers/ValidationConfigLib.sol"; -import {ModuleEntity, ValidationConfig} from "../../src/interfaces/IModuleManager.sol"; +import {ModuleEntity, ModuleEntityLib} from "../../src/helpers/ModuleEntityLib.sol"; +import {ValidationConfig, ValidationConfigLib} from "../../src/helpers/ValidationConfigLib.sol"; contract ValidationConfigLibTest is Test { using ModuleEntityLib for ModuleEntity; diff --git a/test/mocks/modules/DirectCallModule.sol b/test/mocks/modules/DirectCallModule.sol index c5ad271c..d3303a55 100644 --- a/test/mocks/modules/DirectCallModule.sol +++ b/test/mocks/modules/DirectCallModule.sol @@ -2,9 +2,8 @@ pragma solidity ^0.8.19; import {IExecutionHookModule} from "../../../src/interfaces/IExecutionHookModule.sol"; +import {IModularAccount} from "../../../src/interfaces/IModularAccount.sol"; import {ModuleMetadata} from "../../../src/interfaces/IModule.sol"; -import {IStandardExecutor} from "../../../src/interfaces/IStandardExecutor.sol"; - import {BaseModule} from "../../../src/modules/BaseModule.sol"; contract DirectCallModule is BaseModule, IExecutionHookModule { @@ -16,7 +15,7 @@ contract DirectCallModule is BaseModule, IExecutionHookModule { function onUninstall(bytes calldata) external override {} function directCall() external returns (bytes memory) { - return IStandardExecutor(msg.sender).execute(address(this), 0, abi.encodeCall(this.getData, ())); + return IModularAccount(msg.sender).execute(address(this), 0, abi.encodeCall(this.getData, ())); } function getData() external pure returns (bytes memory) { diff --git a/test/mocks/modules/MockAccessControlHookModule.sol b/test/mocks/modules/MockAccessControlHookModule.sol index 91b2b331..03f5471c 100644 --- a/test/mocks/modules/MockAccessControlHookModule.sol +++ b/test/mocks/modules/MockAccessControlHookModule.sol @@ -3,8 +3,8 @@ pragma solidity ^0.8.25; import {PackedUserOperation} from "@eth-infinitism/account-abstraction/interfaces/PackedUserOperation.sol"; +import {IModularAccount} from "../../../src/interfaces/IModularAccount.sol"; import {ModuleMetadata} from "../../../src/interfaces/IModule.sol"; -import {IStandardExecutor} from "../../../src/interfaces/IStandardExecutor.sol"; import {IValidationHookModule} from "../../../src/interfaces/IValidationHookModule.sol"; import {BaseModule} from "../../../src/modules/BaseModule.sol"; @@ -35,7 +35,7 @@ contract MockAccessControlHookModule is IValidationHookModule, BaseModule { returns (uint256) { if (entityId == uint32(EntityId.PRE_VALIDATION_HOOK)) { - if (bytes4(userOp.callData[:4]) == IStandardExecutor.execute.selector) { + if (bytes4(userOp.callData[:4]) == IModularAccount.execute.selector) { address target = abi.decode(userOp.callData[4:36], (address)); // Simulate a merkle proof - require that the target address is also provided in the signature @@ -56,7 +56,7 @@ contract MockAccessControlHookModule is IValidationHookModule, BaseModule { bytes calldata authorization ) external view override { if (entityId == uint32(EntityId.PRE_VALIDATION_HOOK)) { - if (bytes4(data[:4]) == IStandardExecutor.execute.selector) { + if (bytes4(data[:4]) == IModularAccount.execute.selector) { address target = abi.decode(data[4:36], (address)); // Simulate a merkle proof - require that the target address is also provided in the authorization diff --git a/test/mocks/modules/ReturnDataModuleMocks.sol b/test/mocks/modules/ReturnDataModuleMocks.sol index 628960c5..13672766 100644 --- a/test/mocks/modules/ReturnDataModuleMocks.sol +++ b/test/mocks/modules/ReturnDataModuleMocks.sol @@ -12,7 +12,7 @@ import {ModuleMetadata} from "../../../src/interfaces/IModule.sol"; import {DIRECT_CALL_VALIDATION_ENTITYID} from "../../../src/helpers/Constants.sol"; -import {IStandardExecutor} from "../../../src/interfaces/IStandardExecutor.sol"; +import {IModularAccount} from "../../../src/interfaces/IModularAccount.sol"; import {IValidationModule} from "../../../src/interfaces/IValidationModule.sol"; import {BaseModule} from "../../../src/modules/BaseModule.sol"; @@ -103,8 +103,8 @@ contract ResultConsumerModule is IExecutionModule, BaseModule, IValidationModule // Check the return data through the execute with authorization case function checkResultExecuteWithAuthorization(address target, bytes32 expected) external returns (bool) { // This result should be allowed based on the manifest permission request - bytes memory returnData = IStandardExecutor(msg.sender).executeWithAuthorization( - abi.encodeCall(IStandardExecutor.execute, (target, 0, abi.encodeCall(RegularResultContract.foo, ()))), + bytes memory returnData = IModularAccount(msg.sender).executeWithAuthorization( + abi.encodeCall(IModularAccount.execute, (target, 0, abi.encodeCall(RegularResultContract.foo, ()))), abi.encodePacked(this, DIRECT_CALL_VALIDATION_ENTITYID, uint8(0), uint32(1), uint8(255)) // Validation // function of self, // selector-associated, with no auth data diff --git a/test/module/AllowlistModule.t.sol b/test/module/AllowlistModule.t.sol index 0d66ed85..e3024065 100644 --- a/test/module/AllowlistModule.t.sol +++ b/test/module/AllowlistModule.t.sol @@ -4,11 +4,9 @@ pragma solidity ^0.8.25; import {IEntryPoint} from "@eth-infinitism/account-abstraction/interfaces/IEntryPoint.sol"; import {UpgradeableModularAccount} from "../../src/account/UpgradeableModularAccount.sol"; - import {HookConfigLib} from "../../src/helpers/HookConfigLib.sol"; import {ModuleEntity, ModuleEntityLib} from "../../src/helpers/ModuleEntityLib.sol"; -import {Call} from "../../src/interfaces/IStandardExecutor.sol"; - +import {Call} from "../../src/interfaces/IModularAccount.sol"; import {AllowlistModule} from "../../src/modules/permissionhooks/AllowlistModule.sol"; import {Counter} from "../mocks/Counter.sol"; diff --git a/test/module/ERC20TokenLimitModule.t.sol b/test/module/ERC20TokenLimitModule.t.sol index f111e21f..493a49fb 100644 --- a/test/module/ERC20TokenLimitModule.t.sol +++ b/test/module/ERC20TokenLimitModule.t.sol @@ -13,7 +13,7 @@ import {ModuleEntityLib} from "../../src/helpers/ModuleEntityLib.sol"; import {ValidationConfigLib} from "../../src/helpers/ValidationConfigLib.sol"; import {ExecutionManifest} from "../../src/interfaces/IExecutionModule.sol"; -import {Call, IStandardExecutor} from "../../src/interfaces/IStandardExecutor.sol"; +import {Call, IModularAccount} from "../../src/interfaces/IModularAccount.sol"; import {ERC20TokenLimitModule} from "../../src/modules/ERC20TokenLimitModule.sol"; import {MockModule} from "../mocks/MockModule.sol"; @@ -101,7 +101,7 @@ contract ERC20TokenLimitModuleTest is AccountTestBase { vm.startPrank(address(entryPoint)); assertEq(module.limits(0, address(erc20), address(acct)), 10 ether); - acct.executeUserOp(_getPackedUO(abi.encodeCall(IStandardExecutor.executeBatch, (calls))), bytes32(0)); + acct.executeUserOp(_getPackedUO(abi.encodeCall(IModularAccount.executeBatch, (calls))), bytes32(0)); assertEq(module.limits(0, address(erc20), address(acct)), 10 ether - 6 ether - 100_001); } @@ -119,7 +119,7 @@ contract ERC20TokenLimitModuleTest is AccountTestBase { vm.startPrank(address(entryPoint)); assertEq(module.limits(0, address(erc20), address(acct)), 10 ether); - acct.executeUserOp(_getPackedUO(abi.encodeCall(IStandardExecutor.executeBatch, (calls))), bytes32(0)); + acct.executeUserOp(_getPackedUO(abi.encodeCall(IModularAccount.executeBatch, (calls))), bytes32(0)); assertEq(module.limits(0, address(erc20), address(acct)), 10 ether - 6 ether - 100_001); } @@ -138,7 +138,7 @@ contract ERC20TokenLimitModuleTest is AccountTestBase { vm.startPrank(address(entryPoint)); assertEq(module.limits(0, address(erc20), address(acct)), 10 ether); PackedUserOperation[] memory uos = new PackedUserOperation[](1); - uos[0] = _getPackedUO(abi.encodeCall(IStandardExecutor.executeBatch, (calls))); + uos[0] = _getPackedUO(abi.encodeCall(IModularAccount.executeBatch, (calls))); entryPoint.handleOps(uos, bundler); // no spend consumed assertEq(module.limits(0, address(erc20), address(acct)), 10 ether); @@ -167,7 +167,7 @@ contract ERC20TokenLimitModuleTest is AccountTestBase { assertEq(module.limits(0, address(erc20), address(acct)), 10 ether); acct.executeWithAuthorization( - abi.encodeCall(IStandardExecutor.executeBatch, (calls)), + abi.encodeCall(IModularAccount.executeBatch, (calls)), _encodeSignature(ModuleEntityLib.pack(address(validationModule), 0), 1, "") ); assertEq(module.limits(0, address(erc20), address(acct)), 10 ether - 6 ether - 100_001); diff --git a/test/module/NativeTokenLimitModule.t.sol b/test/module/NativeTokenLimitModule.t.sol index 6fd1a20f..e899c1d6 100644 --- a/test/module/NativeTokenLimitModule.t.sol +++ b/test/module/NativeTokenLimitModule.t.sol @@ -11,7 +11,7 @@ import {ModuleEntityLib} from "../../src/helpers/ModuleEntityLib.sol"; import {HookConfigLib} from "../../src/helpers/HookConfigLib.sol"; import {ValidationConfigLib} from "../../src/helpers/ValidationConfigLib.sol"; import {ExecutionManifest} from "../../src/interfaces/IExecutionModule.sol"; -import {Call, IStandardExecutor} from "../../src/interfaces/IStandardExecutor.sol"; +import {Call, IModularAccount} from "../../src/interfaces/IModularAccount.sol"; import {NativeTokenLimitModule} from "../../src/modules/NativeTokenLimitModule.sol"; import {MockModule} from "../mocks/MockModule.sol"; @@ -132,7 +132,7 @@ contract NativeTokenLimitModuleTest is AccountTestBase { vm.startPrank(address(entryPoint)); assertEq(module.limits(0, address(acct)), 10 ether); acct.executeUserOp( - _getPackedUO(0, 0, 0, 0, abi.encodeCall(IStandardExecutor.executeBatch, (calls))), bytes32(0) + _getPackedUO(0, 0, 0, 0, abi.encodeCall(IModularAccount.executeBatch, (calls))), bytes32(0) ); assertEq(module.limits(0, address(acct)), 10 ether - 6 ether - 100_001); assertEq(recipient.balance, 6 ether + 100_001); @@ -157,8 +157,7 @@ contract NativeTokenLimitModuleTest is AccountTestBase { vm.startPrank(address(entryPoint)); assertEq(module.limits(0, address(acct)), 10 ether); PackedUserOperation[] memory uos = new PackedUserOperation[](1); - uos[0] = - _getPackedUO(200_000, 200_000, 200_000, 1, abi.encodeCall(IStandardExecutor.executeBatch, (calls))); + uos[0] = _getPackedUO(200_000, 200_000, 200_000, 1, abi.encodeCall(IModularAccount.executeBatch, (calls))); entryPoint.handleOps(uos, bundler); assertEq(module.limits(0, address(acct)), 10 ether - 6 ether - 700_001); @@ -189,7 +188,7 @@ contract NativeTokenLimitModuleTest is AccountTestBase { assertEq(module.limits(0, address(acct)), 10 ether); acct.executeWithAuthorization( - abi.encodeCall(IStandardExecutor.executeBatch, (calls)), _encodeSignature(validationFunction, 1, "") + abi.encodeCall(IModularAccount.executeBatch, (calls)), _encodeSignature(validationFunction, 1, "") ); assertEq(module.limits(0, address(acct)), 4 ether - 100_001); } diff --git a/test/utils/AccountTestBase.sol b/test/utils/AccountTestBase.sol index 05406b36..9fce33e8 100644 --- a/test/utils/AccountTestBase.sol +++ b/test/utils/AccountTestBase.sol @@ -8,7 +8,7 @@ import {MessageHashUtils} from "@openzeppelin/contracts/utils/cryptography/Messa import {SemiModularAccount} from "../../src/account/SemiModularAccount.sol"; import {UpgradeableModularAccount} from "../../src/account/UpgradeableModularAccount.sol"; import {ModuleEntity, ModuleEntityLib} from "../../src/helpers/ModuleEntityLib.sol"; -import {Call, IStandardExecutor} from "../../src/interfaces/IStandardExecutor.sol"; +import {Call, IModularAccount} from "../../src/interfaces/IModularAccount.sol"; import {SingleSignerValidationModule} from "../../src/modules/validation/SingleSignerValidationModule.sol"; import {OptimizedTest} from "./OptimizedTest.sol"; @@ -71,19 +71,19 @@ abstract contract AccountTestBase is OptimizedTest { } function _runExecUserOp(address target, bytes memory callData) internal { - _runUserOp(abi.encodeCall(IStandardExecutor.execute, (target, 0, callData))); + _runUserOp(abi.encodeCall(IModularAccount.execute, (target, 0, callData))); } function _runExecUserOp(address target, bytes memory callData, bytes memory revertReason) internal { - _runUserOp(abi.encodeCall(IStandardExecutor.execute, (target, 0, callData)), revertReason); + _runUserOp(abi.encodeCall(IModularAccount.execute, (target, 0, callData)), revertReason); } function _runExecBatchUserOp(Call[] memory calls) internal { - _runUserOp(abi.encodeCall(IStandardExecutor.executeBatch, (calls))); + _runUserOp(abi.encodeCall(IModularAccount.executeBatch, (calls))); } function _runExecBatchUserOp(Call[] memory calls, bytes memory revertReason) internal { - _runUserOp(abi.encodeCall(IStandardExecutor.executeBatch, (calls)), revertReason); + _runUserOp(abi.encodeCall(IModularAccount.executeBatch, (calls)), revertReason); } function _runUserOp(bytes memory callData) internal { @@ -121,29 +121,29 @@ abstract contract AccountTestBase is OptimizedTest { } function _runtimeExec(address target, bytes memory callData) internal { - _runtimeCall(abi.encodeCall(IStandardExecutor.execute, (target, 0, callData))); + _runtimeCall(abi.encodeCall(IModularAccount.execute, (target, 0, callData))); } function _runtimeExec(address target, bytes memory callData, bytes memory expectedRevertData) internal { - _runtimeCall(abi.encodeCall(IStandardExecutor.execute, (target, 0, callData)), expectedRevertData); + _runtimeCall(abi.encodeCall(IModularAccount.execute, (target, 0, callData)), expectedRevertData); } function _runtimeExecExpFail(address target, bytes memory callData, bytes memory expectedRevertData) internal { - _runtimeCallExpFail(abi.encodeCall(IStandardExecutor.execute, (target, 0, callData)), expectedRevertData); + _runtimeCallExpFail(abi.encodeCall(IModularAccount.execute, (target, 0, callData)), expectedRevertData); } function _runtimeExecBatch(Call[] memory calls) internal { - _runtimeCall(abi.encodeCall(IStandardExecutor.executeBatch, (calls))); + _runtimeCall(abi.encodeCall(IModularAccount.executeBatch, (calls))); } function _runtimeExecBatch(Call[] memory calls, bytes memory expectedRevertData) internal { - _runtimeCall(abi.encodeCall(IStandardExecutor.executeBatch, (calls)), expectedRevertData); + _runtimeCall(abi.encodeCall(IModularAccount.executeBatch, (calls)), expectedRevertData); } function _runtimeExecBatchExpFail(Call[] memory calls, bytes memory expectedRevertData) internal { - _runtimeCallExpFail(abi.encodeCall(IStandardExecutor.executeBatch, (calls)), expectedRevertData); + _runtimeCallExpFail(abi.encodeCall(IModularAccount.executeBatch, (calls)), expectedRevertData); } function _runtimeCall(bytes memory callData) internal {