@eclesia/indexer-engine 2.5.18 → 2.6.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/emitter/index.d.ts.map +1 -1
- package/dist/emitter/index.js +9 -5
- package/dist/indexer/index.d.ts +1 -2
- package/dist/indexer/index.d.ts.map +1 -1
- package/dist/indexer/index.js +142 -94
- package/dist/promise-queue/index.d.ts.map +1 -1
- package/dist/promise-queue/index.js +5 -5
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/bech32.d.ts +1 -1
- package/dist/utils/bech32.d.ts.map +1 -1
- package/dist/utils/bech32.js +3 -1
- package/dist/utils/bigint.d.ts +1 -1
- package/dist/utils/bigint.d.ts.map +1 -1
- package/dist/utils/bigint.js +1 -2
- package/dist/utils/text.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/emitter/index.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/emitter/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAElB,qBAAa,cAAc;IACzB,OAAO,CAAC,OAAO,CAAsB;IAE9B,OAAO,sBAA6B;IAE3C,OAAO,CAAC,UAAU,CAAiB;;IAMnC,IAAI,CAAC,KAAK,SAAS,MAAM,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,GAAG,MAAM,EAC7D,SAAS,EAAE,KAAK,EAChB,QAAQ,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,GAAG;QAC7C,IAAI,CAAC,EAAE,MAAM,CAAA;KACd;IAkBH,EAAE,CAAC,UAAU,SAAS,MAAM,iBAAiB,CAAC,QAAQ,CAAC,GAAG,MAAM,GAAG,YAAY,EAC7E,SAAS,EAAE,UAAU,EACrB,OAAO,EAAE,UAAU,SAAS,YAAY,GACpC,CAAC,QAAQ,EAAE;QACX,IAAI,EAAE,MAAM,CAAA;QACZ,KAAK,EAAE,OAAO,CAAA;QACd,IAAI,EAAE,MAAM,CAAA;KACb,KAAK,IAAI,GACR,CAAC,QAAQ,EAAE,UAAU,SAAS,MAAM,iBAAiB,CAAC,QAAQ,CAAC,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC,UAAU,CAAC,GAAG,KAAK,KAAK,IAAI;IA8ChI,GAAG,CAAC,UAAU,SAAS,MAAM,iBAAiB,CAAC,QAAQ,CAAC,GAAG,MAAM,EAC/D,SAAS,EAAE,UAAU,EACrB,OAAO,EAAE,CAAC,QAAQ,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC,UAAU,CAAC,KAAK,IAAI;CAmBvE"}
|
package/dist/emitter/index.js
CHANGED
|
@@ -20,7 +20,7 @@ class EclesiaEmitter {
|
|
|
20
20
|
this.emitter.emit("_unhandled", {
|
|
21
21
|
type: eventName,
|
|
22
22
|
event: eventArg,
|
|
23
|
-
uuid: eventArg.uuid
|
|
23
|
+
uuid: eventArg.uuid,
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -37,15 +37,19 @@ class EclesiaEmitter {
|
|
|
37
37
|
try {
|
|
38
38
|
await handler(eventData);
|
|
39
39
|
if (eventName !== "uuid" && eventName !== "_unhandled" && eventData.uuid) {
|
|
40
|
-
this.emit("uuid", {
|
|
41
|
-
|
|
40
|
+
this.emit("uuid", {
|
|
41
|
+
status: true,
|
|
42
|
+
uuid: eventData.uuid,
|
|
43
|
+
});
|
|
42
44
|
}
|
|
43
45
|
}
|
|
44
46
|
catch (error) {
|
|
45
47
|
if (eventName !== "uuid" && eventName !== "_unhandled" && eventData.uuid) {
|
|
46
|
-
this.emit("uuid", {
|
|
48
|
+
this.emit("uuid", {
|
|
49
|
+
status: false,
|
|
47
50
|
error: error,
|
|
48
|
-
uuid: eventData.uuid
|
|
51
|
+
uuid: eventData.uuid,
|
|
52
|
+
});
|
|
49
53
|
}
|
|
50
54
|
}
|
|
51
55
|
};
|
package/dist/indexer/index.d.ts
CHANGED
|
@@ -27,8 +27,7 @@ export declare class EcleciaIndexer extends EclesiaEmitter {
|
|
|
27
27
|
client: CometClient;
|
|
28
28
|
blockClient: CometClient;
|
|
29
29
|
log: winston.Logger;
|
|
30
|
-
private
|
|
31
|
-
private debugTime;
|
|
30
|
+
private tryToRecover;
|
|
32
31
|
private healthCheck;
|
|
33
32
|
private subscription;
|
|
34
33
|
constructor(config: EcleciaIndexerConfig);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/indexer/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/indexer/index.ts"],"names":[],"mappings":"AAMA,OAAO,EACgC,WAAW,EACjD,MAAM,wBAAwB,CAAC;AA4ChC,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,EACL,cAAc,EACf,MAAM,YAAY,CAAC;AAIpB,OAAO,EACO,oBAAoB,EAAE,QAAQ,EAAqB,iBAAiB,EACjF,MAAM,UAAU,CAAC;AAQlB,eAAO,MAAM,oBAAoB;;;;;cAKX,oBAAoB,CAAC,UAAU,CAAC;;;;;;;8BAO1B,OAAO;CAClC,CAAC;AAEF,qBAAa,cAAe,SAAQ,cAAc;IAChD,OAAO,CAAC,MAAM,CAAuB;IAErC,OAAO,CAAC,OAAO,CAAkB;IAEjC,OAAO,CAAC,UAAU,CAAa;IAE/B,OAAO,CAAC,YAAY,CAAU;IAE9B,OAAO,CAAC,eAAe,CAAU;IAEjC,OAAO,CAAC,WAAW,CAAS;IAE5B,OAAO,CAAC,UAAU,CAAK;IAEhB,MAAM,EAAG,WAAW,CAAC;IAErB,WAAW,EAAG,WAAW,CAAC;IAE1B,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC;IAE3B,OAAO,CAAC,YAAY,CAAkB;IAEtC,OAAO,CAAC,WAAW,CAEjB;IAEF,OAAO,CAAC,YAAY,CAA6D;gBAErE,MAAM,EAAE,oBAAoB;IA6ExC,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,aAAa,CAQnB;IAEF,OAAO,CAAC,SAAS;IASJ,OAAO;IAuBP,KAAK;IAqKX,SAAS,EAAE,QAAQ,CAAC,MAAM,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CA2C3D;YAEY,YAAY;YAmJZ,OAAO;IAkER,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,GAAE,OAAc,GAAG,OAAO,CAAC,UAAU,CAAC;IA0BlH,OAAO,CAAC,gBAAgB;YAgDV,YAAY;IAa1B,OAAO,CAAC,WAAW;YASL,cAAc;YAsCd,cAAc;YA4Bd,YAAY;CAkE3B"}
|
package/dist/indexer/index.js
CHANGED
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.EcleciaIndexer = exports.defaultIndexerConfig = void 0;
|
|
7
|
+
/* eslint-disable max-lines */
|
|
7
8
|
const node_crypto_1 = require("node:crypto");
|
|
8
9
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
10
|
const tendermint_rpc_1 = require("@cosmjs/tendermint-rpc");
|
|
@@ -35,30 +36,31 @@ exports.defaultIndexerConfig = {
|
|
|
35
36
|
minimal: true,
|
|
36
37
|
init: () => Promise.resolve(),
|
|
37
38
|
beginTransaction: () => Promise.resolve(),
|
|
38
|
-
endTransaction: (_status) => Promise.resolve()
|
|
39
|
+
endTransaction: (_status) => Promise.resolve(),
|
|
39
40
|
};
|
|
40
41
|
class EcleciaIndexer extends emitter_1.EclesiaEmitter {
|
|
41
42
|
constructor(config) {
|
|
42
43
|
super();
|
|
43
44
|
this.initialized = false;
|
|
44
45
|
this.retryCount = 0;
|
|
45
|
-
this.
|
|
46
|
-
this.debugTime = null;
|
|
46
|
+
this.tryToRecover = false;
|
|
47
47
|
this.healthCheck = {
|
|
48
|
-
status: "CONNECTING"
|
|
48
|
+
status: "CONNECTING",
|
|
49
49
|
};
|
|
50
50
|
this.subscription = null;
|
|
51
51
|
this.blockListener = {
|
|
52
52
|
next: (data) => {
|
|
53
53
|
this.newBlockReceived(data.header.height);
|
|
54
|
-
}
|
|
54
|
+
},
|
|
55
55
|
};
|
|
56
56
|
this.asyncEmit = async (type, event) => {
|
|
57
57
|
event.uuid = (0, uuid_1.v4)();
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
/*
|
|
59
|
+
* More than 1 listener can be registered for an event type
|
|
60
|
+
* Fortunately these are all set up during module init() so we have a consistent count
|
|
61
|
+
* so we can count responses to resolve when complete
|
|
62
|
+
* values are irrelevant as promise resolution is only used for flow control
|
|
63
|
+
*/
|
|
62
64
|
let listenerCount = this.handled.get(type);
|
|
63
65
|
if (!listenerCount) {
|
|
64
66
|
// Setting listenerCount to 1 (the unhandled listener)
|
|
@@ -89,7 +91,7 @@ class EcleciaIndexer extends emitter_1.EclesiaEmitter {
|
|
|
89
91
|
};
|
|
90
92
|
this.config = {
|
|
91
93
|
...exports.defaultIndexerConfig,
|
|
92
|
-
...config
|
|
94
|
+
...config,
|
|
93
95
|
};
|
|
94
96
|
if (this.config.minimal) {
|
|
95
97
|
this.blockQueue = new promise_queue_1.CircularBuffer(this.config.batchSize);
|
|
@@ -97,43 +99,51 @@ class EcleciaIndexer extends emitter_1.EclesiaEmitter {
|
|
|
97
99
|
else {
|
|
98
100
|
this.blockQueue = new promise_queue_1.CircularBuffer(this.config.batchSize);
|
|
99
101
|
}
|
|
100
|
-
const { printf } = winston_1.default.format;
|
|
101
|
-
const eclesiaFormat = printf(({ level, message, timestamp }) => {
|
|
102
|
+
const { printf, } = winston_1.default.format;
|
|
103
|
+
const eclesiaFormat = printf(({ level, message, timestamp, }) => {
|
|
102
104
|
return `${timestamp} [${level.toUpperCase()}]:\t${message}`;
|
|
103
105
|
});
|
|
104
106
|
this.log = winston_1.default.createLogger({
|
|
105
107
|
level: this.config.logLevel,
|
|
106
|
-
defaultMeta: {
|
|
108
|
+
defaultMeta: {
|
|
109
|
+
service: "Eclesia Indexer",
|
|
110
|
+
},
|
|
107
111
|
transports: [
|
|
108
112
|
new winston_1.default.transports.File({
|
|
109
113
|
filename: "error.log",
|
|
110
|
-
level: "error"
|
|
114
|
+
level: "error",
|
|
115
|
+
}),
|
|
116
|
+
new winston_1.default.transports.File({
|
|
117
|
+
filename: "combined.log",
|
|
111
118
|
}),
|
|
112
|
-
new winston_1.default.transports.File({ filename: "combined.log" }),
|
|
113
119
|
new winston_1.default.transports.Console({
|
|
114
|
-
format: winston_1.default.format.combine(winston_1.default.format.splat(), winston_1.default.format.timestamp(), eclesiaFormat, winston_1.default.format.colorize({
|
|
115
|
-
|
|
116
|
-
|
|
120
|
+
format: winston_1.default.format.combine(winston_1.default.format.splat(), winston_1.default.format.timestamp(), eclesiaFormat, winston_1.default.format.colorize({
|
|
121
|
+
all: true,
|
|
122
|
+
})),
|
|
123
|
+
}),
|
|
124
|
+
],
|
|
117
125
|
});
|
|
118
126
|
this.fastify = (0, fastify_1.default)({
|
|
119
|
-
logger: false
|
|
127
|
+
logger: false,
|
|
120
128
|
});
|
|
121
129
|
this.on("_unhandled", (msg) => {
|
|
122
130
|
if (msg.uuid) {
|
|
123
131
|
this.log.verbose("Unhandled event: " + msg.type);
|
|
124
132
|
this.emit("uuid", {
|
|
125
133
|
status: true,
|
|
126
|
-
uuid: msg.uuid
|
|
134
|
+
uuid: msg.uuid,
|
|
127
135
|
});
|
|
128
136
|
}
|
|
129
137
|
});
|
|
130
138
|
this.fastify.get("/health", async (_request, reply) => {
|
|
131
|
-
const code = this.healthCheck.status == "OK"
|
|
139
|
+
const code = this.healthCheck.status == "OK"
|
|
140
|
+
? 200
|
|
141
|
+
: 503;
|
|
132
142
|
reply.code(code).send(this.healthCheck);
|
|
133
143
|
});
|
|
134
144
|
this.fastify.listen({
|
|
135
145
|
port: 80,
|
|
136
|
-
host: "0.0.0.0"
|
|
146
|
+
host: "0.0.0.0",
|
|
137
147
|
}, (err) => {
|
|
138
148
|
if (err) {
|
|
139
149
|
this.log.error(err);
|
|
@@ -154,27 +164,29 @@ class EcleciaIndexer extends emitter_1.EclesiaEmitter {
|
|
|
154
164
|
}
|
|
155
165
|
async connect() {
|
|
156
166
|
try {
|
|
157
|
-
this.client.
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
try {
|
|
167
|
+
if (this.client && this.tryToRecover) {
|
|
168
|
+
this.log.verbose("Recover from error. Attempting to disconnect from RPC");
|
|
169
|
+
this.client.disconnect();
|
|
170
|
+
this.blockClient.disconnect();
|
|
171
|
+
this.log.verbose("Disconnected from RPC");
|
|
172
|
+
}
|
|
164
173
|
this.client = await (0, tendermint_rpc_2.connectComet)(this.config.rpcUrl);
|
|
165
174
|
this.log.info("Connected to RPC for ad hoc queries");
|
|
166
175
|
this.blockClient = await (0, tendermint_rpc_2.connectComet)(this.config.rpcUrl);
|
|
167
176
|
this.log.info("Connected to RPC for block & validator info");
|
|
168
|
-
this.rpcOk = true;
|
|
169
177
|
return true;
|
|
170
178
|
}
|
|
171
179
|
catch (error) {
|
|
172
180
|
this.log.error(error);
|
|
173
|
-
this.
|
|
181
|
+
this.tryToRecover = true;
|
|
174
182
|
return false;
|
|
175
183
|
}
|
|
176
184
|
}
|
|
177
185
|
async start() {
|
|
186
|
+
if (this.blockQueue) {
|
|
187
|
+
this.blockQueue.clear();
|
|
188
|
+
this.log.verbose("Starting, clearing block queue");
|
|
189
|
+
}
|
|
178
190
|
if (!this.initialized) {
|
|
179
191
|
try {
|
|
180
192
|
if (this.config.init) {
|
|
@@ -200,13 +212,18 @@ class EcleciaIndexer extends emitter_1.EclesiaEmitter {
|
|
|
200
212
|
}
|
|
201
213
|
this.initialized = true;
|
|
202
214
|
}
|
|
203
|
-
this.subscription = null;
|
|
204
215
|
try {
|
|
205
216
|
await this.connect();
|
|
206
|
-
|
|
217
|
+
if (!this.config.usePolling && this.subscription) {
|
|
218
|
+
this.subscription.removeListener(this.blockListener);
|
|
219
|
+
this.subscription = null;
|
|
220
|
+
this.log.verbose("Removed existing block listener and subscription");
|
|
221
|
+
}
|
|
222
|
+
this.subscription = this.client.subscribeNewBlock
|
|
223
|
+
? this.client.subscribeNewBlock()
|
|
224
|
+
: null;
|
|
207
225
|
const status = await this.client.status();
|
|
208
226
|
this.latestHeight = status.syncInfo.latestBlockHeight;
|
|
209
|
-
this.blockQueue.clear();
|
|
210
227
|
this.log.info("Current chain height: " + this.latestHeight);
|
|
211
228
|
this.heightToProcess = await this.config.getNextHeight();
|
|
212
229
|
if (this.config.usePolling) {
|
|
@@ -232,11 +249,11 @@ class EcleciaIndexer extends emitter_1.EclesiaEmitter {
|
|
|
232
249
|
});
|
|
233
250
|
const hrTime = process.hrtime();
|
|
234
251
|
let ms = hrTime[0] * 1000000 + hrTime[1] / 1000;
|
|
235
|
-
while (this.blockQueue.size() > 0) {
|
|
252
|
+
while (this.blockQueue.size() > 0 && !this.tryToRecover) {
|
|
236
253
|
// await the dequeued promise is essentially awaiting fetched data for that block
|
|
237
254
|
try {
|
|
238
|
-
if (
|
|
239
|
-
throw new Error("
|
|
255
|
+
if (this.tryToRecover) {
|
|
256
|
+
throw new Error("Exiting processing loop. Attempting to recover indexer");
|
|
240
257
|
}
|
|
241
258
|
// Index block inside a db transaction to ensure data consistency
|
|
242
259
|
await this.config.beginTransaction();
|
|
@@ -274,21 +291,21 @@ class EcleciaIndexer extends emitter_1.EclesiaEmitter {
|
|
|
274
291
|
await this.asyncEmit("periodic/1000", {
|
|
275
292
|
value: null,
|
|
276
293
|
height,
|
|
277
|
-
timestamp
|
|
294
|
+
timestamp,
|
|
278
295
|
});
|
|
279
296
|
}
|
|
280
297
|
if (height % 100 == 0) {
|
|
281
298
|
await this.asyncEmit("periodic/100", {
|
|
282
299
|
value: null,
|
|
283
300
|
height,
|
|
284
|
-
timestamp
|
|
301
|
+
timestamp,
|
|
285
302
|
});
|
|
286
303
|
}
|
|
287
304
|
if (height % 50 == 0) {
|
|
288
305
|
await this.asyncEmit("periodic/50", {
|
|
289
306
|
value: null,
|
|
290
307
|
height,
|
|
291
|
-
timestamp
|
|
308
|
+
timestamp,
|
|
292
309
|
});
|
|
293
310
|
}
|
|
294
311
|
this.log.silly("Handled periodic events");
|
|
@@ -299,9 +316,7 @@ class EcleciaIndexer extends emitter_1.EclesiaEmitter {
|
|
|
299
316
|
this.log.error("" + e);
|
|
300
317
|
this.setStatus("FAILED");
|
|
301
318
|
await this.config.endTransaction(false);
|
|
302
|
-
|
|
303
|
-
this.subscription.removeListener(this.blockListener);
|
|
304
|
-
}
|
|
319
|
+
this.tryToRecover = true;
|
|
305
320
|
this.retryCount++;
|
|
306
321
|
break;
|
|
307
322
|
}
|
|
@@ -329,32 +344,34 @@ class EcleciaIndexer extends emitter_1.EclesiaEmitter {
|
|
|
329
344
|
// Initialize height & timestamp to be used for this block-processing run
|
|
330
345
|
const timestamp = (0, tendermint_rpc_1.toRfc3339WithNanoseconds)(block.block.header.time);
|
|
331
346
|
// Use & await asyncEmit to ensure db insertions in order
|
|
332
|
-
|
|
333
|
-
|
|
347
|
+
/*
|
|
348
|
+
* Emit block information to any interested modules.
|
|
349
|
+
* Primarily the required block module listens to this
|
|
350
|
+
*/
|
|
334
351
|
await this.asyncEmit("block", {
|
|
335
352
|
value: {
|
|
336
353
|
block,
|
|
337
|
-
block_results
|
|
354
|
+
block_results,
|
|
338
355
|
},
|
|
339
356
|
height,
|
|
340
|
-
timestamp
|
|
357
|
+
timestamp,
|
|
341
358
|
});
|
|
342
359
|
this.log.silly("Modules handled block event");
|
|
343
360
|
// Deal with begin_block events first
|
|
344
361
|
await this.asyncEmit("begin_block", {
|
|
345
362
|
value: {
|
|
346
363
|
events: block_results.beginBlockEvents,
|
|
347
|
-
validators
|
|
364
|
+
validators,
|
|
348
365
|
},
|
|
349
366
|
height,
|
|
350
|
-
timestamp
|
|
367
|
+
timestamp,
|
|
351
368
|
});
|
|
352
369
|
this.log.silly("Modules handled begin_block events");
|
|
353
370
|
// Then individual tx_events
|
|
354
371
|
await this.asyncEmit("tx_events", {
|
|
355
372
|
value: block_results.results,
|
|
356
373
|
height,
|
|
357
|
-
timestamp
|
|
374
|
+
timestamp,
|
|
358
375
|
});
|
|
359
376
|
this.log.silly("Modules handled tx events");
|
|
360
377
|
// Emit details and result for each tx msg separately
|
|
@@ -367,14 +384,15 @@ class EcleciaIndexer extends emitter_1.EclesiaEmitter {
|
|
|
367
384
|
continue;
|
|
368
385
|
}
|
|
369
386
|
if (tx.body && tx.body.memo != "") {
|
|
370
|
-
const txHash = (0, node_crypto_1.createHash)("sha256").update(block.block.txs[t])
|
|
387
|
+
const txHash = (0, node_crypto_1.createHash)("sha256").update(block.block.txs[t])
|
|
388
|
+
.digest("hex");
|
|
371
389
|
await this.asyncEmit("tx_memo", {
|
|
372
390
|
value: {
|
|
373
391
|
txHash,
|
|
374
|
-
txBody: tx.body
|
|
392
|
+
txBody: tx.body,
|
|
375
393
|
},
|
|
376
394
|
height,
|
|
377
|
-
timestamp
|
|
395
|
+
timestamp,
|
|
378
396
|
});
|
|
379
397
|
}
|
|
380
398
|
// parsing log rather than using events directly in order to have msg_index available to filter appropriate events for each msg
|
|
@@ -386,15 +404,15 @@ class EcleciaIndexer extends emitter_1.EclesiaEmitter {
|
|
|
386
404
|
for (let i = 0; i < msgs.length; i++) {
|
|
387
405
|
this.log.silly("Indexer broadcasting msg for handling: " + msgs[i].typeUrl);
|
|
388
406
|
const msgevents = msgs.length > 1
|
|
389
|
-
? events.find(
|
|
407
|
+
? events.find(x => x.msg_index == i)?.events
|
|
390
408
|
: events[0].events;
|
|
391
409
|
await this.asyncEmit(msgs[i].typeUrl, {
|
|
392
410
|
value: {
|
|
393
411
|
tx: msgs[i].value,
|
|
394
|
-
events: msgevents
|
|
412
|
+
events: msgevents,
|
|
395
413
|
},
|
|
396
414
|
height,
|
|
397
|
-
timestamp
|
|
415
|
+
timestamp,
|
|
398
416
|
});
|
|
399
417
|
if (msgs[i].typeUrl == "/cosmos.authz.v1beta1.MsgExec") {
|
|
400
418
|
const authzMsgs = tx_1.MsgExec.decode(msgs[i].value).msgs;
|
|
@@ -410,10 +428,10 @@ class EcleciaIndexer extends emitter_1.EclesiaEmitter {
|
|
|
410
428
|
await this.asyncEmit(authzMsgs[r].typeUrl, {
|
|
411
429
|
value: {
|
|
412
430
|
tx: authzMsgs[r].value,
|
|
413
|
-
events: authzMsgEvents
|
|
431
|
+
events: authzMsgEvents,
|
|
414
432
|
},
|
|
415
433
|
height,
|
|
416
|
-
timestamp
|
|
434
|
+
timestamp,
|
|
417
435
|
});
|
|
418
436
|
}
|
|
419
437
|
}
|
|
@@ -426,7 +444,7 @@ class EcleciaIndexer extends emitter_1.EclesiaEmitter {
|
|
|
426
444
|
await this.asyncEmit("end_block", {
|
|
427
445
|
value: block_results.endBlockEvents,
|
|
428
446
|
height,
|
|
429
|
-
timestamp
|
|
447
|
+
timestamp,
|
|
430
448
|
});
|
|
431
449
|
this.log.silly("Modules handled end_block events");
|
|
432
450
|
if (this.config.logLevel == "silly") {
|
|
@@ -436,20 +454,20 @@ class EcleciaIndexer extends emitter_1.EclesiaEmitter {
|
|
|
436
454
|
}
|
|
437
455
|
}
|
|
438
456
|
async fetcher() {
|
|
439
|
-
let error = false;
|
|
440
457
|
for (let i = this.heightToProcess; i <= this.latestHeight; i++) {
|
|
441
458
|
this.log.debug("Fetching: " + i);
|
|
459
|
+
if (this.tryToRecover) {
|
|
460
|
+
this.log.verbose("Exiting fetcher loop. Attempting to recover indexer");
|
|
461
|
+
break;
|
|
462
|
+
}
|
|
442
463
|
try {
|
|
443
464
|
if (this.isMinimal(this.blockQueue)) {
|
|
444
465
|
const timeoutPromise = new Promise((resolve, reject) => {
|
|
445
466
|
setTimeout(reject, 20000, false);
|
|
446
467
|
});
|
|
447
|
-
const toIndex = Promise.race([Promise.all([
|
|
448
|
-
this.blockClient.block(i),
|
|
449
|
-
this.blockClient.blockResults(i)
|
|
450
|
-
]), timeoutPromise]).catch((e) => {
|
|
468
|
+
const toIndex = Promise.race([Promise.all([this.blockClient.block(i), this.blockClient.blockResults(i)]), timeoutPromise]).catch((e) => {
|
|
451
469
|
this.log.error("Error fetching block: " + i + " : " + e);
|
|
452
|
-
this.
|
|
470
|
+
this.tryToRecover = true;
|
|
453
471
|
return Promise.resolve([]);
|
|
454
472
|
});
|
|
455
473
|
this.blockQueue.enqueue(toIndex);
|
|
@@ -458,53 +476,61 @@ class EcleciaIndexer extends emitter_1.EclesiaEmitter {
|
|
|
458
476
|
const timeoutPromise = new Promise((resolve, reject) => {
|
|
459
477
|
setTimeout(reject, 20000, false);
|
|
460
478
|
});
|
|
461
|
-
const q = query_1.QueryValidatorsRequest.fromPartial({
|
|
479
|
+
const q = query_1.QueryValidatorsRequest.fromPartial({
|
|
480
|
+
pagination: {
|
|
481
|
+
limit: 1000n,
|
|
482
|
+
},
|
|
483
|
+
});
|
|
462
484
|
const vals = query_1.QueryValidatorsRequest.encode(q).finish();
|
|
463
|
-
const toIndex = Promise.race([
|
|
485
|
+
const toIndex = Promise.race([
|
|
486
|
+
Promise.all([
|
|
464
487
|
this.blockClient.block(i),
|
|
465
488
|
this.blockClient.blockResults(i),
|
|
466
|
-
this.callABCI("/cosmos.staking.v1beta1.Query/Validators", vals, i, false)
|
|
467
|
-
]),
|
|
489
|
+
this.callABCI("/cosmos.staking.v1beta1.Query/Validators", vals, i, false),
|
|
490
|
+
]),
|
|
491
|
+
timeoutPromise,
|
|
492
|
+
]).catch((e) => {
|
|
468
493
|
this.log.error("Error fetching block: " + i + " : " + e);
|
|
469
|
-
this.
|
|
494
|
+
this.tryToRecover = true;
|
|
470
495
|
return Promise.resolve([]);
|
|
471
496
|
});
|
|
472
497
|
this.blockQueue.enqueue(toIndex);
|
|
473
498
|
}
|
|
474
499
|
await this.blockQueue.continue();
|
|
475
|
-
if (
|
|
500
|
+
if (this.tryToRecover) {
|
|
476
501
|
throw new Error("RPC not responding");
|
|
477
502
|
}
|
|
478
503
|
}
|
|
479
504
|
catch (e) {
|
|
480
505
|
this.log.error(e);
|
|
481
|
-
error = true;
|
|
482
506
|
break;
|
|
483
507
|
}
|
|
484
508
|
}
|
|
485
|
-
if (!
|
|
509
|
+
if (!this.tryToRecover) {
|
|
486
510
|
this.blockQueue.setSynced();
|
|
487
511
|
this.log.info("Synced to latest height");
|
|
488
512
|
}
|
|
489
513
|
}
|
|
490
514
|
async callABCI(path, data, height, adHoc = true) {
|
|
491
515
|
try {
|
|
492
|
-
const abciq = await (adHoc
|
|
516
|
+
const abciq = await (adHoc
|
|
517
|
+
? this.client
|
|
518
|
+
: this.blockClient).abciQuery({
|
|
493
519
|
path,
|
|
494
520
|
data,
|
|
495
|
-
height: height
|
|
521
|
+
height: height,
|
|
496
522
|
});
|
|
497
523
|
if (abciq) {
|
|
498
524
|
return abciq.value;
|
|
499
525
|
}
|
|
500
526
|
else {
|
|
501
|
-
this.
|
|
527
|
+
this.tryToRecover = true;
|
|
502
528
|
this.setStatus("FAILED");
|
|
503
529
|
throw new Error("RPC not responding. Query at: " + path);
|
|
504
530
|
}
|
|
505
531
|
}
|
|
506
532
|
catch (_e) {
|
|
507
|
-
this.
|
|
533
|
+
this.tryToRecover = true;
|
|
508
534
|
this.setStatus("FAILED");
|
|
509
535
|
throw new Error("RPC not responding. Query at: " + path);
|
|
510
536
|
}
|
|
@@ -512,29 +538,30 @@ class EcleciaIndexer extends emitter_1.EclesiaEmitter {
|
|
|
512
538
|
newBlockReceived(height) {
|
|
513
539
|
this.log.info("Received new block: %d", height);
|
|
514
540
|
// If we are synced, add to end of queue
|
|
515
|
-
if (this.blockQueue.synced) {
|
|
541
|
+
if (this.blockQueue.synced && !this.tryToRecover) {
|
|
516
542
|
if (this.blockQueue.size() + 1 == this.config.batchSize) {
|
|
517
543
|
this.log.error("Block queue is full. Cannot add new block");
|
|
518
|
-
this.
|
|
544
|
+
this.tryToRecover = true;
|
|
519
545
|
return;
|
|
520
546
|
}
|
|
521
547
|
try {
|
|
522
548
|
if (this.isMinimal(this.blockQueue)) {
|
|
523
|
-
this.blockQueue.enqueue(Promise.all([
|
|
524
|
-
this.client.block(height),
|
|
525
|
-
this.client.blockResults(height)
|
|
526
|
-
]).catch((e) => {
|
|
549
|
+
this.blockQueue.enqueue(Promise.all([this.client.block(height), this.client.blockResults(height)]).catch((e) => {
|
|
527
550
|
this.log.error("Error fetching block: " + height + " : " + e);
|
|
528
551
|
return Promise.resolve([]);
|
|
529
552
|
}));
|
|
530
553
|
}
|
|
531
554
|
else {
|
|
532
|
-
const q = query_1.QueryValidatorsRequest.fromPartial({
|
|
555
|
+
const q = query_1.QueryValidatorsRequest.fromPartial({
|
|
556
|
+
pagination: {
|
|
557
|
+
limit: 1000n,
|
|
558
|
+
},
|
|
559
|
+
});
|
|
533
560
|
const vals = query_1.QueryValidatorsRequest.encode(q).finish();
|
|
534
561
|
this.blockQueue.enqueue(Promise.all([
|
|
535
562
|
this.client.block(height),
|
|
536
563
|
this.client.blockResults(height),
|
|
537
|
-
this.callABCI("/cosmos.staking.v1beta1.Query/Validators", vals, height, false)
|
|
564
|
+
this.callABCI("/cosmos.staking.v1beta1.Query/Validators", vals, height, false),
|
|
538
565
|
]).catch((e) => {
|
|
539
566
|
this.log.error("Error fetching block: " + height + " : " + e);
|
|
540
567
|
return Promise.resolve([]);
|
|
@@ -572,9 +599,19 @@ class EcleciaIndexer extends emitter_1.EclesiaEmitter {
|
|
|
572
599
|
const readPromise = new Promise((resolve, reject) => {
|
|
573
600
|
try {
|
|
574
601
|
const filters = path.split(".");
|
|
575
|
-
const pickers = filters.map(
|
|
602
|
+
const pickers = filters.map(filter => (0, Pick_1.pick)({
|
|
603
|
+
filter,
|
|
604
|
+
}));
|
|
576
605
|
let counter = 0;
|
|
577
|
-
(0, stream_chain_1.chain)([
|
|
606
|
+
(0, stream_chain_1.chain)([
|
|
607
|
+
this.readGenesis(),
|
|
608
|
+
...pickers,
|
|
609
|
+
(0, StreamArray_1.streamArray)(),
|
|
610
|
+
(0, Batch_1.batch)({
|
|
611
|
+
batchSize: 1000,
|
|
612
|
+
}),
|
|
613
|
+
processor,
|
|
614
|
+
])
|
|
578
615
|
.on("data", (data) => {
|
|
579
616
|
if (data && Array.isArray(data)) {
|
|
580
617
|
counter = counter + data.length;
|
|
@@ -596,7 +633,9 @@ class EcleciaIndexer extends emitter_1.EclesiaEmitter {
|
|
|
596
633
|
const readPromise = new Promise((resolve, reject) => {
|
|
597
634
|
try {
|
|
598
635
|
const filters = path.split(".");
|
|
599
|
-
const pickers = filters.map(
|
|
636
|
+
const pickers = filters.map(filter => (0, Pick_1.pick)({
|
|
637
|
+
filter,
|
|
638
|
+
}));
|
|
600
639
|
let counter = 0;
|
|
601
640
|
(0, stream_chain_1.chain)([this.readGenesis(), ...pickers, (0, StreamValues_1.streamValues)(), processor])
|
|
602
641
|
.on("data", (_data) => {
|
|
@@ -624,29 +663,38 @@ class EcleciaIndexer extends emitter_1.EclesiaEmitter {
|
|
|
624
663
|
const genesisEntry = key.split("/");
|
|
625
664
|
this.log.verbose("Importing " + key + "...");
|
|
626
665
|
if (genesisEntry[1] == "array") {
|
|
666
|
+
await this.setArrayReader(genesisEntry[2],
|
|
627
667
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
628
|
-
|
|
629
|
-
await this.asyncEmit(key, {
|
|
668
|
+
async (data) => {
|
|
669
|
+
await this.asyncEmit(key, {
|
|
670
|
+
value: data.map((x) => x.value),
|
|
671
|
+
});
|
|
630
672
|
return data;
|
|
631
673
|
});
|
|
632
674
|
}
|
|
633
675
|
else {
|
|
676
|
+
await this.setValueReader(genesisEntry[2],
|
|
634
677
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
635
|
-
|
|
636
|
-
await this.asyncEmit(key, {
|
|
678
|
+
async (data) => {
|
|
679
|
+
await this.asyncEmit(key, {
|
|
680
|
+
value: data.value,
|
|
681
|
+
});
|
|
637
682
|
return data;
|
|
638
683
|
});
|
|
639
684
|
}
|
|
640
685
|
}
|
|
641
686
|
}
|
|
642
687
|
this.log.info("Importing gen TXs...");
|
|
688
|
+
await this.setArrayReader("app_state.genutil.gen_txs",
|
|
643
689
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
644
|
-
|
|
690
|
+
async (data) => {
|
|
645
691
|
for (let j = 0; j < data.length; j++) {
|
|
646
692
|
const gentx = data[j].value;
|
|
647
693
|
for (let i = 0; i < gentx.body.messages.length; i++) {
|
|
648
694
|
const msg = gentx.body.messages[i];
|
|
649
|
-
await this.asyncEmit(("gentx" + msg["@type"]), {
|
|
695
|
+
await this.asyncEmit(("gentx" + msg["@type"]), {
|
|
696
|
+
value: msg,
|
|
697
|
+
});
|
|
650
698
|
}
|
|
651
699
|
}
|
|
652
700
|
return data;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/promise-queue/index.ts"],"names":[],"mappings":"AAOA,qBAAa,YAAY,CAAC,CAAC;IACzB,OAAO,CAAC,KAAK,CAAoB;IAEjC,OAAO,CAAC,QAAQ,CAAqC;IAErD,OAAO,CAAC,OAAO,CAA0B;IAElC,MAAM,UAAS;IAEtB,OAAO,CAAC,SAAS,CAAS;IAE1B,OAAO,CAAC,eAAe,CAAmB;gBAE9B,SAAS,EAAE,MAAM;IAY7B,OAAO,CAAC,IAAI,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/promise-queue/index.ts"],"names":[],"mappings":"AAOA,qBAAa,YAAY,CAAC,CAAC;IACzB,OAAO,CAAC,KAAK,CAAoB;IAEjC,OAAO,CAAC,QAAQ,CAAqC;IAErD,OAAO,CAAC,OAAO,CAA0B;IAElC,MAAM,UAAS;IAEtB,OAAO,CAAC,SAAS,CAAS;IAE1B,OAAO,CAAC,eAAe,CAAmB;gBAE9B,SAAS,EAAE,MAAM;IAY7B,OAAO,CAAC,IAAI,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC;IAkBhC,KAAK;IAWL,OAAO,IAMU,OAAO,CAAC,CAAC,CAAC;IAG3B,QAAQ;IAIR,SAAS;IAIT,OAAO;IASP,IAAI;CAGL;AAED,qBAAa,cAAc,CAAC,CAAC;IAC3B,OAAO,CAAC,KAAK,CAAoB;IAEjC,OAAO,CAAC,QAAQ,CAAqC;IAErD,OAAO,CAAC,KAAK,CAAa;IAE1B,OAAO,CAAC,IAAI,CAAa;IAEzB,OAAO,CAAC,OAAO,CAA0B;IAElC,MAAM,UAAS;IAEtB,OAAO,CAAC,SAAS,CAAS;IAE1B,OAAO,CAAC,eAAe,CAAmB;IAE1C,OAAO,CAAC,SAAS,CAAa;gBAElB,SAAS,EAAE,MAAM;IAsB7B,OAAO,CAAC,IAAI,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC;IAwBhC,OAAO;IAaP,KAAK;IAoBL,QAAQ;IAIR,SAAS;IAIT,OAAO;IASP,IAAI;CAGL"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*/
|
|
3
|
+
*This implements an "infinite" FIFO queue of fixed size.
|
|
4
|
+
*await `continue()` before enqueing items to ensure fixed size (as it only resolves when space available)
|
|
5
|
+
*await `dequeue()` to pop an item as it will only resolve if the next item is available
|
|
6
|
+
*size() is always at minimum 1 item which is the promise that will resolve to the next item whenever it is enqueued
|
|
7
|
+
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.CircularBuffer = exports.PromiseQueue = void 0;
|
|
10
10
|
class PromiseQueue {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"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"}
|
package/dist/utils/bech32.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare function toHexString(byteArray: number[]): string;
|
|
2
2
|
declare function keyHashfromAddress(address: string): string;
|
|
3
3
|
declare function chainAddressfromKeyhash(prefix: string, keyhash: string): string;
|
|
4
|
-
export { chainAddressfromKeyhash, keyHashfromAddress, toHexString };
|
|
4
|
+
export { chainAddressfromKeyhash, keyHashfromAddress, toHexString, };
|
|
5
5
|
//# sourceMappingURL=bech32.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bech32.d.ts","sourceRoot":"","sources":["../../src/utils/bech32.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bech32.d.ts","sourceRoot":"","sources":["../../src/utils/bech32.ts"],"names":[],"mappings":"AAIA,iBAAS,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,UAQvC;AACD,iBAAS,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAOnD;AACD,iBAAS,uBAAuB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,UAU/D;AAED,OAAO,EACL,uBAAuB,EAAE,kBAAkB,EAAE,WAAW,GACzD,CAAC"}
|
package/dist/utils/bech32.js
CHANGED
|
@@ -21,5 +21,7 @@ function keyHashfromAddress(address) {
|
|
|
21
21
|
}
|
|
22
22
|
function chainAddressfromKeyhash(prefix, keyhash) {
|
|
23
23
|
const words = bech32_1.bech32.toWords(Buffer.from(keyhash, "hex"));
|
|
24
|
-
return keyhash !== ""
|
|
24
|
+
return keyhash !== ""
|
|
25
|
+
? bech32_1.bech32.encode(prefix, words)
|
|
26
|
+
: "";
|
|
25
27
|
}
|
package/dist/utils/bigint.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bigint.d.ts","sourceRoot":"","sources":["../../src/utils/bigint.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,aAAa,GAAI,KAAK,OAAO,
|
|
1
|
+
{"version":3,"file":"bigint.d.ts","sourceRoot":"","sources":["../../src/utils/bigint.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,aAAa,GAAI,KAAK,OAAO,QAIlC,CAAC;AACF,OAAO,EACL,aAAa,GACd,CAAC"}
|
package/dist/utils/bigint.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.toPlainObject = void 0;
|
|
4
4
|
const toPlainObject = (obj) => {
|
|
5
|
-
return JSON.parse(JSON.stringify(obj, (key, value) => typeof value === "bigint" ? value.toString() : value
|
|
6
|
-
));
|
|
5
|
+
return JSON.parse(JSON.stringify(obj, (key, value) => (typeof value === "bigint" ? value.toString() : value)));
|
|
7
6
|
};
|
|
8
7
|
exports.toPlainObject = toPlainObject;
|
package/dist/utils/text.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../src/utils/text.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,GAAI,GAAG,UAAU,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../src/utils/text.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,GAAI,GAAG,UAAU,GAAG,MAAM,WAUhD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eclesia/indexer-engine",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.1",
|
|
4
4
|
"description": "Core eclesia indexer engine",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"license": "Apache-2.0",
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@eslint/js": "^9.24.0",
|
|
25
|
-
"@stylistic/eslint-plugin
|
|
25
|
+
"@stylistic/eslint-plugin": "^5.3.1",
|
|
26
26
|
"@types/node": "^22.14.0",
|
|
27
27
|
"@types/stream-chain": "^2.1.0",
|
|
28
28
|
"@types/stream-json": "^1.7.8",
|