Skip to content

Commit

Permalink
Merge pull request #261 from pimlicolabs/fix/aa95
Browse files Browse the repository at this point in the history
Retry again if we encounter aa95
  • Loading branch information
plusminushalf authored Jul 2, 2024
2 parents 892c7db + afa23e1 commit ffbf0c2
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/executor/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ export async function filterOpsAndEstimateGas(
)
: true

let fixedEstimationGasLimit: bigint | undefined = fixedGasLimitForEstimation
let aa95RetriesLeft = 3

while (simulatedOps.filter((op) => op.reason === undefined).length > 0) {
try {
const gasOptions = onlyPre1559
Expand Down Expand Up @@ -177,8 +180,8 @@ export async function filterOpsAndEstimateGas(
account: wallet,
nonce: nonce,
blockTag: blockTag,
...(fixedGasLimitForEstimation !== undefined && {
gas: fixedGasLimitForEstimation
...(fixedEstimationGasLimit !== undefined && {
gas: fixedEstimationGasLimit
}),
...gasOptions
}
Expand All @@ -198,7 +201,9 @@ export async function filterOpsAndEstimateGas(
to: bundleBulker,
account: wallet,
data: createCompressedCalldata(opsToSend, perOpInflatorId),
gas: fixedGasLimitForEstimation,
...(fixedEstimationGasLimit !== undefined && {
gas: fixedEstimationGasLimit
}),
nonce: nonce,
blockTag: blockTag,
...gasOptions
Expand Down Expand Up @@ -226,6 +231,17 @@ export async function filterOpsAndEstimateGas(
}

if (errorData) {
if (
errorData.reason.indexOf("AA95 out of gas") !== -1 &&
aa95RetriesLeft > 0
) {
aa95RetriesLeft--
fixedEstimationGasLimit = fixedEstimationGasLimit
? (fixedEstimationGasLimit * 110n) / 100n
: BigInt(30_000_000)
continue
}

logger.debug(
{
errorData,
Expand Down

0 comments on commit ffbf0c2

Please sign in to comment.