@subql/node-ethereum 2.0.1 → 2.0.2-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.
- package/dist/.tsbuildinfo +1 -1
- package/dist/configure/SubqueryProject.d.ts +2 -4
- package/dist/configure/SubqueryProject.js +17 -17
- package/dist/configure/SubqueryProject.js.map +1 -1
- package/dist/configure/configure.module.d.ts +1 -4
- package/dist/configure/configure.module.js +24 -71
- package/dist/configure/configure.module.js.map +1 -1
- package/dist/ethereum/api.ethereum.d.ts +8 -6
- package/dist/ethereum/api.ethereum.js +13 -6
- package/dist/ethereum/api.ethereum.js.map +1 -1
- package/dist/indexer/blockDispatcher/worker-block-dispatcher.service.js +1 -0
- package/dist/indexer/blockDispatcher/worker-block-dispatcher.service.js.map +1 -1
- package/dist/indexer/dictionary.service.js +1 -1
- package/dist/indexer/dictionary.service.js.map +1 -1
- package/dist/indexer/ds-processor.service.d.ts +4 -21
- package/dist/indexer/ds-processor.service.js +6 -97
- package/dist/indexer/ds-processor.service.js.map +1 -1
- package/dist/indexer/dynamic-ds.service.js +1 -1
- package/dist/indexer/dynamic-ds.service.js.map +1 -1
- package/dist/indexer/fetch.module.js +8 -1
- package/dist/indexer/fetch.module.js.map +1 -1
- package/dist/indexer/fetch.service.d.ts +18 -43
- package/dist/indexer/fetch.service.js +28 -286
- package/dist/indexer/fetch.service.js.map +1 -1
- package/dist/indexer/indexer.manager.d.ts +33 -18
- package/dist/indexer/indexer.manager.js +29 -164
- package/dist/indexer/indexer.manager.js.map +1 -1
- package/dist/indexer/indexer.module.js +0 -1
- package/dist/indexer/indexer.module.js.map +1 -1
- package/dist/indexer/project.service.d.ts +5 -35
- package/dist/indexer/project.service.js +6 -203
- package/dist/indexer/project.service.js.map +1 -1
- package/dist/indexer/sandbox.service.d.ts +6 -5
- package/dist/indexer/sandbox.service.js +14 -18
- package/dist/indexer/sandbox.service.js.map +1 -1
- package/dist/indexer/unfinalizedBlocks.service.d.ts +10 -33
- package/dist/indexer/unfinalizedBlocks.service.js +23 -166
- package/dist/indexer/unfinalizedBlocks.service.js.map +1 -1
- package/dist/indexer/worker/worker.d.ts +2 -1
- package/dist/indexer/worker/worker.js.map +1 -1
- package/dist/indexer/worker/worker.service.d.ts +2 -8
- package/dist/indexer/worker/worker.service.js +1 -3
- package/dist/indexer/worker/worker.service.js.map +1 -1
- package/dist/indexer/worker/worker.unfinalizedBlocks.service.d.ts +8 -5
- package/dist/indexer/worker/worker.unfinalizedBlocks.service.js +10 -0
- package/dist/indexer/worker/worker.unfinalizedBlocks.service.js.map +1 -1
- package/dist/main.js +4 -1
- package/dist/main.js.map +1 -1
- package/dist/meta/meta.controller.d.ts +4 -6
- package/dist/meta/meta.module.js +1 -52
- package/dist/meta/meta.module.js.map +1 -1
- package/dist/meta/meta.service.d.ts +7 -40
- package/dist/meta/meta.service.js +9 -83
- package/dist/meta/meta.service.js.map +1 -1
- package/dist/subcommands/forceClean.init.js +1 -2
- package/dist/subcommands/forceClean.init.js.map +1 -1
- package/dist/subcommands/forceClean.module.js +2 -2
- package/dist/subcommands/forceClean.module.js.map +1 -1
- package/dist/subcommands/mmrMigrate.init.d.ts +2 -0
- package/dist/subcommands/mmrMigrate.init.js +28 -0
- package/dist/subcommands/mmrMigrate.init.js.map +1 -0
- package/dist/subcommands/mmrMigrate.module.d.ts +4 -0
- package/dist/subcommands/mmrMigrate.module.js +48 -0
- package/dist/subcommands/mmrMigrate.module.js.map +1 -0
- package/dist/subcommands/mmrRegenerate.init.d.ts +1 -0
- package/dist/subcommands/mmrRegenerate.init.js +27 -0
- package/dist/subcommands/mmrRegenerate.init.js.map +1 -0
- package/dist/subcommands/mmrRegenerate.module.d.ts +4 -0
- package/dist/subcommands/mmrRegenerate.module.js +46 -0
- package/dist/subcommands/mmrRegenerate.module.js.map +1 -0
- package/dist/subcommands/reindex.module.js +3 -2
- package/dist/subcommands/reindex.module.js.map +1 -1
- package/dist/subcommands/reindex.service.d.ts +1 -2
- package/dist/subcommands/reindex.service.js +5 -10
- package/dist/subcommands/reindex.service.js.map +1 -1
- package/dist/subcommands/testing.init.js.map +1 -1
- package/dist/subcommands/testing.module.js +1 -0
- package/dist/subcommands/testing.module.js.map +1 -1
- package/dist/subcommands/testing.service.d.ts +1 -1
- package/dist/subcommands/testing.service.js +0 -1
- package/dist/subcommands/testing.service.js.map +1 -1
- package/dist/utils/project.d.ts +4 -11
- package/dist/utils/project.js +9 -138
- package/dist/utils/project.js.map +1 -1
- package/dist/yargs.d.ts +90 -2
- package/dist/yargs.js +113 -0
- package/dist/yargs.js.map +1 -1
- package/package.json +11 -19
- package/dist/configure/configure.module.spec.d.ts +0 -1
- package/dist/configure/configure.module.spec.js +0 -26
- package/dist/configure/configure.module.spec.js.map +0 -1
- package/dist/indexer/unfinalizedBlocks.spec.d.ts +0 -1
- package/dist/indexer/unfinalizedBlocks.spec.js +0 -195
- package/dist/indexer/unfinalizedBlocks.spec.js.map +0 -1
- package/dist/subcommands/forceClean.service.d.ts +0 -10
- package/dist/subcommands/forceClean.service.js +0 -89
- package/dist/subcommands/forceClean.service.js.map +0 -1
- package/dist/utils/reindex.d.ts +0 -6
- package/dist/utils/reindex.js +0 -48
- package/dist/utils/reindex.js.map +0 -1
package/dist/yargs.d.ts
CHANGED
|
@@ -1,6 +1,81 @@
|
|
|
1
|
-
export declare const yargsOptions: import("yargs").Argv<import("yargs").Omit<{
|
|
1
|
+
export declare const yargsOptions: import("yargs").Argv<import("yargs").Omit<import("yargs").Omit<import("yargs").Omit<{
|
|
2
2
|
targetHeight: number;
|
|
3
|
-
}, "
|
|
3
|
+
}, "targetHeight" | "probe" | "resetOnly" | "unsafe" | "mmr-store-type" | "mmr-path" | "db-schema" | "subquery"> & import("yargs").InferredOptionTypes<{
|
|
4
|
+
probe: {
|
|
5
|
+
type: "boolean";
|
|
6
|
+
description: string;
|
|
7
|
+
demandOption: false;
|
|
8
|
+
default: boolean;
|
|
9
|
+
};
|
|
10
|
+
targetHeight: {
|
|
11
|
+
type: "number";
|
|
12
|
+
description: string;
|
|
13
|
+
demandOption: false;
|
|
14
|
+
};
|
|
15
|
+
resetOnly: {
|
|
16
|
+
type: "boolean";
|
|
17
|
+
description: string;
|
|
18
|
+
demandOption: false;
|
|
19
|
+
default: boolean;
|
|
20
|
+
};
|
|
21
|
+
unsafe: {
|
|
22
|
+
type: "boolean";
|
|
23
|
+
description: string;
|
|
24
|
+
demandOption: false;
|
|
25
|
+
default: boolean;
|
|
26
|
+
};
|
|
27
|
+
'mmr-store-type': {
|
|
28
|
+
demandOption: false;
|
|
29
|
+
describe: string;
|
|
30
|
+
type: "string";
|
|
31
|
+
choices: string[];
|
|
32
|
+
default: string;
|
|
33
|
+
};
|
|
34
|
+
'mmr-path': {
|
|
35
|
+
alias: string;
|
|
36
|
+
demandOption: false;
|
|
37
|
+
describe: string;
|
|
38
|
+
type: "string";
|
|
39
|
+
};
|
|
40
|
+
'db-schema': {
|
|
41
|
+
demandOption: false;
|
|
42
|
+
describe: string;
|
|
43
|
+
type: "string";
|
|
44
|
+
};
|
|
45
|
+
subquery: {
|
|
46
|
+
alias: string;
|
|
47
|
+
demandOption: true;
|
|
48
|
+
default: string;
|
|
49
|
+
describe: string;
|
|
50
|
+
type: "string";
|
|
51
|
+
};
|
|
52
|
+
}>, "mmr-path" | "db-schema" | "subquery" | "direction"> & import("yargs").InferredOptionTypes<{
|
|
53
|
+
direction: {
|
|
54
|
+
type: "string";
|
|
55
|
+
description: string;
|
|
56
|
+
demandOption: false;
|
|
57
|
+
choices: string[];
|
|
58
|
+
default: string;
|
|
59
|
+
};
|
|
60
|
+
'mmr-path': {
|
|
61
|
+
alias: string;
|
|
62
|
+
demandOption: false;
|
|
63
|
+
describe: string;
|
|
64
|
+
type: "string";
|
|
65
|
+
};
|
|
66
|
+
'db-schema': {
|
|
67
|
+
demandOption: false;
|
|
68
|
+
describe: string;
|
|
69
|
+
type: "string";
|
|
70
|
+
};
|
|
71
|
+
subquery: {
|
|
72
|
+
alias: string;
|
|
73
|
+
demandOption: true;
|
|
74
|
+
default: string;
|
|
75
|
+
describe: string;
|
|
76
|
+
type: "string";
|
|
77
|
+
};
|
|
78
|
+
}>, "unsafe" | "mmr-store-type" | "mmr-path" | "db-schema" | "subquery" | "batch-size" | "block-confirmations" | "config" | "debug" | "dictionary-resolver" | "dictionary-timeout" | "disable-historical" | "ipfs" | "local" | "log-level" | "multi-chain" | "network-dictionary" | "network-endpoint" | "output-fmt" | "port" | "profiler" | "proof-of-index" | "query-limit" | "scale-batch-size" | "pg-ca" | "pg-key" | "pg-cert" | "store-cache-threshold" | "store-get-cache-size" | "store-cache-async" | "store-flush-interval" | "subquery-name" | "subscription" | "timeout" | "timestamp-field" | "unfinalized-blocks" | "workers"> & import("yargs").InferredOptionTypes<{
|
|
4
79
|
'batch-size': {
|
|
5
80
|
demandOption: false;
|
|
6
81
|
describe: string;
|
|
@@ -110,6 +185,13 @@ export declare const yargsOptions: import("yargs").Argv<import("yargs").Omit<{
|
|
|
110
185
|
type: "boolean";
|
|
111
186
|
default: boolean;
|
|
112
187
|
};
|
|
188
|
+
'mmr-store-type': {
|
|
189
|
+
demandOption: false;
|
|
190
|
+
describe: string;
|
|
191
|
+
type: "string";
|
|
192
|
+
choices: string[];
|
|
193
|
+
default: string;
|
|
194
|
+
};
|
|
113
195
|
'query-limit': {
|
|
114
196
|
demandOption: false;
|
|
115
197
|
describe: string;
|
|
@@ -152,6 +234,12 @@ export declare const yargsOptions: import("yargs").Argv<import("yargs").Omit<{
|
|
|
152
234
|
describe: string;
|
|
153
235
|
type: "boolean";
|
|
154
236
|
};
|
|
237
|
+
'store-flush-interval': {
|
|
238
|
+
demandOption: false;
|
|
239
|
+
describe: string;
|
|
240
|
+
type: "number";
|
|
241
|
+
default: number;
|
|
242
|
+
};
|
|
155
243
|
subquery: {
|
|
156
244
|
alias: string;
|
|
157
245
|
demandOption: true;
|
package/dist/yargs.js
CHANGED
|
@@ -50,6 +50,105 @@ exports.yargsOptions = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv)
|
|
|
50
50
|
const { reindexInit } = require('./subcommands/reindex.init');
|
|
51
51
|
return reindexInit(argv.targetHeight);
|
|
52
52
|
},
|
|
53
|
+
})
|
|
54
|
+
.command({
|
|
55
|
+
command: 'mmr-regen',
|
|
56
|
+
describe: 'Re-generate mmr between Filebased/Postgres mmr and Proof of index',
|
|
57
|
+
builder: (yargs) => yargs.options({
|
|
58
|
+
probe: {
|
|
59
|
+
type: 'boolean',
|
|
60
|
+
description: 'Fetch latest mmr height information from file based/postgres DB and Poi table',
|
|
61
|
+
demandOption: false,
|
|
62
|
+
default: false,
|
|
63
|
+
},
|
|
64
|
+
targetHeight: {
|
|
65
|
+
type: 'number',
|
|
66
|
+
description: 'Re-genrate mmr value from this block height',
|
|
67
|
+
demandOption: false,
|
|
68
|
+
},
|
|
69
|
+
resetOnly: {
|
|
70
|
+
type: 'boolean',
|
|
71
|
+
description: 'Only reset the mmr value in both POI and file based/postgres DB to target height',
|
|
72
|
+
demandOption: false,
|
|
73
|
+
default: false,
|
|
74
|
+
},
|
|
75
|
+
unsafe: {
|
|
76
|
+
type: 'boolean',
|
|
77
|
+
description: 'Allow sync mmr from Poi table to file or a postgres DB',
|
|
78
|
+
demandOption: false,
|
|
79
|
+
default: false,
|
|
80
|
+
},
|
|
81
|
+
'mmr-store-type': {
|
|
82
|
+
demandOption: false,
|
|
83
|
+
describe: 'When regenerate MMR store in either a file or a postgres DB',
|
|
84
|
+
type: 'string',
|
|
85
|
+
choices: ['file', 'postgres'],
|
|
86
|
+
default: 'file',
|
|
87
|
+
},
|
|
88
|
+
'mmr-path': {
|
|
89
|
+
alias: 'm',
|
|
90
|
+
demandOption: false,
|
|
91
|
+
describe: 'File based only : local path of the merkle mountain range (.mmr) file',
|
|
92
|
+
type: 'string',
|
|
93
|
+
},
|
|
94
|
+
'db-schema': {
|
|
95
|
+
demandOption: false,
|
|
96
|
+
describe: 'Db schema name of the project',
|
|
97
|
+
type: 'string',
|
|
98
|
+
},
|
|
99
|
+
subquery: {
|
|
100
|
+
alias: 'f',
|
|
101
|
+
demandOption: true,
|
|
102
|
+
default: process.cwd(),
|
|
103
|
+
describe: 'Local path or IPFS cid of the subquery project',
|
|
104
|
+
type: 'string',
|
|
105
|
+
},
|
|
106
|
+
}),
|
|
107
|
+
handler: (argv) => {
|
|
108
|
+
(0, logger_1.initLogger)(argv.debug, argv.outputFmt, argv.logLevel);
|
|
109
|
+
// lazy import to make sure logger is instantiated before all other services
|
|
110
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
111
|
+
const { mmrRegenerateInit } = require('./subcommands/mmrRegenerate.init');
|
|
112
|
+
return mmrRegenerateInit(argv.probe, argv.resetOnly, argv.unsafe, argv.targetHeight);
|
|
113
|
+
},
|
|
114
|
+
})
|
|
115
|
+
.command({
|
|
116
|
+
command: 'mmr-migrate',
|
|
117
|
+
describe: 'Migrate MMR data from storage file to postgres DB',
|
|
118
|
+
builder: (yargs) => yargs.options({
|
|
119
|
+
direction: {
|
|
120
|
+
type: 'string',
|
|
121
|
+
description: 'set direction of migration (file -> DB or DB -> file)',
|
|
122
|
+
demandOption: false,
|
|
123
|
+
choices: ['dbToFile', 'fileToDb'],
|
|
124
|
+
default: 'dbToFile',
|
|
125
|
+
},
|
|
126
|
+
'mmr-path': {
|
|
127
|
+
alias: 'm',
|
|
128
|
+
demandOption: false,
|
|
129
|
+
describe: 'Local path of the merkle mountain range (.mmr) file',
|
|
130
|
+
type: 'string',
|
|
131
|
+
},
|
|
132
|
+
'db-schema': {
|
|
133
|
+
demandOption: false,
|
|
134
|
+
describe: 'Db schema name of the project',
|
|
135
|
+
type: 'string',
|
|
136
|
+
},
|
|
137
|
+
subquery: {
|
|
138
|
+
alias: 'f',
|
|
139
|
+
demandOption: true,
|
|
140
|
+
default: process.cwd(),
|
|
141
|
+
describe: 'Local path or IPFS cid of the subquery project',
|
|
142
|
+
type: 'string',
|
|
143
|
+
},
|
|
144
|
+
}),
|
|
145
|
+
handler: (argv) => {
|
|
146
|
+
(0, logger_1.initLogger)(argv.debug, argv.outputFmt, argv.logLevel);
|
|
147
|
+
// lazy import to make sure logger is instantiated before all other services
|
|
148
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
149
|
+
const { mmrMigrateInit } = require('./subcommands/mmrMigrate.init');
|
|
150
|
+
return mmrMigrateInit(argv.direction);
|
|
151
|
+
},
|
|
53
152
|
})
|
|
54
153
|
.options({
|
|
55
154
|
'batch-size': {
|
|
@@ -161,6 +260,13 @@ exports.yargsOptions = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv)
|
|
|
161
260
|
type: 'boolean',
|
|
162
261
|
default: false,
|
|
163
262
|
},
|
|
263
|
+
'mmr-store-type': {
|
|
264
|
+
demandOption: false,
|
|
265
|
+
describe: 'Store MMR in either a file or a postgres DB',
|
|
266
|
+
type: 'string',
|
|
267
|
+
choices: ['file', 'postgres'],
|
|
268
|
+
default: 'file',
|
|
269
|
+
},
|
|
164
270
|
'query-limit': {
|
|
165
271
|
demandOption: false,
|
|
166
272
|
describe: 'The limit of items a project can query with store.getByField at once',
|
|
@@ -203,6 +309,13 @@ exports.yargsOptions = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv)
|
|
|
203
309
|
describe: 'If enabled the store cache will flush data asyncronously relative to indexing data',
|
|
204
310
|
type: 'boolean',
|
|
205
311
|
},
|
|
312
|
+
'store-flush-interval': {
|
|
313
|
+
demandOption: false,
|
|
314
|
+
describe: 'The interval, in seconds, at which data is flushed from the cache. ' +
|
|
315
|
+
'This ensures that data is persisted regularly when there is either not much data or the project is up to date.',
|
|
316
|
+
type: 'number',
|
|
317
|
+
default: 5,
|
|
318
|
+
},
|
|
206
319
|
subquery: {
|
|
207
320
|
alias: 'f',
|
|
208
321
|
demandOption: true,
|
package/dist/yargs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yargs.js","sourceRoot":"","sources":["../src/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AU,EAAE,IAAI;QAChB,YAAY,EAAE,KAAK;QACnB,QAAQ,EAAE,8BAA8B;QACxC,IAAI,EAAE,QAAQ;KACf;IACD,YAAY,EAAE;QACZ,YAAY,EAAE,KAAK;QACnB,QAAQ,EAAE,qDAAqD;QAC/D,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;KACf;IACD,OAAO,EAAE;QACP,YAAY,EAAE,KAAK;QACnB,QAAQ,EAAE,8DAA8D;QACxE,IAAI,EAAE,QAAQ;KACf;IACD,iBAAiB,EAAE;QACjB,YAAY,EAAE,KAAK;QACnB,QAAQ,EAAE,oDAAoD;QAC9D,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;KACf;IACD,oBAAoB,EAAE;QACpB,YAAY,EAAE,KAAK;QACnB,OAAO,EAAE,KAAK;QACd,QAAQ,EAAE,8CAA8C;QACxD,IAAI,EAAE,SAAS;KAChB;IACD,MAAM,EAAE;QACN,IAAI,EAAE,SAAS;QACf,YAAY,EAAE,KAAK;QACnB,QAAQ,EAAE,wDAAwD;KACnE;IACD,OAAO,EAAE;QACP,KAAK,EAAE,GAAG;QACV,YAAY,EAAE,KAAK;QACnB,QAAQ,EACN,0FAA0F;QAC5F,IAAI,EAAE,QAAQ;KACf;CACF,CAAC,CAAC","sourcesContent":["// Copyright 2020-2022 OnFinality Limited authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport { initLogger } from '@subql/node-core/logger';\nimport { hideBin } from 'yargs/helpers';\nimport yargs from 'yargs/yargs';\n\nexport const yargsOptions = yargs(hideBin(process.argv))\n .env('SUBQL_NODE')\n .command({\n command: 'test',\n describe: 'Run tests for a SubQuery application',\n builder: {},\n handler: (argv) => {\n initLogger(\n argv.debug as boolean,\n argv.outputFmt as 'json' | 'colored',\n argv.logLevel as string | undefined,\n );\n // lazy import to make sure logger is instantiated before all other services\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { testingInit } = require('./subcommands/testing.init');\n return testingInit();\n },\n })\n .command({\n command: 'force-clean',\n describe:\n 'Clean the database dropping project schemas and tables. Once the command is executed, the application would exit upon completion.',\n builder: {},\n handler: (argv) => {\n initLogger(\n argv.debug as boolean,\n argv.outputFmt as 'json' | 'colored',\n argv.logLevel as string | undefined,\n );\n\n // lazy import to make sure logger is instantiated before all other services\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { forceCleanInit } = require('./subcommands/forceClean.init');\n return forceCleanInit();\n },\n })\n .command({\n command: 'reindex',\n describe:\n 'Reindex to specified block height. Historical must be enabled for the targeted project (--disable-historical=false). Once the command is executed, the application would exit upon completion.',\n builder: (yargs) =>\n yargs.options('targetHeight', {\n type: 'number',\n description: 'set targetHeight',\n require: true,\n }),\n handler: (argv) => {\n initLogger(\n argv.debug as boolean,\n argv.outputFmt as 'json' | 'colored',\n argv.logLevel as string | undefined,\n );\n // lazy import to make sure logger is instantiated before all other services\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { reindexInit } = require('./subcommands/reindex.init');\n return reindexInit(argv.targetHeight);\n },\n })\n .options({\n 'batch-size': {\n demandOption: false,\n describe: 'Batch size of blocks to fetch in one round',\n type: 'number',\n },\n 'block-confirmations': {\n demandOption: false,\n default: 20,\n describe:\n 'The number of blocks behind the head to be considered finalized, this has no effect with Ethereum',\n type: 'number',\n },\n config: {\n alias: 'c',\n demandOption: false,\n describe: 'Specify configuration file',\n type: 'string',\n },\n 'db-schema': {\n demandOption: false,\n describe: 'Db schema name of the project',\n type: 'string',\n },\n debug: {\n demandOption: false,\n describe:\n 'Show debug information to console output. will forcefully set log level to debug',\n type: 'boolean',\n default: false,\n },\n 'dictionary-resolver': {\n demandOption: false,\n describe: 'Use SubQuery Network dictionary resolver',\n type: 'boolean',\n default: false,\n },\n 'dictionary-timeout': {\n demandOption: false,\n describe: 'Max timeout for dictionary query',\n type: 'number',\n },\n 'disable-historical': {\n demandOption: false,\n default: false,\n describe: 'Disable storing historical state entities',\n type: 'boolean',\n },\n ipfs: {\n demandOption: false,\n describe: 'IPFS gateway endpoint',\n type: 'string',\n },\n local: {\n deprecated: true,\n type: 'boolean',\n demandOption: false,\n describe: 'Use local mode',\n },\n 'log-level': {\n demandOption: false,\n describe: 'Specify log level to print. Ignored when --debug is used',\n type: 'string',\n choices: ['fatal', 'error', 'warn', 'info', 'debug', 'trace', 'silent'],\n },\n 'mmr-path': {\n alias: 'm',\n demandOption: false,\n describe: 'Local path of the merkle mountain range (.mmr) file',\n type: 'string',\n },\n 'multi-chain': {\n demandOption: false,\n default: false,\n describe:\n 'Enables indexing multiple subquery projects into the same database schema',\n type: 'boolean',\n },\n 'network-dictionary': {\n alias: 'd',\n demandOption: false,\n describe: 'Specify the dictionary api for this network',\n type: 'string',\n },\n 'network-endpoint': {\n demandOption: false,\n type: 'string',\n describe: 'Blockchain network endpoint to connect',\n },\n 'output-fmt': {\n demandOption: false,\n describe: 'Print log as json or plain text',\n type: 'string',\n choices: ['json', 'colored'],\n },\n port: {\n alias: 'p',\n demandOption: false,\n describe: 'The port the service will bind to',\n type: 'number',\n },\n profiler: {\n demandOption: false,\n describe: 'Show profiler information to console output',\n type: 'boolean',\n default: false,\n },\n 'proof-of-index': {\n demandOption: false,\n describe: 'Enable/disable proof of index',\n type: 'boolean',\n default: false,\n },\n 'query-limit': {\n demandOption: false,\n describe:\n 'The limit of items a project can query with store.getByField at once',\n type: 'number',\n default: 100,\n },\n 'scale-batch-size': {\n type: 'boolean',\n demandOption: false,\n describe: 'scale batch size based on memory usage',\n default: false,\n },\n 'pg-ca': {\n demandOption: false,\n describe:\n 'Postgres ca certificate - to enable TLS/SSL connections to your PostgreSQL, path to the server certificate file are required, e.g /path/to/server-certificates/root.crt',\n type: 'string',\n },\n 'pg-key': {\n demandOption: false,\n describe:\n 'Postgres client key - Path to key file e.g /path/to/client-key/postgresql.key',\n type: 'string',\n },\n 'pg-cert': {\n demandOption: false,\n describe:\n 'Postgres client certificate - Path to client certificate e.g /path/to/client-certificates/postgresql.crt',\n type: 'string',\n },\n 'store-cache-threshold': {\n demandOption: false,\n describe:\n 'Store cache will flush data to the database when number of records excess this threshold',\n type: 'number',\n },\n 'store-get-cache-size': {\n demandOption: false,\n describe: 'Store get cache size for each model',\n type: 'number',\n },\n 'store-cache-async': {\n demandOption: false,\n describe:\n 'If enabled the store cache will flush data asyncronously relative to indexing data',\n type: 'boolean',\n },\n subquery: {\n alias: 'f',\n demandOption: true,\n default: process.cwd(),\n describe: 'Local path or IPFS cid of the subquery project',\n type: 'string',\n },\n 'subquery-name': {\n deprecated: true,\n demandOption: false,\n describe: 'Name of the subquery project',\n type: 'string',\n },\n subscription: {\n demandOption: false,\n describe: 'Enable subscription by create notification triggers',\n type: 'boolean',\n default: false,\n },\n timeout: {\n demandOption: false,\n describe: 'Timeout for indexer sandbox to execute the mapping functions',\n type: 'number',\n },\n 'timestamp-field': {\n demandOption: false,\n describe: 'Enable/disable created_at and updated_at in schema',\n type: 'boolean',\n default: false,\n },\n 'unfinalized-blocks': {\n demandOption: false,\n default: false,\n describe: 'Enable to fetch and index unfinalized blocks',\n type: 'boolean',\n },\n unsafe: {\n type: 'boolean',\n demandOption: false,\n describe: 'Allows usage of any built-in module within the sandbox',\n },\n workers: {\n alias: 'w',\n demandOption: false,\n describe:\n 'Number of worker threads to use for fetching and processing blocks. Disabled by default.',\n type: 'number',\n },\n });\n"]}
|
|
1
|
+
{"version":3,"file":"yargs.js","sourceRoot":"","sources":["../src/yargs.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sCAAsC;;;;;;AAEtC,oDAAqD;AACrD,2CAAwC;AACxC,wDAAgC;AAEnB,QAAA,YAAY,GAAG,IAAA,eAAK,EAAC,IAAA,iBAAO,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;KACrD,GAAG,CAAC,YAAY,CAAC;KACjB,OAAO,CAAC;IACP,OAAO,EAAE,MAAM;IACf,QAAQ,EAAE,sCAAsC;IAChD,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,CAAC,IAAI,EAAE,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ACtB,QAAQ,EAAE,gDAAgD;QAC1D,IAAI,EAAE,QAAQ;KACf;IACD,eAAe,EAAE;QACf,UAAU,EAAE,IAAI;QAChB,YAAY,EAAE,KAAK;QACnB,QAAQ,EAAE,8BAA8B;QACxC,IAAI,EAAE,QAAQ;KACf;IACD,YAAY,EAAE;QACZ,YAAY,EAAE,KAAK;QACnB,QAAQ,EAAE,qDAAqD;QAC/D,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;KACf;IACD,OAAO,EAAE;QACP,YAAY,EAAE,KAAK;QACnB,QAAQ,EAAE,8DAA8D;QACxE,IAAI,EAAE,QAAQ;KACf;IACD,iBAAiB,EAAE;QACjB,YAAY,EAAE,KAAK;QACnB,QAAQ,EAAE,oDAAoD;QAC9D,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;KACf;IACD,oBAAoB,EAAE;QACpB,YAAY,EAAE,KAAK;QACnB,OAAO,EAAE,KAAK;QACd,QAAQ,EAAE,8CAA8C;QACxD,IAAI,EAAE,SAAS;KAChB;IACD,MAAM,EAAE;QACN,IAAI,EAAE,SAAS;QACf,YAAY,EAAE,KAAK;QACnB,QAAQ,EAAE,wDAAwD;KACnE;IACD,OAAO,EAAE;QACP,KAAK,EAAE,GAAG;QACV,YAAY,EAAE,KAAK;QACnB,QAAQ,EACN,0FAA0F;QAC5F,IAAI,EAAE,QAAQ;KACf;CACF,CAAC,CAAC","sourcesContent":["// Copyright 2020-2022 OnFinality Limited authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport { initLogger } from '@subql/node-core/logger';\nimport { hideBin } from 'yargs/helpers';\nimport yargs from 'yargs/yargs';\n\nexport const yargsOptions = yargs(hideBin(process.argv))\n .env('SUBQL_NODE')\n .command({\n command: 'test',\n describe: 'Run tests for a SubQuery application',\n builder: {},\n handler: (argv) => {\n initLogger(\n argv.debug as boolean,\n argv.outputFmt as 'json' | 'colored',\n argv.logLevel as string | undefined,\n );\n // lazy import to make sure logger is instantiated before all other services\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { testingInit } = require('./subcommands/testing.init');\n return testingInit();\n },\n })\n .command({\n command: 'force-clean',\n describe:\n 'Clean the database dropping project schemas and tables. Once the command is executed, the application would exit upon completion.',\n builder: {},\n handler: (argv) => {\n initLogger(\n argv.debug as boolean,\n argv.outputFmt as 'json' | 'colored',\n argv.logLevel as string | undefined,\n );\n\n // lazy import to make sure logger is instantiated before all other services\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { forceCleanInit } = require('./subcommands/forceClean.init');\n return forceCleanInit();\n },\n })\n .command({\n command: 'reindex',\n describe:\n 'Reindex to specified block height. Historical must be enabled for the targeted project (--disable-historical=false). Once the command is executed, the application would exit upon completion.',\n builder: (yargs) =>\n yargs.options('targetHeight', {\n type: 'number',\n description: 'set targetHeight',\n require: true,\n }),\n handler: (argv) => {\n initLogger(\n argv.debug as boolean,\n argv.outputFmt as 'json' | 'colored',\n argv.logLevel as string | undefined,\n );\n // lazy import to make sure logger is instantiated before all other services\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { reindexInit } = require('./subcommands/reindex.init');\n return reindexInit(argv.targetHeight);\n },\n })\n .command({\n command: 'mmr-regen',\n describe:\n 'Re-generate mmr between Filebased/Postgres mmr and Proof of index',\n builder: (yargs) =>\n yargs.options({\n probe: {\n type: 'boolean',\n description:\n 'Fetch latest mmr height information from file based/postgres DB and Poi table',\n demandOption: false,\n default: false,\n },\n targetHeight: {\n type: 'number',\n description: 'Re-genrate mmr value from this block height',\n demandOption: false,\n },\n resetOnly: {\n type: 'boolean',\n description:\n 'Only reset the mmr value in both POI and file based/postgres DB to target height',\n demandOption: false,\n default: false,\n },\n unsafe: {\n type: 'boolean',\n description: 'Allow sync mmr from Poi table to file or a postgres DB',\n demandOption: false,\n default: false,\n },\n 'mmr-store-type': {\n demandOption: false,\n describe:\n 'When regenerate MMR store in either a file or a postgres DB',\n type: 'string',\n choices: ['file', 'postgres'],\n default: 'file',\n },\n 'mmr-path': {\n alias: 'm',\n demandOption: false,\n describe:\n 'File based only : local path of the merkle mountain range (.mmr) file',\n type: 'string',\n },\n 'db-schema': {\n demandOption: false,\n describe: 'Db schema name of the project',\n type: 'string',\n },\n subquery: {\n alias: 'f',\n demandOption: true,\n default: process.cwd(),\n describe: 'Local path or IPFS cid of the subquery project',\n type: 'string',\n },\n }),\n handler: (argv) => {\n initLogger(\n argv.debug as boolean,\n argv.outputFmt as 'json' | 'colored',\n argv.logLevel as string | undefined,\n );\n\n // lazy import to make sure logger is instantiated before all other services\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { mmrRegenerateInit } = require('./subcommands/mmrRegenerate.init');\n return mmrRegenerateInit(\n argv.probe,\n argv.resetOnly,\n argv.unsafe,\n argv.targetHeight,\n );\n },\n })\n .command({\n command: 'mmr-migrate',\n describe: 'Migrate MMR data from storage file to postgres DB',\n builder: (yargs) =>\n yargs.options({\n direction: {\n type: 'string',\n description: 'set direction of migration (file -> DB or DB -> file)',\n demandOption: false,\n choices: ['dbToFile', 'fileToDb'],\n default: 'dbToFile',\n },\n 'mmr-path': {\n alias: 'm',\n demandOption: false,\n describe: 'Local path of the merkle mountain range (.mmr) file',\n type: 'string',\n },\n 'db-schema': {\n demandOption: false,\n describe: 'Db schema name of the project',\n type: 'string',\n },\n subquery: {\n alias: 'f',\n demandOption: true,\n default: process.cwd(),\n describe: 'Local path or IPFS cid of the subquery project',\n type: 'string',\n },\n }),\n handler: (argv) => {\n initLogger(\n argv.debug as boolean,\n argv.outputFmt as 'json' | 'colored',\n argv.logLevel as string | undefined,\n );\n\n // lazy import to make sure logger is instantiated before all other services\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { mmrMigrateInit } = require('./subcommands/mmrMigrate.init');\n return mmrMigrateInit(argv.direction);\n },\n })\n .options({\n 'batch-size': {\n demandOption: false,\n describe: 'Batch size of blocks to fetch in one round',\n type: 'number',\n },\n 'block-confirmations': {\n demandOption: false,\n default: 20,\n describe:\n 'The number of blocks behind the head to be considered finalized, this has no effect with Ethereum',\n type: 'number',\n },\n config: {\n alias: 'c',\n demandOption: false,\n describe: 'Specify configuration file',\n type: 'string',\n },\n 'db-schema': {\n demandOption: false,\n describe: 'Db schema name of the project',\n type: 'string',\n },\n debug: {\n demandOption: false,\n describe:\n 'Show debug information to console output. will forcefully set log level to debug',\n type: 'boolean',\n default: false,\n },\n 'dictionary-resolver': {\n demandOption: false,\n describe: 'Use SubQuery Network dictionary resolver',\n type: 'boolean',\n default: false,\n },\n 'dictionary-timeout': {\n demandOption: false,\n describe: 'Max timeout for dictionary query',\n type: 'number',\n },\n 'disable-historical': {\n demandOption: false,\n default: false,\n describe: 'Disable storing historical state entities',\n type: 'boolean',\n },\n ipfs: {\n demandOption: false,\n describe: 'IPFS gateway endpoint',\n type: 'string',\n },\n local: {\n deprecated: true,\n type: 'boolean',\n demandOption: false,\n describe: 'Use local mode',\n },\n 'log-level': {\n demandOption: false,\n describe: 'Specify log level to print. Ignored when --debug is used',\n type: 'string',\n choices: ['fatal', 'error', 'warn', 'info', 'debug', 'trace', 'silent'],\n },\n 'mmr-path': {\n alias: 'm',\n demandOption: false,\n describe: 'Local path of the merkle mountain range (.mmr) file',\n type: 'string',\n },\n 'multi-chain': {\n demandOption: false,\n default: false,\n describe:\n 'Enables indexing multiple subquery projects into the same database schema',\n type: 'boolean',\n },\n 'network-dictionary': {\n alias: 'd',\n demandOption: false,\n describe: 'Specify the dictionary api for this network',\n type: 'string',\n },\n 'network-endpoint': {\n demandOption: false,\n type: 'string',\n describe: 'Blockchain network endpoint to connect',\n },\n 'output-fmt': {\n demandOption: false,\n describe: 'Print log as json or plain text',\n type: 'string',\n choices: ['json', 'colored'],\n },\n port: {\n alias: 'p',\n demandOption: false,\n describe: 'The port the service will bind to',\n type: 'number',\n },\n profiler: {\n demandOption: false,\n describe: 'Show profiler information to console output',\n type: 'boolean',\n default: false,\n },\n 'proof-of-index': {\n demandOption: false,\n describe: 'Enable/disable proof of index',\n type: 'boolean',\n default: false,\n },\n 'mmr-store-type': {\n demandOption: false,\n describe: 'Store MMR in either a file or a postgres DB',\n type: 'string',\n choices: ['file', 'postgres'],\n default: 'file',\n },\n 'query-limit': {\n demandOption: false,\n describe:\n 'The limit of items a project can query with store.getByField at once',\n type: 'number',\n default: 100,\n },\n 'scale-batch-size': {\n type: 'boolean',\n demandOption: false,\n describe: 'scale batch size based on memory usage',\n default: false,\n },\n 'pg-ca': {\n demandOption: false,\n describe:\n 'Postgres ca certificate - to enable TLS/SSL connections to your PostgreSQL, path to the server certificate file are required, e.g /path/to/server-certificates/root.crt',\n type: 'string',\n },\n 'pg-key': {\n demandOption: false,\n describe:\n 'Postgres client key - Path to key file e.g /path/to/client-key/postgresql.key',\n type: 'string',\n },\n 'pg-cert': {\n demandOption: false,\n describe:\n 'Postgres client certificate - Path to client certificate e.g /path/to/client-certificates/postgresql.crt',\n type: 'string',\n },\n 'store-cache-threshold': {\n demandOption: false,\n describe:\n 'Store cache will flush data to the database when number of records excess this threshold',\n type: 'number',\n },\n 'store-get-cache-size': {\n demandOption: false,\n describe: 'Store get cache size for each model',\n type: 'number',\n },\n 'store-cache-async': {\n demandOption: false,\n describe:\n 'If enabled the store cache will flush data asyncronously relative to indexing data',\n type: 'boolean',\n },\n 'store-flush-interval': {\n demandOption: false,\n describe:\n 'The interval, in seconds, at which data is flushed from the cache. ' +\n 'This ensures that data is persisted regularly when there is either not much data or the project is up to date.',\n type: 'number',\n default: 5,\n },\n subquery: {\n alias: 'f',\n demandOption: true,\n default: process.cwd(),\n describe: 'Local path or IPFS cid of the subquery project',\n type: 'string',\n },\n 'subquery-name': {\n deprecated: true,\n demandOption: false,\n describe: 'Name of the subquery project',\n type: 'string',\n },\n subscription: {\n demandOption: false,\n describe: 'Enable subscription by create notification triggers',\n type: 'boolean',\n default: false,\n },\n timeout: {\n demandOption: false,\n describe: 'Timeout for indexer sandbox to execute the mapping functions',\n type: 'number',\n },\n 'timestamp-field': {\n demandOption: false,\n describe: 'Enable/disable created_at and updated_at in schema',\n type: 'boolean',\n default: false,\n },\n 'unfinalized-blocks': {\n demandOption: false,\n default: false,\n describe: 'Enable to fetch and index unfinalized blocks',\n type: 'boolean',\n },\n unsafe: {\n type: 'boolean',\n demandOption: false,\n describe: 'Allows usage of any built-in module within the sandbox',\n },\n workers: {\n alias: 'w',\n demandOption: false,\n describe:\n 'Number of worker threads to use for fetching and processing blocks. Disabled by default.',\n type: 'number',\n },\n });\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@subql/node-ethereum",
|
|
3
|
-
"version": "2.0.1",
|
|
3
|
+
"version": "2.0.2-1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Ian He",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -24,31 +24,25 @@
|
|
|
24
24
|
"@nestjs/event-emitter": "^1.3.0",
|
|
25
25
|
"@nestjs/platform-express": "^8.2.6",
|
|
26
26
|
"@nestjs/schedule": "^1.0.2",
|
|
27
|
-
"@subql/common": "^2.
|
|
28
|
-
"@subql/common-ethereum": "2.0.0",
|
|
29
|
-
"@subql/node-core": "^2.
|
|
27
|
+
"@subql/common": "^2.1.1",
|
|
28
|
+
"@subql/common-ethereum": "2.0.1-0",
|
|
29
|
+
"@subql/node-core": "^2.1.2",
|
|
30
30
|
"@subql/testing": "^2.0.0",
|
|
31
|
-
"@subql/types
|
|
32
|
-
"@subql/
|
|
33
|
-
"@subql/
|
|
31
|
+
"@subql/types": "^2.1.2",
|
|
32
|
+
"@subql/types-ethereum": "2.0.1-0",
|
|
33
|
+
"@subql/utils": "^2.1.0",
|
|
34
34
|
"@willsoto/nestjs-prometheus": "^4.4.0",
|
|
35
|
-
"algosdk": "^1.13.1",
|
|
36
|
-
"app-module-path": "^2.2.0",
|
|
37
35
|
"cacheable-lookup": "6",
|
|
38
36
|
"cron-converter": "^1.0.2",
|
|
39
|
-
"dayjs": "^1.10.7",
|
|
40
37
|
"ethers": "^5.7.0",
|
|
41
38
|
"eventemitter2": "^6.4.5",
|
|
42
39
|
"lodash": "^4.17.21",
|
|
43
|
-
"merkle-tools": "^1.4.1",
|
|
44
|
-
"parse-json": "^6.0.2",
|
|
45
40
|
"pg": "^8.7.1",
|
|
46
|
-
"prom-client": "^14.0.1",
|
|
47
41
|
"reflect-metadata": "^0.1.13",
|
|
48
42
|
"rimraf": "^3.0.2",
|
|
49
43
|
"rxjs": "^7.5.2",
|
|
50
44
|
"sequelize": "6.28.0",
|
|
51
|
-
"
|
|
45
|
+
"vm2": "^3.9.9",
|
|
52
46
|
"web3-providers-http": "^1.8.0",
|
|
53
47
|
"web3-providers-ws": "^1.8.0",
|
|
54
48
|
"yargs": "^16.2.0"
|
|
@@ -56,17 +50,14 @@
|
|
|
56
50
|
"devDependencies": {
|
|
57
51
|
"@nestjs/schematics": "^8.0.5",
|
|
58
52
|
"@nestjs/testing": "^8.2.6",
|
|
59
|
-
"@types/app-module-path": "^2.2.0",
|
|
60
53
|
"@types/express": "^4.17.13",
|
|
61
54
|
"@types/jest": "^27.4.0",
|
|
62
55
|
"@types/lodash": "^4.14.178",
|
|
63
56
|
"@types/pino": "^6.3.12",
|
|
64
|
-
"@types/supertest": "^2.0.11",
|
|
65
57
|
"@types/tar": "^6.1.1",
|
|
66
58
|
"@types/yargs": "^16.0.4",
|
|
67
59
|
"dotenv": "^15.0.1",
|
|
68
|
-
"nodemon": "^2.0.15"
|
|
69
|
-
"supertest": "^6.2.2"
|
|
60
|
+
"nodemon": "^2.0.15"
|
|
70
61
|
},
|
|
71
62
|
"resolutions": {
|
|
72
63
|
"@polkadot/util": "11.1.1",
|
|
@@ -75,5 +66,6 @@
|
|
|
75
66
|
"files": [
|
|
76
67
|
"/dist",
|
|
77
68
|
"/bin"
|
|
78
|
-
]
|
|
69
|
+
],
|
|
70
|
+
"stableVersion": "2.0.2-0"
|
|
79
71
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright 2020-2022 OnFinality Limited authors & contributors
|
|
3
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
const configure_module_1 = require("./configure.module");
|
|
6
|
-
describe('Configure', () => {
|
|
7
|
-
it('validDbSchemaName - works', () => {
|
|
8
|
-
expect((0, configure_module_1.validDbSchemaName)('subquery_1')).toBeTruthy();
|
|
9
|
-
});
|
|
10
|
-
it('validDbSchemaName - works not alphanumeric', () => {
|
|
11
|
-
expect((0, configure_module_1.validDbSchemaName)('subquery_-/1')).toBeTruthy();
|
|
12
|
-
});
|
|
13
|
-
it('validDbSchemaName - long', () => {
|
|
14
|
-
expect((0, configure_module_1.validDbSchemaName)('a'.repeat(64))).toBeFalsy();
|
|
15
|
-
});
|
|
16
|
-
it('validDbSchemaName - invalid prefix', () => {
|
|
17
|
-
expect((0, configure_module_1.validDbSchemaName)('pg_whatever')).toBeFalsy();
|
|
18
|
-
});
|
|
19
|
-
it('validDbSchemaName - invalid tokens', () => {
|
|
20
|
-
expect((0, configure_module_1.validDbSchemaName)('he$$*')).toBeFalsy();
|
|
21
|
-
});
|
|
22
|
-
it('validDbSchemaName - empty', () => {
|
|
23
|
-
expect((0, configure_module_1.validDbSchemaName)('')).toBeFalsy();
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
//# sourceMappingURL=configure.module.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"configure.module.spec.js","sourceRoot":"","sources":["../../src/configure/configure.module.spec.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sCAAsC;;AAEtC,yDAAuD;AAEvD,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACzB,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE;QACnC,MAAM,CAAC,IAAA,oCAAiB,EAAC,YAAY,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;IACvD,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE;QACpD,MAAM,CAAC,IAAA,oCAAiB,EAAC,cAAc,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;IACzD,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,0BAA0B,EAAE,GAAG,EAAE;QAClC,MAAM,CAAC,IAAA,oCAAiB,EAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;IACxD,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC5C,MAAM,CAAC,IAAA,oCAAiB,EAAC,aAAa,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;IACvD,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC5C,MAAM,CAAC,IAAA,oCAAiB,EAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;IACjD,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE;QACnC,MAAM,CAAC,IAAA,oCAAiB,EAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;IAC5C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["// Copyright 2020-2022 OnFinality Limited authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport { validDbSchemaName } from './configure.module';\n\ndescribe('Configure', () => {\n it('validDbSchemaName - works', () => {\n expect(validDbSchemaName('subquery_1')).toBeTruthy();\n });\n it('validDbSchemaName - works not alphanumeric', () => {\n expect(validDbSchemaName('subquery_-/1')).toBeTruthy();\n });\n it('validDbSchemaName - long', () => {\n expect(validDbSchemaName('a'.repeat(64))).toBeFalsy();\n });\n it('validDbSchemaName - invalid prefix', () => {\n expect(validDbSchemaName('pg_whatever')).toBeFalsy();\n });\n it('validDbSchemaName - invalid tokens', () => {\n expect(validDbSchemaName('he$$*')).toBeFalsy();\n });\n it('validDbSchemaName - empty', () => {\n expect(validDbSchemaName('')).toBeFalsy();\n });\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright 2020-2022 OnFinality Limited authors & contributors
|
|
3
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
const node_core_1 = require("@subql/node-core");
|
|
6
|
-
const unfinalizedBlocks_service_1 = require("./unfinalizedBlocks.service");
|
|
7
|
-
/* Notes:
|
|
8
|
-
* Block hashes all have the format '0xabc' + block number
|
|
9
|
-
* If they are forked they will have an `f` at the end
|
|
10
|
-
*/
|
|
11
|
-
function mockApiService() {
|
|
12
|
-
const mockApi = {
|
|
13
|
-
getFinalizedBlockHeight: jest.fn(() => 110),
|
|
14
|
-
getRuntimeChain: jest.fn(() => 'ethereum'),
|
|
15
|
-
getBlockByHeightOrHash: (heightOrHash) => {
|
|
16
|
-
if (typeof heightOrHash === 'string') {
|
|
17
|
-
const height = Number(heightOrHash.toString().replace('0xabc', '').replace('f', ''));
|
|
18
|
-
return {
|
|
19
|
-
number: height,
|
|
20
|
-
hash: heightOrHash,
|
|
21
|
-
parentHash: `0xabc${height - 1}f`,
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
const hash = `0xabc${heightOrHash}f`;
|
|
26
|
-
return {
|
|
27
|
-
number: heightOrHash,
|
|
28
|
-
hash: hash,
|
|
29
|
-
parentHash: `0xabc${heightOrHash - 1}f`,
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
return {
|
|
35
|
-
api: mockApi,
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
function getMockMetadata() {
|
|
39
|
-
const data = {};
|
|
40
|
-
return {
|
|
41
|
-
upsert: ({ key, value }) => (data[key] = value),
|
|
42
|
-
findOne: ({ where: { key } }) => ({ value: data[key] }),
|
|
43
|
-
findByPk: (key) => data[key],
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
function mockStoreCache() {
|
|
47
|
-
return {
|
|
48
|
-
metadata: new node_core_1.CacheMetadataModel(getMockMetadata()),
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
function mockBlock(height, hash, parentHash) {
|
|
52
|
-
return {
|
|
53
|
-
number: height,
|
|
54
|
-
hash: hash,
|
|
55
|
-
parentHash: parentHash,
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
describe('UnfinalizedBlocksService', () => {
|
|
59
|
-
let apiService;
|
|
60
|
-
let unfinalizedBlocksService;
|
|
61
|
-
beforeEach(async () => {
|
|
62
|
-
apiService = mockApiService();
|
|
63
|
-
unfinalizedBlocksService = new unfinalizedBlocks_service_1.UnfinalizedBlocksService(apiService, { unfinalizedBlocks: true }, mockStoreCache());
|
|
64
|
-
await unfinalizedBlocksService.init(() => Promise.resolve());
|
|
65
|
-
});
|
|
66
|
-
afterEach(() => {
|
|
67
|
-
unfinalizedBlocksService.unfinalizedBlocks = {};
|
|
68
|
-
});
|
|
69
|
-
it('can set finalized block', () => {
|
|
70
|
-
unfinalizedBlocksService.registerFinalizedBlock(apiService.api.getBlockByHeightOrHash(110));
|
|
71
|
-
expect(unfinalizedBlocksService.finalizedBlockNumber).toBe(110);
|
|
72
|
-
});
|
|
73
|
-
it('cant set a lower finalized block', () => {
|
|
74
|
-
unfinalizedBlocksService.registerFinalizedBlock(apiService.api.getBlockByHeightOrHash(110));
|
|
75
|
-
unfinalizedBlocksService.registerFinalizedBlock(apiService.api.getBlockByHeightOrHash(99));
|
|
76
|
-
expect(unfinalizedBlocksService.finalizedBlockNumber).toBe(110);
|
|
77
|
-
});
|
|
78
|
-
it('keeps track of unfinalized blocks', async () => {
|
|
79
|
-
unfinalizedBlocksService.registerFinalizedBlock(apiService.api.getBlockByHeightOrHash(110));
|
|
80
|
-
await unfinalizedBlocksService.processUnfinalizedBlocks(mockBlock(111, '0xabc111'));
|
|
81
|
-
await unfinalizedBlocksService.processUnfinalizedBlocks(mockBlock(112, '0xabc112'));
|
|
82
|
-
expect(unfinalizedBlocksService.unfinalizedBlocks).toEqual([
|
|
83
|
-
[111, '0xabc111'],
|
|
84
|
-
[112, '0xabc112'],
|
|
85
|
-
]);
|
|
86
|
-
});
|
|
87
|
-
it('doesnt keep track of finalized blocks', async () => {
|
|
88
|
-
unfinalizedBlocksService.registerFinalizedBlock(apiService.api.getBlockByHeightOrHash(120));
|
|
89
|
-
await unfinalizedBlocksService.processUnfinalizedBlocks(mockBlock(111, '0xabc111'));
|
|
90
|
-
await unfinalizedBlocksService.processUnfinalizedBlocks(mockBlock(112, '0xabc112'));
|
|
91
|
-
expect(unfinalizedBlocksService.unfinalizedBlocks).toEqual([]);
|
|
92
|
-
});
|
|
93
|
-
it('can process unfinalized blocks', async () => {
|
|
94
|
-
unfinalizedBlocksService.registerFinalizedBlock(apiService.api.getBlockByHeightOrHash(110));
|
|
95
|
-
await unfinalizedBlocksService.processUnfinalizedBlocks(mockBlock(111, '0xabc111'));
|
|
96
|
-
await unfinalizedBlocksService.processUnfinalizedBlocks(mockBlock(112, '0xabc112'));
|
|
97
|
-
unfinalizedBlocksService.registerFinalizedBlock(mockBlock(112, '0xabc112', '0xabc111'));
|
|
98
|
-
await unfinalizedBlocksService.processUnfinalizedBlocks(mockBlock(113, '0xabc113'));
|
|
99
|
-
expect(unfinalizedBlocksService.unfinalizedBlocks).toEqual([
|
|
100
|
-
[113, '0xabc113'],
|
|
101
|
-
]);
|
|
102
|
-
});
|
|
103
|
-
it('can handle a fork and rewind to the last finalized height', async () => {
|
|
104
|
-
unfinalizedBlocksService.registerFinalizedBlock(apiService.api.getBlockByHeightOrHash(110));
|
|
105
|
-
await unfinalizedBlocksService.processUnfinalizedBlocks(mockBlock(111, '0xabc111'));
|
|
106
|
-
await unfinalizedBlocksService.processUnfinalizedBlocks(mockBlock(112, '0xabc112'));
|
|
107
|
-
// Forked block
|
|
108
|
-
unfinalizedBlocksService.registerFinalizedBlock(mockBlock(112, '0xabc112f', '0xabc111'));
|
|
109
|
-
const res = await unfinalizedBlocksService.processUnfinalizedBlocks(mockBlock(113, '0xabc113'));
|
|
110
|
-
// Last valid block
|
|
111
|
-
expect(res).toBe(111);
|
|
112
|
-
// After this the call stack is something like:
|
|
113
|
-
// indexerManager -> blockDispatcher -> project -> project -> reindex -> blockDispatcher.resetUnfinalizedBlocks
|
|
114
|
-
unfinalizedBlocksService.resetUnfinalizedBlocks();
|
|
115
|
-
expect(unfinalizedBlocksService.unfinalizedBlocks).toEqual([]);
|
|
116
|
-
});
|
|
117
|
-
it('can handle a fork when some unfinalized blocks are invalid', async () => {
|
|
118
|
-
unfinalizedBlocksService.registerFinalizedBlock(apiService.api.getBlockByHeightOrHash(110));
|
|
119
|
-
await unfinalizedBlocksService.processUnfinalizedBlocks(mockBlock(111, '0xabc111'));
|
|
120
|
-
await unfinalizedBlocksService.processUnfinalizedBlocks(mockBlock(112, '0xabc112'));
|
|
121
|
-
await unfinalizedBlocksService.processUnfinalizedBlocks(mockBlock(113, '0xabc113'));
|
|
122
|
-
await unfinalizedBlocksService.processUnfinalizedBlocks(mockBlock(114, '0xabc114'));
|
|
123
|
-
await unfinalizedBlocksService.processUnfinalizedBlocks(mockBlock(115, '0xabc115'));
|
|
124
|
-
await unfinalizedBlocksService.processUnfinalizedBlocks(mockBlock(116, '0xabc116'));
|
|
125
|
-
// Forked block
|
|
126
|
-
unfinalizedBlocksService.registerFinalizedBlock(mockBlock(113, '0xabc113f', '0xabc112'));
|
|
127
|
-
const res = await unfinalizedBlocksService.processUnfinalizedBlocks(mockBlock(117, '0xabc117'));
|
|
128
|
-
// Last valid block
|
|
129
|
-
expect(res).toBe(112);
|
|
130
|
-
});
|
|
131
|
-
it('can handle a fork when all unfinalized blocks are invalid', async () => {
|
|
132
|
-
unfinalizedBlocksService.registerFinalizedBlock(apiService.api.getBlockByHeightOrHash(110));
|
|
133
|
-
await unfinalizedBlocksService.processUnfinalizedBlocks(mockBlock(111, '0xabc111'));
|
|
134
|
-
await unfinalizedBlocksService.processUnfinalizedBlocks(mockBlock(112, '0xabc112'));
|
|
135
|
-
// Forked block
|
|
136
|
-
unfinalizedBlocksService.registerFinalizedBlock(mockBlock(111, '0xabc111f', '0xabc110'));
|
|
137
|
-
const res = await unfinalizedBlocksService.processUnfinalizedBlocks(mockBlock(113, '0xabc113'));
|
|
138
|
-
// Last valid block
|
|
139
|
-
expect(res).toBe(110);
|
|
140
|
-
});
|
|
141
|
-
it('can handle a fork and when unfinalized blocks < finalized head', async () => {
|
|
142
|
-
unfinalizedBlocksService.registerFinalizedBlock(apiService.api.getBlockByHeightOrHash(110));
|
|
143
|
-
await unfinalizedBlocksService.processUnfinalizedBlocks(mockBlock(111, '0xabc111'));
|
|
144
|
-
await unfinalizedBlocksService.processUnfinalizedBlocks(mockBlock(112, '0xabc112'));
|
|
145
|
-
// Forked block
|
|
146
|
-
unfinalizedBlocksService.registerFinalizedBlock(mockBlock(120, '0xabc120f', '0xabc119f'));
|
|
147
|
-
const res = await unfinalizedBlocksService.processUnfinalizedBlocks(mockBlock(113, '0xabc113'));
|
|
148
|
-
// Last valid block
|
|
149
|
-
expect(res).toBe(110);
|
|
150
|
-
});
|
|
151
|
-
it('can handle a fork and when unfinalized blocks < finalized head 2', async () => {
|
|
152
|
-
unfinalizedBlocksService.registerFinalizedBlock(apiService.api.getBlockByHeightOrHash(110));
|
|
153
|
-
unfinalizedBlocksService.lastCheckedBlockHeight = 110;
|
|
154
|
-
await unfinalizedBlocksService.registerUnfinalizedBlock(111, '0xabc111');
|
|
155
|
-
await unfinalizedBlocksService.registerUnfinalizedBlock(112, '0xabc112');
|
|
156
|
-
// Forked block
|
|
157
|
-
unfinalizedBlocksService.registerFinalizedBlock(mockBlock(120, '0xabc120f', '0xabc119f'));
|
|
158
|
-
const res = await unfinalizedBlocksService.processUnfinalizedBlocks(mockBlock(113, '0xabc113'));
|
|
159
|
-
// Last valid block
|
|
160
|
-
expect(res).toBe(110);
|
|
161
|
-
});
|
|
162
|
-
it('can handle a fork and when unfinalized blocks < finalized head with a large difference', async () => {
|
|
163
|
-
unfinalizedBlocksService.registerFinalizedBlock(apiService.api.getBlockByHeightOrHash(110));
|
|
164
|
-
await unfinalizedBlocksService.processUnfinalizedBlocks(mockBlock(111, '0xabc111'));
|
|
165
|
-
await unfinalizedBlocksService.processUnfinalizedBlocks(mockBlock(112, '0xabc112'));
|
|
166
|
-
// Forked block
|
|
167
|
-
unfinalizedBlocksService.registerFinalizedBlock(mockBlock(1200, '0xabc1200f', '0xabc1199f'));
|
|
168
|
-
const res = await unfinalizedBlocksService.processUnfinalizedBlocks(mockBlock(113, '0xabc113'));
|
|
169
|
-
// Last valid block
|
|
170
|
-
expect(res).toBe(110);
|
|
171
|
-
});
|
|
172
|
-
it('can rewind any unfinalized blocks when restarted and unfinalized blocks is disabled', async () => {
|
|
173
|
-
const metadata = getMockMetadata();
|
|
174
|
-
metadata.upsert({
|
|
175
|
-
key: unfinalizedBlocks_service_1.METADATA_UNFINALIZED_BLOCKS_KEY,
|
|
176
|
-
value: JSON.stringify([
|
|
177
|
-
[90, '0xabcd'],
|
|
178
|
-
[91, '0xabc91'],
|
|
179
|
-
[92, '0xabc92'],
|
|
180
|
-
]),
|
|
181
|
-
});
|
|
182
|
-
metadata.upsert({
|
|
183
|
-
key: unfinalizedBlocks_service_1.METADATA_LAST_FINALIZED_PROCESSED_KEY,
|
|
184
|
-
value: 90,
|
|
185
|
-
});
|
|
186
|
-
const unfinalizedBlocksService2 = new unfinalizedBlocks_service_1.UnfinalizedBlocksService(apiService, { unfinalizedBlocks: false }, {
|
|
187
|
-
transaction: () => Promise.resolve({ commit: () => undefined }),
|
|
188
|
-
});
|
|
189
|
-
const reindex = jest.fn().mockReturnValue(Promise.resolve());
|
|
190
|
-
await unfinalizedBlocksService2.init(reindex);
|
|
191
|
-
expect(reindex).toBeCalledWith(90);
|
|
192
|
-
expect(unfinalizedBlocksService2.lastCheckedBlockHeight).toBe(90);
|
|
193
|
-
});
|
|
194
|
-
});
|
|
195
|
-
//# sourceMappingURL=unfinalizedBlocks.spec.js.map
|