@pimlico/alto 0.0.0-main.20250429T151930 → 0.0.0-main.20250502T100438

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/esm/cli/config/bundler.d.ts +18 -6
  2. package/esm/cli/config/bundler.js +7 -1
  3. package/esm/cli/config/bundler.js.map +1 -1
  4. package/esm/cli/config/options.js +15 -3
  5. package/esm/cli/config/options.js.map +1 -1
  6. package/esm/executor/executor.js +5 -0
  7. package/esm/executor/executor.js.map +1 -1
  8. package/esm/executor/executorManager.d.ts +5 -4
  9. package/esm/executor/executorManager.js +22 -21
  10. package/esm/executor/executorManager.js.map +1 -1
  11. package/esm/handlers/gasPriceManager.d.ts +4 -1
  12. package/esm/handlers/gasPriceManager.js +5 -7
  13. package/esm/handlers/gasPriceManager.js.map +1 -1
  14. package/esm/mempool/reputationManager.d.ts +3 -3
  15. package/esm/mempool/reputationManager.js +1 -2
  16. package/esm/mempool/reputationManager.js.map +1 -1
  17. package/esm/rpc/estimation/gasEstimationsV06.js +6 -2
  18. package/esm/rpc/estimation/gasEstimationsV06.js.map +1 -1
  19. package/esm/rpc/methods/eth_estimateUserOperationGas.d.ts +2 -1
  20. package/esm/rpc/methods/eth_estimateUserOperationGas.js +164 -11
  21. package/esm/rpc/methods/eth_estimateUserOperationGas.js.map +1 -1
  22. package/esm/rpc/methods/eth_sendUserOperation.d.ts +9 -2
  23. package/esm/rpc/methods/eth_sendUserOperation.js +114 -17
  24. package/esm/rpc/methods/eth_sendUserOperation.js.map +1 -1
  25. package/esm/rpc/methods/pimlico_sendUserOperationNow.js +4 -1
  26. package/esm/rpc/methods/pimlico_sendUserOperationNow.js.map +1 -1
  27. package/esm/rpc/rpcHandler.d.ts +7 -33
  28. package/esm/rpc/rpcHandler.js +95 -262
  29. package/esm/rpc/rpcHandler.js.map +1 -1
  30. package/esm/rpc/validation/UnsafeValidator.d.ts +1 -5
  31. package/esm/rpc/validation/UnsafeValidator.js +11 -14
  32. package/esm/rpc/validation/UnsafeValidator.js.map +1 -1
  33. package/esm/types/interfaces.d.ts +1 -5
  34. package/esm/utils/bigInt.d.ts +4 -0
  35. package/esm/utils/bigInt.js +9 -0
  36. package/esm/utils/bigInt.js.map +1 -1
  37. package/esm/utils/validation.js +26 -5
  38. package/esm/utils/validation.js.map +1 -1
  39. package/package.json +1 -1
@@ -1,28 +1,125 @@
1
- import { getUserOperationHash } from "../../utils/userop.js";
1
+ import { getNonceKeyAndSequence, getUserOperationHash } from "../../utils/userop.js";
2
2
  import { createMethodHandler } from "../createMethodHandler.js";
3
- import { sendUserOperationSchema } from "../../types/index.js";
3
+ import { sendUserOperationSchema, RpcError, ValidationErrors } from "../../types/index.js";
4
+ import { calcPreVerificationGas, getAAError } from "../../utils/index.js";
5
+ const validatePvg = async (apiVersion, rpcHandler, userOperation, entryPoint) => {
6
+ // PVG validation is skipped for v1
7
+ if (apiVersion == "v1") {
8
+ return [true, ""];
9
+ }
10
+ const requiredPvg = await calcPreVerificationGas({
11
+ config: rpcHandler.config,
12
+ userOperation,
13
+ entryPoint,
14
+ gasPriceManager: rpcHandler.gasPriceManager,
15
+ validate: true
16
+ });
17
+ if (requiredPvg > userOperation.preVerificationGas) {
18
+ return [
19
+ false,
20
+ `preVerificationGas is not enough, required: ${requiredPvg}, got: ${userOperation.preVerificationGas}`
21
+ ];
22
+ }
23
+ return [true, ""];
24
+ };
25
+ const getUserOpValidationResult = async (rpcHandler, userOperation, entryPoint) => {
26
+ const queuedUserOperations = await rpcHandler.mempool.getQueuedOustandingUserOps({
27
+ userOp: userOperation,
28
+ entryPoint
29
+ });
30
+ const validationResult = await rpcHandler.validator.validateUserOperation({
31
+ userOperation,
32
+ queuedUserOperations,
33
+ entryPoint
34
+ });
35
+ return {
36
+ queuedUserOperations,
37
+ validationResult
38
+ };
39
+ };
40
+ export async function addToMempoolIfValid(rpcHandler, userOperation, entryPoint, apiVersion) {
41
+ rpcHandler.ensureEntryPointIsSupported(entryPoint);
42
+ // Execute multiple async operations in parallel
43
+ const [userOpHash, { queuedUserOperations, validationResult }, currentNonceSeq, [pvgSuccess, pvgErrorReason], [preMempoolSuccess, preMempoolError], [validEip7702Auth, validEip7702AuthError]] = await Promise.all([
44
+ getUserOperationHash({
45
+ userOperation: userOperation,
46
+ entryPointAddress: entryPoint,
47
+ chainId: rpcHandler.config.chainId,
48
+ publicClient: rpcHandler.config.publicClient
49
+ }),
50
+ getUserOpValidationResult(rpcHandler, userOperation, entryPoint),
51
+ rpcHandler.getNonceSeq(userOperation, entryPoint),
52
+ validatePvg(apiVersion, rpcHandler, userOperation, entryPoint),
53
+ rpcHandler.preMempoolChecks(userOperation, apiVersion),
54
+ rpcHandler.validateEip7702Auth({
55
+ userOperation,
56
+ validateSender: true
57
+ })
58
+ ]);
59
+ // Validate eip7702Auth
60
+ if (!validEip7702Auth) {
61
+ rpcHandler.eventManager.emitFailedValidation(userOpHash, validEip7702AuthError);
62
+ throw new RpcError(validEip7702AuthError, ValidationErrors.InvalidFields);
63
+ }
64
+ // Pre mempool validation
65
+ if (!preMempoolSuccess) {
66
+ rpcHandler.eventManager.emitFailedValidation(userOpHash, preMempoolError);
67
+ throw new RpcError(preMempoolError);
68
+ }
69
+ // PreVerificationGas validation
70
+ if (!pvgSuccess) {
71
+ rpcHandler.eventManager.emitFailedValidation(userOpHash, pvgErrorReason);
72
+ throw new RpcError(pvgErrorReason, ValidationErrors.SimulateValidation);
73
+ }
74
+ // Nonce validation
75
+ const [, userOpNonceSeq] = getNonceKeyAndSequence(userOperation.nonce);
76
+ if (userOpNonceSeq < currentNonceSeq) {
77
+ const reason = "UserOperation failed validation with reason: AA25 invalid account nonce";
78
+ rpcHandler.eventManager.emitFailedValidation(userOpHash, reason, "AA25");
79
+ throw new RpcError(reason, ValidationErrors.InvalidFields);
80
+ }
81
+ if (userOpNonceSeq > currentNonceSeq + 10n) {
82
+ const reason = "UserOperation failed validaiton with reason: AA25 invalid account nonce";
83
+ rpcHandler.eventManager.emitFailedValidation(userOpHash, reason, "AA25");
84
+ throw new RpcError(reason, ValidationErrors.InvalidFields);
85
+ }
86
+ if (userOpNonceSeq >
87
+ currentNonceSeq + BigInt(queuedUserOperations.length)) {
88
+ rpcHandler.mempool.add(userOperation, entryPoint);
89
+ rpcHandler.eventManager.emitQueued(userOpHash);
90
+ return { result: "queued", userOpHash };
91
+ }
92
+ // userOp validation
93
+ if (rpcHandler.config.dangerousSkipUserOperationValidation) {
94
+ const [isMempoolAddSuccess, mempoolAddError] = await rpcHandler.mempool.add(userOperation, entryPoint);
95
+ if (!isMempoolAddSuccess) {
96
+ rpcHandler.eventManager.emitFailedValidation(userOpHash, mempoolAddError, getAAError(mempoolAddError));
97
+ throw new RpcError(mempoolAddError, ValidationErrors.InvalidFields);
98
+ }
99
+ return { result: "added", userOpHash };
100
+ }
101
+ // ERC-7562 scope rule validation
102
+ rpcHandler.reputationManager.checkReputation(userOperation, entryPoint, validationResult);
103
+ await rpcHandler.mempool.checkEntityMultipleRoleViolation(entryPoint, userOperation);
104
+ // Finally, add to mempool
105
+ const [isMempoolAddSuccess, mempoolAddError] = await rpcHandler.mempool.add(userOperation, entryPoint, validationResult.referencedContracts);
106
+ if (!isMempoolAddSuccess) {
107
+ rpcHandler.eventManager.emitFailedValidation(userOpHash, mempoolAddError, getAAError(mempoolAddError));
108
+ throw new RpcError(mempoolAddError, ValidationErrors.InvalidFields);
109
+ }
110
+ return { result: "added", userOpHash };
111
+ }
4
112
  export const ethSendUserOperationHandler = createMethodHandler({
5
113
  method: "eth_sendUserOperation",
6
114
  schema: sendUserOperationSchema,
7
115
  handler: async ({ rpcHandler, params, apiVersion }) => {
8
116
  const [userOperation, entryPoint] = params;
9
- if (userOperation.eip7702Auth) {
10
- await rpcHandler.validateEip7702Auth({
11
- userOperation,
12
- validateSender: true
13
- });
14
- }
15
- const hash = await getUserOperationHash({
16
- userOperation,
17
- entryPointAddress: entryPoint,
18
- chainId: rpcHandler.config.chainId,
19
- publicClient: rpcHandler.config.publicClient
20
- });
21
117
  let status = "rejected";
22
118
  try {
23
- status = await rpcHandler.addToMempoolIfValid(userOperation, entryPoint, apiVersion);
24
- rpcHandler.eventManager.emitReceived(hash);
25
- return hash;
119
+ const { result, userOpHash } = await addToMempoolIfValid(rpcHandler, userOperation, entryPoint, apiVersion);
120
+ status = result;
121
+ rpcHandler.eventManager.emitReceived(userOpHash);
122
+ return userOpHash;
26
123
  }
27
124
  catch (error) {
28
125
  status = "rejected";
@@ -1 +1 @@
1
- {"version":3,"file":"eth_sendUserOperation.js","sourceRoot":"","sources":["../../../rpc/methods/eth_sendUserOperation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAErD,MAAM,CAAC,MAAM,2BAA2B,GAAG,mBAAmB,CAAC;IAC3D,MAAM,EAAE,uBAAuB;IAC/B,MAAM,EAAE,uBAAuB;IAC/B,OAAO,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE;QAClD,MAAM,CAAC,aAAa,EAAE,UAAU,CAAC,GAAG,MAAM,CAAA;QAE1C,IAAI,aAAa,CAAC,WAAW,EAAE,CAAC;YAC5B,MAAM,UAAU,CAAC,mBAAmB,CAAC;gBACjC,aAAa;gBACb,cAAc,EAAE,IAAI;aACvB,CAAC,CAAA;QACN,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,oBAAoB,CAAC;YACpC,aAAa;YACb,iBAAiB,EAAE,UAAU;YAC7B,OAAO,EAAE,UAAU,CAAC,MAAM,CAAC,OAAO;YAClC,YAAY,EAAE,UAAU,CAAC,MAAM,CAAC,YAAY;SAC/C,CAAC,CAAA;QAEF,IAAI,MAAM,GAAoC,UAAU,CAAA;QACxD,IAAI,CAAC;YACD,MAAM,GAAG,MAAM,UAAU,CAAC,mBAAmB,CACzC,aAAa,EACb,UAAU,EACV,UAAU,CACb,CAAA;YAED,UAAU,CAAC,YAAY,CAAC,YAAY,CAAC,IAAI,CAAC,CAAA;YAE1C,OAAO,IAAI,CAAA;QACf,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,MAAM,GAAG,UAAU,CAAA;YACnB,MAAM,KAAK,CAAA;QACf,CAAC;gBAAS,CAAC;YACP,UAAU,CAAC,OAAO,CAAC,sBAAsB;iBACpC,MAAM,CAAC;gBACJ,MAAM;gBACN,IAAI,EAAE,SAAS;aAClB,CAAC;iBACD,GAAG,EAAE,CAAA;QACd,CAAC;IACL,CAAC;CACJ,CAAC,CAAA"}
1
+ {"version":3,"file":"eth_sendUserOperation.js","sourceRoot":"","sources":["../../../rpc/methods/eth_sendUserOperation.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,sBAAsB,EACtB,oBAAoB,EACvB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,EACH,uBAAuB,EACvB,QAAQ,EACR,gBAAgB,EAKnB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,sBAAsB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAKhE,MAAM,WAAW,GAAG,KAAK,EACrB,UAAsB,EACtB,UAAsB,EACtB,aAA4B,EAC5B,UAAmB,EACO,EAAE;IAC5B,mCAAmC;IACnC,IAAI,UAAU,IAAI,IAAI,EAAE,CAAC;QACrB,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;IACrB,CAAC;IAED,MAAM,WAAW,GAAG,MAAM,sBAAsB,CAAC;QAC7C,MAAM,EAAE,UAAU,CAAC,MAAM;QACzB,aAAa;QACb,UAAU;QACV,eAAe,EAAE,UAAU,CAAC,eAAe;QAC3C,QAAQ,EAAE,IAAI;KACjB,CAAC,CAAA;IAEF,IAAI,WAAW,GAAG,a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;iBACD,GAAG,EAAE,CAAA;QACd,CAAC;IACL,CAAC;CACJ,CAAC,CAAA"}
@@ -16,7 +16,10 @@ export const pimlicoSendUserOperationNowHandler = createMethodHandler({
16
16
  chainId: rpcHandler.config.chainId,
17
17
  publicClient: rpcHandler.config.publicClient
18
18
  });
19
- await rpcHandler.preMempoolChecks(opHash, userOperation, apiVersion, entryPoint);
19
+ const [preMempoolValid, preMempoolError] = await rpcHandler.preMempoolChecks(userOperation, apiVersion);
20
+ if (!preMempoolValid) {
21
+ throw new RpcError(preMempoolError);
22
+ }
20
23
  // Prepare bundle
21
24
  const userOpInfo = {
22
25
  userOp: userOperation,
@@ -1 +1 @@
1
- {"version":3,"file":"pimlico_sendUserOperationNow.js","sourceRoot":"","sources":["../../../rpc/methods/pimlico_sendUserOperationNow.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,oBAAoB,EACpB,WAAW,EACX,yBAAyB,EAC5B,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,EACH,QAAQ,EAGR,gBAAgB,EAChB,iCAAiC,EACpC,MAAM,aAAa,CAAA;AAEpB,MAAM,CAAC,MAAM,kCAAkC,GAAG,mBAAmB,CAAC;IAClE,MAAM,EAAE,8BAA8B;IACtC,MAAM,EAAE,iCAAiC;IACzC,OAAO,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE;QAClD,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,6BAA6B,EAAE,CAAC;YACnD,MAAM,IAAI,QAAQ,CACd,sDAAsD,EACtD,gBAAgB,CAAC,aAAa,CACjC,CAAA;QACL,CAAC;QAED,MAAM,CAAC,aAAa,EAAE,UAAU,CAAC,GAAG,MAAM,CAAA;QAE1C,UAAU,CAAC,2BAA2B,CAAC,UAAU,CAAC,CAAA;QAClD,MAAM,MAAM,GAAG,MAAM,oBAAoB,CAAC;YACtC,aAAa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I,QAAQ,CAAC,eAAe,CAAC,CAAA;QACvC,CAAC;QAED,iBAAiB;QACjB,MAAM,UAAU,GAAe;YAC3B,MAAM,EAAE,aAAa;YACrB,UAAU,EAAE,MAAM,oBAAoB,CAAC;gBACnC,aAAa,EAAE,aAAa;gBAC5B,iBAAiB,EAAE,UAAU;gBAC7B,OAAO,EAAE,UAAU,CAAC,MAAM,CAAC,OAAO;gBAClC,YAAY,EAAE,UAAU,CAAC,MAAM,CAAC,YAAY;aAC/C,CAAC;YACF,cAAc,EAAE,IAAI,CAAC,GAAG,EAAE;YAC1B,kBAAkB,EAAE,CAAC;SACxB,CAAA;QACD,MAAM,MAAM,GAAwB;YAChC,UAAU;YACV,OAAO,EAAE,CAAC,UAAU,CAAC;YACrB,OAAO,EAAE,WAAW,CAAC,aAAa,CAAC;gBAC/B,CAAC,CAAE,KAAe;gBAClB,CAAC,CAAE,KAAe;SACzB,CAAA;QACD,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC,CAAA;QAClE,MAAM,MAAM,GACR,MAAM,UAAU,CAAC,eAAe,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAA;QAEjE,IAAI,CAAC,MAAM,EAAE,CAAC;YACV,MAAM,IAAI,QAAQ,CACd,0CAA0C,EAC1C,gBAAgB,CAAC,aAAa,CACjC,CAAA;QACL,CAAC;QAED,oBAAoB;QACpB,MAAM,OAAO,GACT,MAAM,UAAU,CAAC,MAAM,CAAC,YAAY,CAAC,yBAAyB,CAAC;YAC3D,IAAI,EAAE,MAAM;YACZ,eAAe,EAAE,GAAG;SACvB,CAAC,CAAA;QAEN,OAAO,yBAAyB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACrD,CAAC;CACJ,CAAC,CAAA"}
@@ -1,10 +1,9 @@
1
1
  import { type Executor, type ExecutorManager } from "../executor/index.js";
2
2
  import type { EventManager, GasPriceManager } from "../handlers/index.js";
3
3
  import type { InterfaceReputationManager, Mempool, Monitor } from "../mempool/index.js";
4
- import type { ApiVersion, BundlerRequest, StateOverrides } from "../types/index.js";
4
+ import type { ApiVersion, BundlerRequest } from "../types/index.js";
5
5
  import { type Address, type InterfaceValidator, type UserOperation } from "../types/index.js";
6
6
  import type { Logger, Metrics } from "../utils/index.js";
7
- import { type Hex } from "viem";
8
7
  import type { AltoConfig } from "../createConfig.js";
9
8
  import type { MethodHandler } from "./createMethodHandler.js";
10
9
  export declare class RpcHandler {
@@ -37,39 +36,14 @@ export declare class RpcHandler {
37
36
  handleMethod(request: BundlerRequest, apiVersion: ApiVersion): Promise<any>;
38
37
  ensureEntryPointIsSupported(entryPoint: Address): void;
39
38
  ensureDebugEndpointsAreEnabled(methodName: string): void;
40
- preMempoolChecks(opHash: Hex, userOperation: UserOperation, apiVersion: ApiVersion, entryPoint: Address): Promise<void>;
41
- addToMempoolIfValid(userOperation: UserOperation, entryPoint: Address, apiVersion: ApiVersion): Promise<"added" | "queued">;
39
+ preMempoolChecks(userOperation: UserOperation, apiVersion: ApiVersion): Promise<[boolean, string]>;
42
40
  validateEip7702Auth({ userOperation, validateSender }: {
43
41
  userOperation: UserOperation;
44
42
  validateSender?: boolean;
45
- }): Promise<void>;
46
- getNonceValue(userOperation: UserOperation, entryPoint: Address): Promise<bigint>;
47
- estimateGas({ apiVersion, userOperation, entryPoint, stateOverrides }: {
48
- apiVersion: ApiVersion;
49
- userOperation: UserOperation;
50
- entryPoint: Address;
51
- stateOverrides?: StateOverrides;
52
- }): Promise<{
53
- preVerificationGas: bigint;
54
- verificationGasLimit: bigint;
55
- callGasLimit: bigint;
56
- paymasterVerificationGasLimit: bigint;
57
- paymasterPostOpGasLimit: bigint;
58
- verificationGas?: undefined;
59
- } | {
60
- preVerificationGas: bigint;
61
- verificationGasLimit: bigint;
62
- callGasLimit: bigint;
63
- paymasterVerificationGasLimit?: undefined;
64
- paymasterPostOpGasLimit?: undefined;
65
- verificationGas?: undefined;
66
- } | {
67
- preVerificationGas: bigint;
68
- verificationGas: bigint;
69
- verificationGasLimit: bigint;
70
- callGasLimit: bigint;
71
- paymasterVerificationGasLimit?: undefined;
72
- paymasterPostOpGasLimit?: undefined;
73
- }>;
43
+ }): Promise<[
44
+ boolean,
45
+ string
46
+ ]>;
47
+ getNonceSeq(userOperation: UserOperation, entryPoint: Address): Promise<bigint>;
74
48
  }
75
49
  //# sourceMappingURL=rpcHandler.d.ts.map