@pimlico/alto 0.0.2 → 0.0.3

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 (233) hide show
  1. package/esm/cli/alto.d.ts +6 -0
  2. package/esm/cli/alto.js +92 -0
  3. package/esm/cli/alto.js.map +1 -0
  4. package/esm/cli/config/bundler.d.ts +397 -0
  5. package/esm/cli/config/bundler.js +133 -0
  6. package/esm/cli/config/bundler.js.map +1 -0
  7. package/esm/cli/config/index.d.ts +3 -0
  8. package/esm/cli/config/index.js +3 -0
  9. package/esm/cli/config/index.js.map +1 -0
  10. package/esm/cli/config/options.d.ts +11 -0
  11. package/esm/cli/config/options.js +342 -0
  12. package/esm/cli/config/options.js.map +1 -0
  13. package/esm/cli/customTransport.d.ts +14 -0
  14. package/esm/cli/customTransport.js +53 -0
  15. package/esm/cli/customTransport.js.map +1 -0
  16. package/esm/cli/handler.d.ts +3 -0
  17. package/esm/cli/handler.js +116 -0
  18. package/esm/cli/handler.js.map +1 -0
  19. package/esm/cli/index.d.ts +4 -0
  20. package/esm/cli/index.js +4 -0
  21. package/esm/cli/index.js.map +1 -0
  22. package/esm/cli/instrumentation.d.ts +2 -0
  23. package/esm/cli/instrumentation.js +39 -0
  24. package/esm/cli/instrumentation.js.map +1 -0
  25. package/esm/cli/setupServer.d.ts +17 -0
  26. package/esm/cli/setupServer.js +155 -0
  27. package/esm/cli/setupServer.js.map +1 -0
  28. package/esm/cli/util.d.ts +22 -0
  29. package/esm/cli/util.js +30 -0
  30. package/esm/cli/util.js.map +1 -0
  31. package/esm/executor/executor.d.ts +55 -0
  32. package/esm/executor/executor.js +645 -0
  33. package/esm/executor/executor.js.map +1 -0
  34. package/esm/executor/executorManager.d.ts +34 -0
  35. package/esm/executor/executorManager.js +402 -0
  36. package/esm/executor/executorManager.js.map +1 -0
  37. package/esm/executor/index.d.ts +5 -0
  38. package/esm/executor/index.js +5 -0
  39. package/esm/executor/index.js.map +1 -0
  40. package/esm/executor/senderManager.d.ts +17 -0
  41. package/esm/executor/senderManager.js +160 -0
  42. package/esm/executor/senderManager.js.map +1 -0
  43. package/esm/executor/test/utils.d.ts +13 -0
  44. package/esm/executor/test/utils.js +75 -0
  45. package/esm/executor/test/utils.js.map +1 -0
  46. package/esm/executor/utils.d.ts +32 -0
  47. package/esm/executor/utils.js +241 -0
  48. package/esm/executor/utils.js.map +1 -0
  49. package/esm/index.d.ts +2 -0
  50. package/esm/index.js +2 -0
  51. package/esm/index.js.map +1 -0
  52. package/esm/mempool/index.d.ts +5 -0
  53. package/esm/mempool/index.js +5 -0
  54. package/esm/mempool/index.js.map +1 -0
  55. package/esm/mempool/mempool.d.ts +64 -0
  56. package/esm/mempool/mempool.js +489 -0
  57. package/esm/mempool/mempool.js.map +1 -0
  58. package/esm/mempool/monitoring.d.ts +10 -0
  59. package/esm/mempool/monitoring.js +34 -0
  60. package/esm/mempool/monitoring.js.map +1 -0
  61. package/esm/mempool/nullMempool.d.ts +15 -0
  62. package/esm/mempool/nullMempool.js +36 -0
  63. package/esm/mempool/nullMempool.js.map +1 -0
  64. package/esm/mempool/reputationManager.d.ts +115 -0
  65. package/esm/mempool/reputationManager.js +397 -0
  66. package/esm/mempool/reputationManager.js.map +1 -0
  67. package/esm/mempool/store.d.ts +22 -0
  68. package/esm/mempool/store.js +123 -0
  69. package/esm/mempool/store.js.map +1 -0
  70. package/esm/rpc/EntryPointSimulationsV07.d.ts +58 -0
  71. package/esm/rpc/EntryPointSimulationsV07.js +407 -0
  72. package/esm/rpc/EntryPointSimulationsV07.js.map +1 -0
  73. package/esm/rpc/ExecuteSimulator.d.ts +37 -0
  74. package/esm/rpc/ExecuteSimulator.js +48 -0
  75. package/esm/rpc/ExecuteSimulator.js.map +1 -0
  76. package/esm/rpc/gasEstimation.d.ts +17 -0
  77. package/esm/rpc/gasEstimation.js +410 -0
  78. package/esm/rpc/gasEstimation.js.map +1 -0
  79. package/esm/rpc/index.d.ts +5 -0
  80. package/esm/rpc/index.js +5 -0
  81. package/esm/rpc/index.js.map +1 -0
  82. package/esm/rpc/nonceQueuer.d.ts +25 -0
  83. package/esm/rpc/nonceQueuer.js +135 -0
  84. package/esm/rpc/nonceQueuer.js.map +1 -0
  85. package/esm/rpc/rpcHandler.d.ts +64 -0
  86. package/esm/rpc/rpcHandler.js +727 -0
  87. package/esm/rpc/rpcHandler.js.map +1 -0
  88. package/esm/rpc/server.d.ts +31 -0
  89. package/esm/rpc/server.js +239 -0
  90. package/esm/rpc/server.js.map +1 -0
  91. package/esm/rpc/validation/BundlerCollectorTracerV06.d.ts +102 -0
  92. package/esm/rpc/validation/BundlerCollectorTracerV06.js +255 -0
  93. package/esm/rpc/validation/BundlerCollectorTracerV06.js.map +1 -0
  94. package/esm/rpc/validation/BundlerCollectorTracerV07.d.ts +102 -0
  95. package/esm/rpc/validation/BundlerCollectorTracerV07.js +254 -0
  96. package/esm/rpc/validation/BundlerCollectorTracerV07.js.map +1 -0
  97. package/esm/rpc/validation/SafeValidator.d.ts +35 -0
  98. package/esm/rpc/validation/SafeValidator.js +487 -0
  99. package/esm/rpc/validation/SafeValidator.js.map +1 -0
  100. package/esm/rpc/validation/TracerResultParserV06.d.ts +13 -0
  101. package/esm/rpc/validation/TracerResultParserV06.js +578 -0
  102. package/esm/rpc/validation/TracerResultParserV06.js.map +1 -0
  103. package/esm/rpc/validation/TracerResultParserV07.d.ts +33 -0
  104. package/esm/rpc/validation/TracerResultParserV07.js +557 -0
  105. package/esm/rpc/validation/TracerResultParserV07.js.map +1 -0
  106. package/esm/rpc/validation/UnsafeValidator.d.ts +63 -0
  107. package/esm/rpc/validation/UnsafeValidator.js +257 -0
  108. package/esm/rpc/validation/UnsafeValidator.js.map +1 -0
  109. package/esm/rpc/validation/index.d.ts +3 -0
  110. package/esm/rpc/validation/index.js +3 -0
  111. package/esm/rpc/validation/index.js.map +1 -0
  112. package/esm/rpc/validation/tracer.d.ts +122 -0
  113. package/esm/rpc/validation/tracer.js +82 -0
  114. package/esm/rpc/validation/tracer.js.map +1 -0
  115. package/esm/types/contracts/BundleBulker.d.ts +120 -0
  116. package/esm/types/contracts/BundleBulker.js +157 -0
  117. package/esm/types/contracts/BundleBulker.js.map +1 -0
  118. package/esm/types/contracts/CallEngine.d.ts +28 -0
  119. package/esm/types/contracts/CallEngine.js +37 -0
  120. package/esm/types/contracts/CallEngine.js.map +1 -0
  121. package/esm/types/contracts/CodeHashGetter.d.ts +37 -0
  122. package/esm/types/contracts/CodeHashGetter.js +45 -0
  123. package/esm/types/contracts/CodeHashGetter.js.map +1 -0
  124. package/esm/types/contracts/EntryPoint.d.ts +1789 -0
  125. package/esm/types/contracts/EntryPoint.js +2304 -0
  126. package/esm/types/contracts/EntryPoint.js.map +1 -0
  127. package/esm/types/contracts/EntryPointSimulations.d.ts +153 -0
  128. package/esm/types/contracts/EntryPointSimulations.js +15 -0
  129. package/esm/types/contracts/EntryPointSimulations.js.map +1 -0
  130. package/esm/types/contracts/IOpInflator.d.ts +61 -0
  131. package/esm/types/contracts/IOpInflator.js +80 -0
  132. package/esm/types/contracts/IOpInflator.js.map +1 -0
  133. package/esm/types/contracts/IPaymaster.d.ts +3 -0
  134. package/esm/types/contracts/IPaymaster.js +117 -0
  135. package/esm/types/contracts/IPaymaster.js.map +1 -0
  136. package/esm/types/contracts/Inflator.d.ts +65 -0
  137. package/esm/types/contracts/Inflator.js +84 -0
  138. package/esm/types/contracts/Inflator.js.map +1 -0
  139. package/esm/types/contracts/PerOpInflator.d.ts +176 -0
  140. package/esm/types/contracts/PerOpInflator.js +229 -0
  141. package/esm/types/contracts/PerOpInflator.js.map +1 -0
  142. package/esm/types/contracts/PimlicoEntryPointSimulations.d.ts +23 -0
  143. package/esm/types/contracts/PimlicoEntryPointSimulations.js +33 -0
  144. package/esm/types/contracts/PimlicoEntryPointSimulations.js.map +1 -0
  145. package/esm/types/contracts/SenderCreator.d.ts +4 -0
  146. package/esm/types/contracts/SenderCreator.js +23 -0
  147. package/esm/types/contracts/SenderCreator.js.map +1 -0
  148. package/esm/types/contracts/SimpleAccountFactory.d.ts +57 -0
  149. package/esm/types/contracts/SimpleAccountFactory.js +76 -0
  150. package/esm/types/contracts/SimpleAccountFactory.js.map +1 -0
  151. package/esm/types/contracts/TestOpcodesAccount.d.ts +4 -0
  152. package/esm/types/contracts/TestOpcodesAccount.js +281 -0
  153. package/esm/types/contracts/TestOpcodesAccount.js.map +1 -0
  154. package/esm/types/contracts/TestOpcodesAccountFactory.d.ts +4 -0
  155. package/esm/types/contracts/TestOpcodesAccountFactory.js +23 -0
  156. package/esm/types/contracts/TestOpcodesAccountFactory.js.map +1 -0
  157. package/esm/types/contracts/TestStorageAccount.d.ts +4 -0
  158. package/esm/types/contracts/TestStorageAccount.js +313 -0
  159. package/esm/types/contracts/TestStorageAccount.js.map +1 -0
  160. package/esm/types/contracts/index.d.ts +17 -0
  161. package/esm/types/contracts/index.js +17 -0
  162. package/esm/types/contracts/index.js.map +1 -0
  163. package/esm/types/gasPrice.d.ts +110 -0
  164. package/esm/types/gasPrice.js +52 -0
  165. package/esm/types/gasPrice.js.map +1 -0
  166. package/esm/types/index.d.ts +11 -0
  167. package/esm/types/index.js +11 -0
  168. package/esm/types/index.js.map +1 -0
  169. package/esm/types/interfaces.d.ts +26 -0
  170. package/esm/types/interfaces.js +2 -0
  171. package/esm/types/interfaces.js.map +1 -0
  172. package/esm/types/mempool.d.ts +79 -0
  173. package/esm/types/mempool.js +16 -0
  174. package/esm/types/mempool.js.map +1 -0
  175. package/esm/types/schemas.d.ts +4791 -0
  176. package/esm/types/schemas.js +497 -0
  177. package/esm/types/schemas.js.map +1 -0
  178. package/esm/types/test/validationTestErrors.d.ts +3 -0
  179. package/esm/types/test/validationTestErrors.js +229 -0
  180. package/esm/types/test/validationTestErrors.js.map +1 -0
  181. package/esm/types/utils.d.ts +24 -0
  182. package/esm/types/utils.js +30 -0
  183. package/esm/types/utils.js.map +1 -0
  184. package/esm/types/validation.d.ts +14327 -0
  185. package/esm/types/validation.js +304 -0
  186. package/esm/types/validation.js.map +1 -0
  187. package/esm/utils/bigInt.d.ts +3 -0
  188. package/esm/utils/bigInt.js +9 -0
  189. package/esm/utils/bigInt.js.map +1 -0
  190. package/esm/utils/compressionHandler.d.ts +11 -0
  191. package/esm/utils/compressionHandler.js +39 -0
  192. package/esm/utils/compressionHandler.js.map +1 -0
  193. package/esm/utils/gasPriceManager.d.ts +34 -0
  194. package/esm/utils/gasPriceManager.js +338 -0
  195. package/esm/utils/gasPriceManager.js.map +1 -0
  196. package/esm/utils/helpers.d.ts +4 -0
  197. package/esm/utils/helpers.js +13 -0
  198. package/esm/utils/helpers.js.map +1 -0
  199. package/esm/utils/index.d.ts +11 -0
  200. package/esm/utils/index.js +10 -0
  201. package/esm/utils/index.js.map +1 -0
  202. package/esm/utils/logger.d.ts +6 -0
  203. package/esm/utils/logger.js +76 -0
  204. package/esm/utils/logger.js.map +1 -0
  205. package/esm/utils/metrics.d.ts +22 -0
  206. package/esm/utils/metrics.js +150 -0
  207. package/esm/utils/metrics.js.map +1 -0
  208. package/esm/utils/rpc-reply.d.ts +17 -0
  209. package/esm/utils/rpc-reply.js +41 -0
  210. package/esm/utils/rpc-reply.js.map +1 -0
  211. package/esm/utils/test.d.ts +17 -0
  212. package/esm/utils/test.js +130 -0
  213. package/esm/utils/test.js.map +1 -0
  214. package/esm/utils/userop.d.ts +49 -0
  215. package/esm/utils/userop.js +408 -0
  216. package/esm/utils/userop.js.map +1 -0
  217. package/esm/utils/validation.d.ts +65 -0
  218. package/esm/utils/validation.js +461 -0
  219. package/esm/utils/validation.js.map +1 -0
  220. package/lib/cli/config/bundler.d.ts +6 -0
  221. package/lib/cli/config/bundler.js +2 -1
  222. package/lib/cli/config/bundler.js.map +1 -1
  223. package/lib/cli/config/options.js +6 -0
  224. package/lib/cli/config/options.js.map +1 -1
  225. package/lib/cli/setupServer.js +1 -1
  226. package/lib/cli/setupServer.js.map +1 -1
  227. package/lib/executor/executor.d.ts +2 -1
  228. package/lib/executor/executor.js +6 -4
  229. package/lib/executor/executor.js.map +1 -1
  230. package/lib/executor/utils.d.ts +1 -1
  231. package/lib/executor/utils.js +4 -4
  232. package/lib/executor/utils.js.map +1 -1
  233. package/package.json +1 -1
@@ -0,0 +1,35 @@
1
+ import type { SenderManager } from "../../executor/index.js";
2
+ import type { ChainType, InterfaceValidator, UserOperationV06, UserOperationV07, ValidationResult, ValidationResultV06, ValidationResultV07, ValidationResultWithAggregationV06, ValidationResultWithAggregationV07 } from "../../types/index.js";
3
+ import { type Address, type ReferencedCodeHashes, type StorageMap, type UserOperation, type ValidationResultWithAggregation } from "../../types/index.js";
4
+ import type { GasPriceManager, Logger, Metrics } from "../../utils/index.js";
5
+ import { type Chain, type PublicClient, type Transport } from "viem";
6
+ import { type BundlerTracerResult } from "./BundlerCollectorTracerV06.js";
7
+ import { UnsafeValidator } from "./UnsafeValidator.js";
8
+ export declare class SafeValidator extends UnsafeValidator implements InterfaceValidator {
9
+ private senderManager;
10
+ constructor(publicClient: PublicClient<Transport, Chain>, senderManager: SenderManager, logger: Logger, metrics: Metrics, gasPriceManager: GasPriceManager, chainType: ChainType, entryPointSimulationsAddress?: Address, fixedGasLimitForEstimation?: bigint, usingTenderly?: boolean, balanceOverrideEnabled?: boolean);
11
+ validateUserOperation(shouldCheckPrefund: boolean, userOperation: UserOperation, queuedUserOperations: UserOperation[], entryPoint: Address, referencedContracts?: ReferencedCodeHashes): Promise<(ValidationResult | ValidationResultWithAggregation) & {
12
+ storageMap: StorageMap;
13
+ referencedContracts?: ReferencedCodeHashes;
14
+ }>;
15
+ getCodeHashes(addresses: string[]): Promise<ReferencedCodeHashes>;
16
+ getValidationResultV07(userOperation: UserOperationV07, queuedUserOperations: UserOperationV07[], entryPoint: Address, preCodeHashes?: ReferencedCodeHashes): Promise<(ValidationResultV07 | ValidationResultWithAggregationV07) & {
17
+ storageMap: StorageMap;
18
+ referencedContracts?: ReferencedCodeHashes;
19
+ }>;
20
+ getValidationResultV06(userOperation: UserOperationV06, entryPoint: Address, preCodeHashes?: ReferencedCodeHashes): Promise<(ValidationResultV06 | ValidationResultWithAggregationV06) & {
21
+ referencedContracts?: ReferencedCodeHashes;
22
+ storageMap: StorageMap;
23
+ }>;
24
+ getValidationResultWithTracerV06(userOperation: UserOperationV06, entryPoint: Address): Promise<[ValidationResultV06, BundlerTracerResult]>;
25
+ parseErrorResultV06(userOperation: UserOperationV06, errorResult: {
26
+ errorName: string;
27
+ errorArgs: any;
28
+ }): ValidationResult | ValidationResultWithAggregation;
29
+ getValidationResultWithTracerV07(userOperation: UserOperationV07, entryPoint: Address): Promise<[ValidationResultV07, BundlerTracerResult]>;
30
+ parseErrorResultV07(userOperation: UserOperationV07, errorResult: {
31
+ errorName: string;
32
+ errorArgs: any;
33
+ }): ValidationResult | ValidationResultWithAggregation;
34
+ }
35
+ //# sourceMappingURL=SafeValidator.d.ts.map
@@ -0,0 +1,487 @@
1
+ import { CodeHashGetterAbi, CodeHashGetterBytecode, EntryPointV06Abi, EntryPointV07Abi, EntryPointV07SimulationsAbi, PimlicoEntryPointSimulationsAbi, PimlicoEntryPointSimulationsBytecode, RpcError, ValidationErrors } from "../../types/index.js";
2
+ import { calcVerificationGasAndCallGasLimit, getAddressFromInitCodeOrPaymasterAndData, isVersion06, isVersion07, toPackedUserOperation } from "../../utils/index.js";
3
+ import { decodeAbiParameters, decodeErrorResult, encodeDeployData, encodeFunctionData, zeroAddress } from "viem";
4
+ import { parseFailedOpWithRevert } from "../EntryPointSimulationsV07.js";
5
+ import { bundlerCollectorTracer } from "./BundlerCollectorTracerV06.js";
6
+ import { tracerResultParserV06 } from "./TracerResultParserV06.js";
7
+ import { tracerResultParserV07 } from "./TracerResultParserV07.js";
8
+ import { UnsafeValidator } from "./UnsafeValidator.js";
9
+ import { debug_traceCall } from "./tracer.js";
10
+ export class SafeValidator extends UnsafeValidator {
11
+ senderManager;
12
+ constructor(publicClient, senderManager, logger, metrics, gasPriceManager, chainType, entryPointSimulationsAddress, fixedGasLimitForEstimation, usingTenderly = false, balanceOverrideEnabled = false) {
13
+ super(publicClient, logger, metrics, gasPriceManager, chainType, entryPointSimulationsAddress, fixedGasLimitForEstimation, usingTenderly, balanceOverrideEnabled);
14
+ this.senderManager = senderManager;
15
+ }
16
+ async validateUserOperation(shouldCheckPrefund, userOperation, queuedUserOperations, entryPoint, referencedContracts) {
17
+ try {
18
+ const validationResult = await this.getValidationResult(userOperation, queuedUserOperations, entryPoint, referencedContracts);
19
+ if (shouldCheckPrefund) {
20
+ const prefund = validationResult.returnInfo.prefund;
21
+ const { verificationGasLimit, callGasLimit } = calcVerificationGasAndCallGasLimit(userOperation, {
22
+ preOpGas: validationResult.returnInfo.preOpGas,
23
+ paid: validationResult.returnInfo.prefund
24
+ }, this.chainId);
25
+ let mul = 1n;
26
+ if (isVersion06(userOperation) &&
27
+ userOperation.paymasterAndData) {
28
+ mul = 3n;
29
+ }
30
+ if (isVersion07(userOperation) &&
31
+ userOperation.paymaster === "0x") {
32
+ mul = 3n;
33
+ }
34
+ const requiredPreFund = callGasLimit +
35
+ verificationGasLimit * mul +
36
+ userOperation.preVerificationGas;
37
+ if (requiredPreFund > prefund) {
38
+ throw new RpcError(`prefund is not enough, required: ${requiredPreFund}, got: ${prefund}`, ValidationErrors.SimulateValidation);
39
+ }
40
+ // TODO prefund should be greater than it costs us to add it to mempool
41
+ }
42
+ this.metrics.userOperationsValidationSuccess.inc();
43
+ return validationResult;
44
+ }
45
+ catch (e) {
46
+ this.metrics.userOperationsValidationFailure.inc();
47
+ throw e;
48
+ }
49
+ }
50
+ async getCodeHashes(addresses) {
51
+ const deployData = encodeDeployData({
52
+ abi: CodeHashGetterAbi,
53
+ bytecode: CodeHashGetterBytecode,
54
+ args: [addresses]
55
+ });
56
+ const wallet = await this.senderManager.getWallet();
57
+ let hash = "";
58
+ try {
59
+ await this.publicClient.call({
60
+ account: wallet,
61
+ data: deployData
62
+ });
63
+ }
64
+ catch (e) {
65
+ const error = e;
66
+ // biome-ignore lint/suspicious/noExplicitAny: it's a generic type
67
+ hash = error.walk().data;
68
+ }
69
+ this.senderManager.pushWallet(wallet);
70
+ return {
71
+ hash,
72
+ addresses
73
+ };
74
+ }
75
+ async getValidationResultV07(userOperation, queuedUserOperations, entryPoint, preCodeHashes) {
76
+ if (this.usingTenderly) {
77
+ return super.getValidationResultV07(userOperation, queuedUserOperations, entryPoint);
78
+ }
79
+ if (preCodeHashes && preCodeHashes.addresses.length > 0) {
80
+ const { hash } = await this.getCodeHashes(preCodeHashes.addresses);
81
+ if (hash !== preCodeHashes.hash) {
82
+ throw new RpcError("code hashes mismatch", ValidationErrors.OpcodeValidation);
83
+ }
84
+ }
85
+ const [res, tracerResult] = await this.getValidationResultWithTracerV07(userOperation, entryPoint);
86
+ const [contractAddresses, storageMap] = tracerResultParserV07(userOperation, tracerResult, res, entryPoint.toLowerCase());
87
+ const codeHashes = preCodeHashes || (await this.getCodeHashes(contractAddresses));
88
+ // biome-ignore lint/suspicious/noExplicitAny: it's a generic type
89
+ if (res === "0x") {
90
+ throw new Error("simulateValidation reverted with no revert string!");
91
+ }
92
+ if (res.returnInfo.accountSigFailed) {
93
+ throw new RpcError("Invalid UserOp signature", ValidationErrors.InvalidSignature);
94
+ }
95
+ if (res.returnInfo.paymasterSigFailed) {
96
+ throw new RpcError("Invalid UserOp paymasterData", ValidationErrors.InvalidSignature);
97
+ }
98
+ const now = Math.floor(Date.now() / 1000);
99
+ if (res.returnInfo.validAfter === undefined ||
100
+ res.returnInfo.validAfter > now - 5) {
101
+ throw new RpcError(`User operation is not valid yet, validAfter=${res.returnInfo.validAfter}, now=${now}`, ValidationErrors.ExpiresShortly);
102
+ }
103
+ if (res.returnInfo.validUntil === undefined ||
104
+ res.returnInfo.validUntil < now + 30) {
105
+ throw new RpcError(`UserOperation expires too soon, validUntil=${res.returnInfo.validUntil}, now=${now}`, ValidationErrors.ExpiresShortly);
106
+ }
107
+ return {
108
+ ...res,
109
+ referencedContracts: codeHashes,
110
+ storageMap
111
+ };
112
+ }
113
+ async getValidationResultV06(userOperation, entryPoint, preCodeHashes) {
114
+ if (this.usingTenderly) {
115
+ return super.getValidationResultV06(userOperation, entryPoint);
116
+ }
117
+ if (preCodeHashes && preCodeHashes.addresses.length > 0) {
118
+ const { hash } = await this.getCodeHashes(preCodeHashes.addresses);
119
+ if (hash !== preCodeHashes.hash) {
120
+ throw new RpcError("code hashes mismatch", ValidationErrors.OpcodeValidation);
121
+ }
122
+ }
123
+ const [res, tracerResult] = await this.getValidationResultWithTracerV06(userOperation, entryPoint);
124
+ const [contractAddresses, storageMap] = tracerResultParserV06(userOperation, tracerResult, res, entryPoint.toLowerCase());
125
+ const codeHashes = preCodeHashes || (await this.getCodeHashes(contractAddresses));
126
+ // biome-ignore lint/suspicious/noExplicitAny: it's a generic type
127
+ if (res === "0x") {
128
+ throw new Error("simulateValidation reverted with no revert string!");
129
+ }
130
+ const validationResult = {
131
+ ...res,
132
+ referencedContracts: codeHashes,
133
+ storageMap
134
+ };
135
+ if (validationResult.returnInfo.sigFailed) {
136
+ throw new RpcError("Invalid UserOp signature or paymaster signature", ValidationErrors.InvalidSignature);
137
+ }
138
+ const now = Date.now() / 1000;
139
+ this.logger.debug({
140
+ validAfter: validationResult.returnInfo.validAfter,
141
+ validUntil: validationResult.returnInfo.validUntil,
142
+ now: now
143
+ });
144
+ if (validationResult.returnInfo.validAfter > now - 5) {
145
+ throw new RpcError("User operation is not valid yet", ValidationErrors.ExpiresShortly);
146
+ }
147
+ if (validationResult.returnInfo.validUntil < now + 30) {
148
+ throw new RpcError("expires too soon", ValidationErrors.ExpiresShortly);
149
+ }
150
+ return validationResult;
151
+ }
152
+ async getValidationResultWithTracerV06(userOperation, entryPoint) {
153
+ const tracerResult = await debug_traceCall(this.publicClient, {
154
+ from: zeroAddress,
155
+ to: entryPoint,
156
+ data: encodeFunctionData({
157
+ abi: EntryPointV06Abi,
158
+ functionName: "simulateValidation",
159
+ args: [userOperation]
160
+ })
161
+ }, {
162
+ tracer: bundlerCollectorTracer
163
+ });
164
+ const lastResult = tracerResult.calls.slice(-1)[0];
165
+ if (lastResult.type !== "REVERT") {
166
+ throw new Error("Invalid response. simulateCall must revert");
167
+ }
168
+ const data = lastResult.data;
169
+ if (data === "0x") {
170
+ // biome-ignore lint/suspicious/noExplicitAny: it's a generic type
171
+ return [data, tracerResult];
172
+ }
173
+ try {
174
+ const { errorName, args: errorArgs } = decodeErrorResult({
175
+ abi: EntryPointV06Abi,
176
+ data
177
+ });
178
+ const errFullName = `${errorName}(${errorArgs.toString()})`;
179
+ const errorResult = this.parseErrorResultV06(userOperation, {
180
+ errorName,
181
+ errorArgs
182
+ });
183
+ if (!errorName.includes("Result")) {
184
+ // a real error, not a result.
185
+ throw new Error(errFullName);
186
+ }
187
+ // @ts-ignore
188
+ return [errorResult, tracerResult];
189
+ // biome-ignore lint/suspicious/noExplicitAny: it's a generic type
190
+ }
191
+ catch (e) {
192
+ // if already parsed, throw as is
193
+ if (e.code != null) {
194
+ throw e;
195
+ }
196
+ throw new RpcError(data);
197
+ }
198
+ }
199
+ parseErrorResultV06(userOperation,
200
+ // biome-ignore lint/suspicious/noExplicitAny: it's a generic type
201
+ errorResult) {
202
+ if (!errorResult?.errorName?.startsWith("ValidationResult")) {
203
+ // parse it as FailedOp
204
+ // if its FailedOp, then we have the paymaster param... otherwise its an Error(string)
205
+ let paymaster = errorResult.errorArgs.paymaster;
206
+ if (paymaster === zeroAddress) {
207
+ paymaster = undefined;
208
+ }
209
+ // eslint-disable-next-line
210
+ const msg = errorResult.errorArgs[1] ?? errorResult.toString();
211
+ if (paymaster == null) {
212
+ throw new RpcError(`account validation failed: ${msg}`, ValidationErrors.SimulateValidation);
213
+ }
214
+ throw new RpcError(`paymaster validation failed: ${msg}`, ValidationErrors.SimulatePaymasterValidation, {
215
+ paymaster
216
+ });
217
+ }
218
+ const [returnInfo, senderInfo, factoryInfo, paymasterInfo, aggregatorInfo // may be missing (exists only SimulationResultWithAggregator)
219
+ ] = errorResult.errorArgs;
220
+ // extract address from "data" (first 20 bytes)
221
+ // add it as "addr" member to the "stakeinfo" struct
222
+ // if no address, then return "undefined" instead of struct.
223
+ function fillEntity(data, info) {
224
+ const addr = getAddressFromInitCodeOrPaymasterAndData(data);
225
+ return addr == null
226
+ ? undefined
227
+ : {
228
+ ...info,
229
+ addr
230
+ };
231
+ }
232
+ function fillEntityAggregator(data, info) {
233
+ const addr = getAddressFromInitCodeOrPaymasterAndData(data);
234
+ return addr == null
235
+ ? undefined
236
+ : {
237
+ aggregator: data,
238
+ stakeInfo: {
239
+ ...info,
240
+ addr
241
+ }
242
+ };
243
+ }
244
+ return {
245
+ returnInfo,
246
+ senderInfo: {
247
+ ...senderInfo,
248
+ addr: userOperation.sender
249
+ },
250
+ factoryInfo: fillEntity(userOperation.initCode, factoryInfo),
251
+ paymasterInfo: fillEntity(userOperation.paymasterAndData, paymasterInfo),
252
+ aggregatorInfo: fillEntityAggregator(aggregatorInfo?.actualAggregator, aggregatorInfo?.stakeInfo)
253
+ };
254
+ }
255
+ async getValidationResultWithTracerV07(userOperation, entryPoint) {
256
+ const packedUserOperation = toPackedUserOperation(userOperation);
257
+ const entryPointSimulationsCallData = encodeFunctionData({
258
+ abi: EntryPointV07SimulationsAbi,
259
+ functionName: "simulateValidation",
260
+ args: [packedUserOperation]
261
+ });
262
+ const callData = encodeDeployData({
263
+ abi: PimlicoEntryPointSimulationsAbi,
264
+ bytecode: PimlicoEntryPointSimulationsBytecode,
265
+ args: [entryPoint, entryPointSimulationsCallData]
266
+ });
267
+ const tracerResult = await debug_traceCall(this.publicClient, {
268
+ from: zeroAddress,
269
+ data: callData
270
+ }, {
271
+ tracer: bundlerCollectorTracer
272
+ });
273
+ const lastResult = tracerResult.calls.slice(-1)[0];
274
+ if (lastResult.type !== "REVERT") {
275
+ throw new Error("Invalid response. simulateCall must revert");
276
+ }
277
+ const data = lastResult.data;
278
+ if (data === "0x") {
279
+ // biome-ignore lint/suspicious/noExplicitAny: it's a generic type
280
+ return [data, tracerResult];
281
+ }
282
+ try {
283
+ const { errorName, args: errorArgs } = decodeErrorResult({
284
+ abi: EntryPointV07Abi,
285
+ data
286
+ });
287
+ const errorResult = this.parseErrorResultV07(userOperation, {
288
+ errorName,
289
+ errorArgs
290
+ });
291
+ // @ts-ignore
292
+ return [errorResult, tracerResult];
293
+ // biome-ignore lint/suspicious/noExplicitAny: it's a generic type
294
+ }
295
+ catch (e) {
296
+ // if already parsed, throw as is
297
+ if (e.code != null) {
298
+ throw e;
299
+ }
300
+ throw new RpcError(data);
301
+ }
302
+ }
303
+ parseErrorResultV07(userOperation,
304
+ // biome-ignore lint/suspicious/noExplicitAny: it's a generic type
305
+ errorResult) {
306
+ let decodedResult;
307
+ try {
308
+ decodeErrorResult({
309
+ abi: EntryPointV07SimulationsAbi,
310
+ data: errorResult.errorArgs[1]
311
+ });
312
+ const result = decodeErrorResult({
313
+ abi: EntryPointV07SimulationsAbi,
314
+ data: errorResult.errorArgs[1]
315
+ });
316
+ if (result.errorName === "FailedOp") {
317
+ if ((result.args?.[1]).includes("AA24")) {
318
+ throw new RpcError("Invalid UserOp signature", ValidationErrors.InvalidSignature);
319
+ }
320
+ if ((result.args?.[1]).includes("AA34")) {
321
+ throw new RpcError("Invalid UserOp paymasterData", ValidationErrors.InvalidSignature);
322
+ }
323
+ throw new RpcError(`ValidationResult error: ${result.args?.[1]}`, ValidationErrors.SimulateValidation);
324
+ }
325
+ if (result.errorName === "FailedOpWithRevert") {
326
+ const data = result.args?.[2];
327
+ const error = parseFailedOpWithRevert(data);
328
+ throw new RpcError(`ValidationResult error: ${result.args?.[1]} with revert error as: Panic(${error})`, ValidationErrors.SimulateValidation);
329
+ }
330
+ throw new RpcError(`ValidationResult error: ${result.errorName}`, ValidationErrors.SimulateValidation);
331
+ }
332
+ catch (e) {
333
+ if (e instanceof RpcError) {
334
+ throw e;
335
+ }
336
+ decodedResult = decodeAbiParameters([
337
+ {
338
+ components: [
339
+ {
340
+ components: [
341
+ {
342
+ internalType: "uint256",
343
+ name: "preOpGas",
344
+ type: "uint256"
345
+ },
346
+ {
347
+ internalType: "uint256",
348
+ name: "prefund",
349
+ type: "uint256"
350
+ },
351
+ {
352
+ internalType: "uint256",
353
+ name: "accountValidationData",
354
+ type: "uint256"
355
+ },
356
+ {
357
+ internalType: "uint256",
358
+ name: "paymasterValidationData",
359
+ type: "uint256"
360
+ },
361
+ {
362
+ internalType: "bytes",
363
+ name: "paymasterContext",
364
+ type: "bytes"
365
+ }
366
+ ],
367
+ internalType: "struct IEntryPoint.ReturnInfo",
368
+ name: "returnInfo",
369
+ type: "tuple"
370
+ },
371
+ {
372
+ components: [
373
+ {
374
+ internalType: "uint256",
375
+ name: "stake",
376
+ type: "uint256"
377
+ },
378
+ {
379
+ internalType: "uint256",
380
+ name: "unstakeDelaySec",
381
+ type: "uint256"
382
+ }
383
+ ],
384
+ internalType: "struct IStakeManager.StakeInfo",
385
+ name: "senderInfo",
386
+ type: "tuple"
387
+ },
388
+ {
389
+ components: [
390
+ {
391
+ internalType: "uint256",
392
+ name: "stake",
393
+ type: "uint256"
394
+ },
395
+ {
396
+ internalType: "uint256",
397
+ name: "unstakeDelaySec",
398
+ type: "uint256"
399
+ }
400
+ ],
401
+ internalType: "struct IStakeManager.StakeInfo",
402
+ name: "factoryInfo",
403
+ type: "tuple"
404
+ },
405
+ {
406
+ components: [
407
+ {
408
+ internalType: "uint256",
409
+ name: "stake",
410
+ type: "uint256"
411
+ },
412
+ {
413
+ internalType: "uint256",
414
+ name: "unstakeDelaySec",
415
+ type: "uint256"
416
+ }
417
+ ],
418
+ internalType: "struct IStakeManager.StakeInfo",
419
+ name: "paymasterInfo",
420
+ type: "tuple"
421
+ },
422
+ {
423
+ components: [
424
+ {
425
+ internalType: "address",
426
+ name: "aggregator",
427
+ type: "address"
428
+ },
429
+ {
430
+ components: [
431
+ {
432
+ internalType: "uint256",
433
+ name: "stake",
434
+ type: "uint256"
435
+ },
436
+ {
437
+ internalType: "uint256",
438
+ name: "unstakeDelaySec",
439
+ type: "uint256"
440
+ }
441
+ ],
442
+ internalType: "struct IStakeManager.StakeInfo",
443
+ name: "stakeInfo",
444
+ type: "tuple"
445
+ }
446
+ ],
447
+ internalType: "struct IEntryPoint.AggregatorStakeInfo",
448
+ name: "aggregatorInfo",
449
+ type: "tuple"
450
+ }
451
+ ],
452
+ internalType: "struct IEntryPointSimulations.ValidationResult",
453
+ name: "",
454
+ type: "tuple"
455
+ }
456
+ ], errorResult.errorArgs[1])[0];
457
+ }
458
+ const mergedValidation = this.mergeValidationDataValues(decodedResult.returnInfo.accountValidationData, decodedResult.returnInfo.paymasterValidationData);
459
+ return {
460
+ returnInfo: {
461
+ ...decodedResult.returnInfo,
462
+ accountSigFailed: mergedValidation.accountSigFailed,
463
+ paymasterSigFailed: mergedValidation.paymasterSigFailed,
464
+ validUntil: mergedValidation.validUntil,
465
+ validAfter: mergedValidation.validAfter
466
+ },
467
+ senderInfo: {
468
+ ...decodedResult.senderInfo,
469
+ addr: userOperation.sender
470
+ },
471
+ factoryInfo: userOperation.factory && decodedResult.factoryInfo
472
+ ? {
473
+ ...decodedResult.factoryInfo,
474
+ addr: userOperation.factory
475
+ }
476
+ : undefined,
477
+ paymasterInfo: userOperation.paymaster && decodedResult.paymasterInfo
478
+ ? {
479
+ ...decodedResult.paymasterInfo,
480
+ addr: userOperation.paymaster
481
+ }
482
+ : undefined,
483
+ aggregatorInfo: decodedResult.aggregatorInfo
484
+ };
485
+ }
486
+ }
487
+ //# sourceMappingURL=SafeValidator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SafeValidator.js","sourceRoot":"","sources":["../../../rpc/validation/SafeValidator.ts"],"names":[],"mappings":"AAYA,OAAO,EACH,iBAAiB,EACjB,sBAAsB,EACtB,gBAAgB,EAChB,gBAAgB,EAChB,2BAA2B,EAC3B,+BAA+B,EAC/B,oCAAoC,EACpC,QAAQ,EACR,gBAAgB,EAOnB,MAAM,aAAa,CAAA;AAE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CAAC,aAAa;oBAC9B,IAAI,EAAE,aAAa,CAAC,SAAS;iBAChC;gBACH,CAAC,CAAC,SAAS;YACnB,cAAc,EAAE,aAAa,CAAC,cAAc;SAC/C,CAAA;IACL,CAAC;CACJ"}
@@ -0,0 +1,13 @@
1
+ import { type StorageMap, type ValidationResult, type UserOperationV06 } from "../../types/index.js";
2
+ import { type Address } from "viem";
3
+ import type { BundlerTracerResult } from "./BundlerCollectorTracerV06.js";
4
+ /**
5
+ * parse collected simulation traces and revert if they break our rules
6
+ * @param userOperation the userOperation that was used in this simulation
7
+ * @param tracerResults the tracer return value
8
+ * @param validationResult output from simulateValidation
9
+ * @param entryPoint the entryPoint that hosted the "simulatedValidation" traced call.
10
+ * @return list of contract addresses referenced by this UserOp
11
+ */
12
+ export declare function tracerResultParserV06(userOperation: UserOperationV06, tracerResults: BundlerTracerResult, validationResult: ValidationResult, entryPointAddress: Address): [string[], StorageMap];
13
+ //# sourceMappingURL=TracerResultParserV06.d.ts.map