@aztec/validator-client 0.0.1-commit.f295ac2 → 0.0.1-commit.f504929
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 +22 -19
- package/dest/block_proposal_handler.d.ts +6 -8
- package/dest/block_proposal_handler.d.ts.map +1 -1
- package/dest/block_proposal_handler.js +28 -57
- package/dest/checkpoint_builder.d.ts +15 -13
- package/dest/checkpoint_builder.d.ts.map +1 -1
- package/dest/checkpoint_builder.js +55 -32
- package/dest/config.d.ts +1 -1
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +9 -7
- package/dest/duties/validation_service.d.ts +2 -2
- package/dest/duties/validation_service.d.ts.map +1 -1
- package/dest/duties/validation_service.js +3 -3
- package/dest/factory.d.ts +1 -1
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +2 -1
- package/dest/index.d.ts +1 -2
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +0 -1
- package/dest/key_store/ha_key_store.d.ts +1 -1
- package/dest/key_store/ha_key_store.d.ts.map +1 -1
- package/dest/key_store/ha_key_store.js +2 -2
- package/dest/metrics.d.ts +12 -3
- package/dest/metrics.d.ts.map +1 -1
- package/dest/metrics.js +46 -5
- package/dest/validator.d.ts +40 -14
- package/dest/validator.d.ts.map +1 -1
- package/dest/validator.js +196 -52
- package/package.json +19 -17
- package/src/block_proposal_handler.ts +40 -81
- package/src/checkpoint_builder.ts +80 -33
- package/src/config.ts +9 -7
- package/src/duties/validation_service.ts +9 -2
- package/src/factory.ts +1 -0
- package/src/index.ts +0 -1
- package/src/key_store/ha_key_store.ts +2 -2
- package/src/metrics.ts +63 -6
- package/src/validator.ts +253 -65
- 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 -18
- package/dest/tx_validator/tx_validator_factory.d.ts.map +0 -1
- package/dest/tx_validator/tx_validator_factory.js +0 -53
- 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 -133
|
@@ -95,6 +95,7 @@ export class ValidationService {
|
|
|
95
95
|
public createCheckpointProposal(
|
|
96
96
|
checkpointHeader: CheckpointHeader,
|
|
97
97
|
archive: Fr,
|
|
98
|
+
feeAssetPriceModifier: bigint,
|
|
98
99
|
lastBlockInfo: CreateCheckpointProposalLastBlockData | undefined,
|
|
99
100
|
proposerAttesterAddress: EthAddress | undefined,
|
|
100
101
|
options: CheckpointProposalOptions,
|
|
@@ -119,7 +120,13 @@ export class ValidationService {
|
|
|
119
120
|
txs: options.publishFullTxs ? lastBlockInfo.txs : undefined,
|
|
120
121
|
};
|
|
121
122
|
|
|
122
|
-
return CheckpointProposal.createProposalFromSigner(
|
|
123
|
+
return CheckpointProposal.createProposalFromSigner(
|
|
124
|
+
checkpointHeader,
|
|
125
|
+
archive,
|
|
126
|
+
feeAssetPriceModifier,
|
|
127
|
+
lastBlock,
|
|
128
|
+
payloadSigner,
|
|
129
|
+
);
|
|
123
130
|
}
|
|
124
131
|
|
|
125
132
|
/**
|
|
@@ -137,7 +144,7 @@ export class ValidationService {
|
|
|
137
144
|
attestors: EthAddress[],
|
|
138
145
|
): Promise<CheckpointAttestation[]> {
|
|
139
146
|
// Create the attestation payload from the checkpoint proposal
|
|
140
|
-
const payload = new ConsensusPayload(proposal.checkpointHeader, proposal.archive);
|
|
147
|
+
const payload = new ConsensusPayload(proposal.checkpointHeader, proposal.archive, proposal.feeAssetPriceModifier);
|
|
141
148
|
const buf = Buffer32.fromBuffer(
|
|
142
149
|
keccak256(payload.getPayloadToSign(SignatureDomainSeparator.checkpointAttestation)),
|
|
143
150
|
);
|
package/src/factory.ts
CHANGED
|
@@ -29,6 +29,7 @@ export function createBlockProposalHandler(
|
|
|
29
29
|
const metrics = new ValidatorMetrics(deps.telemetry);
|
|
30
30
|
const blockProposalValidator = new BlockProposalValidator(deps.epochCache, {
|
|
31
31
|
txsPermitted: !config.disableTransactions,
|
|
32
|
+
maxTxsPerBlock: config.maxTxsPerBlock,
|
|
32
33
|
});
|
|
33
34
|
return new BlockProposalHandler(
|
|
34
35
|
deps.checkpointsBuilder,
|
package/src/index.ts
CHANGED
|
@@ -256,8 +256,8 @@ export class HAKeyStore implements ExtendedValidatorKeyStore {
|
|
|
256
256
|
/**
|
|
257
257
|
* Start the high-availability key store
|
|
258
258
|
*/
|
|
259
|
-
public start()
|
|
260
|
-
|
|
259
|
+
public async start() {
|
|
260
|
+
await this.haSigner.start();
|
|
261
261
|
}
|
|
262
262
|
|
|
263
263
|
/**
|
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,
|
|
@@ -6,13 +8,18 @@ import {
|
|
|
6
8
|
Metrics,
|
|
7
9
|
type TelemetryClient,
|
|
8
10
|
type UpDownCounter,
|
|
11
|
+
createUpDownCounterWithDefault,
|
|
9
12
|
} from '@aztec/telemetry-client';
|
|
10
13
|
|
|
14
|
+
import type { BlockProposalValidationFailureReason } from './block_proposal_handler.js';
|
|
15
|
+
|
|
11
16
|
export class ValidatorMetrics {
|
|
12
17
|
private failedReexecutionCounter: UpDownCounter;
|
|
13
18
|
private successfulAttestationsCount: UpDownCounter;
|
|
14
19
|
private failedAttestationsBadProposalCount: UpDownCounter;
|
|
15
20
|
private failedAttestationsNodeIssueCount: UpDownCounter;
|
|
21
|
+
private currentEpoch: Gauge;
|
|
22
|
+
private attestedEpochCount: UpDownCounter;
|
|
16
23
|
|
|
17
24
|
private reexMana: Histogram;
|
|
18
25
|
private reexTx: Histogram;
|
|
@@ -21,18 +28,50 @@ export class ValidatorMetrics {
|
|
|
21
28
|
constructor(telemetryClient: TelemetryClient) {
|
|
22
29
|
const meter = telemetryClient.getMeter('Validator');
|
|
23
30
|
|
|
24
|
-
this.failedReexecutionCounter = meter
|
|
31
|
+
this.failedReexecutionCounter = createUpDownCounterWithDefault(meter, Metrics.VALIDATOR_FAILED_REEXECUTION_COUNT, {
|
|
32
|
+
[Attributes.STATUS]: ['failed'],
|
|
33
|
+
});
|
|
25
34
|
|
|
26
|
-
this.successfulAttestationsCount =
|
|
35
|
+
this.successfulAttestationsCount = createUpDownCounterWithDefault(
|
|
36
|
+
meter,
|
|
37
|
+
Metrics.VALIDATOR_ATTESTATION_SUCCESS_COUNT,
|
|
38
|
+
);
|
|
27
39
|
|
|
28
|
-
this.failedAttestationsBadProposalCount =
|
|
40
|
+
this.failedAttestationsBadProposalCount = createUpDownCounterWithDefault(
|
|
41
|
+
meter,
|
|
29
42
|
Metrics.VALIDATOR_ATTESTATION_FAILED_BAD_PROPOSAL_COUNT,
|
|
43
|
+
{
|
|
44
|
+
[Attributes.ERROR_TYPE]: [
|
|
45
|
+
'invalid_proposal',
|
|
46
|
+
'state_mismatch',
|
|
47
|
+
'failed_txs',
|
|
48
|
+
'in_hash_mismatch',
|
|
49
|
+
'parent_block_wrong_slot',
|
|
50
|
+
],
|
|
51
|
+
[Attributes.IS_COMMITTEE_MEMBER]: [true, false],
|
|
52
|
+
},
|
|
30
53
|
);
|
|
31
54
|
|
|
32
|
-
this.failedAttestationsNodeIssueCount =
|
|
55
|
+
this.failedAttestationsNodeIssueCount = createUpDownCounterWithDefault(
|
|
56
|
+
meter,
|
|
33
57
|
Metrics.VALIDATOR_ATTESTATION_FAILED_NODE_ISSUE_COUNT,
|
|
58
|
+
{
|
|
59
|
+
[Attributes.ERROR_TYPE]: [
|
|
60
|
+
'parent_block_not_found',
|
|
61
|
+
'global_variables_mismatch',
|
|
62
|
+
'block_number_already_exists',
|
|
63
|
+
'txs_not_available',
|
|
64
|
+
'timeout',
|
|
65
|
+
'unknown_error',
|
|
66
|
+
],
|
|
67
|
+
[Attributes.IS_COMMITTEE_MEMBER]: [true, false],
|
|
68
|
+
},
|
|
34
69
|
);
|
|
35
70
|
|
|
71
|
+
this.currentEpoch = meter.createGauge(Metrics.VALIDATOR_CURRENT_EPOCH);
|
|
72
|
+
|
|
73
|
+
this.attestedEpochCount = createUpDownCounterWithDefault(meter, Metrics.VALIDATOR_ATTESTED_EPOCH_COUNT);
|
|
74
|
+
|
|
36
75
|
this.reexMana = meter.createHistogram(Metrics.VALIDATOR_RE_EXECUTION_MANA);
|
|
37
76
|
|
|
38
77
|
this.reexTx = meter.createHistogram(Metrics.VALIDATOR_RE_EXECUTION_TX_COUNT);
|
|
@@ -58,17 +97,35 @@ export class ValidatorMetrics {
|
|
|
58
97
|
this.successfulAttestationsCount.add(num);
|
|
59
98
|
}
|
|
60
99
|
|
|
61
|
-
public incFailedAttestationsBadProposal(
|
|
100
|
+
public incFailedAttestationsBadProposal(
|
|
101
|
+
num: number,
|
|
102
|
+
reason: BlockProposalValidationFailureReason,
|
|
103
|
+
inCommittee: boolean,
|
|
104
|
+
) {
|
|
62
105
|
this.failedAttestationsBadProposalCount.add(num, {
|
|
63
106
|
[Attributes.ERROR_TYPE]: reason,
|
|
64
107
|
[Attributes.IS_COMMITTEE_MEMBER]: inCommittee,
|
|
65
108
|
});
|
|
66
109
|
}
|
|
67
110
|
|
|
68
|
-
public incFailedAttestationsNodeIssue(
|
|
111
|
+
public incFailedAttestationsNodeIssue(
|
|
112
|
+
num: number,
|
|
113
|
+
reason: BlockProposalValidationFailureReason,
|
|
114
|
+
inCommittee: boolean,
|
|
115
|
+
) {
|
|
69
116
|
this.failedAttestationsNodeIssueCount.add(num, {
|
|
70
117
|
[Attributes.ERROR_TYPE]: reason,
|
|
71
118
|
[Attributes.IS_COMMITTEE_MEMBER]: inCommittee,
|
|
72
119
|
});
|
|
73
120
|
}
|
|
121
|
+
|
|
122
|
+
/** Update the gauge tracking the current epoch number (proxy for total epochs elapsed). */
|
|
123
|
+
public setCurrentEpoch(epoch: EpochNumber) {
|
|
124
|
+
this.currentEpoch.record(Number(epoch));
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** Increment the count of epochs in which the given attester submitted at least one attestation. */
|
|
128
|
+
public incAttestedEpochCount(attester: EthAddress) {
|
|
129
|
+
this.attestedEpochCount.add(1, { [Attributes.ATTESTER_ADDRESS]: attester.toString() });
|
|
130
|
+
}
|
|
74
131
|
}
|