The User Operation has three seperate gas values, unlike an EOA transaction which only has a single gas limit. Each gas field covers the different stages of a User Operation lifecycle.
This is the static gas overhead that the Bundler spends in order to initiate the transaction to send the User Operation to the EntryPoint. We highly recommend reading the article on the analysis of PreVerificationGas. In it we discuss what exactly the "gas overhead" refers to and how the Stackup Bundler calculates it.
The VGL refers to the maximum gas available for a User Operation to execute its validation phase. This includes:
- Deploying a smart account on the first transaction.
- Running the
validatePaymasterUserOpfunction on the smart account and paymaster.
postOpfunction on the paymaster after execution.
Unlike the PVG, the VGL is a limit value. This means that the actual gas value, once submitted on-chain, can be less than or equal to this maximum value.
This is another limit value like the VGL. But in this case, it is reserved for the maximum allowed gas to execute a
CALL from the EntryPoint to the
sender with the User Operation
callData. We highly recommend reading the article on estimating callGasLimit for UserOperations to get an in depth understanding of this field and all the different ways we can calculate its value.
Intuitively, we might think that the maximum required gas for a User Operation is equal to
PVG + VGL + CGL. But this is only true if there is no Paymaster. If a Paymaster is included then the maximum gas required is equal to
PVG + (3 * VGL) + CGL.
The reason we multiple VGL by 3 when a paymaster is present, is because we need the value 3 times in the worst case.
- During the initial validation.
postOpa second time if the initial
postOpcall gets reverted.
Lastly, we have the maximum gas cost for the User Operation. This is commonly referred to as the
prefund since it is the amount in ETH (or native gas token) that the
sender or Paymaster is required to pay before it can run the execution phase.
This value is equal to the maximum required gas multiplied by the
maxFeePerGas. It is the absolute maximum that a User Operation can be expected to cost in transaction fees. After execution is complete, the actual gas cost is sent to the Bundler and the remainder is refunded as a deposit on the EntryPoint that can be carried over into future transactions.
Updated 12 days ago