@aztec/validator-client 0.0.1-commit.e588bc7e5 → 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/dest/config.d.ts +1 -1
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +11 -5
- 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 +26 -38
- package/dest/factory.d.ts +1 -1
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +7 -2
- package/dest/metrics.d.ts +5 -1
- package/dest/metrics.d.ts.map +1 -1
- package/dest/metrics.js +12 -0
- package/dest/proposal_handler.d.ts +3 -2
- package/dest/proposal_handler.d.ts.map +1 -1
- package/dest/proposal_handler.js +37 -14
- package/dest/validator.d.ts +9 -8
- package/dest/validator.d.ts.map +1 -1
- package/dest/validator.js +32 -17
- package/package.json +19 -19
- package/src/config.ts +11 -4
- package/src/duties/validation_service.ts +45 -46
- package/src/factory.ts +6 -0
- package/src/metrics.ts +18 -0
- package/src/proposal_handler.ts +44 -19
- package/src/validator.ts +54 -20
package/dest/validator.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BlobClientInterface } from '@aztec/blob-client/client';
|
|
2
2
|
import type { EpochCache } from '@aztec/epoch-cache';
|
|
3
|
-
import {
|
|
3
|
+
import { CheckpointNumber, IndexWithinCheckpoint, SlotNumber } from '@aztec/foundation/branded-types';
|
|
4
4
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
5
5
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
6
6
|
import type { Signature } from '@aztec/foundation/eth-signature';
|
|
@@ -11,7 +11,7 @@ import type { P2P, PeerId } from '@aztec/p2p';
|
|
|
11
11
|
import { type Watcher, type WatcherEmitter } from '@aztec/slasher';
|
|
12
12
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
13
13
|
import type { CommitteeAttestationsAndSigners, L2BlockSink, L2BlockSource } from '@aztec/stdlib/block';
|
|
14
|
-
import type {
|
|
14
|
+
import type { ITxProvider, Validator, ValidatorClientFullConfig, WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
15
15
|
import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
16
16
|
import { type BlockProposal, type BlockProposalOptions, type CheckpointAttestation, CheckpointProposal, type CheckpointProposalCore, type CheckpointProposalOptions } from '@aztec/stdlib/p2p';
|
|
17
17
|
import type { CheckpointHeader } from '@aztec/stdlib/rollup';
|
|
@@ -63,6 +63,7 @@ export declare class ValidatorClient extends ValidatorClient_base implements Val
|
|
|
63
63
|
getValidatorAddresses(): EthAddress[];
|
|
64
64
|
getProposalHandler(): ProposalHandler;
|
|
65
65
|
signWithAddress(addr: EthAddress, msg: TypedDataDefinition, context: SigningContext): Promise<Signature>;
|
|
66
|
+
private getSignatureContext;
|
|
66
67
|
getCoinbaseForAttestor(attestor: EthAddress): EthAddress;
|
|
67
68
|
getFeeRecipientForAttestor(attestor: EthAddress): AztecAddress;
|
|
68
69
|
getConfig(): ValidatorClientFullConfig;
|
|
@@ -106,13 +107,13 @@ export declare class ValidatorClient extends ValidatorClient_base implements Val
|
|
|
106
107
|
* Emits a slash event when an attester signs attestations for different proposals at the same slot.
|
|
107
108
|
*/
|
|
108
109
|
private handleDuplicateAttestation;
|
|
109
|
-
createBlockProposal(blockHeader: BlockHeader, indexWithinCheckpoint: IndexWithinCheckpoint, inHash: Fr, archive: Fr, txs: Tx[], proposerAddress: EthAddress | undefined, options?: BlockProposalOptions): Promise<BlockProposal>;
|
|
110
|
-
createCheckpointProposal(checkpointHeader: CheckpointHeader, archive: Fr, feeAssetPriceModifier: bigint,
|
|
110
|
+
createBlockProposal(blockHeader: BlockHeader, checkpointNumber: CheckpointNumber, indexWithinCheckpoint: IndexWithinCheckpoint, inHash: Fr, archive: Fr, txs: Tx[], proposerAddress: EthAddress | undefined, options?: BlockProposalOptions): Promise<BlockProposal>;
|
|
111
|
+
createCheckpointProposal(checkpointHeader: CheckpointHeader, archive: Fr, checkpointNumber: CheckpointNumber, feeAssetPriceModifier: bigint, lastBlockProposal: BlockProposal | undefined, proposerAddress: EthAddress | undefined, options?: CheckpointProposalOptions): Promise<CheckpointProposal>;
|
|
111
112
|
broadcastBlockProposal(proposal: BlockProposal): Promise<void>;
|
|
112
|
-
signAttestationsAndSigners(attestationsAndSigners: CommitteeAttestationsAndSigners, proposer: EthAddress, slot: SlotNumber,
|
|
113
|
-
collectOwnAttestations(proposal: CheckpointProposal): Promise<CheckpointAttestation[]>;
|
|
114
|
-
collectAttestations(proposal: CheckpointProposal, required: number, deadline: Date): Promise<CheckpointAttestation[]>;
|
|
113
|
+
signAttestationsAndSigners(attestationsAndSigners: CommitteeAttestationsAndSigners, proposer: EthAddress, slot: SlotNumber, checkpointNumber: CheckpointNumber): Promise<Signature>;
|
|
114
|
+
collectOwnAttestations(proposal: CheckpointProposal, checkpointNumber: CheckpointNumber): Promise<CheckpointAttestation[]>;
|
|
115
|
+
collectAttestations(proposal: CheckpointProposal, required: number, deadline: Date, checkpointNumber: CheckpointNumber): Promise<CheckpointAttestation[]>;
|
|
115
116
|
private handleAuthRequest;
|
|
116
117
|
}
|
|
117
118
|
export {};
|
|
118
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
119
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmFsaWRhdG9yLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvdmFsaWRhdG9yLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLG1CQUFtQixFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFFckUsT0FBTyxLQUFLLEVBQUUsVUFBVSxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFDckQsT0FBTyxFQUFFLGdCQUFnQixFQ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|
|
1
|
-
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,
|
|
1
|
+
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAe,qBAAqB,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AACnH,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAGhF,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAmD,GAAG,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAE/F,OAAO,EAAoC,KAAK,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,+BAA+B,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEvG,OAAO,KAAK,EACV,WAAW,EACX,SAAS,EACT,yBAAyB,EACzB,sBAAsB,EACvB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,mBAAmB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AE,EACX,GAAG,EAAE,EAAE,EAAE,EACT,eAAe,EAAE,UAAU,GAAG,SAAS,EACvC,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,aAAa,CAAC,CAiCxB;IAEK,wBAAwB,CAC5B,gBAAgB,EAAE,gBAAgB,EAClC,OAAO,EAAE,EAAE,EACX,gBAAgB,EAAE,gBAAgB,EAClC,qBAAqB,EAAE,MAAM,EAC7B,iBAAiB,EAAE,aAAa,GAAG,SAAS,EAC5C,eAAe,EAAE,UAAU,GAAG,SAAS,EACvC,OAAO,GAAE,yBAA8B,GACtC,OAAO,CAAC,kBAAkB,CAAC,CA0B7B;IAEK,sBAAsB,CAAC,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAEnE;IAEK,0BAA0B,CAC9B,sBAAsB,EAAE,+BAA+B,EACvD,QAAQ,EAAE,UAAU,EACpB,IAAI,EAAE,UAAU,EAChB,gBAAgB,EAAE,gBAAgB,GACjC,OAAO,CAAC,SAAS,CAAC,CAOpB;IAEK,sBAAsB,CAC1B,QAAQ,EAAE,kBAAkB,EAC5B,gBAAgB,EAAE,gBAAgB,GACjC,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAiBlC;IAEK,mBAAmB,CACvB,QAAQ,EAAE,kBAAkB,EAC5B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,IAAI,EACd,gBAAgB,EAAE,gBAAgB,GACjC,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAmElC;YAEa,iBAAiB;CAwBhC"}
|
package/dest/validator.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getBlobsPerL1Block } from '@aztec/blob-lib';
|
|
2
|
+
import { CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
2
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
3
4
|
import { RunningPromise } from '@aztec/foundation/running-promise';
|
|
4
5
|
import { sleep } from '@aztec/foundation/sleep';
|
|
@@ -58,7 +59,7 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
58
59
|
this.log = config.fishermanMode ? log.createChild('[FISHERMAN]') : log;
|
|
59
60
|
this.tracer = telemetry.getTracer('Validator');
|
|
60
61
|
this.metrics = new ValidatorMetrics(telemetry);
|
|
61
|
-
this.validationService = new ValidationService(keyStore, this.log.createChild('validation-service'));
|
|
62
|
+
this.validationService = new ValidationService(keyStore, this.getSignatureContext(), this.log.createChild('validation-service'));
|
|
62
63
|
// Refresh epoch cache every second to trigger alert if participation in committee changes
|
|
63
64
|
this.epochCacheUpdateLoop = new RunningPromise(this.handleEpochCommitteeUpdate.bind(this), this.log, 1000);
|
|
64
65
|
const myAddresses = this.getValidatorAddresses();
|
|
@@ -112,9 +113,14 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
112
113
|
const metrics = new ValidatorMetrics(telemetry);
|
|
113
114
|
const blockProposalValidator = new BlockProposalValidator(epochCache, {
|
|
114
115
|
txsPermitted: !config.disableTransactions,
|
|
115
|
-
maxTxsPerBlock: config.validateMaxTxsPerBlock
|
|
116
|
+
maxTxsPerBlock: config.validateMaxTxsPerBlock,
|
|
117
|
+
maxBlocksPerCheckpoint: config.maxBlocksPerCheckpoint,
|
|
118
|
+
signatureContext: {
|
|
119
|
+
chainId: config.l1ChainId,
|
|
120
|
+
rollupAddress: config.l1Contracts.rollupAddress
|
|
121
|
+
}
|
|
116
122
|
});
|
|
117
|
-
const proposalHandler = new ProposalHandler(checkpointsBuilder, worldState, blockSource, l1ToL2MessageSource, txProvider, blockProposalValidator, epochCache, config, blobClient, metrics, dateProvider, telemetry);
|
|
123
|
+
const proposalHandler = new ProposalHandler(checkpointsBuilder, worldState, blockSource, l1ToL2MessageSource, txProvider, blockProposalValidator, epochCache, config, blobClient, metrics, dateProvider, telemetry, undefined);
|
|
118
124
|
const nodeKeystoreAdapter = NodeKeystoreAdapter.fromKeyStoreManager(keyStoreManager);
|
|
119
125
|
let slashingProtectionSigner;
|
|
120
126
|
if (slashingProtectionDb) {
|
|
@@ -155,6 +161,12 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
155
161
|
signWithAddress(addr, msg, context) {
|
|
156
162
|
return this.keyStore.signTypedDataWithAddress(addr, msg, context);
|
|
157
163
|
}
|
|
164
|
+
getSignatureContext() {
|
|
165
|
+
return {
|
|
166
|
+
chainId: this.config.l1ChainId,
|
|
167
|
+
rollupAddress: this.config.l1Contracts.rollupAddress
|
|
168
|
+
};
|
|
169
|
+
}
|
|
158
170
|
getCoinbaseForAttestor(attestor) {
|
|
159
171
|
return this.keyStore.getCoinbaseAddress(attestor);
|
|
160
172
|
}
|
|
@@ -173,7 +185,7 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
173
185
|
reloadKeystore(newManager) {
|
|
174
186
|
const newAdapter = NodeKeystoreAdapter.fromKeyStoreManager(newManager);
|
|
175
187
|
this.keyStore = new HAKeyStore(newAdapter, this.slashingProtectionSigner);
|
|
176
|
-
this.validationService = new ValidationService(this.keyStore, this.log.createChild('validation-service'));
|
|
188
|
+
this.validationService = new ValidationService(this.keyStore, this.getSignatureContext(), this.log.createChild('validation-service'));
|
|
177
189
|
}
|
|
178
190
|
async start() {
|
|
179
191
|
if (this.epochCacheUpdateLoop.isRunning()) {
|
|
@@ -330,14 +342,17 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
330
342
|
});
|
|
331
343
|
// Validate the checkpoint proposal before attesting (unless skipCheckpointProposalValidation is set).
|
|
332
344
|
// Uses the cached result from the all-nodes callback if available (avoids double validation).
|
|
345
|
+
let checkpointNumber;
|
|
333
346
|
if (this.config.skipCheckpointProposalValidation) {
|
|
334
347
|
this.log.warn(`Skipping checkpoint proposal validation for slot ${proposalSlotNumber}`, proposalInfo);
|
|
348
|
+
checkpointNumber = CheckpointNumber(0);
|
|
335
349
|
} else {
|
|
336
350
|
const validationResult = await this.proposalHandler.handleCheckpointProposal(proposal, proposalInfo);
|
|
337
351
|
if (!validationResult.isValid) {
|
|
338
352
|
this.log.warn(`Checkpoint proposal validation failed: ${validationResult.reason}`, proposalInfo);
|
|
339
353
|
return undefined;
|
|
340
354
|
}
|
|
355
|
+
checkpointNumber = validationResult.checkpointNumber;
|
|
341
356
|
}
|
|
342
357
|
// Check that I have any address in current committee before attesting
|
|
343
358
|
// In fisherman mode, we still create attestations for validation even if not in committee
|
|
@@ -384,7 +399,7 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
384
399
|
});
|
|
385
400
|
return undefined;
|
|
386
401
|
}
|
|
387
|
-
return await this.createCheckpointAttestationsFromProposal(proposal, attestors);
|
|
402
|
+
return await this.createCheckpointAttestationsFromProposal(proposal, attestors, checkpointNumber);
|
|
388
403
|
}
|
|
389
404
|
/**
|
|
390
405
|
* Checks if we should attest to a slot based on equivocation prevention rules.
|
|
@@ -401,12 +416,12 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
401
416
|
}
|
|
402
417
|
return true;
|
|
403
418
|
}
|
|
404
|
-
async createCheckpointAttestationsFromProposal(proposal, attestors = []) {
|
|
419
|
+
async createCheckpointAttestationsFromProposal(proposal, attestors = [], checkpointNumber) {
|
|
405
420
|
// Equivocation check: must happen right before signing to minimize the race window
|
|
406
421
|
if (!this.shouldAttestToSlot(proposal.slotNumber)) {
|
|
407
422
|
return undefined;
|
|
408
423
|
}
|
|
409
|
-
const attestations = await this.validationService.attestToCheckpointProposal(proposal, attestors);
|
|
424
|
+
const attestations = await this.validationService.attestToCheckpointProposal(proposal, attestors, checkpointNumber);
|
|
410
425
|
// Track the proposal we attested to (to prevent equivocation)
|
|
411
426
|
this.lastAttestedProposal = proposal;
|
|
412
427
|
await this.p2pClient.addOwnCheckpointAttestations(attestations);
|
|
@@ -497,7 +512,7 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
497
512
|
}
|
|
498
513
|
]);
|
|
499
514
|
}
|
|
500
|
-
async createBlockProposal(blockHeader, indexWithinCheckpoint, inHash, archive, txs, proposerAddress, options = {}) {
|
|
515
|
+
async createBlockProposal(blockHeader, checkpointNumber, indexWithinCheckpoint, inHash, archive, txs, proposerAddress, options = {}) {
|
|
501
516
|
// Validate that we're not creating a proposal for an older or equal position
|
|
502
517
|
if (this.lastProposedBlock) {
|
|
503
518
|
const lastSlot = this.lastProposedBlock.slotNumber;
|
|
@@ -508,14 +523,14 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
508
523
|
}
|
|
509
524
|
}
|
|
510
525
|
this.log.info(`Assembling block proposal for block ${blockHeader.globalVariables.blockNumber} slot ${blockHeader.globalVariables.slotNumber}`);
|
|
511
|
-
const newProposal = await this.validationService.createBlockProposal(blockHeader, indexWithinCheckpoint, inHash, archive, txs, proposerAddress, {
|
|
526
|
+
const newProposal = await this.validationService.createBlockProposal(blockHeader, checkpointNumber, indexWithinCheckpoint, inHash, archive, txs, proposerAddress, {
|
|
512
527
|
...options,
|
|
513
528
|
broadcastInvalidBlockProposal: this.config.broadcastInvalidBlockProposal
|
|
514
529
|
});
|
|
515
530
|
this.lastProposedBlock = newProposal;
|
|
516
531
|
return newProposal;
|
|
517
532
|
}
|
|
518
|
-
async createCheckpointProposal(checkpointHeader, archive, feeAssetPriceModifier,
|
|
533
|
+
async createCheckpointProposal(checkpointHeader, archive, checkpointNumber, feeAssetPriceModifier, lastBlockProposal, proposerAddress, options = {}) {
|
|
519
534
|
// Validate that we're not creating a proposal for an older or equal slot
|
|
520
535
|
if (this.lastProposedCheckpoint) {
|
|
521
536
|
const lastSlot = this.lastProposedCheckpoint.slotNumber;
|
|
@@ -525,23 +540,23 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
525
540
|
}
|
|
526
541
|
}
|
|
527
542
|
this.log.info(`Assembling checkpoint proposal for slot ${checkpointHeader.slotNumber}`);
|
|
528
|
-
const newProposal = await this.validationService.createCheckpointProposal(checkpointHeader, archive, feeAssetPriceModifier,
|
|
543
|
+
const newProposal = await this.validationService.createCheckpointProposal(checkpointHeader, archive, checkpointNumber, feeAssetPriceModifier, lastBlockProposal, proposerAddress, options);
|
|
529
544
|
this.lastProposedCheckpoint = newProposal;
|
|
530
545
|
return newProposal;
|
|
531
546
|
}
|
|
532
547
|
async broadcastBlockProposal(proposal) {
|
|
533
548
|
await this.p2pClient.broadcastProposal(proposal);
|
|
534
549
|
}
|
|
535
|
-
async signAttestationsAndSigners(attestationsAndSigners, proposer, slot,
|
|
536
|
-
return await this.validationService.signAttestationsAndSigners(attestationsAndSigners, proposer, slot,
|
|
550
|
+
async signAttestationsAndSigners(attestationsAndSigners, proposer, slot, checkpointNumber) {
|
|
551
|
+
return await this.validationService.signAttestationsAndSigners(attestationsAndSigners, proposer, slot, checkpointNumber);
|
|
537
552
|
}
|
|
538
|
-
async collectOwnAttestations(proposal) {
|
|
553
|
+
async collectOwnAttestations(proposal, checkpointNumber) {
|
|
539
554
|
const slot = proposal.slotNumber;
|
|
540
555
|
const inCommittee = await this.epochCache.filterInCommittee(slot, this.getValidatorAddresses());
|
|
541
556
|
this.log.debug(`Collecting ${inCommittee.length} self-attestations for slot ${slot}`, {
|
|
542
557
|
inCommittee
|
|
543
558
|
});
|
|
544
|
-
const attestations = await this.createCheckpointAttestationsFromProposal(proposal, inCommittee);
|
|
559
|
+
const attestations = await this.createCheckpointAttestationsFromProposal(proposal, inCommittee, checkpointNumber);
|
|
545
560
|
if (!attestations) {
|
|
546
561
|
return [];
|
|
547
562
|
}
|
|
@@ -553,7 +568,7 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
553
568
|
});
|
|
554
569
|
return attestations;
|
|
555
570
|
}
|
|
556
|
-
async collectAttestations(proposal, required, deadline) {
|
|
571
|
+
async collectAttestations(proposal, required, deadline, checkpointNumber) {
|
|
557
572
|
// Wait and poll the p2pClient's attestation pool for this checkpoint until we have enough attestations
|
|
558
573
|
const slot = proposal.slotNumber;
|
|
559
574
|
this.log.debug(`Collecting ${required} attestations for slot ${slot} with deadline ${deadline.toISOString()}`);
|
|
@@ -561,7 +576,7 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
561
576
|
this.log.error(`Deadline ${deadline.toISOString()} for collecting ${required} attestations for slot ${slot} is in the past`);
|
|
562
577
|
throw new AttestationTimeoutError(0, required, slot);
|
|
563
578
|
}
|
|
564
|
-
await this.collectOwnAttestations(proposal);
|
|
579
|
+
await this.collectOwnAttestations(proposal, checkpointNumber);
|
|
565
580
|
const proposalId = proposal.archive.toString();
|
|
566
581
|
const myAddresses = this.getValidatorAddresses();
|
|
567
582
|
let attestations = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/validator-client",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.e5a3663dd",
|
|
4
4
|
"main": "dest/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -64,30 +64,30 @@
|
|
|
64
64
|
]
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@aztec/blob-client": "0.0.1-commit.
|
|
68
|
-
"@aztec/blob-lib": "0.0.1-commit.
|
|
69
|
-
"@aztec/constants": "0.0.1-commit.
|
|
70
|
-
"@aztec/epoch-cache": "0.0.1-commit.
|
|
71
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
72
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
73
|
-
"@aztec/node-keystore": "0.0.1-commit.
|
|
74
|
-
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.
|
|
75
|
-
"@aztec/p2p": "0.0.1-commit.
|
|
76
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
77
|
-
"@aztec/prover-client": "0.0.1-commit.
|
|
78
|
-
"@aztec/simulator": "0.0.1-commit.
|
|
79
|
-
"@aztec/slasher": "0.0.1-commit.
|
|
80
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
81
|
-
"@aztec/telemetry-client": "0.0.1-commit.
|
|
82
|
-
"@aztec/validator-ha-signer": "0.0.1-commit.
|
|
67
|
+
"@aztec/blob-client": "0.0.1-commit.e5a3663dd",
|
|
68
|
+
"@aztec/blob-lib": "0.0.1-commit.e5a3663dd",
|
|
69
|
+
"@aztec/constants": "0.0.1-commit.e5a3663dd",
|
|
70
|
+
"@aztec/epoch-cache": "0.0.1-commit.e5a3663dd",
|
|
71
|
+
"@aztec/ethereum": "0.0.1-commit.e5a3663dd",
|
|
72
|
+
"@aztec/foundation": "0.0.1-commit.e5a3663dd",
|
|
73
|
+
"@aztec/node-keystore": "0.0.1-commit.e5a3663dd",
|
|
74
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.e5a3663dd",
|
|
75
|
+
"@aztec/p2p": "0.0.1-commit.e5a3663dd",
|
|
76
|
+
"@aztec/protocol-contracts": "0.0.1-commit.e5a3663dd",
|
|
77
|
+
"@aztec/prover-client": "0.0.1-commit.e5a3663dd",
|
|
78
|
+
"@aztec/simulator": "0.0.1-commit.e5a3663dd",
|
|
79
|
+
"@aztec/slasher": "0.0.1-commit.e5a3663dd",
|
|
80
|
+
"@aztec/stdlib": "0.0.1-commit.e5a3663dd",
|
|
81
|
+
"@aztec/telemetry-client": "0.0.1-commit.e5a3663dd",
|
|
82
|
+
"@aztec/validator-ha-signer": "0.0.1-commit.e5a3663dd",
|
|
83
83
|
"koa": "^2.16.1",
|
|
84
84
|
"koa-router": "^13.1.1",
|
|
85
85
|
"tslib": "^2.4.0",
|
|
86
86
|
"viem": "npm:@aztec/viem@2.38.2"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
|
-
"@aztec/archiver": "0.0.1-commit.
|
|
90
|
-
"@aztec/world-state": "0.0.1-commit.
|
|
89
|
+
"@aztec/archiver": "0.0.1-commit.e5a3663dd",
|
|
90
|
+
"@aztec/world-state": "0.0.1-commit.e5a3663dd",
|
|
91
91
|
"@electric-sql/pglite": "^0.3.14",
|
|
92
92
|
"@jest/globals": "^30.0.0",
|
|
93
93
|
"@types/jest": "^30.0.0",
|
package/src/config.ts
CHANGED
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
booleanConfigHelper,
|
|
4
4
|
getConfigFromMappings,
|
|
5
5
|
numberConfigHelper,
|
|
6
|
+
optionalNumberConfigHelper,
|
|
6
7
|
secretValueConfigHelper,
|
|
7
8
|
} from '@aztec/foundation/config';
|
|
8
9
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
@@ -30,6 +31,12 @@ export const validatorClientConfigMappings: ConfigMappingsType<ValidatorClientCo
|
|
|
30
31
|
.map(address => EthAddress.fromString(address.trim())),
|
|
31
32
|
defaultValue: [],
|
|
32
33
|
},
|
|
34
|
+
l1ChainId: {
|
|
35
|
+
env: 'L1_CHAIN_ID',
|
|
36
|
+
description: 'The chain ID of the ethereum host.',
|
|
37
|
+
parseEnv: (val: string) => +val,
|
|
38
|
+
defaultValue: 31337,
|
|
39
|
+
},
|
|
33
40
|
disableValidator: {
|
|
34
41
|
env: 'VALIDATOR_DISABLED',
|
|
35
42
|
description: 'Do not run the validator',
|
|
@@ -75,22 +82,22 @@ export const validatorClientConfigMappings: ConfigMappingsType<ValidatorClientCo
|
|
|
75
82
|
validateMaxL2BlockGas: {
|
|
76
83
|
env: 'VALIDATOR_MAX_L2_BLOCK_GAS',
|
|
77
84
|
description: 'Maximum L2 block gas for validation. Proposals exceeding this limit are rejected.',
|
|
78
|
-
|
|
85
|
+
...optionalNumberConfigHelper(),
|
|
79
86
|
},
|
|
80
87
|
validateMaxDABlockGas: {
|
|
81
88
|
env: 'VALIDATOR_MAX_DA_BLOCK_GAS',
|
|
82
89
|
description: 'Maximum DA block gas for validation. Proposals exceeding this limit are rejected.',
|
|
83
|
-
|
|
90
|
+
...optionalNumberConfigHelper(),
|
|
84
91
|
},
|
|
85
92
|
validateMaxTxsPerBlock: {
|
|
86
93
|
env: 'VALIDATOR_MAX_TX_PER_BLOCK',
|
|
87
94
|
description: 'Maximum transactions per block for validation. Proposals exceeding this limit are rejected.',
|
|
88
|
-
|
|
95
|
+
...optionalNumberConfigHelper(),
|
|
89
96
|
},
|
|
90
97
|
validateMaxTxsPerCheckpoint: {
|
|
91
98
|
env: 'VALIDATOR_MAX_TX_PER_CHECKPOINT',
|
|
92
99
|
description: 'Maximum transactions per checkpoint for validation. Proposals exceeding this limit are rejected.',
|
|
93
|
-
|
|
100
|
+
...optionalNumberConfigHelper(),
|
|
94
101
|
},
|
|
95
102
|
...localSignerConfigMappings,
|
|
96
103
|
...validatorHASignerConfigMappings,
|
|
@@ -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,36 +99,36 @@ export class ValidationService {
|
|
|
95
99
|
public createCheckpointProposal(
|
|
96
100
|
checkpointHeader: CheckpointHeader,
|
|
97
101
|
archive: Fr,
|
|
102
|
+
checkpointNumber: CheckpointNumber,
|
|
98
103
|
feeAssetPriceModifier: bigint,
|
|
99
|
-
|
|
104
|
+
lastBlockProposal: BlockProposal | undefined,
|
|
100
105
|
proposerAttesterAddress: EthAddress | undefined,
|
|
101
106
|
options: CheckpointProposalOptions,
|
|
102
107
|
): Promise<CheckpointProposal> {
|
|
103
|
-
// 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.
|
|
104
111
|
if (options.broadcastInvalidCheckpointProposal) {
|
|
105
|
-
archive = Fr.random();
|
|
112
|
+
archive = lastBlockProposal?.archiveRoot ?? Fr.random();
|
|
106
113
|
this.log.warn(`Creating INVALID checkpoint proposal for slot ${checkpointHeader.slotNumber}`);
|
|
107
114
|
}
|
|
108
115
|
|
|
109
116
|
// Create a signer that takes payload and context, and uses the appropriate address
|
|
110
|
-
const payloadSigner = (
|
|
117
|
+
const payloadSigner = (
|
|
118
|
+
typedData: Parameters<ValidatorKeyStore['signTypedDataWithAddress']>[1],
|
|
119
|
+
context: SigningContext,
|
|
120
|
+
) => {
|
|
111
121
|
const address = proposerAttesterAddress ?? this.keyStore.getAddress(0);
|
|
112
|
-
return this.keyStore.
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
// Last block to include in the proposal
|
|
116
|
-
const lastBlock = lastBlockInfo && {
|
|
117
|
-
blockHeader: lastBlockInfo.blockHeader,
|
|
118
|
-
indexWithinCheckpoint: lastBlockInfo.indexWithinCheckpoint,
|
|
119
|
-
txHashes: lastBlockInfo.txs.map(tx => tx.getTxHash()),
|
|
120
|
-
txs: options.publishFullTxs ? lastBlockInfo.txs : undefined,
|
|
122
|
+
return this.keyStore.signTypedDataWithAddress(address, typedData, context);
|
|
121
123
|
};
|
|
122
124
|
|
|
123
125
|
return CheckpointProposal.createProposalFromSigner(
|
|
124
126
|
checkpointHeader,
|
|
125
127
|
archive,
|
|
128
|
+
checkpointNumber,
|
|
126
129
|
feeAssetPriceModifier,
|
|
127
|
-
|
|
130
|
+
lastBlockProposal,
|
|
131
|
+
this.signatureContext,
|
|
128
132
|
payloadSigner,
|
|
129
133
|
);
|
|
130
134
|
}
|
|
@@ -142,29 +146,27 @@ export class ValidationService {
|
|
|
142
146
|
async attestToCheckpointProposal(
|
|
143
147
|
proposal: CheckpointProposalCore,
|
|
144
148
|
attestors: EthAddress[],
|
|
149
|
+
checkpointNumber: CheckpointNumber,
|
|
145
150
|
): Promise<CheckpointAttestation[]> {
|
|
146
151
|
// Create the attestation payload from the checkpoint proposal
|
|
147
|
-
const payload = new ConsensusPayload(
|
|
148
|
-
|
|
149
|
-
|
|
152
|
+
const payload = new ConsensusPayload(
|
|
153
|
+
proposal.checkpointHeader,
|
|
154
|
+
proposal.archive,
|
|
155
|
+
proposal.feeAssetPriceModifier,
|
|
156
|
+
this.signatureContext,
|
|
150
157
|
);
|
|
158
|
+
const typedData = getCoordinationSignatureTypedData(payload);
|
|
151
159
|
|
|
152
|
-
// TODO(spy/ha): Use checkpointNumber instead of blockNumber once CheckpointHeader includes it.
|
|
153
|
-
// CheckpointProposalCore doesn't have lastBlock info, so use 0 as a proxy.
|
|
154
|
-
// blockNumber is NOT used for the primary key so it's safe to use here.
|
|
155
|
-
// See CheckpointHeader TODO and SigningContext types documentation.
|
|
156
|
-
const blockNumber = BlockNumber(0);
|
|
157
160
|
const context: SigningContext = {
|
|
158
161
|
slot: proposal.slotNumber,
|
|
159
|
-
|
|
162
|
+
checkpointNumber,
|
|
160
163
|
dutyType: DutyType.ATTESTATION,
|
|
161
164
|
};
|
|
162
165
|
|
|
163
166
|
// Sign each attestor in parallel, catching HA errors per-attestor
|
|
164
167
|
const results = await Promise.allSettled(
|
|
165
168
|
attestors.map(async attestor => {
|
|
166
|
-
const sig = await this.keyStore.
|
|
167
|
-
// return new BlockAttestation(proposal.payload, sig, proposal.signature);
|
|
169
|
+
const sig = await this.keyStore.signTypedDataWithAddress(attestor, typedData, context);
|
|
168
170
|
return new CheckpointAttestation(payload, sig, proposal.signature);
|
|
169
171
|
}),
|
|
170
172
|
);
|
|
@@ -195,7 +197,6 @@ export class ValidationService {
|
|
|
195
197
|
* @param attestationsAndSigners - The attestations and signers to sign
|
|
196
198
|
* @param proposer - The proposer address to sign with
|
|
197
199
|
* @param slot - The slot number for HA signing context
|
|
198
|
-
* @param blockNumber - The block or checkpoint number for HA signing context
|
|
199
200
|
* @returns signature
|
|
200
201
|
* @throws DutyAlreadySignedError if already signed by another HA node
|
|
201
202
|
* @throws SlashingProtectionError if attempting to sign different data for same slot
|
|
@@ -204,17 +205,15 @@ export class ValidationService {
|
|
|
204
205
|
attestationsAndSigners: CommitteeAttestationsAndSigners,
|
|
205
206
|
proposer: EthAddress,
|
|
206
207
|
slot: SlotNumber,
|
|
207
|
-
|
|
208
|
+
checkpointNumber: CheckpointNumber,
|
|
208
209
|
): Promise<Signature> {
|
|
209
210
|
const context: SigningContext = {
|
|
210
211
|
slot,
|
|
211
|
-
|
|
212
|
+
checkpointNumber,
|
|
212
213
|
dutyType: DutyType.ATTESTATIONS_AND_SIGNERS,
|
|
213
214
|
};
|
|
214
215
|
|
|
215
|
-
const
|
|
216
|
-
|
|
217
|
-
);
|
|
218
|
-
return this.keyStore.signMessageWithAddress(proposer, buf, context);
|
|
216
|
+
const typedData = getCoordinationSignatureTypedData(attestationsAndSigners);
|
|
217
|
+
return this.keyStore.signTypedDataWithAddress(proposer, typedData, context);
|
|
219
218
|
}
|
|
220
219
|
}
|
package/src/factory.ts
CHANGED
|
@@ -32,6 +32,11 @@ export function createProposalHandler(
|
|
|
32
32
|
const blockProposalValidator = new BlockProposalValidator(deps.epochCache, {
|
|
33
33
|
txsPermitted: !config.disableTransactions,
|
|
34
34
|
maxTxsPerBlock: config.validateMaxTxsPerBlock ?? config.validateMaxTxsPerCheckpoint,
|
|
35
|
+
maxBlocksPerCheckpoint: config.maxBlocksPerCheckpoint,
|
|
36
|
+
signatureContext: {
|
|
37
|
+
chainId: config.l1ChainId,
|
|
38
|
+
rollupAddress: config.l1Contracts.rollupAddress,
|
|
39
|
+
},
|
|
35
40
|
});
|
|
36
41
|
return new ProposalHandler(
|
|
37
42
|
deps.checkpointsBuilder,
|
|
@@ -46,6 +51,7 @@ export function createProposalHandler(
|
|
|
46
51
|
metrics,
|
|
47
52
|
deps.dateProvider,
|
|
48
53
|
deps.telemetry,
|
|
54
|
+
undefined,
|
|
49
55
|
);
|
|
50
56
|
}
|
|
51
57
|
|
package/src/metrics.ts
CHANGED
|
@@ -24,6 +24,8 @@ export class ValidatorMetrics {
|
|
|
24
24
|
private reexMana: Histogram;
|
|
25
25
|
private reexTx: Histogram;
|
|
26
26
|
private reexDuration: Gauge;
|
|
27
|
+
private checkpointProposalToPipelinedStateDuration: Histogram;
|
|
28
|
+
private checkpointProposalReceiveOffsetFromNextSlotBoundary: Histogram;
|
|
27
29
|
|
|
28
30
|
constructor(telemetryClient: TelemetryClient) {
|
|
29
31
|
const meter = telemetryClient.getMeter('Validator');
|
|
@@ -77,6 +79,12 @@ export class ValidatorMetrics {
|
|
|
77
79
|
this.reexTx = meter.createHistogram(Metrics.VALIDATOR_RE_EXECUTION_TX_COUNT);
|
|
78
80
|
|
|
79
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
|
+
);
|
|
80
88
|
}
|
|
81
89
|
|
|
82
90
|
public recordReex(time: number, txs: number, mManaTotal: number) {
|
|
@@ -85,6 +93,16 @@ export class ValidatorMetrics {
|
|
|
85
93
|
this.reexMana.record(mManaTotal);
|
|
86
94
|
}
|
|
87
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
|
+
|
|
88
106
|
public recordFailedReexecution(proposal: BlockProposal) {
|
|
89
107
|
const proposer = proposal.getSender();
|
|
90
108
|
this.failedReexecutionCounter.add(1, {
|