@pimlico/alto 0.0.0-main.20250916T162729 → 0.0.0-main.20251001T162733

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 (99) hide show
  1. package/esm/cli/config/bundler.d.ts +12 -0
  2. package/esm/cli/config/bundler.js +2 -0
  3. package/esm/cli/config/bundler.js.map +1 -1
  4. package/esm/cli/config/options.js +11 -0
  5. package/esm/cli/config/options.js.map +1 -1
  6. package/esm/cli/setupServer.js +1 -1
  7. package/esm/cli/setupServer.js.map +1 -1
  8. package/esm/cli/shutDown.js +15 -55
  9. package/esm/cli/shutDown.js.map +1 -1
  10. package/esm/executor/bundleManager.d.ts +1 -1
  11. package/esm/executor/bundleManager.js +47 -34
  12. package/esm/executor/bundleManager.js.map +1 -1
  13. package/esm/executor/executorManager.js +3 -4
  14. package/esm/executor/executorManager.js.map +1 -1
  15. package/esm/executor/senderManager/createRedisSenderManager.js +1 -2
  16. package/esm/executor/senderManager/createRedisSenderManager.js.map +1 -1
  17. package/esm/handlers/arbitrumGasPriceManager.js +2 -2
  18. package/esm/handlers/gasPriceManager.js +3 -3
  19. package/esm/handlers/mantleGasPriceManager.js +4 -4
  20. package/esm/handlers/optimismManager.js +1 -1
  21. package/esm/mempool/mempool.d.ts +3 -11
  22. package/esm/mempool/mempool.js +93 -96
  23. package/esm/mempool/mempool.js.map +1 -1
  24. package/esm/mempool/monitoring.d.ts +1 -1
  25. package/esm/mempool/monitoring.js +30 -21
  26. package/esm/mempool/monitoring.js.map +1 -1
  27. package/esm/receiptCache/createMemoryReceiptCache.js +8 -5
  28. package/esm/receiptCache/createMemoryReceiptCache.js.map +1 -1
  29. package/esm/receiptCache/createRedisReceiptCache.js +13 -11
  30. package/esm/receiptCache/createRedisReceiptCache.js.map +1 -1
  31. package/esm/receiptCache/index.d.ts +4 -1
  32. package/esm/receiptCache/index.js.map +1 -1
  33. package/esm/rpc/methods/eth_sendUserOperation.js +6 -7
  34. package/esm/rpc/methods/eth_sendUserOperation.js.map +1 -1
  35. package/esm/rpc/methods/pimlico_sendUserOperationNow.js +8 -11
  36. package/esm/rpc/methods/pimlico_sendUserOperationNow.js.map +1 -1
  37. package/esm/store/createMempoolStore.d.ts +1 -1
  38. package/esm/store/createMempoolStore.js +51 -143
  39. package/esm/store/createMempoolStore.js.map +1 -1
  40. package/esm/store/index.d.ts +4 -75
  41. package/esm/store/index.js +4 -1
  42. package/esm/store/index.js.map +1 -1
  43. package/esm/store/outstanding/index.d.ts +13 -0
  44. package/esm/store/outstanding/index.js +16 -0
  45. package/esm/store/outstanding/index.js.map +1 -0
  46. package/esm/store/{createMemoryOutstandingStore.d.ts → outstanding/memory.d.ts} +11 -10
  47. package/esm/store/outstanding/memory.js +249 -0
  48. package/esm/store/outstanding/memory.js.map +1 -0
  49. package/esm/store/outstanding/redis.d.ts +11 -0
  50. package/esm/store/outstanding/redis.js +201 -0
  51. package/esm/store/outstanding/redis.js.map +1 -0
  52. package/esm/store/outstanding/types.d.ts +18 -0
  53. package/esm/store/outstanding/types.js +2 -0
  54. package/esm/store/outstanding/types.js.map +1 -0
  55. package/esm/store/processing/index.d.ts +11 -0
  56. package/esm/store/processing/index.js +17 -0
  57. package/esm/store/processing/index.js.map +1 -0
  58. package/esm/store/processing/memory.d.ts +14 -0
  59. package/esm/store/processing/memory.js +46 -0
  60. package/esm/store/processing/memory.js.map +1 -0
  61. package/esm/store/processing/redis.d.ts +21 -0
  62. package/esm/store/processing/redis.js +69 -0
  63. package/esm/store/processing/redis.js.map +1 -0
  64. package/esm/store/processing/types.d.ts +9 -0
  65. package/esm/store/processing/types.js +2 -0
  66. package/esm/store/processing/types.js.map +1 -0
  67. package/esm/store/types.d.ts +49 -0
  68. package/esm/store/types.js +2 -0
  69. package/esm/store/types.js.map +1 -0
  70. package/esm/utils/helpers.d.ts +0 -1
  71. package/esm/utils/helpers.js +1 -8
  72. package/esm/utils/helpers.js.map +1 -1
  73. package/esm/utils/minMaxQueue/createRedisMinMaxQueue.d.ts +23 -2
  74. package/esm/utils/minMaxQueue/createRedisMinMaxQueue.js +83 -60
  75. package/esm/utils/minMaxQueue/createRedisMinMaxQueue.js.map +1 -1
  76. package/esm/utils/minMaxQueue/index.d.ts +2 -2
  77. package/esm/utils/minMaxQueue/index.js +2 -2
  78. package/esm/utils/minMaxQueue/index.js.map +1 -1
  79. package/esm/utils/preVerificationGasCalulator.d.ts +0 -2
  80. package/esm/utils/preVerificationGasCalulator.js +2 -2
  81. package/esm/utils/preVerificationGasCalulator.js.map +1 -1
  82. package/esm/utils/userop.d.ts +4 -50
  83. package/esm/utils/userop.js +61 -196
  84. package/esm/utils/userop.js.map +1 -1
  85. package/package.json +1 -1
  86. package/esm/cli/config/redisKeys.d.ts +0 -9
  87. package/esm/cli/config/redisKeys.js +0 -16
  88. package/esm/cli/config/redisKeys.js.map +0 -1
  89. package/esm/store/createMemoryOutstandingStore.js +0 -240
  90. package/esm/store/createMemoryOutstandingStore.js.map +0 -1
  91. package/esm/store/createRedisOutstandingStore.d.ts +0 -28
  92. package/esm/store/createRedisOutstandingStore.js +0 -341
  93. package/esm/store/createRedisOutstandingStore.js.map +0 -1
  94. package/esm/store/createRedisStore.d.ts +0 -10
  95. package/esm/store/createRedisStore.js +0 -128
  96. package/esm/store/createRedisStore.js.map +0 -1
  97. package/esm/store/createStore.d.ts +0 -6
  98. package/esm/store/createStore.js +0 -66
  99. package/esm/store/createStore.js.map +0 -1
@@ -0,0 +1,249 @@
1
+ import { getNonceKeyAndSequence, isDeployment, isVersion07 } from "../../utils/userop.js";
2
+ const senderNonceSlot = (userOp) => {
3
+ const sender = userOp.sender;
4
+ const [nonceKey] = getNonceKeyAndSequence(userOp.nonce);
5
+ return `${sender}-${nonceKey}`;
6
+ };
7
+ export class MemoryOutstanding {
8
+ config;
9
+ pendingOps = new Map();
10
+ priorityQueue = [];
11
+ hashLookup = new Map();
12
+ logger;
13
+ constructor(config) {
14
+ this.config = config;
15
+ // Setup args for getting userOpHash
16
+ this.logger = config.getLogger({ module: "memory-outstanding-queue" }, {
17
+ level: config.logLevel
18
+ });
19
+ }
20
+ dump() {
21
+ return [...Array.from(this.pendingOps.values()).flat()];
22
+ }
23
+ // Adds userOp to queue and maintains sorting by gas price.
24
+ addToPriorityQueue(userOpInfo) {
25
+ this.priorityQueue.push(userOpInfo);
26
+ this.priorityQueue.sort((a, b) => {
27
+ const userOpA = a.userOp;
28
+ const userOpB = b.userOp;
29
+ return Number(userOpA.maxFeePerGas - userOpB.maxFeePerGas);
30
+ });
31
+ }
32
+ validateQueuedLimit(userOp) {
33
+ const outstandingOps = this.dump();
34
+ const parallelUserOpsCount = outstandingOps.filter((userOpInfo) => {
35
+ const { userOp: mempoolUserOp } = userOpInfo;
36
+ return mempoolUserOp.sender === userOp.sender;
37
+ }).length;
38
+ if (parallelUserOpsCount > this.config.mempoolMaxParallelOps) {
39
+ return false;
40
+ }
41
+ return true;
42
+ }
43
+ validateParallelLimit(userOp) {
44
+ const outstandingOps = this.dump();
45
+ const [nonceKey] = getNonceKeyAndSequence(userOp.nonce);
46
+ const queuedUserOpsCount = outstandingOps.filter((userOpInfo) => {
47
+ const { userOp: mempoolUserOp } = userOpInfo;
48
+ const [opNonceKey] = getNonceKeyAndSequence(mempoolUserOp.nonce);
49
+ return (mempoolUserOp.sender === userOp.sender &&
50
+ opNonceKey === nonceKey);
51
+ }).length;
52
+ if (queuedUserOpsCount > this.config.mempoolMaxQueuedOps) {
53
+ return false;
54
+ }
55
+ return true;
56
+ }
57
+ async popConflicting(userOp) {
58
+ const outstandingOps = this.dump();
59
+ let conflictingReason;
60
+ for (const userOpInfo of outstandingOps) {
61
+ const { userOp: mempoolUserOp } = userOpInfo;
62
+ const isSameSender = mempoolUserOp.sender === userOp.sender;
63
+ if (isSameSender && mempoolUserOp.nonce === userOp.nonce) {
64
+ const removed = await this.remove([userOpInfo.userOpHash]);
65
+ if (removed.length > 0) {
66
+ conflictingReason = {
67
+ reason: "conflicting_nonce",
68
+ userOpInfo: removed[0]
69
+ };
70
+ }
71
+ break;
72
+ }
73
+ const isConflictingDeployment = isSameSender &&
74
+ isDeployment(userOp) &&
75
+ isDeployment(mempoolUserOp);
76
+ if (isConflictingDeployment) {
77
+ const removed = await this.remove([userOpInfo.userOpHash]);
78
+ if (removed.length > 0) {
79
+ conflictingReason = {
80
+ reason: "conflicting_deployment",
81
+ userOpInfo: removed[0]
82
+ };
83
+ }
84
+ break;
85
+ }
86
+ }
87
+ return conflictingReason;
88
+ }
89
+ async contains(userOpHash) {
90
+ return this.hashLookup.has(userOpHash);
91
+ }
92
+ pop(count) {
93
+ const results = [];
94
+ for (let i = 0; i < count; i++) {
95
+ const userOpInfo = this.priorityQueue.shift();
96
+ if (!userOpInfo) {
97
+ break;
98
+ }
99
+ const pendingOpsSlot = senderNonceSlot(userOpInfo.userOp);
100
+ const backlogOps = this.pendingOps.get(pendingOpsSlot);
101
+ // This should never throw.
102
+ if (!backlogOps?.shift()) {
103
+ throw new Error("FATAL: No pending userOps for sender");
104
+ }
105
+ // Move next pending userOp into priorityQueue if exist.
106
+ if (backlogOps.length > 0) {
107
+ this.addToPriorityQueue(backlogOps[0]);
108
+ }
109
+ else {
110
+ // Cleanup if no more ops for this slot
111
+ this.pendingOps.delete(pendingOpsSlot);
112
+ }
113
+ // Remove from hash lookup
114
+ this.hashLookup.delete(userOpInfo.userOpHash);
115
+ results.push(userOpInfo);
116
+ }
117
+ return Promise.resolve(results);
118
+ }
119
+ async add(userOpInfos) {
120
+ if (userOpInfos.length === 0)
121
+ return;
122
+ for (const userOpInfo of userOpInfos) {
123
+ const { userOp, userOpHash } = userOpInfo;
124
+ const [nonceKey] = getNonceKeyAndSequence(userOp.nonce);
125
+ const pendingOpsSlot = senderNonceSlot(userOp);
126
+ const backlogOps = (() => {
127
+ if (this.pendingOps.has(pendingOpsSlot)) {
128
+ return this.pendingOps.get(pendingOpsSlot);
129
+ }
130
+ this.pendingOps.set(pendingOpsSlot, []);
131
+ return this.pendingOps.get(pendingOpsSlot);
132
+ })();
133
+ if (!backlogOps) {
134
+ throw new Error("FATAL: No pending operations found for userOpHash");
135
+ }
136
+ // Note: the userOpInfo is always added to backlogOps, because we are pushing to a reference
137
+ backlogOps.push(userOpInfo);
138
+ // Add to hash lookup for O(1) contains checks
139
+ this.hashLookup.set(userOpHash, userOpInfo);
140
+ // Sort backlogOps by nonce sequence
141
+ backlogOps.sort((a, b) => {
142
+ const [, aNonceSeq] = getNonceKeyAndSequence(a.userOp.nonce);
143
+ const [, bNonceSeq] = getNonceKeyAndSequence(b.userOp.nonce);
144
+ return Number(aNonceSeq - bNonceSeq);
145
+ });
146
+ const lowestUserOpHash = backlogOps[0].userOpHash;
147
+ // If lowest, remove any existing userOp with same sender and nonceKey and add current userOp to priorityQueue.
148
+ if (lowestUserOpHash === userOpHash) {
149
+ this.priorityQueue = this.priorityQueue.filter((userOpInfo) => {
150
+ const pendingUserOp = userOpInfo.userOp;
151
+ const isSameSender = pendingUserOp.sender === userOp.sender;
152
+ const isSameNonceKey = getNonceKeyAndSequence(pendingUserOp.nonce)[0] ===
153
+ nonceKey;
154
+ return !(isSameSender && isSameNonceKey);
155
+ });
156
+ this.addToPriorityQueue(userOpInfo);
157
+ }
158
+ }
159
+ }
160
+ async getQueuedUserOps(userOp) {
161
+ const [nonceKey, nonceSequence] = getNonceKeyAndSequence(userOp.nonce);
162
+ const outstandingOps = this.dump();
163
+ const outstanding = outstandingOps.filter((userOpInfo) => {
164
+ const { userOp: mempoolUserOp } = userOpInfo;
165
+ const [mempoolNonceKey, mempoolNonceSequence] = getNonceKeyAndSequence(mempoolUserOp.nonce);
166
+ let isPaymasterSame = false;
167
+ if (isVersion07(userOp) && isVersion07(mempoolUserOp)) {
168
+ isPaymasterSame =
169
+ mempoolUserOp.paymaster === userOp.paymaster &&
170
+ !(mempoolUserOp.sender === userOp.sender &&
171
+ mempoolNonceKey === nonceKey &&
172
+ mempoolNonceSequence === nonceSequence) &&
173
+ userOp.paymaster !== null;
174
+ }
175
+ // Filter operations with the same sender and nonce key
176
+ // but with a lower nonce sequence
177
+ return ((mempoolUserOp.sender === userOp.sender &&
178
+ mempoolNonceKey === nonceKey &&
179
+ mempoolNonceSequence < nonceSequence) ||
180
+ isPaymasterSame);
181
+ });
182
+ return outstanding
183
+ .sort((a, b) => {
184
+ const aUserOp = a.userOp;
185
+ const bUserOp = b.userOp;
186
+ const [, aNonceValue] = getNonceKeyAndSequence(aUserOp.nonce);
187
+ const [, bNonceValue] = getNonceKeyAndSequence(bUserOp.nonce);
188
+ return Number(aNonceValue - bNonceValue);
189
+ })
190
+ .map((userOpInfo) => userOpInfo.userOp);
191
+ }
192
+ async remove(userOpHashes) {
193
+ if (userOpHashes.length === 0) {
194
+ return [];
195
+ }
196
+ const removedOps = [];
197
+ for (const userOpHash of userOpHashes) {
198
+ // Look up userOp in hash lookup first
199
+ const userOpInfo = this.hashLookup.get(userOpHash);
200
+ if (!userOpInfo) {
201
+ this.logger.info(`tried to remove non-existent user op from mempool: ${userOpHash}`);
202
+ continue;
203
+ }
204
+ const pendingOpsSlot = senderNonceSlot(userOpInfo.userOp);
205
+ // Find and remove from pending ops
206
+ const backlogOps = this.pendingOps.get(pendingOpsSlot);
207
+ if (!backlogOps) {
208
+ throw new Error(`FATAL: No pending operations found for userOpHash ${userOpHash}`);
209
+ }
210
+ const backlogIndex = backlogOps.findIndex((info) => info.userOpHash === userOpHash);
211
+ if (backlogIndex === -1) {
212
+ throw new Error(`FATAL: UserOp with hash ${userOpHash} not found in backlog`);
213
+ }
214
+ backlogOps.splice(backlogIndex, 1);
215
+ // Remove from priority queue if present
216
+ const priorityQueueIndex = this.priorityQueue.findIndex((info) => info.userOpHash === userOpHash);
217
+ if (priorityQueueIndex !== -1) {
218
+ this.priorityQueue.splice(priorityQueueIndex, 1);
219
+ }
220
+ // Remove from hash lookup
221
+ this.hashLookup.delete(userOpHash);
222
+ // If this was the first operation and there are more in the backlog,
223
+ // add the new first operation to the priority queue
224
+ if (backlogIndex === 0 && backlogOps.length > 0) {
225
+ this.addToPriorityQueue(backlogOps[0]);
226
+ }
227
+ // Clean up empty slot
228
+ if (backlogOps.length === 0) {
229
+ this.pendingOps.delete(pendingOpsSlot);
230
+ }
231
+ removedOps.push(userOpInfo);
232
+ }
233
+ return removedOps;
234
+ }
235
+ dumpLocal() {
236
+ return Promise.resolve(this.dump());
237
+ }
238
+ clear() {
239
+ this.priorityQueue = [];
240
+ this.pendingOps.clear();
241
+ this.hashLookup.clear();
242
+ return Promise.resolve();
243
+ }
244
+ }
245
+ export const createMemoryOutstandingQueue = ({ config, logger }) => {
246
+ logger.info("Using memory for outstanding mempool");
247
+ return new MemoryOutstanding(config);
248
+ };
249
+ //# sourceMappingURL=memory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory.js","sourceRoot":"","sources":["../../../store/outstanding/memory.ts"],"names":[],"mappings":"AAGA,OAAO,EACH,sBAAsB,EACtB,YAAY,EACZ,WAAW,EACd,MAAM,oBAAoB,CAAA;AAG3B,MAAM,eAAe,GAAG,CAAC,MAAqB,EAAE,EAAE;IAC9C,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAA;IAC5B,MAAM,CAAC,QAAQ,CAAC,GAAG,sBAAsB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IACvD,OAAO,GAAG,MAAM,IAAI,QAAQ,EAAE,CAAA;AAClC,CAAC,CAAA;AAED,MAAM,OAAO,iBAAiB;IAMN;IALZ,UAAU,GAA8B,IAAI,GAAG,EAAE,CAAA;IACjD,aAAa,GAAiB,EAAE,CAAA;IAChC,UAAU,GAA+B,IAAI,GAAG,EAAE,CAAA;IAClD,MAAM,CAAQ;IAEtB,YAAoB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;QAClC,oCAAoC;QACpC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,SAAS,CAC1B,EAAE,MAAM,EAAE,0BAA0B,EAAE,EACtC;YACI,KAAK,EAAE,MAAM,CAA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C,aAAa,CAAC,MAAM,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAA;YACpD,CAAC;YAED,0BAA0B;YAC1B,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;YAElC,qEAAqE;YACrE,oDAAoD;YACpD,IAAI,YAAY,KAAK,CAAC,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC9C,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAA;YAC1C,CAAC;YAED,sBAAsB;YACtB,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC1B,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,cAAc,CAAC,CAAA;YAC1C,CAAC;YAED,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;QAC/B,CAAC;QAED,OAAO,UAAU,CAAA;IACrB,CAAC;IAED,SAAS;QACL,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAA;IACvC,CAAC;IAED,KAAK;QACD,IAAI,CAAC,aAAa,GAAG,EAAE,CAAA;QACvB,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAA;QACvB,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAA;QACvB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAA;IAC5B,CAAC;CACJ;AAED,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,EACzC,MAAM,EACN,MAAM,EAIT,EAAoB,EAAE;IACnB,MAAM,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAA;IACnD,OAAO,IAAI,iBAAiB,CAAC,MAAM,CAAC,CAAA;AACxC,CAAC,CAAA"}
@@ -0,0 +1,11 @@
1
+ import { type Address } from "../../types/index.js";
2
+ import type { Logger } from "pino";
3
+ import type { AltoConfig } from "../../createConfig.js";
4
+ import type { OutstandingStore } from "./types.js";
5
+ export declare const createRedisOutstandingQueue: ({ config, entryPoint, redisEndpoint, logger }: {
6
+ config: AltoConfig;
7
+ entryPoint: Address;
8
+ redisEndpoint: string;
9
+ logger: Logger;
10
+ }) => OutstandingStore;
11
+ //# sourceMappingURL=redis.d.ts.map
@@ -0,0 +1,201 @@
1
+ import { userOpInfoSchema } from "../../types/index.js";
2
+ import { getNonceKeyAndSequence, isDeployment } from "../../utils/index.js";
3
+ import { Redis } from "ioredis";
4
+ import { toHex } from "viem/utils";
5
+ const serialize = (userOpInfo) => {
6
+ return JSON.stringify(userOpInfo, (_, value) => typeof value === "bigint" ? toHex(value) : value);
7
+ };
8
+ const deserialize = (data) => {
9
+ const parsed = JSON.parse(data);
10
+ return userOpInfoSchema.parse(parsed);
11
+ };
12
+ class RedisOutstandingQueue {
13
+ redis;
14
+ senderNonceKeyPrefix; // sender + nonceKey -> userOpHash
15
+ readyQueue; // Queue of userOpHashes (sorted by composite of userOp.nonceSeq + userOp.maxFeePerGas)
16
+ userOpHashMap; // userOpHash -> boolean
17
+ deploymentHashMap; // sender -> deployment userOpHash
18
+ senderNonceQueueTtl; // TTL for sender nonce queues in seconds
19
+ constructor({ config, entryPoint, redisEndpoint, logger }) {
20
+ this.redis = new Redis(redisEndpoint, {});
21
+ // Initialize Redis key names
22
+ const redisPrefix = `${config.redisKeyPrefix}:${config.chainId}:${entryPoint}:outstanding`;
23
+ this.readyQueue = `${redisPrefix}:ready-queue`;
24
+ this.senderNonceKeyPrefix = `${redisPrefix}:sender`;
25
+ this.userOpHashMap = `${redisPrefix}:userop-hash`;
26
+ this.deploymentHashMap = `${redisPrefix}:deployment-senders`;
27
+ // Calculate TTL for sender nonce queues (10 blocks worth of time)
28
+ this.senderNonceQueueTtl = config.blockTime * 10;
29
+ logger.info({
30
+ readyQueueKey: this.readyQueue
31
+ }, "Using redis for outstanding mempool.");
32
+ }
33
+ // Returns queue index for this sender + nonceKey.
34
+ getSenderNonceQueue(userOp) {
35
+ const [nonceKey] = getNonceKeyAndSequence(userOp.nonce);
36
+ return `${this.senderNonceKeyPrefix}:${userOp.sender}:${nonceKey}`;
37
+ }
38
+ // OutstandingStore methods
39
+ async contains(userOpHash) {
40
+ const exists = await this.redis.hexists(this.userOpHashMap, userOpHash);
41
+ return exists === 1;
42
+ }
43
+ async popConflicting(userOp) {
44
+ const { sender, nonce } = userOp;
45
+ const [nonceSeq] = getNonceKeyAndSequence(nonce);
46
+ // Check for conflicting nonce.
47
+ const senderNonceQueue = this.getSenderNonceQueue(userOp);
48
+ const conflictingHashes = await this.redis.zrangebyscore(senderNonceQueue, Number(nonceSeq), Number(nonceSeq));
49
+ if (conflictingHashes.length > 0) {
50
+ const conflictingHash = conflictingHashes[0];
51
+ const removedUserOps = await this.remove([conflictingHash]);
52
+ if (removedUserOps.length > 0) {
53
+ return {
54
+ reason: "conflicting_nonce",
55
+ userOpInfo: removedUserOps[0]
56
+ };
57
+ }
58
+ }
59
+ // Check for conflicting deployment.
60
+ if (isDeployment(userOp)) {
61
+ const existingDeploymentHash = (await this.redis.hget(this.deploymentHashMap, sender));
62
+ if (existingDeploymentHash) {
63
+ const removedUserOps = await this.remove([
64
+ existingDeploymentHash
65
+ ]);
66
+ if (removedUserOps.length > 0) {
67
+ return {
68
+ reason: "conflicting_deployment",
69
+ userOpInfo: removedUserOps[0]
70
+ };
71
+ }
72
+ }
73
+ }
74
+ return undefined;
75
+ }
76
+ async add(userOpInfos) {
77
+ if (userOpInfos.length === 0)
78
+ return;
79
+ // Use pipeline for atomic operations
80
+ const pipeline = this.redis.pipeline();
81
+ for (const userOpInfo of userOpInfos) {
82
+ const { userOp } = userOpInfo;
83
+ const [, nonceSequence] = getNonceKeyAndSequence(userOp.nonce);
84
+ const userOpHash = userOpInfo.userOpHash;
85
+ // Create composite score: nonceSequence in upper 32 bits, maxFeePerGas in lower 32 bits.
86
+ const score = (nonceSequence << 32n) | (userOp.maxFeePerGas & 0xffffffffn);
87
+ // Serialize userOpInfo for storage.
88
+ const serializedUserOp = serialize(userOpInfo);
89
+ // Add to main ready queue.
90
+ pipeline.zadd(this.readyQueue, Number(score), userOpHash);
91
+ // Add to sender+nonceKey index for fast lookup.
92
+ const senderNonceQueue = this.getSenderNonceQueue(userOp);
93
+ pipeline.zadd(senderNonceQueue, Number(nonceSequence), userOpHash);
94
+ pipeline.expire(senderNonceQueue, this.senderNonceQueueTtl);
95
+ // Add to userOpHash map.
96
+ pipeline.hset(this.userOpHashMap, userOpHash, serializedUserOp);
97
+ // Add sender to deployment hash if this is a deployment.
98
+ if (isDeployment(userOp)) {
99
+ pipeline.hset(this.deploymentHashMap, userOp.sender, userOpHash);
100
+ }
101
+ }
102
+ await pipeline.exec();
103
+ }
104
+ // Removes userOps given their hashes and returns the userOpInfo objects.
105
+ async remove(userOpHashes) {
106
+ if (userOpHashes.length === 0)
107
+ return [];
108
+ // Get all serialized data in parallel.
109
+ const pipeline = this.redis.pipeline();
110
+ for (const hash of userOpHashes) {
111
+ pipeline.hget(this.userOpHashMap, hash);
112
+ }
113
+ const serializedResults = await pipeline.exec();
114
+ const removedUserOps = [];
115
+ const removalPipeline = this.redis.pipeline();
116
+ // Process each userOp that exists.
117
+ for (let i = 0; i < userOpHashes.length; i++) {
118
+ const serialized = serializedResults?.[i]?.[1];
119
+ if (!serialized)
120
+ continue;
121
+ const userOpHash = userOpHashes[i];
122
+ const userOpInfo = deserialize(serialized);
123
+ const { userOp } = userOpInfo;
124
+ const [, nonceSequence] = getNonceKeyAndSequence(userOp.nonce);
125
+ const senderNonceQueue = this.getSenderNonceQueue(userOp);
126
+ const isDeploymentOp = isDeployment(userOp);
127
+ // Remove from ready queue.
128
+ removalPipeline.zrem(this.readyQueue, userOpHash);
129
+ // Remove from sender nonceKey queue.
130
+ removalPipeline.zremrangebyscore(senderNonceQueue, Number(nonceSequence), Number(nonceSequence));
131
+ // Remove from hash lookup.
132
+ removalPipeline.hdel(this.userOpHashMap, userOpHash);
133
+ // Remove sender from deployment hash if this was a deployment.
134
+ if (isDeploymentOp) {
135
+ removalPipeline.hdel(this.deploymentHashMap, userOp.sender);
136
+ }
137
+ removedUserOps.push(userOpInfo);
138
+ }
139
+ // Execute all removals.
140
+ await removalPipeline.exec();
141
+ return removedUserOps;
142
+ }
143
+ async pop(count) {
144
+ // Pop from ready queue
145
+ const results = await this.redis.zpopmax(this.readyQueue, count);
146
+ if (!results || results.length === 0) {
147
+ return [];
148
+ }
149
+ // Extract hashes from results (zpopmax returns [member, score, member, score, ...])
150
+ const userOpHashes = [];
151
+ for (let i = 0; i < results.length; i += 2) {
152
+ userOpHashes.push(results[i]);
153
+ }
154
+ // Remove all userOps in batch
155
+ return await this.remove(userOpHashes);
156
+ }
157
+ async getQueuedUserOps(userOp) {
158
+ const [, nonceSequence] = getNonceKeyAndSequence(userOp.nonce);
159
+ const senderNonceQueue = this.getSenderNonceQueue(userOp);
160
+ // Get all userOpHashes with nonce sequence lower than the input
161
+ // ZRANGEBYSCORE returns elements with scores between min and max
162
+ // We want scores from 0 to (nonceSequence - 1)
163
+ const userOpHashes = await this.redis.zrangebyscore(senderNonceQueue, 0, Number(nonceSequence) - 1);
164
+ if (userOpHashes.length === 0)
165
+ return [];
166
+ // Fetch serialized data for each hash
167
+ const pipeline = this.redis.pipeline();
168
+ for (const hash of userOpHashes) {
169
+ pipeline.hget(this.userOpHashMap, hash);
170
+ }
171
+ const results = await pipeline.exec();
172
+ // Deserialize and extract userOps
173
+ return (results || [])
174
+ .map((result) => result?.[1])
175
+ .filter((serialized) => serialized !== null)
176
+ .map((serialized) => deserialize(serialized).userOp);
177
+ }
178
+ // These methods aren't implemented
179
+ dumpLocal() {
180
+ return Promise.resolve([]); // We can't dump from redis as the latency is too high
181
+ }
182
+ clear() {
183
+ throw new Error("Not implemented: clear");
184
+ }
185
+ // Skip limit checks when using Redis
186
+ validateQueuedLimit() {
187
+ return true;
188
+ }
189
+ validateParallelLimit() {
190
+ return true;
191
+ }
192
+ }
193
+ export const createRedisOutstandingQueue = ({ config, entryPoint, redisEndpoint, logger }) => {
194
+ return new RedisOutstandingQueue({
195
+ config,
196
+ entryPoint,
197
+ redisEndpoint,
198
+ logger
199
+ });
200
+ };
201
+ //# sourceMappingURL=redis.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redis.js","sourceRoot":"","sources":["../../../store/outstanding/redis.ts"],"names":[],"mappings":"AAAA,OAAO,EAKH,gBAAgB,EACnB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAClE,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/B,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAIlC,MAAM,SAAS,GAAG,CAAC,UAAsB,EAAU,EAAE;IACjD,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAC3C,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CACnD,CAAA;AACL,CAAC,CAAA;AAED,MAAM,WAAW,GAAG,CAAC,IAAY,EAAc,EAAE;IAC7C,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IAC/B,OAAO,gBAAgB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;AACzC,CAAC,CAAA;AAED,MAAM,qBAAqB;IACf,KAAK,CAAO;IAEZ,oBAAoB,CAAQ,CAAC,kCAAkC;IAC/D,UAAU,CAAQ,CAAC,uFAAuF;IAC1G,aAAa,CAAQ,CAAC,wBAAwB;IAC9C,iBAAiB,CAAQ,CAAC,kCAAkC;IAC5D,mBAAmB,CAAQ,CAAC,yCAAyC;IAE7E,YAAY,EACR,MAAM,EACN,UAAU,EACV,aAAa,EACb,MAAM,EAMT;QACG,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC,aAAa,EAAE,EAAE,CAAC,CAAA;QAEzC,6BAA6B;QA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C7B,MAAM;QACN,UAAU;QACV,aAAa;QACb,MAAM;KACT,CAAC,CAAA;AACN,CAAC,CAAA"}
@@ -0,0 +1,18 @@
1
+ import type { HexData32, UserOpInfo, UserOperation } from "../../types/index.js";
2
+ export type ConflictingOutstandingType = {
3
+ reason: "conflicting_nonce" | "conflicting_deployment";
4
+ userOpInfo: UserOpInfo;
5
+ } | undefined;
6
+ export interface OutstandingStore {
7
+ contains(userOpHash: HexData32): Promise<boolean>;
8
+ pop(count: number): Promise<UserOpInfo[]>;
9
+ popConflicting(userOp: UserOperation): Promise<ConflictingOutstandingType>;
10
+ add(userOpInfos: UserOpInfo[]): Promise<void>;
11
+ remove(userOpHash: HexData32[]): Promise<UserOpInfo[]>;
12
+ getQueuedUserOps(userOp: UserOperation): Promise<UserOperation[]>;
13
+ dumpLocal(): Promise<UserOpInfo[]>;
14
+ clear(): Promise<void>;
15
+ validateQueuedLimit(userOp: UserOperation): boolean;
16
+ validateParallelLimit(userOp: UserOperation): boolean;
17
+ }
18
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../store/outstanding/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ import type { Address } from "viem";
2
+ import type { AltoConfig } from "../../createConfig.js";
3
+ import { type ProcessingStore } from "../index.js";
4
+ export declare function createProcessingStore({ config, entryPoint }: {
5
+ config: AltoConfig;
6
+ entryPoint: Address;
7
+ }): ProcessingStore;
8
+ export * from "./types.js";
9
+ export * from "./memory.js";
10
+ export * from "./redis.js";
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,17 @@
1
+ import { InMemoryProcessingStore, RedisProcessingStore } from "../index.js";
2
+ // Holds all userOps that have been removed from outstanding pool and are being processed.
3
+ // UserOps are are removed from this store when they have successfully landed onchain or when they are cancelled.
4
+ export function createProcessingStore({ config, entryPoint }) {
5
+ if (config.enableHorizontalScaling && config.redisEndpoint) {
6
+ return new RedisProcessingStore({
7
+ config,
8
+ entryPoint,
9
+ redisEndpoint: config.redisEndpoint
10
+ });
11
+ }
12
+ return new InMemoryProcessingStore();
13
+ }
14
+ export * from "./types.js";
15
+ export * from "./memory.js";
16
+ export * from "./redis.js";
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../store/processing/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACH,uBAAuB,EAEvB,oBAAoB,EACvB,MAAM,aAAa,CAAA;AAEpB,0FAA0F;AAC1F,iHAAiH;AACjH,MAAM,UAAU,qBAAqB,CAAC,EAClC,MAAM,EACN,UAAU,EAIb;IACG,IAAI,MAAM,CAAC,uBAAuB,IAAI,MAAM,CAAC,aAAa,EAAE,CAAC;QACzD,OAAO,IAAI,oBAAoB,CAAC;YAC5B,MAAM;YACN,UAAU;YACV,aAAa,EAAE,MAAM,CAAC,aAAa;SACtC,CAAC,CAAA;IACN,CAAC;IACD,OAAO,IAAI,uBAAuB,EAAE,CAAA;AACxC,CAAC;AAED,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA"}
@@ -0,0 +1,14 @@
1
+ import type { UserOpInfo, UserOperation } from "../../types/index.js";
2
+ import type { Hex } from "viem";
3
+ import type { ProcessingStore } from "./types.js";
4
+ export declare class InMemoryProcessingStore implements ProcessingStore {
5
+ private processingUserOpsSet;
6
+ private processingSenderNonceSet;
7
+ private processingDeploymentSet;
8
+ private encodeSenderNonceId;
9
+ addProcessing(userOpInfo: UserOpInfo): Promise<void>;
10
+ removeProcessing(userOpInfo: UserOpInfo): Promise<void>;
11
+ isProcessing(userOpHash: Hex): Promise<boolean>;
12
+ wouldConflict(userOp: UserOperation): Promise<"nonce_conflict" | "deployment_conflict" | undefined>;
13
+ }
14
+ //# sourceMappingURL=memory.d.ts.map
@@ -0,0 +1,46 @@
1
+ import { isDeployment } from "../../utils/index.js";
2
+ export class InMemoryProcessingStore {
3
+ // Use Sets for boolean membership tracking (matching Redis store)
4
+ processingUserOpsSet = new Set();
5
+ processingSenderNonceSet = new Set();
6
+ processingDeploymentSet = new Set();
7
+ encodeSenderNonceId(sender, nonce) {
8
+ return `${sender}:${nonce}`;
9
+ }
10
+ async addProcessing(userOpInfo) {
11
+ const { userOpHash, userOp } = userOpInfo;
12
+ const isDeploymentOp = isDeployment(userOp);
13
+ const senderNonceId = this.encodeSenderNonceId(userOp.sender, userOp.nonce);
14
+ // Add to processing sets
15
+ this.processingUserOpsSet.add(userOpHash);
16
+ this.processingSenderNonceSet.add(senderNonceId);
17
+ if (isDeploymentOp) {
18
+ this.processingDeploymentSet.add(userOp.sender);
19
+ }
20
+ }
21
+ async removeProcessing(userOpInfo) {
22
+ const { userOpHash, userOp } = userOpInfo;
23
+ const senderNonceId = this.encodeSenderNonceId(userOp.sender, userOp.nonce);
24
+ // Remove from all sets
25
+ this.processingUserOpsSet.delete(userOpHash);
26
+ this.processingSenderNonceSet.delete(senderNonceId);
27
+ this.processingDeploymentSet.delete(userOp.sender);
28
+ }
29
+ async isProcessing(userOpHash) {
30
+ return this.processingUserOpsSet.has(userOpHash);
31
+ }
32
+ async wouldConflict(userOp) {
33
+ const isDeploymentOp = isDeployment(userOp);
34
+ const senderNonceId = this.encodeSenderNonceId(userOp.sender, userOp.nonce);
35
+ // Check deployment conflict first
36
+ if (isDeploymentOp && this.processingDeploymentSet.has(userOp.sender)) {
37
+ return "deployment_conflict";
38
+ }
39
+ // Check nonce conflict
40
+ if (this.processingSenderNonceSet.has(senderNonceId)) {
41
+ return "nonce_conflict";
42
+ }
43
+ return undefined;
44
+ }
45
+ }
46
+ //# sourceMappingURL=memory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory.js","sourceRoot":"","sources":["../../../store/processing/memory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAA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IACtD,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,UAAe;QAC9B,OAAO,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;IACpD,CAAC;IAED,KAAK,CAAC,aAAa,CACf,MAAqB;QAErB,MAAM,cAAc,GAAG,YAAY,CAAC,MAAM,CAAC,CAAA;QAC3C,MAAM,aAAa,GAAG,IAAI,CAAC,mBAAmB,CAC1C,MAAM,CAAC,MAAM,EACb,MAAM,CAAC,KAAK,CACf,CAAA;QAED,kCAAkC;QAClC,IAAI,cAAc,IAAI,IAAI,CAAC,uBAAuB,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;YACpE,OAAO,qBAAqB,CAAA;QAChC,CAAC;QAED,uBAAuB;QACvB,IAAI,IAAI,CAAC,wBAAwB,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC;YACnD,OAAO,gBAAgB,CAAA;QAC3B,CAAC;QAED,OAAO,SAAS,CAAA;IACpB,CAAC;CACJ"}
@@ -0,0 +1,21 @@
1
+ import type { ProcessingStore } from "../index.js";
2
+ import type { UserOpInfo, UserOperation } from "../../types/index.js";
3
+ import type { Address, Hex } from "viem";
4
+ import type { AltoConfig } from "../../createConfig.js";
5
+ export declare class RedisProcessingStore implements ProcessingStore {
6
+ private redis;
7
+ private processingUserOpsSet;
8
+ private processingSenderNonceSet;
9
+ private processingDeploymentSet;
10
+ private encodeSenderNonceId;
11
+ constructor({ config, entryPoint, redisEndpoint }: {
12
+ config: AltoConfig;
13
+ entryPoint: Address;
14
+ redisEndpoint: string;
15
+ });
16
+ addProcessing(userOpInfo: UserOpInfo): Promise<void>;
17
+ removeProcessing(userOpInfo: UserOpInfo): Promise<void>;
18
+ isProcessing(userOpHash: Hex): Promise<boolean>;
19
+ wouldConflict(userOp: UserOperation): Promise<"nonce_conflict" | "deployment_conflict" | undefined>;
20
+ }
21
+ //# sourceMappingURL=redis.d.ts.map