@pimlico/alto 0.0.0-staging.20240606T110517 → 0.0.2

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 (230) hide show
  1. package/LICENSE +674 -0
  2. package/lib/executor/executor.js +6 -0
  3. package/lib/executor/executor.js.map +1 -1
  4. package/lib/executor/executorManager.js +1 -0
  5. package/lib/executor/executorManager.js.map +1 -1
  6. package/lib/executor/utils.js +3 -1
  7. package/lib/executor/utils.js.map +1 -1
  8. package/lib/rpc/server.js +2 -1
  9. package/lib/rpc/server.js.map +1 -1
  10. package/lib/types/mempool.d.ts +2 -1
  11. package/package.json +11 -12
  12. package/esm/cli/alto.d.ts +0 -6
  13. package/esm/cli/alto.js +0 -92
  14. package/esm/cli/alto.js.map +0 -1
  15. package/esm/cli/config/bundler.d.ts +0 -391
  16. package/esm/cli/config/bundler.js +0 -132
  17. package/esm/cli/config/bundler.js.map +0 -1
  18. package/esm/cli/config/index.d.ts +0 -3
  19. package/esm/cli/config/index.js +0 -3
  20. package/esm/cli/config/index.js.map +0 -1
  21. package/esm/cli/config/options.d.ts +0 -11
  22. package/esm/cli/config/options.js +0 -336
  23. package/esm/cli/config/options.js.map +0 -1
  24. package/esm/cli/customTransport.d.ts +0 -14
  25. package/esm/cli/customTransport.js +0 -53
  26. package/esm/cli/customTransport.js.map +0 -1
  27. package/esm/cli/handler.d.ts +0 -3
  28. package/esm/cli/handler.js +0 -116
  29. package/esm/cli/handler.js.map +0 -1
  30. package/esm/cli/index.d.ts +0 -4
  31. package/esm/cli/index.js +0 -4
  32. package/esm/cli/index.js.map +0 -1
  33. package/esm/cli/instrumentation.d.ts +0 -2
  34. package/esm/cli/instrumentation.js +0 -39
  35. package/esm/cli/instrumentation.js.map +0 -1
  36. package/esm/cli/setupServer.d.ts +0 -17
  37. package/esm/cli/setupServer.js +0 -155
  38. package/esm/cli/setupServer.js.map +0 -1
  39. package/esm/cli/util.d.ts +0 -22
  40. package/esm/cli/util.js +0 -30
  41. package/esm/cli/util.js.map +0 -1
  42. package/esm/executor/executor.d.ts +0 -54
  43. package/esm/executor/executor.js +0 -637
  44. package/esm/executor/executor.js.map +0 -1
  45. package/esm/executor/executorManager.d.ts +0 -34
  46. package/esm/executor/executorManager.js +0 -401
  47. package/esm/executor/executorManager.js.map +0 -1
  48. package/esm/executor/index.d.ts +0 -5
  49. package/esm/executor/index.js +0 -5
  50. package/esm/executor/index.js.map +0 -1
  51. package/esm/executor/senderManager.d.ts +0 -17
  52. package/esm/executor/senderManager.js +0 -160
  53. package/esm/executor/senderManager.js.map +0 -1
  54. package/esm/executor/test/utils.d.ts +0 -13
  55. package/esm/executor/test/utils.js +0 -75
  56. package/esm/executor/test/utils.js.map +0 -1
  57. package/esm/executor/utils.d.ts +0 -32
  58. package/esm/executor/utils.js +0 -239
  59. package/esm/executor/utils.js.map +0 -1
  60. package/esm/index.d.ts +0 -2
  61. package/esm/index.js +0 -2
  62. package/esm/index.js.map +0 -1
  63. package/esm/mempool/index.d.ts +0 -5
  64. package/esm/mempool/index.js +0 -5
  65. package/esm/mempool/index.js.map +0 -1
  66. package/esm/mempool/mempool.d.ts +0 -64
  67. package/esm/mempool/mempool.js +0 -489
  68. package/esm/mempool/mempool.js.map +0 -1
  69. package/esm/mempool/monitoring.d.ts +0 -10
  70. package/esm/mempool/monitoring.js +0 -34
  71. package/esm/mempool/monitoring.js.map +0 -1
  72. package/esm/mempool/nullMempool.d.ts +0 -15
  73. package/esm/mempool/nullMempool.js +0 -36
  74. package/esm/mempool/nullMempool.js.map +0 -1
  75. package/esm/mempool/reputationManager.d.ts +0 -115
  76. package/esm/mempool/reputationManager.js +0 -397
  77. package/esm/mempool/reputationManager.js.map +0 -1
  78. package/esm/mempool/store.d.ts +0 -22
  79. package/esm/mempool/store.js +0 -123
  80. package/esm/mempool/store.js.map +0 -1
  81. package/esm/rpc/EntryPointSimulationsV07.d.ts +0 -58
  82. package/esm/rpc/EntryPointSimulationsV07.js +0 -407
  83. package/esm/rpc/EntryPointSimulationsV07.js.map +0 -1
  84. package/esm/rpc/ExecuteSimulator.d.ts +0 -37
  85. package/esm/rpc/ExecuteSimulator.js +0 -48
  86. package/esm/rpc/ExecuteSimulator.js.map +0 -1
  87. package/esm/rpc/gasEstimation.d.ts +0 -17
  88. package/esm/rpc/gasEstimation.js +0 -410
  89. package/esm/rpc/gasEstimation.js.map +0 -1
  90. package/esm/rpc/index.d.ts +0 -5
  91. package/esm/rpc/index.js +0 -5
  92. package/esm/rpc/index.js.map +0 -1
  93. package/esm/rpc/nonceQueuer.d.ts +0 -25
  94. package/esm/rpc/nonceQueuer.js +0 -135
  95. package/esm/rpc/nonceQueuer.js.map +0 -1
  96. package/esm/rpc/rpcHandler.d.ts +0 -64
  97. package/esm/rpc/rpcHandler.js +0 -727
  98. package/esm/rpc/rpcHandler.js.map +0 -1
  99. package/esm/rpc/server.d.ts +0 -31
  100. package/esm/rpc/server.js +0 -238
  101. package/esm/rpc/server.js.map +0 -1
  102. package/esm/rpc/validation/BundlerCollectorTracerV06.d.ts +0 -102
  103. package/esm/rpc/validation/BundlerCollectorTracerV06.js +0 -255
  104. package/esm/rpc/validation/BundlerCollectorTracerV06.js.map +0 -1
  105. package/esm/rpc/validation/BundlerCollectorTracerV07.d.ts +0 -102
  106. package/esm/rpc/validation/BundlerCollectorTracerV07.js +0 -254
  107. package/esm/rpc/validation/BundlerCollectorTracerV07.js.map +0 -1
  108. package/esm/rpc/validation/SafeValidator.d.ts +0 -35
  109. package/esm/rpc/validation/SafeValidator.js +0 -487
  110. package/esm/rpc/validation/SafeValidator.js.map +0 -1
  111. package/esm/rpc/validation/TracerResultParserV06.d.ts +0 -13
  112. package/esm/rpc/validation/TracerResultParserV06.js +0 -578
  113. package/esm/rpc/validation/TracerResultParserV06.js.map +0 -1
  114. package/esm/rpc/validation/TracerResultParserV07.d.ts +0 -33
  115. package/esm/rpc/validation/TracerResultParserV07.js +0 -557
  116. package/esm/rpc/validation/TracerResultParserV07.js.map +0 -1
  117. package/esm/rpc/validation/UnsafeValidator.d.ts +0 -63
  118. package/esm/rpc/validation/UnsafeValidator.js +0 -257
  119. package/esm/rpc/validation/UnsafeValidator.js.map +0 -1
  120. package/esm/rpc/validation/index.d.ts +0 -3
  121. package/esm/rpc/validation/index.js +0 -3
  122. package/esm/rpc/validation/index.js.map +0 -1
  123. package/esm/rpc/validation/tracer.d.ts +0 -122
  124. package/esm/rpc/validation/tracer.js +0 -82
  125. package/esm/rpc/validation/tracer.js.map +0 -1
  126. package/esm/types/contracts/BundleBulker.d.ts +0 -120
  127. package/esm/types/contracts/BundleBulker.js +0 -157
  128. package/esm/types/contracts/BundleBulker.js.map +0 -1
  129. package/esm/types/contracts/CallEngine.d.ts +0 -28
  130. package/esm/types/contracts/CallEngine.js +0 -37
  131. package/esm/types/contracts/CallEngine.js.map +0 -1
  132. package/esm/types/contracts/CodeHashGetter.d.ts +0 -37
  133. package/esm/types/contracts/CodeHashGetter.js +0 -45
  134. package/esm/types/contracts/CodeHashGetter.js.map +0 -1
  135. package/esm/types/contracts/EntryPoint.d.ts +0 -1789
  136. package/esm/types/contracts/EntryPoint.js +0 -2304
  137. package/esm/types/contracts/EntryPoint.js.map +0 -1
  138. package/esm/types/contracts/EntryPointSimulations.d.ts +0 -153
  139. package/esm/types/contracts/EntryPointSimulations.js +0 -15
  140. package/esm/types/contracts/EntryPointSimulations.js.map +0 -1
  141. package/esm/types/contracts/IOpInflator.d.ts +0 -61
  142. package/esm/types/contracts/IOpInflator.js +0 -80
  143. package/esm/types/contracts/IOpInflator.js.map +0 -1
  144. package/esm/types/contracts/IPaymaster.d.ts +0 -3
  145. package/esm/types/contracts/IPaymaster.js +0 -117
  146. package/esm/types/contracts/IPaymaster.js.map +0 -1
  147. package/esm/types/contracts/Inflator.d.ts +0 -65
  148. package/esm/types/contracts/Inflator.js +0 -84
  149. package/esm/types/contracts/Inflator.js.map +0 -1
  150. package/esm/types/contracts/PerOpInflator.d.ts +0 -176
  151. package/esm/types/contracts/PerOpInflator.js +0 -229
  152. package/esm/types/contracts/PerOpInflator.js.map +0 -1
  153. package/esm/types/contracts/PimlicoEntryPointSimulations.d.ts +0 -23
  154. package/esm/types/contracts/PimlicoEntryPointSimulations.js +0 -33
  155. package/esm/types/contracts/PimlicoEntryPointSimulations.js.map +0 -1
  156. package/esm/types/contracts/SenderCreator.d.ts +0 -4
  157. package/esm/types/contracts/SenderCreator.js +0 -23
  158. package/esm/types/contracts/SenderCreator.js.map +0 -1
  159. package/esm/types/contracts/SimpleAccountFactory.d.ts +0 -57
  160. package/esm/types/contracts/SimpleAccountFactory.js +0 -76
  161. package/esm/types/contracts/SimpleAccountFactory.js.map +0 -1
  162. package/esm/types/contracts/TestOpcodesAccount.d.ts +0 -4
  163. package/esm/types/contracts/TestOpcodesAccount.js +0 -281
  164. package/esm/types/contracts/TestOpcodesAccount.js.map +0 -1
  165. package/esm/types/contracts/TestOpcodesAccountFactory.d.ts +0 -4
  166. package/esm/types/contracts/TestOpcodesAccountFactory.js +0 -23
  167. package/esm/types/contracts/TestOpcodesAccountFactory.js.map +0 -1
  168. package/esm/types/contracts/TestStorageAccount.d.ts +0 -4
  169. package/esm/types/contracts/TestStorageAccount.js +0 -313
  170. package/esm/types/contracts/TestStorageAccount.js.map +0 -1
  171. package/esm/types/contracts/index.d.ts +0 -17
  172. package/esm/types/contracts/index.js +0 -17
  173. package/esm/types/contracts/index.js.map +0 -1
  174. package/esm/types/gasPrice.d.ts +0 -110
  175. package/esm/types/gasPrice.js +0 -52
  176. package/esm/types/gasPrice.js.map +0 -1
  177. package/esm/types/index.d.ts +0 -11
  178. package/esm/types/index.js +0 -11
  179. package/esm/types/index.js.map +0 -1
  180. package/esm/types/interfaces.d.ts +0 -26
  181. package/esm/types/interfaces.js +0 -2
  182. package/esm/types/interfaces.js.map +0 -1
  183. package/esm/types/mempool.d.ts +0 -78
  184. package/esm/types/mempool.js +0 -16
  185. package/esm/types/mempool.js.map +0 -1
  186. package/esm/types/schemas.d.ts +0 -4791
  187. package/esm/types/schemas.js +0 -497
  188. package/esm/types/schemas.js.map +0 -1
  189. package/esm/types/test/validationTestErrors.d.ts +0 -3
  190. package/esm/types/test/validationTestErrors.js +0 -229
  191. package/esm/types/test/validationTestErrors.js.map +0 -1
  192. package/esm/types/utils.d.ts +0 -24
  193. package/esm/types/utils.js +0 -30
  194. package/esm/types/utils.js.map +0 -1
  195. package/esm/types/validation.d.ts +0 -14327
  196. package/esm/types/validation.js +0 -304
  197. package/esm/types/validation.js.map +0 -1
  198. package/esm/utils/bigInt.d.ts +0 -3
  199. package/esm/utils/bigInt.js +0 -9
  200. package/esm/utils/bigInt.js.map +0 -1
  201. package/esm/utils/compressionHandler.d.ts +0 -11
  202. package/esm/utils/compressionHandler.js +0 -39
  203. package/esm/utils/compressionHandler.js.map +0 -1
  204. package/esm/utils/gasPriceManager.d.ts +0 -34
  205. package/esm/utils/gasPriceManager.js +0 -338
  206. package/esm/utils/gasPriceManager.js.map +0 -1
  207. package/esm/utils/helpers.d.ts +0 -4
  208. package/esm/utils/helpers.js +0 -13
  209. package/esm/utils/helpers.js.map +0 -1
  210. package/esm/utils/index.d.ts +0 -11
  211. package/esm/utils/index.js +0 -10
  212. package/esm/utils/index.js.map +0 -1
  213. package/esm/utils/logger.d.ts +0 -6
  214. package/esm/utils/logger.js +0 -76
  215. package/esm/utils/logger.js.map +0 -1
  216. package/esm/utils/metrics.d.ts +0 -22
  217. package/esm/utils/metrics.js +0 -150
  218. package/esm/utils/metrics.js.map +0 -1
  219. package/esm/utils/rpc-reply.d.ts +0 -17
  220. package/esm/utils/rpc-reply.js +0 -41
  221. package/esm/utils/rpc-reply.js.map +0 -1
  222. package/esm/utils/test.d.ts +0 -17
  223. package/esm/utils/test.js +0 -130
  224. package/esm/utils/test.js.map +0 -1
  225. package/esm/utils/userop.d.ts +0 -49
  226. package/esm/utils/userop.js +0 -408
  227. package/esm/utils/userop.js.map +0 -1
  228. package/esm/utils/validation.d.ts +0 -65
  229. package/esm/utils/validation.js +0 -461
  230. package/esm/utils/validation.js.map +0 -1
@@ -1,257 +0,0 @@
1
- import { EntryPointV06Abi, ExecutionErrors, RpcError, ValidationErrors, entryPointErrorsSchema, entryPointExecutionErrorSchemaV06, entryPointExecutionErrorSchemaV07 } from "../../types/index.js";
2
- import { calcPreVerificationGas, calcVerificationGasAndCallGasLimit, isVersion06, isVersion07 } from "../../utils/index.js";
3
- import * as sentry from "@sentry/node";
4
- import { BaseError, ContractFunctionExecutionError, getContract, pad, slice, toHex, zeroAddress } from "viem";
5
- import { fromZodError } from "zod-validation-error";
6
- import { simulateValidation } from "../EntryPointSimulationsV07.js";
7
- import { simulateHandleOp, simulateHandleOpV06 } from "../gasEstimation.js";
8
- async function getSimulationResult(isVersion06, errorResult, logger, simulationType, usingTenderly = false) {
9
- const entryPointExecutionErrorSchema = isVersion06
10
- ? entryPointExecutionErrorSchemaV06
11
- : entryPointExecutionErrorSchemaV07;
12
- const entryPointErrorSchemaParsing = usingTenderly
13
- ? entryPointErrorsSchema.safeParse(errorResult)
14
- : entryPointExecutionErrorSchema.safeParse(errorResult);
15
- if (!entryPointErrorSchemaParsing.success) {
16
- try {
17
- const err = fromZodError(entryPointErrorSchemaParsing.error);
18
- logger.error({ error: err.message }, "unexpected error during valiation");
19
- logger.error(JSON.stringify(errorResult));
20
- err.message = `User Operation simulation returned unexpected invalid response: ${err.message}`;
21
- throw err;
22
- }
23
- catch {
24
- if (errorResult instanceof BaseError) {
25
- const revertError = errorResult.walk((err) => err instanceof ContractFunctionExecutionError);
26
- throw new RpcError(`UserOperation reverted during simulation with reason: ${
27
- // biome-ignore lint/suspicious/noExplicitAny: it's a generic type
28
- revertError?.cause?.reason}`, ValidationErrors.SimulateValidation);
29
- }
30
- sentry.captureException(errorResult);
31
- throw new Error(`User Operation simulation returned unexpected invalid response: ${errorResult}`);
32
- }
33
- }
34
- const errorData = entryPointErrorSchemaParsing.data;
35
- if (errorData.errorName === "FailedOp") {
36
- const reason = errorData.args.reason;
37
- throw new RpcError(`UserOperation reverted during simulation with reason: ${reason}`, ValidationErrors.SimulateValidation);
38
- }
39
- if (simulationType === "validation") {
40
- if (errorData.errorName !== "ValidationResult" &&
41
- errorData.errorName !== "ValidationResultWithAggregation") {
42
- throw new Error("Unexpected error - errorName is not ValidationResult or ValidationResultWithAggregation");
43
- }
44
- }
45
- else if (errorData.errorName !== "ExecutionResult") {
46
- throw new Error("Unexpected error - errorName is not ExecutionResult");
47
- }
48
- const simulationResult = errorData.args;
49
- return simulationResult;
50
- }
51
- export class UnsafeValidator {
52
- publicClient;
53
- logger;
54
- metrics;
55
- usingTenderly;
56
- balanceOverrideEnabled;
57
- expirationCheck;
58
- chainId;
59
- gasPriceManager;
60
- entryPointSimulationsAddress;
61
- fixedGasLimitForEstimation;
62
- chainType;
63
- constructor(publicClient, logger, metrics, gasPriceManager, chainType, entryPointSimulationsAddress, fixedGasLimitForEstimation, usingTenderly = false, balanceOverrideEnabled = false, expirationCheck = true) {
64
- this.publicClient = publicClient;
65
- this.logger = logger;
66
- this.metrics = metrics;
67
- this.usingTenderly = usingTenderly;
68
- this.balanceOverrideEnabled = balanceOverrideEnabled;
69
- this.expirationCheck = expirationCheck;
70
- this.chainId = publicClient.chain.id;
71
- this.gasPriceManager = gasPriceManager;
72
- this.entryPointSimulationsAddress = entryPointSimulationsAddress;
73
- this.fixedGasLimitForEstimation = fixedGasLimitForEstimation;
74
- this.chainType = chainType;
75
- }
76
- async getExecutionResult(userOperation, entryPoint, queuedUserOperations, stateOverrides) {
77
- const error = await simulateHandleOp(userOperation, queuedUserOperations, entryPoint, this.publicClient, false, zeroAddress, "0x", this.balanceOverrideEnabled, this.chainId, stateOverrides, this.entryPointSimulationsAddress, this.fixedGasLimitForEstimation);
78
- if (error.result === "failed") {
79
- throw new RpcError(`UserOperation reverted during simulation with reason: ${error.data}`, ExecutionErrors.UserOperationReverted);
80
- }
81
- return error;
82
- }
83
- async getValidationResultV06(userOperation, entryPoint, _codeHashes) {
84
- const entryPointContract = getContract({
85
- address: entryPoint,
86
- abi: EntryPointV06Abi,
87
- client: {
88
- public: this.publicClient
89
- }
90
- });
91
- const simulateValidationPromise = entryPointContract.simulate
92
- .simulateValidation([userOperation])
93
- .catch((e) => {
94
- if (e instanceof Error) {
95
- return e;
96
- }
97
- throw e;
98
- });
99
- const runtimeValidationPromise = simulateHandleOpV06(userOperation, entryPoint, this.publicClient, zeroAddress, "0x");
100
- const [simulateValidationResult, runtimeValidation] = await Promise.all([simulateValidationPromise, runtimeValidationPromise]);
101
- const validationResult = {
102
- ...(await getSimulationResult(isVersion06(userOperation), simulateValidationResult, this.logger, "validation", this.usingTenderly)),
103
- storageMap: {}
104
- };
105
- if (validationResult.returnInfo.sigFailed) {
106
- throw new RpcError("Invalid UserOperation signature or paymaster signature", ValidationErrors.InvalidSignature);
107
- }
108
- const now = Date.now() / 1000;
109
- this.logger.debug({
110
- validAfter: validationResult.returnInfo.validAfter,
111
- validUntil: validationResult.returnInfo.validUntil,
112
- now
113
- });
114
- if (validationResult.returnInfo.validAfter > now - 5 &&
115
- this.expirationCheck) {
116
- throw new RpcError("User operation is not valid yet", ValidationErrors.ExpiresShortly);
117
- }
118
- if (validationResult.returnInfo.validUntil < now + 30 &&
119
- this.expirationCheck) {
120
- throw new RpcError("expires too soon", ValidationErrors.ExpiresShortly);
121
- }
122
- // validate runtime
123
- if (runtimeValidation.result === "failed") {
124
- throw new RpcError(`UserOperation reverted during simulation with reason: ${runtimeValidation.data}`, ValidationErrors.SimulateValidation);
125
- }
126
- return validationResult;
127
- }
128
- parseValidationData(validationData) {
129
- const maxUint48 = 2 ** 48 - 1;
130
- const data = pad(toHex(validationData), { size: 32 });
131
- // string offsets start from left (msb)
132
- const aggregator = slice(data, 32 - 20);
133
- let validUntil = Number.parseInt(slice(data, 32 - 26, 32 - 20), 16);
134
- if (validUntil === 0) {
135
- validUntil = maxUint48;
136
- }
137
- const validAfter = Number.parseInt(slice(data, 0, 6), 16);
138
- return {
139
- aggregator,
140
- validAfter,
141
- validUntil
142
- };
143
- }
144
- mergeValidationData(accountValidationData, paymasterValidationData) {
145
- return {
146
- paymasterSigFailed: paymasterValidationData.aggregator !== zeroAddress,
147
- accountSigFailed: accountValidationData.aggregator !== zeroAddress,
148
- validAfter: Math.max(accountValidationData.validAfter, paymasterValidationData.validAfter),
149
- validUntil: Math.min(accountValidationData.validUntil, paymasterValidationData.validUntil)
150
- };
151
- }
152
- mergeValidationDataValues(accountValidationData, paymasterValidationData) {
153
- return this.mergeValidationData(this.parseValidationData(accountValidationData), this.parseValidationData(paymasterValidationData));
154
- }
155
- async getValidationResultV07(userOperation, queuedUserOperations, entryPoint, _codeHashes) {
156
- if (!this.entryPointSimulationsAddress) {
157
- throw new Error("entryPointSimulationsAddress is not set");
158
- }
159
- const { simulateValidationResult } = await simulateValidation(userOperation, queuedUserOperations, entryPoint, this.publicClient, this.entryPointSimulationsAddress);
160
- if (simulateValidationResult.status === "failed") {
161
- throw new RpcError(`UserOperation reverted with reason: ${simulateValidationResult.data}`, ValidationErrors.SimulateValidation);
162
- }
163
- const validationResult = simulateValidationResult.data;
164
- const mergedValidation = this.mergeValidationDataValues(validationResult.returnInfo.accountValidationData, validationResult.returnInfo.paymasterValidationData);
165
- const res = {
166
- returnInfo: {
167
- ...validationResult.returnInfo,
168
- accountSigFailed: mergedValidation.accountSigFailed,
169
- paymasterSigFailed: mergedValidation.paymasterSigFailed,
170
- validUntil: mergedValidation.validUntil,
171
- validAfter: mergedValidation.validAfter
172
- },
173
- senderInfo: {
174
- ...validationResult.senderInfo,
175
- addr: userOperation.sender
176
- },
177
- factoryInfo: userOperation.factory && validationResult.factoryInfo
178
- ? {
179
- ...validationResult.factoryInfo,
180
- addr: userOperation.factory
181
- }
182
- : undefined,
183
- paymasterInfo: userOperation.paymaster && validationResult.paymasterInfo
184
- ? {
185
- ...validationResult.paymasterInfo,
186
- addr: userOperation.paymaster
187
- }
188
- : undefined,
189
- aggregatorInfo: validationResult.aggregatorInfo,
190
- storageMap: {}
191
- };
192
- // this.validateStorageAccessList(userOperation, res, accessList)
193
- if (res.returnInfo.accountSigFailed) {
194
- throw new RpcError("Invalid UserOp signature", ValidationErrors.InvalidSignature);
195
- }
196
- if (res.returnInfo.paymasterSigFailed) {
197
- throw new RpcError("Invalid UserOp paymasterData", ValidationErrors.InvalidSignature);
198
- }
199
- const now = Math.floor(Date.now() / 1000);
200
- if (res.returnInfo.validAfter > now - 5) {
201
- throw new RpcError(`User operation is not valid yet, validAfter=${res.returnInfo.validAfter}, now=${now}`, ValidationErrors.ExpiresShortly);
202
- }
203
- if (res.returnInfo.validUntil == null ||
204
- res.returnInfo.validUntil < now + 30) {
205
- throw new RpcError(`UserOperation expires too soon, validUntil=${res.returnInfo.validUntil}, now=${now}`, ValidationErrors.ExpiresShortly);
206
- }
207
- return res;
208
- }
209
- getValidationResult(userOperation, queuedUserOperations, entryPoint, _codeHashes) {
210
- if (isVersion06(userOperation)) {
211
- return this.getValidationResultV06(userOperation, entryPoint, _codeHashes);
212
- }
213
- return this.getValidationResultV07(userOperation, queuedUserOperations, entryPoint, _codeHashes);
214
- }
215
- async validatePreVerificationGas(userOperation, entryPoint) {
216
- const preVerificationGas = await calcPreVerificationGas(this.publicClient, userOperation, entryPoint, this.chainId, this.chainType, this.gasPriceManager, true);
217
- if (preVerificationGas > userOperation.preVerificationGas) {
218
- throw new RpcError(`preVerificationGas is not enough, required: ${preVerificationGas}, got: ${userOperation.preVerificationGas}`, ValidationErrors.SimulateValidation);
219
- }
220
- }
221
- async validateUserOperation(shouldCheckPrefund, userOperation, queuedUserOperations, entryPoint, _referencedContracts) {
222
- try {
223
- const validationResult = await this.getValidationResult(userOperation, queuedUserOperations, entryPoint);
224
- if (shouldCheckPrefund) {
225
- const prefund = validationResult.returnInfo.prefund;
226
- const { verificationGasLimit, callGasLimit } = calcVerificationGasAndCallGasLimit(userOperation, {
227
- preOpGas: validationResult.returnInfo.preOpGas,
228
- paid: validationResult.returnInfo.prefund
229
- }, this.chainId);
230
- let mul = 1n;
231
- if (isVersion06(userOperation) &&
232
- userOperation.paymasterAndData) {
233
- mul = 3n;
234
- }
235
- if (isVersion07(userOperation) &&
236
- userOperation.paymaster === "0x") {
237
- mul = 3n;
238
- }
239
- const requiredPreFund = callGasLimit +
240
- verificationGasLimit * mul +
241
- userOperation.preVerificationGas;
242
- if (requiredPreFund > prefund) {
243
- throw new RpcError(`prefund is not enough, required: ${requiredPreFund}, got: ${prefund}`, ValidationErrors.SimulateValidation);
244
- }
245
- // TODO prefund should be greater than it costs us to add it to mempool
246
- }
247
- this.metrics.userOperationsValidationSuccess.inc();
248
- return validationResult;
249
- }
250
- catch (e) {
251
- // console.log(e)
252
- this.metrics.userOperationsValidationFailure.inc();
253
- throw e;
254
- }
255
- }
256
- }
257
- //# sourceMappingURL=UnsafeValidator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UnsafeValidator.js","sourceRoot":"","sources":["../../../rpc/validation/UnsafeValidator.ts"],"names":[],"mappings":"AAYA,OAAO,EAEH,gBAAgB,EAChB,eAAe,EAGf,QAAQ,EAGR,gBAAgB,EAEhB,sBAAsB,EACtB,iCAAiC,EACjC,iCAAiC,EACpC,MAAM,aAAa,CAAA;AAEpB,OAAO,EACH,sBAAsB,EACtB,kCAAkC,EAClC,WAAW,EACX,WAAW,EACd,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,EACH,SAAS,EAET,8BAA8B,EAG9B,WAAW,EACX,GAAG,EACH,KAAK,EACL,KAAK,EACL,WAAW,EACd,MAAM,MAAM,CAAA;AACb,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAChE,OAAO,EAEH,gBAAgB,EAChB,mBAAmB,EACtB,MAAM,kBAAkB,CAAA;AAEzB,KAAK,UAAU,mBAAmB,CAC9B,WAAoB,EACpB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
1
- export * from "./SafeValidator.js";
2
- export * from "./UnsafeValidator.js";
3
- //# sourceMappingURL=index.d.ts.map
@@ -1,3 +0,0 @@
1
- export * from "./SafeValidator.js";
2
- export * from "./UnsafeValidator.js";
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../rpc/validation/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA"}
@@ -1,122 +0,0 @@
1
- /// <reference types="node" />
2
- import { type Account, type Chain, type PublicClient, type TransactionRequest, type Transport, type WalletClient } from "viem";
3
- /**
4
- * a function returning a LogTracer.
5
- * the function's body must be "{ return {...} }"
6
- * the body is executed as "geth" tracer, and thus must be self-contained (no external functions or references)
7
- * may only reference external functions defined by geth (see go-ethereum/eth/tracers/js): toHex, toWord, isPrecompiled, slice, toString(16)
8
- * (its OK if original function was in typescript: we extract its value as javascript
9
- */
10
- type LogTracerFunc = () => LogTracer;
11
- export declare function debug_traceCall(client: PublicClient | WalletClient, tx: TransactionRequest, options: TraceOptions): Promise<any>;
12
- export declare function execAndTrace(_walletClient: WalletClient<Transport, Chain, Account>, _tx: TransactionRequest, _options: TraceOptions): TraceResult;
13
- export declare function debug_traceTransaction(client: PublicClient | WalletClient, hash: string, options: TraceOptions): Promise<TraceResult>;
14
- /**
15
- * extract the body of "LogTracerFunc".
16
- * note that we extract the javascript body, even if the function was created as typescript
17
- * @param func
18
- */
19
- export declare function getTracerBodyString(func: LogTracerFunc): string;
20
- export interface TraceOptions {
21
- disableStorage?: boolean;
22
- disableStack?: boolean;
23
- enableMemory?: boolean;
24
- enableReturnData?: boolean;
25
- tracer?: LogTracerFunc | string;
26
- timeout?: string;
27
- }
28
- export interface TraceResult {
29
- gas: number;
30
- returnValue: string;
31
- structLogs: [TraceResultEntry];
32
- }
33
- export interface TraceResultEntry {
34
- depth: number;
35
- error: string;
36
- gas: number;
37
- gasCost: number;
38
- memory?: [string];
39
- op: string;
40
- pc: number;
41
- stack: [string];
42
- storage?: [string];
43
- }
44
- export interface LogContext {
45
- type: string;
46
- from: string;
47
- to: string;
48
- input: Buffer;
49
- gas: number;
50
- gasUsed: number;
51
- gasPrice: number;
52
- intrinsicGas: number;
53
- value: bigint;
54
- block: number;
55
- output: Buffer;
56
- time: string;
57
- blockHash?: Buffer;
58
- txIndex?: number;
59
- txHash?: Buffer;
60
- }
61
- export interface LogTracer {
62
- result: (ctx: LogContext, db: LogDb) => any;
63
- fault: (log: LogStep, db: LogDb) => void;
64
- setup?: (config: any) => any;
65
- step?: (log: LogStep, db: LogDb) => any;
66
- enter?: (frame: LogCallFrame) => void;
67
- exit?: (frame: LogFrameResult) => void;
68
- }
69
- export interface LogCallFrame {
70
- getType: () => string;
71
- getFrom: () => string;
72
- getTo: () => string;
73
- getInput: () => string;
74
- getGas: () => number;
75
- getValue: () => bigint;
76
- }
77
- export interface LogFrameResult {
78
- getGasUsed: () => number;
79
- getOutput: () => Buffer;
80
- getError: () => any;
81
- }
82
- export interface LogOpCode {
83
- isPush: () => boolean;
84
- toString: () => string;
85
- toNumber: () => number;
86
- }
87
- export interface LogMemory {
88
- slice: (start: number, stop: number) => any;
89
- getUint: (offset: number) => any;
90
- length: () => number;
91
- }
92
- export interface LogStack {
93
- peek: (idx: number) => any;
94
- length: () => number;
95
- }
96
- export interface LogContract {
97
- getCaller: () => any;
98
- getAddress: () => string;
99
- getValue: () => bigint;
100
- getInput: () => any;
101
- }
102
- export interface LogStep {
103
- op: LogOpCode;
104
- stack: LogStack;
105
- memory: LogMemory;
106
- contract: LogContract;
107
- getPC: () => number;
108
- getGas: () => number;
109
- getCost: () => number;
110
- getDepth: () => number;
111
- getRefund: () => number;
112
- getError: () => string | undefined;
113
- }
114
- export interface LogDb {
115
- getBalance: (address: string) => bigint;
116
- getNonce: (address: string) => number;
117
- getCode: (address: string) => any;
118
- getState: (address: string, hash: string) => any;
119
- exists: (address: string) => boolean;
120
- }
121
- export {};
122
- //# sourceMappingURL=tracer.d.ts.map
@@ -1,82 +0,0 @@
1
- import * as sentry from "@sentry/node";
2
- import { formatTransactionRequest } from "viem";
3
- // eslint-disable-next-line @typescript-eslint/naming-convention
4
- export async function debug_traceCall(client, tx, options
5
- // biome-ignore lint/suspicious/noExplicitAny: it's a generic type
6
- ) {
7
- const traceOptions = tracer2string(options);
8
- const ret = await client
9
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
10
- // @ts-ignore
11
- .request({
12
- method: "debug_traceCall",
13
- params: [formatTransactionRequest(tx), "latest", traceOptions]
14
- })
15
- .catch((e) => {
16
- if (e instanceof Error) {
17
- // console.log("ex=", e.message)
18
- // console.log(
19
- // "tracer=",
20
- // traceOptions.tracer
21
- // ?.toString()
22
- // .split("\n")
23
- // .map((line, index) => `${index + 1}: ${line}`)
24
- // .join("\n")
25
- // )
26
- throw e;
27
- }
28
- sentry.captureException(e);
29
- });
30
- // console.log("ret=", ret)
31
- return ret;
32
- }
33
- // a hack for network that doesn't have traceCall: mine the transaction, and use debug_traceTransaction
34
- export function execAndTrace(_walletClient, _tx, _options) {
35
- //const hash = await walletClient.sendTransaction(tx)
36
- throw new Error("not implemented");
37
- //return await debug_traceTransaction(walletClient, hash, options)
38
- }
39
- // eslint-disable-next-line @typescript-eslint/naming-convention
40
- export async function debug_traceTransaction(client, hash, options) {
41
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
42
- // @ts-ignore
43
- const ret = await client.request({
44
- method: "debug_traceTransaction",
45
- params: [hash, tracer2string(options)]
46
- });
47
- // const tx = await provider.getTransaction(hash)
48
- // return applyTracer(tx, ret, options)
49
- return ret;
50
- }
51
- /**
52
- * extract the body of "LogTracerFunc".
53
- * note that we extract the javascript body, even if the function was created as typescript
54
- * @param func
55
- */
56
- export function getTracerBodyString(func) {
57
- const tracerFunc = func.toString();
58
- // function must return a plain object:
59
- // function xyz() { return {...}; }
60
- const regexp = /function \w+\s*\(\s*\)\s*{\s*return\s*(\{[\s\S]+\});?\s*\}\s*$/; // (\{[\s\S]+\}); \} $/
61
- const match = tracerFunc.match(regexp);
62
- if (match === null) {
63
- throw new Error("Not a simple method returning value");
64
- }
65
- let ret = match[1];
66
- ret = ret
67
- // .replace(/\/\/.*\n/g,'\n')
68
- // .replace(/\n\s*\n/g, '\n')
69
- .replace(/\b(?:const|let)\b/g, "");
70
- // console.log('== tracer source',ret.split('\n').map((line,index)=>`${index}: ${line}`).join('\n'))
71
- return ret;
72
- }
73
- function tracer2string(options) {
74
- if (typeof options.tracer === "function") {
75
- return {
76
- ...options,
77
- tracer: getTracerBodyString(options.tracer)
78
- };
79
- }
80
- return options;
81
- }
82
- //# sourceMappingURL=tracer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tracer.js","sourceRoot":"","sources":["../../../rpc/validation/tracer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,EAOH,wBAAwB,EAC3B,MAAM,MAAM,CAAA;AAab,gEAAgE;AAChE,MAAM,CAAC,KAAK,UAAU,eAAe,CACjC,MAAmC,EACnC,EAAsB,EACtB,OAAqB;AACrB,kEAAkE;;IAElE,MAAM,YAAY,GAAG,aAAa,CAAC,OAAO,CAAC,CAAA;IAC3C,MAAM,GAAG,GAAG,MAAM,MAAM;QACpB,6DAA6D;QAC7D,aAAa;SACZ,OAAO,CAAC;QACL,MAAM,EAAE,iBAAiB;QACzB,MAAM,EAAE,CAAC,wBAAwB,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,YAAY,CAAC;KACjE,CAAC;SACD,KAAK,CAAC,CAAC,CAAU,EAAE,EAAE;QAClB,IAAI,CAAC,YAAY,KAAK,EAAE,CAAC;YACrB,gCAAgC;YAChC,eAAe;YACf,iBAAiB;YACjB,0BAA0B;YAC1B,uBAAuB;YACvB,uBAAuB;YACvB,yDAAyD;YACzD,sBAAsB;YACtB,IAAI;YACJ,MAAM,CAAC,CAAA;QACX,CAAC;QACD,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B;IACxC,IAAI,OAAO,OAAO,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;QACvC,OAAO;YACH,GAAG,OAAO;YACV,MAAM,EAAE,mBAAmB,CAAC,OAAO,CAAC,MAAM,CAAC;SAC9C,CAAA;IACL,CAAC;IACD,OAAO,OAAO,CAAA;AAClB,CAAC"}
@@ -1,120 +0,0 @@
1
- export declare const BundleBulkerAbi: readonly [{
2
- readonly type: "fallback";
3
- readonly stateMutability: "nonpayable";
4
- }, {
5
- readonly type: "function";
6
- readonly name: "ENTRY_POINT";
7
- readonly inputs: readonly [];
8
- readonly outputs: readonly [{
9
- readonly name: "";
10
- readonly type: "address";
11
- readonly internalType: "address";
12
- }];
13
- readonly stateMutability: "view";
14
- }, {
15
- readonly type: "function";
16
- readonly name: "idToInflator";
17
- readonly inputs: readonly [{
18
- readonly name: "";
19
- readonly type: "uint32";
20
- readonly internalType: "uint32";
21
- }];
22
- readonly outputs: readonly [{
23
- readonly name: "";
24
- readonly type: "address";
25
- readonly internalType: "contract IInflator";
26
- }];
27
- readonly stateMutability: "view";
28
- }, {
29
- readonly type: "function";
30
- readonly name: "inflate";
31
- readonly inputs: readonly [{
32
- readonly name: "compressed";
33
- readonly type: "bytes";
34
- readonly internalType: "bytes";
35
- }];
36
- readonly outputs: readonly [{
37
- readonly name: "ops";
38
- readonly type: "tuple[]";
39
- readonly internalType: "struct UserOperation[]";
40
- readonly components: readonly [{
41
- readonly name: "sender";
42
- readonly type: "address";
43
- readonly internalType: "address";
44
- }, {
45
- readonly name: "nonce";
46
- readonly type: "uint256";
47
- readonly internalType: "uint256";
48
- }, {
49
- readonly name: "initCode";
50
- readonly type: "bytes";
51
- readonly internalType: "bytes";
52
- }, {
53
- readonly name: "callData";
54
- readonly type: "bytes";
55
- readonly internalType: "bytes";
56
- }, {
57
- readonly name: "callGasLimit";
58
- readonly type: "uint256";
59
- readonly internalType: "uint256";
60
- }, {
61
- readonly name: "verificationGasLimit";
62
- readonly type: "uint256";
63
- readonly internalType: "uint256";
64
- }, {
65
- readonly name: "preVerificationGas";
66
- readonly type: "uint256";
67
- readonly internalType: "uint256";
68
- }, {
69
- readonly name: "maxFeePerGas";
70
- readonly type: "uint256";
71
- readonly internalType: "uint256";
72
- }, {
73
- readonly name: "maxPriorityFeePerGas";
74
- readonly type: "uint256";
75
- readonly internalType: "uint256";
76
- }, {
77
- readonly name: "paymasterAndData";
78
- readonly type: "bytes";
79
- readonly internalType: "bytes";
80
- }, {
81
- readonly name: "signature";
82
- readonly type: "bytes";
83
- readonly internalType: "bytes";
84
- }];
85
- }, {
86
- readonly name: "beneficiary";
87
- readonly type: "address";
88
- readonly internalType: "address payable";
89
- }];
90
- readonly stateMutability: "view";
91
- }, {
92
- readonly type: "function";
93
- readonly name: "inflatorToID";
94
- readonly inputs: readonly [{
95
- readonly name: "";
96
- readonly type: "address";
97
- readonly internalType: "contract IInflator";
98
- }];
99
- readonly outputs: readonly [{
100
- readonly name: "";
101
- readonly type: "uint32";
102
- readonly internalType: "uint32";
103
- }];
104
- readonly stateMutability: "view";
105
- }, {
106
- readonly type: "function";
107
- readonly name: "registerInflator";
108
- readonly inputs: readonly [{
109
- readonly name: "inflatorId";
110
- readonly type: "uint32";
111
- readonly internalType: "uint32";
112
- }, {
113
- readonly name: "inflator";
114
- readonly type: "address";
115
- readonly internalType: "contract IInflator";
116
- }];
117
- readonly outputs: readonly [];
118
- readonly stateMutability: "nonpayable";
119
- }];
120
- //# sourceMappingURL=BundleBulker.d.ts.map