@aztec/sequencer-client 0.0.1-commit.2ed92850 → 0.0.1-commit.343b43af6
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 +23 -7
- package/dest/client/sequencer-client.d.ts.map +1 -1
- package/dest/client/sequencer-client.js +99 -16
- package/dest/config.d.ts +24 -6
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +40 -28
- 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/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 +338 -48
- package/dest/sequencer/checkpoint_proposal_job.d.ts +31 -10
- package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -1
- package/dest/sequencer/checkpoint_proposal_job.js +177 -97
- 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 +26 -13
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +42 -41
- 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 +10 -10
- package/dest/test/mock_checkpoint_builder.d.ts.map +1 -1
- package/dest/test/mock_checkpoint_builder.js +45 -36
- package/dest/test/utils.d.ts +3 -3
- package/dest/test/utils.d.ts.map +1 -1
- package/dest/test/utils.js +5 -4
- package/package.json +28 -28
- package/src/client/sequencer-client.ts +135 -18
- package/src/config.ts +54 -38
- package/src/global_variable_builder/global_builder.ts +1 -1
- 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 +333 -60
- package/src/sequencer/checkpoint_proposal_job.ts +236 -122
- package/src/sequencer/metrics.ts +124 -32
- package/src/sequencer/sequencer.ts +53 -47
- 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 +62 -50
- package/src/test/utils.ts +5 -2
|
@@ -436,20 +436,21 @@ 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 { BLOBS_PER_CHECKPOINT, FIELDS_PER_BLOB } from '@aztec/constants';
|
|
441
|
-
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
439
|
+
import { BlockNumber, IndexWithinCheckpoint } from '@aztec/foundation/branded-types';
|
|
442
440
|
import { randomInt } from '@aztec/foundation/crypto/random';
|
|
443
|
-
import {
|
|
441
|
+
import { flipSignature, generateRecoverableSignature, generateUnrecoverableSignature } from '@aztec/foundation/crypto/secp256k1-signer';
|
|
444
442
|
import { filter } from '@aztec/foundation/iterator';
|
|
443
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
445
444
|
import { sleep, sleepUntil } from '@aztec/foundation/sleep';
|
|
446
445
|
import { Timer } from '@aztec/foundation/timer';
|
|
447
|
-
import { unfreeze } from '@aztec/foundation/types';
|
|
446
|
+
import { isErrorClass, unfreeze } from '@aztec/foundation/types';
|
|
448
447
|
import { CommitteeAttestationsAndSigners, MaliciousCommitteeAttestationsAndSigners } from '@aztec/stdlib/block';
|
|
448
|
+
import { validateCheckpoint } from '@aztec/stdlib/checkpoint';
|
|
449
449
|
import { getSlotStartBuildTimestamp } from '@aztec/stdlib/epoch-helpers';
|
|
450
450
|
import { Gas } from '@aztec/stdlib/gas';
|
|
451
|
+
import { NoValidTxsError } from '@aztec/stdlib/interfaces/server';
|
|
451
452
|
import { computeInHashFromL1ToL2Messages } from '@aztec/stdlib/messaging';
|
|
452
|
-
import { orderAttestations } from '@aztec/stdlib/p2p';
|
|
453
|
+
import { orderAttestations, trimAttestations } from '@aztec/stdlib/p2p';
|
|
453
454
|
import { AttestationTimeoutError } from '@aztec/stdlib/validators';
|
|
454
455
|
import { Attributes, trackSpan } from '@aztec/telemetry-client';
|
|
455
456
|
import { DutyAlreadySignedError, SlashingProtectionError } from '@aztec/validator-ha-signer/errors';
|
|
@@ -495,7 +496,6 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
495
496
|
metrics;
|
|
496
497
|
eventEmitter;
|
|
497
498
|
setStateFn;
|
|
498
|
-
log;
|
|
499
499
|
tracer;
|
|
500
500
|
static{
|
|
501
501
|
({ e: [_initProto] } = _apply_decs_2203_r(this, [
|
|
@@ -541,8 +541,9 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
541
541
|
]
|
|
542
542
|
], []));
|
|
543
543
|
}
|
|
544
|
+
log;
|
|
544
545
|
constructor(epoch, slot, checkpointNumber, syncedToBlockNumber, // TODO(palla/mbps): Can we remove the proposer in favor of attestorAddress? Need to check fisherman-node flows.
|
|
545
|
-
proposer, publisher, attestorAddress, invalidateCheckpoint, validatorClient, globalsBuilder, p2pClient, worldState, l1ToL2MessageSource, l2BlockSource, checkpointsBuilder, blockSink, l1Constants, config, timetable, slasherClient, epochCache, dateProvider, metrics, eventEmitter, setStateFn,
|
|
546
|
+
proposer, publisher, attestorAddress, invalidateCheckpoint, validatorClient, globalsBuilder, p2pClient, worldState, l1ToL2MessageSource, l2BlockSource, checkpointsBuilder, blockSink, l1Constants, config, timetable, slasherClient, epochCache, dateProvider, metrics, eventEmitter, setStateFn, tracer, bindings){
|
|
546
547
|
this.epoch = epoch;
|
|
547
548
|
this.slot = slot;
|
|
548
549
|
this.checkpointNumber = checkpointNumber;
|
|
@@ -568,9 +569,12 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
568
569
|
this.metrics = metrics;
|
|
569
570
|
this.eventEmitter = eventEmitter;
|
|
570
571
|
this.setStateFn = setStateFn;
|
|
571
|
-
this.log = log;
|
|
572
572
|
this.tracer = tracer;
|
|
573
573
|
_initProto(this);
|
|
574
|
+
this.log = createLogger('sequencer:checkpoint-proposal', {
|
|
575
|
+
...bindings,
|
|
576
|
+
instanceId: `slot-${slot}`
|
|
577
|
+
});
|
|
574
578
|
}
|
|
575
579
|
/**
|
|
576
580
|
* Executes the checkpoint proposal job.
|
|
@@ -585,7 +589,7 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
585
589
|
// Wait until the voting promises have resolved, so all requests are enqueued (not sent)
|
|
586
590
|
await Promise.all(votesPromises);
|
|
587
591
|
if (checkpoint) {
|
|
588
|
-
this.metrics.
|
|
592
|
+
this.metrics.recordCheckpointProposalSuccess();
|
|
589
593
|
}
|
|
590
594
|
// Do not post anything to L1 if we are fishermen, but do perform L1 fee analysis
|
|
591
595
|
if (this.config.fishermanMode) {
|
|
@@ -635,13 +639,14 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
635
639
|
const l1ToL2Messages = await this.l1ToL2MessageSource.getL1ToL2Messages(this.checkpointNumber);
|
|
636
640
|
const inHash = computeInHashFromL1ToL2Messages(l1ToL2Messages);
|
|
637
641
|
// Collect the out hashes of all the checkpoints before this one in the same epoch
|
|
638
|
-
const
|
|
639
|
-
|
|
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();
|
|
640
645
|
const fork = _ts_add_disposable_resource(env, await this.worldState.fork(this.syncedToBlockNumber, {
|
|
641
646
|
closeDelayMs: 12_000
|
|
642
|
-
}),
|
|
647
|
+
}), true);
|
|
643
648
|
// Create checkpoint builder for the entire slot
|
|
644
|
-
const checkpointBuilder = await this.checkpointsBuilder.startCheckpoint(this.checkpointNumber, checkpointGlobalVariables, l1ToL2Messages, previousCheckpointOutHashes, fork);
|
|
649
|
+
const checkpointBuilder = await this.checkpointsBuilder.startCheckpoint(this.checkpointNumber, checkpointGlobalVariables, feeAssetPriceModifier, l1ToL2Messages, previousCheckpointOutHashes, fork, this.log.getBindings());
|
|
645
650
|
// Options for the validator client when creating block and checkpoint proposals
|
|
646
651
|
const blockProposalOptions = {
|
|
647
652
|
publishFullTxs: !!this.config.publishTxsWithProposals,
|
|
@@ -653,6 +658,7 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
653
658
|
};
|
|
654
659
|
let blocksInCheckpoint = [];
|
|
655
660
|
let blockPendingBroadcast = undefined;
|
|
661
|
+
const checkpointBuildTimer = new Timer();
|
|
656
662
|
try {
|
|
657
663
|
// Main loop: build blocks for the checkpoint
|
|
658
664
|
const result = await this.buildBlocksForCheckpoint(checkpointBuilder, checkpointGlobalVariables.timestamp, inHash, blockProposalOptions);
|
|
@@ -662,19 +668,7 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
662
668
|
// These errors are expected in HA mode, so we yield and let another HA node handle the slot
|
|
663
669
|
// The only distinction between the 2 errors is SlashingProtectionError throws when the payload is different,
|
|
664
670
|
// which is normal for block building (may have picked different txs)
|
|
665
|
-
if (err
|
|
666
|
-
this.log.info(`Checkpoint proposal for slot ${this.slot} already signed by another HA node, yielding`, {
|
|
667
|
-
slot: this.slot,
|
|
668
|
-
signedByNode: err.signedByNode
|
|
669
|
-
});
|
|
670
|
-
return undefined;
|
|
671
|
-
}
|
|
672
|
-
if (err instanceof SlashingProtectionError) {
|
|
673
|
-
this.log.info(`Checkpoint proposal for slot ${this.slot} blocked by slashing protection, yielding`, {
|
|
674
|
-
slot: this.slot,
|
|
675
|
-
existingMessageHash: err.existingMessageHash,
|
|
676
|
-
attemptedMessageHash: err.attemptedMessageHash
|
|
677
|
-
});
|
|
671
|
+
if (this.handleHASigningError(err, 'Block proposal')) {
|
|
678
672
|
return undefined;
|
|
679
673
|
}
|
|
680
674
|
throw err;
|
|
@@ -688,10 +682,36 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
688
682
|
});
|
|
689
683
|
return undefined;
|
|
690
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
|
+
}
|
|
691
694
|
// Assemble and broadcast the checkpoint proposal, including the last block that was not
|
|
692
695
|
// broadcasted yet, and wait to collect the committee attestations.
|
|
693
696
|
this.setStateFn(SequencerState.ASSEMBLING_CHECKPOINT, this.slot);
|
|
694
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()));
|
|
695
715
|
// Do not collect attestations nor publish to L1 in fisherman mode
|
|
696
716
|
if (this.config.fishermanMode) {
|
|
697
717
|
this.log.info(`Built checkpoint for slot ${this.slot} with ${blocksInCheckpoint.length} blocks. ` + `Skipping proposal in fisherman mode.`, {
|
|
@@ -709,7 +729,7 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
709
729
|
txs: blockPendingBroadcast.txs
|
|
710
730
|
};
|
|
711
731
|
// Create the checkpoint proposal and broadcast it
|
|
712
|
-
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);
|
|
713
733
|
const blockProposedAt = this.dateProvider.now();
|
|
714
734
|
await this.p2pClient.broadcastCheckpointProposal(proposal);
|
|
715
735
|
this.setStateFn(SequencerState.COLLECTING_ATTESTATIONS, this.slot);
|
|
@@ -723,20 +743,8 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
723
743
|
attestationsSignature = await this.validatorClient.signAttestationsAndSigners(attestations, signer, this.slot, this.checkpointNumber);
|
|
724
744
|
} catch (err) {
|
|
725
745
|
// We shouldn't really get here since we yield to another HA node
|
|
726
|
-
// as soon as we see these errors when creating block proposals.
|
|
727
|
-
if (err
|
|
728
|
-
this.log.info(`Attestations signature for slot ${this.slot} already signed by another HA node, yielding`, {
|
|
729
|
-
slot: this.slot,
|
|
730
|
-
signedByNode: err.signedByNode
|
|
731
|
-
});
|
|
732
|
-
return undefined;
|
|
733
|
-
}
|
|
734
|
-
if (err instanceof SlashingProtectionError) {
|
|
735
|
-
this.log.info(`Attestations signature for slot ${this.slot} blocked by slashing protection, yielding`, {
|
|
736
|
-
slot: this.slot,
|
|
737
|
-
existingMessageHash: err.existingMessageHash,
|
|
738
|
-
attemptedMessageHash: err.attemptedMessageHash
|
|
739
|
-
});
|
|
746
|
+
// as soon as we see these errors when creating block or checkpoint proposals.
|
|
747
|
+
if (this.handleHASigningError(err, 'Attestations signature')) {
|
|
740
748
|
return undefined;
|
|
741
749
|
}
|
|
742
750
|
throw err;
|
|
@@ -746,6 +754,14 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
746
754
|
const aztecSlotDuration = this.l1Constants.slotDuration;
|
|
747
755
|
const slotStartBuildTimestamp = this.getSlotStartBuildTimestamp();
|
|
748
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
|
+
}
|
|
749
765
|
await this.publisher.enqueueProposeCheckpoint(checkpoint, attestations, attestationsSignature, {
|
|
750
766
|
txTimeoutAt,
|
|
751
767
|
forcePendingCheckpointNumber: this.invalidateCheckpoint?.forcePendingCheckpointNumber
|
|
@@ -755,7 +771,8 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
755
771
|
env.error = e;
|
|
756
772
|
env.hasError = true;
|
|
757
773
|
} finally{
|
|
758
|
-
_ts_dispose_resources(env);
|
|
774
|
+
const result = _ts_dispose_resources(env);
|
|
775
|
+
if (result) await result;
|
|
759
776
|
}
|
|
760
777
|
} catch (err) {
|
|
761
778
|
if (err && (err instanceof DutyAlreadySignedError || err instanceof SlashingProtectionError)) {
|
|
@@ -772,13 +789,11 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
772
789
|
const blocksInCheckpoint = [];
|
|
773
790
|
const txHashesAlreadyIncluded = new Set();
|
|
774
791
|
const initialBlockNumber = BlockNumber(this.syncedToBlockNumber + 1);
|
|
775
|
-
// Remaining blob fields available for blocks (checkpoint end marker already subtracted)
|
|
776
|
-
let remainingBlobFields = BLOBS_PER_CHECKPOINT * FIELDS_PER_BLOB - NUM_CHECKPOINT_END_MARKER_FIELDS;
|
|
777
792
|
// Last block in the checkpoint will usually be flagged as pending broadcast, so we send it along with the checkpoint proposal
|
|
778
793
|
let blockPendingBroadcast = undefined;
|
|
779
794
|
while(true){
|
|
780
795
|
const blocksBuilt = blocksInCheckpoint.length;
|
|
781
|
-
const indexWithinCheckpoint = blocksBuilt;
|
|
796
|
+
const indexWithinCheckpoint = IndexWithinCheckpoint(blocksBuilt);
|
|
782
797
|
const blockNumber = BlockNumber(initialBlockNumber + blocksBuilt);
|
|
783
798
|
const secondsIntoSlot = this.getSecondsIntoSlot();
|
|
784
799
|
const timingInfo = this.timetable.canStartNextBlock(secondsIntoSlot);
|
|
@@ -799,9 +814,9 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
799
814
|
buildDeadline: timingInfo.deadline ? new Date((this.getSlotStartBuildTimestamp() + timingInfo.deadline) * 1000) : undefined,
|
|
800
815
|
blockNumber,
|
|
801
816
|
indexWithinCheckpoint,
|
|
802
|
-
txHashesAlreadyIncluded
|
|
803
|
-
remainingBlobFields
|
|
817
|
+
txHashesAlreadyIncluded
|
|
804
818
|
});
|
|
819
|
+
// TODO(palla/mbps): Review these conditions. We may want to keep trying in some scenarios.
|
|
805
820
|
if (!buildResult && timingInfo.isLastBlock) {
|
|
806
821
|
break;
|
|
807
822
|
} else if (!buildResult && timingInfo.deadline !== undefined) {
|
|
@@ -821,10 +836,8 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
821
836
|
}
|
|
822
837
|
break;
|
|
823
838
|
}
|
|
824
|
-
const { block, usedTxs
|
|
839
|
+
const { block, usedTxs } = buildResult;
|
|
825
840
|
blocksInCheckpoint.push(block);
|
|
826
|
-
// Update remaining blob fields for the next block
|
|
827
|
-
remainingBlobFields = newRemainingBlobFields;
|
|
828
841
|
// Sync the proposed block to the archiver to make it available
|
|
829
842
|
// Note that the checkpoint builder uses its own fork so it should not need to wait for this syncing
|
|
830
843
|
// Eventually we should refactor the checkpoint builder to not need a separate long-lived fork
|
|
@@ -875,15 +888,14 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
875
888
|
await this.waitUntilTimeInSlot(nextSubslotStart);
|
|
876
889
|
}
|
|
877
890
|
/** Builds a single block. Called from the main block building loop. */ async buildSingleBlock(checkpointBuilder, opts) {
|
|
878
|
-
const { blockTimestamp, forceCreate, blockNumber, indexWithinCheckpoint, buildDeadline, txHashesAlreadyIncluded
|
|
891
|
+
const { blockTimestamp, forceCreate, blockNumber, indexWithinCheckpoint, buildDeadline, txHashesAlreadyIncluded } = opts;
|
|
879
892
|
this.log.verbose(`Preparing block ${blockNumber} index ${indexWithinCheckpoint} at checkpoint ${this.checkpointNumber} for slot ${this.slot}`, {
|
|
880
893
|
...checkpointBuilder.getConstantData(),
|
|
881
894
|
...opts
|
|
882
895
|
});
|
|
883
896
|
try {
|
|
884
897
|
// Wait until we have enough txs to build the block
|
|
885
|
-
const minTxs = this.
|
|
886
|
-
const { availableTxs, canStartBuilding } = await this.waitForMinTxs(opts);
|
|
898
|
+
const { availableTxs, canStartBuilding, minTxs } = await this.waitForMinTxs(opts);
|
|
887
899
|
if (!canStartBuilding) {
|
|
888
900
|
this.log.warn(`Not enough txs to build block ${blockNumber} at index ${indexWithinCheckpoint} in slot ${this.slot} (got ${availableTxs} txs but needs ${minTxs})`, {
|
|
889
901
|
blockNumber,
|
|
@@ -900,58 +912,56 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
900
912
|
}
|
|
901
913
|
// Create iterator to pending txs. We filter out txs already included in previous blocks in the checkpoint
|
|
902
914
|
// just in case p2p failed to sync the provisional block and didn't get to remove those txs from the mempool yet.
|
|
903
|
-
const pendingTxs = filter(this.p2pClient.
|
|
915
|
+
const pendingTxs = filter(this.p2pClient.iterateEligiblePendingTxs(), (tx)=>!txHashesAlreadyIncluded.has(tx.txHash.toString()));
|
|
904
916
|
this.log.debug(`Building block ${blockNumber} at index ${indexWithinCheckpoint} for slot ${this.slot} with ${availableTxs} available txs`, {
|
|
905
917
|
slot: this.slot,
|
|
906
918
|
blockNumber,
|
|
907
919
|
indexWithinCheckpoint
|
|
908
920
|
});
|
|
909
921
|
this.setStateFn(SequencerState.CREATING_BLOCK, this.slot);
|
|
910
|
-
//
|
|
911
|
-
|
|
912
|
-
const maxBlobFieldsForTxs = remainingBlobFields - blockEndOverhead;
|
|
922
|
+
// Per-block limits derived at startup by computeBlockLimits(), further capped
|
|
923
|
+
// by remaining checkpoint-level budgets inside CheckpointBuilder before each block is built.
|
|
913
924
|
const blockBuilderOptions = {
|
|
914
925
|
maxTransactions: this.config.maxTxsPerBlock,
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
deadline: buildDeadline
|
|
926
|
+
maxBlockGas: this.config.maxL2BlockGas !== undefined || this.config.maxDABlockGas !== undefined ? new Gas(this.config.maxDABlockGas ?? Infinity, this.config.maxL2BlockGas ?? Infinity) : undefined,
|
|
927
|
+
deadline: buildDeadline,
|
|
928
|
+
isBuildingProposal: true
|
|
919
929
|
};
|
|
920
930
|
// Actually build the block by executing txs
|
|
921
|
-
const
|
|
922
|
-
const { publicGas, block, publicProcessorDuration, numTxs, blockBuildingTimer, usedTxs, failedTxs, usedTxBlobFields } = await checkpointBuilder.buildBlock(pendingTxs, blockNumber, blockTimestamp, blockBuilderOptions);
|
|
923
|
-
const blockBuildDuration = workTimer.ms();
|
|
931
|
+
const buildResult = await this.buildSingleBlockWithCheckpointBuilder(checkpointBuilder, pendingTxs, blockNumber, blockTimestamp, blockBuilderOptions);
|
|
924
932
|
// If any txs failed during execution, drop them from the mempool so we don't pick them up again
|
|
925
|
-
await this.dropFailedTxsFromP2P(failedTxs);
|
|
933
|
+
await this.dropFailedTxsFromP2P(buildResult.failedTxs);
|
|
926
934
|
// Check if we have created a block with enough txs. If there were invalid txs in the pool, or if execution took
|
|
927
935
|
// too long, then we may not get to minTxsPerBlock after executing public functions.
|
|
928
936
|
const minValidTxs = this.config.minValidTxsPerBlock ?? minTxs;
|
|
929
|
-
|
|
930
|
-
|
|
937
|
+
const numTxs = buildResult.status === 'no-valid-txs' ? 0 : buildResult.numTxs;
|
|
938
|
+
if (buildResult.status === 'no-valid-txs' || !forceCreate && numTxs < minValidTxs) {
|
|
939
|
+
this.log.warn(`Block ${blockNumber} at index ${indexWithinCheckpoint} on slot ${this.slot} has too few valid txs to be proposed`, {
|
|
931
940
|
slot: this.slot,
|
|
932
941
|
blockNumber,
|
|
933
942
|
numTxs,
|
|
934
|
-
indexWithinCheckpoint
|
|
943
|
+
indexWithinCheckpoint,
|
|
944
|
+
minValidTxs,
|
|
945
|
+
buildResult: buildResult.status
|
|
935
946
|
});
|
|
936
|
-
this.eventEmitter.emit('block-
|
|
937
|
-
|
|
938
|
-
availableTxs: numTxs,
|
|
947
|
+
this.eventEmitter.emit('block-build-failed', {
|
|
948
|
+
reason: `Insufficient valid txs`,
|
|
939
949
|
slot: this.slot
|
|
940
950
|
});
|
|
941
951
|
this.metrics.recordBlockProposalFailed('insufficient_valid_txs');
|
|
942
952
|
return undefined;
|
|
943
953
|
}
|
|
944
954
|
// Block creation succeeded, emit stats and metrics
|
|
955
|
+
const { block, publicProcessorDuration, usedTxs, blockBuildDuration } = buildResult;
|
|
945
956
|
const blockStats = {
|
|
946
957
|
eventName: 'l2-block-built',
|
|
947
958
|
duration: blockBuildDuration,
|
|
948
959
|
publicProcessDuration: publicProcessorDuration,
|
|
949
|
-
rollupCircuitsDuration: blockBuildingTimer.ms(),
|
|
950
960
|
...block.getStats()
|
|
951
961
|
};
|
|
952
962
|
const blockHash = await block.hash();
|
|
953
963
|
const txHashes = block.body.txEffects.map((tx)=>tx.txHash);
|
|
954
|
-
const manaPerSec =
|
|
964
|
+
const manaPerSec = block.header.totalManaUsed.toNumberUnsafe() / (blockBuildDuration / 1000);
|
|
955
965
|
this.log.info(`Built block ${block.number} at checkpoint ${this.checkpointNumber} for slot ${this.slot} with ${numTxs} txs`, {
|
|
956
966
|
blockHash,
|
|
957
967
|
txHashes,
|
|
@@ -962,11 +972,10 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
962
972
|
blockNumber: block.number,
|
|
963
973
|
slot: this.slot
|
|
964
974
|
});
|
|
965
|
-
this.metrics.recordBuiltBlock(blockBuildDuration,
|
|
975
|
+
this.metrics.recordBuiltBlock(blockBuildDuration, block.header.totalManaUsed.toNumberUnsafe());
|
|
966
976
|
return {
|
|
967
977
|
block,
|
|
968
|
-
usedTxs
|
|
969
|
-
remainingBlobFields: maxBlobFieldsForTxs - usedTxBlobFields
|
|
978
|
+
usedTxs
|
|
970
979
|
};
|
|
971
980
|
} catch (err) {
|
|
972
981
|
this.eventEmitter.emit('block-build-failed', {
|
|
@@ -984,9 +993,30 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
984
993
|
};
|
|
985
994
|
}
|
|
986
995
|
}
|
|
996
|
+
/** Uses the checkpoint builder to build a block, catching specific txs */ async buildSingleBlockWithCheckpointBuilder(checkpointBuilder, pendingTxs, blockNumber, blockTimestamp, blockBuilderOptions) {
|
|
997
|
+
try {
|
|
998
|
+
const workTimer = new Timer();
|
|
999
|
+
const result = await checkpointBuilder.buildBlock(pendingTxs, blockNumber, blockTimestamp, blockBuilderOptions);
|
|
1000
|
+
const blockBuildDuration = workTimer.ms();
|
|
1001
|
+
return {
|
|
1002
|
+
...result,
|
|
1003
|
+
blockBuildDuration,
|
|
1004
|
+
status: 'success'
|
|
1005
|
+
};
|
|
1006
|
+
} catch (err) {
|
|
1007
|
+
if (isErrorClass(err, NoValidTxsError)) {
|
|
1008
|
+
return {
|
|
1009
|
+
failedTxs: err.failedTxs,
|
|
1010
|
+
status: 'no-valid-txs'
|
|
1011
|
+
};
|
|
1012
|
+
}
|
|
1013
|
+
throw err;
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
987
1016
|
/** Waits until minTxs are available on the pool for building a block. */ async waitForMinTxs(opts) {
|
|
988
|
-
const minTxs = this.config.minTxsPerBlock;
|
|
989
1017
|
const { indexWithinCheckpoint, blockNumber, buildDeadline, forceCreate } = opts;
|
|
1018
|
+
// We only allow a block with 0 txs in the first block of the checkpoint
|
|
1019
|
+
const minTxs = indexWithinCheckpoint > 0 && this.config.minTxsPerBlock === 0 ? 1 : this.config.minTxsPerBlock;
|
|
990
1020
|
// Deadline is undefined if we are not enforcing the timetable, meaning we'll exit immediately when out of time
|
|
991
1021
|
const startBuildingDeadline = buildDeadline ? new Date(buildDeadline.getTime() - this.timetable.minExecutionTime * 1000) : undefined;
|
|
992
1022
|
let availableTxs = await this.p2pClient.getPendingTxCount();
|
|
@@ -996,7 +1026,8 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
996
1026
|
if (startBuildingDeadline === undefined || now >= startBuildingDeadline) {
|
|
997
1027
|
return {
|
|
998
1028
|
canStartBuilding: false,
|
|
999
|
-
availableTxs
|
|
1029
|
+
availableTxs,
|
|
1030
|
+
minTxs
|
|
1000
1031
|
};
|
|
1001
1032
|
}
|
|
1002
1033
|
// Wait a bit before checking again
|
|
@@ -1006,12 +1037,13 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
1006
1037
|
slot: this.slot,
|
|
1007
1038
|
indexWithinCheckpoint
|
|
1008
1039
|
});
|
|
1009
|
-
await
|
|
1040
|
+
await this.waitForTxsPollingInterval();
|
|
1010
1041
|
availableTxs = await this.p2pClient.getPendingTxCount();
|
|
1011
1042
|
}
|
|
1012
1043
|
return {
|
|
1013
1044
|
canStartBuilding: true,
|
|
1014
|
-
availableTxs
|
|
1045
|
+
availableTxs,
|
|
1046
|
+
minTxs
|
|
1015
1047
|
};
|
|
1016
1048
|
}
|
|
1017
1049
|
/**
|
|
@@ -1041,17 +1073,23 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
1041
1073
|
return new CommitteeAttestationsAndSigners(orderAttestations(attestations ?? [], committee));
|
|
1042
1074
|
}
|
|
1043
1075
|
const attestationTimeAllowed = this.config.enforceTimeTable ? this.timetable.getMaxAllowedTime(SequencerState.PUBLISHING_CHECKPOINT) : this.l1Constants.slotDuration;
|
|
1044
|
-
const attestationDeadline = new Date(this.
|
|
1076
|
+
const attestationDeadline = new Date((this.getSlotStartBuildTimestamp() + attestationTimeAllowed) * 1000);
|
|
1045
1077
|
this.metrics.recordRequiredAttestations(numberOfRequiredAttestations, attestationTimeAllowed);
|
|
1046
1078
|
const collectAttestationsTimer = new Timer();
|
|
1047
1079
|
let collectedAttestationsCount = 0;
|
|
1048
1080
|
try {
|
|
1049
1081
|
const attestations = await this.validatorClient.collectAttestations(proposal, numberOfRequiredAttestations, attestationDeadline);
|
|
1050
1082
|
collectedAttestationsCount = attestations.length;
|
|
1083
|
+
// Trim attestations to minimum required to save L1 calldata gas
|
|
1084
|
+
const localAddresses = this.validatorClient.getValidatorAddresses();
|
|
1085
|
+
const trimmed = trimAttestations(attestations, numberOfRequiredAttestations, this.attestorAddress, localAddresses);
|
|
1086
|
+
if (trimmed.length < attestations.length) {
|
|
1087
|
+
this.log.debug(`Trimmed attestations from ${attestations.length} to ${trimmed.length} for L1 submission`);
|
|
1088
|
+
}
|
|
1051
1089
|
// Rollup contract requires that the signatures are provided in the order of the committee
|
|
1052
|
-
const sorted = orderAttestations(
|
|
1090
|
+
const sorted = orderAttestations(trimmed, committee);
|
|
1053
1091
|
// Manipulate the attestations if we've been configured to do so
|
|
1054
|
-
if (this.config.injectFakeAttestation || this.config.shuffleAttestationOrdering) {
|
|
1092
|
+
if (this.config.injectFakeAttestation || this.config.injectHighSValueAttestation || this.config.injectUnrecoverableSignatureAttestation || this.config.shuffleAttestationOrdering) {
|
|
1055
1093
|
return this.manipulateAttestations(proposal.slotNumber, epoch, seed, committee, sorted);
|
|
1056
1094
|
}
|
|
1057
1095
|
return new CommitteeAttestationsAndSigners(sorted);
|
|
@@ -1068,7 +1106,7 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
1068
1106
|
// Compute the proposer index in the committee, since we dont want to tweak it.
|
|
1069
1107
|
// Otherwise, the L1 rollup contract will reject the block outright.
|
|
1070
1108
|
const proposerIndex = Number(this.epochCache.computeProposerIndex(slotNumber, epoch, seed, BigInt(committee.length)));
|
|
1071
|
-
if (this.config.injectFakeAttestation) {
|
|
1109
|
+
if (this.config.injectFakeAttestation || this.config.injectHighSValueAttestation || this.config.injectUnrecoverableSignatureAttestation) {
|
|
1072
1110
|
// Find non-empty attestations that are not from the proposer
|
|
1073
1111
|
const nonProposerIndices = [];
|
|
1074
1112
|
for(let i = 0; i < attestations.length; i++){
|
|
@@ -1078,8 +1116,16 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
1078
1116
|
}
|
|
1079
1117
|
if (nonProposerIndices.length > 0) {
|
|
1080
1118
|
const targetIndex = nonProposerIndices[randomInt(nonProposerIndices.length)];
|
|
1081
|
-
this.
|
|
1082
|
-
|
|
1119
|
+
if (this.config.injectHighSValueAttestation) {
|
|
1120
|
+
this.log.warn(`Injecting high-s value attestation in checkpoint for slot ${slotNumber} at index ${targetIndex}`);
|
|
1121
|
+
unfreeze(attestations[targetIndex]).signature = flipSignature(attestations[targetIndex].signature);
|
|
1122
|
+
} else if (this.config.injectUnrecoverableSignatureAttestation) {
|
|
1123
|
+
this.log.warn(`Injecting unrecoverable signature attestation in checkpoint for slot ${slotNumber} at index ${targetIndex}`);
|
|
1124
|
+
unfreeze(attestations[targetIndex]).signature = generateUnrecoverableSignature();
|
|
1125
|
+
} else {
|
|
1126
|
+
this.log.warn(`Injecting fake attestation in checkpoint for slot ${slotNumber} at index ${targetIndex}`);
|
|
1127
|
+
unfreeze(attestations[targetIndex]).signature = generateRecoverableSignature();
|
|
1128
|
+
}
|
|
1083
1129
|
}
|
|
1084
1130
|
return new CommitteeAttestationsAndSigners(attestations);
|
|
1085
1131
|
}
|
|
@@ -1088,14 +1134,25 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
1088
1134
|
const shuffled = [
|
|
1089
1135
|
...attestations
|
|
1090
1136
|
];
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
];
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1137
|
+
// Find two non-proposer positions that both have non-empty signatures to swap.
|
|
1138
|
+
// This ensures the bitmap doesn't change, so the MaliciousCommitteeAttestationsAndSigners
|
|
1139
|
+
// signers array stays correctly aligned with L1's committee reconstruction.
|
|
1140
|
+
const swappable = [];
|
|
1141
|
+
for(let k = 0; k < shuffled.length; k++){
|
|
1142
|
+
if (!shuffled[k].signature.isEmpty() && k !== proposerIndex) {
|
|
1143
|
+
swappable.push(k);
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
if (swappable.length >= 2) {
|
|
1147
|
+
const [i, j] = [
|
|
1148
|
+
swappable[0],
|
|
1149
|
+
swappable[1]
|
|
1150
|
+
];
|
|
1151
|
+
[shuffled[i], shuffled[j]] = [
|
|
1152
|
+
shuffled[j],
|
|
1153
|
+
shuffled[i]
|
|
1154
|
+
];
|
|
1155
|
+
}
|
|
1099
1156
|
const signers = new CommitteeAttestationsAndSigners(attestations).getSigners();
|
|
1100
1157
|
return new MaliciousCommitteeAttestationsAndSigners(shuffled, signers);
|
|
1101
1158
|
}
|
|
@@ -1108,7 +1165,7 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
1108
1165
|
const failedTxData = failedTxs.map((fail)=>fail.tx);
|
|
1109
1166
|
const failedTxHashes = failedTxData.map((tx)=>tx.getTxHash());
|
|
1110
1167
|
this.log.verbose(`Dropping failed txs ${failedTxHashes.join(', ')}`);
|
|
1111
|
-
await this.p2pClient.
|
|
1168
|
+
await this.p2pClient.handleFailedExecution(failedTxHashes);
|
|
1112
1169
|
}
|
|
1113
1170
|
/**
|
|
1114
1171
|
* Adds the proposed block to the archiver so it's available via P2P.
|
|
@@ -1143,15 +1200,38 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
1143
1200
|
slot: this.slot,
|
|
1144
1201
|
feeAnalysisId: feeAnalysis?.id
|
|
1145
1202
|
});
|
|
1146
|
-
this.metrics.
|
|
1203
|
+
this.metrics.recordCheckpointProposalFailed('block_build_failed');
|
|
1147
1204
|
}
|
|
1148
1205
|
this.publisher.clearPendingRequests();
|
|
1149
1206
|
}
|
|
1207
|
+
/**
|
|
1208
|
+
* Helper to handle HA double-signing errors. Returns true if the error was handled (caller should yield).
|
|
1209
|
+
*/ handleHASigningError(err, errorContext) {
|
|
1210
|
+
if (err instanceof DutyAlreadySignedError) {
|
|
1211
|
+
this.log.info(`${errorContext} for slot ${this.slot} already signed by another HA node, yielding`, {
|
|
1212
|
+
slot: this.slot,
|
|
1213
|
+
signedByNode: err.signedByNode
|
|
1214
|
+
});
|
|
1215
|
+
return true;
|
|
1216
|
+
}
|
|
1217
|
+
if (err instanceof SlashingProtectionError) {
|
|
1218
|
+
this.log.info(`${errorContext} for slot ${this.slot} blocked by slashing protection, yielding`, {
|
|
1219
|
+
slot: this.slot,
|
|
1220
|
+
existingMessageHash: err.existingMessageHash,
|
|
1221
|
+
attemptedMessageHash: err.attemptedMessageHash
|
|
1222
|
+
});
|
|
1223
|
+
return true;
|
|
1224
|
+
}
|
|
1225
|
+
return false;
|
|
1226
|
+
}
|
|
1150
1227
|
/** Waits until a specific time within the current slot */ async waitUntilTimeInSlot(targetSecondsIntoSlot) {
|
|
1151
1228
|
const slotStartTimestamp = this.getSlotStartBuildTimestamp();
|
|
1152
1229
|
const targetTimestamp = slotStartTimestamp + targetSecondsIntoSlot;
|
|
1153
1230
|
await sleepUntil(new Date(targetTimestamp * 1000), this.dateProvider.nowAsDate());
|
|
1154
1231
|
}
|
|
1232
|
+
/** Waits the polling interval for transactions. Extracted for test overriding. */ async waitForTxsPollingInterval() {
|
|
1233
|
+
await sleep(TXS_POLLING_MS);
|
|
1234
|
+
}
|
|
1155
1235
|
getSlotStartBuildTimestamp() {
|
|
1156
1236
|
return getSlotStartBuildTimestamp(this.slot, this.l1Constants);
|
|
1157
1237
|
}
|
|
@@ -21,15 +21,24 @@ export declare class SequencerMetrics {
|
|
|
21
21
|
private slots;
|
|
22
22
|
private filledSlots;
|
|
23
23
|
private blockProposalFailed;
|
|
24
|
-
private
|
|
25
|
-
private
|
|
24
|
+
private checkpointProposalSuccess;
|
|
25
|
+
private checkpointPrecheckFailed;
|
|
26
|
+
private checkpointProposalFailed;
|
|
26
27
|
private checkpointSuccess;
|
|
27
28
|
private slashingAttempts;
|
|
28
29
|
private checkpointAttestationDelay;
|
|
30
|
+
private checkpointBuildDuration;
|
|
31
|
+
private checkpointBlockCount;
|
|
32
|
+
private checkpointTxCount;
|
|
33
|
+
private checkpointTotalMana;
|
|
29
34
|
private fishermanWouldBeIncluded;
|
|
30
35
|
private fishermanTimeBeforeBlock;
|
|
31
36
|
private fishermanPendingBlobTxCount;
|
|
32
37
|
private fishermanIncludedBlobTxCount;
|
|
38
|
+
private fishermanPendingBlobCount;
|
|
39
|
+
private fishermanIncludedBlobCount;
|
|
40
|
+
private fishermanBlockBlobsFull;
|
|
41
|
+
private fishermanMaxBlobCapacity;
|
|
33
42
|
private fishermanCalculatedPriorityFee;
|
|
34
43
|
private fishermanPriorityFeeDelta;
|
|
35
44
|
private fishermanEstimatedCost;
|
|
@@ -48,8 +57,11 @@ export declare class SequencerMetrics {
|
|
|
48
57
|
incFilledSlot(proposer: string, coinbase: Hex | EthAddress | undefined): Promise<void>;
|
|
49
58
|
recordCheckpointSuccess(): void;
|
|
50
59
|
recordBlockProposalFailed(reason?: string): void;
|
|
51
|
-
|
|
52
|
-
|
|
60
|
+
recordCheckpointProposalSuccess(): void;
|
|
61
|
+
recordCheckpointPrecheckFailed(checkType: 'slot_already_taken' | 'rollup_contract_check_failed' | 'slot_mismatch' | 'block_number_mismatch'): void;
|
|
62
|
+
recordCheckpointProposalFailed(reason?: string): void;
|
|
63
|
+
/** Records aggregate metrics for a completed checkpoint build. */
|
|
64
|
+
recordCheckpointBuild(durationMs: number, blockCount: number, txCount: number, totalMana: number): void;
|
|
53
65
|
recordSlashingAttempt(actionCount: number): void;
|
|
54
66
|
/**
|
|
55
67
|
* Records metrics for a completed fisherman fee analysis
|
|
@@ -57,4 +69,4 @@ export declare class SequencerMetrics {
|
|
|
57
69
|
*/
|
|
58
70
|
recordFishermanFeeAnalysis(analysis: L1FeeAnalysisResult):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UE4QixDQUFDLE1BQU0sQ0FBQyxFQUFFLE1BQU0sUUFJN0M7SUFFRCxrRUFBa0U7SUFDbEUscUJBQXFCLENBQUMsVUFBVSxFQUFFLE1BQU0sRUFBRSxVQUFVLEVBQUUsTUFBTSxFQUFFLE9BQU8sRUFBRSxNQUFNLEVBQUUsU0FBUyxFQUFFLE1BQU0sUUFLL0Y7SUFFRCxxQkFBcUIsQ0FBQyxXQUFXLEVBQUUsTUFBTSxRQUV4QztJQUVEOzs7T0FHRztJQUNILDBCQUEwQixDQUFDLFFBQVEsRUFBRSxtQkFBbUIsUUFrSHZEO0NBQ0YifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../src/sequencer/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAML,KAAK,eAAe,EACpB,KAAK,MAAM,
|
|
1
|
+
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../src/sequencer/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAML,KAAK,eAAe,EACpB,KAAK,MAAM,EAGZ,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,KAAK,GAAG,EAAe,MAAM,MAAM,CAAC;AAE7C,OAAO,KAAK,EAAE,c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