@aztec/validator-client 0.0.1-commit.0b941701 → 0.0.1-commit.0dc957cde
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 +60 -18
- package/dest/checkpoint_builder.d.ts +26 -14
- package/dest/checkpoint_builder.d.ts.map +1 -1
- package/dest/checkpoint_builder.js +136 -45
- package/dest/config.d.ts +1 -1
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +28 -9
- 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.d.ts +1 -1
- package/dest/key_store/ha_key_store.d.ts.map +1 -1
- package/dest/key_store/ha_key_store.js +3 -3
- package/dest/metrics.d.ts +16 -3
- package/dest/metrics.d.ts.map +1 -1
- package/dest/metrics.js +58 -5
- 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 +45 -24
- package/dest/validator.d.ts.map +1 -1
- package/dest/validator.js +194 -206
- package/package.json +19 -17
- package/src/checkpoint_builder.ts +183 -50
- package/src/config.ts +28 -9
- 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 +3 -3
- package/src/metrics.ts +81 -6
- package/src/proposal_handler.ts +1042 -0
- package/src/validator.ts +272 -241
- package/dest/block_proposal_handler.d.ts +0 -64
- package/dest/block_proposal_handler.d.ts.map +0 -1
- package/dest/block_proposal_handler.js +0 -545
- 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 -54
- package/src/block_proposal_handler.ts +0 -554
- 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 -135
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BlockNumber,
|
|
3
|
-
type CheckpointNumber,
|
|
4
|
-
IndexWithinCheckpoint,
|
|
5
|
-
type SlotNumber,
|
|
6
|
-
} from '@aztec/foundation/branded-types';
|
|
1
|
+
import { type CheckpointNumber, IndexWithinCheckpoint, type SlotNumber } from '@aztec/foundation/branded-types';
|
|
7
2
|
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
8
3
|
import { keccak256 } from '@aztec/foundation/crypto/keccak';
|
|
9
4
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
@@ -11,7 +6,6 @@ import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
|
11
6
|
import type { Signature } from '@aztec/foundation/eth-signature';
|
|
12
7
|
import { createLogger } from '@aztec/foundation/log';
|
|
13
8
|
import type { CommitteeAttestationsAndSigners } from '@aztec/stdlib/block';
|
|
14
|
-
import type { CreateCheckpointProposalLastBlockData } from '@aztec/stdlib/interfaces/server';
|
|
15
9
|
import {
|
|
16
10
|
BlockProposal,
|
|
17
11
|
type BlockProposalOptions,
|
|
@@ -52,6 +46,7 @@ export class ValidationService {
|
|
|
52
46
|
*/
|
|
53
47
|
public createBlockProposal(
|
|
54
48
|
blockHeader: BlockHeader,
|
|
49
|
+
checkpointNumber: CheckpointNumber,
|
|
55
50
|
blockIndexWithinCheckpoint: IndexWithinCheckpoint,
|
|
56
51
|
inHash: Fr,
|
|
57
52
|
archive: Fr,
|
|
@@ -72,6 +67,7 @@ export class ValidationService {
|
|
|
72
67
|
|
|
73
68
|
return BlockProposal.createProposalFromSigner(
|
|
74
69
|
blockHeader,
|
|
70
|
+
checkpointNumber,
|
|
75
71
|
blockIndexWithinCheckpoint,
|
|
76
72
|
inHash,
|
|
77
73
|
archive,
|
|
@@ -86,7 +82,7 @@ export class ValidationService {
|
|
|
86
82
|
*
|
|
87
83
|
* @param checkpointHeader - The checkpoint header containing aggregated data
|
|
88
84
|
* @param archive - The archive of the checkpoint
|
|
89
|
-
* @param
|
|
85
|
+
* @param lastBlockProposal - Signed block proposal for the last block in the checkpoint, or undefined
|
|
90
86
|
* @param proposerAttesterAddress - The address of the proposer
|
|
91
87
|
* @param options - Checkpoint proposal options
|
|
92
88
|
*
|
|
@@ -95,13 +91,17 @@ export class ValidationService {
|
|
|
95
91
|
public createCheckpointProposal(
|
|
96
92
|
checkpointHeader: CheckpointHeader,
|
|
97
93
|
archive: Fr,
|
|
98
|
-
|
|
94
|
+
checkpointNumber: CheckpointNumber,
|
|
95
|
+
feeAssetPriceModifier: bigint,
|
|
96
|
+
lastBlockProposal: BlockProposal | undefined,
|
|
99
97
|
proposerAttesterAddress: EthAddress | undefined,
|
|
100
98
|
options: CheckpointProposalOptions,
|
|
101
99
|
): Promise<CheckpointProposal> {
|
|
102
|
-
// For testing: change the archive to trigger state_mismatch validation failure
|
|
100
|
+
// For testing: change the archive to trigger state_mismatch validation failure.
|
|
101
|
+
// If there's a last block proposal, use its (already invalid) archive to keep signatures consistent
|
|
102
|
+
// so P2P validation passes and the slasher can detect the offense.
|
|
103
103
|
if (options.broadcastInvalidCheckpointProposal) {
|
|
104
|
-
archive = Fr.random();
|
|
104
|
+
archive = lastBlockProposal?.archiveRoot ?? Fr.random();
|
|
105
105
|
this.log.warn(`Creating INVALID checkpoint proposal for slot ${checkpointHeader.slotNumber}`);
|
|
106
106
|
}
|
|
107
107
|
|
|
@@ -111,15 +111,14 @@ export class ValidationService {
|
|
|
111
111
|
return this.keyStore.signMessageWithAddress(address, payload, context);
|
|
112
112
|
};
|
|
113
113
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
return CheckpointProposal.createProposalFromSigner(checkpointHeader, archive, lastBlock, payloadSigner);
|
|
114
|
+
return CheckpointProposal.createProposalFromSigner(
|
|
115
|
+
checkpointHeader,
|
|
116
|
+
archive,
|
|
117
|
+
checkpointNumber,
|
|
118
|
+
feeAssetPriceModifier,
|
|
119
|
+
lastBlockProposal,
|
|
120
|
+
payloadSigner,
|
|
121
|
+
);
|
|
123
122
|
}
|
|
124
123
|
|
|
125
124
|
/**
|
|
@@ -135,27 +134,17 @@ export class ValidationService {
|
|
|
135
134
|
async attestToCheckpointProposal(
|
|
136
135
|
proposal: CheckpointProposalCore,
|
|
137
136
|
attestors: EthAddress[],
|
|
137
|
+
checkpointNumber: CheckpointNumber,
|
|
138
138
|
): Promise<CheckpointAttestation[]> {
|
|
139
139
|
// Create the attestation payload from the checkpoint proposal
|
|
140
|
-
const payload = new ConsensusPayload(proposal.checkpointHeader, proposal.archive);
|
|
140
|
+
const payload = new ConsensusPayload(proposal.checkpointHeader, proposal.archive, proposal.feeAssetPriceModifier);
|
|
141
141
|
const buf = Buffer32.fromBuffer(
|
|
142
142
|
keccak256(payload.getPayloadToSign(SignatureDomainSeparator.checkpointAttestation)),
|
|
143
143
|
);
|
|
144
144
|
|
|
145
|
-
// TODO(spy/ha): Use checkpointNumber instead of blockNumber once CheckpointHeader includes it.
|
|
146
|
-
// Currently using lastBlock.blockNumber as a proxy for checkpoint identification in HA signing.
|
|
147
|
-
// blockNumber is NOT used for the primary key so it's safe to use here.
|
|
148
|
-
// See CheckpointHeader TODO and SigningContext types documentation.
|
|
149
|
-
let blockNumber: BlockNumber;
|
|
150
|
-
try {
|
|
151
|
-
blockNumber = proposal.blockNumber;
|
|
152
|
-
} catch {
|
|
153
|
-
// Checkpoint proposal may not have lastBlock, use 0 as fallback
|
|
154
|
-
blockNumber = BlockNumber(0);
|
|
155
|
-
}
|
|
156
145
|
const context: SigningContext = {
|
|
157
146
|
slot: proposal.slotNumber,
|
|
158
|
-
|
|
147
|
+
checkpointNumber,
|
|
159
148
|
dutyType: DutyType.ATTESTATION,
|
|
160
149
|
};
|
|
161
150
|
|
|
@@ -176,7 +165,7 @@ export class ValidationService {
|
|
|
176
165
|
} else {
|
|
177
166
|
const error = result.reason;
|
|
178
167
|
if (error instanceof DutyAlreadySignedError || error instanceof SlashingProtectionError) {
|
|
179
|
-
this.log.
|
|
168
|
+
this.log.verbose(
|
|
180
169
|
`Attestation for slot ${proposal.slotNumber} by ${attestors[i]} already signed by another High-Availability node`,
|
|
181
170
|
);
|
|
182
171
|
// Continue with remaining attestors
|
|
@@ -194,7 +183,6 @@ export class ValidationService {
|
|
|
194
183
|
* @param attestationsAndSigners - The attestations and signers to sign
|
|
195
184
|
* @param proposer - The proposer address to sign with
|
|
196
185
|
* @param slot - The slot number for HA signing context
|
|
197
|
-
* @param blockNumber - The block or checkpoint number for HA signing context
|
|
198
186
|
* @returns signature
|
|
199
187
|
* @throws DutyAlreadySignedError if already signed by another HA node
|
|
200
188
|
* @throws SlashingProtectionError if attempting to sign different data for same slot
|
|
@@ -203,11 +191,11 @@ export class ValidationService {
|
|
|
203
191
|
attestationsAndSigners: CommitteeAttestationsAndSigners,
|
|
204
192
|
proposer: EthAddress,
|
|
205
193
|
slot: SlotNumber,
|
|
206
|
-
|
|
194
|
+
checkpointNumber: CheckpointNumber,
|
|
207
195
|
): Promise<Signature> {
|
|
208
196
|
const context: SigningContext = {
|
|
209
197
|
slot,
|
|
210
|
-
|
|
198
|
+
checkpointNumber,
|
|
211
199
|
dutyType: DutyType.ATTESTATIONS_AND_SIGNERS,
|
|
212
200
|
};
|
|
213
201
|
|
package/src/factory.ts
CHANGED
|
@@ -7,13 +7,14 @@ import type { L2BlockSink, L2BlockSource } from '@aztec/stdlib/block';
|
|
|
7
7
|
import type { ValidatorClientFullConfig, WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
8
8
|
import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
9
9
|
import type { TelemetryClient } from '@aztec/telemetry-client';
|
|
10
|
+
import type { SlashingProtectionDatabase } from '@aztec/validator-ha-signer/types';
|
|
10
11
|
|
|
11
|
-
import { BlockProposalHandler } from './block_proposal_handler.js';
|
|
12
12
|
import type { FullNodeCheckpointsBuilder } from './checkpoint_builder.js';
|
|
13
13
|
import { ValidatorMetrics } from './metrics.js';
|
|
14
|
+
import { ProposalHandler } from './proposal_handler.js';
|
|
14
15
|
import { ValidatorClient } from './validator.js';
|
|
15
16
|
|
|
16
|
-
export function
|
|
17
|
+
export function createProposalHandler(
|
|
17
18
|
config: ValidatorClientFullConfig,
|
|
18
19
|
deps: {
|
|
19
20
|
checkpointsBuilder: FullNodeCheckpointsBuilder;
|
|
@@ -22,6 +23,7 @@ export function createBlockProposalHandler(
|
|
|
22
23
|
l1ToL2MessageSource: L1ToL2MessageSource;
|
|
23
24
|
p2pClient: P2PClient;
|
|
24
25
|
epochCache: EpochCache;
|
|
26
|
+
blobClient: BlobClientInterface;
|
|
25
27
|
dateProvider: DateProvider;
|
|
26
28
|
telemetry: TelemetryClient;
|
|
27
29
|
},
|
|
@@ -29,8 +31,9 @@ export function createBlockProposalHandler(
|
|
|
29
31
|
const metrics = new ValidatorMetrics(deps.telemetry);
|
|
30
32
|
const blockProposalValidator = new BlockProposalValidator(deps.epochCache, {
|
|
31
33
|
txsPermitted: !config.disableTransactions,
|
|
34
|
+
maxTxsPerBlock: config.validateMaxTxsPerBlock ?? config.validateMaxTxsPerCheckpoint,
|
|
32
35
|
});
|
|
33
|
-
return new
|
|
36
|
+
return new ProposalHandler(
|
|
34
37
|
deps.checkpointsBuilder,
|
|
35
38
|
deps.worldState,
|
|
36
39
|
deps.blockSource,
|
|
@@ -39,9 +42,11 @@ export function createBlockProposalHandler(
|
|
|
39
42
|
blockProposalValidator,
|
|
40
43
|
deps.epochCache,
|
|
41
44
|
config,
|
|
45
|
+
deps.blobClient,
|
|
42
46
|
metrics,
|
|
43
47
|
deps.dateProvider,
|
|
44
48
|
deps.telemetry,
|
|
49
|
+
undefined,
|
|
45
50
|
);
|
|
46
51
|
}
|
|
47
52
|
|
|
@@ -58,6 +63,7 @@ export function createValidatorClient(
|
|
|
58
63
|
epochCache: EpochCache;
|
|
59
64
|
keyStoreManager: KeystoreManager | undefined;
|
|
60
65
|
blobClient: BlobClientInterface;
|
|
66
|
+
slashingProtectionDb?: SlashingProtectionDatabase;
|
|
61
67
|
},
|
|
62
68
|
) {
|
|
63
69
|
if (config.disableValidator || !deps.keyStoreManager) {
|
|
@@ -78,5 +84,6 @@ export function createValidatorClient(
|
|
|
78
84
|
deps.blobClient,
|
|
79
85
|
deps.dateProvider,
|
|
80
86
|
deps.telemetry,
|
|
87
|
+
deps.slashingProtectionDb,
|
|
81
88
|
);
|
|
82
89
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './proposal_handler.js';
|
|
2
2
|
export * from './checkpoint_builder.js';
|
|
3
3
|
export * from './config.js';
|
|
4
4
|
export * from './factory.js';
|
|
5
5
|
export * from './validator.js';
|
|
6
6
|
export * from './key_store/index.js';
|
|
7
|
-
export * from './tx_validator/index.js';
|
|
@@ -240,7 +240,7 @@ export class HAKeyStore implements ExtendedValidatorKeyStore {
|
|
|
240
240
|
}
|
|
241
241
|
|
|
242
242
|
if (error instanceof SlashingProtectionError) {
|
|
243
|
-
this.log.
|
|
243
|
+
this.log.info(`Duty already signed by another node with different payload`, {
|
|
244
244
|
dutyType: context.dutyType,
|
|
245
245
|
slot: context.slot,
|
|
246
246
|
existingMessageHash: error.existingMessageHash,
|
|
@@ -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,38 +8,83 @@ 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 './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;
|
|
19
26
|
private reexDuration: Gauge;
|
|
27
|
+
private checkpointProposalToPipelinedStateDuration: Histogram;
|
|
28
|
+
private checkpointProposalReceiveOffsetFromNextSlotBoundary: Histogram;
|
|
20
29
|
|
|
21
30
|
constructor(telemetryClient: TelemetryClient) {
|
|
22
31
|
const meter = telemetryClient.getMeter('Validator');
|
|
23
32
|
|
|
24
|
-
this.failedReexecutionCounter = meter
|
|
33
|
+
this.failedReexecutionCounter = createUpDownCounterWithDefault(meter, Metrics.VALIDATOR_FAILED_REEXECUTION_COUNT, {
|
|
34
|
+
[Attributes.STATUS]: ['failed'],
|
|
35
|
+
});
|
|
25
36
|
|
|
26
|
-
this.successfulAttestationsCount =
|
|
37
|
+
this.successfulAttestationsCount = createUpDownCounterWithDefault(
|
|
38
|
+
meter,
|
|
39
|
+
Metrics.VALIDATOR_ATTESTATION_SUCCESS_COUNT,
|
|
40
|
+
);
|
|
27
41
|
|
|
28
|
-
this.failedAttestationsBadProposalCount =
|
|
42
|
+
this.failedAttestationsBadProposalCount = createUpDownCounterWithDefault(
|
|
43
|
+
meter,
|
|
29
44
|
Metrics.VALIDATOR_ATTESTATION_FAILED_BAD_PROPOSAL_COUNT,
|
|
45
|
+
{
|
|
46
|
+
[Attributes.ERROR_TYPE]: [
|
|
47
|
+
'invalid_proposal',
|
|
48
|
+
'state_mismatch',
|
|
49
|
+
'failed_txs',
|
|
50
|
+
'in_hash_mismatch',
|
|
51
|
+
'parent_block_wrong_slot',
|
|
52
|
+
],
|
|
53
|
+
[Attributes.IS_COMMITTEE_MEMBER]: [true, false],
|
|
54
|
+
},
|
|
30
55
|
);
|
|
31
56
|
|
|
32
|
-
this.failedAttestationsNodeIssueCount =
|
|
57
|
+
this.failedAttestationsNodeIssueCount = createUpDownCounterWithDefault(
|
|
58
|
+
meter,
|
|
33
59
|
Metrics.VALIDATOR_ATTESTATION_FAILED_NODE_ISSUE_COUNT,
|
|
60
|
+
{
|
|
61
|
+
[Attributes.ERROR_TYPE]: [
|
|
62
|
+
'parent_block_not_found',
|
|
63
|
+
'global_variables_mismatch',
|
|
64
|
+
'block_number_already_exists',
|
|
65
|
+
'txs_not_available',
|
|
66
|
+
'timeout',
|
|
67
|
+
'unknown_error',
|
|
68
|
+
],
|
|
69
|
+
[Attributes.IS_COMMITTEE_MEMBER]: [true, false],
|
|
70
|
+
},
|
|
34
71
|
);
|
|
35
72
|
|
|
73
|
+
this.currentEpoch = meter.createGauge(Metrics.VALIDATOR_CURRENT_EPOCH);
|
|
74
|
+
|
|
75
|
+
this.attestedEpochCount = createUpDownCounterWithDefault(meter, Metrics.VALIDATOR_ATTESTED_EPOCH_COUNT);
|
|
76
|
+
|
|
36
77
|
this.reexMana = meter.createHistogram(Metrics.VALIDATOR_RE_EXECUTION_MANA);
|
|
37
78
|
|
|
38
79
|
this.reexTx = meter.createHistogram(Metrics.VALIDATOR_RE_EXECUTION_TX_COUNT);
|
|
39
80
|
|
|
40
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
|
+
);
|
|
41
88
|
}
|
|
42
89
|
|
|
43
90
|
public recordReex(time: number, txs: number, mManaTotal: number) {
|
|
@@ -46,6 +93,16 @@ export class ValidatorMetrics {
|
|
|
46
93
|
this.reexMana.record(mManaTotal);
|
|
47
94
|
}
|
|
48
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
|
+
|
|
49
106
|
public recordFailedReexecution(proposal: BlockProposal) {
|
|
50
107
|
const proposer = proposal.getSender();
|
|
51
108
|
this.failedReexecutionCounter.add(1, {
|
|
@@ -58,17 +115,35 @@ export class ValidatorMetrics {
|
|
|
58
115
|
this.successfulAttestationsCount.add(num);
|
|
59
116
|
}
|
|
60
117
|
|
|
61
|
-
public incFailedAttestationsBadProposal(
|
|
118
|
+
public incFailedAttestationsBadProposal(
|
|
119
|
+
num: number,
|
|
120
|
+
reason: BlockProposalValidationFailureReason,
|
|
121
|
+
inCommittee: boolean,
|
|
122
|
+
) {
|
|
62
123
|
this.failedAttestationsBadProposalCount.add(num, {
|
|
63
124
|
[Attributes.ERROR_TYPE]: reason,
|
|
64
125
|
[Attributes.IS_COMMITTEE_MEMBER]: inCommittee,
|
|
65
126
|
});
|
|
66
127
|
}
|
|
67
128
|
|
|
68
|
-
public incFailedAttestationsNodeIssue(
|
|
129
|
+
public incFailedAttestationsNodeIssue(
|
|
130
|
+
num: number,
|
|
131
|
+
reason: BlockProposalValidationFailureReason,
|
|
132
|
+
inCommittee: boolean,
|
|
133
|
+
) {
|
|
69
134
|
this.failedAttestationsNodeIssueCount.add(num, {
|
|
70
135
|
[Attributes.ERROR_TYPE]: reason,
|
|
71
136
|
[Attributes.IS_COMMITTEE_MEMBER]: inCommittee,
|
|
72
137
|
});
|
|
73
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
|
+
}
|
|
74
149
|
}
|