Skip to content

Commit

Permalink
Merge pull request #252 from pimlicolabs/fix/aa95
Browse files Browse the repository at this point in the history
Fix/aa95
  • Loading branch information
mouseless0x authored Jun 12, 2024
2 parents e46882c + c177590 commit a4fff25
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/beige-nails-march.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@pimlico/alto": patch
---

Fixed bug where gas estimate is too low leading to the bundling tx reverting onchain due to AA95
21 changes: 18 additions & 3 deletions src/executor/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -584,8 +584,6 @@ export class Executor {
childLogger
)

gasLimit += 10_000n

if (resubmitAllOps) {
this.markWalletProcessed(wallet)
return opsWithHashes.map((owh) => {
Expand Down Expand Up @@ -647,7 +645,24 @@ export class Executor {
entryPoint
})

childLogger.trace({ gasLimit }, "got gas limit")
if (isUserOpVersion06) {
// https://github.com/eth-infinitism/account-abstraction/blob/fa61290d37d079e928d92d53a122efcc63822214/contracts/core/EntryPoint.sol#L236
let innerHandleOpFloor = 0n
for (const owh of opsWithHashToBundle) {
const op = deriveUserOperation(owh.mempoolUserOperation)
innerHandleOpFloor +=
op.callGasLimit + op.verificationGasLimit + 5000n
}

if (gasLimit < innerHandleOpFloor) {
gasLimit += innerHandleOpFloor
}
}

// sometimes the estimation rounds down, adding a fixed constant accounts for this
gasLimit += 10_000n

childLogger.debug({ gasLimit }, "got gas limit")

let txHash: HexData32
try {
Expand Down

0 comments on commit a4fff25

Please sign in to comment.