@aztec/validator-client 0.0.1-commit.e558bd1c → 0.0.1-commit.e5a3663dd
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 +51 -10
- 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 +33 -7
- package/dest/duties/validation_service.d.ts +11 -12
- package/dest/duties/validation_service.d.ts.map +1 -1
- package/dest/duties/validation_service.js +27 -45
- package/dest/factory.d.ts +7 -4
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +11 -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 +986 -0
- package/dest/validator.d.ts +41 -23
- package/dest/validator.d.ts.map +1 -1
- package/dest/validator.js +181 -200
- package/package.json +19 -19
- package/src/checkpoint_builder.ts +142 -39
- package/src/config.ts +33 -6
- package/src/duties/validation_service.ts +53 -53
- package/src/factory.ts +15 -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 +1052 -0
- package/src/validator.ts +265 -229
- 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
|
@@ -1,17 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BlockNumber,
|
|
3
|
-
type CheckpointNumber,
|
|
4
|
-
IndexWithinCheckpoint,
|
|
5
|
-
type SlotNumber,
|
|
6
|
-
} from '@aztec/foundation/branded-types';
|
|
7
|
-
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
8
|
-
import { keccak256 } from '@aztec/foundation/crypto/keccak';
|
|
1
|
+
import { type CheckpointNumber, IndexWithinCheckpoint, type SlotNumber } from '@aztec/foundation/branded-types';
|
|
9
2
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
10
3
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
11
4
|
import type { Signature } from '@aztec/foundation/eth-signature';
|
|
12
5
|
import { createLogger } from '@aztec/foundation/log';
|
|
13
|
-
import
|
|
14
|
-
import type { CreateCheckpointProposalLastBlockData } from '@aztec/stdlib/interfaces/server';
|
|
6
|
+
import { CommitteeAttestationsAndSigners } from '@aztec/stdlib/block';
|
|
15
7
|
import {
|
|
16
8
|
BlockProposal,
|
|
17
9
|
type BlockProposalOptions,
|
|
@@ -20,7 +12,8 @@ import {
|
|
|
20
12
|
type CheckpointProposalCore,
|
|
21
13
|
type CheckpointProposalOptions,
|
|
22
14
|
ConsensusPayload,
|
|
23
|
-
|
|
15
|
+
type CoordinationSignatureContext,
|
|
16
|
+
getCoordinationSignatureTypedData,
|
|
24
17
|
} from '@aztec/stdlib/p2p';
|
|
25
18
|
import type { CheckpointHeader } from '@aztec/stdlib/rollup';
|
|
26
19
|
import type { BlockHeader, Tx } from '@aztec/stdlib/tx';
|
|
@@ -32,6 +25,7 @@ import type { ValidatorKeyStore } from '../key_store/interface.js';
|
|
|
32
25
|
export class ValidationService {
|
|
33
26
|
constructor(
|
|
34
27
|
private keyStore: ValidatorKeyStore,
|
|
28
|
+
private signatureContext: CoordinationSignatureContext,
|
|
35
29
|
private log = createLogger('validator:validation-service'),
|
|
36
30
|
) {}
|
|
37
31
|
|
|
@@ -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,
|
|
@@ -67,17 +62,26 @@ export class ValidationService {
|
|
|
67
62
|
|
|
68
63
|
// Create a signer that uses the appropriate address
|
|
69
64
|
const address = proposerAttesterAddress ?? this.keyStore.getAddress(0);
|
|
70
|
-
const payloadSigner = (
|
|
71
|
-
|
|
65
|
+
const payloadSigner = (
|
|
66
|
+
typedData: Parameters<ValidatorKeyStore['signTypedDataWithAddress']>[1],
|
|
67
|
+
context: SigningContext,
|
|
68
|
+
) => this.keyStore.signTypedDataWithAddress(address, typedData, context);
|
|
69
|
+
const txsSigner = (
|
|
70
|
+
typedData: Parameters<ValidatorKeyStore['signTypedDataWithAddress']>[1],
|
|
71
|
+
context: SigningContext,
|
|
72
|
+
) => this.keyStore.signTypedDataWithAddress(address, typedData, context);
|
|
72
73
|
|
|
73
74
|
return BlockProposal.createProposalFromSigner(
|
|
74
75
|
blockHeader,
|
|
76
|
+
checkpointNumber,
|
|
75
77
|
blockIndexWithinCheckpoint,
|
|
76
78
|
inHash,
|
|
77
79
|
archive,
|
|
78
80
|
txs.map(tx => tx.getTxHash()),
|
|
79
81
|
options.publishFullTxs ? txs : undefined,
|
|
82
|
+
this.signatureContext,
|
|
80
83
|
payloadSigner,
|
|
84
|
+
txsSigner,
|
|
81
85
|
);
|
|
82
86
|
}
|
|
83
87
|
|
|
@@ -86,7 +90,7 @@ export class ValidationService {
|
|
|
86
90
|
*
|
|
87
91
|
* @param checkpointHeader - The checkpoint header containing aggregated data
|
|
88
92
|
* @param archive - The archive of the checkpoint
|
|
89
|
-
* @param
|
|
93
|
+
* @param lastBlockProposal - Signed block proposal for the last block in the checkpoint, or undefined
|
|
90
94
|
* @param proposerAttesterAddress - The address of the proposer
|
|
91
95
|
* @param options - Checkpoint proposal options
|
|
92
96
|
*
|
|
@@ -95,31 +99,38 @@ export class ValidationService {
|
|
|
95
99
|
public createCheckpointProposal(
|
|
96
100
|
checkpointHeader: CheckpointHeader,
|
|
97
101
|
archive: Fr,
|
|
98
|
-
|
|
102
|
+
checkpointNumber: CheckpointNumber,
|
|
103
|
+
feeAssetPriceModifier: bigint,
|
|
104
|
+
lastBlockProposal: BlockProposal | undefined,
|
|
99
105
|
proposerAttesterAddress: EthAddress | undefined,
|
|
100
106
|
options: CheckpointProposalOptions,
|
|
101
107
|
): Promise<CheckpointProposal> {
|
|
102
|
-
// For testing: change the archive to trigger state_mismatch validation failure
|
|
108
|
+
// For testing: change the archive to trigger state_mismatch validation failure.
|
|
109
|
+
// If there's a last block proposal, use its (already invalid) archive to keep signatures consistent
|
|
110
|
+
// so P2P validation passes and the slasher can detect the offense.
|
|
103
111
|
if (options.broadcastInvalidCheckpointProposal) {
|
|
104
|
-
archive = Fr.random();
|
|
112
|
+
archive = lastBlockProposal?.archiveRoot ?? Fr.random();
|
|
105
113
|
this.log.warn(`Creating INVALID checkpoint proposal for slot ${checkpointHeader.slotNumber}`);
|
|
106
114
|
}
|
|
107
115
|
|
|
108
116
|
// Create a signer that takes payload and context, and uses the appropriate address
|
|
109
|
-
const payloadSigner = (
|
|
117
|
+
const payloadSigner = (
|
|
118
|
+
typedData: Parameters<ValidatorKeyStore['signTypedDataWithAddress']>[1],
|
|
119
|
+
context: SigningContext,
|
|
120
|
+
) => {
|
|
110
121
|
const address = proposerAttesterAddress ?? this.keyStore.getAddress(0);
|
|
111
|
-
return this.keyStore.
|
|
122
|
+
return this.keyStore.signTypedDataWithAddress(address, typedData, context);
|
|
112
123
|
};
|
|
113
124
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
125
|
+
return CheckpointProposal.createProposalFromSigner(
|
|
126
|
+
checkpointHeader,
|
|
127
|
+
archive,
|
|
128
|
+
checkpointNumber,
|
|
129
|
+
feeAssetPriceModifier,
|
|
130
|
+
lastBlockProposal,
|
|
131
|
+
this.signatureContext,
|
|
132
|
+
payloadSigner,
|
|
133
|
+
);
|
|
123
134
|
}
|
|
124
135
|
|
|
125
136
|
/**
|
|
@@ -135,35 +146,27 @@ export class ValidationService {
|
|
|
135
146
|
async attestToCheckpointProposal(
|
|
136
147
|
proposal: CheckpointProposalCore,
|
|
137
148
|
attestors: EthAddress[],
|
|
149
|
+
checkpointNumber: CheckpointNumber,
|
|
138
150
|
): Promise<CheckpointAttestation[]> {
|
|
139
151
|
// Create the attestation payload from the checkpoint proposal
|
|
140
|
-
const payload = new ConsensusPayload(
|
|
141
|
-
|
|
142
|
-
|
|
152
|
+
const payload = new ConsensusPayload(
|
|
153
|
+
proposal.checkpointHeader,
|
|
154
|
+
proposal.archive,
|
|
155
|
+
proposal.feeAssetPriceModifier,
|
|
156
|
+
this.signatureContext,
|
|
143
157
|
);
|
|
158
|
+
const typedData = getCoordinationSignatureTypedData(payload);
|
|
144
159
|
|
|
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
160
|
const context: SigningContext = {
|
|
157
161
|
slot: proposal.slotNumber,
|
|
158
|
-
|
|
162
|
+
checkpointNumber,
|
|
159
163
|
dutyType: DutyType.ATTESTATION,
|
|
160
164
|
};
|
|
161
165
|
|
|
162
166
|
// Sign each attestor in parallel, catching HA errors per-attestor
|
|
163
167
|
const results = await Promise.allSettled(
|
|
164
168
|
attestors.map(async attestor => {
|
|
165
|
-
const sig = await this.keyStore.
|
|
166
|
-
// return new BlockAttestation(proposal.payload, sig, proposal.signature);
|
|
169
|
+
const sig = await this.keyStore.signTypedDataWithAddress(attestor, typedData, context);
|
|
167
170
|
return new CheckpointAttestation(payload, sig, proposal.signature);
|
|
168
171
|
}),
|
|
169
172
|
);
|
|
@@ -176,7 +179,7 @@ export class ValidationService {
|
|
|
176
179
|
} else {
|
|
177
180
|
const error = result.reason;
|
|
178
181
|
if (error instanceof DutyAlreadySignedError || error instanceof SlashingProtectionError) {
|
|
179
|
-
this.log.
|
|
182
|
+
this.log.verbose(
|
|
180
183
|
`Attestation for slot ${proposal.slotNumber} by ${attestors[i]} already signed by another High-Availability node`,
|
|
181
184
|
);
|
|
182
185
|
// Continue with remaining attestors
|
|
@@ -194,7 +197,6 @@ export class ValidationService {
|
|
|
194
197
|
* @param attestationsAndSigners - The attestations and signers to sign
|
|
195
198
|
* @param proposer - The proposer address to sign with
|
|
196
199
|
* @param slot - The slot number for HA signing context
|
|
197
|
-
* @param blockNumber - The block or checkpoint number for HA signing context
|
|
198
200
|
* @returns signature
|
|
199
201
|
* @throws DutyAlreadySignedError if already signed by another HA node
|
|
200
202
|
* @throws SlashingProtectionError if attempting to sign different data for same slot
|
|
@@ -203,17 +205,15 @@ export class ValidationService {
|
|
|
203
205
|
attestationsAndSigners: CommitteeAttestationsAndSigners,
|
|
204
206
|
proposer: EthAddress,
|
|
205
207
|
slot: SlotNumber,
|
|
206
|
-
|
|
208
|
+
checkpointNumber: CheckpointNumber,
|
|
207
209
|
): Promise<Signature> {
|
|
208
210
|
const context: SigningContext = {
|
|
209
211
|
slot,
|
|
210
|
-
|
|
212
|
+
checkpointNumber,
|
|
211
213
|
dutyType: DutyType.ATTESTATIONS_AND_SIGNERS,
|
|
212
214
|
};
|
|
213
215
|
|
|
214
|
-
const
|
|
215
|
-
|
|
216
|
-
);
|
|
217
|
-
return this.keyStore.signMessageWithAddress(proposer, buf, context);
|
|
216
|
+
const typedData = getCoordinationSignatureTypedData(attestationsAndSigners);
|
|
217
|
+
return this.keyStore.signTypedDataWithAddress(proposer, typedData, context);
|
|
218
218
|
}
|
|
219
219
|
}
|
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,14 @@ 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,
|
|
35
|
+
maxBlocksPerCheckpoint: config.maxBlocksPerCheckpoint,
|
|
36
|
+
signatureContext: {
|
|
37
|
+
chainId: config.l1ChainId,
|
|
38
|
+
rollupAddress: config.l1Contracts.rollupAddress,
|
|
39
|
+
},
|
|
32
40
|
});
|
|
33
|
-
return new
|
|
41
|
+
return new ProposalHandler(
|
|
34
42
|
deps.checkpointsBuilder,
|
|
35
43
|
deps.worldState,
|
|
36
44
|
deps.blockSource,
|
|
@@ -39,9 +47,11 @@ export function createBlockProposalHandler(
|
|
|
39
47
|
blockProposalValidator,
|
|
40
48
|
deps.epochCache,
|
|
41
49
|
config,
|
|
50
|
+
deps.blobClient,
|
|
42
51
|
metrics,
|
|
43
52
|
deps.dateProvider,
|
|
44
53
|
deps.telemetry,
|
|
54
|
+
undefined,
|
|
45
55
|
);
|
|
46
56
|
}
|
|
47
57
|
|
|
@@ -58,6 +68,7 @@ export function createValidatorClient(
|
|
|
58
68
|
epochCache: EpochCache;
|
|
59
69
|
keyStoreManager: KeystoreManager | undefined;
|
|
60
70
|
blobClient: BlobClientInterface;
|
|
71
|
+
slashingProtectionDb?: SlashingProtectionDatabase;
|
|
61
72
|
},
|
|
62
73
|
) {
|
|
63
74
|
if (config.disableValidator || !deps.keyStoreManager) {
|
|
@@ -78,5 +89,6 @@ export function createValidatorClient(
|
|
|
78
89
|
deps.blobClient,
|
|
79
90
|
deps.dateProvider,
|
|
80
91
|
deps.telemetry,
|
|
92
|
+
deps.slashingProtectionDb,
|
|
81
93
|
);
|
|
82
94
|
}
|
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,
|
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
|
}
|