diff --git a/src/account/PluginManagerInternals.sol b/src/account/PluginManagerInternals.sol index 1fc64744..90f9b05b 100644 --- a/src/account/PluginManagerInternals.sol +++ b/src/account/PluginManagerInternals.sol @@ -78,7 +78,7 @@ abstract contract PluginManagerInternals is IPluginManager { function _addValidationFunction(address plugin, ManifestValidation memory mv) internal { AccountStorage storage _storage = getAccountStorage(); - FunctionReference validationFunction = FunctionReferenceLib.pack(plugin, mv.validationId); + FunctionReference validationFunction = FunctionReferenceLib.pack(plugin, mv.entityId); if (mv.isDefault) { _storage.validationData[validationFunction].isGlobal = true; @@ -99,7 +99,7 @@ abstract contract PluginManagerInternals is IPluginManager { function _removeValidationFunction(address plugin, ManifestValidation memory mv) internal { AccountStorage storage _storage = getAccountStorage(); - FunctionReference validationFunction = FunctionReferenceLib.pack(plugin, mv.validationId); + FunctionReference validationFunction = FunctionReferenceLib.pack(plugin, mv.entityId); _storage.validationData[validationFunction].isGlobal = false; _storage.validationData[validationFunction].isSignatureValidation = false; @@ -183,7 +183,7 @@ abstract contract PluginManagerInternals is IPluginManager { for (uint256 i = 0; i < length; ++i) { ManifestExecutionHook memory mh = manifest.executionHooks[i]; EnumerableSet.Bytes32Set storage execHooks = _storage.selectorData[mh.executionSelector].executionHooks; - FunctionReference hookFunction = FunctionReferenceLib.pack(plugin, mh.validationId); + FunctionReference hookFunction = FunctionReferenceLib.pack(plugin, mh.entityId); _addExecHooks(execHooks, hookFunction, mh.isPreHook, mh.isPostHook); } @@ -223,7 +223,7 @@ abstract contract PluginManagerInternals is IPluginManager { uint256 length = manifest.executionHooks.length; for (uint256 i = 0; i < length; ++i) { ManifestExecutionHook memory mh = manifest.executionHooks[i]; - FunctionReference hookFunction = FunctionReferenceLib.pack(plugin, mh.validationId); + FunctionReference hookFunction = FunctionReferenceLib.pack(plugin, mh.entityId); EnumerableSet.Bytes32Set storage execHooks = _storage.selectorData[mh.executionSelector].executionHooks; _removeExecHooks(execHooks, hookFunction, mh.isPreHook, mh.isPostHook); } diff --git a/src/account/UpgradeableModularAccount.sol b/src/account/UpgradeableModularAccount.sol index 17c930ad..8e7c2ec6 100644 --- a/src/account/UpgradeableModularAccount.sol +++ b/src/account/UpgradeableModularAccount.sol @@ -68,18 +68,18 @@ contract UpgradeableModularAccount is error NativeTokenSpendingNotPermitted(address plugin); error NonCanonicalEncoding(); error NotEntryPoint(); - error PostExecHookReverted(address plugin, uint32 validationId, bytes revertReason); - error PreExecHookReverted(address plugin, uint32 validationId, bytes revertReason); - error PreRuntimeValidationHookFailed(address plugin, uint32 validationId, bytes revertReason); + error PostExecHookReverted(address plugin, uint32 entityId, bytes revertReason); + error PreExecHookReverted(address plugin, uint32 entityId, bytes revertReason); + error PreRuntimeValidationHookFailed(address plugin, uint32 entityId, bytes revertReason); error RequireUserOperationContext(); error RuntimeValidationFunctionMissing(bytes4 selector); - error RuntimeValidationFunctionReverted(address plugin, uint32 validationId, bytes revertReason); + error RuntimeValidationFunctionReverted(address plugin, uint32 entityId, bytes revertReason); error SelfCallRecursionDepthExceeded(); - error SignatureValidationInvalid(address plugin, uint32 validationId); - error UnexpectedAggregator(address plugin, uint32 validationId, address aggregator); + error SignatureValidationInvalid(address plugin, uint32 entityId); + error UnexpectedAggregator(address plugin, uint32 entityId, address aggregator); error UnrecognizedFunction(bytes4 selector); error UserOpValidationFunctionMissing(bytes4 selector); - error ValidationDoesNotApply(bytes4 selector, address plugin, uint32 validationId, bool isGlobal); + error ValidationDoesNotApply(bytes4 selector, address plugin, uint32 entityId, bool isGlobal); error ValidationSignatureSegmentMissing(); error SignatureSegmentOutOfOrder(); @@ -343,15 +343,13 @@ contract UpgradeableModularAccount is FunctionReference sigValidation = FunctionReference.wrap(bytes24(signature)); - (address plugin, uint32 validationId) = sigValidation.unpack(); + (address plugin, uint32 entityId) = sigValidation.unpack(); if (!_storage.validationData[sigValidation].isSignatureValidation) { - revert SignatureValidationInvalid(plugin, validationId); + revert SignatureValidationInvalid(plugin, entityId); } - if ( - IValidation(plugin).validateSignature(validationId, msg.sender, hash, signature[24:]) - == _1271_MAGIC_VALUE - ) { + if (IValidation(plugin).validateSignature(entityId, msg.sender, hash, signature[24:]) == _1271_MAGIC_VALUE) + { return _1271_MAGIC_VALUE; } return _1271_INVALID; @@ -434,13 +432,13 @@ contract UpgradeableModularAccount is userOp.signature = ""; } - (address plugin, uint32 validationId) = preUserOpValidationHooks[i].unpack(); + (address plugin, uint32 entityId) = preUserOpValidationHooks[i].unpack(); uint256 currentValidationData = - IValidationHook(plugin).preUserOpValidationHook(validationId, userOp, userOpHash); + IValidationHook(plugin).preUserOpValidationHook(entityId, userOp, userOpHash); if (uint160(currentValidationData) > 1) { // If the aggregator is not 0 or 1, it is an unexpected value - revert UnexpectedAggregator(plugin, validationId, address(uint160(currentValidationData))); + revert UnexpectedAggregator(plugin, entityId, address(uint160(currentValidationData))); } validationData = _coalescePreValidation(validationData, currentValidationData); } @@ -453,8 +451,8 @@ contract UpgradeableModularAccount is userOp.signature = signatureSegment.getBody(); - (address plugin, uint32 validationId) = userOpValidationFunction.unpack(); - uint256 currentValidationData = IValidation(plugin).validateUserOp(validationId, userOp, userOpHash); + (address plugin, uint32 entityId) = userOpValidationFunction.unpack(); + uint256 currentValidationData = IValidation(plugin).validateUserOp(entityId, userOp, userOpHash); if (preUserOpValidationHooks.length != 0) { // If we have other validation data we need to coalesce with @@ -501,15 +499,15 @@ contract UpgradeableModularAccount is currentAuthData = ""; } - (address hookPlugin, uint32 hookValidationId) = preRuntimeValidationHooks[i].unpack(); + (address hookPlugin, uint32 hookEntityId) = preRuntimeValidationHooks[i].unpack(); try IValidationHook(hookPlugin).preRuntimeValidationHook( - hookValidationId, msg.sender, msg.value, callData, currentAuthData + hookEntityId, msg.sender, msg.value, callData, currentAuthData ) // forgefmt: disable-start // solhint-disable-next-line no-empty-blocks {} catch (bytes memory revertReason) { // forgefmt: disable-end - revert PreRuntimeValidationHookFailed(hookPlugin, hookValidationId, revertReason); + revert PreRuntimeValidationHookFailed(hookPlugin, hookEntityId, revertReason); } } @@ -517,16 +515,14 @@ contract UpgradeableModularAccount is revert ValidationSignatureSegmentMissing(); } - (address plugin, uint32 validationId) = runtimeValidationFunction.unpack(); + (address plugin, uint32 entityId) = runtimeValidationFunction.unpack(); - try IValidation(plugin).validateRuntime( - validationId, msg.sender, msg.value, callData, authSegment.getBody() - ) + try IValidation(plugin).validateRuntime(entityId, msg.sender, msg.value, callData, authSegment.getBody()) // forgefmt: disable-start // solhint-disable-next-line no-empty-blocks {} catch (bytes memory revertReason) { // forgefmt: disable-end - revert RuntimeValidationFunctionReverted(plugin, validationId, revertReason); + revert RuntimeValidationFunctionReverted(plugin, entityId, revertReason); } } @@ -571,14 +567,14 @@ contract UpgradeableModularAccount is internal returns (bytes memory preExecHookReturnData) { - (address plugin, uint32 validationId) = preExecHook.unpack(); - try IExecutionHook(plugin).preExecutionHook(validationId, msg.sender, msg.value, data) returns ( + (address plugin, uint32 entityId) = preExecHook.unpack(); + try IExecutionHook(plugin).preExecutionHook(entityId, msg.sender, msg.value, data) returns ( bytes memory returnData ) { preExecHookReturnData = returnData; } catch (bytes memory revertReason) { // TODO: same issue with EP0.6 - we can't do bytes4 error codes in plugins - revert PreExecHookReverted(plugin, validationId, revertReason); + revert PreExecHookReverted(plugin, entityId, revertReason); } } @@ -596,11 +592,11 @@ contract UpgradeableModularAccount is continue; } - (address plugin, uint32 validationId) = postHookToRun.postExecHook.unpack(); + (address plugin, uint32 entityId) = postHookToRun.postExecHook.unpack(); // solhint-disable-next-line no-empty-blocks - try IExecutionHook(plugin).postExecutionHook(validationId, postHookToRun.preExecHookReturnData) {} + try IExecutionHook(plugin).postExecutionHook(entityId, postHookToRun.preExecHookReturnData) {} catch (bytes memory revertReason) { - revert PostExecHookReverted(plugin, validationId, revertReason); + revert PostExecHookReverted(plugin, entityId, revertReason); } } } diff --git a/src/helpers/FunctionReferenceLib.sol b/src/helpers/FunctionReferenceLib.sol index e39b9360..6e9c4dc6 100644 --- a/src/helpers/FunctionReferenceLib.sol +++ b/src/helpers/FunctionReferenceLib.sol @@ -9,14 +9,14 @@ library FunctionReferenceLib { // Magic value for hooks that should always revert. FunctionReference internal constant _PRE_HOOK_ALWAYS_DENY = FunctionReference.wrap(bytes24(uint192(2))); - function pack(address addr, uint32 validationId) internal pure returns (FunctionReference) { - return FunctionReference.wrap(bytes24(bytes20(addr)) | bytes24(uint192(validationId))); + function pack(address addr, uint32 entityId) internal pure returns (FunctionReference) { + return FunctionReference.wrap(bytes24(bytes20(addr)) | bytes24(uint192(entityId))); } - function unpack(FunctionReference fr) internal pure returns (address addr, uint32 validationId) { + function unpack(FunctionReference fr) internal pure returns (address addr, uint32 entityId) { bytes24 underlying = FunctionReference.unwrap(fr); addr = address(bytes20(underlying)); - validationId = uint32(bytes4(underlying << 160)); + entityId = uint32(bytes4(underlying << 160)); } function isEmpty(FunctionReference fr) internal pure returns (bool) { diff --git a/src/helpers/ValidationConfigLib.sol b/src/helpers/ValidationConfigLib.sol index 51bbf63c..f2dfacea 100644 --- a/src/helpers/ValidationConfigLib.sol +++ b/src/helpers/ValidationConfigLib.sol @@ -28,7 +28,7 @@ library ValidationConfigLib { ); } - function pack(address _plugin, uint32 _validationId, bool _isGlobal, bool _isSignatureValidation) + function pack(address _plugin, uint32 _entityId, bool _isGlobal, bool _isSignatureValidation) internal pure returns (ValidationConfig) @@ -37,8 +37,8 @@ library ValidationConfigLib { bytes26( // plugin address stored in the first 20 bytes bytes26(bytes20(_plugin)) - // validationId stored in the 21st - 24th byte - | bytes26(bytes32(uint256(_validationId) << 168)) + // entityId stored in the 21st - 24th byte + | bytes26(bytes32(uint256(_entityId) << 168)) // isGlobal flag stored in the 25th byte | bytes26(bytes32(_isGlobal ? uint256(1) << 56 : 0)) // isSignatureValidation flag stored in the 26th byte @@ -50,11 +50,11 @@ library ValidationConfigLib { function unpackUnderlying(ValidationConfig config) internal pure - returns (address _plugin, uint32 _validationId, bool _isGlobal, bool _isSignatureValidation) + returns (address _plugin, uint32 _entityId, bool _isGlobal, bool _isSignatureValidation) { bytes26 configBytes = ValidationConfig.unwrap(config); _plugin = address(bytes20(configBytes)); - _validationId = uint32(bytes4(configBytes << 160)); + _entityId = uint32(bytes4(configBytes << 160)); _isGlobal = uint8(configBytes[24]) == 1; _isSignatureValidation = uint8(configBytes[25]) == 1; } @@ -74,7 +74,7 @@ library ValidationConfigLib { return address(bytes20(ValidationConfig.unwrap(config))); } - function validationId(ValidationConfig config) internal pure returns (uint32) { + function entityId(ValidationConfig config) internal pure returns (uint32) { return uint32(bytes4(ValidationConfig.unwrap(config) << 160)); } diff --git a/src/interfaces/IExecutionHook.sol b/src/interfaces/IExecutionHook.sol index 3afff456..6f0b06eb 100644 --- a/src/interfaces/IExecutionHook.sol +++ b/src/interfaces/IExecutionHook.sol @@ -4,24 +4,24 @@ pragma solidity ^0.8.25; import {IPlugin} from "./IPlugin.sol"; interface IExecutionHook is IPlugin { - /// @notice Run the pre execution hook specified by the `validationId`. + /// @notice Run the pre execution hook specified by the `entityId`. /// @dev To indicate the entire call should revert, the function MUST revert. - /// @param validationId An identifier that routes the call to different internal implementations, should there + /// @param entityId An identifier that routes the call to different internal implementations, should there /// be /// more than one. /// @param sender The caller address. /// @param value The call value. /// @param data The calldata sent. /// @return Context to pass to a post execution hook, if present. An empty bytes array MAY be returned. - function preExecutionHook(uint32 validationId, address sender, uint256 value, bytes calldata data) + function preExecutionHook(uint32 entityId, address sender, uint256 value, bytes calldata data) external returns (bytes memory); - /// @notice Run the post execution hook specified by the `validationId`. + /// @notice Run the post execution hook specified by the `entityId`. /// @dev To indicate the entire call should revert, the function MUST revert. - /// @param validationId An identifier that routes the call to different internal implementations, should there + /// @param entityId An identifier that routes the call to different internal implementations, should there /// be /// more than one. /// @param preExecHookData The context returned by its associated pre execution hook. - function postExecutionHook(uint32 validationId, bytes calldata preExecHookData) external; + function postExecutionHook(uint32 entityId, bytes calldata preExecHookData) external; } diff --git a/src/interfaces/IPlugin.sol b/src/interfaces/IPlugin.sol index 1b576bd6..824a1ddf 100644 --- a/src/interfaces/IPlugin.sol +++ b/src/interfaces/IPlugin.sol @@ -15,7 +15,7 @@ struct ManifestExecutionFunction { // todo: do we need these at all? Or do we fully switch to `installValidation`? struct ManifestValidation { - uint32 validationId; + uint32 entityId; bool isDefault; bool isSignatureValidation; bytes4[] selectors; @@ -24,7 +24,7 @@ struct ManifestValidation { struct ManifestExecutionHook { // TODO(erc6900 spec): These fields can be packed into a single word bytes4 executionSelector; - uint32 validationId; + uint32 entityId; bool isPreHook; bool isPostHook; } diff --git a/src/interfaces/IValidation.sol b/src/interfaces/IValidation.sol index 2f3e1292..266e6878 100644 --- a/src/interfaces/IValidation.sol +++ b/src/interfaces/IValidation.sol @@ -6,20 +6,20 @@ import {PackedUserOperation} from "@eth-infinitism/account-abstraction/interface import {IPlugin} from "./IPlugin.sol"; interface IValidation is IPlugin { - /// @notice Run the user operation validationFunction specified by the `validationId`. - /// @param validationId An identifier that routes the call to different internal implementations, should there + /// @notice Run the user operation validationFunction specified by the `entityId`. + /// @param entityId An identifier that routes the call to different internal implementations, should there /// be /// more than one. /// @param userOp The user operation. /// @param userOpHash The user operation hash. /// @return Packed validation data for validAfter (6 bytes), validUntil (6 bytes), and authorizer (20 bytes). - function validateUserOp(uint32 validationId, PackedUserOperation calldata userOp, bytes32 userOpHash) + function validateUserOp(uint32 entityId, PackedUserOperation calldata userOp, bytes32 userOpHash) external returns (uint256); - /// @notice Run the runtime validationFunction specified by the `validationId`. + /// @notice Run the runtime validationFunction specified by the `entityId`. /// @dev To indicate the entire call should revert, the function MUST revert. - /// @param validationId An identifier that routes the call to different internal implementations, should there + /// @param entityId An identifier that routes the call to different internal implementations, should there /// be /// more than one. /// @param sender The caller address. @@ -27,7 +27,7 @@ interface IValidation is IPlugin { /// @param data The calldata sent. /// @param authorization Additional data for the validation function to use. function validateRuntime( - uint32 validationId, + uint32 entityId, address sender, uint256 value, bytes calldata data, @@ -36,14 +36,14 @@ interface IValidation is IPlugin { /// @notice Validates a signature using ERC-1271. /// @dev To indicate the entire call should revert, the function MUST revert. - /// @param validationId An identifier that routes the call to different internal implementations, should there + /// @param entityId An identifier that routes the call to different internal implementations, should there /// be /// more than one. /// @param sender the address that sent the ERC-1271 request to the smart account /// @param hash the hash of the ERC-1271 request /// @param signature the signature of the ERC-1271 request /// @return the ERC-1271 `MAGIC_VALUE` if the signature is valid, or 0xFFFFFFFF if invalid. - function validateSignature(uint32 validationId, address sender, bytes32 hash, bytes calldata signature) + function validateSignature(uint32 entityId, address sender, bytes32 hash, bytes calldata signature) external view returns (bytes4); diff --git a/src/interfaces/IValidationHook.sol b/src/interfaces/IValidationHook.sol index 9febf60b..dc5630dc 100644 --- a/src/interfaces/IValidationHook.sol +++ b/src/interfaces/IValidationHook.sol @@ -6,28 +6,28 @@ import {PackedUserOperation} from "@eth-infinitism/account-abstraction/interface import {IPlugin} from "./IPlugin.sol"; interface IValidationHook is IPlugin { - /// @notice Run the pre user operation validation hook specified by the `validationId`. + /// @notice Run the pre user operation validation hook specified by the `entityId`. /// @dev Pre user operation validation hooks MUST NOT return an authorizer value other than 0 or 1. - /// @param validationId An identifier that routes the call to different internal implementations, should there + /// @param entityId An identifier that routes the call to different internal implementations, should there /// be /// more than one. /// @param userOp The user operation. /// @param userOpHash The user operation hash. /// @return Packed validation data for validAfter (6 bytes), validUntil (6 bytes), and authorizer (20 bytes). - function preUserOpValidationHook(uint32 validationId, PackedUserOperation calldata userOp, bytes32 userOpHash) + function preUserOpValidationHook(uint32 entityId, PackedUserOperation calldata userOp, bytes32 userOpHash) external returns (uint256); - /// @notice Run the pre runtime validation hook specified by the `validationId`. + /// @notice Run the pre runtime validation hook specified by the `entityId`. /// @dev To indicate the entire call should revert, the function MUST revert. - /// @param validationId An identifier that routes the call to different internal implementations, should there + /// @param entityId An identifier that routes the call to different internal implementations, should there /// be /// more than one. /// @param sender The caller address. /// @param value The call value. /// @param data The calldata sent. function preRuntimeValidationHook( - uint32 validationId, + uint32 entityId, address sender, uint256 value, bytes calldata data, @@ -36,15 +36,15 @@ interface IValidationHook is IPlugin { // TODO: support this hook type within the account & in the manifest - /// @notice Run the pre signature validation hook specified by the `validationId`. + /// @notice Run the pre signature validation hook specified by the `entityId`. /// @dev To indicate the call should revert, the function MUST revert. - /// @param validationId An identifier that routes the call to different internal implementations, should there + /// @param entityId An identifier that routes the call to different internal implementations, should there /// be /// more than one. /// @param sender The caller address. /// @param hash The hash of the message being signed. /// @param signature The signature of the message. - // function preSignatureValidationHook(uint32 validationId, address sender, bytes32 hash, bytes calldata + // function preSignatureValidationHook(uint32 entityId, address sender, bytes32 hash, bytes calldata // signature) // external // view diff --git a/src/plugins/owner/SingleOwnerPlugin.sol b/src/plugins/owner/SingleOwnerPlugin.sol index c8aa6495..d82a1824 100644 --- a/src/plugins/owner/SingleOwnerPlugin.sol +++ b/src/plugins/owner/SingleOwnerPlugin.sol @@ -82,20 +82,20 @@ contract SingleOwnerPlugin is IValidation, BasePlugin { } /// @inheritdoc IValidation - function validateRuntime(uint32 validationId, address sender, uint256, bytes calldata, bytes calldata) + function validateRuntime(uint32 entityId, address sender, uint256, bytes calldata, bytes calldata) external view override { // Validate that the sender is the owner of the account or self. - if (sender != owners[validationId][msg.sender]) { + if (sender != owners[entityId][msg.sender]) { revert NotAuthorized(); } return; } /// @inheritdoc IValidation - function validateUserOp(uint32 validationId, PackedUserOperation calldata userOp, bytes32 userOpHash) + function validateUserOp(uint32 entityId, PackedUserOperation calldata userOp, bytes32 userOpHash) external view override @@ -104,7 +104,7 @@ contract SingleOwnerPlugin is IValidation, BasePlugin { // Validate the user op signature against the owner. if ( SignatureChecker.isValidSignatureNow( - owners[validationId][msg.sender], userOpHash.toEthSignedMessageHash(), userOp.signature + owners[entityId][msg.sender], userOpHash.toEthSignedMessageHash(), userOp.signature ) ) { return _SIG_VALIDATION_PASSED; @@ -123,13 +123,13 @@ contract SingleOwnerPlugin is IValidation, BasePlugin { /// validation used in `validateUserOp`, this does///*not** wrap the digest in /// an "Ethereum Signed Message" envelope before checking the signature in /// the EOA-owner case. - function validateSignature(uint32 validationId, address, bytes32 digest, bytes calldata signature) + function validateSignature(uint32 entityId, address, bytes32 digest, bytes calldata signature) external view override returns (bytes4) { - if (SignatureChecker.isValidSignatureNow(owners[validationId][msg.sender], digest, signature)) { + if (SignatureChecker.isValidSignatureNow(owners[entityId][msg.sender], digest, signature)) { return _1271_MAGIC_VALUE; } return _1271_INVALID; diff --git a/src/samples/permissionhooks/AllowlistPlugin.sol b/src/samples/permissionhooks/AllowlistPlugin.sol index 3207bdd6..2d86ca18 100644 --- a/src/samples/permissionhooks/AllowlistPlugin.sol +++ b/src/samples/permissionhooks/AllowlistPlugin.sol @@ -9,7 +9,7 @@ import {IStandardExecutor, Call} from "../../interfaces/IStandardExecutor.sol"; import {BasePlugin} from "../../plugins/BasePlugin.sol"; contract AllowlistPlugin is IValidationHook, BasePlugin { - enum ValidationId { + enum EntityId { PRE_VALIDATION_HOOK } @@ -68,25 +68,25 @@ contract AllowlistPlugin is IValidationHook, BasePlugin { selectorAllowlist[target][selector][msg.sender] = allowed; } - function preUserOpValidationHook(uint32 validationId, PackedUserOperation calldata userOp, bytes32) + function preUserOpValidationHook(uint32 entityId, PackedUserOperation calldata userOp, bytes32) external view override returns (uint256) { - if (validationId == uint32(ValidationId.PRE_VALIDATION_HOOK)) { + if (entityId == uint32(EntityId.PRE_VALIDATION_HOOK)) { _checkAllowlistCalldata(userOp.callData); return 0; } revert NotImplemented(); } - function preRuntimeValidationHook(uint32 validationId, address, uint256, bytes calldata data, bytes calldata) + function preRuntimeValidationHook(uint32 entityId, address, uint256, bytes calldata data, bytes calldata) external view override { - if (validationId == uint32(ValidationId.PRE_VALIDATION_HOOK)) { + if (entityId == uint32(EntityId.PRE_VALIDATION_HOOK)) { _checkAllowlistCalldata(data); return; } diff --git a/standard/ERCs/erc-6900.md b/standard/ERCs/erc-6900.md index 1adfb375..9c80488c 100644 --- a/standard/ERCs/erc-6900.md +++ b/standard/ERCs/erc-6900.md @@ -267,56 +267,56 @@ interface IPlugin { /// @param data Optional bytes array to be decoded and used by the plugin to clear plugin data for the modular account. function onUninstall(bytes calldata data) external; - /// @notice Run the pre user operation validation hook specified by the `validationId`. + /// @notice Run the pre user operation validation hook specified by the `entityId`. /// @dev Pre user operation validation hooks MUST NOT return an authorizer value other than 0 or 1. - /// @param validationId An identifier that routes the call to different internal implementations, should there be more than one. + /// @param entityId An identifier that routes the call to different internal implementations, should there be more than one. /// @param userOp The user operation. /// @param userOpHash The user operation hash. /// @return Packed validation data for validAfter (6 bytes), validUntil (6 bytes), and authorizer (20 bytes). - function preUserOpValidationHook(uint8 validationId, PackedUserOperation memory userOp, bytes32 userOpHash) external returns (uint256); + function preUserOpValidationHook(uint8 entityId, PackedUserOperation memory userOp, bytes32 userOpHash) external returns (uint256); - /// @notice Run the user operation validationFunction specified by the `validationId`. - /// @param validationId An identifier that routes the call to different internal implementations, should there be + /// @notice Run the user operation validationFunction specified by the `entityId`. + /// @param entityId An identifier that routes the call to different internal implementations, should there be /// more than one. /// @param userOp The user operation. /// @param userOpHash The user operation hash. /// @return Packed validation data for validAfter (6 bytes), validUntil (6 bytes), and authorizer (20 bytes). - function userOpValidationFunction(uint8 validationId, PackedUserOperation calldata userOp, bytes32 userOpHash) + function userOpValidationFunction(uint8 entityId, PackedUserOperation calldata userOp, bytes32 userOpHash) external returns (uint256); - /// @notice Run the pre runtime validation hook specified by the `validationId`. + /// @notice Run the pre runtime validation hook specified by the `entityId`. /// @dev To indicate the entire call should revert, the function MUST revert. - /// @param validationId An identifier that routes the call to different internal implementations, should there be more than one. + /// @param entityId An identifier that routes the call to different internal implementations, should there be more than one. /// @param sender The caller address. /// @param value The call value. /// @param data The calldata sent. - function preRuntimeValidationHook(uint8 validationId, address sender, uint256 value, bytes calldata data) external; + function preRuntimeValidationHook(uint8 entityId, address sender, uint256 value, bytes calldata data) external; - /// @notice Run the runtime validationFunction specified by the `validationId`. + /// @notice Run the runtime validationFunction specified by the `entityId`. /// @dev To indicate the entire call should revert, the function MUST revert. - /// @param validationId An identifier that routes the call to different internal implementations, should there be + /// @param entityId An identifier that routes the call to different internal implementations, should there be /// more than one. /// @param sender The caller address. /// @param value The call value. /// @param data The calldata sent. - function runtimeValidationFunction(uint8 validationId, address sender, uint256 value, bytes calldata data) + function runtimeValidationFunction(uint8 entityId, address sender, uint256 value, bytes calldata data) external; - /// @notice Run the pre execution hook specified by the `validationId`. + /// @notice Run the pre execution hook specified by the `entityId`. /// @dev To indicate the entire call should revert, the function MUST revert. - /// @param validationId An identifier that routes the call to different internal implementations, should there be more than one. + /// @param entityId An identifier that routes the call to different internal implementations, should there be more than one. /// @param sender The caller address. /// @param value The call value. /// @param data The calldata sent. /// @return Context to pass to a post execution hook, if present. An empty bytes array MAY be returned. - function preExecutionHook(uint8 validationId, address sender, uint256 value, bytes calldata data) external returns (bytes memory); + function preExecutionHook(uint8 entityId, address sender, uint256 value, bytes calldata data) external returns (bytes memory); - /// @notice Run the post execution hook specified by the `validationId`. + /// @notice Run the post execution hook specified by the `entityId`. /// @dev To indicate the entire call should revert, the function MUST revert. - /// @param validationId An identifier that routes the call to different internal implementations, should there be more than one. + /// @param entityId An identifier that routes the call to different internal implementations, should there be more than one. /// @param preExecHookData The context returned by its associated pre execution hook. - function postExecutionHook(uint8 validationId, bytes calldata preExecHookData) external; + function postExecutionHook(uint8 entityId, bytes calldata preExecHookData) external; /// @notice Describe the contents and intended configuration of the plugin. /// @dev This manifest MUST stay constant over time. @@ -359,7 +359,7 @@ enum ManifestAssociatedFunctionType { /// of the function at `dependencies[dependencyIndex]` during the call to `installPlugin(config)`. struct ManifestFunction { ManifestAssociatedFunctionType functionType; - uint8 validationId; + uint8 entityId; uint256 dependencyIndex; } @@ -371,7 +371,7 @@ struct ManifestAssociatedFunction { struct ManifestExecutionHook { // TODO(erc6900 spec): These fields can be packed into a single word bytes4 executionSelector; - uint8 validationId; + uint8 entityId; bool isPreHook; bool isPostHook; } diff --git a/test/account/AccountExecHooks.t.sol b/test/account/AccountExecHooks.t.sol index 1457801a..98d16dcf 100644 --- a/test/account/AccountExecHooks.t.sol +++ b/test/account/AccountExecHooks.t.sol @@ -45,7 +45,7 @@ contract AccountExecHooksTest is AccountTestBase { _installPlugin1WithHooks( ManifestExecutionHook({ executionSelector: _EXEC_SELECTOR, - validationId: _PRE_HOOK_FUNCTION_ID_1, + entityId: _PRE_HOOK_FUNCTION_ID_1, isPreHook: true, isPostHook: false }) @@ -83,7 +83,7 @@ contract AccountExecHooksTest is AccountTestBase { _installPlugin1WithHooks( ManifestExecutionHook({ executionSelector: _EXEC_SELECTOR, - validationId: _BOTH_HOOKS_FUNCTION_ID_3, + entityId: _BOTH_HOOKS_FUNCTION_ID_3, isPreHook: true, isPostHook: true }) @@ -131,7 +131,7 @@ contract AccountExecHooksTest is AccountTestBase { _installPlugin1WithHooks( ManifestExecutionHook({ executionSelector: _EXEC_SELECTOR, - validationId: _POST_HOOK_FUNCTION_ID_2, + entityId: _POST_HOOK_FUNCTION_ID_2, isPreHook: false, isPostHook: true }) diff --git a/test/account/AccountLoupe.t.sol b/test/account/AccountLoupe.t.sol index 121bc935..9602393f 100644 --- a/test/account/AccountLoupe.t.sol +++ b/test/account/AccountLoupe.t.sol @@ -70,7 +70,7 @@ contract AccountLoupeTest is CustomValidationTestBase { function test_pluginLoupe_getSelectors() public { FunctionReference comprehensivePluginValidation = FunctionReferenceLib.pack( - address(comprehensivePlugin), uint32(ComprehensivePlugin.ValidationId.VALIDATION) + address(comprehensivePlugin), uint32(ComprehensivePlugin.EntityId.VALIDATION) ); bytes4[] memory selectors = account1.getSelectors(comprehensivePluginValidation); @@ -84,21 +84,21 @@ contract AccountLoupeTest is CustomValidationTestBase { ExecutionHook[3] memory expectedHooks = [ ExecutionHook({ hookFunction: FunctionReferenceLib.pack( - address(comprehensivePlugin), uint32(ComprehensivePlugin.ValidationId.BOTH_EXECUTION_HOOKS) + address(comprehensivePlugin), uint32(ComprehensivePlugin.EntityId.BOTH_EXECUTION_HOOKS) ), isPreHook: true, isPostHook: true }), ExecutionHook({ hookFunction: FunctionReferenceLib.pack( - address(comprehensivePlugin), uint32(ComprehensivePlugin.ValidationId.PRE_EXECUTION_HOOK) + address(comprehensivePlugin), uint32(ComprehensivePlugin.EntityId.PRE_EXECUTION_HOOK) ), isPreHook: true, isPostHook: false }), ExecutionHook({ hookFunction: FunctionReferenceLib.pack( - address(comprehensivePlugin), uint32(ComprehensivePlugin.ValidationId.POST_EXECUTION_HOOK) + address(comprehensivePlugin), uint32(ComprehensivePlugin.EntityId.POST_EXECUTION_HOOK) ), isPreHook: false, isPostHook: true @@ -124,7 +124,7 @@ contract AccountLoupeTest is CustomValidationTestBase { FunctionReference.unwrap(hooks[0]), FunctionReference.unwrap( FunctionReferenceLib.pack( - address(comprehensivePlugin), uint32(ComprehensivePlugin.ValidationId.PRE_VALIDATION_HOOK_1) + address(comprehensivePlugin), uint32(ComprehensivePlugin.EntityId.PRE_VALIDATION_HOOK_1) ) ) ); @@ -132,7 +132,7 @@ contract AccountLoupeTest is CustomValidationTestBase { FunctionReference.unwrap(hooks[1]), FunctionReference.unwrap( FunctionReferenceLib.pack( - address(comprehensivePlugin), uint32(ComprehensivePlugin.ValidationId.PRE_VALIDATION_HOOK_2) + address(comprehensivePlugin), uint32(ComprehensivePlugin.EntityId.PRE_VALIDATION_HOOK_2) ) ) ); @@ -148,10 +148,10 @@ contract AccountLoupeTest is CustomValidationTestBase { { FunctionReference[] memory preValidationHooks = new FunctionReference[](2); preValidationHooks[0] = FunctionReferenceLib.pack( - address(comprehensivePlugin), uint32(ComprehensivePlugin.ValidationId.PRE_VALIDATION_HOOK_1) + address(comprehensivePlugin), uint32(ComprehensivePlugin.EntityId.PRE_VALIDATION_HOOK_1) ); preValidationHooks[1] = FunctionReferenceLib.pack( - address(comprehensivePlugin), uint32(ComprehensivePlugin.ValidationId.PRE_VALIDATION_HOOK_2) + address(comprehensivePlugin), uint32(ComprehensivePlugin.EntityId.PRE_VALIDATION_HOOK_2) ); bytes[] memory installDatas = new bytes[](2); diff --git a/test/account/PerHookData.t.sol b/test/account/PerHookData.t.sol index 6db83015..74228643 100644 --- a/test/account/PerHookData.t.sol +++ b/test/account/PerHookData.t.sol @@ -213,7 +213,7 @@ contract PerHookDataTest is CustomValidationTestBase { abi.encodeWithSelector( UpgradeableModularAccount.PreRuntimeValidationHookFailed.selector, _accessControlHookPlugin, - uint32(MockAccessControlHookPlugin.ValidationId.PRE_VALIDATION_HOOK), + uint32(MockAccessControlHookPlugin.EntityId.PRE_VALIDATION_HOOK), abi.encodeWithSignature("Error(string)", "Proof doesn't match target") ) ); @@ -232,7 +232,7 @@ contract PerHookDataTest is CustomValidationTestBase { abi.encodeWithSelector( UpgradeableModularAccount.PreRuntimeValidationHookFailed.selector, _accessControlHookPlugin, - uint32(MockAccessControlHookPlugin.ValidationId.PRE_VALIDATION_HOOK), + uint32(MockAccessControlHookPlugin.EntityId.PRE_VALIDATION_HOOK), abi.encodeWithSignature("Error(string)", "Proof doesn't match target") ) ); @@ -274,7 +274,7 @@ contract PerHookDataTest is CustomValidationTestBase { abi.encodeWithSelector( UpgradeableModularAccount.PreRuntimeValidationHookFailed.selector, _accessControlHookPlugin, - uint32(MockAccessControlHookPlugin.ValidationId.PRE_VALIDATION_HOOK), + uint32(MockAccessControlHookPlugin.EntityId.PRE_VALIDATION_HOOK), abi.encodeWithSignature("Error(string)", "Target not allowed") ) ); @@ -328,7 +328,7 @@ contract PerHookDataTest is CustomValidationTestBase { returns (FunctionReference, bool, bool, bytes4[] memory, bytes memory, bytes memory, bytes memory) { FunctionReference accessControlHook = FunctionReferenceLib.pack( - address(_accessControlHookPlugin), uint32(MockAccessControlHookPlugin.ValidationId.PRE_VALIDATION_HOOK) + address(_accessControlHookPlugin), uint32(MockAccessControlHookPlugin.EntityId.PRE_VALIDATION_HOOK) ); FunctionReference[] memory preValidationHooks = new FunctionReference[](1); diff --git a/test/account/SelfCallAuthorization.t.sol b/test/account/SelfCallAuthorization.t.sol index 21b4de33..708117e2 100644 --- a/test/account/SelfCallAuthorization.t.sol +++ b/test/account/SelfCallAuthorization.t.sol @@ -28,7 +28,7 @@ contract SelfCallAuthorizationTest is AccountTestBase { account1.installPlugin(address(comprehensivePlugin), manifestHash, ""); comprehensivePluginValidation = FunctionReferenceLib.pack( - address(comprehensivePlugin), uint32(ComprehensivePlugin.ValidationId.VALIDATION) + address(comprehensivePlugin), uint32(ComprehensivePlugin.EntityId.VALIDATION) ); } diff --git a/test/account/ValidationIntersection.t.sol b/test/account/ValidationIntersection.t.sol index 3643eff5..5011aad8 100644 --- a/test/account/ValidationIntersection.t.sol +++ b/test/account/ValidationIntersection.t.sol @@ -33,17 +33,17 @@ contract ValidationIntersectionTest is AccountTestBase { noHookValidation = FunctionReferenceLib.pack({ addr: address(noHookPlugin), - validationId: uint32(MockBaseUserOpValidationPlugin.ValidationId.USER_OP_VALIDATION) + entityId: uint32(MockBaseUserOpValidationPlugin.EntityId.USER_OP_VALIDATION) }); oneHookValidation = FunctionReferenceLib.pack({ addr: address(oneHookPlugin), - validationId: uint32(MockBaseUserOpValidationPlugin.ValidationId.USER_OP_VALIDATION) + entityId: uint32(MockBaseUserOpValidationPlugin.EntityId.USER_OP_VALIDATION) }); twoHookValidation = FunctionReferenceLib.pack({ addr: address(twoHookPlugin), - validationId: uint32(MockBaseUserOpValidationPlugin.ValidationId.USER_OP_VALIDATION) + entityId: uint32(MockBaseUserOpValidationPlugin.EntityId.USER_OP_VALIDATION) }); vm.startPrank(address(entryPoint)); @@ -62,7 +62,7 @@ contract ValidationIntersectionTest is AccountTestBase { FunctionReference[] memory preValidationHooks = new FunctionReference[](1); preValidationHooks[0] = FunctionReferenceLib.pack({ addr: address(oneHookPlugin), - validationId: uint32(MockBaseUserOpValidationPlugin.ValidationId.PRE_VALIDATION_HOOK_1) + entityId: uint32(MockBaseUserOpValidationPlugin.EntityId.PRE_VALIDATION_HOOK_1) }); bytes[] memory installDatas = new bytes[](1); account1.installValidation( @@ -81,11 +81,11 @@ contract ValidationIntersectionTest is AccountTestBase { preValidationHooks = new FunctionReference[](2); preValidationHooks[0] = FunctionReferenceLib.pack({ addr: address(twoHookPlugin), - validationId: uint32(MockBaseUserOpValidationPlugin.ValidationId.PRE_VALIDATION_HOOK_1) + entityId: uint32(MockBaseUserOpValidationPlugin.EntityId.PRE_VALIDATION_HOOK_1) }); preValidationHooks[1] = FunctionReferenceLib.pack({ addr: address(twoHookPlugin), - validationId: uint32(MockBaseUserOpValidationPlugin.ValidationId.PRE_VALIDATION_HOOK_2) + entityId: uint32(MockBaseUserOpValidationPlugin.EntityId.PRE_VALIDATION_HOOK_2) }); installDatas = new bytes[](2); account1.installValidation( @@ -211,7 +211,7 @@ contract ValidationIntersectionTest is AccountTestBase { abi.encodeWithSelector( UpgradeableModularAccount.UnexpectedAggregator.selector, address(oneHookPlugin), - MockBaseUserOpValidationPlugin.ValidationId.PRE_VALIDATION_HOOK_1, + MockBaseUserOpValidationPlugin.EntityId.PRE_VALIDATION_HOOK_1, badAuthorizer ) ); diff --git a/test/libraries/FunctionReferenceLib.t.sol b/test/libraries/FunctionReferenceLib.t.sol index 3cc45c6b..4ecfb0e9 100644 --- a/test/libraries/FunctionReferenceLib.t.sol +++ b/test/libraries/FunctionReferenceLib.t.sol @@ -9,16 +9,16 @@ import {FunctionReference} from "../../src/interfaces/IPluginManager.sol"; contract FunctionReferenceLibTest is Test { using FunctionReferenceLib for FunctionReference; - function testFuzz_functionReference_packing(address addr, uint32 validationId) public { + function testFuzz_functionReference_packing(address addr, uint32 entityId) public { // console.log("addr: ", addr); - // console.log("validationId: ", vm.toString(validationId)); - FunctionReference fr = FunctionReferenceLib.pack(addr, validationId); + // console.log("entityId: ", vm.toString(entityId)); + FunctionReference fr = FunctionReferenceLib.pack(addr, entityId); // console.log("packed: ", vm.toString(FunctionReference.unwrap(fr))); - (address addr2, uint32 validationId2) = FunctionReferenceLib.unpack(fr); + (address addr2, uint32 entityId2) = FunctionReferenceLib.unpack(fr); // console.log("addr2: ", addr2); - // console.log("validationId2: ", vm.toString(validationId2)); + // console.log("entityId2: ", vm.toString(entityId2)); assertEq(addr, addr2); - assertEq(validationId, validationId2); + assertEq(entityId, entityId2); } function testFuzz_functionReference_operators(FunctionReference a, FunctionReference b) public { diff --git a/test/mocks/plugins/ComprehensivePlugin.sol b/test/mocks/plugins/ComprehensivePlugin.sol index af4ea806..9bff9237 100644 --- a/test/mocks/plugins/ComprehensivePlugin.sol +++ b/test/mocks/plugins/ComprehensivePlugin.sol @@ -18,7 +18,7 @@ import {IExecutionHook} from "../../../src/interfaces/IExecutionHook.sol"; import {BasePlugin} from "../../../src/plugins/BasePlugin.sol"; contract ComprehensivePlugin is IValidation, IValidationHook, IExecutionHook, BasePlugin { - enum ValidationId { + enum EntityId { PRE_VALIDATION_HOOK_1, PRE_VALIDATION_HOOK_2, VALIDATION, @@ -46,85 +46,81 @@ contract ComprehensivePlugin is IValidation, IValidationHook, IExecutionHook, Ba function onUninstall(bytes calldata) external override {} - function preUserOpValidationHook(uint32 validationId, PackedUserOperation calldata, bytes32) + function preUserOpValidationHook(uint32 entityId, PackedUserOperation calldata, bytes32) external pure override returns (uint256) { - if (validationId == uint32(ValidationId.PRE_VALIDATION_HOOK_1)) { + if (entityId == uint32(EntityId.PRE_VALIDATION_HOOK_1)) { return 0; - } else if (validationId == uint32(ValidationId.PRE_VALIDATION_HOOK_2)) { + } else if (entityId == uint32(EntityId.PRE_VALIDATION_HOOK_2)) { return 0; } revert NotImplemented(); } - function validateUserOp(uint32 validationId, PackedUserOperation calldata, bytes32) + function validateUserOp(uint32 entityId, PackedUserOperation calldata, bytes32) external pure override returns (uint256) { - if (validationId == uint32(ValidationId.VALIDATION)) { + if (entityId == uint32(EntityId.VALIDATION)) { return 0; } revert NotImplemented(); } - function preRuntimeValidationHook(uint32 validationId, address, uint256, bytes calldata, bytes calldata) + function preRuntimeValidationHook(uint32 entityId, address, uint256, bytes calldata, bytes calldata) external pure override { - if (validationId == uint32(ValidationId.PRE_VALIDATION_HOOK_1)) { + if (entityId == uint32(EntityId.PRE_VALIDATION_HOOK_1)) { return; - } else if (validationId == uint32(ValidationId.PRE_VALIDATION_HOOK_2)) { + } else if (entityId == uint32(EntityId.PRE_VALIDATION_HOOK_2)) { return; } revert NotImplemented(); } - function validateRuntime(uint32 validationId, address, uint256, bytes calldata, bytes calldata) + function validateRuntime(uint32 entityId, address, uint256, bytes calldata, bytes calldata) external pure override { - if (validationId == uint32(ValidationId.VALIDATION)) { + if (entityId == uint32(EntityId.VALIDATION)) { return; } revert NotImplemented(); } - function validateSignature(uint32 validationId, address, bytes32, bytes calldata) - external - pure - returns (bytes4) - { - if (validationId == uint32(ValidationId.SIG_VALIDATION)) { + function validateSignature(uint32 entityId, address, bytes32, bytes calldata) external pure returns (bytes4) { + if (entityId == uint32(EntityId.SIG_VALIDATION)) { return 0xffffffff; } revert NotImplemented(); } - function preExecutionHook(uint32 validationId, address, uint256, bytes calldata) + function preExecutionHook(uint32 entityId, address, uint256, bytes calldata) external pure override returns (bytes memory) { - if (validationId == uint32(ValidationId.PRE_EXECUTION_HOOK)) { + if (entityId == uint32(EntityId.PRE_EXECUTION_HOOK)) { return ""; - } else if (validationId == uint32(ValidationId.BOTH_EXECUTION_HOOKS)) { + } else if (entityId == uint32(EntityId.BOTH_EXECUTION_HOOKS)) { return ""; } revert NotImplemented(); } - function postExecutionHook(uint32 validationId, bytes calldata) external pure override { - if (validationId == uint32(ValidationId.POST_EXECUTION_HOOK)) { + function postExecutionHook(uint32 entityId, bytes calldata) external pure override { + if (entityId == uint32(EntityId.POST_EXECUTION_HOOK)) { return; - } else if (validationId == uint32(ValidationId.BOTH_EXECUTION_HOOKS)) { + } else if (entityId == uint32(EntityId.BOTH_EXECUTION_HOOKS)) { return; } revert NotImplemented(); @@ -145,7 +141,7 @@ contract ComprehensivePlugin is IValidation, IValidationHook, IExecutionHook, Ba manifest.validationFunctions = new ManifestValidation[](1); manifest.validationFunctions[0] = ManifestValidation({ - validationId: uint32(ValidationId.VALIDATION), + entityId: uint32(EntityId.VALIDATION), isDefault: true, isSignatureValidation: false, selectors: validationSelectors @@ -154,19 +150,19 @@ contract ComprehensivePlugin is IValidation, IValidationHook, IExecutionHook, Ba manifest.executionHooks = new ManifestExecutionHook[](3); manifest.executionHooks[0] = ManifestExecutionHook({ executionSelector: this.foo.selector, - validationId: uint32(ValidationId.BOTH_EXECUTION_HOOKS), + entityId: uint32(EntityId.BOTH_EXECUTION_HOOKS), isPreHook: true, isPostHook: true }); manifest.executionHooks[1] = ManifestExecutionHook({ executionSelector: this.foo.selector, - validationId: uint32(ValidationId.PRE_EXECUTION_HOOK), + entityId: uint32(EntityId.PRE_EXECUTION_HOOK), isPreHook: true, isPostHook: false }); manifest.executionHooks[2] = ManifestExecutionHook({ executionSelector: this.foo.selector, - validationId: uint32(ValidationId.POST_EXECUTION_HOOK), + entityId: uint32(EntityId.POST_EXECUTION_HOOK), isPreHook: false, isPostHook: true }); diff --git a/test/mocks/plugins/MockAccessControlHookPlugin.sol b/test/mocks/plugins/MockAccessControlHookPlugin.sol index edbd2822..6bd593f2 100644 --- a/test/mocks/plugins/MockAccessControlHookPlugin.sol +++ b/test/mocks/plugins/MockAccessControlHookPlugin.sol @@ -13,7 +13,7 @@ import {BasePlugin} from "../../../src/plugins/BasePlugin.sol"; // This is just a mock - it does not enforce this over `executeBatch` and other methods of making calls, and should // not be used in production.. contract MockAccessControlHookPlugin is IValidationHook, BasePlugin { - enum ValidationId { + enum EntityId { PRE_VALIDATION_HOOK } @@ -28,13 +28,13 @@ contract MockAccessControlHookPlugin is IValidationHook, BasePlugin { delete allowedTargets[msg.sender]; } - function preUserOpValidationHook(uint32 validationId, PackedUserOperation calldata userOp, bytes32) + function preUserOpValidationHook(uint32 entityId, PackedUserOperation calldata userOp, bytes32) external view override returns (uint256) { - if (validationId == uint32(ValidationId.PRE_VALIDATION_HOOK)) { + if (entityId == uint32(EntityId.PRE_VALIDATION_HOOK)) { if (bytes4(userOp.callData[:4]) == IStandardExecutor.execute.selector) { address target = abi.decode(userOp.callData[4:36], (address)); @@ -49,13 +49,13 @@ contract MockAccessControlHookPlugin is IValidationHook, BasePlugin { } function preRuntimeValidationHook( - uint32 validationId, + uint32 entityId, address, uint256, bytes calldata data, bytes calldata authorization ) external view override { - if (validationId == uint32(ValidationId.PRE_VALIDATION_HOOK)) { + if (entityId == uint32(EntityId.PRE_VALIDATION_HOOK)) { if (bytes4(data[:4]) == IStandardExecutor.execute.selector) { address target = abi.decode(data[4:36], (address)); diff --git a/test/mocks/plugins/ReturnDataPluginMocks.sol b/test/mocks/plugins/ReturnDataPluginMocks.sol index abe971da..6bab7b0b 100644 --- a/test/mocks/plugins/ReturnDataPluginMocks.sol +++ b/test/mocks/plugins/ReturnDataPluginMocks.sol @@ -121,7 +121,7 @@ contract ResultConsumerPlugin is BasePlugin, IValidation { manifest.validationFunctions = new ManifestValidation[](1); manifest.validationFunctions[0] = ManifestValidation({ - validationId: 0, + entityId: 0, isDefault: true, isSignatureValidation: false, selectors: validationSelectors diff --git a/test/mocks/plugins/ValidationPluginMocks.sol b/test/mocks/plugins/ValidationPluginMocks.sol index 56ebdea9..af57eaaa 100644 --- a/test/mocks/plugins/ValidationPluginMocks.sol +++ b/test/mocks/plugins/ValidationPluginMocks.sol @@ -14,7 +14,7 @@ import {IValidationHook} from "../../../src/interfaces/IValidationHook.sol"; import {BasePlugin} from "../../../src/plugins/BasePlugin.sol"; abstract contract MockBaseUserOpValidationPlugin is IValidation, IValidationHook, BasePlugin { - enum ValidationId { + enum EntityId { USER_OP_VALIDATION, PRE_VALIDATION_HOOK_1, PRE_VALIDATION_HOOK_2 @@ -32,27 +32,27 @@ abstract contract MockBaseUserOpValidationPlugin is IValidation, IValidationHook function onUninstall(bytes calldata) external override {} - function preUserOpValidationHook(uint32 validationId, PackedUserOperation calldata, bytes32) + function preUserOpValidationHook(uint32 entityId, PackedUserOperation calldata, bytes32) external view override returns (uint256) { - if (validationId == uint32(ValidationId.PRE_VALIDATION_HOOK_1)) { + if (entityId == uint32(EntityId.PRE_VALIDATION_HOOK_1)) { return _preUserOpValidationHook1Data; - } else if (validationId == uint32(ValidationId.PRE_VALIDATION_HOOK_2)) { + } else if (entityId == uint32(EntityId.PRE_VALIDATION_HOOK_2)) { return _preUserOpValidationHook2Data; } revert NotImplemented(); } - function validateUserOp(uint32 validationId, PackedUserOperation calldata, bytes32) + function validateUserOp(uint32 entityId, PackedUserOperation calldata, bytes32) external view override returns (uint256) { - if (validationId == uint32(ValidationId.USER_OP_VALIDATION)) { + if (entityId == uint32(EntityId.USER_OP_VALIDATION)) { return _userOpValidationFunctionData; } revert NotImplemented(); @@ -108,7 +108,7 @@ contract MockUserOpValidationPlugin is MockBaseUserOpValidationPlugin { manifest.validationFunctions = new ManifestValidation[](1); manifest.validationFunctions[0] = ManifestValidation({ - validationId: uint32(ValidationId.USER_OP_VALIDATION), + entityId: uint32(EntityId.USER_OP_VALIDATION), isDefault: false, isSignatureValidation: false, selectors: validationSelectors @@ -151,7 +151,7 @@ contract MockUserOpValidation1HookPlugin is MockBaseUserOpValidationPlugin { manifest.validationFunctions = new ManifestValidation[](2); manifest.validationFunctions[0] = ManifestValidation({ - validationId: uint32(ValidationId.USER_OP_VALIDATION), + entityId: uint32(EntityId.USER_OP_VALIDATION), isDefault: false, isSignatureValidation: false, selectors: validationSelectors @@ -197,7 +197,7 @@ contract MockUserOpValidation2HookPlugin is MockBaseUserOpValidationPlugin { manifest.validationFunctions = new ManifestValidation[](1); manifest.validationFunctions[0] = ManifestValidation({ - validationId: uint32(ValidationId.USER_OP_VALIDATION), + entityId: uint32(EntityId.USER_OP_VALIDATION), isDefault: false, isSignatureValidation: false, selectors: validationSelectors diff --git a/test/samples/AllowlistPlugin.t.sol b/test/samples/AllowlistPlugin.t.sol index d4d28a27..4bf5f60e 100644 --- a/test/samples/AllowlistPlugin.t.sol +++ b/test/samples/AllowlistPlugin.t.sol @@ -184,7 +184,7 @@ contract AllowlistPluginTest is CustomValidationTestBase { return abi.encodeWithSelector( UpgradeableModularAccount.PreRuntimeValidationHookFailed.selector, address(allowlistPlugin), - uint32(AllowlistPlugin.ValidationId.PRE_VALIDATION_HOOK), + uint32(AllowlistPlugin.EntityId.PRE_VALIDATION_HOOK), abi.encodeWithSelector(AllowlistPlugin.SelectorNotAllowed.selector) ); } @@ -192,7 +192,7 @@ contract AllowlistPluginTest is CustomValidationTestBase { return abi.encodeWithSelector( UpgradeableModularAccount.PreRuntimeValidationHookFailed.selector, address(allowlistPlugin), - uint32(AllowlistPlugin.ValidationId.PRE_VALIDATION_HOOK), + uint32(AllowlistPlugin.EntityId.PRE_VALIDATION_HOOK), abi.encodeWithSelector(AllowlistPlugin.TargetNotAllowed.selector) ); } @@ -293,7 +293,7 @@ contract AllowlistPluginTest is CustomValidationTestBase { returns (FunctionReference, bool, bool, bytes4[] memory, bytes memory, bytes memory, bytes memory) { FunctionReference accessControlHook = FunctionReferenceLib.pack( - address(allowlistPlugin), uint32(AllowlistPlugin.ValidationId.PRE_VALIDATION_HOOK) + address(allowlistPlugin), uint32(AllowlistPlugin.EntityId.PRE_VALIDATION_HOOK) ); FunctionReference[] memory preValidationHooks = new FunctionReference[](1);