Skip to content

Commit

Permalink
ft: adding unsafe fallback userop validation
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilkumar1612 committed Feb 4, 2025
1 parent b1f84eb commit 6f64b2a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
10 changes: 8 additions & 2 deletions packages/executor/src/modules/eth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,14 @@ export class Eth {
);
}
await this.userOpValidationService.validateGasFee(userOp);
const validationResult =
await this.userOpValidationService.simulateValidation(userOp, entryPoint);
const validationResult = await this.userOpValidationService
.simulateValidation(userOp, entryPoint)
.catch(() => {
throw new RpcError(
"Internal error occurred while validating userOp",
RpcErrorCodes.INTERNAL_ERROR
);
});
// TODO: fetch aggregator
this.logger.debug(
"Opcode validation successful. Trying saving in mempool..."
Expand Down
24 changes: 19 additions & 5 deletions packages/executor/src/services/UserOpValidation/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,25 @@ export class UserOpValidationService {
entryPoint
);
}
return await this.safeValidationService.validateSafely(
userOp,
entryPoint,
codehash
);
return await this.safeValidationService
.validateSafely(userOp, entryPoint, codehash)
.catch(async (error) => {
this.logger.debug(
`Error occurred during userOp validation on safe mode: ${error}`
);
this.logger.debug("Validating userOp using unsafe mode...");

if (this.networkConfig.entryPointForwarder.length > 2) {
return await this.unsafeValidationService.validateUnsafelyWithForwarder(
userOp,
entryPoint
);
}
return await this.unsafeValidationService.validateUnsafely(
userOp,
entryPoint
);
});
}

async validateGasFee(userOp: UserOperationStruct): Promise<boolean> {
Expand Down

0 comments on commit 6f64b2a

Please sign in to comment.