@aztec/sequencer-client 0.0.1-commit.1142ef1 → 0.0.1-commit.125b3452
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/client/sequencer-client.d.ts +24 -7
- package/dest/client/sequencer-client.d.ts.map +1 -1
- package/dest/client/sequencer-client.js +101 -16
- package/dest/config.d.ts +25 -6
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +49 -30
- package/dest/global_variable_builder/global_builder.d.ts +2 -4
- package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
- package/dest/global_variable_builder/global_builder.js +7 -6
- package/dest/index.d.ts +2 -2
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -1
- package/dest/publisher/config.d.ts +35 -17
- package/dest/publisher/config.d.ts.map +1 -1
- package/dest/publisher/config.js +106 -42
- package/dest/publisher/index.d.ts +2 -1
- package/dest/publisher/index.d.ts.map +1 -1
- package/dest/publisher/l1_tx_failed_store/factory.d.ts +11 -0
- package/dest/publisher/l1_tx_failed_store/factory.d.ts.map +1 -0
- package/dest/publisher/l1_tx_failed_store/factory.js +22 -0
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts +59 -0
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts.map +1 -0
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.js +1 -0
- package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.d.ts +15 -0
- package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.d.ts.map +1 -0
- package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.js +34 -0
- package/dest/publisher/l1_tx_failed_store/index.d.ts +4 -0
- package/dest/publisher/l1_tx_failed_store/index.d.ts.map +1 -0
- package/dest/publisher/l1_tx_failed_store/index.js +2 -0
- package/dest/publisher/sequencer-publisher-factory.d.ts +11 -3
- package/dest/publisher/sequencer-publisher-factory.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher-factory.js +27 -2
- package/dest/publisher/sequencer-publisher-metrics.d.ts +1 -1
- package/dest/publisher/sequencer-publisher-metrics.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher-metrics.js +12 -4
- package/dest/publisher/sequencer-publisher.d.ts +26 -8
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +349 -49
- package/dest/sequencer/checkpoint_proposal_job.d.ts +33 -10
- package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -1
- package/dest/sequencer/checkpoint_proposal_job.js +217 -66
- package/dest/sequencer/checkpoint_voter.d.ts +3 -2
- package/dest/sequencer/checkpoint_voter.d.ts.map +1 -1
- package/dest/sequencer/checkpoint_voter.js +34 -10
- package/dest/sequencer/index.d.ts +1 -2
- package/dest/sequencer/index.d.ts.map +1 -1
- package/dest/sequencer/index.js +0 -1
- package/dest/sequencer/metrics.d.ts +17 -5
- package/dest/sequencer/metrics.d.ts.map +1 -1
- package/dest/sequencer/metrics.js +111 -30
- package/dest/sequencer/sequencer.d.ts +42 -19
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +107 -50
- package/dest/sequencer/timetable.d.ts +4 -6
- package/dest/sequencer/timetable.d.ts.map +1 -1
- package/dest/sequencer/timetable.js +7 -11
- package/dest/sequencer/types.d.ts +2 -2
- package/dest/sequencer/types.d.ts.map +1 -1
- package/dest/test/index.d.ts +3 -5
- package/dest/test/index.d.ts.map +1 -1
- package/dest/test/mock_checkpoint_builder.d.ts +27 -19
- package/dest/test/mock_checkpoint_builder.d.ts.map +1 -1
- package/dest/test/mock_checkpoint_builder.js +67 -38
- package/dest/test/utils.d.ts +8 -8
- package/dest/test/utils.d.ts.map +1 -1
- package/dest/test/utils.js +12 -11
- package/package.json +29 -28
- package/src/client/sequencer-client.ts +135 -18
- package/src/config.ts +65 -41
- package/src/global_variable_builder/global_builder.ts +6 -5
- package/src/index.ts +1 -6
- package/src/publisher/config.ts +121 -43
- package/src/publisher/index.ts +3 -0
- package/src/publisher/l1_tx_failed_store/factory.ts +32 -0
- package/src/publisher/l1_tx_failed_store/failed_tx_store.ts +55 -0
- package/src/publisher/l1_tx_failed_store/file_store_failed_tx_store.ts +46 -0
- package/src/publisher/l1_tx_failed_store/index.ts +3 -0
- package/src/publisher/sequencer-publisher-factory.ts +38 -6
- package/src/publisher/sequencer-publisher-metrics.ts +7 -3
- package/src/publisher/sequencer-publisher.ts +344 -61
- package/src/sequencer/checkpoint_proposal_job.ts +306 -81
- package/src/sequencer/checkpoint_voter.ts +32 -7
- package/src/sequencer/index.ts +0 -1
- package/src/sequencer/metrics.ts +124 -32
- package/src/sequencer/sequencer.ts +131 -53
- package/src/sequencer/timetable.ts +13 -12
- package/src/sequencer/types.ts +1 -1
- package/src/test/index.ts +2 -4
- package/src/test/mock_checkpoint_builder.ts +122 -78
- package/src/test/utils.ts +24 -14
- package/dest/sequencer/block_builder.d.ts +0 -26
- package/dest/sequencer/block_builder.d.ts.map +0 -1
- package/dest/sequencer/block_builder.js +0 -129
- package/src/sequencer/block_builder.ts +0 -216
|
@@ -436,21 +436,24 @@ function _apply_decs_2203_r(targetClass, memberDecs, classDecs, parentClass) {
|
|
|
436
436
|
return (_apply_decs_2203_r = applyDecs2203RFactory())(targetClass, memberDecs, classDecs, parentClass);
|
|
437
437
|
}
|
|
438
438
|
var _dec, _dec1, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _initProto;
|
|
439
|
-
import {
|
|
440
|
-
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
439
|
+
import { BlockNumber, IndexWithinCheckpoint } from '@aztec/foundation/branded-types';
|
|
441
440
|
import { randomInt } from '@aztec/foundation/crypto/random';
|
|
442
|
-
import {
|
|
441
|
+
import { flipSignature, generateRecoverableSignature, generateUnrecoverableSignature } from '@aztec/foundation/crypto/secp256k1-signer';
|
|
443
442
|
import { filter } from '@aztec/foundation/iterator';
|
|
443
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
444
444
|
import { sleep, sleepUntil } from '@aztec/foundation/sleep';
|
|
445
445
|
import { Timer } from '@aztec/foundation/timer';
|
|
446
|
-
import { unfreeze } from '@aztec/foundation/types';
|
|
446
|
+
import { isErrorClass, unfreeze } from '@aztec/foundation/types';
|
|
447
447
|
import { CommitteeAttestationsAndSigners, MaliciousCommitteeAttestationsAndSigners } from '@aztec/stdlib/block';
|
|
448
|
+
import { validateCheckpoint } from '@aztec/stdlib/checkpoint';
|
|
448
449
|
import { getSlotStartBuildTimestamp } from '@aztec/stdlib/epoch-helpers';
|
|
449
450
|
import { Gas } from '@aztec/stdlib/gas';
|
|
451
|
+
import { InsufficientValidTxsError } from '@aztec/stdlib/interfaces/server';
|
|
450
452
|
import { computeInHashFromL1ToL2Messages } from '@aztec/stdlib/messaging';
|
|
451
|
-
import { orderAttestations } from '@aztec/stdlib/p2p';
|
|
453
|
+
import { orderAttestations, trimAttestations } from '@aztec/stdlib/p2p';
|
|
452
454
|
import { AttestationTimeoutError } from '@aztec/stdlib/validators';
|
|
453
455
|
import { Attributes, trackSpan } from '@aztec/telemetry-client';
|
|
456
|
+
import { DutyAlreadySignedError, SlashingProtectionError } from '@aztec/validator-ha-signer/errors';
|
|
454
457
|
import { CheckpointVoter } from './checkpoint_voter.js';
|
|
455
458
|
import { SequencerInterruptedError } from './errors.js';
|
|
456
459
|
import { SequencerState } from './utils.js';
|
|
@@ -468,6 +471,7 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
468
471
|
* as well as enqueueing votes for slashing and governance proposals. This class is created from
|
|
469
472
|
* the Sequencer once the check for being the proposer for the slot has succeeded.
|
|
470
473
|
*/ export class CheckpointProposalJob {
|
|
474
|
+
epoch;
|
|
471
475
|
slot;
|
|
472
476
|
checkpointNumber;
|
|
473
477
|
syncedToBlockNumber;
|
|
@@ -480,6 +484,7 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
480
484
|
p2pClient;
|
|
481
485
|
worldState;
|
|
482
486
|
l1ToL2MessageSource;
|
|
487
|
+
l2BlockSource;
|
|
483
488
|
checkpointsBuilder;
|
|
484
489
|
blockSink;
|
|
485
490
|
l1Constants;
|
|
@@ -491,7 +496,6 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
491
496
|
metrics;
|
|
492
497
|
eventEmitter;
|
|
493
498
|
setStateFn;
|
|
494
|
-
log;
|
|
495
499
|
tracer;
|
|
496
500
|
static{
|
|
497
501
|
({ e: [_initProto] } = _apply_decs_2203_r(this, [
|
|
@@ -537,8 +541,10 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
537
541
|
]
|
|
538
542
|
], []));
|
|
539
543
|
}
|
|
540
|
-
|
|
541
|
-
|
|
544
|
+
log;
|
|
545
|
+
constructor(epoch, slot, checkpointNumber, syncedToBlockNumber, // TODO(palla/mbps): Can we remove the proposer in favor of attestorAddress? Need to check fisherman-node flows.
|
|
546
|
+
proposer, publisher, attestorAddress, invalidateCheckpoint, validatorClient, globalsBuilder, p2pClient, worldState, l1ToL2MessageSource, l2BlockSource, checkpointsBuilder, blockSink, l1Constants, config, timetable, slasherClient, epochCache, dateProvider, metrics, eventEmitter, setStateFn, tracer, bindings){
|
|
547
|
+
this.epoch = epoch;
|
|
542
548
|
this.slot = slot;
|
|
543
549
|
this.checkpointNumber = checkpointNumber;
|
|
544
550
|
this.syncedToBlockNumber = syncedToBlockNumber;
|
|
@@ -551,6 +557,7 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
551
557
|
this.p2pClient = p2pClient;
|
|
552
558
|
this.worldState = worldState;
|
|
553
559
|
this.l1ToL2MessageSource = l1ToL2MessageSource;
|
|
560
|
+
this.l2BlockSource = l2BlockSource;
|
|
554
561
|
this.checkpointsBuilder = checkpointsBuilder;
|
|
555
562
|
this.blockSink = blockSink;
|
|
556
563
|
this.l1Constants = l1Constants;
|
|
@@ -562,9 +569,12 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
562
569
|
this.metrics = metrics;
|
|
563
570
|
this.eventEmitter = eventEmitter;
|
|
564
571
|
this.setStateFn = setStateFn;
|
|
565
|
-
this.log = log;
|
|
566
572
|
this.tracer = tracer;
|
|
567
573
|
_initProto(this);
|
|
574
|
+
this.log = createLogger('sequencer:checkpoint-proposal', {
|
|
575
|
+
...bindings,
|
|
576
|
+
instanceId: `slot-${slot}`
|
|
577
|
+
});
|
|
568
578
|
}
|
|
569
579
|
/**
|
|
570
580
|
* Executes the checkpoint proposal job.
|
|
@@ -579,7 +589,7 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
579
589
|
// Wait until the voting promises have resolved, so all requests are enqueued (not sent)
|
|
580
590
|
await Promise.all(votesPromises);
|
|
581
591
|
if (checkpoint) {
|
|
582
|
-
this.metrics.
|
|
592
|
+
this.metrics.recordCheckpointProposalSuccess();
|
|
583
593
|
}
|
|
584
594
|
// Do not post anything to L1 if we are fishermen, but do perform L1 fee analysis
|
|
585
595
|
if (this.config.fishermanMode) {
|
|
@@ -628,11 +638,15 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
628
638
|
// Collect L1 to L2 messages for the checkpoint and compute their hash
|
|
629
639
|
const l1ToL2Messages = await this.l1ToL2MessageSource.getL1ToL2Messages(this.checkpointNumber);
|
|
630
640
|
const inHash = computeInHashFromL1ToL2Messages(l1ToL2Messages);
|
|
641
|
+
// Collect the out hashes of all the checkpoints before this one in the same epoch
|
|
642
|
+
const previousCheckpointOutHashes = (await this.l2BlockSource.getCheckpointsDataForEpoch(this.epoch)).filter((c)=>c.checkpointNumber < this.checkpointNumber).map((c)=>c.checkpointOutHash);
|
|
643
|
+
// Get the fee asset price modifier from the oracle
|
|
644
|
+
const feeAssetPriceModifier = await this.publisher.getFeeAssetPriceModifier();
|
|
631
645
|
const fork = _ts_add_disposable_resource(env, await this.worldState.fork(this.syncedToBlockNumber, {
|
|
632
646
|
closeDelayMs: 12_000
|
|
633
|
-
}),
|
|
647
|
+
}), true);
|
|
634
648
|
// Create checkpoint builder for the entire slot
|
|
635
|
-
const checkpointBuilder = await this.checkpointsBuilder.startCheckpoint(this.checkpointNumber, checkpointGlobalVariables, l1ToL2Messages, fork);
|
|
649
|
+
const checkpointBuilder = await this.checkpointsBuilder.startCheckpoint(this.checkpointNumber, checkpointGlobalVariables, feeAssetPriceModifier, l1ToL2Messages, previousCheckpointOutHashes, fork, this.log.getBindings());
|
|
636
650
|
// Options for the validator client when creating block and checkpoint proposals
|
|
637
651
|
const blockProposalOptions = {
|
|
638
652
|
publishFullTxs: !!this.config.publishTxsWithProposals,
|
|
@@ -642,8 +656,23 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
642
656
|
publishFullTxs: !!this.config.publishTxsWithProposals,
|
|
643
657
|
broadcastInvalidCheckpointProposal: this.config.broadcastInvalidBlockProposal
|
|
644
658
|
};
|
|
645
|
-
|
|
646
|
-
|
|
659
|
+
let blocksInCheckpoint = [];
|
|
660
|
+
let blockPendingBroadcast = undefined;
|
|
661
|
+
const checkpointBuildTimer = new Timer();
|
|
662
|
+
try {
|
|
663
|
+
// Main loop: build blocks for the checkpoint
|
|
664
|
+
const result = await this.buildBlocksForCheckpoint(checkpointBuilder, checkpointGlobalVariables.timestamp, inHash, blockProposalOptions);
|
|
665
|
+
blocksInCheckpoint = result.blocksInCheckpoint;
|
|
666
|
+
blockPendingBroadcast = result.blockPendingBroadcast;
|
|
667
|
+
} catch (err) {
|
|
668
|
+
// These errors are expected in HA mode, so we yield and let another HA node handle the slot
|
|
669
|
+
// The only distinction between the 2 errors is SlashingProtectionError throws when the payload is different,
|
|
670
|
+
// which is normal for block building (may have picked different txs)
|
|
671
|
+
if (this.handleHASigningError(err, 'Block proposal')) {
|
|
672
|
+
return undefined;
|
|
673
|
+
}
|
|
674
|
+
throw err;
|
|
675
|
+
}
|
|
647
676
|
if (blocksInCheckpoint.length === 0) {
|
|
648
677
|
this.log.warn(`No blocks were built for slot ${this.slot}`, {
|
|
649
678
|
slot: this.slot
|
|
@@ -653,10 +682,36 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
653
682
|
});
|
|
654
683
|
return undefined;
|
|
655
684
|
}
|
|
685
|
+
const minBlocksForCheckpoint = this.config.minBlocksForCheckpoint;
|
|
686
|
+
if (minBlocksForCheckpoint !== undefined && blocksInCheckpoint.length < minBlocksForCheckpoint) {
|
|
687
|
+
this.log.warn(`Checkpoint has fewer blocks than minimum (${blocksInCheckpoint.length} < ${minBlocksForCheckpoint}), skipping proposal`, {
|
|
688
|
+
slot: this.slot,
|
|
689
|
+
blocksBuilt: blocksInCheckpoint.length,
|
|
690
|
+
minBlocksForCheckpoint
|
|
691
|
+
});
|
|
692
|
+
return undefined;
|
|
693
|
+
}
|
|
656
694
|
// Assemble and broadcast the checkpoint proposal, including the last block that was not
|
|
657
695
|
// broadcasted yet, and wait to collect the committee attestations.
|
|
658
696
|
this.setStateFn(SequencerState.ASSEMBLING_CHECKPOINT, this.slot);
|
|
659
697
|
const checkpoint = await checkpointBuilder.completeCheckpoint();
|
|
698
|
+
// Final validation round for the checkpoint before we propose it, just for safety
|
|
699
|
+
try {
|
|
700
|
+
validateCheckpoint(checkpoint, {
|
|
701
|
+
rollupManaLimit: this.l1Constants.rollupManaLimit,
|
|
702
|
+
maxL2BlockGas: this.config.maxL2BlockGas,
|
|
703
|
+
maxDABlockGas: this.config.maxDABlockGas,
|
|
704
|
+
maxTxsPerBlock: this.config.maxTxsPerBlock,
|
|
705
|
+
maxTxsPerCheckpoint: this.config.maxTxsPerCheckpoint
|
|
706
|
+
});
|
|
707
|
+
} catch (err) {
|
|
708
|
+
this.log.error(`Built an invalid checkpoint at slot ${this.slot} (skipping proposal)`, err, {
|
|
709
|
+
checkpoint: checkpoint.header.toInspect()
|
|
710
|
+
});
|
|
711
|
+
return undefined;
|
|
712
|
+
}
|
|
713
|
+
// Record checkpoint-level build metrics
|
|
714
|
+
this.metrics.recordCheckpointBuild(checkpointBuildTimer.ms(), blocksInCheckpoint.length, checkpoint.getStats().txCount, Number(checkpoint.header.totalManaUsed.toBigInt()));
|
|
660
715
|
// Do not collect attestations nor publish to L1 in fisherman mode
|
|
661
716
|
if (this.config.fishermanMode) {
|
|
662
717
|
this.log.info(`Built checkpoint for slot ${this.slot} with ${blocksInCheckpoint.length} blocks. ` + `Skipping proposal in fisherman mode.`, {
|
|
@@ -674,7 +729,7 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
674
729
|
txs: blockPendingBroadcast.txs
|
|
675
730
|
};
|
|
676
731
|
// Create the checkpoint proposal and broadcast it
|
|
677
|
-
const proposal = await this.validatorClient.createCheckpointProposal(checkpoint.header, checkpoint.archive.root, lastBlock, this.proposer, checkpointProposalOptions);
|
|
732
|
+
const proposal = await this.validatorClient.createCheckpointProposal(checkpoint.header, checkpoint.archive.root, feeAssetPriceModifier, lastBlock, this.proposer, checkpointProposalOptions);
|
|
678
733
|
const blockProposedAt = this.dateProvider.now();
|
|
679
734
|
await this.p2pClient.broadcastCheckpointProposal(proposal);
|
|
680
735
|
this.setStateFn(SequencerState.COLLECTING_ATTESTATIONS, this.slot);
|
|
@@ -683,12 +738,30 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
683
738
|
this.metrics.recordCheckpointAttestationDelay(blockAttestedAt - blockProposedAt);
|
|
684
739
|
// Proposer must sign over the attestations before pushing them to L1
|
|
685
740
|
const signer = this.proposer ?? this.publisher.getSenderAddress();
|
|
686
|
-
|
|
741
|
+
let attestationsSignature;
|
|
742
|
+
try {
|
|
743
|
+
attestationsSignature = await this.validatorClient.signAttestationsAndSigners(attestations, signer, this.slot, this.checkpointNumber);
|
|
744
|
+
} catch (err) {
|
|
745
|
+
// We shouldn't really get here since we yield to another HA node
|
|
746
|
+
// as soon as we see these errors when creating block or checkpoint proposals.
|
|
747
|
+
if (this.handleHASigningError(err, 'Attestations signature')) {
|
|
748
|
+
return undefined;
|
|
749
|
+
}
|
|
750
|
+
throw err;
|
|
751
|
+
}
|
|
687
752
|
// Enqueue publishing the checkpoint to L1
|
|
688
753
|
this.setStateFn(SequencerState.PUBLISHING_CHECKPOINT, this.slot);
|
|
689
754
|
const aztecSlotDuration = this.l1Constants.slotDuration;
|
|
690
755
|
const slotStartBuildTimestamp = this.getSlotStartBuildTimestamp();
|
|
691
756
|
const txTimeoutAt = new Date((slotStartBuildTimestamp + aztecSlotDuration) * 1000);
|
|
757
|
+
// If we have been configured to potentially skip publishing checkpoint then roll the dice here
|
|
758
|
+
if (this.config.skipPublishingCheckpointsPercent !== undefined && this.config.skipPublishingCheckpointsPercent > 0) {
|
|
759
|
+
const result = Math.max(0, randomInt(100));
|
|
760
|
+
if (result < this.config.skipPublishingCheckpointsPercent) {
|
|
761
|
+
this.log.warn(`Skipping publishing proposal for checkpoint ${checkpoint.number}. Configured percentage: ${this.config.skipPublishingCheckpointsPercent}, generated value: ${result}`);
|
|
762
|
+
return checkpoint;
|
|
763
|
+
}
|
|
764
|
+
}
|
|
692
765
|
await this.publisher.enqueueProposeCheckpoint(checkpoint, attestations, attestationsSignature, {
|
|
693
766
|
txTimeoutAt,
|
|
694
767
|
forcePendingCheckpointNumber: this.invalidateCheckpoint?.forcePendingCheckpointNumber
|
|
@@ -698,9 +771,14 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
698
771
|
env.error = e;
|
|
699
772
|
env.hasError = true;
|
|
700
773
|
} finally{
|
|
701
|
-
_ts_dispose_resources(env);
|
|
774
|
+
const result = _ts_dispose_resources(env);
|
|
775
|
+
if (result) await result;
|
|
702
776
|
}
|
|
703
777
|
} catch (err) {
|
|
778
|
+
if (err && (err instanceof DutyAlreadySignedError || err instanceof SlashingProtectionError)) {
|
|
779
|
+
// swallow this error. It's already been logged by a function deeper in the stack
|
|
780
|
+
return undefined;
|
|
781
|
+
}
|
|
704
782
|
this.log.error(`Error building checkpoint at slot ${this.slot}`, err);
|
|
705
783
|
return undefined;
|
|
706
784
|
}
|
|
@@ -715,7 +793,7 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
715
793
|
let blockPendingBroadcast = undefined;
|
|
716
794
|
while(true){
|
|
717
795
|
const blocksBuilt = blocksInCheckpoint.length;
|
|
718
|
-
const indexWithinCheckpoint = blocksBuilt;
|
|
796
|
+
const indexWithinCheckpoint = IndexWithinCheckpoint(blocksBuilt);
|
|
719
797
|
const blockNumber = BlockNumber(initialBlockNumber + blocksBuilt);
|
|
720
798
|
const secondsIntoSlot = this.getSecondsIntoSlot();
|
|
721
799
|
const timingInfo = this.timetable.canStartNextBlock(secondsIntoSlot);
|
|
@@ -738,6 +816,7 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
738
816
|
indexWithinCheckpoint,
|
|
739
817
|
txHashesAlreadyIncluded
|
|
740
818
|
});
|
|
819
|
+
// TODO(palla/mbps): Review these conditions. We may want to keep trying in some scenarios.
|
|
741
820
|
if (!buildResult && timingInfo.isLastBlock) {
|
|
742
821
|
break;
|
|
743
822
|
} else if (!buildResult && timingInfo.deadline !== undefined) {
|
|
@@ -760,9 +839,10 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
760
839
|
const { block, usedTxs } = buildResult;
|
|
761
840
|
blocksInCheckpoint.push(block);
|
|
762
841
|
// Sync the proposed block to the archiver to make it available
|
|
763
|
-
//
|
|
764
|
-
//
|
|
842
|
+
// We wait for the sync to succeed, as this helps catch consistency errors, even if it means we lose some time for block-building
|
|
843
|
+
// If this throws, we abort the entire checkpoint
|
|
765
844
|
await this.syncProposedBlockToArchiver(block);
|
|
845
|
+
usedTxs.forEach((tx)=>txHashesAlreadyIncluded.add(tx.txHash.toString()));
|
|
766
846
|
// If this is the last block, exit the loop now so we start collecting attestations
|
|
767
847
|
if (timingInfo.isLastBlock) {
|
|
768
848
|
this.log.verbose(`Completed final block ${blockNumber} for slot ${this.slot}`, {
|
|
@@ -809,8 +889,7 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
809
889
|
});
|
|
810
890
|
try {
|
|
811
891
|
// Wait until we have enough txs to build the block
|
|
812
|
-
const minTxs = this.
|
|
813
|
-
const { availableTxs, canStartBuilding } = await this.waitForMinTxs(opts);
|
|
892
|
+
const { availableTxs, canStartBuilding, minTxs } = await this.waitForMinTxs(opts);
|
|
814
893
|
if (!canStartBuilding) {
|
|
815
894
|
this.log.warn(`Not enough txs to build block ${blockNumber} at index ${indexWithinCheckpoint} in slot ${this.slot} (got ${availableTxs} txs but needs ${minTxs})`, {
|
|
816
895
|
blockNumber,
|
|
@@ -827,55 +906,56 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
827
906
|
}
|
|
828
907
|
// Create iterator to pending txs. We filter out txs already included in previous blocks in the checkpoint
|
|
829
908
|
// just in case p2p failed to sync the provisional block and didn't get to remove those txs from the mempool yet.
|
|
830
|
-
const pendingTxs = filter(this.p2pClient.
|
|
909
|
+
const pendingTxs = filter(this.p2pClient.iterateEligiblePendingTxs(), (tx)=>!txHashesAlreadyIncluded.has(tx.txHash.toString()));
|
|
831
910
|
this.log.debug(`Building block ${blockNumber} at index ${indexWithinCheckpoint} for slot ${this.slot} with ${availableTxs} available txs`, {
|
|
832
911
|
slot: this.slot,
|
|
833
912
|
blockNumber,
|
|
834
913
|
indexWithinCheckpoint
|
|
835
914
|
});
|
|
836
915
|
this.setStateFn(SequencerState.CREATING_BLOCK, this.slot);
|
|
916
|
+
// Per-block limits derived at startup by computeBlockLimits(), further capped
|
|
917
|
+
// by remaining checkpoint-level budgets inside CheckpointBuilder before each block is built.
|
|
918
|
+
// minValidTxs is passed into the builder so it can reject the block *before* updating state.
|
|
919
|
+
const minValidTxs = forceCreate ? 0 : this.config.minValidTxsPerBlock ?? minTxs;
|
|
837
920
|
const blockBuilderOptions = {
|
|
838
921
|
maxTransactions: this.config.maxTxsPerBlock,
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
922
|
+
maxBlockGas: this.config.maxL2BlockGas !== undefined || this.config.maxDABlockGas !== undefined ? new Gas(this.config.maxDABlockGas ?? Infinity, this.config.maxL2BlockGas ?? Infinity) : undefined,
|
|
923
|
+
deadline: buildDeadline,
|
|
924
|
+
isBuildingProposal: true,
|
|
925
|
+
minValidTxs
|
|
843
926
|
};
|
|
844
|
-
// Actually build the block by executing txs
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
const
|
|
927
|
+
// Actually build the block by executing txs. The builder throws InsufficientValidTxsError
|
|
928
|
+
// if the number of successfully processed txs is below minValidTxs, ensuring state is not
|
|
929
|
+
// updated for blocks that will be discarded.
|
|
930
|
+
const buildResult = await this.buildSingleBlockWithCheckpointBuilder(checkpointBuilder, pendingTxs, blockNumber, blockTimestamp, blockBuilderOptions);
|
|
848
931
|
// If any txs failed during execution, drop them from the mempool so we don't pick them up again
|
|
849
|
-
await this.dropFailedTxsFromP2P(failedTxs);
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
const minValidTxs = this.config.minValidTxsPerBlock ?? minTxs;
|
|
853
|
-
if (!forceCreate && numTxs < minValidTxs) {
|
|
854
|
-
this.log.warn(`Block ${blockNumber} at index ${indexWithinCheckpoint} on slot ${this.slot} has too few valid txs to be proposed (got ${numTxs} but required ${minValidTxs})`, {
|
|
932
|
+
await this.dropFailedTxsFromP2P(buildResult.failedTxs);
|
|
933
|
+
if (buildResult.status === 'insufficient-valid-txs') {
|
|
934
|
+
this.log.warn(`Block ${blockNumber} at index ${indexWithinCheckpoint} on slot ${this.slot} has too few valid txs to be proposed`, {
|
|
855
935
|
slot: this.slot,
|
|
856
936
|
blockNumber,
|
|
857
|
-
numTxs,
|
|
858
|
-
indexWithinCheckpoint
|
|
937
|
+
numTxs: buildResult.processedCount,
|
|
938
|
+
indexWithinCheckpoint,
|
|
939
|
+
minValidTxs
|
|
859
940
|
});
|
|
860
|
-
this.eventEmitter.emit('block-
|
|
861
|
-
|
|
862
|
-
availableTxs: numTxs,
|
|
941
|
+
this.eventEmitter.emit('block-build-failed', {
|
|
942
|
+
reason: `Insufficient valid txs`,
|
|
863
943
|
slot: this.slot
|
|
864
944
|
});
|
|
865
945
|
this.metrics.recordBlockProposalFailed('insufficient_valid_txs');
|
|
866
946
|
return undefined;
|
|
867
947
|
}
|
|
868
948
|
// Block creation succeeded, emit stats and metrics
|
|
949
|
+
const { block, publicProcessorDuration, usedTxs, blockBuildDuration, numTxs } = buildResult;
|
|
869
950
|
const blockStats = {
|
|
870
951
|
eventName: 'l2-block-built',
|
|
871
952
|
duration: blockBuildDuration,
|
|
872
953
|
publicProcessDuration: publicProcessorDuration,
|
|
873
|
-
rollupCircuitsDuration: blockBuildingTimer.ms(),
|
|
874
954
|
...block.getStats()
|
|
875
955
|
};
|
|
876
956
|
const blockHash = await block.hash();
|
|
877
957
|
const txHashes = block.body.txEffects.map((tx)=>tx.txHash);
|
|
878
|
-
const manaPerSec =
|
|
958
|
+
const manaPerSec = block.header.totalManaUsed.toNumberUnsafe() / (blockBuildDuration / 1000);
|
|
879
959
|
this.log.info(`Built block ${block.number} at checkpoint ${this.checkpointNumber} for slot ${this.slot} with ${numTxs} txs`, {
|
|
880
960
|
blockHash,
|
|
881
961
|
txHashes,
|
|
@@ -886,7 +966,7 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
886
966
|
blockNumber: block.number,
|
|
887
967
|
slot: this.slot
|
|
888
968
|
});
|
|
889
|
-
this.metrics.recordBuiltBlock(blockBuildDuration,
|
|
969
|
+
this.metrics.recordBuiltBlock(blockBuildDuration, block.header.totalManaUsed.toNumberUnsafe());
|
|
890
970
|
return {
|
|
891
971
|
block,
|
|
892
972
|
usedTxs
|
|
@@ -907,9 +987,31 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
907
987
|
};
|
|
908
988
|
}
|
|
909
989
|
}
|
|
990
|
+
/** Uses the checkpoint builder to build a block, catching InsufficientValidTxsError. */ async buildSingleBlockWithCheckpointBuilder(checkpointBuilder, pendingTxs, blockNumber, blockTimestamp, blockBuilderOptions) {
|
|
991
|
+
try {
|
|
992
|
+
const workTimer = new Timer();
|
|
993
|
+
const result = await checkpointBuilder.buildBlock(pendingTxs, blockNumber, blockTimestamp, blockBuilderOptions);
|
|
994
|
+
const blockBuildDuration = workTimer.ms();
|
|
995
|
+
return {
|
|
996
|
+
...result,
|
|
997
|
+
blockBuildDuration,
|
|
998
|
+
status: 'success'
|
|
999
|
+
};
|
|
1000
|
+
} catch (err) {
|
|
1001
|
+
if (isErrorClass(err, InsufficientValidTxsError)) {
|
|
1002
|
+
return {
|
|
1003
|
+
failedTxs: err.failedTxs,
|
|
1004
|
+
processedCount: err.processedCount,
|
|
1005
|
+
status: 'insufficient-valid-txs'
|
|
1006
|
+
};
|
|
1007
|
+
}
|
|
1008
|
+
throw err;
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
910
1011
|
/** Waits until minTxs are available on the pool for building a block. */ async waitForMinTxs(opts) {
|
|
911
|
-
const minTxs = this.config.minTxsPerBlock;
|
|
912
1012
|
const { indexWithinCheckpoint, blockNumber, buildDeadline, forceCreate } = opts;
|
|
1013
|
+
// We only allow a block with 0 txs in the first block of the checkpoint
|
|
1014
|
+
const minTxs = indexWithinCheckpoint > 0 && this.config.minTxsPerBlock === 0 ? 1 : this.config.minTxsPerBlock;
|
|
913
1015
|
// Deadline is undefined if we are not enforcing the timetable, meaning we'll exit immediately when out of time
|
|
914
1016
|
const startBuildingDeadline = buildDeadline ? new Date(buildDeadline.getTime() - this.timetable.minExecutionTime * 1000) : undefined;
|
|
915
1017
|
let availableTxs = await this.p2pClient.getPendingTxCount();
|
|
@@ -919,7 +1021,8 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
919
1021
|
if (startBuildingDeadline === undefined || now >= startBuildingDeadline) {
|
|
920
1022
|
return {
|
|
921
1023
|
canStartBuilding: false,
|
|
922
|
-
availableTxs
|
|
1024
|
+
availableTxs,
|
|
1025
|
+
minTxs
|
|
923
1026
|
};
|
|
924
1027
|
}
|
|
925
1028
|
// Wait a bit before checking again
|
|
@@ -929,12 +1032,13 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
929
1032
|
slot: this.slot,
|
|
930
1033
|
indexWithinCheckpoint
|
|
931
1034
|
});
|
|
932
|
-
await
|
|
1035
|
+
await this.waitForTxsPollingInterval();
|
|
933
1036
|
availableTxs = await this.p2pClient.getPendingTxCount();
|
|
934
1037
|
}
|
|
935
1038
|
return {
|
|
936
1039
|
canStartBuilding: true,
|
|
937
|
-
availableTxs
|
|
1040
|
+
availableTxs,
|
|
1041
|
+
minTxs
|
|
938
1042
|
};
|
|
939
1043
|
}
|
|
940
1044
|
/**
|
|
@@ -964,17 +1068,23 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
964
1068
|
return new CommitteeAttestationsAndSigners(orderAttestations(attestations ?? [], committee));
|
|
965
1069
|
}
|
|
966
1070
|
const attestationTimeAllowed = this.config.enforceTimeTable ? this.timetable.getMaxAllowedTime(SequencerState.PUBLISHING_CHECKPOINT) : this.l1Constants.slotDuration;
|
|
967
|
-
const attestationDeadline = new Date(this.
|
|
1071
|
+
const attestationDeadline = new Date((this.getSlotStartBuildTimestamp() + attestationTimeAllowed) * 1000);
|
|
968
1072
|
this.metrics.recordRequiredAttestations(numberOfRequiredAttestations, attestationTimeAllowed);
|
|
969
1073
|
const collectAttestationsTimer = new Timer();
|
|
970
1074
|
let collectedAttestationsCount = 0;
|
|
971
1075
|
try {
|
|
972
1076
|
const attestations = await this.validatorClient.collectAttestations(proposal, numberOfRequiredAttestations, attestationDeadline);
|
|
973
1077
|
collectedAttestationsCount = attestations.length;
|
|
1078
|
+
// Trim attestations to minimum required to save L1 calldata gas
|
|
1079
|
+
const localAddresses = this.validatorClient.getValidatorAddresses();
|
|
1080
|
+
const trimmed = trimAttestations(attestations, numberOfRequiredAttestations, this.attestorAddress, localAddresses);
|
|
1081
|
+
if (trimmed.length < attestations.length) {
|
|
1082
|
+
this.log.debug(`Trimmed attestations from ${attestations.length} to ${trimmed.length} for L1 submission`);
|
|
1083
|
+
}
|
|
974
1084
|
// Rollup contract requires that the signatures are provided in the order of the committee
|
|
975
|
-
const sorted = orderAttestations(
|
|
1085
|
+
const sorted = orderAttestations(trimmed, committee);
|
|
976
1086
|
// Manipulate the attestations if we've been configured to do so
|
|
977
|
-
if (this.config.injectFakeAttestation || this.config.shuffleAttestationOrdering) {
|
|
1087
|
+
if (this.config.injectFakeAttestation || this.config.injectHighSValueAttestation || this.config.injectUnrecoverableSignatureAttestation || this.config.shuffleAttestationOrdering) {
|
|
978
1088
|
return this.manipulateAttestations(proposal.slotNumber, epoch, seed, committee, sorted);
|
|
979
1089
|
}
|
|
980
1090
|
return new CommitteeAttestationsAndSigners(sorted);
|
|
@@ -991,7 +1101,7 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
991
1101
|
// Compute the proposer index in the committee, since we dont want to tweak it.
|
|
992
1102
|
// Otherwise, the L1 rollup contract will reject the block outright.
|
|
993
1103
|
const proposerIndex = Number(this.epochCache.computeProposerIndex(slotNumber, epoch, seed, BigInt(committee.length)));
|
|
994
|
-
if (this.config.injectFakeAttestation) {
|
|
1104
|
+
if (this.config.injectFakeAttestation || this.config.injectHighSValueAttestation || this.config.injectUnrecoverableSignatureAttestation) {
|
|
995
1105
|
// Find non-empty attestations that are not from the proposer
|
|
996
1106
|
const nonProposerIndices = [];
|
|
997
1107
|
for(let i = 0; i < attestations.length; i++){
|
|
@@ -1001,8 +1111,16 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
1001
1111
|
}
|
|
1002
1112
|
if (nonProposerIndices.length > 0) {
|
|
1003
1113
|
const targetIndex = nonProposerIndices[randomInt(nonProposerIndices.length)];
|
|
1004
|
-
this.
|
|
1005
|
-
|
|
1114
|
+
if (this.config.injectHighSValueAttestation) {
|
|
1115
|
+
this.log.warn(`Injecting high-s value attestation in checkpoint for slot ${slotNumber} at index ${targetIndex}`);
|
|
1116
|
+
unfreeze(attestations[targetIndex]).signature = flipSignature(attestations[targetIndex].signature);
|
|
1117
|
+
} else if (this.config.injectUnrecoverableSignatureAttestation) {
|
|
1118
|
+
this.log.warn(`Injecting unrecoverable signature attestation in checkpoint for slot ${slotNumber} at index ${targetIndex}`);
|
|
1119
|
+
unfreeze(attestations[targetIndex]).signature = generateUnrecoverableSignature();
|
|
1120
|
+
} else {
|
|
1121
|
+
this.log.warn(`Injecting fake attestation in checkpoint for slot ${slotNumber} at index ${targetIndex}`);
|
|
1122
|
+
unfreeze(attestations[targetIndex]).signature = generateRecoverableSignature();
|
|
1123
|
+
}
|
|
1006
1124
|
}
|
|
1007
1125
|
return new CommitteeAttestationsAndSigners(attestations);
|
|
1008
1126
|
}
|
|
@@ -1011,14 +1129,25 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
1011
1129
|
const shuffled = [
|
|
1012
1130
|
...attestations
|
|
1013
1131
|
];
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
];
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1132
|
+
// Find two non-proposer positions that both have non-empty signatures to swap.
|
|
1133
|
+
// This ensures the bitmap doesn't change, so the MaliciousCommitteeAttestationsAndSigners
|
|
1134
|
+
// signers array stays correctly aligned with L1's committee reconstruction.
|
|
1135
|
+
const swappable = [];
|
|
1136
|
+
for(let k = 0; k < shuffled.length; k++){
|
|
1137
|
+
if (!shuffled[k].signature.isEmpty() && k !== proposerIndex) {
|
|
1138
|
+
swappable.push(k);
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
if (swappable.length >= 2) {
|
|
1142
|
+
const [i, j] = [
|
|
1143
|
+
swappable[0],
|
|
1144
|
+
swappable[1]
|
|
1145
|
+
];
|
|
1146
|
+
[shuffled[i], shuffled[j]] = [
|
|
1147
|
+
shuffled[j],
|
|
1148
|
+
shuffled[i]
|
|
1149
|
+
];
|
|
1150
|
+
}
|
|
1022
1151
|
const signers = new CommitteeAttestationsAndSigners(attestations).getSigners();
|
|
1023
1152
|
return new MaliciousCommitteeAttestationsAndSigners(shuffled, signers);
|
|
1024
1153
|
}
|
|
@@ -1031,14 +1160,13 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
1031
1160
|
const failedTxData = failedTxs.map((fail)=>fail.tx);
|
|
1032
1161
|
const failedTxHashes = failedTxData.map((tx)=>tx.getTxHash());
|
|
1033
1162
|
this.log.verbose(`Dropping failed txs ${failedTxHashes.join(', ')}`);
|
|
1034
|
-
await this.p2pClient.
|
|
1163
|
+
await this.p2pClient.handleFailedExecution(failedTxHashes);
|
|
1035
1164
|
}
|
|
1036
1165
|
/**
|
|
1037
1166
|
* Adds the proposed block to the archiver so it's available via P2P.
|
|
1038
1167
|
* Gossip doesn't echo messages back to the sender, so the proposer's archiver/world-state
|
|
1039
1168
|
* would never receive its own block without this explicit sync.
|
|
1040
1169
|
*/ async syncProposedBlockToArchiver(block) {
|
|
1041
|
-
// TODO(palla/mbps): Change default to false once block sync is stable.
|
|
1042
1170
|
if (this.config.skipPushProposedBlocksToArchiver !== false) {
|
|
1043
1171
|
this.log.warn(`Skipping push of proposed block ${block.number} to archiver`, {
|
|
1044
1172
|
blockNumber: block.number,
|
|
@@ -1067,15 +1195,38 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
1067
1195
|
slot: this.slot,
|
|
1068
1196
|
feeAnalysisId: feeAnalysis?.id
|
|
1069
1197
|
});
|
|
1070
|
-
this.metrics.
|
|
1198
|
+
this.metrics.recordCheckpointProposalFailed('block_build_failed');
|
|
1071
1199
|
}
|
|
1072
1200
|
this.publisher.clearPendingRequests();
|
|
1073
1201
|
}
|
|
1202
|
+
/**
|
|
1203
|
+
* Helper to handle HA double-signing errors. Returns true if the error was handled (caller should yield).
|
|
1204
|
+
*/ handleHASigningError(err, errorContext) {
|
|
1205
|
+
if (err instanceof DutyAlreadySignedError) {
|
|
1206
|
+
this.log.info(`${errorContext} for slot ${this.slot} already signed by another HA node, yielding`, {
|
|
1207
|
+
slot: this.slot,
|
|
1208
|
+
signedByNode: err.signedByNode
|
|
1209
|
+
});
|
|
1210
|
+
return true;
|
|
1211
|
+
}
|
|
1212
|
+
if (err instanceof SlashingProtectionError) {
|
|
1213
|
+
this.log.info(`${errorContext} for slot ${this.slot} blocked by slashing protection, yielding`, {
|
|
1214
|
+
slot: this.slot,
|
|
1215
|
+
existingMessageHash: err.existingMessageHash,
|
|
1216
|
+
attemptedMessageHash: err.attemptedMessageHash
|
|
1217
|
+
});
|
|
1218
|
+
return true;
|
|
1219
|
+
}
|
|
1220
|
+
return false;
|
|
1221
|
+
}
|
|
1074
1222
|
/** Waits until a specific time within the current slot */ async waitUntilTimeInSlot(targetSecondsIntoSlot) {
|
|
1075
1223
|
const slotStartTimestamp = this.getSlotStartBuildTimestamp();
|
|
1076
1224
|
const targetTimestamp = slotStartTimestamp + targetSecondsIntoSlot;
|
|
1077
1225
|
await sleepUntil(new Date(targetTimestamp * 1000), this.dateProvider.nowAsDate());
|
|
1078
1226
|
}
|
|
1227
|
+
/** Waits the polling interval for transactions. Extracted for test overriding. */ async waitForTxsPollingInterval() {
|
|
1228
|
+
await sleep(TXS_POLLING_MS);
|
|
1229
|
+
}
|
|
1079
1230
|
getSlotStartBuildTimestamp() {
|
|
1080
1231
|
return getSlotStartBuildTimestamp(this.slot, this.l1Constants);
|
|
1081
1232
|
}
|
|
@@ -21,7 +21,8 @@ export declare class CheckpointVoter {
|
|
|
21
21
|
private readonly metrics;
|
|
22
22
|
private readonly log;
|
|
23
23
|
private slotTimestamp;
|
|
24
|
-
private
|
|
24
|
+
private governanceSigner;
|
|
25
|
+
private slashingSigner;
|
|
25
26
|
constructor(slot: SlotNumber, publisher: SequencerPublisher, attestorAddress: EthAddress, validatorClient: ValidatorClient, slasherClient: SlasherClientInterface | undefined, l1Constants: SequencerRollupConstants, config: ResolvedSequencerConfig, metrics: SequencerMetrics, log: Logger);
|
|
26
27
|
/**
|
|
27
28
|
* Enqueues governance and slashing votes with the publisher.
|
|
@@ -31,4 +32,4 @@ export declare class CheckpointVoter {
|
|
|
31
32
|
private enqueueGovernanceVote;
|
|
32
33
|
private enqueueSlashingVote;
|
|
33
34
|
}
|
|
34
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
35
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hlY2twb2ludF92b3Rlci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3NlcXVlbmNlci9jaGVja3BvaW50X3ZvdGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLFVBQVUsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ2xFLE9BQU8sS0FBSyxFQUFFLFVBQVUsRUFBRSxNQUFNLCtCQUErQixDQUFDO0FBQ2hFLE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBQ3BELE9BQU8sS0FBSyxFQUFFLHNCQUFzQixFQUFFLE1BQU0sZ0JBQWdCLENBQUM7QUFFN0QsT0FBTyxLQUFLLEVBQUUsdUJBQXVCLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUMvRSxPQUFPLEtBQUssRUFBRSxlQUFlLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQU0vRCxPQUFPLEtBQUssRUFBRSxrQkFBa0IsRUFBRSxNQUFNLHFDQUFxQyxDQUFDO0FBQzlFLE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sY0FBYyxDQUFDO0FBQ3JELE9BQU8sS0FBSyxFQUFFLHdCQUF3QixFQUFFLE1BQU0sWUFBWSxDQUFDO0FBRTNEOztHQUVHO0FBQ0gscUJBQWEsZUFBZTtJQU14QixPQUFPLENBQUMsUUFBUSxDQUFDLElBQUk7SUFDckIsT0FBTyxDQUFDLFFBQVEsQ0FBQyxTQUFTO0lBQzFCLE9BQU8sQ0FBQyxRQUFRLENBQUMsZUFBZTtJQUNoQyxPQUFPLENBQUMsUUFBUSxDQUFDLGVBQWU7SUFDaEMsT0FBTyxDQUFDLFFBQVEsQ0FBQyxhQUFhO0lBQzlCLE9BQU8sQ0FBQyxRQUFRLENBQUMsV0FBVztJQUM1QixPQUFPLENBQUMsUUFBUSxDQUFDLE1BQU07SUFDdkIsT0FBTyxDQUFDLFFBQVEsQ0FBQyxPQUFPO0lBQ3hCLE9BQU8sQ0FBQyxRQUFRLENBQUMsR0FBRztJQWJ0QixPQUFPLENBQUMsYUFBYSxDQUFTO0lBQzlCLE9BQU8sQ0FBQyxnQkFBZ0IsQ0FBdUQ7SUFDL0UsT0FBTyxDQUFDLGNBQWMsQ0FBdUQ7SUFFN0UsWUFDbUIsSUFBSSxFQUFFLFVBQVUsRUFDaEIsU0FBUyxFQUFFLGtCQUFrQixFQUM3QixlQUFlLEVBQUUsVUFBVSxFQUMzQixlQUFlLEVBQUUsZUFBZSxFQUNoQyxhQUFhLEVBQUUsc0JBQXNCLEdBQUcsU0FBUyxFQUNqRCxXQUFXLEVBQUUsd0JBQXdCLEVBQ3JDLE1BQU0sRUFBRSx1QkFBdUIsRUFDL0IsT0FBTyxFQUFFLGdCQUFnQixFQUN6QixHQUFHLEVBQUUsTUFBTSxFQWE3QjtJQUVEOzs7T0FHRztJQUNILFlBQVksSUFBSSxDQUFDLE9BQU8sQ0FBQyxPQUFPLEdBQUcsU0FBUyxDQUFDLEVBQUUsT0FBTyxDQUFDLE9BQU8sR0FBRyxTQUFTLENBQUMsQ0FBQyxDQVUzRTtZQUVhLHFCQUFxQjtZQWdDckIsbUJBQW1CO0NBaUNsQyJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkpoint_voter.d.ts","sourceRoot":"","sources":["../../src/sequencer/checkpoint_voter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAE7D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"checkpoint_voter.d.ts","sourceRoot":"","sources":["../../src/sequencer/checkpoint_voter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAE7D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAM/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAE3D;;GAEG;AACH,qBAAa,eAAe;IAMxB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,GAAG;IAbtB,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,gBAAgB,CAAuD;IAC/E,OAAO,CAAC,cAAc,CAAuD;IAE7E,YACmB,IAAI,EAAE,UAAU,EAChB,SAAS,EAAE,kBAAkB,EAC7B,eAAe,EAAE,UAAU,EAC3B,eAAe,EAAE,eAAe,EAChC,aAAa,EAAE,sBAAsB,GAAG,SAAS,EACjD,WAAW,EAAE,wBAAwB,EACrC,MAAM,EAAE,uBAAuB,EAC/B,OAAO,EAAE,gBAAgB,EACzB,GAAG,EAAE,MAAM,EAa7B;IAED;;;OAGG;IACH,YAAY,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,EAAE,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAAC,CAU3E;YAEa,qBAAqB;YAgCrB,mBAAmB;CAiClC"}
|