Big changes are coming to ERC-4337

Breaking changes are coming to ERC-4337.

On Wednesday January 10 2024, the Ethereum Foundation shared a preview of drastic - and breaking - changes to the ERC-4337 specification.

The new version, v0.7.0, applies the learnings of the last 9 months of ERC-4337 being in production.

In a message to members of the ERC-4337 community, Tom Teman of the Ethereum Foundation said “[a] security audit by OpenZeppelin is scheduled to start next week, after which the changes will be finalized, published and deployed.”

The first production-ready version of ERC-4337 was announced at ETH Denver last year, and I suspect the Ethereum Foundation hopes to announce v0.7 there.

The biggest change is in the structure of account abstraction transactions. The lifecycle of these transactions, other rather “user operations,” is more complex than a regular Ethereum transaction. The user has to specify more than one gas value to account for the fact that an account can do computation while its signature is being checked.

In this update the user operation structure now requires five gas values to be specified when a transaction is made.

  • preVerificationGas, which is used to compensate ERC-4337 bundlers
  • verificationGasLimit, which specifies how much gas the user’s account is willing to spend verifying its signature
  • paymasterVerificationGasLimit, an optional parameter that specifies how much gas a paymaster is willing to spend verifying its signature and any associated data
  • callGasLimit, which is how much gas the user operation can spend while executing its tasks
  • paymasterPostOpGasLimit, which is how much gas the paymaster is willing to spend after the operation is completed to do any clean up tasks like withdraw ERC-20 tokens.

The goal of these changes is to make gas estimation more accurate and reduce gas costs. The savings are most dramatic on layer 2s, since these changes reduce the amount of data that needs to be published. It also better aligns ERC-4337 with plans to enshrine account abstraction directly, so that the transition from ERC-4337 to full account abstraction will be less painful.

Another change users will see is that they will be penalized for bad gas estimates. The new specification charges users 10% for all unused gas in execution, which prevents apps from putting transactions with unnecessarily high gas limits.

The current version of ERC-4337, v0.6, will continue to be supported by infrastructure providers during the transition.

Stackup will continue supporting v0.6 of ERC-4337 as the community transitions to v0.7 after the audit is complete. It is difficult to determine how long this transition will take, but Stackup supported v0.5 for six months before moving all customers to v0.6.

To support the transition, Stackup is redesigning the open-source userop.js SDK from the ground up. Since ERC-4337 first went live in March of last year, we have learned a lot about how developers are taking advantage of account abstraction. We previously built userop.js with a builder pattern, which is the most flexible but has fewer abstractions. The new version of userop.js will make user operations more reliable, easier to build, and cheaper. It will also be much easier for our great community of open source developers to contribute.