@lodestar/prover 1.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +135 -0
  3. package/lib/cli/applyPreset.d.ts +2 -0
  4. package/lib/cli/applyPreset.js +72 -0
  5. package/lib/cli/applyPreset.js.map +1 -0
  6. package/lib/cli/cli.d.ts +8 -0
  7. package/lib/cli/cli.js +50 -0
  8. package/lib/cli/cli.js.map +1 -0
  9. package/lib/cli/cmds/index.d.ts +4 -0
  10. package/lib/cli/cmds/index.js +3 -0
  11. package/lib/cli/cmds/index.js.map +1 -0
  12. package/lib/cli/cmds/start/handler.d.ts +7 -0
  13. package/lib/cli/cmds/start/handler.js +30 -0
  14. package/lib/cli/cmds/start/handler.js.map +1 -0
  15. package/lib/cli/cmds/start/index.d.ts +5 -0
  16. package/lib/cli/cmds/start/index.js +15 -0
  17. package/lib/cli/cmds/start/index.js.map +1 -0
  18. package/lib/cli/cmds/start/options.d.ts +27 -0
  19. package/lib/cli/cmds/start/options.js +67 -0
  20. package/lib/cli/cmds/start/options.js.map +1 -0
  21. package/lib/cli/index.d.ts +4 -0
  22. package/lib/cli/index.js +25 -0
  23. package/lib/cli/index.js.map +1 -0
  24. package/lib/cli/options.d.ts +22 -0
  25. package/lib/cli/options.js +50 -0
  26. package/lib/cli/options.js.map +1 -0
  27. package/lib/constants.d.ts +6 -0
  28. package/lib/constants.js +7 -0
  29. package/lib/constants.js.map +1 -0
  30. package/lib/index.d.ts +4 -0
  31. package/lib/index.js +4 -0
  32. package/lib/index.js.map +1 -0
  33. package/lib/index.web.d.ts +3 -0
  34. package/lib/index.web.js +3 -0
  35. package/lib/index.web.js.map +1 -0
  36. package/lib/interfaces.d.ts +69 -0
  37. package/lib/interfaces.js +6 -0
  38. package/lib/interfaces.js.map +1 -0
  39. package/lib/proof_provider/ordered_map.d.ts +8 -0
  40. package/lib/proof_provider/ordered_map.js +24 -0
  41. package/lib/proof_provider/ordered_map.js.map +1 -0
  42. package/lib/proof_provider/payload_store.d.ts +25 -0
  43. package/lib/proof_provider/payload_store.js +154 -0
  44. package/lib/proof_provider/payload_store.js.map +1 -0
  45. package/lib/proof_provider/proof_provider.d.ts +36 -0
  46. package/lib/proof_provider/proof_provider.js +171 -0
  47. package/lib/proof_provider/proof_provider.js.map +1 -0
  48. package/lib/types.d.ts +136 -0
  49. package/lib/types.js +3 -0
  50. package/lib/types.js.map +1 -0
  51. package/lib/utils/assertion.d.ts +10 -0
  52. package/lib/utils/assertion.js +34 -0
  53. package/lib/utils/assertion.js.map +1 -0
  54. package/lib/utils/command.d.ts +22 -0
  55. package/lib/utils/command.js +27 -0
  56. package/lib/utils/command.js.map +1 -0
  57. package/lib/utils/consensus.d.ts +19 -0
  58. package/lib/utils/consensus.js +74 -0
  59. package/lib/utils/consensus.js.map +1 -0
  60. package/lib/utils/conversion.d.ts +47 -0
  61. package/lib/utils/conversion.js +94 -0
  62. package/lib/utils/conversion.js.map +1 -0
  63. package/lib/utils/errors.d.ts +6 -0
  64. package/lib/utils/errors.js +6 -0
  65. package/lib/utils/errors.js.map +1 -0
  66. package/lib/utils/evm.d.ts +44 -0
  67. package/lib/utils/evm.js +193 -0
  68. package/lib/utils/evm.js.map +1 -0
  69. package/lib/utils/execution.d.ts +12 -0
  70. package/lib/utils/execution.js +53 -0
  71. package/lib/utils/execution.js.map +1 -0
  72. package/lib/utils/file.d.ts +8 -0
  73. package/lib/utils/file.js +50 -0
  74. package/lib/utils/file.js.map +1 -0
  75. package/lib/utils/gitData/gitDataPath.d.ts +17 -0
  76. package/lib/utils/gitData/gitDataPath.js +37 -0
  77. package/lib/utils/gitData/gitDataPath.js.map +1 -0
  78. package/lib/utils/gitData/index.d.ts +6 -0
  79. package/lib/utils/gitData/index.js +68 -0
  80. package/lib/utils/gitData/index.js.map +1 -0
  81. package/lib/utils/gitData/writeGitData.d.ts +3 -0
  82. package/lib/utils/gitData/writeGitData.js +8 -0
  83. package/lib/utils/gitData/writeGitData.js.map +1 -0
  84. package/lib/utils/json_rpc.d.ts +17 -0
  85. package/lib/utils/json_rpc.js +115 -0
  86. package/lib/utils/json_rpc.js.map +1 -0
  87. package/lib/utils/logger.d.ts +4 -0
  88. package/lib/utils/logger.js +12 -0
  89. package/lib/utils/logger.js.map +1 -0
  90. package/lib/utils/process.d.ts +20 -0
  91. package/lib/utils/process.js +75 -0
  92. package/lib/utils/process.js.map +1 -0
  93. package/lib/utils/req_resp.d.ts +5 -0
  94. package/lib/utils/req_resp.js +33 -0
  95. package/lib/utils/req_resp.js.map +1 -0
  96. package/lib/utils/rpc.d.ts +26 -0
  97. package/lib/utils/rpc.js +55 -0
  98. package/lib/utils/rpc.js.map +1 -0
  99. package/lib/utils/validation.d.ts +30 -0
  100. package/lib/utils/validation.js +94 -0
  101. package/lib/utils/validation.js.map +1 -0
  102. package/lib/utils/verification.d.ts +34 -0
  103. package/lib/utils/verification.js +62 -0
  104. package/lib/utils/verification.js.map +1 -0
  105. package/lib/utils/version.d.ts +12 -0
  106. package/lib/utils/version.js +59 -0
  107. package/lib/utils/version.js.map +1 -0
  108. package/lib/verified_requests/eth_call.d.ts +4 -0
  109. package/lib/verified_requests/eth_call.js +33 -0
  110. package/lib/verified_requests/eth_call.js.map +1 -0
  111. package/lib/verified_requests/eth_estimateGas.d.ts +4 -0
  112. package/lib/verified_requests/eth_estimateGas.js +33 -0
  113. package/lib/verified_requests/eth_estimateGas.js.map +1 -0
  114. package/lib/verified_requests/eth_getBalance.d.ts +3 -0
  115. package/lib/verified_requests/eth_getBalance.js +13 -0
  116. package/lib/verified_requests/eth_getBalance.js.map +1 -0
  117. package/lib/verified_requests/eth_getBlockByHash.d.ts +4 -0
  118. package/lib/verified_requests/eth_getBlockByHash.js +12 -0
  119. package/lib/verified_requests/eth_getBlockByHash.js.map +1 -0
  120. package/lib/verified_requests/eth_getBlockByNumber.d.ts +7 -0
  121. package/lib/verified_requests/eth_getBlockByNumber.js +12 -0
  122. package/lib/verified_requests/eth_getBlockByNumber.js.map +1 -0
  123. package/lib/verified_requests/eth_getCode.d.ts +3 -0
  124. package/lib/verified_requests/eth_getCode.js +32 -0
  125. package/lib/verified_requests/eth_getCode.js.map +1 -0
  126. package/lib/verified_requests/eth_getTransactionCount.d.ts +6 -0
  127. package/lib/verified_requests/eth_getTransactionCount.js +13 -0
  128. package/lib/verified_requests/eth_getTransactionCount.js.map +1 -0
  129. package/lib/web3_provider.d.ts +14 -0
  130. package/lib/web3_provider.js +138 -0
  131. package/lib/web3_provider.js.map +1 -0
  132. package/lib/web3_proxy.d.ts +13 -0
  133. package/lib/web3_proxy.js +136 -0
  134. package/lib/web3_proxy.js.map +1 -0
  135. package/package.json +100 -0
@@ -0,0 +1,67 @@
1
+ import { DEFAULT_PROXY_REQUEST_TIMEOUT } from "../../../constants.js";
2
+ import { LCTransport } from "../../../interfaces.js";
3
+ import { alwaysAllowedMethods } from "../../../utils/process.js";
4
+ export const startOptions = {
5
+ port: {
6
+ description: "Port number to start the proxy.",
7
+ type: "number",
8
+ default: 8080,
9
+ },
10
+ executionRpcUrl: {
11
+ description: "RPC url for the execution node.",
12
+ type: "string",
13
+ demandOption: true,
14
+ group: "execution",
15
+ },
16
+ unverifiedWhitelist: {
17
+ description: `Methods which are allowed to forward. If not provided, all methods are allowed. ${alwaysAllowedMethods.join(",")} are always allowed.`,
18
+ type: "array",
19
+ demandOption: false,
20
+ group: "execution",
21
+ },
22
+ requestTimeout: {
23
+ description: "Number of ms to wait for a response from the execution node.",
24
+ default: DEFAULT_PROXY_REQUEST_TIMEOUT,
25
+ type: "number",
26
+ demandOption: false,
27
+ group: "execution",
28
+ },
29
+ beaconUrls: {
30
+ description: "The beacon node PRC urls for 'rest' mode.",
31
+ type: "string",
32
+ array: true,
33
+ conflicts: ["beaconBootnodes"],
34
+ group: "beacon",
35
+ },
36
+ beaconBootnodes: {
37
+ description: "The beacon node PRC urls for 'p2p' mode.",
38
+ type: "string",
39
+ array: true,
40
+ conflicts: ["beaconUrls"],
41
+ group: "beacon",
42
+ },
43
+ wsCheckpoint: {
44
+ description: "The trusted checkpoint root to start the lightclient. If not provided will initialize from the latest finalized slot. It shouldn't be older than weak subjectivity period",
45
+ type: "string",
46
+ demandOption: false,
47
+ group: "beacon",
48
+ },
49
+ };
50
+ export function parseStartArgs(args) {
51
+ var _a, _b, _c;
52
+ if (!args.beaconUrls && !args.beaconBootnodes) {
53
+ throw new Error("Either --beaconUrls or --beaconBootnodes must be provided");
54
+ }
55
+ // Remove undefined values to allow deepmerge to inject default values downstream
56
+ return {
57
+ port: args.port,
58
+ executionRpcUrl: args.executionRpcUrl,
59
+ transport: args.beaconUrls ? LCTransport.Rest : LCTransport.P2P,
60
+ urls: (_a = args.beaconUrls) !== null && _a !== void 0 ? _a : [],
61
+ bootnodes: (_b = args.beaconBootnodes) !== null && _b !== void 0 ? _b : [],
62
+ wsCheckpoint: args.wsCheckpoint,
63
+ unverifiedWhitelist: args.unverifiedWhitelist,
64
+ requestTimeout: (_c = args.requestTimeout) !== null && _c !== void 0 ? _c : DEFAULT_PROXY_REQUEST_TIMEOUT,
65
+ };
66
+ }
67
+ //# sourceMappingURL=options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["../../../../src/cli/cmds/start/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,6BAA6B,EAAC,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAC,WAAW,EAAC,MAAM,wBAAwB,CAAC;AAEnD,OAAO,EAAC,oBAAoB,EAAC,MAAM,2BAA2B,CAAC;AAoB/D,MAAM,CAAC,MAAM,YAAY,GAAiC;IACxD,IAAI,EAAE;QACJ,WAAW,EAAE,iCAAiC;QAC9C,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,IAAI;KACd;IAED,eAAe,EAAE;QACf,WAAW,EAAE,iCAAiC;QAC9C,IAAI,EAAE,QAAQ;QACd,YAAY,EAAE,IAAI;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B,SAAS,EAAE,MAAA,IAAI,CAAC,eAAe,mCAAI,EAAE;QACrC,YAAY,EAAE,IAAI,CAAC,YAAY;QAC/B,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;QAC7C,cAAc,EAAE,MAAA,IAAI,CAAC,cAAc,mCAAI,6BAA6B;KACrE,CAAC;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import "./applyPreset.js";
3
+ import "source-map-support/register.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env node
2
+ // MUST import first to apply preset from args
3
+ import "./applyPreset.js";
4
+ import { YargsError } from "../utils/errors.js";
5
+ import { getLodestarProverCli, yarg } from "./cli.js";
6
+ import "source-map-support/register.js";
7
+ const prover = getLodestarProverCli();
8
+ void prover
9
+ .fail((msg, err) => {
10
+ if (msg) {
11
+ // Show command help message when no command is provided
12
+ if (msg.includes("Not enough non-option arguments")) {
13
+ yarg.showHelp();
14
+ // eslint-disable-next-line no-console
15
+ console.log("\n");
16
+ }
17
+ }
18
+ const errorMessage = err !== undefined ? (err instanceof YargsError ? err.message : err.stack) : msg || "Unknown error";
19
+ // eslint-disable-next-line no-console
20
+ console.error(` ✖ ${errorMessage}\n`);
21
+ process.exit(1);
22
+ })
23
+ // Execute CLI
24
+ .parse();
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AAEA,8CAA8C;AAC9C,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAC,oBAAoB,EAAE,IAAI,EAAC,MAAM,UAAU,CAAC;AACpD,OAAO,gCAAgC,CAAC;AAExC,MAAM,MAAM,GAAG,oBAAoB,EAAE,CAAC;AAEtC,KAAK,MAAM;KACR,IAAI,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;IACjB,IAAI,GAAG,EAAE;QACP,wDAAwD;QACxD,IAAI,GAAG,CAAC,QAAQ,CAAC,iCAAiC,CAAC,EAAE;YACnD,IAAI,CAAC,QAAQ,EAAE,CAAC;YAChB,sCAAsC;YACtC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;SACnB;KACF;IAED,MAAM,YAAY,GAChB,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,YAAY,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,eAAe,CAAC;IAErG,sCAAsC;IACtC,OAAO,CAAC,KAAK,CAAC,MAAM,YAAY,IAAI,CAAC,CAAC;IACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC;IAEF,cAAc;KACb,KAAK,EAAE,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { NetworkName } from "@lodestar/config/networks";
2
+ import { LogLevel } from "@lodestar/utils";
3
+ import { CliCommandOptions } from "../utils/command.js";
4
+ export type GlobalArgs = {
5
+ network: string;
6
+ logLevel: string;
7
+ presetFile?: string;
8
+ preset: string;
9
+ paramsFile: string;
10
+ };
11
+ export type GlobalOptions = {
12
+ logLevel: LogLevel;
13
+ } & ({
14
+ paramsFile: string;
15
+ network?: never;
16
+ } | {
17
+ network: NetworkName;
18
+ paramsFile?: never;
19
+ });
20
+ export declare const globalOptions: CliCommandOptions<GlobalArgs>;
21
+ export declare function parseGlobalArgs(args: GlobalArgs): GlobalOptions;
22
+ //# sourceMappingURL=options.d.ts.map
@@ -0,0 +1,50 @@
1
+ import { networksChainConfig } from "@lodestar/config/networks";
2
+ import { LogLevels } from "@lodestar/utils";
3
+ import { ACTIVE_PRESET } from "@lodestar/params";
4
+ export const globalOptions = {
5
+ network: {
6
+ description: "Specify the network to connect.",
7
+ type: "string",
8
+ choices: [
9
+ ...Object.keys(networksChainConfig),
10
+ "dev",
11
+ ],
12
+ conflicts: ["paramsFile"],
13
+ },
14
+ paramsFile: {
15
+ description: "Network configuration file",
16
+ type: "string",
17
+ conflicts: ["network"],
18
+ },
19
+ logLevel: {
20
+ description: "Set the log level.",
21
+ type: "string",
22
+ choices: LogLevels,
23
+ default: "info",
24
+ },
25
+ // hidden option to allow for LODESTAR_PRESET to be set
26
+ preset: {
27
+ hidden: true,
28
+ type: "string",
29
+ default: ACTIVE_PRESET,
30
+ },
31
+ presetFile: {
32
+ hidden: true,
33
+ description: "Preset configuration file to override the active preset with custom values",
34
+ type: "string",
35
+ },
36
+ };
37
+ export function parseGlobalArgs(args) {
38
+ // Remove undefined values to allow deepmerge to inject default values downstream
39
+ if (args.network) {
40
+ return {
41
+ network: args.network,
42
+ logLevel: args.logLevel,
43
+ };
44
+ }
45
+ return {
46
+ logLevel: args.logLevel,
47
+ paramsFile: args.paramsFile,
48
+ };
49
+ }
50
+ //# sourceMappingURL=options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/cli/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,mBAAmB,EAAC,MAAM,2BAA2B,CAAC;AAC3E,OAAO,EAAW,SAAS,EAAC,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAe/C,MAAM,CAAC,MAAM,aAAa,GAAkC;IAC1D,OAAO,EAAE;QACP,WAAW,EAAE,iCAAiC;QAC9C,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE;YACP,GAAG,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC;YACnC,KAAK;SACN;QACD,SAAS,EAAE,CAAC,YAAY,CAAC;KAC1B;IAED,UAAU,EAAE;QACV,WAAW,EAAE,4BAA4B;QACzC,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE,CAAC,SAAS,CAAC;KACvB;IAED,QAAQ,EAAE;QACR,WAAW,EAAE,oBAAoB;QACjC,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,SAAS;QAClB,OAAO,EAAE,MAAM;KAChB;IAED,uDAAuD;IACvD,MAAM,EAAE;QACN,MAAM,EAAE,IAAI;QACZ,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,aAAa;KACvB;IAED,UAAU,EAAE;QACV,MAAM,EAAE,IAAI;QACZ,WAAW,EAAE,4EAA4E;QACzF,IAAI,EAAE,QAAQ;KACf;CACF,CAAC;AAEF,MAAM,UAAU,eAAe,CAAC,IAAgB;IAC9C,iFAAiF;IACjF,IAAI,IAAI,CAAC,OAAO,EAAE;QAChB,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,OAAsB;YACpC,QAAQ,EAAE,IAAI,CAAC,QAAoB;SACpC,CAAC;KACH;IAED,OAAO;QACL,QAAQ,EAAE,IAAI,CAAC,QAAoB;QACnC,UAAU,EAAE,IAAI,CAAC,UAAU;KAC5B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare const MAX_REQUEST_LIGHT_CLIENT_UPDATES = 128;
2
+ export declare const MAX_PAYLOAD_HISTORY = 32;
3
+ export declare const UNVERIFIED_RESPONSE_CODE = -33091;
4
+ export declare const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
5
+ export declare const DEFAULT_PROXY_REQUEST_TIMEOUT = 3000;
6
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1,7 @@
1
+ // https://github.com/ethereum/consensus-specs/blob/dev/specs/altair/light-client/p2p-interface.md#configuration
2
+ export const MAX_REQUEST_LIGHT_CLIENT_UPDATES = 128;
3
+ export const MAX_PAYLOAD_HISTORY = 32;
4
+ export const UNVERIFIED_RESPONSE_CODE = -33091;
5
+ export const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
6
+ export const DEFAULT_PROXY_REQUEST_TIMEOUT = 3000;
7
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,gHAAgH;AAChH,MAAM,CAAC,MAAM,gCAAgC,GAAG,GAAG,CAAC;AACpD,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAC;AACtC,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,KAAK,CAAC;AAC/C,MAAM,CAAC,MAAM,YAAY,GAAG,4CAA4C,CAAC;AACzE,MAAM,CAAC,MAAM,6BAA6B,GAAG,IAAI,CAAC"}
package/lib/index.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export * from "./interfaces.js";
2
+ export { createVerifiedExecutionProvider } from "./web3_provider.js";
3
+ export { createVerifiedExecutionProxy } from "./web3_proxy.js";
4
+ //# sourceMappingURL=index.d.ts.map
package/lib/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export * from "./interfaces.js";
2
+ export { createVerifiedExecutionProvider } from "./web3_provider.js";
3
+ export { createVerifiedExecutionProxy } from "./web3_proxy.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAC,+BAA+B,EAAC,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAC,4BAA4B,EAAC,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./interfaces.js";
2
+ export { createVerifiedExecutionProvider } from "./web3_provider.js";
3
+ //# sourceMappingURL=index.web.d.ts.map
@@ -0,0 +1,3 @@
1
+ export * from "./interfaces.js";
2
+ export { createVerifiedExecutionProvider } from "./web3_provider.js";
3
+ //# sourceMappingURL=index.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.web.js","sourceRoot":"","sources":["../src/index.web.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAC,+BAA+B,EAAC,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,69 @@
1
+ import { ChainConfig } from "@lodestar/config";
2
+ import { NetworkName } from "@lodestar/config/networks";
3
+ import { Logger, LogLevel } from "@lodestar/utils";
4
+ import { ProofProvider } from "./proof_provider/proof_provider.js";
5
+ import { JsonRpcRequest, JsonRpcRequestOrBatch, JsonRpcResponse, JsonRpcResponseOrBatch } from "./types.js";
6
+ import { ELRpc } from "./utils/rpc.js";
7
+ export declare enum LCTransport {
8
+ Rest = "Rest",
9
+ P2P = "P2P"
10
+ }
11
+ export type NetworkOrConfig = {
12
+ network: NetworkName;
13
+ config?: never;
14
+ } | {
15
+ network?: never;
16
+ config: Partial<ChainConfig>;
17
+ };
18
+ export type RootProviderInitOptions = ConsensusNodeOptions & NetworkOrConfig & {
19
+ signal: AbortSignal;
20
+ logger: Logger;
21
+ wsCheckpoint?: string;
22
+ unverifiedWhitelist?: string[];
23
+ };
24
+ export type ELRequestHandler<Params = unknown[], Response = unknown> = (payload: JsonRpcRequestOrBatch<Params>) => Promise<JsonRpcResponseOrBatch<Response> | undefined>;
25
+ export type ELRequestHandlerAny = ELRequestHandler<any, any>;
26
+ export interface EIP1193Provider {
27
+ request: (payload: JsonRpcRequestOrBatch) => Promise<JsonRpcResponseOrBatch>;
28
+ }
29
+ export interface RequestProvider {
30
+ request(payload: JsonRpcRequestOrBatch, callback: (err: Error | undefined, response: JsonRpcResponseOrBatch) => void): void;
31
+ }
32
+ export interface SendProvider {
33
+ send(payload: JsonRpcRequest, callback: (err?: Error | null, response?: JsonRpcResponse) => void): void;
34
+ }
35
+ export interface EthersProvider {
36
+ send(method: string, params: Array<unknown>): Promise<JsonRpcResponse>;
37
+ }
38
+ export interface SendAsyncProvider {
39
+ sendAsync(payload: JsonRpcRequestOrBatch): Promise<JsonRpcResponseOrBatch>;
40
+ }
41
+ export type Web3Provider = SendProvider | EthersProvider | SendAsyncProvider | RequestProvider | EIP1193Provider;
42
+ export type ELVerifiedRequestHandlerOpts<Params = unknown[]> = {
43
+ payload: JsonRpcRequest<Params>;
44
+ rpc: ELRpc;
45
+ proofProvider: ProofProvider;
46
+ logger: Logger;
47
+ };
48
+ export type ELVerifiedRequestHandler<Params = unknown[], Response = unknown> = (opts: ELVerifiedRequestHandlerOpts<Params>) => Promise<JsonRpcResponse<Response>>;
49
+ export type LogOptions = {
50
+ logger?: Logger;
51
+ logLevel?: never;
52
+ } | {
53
+ logLevel?: LogLevel;
54
+ logger?: never;
55
+ };
56
+ export type ConsensusNodeOptions = {
57
+ transport: LCTransport.Rest;
58
+ urls: string[];
59
+ } | {
60
+ transport: LCTransport.P2P;
61
+ bootnodes: string[];
62
+ };
63
+ export type RootProviderOptions = {
64
+ signal?: AbortSignal;
65
+ wsCheckpoint?: string;
66
+ unverifiedWhitelist?: string[];
67
+ };
68
+ export type VerifiedExecutionInitOptions = LogOptions & ConsensusNodeOptions & NetworkOrConfig & RootProviderOptions;
69
+ //# sourceMappingURL=interfaces.d.ts.map
@@ -0,0 +1,6 @@
1
+ export var LCTransport;
2
+ (function (LCTransport) {
3
+ LCTransport["Rest"] = "Rest";
4
+ LCTransport["P2P"] = "P2P";
5
+ })(LCTransport || (LCTransport = {}));
6
+ //# sourceMappingURL=interfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAOA,MAAM,CAAN,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,4BAAa,CAAA;IACb,0BAAW,CAAA;AACb,CAAC,EAHW,WAAW,KAAX,WAAW,QAGtB"}
@@ -0,0 +1,8 @@
1
+ export declare class OrderedMap<T> extends Map<number, T> {
2
+ private _min;
3
+ private _max;
4
+ get min(): number;
5
+ get max(): number;
6
+ set(key: number, value: T): this;
7
+ }
8
+ //# sourceMappingURL=ordered_map.d.ts.map
@@ -0,0 +1,24 @@
1
+ export class OrderedMap extends Map {
2
+ constructor() {
3
+ super(...arguments);
4
+ this._min = 0;
5
+ this._max = 0;
6
+ }
7
+ get min() {
8
+ return this._min;
9
+ }
10
+ get max() {
11
+ return this._max;
12
+ }
13
+ set(key, value) {
14
+ if (key < this._min) {
15
+ this._min = key;
16
+ }
17
+ if (key > this._max) {
18
+ this._max = key;
19
+ }
20
+ super.set(key, value);
21
+ return this;
22
+ }
23
+ }
24
+ //# sourceMappingURL=ordered_map.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ordered_map.js","sourceRoot":"","sources":["../../src/proof_provider/ordered_map.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,UAAc,SAAQ,GAAc;IAAjD;;QACU,SAAI,GAAG,CAAC,CAAC;QACT,SAAI,GAAG,CAAC,CAAC;IAsBnB,CAAC;IApBC,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED,GAAG,CAAC,GAAW,EAAE,KAAQ;QACvB,IAAI,GAAG,GAAG,IAAI,CAAC,IAAI,EAAE;YACnB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;SACjB;QAED,IAAI,GAAG,GAAG,IAAI,CAAC,IAAI,EAAE;YACnB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;SACjB;QAED,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
@@ -0,0 +1,25 @@
1
+ import { Api } from "@lodestar/api";
2
+ import { allForks, capella } from "@lodestar/types";
3
+ import { Logger } from "@lodestar/utils";
4
+ /**
5
+ * The in-memory store for the execution payloads to be used to verify the proofs
6
+ */
7
+ export declare class PayloadStore {
8
+ private opts;
9
+ private finalizedRoots;
10
+ private unfinalizedRoots;
11
+ private payloads;
12
+ private latestBlockRoot;
13
+ constructor(opts: {
14
+ api: Api;
15
+ logger: Logger;
16
+ });
17
+ get finalized(): allForks.ExecutionPayload | undefined;
18
+ get latest(): allForks.ExecutionPayload | undefined;
19
+ get(blockId: number | string): Promise<allForks.ExecutionPayload | undefined>;
20
+ getOrFetchFinalizedPayload(blockNumber: number): Promise<allForks.ExecutionPayload | undefined>;
21
+ set(payload: allForks.ExecutionPayload, finalized: boolean): void;
22
+ processLCHeader(header: capella.LightClientHeader, finalized?: boolean): Promise<void>;
23
+ private prune;
24
+ }
25
+ //# sourceMappingURL=payload_store.d.ts.map
@@ -0,0 +1,154 @@
1
+ import { MAX_PAYLOAD_HISTORY } from "../constants.js";
2
+ import { getExecutionPayloadForBlockNumber, getExecutionPayloads } from "../utils/consensus.js";
3
+ import { bufferToHex, hexToNumber } from "../utils/conversion.js";
4
+ import { OrderedMap } from "./ordered_map.js";
5
+ /**
6
+ * The in-memory store for the execution payloads to be used to verify the proofs
7
+ */
8
+ export class PayloadStore {
9
+ constructor(opts) {
10
+ this.opts = opts;
11
+ // We store the block numbers only for finalized blocks
12
+ this.finalizedRoots = new OrderedMap();
13
+ // Unfinalized blocks are stored by the roots of the beacon chain
14
+ this.unfinalizedRoots = new Map();
15
+ // Payloads store with BlockELRoot as key
16
+ this.payloads = new Map();
17
+ this.latestBlockRoot = null;
18
+ }
19
+ get finalized() {
20
+ const finalizedMaxRoot = this.finalizedRoots.get(this.finalizedRoots.max);
21
+ if (finalizedMaxRoot) {
22
+ return this.payloads.get(finalizedMaxRoot);
23
+ }
24
+ return undefined;
25
+ }
26
+ get latest() {
27
+ if (this.latestBlockRoot) {
28
+ return this.payloads.get(this.latestBlockRoot);
29
+ }
30
+ return undefined;
31
+ }
32
+ async get(blockId) {
33
+ // Given block id is a block hash in hex (32 bytes root takes 64 hex chars + 2 for 0x prefix)
34
+ if (typeof blockId === "string" && blockId.startsWith("0x") && blockId.length === 64 + 2) {
35
+ return this.payloads.get(blockId);
36
+ }
37
+ // Given block id is a block number in hex
38
+ if (typeof blockId === "string" && blockId.startsWith("0x")) {
39
+ return this.getOrFetchFinalizedPayload(hexToNumber(blockId));
40
+ }
41
+ // Given block id is a block number in decimal string
42
+ if (typeof blockId === "string" && !blockId.startsWith("0x")) {
43
+ return this.getOrFetchFinalizedPayload(parseInt(blockId, 10));
44
+ }
45
+ // Given block id is a block number in decimal
46
+ if (typeof blockId === "number") {
47
+ return this.getOrFetchFinalizedPayload(blockId);
48
+ }
49
+ return undefined;
50
+ }
51
+ async getOrFetchFinalizedPayload(blockNumber) {
52
+ if (blockNumber > this.finalizedRoots.max) {
53
+ throw new Error(`Block number ${blockNumber} is higher than the latest finalized block number. We recommend to use block hash for unfinalized blocks.`);
54
+ }
55
+ let blockELRoot = this.finalizedRoots.get(blockNumber);
56
+ // check if we have payload cached locally else fetch from api
57
+ if (!blockELRoot) {
58
+ const payloads = await getExecutionPayloadForBlockNumber(this.opts.api, this.finalizedRoots.min, blockNumber);
59
+ for (const payload of Object.values(payloads)) {
60
+ this.set(payload, true);
61
+ }
62
+ }
63
+ blockELRoot = this.finalizedRoots.get(blockNumber);
64
+ if (blockELRoot) {
65
+ return this.payloads.get(blockELRoot);
66
+ }
67
+ return undefined;
68
+ }
69
+ set(payload, finalized) {
70
+ const blockRoot = bufferToHex(payload.blockHash);
71
+ this.payloads.set(blockRoot, payload);
72
+ if (this.latestBlockRoot) {
73
+ const latestPayload = this.payloads.get(this.latestBlockRoot);
74
+ if (latestPayload && latestPayload.blockNumber < payload.blockNumber) {
75
+ this.latestBlockRoot = blockRoot;
76
+ }
77
+ }
78
+ else {
79
+ this.latestBlockRoot = blockRoot;
80
+ }
81
+ if (finalized) {
82
+ this.finalizedRoots.set(payload.blockNumber, blockRoot);
83
+ }
84
+ }
85
+ async processLCHeader(header, finalized = false) {
86
+ const blockSlot = header.beacon.slot;
87
+ const blockNumber = header.execution.blockNumber;
88
+ const blockELRoot = bufferToHex(header.execution.blockHash);
89
+ const blockCLRoot = bufferToHex(header.beacon.stateRoot);
90
+ const existingELRoot = this.unfinalizedRoots.get(blockCLRoot);
91
+ // ==== Finalized blocks ====
92
+ // if the block is finalized, we need to update the finalizedRoots map
93
+ if (finalized) {
94
+ this.finalizedRoots.set(blockNumber, blockELRoot);
95
+ // If the block is finalized and we already have the payload
96
+ // We can remove it from the unfinalizedRoots map and do nothing else
97
+ if (existingELRoot) {
98
+ this.unfinalizedRoots.delete(blockCLRoot);
99
+ }
100
+ // If the block is finalized and we do not have the payload
101
+ // We need to fetch and set the payload
102
+ else if (finalized && !existingELRoot) {
103
+ this.payloads.set(bufferToHex(header.execution.blockHash), (await getExecutionPayloads({
104
+ api: this.opts.api,
105
+ startSlot: blockSlot,
106
+ endSlot: blockSlot,
107
+ logger: this.opts.logger,
108
+ }))[blockSlot]);
109
+ }
110
+ return;
111
+ }
112
+ // ==== Unfinalized blocks ====
113
+ // We already have the payload for this block
114
+ if (existingELRoot && existingELRoot === blockELRoot) {
115
+ return;
116
+ }
117
+ // Re-org happened, we need to update the payload
118
+ if (existingELRoot && existingELRoot !== blockELRoot) {
119
+ this.payloads.delete(existingELRoot);
120
+ this.unfinalizedRoots.set(blockCLRoot, blockELRoot);
121
+ }
122
+ // We do not have the payload for this block, we need to fetch it
123
+ const payload = (await getExecutionPayloads({
124
+ api: this.opts.api,
125
+ startSlot: blockSlot,
126
+ endSlot: blockSlot,
127
+ logger: this.opts.logger,
128
+ }))[blockSlot];
129
+ this.set(payload, false);
130
+ this.prune();
131
+ }
132
+ prune() {
133
+ if (this.finalizedRoots.size <= MAX_PAYLOAD_HISTORY)
134
+ return;
135
+ for (let blockNumber = this.finalizedRoots.max - MAX_PAYLOAD_HISTORY; blockNumber > this.finalizedRoots.min; blockNumber--) {
136
+ const blockELRoot = this.finalizedRoots.get(blockNumber);
137
+ if (blockELRoot) {
138
+ this.payloads.delete(blockELRoot);
139
+ this.finalizedRoots.delete(blockNumber);
140
+ }
141
+ }
142
+ for (const [clRoot, elRoot] of this.unfinalizedRoots) {
143
+ const payload = this.payloads.get(elRoot);
144
+ if (!payload) {
145
+ this.unfinalizedRoots.delete(clRoot);
146
+ continue;
147
+ }
148
+ if (payload.blockNumber < this.finalizedRoots.min) {
149
+ this.unfinalizedRoots.delete(clRoot);
150
+ }
151
+ }
152
+ }
153
+ }
154
+ //# sourceMappingURL=payload_store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payload_store.js","sourceRoot":"","sources":["../../src/proof_provider/payload_store.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,mBAAmB,EAAC,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAC,iCAAiC,EAAE,oBAAoB,EAAC,MAAM,uBAAuB,CAAC;AAC9F,OAAO,EAAC,WAAW,EAAE,WAAW,EAAC,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAK5C;;GAEG;AACH,MAAM,OAAO,YAAY;IAYvB,YAAoB,IAAgC;QAAhC,SAAI,GAAJ,IAAI,CAA4B;QAXpD,uDAAuD;QAC/C,mBAAc,GAAG,IAAI,UAAU,EAAe,CAAC;QAEvD,iEAAiE;QACzD,qBAAgB,GAAG,IAAI,GAAG,EAA4B,CAAC;QAE/D,yCAAyC;QACjC,aAAQ,GAAG,IAAI,GAAG,EAA0C,CAAC;QAE7D,oBAAe,GAAuB,IAAI,CAAC;IAEI,CAAC;IAExD,IAAI,SAAS;QACX,MAAM,gBAAgB,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;QAC1E,IAAI,gBAAgB,EAAE;YACpB,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;SAC5C;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,MAAM;QACR,IAAI,IAAI,CAAC,eAAe,EAAE;YACxB,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;SAChD;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,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ClB,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM;SACzB,CAAC,CACH,CAAC,SAAS,CAAC,CAAC;QACb,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QACzB,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;IAEO,KAAK;QACX,IAAI,IAAI,CAAC,cAAc,CAAC,IAAI,IAAI,mBAAmB;YAAE,OAAO;QAE5D,KACE,IAAI,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,GAAG,mBAAmB,EAC/D,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,EACrC,WAAW,EAAE,EACb;YACA,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;YACzD,IAAI,WAAW,EAAE;gBACf,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;gBAClC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;aACzC;SACF;QAED,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACpD,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YAC1C,IAAI,CAAC,OAAO,EAAE;gBACZ,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;gBACrC,SAAS;aACV;YAED,IAAI,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE;gBACjD,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;aACtC;SACF;IACH,CAAC;CACF"}
@@ -0,0 +1,36 @@
1
+ import { Api } from "@lodestar/api/beacon";
2
+ import { ChainForkConfig } from "@lodestar/config";
3
+ import { NetworkName } from "@lodestar/config/networks";
4
+ import { Lightclient, RunStatusCode } from "@lodestar/light-client";
5
+ import { LightClientRestTransport } from "@lodestar/light-client/transport";
6
+ import { allForks } from "@lodestar/types";
7
+ import { RootProviderInitOptions } from "../interfaces.js";
8
+ type RootProviderOptions = Omit<RootProviderInitOptions, "transport"> & {
9
+ transport: LightClientRestTransport;
10
+ api: Api;
11
+ config: ChainForkConfig;
12
+ };
13
+ export declare class ProofProvider {
14
+ readonly opts: RootProviderOptions;
15
+ private store;
16
+ private logger;
17
+ private readyPromise?;
18
+ readonly config: ChainForkConfig;
19
+ readonly network: NetworkName;
20
+ readonly api: Api;
21
+ lightClient?: Lightclient;
22
+ constructor(opts: RootProviderOptions);
23
+ waitToBeReady(): Promise<void>;
24
+ static init(opts: RootProviderInitOptions): ProofProvider;
25
+ private sync;
26
+ getStatus(): {
27
+ latest: number;
28
+ finalized: number;
29
+ status: RunStatusCode;
30
+ };
31
+ getExecutionPayload(blockNumber: number | string | "finalized" | "latest"): Promise<allForks.ExecutionPayload>;
32
+ processLCHeader(lcHeader: allForks.LightClientHeader, finalized?: boolean): Promise<void>;
33
+ private registerEvents;
34
+ }
35
+ export {};
36
+ //# sourceMappingURL=proof_provider.d.ts.map