@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,115 +0,0 @@
1
- import { type StakeInfo, type UserOperation, type ValidationResult, type ValidationResultWithAggregation } from "../types/index.js";
2
- import type { Logger } from "../utils/index.js";
3
- import { type Address, type PublicClient } from "viem";
4
- export interface InterfaceReputationManager {
5
- checkReputation(userOperation: UserOperation, entryPoint: Address, validationResult: ValidationResult | ValidationResultWithAggregation): Promise<void>;
6
- updateUserOperationSeenStatus(userOperation: UserOperation, entryPoint: Address): void;
7
- increaseUserOperationCount(userOperation: UserOperation): void;
8
- decreaseUserOperationCount(userOperation: UserOperation): void;
9
- getStatus(entryPoint: Address, address: Address | null): ReputationStatus;
10
- updateUserOperationIncludedStatus(userOperation: UserOperation, entryPoint: Address, accountDeployed: boolean): void;
11
- crashedHandleOps(userOperation: UserOperation, entryPoint: Address, reason: string): void;
12
- setReputation(entryPoint: Address, args: {
13
- address: Address;
14
- opsSeen: bigint;
15
- opsIncluded: bigint;
16
- }[]): void;
17
- dumpReputations(entryPoint: Address): ReputationEntry[];
18
- getStakeStatus(entryPoint: Address, address: Address): Promise<{
19
- stakeInfo: StakeInfo;
20
- isStaked: boolean;
21
- }>;
22
- clear(): void;
23
- clearEntityCount(): void;
24
- }
25
- export declare enum EntityType {
26
- Account = "Account",
27
- Paymaster = "Paymaster",
28
- Factory = "Factory",
29
- Aggregator = "Aggregator"
30
- }
31
- export type ReputationStatus = 0n | 1n | 2n;
32
- export declare const ReputationStatuses: {
33
- ok: ReputationStatus;
34
- throttled: ReputationStatus;
35
- banned: ReputationStatus;
36
- };
37
- export interface ReputationEntry {
38
- address: Address;
39
- opsSeen: bigint;
40
- opsIncluded: bigint;
41
- status?: ReputationStatus;
42
- }
43
- export interface ReputationParams {
44
- minInclusionDenominator: bigint;
45
- throttlingSlack: bigint;
46
- banSlack: bigint;
47
- }
48
- export declare const BundlerReputationParams: ReputationParams;
49
- export declare class NullReputationManager implements InterfaceReputationManager {
50
- checkReputation(_userOperation: UserOperation, _entryPoint: Address, _validationResult: ValidationResult | ValidationResultWithAggregation): Promise<void>;
51
- increaseUserOperationCount(_: UserOperation): void;
52
- decreaseUserOperationCount(_: UserOperation): void;
53
- updateUserOperationSeenStatus(_: UserOperation, _entryPoint: Address): void;
54
- updateUserOperationIncludedStatus(_: UserOperation, _entryPoint: Address, __: boolean): void;
55
- crashedHandleOps(_: UserOperation, _entryPoint: Address, __: string): void;
56
- setReputation(_: Address, __: {
57
- address: Address;
58
- opsSeen: bigint;
59
- opsIncluded: bigint;
60
- }[]): void;
61
- dumpReputations(_entryPoint: Address): ReputationEntry[];
62
- getStatus(_entryPoint: Address, _address: `0x${string}` | null): ReputationStatus;
63
- getStakeStatus(_entryPoint: Address, _: Address): Promise<{
64
- stakeInfo: StakeInfo;
65
- isStaked: boolean;
66
- }>;
67
- clear(): void;
68
- clearEntityCount(): void;
69
- }
70
- export declare class ReputationManager implements InterfaceReputationManager {
71
- private publicClient;
72
- private minStake;
73
- private minUnstakeDelay;
74
- private entityCount;
75
- private throttledEntityMinMempoolCount;
76
- private maxMempoolUserOperationsPerSender;
77
- private maxMempoolUserOperationsPerNewUnstakedEntity;
78
- private inclusionRateFactor;
79
- private entries;
80
- private whitelist;
81
- private blackList;
82
- private bundlerReputationParams;
83
- private logger;
84
- constructor(publicClient: PublicClient, entryPoints: Address[], minStake: bigint, minUnstakeDelay: bigint, logger: Logger, maxMempoolUserOperationsPerNewUnstakedEntity?: bigint, throttledEntityMinMempoolCount?: bigint, inclusionRateFactor?: bigint, maxMempoolUserOperationsPerSender?: bigint, blackList?: Address[], whiteList?: Address[], bundlerReputationParams?: ReputationParams);
85
- setReputation(entryPoint: Address, reputations: {
86
- address: Address;
87
- opsSeen: bigint;
88
- opsIncluded: bigint;
89
- }[]): void;
90
- dumpReputations(entryPoint: Address): ReputationEntry[];
91
- clear(): void;
92
- clearEntityCount(): void;
93
- getStakeStatus(entryPoint: Address, address: Address): Promise<{
94
- stakeInfo: StakeInfo;
95
- isStaked: boolean;
96
- }>;
97
- checkReputation(userOperation: UserOperation, entryPoint: Address, validationResult: ValidationResult | ValidationResultWithAggregation): Promise<void>;
98
- getEntityCount(address: Address): bigint;
99
- increaseSeen(entryPoint: Address, address: Address): void;
100
- updateCrashedHandleOps(entryPoint: Address, address: Address): void;
101
- crashedHandleOps(op: UserOperation, entryPoint: Address, reason: string): void;
102
- updateIncludedStatus(entryPoint: Address, address: Address): void;
103
- updateUserOperationIncludedStatus(userOperation: UserOperation, entryPoint: Address, accountDeployed: boolean): void;
104
- updateUserOperationSeenStatus(userOperation: UserOperation, entryPoint: Address): void;
105
- increaseUserOperationCount(userOperation: UserOperation): void;
106
- decreaseUserOperationCount(userOperation: UserOperation): void;
107
- checkReputationStatus(entryPoint: Address, entityType: EntityType, stakeInfo: StakeInfo, maxMempoolUserOperationsPerSenderOverride?: bigint): void;
108
- getStatus(entryPoint: Address, address: Address | null): ReputationStatus;
109
- checkBanned(entryPoint: Address, entityType: EntityType, stakeInfo: StakeInfo): void;
110
- checkThrottled(entryPoint: Address, entityType: EntityType, stakeInfo: StakeInfo): void;
111
- isWhiteListed(address: Address): boolean;
112
- checkStake(entryPoint: Address, entityType: EntityType, stakeInfo: StakeInfo): void;
113
- calCulateMaxMempoolUserOperationsPerEntity(entryPoint: Address, address: Address): bigint;
114
- }
115
- //# sourceMappingURL=reputationManager.d.ts.map
@@ -1,397 +0,0 @@
1
- import { EntryPointV06Abi, RpcError, ValidationErrors } from "../types/index.js";
2
- import { getAddressFromInitCodeOrPaymasterAndData, isVersion06 } from "../utils/index.js";
3
- import { getAddress, getContract } from "viem";
4
- export var EntityType;
5
- (function (EntityType) {
6
- EntityType["Account"] = "Account";
7
- EntityType["Paymaster"] = "Paymaster";
8
- EntityType["Factory"] = "Factory";
9
- EntityType["Aggregator"] = "Aggregator";
10
- })(EntityType || (EntityType = {}));
11
- export const ReputationStatuses = {
12
- ok: 0n,
13
- throttled: 1n,
14
- banned: 2n
15
- };
16
- export const BundlerReputationParams = {
17
- minInclusionDenominator: 10n,
18
- throttlingSlack: 10n,
19
- banSlack: 50n
20
- };
21
- export class NullReputationManager {
22
- checkReputation(_userOperation, _entryPoint, _validationResult) {
23
- return Promise.resolve();
24
- }
25
- increaseUserOperationCount(_) {
26
- return;
27
- }
28
- decreaseUserOperationCount(_) {
29
- return;
30
- }
31
- updateUserOperationSeenStatus(_, _entryPoint) {
32
- return;
33
- }
34
- updateUserOperationIncludedStatus(_, _entryPoint, __) {
35
- return;
36
- }
37
- crashedHandleOps(_, _entryPoint, __) {
38
- return;
39
- }
40
- setReputation(_, __) {
41
- return;
42
- }
43
- dumpReputations(_entryPoint) {
44
- return [];
45
- }
46
- getStatus(_entryPoint, _address) {
47
- throw new Error("Method not implemented.");
48
- }
49
- getStakeStatus(_entryPoint, _) {
50
- throw new Error("Method not implemented.");
51
- }
52
- clear() {
53
- return;
54
- }
55
- clearEntityCount() {
56
- return;
57
- }
58
- }
59
- export class ReputationManager {
60
- publicClient;
61
- minStake;
62
- minUnstakeDelay;
63
- entityCount = {};
64
- throttledEntityMinMempoolCount;
65
- maxMempoolUserOperationsPerSender;
66
- maxMempoolUserOperationsPerNewUnstakedEntity;
67
- inclusionRateFactor;
68
- entries = {};
69
- whitelist = new Set();
70
- blackList = new Set();
71
- bundlerReputationParams;
72
- logger;
73
- constructor(publicClient, entryPoints, minStake, minUnstakeDelay, logger, maxMempoolUserOperationsPerNewUnstakedEntity, throttledEntityMinMempoolCount, inclusionRateFactor, maxMempoolUserOperationsPerSender, blackList, whiteList, bundlerReputationParams) {
74
- this.publicClient = publicClient;
75
- this.minStake = minStake;
76
- this.minUnstakeDelay = minUnstakeDelay;
77
- this.logger = logger;
78
- this.maxMempoolUserOperationsPerNewUnstakedEntity =
79
- maxMempoolUserOperationsPerNewUnstakedEntity ?? 10n;
80
- this.inclusionRateFactor = inclusionRateFactor ?? 10n;
81
- this.throttledEntityMinMempoolCount =
82
- throttledEntityMinMempoolCount ?? 4n;
83
- this.maxMempoolUserOperationsPerSender =
84
- maxMempoolUserOperationsPerSender ?? 4n;
85
- this.bundlerReputationParams =
86
- bundlerReputationParams ?? BundlerReputationParams;
87
- for (const address of blackList || []) {
88
- this.blackList.add(address);
89
- }
90
- for (const address of whiteList || []) {
91
- this.whitelist.add(address);
92
- }
93
- for (const entryPoint of entryPoints) {
94
- this.entries[entryPoint] = {};
95
- }
96
- }
97
- setReputation(entryPoint, reputations) {
98
- for (const reputation of reputations) {
99
- const address = getAddress(reputation.address);
100
- this.entries[entryPoint][address] = {
101
- address,
102
- opsSeen: BigInt(reputation.opsSeen),
103
- opsIncluded: BigInt(reputation.opsIncluded)
104
- };
105
- }
106
- this.logger.debug({
107
- reputations: this.entries
108
- }, "Reputation set");
109
- }
110
- dumpReputations(entryPoint) {
111
- return Object.values(this.entries[entryPoint]).map((entry) => ({
112
- ...entry,
113
- status: this.getStatus(entryPoint, entry.address)
114
- }));
115
- }
116
- clear() {
117
- this.entries = {};
118
- this.entityCount = {};
119
- }
120
- clearEntityCount() {
121
- this.entityCount = {};
122
- }
123
- async getStakeStatus(entryPoint, address) {
124
- const entryPointContract = getContract({
125
- abi: EntryPointV06Abi,
126
- address: entryPoint,
127
- client: {
128
- public: this.publicClient
129
- }
130
- });
131
- const stakeInfo = await entryPointContract.read.getDepositInfo([
132
- address
133
- ]);
134
- const stake = BigInt(stakeInfo.stake);
135
- const unstakeDelaySec = BigInt(stakeInfo.unstakeDelaySec);
136
- const isStaked = stake >= this.minStake && unstakeDelaySec >= this.minUnstakeDelay;
137
- return {
138
- stakeInfo: {
139
- addr: address,
140
- stake: stake,
141
- unstakeDelaySec: unstakeDelaySec
142
- },
143
- isStaked
144
- };
145
- }
146
- checkReputation(userOperation, entryPoint, validationResult) {
147
- this.increaseUserOperationCount(userOperation);
148
- this.checkReputationStatus(entryPoint, EntityType.Account, validationResult.senderInfo, this.maxMempoolUserOperationsPerSender);
149
- if (validationResult.paymasterInfo) {
150
- this.checkReputationStatus(entryPoint, EntityType.Paymaster, validationResult.paymasterInfo);
151
- }
152
- if (validationResult.factoryInfo) {
153
- this.checkReputationStatus(entryPoint, EntityType.Factory, validationResult.factoryInfo);
154
- }
155
- const aggregatorValidationResult = validationResult;
156
- if (aggregatorValidationResult.aggregatorInfo) {
157
- this.checkReputationStatus(entryPoint, EntityType.Aggregator, aggregatorValidationResult.aggregatorInfo.stakeInfo);
158
- }
159
- return Promise.resolve();
160
- }
161
- getEntityCount(address) {
162
- return this.entityCount[address] ?? 0;
163
- }
164
- increaseSeen(entryPoint, address) {
165
- const entry = this.entries[entryPoint][address];
166
- if (!entry) {
167
- this.entries[entryPoint][address] = {
168
- address,
169
- opsSeen: 0n,
170
- opsIncluded: 0n
171
- };
172
- }
173
- entry.opsSeen++;
174
- }
175
- updateCrashedHandleOps(entryPoint, address) {
176
- const entry = this.entries[entryPoint][address];
177
- if (!entry) {
178
- this.entries[entryPoint][address] = {
179
- address,
180
- opsSeen: 1000n,
181
- opsIncluded: 0n
182
- };
183
- return;
184
- }
185
- entry.opsSeen = 1000n;
186
- entry.opsIncluded = 0n;
187
- }
188
- crashedHandleOps(op, entryPoint, reason) {
189
- const isUserOpV06 = isVersion06(op);
190
- if (reason.startsWith("AA3")) {
191
- // paymaster
192
- const paymaster = isUserOpV06
193
- ? getAddressFromInitCodeOrPaymasterAndData(op.paymasterAndData)
194
- : op.paymaster;
195
- if (paymaster) {
196
- this.updateCrashedHandleOps(entryPoint, paymaster);
197
- }
198
- }
199
- else if (reason.startsWith("AA2")) {
200
- // sender
201
- const sender = op.sender;
202
- this.updateCrashedHandleOps(entryPoint, sender);
203
- }
204
- else if (reason.startsWith("AA1")) {
205
- // init code
206
- const factory = isUserOpV06
207
- ? getAddressFromInitCodeOrPaymasterAndData(op.initCode)
208
- : op.factory;
209
- if (factory) {
210
- this.updateCrashedHandleOps(entryPoint, factory);
211
- }
212
- }
213
- }
214
- updateIncludedStatus(entryPoint, address) {
215
- const entry = this.entries[entryPoint][address];
216
- if (!entry) {
217
- this.entries[entryPoint][address] = {
218
- address,
219
- opsSeen: 0n,
220
- opsIncluded: 0n
221
- };
222
- }
223
- entry.opsIncluded++;
224
- }
225
- updateUserOperationIncludedStatus(userOperation, entryPoint, accountDeployed) {
226
- const sender = userOperation.sender;
227
- this.updateIncludedStatus(entryPoint, sender);
228
- const isUserOpV06 = isVersion06(userOperation);
229
- const paymaster = isUserOpV06
230
- ? getAddressFromInitCodeOrPaymasterAndData(userOperation.paymasterAndData)
231
- : userOperation.paymaster;
232
- if (paymaster) {
233
- this.updateIncludedStatus(entryPoint, paymaster);
234
- }
235
- if (accountDeployed) {
236
- const factory = (isUserOpV06
237
- ? getAddressFromInitCodeOrPaymasterAndData(userOperation.initCode)
238
- : userOperation.factory);
239
- if (factory) {
240
- this.updateIncludedStatus(entryPoint, factory);
241
- }
242
- }
243
- }
244
- updateUserOperationSeenStatus(userOperation, entryPoint) {
245
- const sender = userOperation.sender;
246
- this.increaseSeen(entryPoint, sender);
247
- const isUserOpV06 = isVersion06(userOperation);
248
- const paymaster = isUserOpV06
249
- ? getAddressFromInitCodeOrPaymasterAndData(userOperation.paymasterAndData)
250
- : userOperation.paymaster;
251
- if (paymaster) {
252
- this.increaseSeen(entryPoint, paymaster);
253
- }
254
- const factory = (isUserOpV06
255
- ? getAddressFromInitCodeOrPaymasterAndData(userOperation.initCode)
256
- : userOperation.factory);
257
- this.logger.debug({ userOperation, factory }, "updateUserOperationSeenStatus");
258
- if (factory) {
259
- this.increaseSeen(entryPoint, factory);
260
- }
261
- }
262
- increaseUserOperationCount(userOperation) {
263
- const sender = userOperation.sender;
264
- this.entityCount[sender] = (this.entityCount[sender] ?? 0n) + 1n;
265
- const isUserOpV06 = isVersion06(userOperation);
266
- const paymaster = isUserOpV06
267
- ? getAddressFromInitCodeOrPaymasterAndData(userOperation.paymasterAndData)
268
- : userOperation.paymaster;
269
- if (paymaster) {
270
- this.entityCount[paymaster] =
271
- (this.entityCount[paymaster] ?? 0n) + 1n;
272
- }
273
- const factory = (isUserOpV06
274
- ? getAddressFromInitCodeOrPaymasterAndData(userOperation.initCode)
275
- : userOperation.factory);
276
- if (factory) {
277
- this.entityCount[factory] = (this.entityCount[factory] ?? 0n) + 1n;
278
- }
279
- }
280
- decreaseUserOperationCount(userOperation) {
281
- const sender = userOperation.sender;
282
- this.entityCount[sender] = (this.entityCount[sender] ?? 0n) - 1n;
283
- const isUserOpV06 = isVersion06(userOperation);
284
- this.entityCount[sender] =
285
- this.entityCount[sender] < 0n ? 0n : this.entityCount[sender];
286
- const paymaster = isUserOpV06
287
- ? getAddressFromInitCodeOrPaymasterAndData(userOperation.paymasterAndData)
288
- : userOperation.paymaster;
289
- if (paymaster) {
290
- this.entityCount[paymaster] =
291
- (this.entityCount[paymaster] ?? 0n) - 1n;
292
- this.entityCount[paymaster] =
293
- this.entityCount[paymaster] < 0n
294
- ? 0n
295
- : this.entityCount[paymaster];
296
- }
297
- const factory = (isUserOpV06
298
- ? getAddressFromInitCodeOrPaymasterAndData(userOperation.initCode)
299
- : userOperation.factory);
300
- if (factory) {
301
- this.entityCount[factory] = (this.entityCount[factory] ?? 0n) - 1n;
302
- this.entityCount[factory] =
303
- this.entityCount[factory] < 0n ? 0n : this.entityCount[factory];
304
- }
305
- }
306
- checkReputationStatus(entryPoint, entityType, stakeInfo, maxMempoolUserOperationsPerSenderOverride) {
307
- const maxTxMempoolAllowedEntity = maxMempoolUserOperationsPerSenderOverride ??
308
- this.calCulateMaxMempoolUserOperationsPerEntity(entryPoint, stakeInfo.addr);
309
- this.checkBanned(entryPoint, entityType, stakeInfo);
310
- const entityCount = this.getEntityCount(stakeInfo.addr);
311
- if (entityCount > this.throttledEntityMinMempoolCount) {
312
- this.checkThrottled(entryPoint, entityType, stakeInfo);
313
- }
314
- if (entityCount > maxTxMempoolAllowedEntity) {
315
- this.checkStake(entryPoint, entityType, stakeInfo);
316
- }
317
- }
318
- getStatus(entryPoint, address) {
319
- if (!address || this.whitelist.has(address)) {
320
- return ReputationStatuses.ok;
321
- }
322
- if (this.blackList.has(address)) {
323
- return ReputationStatuses.banned;
324
- }
325
- const entry = this.entries[entryPoint][address];
326
- if (!entry) {
327
- return ReputationStatuses.ok;
328
- }
329
- const minExpectedIncluded = entry.opsSeen / this.bundlerReputationParams.minInclusionDenominator;
330
- this.logger.debug({
331
- address: address,
332
- minExpectedIncluded,
333
- opsSeen: entry.opsSeen,
334
- minInclusionDenominator: this.bundlerReputationParams.minInclusionDenominator,
335
- opsIncluded: entry.opsIncluded,
336
- throttlingSlack: this.bundlerReputationParams.throttlingSlack,
337
- banSlack: this.bundlerReputationParams.banSlack
338
- }, "minExpectedIncluded");
339
- if (minExpectedIncluded <=
340
- entry.opsIncluded + this.bundlerReputationParams.throttlingSlack) {
341
- entry.status = ReputationStatuses.ok;
342
- return ReputationStatuses.ok;
343
- }
344
- if (minExpectedIncluded <=
345
- entry.opsIncluded + this.bundlerReputationParams.banSlack) {
346
- entry.status = ReputationStatuses.throttled;
347
- return ReputationStatuses.throttled;
348
- }
349
- entry.status = ReputationStatuses.banned;
350
- return ReputationStatuses.banned;
351
- }
352
- checkBanned(entryPoint, entityType, stakeInfo) {
353
- const status = this.getStatus(entryPoint, stakeInfo.addr);
354
- if (status === ReputationStatuses.banned) {
355
- throw new RpcError(`${entityType} ${stakeInfo.addr} is banned from using the pimlico`, ValidationErrors.Reputation);
356
- }
357
- }
358
- checkThrottled(entryPoint, entityType, stakeInfo) {
359
- const status = this.getStatus(entryPoint, stakeInfo.addr);
360
- if (status === ReputationStatuses.throttled) {
361
- throw new RpcError(`${entityType} ${stakeInfo.addr} is throttled by the pimlico`, ValidationErrors.Reputation);
362
- }
363
- }
364
- isWhiteListed(address) {
365
- return this.whitelist.has(address);
366
- }
367
- checkStake(entryPoint, entityType, stakeInfo) {
368
- if (this.isWhiteListed(stakeInfo.addr)) {
369
- return;
370
- }
371
- this.checkBanned(entryPoint, entityType, stakeInfo);
372
- if (stakeInfo.stake < this.minStake) {
373
- if (stakeInfo.stake === 0n) {
374
- throw new RpcError(`${entityType} ${stakeInfo.addr} is unstaked and must stake minimum ${this.minStake} to use pimlico`, ValidationErrors.InsufficientStake);
375
- }
376
- throw new RpcError(`${entityType} ${stakeInfo.addr} does not have enough stake to use pimlico`, ValidationErrors.InsufficientStake);
377
- }
378
- if (stakeInfo.unstakeDelaySec < this.minUnstakeDelay) {
379
- throw new RpcError(`${entityType} ${stakeInfo.addr} does not have enough unstake delay to use pimlico`, ValidationErrors.InsufficientStake);
380
- }
381
- }
382
- calCulateMaxMempoolUserOperationsPerEntity(entryPoint, address) {
383
- const entry = this.entries[entryPoint][address];
384
- if (!entry) {
385
- return this.maxMempoolUserOperationsPerNewUnstakedEntity;
386
- }
387
- let inclusionRate = 0n;
388
- if (entry.opsSeen !== 0n) {
389
- // prevent NaN of Infinity in tests
390
- inclusionRate = entry.opsIncluded / entry.opsSeen;
391
- }
392
- return (this.maxMempoolUserOperationsPerNewUnstakedEntity +
393
- inclusionRate * this.inclusionRateFactor +
394
- (entry.opsIncluded > 10000n ? 10000n : entry.opsIncluded));
395
- }
396
- }
397
- //# sourceMappingURL=reputationManager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"reputationManager.js","sourceRoot":"","sources":["../../mempool/reputationManager.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,gBAAgB,EAChB,QAAQ,EAGR,gBAAgB,EAGnB,MAAM,aAAa,CAAA;AAEpB,OAAO,EACH,wCAAwC,EACxC,WAAW,EACd,MAAM,aAAa,CAAA;AACpB,OAAO,EAAmC,UAAU,EAAE,WAAW,EAAE,MAAM,MAAM,CAAA;AA6C/E,MAAM,CAAN,IAAY,UAKX;AALD,WAAY,UAAU;IAClB,iCAAmB,CAAA;IACnB,qCAAuB,CAAA;IACvB,iCAAmB,CAAA;IACnB,uCAAyB,CAAA;AAC7B,CAAC,EALW,UAAU,KAAV,UAAU,QAKrB;AAGD,MAAM,CAAC,MAAM,kBAAkB,GAI3B;IACA,EAAE,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KAAK,CAAC,OAAO,KAAK,EAAE,EAAE,CAAC;YACvB,mCAAmC;YACnC,aAAa,GAAG,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,OAAO,CAAA;QACrD,CAAC;QACD,OAAO,CACH,IAAI,CAAC,4CAA4C;YACjD,aAAa,GAAG,IAAI,CAAC,mBAAmB;YACxC,CAAC,KAAK,CAAC,WAAW,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAC5D,CAAA;IACL,CAAC;CACJ"}
@@ -1,22 +0,0 @@
1
- import type { Metrics } from "../utils/index.js";
2
- import type { HexData32, SubmittedUserOperation, UserOperationInfo } from "../types/index.js";
3
- import type { Logger } from "../utils/index.js";
4
- export declare class MemoryStore {
5
- private outstandingUserOperations;
6
- private processingUserOperations;
7
- private submittedUserOperations;
8
- private logger;
9
- private metrics;
10
- constructor(logger: Logger, metrics: Metrics);
11
- addOutstanding(op: UserOperationInfo): void;
12
- addProcessing(op: UserOperationInfo): void;
13
- addSubmitted(op: SubmittedUserOperation): void;
14
- removeOutstanding(userOpHash: HexData32): void;
15
- removeProcessing(userOpHash: HexData32): void;
16
- removeSubmitted(userOpHash: HexData32): void;
17
- dumpOutstanding(): UserOperationInfo[];
18
- dumpProcessing(): UserOperationInfo[];
19
- dumpSubmitted(): SubmittedUserOperation[];
20
- clear(from: "outstanding" | "processing" | "submitted"): void;
21
- }
22
- //# sourceMappingURL=store.d.ts.map