Skip to content

Commit

Permalink
Update ERC-7677: add isFinal flag, move sponsor, and specify validati…
Browse files Browse the repository at this point in the history
…on expectations

Merged by EIP-Bot.
  • Loading branch information
lukasrosario authored Jun 17, 2024
1 parent 878ef76 commit 626727f
Showing 1 changed file with 34 additions and 11 deletions.
45 changes: 34 additions & 11 deletions ERCS/erc-7677.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ Returns stub values to be used in paymaster-related fields of an unsigned user o

This method MAY return paymaster-specific gas values if applicable to the provided EntryPoint version. For example, if provided with EntryPoint v0.7, this method MAY return `paymasterVerificationGasLimit` and `paymasterPostOpGasLimit` values. The wallet SHOULD use these provided gas values when submitting the `UserOperation` to a bundler for gas estimation.

This method MAY also return a `sponsor` object with a `name` field and an optional `icon` field. The `name` field is the name of the party sponsoring the transaction, and the `icon` field is a URI pointing to an image. Wallet developers MAY choose to display sponsor information to users. The `icon` string MUST be a data URI as defined in [RFC-2397]. The image SHOULD be a square with 96x96px minimum resolution. The image format is RECOMMENDED to be either lossless or vector based such as PNG, WebP or SVG to make the image easy to render on the wallet. Since SVG images can execute Javascript, wallets MUST render SVG images using the `<img>` tag to ensure no untrusted Javascript execution can occur.

There are cases where a call to just `pm_getPaymasterStubData` is sufficient to provide valid paymaster-related user operation fields, e.g. when the `paymasterData` does not contain a signature. In such cases, the second RPC call to `pm_getPaymasterData` (defined below) MAY be skipped, by returning `isFinal: true` by this RPC call.

Paymaster web services SHOULD do validations on incoming user operations during `pm_getPaymasterStubData` execution and reject the request at this stage if it would not sponsor the operation.

##### `pm_getPaymasterStubData` RPC Specification

Note that the user operation parameter does not include a signature, as the user signs after all other fields are populated.
Expand All @@ -58,11 +64,13 @@ type GetPaymasterStubDataParams = [
];

type GetPaymasterStubDataResult = {
sponsor?: { name: string; icon?: string } // Sponsor info
paymaster?: string // Paymaster address (entrypoint v0.7)
paymasterData?: string; // Paymaster data (entrypoint v0.7)
paymasterVerificationGasLimit?: `0x${string}`; // Paymaster validation gas (entrypoint v0.7)
paymasterPostOpGasLimit?: `0x${string}`; // Paymaster post-op gas (entrypoint v0.7)
paymasterAndData?: string; // Paymaster and data (entrypoint v0.6)
isFinal?: boolean; // Indicates that the caller does not need to call pm_getPaymasterData
}
```
Expand Down Expand Up @@ -98,6 +106,10 @@ For example, if using entrypoint v0.6:
```json
{
"sponsor": {
"name": "My App",
"icon": "https://..."
},
"paymasterAndData": "0x..."
}
```
Expand All @@ -106,6 +118,10 @@ If using entrypoint v0.7:
```json
{
"sponsor": {
"name": "My App",
"icon": "https://..."
},
"paymaster": "0x...",
"paymasterData": "0x..."
}
Expand All @@ -115,19 +131,35 @@ If using entrypoint v0.7, with paymaster gas estimates:
```json
{
"sponsor": {
"name": "My App",
"icon": "https://..."
},
"paymaster": "0x...",
"paymasterData": "0x...",
"paymasterVerificationGasLimit": "0x...",
"paymasterPostOpGasLimit": "0x..."
}
```
Indicating that the caller does not need to make a `pm_getPaymasterData` RPC call:
```json
{
"sponsor": {
"name": "My App",
"icon": "https://..."
},
"paymaster": "0x...",
"paymasterData": "0x...",
"isFinal": true
}
```
#### `pm_getPaymasterData`
Returns values to be used in paymaster-related fields of a signed user operation. These are not stub values and will be used during user operation submission to a bundler. Similar to `pm_getPaymasterStubData`, accepts an unsigned user operation, entrypoint address, chain id, and a context object.
This method also returns a `sponsor` object with `name` and `icon` fields. The `name` field is the name of the party sponsoring the transaction, and the `icon` field is a URI pointing to an image. Wallet developers MAY choose to display sponsor information to users. The `icon` string MUST be a data URI as defined in [RFC-2397]. The image SHOULD be a square with 96x96px minimum resolution. The image format is RECOMMENDED to be either lossless or vector based such as PNG, WebP or SVG to make the image easy to render on the wallet. Since SVG images can execute Javascript, wallets MUST render SVG images using the `<img>` tag to ensure no untrusted Javascript execution can occur.
##### `pm_getPaymasterData` RPC Specification
Note that the user operation parameter does not include a signature, as the user signs after all other fields are populated.
Expand All @@ -153,7 +185,6 @@ type GetPaymasterDataParams = [
];

type GetPaymasterDataResult = {
sponsor?: { name: string; icon: string } // Sponsor info
paymaster?: string // Paymaster address (entrypoint v0.7)
paymasterData?: string; // Paymaster data (entrypoint v0.7)
paymasterAndData?: string; // Paymaster and data (entrypoint v0.6)
Expand Down Expand Up @@ -192,10 +223,6 @@ For example, if using entrypoint v0.6:
```json
{
"sponsor": {
"name": "My App",
"icon": "https://..."
},
"paymasterAndData": "0x..."
}
```
Expand All @@ -204,10 +231,6 @@ If using entrypoint v0.7:
```json
{
"sponsor": {
"name": "My App",
"icon": "https://..."
},
"paymaster": "0x...",
"paymasterData": "0x..."
}
Expand Down

0 comments on commit 626727f

Please sign in to comment.