From 8c2824fd81c9ceeeed50001028caeb93e7aec902 Mon Sep 17 00:00:00 2001 From: Alex Forshtat Date: Fri, 23 Aug 2024 14:06:03 +0200 Subject: [PATCH 1/3] AA-429: Create ERC-5792 "capabilities" ERC for Account Abstraction --- ERCS/erc-xxxx.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 ERCS/erc-xxxx.md diff --git a/ERCS/erc-xxxx.md b/ERCS/erc-xxxx.md new file mode 100644 index 0000000000..d4a7b2cb16 --- /dev/null +++ b/ERCS/erc-xxxx.md @@ -0,0 +1,35 @@ +--- +eip: +title: Set of Wallet Capabilities for Account Abstraction Applications +description: +author: +discussions-to: +status: Draft +type: Standards Track +category: ERC +created: +requires: 5792, 7702 +--- + +## Abstract + +## Motivation + +## Specification + +### Static Paymaster Configuration Capability +### On-chain Query Paymaster Configuration Capability +### Validity Time Range Capability +### Multidimensional Nonce Capability +### Account Abstraction Gas Limit Override Capability +### Set Externally Owned Account Code Capability + +## Rationale + +## Reference Implementation + +## Security Considerations + +## Copyright + +Copyright and related rights waived via [CC0](../LICENSE.md). From a3cce6fc9952c849858f6f2eb77c89d47a9af4b8 Mon Sep 17 00:00:00 2001 From: Alex Forshtat Date: Fri, 23 Aug 2024 14:48:00 +0200 Subject: [PATCH 2/3] Fill in the specification part of an ERC a bit --- ERCS/erc-xxxx.md | 172 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 169 insertions(+), 3 deletions(-) diff --git a/ERCS/erc-xxxx.md b/ERCS/erc-xxxx.md index d4a7b2cb16..b14470e1f1 100644 --- a/ERCS/erc-xxxx.md +++ b/ERCS/erc-xxxx.md @@ -1,8 +1,8 @@ --- eip: title: Set of Wallet Capabilities for Account Abstraction Applications -description: -author: +description: A way for apps and Account Abstraction wallets to communicate more advanced parameters of Account Abstraction operations +author: Yoav Weiss (@yoavw), Alex Forshtat (@forshtat), Dror Tirosh (@drortirosh), Shahaf Nacson (@shahafn) discussions-to: status: Draft type: Standards Track @@ -13,17 +13,183 @@ requires: 5792, 7702 ## Abstract +[EIP-5792](./eip-5792) defines a baseline JSON-RPC API for a communication between wallets and dapps. +With EIP-5792, apps and wallets can communicate about any advanced features using "capabilities" - extensions +to the base protocol that must be defined in separate documents. + +This proposal defines a set of "capabilities" the wallets may want to implement in order to provide a +comprehensive support for Account Abstraction. + ## Motivation ## Specification +### Shared configuration + +All actions in Account Abstraction within the context of EIP-5792 must be done on a single chain and atomically. +This means all requests to the `wallet_sendCalls` methods MUST be done: + +1. With the `atomicBatch` capability enabled +2. With the `chainId` set to the same value in all calls + ### Static Paymaster Configuration Capability + +Note that use of Paymasters managed by a "paymaster web service" is described in [ERC-7677](./eip-7677). + +Identifier: + +`staticPaymasterConfiguration` + +Interface: + +```typescript +type StaticPaymasterConfigurationCapabilityParams = Record< + `0x${string}`, // Chain ID + { + paymaster: string; + paymasterData: string; + paymasterValidationGasLimit: `0x${string}`; + paymasterPostOpGasLimit: `0x${string}`; + } +>; +``` + ### On-chain Query Paymaster Configuration Capability + +Identifier: + +`onChainQueryPaymasterConfiguration` + +Interface: + +```typescript +type OnChainQueryPaymasterConfigurationCapabilityParams = Record< + `0x${string}`, // Chain ID + { + target: `0x${string}`, // contract to query for Paymaster configuration + context: `0x${string}`, // hex-encoded byte array to pass to the configuration provider + } +> +``` + +We then define the following Solidity interface: + +```solidity + + struct PaymasterConfiguration { + address paymaster; + bytes paymasterData; + uint256 paymasterValidationGasLimit; + uint256 paymasterPostOpGasLimit; + } + +interface IPaymasterConfigurationResolver { + function getPaymasterConfiguration(bytes operation, bytes context) external; +} + +``` + +The wallet MUST perform an ABI-encoding of the entire `operation` object and make a view call +to the `getPaymasterConfiguration` function of the `target` address. + +If the view call fails or returns an invalid data, the `wallet_sendCalls` method must fail and return with an error. + ### Validity Time Range Capability + +Identifier: + +`validityTimeRange` + +Interface: + +```typescript +type ValidityTimeRangeCapabilityParams = Record< + `0x${string}`, // Chain ID + { + validAfter: `0x${string}`, // operation valid only after this timestamp, in seconds + validUntil: `0x${string}` // operation valid only before this timestamp, in seconds + } +> +``` + +The wallet must then verify the time range [`validAfter`..`validUntil`] is valid and present it to the +user in a human-readable way for confirmation as part of the transaction information. + ### Multidimensional Nonce Capability -### Account Abstraction Gas Limit Override Capability + +Identifier: + +`multiDimensionalNonce` + +Interface: + +```typescript +type MultiDimensionalNonceCapabilityParams = Record< + `0x${string}`, // Chain ID + { + nonceKey: `0x${string}`, + nonceSequence: `0x${string}` + } +> +``` + +For Smart Contract Accounts that support multidimensional nonce values, +the wallet must specify these parameters during the actual on-chain execution of the batch. + +### Account Abstraction Gas Parameters Override Capability + +Identifier: + +`accountAbstractionGasParamsOverride` + +Interface: + +```typescript +type AAGasParamsOverrideCapabilityParams = Record< + `0x${string}`, // Chain ID + { + preVerificationGas?: `0x${string}`, + verificationGasLimit?: `0x${string}`, + callGasLimit?: `0x${string}`, + paymasterVerificationGasLimit?: `0x${string}`, + paymasterPostOpGasLimit?: `0x${string}`, + maxFeePerGas?: `0x${string}`, + maxPriorityFeePerGas?: `0x${string}` + } +> +``` + +Notice that all fields in the `AAGasParamsOverrideCapabilityParams` are optional. +Only the values that callers want to override must be provided. + +In case `paymasterVerificationGasLimit` or `paymasterPostOpGasLimit` are provided, +wallets should warn the users about this happening but use these values instead of +the ones generated by any other capability. +Wallets may choose to reject such configurations or request the user input in this case. +Such a combination of features is only expected to be used in development and is very risky to use in production. + ### Set Externally Owned Account Code Capability +This capability is designed to use with [EIP-7702](./eip-7702) transactions. + +Identifier: + +`setCodeForEOA` + +Interface: + +```typescript +type SetCodeForEOACapabilityParams = Record< + `0x${string}`, // Chain ID + { + codeAddress: `0x${string}`, // implementation code address + } +> +``` + +Wallets should generate an EIP-7702 compatible transaction that sets a code of a `from` EOA address +to the code of `codeAddress` specified in the request. + ## Rationale ## Reference Implementation From 51c98982fc772069b10f4850b55581da0eae9587 Mon Sep 17 00:00:00 2001 From: Alex Forshtat Date: Sat, 24 Aug 2024 17:53:42 +0200 Subject: [PATCH 3/3] Update ERCS/erc-xxxx.md Co-authored-by: Dror Tirosh --- ERCS/erc-xxxx.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ERCS/erc-xxxx.md b/ERCS/erc-xxxx.md index b14470e1f1..b8056a367e 100644 --- a/ERCS/erc-xxxx.md +++ b/ERCS/erc-xxxx.md @@ -84,7 +84,7 @@ We then define the following Solidity interface: } interface IPaymasterConfigurationResolver { - function getPaymasterConfiguration(bytes operation, bytes context) external; + function getPaymasterConfiguration(bytes operation, bytes context) returns (PaymasterConfiguration); } ```