@aztec/validator-client 0.0.1-commit.c7c42ec → 0.0.1-commit.c949de6bc
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 +285 -0
- package/dest/block_proposal_handler.d.ts +21 -11
- package/dest/block_proposal_handler.d.ts.map +1 -1
- package/dest/block_proposal_handler.js +327 -85
- package/dest/checkpoint_builder.d.ts +69 -0
- package/dest/checkpoint_builder.d.ts.map +1 -0
- package/dest/checkpoint_builder.js +180 -0
- package/dest/config.d.ts +1 -1
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +16 -8
- package/dest/duties/validation_service.d.ts +41 -12
- package/dest/duties/validation_service.d.ts.map +1 -1
- package/dest/duties/validation_service.js +109 -26
- package/dest/factory.d.ts +13 -10
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +2 -2
- package/dest/index.d.ts +2 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -0
- package/dest/key_store/ha_key_store.d.ts +99 -0
- package/dest/key_store/ha_key_store.d.ts.map +1 -0
- package/dest/key_store/ha_key_store.js +208 -0
- package/dest/key_store/index.d.ts +2 -1
- package/dest/key_store/index.d.ts.map +1 -1
- package/dest/key_store/index.js +1 -0
- package/dest/key_store/interface.d.ts +36 -6
- package/dest/key_store/interface.d.ts.map +1 -1
- package/dest/key_store/local_key_store.d.ts +10 -5
- package/dest/key_store/local_key_store.d.ts.map +1 -1
- package/dest/key_store/local_key_store.js +8 -4
- package/dest/key_store/node_keystore_adapter.d.ts +18 -5
- package/dest/key_store/node_keystore_adapter.d.ts.map +1 -1
- package/dest/key_store/node_keystore_adapter.js +18 -4
- package/dest/key_store/web3signer_key_store.d.ts +10 -5
- package/dest/key_store/web3signer_key_store.d.ts.map +1 -1
- package/dest/key_store/web3signer_key_store.js +8 -4
- package/dest/metrics.d.ts +4 -3
- package/dest/metrics.d.ts.map +1 -1
- package/dest/metrics.js +34 -30
- package/dest/validator.d.ts +73 -24
- package/dest/validator.d.ts.map +1 -1
- package/dest/validator.js +452 -91
- package/package.json +21 -13
- package/src/block_proposal_handler.ts +246 -57
- package/src/checkpoint_builder.ts +328 -0
- package/src/config.ts +15 -7
- package/src/duties/validation_service.ts +160 -31
- package/src/factory.ts +17 -11
- package/src/index.ts +1 -0
- package/src/key_store/ha_key_store.ts +269 -0
- package/src/key_store/index.ts +1 -0
- package/src/key_store/interface.ts +44 -5
- package/src/key_store/local_key_store.ts +13 -4
- package/src/key_store/node_keystore_adapter.ts +27 -4
- package/src/key_store/web3signer_key_store.ts +17 -4
- package/src/metrics.ts +45 -33
- package/src/validator.ts +615 -120
package/src/metrics.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import type { BlockProposal } from '@aztec/stdlib/p2p';
|
|
2
2
|
import {
|
|
3
3
|
Attributes,
|
|
4
|
+
type Gauge,
|
|
4
5
|
type Histogram,
|
|
5
6
|
Metrics,
|
|
6
7
|
type TelemetryClient,
|
|
7
8
|
type UpDownCounter,
|
|
8
|
-
|
|
9
|
+
createUpDownCounterWithDefault,
|
|
9
10
|
} from '@aztec/telemetry-client';
|
|
10
11
|
|
|
12
|
+
import type { BlockProposalValidationFailureReason } from './block_proposal_handler.js';
|
|
13
|
+
|
|
11
14
|
export class ValidatorMetrics {
|
|
12
15
|
private failedReexecutionCounter: UpDownCounter;
|
|
13
16
|
private successfulAttestationsCount: UpDownCounter;
|
|
@@ -16,55 +19,56 @@ export class ValidatorMetrics {
|
|
|
16
19
|
|
|
17
20
|
private reexMana: Histogram;
|
|
18
21
|
private reexTx: Histogram;
|
|
19
|
-
private reexDuration:
|
|
22
|
+
private reexDuration: Gauge;
|
|
20
23
|
|
|
21
24
|
constructor(telemetryClient: TelemetryClient) {
|
|
22
25
|
const meter = telemetryClient.getMeter('Validator');
|
|
23
26
|
|
|
24
|
-
this.failedReexecutionCounter = meter
|
|
25
|
-
|
|
26
|
-
unit: 'count',
|
|
27
|
-
valueType: ValueType.INT,
|
|
27
|
+
this.failedReexecutionCounter = createUpDownCounterWithDefault(meter, Metrics.VALIDATOR_FAILED_REEXECUTION_COUNT, {
|
|
28
|
+
[Attributes.STATUS]: ['failed'],
|
|
28
29
|
});
|
|
29
30
|
|
|
30
|
-
this.successfulAttestationsCount =
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
this.successfulAttestationsCount = createUpDownCounterWithDefault(
|
|
32
|
+
meter,
|
|
33
|
+
Metrics.VALIDATOR_ATTESTATION_SUCCESS_COUNT,
|
|
34
|
+
);
|
|
34
35
|
|
|
35
|
-
this.failedAttestationsBadProposalCount =
|
|
36
|
+
this.failedAttestationsBadProposalCount = createUpDownCounterWithDefault(
|
|
37
|
+
meter,
|
|
36
38
|
Metrics.VALIDATOR_ATTESTATION_FAILED_BAD_PROPOSAL_COUNT,
|
|
37
39
|
{
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
[Attributes.ERROR_TYPE]: [
|
|
41
|
+
'invalid_proposal',
|
|
42
|
+
'state_mismatch',
|
|
43
|
+
'failed_txs',
|
|
44
|
+
'in_hash_mismatch',
|
|
45
|
+
'parent_block_wrong_slot',
|
|
46
|
+
],
|
|
47
|
+
[Attributes.IS_COMMITTEE_MEMBER]: [true, false],
|
|
40
48
|
},
|
|
41
49
|
);
|
|
42
50
|
|
|
43
|
-
this.failedAttestationsNodeIssueCount =
|
|
51
|
+
this.failedAttestationsNodeIssueCount = createUpDownCounterWithDefault(
|
|
52
|
+
meter,
|
|
44
53
|
Metrics.VALIDATOR_ATTESTATION_FAILED_NODE_ISSUE_COUNT,
|
|
45
54
|
{
|
|
46
|
-
|
|
47
|
-
|
|
55
|
+
[Attributes.ERROR_TYPE]: [
|
|
56
|
+
'parent_block_not_found',
|
|
57
|
+
'global_variables_mismatch',
|
|
58
|
+
'block_number_already_exists',
|
|
59
|
+
'txs_not_available',
|
|
60
|
+
'timeout',
|
|
61
|
+
'unknown_error',
|
|
62
|
+
],
|
|
63
|
+
[Attributes.IS_COMMITTEE_MEMBER]: [true, false],
|
|
48
64
|
},
|
|
49
65
|
);
|
|
50
66
|
|
|
51
|
-
this.reexMana = meter.createHistogram(Metrics.VALIDATOR_RE_EXECUTION_MANA
|
|
52
|
-
description: 'The mana consumed by blocks',
|
|
53
|
-
valueType: ValueType.DOUBLE,
|
|
54
|
-
unit: 'Mmana',
|
|
55
|
-
});
|
|
67
|
+
this.reexMana = meter.createHistogram(Metrics.VALIDATOR_RE_EXECUTION_MANA);
|
|
56
68
|
|
|
57
|
-
this.reexTx = meter.createHistogram(Metrics.VALIDATOR_RE_EXECUTION_TX_COUNT
|
|
58
|
-
description: 'The number of txs in a block proposal',
|
|
59
|
-
valueType: ValueType.INT,
|
|
60
|
-
unit: 'tx',
|
|
61
|
-
});
|
|
69
|
+
this.reexTx = meter.createHistogram(Metrics.VALIDATOR_RE_EXECUTION_TX_COUNT);
|
|
62
70
|
|
|
63
|
-
this.reexDuration = meter.createGauge(Metrics.VALIDATOR_RE_EXECUTION_TIME
|
|
64
|
-
description: 'The time taken to re-execute a transaction',
|
|
65
|
-
unit: 'ms',
|
|
66
|
-
valueType: ValueType.INT,
|
|
67
|
-
});
|
|
71
|
+
this.reexDuration = meter.createGauge(Metrics.VALIDATOR_RE_EXECUTION_TIME);
|
|
68
72
|
}
|
|
69
73
|
|
|
70
74
|
public recordReex(time: number, txs: number, mManaTotal: number) {
|
|
@@ -85,14 +89,22 @@ export class ValidatorMetrics {
|
|
|
85
89
|
this.successfulAttestationsCount.add(num);
|
|
86
90
|
}
|
|
87
91
|
|
|
88
|
-
public incFailedAttestationsBadProposal(
|
|
92
|
+
public incFailedAttestationsBadProposal(
|
|
93
|
+
num: number,
|
|
94
|
+
reason: BlockProposalValidationFailureReason,
|
|
95
|
+
inCommittee: boolean,
|
|
96
|
+
) {
|
|
89
97
|
this.failedAttestationsBadProposalCount.add(num, {
|
|
90
98
|
[Attributes.ERROR_TYPE]: reason,
|
|
91
99
|
[Attributes.IS_COMMITTEE_MEMBER]: inCommittee,
|
|
92
100
|
});
|
|
93
101
|
}
|
|
94
102
|
|
|
95
|
-
public incFailedAttestationsNodeIssue(
|
|
103
|
+
public incFailedAttestationsNodeIssue(
|
|
104
|
+
num: number,
|
|
105
|
+
reason: BlockProposalValidationFailureReason,
|
|
106
|
+
inCommittee: boolean,
|
|
107
|
+
) {
|
|
96
108
|
this.failedAttestationsNodeIssueCount.add(num, {
|
|
97
109
|
[Attributes.ERROR_TYPE]: reason,
|
|
98
110
|
[Attributes.IS_COMMITTEE_MEMBER]: inCommittee,
|