@aztec/validator-client 0.0.1-commit.64b6bbb → 0.0.1-commit.69c59a8b3
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/README.md +41 -2
- package/dest/checkpoint_builder.d.ts +21 -8
- package/dest/checkpoint_builder.d.ts.map +1 -1
- package/dest/checkpoint_builder.js +124 -46
- package/dest/config.d.ts +1 -1
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +22 -6
- package/dest/duties/validation_service.d.ts +7 -9
- package/dest/duties/validation_service.d.ts.map +1 -1
- package/dest/duties/validation_service.js +15 -33
- package/dest/factory.d.ts +7 -4
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +6 -5
- package/dest/index.d.ts +2 -3
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -2
- package/dest/key_store/ha_key_store.js +1 -1
- package/dest/metrics.d.ts +14 -2
- package/dest/metrics.d.ts.map +1 -1
- package/dest/metrics.js +24 -0
- package/dest/proposal_handler.d.ts +108 -0
- package/dest/proposal_handler.d.ts.map +1 -0
- package/dest/proposal_handler.js +974 -0
- package/dest/validator.d.ts +23 -20
- package/dest/validator.d.ts.map +1 -1
- package/dest/validator.js +95 -202
- package/package.json +19 -19
- package/src/checkpoint_builder.ts +142 -39
- package/src/config.ts +22 -6
- package/src/duties/validation_service.ts +25 -37
- package/src/factory.ts +10 -3
- package/src/index.ts +1 -2
- package/src/key_store/ha_key_store.ts +1 -1
- package/src/metrics.ts +37 -1
- package/src/proposal_handler.ts +1042 -0
- package/src/validator.ts +129 -224
- package/dest/block_proposal_handler.d.ts +0 -63
- package/dest/block_proposal_handler.d.ts.map +0 -1
- package/dest/block_proposal_handler.js +0 -546
- package/dest/tx_validator/index.d.ts +0 -3
- package/dest/tx_validator/index.d.ts.map +0 -1
- package/dest/tx_validator/index.js +0 -2
- package/dest/tx_validator/nullifier_cache.d.ts +0 -14
- package/dest/tx_validator/nullifier_cache.d.ts.map +0 -1
- package/dest/tx_validator/nullifier_cache.js +0 -24
- package/dest/tx_validator/tx_validator_factory.d.ts +0 -19
- package/dest/tx_validator/tx_validator_factory.d.ts.map +0 -1
- package/dest/tx_validator/tx_validator_factory.js +0 -54
- package/src/block_proposal_handler.ts +0 -555
- package/src/tx_validator/index.ts +0 -2
- package/src/tx_validator/nullifier_cache.ts +0 -30
- package/src/tx_validator/tx_validator_factory.ts +0 -154
package/src/metrics.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { EpochNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
1
3
|
import type { BlockProposal } from '@aztec/stdlib/p2p';
|
|
2
4
|
import {
|
|
3
5
|
Attributes,
|
|
@@ -9,17 +11,21 @@ import {
|
|
|
9
11
|
createUpDownCounterWithDefault,
|
|
10
12
|
} from '@aztec/telemetry-client';
|
|
11
13
|
|
|
12
|
-
import type { BlockProposalValidationFailureReason } from './
|
|
14
|
+
import type { BlockProposalValidationFailureReason } from './proposal_handler.js';
|
|
13
15
|
|
|
14
16
|
export class ValidatorMetrics {
|
|
15
17
|
private failedReexecutionCounter: UpDownCounter;
|
|
16
18
|
private successfulAttestationsCount: UpDownCounter;
|
|
17
19
|
private failedAttestationsBadProposalCount: UpDownCounter;
|
|
18
20
|
private failedAttestationsNodeIssueCount: UpDownCounter;
|
|
21
|
+
private currentEpoch: Gauge;
|
|
22
|
+
private attestedEpochCount: UpDownCounter;
|
|
19
23
|
|
|
20
24
|
private reexMana: Histogram;
|
|
21
25
|
private reexTx: Histogram;
|
|
22
26
|
private reexDuration: Gauge;
|
|
27
|
+
private checkpointProposalToPipelinedStateDuration: Histogram;
|
|
28
|
+
private checkpointProposalReceiveOffsetFromNextSlotBoundary: Histogram;
|
|
23
29
|
|
|
24
30
|
constructor(telemetryClient: TelemetryClient) {
|
|
25
31
|
const meter = telemetryClient.getMeter('Validator');
|
|
@@ -64,11 +70,21 @@ export class ValidatorMetrics {
|
|
|
64
70
|
},
|
|
65
71
|
);
|
|
66
72
|
|
|
73
|
+
this.currentEpoch = meter.createGauge(Metrics.VALIDATOR_CURRENT_EPOCH);
|
|
74
|
+
|
|
75
|
+
this.attestedEpochCount = createUpDownCounterWithDefault(meter, Metrics.VALIDATOR_ATTESTED_EPOCH_COUNT);
|
|
76
|
+
|
|
67
77
|
this.reexMana = meter.createHistogram(Metrics.VALIDATOR_RE_EXECUTION_MANA);
|
|
68
78
|
|
|
69
79
|
this.reexTx = meter.createHistogram(Metrics.VALIDATOR_RE_EXECUTION_TX_COUNT);
|
|
70
80
|
|
|
71
81
|
this.reexDuration = meter.createGauge(Metrics.VALIDATOR_RE_EXECUTION_TIME);
|
|
82
|
+
this.checkpointProposalToPipelinedStateDuration = meter.createHistogram(
|
|
83
|
+
Metrics.VALIDATOR_CHECKPOINT_PROPOSAL_TO_PIPELINED_STATE_DURATION,
|
|
84
|
+
);
|
|
85
|
+
this.checkpointProposalReceiveOffsetFromNextSlotBoundary = meter.createHistogram(
|
|
86
|
+
Metrics.VALIDATOR_CHECKPOINT_PROPOSAL_RECEIVE_OFFSET_FROM_NEXT_SLOT_BOUNDARY,
|
|
87
|
+
);
|
|
72
88
|
}
|
|
73
89
|
|
|
74
90
|
public recordReex(time: number, txs: number, mManaTotal: number) {
|
|
@@ -77,6 +93,16 @@ export class ValidatorMetrics {
|
|
|
77
93
|
this.reexMana.record(mManaTotal);
|
|
78
94
|
}
|
|
79
95
|
|
|
96
|
+
public recordCheckpointProposalToPipelinedStateDuration(durationMs: number) {
|
|
97
|
+
this.checkpointProposalToPipelinedStateDuration.record(Math.ceil(durationMs));
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
public recordCheckpointProposalReceiveOffsetFromNextSlotBoundary(offsetMs: number) {
|
|
101
|
+
this.checkpointProposalReceiveOffsetFromNextSlotBoundary.record(Math.ceil(Math.abs(offsetMs)), {
|
|
102
|
+
[Attributes.SLOT_BOUNDARY_SIDE]: offsetMs < 0 ? 'before' : 'after',
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
|
|
80
106
|
public recordFailedReexecution(proposal: BlockProposal) {
|
|
81
107
|
const proposer = proposal.getSender();
|
|
82
108
|
this.failedReexecutionCounter.add(1, {
|
|
@@ -110,4 +136,14 @@ export class ValidatorMetrics {
|
|
|
110
136
|
[Attributes.IS_COMMITTEE_MEMBER]: inCommittee,
|
|
111
137
|
});
|
|
112
138
|
}
|
|
139
|
+
|
|
140
|
+
/** Update the gauge tracking the current epoch number (proxy for total epochs elapsed). */
|
|
141
|
+
public setCurrentEpoch(epoch: EpochNumber) {
|
|
142
|
+
this.currentEpoch.record(Number(epoch));
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/** Increment the count of epochs in which the given attester submitted at least one attestation. */
|
|
146
|
+
public incAttestedEpochCount(attester: EthAddress) {
|
|
147
|
+
this.attestedEpochCount.add(1, { [Attributes.ATTESTER_ADDRESS]: attester.toString() });
|
|
148
|
+
}
|
|
113
149
|
}
|