@subql/node-ethereum 0.4.1-9 → 0.4.1-storeCache-0.0.3

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 (100) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/README.md +3 -0
  3. package/dist/.tsbuildinfo +1 -1
  4. package/dist/ethereum/api.ethereum.d.ts +4 -1
  5. package/dist/ethereum/api.ethereum.js +31 -5
  6. package/dist/ethereum/api.ethereum.js.map +1 -1
  7. package/dist/ethereum/api.service.ethereum.js +1 -1
  8. package/dist/ethereum/api.service.ethereum.js.map +1 -1
  9. package/dist/ethereum/ethers/json-rpc-batch-provider.d.ts +21 -0
  10. package/dist/ethereum/ethers/json-rpc-batch-provider.js +102 -0
  11. package/dist/ethereum/ethers/json-rpc-batch-provider.js.map +1 -0
  12. package/dist/ethereum/ethers/json-rpc-provider.d.ts +7 -0
  13. package/dist/ethereum/ethers/json-rpc-provider.js +68 -0
  14. package/dist/ethereum/ethers/json-rpc-provider.js.map +1 -0
  15. package/dist/ethereum/ethers/web/_version.d.ts +1 -0
  16. package/dist/ethereum/ethers/web/_version.js +6 -0
  17. package/dist/ethereum/ethers/web/_version.js.map +1 -0
  18. package/dist/ethereum/ethers/web/geturl.d.ts +3 -0
  19. package/dist/ethereum/ethers/web/geturl.js +116 -0
  20. package/dist/ethereum/ethers/web/geturl.js.map +1 -0
  21. package/dist/ethereum/ethers/web/index.d.ts +49 -0
  22. package/dist/ethereum/ethers/web/index.js +433 -0
  23. package/dist/ethereum/ethers/web/index.js.map +1 -0
  24. package/dist/ethereum/ethers/web/types.d.ts +26 -0
  25. package/dist/ethereum/ethers/web/types.js +4 -0
  26. package/dist/ethereum/ethers/web/types.js.map +1 -0
  27. package/dist/ethereum/utils.ethereum.js +7 -5
  28. package/dist/ethereum/utils.ethereum.js.map +1 -1
  29. package/dist/indexer/blockDispatcher/block-dispatcher.service.d.ts +8 -15
  30. package/dist/indexer/blockDispatcher/block-dispatcher.service.js +20 -108
  31. package/dist/indexer/blockDispatcher/block-dispatcher.service.js.map +1 -1
  32. package/dist/indexer/blockDispatcher/ethereum-block-dispatcher.d.ts +4 -0
  33. package/dist/indexer/blockDispatcher/ethereum-block-dispatcher.js +5 -0
  34. package/dist/indexer/blockDispatcher/ethereum-block-dispatcher.js.map +1 -0
  35. package/dist/indexer/blockDispatcher/index.d.ts +2 -2
  36. package/dist/indexer/blockDispatcher/index.js.map +1 -1
  37. package/dist/indexer/blockDispatcher/worker-block-dispatcher.service.d.ts +12 -17
  38. package/dist/indexer/blockDispatcher/worker-block-dispatcher.service.js +48 -134
  39. package/dist/indexer/blockDispatcher/worker-block-dispatcher.service.js.map +1 -1
  40. package/dist/indexer/dynamic-ds.service.d.ts +3 -22
  41. package/dist/indexer/dynamic-ds.service.js +4 -91
  42. package/dist/indexer/dynamic-ds.service.js.map +1 -1
  43. package/dist/indexer/fetch.module.js +24 -6
  44. package/dist/indexer/fetch.module.js.map +1 -1
  45. package/dist/indexer/fetch.service.d.ts +3 -3
  46. package/dist/indexer/fetch.service.js +40 -39
  47. package/dist/indexer/fetch.service.js.map +1 -1
  48. package/dist/indexer/indexer.manager.d.ts +4 -16
  49. package/dist/indexer/indexer.manager.js +22 -61
  50. package/dist/indexer/indexer.manager.js.map +1 -1
  51. package/dist/indexer/indexer.module.js +25 -2
  52. package/dist/indexer/indexer.module.js.map +1 -1
  53. package/dist/indexer/project.service.d.ts +4 -10
  54. package/dist/indexer/project.service.js +45 -100
  55. package/dist/indexer/project.service.js.map +1 -1
  56. package/dist/indexer/sandbox.service.js +6 -1
  57. package/dist/indexer/sandbox.service.js.map +1 -1
  58. package/dist/indexer/unfinalizedBlocks.service.d.ts +12 -12
  59. package/dist/indexer/unfinalizedBlocks.service.js +33 -38
  60. package/dist/indexer/unfinalizedBlocks.service.js.map +1 -1
  61. package/dist/indexer/unfinalizedBlocks.spec.js +41 -34
  62. package/dist/indexer/unfinalizedBlocks.spec.js.map +1 -1
  63. package/dist/indexer/worker/worker.d.ts +22 -8
  64. package/dist/indexer/worker/worker.js +14 -7
  65. package/dist/indexer/worker/worker.js.map +1 -1
  66. package/dist/indexer/worker/worker.service.d.ts +2 -2
  67. package/dist/indexer/worker/worker.service.js +11 -4
  68. package/dist/indexer/worker/worker.service.js.map +1 -1
  69. package/dist/indexer/worker/worker.unfinalizedBlocks.service.d.ts +11 -0
  70. package/dist/indexer/worker/worker.unfinalizedBlocks.service.js +32 -0
  71. package/dist/indexer/worker/worker.unfinalizedBlocks.service.js.map +1 -0
  72. package/dist/init.js +2 -2
  73. package/dist/init.js.map +1 -1
  74. package/dist/meta/meta.module.js +8 -0
  75. package/dist/meta/meta.module.js.map +1 -1
  76. package/dist/meta/meta.service.d.ts +18 -3
  77. package/dist/meta/meta.service.js +89 -5
  78. package/dist/meta/meta.service.js.map +1 -1
  79. package/dist/subcommands/forceClean.service.js +8 -4
  80. package/dist/subcommands/forceClean.service.js.map +1 -1
  81. package/dist/subcommands/reindex.init.js +5 -1
  82. package/dist/subcommands/reindex.init.js.map +1 -1
  83. package/dist/subcommands/reindex.module.js +8 -0
  84. package/dist/subcommands/reindex.module.js.map +1 -1
  85. package/dist/subcommands/reindex.service.d.ts +4 -1
  86. package/dist/subcommands/reindex.service.js +21 -10
  87. package/dist/subcommands/reindex.service.js.map +1 -1
  88. package/dist/utils/project.js.map +1 -1
  89. package/dist/utils/reindex.d.ts +2 -1
  90. package/dist/utils/reindex.js +6 -2
  91. package/dist/utils/reindex.js.map +1 -1
  92. package/dist/utils/string.js +10 -2
  93. package/dist/utils/string.js.map +1 -1
  94. package/dist/yargs.d.ts +85 -53
  95. package/dist/yargs.js +103 -71
  96. package/dist/yargs.js.map +1 -1
  97. package/package.json +9 -9
  98. package/dist/indexer/blockDispatcher/base-block-dispatcher.d.ts +0 -40
  99. package/dist/indexer/blockDispatcher/base-block-dispatcher.js +0 -99
  100. package/dist/indexer/blockDispatcher/base-block-dispatcher.js.map +0 -1
package/dist/yargs.js CHANGED
@@ -40,18 +40,10 @@ exports.yargsOptions = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv)
40
40
  },
41
41
  })
42
42
  .options({
43
- subquery: {
44
- alias: 'f',
45
- demandOption: true,
46
- default: process.cwd(),
47
- describe: 'Local path or IPFS cid of the subquery project',
48
- type: 'string',
49
- },
50
- 'subquery-name': {
51
- deprecated: true,
43
+ 'batch-size': {
52
44
  demandOption: false,
53
- describe: 'Name of the subquery project',
54
- type: 'string',
45
+ describe: 'Batch size of blocks to fetch in one round',
46
+ type: 'number',
55
47
  },
56
48
  config: {
57
49
  alias: 'c',
@@ -59,55 +51,62 @@ exports.yargsOptions = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv)
59
51
  describe: 'Specify configuration file',
60
52
  type: 'string',
61
53
  },
62
- local: {
63
- deprecated: true,
64
- type: 'boolean',
65
- demandOption: false,
66
- describe: 'Use local mode',
67
- },
68
54
  'db-schema': {
69
55
  demandOption: false,
70
56
  describe: 'Db schema name of the project',
71
57
  type: 'string',
72
58
  },
73
- unsafe: {
59
+ debug: {
60
+ demandOption: false,
61
+ describe: 'Show debug information to console output. will forcefully set log level to debug',
74
62
  type: 'boolean',
63
+ default: false,
64
+ },
65
+ 'dictionary-timeout': {
75
66
  demandOption: false,
76
- describe: 'Allows usage of any built-in module within the sandbox',
67
+ describe: 'Max timeout for dictionary query',
68
+ type: 'number',
77
69
  },
78
- subscription: {
70
+ 'disable-historical': {
79
71
  demandOption: false,
80
- describe: 'Enable subscription by create notification triggers',
81
- type: 'boolean',
82
72
  default: false,
73
+ describe: 'Disable storing historical state entities',
74
+ type: 'boolean',
83
75
  },
84
- 'batch-size': {
76
+ ipfs: {
85
77
  demandOption: false,
86
- describe: 'Batch size of blocks to fetch in one round',
87
- type: 'number',
78
+ describe: 'IPFS gateway endpoint',
79
+ type: 'string',
88
80
  },
89
- 'scale-batch-size': {
81
+ local: {
82
+ deprecated: true,
90
83
  type: 'boolean',
91
84
  demandOption: false,
92
- describe: 'scale batch size based on memory usage',
93
- default: false,
85
+ describe: 'Use local mode',
94
86
  },
95
- timeout: {
87
+ 'log-level': {
96
88
  demandOption: false,
97
- describe: 'Timeout for indexer sandbox to execute the mapping functions',
98
- type: 'number',
89
+ describe: 'Specify log level to print. Ignored when --debug is used',
90
+ type: 'string',
91
+ choices: ['fatal', 'error', 'warn', 'info', 'debug', 'trace', 'silent'],
99
92
  },
100
- debug: {
93
+ 'mmr-path': {
94
+ alias: 'm',
101
95
  demandOption: false,
102
- describe: 'Show debug information to console output. will forcefully set log level to debug',
103
- type: 'boolean',
104
- default: false,
96
+ describe: 'Local path of the merkle mountain range (.mmr) file',
97
+ type: 'string',
105
98
  },
106
- profiler: {
99
+ 'multi-chain': {
107
100
  demandOption: false,
108
- describe: 'Show profiler information to console output',
109
- type: 'boolean',
110
101
  default: false,
102
+ describe: 'Enables indexing multiple subquery projects into the same database schema',
103
+ type: 'boolean',
104
+ },
105
+ 'network-dictionary': {
106
+ alias: 'd',
107
+ demandOption: false,
108
+ describe: 'Specify the dictionary api for this network',
109
+ type: 'string',
111
110
  },
112
111
  'network-endpoint': {
113
112
  demandOption: false,
@@ -120,57 +119,82 @@ exports.yargsOptions = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv)
120
119
  type: 'string',
121
120
  choices: ['json', 'colored'],
122
121
  },
123
- 'log-level': {
122
+ port: {
123
+ alias: 'p',
124
124
  demandOption: false,
125
- describe: 'Specify log level to print. Ignored when --debug is used',
126
- type: 'string',
127
- choices: ['fatal', 'error', 'warn', 'info', 'debug', 'trace', 'silent'],
125
+ describe: 'The port the service will bind to',
126
+ type: 'number',
128
127
  },
129
- 'timestamp-field': {
128
+ profiler: {
130
129
  demandOption: false,
131
- describe: 'Enable/disable created_at and updated_at in schema',
130
+ describe: 'Show profiler information to console output',
132
131
  type: 'boolean',
133
132
  default: false,
134
133
  },
135
- 'network-dictionary': {
136
- alias: 'd',
134
+ 'proof-of-index': {
137
135
  demandOption: false,
138
- describe: 'Specify the dictionary api for this network',
139
- type: 'string',
136
+ describe: 'Enable/disable proof of index',
137
+ type: 'boolean',
138
+ default: false,
140
139
  },
141
- 'dictionary-timeout': {
140
+ 'query-limit': {
142
141
  demandOption: false,
143
- describe: 'Max timeout for dictionary query',
142
+ describe: 'The limit of items a project can query with store.getByField at once',
144
143
  type: 'number',
144
+ default: 100,
145
145
  },
146
- 'mmr-path': {
147
- alias: 'm',
146
+ 'scale-batch-size': {
147
+ type: 'boolean',
148
148
  demandOption: false,
149
- describe: 'Local path of the merkle mountain range (.mmr) file',
150
- type: 'string',
149
+ describe: 'scale batch size based on memory usage',
150
+ default: false,
151
151
  },
152
- 'proof-of-index': {
152
+ 'dictionary-resolver': {
153
153
  demandOption: false,
154
- describe: 'Enable/disable proof of index',
154
+ describe: 'Use subquery network dictionary resolver',
155
155
  type: 'boolean',
156
156
  default: false,
157
157
  },
158
- ipfs: {
158
+ subquery: {
159
+ alias: 'f',
160
+ demandOption: true,
161
+ default: process.cwd(),
162
+ describe: 'Local path or IPFS cid of the subquery project',
163
+ type: 'string',
164
+ },
165
+ 'subquery-name': {
166
+ deprecated: true,
159
167
  demandOption: false,
160
- describe: 'IPFS gateway endpoint',
168
+ describe: 'Name of the subquery project',
161
169
  type: 'string',
162
170
  },
163
- port: {
164
- alias: 'p',
171
+ subscription: {
165
172
  demandOption: false,
166
- describe: 'The port the service will bind to',
173
+ describe: 'Enable subscription by create notification triggers',
174
+ type: 'boolean',
175
+ default: false,
176
+ },
177
+ timeout: {
178
+ demandOption: false,
179
+ describe: 'Timeout for indexer sandbox to execute the mapping functions',
167
180
  type: 'number',
168
181
  },
169
- 'disable-historical': {
182
+ 'timestamp-field': {
170
183
  demandOption: false,
184
+ describe: 'Enable/disable created_at and updated_at in schema',
185
+ type: 'boolean',
171
186
  default: false,
172
- describe: 'Disable storing historical state entities',
187
+ },
188
+ 'unfinalized-blocks': {
189
+ demandOption: false,
190
+ default: false,
191
+ describe: 'Enable to fetch and index unfinalized blocks',
192
+ type: 'boolean',
193
+ },
194
+ unsafe: {
173
195
  type: 'boolean',
196
+ demandOption: false,
197
+ describe: 'Allows usage of any built-in module within the sandbox',
174
198
  },
175
199
  workers: {
176
200
  alias: 'w',
@@ -178,17 +202,25 @@ exports.yargsOptions = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv)
178
202
  describe: 'Number of worker threads to use for fetching and processing blocks. Disabled by default.',
179
203
  type: 'number',
180
204
  },
181
- 'query-limit': {
205
+ 'pg-ca': {
182
206
  demandOption: false,
183
- describe: 'The limit of items a project can query with store.getByField at once',
184
- type: 'number',
185
- default: 100,
207
+ describe: 'Postgres ca certificate - to enables TLS/SSL connections to your PostgreSQL, path to the server certificate file are required, e.g /path/to/server-certificates/root.crt',
208
+ type: 'string',
186
209
  },
187
- 'unfinalized-blocks': {
210
+ 'pg-key': {
188
211
  demandOption: false,
189
- default: false,
190
- describe: 'Enable to fetch and index unfinalized blocks',
191
- type: 'boolean',
212
+ describe: 'Postgres client key - Path to key file e.g /path/to/client-key/postgresql.key',
213
+ type: 'string',
214
+ },
215
+ 'pg-cert': {
216
+ demandOption: false,
217
+ describe: 'Postgres client certificate - Path to client certificate e.g /path/to/client-certificates/postgresql.crt',
218
+ type: 'string',
219
+ },
220
+ 'store-cache-threshold': {
221
+ demandOption: false,
222
+ describe: 'Store cache will flush when number of records excess this threshold',
223
+ type: 'number',
192
224
  },
193
225
  });
194
226
  //# sourceMappingURL=yargs.js.map
package/dist/yargs.js.map CHANGED
@@ -1 +1 @@
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;IAC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,QAAQ,EAAE,2CAA2C;QACrD,IAAI,EAAE,SAAS;KAChB;IACD,OAAO,EAAE;QACP,KAAK,EAAE,GAAG;QACV,YAAY,EAAE,KAAK;QACnB,QAAQ,EACN,0FAA0F;QAC5F,IAAI,EAAE,QAAQ;KACf;IACD,aAAa,EAAE;QACb,YAAY,EAAE,KAAK;QACnB,QAAQ,EACN,sEAAsE;QACxE,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,GAAG;KACb;IACD,oBAAoB,EAAE;QACpB,YAAY,EAAE,KAAK;QACnB,OAAO,EAAE,KAAK;QACd,QAAQ,EAAE,8CAA8C;QACxD,IAAI,EAAE,SAAS;KAChB;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: '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 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 config: {\n alias: 'c',\n demandOption: false,\n describe: 'Specify configuration file',\n type: 'string',\n },\n local: {\n deprecated: true,\n type: 'boolean',\n demandOption: false,\n describe: 'Use local mode',\n },\n 'db-schema': {\n demandOption: false,\n describe: 'Db schema name of the project',\n type: 'string',\n },\n unsafe: {\n type: 'boolean',\n demandOption: false,\n describe: 'Allows usage of any built-in module within the sandbox',\n },\n subscription: {\n demandOption: false,\n describe: 'Enable subscription by create notification triggers',\n type: 'boolean',\n default: false,\n },\n 'batch-size': {\n demandOption: false,\n describe: 'Batch size of blocks to fetch in one round',\n type: 'number',\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 timeout: {\n demandOption: false,\n describe: 'Timeout for indexer sandbox to execute the mapping functions',\n type: 'number',\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 profiler: {\n demandOption: false,\n describe: 'Show profiler information to console output',\n type: 'boolean',\n default: false,\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 '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 'timestamp-field': {\n demandOption: false,\n describe: 'Enable/disable created_at and updated_at in schema',\n type: 'boolean',\n default: false,\n },\n 'network-dictionary': {\n alias: 'd',\n demandOption: false,\n describe: 'Specify the dictionary api for this network',\n type: 'string',\n },\n 'dictionary-timeout': {\n demandOption: false,\n describe: 'Max timeout for dictionary query',\n type: 'number',\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 'proof-of-index': {\n demandOption: false,\n describe: 'Enable/disable proof of index',\n type: 'boolean',\n default: false,\n },\n ipfs: {\n demandOption: false,\n describe: 'IPFS gateway endpoint',\n type: 'string',\n },\n port: {\n alias: 'p',\n demandOption: false,\n describe: 'The port the service will bind to',\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 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 '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 'unfinalized-blocks': {\n demandOption: false,\n default: false,\n describe: 'Enable to fetch and index unfinalized blocks',\n type: 'boolean',\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,aAAa;IACtB,QAAQ,EACN,mIAAmI;IACrI,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;QAChB,IAAA,mBAAU,EACR,IAAI,CAAC,KAAgB,EACrB,IAAI,CAAC,SAA+B,EACpC,IAAI,CAAC,QAA8B,CACpC,CAAC;QAEF,4EAA4E;QAC5E,8DAA8D;QAC9D,MAAM,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AoD;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;IACD,OAAO,EAAE;QACP,YAAY,EAAE,KAAK;QACnB,QAAQ,EACN,0KAA0K;QAC5K,IAAI,EAAE,QAAQ;KACf;IACD,QAAQ,EAAE;QACR,YAAY,EAAE,KAAK;QACnB,QAAQ,EACN,+EAA+E;QACjF,IAAI,EAAE,QAAQ;KACf;IACD,SAAS,EAAE;QACT,YAAY,EAAE,KAAK;QACnB,QAAQ,EACN,0GAA0G;QAC5G,IAAI,EAAE,QAAQ;KACf;IACD,uBAAuB,EAAE;QACvB,YAAY,EAAE,KAAK;QACnB,QAAQ,EACN,qEAAqE;QACvE,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: '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 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-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 'dictionary-resolver': {\n demandOption: false,\n describe: 'Use subquery network dictionary resolver',\n type: 'boolean',\n default: false,\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 'pg-ca': {\n demandOption: false,\n describe:\n 'Postgres ca certificate - to enables 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 when number of records excess this threshold',\n type: 'number',\n },\n });\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@subql/node-ethereum",
3
- "version": "0.4.1-9",
3
+ "version": "0.4.1-storeCache-0.0.3",
4
4
  "description": "",
5
5
  "author": "Ian He",
6
6
  "license": "Apache-2.0",
@@ -24,11 +24,11 @@
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": "1.5.0",
28
- "@subql/common-ethereum": "0.2.2-4",
29
- "@subql/node-core": "1.8.1-2",
30
- "@subql/types-ethereum": "0.2.2-6",
31
- "@subql/utils": "1.3.2-1",
27
+ "@subql/common": "^1.7.0",
28
+ "@subql/common-ethereum": "workspace:*",
29
+ "@subql/node-core": "1.10.1-storeCache-0.0.3",
30
+ "@subql/types-ethereum": "workspace:*",
31
+ "@subql/utils": "^1.4.1",
32
32
  "@subql/x-merkle-mountain-range": "2.0.0-0.1.2",
33
33
  "@willsoto/nestjs-prometheus": "^4.4.0",
34
34
  "algosdk": "^1.13.1",
@@ -45,7 +45,7 @@
45
45
  "reflect-metadata": "^0.1.13",
46
46
  "rimraf": "^3.0.2",
47
47
  "rxjs": "^7.5.2",
48
- "sequelize": "6.23.0",
48
+ "sequelize": "6.28.0",
49
49
  "tar": "^6.1.11",
50
50
  "typescript": "^4.4.4",
51
51
  "web3-providers-http": "^1.8.0",
@@ -74,5 +74,5 @@
74
74
  "/dist",
75
75
  "/bin"
76
76
  ],
77
- "stableVersion": "0.4.1-8"
78
- }
77
+ "stableVersion": "0.4.1-13"
78
+ }
@@ -1,40 +0,0 @@
1
- import { EventEmitter2 } from '@nestjs/event-emitter';
2
- import { IQueue, NodeConfig } from '@subql/node-core';
3
- import { ProjectService } from '../project.service';
4
- export declare type ProcessBlockResponse = {
5
- dynamicDsCreated: boolean;
6
- operationHash: Uint8Array;
7
- reindexBlockHeight: number;
8
- };
9
- export interface IBlockDispatcher {
10
- init(onDynamicDsCreated: (height: number) => Promise<void>): Promise<void>;
11
- enqueueBlocks(heights: number[], latestBufferHeight?: number): void;
12
- queueSize: number;
13
- freeSize: number;
14
- latestBufferedHeight: number | undefined;
15
- flushQueue(height: number): void;
16
- rewind(height: number): Promise<void>;
17
- }
18
- export declare abstract class BaseBlockDispatcher<Q extends IQueue> implements IBlockDispatcher {
19
- protected nodeConfig: NodeConfig;
20
- protected eventEmitter: EventEmitter2;
21
- protected projectService: ProjectService;
22
- protected queue: Q;
23
- protected _latestBufferedHeight: number;
24
- protected _processedBlockCount: number;
25
- protected latestProcessedHeight: number;
26
- protected currentProcessingHeight: number;
27
- protected onDynamicDsCreated: (height: number) => Promise<void>;
28
- constructor(nodeConfig: NodeConfig, eventEmitter: EventEmitter2, projectService: ProjectService, queue: Q);
29
- abstract enqueueBlocks(heights: number[]): void;
30
- abstract init(onDynamicDsCreated: (height: number) => Promise<void>): Promise<void>;
31
- get queueSize(): number;
32
- get freeSize(): number;
33
- get latestBufferedHeight(): number;
34
- set latestBufferedHeight(height: number);
35
- protected setProcessedBlockCount(processedBlockCount: number): void;
36
- rewind(lastCorrectHeight: number): Promise<void>;
37
- flushQueue(height: number): void;
38
- protected preProcessBlock(height: number): void;
39
- protected postProcessBlock(height: number, processBlockResponse: ProcessBlockResponse): Promise<void>;
40
- }
@@ -1,99 +0,0 @@
1
- "use strict";
2
- // Copyright 2020-2021 OnFinality Limited authors & contributors
3
- // SPDX-License-Identifier: Apache-2.0
4
- var __importDefault = (this && this.__importDefault) || function (mod) {
5
- return (mod && mod.__esModule) ? mod : { "default": mod };
6
- };
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.BaseBlockDispatcher = void 0;
9
- const assert_1 = __importDefault(require("assert"));
10
- const util_1 = require("@polkadot/util");
11
- const node_core_1 = require("@subql/node-core");
12
- const logger = (0, node_core_1.getLogger)('BaseBlockDispatcherService');
13
- const NULL_MERKEL_ROOT = (0, util_1.hexToU8a)('0x00');
14
- function isNullMerkelRoot(operationHash) {
15
- return (0, util_1.u8aEq)(operationHash, NULL_MERKEL_ROOT);
16
- }
17
- class BaseBlockDispatcher {
18
- constructor(nodeConfig, eventEmitter, projectService, queue) {
19
- this.nodeConfig = nodeConfig;
20
- this.eventEmitter = eventEmitter;
21
- this.projectService = projectService;
22
- this.queue = queue;
23
- }
24
- get queueSize() {
25
- return this.queue.size;
26
- }
27
- get freeSize() {
28
- return this.queue.freeSpace;
29
- }
30
- get latestBufferedHeight() {
31
- return this._latestBufferedHeight;
32
- }
33
- set latestBufferedHeight(height) {
34
- this.eventEmitter.emit(node_core_1.IndexerEvent.BlocknumberQueueSize, {
35
- value: this.queueSize,
36
- });
37
- this._latestBufferedHeight = height;
38
- }
39
- setProcessedBlockCount(processedBlockCount) {
40
- this._processedBlockCount = processedBlockCount;
41
- this.eventEmitter.emit(node_core_1.IndexerEvent.BlockProcessedCount, {
42
- processedBlockCount,
43
- timestamp: Date.now(),
44
- });
45
- }
46
- // Compare it with current indexing number, if last corrected is already indexed
47
- // rewind, also flush queued blocks, drop current indexing transaction, set last processed to correct block too
48
- // if rollback is greater than current index flush queue only
49
- async rewind(lastCorrectHeight) {
50
- if (lastCorrectHeight <= this.currentProcessingHeight) {
51
- logger.info(`Found last verified block at height ${lastCorrectHeight}, rewinding...`);
52
- await this.projectService.reindex(lastCorrectHeight);
53
- this.latestProcessedHeight = lastCorrectHeight;
54
- logger.info(`Successful rewind to block ${lastCorrectHeight}!`);
55
- }
56
- this.flushQueue(lastCorrectHeight);
57
- logger.info(`Queued blocks flushed!`); //Also last buffered height reset, next fetching should start after lastCorrectHeight
58
- }
59
- flushQueue(height) {
60
- this.latestBufferedHeight = height;
61
- this.queue.flush();
62
- }
63
- // Is called directly before a block is processed
64
- preProcessBlock(height) {
65
- this.currentProcessingHeight = height;
66
- this.eventEmitter.emit(node_core_1.IndexerEvent.BlockProcessing, {
67
- height,
68
- timestamp: Date.now(),
69
- });
70
- }
71
- // Is called directly after a block is processed
72
- async postProcessBlock(height, processBlockResponse) {
73
- const { dynamicDsCreated, operationHash, reindexBlockHeight } = processBlockResponse;
74
- if (reindexBlockHeight !== null && reindexBlockHeight !== undefined) {
75
- await this.rewind(reindexBlockHeight);
76
- this.latestProcessedHeight = reindexBlockHeight;
77
- }
78
- else {
79
- if (this.nodeConfig.proofOfIndex && !isNullMerkelRoot(operationHash)) {
80
- // We only check if it is undefined, need to be caution here when blockOffset is 0
81
- if (this.projectService.blockOffset === undefined) {
82
- // Which means during project init, it has not found offset and set value
83
- await this.projectService.upsertMetadataBlockOffset(height - 1);
84
- }
85
- // this will return if project service blockOffset already exist
86
- void this.projectService.setBlockOffset(height - 1);
87
- }
88
- if (dynamicDsCreated) {
89
- await this.onDynamicDsCreated(height);
90
- }
91
- (0, assert_1.default)(!this.latestProcessedHeight || height > this.latestProcessedHeight, `Block processed out of order. Height: ${height}. Latest: ${this.latestProcessedHeight}`);
92
- // In memory _processedBlockCount increase, db metadata increase BlockCount in indexer.manager
93
- this.setProcessedBlockCount(this._processedBlockCount + 1);
94
- this.latestProcessedHeight = height;
95
- }
96
- }
97
- }
98
- exports.BaseBlockDispatcher = BaseBlockDispatcher;
99
- //# sourceMappingURL=base-block-dispatcher.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"base-block-dispatcher.js","sourceRoot":"","sources":["../../../src/indexer/blockDispatcher/base-block-dispatcher.ts"],"names":[],"mappings":";AAAA,gEAAgE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,aAAa,CAAC,EAAE;gBACpE,kFAAkF;gBAClF,IAAI,IAAI,CAAC,cAAc,CAAC,WAAW,KAAK,SAAS,EAAE;oBACjD,yEAAyE;oBACzE,MAAM,IAAI,CAAC,cAAc,CAAC,yBAAyB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;iBACjE;gBACD,gEAAgE;gBAChE,KAAK,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;aACrD;YACD,IAAI,gBAAgB,EAAE;gBACpB,MAAM,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;aACvC;YACD,IAAA,gBAAM,EACJ,CAAC,IAAI,CAAC,qBAAqB,IAAI,MAAM,GAAG,IAAI,CAAC,qBAAqB,EAClE,yCAAyC,MAAM,aAAa,IAAI,CAAC,qBAAqB,EAAE,CACzF,CAAC;YACF,8FAA8F;YAC9F,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,oBAAoB,GAAG,CAAC,CAAC,CAAC;YAC3D,IAAI,CAAC,qBAAqB,GAAG,MAAM,CAAC;SACrC;IACH,CAAC;CACF;AA9GD,kDA8GC","sourcesContent":["// Copyright 2020-2021 OnFinality Limited authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport assert from 'assert';\nimport { EventEmitter2 } from '@nestjs/event-emitter';\nimport { hexToU8a, u8aEq } from '@polkadot/util';\nimport { getLogger, IndexerEvent, IQueue, NodeConfig } from '@subql/node-core';\nimport { ProjectService } from '../project.service';\n\nconst logger = getLogger('BaseBlockDispatcherService');\n\nexport type ProcessBlockResponse = {\n dynamicDsCreated: boolean;\n operationHash: Uint8Array;\n reindexBlockHeight: number;\n};\n\nexport interface IBlockDispatcher {\n init(onDynamicDsCreated: (height: number) => Promise<void>): Promise<void>;\n\n enqueueBlocks(heights: number[], latestBufferHeight?: number): void;\n\n queueSize: number;\n freeSize: number;\n latestBufferedHeight: number | undefined;\n\n // Remove all enqueued blocks, used when a dynamic ds is created\n flushQueue(height: number): void;\n rewind(height: number): Promise<void>;\n}\n\nconst NULL_MERKEL_ROOT = hexToU8a('0x00');\n\nfunction isNullMerkelRoot(operationHash: Uint8Array): boolean {\n return u8aEq(operationHash, NULL_MERKEL_ROOT);\n}\n\nexport abstract class BaseBlockDispatcher<Q extends IQueue>\n implements IBlockDispatcher\n{\n protected _latestBufferedHeight: number;\n protected _processedBlockCount: number;\n protected latestProcessedHeight: number;\n protected currentProcessingHeight: number;\n protected onDynamicDsCreated: (height: number) => Promise<void>;\n\n constructor(\n protected nodeConfig: NodeConfig,\n protected eventEmitter: EventEmitter2,\n protected projectService: ProjectService,\n protected queue: Q,\n ) {}\n\n abstract enqueueBlocks(heights: number[]): void;\n abstract init(\n onDynamicDsCreated: (height: number) => Promise<void>,\n ): Promise<void>;\n\n get queueSize(): number {\n return this.queue.size;\n }\n\n get freeSize(): number {\n return this.queue.freeSpace;\n }\n\n get latestBufferedHeight(): number {\n return this._latestBufferedHeight;\n }\n\n set latestBufferedHeight(height: number) {\n this.eventEmitter.emit(IndexerEvent.BlocknumberQueueSize, {\n value: this.queueSize,\n });\n this._latestBufferedHeight = height;\n }\n\n protected setProcessedBlockCount(processedBlockCount: number): void {\n this._processedBlockCount = processedBlockCount;\n this.eventEmitter.emit(IndexerEvent.BlockProcessedCount, {\n processedBlockCount,\n timestamp: Date.now(),\n });\n }\n\n // Compare it with current indexing number, if last corrected is already indexed\n // rewind, also flush queued blocks, drop current indexing transaction, set last processed to correct block too\n // if rollback is greater than current index flush queue only\n async rewind(lastCorrectHeight: number): Promise<void> {\n if (lastCorrectHeight <= this.currentProcessingHeight) {\n logger.info(\n `Found last verified block at height ${lastCorrectHeight}, rewinding...`,\n );\n await this.projectService.reindex(lastCorrectHeight);\n this.latestProcessedHeight = lastCorrectHeight;\n logger.info(`Successful rewind to block ${lastCorrectHeight}!`);\n }\n this.flushQueue(lastCorrectHeight);\n logger.info(`Queued blocks flushed!`); //Also last buffered height reset, next fetching should start after lastCorrectHeight\n }\n\n flushQueue(height: number): void {\n this.latestBufferedHeight = height;\n this.queue.flush();\n }\n\n // Is called directly before a block is processed\n protected preProcessBlock(height: number): void {\n this.currentProcessingHeight = height;\n this.eventEmitter.emit(IndexerEvent.BlockProcessing, {\n height,\n timestamp: Date.now(),\n });\n }\n\n // Is called directly after a block is processed\n protected async postProcessBlock(\n height: number,\n processBlockResponse: ProcessBlockResponse,\n ): Promise<void> {\n const { dynamicDsCreated, operationHash, reindexBlockHeight } =\n processBlockResponse;\n if (reindexBlockHeight !== null && reindexBlockHeight !== undefined) {\n await this.rewind(reindexBlockHeight);\n this.latestProcessedHeight = reindexBlockHeight;\n } else {\n if (this.nodeConfig.proofOfIndex && !isNullMerkelRoot(operationHash)) {\n // We only check if it is undefined, need to be caution here when blockOffset is 0\n if (this.projectService.blockOffset === undefined) {\n // Which means during project init, it has not found offset and set value\n await this.projectService.upsertMetadataBlockOffset(height - 1);\n }\n // this will return if project service blockOffset already exist\n void this.projectService.setBlockOffset(height - 1);\n }\n if (dynamicDsCreated) {\n await this.onDynamicDsCreated(height);\n }\n assert(\n !this.latestProcessedHeight || height > this.latestProcessedHeight,\n `Block processed out of order. Height: ${height}. Latest: ${this.latestProcessedHeight}`,\n );\n // In memory _processedBlockCount increase, db metadata increase BlockCount in indexer.manager\n this.setProcessedBlockCount(this._processedBlockCount + 1);\n this.latestProcessedHeight = height;\n }\n }\n}\n"]}