@pimlico/alto 0.0.0-main.20250908T105720 → 0.0.0-main.20250930T125129
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 +11 -11
- package/esm/cli/setupServer.js.map +1 -1
- package/esm/cli/shutDown.d.ts +5 -5
- package/esm/cli/shutDown.js +20 -60
- package/esm/cli/shutDown.js.map +1 -1
- package/esm/executor/{userOpMonitor.d.ts → bundleManager.d.ts} +4 -4
- package/esm/executor/{userOpMonitor.js → bundleManager.js} +50 -37
- package/esm/executor/bundleManager.js.map +1 -0
- package/esm/executor/executorManager.d.ts +4 -4
- package/esm/executor/executorManager.js +23 -24
- package/esm/executor/executorManager.js.map +1 -1
- package/esm/executor/index.d.ts +1 -1
- package/esm/executor/index.js +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 +91 -93
- 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_getUserOperationReceipt.js +1 -1
- package/esm/rpc/methods/pimlico_sendUserOperationNow.js +4 -1
- package/esm/rpc/methods/pimlico_sendUserOperationNow.js.map +1 -1
- package/esm/rpc/rpcHandler.d.ts +4 -4
- package/esm/rpc/rpcHandler.js +3 -3
- 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/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/userop.d.ts +1 -0
- package/esm/utils/userop.js +6 -0
- 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/executor/userOpMonitor.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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pimlico_sendUserOperationNow.js","sourceRoot":"","sources":["../../../rpc/methods/pimlico_sendUserOperationNow.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,QAAQ,EAGR,gBAAgB,EAChB,iCAAiC,EACpC,MAAM,aAAa,CAAA;AACpB,OAAO,EACH,aAAa,EACb,WAAW,EACX,WAAW,EACX,kBAAkB,EACrB,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAE5D,MAAM,CAAC,MAAM,kCAAkC,GAAG,mBAAmB,CAAC;IAClE,MAAM,EAAE,8BAA8B;IACtC,MAAM,EAAE,iCAAiC;IACzC,OAAO,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE;QAClD,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,6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,KAAK,CAAA;QACnB,CAAC;QAED,MAAM,MAAM,GAAwB;YAChC,UAAU;YACV,OAAO,EAAE,CAAC,UAAU,CAAC;YACrB,OAAO;YACP,kBAAkB,EAAE,CAAC;SACxB,CAAA;QACD,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"pimlico_sendUserOperationNow.js","sourceRoot":"","sources":["../../../rpc/methods/pimlico_sendUserOperationNow.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,QAAQ,EAGR,gBAAgB,EAChB,iCAAiC,EACpC,MAAM,aAAa,CAAA;AACpB,OAAO,EACH,aAAa,EACb,WAAW,EACX,WAAW,EACX,kBAAkB,EACrB,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAE5D,MAAM,CAAC,MAAM,kCAAkC,GAAG,mBAAmB,CAAC;IAClE,MAAM,EAAE,8BAA8B;IACtC,MAAM,EAAE,iCAAiC;IACzC,OAAO,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE;QAClD,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,6BAA6B,EAAE,CAAC;YACnD,MAAM,IAAI,QAAQ,CACd,sDAAsD,EACtD,gBAAgB,CAAC,aAAa,CACjC,CAAA;QACL,CAAC;QAED,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,MAAM,CAAA;QACnC,UAAU,CAAC,2BAA2B,CAAC,UAAU,CAAC,CAAA;QAElD,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC;YAC/B,MAAM;YACN,iBAAiB,EAAE,UAAU;YAC7B,OAAO,EAAE,UAAU,CAAC,MAAM,CAAC,OAAO;YAClC,YAAY,EAAE,UAAU,CAAC,MAAM,CAAC,YAAY;SAC/C,CAAC,CAAA;QAEF,MAAM,CAAC,eAAe,EAAE,eAAe,CAAC,GACpC,MAAM,UAAU,CA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O,GACT,MAAM,UAAU,CAAC,MAAM,CAAC,YAAY,CAAC,yBAAyB,CAAC;YAC3D,IAAI,EAAE,MAAM;YACZ,eAAe,EAAE,GAAG;SACvB,CAAC,CAAA;QAEN,OAAO,kBAAkB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC9C,CAAC;CACJ,CAAC,CAAA"}
|
package/esm/rpc/rpcHandler.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { ApiVersion, BundlerRequest } from "../types/index.js";
|
|
|
5
5
|
import { type Address, type InterfaceValidator, type UserOperation } from "../types/index.js";
|
|
6
6
|
import type { Logger, Metrics } from "../utils/index.js";
|
|
7
7
|
import type { AltoConfig } from "../createConfig.js";
|
|
8
|
-
import type {
|
|
8
|
+
import type { BundleManager } from "../executor/bundleManager.js";
|
|
9
9
|
import type { MethodHandler } from "./createMethodHandler.js";
|
|
10
10
|
export declare class RpcHandler {
|
|
11
11
|
config: AltoConfig;
|
|
@@ -18,11 +18,11 @@ export declare class RpcHandler {
|
|
|
18
18
|
metrics: Metrics;
|
|
19
19
|
eventManager: EventManager;
|
|
20
20
|
gasPriceManager: GasPriceManager;
|
|
21
|
-
|
|
21
|
+
bundleManager: BundleManager;
|
|
22
22
|
logger: Logger;
|
|
23
23
|
private methodHandlers;
|
|
24
24
|
private eip7702CodeCache;
|
|
25
|
-
constructor({ config, validator, mempool, executor, monitor, executorManager, reputationManager,
|
|
25
|
+
constructor({ config, validator, mempool, executor, monitor, executorManager, reputationManager, bundleManager, metrics, eventManager, gasPriceManager }: {
|
|
26
26
|
config: AltoConfig;
|
|
27
27
|
validator: InterfaceValidator;
|
|
28
28
|
mempool: Mempool;
|
|
@@ -30,7 +30,7 @@ export declare class RpcHandler {
|
|
|
30
30
|
monitor: Monitor;
|
|
31
31
|
executorManager: ExecutorManager;
|
|
32
32
|
reputationManager: InterfaceReputationManager;
|
|
33
|
-
|
|
33
|
+
bundleManager: BundleManager;
|
|
34
34
|
metrics: Metrics;
|
|
35
35
|
eventManager: EventManager;
|
|
36
36
|
gasPriceManager: GasPriceManager;
|
package/esm/rpc/rpcHandler.js
CHANGED
|
@@ -16,11 +16,11 @@ export class RpcHandler {
|
|
|
16
16
|
metrics;
|
|
17
17
|
eventManager;
|
|
18
18
|
gasPriceManager;
|
|
19
|
-
|
|
19
|
+
bundleManager;
|
|
20
20
|
logger;
|
|
21
21
|
methodHandlers;
|
|
22
22
|
eip7702CodeCache;
|
|
23
|
-
constructor({ config, validator, mempool, executor, monitor, executorManager, reputationManager,
|
|
23
|
+
constructor({ config, validator, mempool, executor, monitor, executorManager, reputationManager, bundleManager, metrics, eventManager, gasPriceManager }) {
|
|
24
24
|
this.config = config;
|
|
25
25
|
this.validator = validator;
|
|
26
26
|
this.mempool = mempool;
|
|
@@ -31,7 +31,7 @@ export class RpcHandler {
|
|
|
31
31
|
this.metrics = metrics;
|
|
32
32
|
this.eventManager = eventManager;
|
|
33
33
|
this.gasPriceManager = gasPriceManager;
|
|
34
|
-
this.
|
|
34
|
+
this.bundleManager = bundleManager;
|
|
35
35
|
this.logger = config.getLogger({ module: "rpc" }, {
|
|
36
36
|
level: config.rpcLogLevel || config.logLevel
|
|
37
37
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { type MempoolStore } from "./index.js";
|
|
1
2
|
import type { Metrics } from "../utils/index.js";
|
|
2
|
-
import type { MempoolStore } from "./index.js";
|
|
3
3
|
import type { AltoConfig } from "../createConfig.js";
|
|
4
4
|
export declare const createMempoolStore: ({ config, metrics }: {
|
|
5
5
|
config: AltoConfig;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
+
import { createOutstandingQueue, createProcessingStore } from "./index.js";
|
|
1
2
|
import * as sentry from "@sentry/node";
|
|
2
|
-
import { createMemoryOutstandingQueue } from "./createMemoryOutstandingStore.js";
|
|
3
|
-
import { createRedisOutstandingQueue } from "./createRedisOutstandingStore.js";
|
|
4
|
-
import { createRedisStore } from "./createRedisStore.js";
|
|
5
|
-
import { createMemoryStore } from "./createStore.js";
|
|
6
3
|
export const createMempoolStore = ({ config, metrics }) => {
|
|
7
4
|
const logger = config.getLogger({ module: "mempool-store" }, {
|
|
8
5
|
level: config.logLevel
|
|
@@ -17,59 +14,20 @@ export const createMempoolStore = ({ config, metrics }) => {
|
|
|
17
14
|
return handlers;
|
|
18
15
|
};
|
|
19
16
|
for (const entryPoint of config.entrypoints) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
processing = createRedisStore({
|
|
30
|
-
config,
|
|
31
|
-
entryPoint,
|
|
32
|
-
storeType: "processing",
|
|
33
|
-
redisEndpoint: config.redisEndpoint
|
|
34
|
-
});
|
|
35
|
-
submitted = createRedisStore({
|
|
36
|
-
config,
|
|
37
|
-
entryPoint,
|
|
38
|
-
storeType: "submitted",
|
|
39
|
-
redisEndpoint: config.redisEndpoint
|
|
40
|
-
});
|
|
41
|
-
// Log the Redis keys being used
|
|
42
|
-
const outstandingKey = `${config.chainId}:outstanding:pending-queue:${entryPoint}`;
|
|
43
|
-
const processingKey = `${config.chainId}:processing:*:${entryPoint}`;
|
|
44
|
-
const submittedKey = `${config.chainId}:submitted:*:${entryPoint}`;
|
|
45
|
-
logger.info({
|
|
46
|
-
outstandingKey,
|
|
47
|
-
processingKey,
|
|
48
|
-
submittedKey
|
|
49
|
-
}, "Using redis for outstanding, processing, submitted mempools with keys");
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
outstanding = createMemoryOutstandingQueue({
|
|
53
|
-
config
|
|
54
|
-
});
|
|
55
|
-
processing = createMemoryStore({
|
|
56
|
-
config
|
|
57
|
-
});
|
|
58
|
-
submitted = createMemoryStore({
|
|
59
|
-
config
|
|
60
|
-
});
|
|
61
|
-
logger.info("Using memory for outstanding, processing, submitted mempools");
|
|
62
|
-
}
|
|
17
|
+
const outstanding = createOutstandingQueue({
|
|
18
|
+
config,
|
|
19
|
+
entryPoint,
|
|
20
|
+
logger
|
|
21
|
+
});
|
|
22
|
+
const processing = createProcessingStore({
|
|
23
|
+
config,
|
|
24
|
+
entryPoint
|
|
25
|
+
});
|
|
63
26
|
storeHandlers.set(entryPoint, {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
outstanding
|
|
27
|
+
outstanding,
|
|
28
|
+
processing
|
|
67
29
|
});
|
|
68
30
|
}
|
|
69
|
-
const logAddOperation = (userOpHash, storeType) => {
|
|
70
|
-
logger.debug({ userOpHash, store: storeType }, `added user op to ${storeType} mempool`);
|
|
71
|
-
metrics.userOpsInMempool.labels({ status: storeType }).inc();
|
|
72
|
-
};
|
|
73
31
|
const logRemoveOperation = (userOpHash, storeType, removed) => {
|
|
74
32
|
if (!removed) {
|
|
75
33
|
logger.warn({ userOpHash, store: storeType }, "tried to remove non-existent user op from mempool");
|
|
@@ -85,71 +43,36 @@ export const createMempoolStore = ({ config, metrics }) => {
|
|
|
85
43
|
};
|
|
86
44
|
return {
|
|
87
45
|
// Methods used for bundling
|
|
88
|
-
popOutstanding: async (entryPoint) => {
|
|
89
|
-
try {
|
|
90
|
-
const { outstanding } = getStoreHandlers(entryPoint);
|
|
91
|
-
return await outstanding.pop();
|
|
92
|
-
}
|
|
93
|
-
catch (err) {
|
|
94
|
-
logger.error({ err }, "Failed to pop from outstanding mempool, defaulting to undefined");
|
|
95
|
-
sentry.captureException(err);
|
|
96
|
-
return undefined;
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
peekOutstanding: async (entryPoint) => {
|
|
46
|
+
popOutstanding: async (entryPoint, count) => {
|
|
100
47
|
try {
|
|
101
48
|
const { outstanding } = getStoreHandlers(entryPoint);
|
|
102
|
-
return await outstanding.
|
|
49
|
+
return await outstanding.pop(count);
|
|
103
50
|
}
|
|
104
51
|
catch (err) {
|
|
105
|
-
logger.error({ err }, "Failed to
|
|
52
|
+
logger.error({ err }, "Failed to pop from outstanding mempool, defaulting to empty array");
|
|
106
53
|
sentry.captureException(err);
|
|
107
|
-
return
|
|
54
|
+
return [];
|
|
108
55
|
}
|
|
109
56
|
},
|
|
110
57
|
// State handling
|
|
111
|
-
addOutstanding: async ({ entryPoint,
|
|
58
|
+
addOutstanding: async ({ entryPoint, userOpInfos }) => {
|
|
112
59
|
const { outstanding } = getStoreHandlers(entryPoint);
|
|
113
|
-
|
|
60
|
+
metrics.userOpsInMempool
|
|
61
|
+
.labels({ status: "outstanding" })
|
|
62
|
+
.inc(userOpInfos.length);
|
|
114
63
|
try {
|
|
115
|
-
await outstanding.add(
|
|
64
|
+
await outstanding.add(userOpInfos);
|
|
116
65
|
}
|
|
117
66
|
catch (err) {
|
|
118
67
|
logger.error({ err }, "Failed to add to outstanding mempool");
|
|
119
68
|
sentry.captureException(err);
|
|
120
69
|
}
|
|
121
70
|
},
|
|
122
|
-
addProcessing: ({ entryPoint, userOpInfo }) => {
|
|
123
|
-
try {
|
|
124
|
-
const { processing } = getStoreHandlers(entryPoint);
|
|
125
|
-
logAddOperation(userOpInfo.userOpHash, "processing");
|
|
126
|
-
processing.add(userOpInfo);
|
|
127
|
-
return Promise.resolve();
|
|
128
|
-
}
|
|
129
|
-
catch (err) {
|
|
130
|
-
logger.error({ err }, "Failed to add to processing mempool");
|
|
131
|
-
sentry.captureException(err);
|
|
132
|
-
return Promise.resolve();
|
|
133
|
-
}
|
|
134
|
-
},
|
|
135
|
-
addSubmitted: ({ entryPoint, userOpInfo }) => {
|
|
136
|
-
try {
|
|
137
|
-
const { submitted } = getStoreHandlers(entryPoint);
|
|
138
|
-
logAddOperation(userOpInfo.userOpHash, "submitted");
|
|
139
|
-
submitted.add(userOpInfo);
|
|
140
|
-
return Promise.resolve();
|
|
141
|
-
}
|
|
142
|
-
catch (err) {
|
|
143
|
-
logger.error({ err }, "Failed to add to submitted mempool");
|
|
144
|
-
sentry.captureException(err);
|
|
145
|
-
return Promise.resolve();
|
|
146
|
-
}
|
|
147
|
-
},
|
|
148
71
|
removeOutstanding: async ({ entryPoint, userOpHash }) => {
|
|
149
72
|
try {
|
|
150
73
|
const { outstanding } = getStoreHandlers(entryPoint);
|
|
151
|
-
const removed = await outstanding.remove(userOpHash);
|
|
152
|
-
logRemoveOperation(userOpHash, "outstanding", removed);
|
|
74
|
+
const removed = await outstanding.remove([userOpHash]);
|
|
75
|
+
logRemoveOperation(userOpHash, "outstanding", removed.length > 0);
|
|
153
76
|
}
|
|
154
77
|
catch (err) {
|
|
155
78
|
logger.error({ err }, "Failed to remove from outstanding mempool");
|
|
@@ -157,69 +80,54 @@ export const createMempoolStore = ({ config, metrics }) => {
|
|
|
157
80
|
return Promise.resolve();
|
|
158
81
|
}
|
|
159
82
|
},
|
|
160
|
-
|
|
83
|
+
dumpOutstanding: async (entryPoint) => {
|
|
84
|
+
const { outstanding } = getStoreHandlers(entryPoint);
|
|
85
|
+
logDumpOperation("outstanding");
|
|
86
|
+
return await outstanding.dumpLocal();
|
|
87
|
+
},
|
|
88
|
+
// Methods to mark/unmark userOps that are being processed.
|
|
89
|
+
addProcessing: async ({ entryPoint, userOpInfo }) => {
|
|
161
90
|
try {
|
|
162
91
|
const { processing } = getStoreHandlers(entryPoint);
|
|
163
|
-
|
|
164
|
-
logRemoveOperation(userOpHash, "processing", removed);
|
|
92
|
+
await processing.addProcessing(userOpInfo);
|
|
165
93
|
}
|
|
166
94
|
catch (err) {
|
|
167
|
-
logger.error({ err }, "Failed to
|
|
95
|
+
logger.error({ err }, "Failed to track active userOp");
|
|
168
96
|
sentry.captureException(err);
|
|
169
|
-
return Promise.resolve();
|
|
170
97
|
}
|
|
171
98
|
},
|
|
172
|
-
|
|
99
|
+
removeProcessing: async ({ entryPoint, userOpInfo }) => {
|
|
173
100
|
try {
|
|
174
|
-
const {
|
|
175
|
-
|
|
176
|
-
logRemoveOperation(userOpHash, "submitted", removed);
|
|
101
|
+
const { processing } = getStoreHandlers(entryPoint);
|
|
102
|
+
await processing.removeProcessing(userOpInfo);
|
|
177
103
|
}
|
|
178
104
|
catch (err) {
|
|
179
|
-
logger.error({ err }, "Failed to
|
|
105
|
+
logger.error({ err }, "Failed to untrack active userOp");
|
|
180
106
|
sentry.captureException(err);
|
|
181
|
-
return Promise.resolve();
|
|
182
107
|
}
|
|
183
108
|
},
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
},
|
|
189
|
-
dumpProcessing: async (entryPoint) => {
|
|
190
|
-
const { processing } = getStoreHandlers(entryPoint);
|
|
191
|
-
logDumpOperation("processing");
|
|
192
|
-
return await processing.dumpLocal();
|
|
193
|
-
},
|
|
194
|
-
dumpSubmitted: async (entryPoint) => {
|
|
195
|
-
const { submitted } = getStoreHandlers(entryPoint);
|
|
196
|
-
logDumpOperation("submitted");
|
|
197
|
-
return await submitted.dumpLocal();
|
|
198
|
-
},
|
|
199
|
-
// Check if the userOp is already in the mempool
|
|
200
|
-
isInMempool: async ({ userOpHash, entryPoint }) => {
|
|
201
|
-
const { outstanding, processing, submitted } = getStoreHandlers(entryPoint);
|
|
202
|
-
const [inOutstanding, inProcessing, inSubmitted] = await Promise.all([
|
|
109
|
+
// Check if the userOp is already in the mempool or conflicts with existing userOps.
|
|
110
|
+
checkDuplicatesAndConflicts: async ({ entryPoint, userOp, userOpHash }) => {
|
|
111
|
+
const { outstanding, processing } = getStoreHandlers(entryPoint);
|
|
112
|
+
const [isInOutstanding, isInProcessing, wouldConflict] = await Promise.all([
|
|
203
113
|
outstanding.contains(userOpHash),
|
|
204
|
-
processing.
|
|
205
|
-
|
|
114
|
+
processing.isProcessing(userOpHash),
|
|
115
|
+
processing.wouldConflict(userOp)
|
|
206
116
|
]);
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
const conflicting = submittedConflict || processingConflict;
|
|
216
|
-
if (conflicting?.reason === "conflicting_nonce") {
|
|
117
|
+
// Check if already known (in outstanding or processing).
|
|
118
|
+
if (isInOutstanding || isInProcessing) {
|
|
119
|
+
return {
|
|
120
|
+
valid: false,
|
|
121
|
+
reason: "Already known"
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
if (wouldConflict === "nonce_conflict") {
|
|
217
125
|
return {
|
|
218
126
|
valid: false,
|
|
219
127
|
reason: "AA25 invalid account nonce: Another UserOperation with same sender and nonce is already being processed"
|
|
220
128
|
};
|
|
221
129
|
}
|
|
222
|
-
if (
|
|
130
|
+
if (wouldConflict === "deployment_conflict") {
|
|
223
131
|
return {
|
|
224
132
|
valid: false,
|
|
225
133
|
reason: "AA25 invalid account deployment: Another deployment operation for this sender is already being processed"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createMempoolStore.js","sourceRoot":"","sources":["../../store/createMempoolStore.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createMempoolStore.js","sourceRoot":"","sources":["../../store/createMempoolStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAQH,sBAAsB,EACtB,qBAAqB,EACxB,MAAM,aAAa,CAAA;AAIpB,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AAItC,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EAC/B,MAAM,EACN,OAAO,EACgC,EAAgB,EAAE;IACzD,MAAM,MAAM,GAAW,MAAM,CAAC,SAAS,CACnC,EAAE,MAAM,EAAE,eAAe,EAAE,EAC3B;QACI,KAAK,EAAE,MAAM,CAAC,QAAQ;KACzB,CACJ,CAAA;IAED,MAAM,aAAa,GAMf,IAAI,GAAG,EAAE,CAAA;IAEb,2DAA2D;IAC3D,MAAM,gBAAgB,GAAG,CAAC,UAAmB,EAAE,EAAE;QAC7C,MAAM,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;QAC9C,IAAI,CAAC,QAAQ,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CACX,2CAA2C,UAAU,EAAE,CAC1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serOpInfo;
|
|
6
|
-
} | undefined;
|
|
7
|
-
export type ConflictingStoreType = {
|
|
8
|
-
reason: "conflicting_nonce" | "conflicting_deployment";
|
|
9
|
-
userOp: UserOperation;
|
|
10
|
-
} | undefined;
|
|
11
|
-
type ValidationResult = {
|
|
12
|
-
valid: true;
|
|
13
|
-
} | {
|
|
14
|
-
valid: false;
|
|
15
|
-
reason: string;
|
|
16
|
-
};
|
|
17
|
-
export type EntryPointUserOpInfoParam = {
|
|
18
|
-
entryPoint: Address;
|
|
19
|
-
userOpInfo: UserOpInfo;
|
|
20
|
-
};
|
|
21
|
-
export type EntryPointUserOpHashParam = {
|
|
22
|
-
entryPoint: Address;
|
|
23
|
-
userOpHash: HexData32;
|
|
24
|
-
};
|
|
25
|
-
export type EntryPointUserOpParam = {
|
|
26
|
-
userOp: UserOperation;
|
|
27
|
-
entryPoint: Address;
|
|
28
|
-
};
|
|
29
|
-
export type MempoolStore = {
|
|
30
|
-
peekOutstanding: (entryPoint: Address) => Promise<UserOpInfo | undefined>;
|
|
31
|
-
popOutstanding: (entryPoint: Address) => Promise<UserOpInfo | undefined>;
|
|
32
|
-
addOutstanding: (args: EntryPointUserOpInfoParam) => Promise<void>;
|
|
33
|
-
addProcessing: (args: EntryPointUserOpInfoParam) => Promise<void>;
|
|
34
|
-
addSubmitted: (args: EntryPointUserOpInfoParam) => Promise<void>;
|
|
35
|
-
removeOutstanding: (args: EntryPointUserOpHashParam) => Promise<void>;
|
|
36
|
-
removeProcessing: (args: EntryPointUserOpHashParam) => Promise<void>;
|
|
37
|
-
removeSubmitted: (args: EntryPointUserOpHashParam) => Promise<void>;
|
|
38
|
-
dumpOutstanding: (entryPoint: Address) => Promise<UserOpInfo[]>;
|
|
39
|
-
dumpProcessing: (entryPoint: Address) => Promise<UserOpInfo[]>;
|
|
40
|
-
dumpSubmitted: (entryPoint: Address) => Promise<UserOpInfo[]>;
|
|
41
|
-
isInMempool: (args: EntryPointUserOpHashParam) => Promise<boolean>;
|
|
42
|
-
popConflictingOustanding: (args: {
|
|
43
|
-
entryPoint: Address;
|
|
44
|
-
userOp: UserOperation;
|
|
45
|
-
}) => Promise<ConflictingOutstandingType>;
|
|
46
|
-
validateSubmittedOrProcessing: (args: EntryPointUserOpParam) => Promise<ValidationResult>;
|
|
47
|
-
validateSenderLimits: (args: {
|
|
48
|
-
entryPoint: Address;
|
|
49
|
-
userOp: UserOperation;
|
|
50
|
-
}) => Promise<ValidationResult>;
|
|
51
|
-
getQueuedOutstandingUserOps: (args: {
|
|
52
|
-
userOp: UserOperation;
|
|
53
|
-
entryPoint: Address;
|
|
54
|
-
}) => Promise<UserOperation[]>;
|
|
55
|
-
clearOutstanding: (entryPoint: Address) => Promise<void>;
|
|
56
|
-
};
|
|
57
|
-
export type BaseStore = {
|
|
58
|
-
add: (op: UserOpInfo) => Promise<void>;
|
|
59
|
-
remove: (userOpHash: HexData32) => Promise<boolean>;
|
|
60
|
-
contains: (userOpHash: HexData32) => Promise<boolean>;
|
|
61
|
-
dumpLocal: () => Promise<UserOpInfo[]>;
|
|
62
|
-
};
|
|
63
|
-
export type Store = BaseStore & {
|
|
64
|
-
findConflicting: (args: UserOperation) => Promise<ConflictingStoreType>;
|
|
65
|
-
};
|
|
66
|
-
export type OutstandingStore = BaseStore & {
|
|
67
|
-
clear: () => Promise<void>;
|
|
68
|
-
popConflicting: (args: UserOperation) => Promise<ConflictingOutstandingType>;
|
|
69
|
-
validateQueuedLimit: (userOp: UserOperation) => boolean;
|
|
70
|
-
validateParallelLimit: (userOp: UserOperation) => boolean;
|
|
71
|
-
getQueuedUserOps: (userOp: UserOperation) => Promise<UserOperation[]>;
|
|
72
|
-
peek: () => Promise<UserOpInfo | undefined>;
|
|
73
|
-
pop: () => Promise<UserOpInfo | undefined>;
|
|
74
|
-
};
|
|
75
|
-
export { createMempoolStore } from "./createMempoolStore.js";
|
|
1
|
+
export * from "./types.js";
|
|
2
|
+
export * from "./outstanding/index.js";
|
|
3
|
+
export * from "./processing/index.js";
|
|
4
|
+
export * from "./createMempoolStore.js";
|
|
76
5
|
//# sourceMappingURL=index.d.ts.map
|
package/esm/store/index.js
CHANGED
package/esm/store/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../store/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../store/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,sBAAsB,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type OutstandingStore } from "../index.js";
|
|
2
|
+
import type { Logger } from "../../utils/index.js";
|
|
3
|
+
import type { Address } from "viem";
|
|
4
|
+
import type { AltoConfig } from "../../createConfig.js";
|
|
5
|
+
export declare const createOutstandingQueue: ({ config, entryPoint, logger }: {
|
|
6
|
+
config: AltoConfig;
|
|
7
|
+
entryPoint: Address;
|
|
8
|
+
logger: Logger;
|
|
9
|
+
}) => OutstandingStore;
|
|
10
|
+
export * from "./types.js";
|
|
11
|
+
export * from "./memory.js";
|
|
12
|
+
export * from "./redis.js";
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createMemoryOutstandingQueue, createRedisOutstandingQueue } from "../index.js";
|
|
2
|
+
export const createOutstandingQueue = ({ config, entryPoint, logger }) => {
|
|
3
|
+
if (config.enableHorizontalScaling && config.redisEndpoint) {
|
|
4
|
+
return createRedisOutstandingQueue({
|
|
5
|
+
config,
|
|
6
|
+
entryPoint,
|
|
7
|
+
redisEndpoint: config.redisEndpoint,
|
|
8
|
+
logger
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
return createMemoryOutstandingQueue({ config, logger });
|
|
12
|
+
};
|
|
13
|
+
export * from "./types.js";
|
|
14
|
+
export * from "./memory.js";
|
|
15
|
+
export * from "./redis.js";
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../store/outstanding/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,4BAA4B,EAC5B,2BAA2B,EAC9B,MAAM,aAAa,CAAA;AAKpB,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,EACnC,MAAM,EACN,UAAU,EACV,MAAM,EAKT,EAAoB,EAAE;IACnB,IAAI,MAAM,CAAC,uBAAuB,IAAI,MAAM,CAAC,aAAa,EAAE,CAAC;QACzD,OAAO,2BAA2B,CAAC;YAC/B,MAAM;YACN,UAAU;YACV,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,MAAM;SACT,CAAC,CAAA;IACN,CAAC;IACD,OAAO,4BAA4B,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;AAC3D,CAAC,CAAA;AAED,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import type { HexData32, UserOpInfo, UserOperation } from "
|
|
2
|
-
import type {
|
|
3
|
-
import type { AltoConfig } from "
|
|
1
|
+
import type { HexData32, UserOpInfo, UserOperation } from "../../types/index.js";
|
|
2
|
+
import type { Logger } from "../../utils/index.js";
|
|
3
|
+
import type { AltoConfig } from "../../createConfig.js";
|
|
4
|
+
import type { ConflictingOutstandingType, OutstandingStore } from "./types.js";
|
|
4
5
|
export declare class MemoryOutstanding implements OutstandingStore {
|
|
5
6
|
private config;
|
|
6
7
|
private pendingOps;
|
|
7
8
|
private priorityQueue;
|
|
9
|
+
private hashLookup;
|
|
8
10
|
private logger;
|
|
9
11
|
constructor(config: AltoConfig);
|
|
10
12
|
private dump;
|
|
@@ -13,16 +15,15 @@ export declare class MemoryOutstanding implements OutstandingStore {
|
|
|
13
15
|
validateParallelLimit(userOp: UserOperation): boolean;
|
|
14
16
|
popConflicting(userOp: UserOperation): Promise<ConflictingOutstandingType>;
|
|
15
17
|
contains(userOpHash: HexData32): Promise<boolean>;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
add(userOpInfo: UserOpInfo): Promise<void>;
|
|
18
|
+
pop(count: number): Promise<UserOpInfo[]>;
|
|
19
|
+
add(userOpInfos: UserOpInfo[]): Promise<void>;
|
|
19
20
|
getQueuedUserOps(userOp: UserOperation): Promise<UserOperation[]>;
|
|
20
|
-
remove(
|
|
21
|
+
remove(userOpHashes: HexData32[]): Promise<UserOpInfo[]>;
|
|
21
22
|
dumpLocal(): Promise<UserOpInfo[]>;
|
|
22
23
|
clear(): Promise<void>;
|
|
23
|
-
findConflicting(userOp: UserOperation): Promise<ConflictingOutstandingType>;
|
|
24
24
|
}
|
|
25
|
-
export declare const createMemoryOutstandingQueue: ({ config }: {
|
|
25
|
+
export declare const createMemoryOutstandingQueue: ({ config, logger }: {
|
|
26
26
|
config: AltoConfig;
|
|
27
|
+
logger: Logger;
|
|
27
28
|
}) => OutstandingStore;
|
|
28
|
-
//# sourceMappingURL=
|
|
29
|
+
//# sourceMappingURL=memory.d.ts.map
|