Skip to content

Commit 34fec34

Browse files
committed
feat: update spec for v0.7.0
1 parent 540df6f commit 34fec34

15 files changed

+197
-178
lines changed

src/account/PluginManagerInternals.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ abstract contract PluginManagerInternals is IPluginManager {
217217
function _installPlugin(
218218
address plugin,
219219
bytes32 manifestHash,
220-
bytes memory pluginInitData,
220+
bytes memory pluginInstallData,
221221
FunctionReference[] memory dependencies
222222
) internal {
223223
AccountStorage storage _storage = getAccountStorage();
@@ -430,7 +430,7 @@ abstract contract PluginManagerInternals is IPluginManager {
430430

431431
// Initialize the plugin storage for the account.
432432
// solhint-disable-next-line no-empty-blocks
433-
try IPlugin(plugin).onInstall(pluginInitData) {}
433+
try IPlugin(plugin).onInstall(pluginInstallData) {}
434434
catch (bytes memory revertReason) {
435435
revert PluginInstallCallbackFailed(plugin, revertReason);
436436
}

src/account/UpgradeableModularAccount.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,10 +261,10 @@ contract UpgradeableModularAccount is
261261
function installPlugin(
262262
address plugin,
263263
bytes32 manifestHash,
264-
bytes calldata pluginInitData,
264+
bytes calldata pluginInstallData,
265265
FunctionReference[] calldata dependencies
266266
) external override wrapNativeFunction {
267-
_installPlugin(plugin, manifestHash, pluginInitData, dependencies);
267+
_installPlugin(plugin, manifestHash, pluginInstallData, dependencies);
268268
}
269269

270270
/// @inheritdoc IPluginManager

src/interfaces/IAccountLoupe.sol

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,35 @@ pragma solidity ^0.8.19;
44
import {FunctionReference} from "../helpers/FunctionReferenceLib.sol";
55

66
interface IAccountLoupe {
7-
/// @notice Config for an execution function, given a selector
7+
/// @notice Config for an execution function, given a selector.
88
struct ExecutionFunctionConfig {
99
address plugin;
1010
FunctionReference userOpValidationFunction;
1111
FunctionReference runtimeValidationFunction;
1212
}
1313

14-
/// @notice Pre and post hooks for a given selector
15-
/// @dev It's possible for one of either `preExecHook` or `postExecHook` to be empty
14+
/// @notice Pre and post hooks for a given selector.
15+
/// @dev It's possible for one of either `preExecHook` or `postExecHook` to be empty.
1616
struct ExecutionHooks {
1717
FunctionReference preExecHook;
1818
FunctionReference postExecHook;
1919
}
2020

21-
/// @notice Gets the validation functions and plugin address for a selector
22-
/// @dev If the selector is a native function, the plugin address will be the address of the account
23-
/// @param selector The selector to get the configuration for
24-
/// @return The configuration for this selector
21+
/// @notice Get the validation functions and plugin address for a selector.
22+
/// @dev If the selector is a native function, the plugin address will be the address of the account.
23+
/// @param selector The selector to get the configuration for.
24+
/// @return The configuration for this selector.
2525
function getExecutionFunctionConfig(bytes4 selector) external view returns (ExecutionFunctionConfig memory);
2626

27-
/// @notice Gets the pre and post execution hooks for a selector
28-
/// @param selector The selector to get the hooks for
29-
/// @return The pre and post execution hooks for this selector
27+
/// @notice Get the pre and post execution hooks for a selector.
28+
/// @param selector The selector to get the hooks for.
29+
/// @return The pre and post execution hooks for this selector.
3030
function getExecutionHooks(bytes4 selector) external view returns (ExecutionHooks[] memory);
3131

32-
/// @notice Gets the pre user op and runtime validation hooks associated with a selector
33-
/// @param selector The selector to get the hooks for
34-
/// @return preUserOpValidationHooks The pre user op validation hooks for this selector
35-
/// @return preRuntimeValidationHooks The pre runtime validation hooks for this selector
32+
/// @notice Get the pre user op and runtime validation hooks associated with a selector.
33+
/// @param selector The selector to get the hooks for.
34+
/// @return preUserOpValidationHooks The pre user op validation hooks for this selector.
35+
/// @return preRuntimeValidationHooks The pre runtime validation hooks for this selector.
3636
function getPreValidationHooks(bytes4 selector)
3737
external
3838
view
@@ -41,7 +41,7 @@ interface IAccountLoupe {
4141
FunctionReference[] memory preRuntimeValidationHooks
4242
);
4343

44-
/// @notice Gets an array of all installed plugins
45-
/// @return The addresses of all installed plugins
44+
/// @notice Get an array of all installed plugins.
45+
/// @return The addresses of all installed plugins.
4646
function getInstalledPlugins() external view returns (address[] memory);
4747
}

src/interfaces/IPlugin.sol

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,28 @@ import {UserOperation} from "@eth-infinitism/account-abstraction/interfaces/User
77
// so annotating here to prevent that.
88
// forgefmt: disable-start
99
enum ManifestAssociatedFunctionType {
10-
/// @notice Function is not defined.
10+
// Function is not defined.
1111
NONE,
12-
/// @notice Function belongs to this plugin.
12+
// Function belongs to this plugin.
1313
SELF,
14-
/// @notice Function belongs to an external plugin provided as a dependency during plugin installation.
14+
// Function belongs to an external plugin provided as a dependency during plugin installation.
1515
DEPENDENCY,
16-
/// @notice Resolves to a magic value to always bypass runtime validation for a given function.
17-
/// This is only assignable on runtime validation functions. If it were to be used on a user op validationFunction,
18-
/// it would risk burning gas from the account. When used as a hook in any hook location, it is equivalent to not
19-
/// setting a hook and is therefore disallowed.
16+
// Resolves to a magic value to always bypass runtime validation for a given function.
17+
// This is only assignable on runtime validation functions. If it were to be used on a user op validationFunction,
18+
// it would risk burning gas from the account. When used as a hook in any hook location, it is equivalent to not
19+
// setting a hook and is therefore disallowed.
2020
RUNTIME_VALIDATION_ALWAYS_ALLOW,
21-
/// @notice Resolves to a magic value to always fail in a hook for a given function.
22-
/// This is only assignable to pre hooks (pre validation and pre execution). It should not be used on
23-
/// validation functions themselves, because this is equivalent to leaving the validation functions unset.
24-
/// It should not be used in post-exec hooks, because if it is known to always revert, that should happen
25-
/// as early as possible to save gas.
21+
// Resolves to a magic value to always fail in a hook for a given function.
22+
// This is only assignable to pre hooks (pre validation and pre execution). It should not be used on
23+
// validation functions themselves, because this is equivalent to leaving the validation functions unset.
24+
// It should not be used in post-exec hooks, because if it is known to always revert, that should happen
25+
// as early as possible to save gas.
2626
PRE_HOOK_ALWAYS_DENY
2727
}
2828
// forgefmt: disable-end
2929

30-
// For functions of type `ManifestAssociatedFunctionType.DEPENDENCY`, the MSCA MUST find the plugin address
31-
// of the function at `dependencies[dependencyIndex]` during the call to `installPlugin(config)`.
30+
/// @dev For functions of type `ManifestAssociatedFunctionType.DEPENDENCY`, the MSCA MUST find the plugin address
31+
/// of the function at `dependencies[dependencyIndex]` during the call to `installPlugin(config)`.
3232
struct ManifestFunction {
3333
ManifestAssociatedFunctionType functionType;
3434
uint8 functionId;
@@ -73,19 +73,21 @@ struct PluginMetadata {
7373

7474
/// @dev A struct describing how the plugin should be installed on a modular account.
7575
struct PluginManifest {
76-
// List of ERC-165 interfaceIds to add to account to support introspection checks.
76+
// List of ERC-165 interface IDs to add to account to support introspection checks. This MUST NOT include
77+
// IPlugin's interface ID.
7778
bytes4[] interfaceIds;
78-
// If this plugin depends on other plugins' validation functions and/or hooks, the interface IDs of
79-
// those plugins MUST be provided here, with its position in the array matching the `dependencyIndex`
80-
// members of `ManifestFunction` structs used in the manifest.
79+
// If this plugin depends on other plugins' validation functions, the interface IDs of those plugins MUST be
80+
// provided here, with its position in the array matching the `dependencyIndex` members of `ManifestFunction`
81+
// structs used in the manifest.
8182
bytes4[] dependencyInterfaceIds;
8283
// Execution functions defined in this plugin to be installed on the MSCA.
8384
bytes4[] executionFunctions;
8485
// Plugin execution functions already installed on the MSCA that this plugin will be able to call.
8586
bytes4[] permittedExecutionSelectors;
86-
// Boolean to indicate whether the plugin can call any external contract addresses.
87+
// Boolean to indicate whether the plugin can call any external address.
8788
bool permitAnyExternalAddress;
88-
// Boolean to indicate whether the plugin needs access to spend native tokens of the account.
89+
// Boolean to indicate whether the plugin needs access to spend native tokens of the account. If false, the
90+
// plugin MUST still be able to spend up to the balance that it sends to the account in the same call.
8991
bool canSpendNativeToken;
9092
ManifestExternalCallPermission[] permittedExternalCalls;
9193
ManifestAssociatedFunction[] userOpValidationFunctions;

src/interfaces/IPluginExecutor.sol

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,20 @@
22
pragma solidity ^0.8.19;
33

44
interface IPluginExecutor {
5-
/// @notice Executes a call from a plugin to another plugin.
6-
/// @dev Permissions must be granted to the calling plugin for the call to go through.
7-
/// @param data calldata to send to the plugin
8-
/// @return The result of the call
5+
/// @notice Execute a call from a plugin to another plugin, via an execution function installed on the account.
6+
/// @dev Plugins are not allowed to call native functions on the account. Permissions must be granted to the
7+
/// calling plugin for the call to go through.
8+
/// @param data The calldata to send to the plugin.
9+
/// @return The return data from the call.
910
function executeFromPlugin(bytes calldata data) external payable returns (bytes memory);
1011

11-
/// @notice Executes a call from a plugin to a non-plugin address.
12-
/// @dev Permissions must be granted to the calling plugin for the call to go through.
13-
/// @param target address of the target to call
14-
/// @param value value to send with the call
15-
/// @param data calldata to send to the target
16-
/// @return The result of the call
12+
/// @notice Execute a call from a plugin to a non-plugin address.
13+
/// @dev If the target is a plugin, the call SHOULD revert. Permissions must be granted to the calling plugin
14+
/// for the call to go through.
15+
/// @param target The address to be called.
16+
/// @param value The value to send with the call.
17+
/// @param data The calldata to send to the target.
18+
/// @return The return data from the call.
1719
function executeFromPluginExternal(address target, uint256 value, bytes calldata data)
1820
external
1921
payable

src/interfaces/IPluginManager.sol

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@ pragma solidity ^0.8.19;
33

44
import {FunctionReference} from "../helpers/FunctionReferenceLib.sol";
55

6-
/// @title Plugin Manager Interface
76
interface IPluginManager {
87
event PluginInstalled(address indexed plugin, bytes32 manifestHash, FunctionReference[] dependencies);
98

10-
event PluginUninstalled(address indexed plugin, bool indexed callbacksSucceeded);
9+
event PluginUninstalled(address indexed plugin, bool indexed onUninstallSucceeded);
1110

1211
/// @notice Install a plugin to the modular account.
1312
/// @param plugin The plugin to install.
1413
/// @param manifestHash The hash of the plugin manifest.
15-
/// @param pluginInitData Optional data to be decoded and used by the plugin to setup initial plugin data for
16-
/// the modular account.
17-
/// @param dependencies The dependencies of the plugin, as described in the manifest.
14+
/// @param pluginInstallData Optional data to be decoded and used by the plugin to setup initial plugin data
15+
/// for the modular account.
16+
/// @param dependencies The dependencies of the plugin, as described in the manifest. Each FunctionReference
17+
/// MUST be composed of an installed plugin's address and a function ID of its validation function.
1818
function installPlugin(
1919
address plugin,
2020
bytes32 manifestHash,
21-
bytes calldata pluginInitData,
21+
bytes calldata pluginInstallData,
2222
FunctionReference[] calldata dependencies
2323
) external;
2424

src/interfaces/IStandardExecutor.sol

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,26 @@
22
pragma solidity ^0.8.19;
33

44
struct Call {
5-
// The target address for account to call.
5+
// The target address for the account to call.
66
address target;
77
// The value sent with the call.
88
uint256 value;
9-
// The call data for the call.
9+
// The calldata for the call.
1010
bytes data;
1111
}
1212

13-
/// @title Standard Executor Interface
1413
interface IStandardExecutor {
1514
/// @notice Standard execute method.
1615
/// @dev If the target is a plugin, the call SHOULD revert.
17-
/// @param target The target address for account to call.
16+
/// @param target The target address for the account to call.
1817
/// @param value The value sent with the call.
19-
/// @param data The call data for the call.
18+
/// @param data The calldata for the call.
2019
/// @return The return data from the call.
2120
function execute(address target, uint256 value, bytes calldata data) external payable returns (bytes memory);
2221

2322
/// @notice Standard executeBatch method.
24-
/// @dev If the target is a plugin, the call SHOULD revert. If any of the transactions revert, the entire batch
25-
/// reverts.
23+
/// @dev If the target is a plugin, the call SHOULD revert. If any of the calls revert, the entire batch MUST
24+
/// revert.
2625
/// @param calls The array of calls.
2726
/// @return An array containing the return data from the calls.
2827
function executeBatch(Call[] calldata calls) external payable returns (bytes[] memory);

0 commit comments

Comments
 (0)