@aztec/aztec-node 0.0.1-commit.6d3c34e → 0.0.1-commit.7cf39cb55
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/dest/aztec-node/node_metrics.d.ts +1 -1
- package/dest/aztec-node/node_metrics.d.ts.map +1 -1
- package/dest/aztec-node/node_metrics.js +8 -4
- package/dest/aztec-node/server.d.ts +25 -92
- package/dest/aztec-node/server.d.ts.map +1 -1
- package/dest/aztec-node/server.js +151 -159
- package/dest/sentinel/factory.d.ts +1 -1
- package/dest/sentinel/factory.d.ts.map +1 -1
- package/dest/sentinel/factory.js +1 -1
- package/dest/sentinel/sentinel.d.ts +2 -2
- package/dest/sentinel/sentinel.d.ts.map +1 -1
- package/dest/sentinel/sentinel.js +39 -20
- package/dest/sentinel/store.d.ts +2 -2
- package/dest/sentinel/store.d.ts.map +1 -1
- package/dest/sentinel/store.js +11 -7
- package/package.json +26 -25
- package/src/aztec-node/node_metrics.ts +12 -5
- package/src/aztec-node/server.ts +193 -221
- package/src/sentinel/factory.ts +1 -6
- package/src/sentinel/sentinel.ts +42 -18
- package/src/sentinel/store.ts +12 -12
|
@@ -8,6 +8,15 @@ import { OffenseType, WANT_TO_SLASH_EVENT } from '@aztec/slasher';
|
|
|
8
8
|
import { L2BlockStream, getAttestationInfoFromPublishedCheckpoint } from '@aztec/stdlib/block';
|
|
9
9
|
import { getEpochAtSlot, getSlotRangeForEpoch, getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
|
|
10
10
|
import EventEmitter from 'node:events';
|
|
11
|
+
/** Maps a validator status to its category: proposer or attestation. */ function statusToCategory(status) {
|
|
12
|
+
switch(status){
|
|
13
|
+
case 'attestation-sent':
|
|
14
|
+
case 'attestation-missed':
|
|
15
|
+
return 'attestation';
|
|
16
|
+
default:
|
|
17
|
+
return 'proposer';
|
|
18
|
+
}
|
|
19
|
+
}
|
|
11
20
|
export class Sentinel extends EventEmitter {
|
|
12
21
|
epochCache;
|
|
13
22
|
archiver;
|
|
@@ -82,7 +91,7 @@ export class Sentinel extends EventEmitter {
|
|
|
82
91
|
return;
|
|
83
92
|
}
|
|
84
93
|
const blockNumber = event.block.number;
|
|
85
|
-
const block = await this.archiver.
|
|
94
|
+
const block = await this.archiver.getL2Block(blockNumber);
|
|
86
95
|
if (!block) {
|
|
87
96
|
this.logger.error(`Failed to get block ${blockNumber}`, {
|
|
88
97
|
block
|
|
@@ -263,17 +272,17 @@ export class Sentinel extends EventEmitter {
|
|
|
263
272
|
committee
|
|
264
273
|
});
|
|
265
274
|
// Check if there is an L2 block in L1 for this L2 slot
|
|
266
|
-
// Here we get all attestations for the
|
|
267
|
-
// or all attestations for all proposals in the slot if no
|
|
275
|
+
// Here we get all checkpoint attestations for the checkpoint at the given slot,
|
|
276
|
+
// or all checkpoint attestations for all proposals in the slot if no checkpoint was mined.
|
|
268
277
|
// We gather from both p2p (contains the ones seen on the p2p layer) and archiver
|
|
269
|
-
// (contains the ones synced from mined
|
|
270
|
-
const
|
|
271
|
-
const p2pAttested = await this.p2p.getCheckpointAttestationsForSlot(slot,
|
|
278
|
+
// (contains the ones synced from mined checkpoints, which we may have missed from p2p).
|
|
279
|
+
const checkpoint = this.slotNumberToCheckpoint.get(slot);
|
|
280
|
+
const p2pAttested = await this.p2p.getCheckpointAttestationsForSlot(slot, checkpoint?.archive);
|
|
272
281
|
// Filter out attestations with invalid signatures
|
|
273
282
|
const p2pAttestors = p2pAttested.map((a)=>a.getSender()).filter((s)=>s !== undefined);
|
|
274
283
|
const attestors = new Set([
|
|
275
284
|
...p2pAttestors.map((a)=>a.toString()),
|
|
276
|
-
...
|
|
285
|
+
...checkpoint?.attestors.map((a)=>a.toString()) ?? []
|
|
277
286
|
].filter((addr)=>proposer.toString() !== addr));
|
|
278
287
|
// We assume that there was a block proposal if at least one of the validators (other than the proposer) attested to it.
|
|
279
288
|
// It could be the case that every single validator failed, and we could differentiate it by having
|
|
@@ -281,17 +290,26 @@ export class Sentinel extends EventEmitter {
|
|
|
281
290
|
// But we'll leave that corner case out to reduce pressure on the node.
|
|
282
291
|
// TODO(palla/slash): This breaks if a given node has more than one validator in the current committee,
|
|
283
292
|
// since they will attest to their own proposal it even if it's not re-executable.
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
293
|
+
let status;
|
|
294
|
+
if (checkpoint) {
|
|
295
|
+
status = 'checkpoint-mined';
|
|
296
|
+
} else if (attestors.size > 0) {
|
|
297
|
+
status = 'checkpoint-proposed';
|
|
298
|
+
} else {
|
|
299
|
+
// No checkpoint on L1 and no checkpoint attestations seen. Check if block proposals were sent for this slot.
|
|
300
|
+
const hasBlockProposals = await this.p2p.hasBlockProposalsForSlot(slot);
|
|
301
|
+
status = hasBlockProposals ? 'checkpoint-missed' : 'blocks-missed';
|
|
302
|
+
}
|
|
303
|
+
this.logger.debug(`Checkpoint status for slot ${slot}: ${status}`, {
|
|
304
|
+
...checkpoint,
|
|
287
305
|
slot
|
|
288
306
|
});
|
|
289
|
-
// Get attestors that failed their
|
|
290
|
-
const missedAttestors = new Set(
|
|
307
|
+
// Get attestors that failed their checkpoint attestation duties, but only if there was a checkpoint proposed or mined
|
|
308
|
+
const missedAttestors = new Set(status === 'blocks-missed' || status === 'checkpoint-missed' ? [] : committee.filter((v)=>!attestors.has(v.toString()) && !proposer.equals(v)).map((v)=>v.toString()));
|
|
291
309
|
this.logger.debug(`Retrieved ${attestors.size} attestors out of ${committee.length} for slot ${slot}`, {
|
|
292
|
-
|
|
310
|
+
status,
|
|
293
311
|
proposer: proposer.toString(),
|
|
294
|
-
...
|
|
312
|
+
...checkpoint,
|
|
295
313
|
slot,
|
|
296
314
|
attestors: [
|
|
297
315
|
...attestors
|
|
@@ -304,7 +322,7 @@ export class Sentinel extends EventEmitter {
|
|
|
304
322
|
// Compute the status for each validator in the committee
|
|
305
323
|
const statusFor = (who)=>{
|
|
306
324
|
if (who === proposer.toString()) {
|
|
307
|
-
return
|
|
325
|
+
return status;
|
|
308
326
|
} else if (attestors.has(who)) {
|
|
309
327
|
return 'attestation-sent';
|
|
310
328
|
} else if (missedAttestors.has(who)) {
|
|
@@ -361,15 +379,16 @@ export class Sentinel extends EventEmitter {
|
|
|
361
379
|
computeStatsForValidator(address, allHistory, fromSlot, toSlot) {
|
|
362
380
|
let history = fromSlot ? allHistory.filter((h)=>BigInt(h.slot) >= fromSlot) : allHistory;
|
|
363
381
|
history = toSlot ? history.filter((h)=>BigInt(h.slot) <= toSlot) : history;
|
|
364
|
-
const lastProposal = history.filter((h)=>h.status === '
|
|
382
|
+
const lastProposal = history.filter((h)=>h.status === 'checkpoint-proposed' || h.status === 'checkpoint-mined').at(-1);
|
|
365
383
|
const lastAttestation = history.filter((h)=>h.status === 'attestation-sent').at(-1);
|
|
366
384
|
return {
|
|
367
385
|
address: EthAddress.fromString(address),
|
|
368
386
|
lastProposal: this.computeFromSlot(lastProposal?.slot),
|
|
369
387
|
lastAttestation: this.computeFromSlot(lastAttestation?.slot),
|
|
370
388
|
totalSlots: history.length,
|
|
371
|
-
missedProposals: this.computeMissed(history, '
|
|
372
|
-
'
|
|
389
|
+
missedProposals: this.computeMissed(history, 'proposer', [
|
|
390
|
+
'checkpoint-missed',
|
|
391
|
+
'blocks-missed'
|
|
373
392
|
]),
|
|
374
393
|
missedAttestations: this.computeMissed(history, 'attestation', [
|
|
375
394
|
'attestation-missed'
|
|
@@ -377,8 +396,8 @@ export class Sentinel extends EventEmitter {
|
|
|
377
396
|
history
|
|
378
397
|
};
|
|
379
398
|
}
|
|
380
|
-
computeMissed(history,
|
|
381
|
-
const relevantHistory = history.filter((h)=>!
|
|
399
|
+
computeMissed(history, computeOverCategory, filter) {
|
|
400
|
+
const relevantHistory = history.filter((h)=>!computeOverCategory || statusToCategory(h.status) === computeOverCategory);
|
|
382
401
|
const filteredHistory = relevantHistory.filter((h)=>filter.includes(h.status));
|
|
383
402
|
return {
|
|
384
403
|
currentStreak: countWhile([
|
package/dest/sentinel/store.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { ValidatorStatusHistory, ValidatorStatusInSlot, ValidatorsEpochPerf
|
|
|
5
5
|
export declare class SentinelStore {
|
|
6
6
|
private store;
|
|
7
7
|
private config;
|
|
8
|
-
static readonly SCHEMA_VERSION
|
|
8
|
+
static readonly SCHEMA_VERSION = 3;
|
|
9
9
|
private readonly historyMap;
|
|
10
10
|
private readonly provenMap;
|
|
11
11
|
constructor(store: AztecAsyncKVStore, config: {
|
|
@@ -32,4 +32,4 @@ export declare class SentinelStore {
|
|
|
32
32
|
private statusToNumber;
|
|
33
33
|
private statusFromNumber;
|
|
34
34
|
}
|
|
35
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
35
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RvcmUuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zZW50aW5lbC9zdG9yZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsV0FBVyxFQUFFLFVBQVUsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQzFFLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSwrQkFBK0IsQ0FBQztBQUUzRCxPQUFPLEtBQUssRUFBRSxpQkFBaUIsRUFBaUIsTUFBTSxpQkFBaUIsQ0FBQztBQUN4RSxPQUFPLEtBQUssRUFDVixzQkFBc0IsRUFDdEIscUJBQXFCLEVBQ3JCLDBCQUEwQixFQUMzQixNQUFNLDBCQUEwQixDQUFDO0FBRWxDLHFCQUFhLGFBQWE7SUFXdEIsT0FBTyxDQUFDLEtBQUs7SUFDYixPQUFPLENBQUMsTUFBTTtJQVhoQixnQkFBdUIsY0FBYyxLQUFLO0lBRzFDLE9BQU8sQ0FBQyxRQUFRLENBQUMsVUFBVSxDQUF1QztJQUlsRSxPQUFPLENBQUMsUUFBUSxDQUFDLFNBQVMsQ0FBdUM7SUFFakUsWUFDVSxLQUFLLEVBQUUsaUJBQWlCLEVBQ3hCLE1BQU0sRUFBRTtRQUFFLGFBQWEsRUFBRSxNQUFNLENBQUM7UUFBQywrQkFBK0IsRUFBRSxNQUFNLENBQUE7S0FBRSxFQUluRjtJQUVNLGdCQUFnQixXQUV0QjtJQUVNLGtDQUFrQyxXQUV4QztJQUVZLHVCQUF1QixDQUFDLEtBQUssRUFBRSxXQUFXLEVBQUUsV0FBVyxFQUFFLDBCQUEwQixpQkFNL0Y7SUFFWSxvQkFBb0IsQ0FBQyxHQUFHLEVBQUUsVUFBVSxHQUFHLE9BQU8sQ0FBQztRQUFFLE1BQU0sRUFBRSxNQUFNLENBQUM7UUFBQyxLQUFLLEVBQUUsTUFBTSxDQUFDO1FBQUMsS0FBSyxFQUFFLFdBQVcsQ0FBQTtLQUFFLEVBQUUsQ0FBQyxDQUduSDtZQUVhLHNDQUFzQztJQTZCdkMsZ0JBQWdCLENBQUMsSUFBSSxFQUFFLFVBQVUsRUFBRSxRQUFRLEVBQUUsTUFBTSxDQUFDLEtBQUssTUFBTSxFQUFFLEVBQUUscUJBQXFCLEdBQUcsU0FBUyxDQUFDLGlCQVFqSDtZQUVhLDBCQUEwQjtJQVEzQixZQUFZLElBQUksT0FBTyxDQUFDLE1BQU0sQ0FBQyxLQUFLLE1BQU0sRUFBRSxFQUFFLHNCQUFzQixDQUFDLENBQUMsQ0FNbEY7SUFFWSxVQUFVLENBQUMsT0FBTyxFQUFFLFVBQVUsR0FBRyxPQUFPLENBQUMsc0JBQXNCLEdBQUcsU0FBUyxDQUFDLENBR3hGO0lBRUQsT0FBTyxDQUFDLG9CQUFvQjtJQU01QixPQUFPLENBQUMsc0JBQXNCO0lBYTlCLE9BQU8sQ0FBQyxnQkFBZ0I7SUFNeEIsT0FBTyxDQUFDLGtCQUFrQjtJQVcxQixPQUFPLENBQUMsY0FBYztJQXFCdEIsT0FBTyxDQUFDLGdCQUFnQjtDQWtCekIifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/sentinel/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EACV,sBAAsB,EACtB,qBAAqB,EACrB,0BAA0B,EAC3B,MAAM,0BAA0B,CAAC;AAElC,qBAAa,aAAa;IAWtB,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,MAAM;IAXhB,gBAAuB,cAAc,
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/sentinel/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EACV,sBAAsB,EACtB,qBAAqB,EACrB,0BAA0B,EAC3B,MAAM,0BAA0B,CAAC;AAElC,qBAAa,aAAa;IAWtB,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,MAAM;IAXhB,gBAAuB,cAAc,KAAK;IAG1C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAuC;IAIlE,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAuC;IAEjE,YACU,KAAK,EAAE,iBAAiB,EACxB,MAAM,EAAE;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,+BAA+B,EAAE,MAAM,CAAA;KAAE,EAInF;IAEM,gBAAgB,WAEtB;IAEM,kCAAkC,WAExC;IAEY,uBAAuB,CAAC,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,0BAA0B,iBAM/F;IAEY,oBAAoB,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,WAAW,CAAA;KAAE,EAAE,CAAC,CAGnH;YAEa,sCAAsC;IA6BvC,gBAAgB,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,CAAC,KAAK,MAAM,EAAE,EAAE,qBAAqB,GAAG,SAAS,CAAC,iBAQjH;YAEa,0BAA0B;IAQ3B,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,MAAM,EAAE,EAAE,sBAAsB,CAAC,CAAC,CAMlF;IAEY,UAAU,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,sBAAsB,GAAG,SAAS,CAAC,CAGxF;IAED,OAAO,CAAC,oBAAoB;IAM5B,OAAO,CAAC,sBAAsB;IAa9B,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,kBAAkB;IAW1B,OAAO,CAAC,cAAc;IAqBtB,OAAO,CAAC,gBAAgB;CAkBzB"}
|
package/dest/sentinel/store.js
CHANGED
|
@@ -4,7 +4,7 @@ import { BufferReader, numToUInt8, numToUInt32BE, serializeToBuffer } from '@azt
|
|
|
4
4
|
export class SentinelStore {
|
|
5
5
|
store;
|
|
6
6
|
config;
|
|
7
|
-
static SCHEMA_VERSION =
|
|
7
|
+
static SCHEMA_VERSION = 3;
|
|
8
8
|
// a map from validator address to their ValidatorStatusHistory
|
|
9
9
|
historyMap;
|
|
10
10
|
// a map from validator address to their historical proven epoch performance
|
|
@@ -134,16 +134,18 @@ export class SentinelStore {
|
|
|
134
134
|
}
|
|
135
135
|
statusToNumber(status) {
|
|
136
136
|
switch(status){
|
|
137
|
-
case '
|
|
137
|
+
case 'checkpoint-mined':
|
|
138
138
|
return 1;
|
|
139
|
-
case '
|
|
139
|
+
case 'checkpoint-proposed':
|
|
140
140
|
return 2;
|
|
141
|
-
case '
|
|
141
|
+
case 'checkpoint-missed':
|
|
142
142
|
return 3;
|
|
143
143
|
case 'attestation-sent':
|
|
144
144
|
return 4;
|
|
145
145
|
case 'attestation-missed':
|
|
146
146
|
return 5;
|
|
147
|
+
case 'blocks-missed':
|
|
148
|
+
return 6;
|
|
147
149
|
default:
|
|
148
150
|
{
|
|
149
151
|
const _exhaustive = status;
|
|
@@ -154,15 +156,17 @@ export class SentinelStore {
|
|
|
154
156
|
statusFromNumber(status) {
|
|
155
157
|
switch(status){
|
|
156
158
|
case 1:
|
|
157
|
-
return '
|
|
159
|
+
return 'checkpoint-mined';
|
|
158
160
|
case 2:
|
|
159
|
-
return '
|
|
161
|
+
return 'checkpoint-proposed';
|
|
160
162
|
case 3:
|
|
161
|
-
return '
|
|
163
|
+
return 'checkpoint-missed';
|
|
162
164
|
case 4:
|
|
163
165
|
return 'attestation-sent';
|
|
164
166
|
case 5:
|
|
165
167
|
return 'attestation-missed';
|
|
168
|
+
case 6:
|
|
169
|
+
return 'blocks-missed';
|
|
166
170
|
default:
|
|
167
171
|
throw new Error(`Unknown status: ${status}`);
|
|
168
172
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/aztec-node",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.7cf39cb55",
|
|
4
4
|
"main": "dest/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -65,29 +65,30 @@
|
|
|
65
65
|
]
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@aztec/archiver": "0.0.1-commit.
|
|
69
|
-
"@aztec/bb-prover": "0.0.1-commit.
|
|
70
|
-
"@aztec/blob-client": "0.0.1-commit.
|
|
71
|
-
"@aztec/constants": "0.0.1-commit.
|
|
72
|
-
"@aztec/epoch-cache": "0.0.1-commit.
|
|
73
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
74
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
75
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
76
|
-
"@aztec/l1-artifacts": "0.0.1-commit.
|
|
77
|
-
"@aztec/merkle-tree": "0.0.1-commit.
|
|
78
|
-
"@aztec/node-keystore": "0.0.1-commit.
|
|
79
|
-
"@aztec/node-lib": "0.0.1-commit.
|
|
80
|
-
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.
|
|
81
|
-
"@aztec/p2p": "0.0.1-commit.
|
|
82
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
83
|
-
"@aztec/prover-client": "0.0.1-commit.
|
|
84
|
-
"@aztec/sequencer-client": "0.0.1-commit.
|
|
85
|
-
"@aztec/simulator": "0.0.1-commit.
|
|
86
|
-
"@aztec/slasher": "0.0.1-commit.
|
|
87
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
88
|
-
"@aztec/telemetry-client": "0.0.1-commit.
|
|
89
|
-
"@aztec/validator-client": "0.0.1-commit.
|
|
90
|
-
"@aztec/
|
|
68
|
+
"@aztec/archiver": "0.0.1-commit.7cf39cb55",
|
|
69
|
+
"@aztec/bb-prover": "0.0.1-commit.7cf39cb55",
|
|
70
|
+
"@aztec/blob-client": "0.0.1-commit.7cf39cb55",
|
|
71
|
+
"@aztec/constants": "0.0.1-commit.7cf39cb55",
|
|
72
|
+
"@aztec/epoch-cache": "0.0.1-commit.7cf39cb55",
|
|
73
|
+
"@aztec/ethereum": "0.0.1-commit.7cf39cb55",
|
|
74
|
+
"@aztec/foundation": "0.0.1-commit.7cf39cb55",
|
|
75
|
+
"@aztec/kv-store": "0.0.1-commit.7cf39cb55",
|
|
76
|
+
"@aztec/l1-artifacts": "0.0.1-commit.7cf39cb55",
|
|
77
|
+
"@aztec/merkle-tree": "0.0.1-commit.7cf39cb55",
|
|
78
|
+
"@aztec/node-keystore": "0.0.1-commit.7cf39cb55",
|
|
79
|
+
"@aztec/node-lib": "0.0.1-commit.7cf39cb55",
|
|
80
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.7cf39cb55",
|
|
81
|
+
"@aztec/p2p": "0.0.1-commit.7cf39cb55",
|
|
82
|
+
"@aztec/protocol-contracts": "0.0.1-commit.7cf39cb55",
|
|
83
|
+
"@aztec/prover-client": "0.0.1-commit.7cf39cb55",
|
|
84
|
+
"@aztec/sequencer-client": "0.0.1-commit.7cf39cb55",
|
|
85
|
+
"@aztec/simulator": "0.0.1-commit.7cf39cb55",
|
|
86
|
+
"@aztec/slasher": "0.0.1-commit.7cf39cb55",
|
|
87
|
+
"@aztec/stdlib": "0.0.1-commit.7cf39cb55",
|
|
88
|
+
"@aztec/telemetry-client": "0.0.1-commit.7cf39cb55",
|
|
89
|
+
"@aztec/validator-client": "0.0.1-commit.7cf39cb55",
|
|
90
|
+
"@aztec/validator-ha-signer": "0.0.1-commit.7cf39cb55",
|
|
91
|
+
"@aztec/world-state": "0.0.1-commit.7cf39cb55",
|
|
91
92
|
"koa": "^2.16.1",
|
|
92
93
|
"koa-router": "^13.1.1",
|
|
93
94
|
"tslib": "^2.4.0",
|
|
@@ -97,7 +98,7 @@
|
|
|
97
98
|
"@jest/globals": "^30.0.0",
|
|
98
99
|
"@types/jest": "^30.0.0",
|
|
99
100
|
"@types/node": "^22.15.17",
|
|
100
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
101
|
+
"@typescript/native-preview": "7.0.0-dev.20260113.1",
|
|
101
102
|
"jest": "^30.0.0",
|
|
102
103
|
"jest-mock-extended": "^4.0.0",
|
|
103
104
|
"ts-node": "^10.9.1",
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Attributes,
|
|
3
|
+
type Histogram,
|
|
4
|
+
Metrics,
|
|
5
|
+
type TelemetryClient,
|
|
6
|
+
type UpDownCounter,
|
|
7
|
+
createUpDownCounterWithDefault,
|
|
8
|
+
} from '@aztec/telemetry-client';
|
|
2
9
|
|
|
3
10
|
export class NodeMetrics {
|
|
4
11
|
private receiveTxCount: UpDownCounter;
|
|
@@ -9,14 +16,14 @@ export class NodeMetrics {
|
|
|
9
16
|
|
|
10
17
|
constructor(client: TelemetryClient, name = 'AztecNode') {
|
|
11
18
|
const meter = client.getMeter(name);
|
|
12
|
-
this.receiveTxCount = meter
|
|
19
|
+
this.receiveTxCount = createUpDownCounterWithDefault(meter, Metrics.NODE_RECEIVE_TX_COUNT, {
|
|
20
|
+
[Attributes.OK]: [true, false],
|
|
21
|
+
});
|
|
13
22
|
this.receiveTxDuration = meter.createHistogram(Metrics.NODE_RECEIVE_TX_DURATION);
|
|
14
23
|
|
|
15
24
|
this.snapshotDuration = meter.createHistogram(Metrics.NODE_SNAPSHOT_DURATION);
|
|
16
25
|
|
|
17
|
-
this.snapshotErrorCount = meter
|
|
18
|
-
|
|
19
|
-
this.snapshotErrorCount.add(0);
|
|
26
|
+
this.snapshotErrorCount = createUpDownCounterWithDefault(meter, Metrics.NODE_SNAPSHOT_ERROR_COUNT);
|
|
20
27
|
}
|
|
21
28
|
|
|
22
29
|
receivedTx(durationMs: number, isAccepted: boolean) {
|