@aztec/sequencer-client 0.0.1-commit.b2a5d0dd1 → 0.0.1-commit.b3d3157a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +281 -21
- package/dest/client/sequencer-client.d.ts +3 -3
- package/dest/client/sequencer-client.d.ts.map +1 -1
- package/dest/client/sequencer-client.js +6 -6
- package/dest/config.d.ts +6 -3
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +33 -10
- package/dest/global_variable_builder/fee_provider.js +1 -1
- package/dest/global_variable_builder/global_builder.d.ts +2 -3
- package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
- package/dest/global_variable_builder/global_builder.js +1 -1
- 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 +3 -3
- package/dest/publisher/config.d.ts.map +1 -1
- package/dest/publisher/sequencer-bundle-simulator.d.ts +96 -0
- package/dest/publisher/sequencer-bundle-simulator.d.ts.map +1 -0
- package/dest/publisher/sequencer-bundle-simulator.js +198 -0
- package/dest/publisher/sequencer-publisher.d.ts +36 -36
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +271 -500
- package/dest/sequencer/automine/automine_factory.d.ts +54 -0
- package/dest/sequencer/automine/automine_factory.d.ts.map +1 -0
- package/dest/sequencer/automine/automine_factory.js +84 -0
- package/dest/sequencer/automine/automine_sequencer.d.ts +151 -0
- package/dest/sequencer/automine/automine_sequencer.d.ts.map +1 -0
- package/dest/sequencer/automine/automine_sequencer.js +509 -0
- package/dest/sequencer/chain_state_overrides.d.ts +52 -16
- package/dest/sequencer/chain_state_overrides.d.ts.map +1 -1
- package/dest/sequencer/chain_state_overrides.js +86 -27
- package/dest/sequencer/checkpoint_proposal_job.d.ts +24 -6
- package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -1
- package/dest/sequencer/checkpoint_proposal_job.js +373 -83
- package/dest/sequencer/events.d.ts +42 -2
- package/dest/sequencer/events.d.ts.map +1 -1
- package/dest/sequencer/index.d.ts +3 -1
- package/dest/sequencer/index.d.ts.map +1 -1
- package/dest/sequencer/index.js +2 -0
- package/dest/sequencer/metrics.d.ts +3 -1
- package/dest/sequencer/metrics.d.ts.map +1 -1
- package/dest/sequencer/metrics.js +7 -0
- package/dest/sequencer/sequencer.d.ts +44 -9
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +256 -79
- package/dest/sequencer/timetable.d.ts +3 -6
- package/dest/sequencer/timetable.d.ts.map +1 -1
- package/dest/sequencer/timetable.js +3 -7
- package/dest/sequencer/types.d.ts +2 -2
- package/dest/sequencer/types.d.ts.map +1 -1
- package/dest/test/utils.d.ts +1 -1
- package/dest/test/utils.d.ts.map +1 -1
- package/dest/test/utils.js +7 -6
- package/package.json +27 -27
- package/src/client/sequencer-client.ts +12 -7
- package/src/config.ts +38 -10
- package/src/global_variable_builder/fee_provider.ts +1 -1
- package/src/global_variable_builder/global_builder.ts +2 -3
- package/src/index.ts +10 -1
- package/src/publisher/config.ts +2 -2
- package/src/publisher/sequencer-bundle-simulator.ts +254 -0
- package/src/publisher/sequencer-publisher.ts +286 -521
- package/src/sequencer/README.md +162 -520
- package/src/sequencer/automine/README.md +46 -0
- package/src/sequencer/automine/automine_factory.ts +145 -0
- package/src/sequencer/automine/automine_sequencer.ts +595 -0
- package/src/sequencer/chain_state_overrides.ts +133 -58
- package/src/sequencer/checkpoint_proposal_job.ts +420 -100
- package/src/sequencer/events.ts +46 -2
- package/src/sequencer/index.ts +2 -0
- package/src/sequencer/metrics.ts +9 -0
- package/src/sequencer/sequencer.ts +284 -95
- package/src/sequencer/timetable.ts +2 -9
- package/src/sequencer/types.ts +1 -1
- package/src/test/utils.ts +28 -10
|
@@ -372,21 +372,21 @@ function _apply_decs_2203_r(targetClass, memberDecs, classDecs, parentClass) {
|
|
|
372
372
|
}
|
|
373
373
|
var _dec, _dec1, _dec2, _dec3, _initProto;
|
|
374
374
|
import { getKzg } from '@aztec/blob-lib';
|
|
375
|
-
import {
|
|
376
|
-
import { NoCommitteeError
|
|
377
|
-
import {
|
|
375
|
+
import { PROPOSER_PIPELINING_SLOT_OFFSET } from '@aztec/epoch-cache';
|
|
376
|
+
import { NoCommitteeError } from '@aztec/ethereum/contracts';
|
|
377
|
+
import { CheckpointNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
378
378
|
import { merge, omit, pick } from '@aztec/foundation/collection';
|
|
379
|
-
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
380
379
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
381
380
|
import { createLogger } from '@aztec/foundation/log';
|
|
382
381
|
import { RunningPromise } from '@aztec/foundation/running-promise';
|
|
383
|
-
import { getSlotStartBuildTimestamp } from '@aztec/stdlib/epoch-helpers';
|
|
382
|
+
import { getEpochAtSlot, getSlotStartBuildTimestamp, getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
|
|
384
383
|
import { SequencerConfigSchema } from '@aztec/stdlib/interfaces/server';
|
|
385
384
|
import { pickFromSchema } from '@aztec/stdlib/schemas';
|
|
386
|
-
import {
|
|
385
|
+
import { MIN_EXECUTION_TIME } from '@aztec/stdlib/timetable';
|
|
387
386
|
import { Attributes, getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
|
|
388
387
|
import EventEmitter from 'node:events';
|
|
389
388
|
import { DefaultSequencerConfig } from '../config.js';
|
|
389
|
+
import { buildCheckpointSimulationOverridesPlan } from './chain_state_overrides.js';
|
|
390
390
|
import { CheckpointProposalJob } from './checkpoint_proposal_job.js';
|
|
391
391
|
import { CheckpointProposalJobMetrics } from './checkpoint_proposal_job_metrics.js';
|
|
392
392
|
import { CheckpointVoter } from './checkpoint_voter.js';
|
|
@@ -449,8 +449,11 @@ _dec = trackSpan('Sequencer.work'), _dec1 = trackSpan('Sequencer.prepareCheckpoi
|
|
|
449
449
|
}
|
|
450
450
|
runningPromise;
|
|
451
451
|
state;
|
|
452
|
+
stateSlotNumber;
|
|
453
|
+
stateEnteredAtMs;
|
|
452
454
|
metrics;
|
|
453
455
|
checkpointProposalJobMetrics;
|
|
456
|
+
stateLog;
|
|
454
457
|
/** The last slot for which we attempted to perform our voting duties with degraded block production */ lastSlotForFallbackVote;
|
|
455
458
|
/** The last slot for which we logged "no committee" warning, to avoid spam */ lastSlotForNoCommitteeWarning;
|
|
456
459
|
/** The last slot for which we triggered a checkpoint proposal job, to prevent duplicate attempts. */ lastSlotForCheckpointProposalJob;
|
|
@@ -459,12 +462,18 @@ _dec = trackSpan('Sequencer.work'), _dec1 = trackSpan('Sequencer.prepareCheckpoi
|
|
|
459
462
|
/** The last checkpoint proposal job, tracked so we can await its pending L1 submission during shutdown. */ lastCheckpointProposalJob;
|
|
460
463
|
/** The maximum number of seconds that the sequencer can be into a slot to transition to a particular state. */ timetable;
|
|
461
464
|
/** Config for the sequencer */ config;
|
|
465
|
+
signatureContext;
|
|
462
466
|
constructor(publisherFactory, validatorClient, globalsBuilder, p2pClient, worldState, slasherClient, l2BlockSource, l1ToL2MessageSource, checkpointsBuilder, l1Constants, dateProvider, epochCache, rollupContract, config, telemetry = getTelemetryClient(), log = createLogger('sequencer')){
|
|
463
|
-
super(), this.publisherFactory = publisherFactory, this.validatorClient = validatorClient, this.globalsBuilder = globalsBuilder, this.p2pClient = p2pClient, this.worldState = worldState, this.slasherClient = slasherClient, this.l2BlockSource = l2BlockSource, this.l1ToL2MessageSource = l1ToL2MessageSource, this.checkpointsBuilder = checkpointsBuilder, this.l1Constants = l1Constants, this.dateProvider = dateProvider, this.epochCache = epochCache, this.rollupContract = rollupContract, this.telemetry = telemetry, this.log = log, this.state = (_initProto(this), SequencerState.STOPPED), this.config = DefaultSequencerConfig;
|
|
467
|
+
super(), this.publisherFactory = publisherFactory, this.validatorClient = validatorClient, this.globalsBuilder = globalsBuilder, this.p2pClient = p2pClient, this.worldState = worldState, this.slasherClient = slasherClient, this.l2BlockSource = l2BlockSource, this.l1ToL2MessageSource = l1ToL2MessageSource, this.checkpointsBuilder = checkpointsBuilder, this.l1Constants = l1Constants, this.dateProvider = dateProvider, this.epochCache = epochCache, this.rollupContract = rollupContract, this.telemetry = telemetry, this.log = log, this.state = (_initProto(this), SequencerState.STOPPED), this.stateEnteredAtMs = performance.now(), this.config = DefaultSequencerConfig;
|
|
468
|
+
this.stateLog = log.createChild('state');
|
|
464
469
|
// Add [FISHERMAN] prefix to logger if in fisherman mode
|
|
465
470
|
if (config.fishermanMode) {
|
|
466
471
|
this.log = log.createChild('[FISHERMAN]');
|
|
467
472
|
}
|
|
473
|
+
this.signatureContext = {
|
|
474
|
+
chainId: config.l1ChainId,
|
|
475
|
+
rollupAddress: config.rollupAddress
|
|
476
|
+
};
|
|
468
477
|
this.metrics = new SequencerMetrics(telemetry, this.rollupContract, 'Sequencer');
|
|
469
478
|
this.checkpointProposalJobMetrics = new CheckpointProposalJobMetrics(telemetry);
|
|
470
479
|
this.updateConfig(config);
|
|
@@ -480,8 +489,7 @@ _dec = trackSpan('Sequencer.work'), _dec1 = trackSpan('Sequencer.prepareCheckpoi
|
|
|
480
489
|
l1PublishingTime: this.l1PublishingTime,
|
|
481
490
|
p2pPropagationTime,
|
|
482
491
|
blockDurationMs: this.config.blockDurationMs,
|
|
483
|
-
enforce: this.config.enforceTimeTable
|
|
484
|
-
pipelining: this.epochCache.isProposerPipeliningEnabled()
|
|
492
|
+
enforce: this.config.enforceTimeTable
|
|
485
493
|
}, this.metrics, this.log);
|
|
486
494
|
}
|
|
487
495
|
/** Initializes the sequencer (precomputes tables). Takes about 3s. */ init() {
|
|
@@ -503,6 +511,7 @@ _dec = trackSpan('Sequencer.work'), _dec1 = trackSpan('Sequencer.prepareCheckpoi
|
|
|
503
511
|
this.setState(SequencerState.STOPPING, undefined, {
|
|
504
512
|
force: true
|
|
505
513
|
});
|
|
514
|
+
this.lastCheckpointProposalJob?.interrupt();
|
|
506
515
|
await this.publisherFactory.stopAll();
|
|
507
516
|
await this.runningPromise?.stop();
|
|
508
517
|
await this.lastCheckpointProposalJob?.awaitPendingSubmission();
|
|
@@ -515,20 +524,19 @@ _dec = trackSpan('Sequencer.work'), _dec1 = trackSpan('Sequencer.prepareCheckpoi
|
|
|
515
524
|
try {
|
|
516
525
|
await this.work();
|
|
517
526
|
} catch (err) {
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
//
|
|
523
|
-
|
|
524
|
-
SequencerState.INITIALIZING_CHECKPOINT,
|
|
525
|
-
SequencerState.PROPOSER_CHECK
|
|
526
|
-
].includes(err.proposedState) ? 'debug' : 'warn';
|
|
527
|
-
this.log[logLvl](err.message, {
|
|
527
|
+
if (err instanceof SequencerTooSlowError && [
|
|
528
|
+
SequencerState.INITIALIZING_CHECKPOINT,
|
|
529
|
+
SequencerState.PROPOSER_CHECK
|
|
530
|
+
].includes(err.proposedState)) {
|
|
531
|
+
// No need to alert if we just didn't get to start in time
|
|
532
|
+
this.log.debug(err.message, {
|
|
528
533
|
now: this.dateProvider.nowInSeconds()
|
|
529
534
|
});
|
|
530
535
|
} else {
|
|
531
536
|
// Re-throw other errors
|
|
537
|
+
this.emit('checkpoint-error', {
|
|
538
|
+
error: err
|
|
539
|
+
});
|
|
532
540
|
throw err;
|
|
533
541
|
}
|
|
534
542
|
} finally{
|
|
@@ -549,8 +557,7 @@ _dec = trackSpan('Sequencer.work'), _dec1 = trackSpan('Sequencer.prepareCheckpoi
|
|
|
549
557
|
* - Submit checkpoint
|
|
550
558
|
*/ async work() {
|
|
551
559
|
this.setState(SequencerState.SYNCHRONIZING, undefined);
|
|
552
|
-
const { slot, ts, nowSeconds
|
|
553
|
-
const { slot: targetSlot, epoch: targetEpoch } = this.epochCache.getTargetEpochAndSlotInNextL1Slot();
|
|
560
|
+
const { slot, targetSlot, epoch, targetEpoch, ts, nowSeconds } = this.getSlotContextInNextL1Slot();
|
|
554
561
|
// Check if we are synced and it's our slot, grab a publisher, check previous block invalidation, etc
|
|
555
562
|
const checkpointProposalJob = await this.prepareCheckpointProposal(slot, targetSlot, epoch, targetEpoch, ts, nowSeconds);
|
|
556
563
|
if (!checkpointProposalJob) {
|
|
@@ -571,6 +578,18 @@ _dec = trackSpan('Sequencer.work'), _dec1 = trackSpan('Sequencer.prepareCheckpoi
|
|
|
571
578
|
}
|
|
572
579
|
return checkpoint;
|
|
573
580
|
}
|
|
581
|
+
/** Returns slot and target slot from a single clock snapshot. */ getSlotContextInNextL1Slot() {
|
|
582
|
+
const { slot, ts, nowSeconds, epoch } = this.epochCache.getEpochAndSlotInNextL1Slot();
|
|
583
|
+
const targetSlot = SlotNumber(slot + PROPOSER_PIPELINING_SLOT_OFFSET);
|
|
584
|
+
return {
|
|
585
|
+
slot,
|
|
586
|
+
targetSlot,
|
|
587
|
+
epoch,
|
|
588
|
+
targetEpoch: getEpochAtSlot(targetSlot, this.l1Constants),
|
|
589
|
+
ts,
|
|
590
|
+
nowSeconds
|
|
591
|
+
};
|
|
592
|
+
}
|
|
574
593
|
/**
|
|
575
594
|
* Prepares the checkpoint proposal by performing all necessary checks and setup.
|
|
576
595
|
* This is the initial step in the main loop.
|
|
@@ -588,6 +607,14 @@ _dec = trackSpan('Sequencer.work'), _dec1 = trackSpan('Sequencer.prepareCheckpoi
|
|
|
588
607
|
this.log.trace(`Slot ${targetSlot} has already been published as checkpoint ${this.lastCheckpointProposed.number}`);
|
|
589
608
|
return undefined;
|
|
590
609
|
}
|
|
610
|
+
// Test-only: skip proposing for explicitly paused slots. Attestation paths run in the validator
|
|
611
|
+
// client and are not gated by this hook, so paused proposers still attest to others' proposals.
|
|
612
|
+
if (this.config.pauseProposingForSlots?.some((s)=>s === targetSlot)) {
|
|
613
|
+
this.log.warn(`Skipping proposal for paused slot ${targetSlot} (test-only pauseProposingForSlots hook)`, {
|
|
614
|
+
targetSlot
|
|
615
|
+
});
|
|
616
|
+
return undefined;
|
|
617
|
+
}
|
|
591
618
|
// Check all components are synced to latest as seen by the archiver (queries all subsystems)
|
|
592
619
|
const syncedTo = await this.checkSync({
|
|
593
620
|
ts,
|
|
@@ -611,6 +638,7 @@ _dec = trackSpan('Sequencer.work'), _dec1 = trackSpan('Sequencer.prepareCheckpoi
|
|
|
611
638
|
if (canPropose) {
|
|
612
639
|
await this.tryVoteWhenEscapeHatchOpen({
|
|
613
640
|
slot,
|
|
641
|
+
targetSlot,
|
|
614
642
|
proposer
|
|
615
643
|
});
|
|
616
644
|
} else {
|
|
@@ -664,40 +692,84 @@ _dec = trackSpan('Sequencer.work'), _dec1 = trackSpan('Sequencer.prepareCheckpoi
|
|
|
664
692
|
const proposerForPublisher = this.config.fishermanMode ? undefined : proposer;
|
|
665
693
|
const { attestorAddress, publisher } = await this.publisherFactory.create(proposerForPublisher);
|
|
666
694
|
this.log.verbose(`Created publisher at address ${publisher.getSenderAddress()} for attestor ${attestorAddress}`);
|
|
667
|
-
//
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
}
|
|
672
|
-
// Prepare invalidation request if the pending chain is invalid (returns undefined if no need)
|
|
673
|
-
let invalidateCheckpoint = await publisher.simulateInvalidateCheckpoint(syncedTo.pendingChainValidationStatus);
|
|
695
|
+
// Prepare invalidation request if the pending chain is invalid (returns undefined if no need).
|
|
696
|
+
// Only simulate invalidation when there's no proposed parent, since we assume the proposed parent
|
|
697
|
+
// will invalidate the currently invalid checkpoint on L1.
|
|
698
|
+
const invalidateCheckpoint = syncedTo.hasProposedCheckpoint || syncedTo.pendingChainValidationStatus.valid ? undefined : await publisher.simulateInvalidateCheckpoint(syncedTo.pendingChainValidationStatus);
|
|
674
699
|
// Determine the correct archive and L1 state overrides for the canProposeAt check.
|
|
675
700
|
// The L1 contract reads archives[proposedCheckpointNumber] and compares it with the provided archive.
|
|
676
701
|
// When invalidating or pipelining, the local archive may differ from L1's, so we adjust accordingly.
|
|
677
702
|
let archiveForCheck = syncedTo.archive;
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
//
|
|
687
|
-
|
|
703
|
+
if (syncedTo.hasProposedCheckpoint) {
|
|
704
|
+
this.metrics.recordPipelineDepth(syncedTo.checkpointNumber - syncedTo.checkpointedCheckpointNumber);
|
|
705
|
+
this.log.verbose(`Building on top of proposed checkpoint (pending=${syncedTo.proposedCheckpointData?.checkpointNumber}) for target slot ${targetSlot}`, {
|
|
706
|
+
targetSlot,
|
|
707
|
+
parentCheckpointNumber: CheckpointNumber(checkpointNumber - 1)
|
|
708
|
+
});
|
|
709
|
+
// Match what L1 will see at archives[pending] once the proposed parent lands: the parent's
|
|
710
|
+
// own archive root from the gossiped proposal. `syncedTo.archive` is the world-state-local
|
|
711
|
+
// view and can transiently diverge from the proposed parent (e.g. before the proposed
|
|
712
|
+
// parent's blocks have been applied locally); diverging here would cause the canProposeAt
|
|
713
|
+
// override to set archives[pending] to one value while we present another for comparison.
|
|
714
|
+
archiveForCheck = syncedTo.proposedCheckpointData.archive.root;
|
|
688
715
|
} else if (invalidateCheckpoint) {
|
|
689
716
|
// After invalidation, L1 will roll back to checkpoint N-1. The archive at N-1 already
|
|
690
717
|
// exists on L1, so we just pass the matching archive (the lastArchive of the invalid checkpoint).
|
|
691
718
|
archiveForCheck = invalidateCheckpoint.lastArchive;
|
|
692
|
-
l1SimulationOverridesBuilder.forPendingCheckpoint(invalidateCheckpoint.forcePendingCheckpointNumber);
|
|
693
719
|
this.metrics.recordPipelineDepth(0);
|
|
694
720
|
} else {
|
|
695
721
|
this.metrics.recordPipelineDepth(0);
|
|
696
722
|
}
|
|
697
|
-
|
|
723
|
+
// Build the simulation plan: pending/proven override from pipelining or invalidation (or the
|
|
724
|
+
// current snapshot when neither applies, to short-circuit any pending prune in simulation),
|
|
725
|
+
// plus the parent checkpoint cell and fee header when pipelining.
|
|
726
|
+
const simulationOverridesPlan = await buildCheckpointSimulationOverridesPlan({
|
|
727
|
+
checkpointNumber,
|
|
728
|
+
proposedCheckpointData: syncedTo.hasProposedCheckpoint ? syncedTo.proposedCheckpointData : undefined,
|
|
729
|
+
invalidateToPendingCheckpointNumber: invalidateCheckpoint?.forcePendingCheckpointNumber,
|
|
730
|
+
checkpointedCheckpointNumber: syncedTo.checkpointedCheckpointNumber,
|
|
731
|
+
rollup: this.rollupContract,
|
|
732
|
+
signatureContext: this.signatureContext,
|
|
733
|
+
log: this.log
|
|
734
|
+
});
|
|
735
|
+
// The plan always pins both pending/proven (to short-circuit `canPruneAtTime` in simulation),
|
|
736
|
+
// so `provenOverride` always reflects the assumed proven checkpoint we are pinning the
|
|
737
|
+
// simulation to. We additionally warn when the pin is load-bearing — i.e. when a prune would
|
|
738
|
+
// actually fire at the target slot without it — so observers can spot "we are building
|
|
739
|
+
// optimistically across a pruning boundary" in the logs.
|
|
740
|
+
const provenOverride = simulationOverridesPlan?.chainTipsOverride?.proven;
|
|
741
|
+
if (provenOverride !== undefined && await this.l2BlockSource.isPruneDueAtSlot(targetSlot)) {
|
|
742
|
+
this.log.warn(`Assuming proof for epoch ending at checkpoint ${provenOverride} lands by target slot ${targetSlot}`, {
|
|
743
|
+
checkpointNumber,
|
|
744
|
+
slot,
|
|
745
|
+
targetSlot,
|
|
746
|
+
provenOverride
|
|
747
|
+
});
|
|
748
|
+
}
|
|
749
|
+
this.emit('preparing-checkpoint', {
|
|
750
|
+
targetSlot,
|
|
751
|
+
checkpointNumber,
|
|
752
|
+
hadProposedParent: syncedTo.hasProposedCheckpoint,
|
|
753
|
+
provenOverride,
|
|
754
|
+
simulatedPending: simulationOverridesPlan?.chainTipsOverride?.pending
|
|
755
|
+
});
|
|
698
756
|
const canProposeCheck = await publisher.canProposeAt(archiveForCheck, proposer ?? EthAddress.ZERO, simulationOverridesPlan);
|
|
757
|
+
const proposeContext = {
|
|
758
|
+
hasProposedCheckpoint: syncedTo.hasProposedCheckpoint,
|
|
759
|
+
proposedCheckpointNumber: syncedTo.proposedCheckpointData?.checkpointNumber,
|
|
760
|
+
checkpointedCheckpointNumber: syncedTo.checkpointedCheckpointNumber,
|
|
761
|
+
isInvalidating: !!invalidateCheckpoint,
|
|
762
|
+
invalidatingCheckpointNumber: invalidateCheckpoint?.checkpointNumber,
|
|
763
|
+
archiveForCheck: archiveForCheck.toString(),
|
|
764
|
+
overridePendingCheckpointNumber: simulationOverridesPlan?.chainTipsOverride?.pending,
|
|
765
|
+
overrideArchive: simulationOverridesPlan?.pendingCheckpointState?.archive,
|
|
766
|
+
overrideFeeHeader: simulationOverridesPlan?.pendingCheckpointState?.feeHeader
|
|
767
|
+
};
|
|
699
768
|
if (canProposeCheck === undefined) {
|
|
700
|
-
this.log.warn(`Cannot propose checkpoint ${checkpointNumber} at slot ${slot} due to failed rollup contract check`,
|
|
769
|
+
this.log.warn(`Cannot propose checkpoint ${checkpointNumber} at slot ${slot} due to failed rollup contract check`, {
|
|
770
|
+
...logCtx,
|
|
771
|
+
...proposeContext
|
|
772
|
+
});
|
|
701
773
|
this.emit('proposer-rollup-check-failed', {
|
|
702
774
|
reason: 'Rollup contract check failed',
|
|
703
775
|
slot
|
|
@@ -708,6 +780,7 @@ _dec = trackSpan('Sequencer.work'), _dec1 = trackSpan('Sequencer.prepareCheckpoi
|
|
|
708
780
|
if (canProposeCheck.slot !== targetSlot) {
|
|
709
781
|
this.log.warn(`Cannot propose block due to slot mismatch with rollup contract (this can be caused by a clock out of sync). Expected slot ${targetSlot} but got ${canProposeCheck.slot}.`, {
|
|
710
782
|
...logCtx,
|
|
783
|
+
...proposeContext,
|
|
711
784
|
rollup: canProposeCheck,
|
|
712
785
|
expectedSlot: targetSlot
|
|
713
786
|
});
|
|
@@ -721,6 +794,7 @@ _dec = trackSpan('Sequencer.work'), _dec1 = trackSpan('Sequencer.prepareCheckpoi
|
|
|
721
794
|
if (canProposeCheck.checkpointNumber !== checkpointNumber) {
|
|
722
795
|
this.log.warn(`Cannot propose due to block mismatch with rollup contract (this can be caused by a pending archiver sync). Expected checkpoint ${checkpointNumber} but got ${canProposeCheck.checkpointNumber}.`, {
|
|
723
796
|
...logCtx,
|
|
797
|
+
...proposeContext,
|
|
724
798
|
rollup: canProposeCheck,
|
|
725
799
|
expectedSlot: slot
|
|
726
800
|
});
|
|
@@ -735,14 +809,16 @@ _dec = trackSpan('Sequencer.work'), _dec1 = trackSpan('Sequencer.prepareCheckpoi
|
|
|
735
809
|
await this.p2pClient.prepareForSlot(targetSlot);
|
|
736
810
|
this.log.info(`Preparing checkpoint proposal ${checkpointNumber} for target slot ${targetSlot} during wall-clock slot ${slot}`, {
|
|
737
811
|
...logCtx,
|
|
738
|
-
|
|
739
|
-
|
|
812
|
+
...proposeContext,
|
|
813
|
+
proposer
|
|
740
814
|
});
|
|
741
815
|
// Create and return the checkpoint proposal job
|
|
742
|
-
return this.createCheckpointProposalJob(slot, targetSlot, targetEpoch, checkpointNumber, syncedTo.blockNumber, proposer, publisher, attestorAddress, invalidateCheckpoint, syncedTo.proposedCheckpointData);
|
|
816
|
+
return this.createCheckpointProposalJob(slot, targetSlot, targetEpoch, checkpointNumber, syncedTo.blockNumber, syncedTo.checkpointedCheckpointNumber, proposer, publisher, attestorAddress, invalidateCheckpoint, syncedTo.proposedCheckpointData);
|
|
743
817
|
}
|
|
744
|
-
createCheckpointProposalJob(slot, targetSlot, targetEpoch, checkpointNumber, syncedToBlockNumber, proposer, publisher, attestorAddress, invalidateCheckpoint, proposedCheckpointData) {
|
|
745
|
-
return new CheckpointProposalJob(slot, targetSlot, targetEpoch, checkpointNumber, syncedToBlockNumber, proposer, publisher, attestorAddress, invalidateCheckpoint, this.validatorClient, this.globalsBuilder, this.p2pClient, this.worldState, this.l1ToL2MessageSource, this.l2BlockSource, this.checkpointsBuilder, this.l2BlockSource, this.l1Constants, this.config, this.timetable, this.slasherClient, this.epochCache, this.dateProvider, this.metrics, this.checkpointProposalJobMetrics.createRecorder(), this,
|
|
818
|
+
createCheckpointProposalJob(slot, targetSlot, targetEpoch, checkpointNumber, syncedToBlockNumber, checkpointedCheckpointNumber, proposer, publisher, attestorAddress, invalidateCheckpoint, proposedCheckpointData) {
|
|
819
|
+
return new CheckpointProposalJob(slot, targetSlot, targetEpoch, checkpointNumber, syncedToBlockNumber, checkpointedCheckpointNumber, proposer, publisher, attestorAddress, invalidateCheckpoint, this.validatorClient, this.globalsBuilder, this.p2pClient, this.worldState, this.l1ToL2MessageSource, this.l2BlockSource, this.checkpointsBuilder, this.l2BlockSource, this.l1Constants, this.signatureContext, this.config, this.timetable, this.slasherClient, this.epochCache, this.dateProvider, this.metrics, this.checkpointProposalJobMetrics.createRecorder(), this, (state, slot, timeReferenceSlot)=>this.setState(state, slot, {
|
|
820
|
+
timeReferenceSlot
|
|
821
|
+
}), this.tracer, this.log.getBindings(), proposedCheckpointData);
|
|
746
822
|
}
|
|
747
823
|
/**
|
|
748
824
|
* Returns the current sequencer state.
|
|
@@ -752,8 +828,9 @@ _dec = trackSpan('Sequencer.work'), _dec1 = trackSpan('Sequencer.prepareCheckpoi
|
|
|
752
828
|
/**
|
|
753
829
|
* Internal helper for setting the sequencer state and checks if we have enough time left in the slot to transition to the new state.
|
|
754
830
|
* @param proposedState - The new state to transition to.
|
|
755
|
-
* @param slotNumber - The
|
|
831
|
+
* @param slotNumber - The logical slot associated with the new state.
|
|
756
832
|
* @param force - Whether to force the transition even if the sequencer is stopped.
|
|
833
|
+
* @param timeReferenceSlot - The slot to use for deadline checks when it differs from the logical slot.
|
|
757
834
|
*/ setState(proposedState, slotNumber, opts = {}) {
|
|
758
835
|
if (this.state === SequencerState.STOPPING && proposedState !== SequencerState.STOPPED && !opts.force) {
|
|
759
836
|
this.log.warn(`Cannot set sequencer to ${proposedState} as it is stopping.`);
|
|
@@ -764,25 +841,44 @@ _dec = trackSpan('Sequencer.work'), _dec1 = trackSpan('Sequencer.prepareCheckpoi
|
|
|
764
841
|
return;
|
|
765
842
|
}
|
|
766
843
|
let secondsIntoSlot = undefined;
|
|
767
|
-
|
|
768
|
-
|
|
844
|
+
const timeReferenceSlot = opts.timeReferenceSlot ?? slotNumber;
|
|
845
|
+
if (timeReferenceSlot !== undefined) {
|
|
846
|
+
secondsIntoSlot = this.getSecondsIntoSlot(timeReferenceSlot);
|
|
769
847
|
this.timetable.assertTimeLeft(proposedState, secondsIntoSlot);
|
|
770
848
|
}
|
|
849
|
+
const oldState = this.state;
|
|
850
|
+
const oldStateSlotNumber = this.stateSlotNumber;
|
|
851
|
+
const stateChanged = proposedState !== oldState;
|
|
852
|
+
const transitionAtMs = performance.now();
|
|
853
|
+
const stateDurationMs = transitionAtMs - this.stateEnteredAtMs;
|
|
771
854
|
const boringStates = [
|
|
772
855
|
SequencerState.IDLE,
|
|
773
856
|
SequencerState.SYNCHRONIZING
|
|
774
857
|
];
|
|
775
|
-
const logLevel = boringStates.includes(proposedState) && boringStates.includes(
|
|
776
|
-
this.
|
|
858
|
+
const logLevel = boringStates.includes(proposedState) && boringStates.includes(oldState) ? 'trace' : 'debug';
|
|
859
|
+
this.stateLog[logLevel](`Transitioning from ${oldState} to ${proposedState}`, {
|
|
860
|
+
oldState,
|
|
861
|
+
newState: proposedState,
|
|
777
862
|
slotNumber,
|
|
778
|
-
|
|
863
|
+
timeReferenceSlot,
|
|
864
|
+
stateSlotNumber: oldStateSlotNumber,
|
|
865
|
+
secondsIntoSlot,
|
|
866
|
+
...stateChanged && {
|
|
867
|
+
stateDurationMs: Math.ceil(stateDurationMs)
|
|
868
|
+
}
|
|
779
869
|
});
|
|
780
870
|
this.emit('state-changed', {
|
|
781
|
-
oldState
|
|
871
|
+
oldState,
|
|
782
872
|
newState: proposedState,
|
|
783
873
|
secondsIntoSlot,
|
|
784
|
-
slot: slotNumber
|
|
874
|
+
slot: slotNumber,
|
|
875
|
+
timeReferenceSlot
|
|
785
876
|
});
|
|
877
|
+
if (stateChanged) {
|
|
878
|
+
this.metrics.recordStateDuration(stateDurationMs, oldState);
|
|
879
|
+
this.stateEnteredAtMs = transitionAtMs;
|
|
880
|
+
this.stateSlotNumber = slotNumber;
|
|
881
|
+
}
|
|
786
882
|
this.state = proposedState;
|
|
787
883
|
}
|
|
788
884
|
/**
|
|
@@ -817,13 +913,10 @@ _dec = trackSpan('Sequencer.work'), _dec1 = trackSpan('Sequencer.prepareCheckpoi
|
|
|
817
913
|
checkpointed: t.checkpointed
|
|
818
914
|
})),
|
|
819
915
|
this.l2BlockSource.getPendingChainValidationStatus(),
|
|
820
|
-
this.l2BlockSource.
|
|
916
|
+
this.l2BlockSource.getProposedCheckpointData()
|
|
821
917
|
]);
|
|
822
918
|
const [worldState, l2Tips, p2p, l1ToL2MessageSourceTips, pendingChainValidationStatus, proposedCheckpointData] = syncedBlocks;
|
|
823
|
-
|
|
824
|
-
// as the world state can compute the new genesis block hash, but other components use the hardcoded constant.
|
|
825
|
-
// TODO(palla/mbps): Fix the above. All components should be able to handle dynamic genesis block hashes.
|
|
826
|
-
const result = l2Tips.proposed.number === 0 && l2Tips.checkpointed.block.number === 0 && l2Tips.checkpointed.checkpoint.number === 0 && worldState.number === 0 && p2p.number === 0 && l1ToL2MessageSourceTips.proposed.number === 0 && l1ToL2MessageSourceTips.checkpointed.block.number === 0 && l1ToL2MessageSourceTips.checkpointed.checkpoint.number === 0 || worldState.hash === l2Tips.proposed.hash && p2p.hash === l2Tips.proposed.hash && l1ToL2MessageSourceTips.proposed.hash === l2Tips.proposed.hash && l1ToL2MessageSourceTips.checkpointed.block.hash === l2Tips.checkpointed.block.hash && l1ToL2MessageSourceTips.checkpointed.checkpoint.hash === l2Tips.checkpointed.checkpoint.hash;
|
|
919
|
+
const result = worldState.hash === l2Tips.proposed.hash && p2p.hash === l2Tips.proposed.hash && l1ToL2MessageSourceTips.proposed.hash === l2Tips.proposed.hash && l1ToL2MessageSourceTips.checkpointed.block.hash === l2Tips.checkpointed.block.hash && l1ToL2MessageSourceTips.checkpointed.checkpoint.hash === l2Tips.checkpointed.checkpoint.hash;
|
|
827
920
|
if (!result) {
|
|
828
921
|
this.log.debug(`Sequencer sync check failed`, {
|
|
829
922
|
worldState,
|
|
@@ -833,27 +926,75 @@ _dec = trackSpan('Sequencer.work'), _dec1 = trackSpan('Sequencer.prepareCheckpoi
|
|
|
833
926
|
});
|
|
834
927
|
return undefined;
|
|
835
928
|
}
|
|
836
|
-
// Special case for genesis state
|
|
837
929
|
const blockNumber = worldState.number;
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
blockNumber
|
|
844
|
-
|
|
845
|
-
hasProposedCheckpoint: false,
|
|
930
|
+
const blockData = await this.l2BlockSource.getBlockData({
|
|
931
|
+
number: blockNumber
|
|
932
|
+
});
|
|
933
|
+
if (!blockData) {
|
|
934
|
+
this.log.warn(`Sequencer sync check failed: failed to get L2 block data ${blockNumber} from the archiver`, {
|
|
935
|
+
blockNumber,
|
|
936
|
+
l2Tips,
|
|
846
937
|
syncedL2Slot,
|
|
847
|
-
|
|
848
|
-
};
|
|
938
|
+
...args
|
|
939
|
+
});
|
|
940
|
+
return undefined;
|
|
849
941
|
}
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
942
|
+
// Refuse to build a checkpoint on top of a proposed block whose enclosing checkpoint was never
|
|
943
|
+
// proposed. Under pipelining we may have received and reexecuted such a block locally — advancing
|
|
944
|
+
// our world-state tip past the checkpointed tip — while the proposing node never published the
|
|
945
|
+
// matching proposed checkpoint (e.g. it crashed before assembling it). Building on this orphan block
|
|
946
|
+
// would fork the chain off a tip no other node can follow. The archiver prunes these orphan blocks
|
|
947
|
+
// once their build slot ends; this guard is the correctness barrier during the grace window before.
|
|
948
|
+
if (blockData.checkpointNumber > l2Tips.checkpointed.checkpoint.number && (l2Tips.proposedCheckpoint.checkpoint.number !== blockData.checkpointNumber || proposedCheckpointData?.checkpointNumber !== blockData.checkpointNumber)) {
|
|
949
|
+
const logCtx = {
|
|
950
|
+
blockCheckpointNumber: blockData.checkpointNumber,
|
|
951
|
+
checkpointedCheckpointNumber: l2Tips.checkpointed.checkpoint.number,
|
|
952
|
+
proposedCheckpointTipNumber: l2Tips.proposedCheckpoint.checkpoint.number,
|
|
953
|
+
proposedCheckpointDataNumber: proposedCheckpointData?.checkpointNumber,
|
|
954
|
+
blockNumber: blockData.header.getBlockNumber(),
|
|
955
|
+
blockSlot: blockData.header.getSlot(),
|
|
956
|
+
syncedL2Slot,
|
|
957
|
+
...args
|
|
958
|
+
};
|
|
959
|
+
// Under pipelining the block proposal for a checkpoint leads its checkpoint proposal by up to one
|
|
960
|
+
// slot, so a world-state tip sitting in an as-yet-unproposed checkpoint is the expected steady state
|
|
961
|
+
// until that checkpoint is due. Only treat it as abnormal — and warn — once the checkpoint is overdue
|
|
962
|
+
// by the same deadline the archiver uses to prune the orphan block (see pruneOrphanProposedBlocks).
|
|
963
|
+
// Before then this is normal pipelining and we wait it out quietly.
|
|
964
|
+
if (this.isProposedCheckpointOverdue(blockData.header.getSlot())) {
|
|
965
|
+
this.log.warn(`Sequencer sync check failed: proposed block has no matching proposed checkpoint`, logCtx);
|
|
966
|
+
} else {
|
|
967
|
+
this.log.debug(`Waiting for proposed checkpoint to catch up with reexecuted block`, logCtx);
|
|
968
|
+
}
|
|
854
969
|
return undefined;
|
|
855
970
|
}
|
|
856
971
|
const hasProposedCheckpoint = l2Tips.proposedCheckpoint.checkpoint.number > l2Tips.checkpointed.checkpoint.number;
|
|
972
|
+
// The l2Tips and proposedCheckpointData reads above come from independent archiver snapshots
|
|
973
|
+
// (a JS-side tips cache vs. a direct store read on `#proposedCheckpoints`). A concurrent archiver
|
|
974
|
+
// write that mutates both can be observed split, leaving us with `hasProposedCheckpoint=true` but
|
|
975
|
+
// no proposedCheckpointData (or one whose number doesn't match the tip). Refuse to proceed in that
|
|
976
|
+
// window — the next checkSync tick will see a coherent snapshot.
|
|
977
|
+
if (hasProposedCheckpoint && (!proposedCheckpointData || proposedCheckpointData.checkpointNumber !== l2Tips.proposedCheckpoint.checkpoint.number)) {
|
|
978
|
+
this.log.warn(`Sequencer sync check failed: inconsistent proposed-checkpoint state`, {
|
|
979
|
+
proposedCheckpointTipNumber: l2Tips.proposedCheckpoint.checkpoint.number,
|
|
980
|
+
checkpointedTipNumber: l2Tips.checkpointed.checkpoint.number,
|
|
981
|
+
proposedCheckpointDataNumber: proposedCheckpointData?.checkpointNumber,
|
|
982
|
+
syncedL2Slot,
|
|
983
|
+
...args
|
|
984
|
+
});
|
|
985
|
+
return undefined;
|
|
986
|
+
}
|
|
987
|
+
// Check that the proposed checkpoint is indeed the parent of the checkpoint we'll be building
|
|
988
|
+
// The checkpoint number to build is derived as blockData.checkpointNumber + 1
|
|
989
|
+
if (proposedCheckpointData && proposedCheckpointData.checkpointNumber !== blockData.checkpointNumber) {
|
|
990
|
+
this.log.warn(`Sequencer sync check failed: proposed checkpoint number mismatch`, {
|
|
991
|
+
proposedCheckpointNumber: proposedCheckpointData.checkpointNumber,
|
|
992
|
+
blockCheckpointNumber: blockData.checkpointNumber,
|
|
993
|
+
syncedL2Slot,
|
|
994
|
+
...args
|
|
995
|
+
});
|
|
996
|
+
return undefined;
|
|
997
|
+
}
|
|
857
998
|
return {
|
|
858
999
|
blockData,
|
|
859
1000
|
blockNumber: blockData.header.getBlockNumber(),
|
|
@@ -867,6 +1008,18 @@ _dec = trackSpan('Sequencer.work'), _dec1 = trackSpan('Sequencer.prepareCheckpoi
|
|
|
867
1008
|
};
|
|
868
1009
|
}
|
|
869
1010
|
/**
|
|
1011
|
+
* Whether the enclosing checkpoint of a reexecuted block is overdue: past the deadline by which a
|
|
1012
|
+
* well-behaved proposer should have published it. Mirrors the archiver's orphan-prune deadline (the
|
|
1013
|
+
* start of the slot after the block's build slot, plus a grace period) so the sequencer only warns
|
|
1014
|
+
* about a missing proposed checkpoint once the archiver itself would prune the orphan block. The grace
|
|
1015
|
+
* is derived from the block build duration the same way the archiver defaults it at node wiring.
|
|
1016
|
+
*/ isProposedCheckpointOverdue(blockSlot) {
|
|
1017
|
+
const expectedBySlot = SlotNumber(Number(blockSlot) - PROPOSER_PIPELINING_SLOT_OFFSET + 1);
|
|
1018
|
+
const graceSeconds = this.config.blockDurationMs !== undefined ? Math.ceil(this.config.blockDurationMs / 1000) : MIN_EXECUTION_TIME;
|
|
1019
|
+
const expectedByTime = getTimestampForSlot(expectedBySlot, this.l1Constants) + BigInt(graceSeconds);
|
|
1020
|
+
return BigInt(this.dateProvider.nowInSeconds()) >= expectedByTime;
|
|
1021
|
+
}
|
|
1022
|
+
/**
|
|
870
1023
|
* Checks if we are the proposer for the next slot.
|
|
871
1024
|
* @returns True if we can propose, and the proposer address (undefined if anyone can propose)
|
|
872
1025
|
*/ async checkCanPropose(targetSlot) {
|
|
@@ -980,13 +1133,21 @@ _dec = trackSpan('Sequencer.work'), _dec1 = trackSpan('Sequencer.prepareCheckpoi
|
|
|
980
1133
|
this.log.info(`Voting in slot ${slot} despite sync failure`, {
|
|
981
1134
|
slot
|
|
982
1135
|
});
|
|
983
|
-
|
|
1136
|
+
// Votes are EIP-712-signed for `targetSlot` (the pipelined slot in which the multicall is
|
|
1137
|
+
// expected to mine). Delay submission to the start of `targetSlot` so the tx mines in the
|
|
1138
|
+
// slot the votes were signed for. We fire-and-forget so we don't block the sequencer's
|
|
1139
|
+
// work loop while waiting for the target slot to start.
|
|
1140
|
+
void publisher.sendRequestsAt(targetSlot).catch((err)=>{
|
|
1141
|
+
this.log.error(`Failed to publish votes despite sync failure for slot ${slot}`, err, {
|
|
1142
|
+
slot
|
|
1143
|
+
});
|
|
1144
|
+
});
|
|
984
1145
|
}
|
|
985
1146
|
/**
|
|
986
1147
|
* Tries to vote on slashing actions and governance proposals when escape hatch is open.
|
|
987
1148
|
* This allows the sequencer to participate in voting without performing checkpoint proposal work.
|
|
988
1149
|
*/ async tryVoteWhenEscapeHatchOpen(args) {
|
|
989
|
-
const { slot, proposer } = args;
|
|
1150
|
+
const { slot, targetSlot, proposer } = args;
|
|
990
1151
|
// Prevent duplicate attempts in the same slot
|
|
991
1152
|
if (this.lastSlotForFallbackVote === slot) {
|
|
992
1153
|
this.log.trace(`Already attempted to vote in slot ${slot} (escape hatch open, skipping)`);
|
|
@@ -997,9 +1158,14 @@ _dec = trackSpan('Sequencer.work'), _dec1 = trackSpan('Sequencer.prepareCheckpoi
|
|
|
997
1158
|
const { attestorAddress, publisher } = await this.publisherFactory.create(proposer);
|
|
998
1159
|
this.log.debug(`Escape hatch open for slot ${slot}, attempting vote-only actions`, {
|
|
999
1160
|
slot,
|
|
1161
|
+
targetSlot,
|
|
1000
1162
|
attestorAddress
|
|
1001
1163
|
});
|
|
1002
|
-
|
|
1164
|
+
// Under proposer pipelining, the multicall is expected to mine in `targetSlot` (slot + 1).
|
|
1165
|
+
// Governance and slashing votes are EIP-712-signed against the slot they will mine in, and the
|
|
1166
|
+
// L1 contract checks `msg.sender == getCurrentProposer()` using the mining slot. So we must
|
|
1167
|
+
// sign for `targetSlot` and delay submission to the start of `targetSlot`.
|
|
1168
|
+
const voter = new CheckpointVoter(targetSlot, publisher, attestorAddress, this.validatorClient, this.slasherClient, this.l1Constants, this.config, this.metrics, this.log);
|
|
1003
1169
|
const votesPromises = voter.enqueueVotes();
|
|
1004
1170
|
const votes = await Promise.all(votesPromises);
|
|
1005
1171
|
if (votes.every((p)=>!p)) {
|
|
@@ -1007,9 +1173,20 @@ _dec = trackSpan('Sequencer.work'), _dec1 = trackSpan('Sequencer.prepareCheckpoi
|
|
|
1007
1173
|
return;
|
|
1008
1174
|
}
|
|
1009
1175
|
this.log.info(`Voting in slot ${slot} (escape hatch open)`, {
|
|
1010
|
-
slot
|
|
1176
|
+
slot,
|
|
1177
|
+
targetSlot
|
|
1178
|
+
});
|
|
1179
|
+
// Votes are EIP-712-signed for `targetSlot`. Delay submission to the start of `targetSlot` so
|
|
1180
|
+
// the multicall mines in the slot the votes were signed for; otherwise the L1 contract reads
|
|
1181
|
+
// `signaler = getCurrentProposer()` against the wrong slot and signature verification fails
|
|
1182
|
+
// silently inside Multicall3. Fire-and-forget so we don't block the sequencer's work loop while
|
|
1183
|
+
// waiting for the target slot to start, mirroring tryVoteWhenSyncFails.
|
|
1184
|
+
void publisher.sendRequestsAt(targetSlot).catch((err)=>{
|
|
1185
|
+
this.log.error(`Failed to publish escape-hatch votes for slot ${slot}`, err, {
|
|
1186
|
+
slot,
|
|
1187
|
+
targetSlot
|
|
1188
|
+
});
|
|
1011
1189
|
});
|
|
1012
|
-
await publisher.sendRequests();
|
|
1013
1190
|
}
|
|
1014
1191
|
/**
|
|
1015
1192
|
* Considers invalidating a block if the pending chain is invalid. Depends on how long the invalid block
|
|
@@ -51,11 +51,9 @@ export declare class SequencerTimetable {
|
|
|
51
51
|
readonly blockDuration: number | undefined;
|
|
52
52
|
/** Maximum number of blocks that can be built in this slot configuration */
|
|
53
53
|
readonly maxNumberOfBlocks: number;
|
|
54
|
-
/** Whether pipelining is enabled (checkpoint finalization deferred to next slot). */
|
|
55
|
-
readonly pipelining: boolean;
|
|
56
54
|
/**
|
|
57
|
-
* How far into the target slot attestation collection can
|
|
58
|
-
*
|
|
55
|
+
* How far into the target slot assembly and attestation collection can start when pipelining.
|
|
56
|
+
* Production-like timing keeps this at zero; fast local publishing profiles can use the attestation window.
|
|
59
57
|
*/
|
|
60
58
|
readonly pipeliningAttestationGracePeriod: number;
|
|
61
59
|
constructor(opts: {
|
|
@@ -65,7 +63,6 @@ export declare class SequencerTimetable {
|
|
|
65
63
|
p2pPropagationTime?: number;
|
|
66
64
|
blockDurationMs?: number;
|
|
67
65
|
enforce: boolean;
|
|
68
|
-
pipelining?: boolean;
|
|
69
66
|
}, metrics?: SequencerMetrics | undefined, log?: Logger | undefined);
|
|
70
67
|
getCheckpointAssemblyDeadline(): number;
|
|
71
68
|
getCheckpointAttestationDeadline(): number;
|
|
@@ -98,4 +95,4 @@ export declare class SequencerTimetable {
|
|
|
98
95
|
isLastBlock: boolean;
|
|
99
96
|
};
|
|
100
97
|
}
|
|
101
|
-
//# sourceMappingURL=data:application/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