Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mouseless0x committed Oct 18, 2024
1 parent f7ccd43 commit 9d63f5d
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 26 deletions.
54 changes: 29 additions & 25 deletions src/executor/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,20 @@ import {
InsufficientFundsError,
IntrinsicGasTooLowError,
NonceTooLowError,
TransactionExecutionError,
encodeFunctionData,
getContract,
type Account,
type Hex,
TransactionExecutionError
BaseError
} from "viem"
import {
type CompressedFilterOpsAndEstimateGasParams,
createCompressedCalldata,
filterOpsAndEstimateGas,
flushStuckTransaction,
simulatedOpsToResults
simulatedOpsToResults,
isTransactionUnderpricedError
} from "./utils"
import type { SendTransactionErrorType } from "viem"
import type { AltoConfig } from "../createConfig"
Expand Down Expand Up @@ -548,6 +550,31 @@ export class Executor {

break
} catch (e: unknown) {
if (e instanceof BaseError) {
if (isTransactionUnderpricedError(e)) {
request.maxFeePerGas = scaleBigIntByPercent(
request.maxFeePerGas,
150
)
request.maxPriorityFeePerGas = scaleBigIntByPercent(
request.maxPriorityFeePerGas,
150
)
//this.markWalletProcessed(wallet)
//return opsWithHashToBundle.map((owh) => {
// return {
// status: "resubmit",
// info: {
// entryPoint,
// userOpHash: owh.userOperationHash,
// userOperation: owh.mempoolUserOperation,
// reason: "replacement transaction underpriced"
// }
// }
//})
}
}

const error = e as SendTransactionErrorType
let isErrorHandled = false

Expand Down Expand Up @@ -798,29 +825,6 @@ export class Executor {
})
}

if (
e?.details
?.toLowerCase()
.includes("replacement transaction underpriced")
) {
childLogger.error(
{ error: e },
"replacement transaction underpriced"
)
this.markWalletProcessed(wallet)
return opsWithHashToBundle.map((owh) => {
return {
status: "resubmit",
info: {
entryPoint,
userOpHash: owh.userOperationHash,
userOperation: owh.mempoolUserOperation,
reason: "replacement transaction underpriced"
}
}
})
}

sentry.captureException(err)
childLogger.error(
{ error: JSON.stringify(err) },
Expand Down
9 changes: 8 additions & 1 deletion src/executor/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,16 @@ import {
concat,
decodeErrorResult,
hexToBytes,
numberToHex
numberToHex,
BaseError
} from "viem"

export const isTransactionUnderpricedError = (e: BaseError) => {
return e?.details
?.toLowerCase()
.includes("replacement transaction underpriced")
}

export function simulatedOpsToResults(
simulatedOps: {
owh: UserOperationWithHash
Expand Down

0 comments on commit 9d63f5d

Please sign in to comment.