Introducing User Operation Overrides

Introducing User Operation Overrides

Author: Alchemy Team

Reviewed by Brady Werkheiser

Published on January 17, 20242 min read
user operation overrides

Account Abstraction lets users use smart contract accounts as wallets instead of traditional Externally Owned Accounts (EOAs). When initiating transactions from a smart contract account, User Operations (UserOps or UOs) contain the transaction details similar to regular transactions: sendertocalldatamaxFeePerGasmaxPriorityFeesignature, and nonce.

Because smart contract accounts rely on Bundlers to execute transactions on their behalf, user operations also contain a new set of fields for estimating gas and sponsoring gas with paymasters including: callGasLimitverificationGasLimitpreVerificationGas, and paymasterAndData.

Today, we’re launching User Operation Overrides to give developers fine grain control over gas fees. Gas fee markets move fast on L2s, and when that happens pending UOs might fail.

UO Overrides enable you to override gas estimates to get stronger guarantees that UserOps are mined, regardless of gas estimates that are misaligned with actual gas costs.

What User Operation Overrides Do:

By overriding a gas fee estimate, which incorporates a lot of complex inputs and therefore can be hard to estimate accurately, you can get stronger guarantees that your UserOp will successfully be mined regardless of gas fluctuations by setting absolute or multiplier-based override values.

What are the benefits of User Operation Overrides?

The two main developer benefits of UO Overrides are streamlining the complexity of estimating gas and paymaster values, and increasing the likelihood of UOs getting mined during periods of fee market volatility.

1. Streamline complexity

Today, estimating the right gas fee means incorporating six different gas types, making it hard to get a gas estimate “right”. With Fee Overrides, devs set the parameter to override gas estimates at a certain threshold, so UserOps are mined, regardless of how accurate your estimate was.

2. Own your outcomes

One pain point of using the aa-sdk to date has been that when the network got busy, teams would ask Alchemy engineers to take care of gas estimation and UserOp success for them.

With User Operation Overrides, teams can now choose what UserOps are most important, and set custom override values with greater control to increase the likelihood that their UOs are mined successfully.

What are the features of User Operation Overrides?

User Operation Overrides allow the specification of override values for:

  1. maxFeePerGas

  2. maxPriorityFeePerGas

  3. callGasLimit

  4. preVerificationGas

  5. verificationGasLimit

  6. paymasterAndData

Developers building with Alchemy's AA SDK can use User Operation Overrides with any Bundler or Paymaster!

How do User Operation Overrides work?

Override values are available from each middleware of the SmartAccountProvider. For example, the default middlewares such as gasEstimator or feeDataGetter apply the overrides values to the estimated values if the override values are provided.

Other than the paymasterAndData field, the override fields could be either the absolute value or the multiplier value. In the default middlewares, if the override value is an absolute value, it simply overrides the estimated value.

If the override value is a multiplier value, the estimated value is bumped with the indicated multiplier value. For example, if the override value is { multiplier: 1.1 } for the maxPriorityFeePerGas field, then a 1.1 multiplier, or a 10% increase, is applied to the estimated maxPriorityFeePerGas of the user operation.

To get started, explore the User Operation Override docs!

Section background image

Build blockchain magic

Alchemy combines the most powerful web3 developer products and tools with resources, community and legendary support.

Get your API key