@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.
- package/esm/cli/config/bundler.d.ts +12 -0
- package/esm/cli/config/bundler.js +2 -0
- package/esm/cli/config/bundler.js.map +1 -1
- package/esm/cli/config/options.js +11 -0
- package/esm/cli/config/options.js.map +1 -1
- package/esm/cli/setupServer.js +1 -1
- package/esm/cli/setupServer.js.map +1 -1
- package/esm/cli/shutDown.js +15 -55
- package/esm/cli/shutDown.js.map +1 -1
- package/esm/executor/bundleManager.d.ts +1 -1
- package/esm/executor/bundleManager.js +47 -34
- package/esm/executor/bundleManager.js.map +1 -1
- package/esm/executor/executorManager.js +3 -4
- package/esm/executor/executorManager.js.map +1 -1
- package/esm/executor/senderManager/createRedisSenderManager.js +1 -2
- package/esm/executor/senderManager/createRedisSenderManager.js.map +1 -1
- package/esm/handlers/arbitrumGasPriceManager.js +2 -2
- package/esm/handlers/gasPriceManager.js +3 -3
- package/esm/handlers/mantleGasPriceManager.js +4 -4
- package/esm/handlers/optimismManager.js +1 -1
- package/esm/mempool/mempool.d.ts +3 -11
- package/esm/mempool/mempool.js +93 -96
- package/esm/mempool/mempool.js.map +1 -1
- package/esm/mempool/monitoring.d.ts +1 -1
- package/esm/mempool/monitoring.js +30 -21
- package/esm/mempool/monitoring.js.map +1 -1
- package/esm/receiptCache/createMemoryReceiptCache.js +8 -5
- package/esm/receiptCache/createMemoryReceiptCache.js.map +1 -1
- package/esm/receiptCache/createRedisReceiptCache.js +13 -11
- package/esm/receiptCache/createRedisReceiptCache.js.map +1 -1
- package/esm/receiptCache/index.d.ts +4 -1
- package/esm/receiptCache/index.js.map +1 -1
- package/esm/rpc/methods/eth_sendUserOperation.js +6 -7
- package/esm/rpc/methods/eth_sendUserOperation.js.map +1 -1
- package/esm/rpc/methods/pimlico_sendUserOperationNow.js +8 -11
- package/esm/rpc/methods/pimlico_sendUserOperationNow.js.map +1 -1
- package/esm/store/createMempoolStore.d.ts +1 -1
- package/esm/store/createMempoolStore.js +51 -143
- package/esm/store/createMempoolStore.js.map +1 -1
- package/esm/store/index.d.ts +4 -75
- package/esm/store/index.js +4 -1
- package/esm/store/index.js.map +1 -1
- package/esm/store/outstanding/index.d.ts +13 -0
- package/esm/store/outstanding/index.js +16 -0
- package/esm/store/outstanding/index.js.map +1 -0
- package/esm/store/{createMemoryOutstandingStore.d.ts → outstanding/memory.d.ts} +11 -10
- package/esm/store/outstanding/memory.js +249 -0
- package/esm/store/outstanding/memory.js.map +1 -0
- package/esm/store/outstanding/redis.d.ts +11 -0
- package/esm/store/outstanding/redis.js +201 -0
- package/esm/store/outstanding/redis.js.map +1 -0
- package/esm/store/outstanding/types.d.ts +18 -0
- package/esm/store/outstanding/types.js +2 -0
- package/esm/store/outstanding/types.js.map +1 -0
- package/esm/store/processing/index.d.ts +11 -0
- package/esm/store/processing/index.js +17 -0
- package/esm/store/processing/index.js.map +1 -0
- package/esm/store/processing/memory.d.ts +14 -0
- package/esm/store/processing/memory.js +46 -0
- package/esm/store/processing/memory.js.map +1 -0
- package/esm/store/processing/redis.d.ts +21 -0
- package/esm/store/processing/redis.js +69 -0
- package/esm/store/processing/redis.js.map +1 -0
- package/esm/store/processing/types.d.ts +9 -0
- package/esm/store/processing/types.js +2 -0
- package/esm/store/processing/types.js.map +1 -0
- package/esm/store/types.d.ts +49 -0
- package/esm/store/types.js +2 -0
- package/esm/store/types.js.map +1 -0
- package/esm/utils/helpers.d.ts +0 -1
- package/esm/utils/helpers.js +1 -8
- package/esm/utils/helpers.js.map +1 -1
- package/esm/utils/minMaxQueue/createRedisMinMaxQueue.d.ts +23 -2
- package/esm/utils/minMaxQueue/createRedisMinMaxQueue.js +83 -60
- package/esm/utils/minMaxQueue/createRedisMinMaxQueue.js.map +1 -1
- package/esm/utils/minMaxQueue/index.d.ts +2 -2
- package/esm/utils/minMaxQueue/index.js +2 -2
- package/esm/utils/minMaxQueue/index.js.map +1 -1
- package/esm/utils/preVerificationGasCalulator.d.ts +0 -2
- package/esm/utils/preVerificationGasCalulator.js +2 -2
- package/esm/utils/preVerificationGasCalulator.js.map +1 -1
- package/esm/utils/userop.d.ts +4 -50
- package/esm/utils/userop.js +61 -196
- package/esm/utils/userop.js.map +1 -1
- package/package.json +1 -1
- package/esm/cli/config/redisKeys.d.ts +0 -9
- package/esm/cli/config/redisKeys.js +0 -16
- package/esm/cli/config/redisKeys.js.map +0 -1
- package/esm/store/createMemoryOutstandingStore.js +0 -240
- package/esm/store/createMemoryOutstandingStore.js.map +0 -1
- package/esm/store/createRedisOutstandingStore.d.ts +0 -28
- package/esm/store/createRedisOutstandingStore.js +0 -341
- package/esm/store/createRedisOutstandingStore.js.map +0 -1
- package/esm/store/createRedisStore.d.ts +0 -10
- package/esm/store/createRedisStore.js +0 -128
- package/esm/store/createRedisStore.js.map +0 -1
- package/esm/store/createStore.d.ts +0 -6
- package/esm/store/createStore.js +0 -66
- package/esm/store/createStore.js.map +0 -1
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
import { getNonceKeyAndSequence, isVersion06, 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
|
-
logger;
|
|
12
|
-
constructor(config) {
|
|
13
|
-
this.config = config;
|
|
14
|
-
this.logger = config.getLogger({ module: "memory-outstanding-queue" }, {
|
|
15
|
-
level: config.logLevel
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
dump() {
|
|
19
|
-
return [...Array.from(this.pendingOps.values()).flat()];
|
|
20
|
-
}
|
|
21
|
-
// Adds userOp to queue and maintains sorting by gas price.
|
|
22
|
-
addToPriorityQueue(userOpInfo) {
|
|
23
|
-
this.priorityQueue.push(userOpInfo);
|
|
24
|
-
this.priorityQueue.sort((a, b) => {
|
|
25
|
-
const userOpA = a.userOp;
|
|
26
|
-
const userOpB = b.userOp;
|
|
27
|
-
return Number(userOpA.maxFeePerGas - userOpB.maxFeePerGas);
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
validateQueuedLimit(userOp) {
|
|
31
|
-
const outstandingOps = this.dump();
|
|
32
|
-
const parallelUserOpsCount = outstandingOps.filter((userOpInfo) => {
|
|
33
|
-
const { userOp: mempoolUserOp } = userOpInfo;
|
|
34
|
-
return mempoolUserOp.sender === userOp.sender;
|
|
35
|
-
}).length;
|
|
36
|
-
if (parallelUserOpsCount > this.config.mempoolMaxParallelOps) {
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
return true;
|
|
40
|
-
}
|
|
41
|
-
validateParallelLimit(userOp) {
|
|
42
|
-
const outstandingOps = this.dump();
|
|
43
|
-
const [nonceKey] = getNonceKeyAndSequence(userOp.nonce);
|
|
44
|
-
const queuedUserOpsCount = outstandingOps.filter((userOpInfo) => {
|
|
45
|
-
const { userOp: mempoolUserOp } = userOpInfo;
|
|
46
|
-
const [opNonceKey] = getNonceKeyAndSequence(mempoolUserOp.nonce);
|
|
47
|
-
return (mempoolUserOp.sender === userOp.sender &&
|
|
48
|
-
opNonceKey === nonceKey);
|
|
49
|
-
}).length;
|
|
50
|
-
if (queuedUserOpsCount > this.config.mempoolMaxQueuedOps) {
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
return true;
|
|
54
|
-
}
|
|
55
|
-
popConflicting(userOp) {
|
|
56
|
-
const outstandingOps = this.dump();
|
|
57
|
-
let conflictingReason;
|
|
58
|
-
for (const userOpInfo of outstandingOps) {
|
|
59
|
-
const { userOp: mempoolUserOp } = userOpInfo;
|
|
60
|
-
const isSameSender = mempoolUserOp.sender === userOp.sender;
|
|
61
|
-
if (isSameSender && mempoolUserOp.nonce === userOp.nonce) {
|
|
62
|
-
this.remove(userOpInfo.userOpHash);
|
|
63
|
-
conflictingReason = {
|
|
64
|
-
reason: "conflicting_nonce",
|
|
65
|
-
userOpInfo
|
|
66
|
-
};
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
const isConflictingV6Deployment = isVersion06(userOp) &&
|
|
70
|
-
isVersion06(mempoolUserOp) &&
|
|
71
|
-
userOp.initCode &&
|
|
72
|
-
userOp.initCode !== "0x" &&
|
|
73
|
-
mempoolUserOp.initCode &&
|
|
74
|
-
mempoolUserOp.initCode !== "0x" &&
|
|
75
|
-
isSameSender;
|
|
76
|
-
const isConflictingV7Deployment = isVersion07(userOp) &&
|
|
77
|
-
isVersion07(mempoolUserOp) &&
|
|
78
|
-
userOp.factory &&
|
|
79
|
-
userOp.factory !== "0x" &&
|
|
80
|
-
mempoolUserOp.factory &&
|
|
81
|
-
mempoolUserOp.factory !== "0x" &&
|
|
82
|
-
isSameSender;
|
|
83
|
-
const isConflictingDeployment = isConflictingV6Deployment || isConflictingV7Deployment;
|
|
84
|
-
if (isConflictingDeployment) {
|
|
85
|
-
this.remove(userOpInfo.userOpHash);
|
|
86
|
-
conflictingReason = {
|
|
87
|
-
reason: "conflicting_deployment",
|
|
88
|
-
userOpInfo
|
|
89
|
-
};
|
|
90
|
-
break;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
return Promise.resolve(conflictingReason);
|
|
94
|
-
}
|
|
95
|
-
async contains(userOpHash) {
|
|
96
|
-
for (const userOpInfos of this.pendingOps.values()) {
|
|
97
|
-
if (userOpInfos.some((info) => info.userOpHash === userOpHash)) {
|
|
98
|
-
return true;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
return false;
|
|
102
|
-
}
|
|
103
|
-
peek() {
|
|
104
|
-
if (this.priorityQueue.length === 0) {
|
|
105
|
-
return Promise.resolve(undefined);
|
|
106
|
-
}
|
|
107
|
-
return Promise.resolve(this.priorityQueue[0]);
|
|
108
|
-
}
|
|
109
|
-
pop() {
|
|
110
|
-
const userOpInfo = this.priorityQueue.shift();
|
|
111
|
-
if (!userOpInfo) {
|
|
112
|
-
return Promise.resolve(undefined);
|
|
113
|
-
}
|
|
114
|
-
const pendingOpsSlot = senderNonceSlot(userOpInfo.userOp);
|
|
115
|
-
const backlogOps = this.pendingOps.get(pendingOpsSlot);
|
|
116
|
-
// This should never throw.
|
|
117
|
-
if (!backlogOps?.shift()) {
|
|
118
|
-
throw new Error("FATAL: No pending userOps for sender");
|
|
119
|
-
}
|
|
120
|
-
// Move next pending userOp into priorityQueue if exist.
|
|
121
|
-
if (backlogOps.length > 0) {
|
|
122
|
-
this.addToPriorityQueue(backlogOps[0]);
|
|
123
|
-
}
|
|
124
|
-
// Cleanup.
|
|
125
|
-
if (backlogOps.length === 0) {
|
|
126
|
-
this.pendingOps.delete(pendingOpsSlot);
|
|
127
|
-
}
|
|
128
|
-
return Promise.resolve(userOpInfo);
|
|
129
|
-
}
|
|
130
|
-
async add(userOpInfo) {
|
|
131
|
-
const { userOp, userOpHash } = userOpInfo;
|
|
132
|
-
const [nonceKey] = getNonceKeyAndSequence(userOp.nonce);
|
|
133
|
-
const pendingOpsSlot = senderNonceSlot(userOp);
|
|
134
|
-
const backlogOps = (() => {
|
|
135
|
-
if (this.pendingOps.has(pendingOpsSlot)) {
|
|
136
|
-
return this.pendingOps.get(pendingOpsSlot);
|
|
137
|
-
}
|
|
138
|
-
this.pendingOps.set(pendingOpsSlot, []);
|
|
139
|
-
return this.pendingOps.get(pendingOpsSlot);
|
|
140
|
-
})();
|
|
141
|
-
if (!backlogOps) {
|
|
142
|
-
throw new Error("FATAL: No pending operations found for userOpHash");
|
|
143
|
-
}
|
|
144
|
-
// Note: the userOpInfo is always added to backlogOps, because we are pushing to a reference
|
|
145
|
-
backlogOps.push(userOpInfo);
|
|
146
|
-
backlogOps
|
|
147
|
-
.map((sop) => sop.userOp)
|
|
148
|
-
.sort((a, b) => {
|
|
149
|
-
const [, aNonceSeq] = getNonceKeyAndSequence(a.nonce);
|
|
150
|
-
const [, bNonceSeq] = getNonceKeyAndSequence(b.nonce);
|
|
151
|
-
return Number(aNonceSeq) - Number(bNonceSeq);
|
|
152
|
-
});
|
|
153
|
-
const lowestUserOpHash = backlogOps[0].userOpHash;
|
|
154
|
-
// If lowest, remove any existing userOp with same sender and nonceKey and add current userOp to priorityQueue.
|
|
155
|
-
if (lowestUserOpHash === userOpHash) {
|
|
156
|
-
this.priorityQueue = this.priorityQueue.filter((userOpInfo) => {
|
|
157
|
-
const pendingUserOp = userOpInfo.userOp;
|
|
158
|
-
const isSameSender = pendingUserOp.sender === userOp.sender;
|
|
159
|
-
const isSameNonceKey = getNonceKeyAndSequence(pendingUserOp.nonce)[0] === nonceKey;
|
|
160
|
-
return !(isSameSender && isSameNonceKey);
|
|
161
|
-
});
|
|
162
|
-
this.addToPriorityQueue(userOpInfo);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
async getQueuedUserOps(userOp) {
|
|
166
|
-
const [nonceKey, nonceSequence] = getNonceKeyAndSequence(userOp.nonce);
|
|
167
|
-
const outstandingOps = this.dump();
|
|
168
|
-
const outstanding = outstandingOps.filter((userOpInfo) => {
|
|
169
|
-
const { userOp: mempoolUserOp } = userOpInfo;
|
|
170
|
-
const [mempoolNonceKey, mempoolNonceSequence] = getNonceKeyAndSequence(mempoolUserOp.nonce);
|
|
171
|
-
let isPaymasterSame = false;
|
|
172
|
-
if (isVersion07(userOp) && isVersion07(mempoolUserOp)) {
|
|
173
|
-
isPaymasterSame =
|
|
174
|
-
mempoolUserOp.paymaster === userOp.paymaster &&
|
|
175
|
-
!(mempoolUserOp.sender === userOp.sender &&
|
|
176
|
-
mempoolNonceKey === nonceKey &&
|
|
177
|
-
mempoolNonceSequence === nonceSequence) &&
|
|
178
|
-
userOp.paymaster !== null;
|
|
179
|
-
}
|
|
180
|
-
// Filter operations with the same sender and nonce key
|
|
181
|
-
// but with a lower nonce sequence
|
|
182
|
-
return ((mempoolUserOp.sender === userOp.sender &&
|
|
183
|
-
mempoolNonceKey === nonceKey &&
|
|
184
|
-
mempoolNonceSequence < nonceSequence) ||
|
|
185
|
-
isPaymasterSame);
|
|
186
|
-
});
|
|
187
|
-
return outstanding
|
|
188
|
-
.sort((a, b) => {
|
|
189
|
-
const aUserOp = a.userOp;
|
|
190
|
-
const bUserOp = b.userOp;
|
|
191
|
-
const [, aNonceValue] = getNonceKeyAndSequence(aUserOp.nonce);
|
|
192
|
-
const [, bNonceValue] = getNonceKeyAndSequence(bUserOp.nonce);
|
|
193
|
-
return Number(aNonceValue - bNonceValue);
|
|
194
|
-
})
|
|
195
|
-
.map((userOpInfo) => userOpInfo.userOp);
|
|
196
|
-
}
|
|
197
|
-
async remove(userOpHash) {
|
|
198
|
-
const priorityQueueIndex = this.priorityQueue.findIndex((info) => info.userOpHash === userOpHash);
|
|
199
|
-
if (priorityQueueIndex === -1) {
|
|
200
|
-
this.logger.info("tried to remove non-existent user op from mempool");
|
|
201
|
-
return false;
|
|
202
|
-
}
|
|
203
|
-
const userOpInfo = this.priorityQueue[priorityQueueIndex];
|
|
204
|
-
const pendingOpsSlot = senderNonceSlot(userOpInfo.userOp);
|
|
205
|
-
// Remove from priority queue
|
|
206
|
-
this.priorityQueue.splice(priorityQueueIndex, 1);
|
|
207
|
-
// Find and remove from pending ops
|
|
208
|
-
const backlogOps = this.pendingOps.get(pendingOpsSlot);
|
|
209
|
-
if (!backlogOps) {
|
|
210
|
-
throw new Error(`FATAL: No pending operations found for userOpHash ${userOpHash}`);
|
|
211
|
-
}
|
|
212
|
-
const backlogIndex = backlogOps.findIndex((info) => info.userOpHash === userOpHash);
|
|
213
|
-
if (backlogIndex === -1) {
|
|
214
|
-
throw new Error(`FATAL: UserOp with hash ${userOpHash} not found in backlog`);
|
|
215
|
-
}
|
|
216
|
-
backlogOps.splice(backlogIndex, 1);
|
|
217
|
-
// If this was the first operation and there are more in the backlog,
|
|
218
|
-
// add the new first operation to the priority queue
|
|
219
|
-
if (backlogIndex === 0 && backlogOps.length > 0) {
|
|
220
|
-
this.addToPriorityQueue(backlogOps[0]);
|
|
221
|
-
}
|
|
222
|
-
return true;
|
|
223
|
-
}
|
|
224
|
-
dumpLocal() {
|
|
225
|
-
return Promise.resolve(this.dump());
|
|
226
|
-
}
|
|
227
|
-
clear() {
|
|
228
|
-
this.priorityQueue = [];
|
|
229
|
-
this.pendingOps.clear();
|
|
230
|
-
return Promise.resolve();
|
|
231
|
-
}
|
|
232
|
-
// Adding findConflicting method to maintain compatibility with Store interface
|
|
233
|
-
findConflicting(userOp) {
|
|
234
|
-
return Promise.resolve(this.popConflicting(userOp));
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
export const createMemoryOutstandingQueue = ({ config }) => {
|
|
238
|
-
return new MemoryOutstanding(config);
|
|
239
|
-
};
|
|
240
|
-
//# sourceMappingURL=createMemoryOutstandingStore.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createMemoryOutstandingStore.js","sourceRoot":"","sources":["../../store/createMemoryOutstandingStore.ts"],"names":[],"mappings":"AAIA,OAAO,EACH,sBAAsB,EACtB,WAAW,EACX,WAAW,EACd,MAAM,iBAAiB,CAAA;AAExB,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;IAKN;IAJZ,UAAU,GAA8B,IAAI,GAAG,EAAE,CAAA;IACjD,aAAa,GAAiB,EAAE,CAAA;IAChC,MAAM,CAAQ;IAEtB,YAAoB,MAAkB;QAAlB,WAAM,GAAN,MAAM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,CAAC,CAAC,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CACX,2BAA2B,UAAU,uBAAuB,CAC/D,CAAA;QACL,CAAC;QAED,UAAU,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC,CAAA;QAElC,qEAAqE;QACrE,oDAAoD;QACpD,IAAI,YAAY,KAAK,CAAC,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC9C,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAA;QAC1C,CAAC;QAED,OAAO,IAAI,CAAA;IACf,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,OAAO,OAAO,CAAC,OAAO,EAAE,CAAA;IAC5B,CAAC;IAED,+EAA+E;IAC/E,eAAe,CACX,MAAqB;QAErB,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAA;IACvD,CAAC;CACJ;AAED,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,EACzC,MAAM,EACe,EAAoB,EAAE;IAC3C,OAAO,IAAI,iBAAiB,CAAC,MAAM,CAAC,CAAA;AACxC,CAAC,CAAA"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { type Address } from "../types/index.js";
|
|
2
|
-
import { type ChainableCommander, Redis } from "ioredis";
|
|
3
|
-
import type { OutstandingStore } from "./index.js";
|
|
4
|
-
import type { AltoConfig } from "../createConfig.js";
|
|
5
|
-
export declare class RedisHash {
|
|
6
|
-
private redis;
|
|
7
|
-
private keyName;
|
|
8
|
-
constructor(redis: Redis, keyName: string);
|
|
9
|
-
get keyPath(): string;
|
|
10
|
-
set({ key, value, multi }: {
|
|
11
|
-
key: string;
|
|
12
|
-
value: string;
|
|
13
|
-
multi?: ChainableCommander | Redis;
|
|
14
|
-
}): Promise<void>;
|
|
15
|
-
get(field: string): Promise<string | null>;
|
|
16
|
-
delete({ key, multi }: {
|
|
17
|
-
key: string;
|
|
18
|
-
multi?: ChainableCommander | Redis;
|
|
19
|
-
}): Promise<void>;
|
|
20
|
-
exists(field: string): Promise<boolean>;
|
|
21
|
-
getAll(): Promise<Record<string, string>>;
|
|
22
|
-
}
|
|
23
|
-
export declare const createRedisOutstandingQueue: ({ config, entryPoint, redisEndpoint }: {
|
|
24
|
-
config: AltoConfig;
|
|
25
|
-
entryPoint: Address;
|
|
26
|
-
redisEndpoint: string;
|
|
27
|
-
}) => OutstandingStore;
|
|
28
|
-
//# sourceMappingURL=createRedisOutstandingStore.d.ts.map
|
|
@@ -1,341 +0,0 @@
|
|
|
1
|
-
import { userOpInfoSchema } from "../types/index.js";
|
|
2
|
-
import { Redis } from "ioredis";
|
|
3
|
-
import { toHex } from "viem/utils";
|
|
4
|
-
import { getNonceKeyAndSequence, isVersion06, isVersion07 } from "../utils/userop.js";
|
|
5
|
-
const serializeUserOpInfo = (userOpInfo) => {
|
|
6
|
-
return JSON.stringify(userOpInfo, (_, value) => typeof value === "bigint" ? toHex(value) : value);
|
|
7
|
-
};
|
|
8
|
-
const deserializeUserOpInfo = (data) => {
|
|
9
|
-
try {
|
|
10
|
-
const parsed = JSON.parse(data);
|
|
11
|
-
const result = userOpInfoSchema.safeParse(parsed);
|
|
12
|
-
if (!result.success) {
|
|
13
|
-
throw new Error(`Failed to parse UserOpInfo: ${result.error.message}`);
|
|
14
|
-
}
|
|
15
|
-
return result.data;
|
|
16
|
-
}
|
|
17
|
-
catch (error) {
|
|
18
|
-
if (error instanceof Error) {
|
|
19
|
-
throw new Error(`UserOpInfo deserialization failed: ${error.message}`);
|
|
20
|
-
}
|
|
21
|
-
throw new Error("UserOpInfo deserialization failed with unknown error");
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
const isDeployment = (userOp) => {
|
|
25
|
-
const isV6Deployment = isVersion06(userOp) && !!userOp.initCode && userOp.initCode !== "0x";
|
|
26
|
-
const isV7Deployment = isVersion07(userOp) && !!userOp.factory && userOp.factory !== "0x";
|
|
27
|
-
return isV6Deployment || isV7Deployment;
|
|
28
|
-
};
|
|
29
|
-
class RedisSortedSet {
|
|
30
|
-
redis;
|
|
31
|
-
keyName;
|
|
32
|
-
constructor(redis, keyName) {
|
|
33
|
-
this.redis = redis;
|
|
34
|
-
this.keyName = keyName;
|
|
35
|
-
}
|
|
36
|
-
get keyPath() {
|
|
37
|
-
return this.keyName;
|
|
38
|
-
}
|
|
39
|
-
async add({ member, score, multi = this.redis }) {
|
|
40
|
-
await multi.zadd(this.keyPath, score, member);
|
|
41
|
-
}
|
|
42
|
-
async remove({ member, multi = this.redis }) {
|
|
43
|
-
await multi.zrem(this.keyPath, member);
|
|
44
|
-
}
|
|
45
|
-
getByScoreRange(min, max) {
|
|
46
|
-
return Promise.resolve(this.redis.zrangebyscore(this.keyPath, min, max));
|
|
47
|
-
}
|
|
48
|
-
getByRankRange(start, stop) {
|
|
49
|
-
return Promise.resolve(this.redis.zrange(this.keyPath, start, stop));
|
|
50
|
-
}
|
|
51
|
-
async popMax() {
|
|
52
|
-
const result = (await this.redis.zmpop(1, [this.keyPath], "MAX", "COUNT", 1));
|
|
53
|
-
return result && result[1].length > 0 ? result[1][0][0] : undefined;
|
|
54
|
-
}
|
|
55
|
-
async popMin() {
|
|
56
|
-
const result = (await this.redis.zmpop(1, [this.keyPath], "MIN", "COUNT", 1));
|
|
57
|
-
return result && result[1].length > 0 ? result[1][0][0] : undefined;
|
|
58
|
-
}
|
|
59
|
-
async delete({ multi = this.redis }) {
|
|
60
|
-
await multi.del(this.keyPath);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
export class RedisHash {
|
|
64
|
-
redis;
|
|
65
|
-
keyName;
|
|
66
|
-
constructor(redis, keyName) {
|
|
67
|
-
this.redis = redis;
|
|
68
|
-
this.keyName = keyName;
|
|
69
|
-
}
|
|
70
|
-
get keyPath() {
|
|
71
|
-
return this.keyName;
|
|
72
|
-
}
|
|
73
|
-
async set({ key, value, multi = this.redis }) {
|
|
74
|
-
await multi.hset(this.keyPath, key, value);
|
|
75
|
-
}
|
|
76
|
-
get(field) {
|
|
77
|
-
return Promise.resolve(this.redis.hget(this.keyPath, field));
|
|
78
|
-
}
|
|
79
|
-
async delete({ key, multi = this.redis }) {
|
|
80
|
-
await multi.hdel(this.keyPath, key);
|
|
81
|
-
}
|
|
82
|
-
async exists(field) {
|
|
83
|
-
return (await this.redis.hexists(this.keyPath, field)) === 1;
|
|
84
|
-
}
|
|
85
|
-
getAll() {
|
|
86
|
-
return Promise.resolve(this.redis.hgetall(this.keyPath));
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
class RedisOutstandingQueue {
|
|
90
|
-
redis;
|
|
91
|
-
chainId;
|
|
92
|
-
entryPoint;
|
|
93
|
-
// Redis data structures
|
|
94
|
-
readyOpsQueue; // gasPrice -> pendingOpsKey
|
|
95
|
-
userOpHashLookup; // userOpHash -> pendingOpsKey
|
|
96
|
-
factoryLookup; // sender -> userOpHash
|
|
97
|
-
constructor({ config, entryPoint, redisEndpoint }) {
|
|
98
|
-
this.redis = new Redis(redisEndpoint, {});
|
|
99
|
-
this.chainId = config.chainId;
|
|
100
|
-
this.entryPoint = entryPoint;
|
|
101
|
-
// Initialize Redis data structures
|
|
102
|
-
const factoryLookupKey = `${this.chainId}:outstanding:factory-lookup:${this.entryPoint}`;
|
|
103
|
-
const userOpHashLookupKey = `${this.chainId}:outstanding:user-op-hash-index:${this.entryPoint}`;
|
|
104
|
-
const readyOpsQueueKey = `${this.chainId}:outstanding:pending-queue:${this.entryPoint}`;
|
|
105
|
-
this.readyOpsQueue = new RedisSortedSet(this.redis, readyOpsQueueKey);
|
|
106
|
-
this.userOpHashLookup = new RedisHash(this.redis, userOpHashLookupKey);
|
|
107
|
-
this.factoryLookup = new RedisHash(this.redis, factoryLookupKey);
|
|
108
|
-
}
|
|
109
|
-
// Helpers
|
|
110
|
-
getPendingOpsSet(userOp) {
|
|
111
|
-
return new RedisSortedSet(this.redis, this.getPendingOpsKey(userOp));
|
|
112
|
-
}
|
|
113
|
-
getPendingOpsKey(userOp) {
|
|
114
|
-
const [nonceKey] = getNonceKeyAndSequence(userOp.nonce);
|
|
115
|
-
const fingerprint = `${userOp.sender}-${toHex(nonceKey)}`;
|
|
116
|
-
return `${this.chainId}:outstanding:pending-ops:${this.entryPoint}:${fingerprint}`;
|
|
117
|
-
}
|
|
118
|
-
// OutstandingStore methods
|
|
119
|
-
contains(userOpHash) {
|
|
120
|
-
return Promise.resolve(this.userOpHashLookup.exists(userOpHash));
|
|
121
|
-
}
|
|
122
|
-
async popConflicting(userOp) {
|
|
123
|
-
const [, nonceSeq] = getNonceKeyAndSequence(userOp.nonce);
|
|
124
|
-
const pendingOpsSet = this.getPendingOpsSet(userOp);
|
|
125
|
-
// Check for operations with the same nonce sequence
|
|
126
|
-
const conflictingNonce = await pendingOpsSet.getByScoreRange(Number(nonceSeq), Number(nonceSeq));
|
|
127
|
-
if (conflictingNonce.length > 0) {
|
|
128
|
-
const conflicting = deserializeUserOpInfo(conflictingNonce[0]);
|
|
129
|
-
await this.remove(conflicting.userOpHash);
|
|
130
|
-
return {
|
|
131
|
-
reason: "conflicting_nonce",
|
|
132
|
-
userOpInfo: conflicting
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
// Check for conflicting deployments to the same address
|
|
136
|
-
if (isDeployment(userOp)) {
|
|
137
|
-
const conflictingUserOpHash = await this.factoryLookup.get(userOp.sender);
|
|
138
|
-
if (conflictingUserOpHash) {
|
|
139
|
-
const pendingOpsKey = await this.userOpHashLookup.get(conflictingUserOpHash);
|
|
140
|
-
if (pendingOpsKey) {
|
|
141
|
-
const conflictingPendingOpsSet = new RedisSortedSet(this.redis, pendingOpsKey);
|
|
142
|
-
const ops = await conflictingPendingOpsSet.getByRankRange(0, -1);
|
|
143
|
-
const userOps = ops.map(deserializeUserOpInfo);
|
|
144
|
-
const conflictingUserOp = userOps.find((op) => op.userOpHash === conflictingUserOpHash);
|
|
145
|
-
if (conflictingUserOp) {
|
|
146
|
-
await this.remove(conflictingUserOp.userOpHash);
|
|
147
|
-
return {
|
|
148
|
-
reason: "conflicting_deployment",
|
|
149
|
-
userOpInfo: conflictingUserOp
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
return undefined;
|
|
156
|
-
}
|
|
157
|
-
async peek() {
|
|
158
|
-
// Get highest gas price operation's key
|
|
159
|
-
const pendingOpsKeys = await this.readyOpsQueue.getByRankRange(0, 0);
|
|
160
|
-
if (pendingOpsKeys.length === 0) {
|
|
161
|
-
return undefined;
|
|
162
|
-
}
|
|
163
|
-
// Get the lowest nonce operation from the pendingOpsKey
|
|
164
|
-
const pendingOpsSet = new RedisSortedSet(this.redis, pendingOpsKeys[0]);
|
|
165
|
-
const userOpInfoStrings = await pendingOpsSet.getByRankRange(0, 0);
|
|
166
|
-
if (userOpInfoStrings.length === 0) {
|
|
167
|
-
return undefined;
|
|
168
|
-
}
|
|
169
|
-
return deserializeUserOpInfo(userOpInfoStrings[0]);
|
|
170
|
-
}
|
|
171
|
-
async add(userOpInfo) {
|
|
172
|
-
const { userOpHash, userOp } = userOpInfo;
|
|
173
|
-
const pendingOpsSet = this.getPendingOpsSet(userOp);
|
|
174
|
-
const [, nonceSeq] = getNonceKeyAndSequence(userOp.nonce);
|
|
175
|
-
// check if this will be the lowest nonce operation
|
|
176
|
-
// We need this info before starting the transaction
|
|
177
|
-
const existingOps = await pendingOpsSet.getByRankRange(0, 0);
|
|
178
|
-
const isLowestNonce = existingOps.length === 0 ||
|
|
179
|
-
userOp.nonce < deserializeUserOpInfo(existingOps[0]).userOp.nonce;
|
|
180
|
-
const multi = this.redis.multi();
|
|
181
|
-
// Add to pendingOps sorted set with nonceSeq as score
|
|
182
|
-
await pendingOpsSet.add({
|
|
183
|
-
member: serializeUserOpInfo(userOpInfo),
|
|
184
|
-
score: Number(nonceSeq),
|
|
185
|
-
multi
|
|
186
|
-
});
|
|
187
|
-
// Add to userOpHash lookup
|
|
188
|
-
await this.userOpHashLookup.set({
|
|
189
|
-
key: userOpHash,
|
|
190
|
-
value: pendingOpsSet.keyPath,
|
|
191
|
-
multi
|
|
192
|
-
});
|
|
193
|
-
// Track factory deployments if needed
|
|
194
|
-
if (isDeployment(userOp)) {
|
|
195
|
-
await this.factoryLookup.set({
|
|
196
|
-
key: userOp.sender,
|
|
197
|
-
value: userOpHash,
|
|
198
|
-
multi
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
// If lowest nonce, update ready queue with this userOp's gasPrice
|
|
202
|
-
if (isLowestNonce) {
|
|
203
|
-
await this.readyOpsQueue.add({
|
|
204
|
-
member: pendingOpsSet.keyPath,
|
|
205
|
-
score: Number(userOp.maxFeePerGas),
|
|
206
|
-
multi
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
await multi.exec();
|
|
210
|
-
}
|
|
211
|
-
async remove(userOpHash) {
|
|
212
|
-
// Get the userOp info from the secondary index
|
|
213
|
-
const pendingOpsKey = await this.userOpHashLookup.get(userOpHash);
|
|
214
|
-
if (!pendingOpsKey) {
|
|
215
|
-
return false;
|
|
216
|
-
}
|
|
217
|
-
// Get all pending operations for this key
|
|
218
|
-
const pendingOpsSet = new RedisSortedSet(this.redis, pendingOpsKey);
|
|
219
|
-
const ops = await pendingOpsSet.getByRankRange(0, -1);
|
|
220
|
-
if (ops.length === 0) {
|
|
221
|
-
return false;
|
|
222
|
-
}
|
|
223
|
-
const userOps = ops.map(deserializeUserOpInfo);
|
|
224
|
-
const userOpInfo = userOps.find((op) => op.userOpHash === userOpHash);
|
|
225
|
-
if (!userOpInfo) {
|
|
226
|
-
return false;
|
|
227
|
-
}
|
|
228
|
-
// Check if we're removing the lowest nonce operation
|
|
229
|
-
const isLowestNonce = userOps[0].userOpHash === userOpHash;
|
|
230
|
-
// If this is the lowest nonce, check if there's a next operation before starting the transaction
|
|
231
|
-
let nextOp;
|
|
232
|
-
if (isLowestNonce && userOps.length > 1) {
|
|
233
|
-
// userOps is already sorted by nonce sequence because it comes from the sorted set
|
|
234
|
-
// So we can simply take the second operation as the next one
|
|
235
|
-
nextOp = userOps[1];
|
|
236
|
-
}
|
|
237
|
-
// Create a transaction
|
|
238
|
-
const multi = this.redis.multi();
|
|
239
|
-
// Clean up factory deployment tracking if needed
|
|
240
|
-
if (isDeployment(userOpInfo.userOp)) {
|
|
241
|
-
await this.factoryLookup.delete({
|
|
242
|
-
key: userOpInfo.userOp.sender,
|
|
243
|
-
multi
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
// Remove from the sorted set
|
|
247
|
-
await pendingOpsSet.remove({
|
|
248
|
-
member: serializeUserOpInfo(userOpInfo),
|
|
249
|
-
multi
|
|
250
|
-
});
|
|
251
|
-
// Remove from hash lookup
|
|
252
|
-
await this.userOpHashLookup.delete({
|
|
253
|
-
key: userOpHash,
|
|
254
|
-
multi
|
|
255
|
-
});
|
|
256
|
-
if (isLowestNonce) {
|
|
257
|
-
// Remove from ready queue
|
|
258
|
-
await this.readyOpsQueue.remove({ member: pendingOpsKey, multi });
|
|
259
|
-
// If we have a next operation, add it to the ready queue
|
|
260
|
-
if (nextOp) {
|
|
261
|
-
await this.readyOpsQueue.add({
|
|
262
|
-
member: pendingOpsKey,
|
|
263
|
-
score: Number(nextOp.userOp.maxFeePerGas),
|
|
264
|
-
multi
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
// Execute transaction
|
|
269
|
-
await multi.exec();
|
|
270
|
-
return true;
|
|
271
|
-
}
|
|
272
|
-
async pop() {
|
|
273
|
-
// Pop highest gas price operation
|
|
274
|
-
const pendingOpsKey = await this.readyOpsQueue.popMax();
|
|
275
|
-
if (!pendingOpsKey) {
|
|
276
|
-
return undefined;
|
|
277
|
-
}
|
|
278
|
-
const pendingOpsSet = new RedisSortedSet(this.redis, pendingOpsKey);
|
|
279
|
-
// Get the operations from the set (limited to 2 for efficiency)
|
|
280
|
-
const ops = await pendingOpsSet.getByRankRange(0, 1);
|
|
281
|
-
if (ops.length === 0) {
|
|
282
|
-
return undefined;
|
|
283
|
-
}
|
|
284
|
-
const currentUserOpStr = ops[0];
|
|
285
|
-
const currentUserOp = deserializeUserOpInfo(currentUserOpStr);
|
|
286
|
-
// Create a transaction
|
|
287
|
-
const multi = this.redis.multi();
|
|
288
|
-
// Remove the current operation
|
|
289
|
-
await pendingOpsSet.remove({ member: currentUserOpStr, multi });
|
|
290
|
-
await this.userOpHashLookup.delete({
|
|
291
|
-
key: currentUserOp.userOpHash,
|
|
292
|
-
multi
|
|
293
|
-
});
|
|
294
|
-
// Execute transaction
|
|
295
|
-
await multi.exec();
|
|
296
|
-
// Check if there are more operations in this set
|
|
297
|
-
if (ops.length > 1) {
|
|
298
|
-
const nextUserOp = deserializeUserOpInfo(ops[1]);
|
|
299
|
-
await this.readyOpsQueue.add({
|
|
300
|
-
member: pendingOpsKey,
|
|
301
|
-
score: Number(nextUserOp.userOp.maxFeePerGas)
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
else {
|
|
305
|
-
// Delete the empty set
|
|
306
|
-
await pendingOpsSet.delete({});
|
|
307
|
-
}
|
|
308
|
-
return currentUserOp;
|
|
309
|
-
}
|
|
310
|
-
async getQueuedUserOps(userOp) {
|
|
311
|
-
const pendingOpsSet = this.getPendingOpsSet(userOp);
|
|
312
|
-
const [, nonceSequence] = getNonceKeyAndSequence(userOp.nonce);
|
|
313
|
-
const pendingOps = await pendingOpsSet.getByRankRange(0, -1);
|
|
314
|
-
// Filter operations with nonce sequence less than the current one
|
|
315
|
-
return pendingOps
|
|
316
|
-
.map(deserializeUserOpInfo)
|
|
317
|
-
.filter((opInfo) => {
|
|
318
|
-
const [, opNonceSeq] = getNonceKeyAndSequence(opInfo.userOp.nonce);
|
|
319
|
-
return opNonceSeq < nonceSequence;
|
|
320
|
-
})
|
|
321
|
-
.map((opInfo) => opInfo.userOp);
|
|
322
|
-
}
|
|
323
|
-
// These methods aren't implemented
|
|
324
|
-
dumpLocal() {
|
|
325
|
-
return Promise.resolve([]); // We can't dump from redis as the latency is too high
|
|
326
|
-
}
|
|
327
|
-
clear() {
|
|
328
|
-
throw new Error("Not implemented: clear");
|
|
329
|
-
}
|
|
330
|
-
// Skip limit checks when using Redis
|
|
331
|
-
validateQueuedLimit() {
|
|
332
|
-
return true;
|
|
333
|
-
}
|
|
334
|
-
validateParallelLimit() {
|
|
335
|
-
return true;
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
export const createRedisOutstandingQueue = ({ config, entryPoint, redisEndpoint }) => {
|
|
339
|
-
return new RedisOutstandingQueue({ config, entryPoint, redisEndpoint });
|
|
340
|
-
};
|
|
341
|
-
//# sourceMappingURL=createRedisOutstandingStore.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createRedisOutstandingStore.js","sourceRoot":"","sources":["../../store/createRedisOutstandingStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAKH,gBAAgB,EACnB,MAAM,aAAa,CAAA;AACpB,OAAO,EAA2B,KAAK,EAAE,MAAM,SAAS,CAAA;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAGlC,OAAO,EACH,sBAAsB,EACtB,WAAW,EACX,WAAW,EACd,MAAM,iBAAiB,CAAA;AAExB,MAAM,mBAAmB,GAAG,CAAC,UAAsB,EAAU,EAAE;IAC3D,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,C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CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC,CAAA;AAC3E,CAAC,CAAA"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type Address } from "viem";
|
|
2
|
-
import type { Store } from "./index.js";
|
|
3
|
-
import type { AltoConfig } from "../createConfig.js";
|
|
4
|
-
export declare const createRedisStore: ({ config, storeType, entryPoint, redisEndpoint }: {
|
|
5
|
-
config: AltoConfig;
|
|
6
|
-
storeType: string;
|
|
7
|
-
entryPoint: Address;
|
|
8
|
-
redisEndpoint: string;
|
|
9
|
-
}) => Store;
|
|
10
|
-
//# sourceMappingURL=createRedisStore.d.ts.map
|