Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
mouseless0x committed Feb 26, 2025
1 parent 0291737 commit d27673a
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 53 deletions.
119 changes: 67 additions & 52 deletions src/executor/executorManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -434,58 +434,75 @@ export class ExecutorManager {
const unwatch = this.config.publicClient.watchBlockNumber({
onBlockNumber: async (currentBlockNumber) => {
if (currentBlockNumber > blockNumber + 1n) {
const userOperationReceipt =
await this.getUserOperationReceipt(userOpHash)

if (userOperationReceipt) {
const transactionHash =
userOperationReceipt.receipt.transactionHash
const blockNumber =
userOperationReceipt.receipt.blockNumber

this.mempool.removeSubmitted(userOpHash)
this.monitor.setUserOperationStatus(userOpHash, {
status: "included",
transactionHash
})

this.eventManager.emitFrontranOnChain(
userOpHash,
transactionHash,
blockNumber
)
try {
const userOperationReceipt =
await this.getUserOperationReceipt(userOpHash)

if (userOperationReceipt) {
const transactionHash =
userOperationReceipt.receipt.transactionHash
const blockNumber =
userOperationReceipt.receipt.blockNumber

this.mempool.removeSubmitted(userOpHash)
this.monitor.setUserOperationStatus(userOpHash, {
status: "included",
transactionHash
})

this.logger.info(
{
this.eventManager.emitFrontranOnChain(
userOpHash,
transactionHash,
blockNumber
)

this.logger.info(
{
userOpHash,
transactionHash
},
"user op frontrun onchain"
)

this.metrics.userOperationsOnChain
.labels({ status: "frontran" })
.inc(1)
} else {
this.monitor.setUserOperationStatus(userOpHash, {
status: "failed",
transactionHash
})
this.eventManager.emitFailedOnChain(
userOpHash,
transactionHash,
blockNumber
)
this.logger.info(
{
userOpHash,
transactionHash
},
"user op failed onchain"
)
this.metrics.userOperationsOnChain
.labels({ status: "reverted" })
.inc(1)
}
} catch (error) {
this.logger.error(
{
userOpHash,
transactionHash,
error
},
"user op frontrun onchain"
"Error checking frontrun status"
)

this.metrics.userOperationsOnChain
.labels({ status: "frontran" })
.inc(1)
} else {
// Still mark as failed since we couldn't verify inclusion
this.monitor.setUserOperationStatus(userOpHash, {
status: "failed",
transactionHash
})
this.eventManager.emitFailedOnChain(
userOpHash,
transactionHash,
blockNumber
)
this.logger.info(
{
userOpHash,
transactionHash
},
"user op failed onchain"
)
this.metrics.userOperationsOnChain
.labels({ status: "reverted" })
.inc(1)
}
unwatch()
}
Expand Down Expand Up @@ -739,16 +756,14 @@ export class ExecutorManager {

// Free wallet and return if potentially included too many times.
if (txInfo.timesPotentiallyIncluded >= 3) {
if (txInfo.timesPotentiallyIncluded >= 3) {
this.removeSubmitted(bundle.userOps)
this.logger.warn(
{
oldTxHash,
userOps: getUserOpHashes(bundleResult.rejectedUserOps)
},
"transaction potentially already included too many times, removing"
)
}
this.removeSubmitted(bundle.userOps)
this.logger.warn(
{
oldTxHash,
userOps: getUserOpHashes(bundleResult.rejectedUserOps)
},
"transaction potentially already included too many times, removing"
)

await this.senderManager.markWalletProcessed(txInfo.executor)
return
Expand Down
2 changes: 1 addition & 1 deletion src/types/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ const partialUserOperationSchema = z.union([
partialUserOperationV07Schema
])

const userOperationSchema = z.union([
export const userOperationSchema = z.union([
userOperationV06Schema,
userOperationV07Schema
])
Expand Down

0 comments on commit d27673a

Please sign in to comment.