@pimlico/alto 0.0.0-staging.20240606T093925 → 0.0.0-staging.20240606T095015
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/lib/cli/config/bundler.js +73 -76
- package/lib/cli/config/bundler.js.map +1 -1
- package/lib/cli/config/index.js +2 -18
- package/lib/cli/config/index.js.map +1 -1
- package/lib/cli/config/options.js +10 -13
- package/lib/cli/config/options.js.map +1 -1
- package/lib/cli/customTransport.js +7 -11
- package/lib/cli/customTransport.js.map +1 -1
- package/lib/cli/handler.js +24 -28
- package/lib/cli/handler.js.map +1 -1
- package/lib/cli/index.js +2 -18
- package/lib/cli/index.js.map +1 -1
- package/lib/cli/instrumentation.js +20 -22
- package/lib/cli/instrumentation.js.map +1 -1
- package/lib/cli/setupServer.js +17 -21
- package/lib/cli/setupServer.js.map +1 -1
- package/lib/cli/util.js +1 -5
- package/lib/cli/util.js.map +1 -1
- package/lib/executor/executor.js +56 -84
- package/lib/executor/executor.js.map +1 -1
- package/lib/executor/executorManager.js +7 -11
- package/lib/executor/executorManager.js.map +1 -1
- package/lib/executor/index.js +4 -20
- package/lib/executor/index.js.map +1 -1
- package/lib/executor/senderManager.js +8 -12
- package/lib/executor/senderManager.js.map +1 -1
- package/lib/executor/test/utils.js +22 -28
- package/lib/executor/test/utils.js.map +1 -1
- package/lib/executor/utils.js +31 -61
- package/lib/executor/utils.js.map +1 -1
- package/lib/index.js +28 -59
- package/lib/index.js.map +1 -1
- package/lib/mempool/index.js +4 -20
- package/lib/mempool/index.js.map +1 -1
- package/lib/mempool/mempool.js +55 -59
- package/lib/mempool/mempool.js.map +1 -1
- package/lib/mempool/monitoring.js +1 -5
- package/lib/mempool/monitoring.js.map +1 -1
- package/lib/mempool/nullMempool.js +1 -5
- package/lib/mempool/nullMempool.js.map +1 -1
- package/lib/mempool/reputationManager.js +44 -49
- package/lib/mempool/reputationManager.js.map +1 -1
- package/lib/mempool/store.js +1 -5
- package/lib/mempool/store.js.map +1 -1
- package/lib/rpc/EntryPointSimulationsV07.js +44 -50
- package/lib/rpc/EntryPointSimulationsV07.js.map +1 -1
- package/lib/rpc/ExecuteSimulator.js +2 -5
- package/lib/rpc/ExecuteSimulator.js.map +1 -1
- package/lib/rpc/gasEstimation.js +62 -69
- package/lib/rpc/gasEstimation.js.map +1 -1
- package/lib/rpc/index.js +4 -20
- package/lib/rpc/index.js.map +1 -1
- package/lib/rpc/nonceQueuer.js +16 -20
- package/lib/rpc/nonceQueuer.js.map +1 -1
- package/lib/rpc/rpcHandler.js +76 -103
- package/lib/rpc/rpcHandler.js.map +1 -1
- package/lib/rpc/server.js +26 -56
- package/lib/rpc/server.js.map +1 -1
- package/lib/rpc/validation/BundlerCollectorTracerV06.js +1 -5
- package/lib/rpc/validation/BundlerCollectorTracerV06.js.map +1 -1
- package/lib/rpc/validation/BundlerCollectorTracerV07.js +1 -5
- package/lib/rpc/validation/BundlerCollectorTracerV07.js.map +1 -1
- package/lib/rpc/validation/SafeValidator.js +65 -69
- package/lib/rpc/validation/SafeValidator.js.map +1 -1
- package/lib/rpc/validation/TracerResultParserV06.js +26 -30
- package/lib/rpc/validation/TracerResultParserV06.js.map +1 -1
- package/lib/rpc/validation/TracerResultParserV07.js +29 -36
- package/lib/rpc/validation/TracerResultParserV07.js.map +1 -1
- package/lib/rpc/validation/UnsafeValidator.js +46 -73
- package/lib/rpc/validation/UnsafeValidator.js.map +1 -1
- package/lib/rpc/validation/index.js +2 -18
- package/lib/rpc/validation/index.js.map +1 -1
- package/lib/rpc/validation/tracer.js +7 -37
- package/lib/rpc/validation/tracer.js.map +1 -1
- package/lib/types/contracts/BundleBulker.js +1 -4
- package/lib/types/contracts/BundleBulker.js.map +1 -1
- package/lib/types/contracts/CallEngine.js +1 -4
- package/lib/types/contracts/CallEngine.js.map +1 -1
- package/lib/types/contracts/CodeHashGetter.js +2 -5
- package/lib/types/contracts/CodeHashGetter.js.map +1 -1
- package/lib/types/contracts/EntryPoint.js +4 -7
- package/lib/types/contracts/EntryPoint.js.map +1 -1
- package/lib/types/contracts/EntryPointSimulations.js +3 -6
- package/lib/types/contracts/EntryPointSimulations.js.map +1 -1
- package/lib/types/contracts/IOpInflator.js +1 -4
- package/lib/types/contracts/IOpInflator.js.map +1 -1
- package/lib/types/contracts/IPaymaster.js +1 -4
- package/lib/types/contracts/IPaymaster.js.map +1 -1
- package/lib/types/contracts/Inflator.js +1 -4
- package/lib/types/contracts/Inflator.js.map +1 -1
- package/lib/types/contracts/PerOpInflator.js +1 -4
- package/lib/types/contracts/PerOpInflator.js.map +1 -1
- package/lib/types/contracts/PimlicoEntryPointSimulations.js +2 -5
- package/lib/types/contracts/PimlicoEntryPointSimulations.js.map +1 -1
- package/lib/types/contracts/SenderCreator.js +2 -5
- package/lib/types/contracts/SenderCreator.js.map +1 -1
- package/lib/types/contracts/SimpleAccountFactory.js +2 -5
- package/lib/types/contracts/SimpleAccountFactory.js.map +1 -1
- package/lib/types/contracts/TestOpcodesAccount.js +2 -5
- package/lib/types/contracts/TestOpcodesAccount.js.map +1 -1
- package/lib/types/contracts/TestOpcodesAccountFactory.js +2 -5
- package/lib/types/contracts/TestOpcodesAccountFactory.js.map +1 -1
- package/lib/types/contracts/TestStorageAccount.js +2 -5
- package/lib/types/contracts/TestStorageAccount.js.map +1 -1
- package/lib/types/contracts/index.js +16 -32
- package/lib/types/contracts/index.js.map +1 -1
- package/lib/types/gasPrice.js +14 -17
- package/lib/types/gasPrice.js.map +1 -1
- package/lib/types/index.js +10 -26
- package/lib/types/index.js.map +1 -1
- package/lib/types/interfaces.js +1 -2
- package/lib/types/mempool.js +5 -10
- package/lib/types/mempool.js.map +1 -1
- package/lib/types/schemas.js +254 -284
- package/lib/types/schemas.js.map +1 -1
- package/lib/types/test/validationTestErrors.js +2 -5
- package/lib/types/test/validationTestErrors.js.map +1 -1
- package/lib/types/utils.js +5 -9
- package/lib/types/utils.js.map +1 -1
- package/lib/types/validation.js +139 -142
- package/lib/types/validation.js.map +1 -1
- package/lib/utils/bigInt.js +2 -7
- package/lib/utils/bigInt.js.map +1 -1
- package/lib/utils/compressionHandler.js +7 -11
- package/lib/utils/compressionHandler.js.map +1 -1
- package/lib/utils/gasPriceManager.js +30 -57
- package/lib/utils/gasPriceManager.js.map +1 -1
- package/lib/utils/helpers.js +5 -10
- package/lib/utils/helpers.js.map +1 -1
- package/lib/utils/index.js +9 -25
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/logger.js +10 -19
- package/lib/utils/logger.js.map +1 -1
- package/lib/utils/metrics.js +20 -24
- package/lib/utils/metrics.js.map +1 -1
- package/lib/utils/rpc-reply.js +1 -3
- package/lib/utils/rpc-reply.js.map +1 -1
- package/lib/utils/test.js +36 -67
- package/lib/utils/test.js.map +1 -1
- package/lib/utils/userop.js +62 -107
- package/lib/utils/userop.js.map +1 -1
- package/lib/utils/validation.js +64 -99
- package/lib/utils/validation.js.map +1 -1
- package/package.json +2 -1
|
@@ -1,41 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const semantic_conventions_1 = require("@opentelemetry/semantic-conventions");
|
|
11
|
-
const opentelemetry_instrumentation_fetch_node_1 = require("opentelemetry-instrumentation-fetch-node");
|
|
1
|
+
import { SpanKind } from "@opentelemetry/api";
|
|
2
|
+
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-proto";
|
|
3
|
+
import { FastifyInstrumentation } from "@opentelemetry/instrumentation-fastify";
|
|
4
|
+
import { HttpInstrumentation } from "@opentelemetry/instrumentation-http";
|
|
5
|
+
import { PinoInstrumentation } from "@opentelemetry/instrumentation-pino";
|
|
6
|
+
import { NodeSDK } from "@opentelemetry/sdk-node";
|
|
7
|
+
import { ParentBasedSampler, SamplingDecision } from "@opentelemetry/sdk-trace-base";
|
|
8
|
+
import { SemanticAttributes } from "@opentelemetry/semantic-conventions";
|
|
9
|
+
import { FetchInstrumentation } from "opentelemetry-instrumentation-fetch-node";
|
|
12
10
|
class CustomSampler {
|
|
13
11
|
shouldSample(_context, _traceId, _spanName, spanKind, attributes) {
|
|
14
12
|
const ignoredRoutes = ["/metrics", "/health"];
|
|
15
|
-
const httpTarget = attributes[
|
|
16
|
-
if (spanKind ===
|
|
13
|
+
const httpTarget = attributes[SemanticAttributes.HTTP_TARGET];
|
|
14
|
+
if (spanKind === SpanKind.SERVER &&
|
|
17
15
|
httpTarget &&
|
|
18
16
|
ignoredRoutes.includes(httpTarget.toString())) {
|
|
19
|
-
return { decision:
|
|
17
|
+
return { decision: SamplingDecision.NOT_RECORD };
|
|
20
18
|
}
|
|
21
19
|
// fallback
|
|
22
|
-
return { decision:
|
|
20
|
+
return { decision: SamplingDecision.RECORD_AND_SAMPLED };
|
|
23
21
|
}
|
|
24
22
|
toString() {
|
|
25
23
|
return "CustomSampler";
|
|
26
24
|
}
|
|
27
25
|
}
|
|
28
|
-
const sdk = new
|
|
29
|
-
traceExporter: new
|
|
26
|
+
const sdk = new NodeSDK({
|
|
27
|
+
traceExporter: new OTLPTraceExporter(),
|
|
30
28
|
instrumentations: [
|
|
31
|
-
new
|
|
29
|
+
new HttpInstrumentation({
|
|
32
30
|
requireParentforOutgoingSpans: true
|
|
33
31
|
}),
|
|
34
|
-
new
|
|
35
|
-
new
|
|
36
|
-
new
|
|
32
|
+
new FetchInstrumentation({}),
|
|
33
|
+
new FastifyInstrumentation(),
|
|
34
|
+
new PinoInstrumentation()
|
|
37
35
|
],
|
|
38
|
-
sampler: new
|
|
36
|
+
sampler: new ParentBasedSampler({ root: new CustomSampler() })
|
|
39
37
|
});
|
|
40
38
|
sdk.start();
|
|
41
39
|
//# sourceMappingURL=instrumentation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../cli/instrumentation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,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d,IAAI,mBAAmB,CAAC;YACpB,6BAA6B,EAAE,IAAI;SACtC,CAAC;QACF,IAAI,oBAAoB,CAAC,EAAE,CAAC;QAC5B,IAAI,sBAAsB,EAAE;QAC5B,IAAI,mBAAmB,EAAE;KAC5B;IACD,OAAO,EAAE,IAAI,kBAAkB,CAAC,EAAE,IAAI,EAAE,IAAI,aAAa,EAAE,EAAE,CAAC;CACjE,CAAC,CAAA;AAEF,GAAG,CAAC,KAAK,EAAE,CAAA"}
|
package/lib/cli/setupServer.js
CHANGED
|
@@ -1,32 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const mempool_1 = require("../mempool/index.js");
|
|
6
|
-
const rpc_1 = require("../rpc/index.js");
|
|
7
|
-
const utils_1 = require("../utils/index.js");
|
|
1
|
+
import { Executor, ExecutorManager } from "../executor/index.js";
|
|
2
|
+
import { MemoryMempool, Monitor, NullReputationManager, ReputationManager } from "../mempool/index.js";
|
|
3
|
+
import { NonceQueuer, RpcHandler, SafeValidator, Server, UnsafeValidator } from "../rpc/index.js";
|
|
4
|
+
import { CompressionHandler } from "../utils/index.js";
|
|
8
5
|
const getReputationManager = ({ client, parsedArgs, logger }) => {
|
|
9
6
|
if (parsedArgs["safe-mode"]) {
|
|
10
|
-
return new
|
|
7
|
+
return new ReputationManager(client, parsedArgs.entrypoints, BigInt(parsedArgs["min-entity-stake"]), BigInt(parsedArgs["min-entity-unstake-delay"]), logger.child({ module: "reputation_manager" }, {
|
|
11
8
|
level: parsedArgs["reputation-manager-log-level"] ||
|
|
12
9
|
parsedArgs["log-level"]
|
|
13
10
|
}));
|
|
14
11
|
}
|
|
15
|
-
return new
|
|
12
|
+
return new NullReputationManager();
|
|
16
13
|
};
|
|
17
14
|
const getValidator = ({ client, parsedArgs, logger, senderManager, metrics, gasPriceManager }) => {
|
|
18
15
|
if (parsedArgs["safe-mode"]) {
|
|
19
|
-
return new
|
|
16
|
+
return new SafeValidator(client, senderManager, logger.child({ module: "rpc" }, {
|
|
20
17
|
level: parsedArgs["rpc-log-level"] || parsedArgs["log-level"]
|
|
21
18
|
}), metrics, gasPriceManager, parsedArgs["chain-type"], parsedArgs["entrypoint-simulation-contract"], parsedArgs["fixed-gas-limit-for-estimation"], parsedArgs.tenderly, parsedArgs["balance-override"]);
|
|
22
19
|
}
|
|
23
|
-
return new
|
|
20
|
+
return new UnsafeValidator(client, logger.child({ module: "rpc" }, { level: parsedArgs["rpc-log-level"] || parsedArgs["log-level"] }), metrics, gasPriceManager, parsedArgs["chain-type"], parsedArgs["entrypoint-simulation-contract"], parsedArgs["fixed-gas-limit-for-estimation"], parsedArgs.tenderly, parsedArgs["balance-override"], parsedArgs["expiration-check"]);
|
|
24
21
|
};
|
|
25
22
|
const getMonitor = () => {
|
|
26
|
-
return new
|
|
23
|
+
return new Monitor();
|
|
27
24
|
};
|
|
28
25
|
const getMempool = ({ monitor, reputationManager, validator, client, parsedArgs, logger, metrics }) => {
|
|
29
|
-
return new
|
|
26
|
+
return new MemoryMempool(monitor, reputationManager, validator, client, parsedArgs["safe-mode"], logger.child({ module: "mempool" }, {
|
|
30
27
|
level: parsedArgs["mempool-log-level"] || parsedArgs["log-level"]
|
|
31
28
|
}), metrics, parsedArgs["mempool-max-parallel-ops"], parsedArgs["mempool-max-queued-ops"], parsedArgs["enforce-unique-senders-per-bundle"]);
|
|
32
29
|
};
|
|
@@ -34,33 +31,33 @@ const getCompressionHandler = async ({ client, parsedArgs }) => {
|
|
|
34
31
|
let compressionHandler = null;
|
|
35
32
|
if (parsedArgs["bundle-bulker-address"] !== undefined &&
|
|
36
33
|
parsedArgs["per-op-inflator-address"] !== undefined) {
|
|
37
|
-
compressionHandler = await
|
|
34
|
+
compressionHandler = await CompressionHandler.createAsync(parsedArgs["bundle-bulker-address"], parsedArgs["per-op-inflator-address"], client);
|
|
38
35
|
}
|
|
39
36
|
return compressionHandler;
|
|
40
37
|
};
|
|
41
38
|
const getExecutor = ({ client, walletClient, senderManager, reputationManager, parsedArgs, logger, metrics, compressionHandler, gasPriceManager }) => {
|
|
42
|
-
return new
|
|
39
|
+
return new Executor(client, walletClient, senderManager, reputationManager, parsedArgs.entrypoints, logger.child({ module: "executor" }, {
|
|
43
40
|
level: parsedArgs["executor-log-level"] || parsedArgs["log-level"]
|
|
44
41
|
}), metrics, compressionHandler, gasPriceManager, !parsedArgs.tenderly, parsedArgs["legacy-transactions"], parsedArgs["fixed-gas-limit-for-estimation"], parsedArgs["local-gas-limit-calculation"]);
|
|
45
42
|
};
|
|
46
43
|
const getExecutorManager = ({ executor, mempool, monitor, reputationManager, client, parsedArgs, logger, metrics, gasPriceManager }) => {
|
|
47
|
-
return new
|
|
44
|
+
return new ExecutorManager(executor, parsedArgs.entrypoints, mempool, monitor, reputationManager, client, parsedArgs["polling-interval"], logger.child({ module: "executor" }, {
|
|
48
45
|
level: parsedArgs["executor-log-level"] || parsedArgs["log-level"]
|
|
49
46
|
}), metrics, parsedArgs["bundle-mode"], parsedArgs["max-bundle-wait"], parsedArgs["max-gas-per-bundle"], gasPriceManager);
|
|
50
47
|
};
|
|
51
48
|
const getNonceQueuer = ({ mempool, client, parsedArgs, logger }) => {
|
|
52
|
-
return new
|
|
49
|
+
return new NonceQueuer(mempool, client, logger.child({ module: "nonce_queuer" }, {
|
|
53
50
|
level: parsedArgs["nonce-queuer-log-level"] ||
|
|
54
51
|
parsedArgs["log-level"]
|
|
55
52
|
}));
|
|
56
53
|
};
|
|
57
54
|
const getRpcHandler = ({ client, validator, mempool, executor, monitor, nonceQueuer, executorManager, reputationManager, parsedArgs, logger, metrics, compressionHandler, gasPriceManager }) => {
|
|
58
|
-
return new
|
|
55
|
+
return new RpcHandler(parsedArgs.entrypoints, client, validator, mempool, executor, monitor, nonceQueuer, executorManager, reputationManager, parsedArgs.tenderly ?? false, parsedArgs["max-block-range"], logger.child({ module: "rpc" }, { level: parsedArgs["rpc-log-level"] || parsedArgs["log-level"] }), metrics, parsedArgs["enable-debug-endpoints"], compressionHandler, parsedArgs["legacy-transactions"], gasPriceManager, parsedArgs["gas-price-multipliers"], parsedArgs["chain-type"], parsedArgs["paymaster-gas-limit-multiplier"], parsedArgs["dangerous-skip-user-operation-validation"]);
|
|
59
56
|
};
|
|
60
57
|
const getServer = ({ rpcEndpoint, parsedArgs, logger, registry, metrics }) => {
|
|
61
|
-
return new
|
|
58
|
+
return new Server(rpcEndpoint, parsedArgs["api-version"], parsedArgs["default-api-version"], parsedArgs.port, parsedArgs.timeout, parsedArgs["websocket-max-payload-size"], parsedArgs.websocket, logger.child({ module: "rpc" }, { level: parsedArgs["rpc-log-level"] || parsedArgs["log-level"] }), registry, metrics);
|
|
62
59
|
};
|
|
63
|
-
const setupServer = async ({ client, walletClient, parsedArgs, logger, rootLogger, registry, metrics, senderManager, gasPriceManager }) => {
|
|
60
|
+
export const setupServer = async ({ client, walletClient, parsedArgs, logger, rootLogger, registry, metrics, senderManager, gasPriceManager }) => {
|
|
64
61
|
const validator = getValidator({
|
|
65
62
|
client,
|
|
66
63
|
logger,
|
|
@@ -155,5 +152,4 @@ const setupServer = async ({ client, walletClient, parsedArgs, logger, rootLogge
|
|
|
155
152
|
process.on("SIGINT", gracefulShutdown);
|
|
156
153
|
process.on("SIGTERM", gracefulShutdown);
|
|
157
154
|
};
|
|
158
|
-
exports.setupServer = setupServer;
|
|
159
155
|
//# sourceMappingURL=setupServer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setupServer.js","sourceRoot":"","sources":["../../cli/setupServer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"setupServer.js","sourceRoot":"","sources":["../../cli/setupServer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAC1D,OAAO,EACH,aAAa,EACb,OAAO,EACP,qBAAqB,EACrB,iBAAiB,EAEpB,MAAM,eAAe,CAAA;AACtB,OAAO,EACH,WAAW,EACX,UA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G,KAAK,EAAE,MAAc,EAAE,EAAE;QAC9C,UAAU,CAAC,IAAI,CAAC,GAAG,MAAM,0BAA0B,CAAC,CAAA;QAEpD,MAAM,MAAM,CAAC,IAAI,EAAE,CAAA;QACnB,UAAU,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA;QAEjC,MAAM,WAAW,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,MAAM,CAAA;QACpD,MAAM,SAAS,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,MAAM,CAAA;QACnD,MAAM,UAAU,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,MAAM,CAAA;QAClD,UAAU,CAAC,IAAI,CACX,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,EACtC,iCAAiC,CACpC,CAAA;QAED,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACnB,CAAC,CAAA;IAED,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAA;IACtC,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAA;AAC3C,CAAC,CAAA"}
|
package/lib/cli/util.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.registerCommandToYargs = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Register a CliCommand type to yargs. Recursively registers subcommands too.
|
|
6
3
|
* @param yargs
|
|
7
4
|
* @param cliCommand
|
|
8
5
|
*/
|
|
9
|
-
function registerCommandToYargs(
|
|
6
|
+
export function registerCommandToYargs(
|
|
10
7
|
// biome-ignore lint/suspicious/noExplicitAny: it's a generic type
|
|
11
8
|
yargs,
|
|
12
9
|
// biome-ignore lint/suspicious/noExplicitAny: it's a generic type
|
|
@@ -30,5 +27,4 @@ cliCommand) {
|
|
|
30
27
|
handler: cliCommand.handler || function emptyHandler() { }
|
|
31
28
|
});
|
|
32
29
|
}
|
|
33
|
-
exports.registerCommandToYargs = registerCommandToYargs;
|
|
34
30
|
//# sourceMappingURL=util.js.map
|
package/lib/cli/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../cli/util.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../cli/util.ts"],"names":[],"mappings":"AAuBA;;;;GAIG;AACH,MAAM,UAAU,sBAAsB;AAClC,kEAAkE;AAClE,KAAgB;AAChB,kEAAkE;AAClE,UAAgC;IAEhC,KAAK,CAAC,OAAO,CAAC;QACV,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,QAAQ,EAAE,UAAU,CAAC,QAAQ;QAC7B,OAAO,EAAE,CAAC,YAAY,EAAE,EAAE;YACtB,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,IAAI,EAAE,CAAC,CAAA;YAC9C,KAAK,MAAM,UAAU,IAAI,UAAU,CAAC,WAAW,IAAI,EAAE,EAAE,CAAC;gBACpD,sBAAsB,CAAC,YAAY,EAAE,UAAU,CAAC,CAAA;YACpD,CAAC;YACD,IAAI,UAAU,CAAC,QAAQ,EAAE,CAAC;gBACtB,KAAK,MAAM,OAAO,IAAI,UAAU,CAAC,QAAQ,EAAE,CAAC;oBACxC,YAAY,CAAC,OAAO,CAChB,MAAM,OAAO,CAAC,OAAO,EAAE,EACvB,OAAO,CAAC,WAAW,CACtB,CAAA;gBACL,CAAC;YACL,CAAC;YACD,OAAO,KAAK,CAAA;QAChB,CAAC;QACD,gEAAgE;QAChE,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,SAAS,YAAY,KAAU,CAAC;KAClE,CAAC,CAAA;AACN,CAAC"}
|
package/lib/executor/executor.js
CHANGED
|
@@ -1,36 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.Executor = exports.NullExecutor = void 0;
|
|
27
|
-
const types_1 = require("../types/index.js");
|
|
28
|
-
const utils_1 = require("../utils/index.js");
|
|
29
|
-
const sentry = __importStar(require("@sentry/node"));
|
|
30
|
-
const async_mutex_1 = require("async-mutex");
|
|
31
|
-
const viem_1 = require("viem");
|
|
32
|
-
const utils_2 = require("./utils.js");
|
|
33
|
-
class NullExecutor {
|
|
1
|
+
import { EntryPointV06Abi, EntryPointV07Abi, deriveUserOperation } from "../types/index.js";
|
|
2
|
+
import { getUserOperationHash, isVersion06, maxBigInt, parseViemError, toPackedUserOperation } from "../utils/index.js";
|
|
3
|
+
import * as sentry from "@sentry/node";
|
|
4
|
+
import { Mutex } from "async-mutex";
|
|
5
|
+
import { FeeCapTooLowError, InsufficientFundsError, IntrinsicGasTooLowError, NonceTooLowError, encodeFunctionData, getContract } from "viem";
|
|
6
|
+
import { createCompressedCalldata, filterOpsAndEstimateGas, flushStuckTransaction, simulatedOpsToResults } from "./utils.js";
|
|
7
|
+
export class NullExecutor {
|
|
34
8
|
bundle(_entryPoint, _ops) {
|
|
35
9
|
return Promise.resolve([]);
|
|
36
10
|
}
|
|
@@ -53,8 +27,7 @@ class NullExecutor {
|
|
|
53
27
|
return Promise.resolve();
|
|
54
28
|
}
|
|
55
29
|
}
|
|
56
|
-
|
|
57
|
-
class Executor {
|
|
30
|
+
export class Executor {
|
|
58
31
|
// private unWatch: WatchBlocksReturnType | undefined
|
|
59
32
|
publicClient;
|
|
60
33
|
walletClient;
|
|
@@ -84,7 +57,7 @@ class Executor {
|
|
|
84
57
|
this.compressionHandler = compressionHandler;
|
|
85
58
|
this.gasPriceManager = gasPriceManager;
|
|
86
59
|
this.entryPoints = entryPoints;
|
|
87
|
-
this.mutex = new
|
|
60
|
+
this.mutex = new Mutex();
|
|
88
61
|
}
|
|
89
62
|
getCompressionHandler() {
|
|
90
63
|
if (!this.compressionHandler) {
|
|
@@ -104,14 +77,14 @@ class Executor {
|
|
|
104
77
|
async replaceTransaction(transactionInfo) {
|
|
105
78
|
const newRequest = { ...transactionInfo.transactionRequest };
|
|
106
79
|
const gasPriceParameters = await this.gasPriceManager.getGasPrice();
|
|
107
|
-
newRequest.maxFeePerGas =
|
|
108
|
-
newRequest.maxPriorityFeePerGas =
|
|
80
|
+
newRequest.maxFeePerGas = maxBigInt(gasPriceParameters.maxFeePerGas, (newRequest.maxFeePerGas * 11n + 9n) / 10n);
|
|
81
|
+
newRequest.maxPriorityFeePerGas = maxBigInt(gasPriceParameters.maxPriorityFeePerGas, (newRequest.maxPriorityFeePerGas * 11n + 9n) / 10n);
|
|
109
82
|
newRequest.account = transactionInfo.executor;
|
|
110
83
|
const opsWithHashes = transactionInfo.userOperationInfos.map((opInfo) => {
|
|
111
|
-
const op =
|
|
84
|
+
const op = deriveUserOperation(opInfo.mempoolUserOperation);
|
|
112
85
|
return {
|
|
113
86
|
mempoolUserOperation: opInfo.mempoolUserOperation,
|
|
114
|
-
userOperationHash:
|
|
87
|
+
userOperationHash: getUserOperationHash(op, transactionInfo.entryPoint, this.walletClient.chain.id),
|
|
115
88
|
entryPoint: opInfo.entryPoint
|
|
116
89
|
};
|
|
117
90
|
});
|
|
@@ -119,17 +92,17 @@ class Executor {
|
|
|
119
92
|
if (transactionInfo.transactionType === "default") {
|
|
120
93
|
const [isUserOpVersion06, entryPoint] = opsWithHashes.reduce((acc, op) => {
|
|
121
94
|
if (acc[0] !==
|
|
122
|
-
|
|
95
|
+
isVersion06(op.mempoolUserOperation) ||
|
|
123
96
|
acc[1] !== op.entryPoint) {
|
|
124
97
|
throw new Error("All user operations must be of the same version");
|
|
125
98
|
}
|
|
126
99
|
return acc;
|
|
127
100
|
}, [
|
|
128
|
-
|
|
101
|
+
isVersion06(opsWithHashes[0].mempoolUserOperation),
|
|
129
102
|
opsWithHashes[0].entryPoint
|
|
130
103
|
]);
|
|
131
|
-
const ep =
|
|
132
|
-
abi: isUserOpVersion06 ?
|
|
104
|
+
const ep = getContract({
|
|
105
|
+
abi: isUserOpVersion06 ? EntryPointV06Abi : EntryPointV07Abi,
|
|
133
106
|
address: entryPoint,
|
|
134
107
|
client: {
|
|
135
108
|
public: this.publicClient,
|
|
@@ -150,7 +123,7 @@ class Executor {
|
|
|
150
123
|
type: "compressed"
|
|
151
124
|
};
|
|
152
125
|
}
|
|
153
|
-
const result = await
|
|
126
|
+
const result = await filterOpsAndEstimateGas(transactionInfo.entryPoint, callContext, transactionInfo.executor, opsWithHashes, newRequest.nonce, newRequest.maxFeePerGas, newRequest.maxPriorityFeePerGas, "latest", this.legacyTransactions, this.fixedGasLimitForEstimation, this.reputationManager, this.logger);
|
|
154
127
|
const childLogger = this.logger.child({
|
|
155
128
|
transactionHash: transactionInfo.transactionHash,
|
|
156
129
|
executor: transactionInfo.executor.address
|
|
@@ -181,7 +154,7 @@ class Executor {
|
|
|
181
154
|
});
|
|
182
155
|
newRequest.gas = this.localGasLimitCalculation
|
|
183
156
|
? opsToBundle.reduce((acc, opInfo) => {
|
|
184
|
-
const userOperation =
|
|
157
|
+
const userOperation = deriveUserOperation(opInfo.mempoolUserOperation);
|
|
185
158
|
return (acc +
|
|
186
159
|
userOperation.preVerificationGas +
|
|
187
160
|
3n * userOperation.verificationGasLimit +
|
|
@@ -192,32 +165,32 @@ class Executor {
|
|
|
192
165
|
if (transactionInfo.transactionType === "default") {
|
|
193
166
|
const isUserOpVersion06 = opsWithHashes.reduce((acc, op) => {
|
|
194
167
|
if (acc !==
|
|
195
|
-
|
|
168
|
+
isVersion06(op.mempoolUserOperation)) {
|
|
196
169
|
throw new Error("All user operations must be of the same version");
|
|
197
170
|
}
|
|
198
171
|
return acc;
|
|
199
|
-
},
|
|
172
|
+
}, isVersion06(opsWithHashes[0].mempoolUserOperation));
|
|
200
173
|
newRequest.data = isUserOpVersion06
|
|
201
|
-
?
|
|
202
|
-
abi:
|
|
174
|
+
? encodeFunctionData({
|
|
175
|
+
abi: EntryPointV06Abi,
|
|
203
176
|
functionName: "handleOps",
|
|
204
177
|
args: [
|
|
205
178
|
opsToBundle.map((opInfo) => opInfo.mempoolUserOperation),
|
|
206
179
|
transactionInfo.executor.address
|
|
207
180
|
]
|
|
208
181
|
})
|
|
209
|
-
:
|
|
210
|
-
abi:
|
|
182
|
+
: encodeFunctionData({
|
|
183
|
+
abi: EntryPointV07Abi,
|
|
211
184
|
functionName: "handleOps",
|
|
212
185
|
args: [
|
|
213
|
-
opsToBundle.map((opInfo) =>
|
|
186
|
+
opsToBundle.map((opInfo) => toPackedUserOperation(opInfo.mempoolUserOperation)),
|
|
214
187
|
transactionInfo.executor.address
|
|
215
188
|
]
|
|
216
189
|
});
|
|
217
190
|
}
|
|
218
191
|
else if (transactionInfo.transactionType === "compressed") {
|
|
219
192
|
const compressedOps = opsToBundle.map((opInfo) => opInfo.mempoolUserOperation);
|
|
220
|
-
newRequest.data =
|
|
193
|
+
newRequest.data = createCompressedCalldata(compressedOps, this.getCompressionHandler().perOpInflatorId);
|
|
221
194
|
}
|
|
222
195
|
try {
|
|
223
196
|
childLogger.info({
|
|
@@ -264,22 +237,22 @@ class Executor {
|
|
|
264
237
|
};
|
|
265
238
|
}
|
|
266
239
|
catch (err) {
|
|
267
|
-
const e =
|
|
240
|
+
const e = parseViemError(err);
|
|
268
241
|
if (!e) {
|
|
269
242
|
sentry.captureException(err);
|
|
270
243
|
childLogger.error({ error: err }, "unknown error replacing transaction");
|
|
271
244
|
}
|
|
272
|
-
if (e instanceof
|
|
245
|
+
if (e instanceof NonceTooLowError) {
|
|
273
246
|
childLogger.trace({ error: e }, "nonce too low, potentially already included");
|
|
274
247
|
return { status: "potentially_already_included" };
|
|
275
248
|
}
|
|
276
|
-
if (e instanceof
|
|
249
|
+
if (e instanceof FeeCapTooLowError) {
|
|
277
250
|
childLogger.warn({ error: e }, "fee cap too low, not replacing");
|
|
278
251
|
}
|
|
279
|
-
if (e instanceof
|
|
252
|
+
if (e instanceof InsufficientFundsError) {
|
|
280
253
|
childLogger.warn({ error: e }, "insufficient funds, not replacing");
|
|
281
254
|
}
|
|
282
|
-
if (e instanceof
|
|
255
|
+
if (e instanceof IntrinsicGasTooLowError) {
|
|
283
256
|
childLogger.warn({ error: e }, "intrinsic gas too low, not replacing");
|
|
284
257
|
}
|
|
285
258
|
childLogger.warn({ error: e }, "error replacing transaction");
|
|
@@ -297,7 +270,7 @@ class Executor {
|
|
|
297
270
|
: Array.from(new Set(this.senderManager.wallets));
|
|
298
271
|
const promises = wallets.map(async (wallet) => {
|
|
299
272
|
for (const entryPoint of this.entryPoints) {
|
|
300
|
-
await
|
|
273
|
+
await flushStuckTransaction(this.publicClient, this.walletClient, wallet, gasPrice.maxFeePerGas * 5n, this.logger, entryPoint);
|
|
301
274
|
}
|
|
302
275
|
});
|
|
303
276
|
await Promise.all(promises);
|
|
@@ -307,18 +280,18 @@ class Executor {
|
|
|
307
280
|
const opsWithHashes = ops.map((op) => {
|
|
308
281
|
return {
|
|
309
282
|
mempoolUserOperation: op,
|
|
310
|
-
userOperationHash:
|
|
283
|
+
userOperationHash: getUserOperationHash(op, entryPoint, this.walletClient.chain.id)
|
|
311
284
|
};
|
|
312
285
|
});
|
|
313
286
|
const isUserOpVersion06 = opsWithHashes.reduce((acc, op) => {
|
|
314
287
|
if (acc !==
|
|
315
|
-
|
|
288
|
+
isVersion06(op.mempoolUserOperation)) {
|
|
316
289
|
throw new Error("All user operations must be of the same version");
|
|
317
290
|
}
|
|
318
291
|
return acc;
|
|
319
|
-
},
|
|
320
|
-
const ep =
|
|
321
|
-
abi: isUserOpVersion06 ?
|
|
292
|
+
}, isVersion06(opsWithHashes[0].mempoolUserOperation));
|
|
293
|
+
const ep = getContract({
|
|
294
|
+
abi: isUserOpVersion06 ? EntryPointV06Abi : EntryPointV07Abi,
|
|
322
295
|
address: entryPoint,
|
|
323
296
|
client: {
|
|
324
297
|
public: this.publicClient,
|
|
@@ -341,7 +314,7 @@ class Executor {
|
|
|
341
314
|
ep,
|
|
342
315
|
type: "default"
|
|
343
316
|
};
|
|
344
|
-
let { gasLimit, simulatedOps, resubmitAllOps } = await
|
|
317
|
+
let { gasLimit, simulatedOps, resubmitAllOps } = await filterOpsAndEstimateGas(entryPoint, callContext, wallet, opsWithHashes, nonce, gasPriceParameters.maxFeePerGas, gasPriceParameters.maxPriorityFeePerGas, "pending", this.legacyTransactions, this.fixedGasLimitForEstimation, this.reputationManager, childLogger);
|
|
345
318
|
gasLimit += 10000n;
|
|
346
319
|
if (resubmitAllOps) {
|
|
347
320
|
this.markWalletProcessed(wallet);
|
|
@@ -352,7 +325,7 @@ class Executor {
|
|
|
352
325
|
entryPoint,
|
|
353
326
|
userOpHash: owh.userOperationHash,
|
|
354
327
|
userOperation: owh.mempoolUserOperation,
|
|
355
|
-
reason:
|
|
328
|
+
reason: FeeCapTooLowError.name
|
|
356
329
|
}
|
|
357
330
|
};
|
|
358
331
|
return bundleResult;
|
|
@@ -415,7 +388,7 @@ class Executor {
|
|
|
415
388
|
...gasOptions
|
|
416
389
|
})
|
|
417
390
|
: await ep.write.handleOps([
|
|
418
|
-
opsWithHashToBundle.map((owh) =>
|
|
391
|
+
opsWithHashToBundle.map((owh) => toPackedUserOperation(owh.mempoolUserOperation)),
|
|
419
392
|
wallet.address
|
|
420
393
|
], {
|
|
421
394
|
account: wallet,
|
|
@@ -425,8 +398,8 @@ class Executor {
|
|
|
425
398
|
});
|
|
426
399
|
}
|
|
427
400
|
catch (err) {
|
|
428
|
-
const e =
|
|
429
|
-
if (e instanceof
|
|
401
|
+
const e = parseViemError(err);
|
|
402
|
+
if (e instanceof InsufficientFundsError) {
|
|
430
403
|
childLogger.error({ error: e }, "insufficient funds, not submitting transaction");
|
|
431
404
|
this.markWalletProcessed(wallet);
|
|
432
405
|
return opsWithHashToBundle.map((owh) => {
|
|
@@ -436,7 +409,7 @@ class Executor {
|
|
|
436
409
|
entryPoint,
|
|
437
410
|
userOpHash: owh.userOperationHash,
|
|
438
411
|
userOperation: owh.mempoolUserOperation,
|
|
439
|
-
reason:
|
|
412
|
+
reason: InsufficientFundsError.name
|
|
440
413
|
}
|
|
441
414
|
};
|
|
442
415
|
});
|
|
@@ -474,7 +447,7 @@ class Executor {
|
|
|
474
447
|
account: wallet,
|
|
475
448
|
to: ep.address,
|
|
476
449
|
data: isUserOpVersion06
|
|
477
|
-
?
|
|
450
|
+
? encodeFunctionData({
|
|
478
451
|
abi: ep.abi,
|
|
479
452
|
functionName: "handleOps",
|
|
480
453
|
args: [
|
|
@@ -482,11 +455,11 @@ class Executor {
|
|
|
482
455
|
wallet.address
|
|
483
456
|
]
|
|
484
457
|
})
|
|
485
|
-
:
|
|
458
|
+
: encodeFunctionData({
|
|
486
459
|
abi: ep.abi,
|
|
487
460
|
functionName: "handleOps",
|
|
488
461
|
args: [
|
|
489
|
-
opsWithHashToBundle.map((owh) =>
|
|
462
|
+
opsWithHashToBundle.map((owh) => toPackedUserOperation(owh.mempoolUserOperation)),
|
|
490
463
|
wallet.address
|
|
491
464
|
]
|
|
492
465
|
}),
|
|
@@ -502,7 +475,7 @@ class Executor {
|
|
|
502
475
|
firstSubmitted: Date.now(),
|
|
503
476
|
timesPotentiallyIncluded: 0
|
|
504
477
|
};
|
|
505
|
-
const userOperationResults =
|
|
478
|
+
const userOperationResults = simulatedOpsToResults(simulatedOps, transactionInfo);
|
|
506
479
|
childLogger.info({
|
|
507
480
|
transactionRequest: {
|
|
508
481
|
...transactionInfo.transactionRequest,
|
|
@@ -534,10 +507,10 @@ class Executor {
|
|
|
534
507
|
perOpInflatorId: compressionHandler.perOpInflatorId,
|
|
535
508
|
type: "compressed"
|
|
536
509
|
};
|
|
537
|
-
let { gasLimit, simulatedOps, resubmitAllOps } = await
|
|
510
|
+
let { gasLimit, simulatedOps, resubmitAllOps } = await filterOpsAndEstimateGas(entryPoint, callContext, wallet, compressedOps.map((compressedOp) => {
|
|
538
511
|
return {
|
|
539
512
|
mempoolUserOperation: compressedOp,
|
|
540
|
-
userOperationHash:
|
|
513
|
+
userOperationHash: getUserOperationHash(compressedOp.inflatedOp, entryPoint, this.walletClient.chain.id)
|
|
541
514
|
};
|
|
542
515
|
}), nonce, gasPriceParameters.maxFeePerGas, gasPriceParameters.maxPriorityFeePerGas, "pending", this.legacyTransactions, this.fixedGasLimitForEstimation, this.reputationManager, childLogger);
|
|
543
516
|
gasLimit += 10000n;
|
|
@@ -548,9 +521,9 @@ class Executor {
|
|
|
548
521
|
status: "resubmit",
|
|
549
522
|
info: {
|
|
550
523
|
entryPoint,
|
|
551
|
-
userOpHash:
|
|
524
|
+
userOpHash: getUserOperationHash(compressedOp.inflatedOp, entryPoint, this.walletClient.chain.id),
|
|
552
525
|
userOperation: compressedOp,
|
|
553
|
-
reason:
|
|
526
|
+
reason: FeeCapTooLowError.name
|
|
554
527
|
}
|
|
555
528
|
};
|
|
556
529
|
});
|
|
@@ -563,7 +536,7 @@ class Executor {
|
|
|
563
536
|
status: "failure",
|
|
564
537
|
error: {
|
|
565
538
|
entryPoint,
|
|
566
|
-
userOpHash:
|
|
539
|
+
userOpHash: getUserOperationHash(compressedOp.inflatedOp, entryPoint, this.walletClient.chain.id),
|
|
567
540
|
reason: "INTERNAL FAILURE"
|
|
568
541
|
}
|
|
569
542
|
};
|
|
@@ -601,7 +574,7 @@ class Executor {
|
|
|
601
574
|
txHash = await this.walletClient.sendTransaction({
|
|
602
575
|
account: wallet,
|
|
603
576
|
to: compressionHandler.bundleBulkerAddress,
|
|
604
|
-
data:
|
|
577
|
+
data: createCompressedCalldata(compressedOps, compressionHandler.perOpInflatorId),
|
|
605
578
|
gas: gasLimit,
|
|
606
579
|
nonce: nonce,
|
|
607
580
|
...gasOptions
|
|
@@ -639,7 +612,7 @@ class Executor {
|
|
|
639
612
|
previousTransactionHashes: [],
|
|
640
613
|
transactionRequest: {
|
|
641
614
|
to: compressionHandler.bundleBulkerAddress,
|
|
642
|
-
data:
|
|
615
|
+
data: createCompressedCalldata(compressedOps, compressionHandler.perOpInflatorId),
|
|
643
616
|
gas: gasLimit,
|
|
644
617
|
account: wallet,
|
|
645
618
|
chain: this.walletClient.chain,
|
|
@@ -653,7 +626,7 @@ class Executor {
|
|
|
653
626
|
firstSubmitted: Date.now(),
|
|
654
627
|
timesPotentiallyIncluded: 0
|
|
655
628
|
};
|
|
656
|
-
const userOperationResults =
|
|
629
|
+
const userOperationResults = simulatedOpsToResults(simulatedOps, transactionInfo);
|
|
657
630
|
childLogger.info({
|
|
658
631
|
txHash,
|
|
659
632
|
opHashes: opsToBundle.map((owh) => owh.userOperationHash)
|
|
@@ -661,5 +634,4 @@ class Executor {
|
|
|
661
634
|
return userOperationResults;
|
|
662
635
|
}
|
|
663
636
|
}
|
|
664
|
-
exports.Executor = Executor;
|
|
665
637
|
//# sourceMappingURL=executor.js.map
|