@aztec/sequencer-client 3.0.0-nightly.20251221 → 3.0.0-nightly.20251223
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 +9 -8
- package/dest/client/sequencer-client.d.ts.map +1 -1
- package/dest/client/sequencer-client.js +28 -24
- package/dest/config.d.ts +7 -1
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +63 -26
- package/dest/global_variable_builder/global_builder.d.ts +16 -8
- package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
- package/dest/global_variable_builder/global_builder.js +35 -26
- 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/config.js +2 -2
- package/dest/publisher/sequencer-publisher-factory.d.ts +3 -3
- package/dest/publisher/sequencer-publisher-factory.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher-factory.js +1 -1
- package/dest/publisher/sequencer-publisher-metrics.d.ts +3 -3
- package/dest/publisher/sequencer-publisher-metrics.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.d.ts +11 -24
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +50 -62
- package/dest/sequencer/block_builder.d.ts +1 -3
- package/dest/sequencer/block_builder.d.ts.map +1 -1
- package/dest/sequencer/block_builder.js +4 -2
- package/dest/sequencer/checkpoint_builder.d.ts +63 -0
- package/dest/sequencer/checkpoint_builder.d.ts.map +1 -0
- package/dest/sequencer/checkpoint_builder.js +131 -0
- package/dest/sequencer/checkpoint_proposal_job.d.ts +73 -0
- package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -0
- package/dest/sequencer/checkpoint_proposal_job.js +638 -0
- package/dest/sequencer/checkpoint_voter.d.ts +34 -0
- package/dest/sequencer/checkpoint_voter.d.ts.map +1 -0
- package/dest/sequencer/checkpoint_voter.js +85 -0
- package/dest/sequencer/events.d.ts +46 -0
- package/dest/sequencer/events.d.ts.map +1 -0
- package/dest/sequencer/events.js +1 -0
- package/dest/sequencer/index.d.ts +5 -1
- package/dest/sequencer/index.d.ts.map +1 -1
- package/dest/sequencer/index.js +4 -0
- package/dest/sequencer/metrics.d.ts +3 -1
- package/dest/sequencer/metrics.d.ts.map +1 -1
- package/dest/sequencer/metrics.js +9 -0
- package/dest/sequencer/sequencer.d.ts +87 -127
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +179 -596
- package/dest/sequencer/timetable.d.ts +33 -13
- package/dest/sequencer/timetable.d.ts.map +1 -1
- package/dest/sequencer/timetable.js +73 -39
- package/dest/sequencer/types.d.ts +3 -0
- package/dest/sequencer/types.d.ts.map +1 -0
- package/dest/sequencer/types.js +1 -0
- package/dest/sequencer/utils.d.ts +14 -8
- package/dest/sequencer/utils.d.ts.map +1 -1
- package/dest/sequencer/utils.js +7 -4
- package/dest/test/index.d.ts +3 -1
- package/dest/test/index.d.ts.map +1 -1
- package/package.json +27 -27
- package/src/client/sequencer-client.ts +24 -31
- package/src/config.ts +68 -25
- package/src/global_variable_builder/global_builder.ts +45 -39
- package/src/index.ts +2 -0
- package/src/publisher/config.ts +3 -3
- package/src/publisher/sequencer-publisher-factory.ts +3 -3
- package/src/publisher/sequencer-publisher-metrics.ts +2 -2
- package/src/publisher/sequencer-publisher.ts +71 -74
- package/src/sequencer/block_builder.ts +4 -1
- package/src/sequencer/checkpoint_builder.ts +217 -0
- package/src/sequencer/checkpoint_proposal_job.ts +701 -0
- package/src/sequencer/checkpoint_voter.ts +105 -0
- package/src/sequencer/events.ts +27 -0
- package/src/sequencer/index.ts +4 -0
- package/src/sequencer/metrics.ts +11 -0
- package/src/sequencer/sequencer.ts +275 -804
- package/src/sequencer/timetable.ts +84 -49
- package/src/sequencer/types.ts +6 -0
- package/src/sequencer/utils.ts +18 -9
- package/src/test/index.ts +2 -0
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { SequencerMetrics } from './metrics.js';
|
|
2
2
|
import { SequencerState } from './utils.js';
|
|
3
|
+
export declare const MIN_EXECUTION_TIME = 1;
|
|
4
|
+
export declare const CHECKPOINT_INITIALIZATION_TIME = 1;
|
|
5
|
+
export declare const CHECKPOINT_FINALIZATION_TIME = 1;
|
|
3
6
|
export declare class SequencerTimetable {
|
|
4
7
|
private readonly metrics?;
|
|
5
8
|
private readonly log;
|
|
@@ -15,36 +18,53 @@ export declare class SequencerTimetable {
|
|
|
15
18
|
* we can just post in the very last second of the L1 slot and still expect the tx to be accepted.
|
|
16
19
|
*/
|
|
17
20
|
readonly l1PublishingTime: number;
|
|
18
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* What's the minimum time we want to leave available for execution and reexecution (used to derive init deadline)
|
|
23
|
+
* Defaults to half of the block duration if set, otherwise a constant.
|
|
24
|
+
*/
|
|
19
25
|
readonly minExecutionTime: number;
|
|
20
26
|
/** How long it takes to get ready to start building */
|
|
21
|
-
readonly
|
|
27
|
+
readonly checkpointInitializationTime: number;
|
|
22
28
|
/** How long it takes to for proposals and attestations to travel across the p2p layer (one-way) */
|
|
23
|
-
readonly
|
|
24
|
-
/** How much time we spend validating and processing a
|
|
25
|
-
readonly
|
|
29
|
+
readonly p2pPropagationTime: number;
|
|
30
|
+
/** How much time we spend validating and processing a checkpoint after building it */
|
|
31
|
+
readonly checkpointFinalizationTime: number;
|
|
26
32
|
/** Ethereum slot duration in seconds */
|
|
27
33
|
readonly ethereumSlotDuration: number;
|
|
28
34
|
/** Aztec slot duration in seconds (must be multiple of ethereum slot duration) */
|
|
29
35
|
readonly aztecSlotDuration: number;
|
|
30
|
-
/** How late into an L1 slot we can send a tx to make sure it gets included in the immediate next block. Complement of l1PublishingTime. */
|
|
31
|
-
readonly maxL1TxInclusionTimeIntoSlot: number;
|
|
32
36
|
/** Whether assertTimeLeft will throw if not enough time. */
|
|
33
37
|
readonly enforce: boolean;
|
|
38
|
+
/** Duration per block when building multiple blocks per slot (undefined = single block per slot) */
|
|
39
|
+
readonly blockDuration: number | undefined;
|
|
34
40
|
constructor(opts: {
|
|
35
41
|
ethereumSlotDuration: number;
|
|
36
42
|
aztecSlotDuration: number;
|
|
37
|
-
|
|
38
|
-
|
|
43
|
+
l1PublishingTime: number;
|
|
44
|
+
p2pPropagationTime?: number;
|
|
45
|
+
blockDurationMs?: number;
|
|
39
46
|
enforce: boolean;
|
|
40
47
|
}, metrics?: SequencerMetrics | undefined, log?: import("@aztec/aztec.js/log").Logger);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
48
|
+
/** Deadline for a block proposal execution. Ensures we have enough time left for reexecution and publishing. */
|
|
49
|
+
getProposerExecTimeEnd(secondsIntoSlot: number): number;
|
|
50
|
+
/** Deadline for block proposal reexecution. Ensures the proposer has enough time for publishing. */
|
|
44
51
|
getValidatorReexecTimeEnd(secondsIntoSlot?: number): number;
|
|
45
52
|
getMaxAllowedTime(state: Extract<SequencerState, SequencerState.STOPPED | SequencerState.IDLE | SequencerState.SYNCHRONIZING>): undefined;
|
|
46
53
|
getMaxAllowedTime(state: Exclude<SequencerState, SequencerState.STOPPED | SequencerState.IDLE | SequencerState.SYNCHRONIZING>): number;
|
|
47
54
|
getMaxAllowedTime(state: SequencerState): number | undefined;
|
|
48
55
|
assertTimeLeft(newState: SequencerState, secondsIntoSlot: number): void;
|
|
56
|
+
/**
|
|
57
|
+
* Get timing information for building blocks within a slot.
|
|
58
|
+
* @param secondsIntoSlot - Current seconds into the slot
|
|
59
|
+
* @returns Object containing:
|
|
60
|
+
* - canStart: boolean - Whether there's time to start a block now
|
|
61
|
+
* - deadline: number - Deadline (seconds into slot) for building the block
|
|
62
|
+
* - isLastBlock: boolean - Whether the next block would be the last one in the checkpoint
|
|
63
|
+
*/
|
|
64
|
+
canStartNextBlock(secondsIntoSlot: number): {
|
|
65
|
+
canStart: boolean;
|
|
66
|
+
deadline: number | undefined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sYUFBYSxDQUFDLEdBQzFHLE1BQU0sQ0FBQztJQUNILGlCQUFpQixDQUFDLEtBQUssRUFBRSxjQUFjLEdBQUcsTUFBTSxHQUFHLFNBQVMsQ0FBQztJQTJCN0QsY0FBYyxDQUFDLFFBQVEsRUFBRSxjQUFjLEVBQUUsZUFBZSxFQUFFLE1BQU0sUUFpQnRFO0lBRUQ7Ozs7Ozs7T0FPRztJQUNJLGlCQUFpQixDQUFDLGVBQWUsRUFBRSxNQUFNLEdBQUc7UUFDakQsUUFBUSxFQUFFLE9BQU8sQ0FBQztRQUNsQixRQUFRLEVBQUUsTUFBTSxHQUFHLFNBQVMsQ0FBQztRQUM3QixXQUFXLEVBQUUsT0FBTyxDQUFDO0tBQ3RCLENBZ0JBO0NBQ0YifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timetable.d.ts","sourceRoot":"","sources":["../../src/sequencer/timetable.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"timetable.d.ts","sourceRoot":"","sources":["../../src/sequencer/timetable.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,eAAO,MAAM,kBAAkB,IAAI,CAAC;AACpC,eAAO,MAAM,8BAA8B,IAAI,CAAC;AAChD,eAAO,MAAM,4BAA4B,IAAI,CAAC;AAE9C,qBAAa,kBAAkB;IAmD3B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;IACzB,OAAO,CAAC,QAAQ,CAAC,GAAG;IAnDtB;;;;OAIG;IACH,SAAgB,kBAAkB,EAAE,MAAM,CAAC;IAE3C;;;;OAIG;IACH,SAAgB,gBAAgB,EAAE,MAAM,CAAC;IAEzC;;;OAG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S,CAAC;IA2B7D,cAAc,CAAC,QAAQ,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,QAiBtE;IAED;;;;;;;OAOG;IACI,iBAAiB,CAAC,eAAe,EAAE,MAAM,GAAG;QACjD,QAAQ,EAAE,OAAO,CAAC;QAClB,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;QAC7B,WAAW,EAAE,OAAO,CAAC;KACtB,CAgBA;CACF"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createLogger } from '@aztec/aztec.js/log';
|
|
2
|
-
import { DEFAULT_ATTESTATION_PROPAGATION_TIME } from '../config.js';
|
|
2
|
+
import { DEFAULT_ATTESTATION_PROPAGATION_TIME as DEFAULT_P2P_PROPAGATION_TIME } from '../config.js';
|
|
3
3
|
import { SequencerTooSlowError } from './errors.js';
|
|
4
4
|
import { SequencerState } from './utils.js';
|
|
5
|
-
const MIN_EXECUTION_TIME = 1;
|
|
6
|
-
const
|
|
7
|
-
const
|
|
5
|
+
export const MIN_EXECUTION_TIME = 1;
|
|
6
|
+
export const CHECKPOINT_INITIALIZATION_TIME = 1;
|
|
7
|
+
export const CHECKPOINT_FINALIZATION_TIME = 1;
|
|
8
8
|
export class SequencerTimetable {
|
|
9
9
|
metrics;
|
|
10
10
|
log;
|
|
@@ -18,59 +18,63 @@ export class SequencerTimetable {
|
|
|
18
18
|
* but we'll timeout sooner to give it more time to propagate (remember we also have blobs!). Still, when working in anvil,
|
|
19
19
|
* we can just post in the very last second of the L1 slot and still expect the tx to be accepted.
|
|
20
20
|
*/ l1PublishingTime;
|
|
21
|
-
/**
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
/**
|
|
22
|
+
* What's the minimum time we want to leave available for execution and reexecution (used to derive init deadline)
|
|
23
|
+
* Defaults to half of the block duration if set, otherwise a constant.
|
|
24
|
+
*/ minExecutionTime;
|
|
25
|
+
/** How long it takes to get ready to start building */ checkpointInitializationTime;
|
|
26
|
+
/** How long it takes to for proposals and attestations to travel across the p2p layer (one-way) */ p2pPropagationTime;
|
|
27
|
+
/** How much time we spend validating and processing a checkpoint after building it */ checkpointFinalizationTime;
|
|
25
28
|
/** Ethereum slot duration in seconds */ ethereumSlotDuration;
|
|
26
29
|
/** Aztec slot duration in seconds (must be multiple of ethereum slot duration) */ aztecSlotDuration;
|
|
27
|
-
/** How late into an L1 slot we can send a tx to make sure it gets included in the immediate next block. Complement of l1PublishingTime. */ maxL1TxInclusionTimeIntoSlot;
|
|
28
30
|
/** Whether assertTimeLeft will throw if not enough time. */ enforce;
|
|
31
|
+
/** Duration per block when building multiple blocks per slot (undefined = single block per slot) */ blockDuration;
|
|
29
32
|
constructor(opts, metrics, log = createLogger('sequencer:timetable')){
|
|
30
33
|
this.metrics = metrics;
|
|
31
34
|
this.log = log;
|
|
32
35
|
this.minExecutionTime = MIN_EXECUTION_TIME;
|
|
33
|
-
this.
|
|
34
|
-
this.
|
|
36
|
+
this.checkpointInitializationTime = CHECKPOINT_INITIALIZATION_TIME;
|
|
37
|
+
this.checkpointFinalizationTime = CHECKPOINT_FINALIZATION_TIME;
|
|
35
38
|
this.ethereumSlotDuration = opts.ethereumSlotDuration;
|
|
36
39
|
this.aztecSlotDuration = opts.aztecSlotDuration;
|
|
37
|
-
this.
|
|
38
|
-
this.
|
|
39
|
-
this.
|
|
40
|
+
this.l1PublishingTime = opts.l1PublishingTime;
|
|
41
|
+
this.p2pPropagationTime = opts.p2pPropagationTime ?? DEFAULT_P2P_PROPAGATION_TIME;
|
|
42
|
+
this.blockDuration = opts.blockDurationMs ? opts.blockDurationMs / 1000 : undefined;
|
|
43
|
+
this.minExecutionTime = MIN_EXECUTION_TIME;
|
|
40
44
|
this.enforce = opts.enforce;
|
|
41
45
|
// Assume zero-cost propagation time and faster runs in test environments where L1 slot duration is shortened
|
|
42
46
|
if (this.ethereumSlotDuration < 8) {
|
|
43
|
-
this.
|
|
44
|
-
this.
|
|
45
|
-
this.
|
|
47
|
+
this.p2pPropagationTime = 0;
|
|
48
|
+
this.checkpointFinalizationTime = 0.5;
|
|
49
|
+
this.checkpointInitializationTime = 0.5;
|
|
46
50
|
}
|
|
47
|
-
|
|
48
|
-
const
|
|
51
|
+
// Minimum work to do within a slot for building a block with the minimum time for execution and publishing its checkpoint
|
|
52
|
+
const minWorkToDo = this.checkpointInitializationTime + this.minExecutionTime * 2 + // Execution and reexecution
|
|
53
|
+
this.checkpointFinalizationTime + this.p2pPropagationTime * 2 + // Send proposal and receive attestations
|
|
54
|
+
this.l1PublishingTime; // Submit to L1
|
|
55
|
+
const initializeDeadline = this.aztecSlotDuration - minWorkToDo;
|
|
49
56
|
this.initializeDeadline = initializeDeadline;
|
|
50
57
|
this.log.verbose(`Sequencer timetable initialized (${this.enforce ? 'enforced' : 'not enforced'})`, {
|
|
51
58
|
ethereumSlotDuration: this.ethereumSlotDuration,
|
|
52
59
|
aztecSlotDuration: this.aztecSlotDuration,
|
|
53
|
-
maxL1TxInclusionTimeIntoSlot: this.maxL1TxInclusionTimeIntoSlot,
|
|
54
60
|
l1PublishingTime: this.l1PublishingTime,
|
|
55
61
|
minExecutionTime: this.minExecutionTime,
|
|
56
|
-
blockPrepareTime: this.
|
|
57
|
-
|
|
58
|
-
blockValidationTime: this.
|
|
62
|
+
blockPrepareTime: this.checkpointInitializationTime,
|
|
63
|
+
p2pPropagationTime: this.p2pPropagationTime,
|
|
64
|
+
blockValidationTime: this.checkpointFinalizationTime,
|
|
59
65
|
initializeDeadline: this.initializeDeadline,
|
|
60
66
|
enforce: this.enforce,
|
|
61
|
-
allWorkToDo
|
|
67
|
+
allWorkToDo: minWorkToDo
|
|
62
68
|
});
|
|
63
69
|
if (initializeDeadline <= 0) {
|
|
64
|
-
throw new Error(`Block proposal initialize deadline cannot be negative (got ${initializeDeadline} from total time needed ${
|
|
70
|
+
throw new Error(`Block proposal initialize deadline cannot be negative (got ${initializeDeadline} from total time needed ${minWorkToDo} and a slot duration of ${this.aztecSlotDuration}).`);
|
|
65
71
|
}
|
|
66
72
|
}
|
|
67
|
-
|
|
68
|
-
return this.blockValidationTime + this.attestationPropagationTime * 2 + this.l1PublishingTime;
|
|
69
|
-
}
|
|
70
|
-
getBlockProposalExecTimeEnd(secondsIntoSlot) {
|
|
73
|
+
/** Deadline for a block proposal execution. Ensures we have enough time left for reexecution and publishing. */ getProposerExecTimeEnd(secondsIntoSlot) {
|
|
71
74
|
// We are N seconds into the slot. We need to account for `afterBlockBuildingTimeNeededWithoutReexec` seconds,
|
|
72
75
|
// send then split the remaining time between the re-execution and the block building.
|
|
73
|
-
const
|
|
76
|
+
const afterBlockBuildingTimeNeededWithoutReexec = this.checkpointFinalizationTime + this.p2pPropagationTime * 2 + this.l1PublishingTime;
|
|
77
|
+
const maxAllowed = this.aztecSlotDuration - afterBlockBuildingTimeNeededWithoutReexec;
|
|
74
78
|
const available = maxAllowed - secondsIntoSlot;
|
|
75
79
|
const executionTimeEnd = secondsIntoSlot + available / 2;
|
|
76
80
|
this.log.debug(`Block proposal execution time deadline is ${executionTimeEnd}`, {
|
|
@@ -81,12 +85,10 @@ export class SequencerTimetable {
|
|
|
81
85
|
});
|
|
82
86
|
return executionTimeEnd;
|
|
83
87
|
}
|
|
84
|
-
|
|
85
|
-
return this.attestationPropagationTime + this.l1PublishingTime;
|
|
86
|
-
}
|
|
87
|
-
getValidatorReexecTimeEnd(secondsIntoSlot) {
|
|
88
|
+
/** Deadline for block proposal reexecution. Ensures the proposer has enough time for publishing. */ getValidatorReexecTimeEnd(secondsIntoSlot) {
|
|
88
89
|
// We need to leave for `afterBlockReexecTimeNeeded` seconds available.
|
|
89
|
-
const
|
|
90
|
+
const afterBlockReexecTimeNeeded = this.p2pPropagationTime + this.l1PublishingTime;
|
|
91
|
+
const validationTimeEnd = this.aztecSlotDuration - afterBlockReexecTimeNeeded;
|
|
90
92
|
this.log.debug(`Validator re-execution time deadline is ${validationTimeEnd}`, {
|
|
91
93
|
secondsIntoSlot,
|
|
92
94
|
validationTimeEnd
|
|
@@ -101,13 +103,16 @@ export class SequencerTimetable {
|
|
|
101
103
|
case SequencerState.SYNCHRONIZING:
|
|
102
104
|
return; // We don't really care about times for this states
|
|
103
105
|
case SequencerState.PROPOSER_CHECK:
|
|
104
|
-
case SequencerState.
|
|
106
|
+
case SequencerState.INITIALIZING_CHECKPOINT:
|
|
105
107
|
return this.initializeDeadline;
|
|
108
|
+
case SequencerState.WAITING_FOR_TXS:
|
|
106
109
|
case SequencerState.CREATING_BLOCK:
|
|
107
|
-
|
|
110
|
+
case SequencerState.WAITING_UNTIL_NEXT_BLOCK:
|
|
111
|
+
return this.initializeDeadline + this.checkpointInitializationTime;
|
|
112
|
+
case SequencerState.FINALIZING_CHECKPOINT:
|
|
108
113
|
case SequencerState.COLLECTING_ATTESTATIONS:
|
|
109
|
-
return this.aztecSlotDuration - this.l1PublishingTime - 2 * this.
|
|
110
|
-
case SequencerState.
|
|
114
|
+
return this.aztecSlotDuration - this.l1PublishingTime - 2 * this.p2pPropagationTime;
|
|
115
|
+
case SequencerState.PUBLISHING_CHECKPOINT:
|
|
111
116
|
return this.aztecSlotDuration - this.l1PublishingTime;
|
|
112
117
|
default:
|
|
113
118
|
{
|
|
@@ -134,4 +139,33 @@ export class SequencerTimetable {
|
|
|
134
139
|
secondsIntoSlot
|
|
135
140
|
});
|
|
136
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* Get timing information for building blocks within a slot.
|
|
144
|
+
* @param secondsIntoSlot - Current seconds into the slot
|
|
145
|
+
* @returns Object containing:
|
|
146
|
+
* - canStart: boolean - Whether there's time to start a block now
|
|
147
|
+
* - deadline: number - Deadline (seconds into slot) for building the block
|
|
148
|
+
* - isLastBlock: boolean - Whether the next block would be the last one in the checkpoint
|
|
149
|
+
*/ canStartNextBlock(secondsIntoSlot) {
|
|
150
|
+
const minExecutionTime = this.minExecutionTime;
|
|
151
|
+
const deadline = this.enforce ? this.getProposerExecTimeEnd(secondsIntoSlot) : undefined;
|
|
152
|
+
// Always allow to start if we don't enforce the timetable
|
|
153
|
+
const canStart = !this.enforce || deadline === undefined || deadline - secondsIntoSlot >= minExecutionTime;
|
|
154
|
+
// Single block per slot
|
|
155
|
+
if (this.blockDuration === undefined) {
|
|
156
|
+
this.log.debug(`${canStart ? 'Can' : 'Cannot'} start single-block checkpoint at ${secondsIntoSlot}s into slot`);
|
|
157
|
+
return {
|
|
158
|
+
deadline,
|
|
159
|
+
canStart,
|
|
160
|
+
isLastBlock: true
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
// Multiple blocks per slot
|
|
164
|
+
// TODO(palla/mbps) Implement me
|
|
165
|
+
return {
|
|
166
|
+
deadline,
|
|
167
|
+
canStart,
|
|
168
|
+
isLastBlock: true
|
|
169
|
+
};
|
|
170
|
+
}
|
|
137
171
|
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
2
|
+
export type SequencerRollupConstants = Pick<L1RollupConstants, 'ethereumSlotDuration' | 'l1GenesisTime' | 'slotDuration'>;
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zZXF1ZW5jZXIvdHlwZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsaUJBQWlCLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUVyRSxNQUFNLE1BQU0sd0JBQXdCLEdBQUcsSUFBSSxDQUN6QyxpQkFBaUIsRUFDakIsc0JBQXNCLEdBQUcsZUFBZSxHQUFHLGNBQWMsQ0FDMUQsQ0FBQyJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/sequencer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAErE,MAAM,MAAM,wBAAwB,GAAG,IAAI,CACzC,iBAAiB,EACjB,sBAAsB,GAAG,eAAe,GAAG,cAAc,CAC1D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -9,16 +9,22 @@ export declare enum SequencerState {
|
|
|
9
9
|
SYNCHRONIZING = "SYNCHRONIZING",
|
|
10
10
|
/** Checking if we are the proposer for the current slot. */
|
|
11
11
|
PROPOSER_CHECK = "PROPOSER_CHECK",
|
|
12
|
-
/** Initializing the
|
|
13
|
-
|
|
14
|
-
/**
|
|
12
|
+
/** Initializing the checkpoint proposal. */
|
|
13
|
+
INITIALIZING_CHECKPOINT = "INITIALIZING_CHECKPOINT",
|
|
14
|
+
/** Waiting for transactions to arrive in the pool. */
|
|
15
|
+
WAITING_FOR_TXS = "WAITING_FOR_TXS",
|
|
16
|
+
/** Creating a new L2 block. Includes processing public function calls. */
|
|
15
17
|
CREATING_BLOCK = "CREATING_BLOCK",
|
|
16
|
-
/**
|
|
18
|
+
/** Waiting until the next block can be created. */
|
|
19
|
+
WAITING_UNTIL_NEXT_BLOCK = "WAITING_UNTIL_NEXT_BLOCK",
|
|
20
|
+
/** Finalizing and broadcasting the checkpoint. */
|
|
21
|
+
FINALIZING_CHECKPOINT = "FINALIZING_CHECKPOINT",
|
|
22
|
+
/** Collecting attestations from its peers. */
|
|
17
23
|
COLLECTING_ATTESTATIONS = "COLLECTING_ATTESTATIONS",
|
|
18
|
-
/** Sending the tx to L1 with the L2
|
|
19
|
-
|
|
24
|
+
/** Sending the tx to L1 with the L2 checkpoint data and awaiting it to be mined.. */
|
|
25
|
+
PUBLISHING_CHECKPOINT = "PUBLISHING_CHECKPOINT"
|
|
20
26
|
}
|
|
21
|
-
export type SequencerStateWithSlot = SequencerState.
|
|
27
|
+
export type SequencerStateWithSlot = SequencerState.INITIALIZING_CHECKPOINT | SequencerState.WAITING_FOR_TXS | SequencerState.CREATING_BLOCK | SequencerState.WAITING_UNTIL_NEXT_BLOCK | SequencerState.COLLECTING_ATTESTATIONS | SequencerState.PUBLISHING_CHECKPOINT | SequencerState.PROPOSER_CHECK | SequencerState.FINALIZING_CHECKPOINT;
|
|
22
28
|
export type SequencerStateCallback = () => SequencerState;
|
|
23
29
|
export declare function sequencerStateToNumber(state: SequencerState): number;
|
|
24
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
30
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zZXF1ZW5jZXIvdXRpbHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsb0JBQVksY0FBYztJQUN4QixxRUFBcUU7SUFDckUsT0FBTyxZQUFZO0lBQ25CLGdFQUFnRTtJQUNoRSxRQUFRLGFBQWE7SUFDckIscURBQXFEO0lBQ3JELElBQUksU0FBUztJQUNiLHVDQUF1QztJQUN2QyxhQUFhLGtCQUFrQjtJQUMvQiw0REFBNEQ7SUFDNUQsY0FBYyxtQkFBbUI7SUFDakMsNENBQTRDO0lBQzVDLHVCQUF1Qiw0QkFBNEI7SUFDbkQsc0RBQXNEO0lBQ3RELGVBQWUsb0JBQW9CO0lBQ25DLDBFQUEwRTtJQUMxRSxjQUFjLG1CQUFtQjtJQUNqQyxtREFBbUQ7SUFDbkQsd0JBQXdCLDZCQUE2QjtJQUNyRCxrREFBa0Q7SUFDbEQscUJBQXFCLDBCQUEwQjtJQUMvQyw4Q0FBOEM7SUFDOUMsdUJBQXVCLDRCQUE0QjtJQUNuRCxxRkFBcUY7SUFDckYscUJBQXFCLDBCQUEwQjtDQUNoRDtBQUVELE1BQU0sTUFBTSxzQkFBc0IsR0FDOUIsY0FBYyxDQUFDLHVCQUF1QixHQUN0QyxjQUFjLENBQUMsZUFBZSxHQUM5QixjQUFjLENBQUMsY0FBYyxHQUM3QixjQUFjLENBQUMsd0JBQXdCLEdBQ3ZDLGNBQWMsQ0FBQyx1QkFBdUIsR0FDdEMsY0FBYyxDQUFDLHFCQUFxQixHQUNwQyxjQUFjLENBQUMsY0FBYyxHQUM3QixjQUFjLENBQUMscUJBQXFCLENBQUM7QUFFekMsTUFBTSxNQUFNLHNCQUFzQixHQUFHLE1BQU0sY0FBYyxDQUFDO0FBRTFELHdCQUFnQixzQkFBc0IsQ0FBQyxLQUFLLEVBQUUsY0FBYyxHQUFHLE1BQU0sQ0FFcEUifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/sequencer/utils.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IACxB,qEAAqE;IACrE,OAAO,YAAY;IACnB,gEAAgE;IAChE,QAAQ,aAAa;IACrB,qDAAqD;IACrD,IAAI,SAAS;IACb,uCAAuC;IACvC,aAAa,kBAAkB;IAC/B,4DAA4D;IAC5D,cAAc,mBAAmB;IACjC,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/sequencer/utils.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IACxB,qEAAqE;IACrE,OAAO,YAAY;IACnB,gEAAgE;IAChE,QAAQ,aAAa;IACrB,qDAAqD;IACrD,IAAI,SAAS;IACb,uCAAuC;IACvC,aAAa,kBAAkB;IAC/B,4DAA4D;IAC5D,cAAc,mBAAmB;IACjC,4CAA4C;IAC5C,uBAAuB,4BAA4B;IACnD,sDAAsD;IACtD,eAAe,oBAAoB;IACnC,0EAA0E;IAC1E,cAAc,mBAAmB;IACjC,mDAAmD;IACnD,wBAAwB,6BAA6B;IACrD,kDAAkD;IAClD,qBAAqB,0BAA0B;IAC/C,8CAA8C;IAC9C,uBAAuB,4BAA4B;IACnD,qFAAqF;IACrF,qBAAqB,0BAA0B;CAChD;AAED,MAAM,MAAM,sBAAsB,GAC9B,cAAc,CAAC,uBAAuB,GACtC,cAAc,CAAC,eAAe,GAC9B,cAAc,CAAC,cAAc,GAC7B,cAAc,CAAC,wBAAwB,GACvC,cAAc,CAAC,uBAAuB,GACtC,cAAc,CAAC,qBAAqB,GACpC,cAAc,CAAC,cAAc,GAC7B,cAAc,CAAC,qBAAqB,CAAC;AAEzC,MAAM,MAAM,sBAAsB,GAAG,MAAM,cAAc,CAAC;AAE1D,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,CAEpE"}
|
package/dest/sequencer/utils.js
CHANGED
|
@@ -4,10 +4,13 @@ export var SequencerState = /*#__PURE__*/ function(SequencerState) {
|
|
|
4
4
|
/** Sequencer is awaiting the next call to work(). */ SequencerState["IDLE"] = "IDLE";
|
|
5
5
|
/** Synchronizing with the L2 chain. */ SequencerState["SYNCHRONIZING"] = "SYNCHRONIZING";
|
|
6
6
|
/** Checking if we are the proposer for the current slot. */ SequencerState["PROPOSER_CHECK"] = "PROPOSER_CHECK";
|
|
7
|
-
/** Initializing the
|
|
8
|
-
/**
|
|
9
|
-
/**
|
|
10
|
-
/**
|
|
7
|
+
/** Initializing the checkpoint proposal. */ SequencerState["INITIALIZING_CHECKPOINT"] = "INITIALIZING_CHECKPOINT";
|
|
8
|
+
/** Waiting for transactions to arrive in the pool. */ SequencerState["WAITING_FOR_TXS"] = "WAITING_FOR_TXS";
|
|
9
|
+
/** Creating a new L2 block. Includes processing public function calls. */ SequencerState["CREATING_BLOCK"] = "CREATING_BLOCK";
|
|
10
|
+
/** Waiting until the next block can be created. */ SequencerState["WAITING_UNTIL_NEXT_BLOCK"] = "WAITING_UNTIL_NEXT_BLOCK";
|
|
11
|
+
/** Finalizing and broadcasting the checkpoint. */ SequencerState["FINALIZING_CHECKPOINT"] = "FINALIZING_CHECKPOINT";
|
|
12
|
+
/** Collecting attestations from its peers. */ SequencerState["COLLECTING_ATTESTATIONS"] = "COLLECTING_ATTESTATIONS";
|
|
13
|
+
/** Sending the tx to L1 with the L2 checkpoint data and awaiting it to be mined.. */ SequencerState["PUBLISHING_CHECKPOINT"] = "PUBLISHING_CHECKPOINT";
|
|
11
14
|
return SequencerState;
|
|
12
15
|
}({});
|
|
13
16
|
export function sequencerStateToNumber(state) {
|
package/dest/test/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type { ValidatorClient } from '@aztec/validator-client';
|
|
|
5
5
|
import { SequencerClient } from '../client/sequencer-client.js';
|
|
6
6
|
import type { SequencerPublisherFactory } from '../publisher/sequencer-publisher-factory.js';
|
|
7
7
|
import type { SequencerPublisher } from '../publisher/sequencer-publisher.js';
|
|
8
|
+
import type { FullNodeCheckpointsBuilder } from '../sequencer/checkpoint_builder.js';
|
|
8
9
|
import { Sequencer } from '../sequencer/sequencer.js';
|
|
9
10
|
import type { SequencerTimetable } from '../sequencer/timetable.js';
|
|
10
11
|
declare class TestSequencer_ extends Sequencer {
|
|
@@ -13,6 +14,7 @@ declare class TestSequencer_ extends Sequencer {
|
|
|
13
14
|
publisher: SequencerPublisher;
|
|
14
15
|
publisherFactory: SequencerPublisherFactory;
|
|
15
16
|
validatorClient: ValidatorClient;
|
|
17
|
+
checkpointsBuilder: FullNodeCheckpointsBuilder;
|
|
16
18
|
}
|
|
17
19
|
export type TestSequencer = TestSequencer_;
|
|
18
20
|
declare class TestSequencerClient_ extends SequencerClient {
|
|
@@ -21,4 +23,4 @@ declare class TestSequencerClient_ extends SequencerClient {
|
|
|
21
23
|
}
|
|
22
24
|
export type TestSequencerClient = TestSequencerClient_;
|
|
23
25
|
export {};
|
|
24
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
26
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0L2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLG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nQixDQUFDLGtCQUFrQixDQUFDLENBQUM7Q0FDdkU7QUFFRCxNQUFNLE1BQU0sbUJBQW1CLEdBQUcsb0JBQW9CLENBQUMifQ==
|
package/dest/test/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AAC7F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,cAAM,cAAe,SAAQ,SAAS;IACrB,sBAAsB,EAAE,sBAAsB,CAAC;IAC/C,SAAS,EAAE,kBAAkB,CAAC;IAC9B,SAAS,EAAE,kBAAkB,CAAC;IAC9B,gBAAgB,EAAE,yBAAyB,CAAC;IAC5C,eAAe,EAAE,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AAC7F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AACrF,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,cAAM,cAAe,SAAQ,SAAS;IACrB,sBAAsB,EAAE,sBAAsB,CAAC;IAC/C,SAAS,EAAE,kBAAkB,CAAC;IAC9B,SAAS,EAAE,kBAAkB,CAAC;IAC9B,gBAAgB,EAAE,yBAAyB,CAAC;IAC5C,eAAe,EAAE,eAAe,CAAC;IACjC,kBAAkB,EAAE,0BAA0B,CAAC;CAC/D;AAED,MAAM,MAAM,aAAa,GAAG,cAAc,CAAC;AAE3C,cAAM,oBAAqB,SAAQ,eAAe;IACjC,SAAS,EAAE,aAAa,CAAC;IACzB,gBAAgB,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;CACvE;AAED,MAAM,MAAM,mBAAmB,GAAG,oBAAoB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/sequencer-client",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.20251223",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -26,37 +26,37 @@
|
|
|
26
26
|
"test:integration:run": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --no-cache --config jest.integration.config.json"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@aztec/aztec.js": "3.0.0-nightly.
|
|
30
|
-
"@aztec/bb-prover": "3.0.0-nightly.
|
|
31
|
-
"@aztec/blob-
|
|
32
|
-
"@aztec/blob-
|
|
33
|
-
"@aztec/constants": "3.0.0-nightly.
|
|
34
|
-
"@aztec/epoch-cache": "3.0.0-nightly.
|
|
35
|
-
"@aztec/ethereum": "3.0.0-nightly.
|
|
36
|
-
"@aztec/foundation": "3.0.0-nightly.
|
|
37
|
-
"@aztec/l1-artifacts": "3.0.0-nightly.
|
|
38
|
-
"@aztec/merkle-tree": "3.0.0-nightly.
|
|
39
|
-
"@aztec/node-keystore": "3.0.0-nightly.
|
|
40
|
-
"@aztec/noir-acvm_js": "3.0.0-nightly.
|
|
41
|
-
"@aztec/noir-contracts.js": "3.0.0-nightly.
|
|
42
|
-
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.
|
|
43
|
-
"@aztec/noir-types": "3.0.0-nightly.
|
|
44
|
-
"@aztec/p2p": "3.0.0-nightly.
|
|
45
|
-
"@aztec/protocol-contracts": "3.0.0-nightly.
|
|
46
|
-
"@aztec/prover-client": "3.0.0-nightly.
|
|
47
|
-
"@aztec/simulator": "3.0.0-nightly.
|
|
48
|
-
"@aztec/slasher": "3.0.0-nightly.
|
|
49
|
-
"@aztec/stdlib": "3.0.0-nightly.
|
|
50
|
-
"@aztec/telemetry-client": "3.0.0-nightly.
|
|
51
|
-
"@aztec/validator-client": "3.0.0-nightly.
|
|
52
|
-
"@aztec/world-state": "3.0.0-nightly.
|
|
29
|
+
"@aztec/aztec.js": "3.0.0-nightly.20251223",
|
|
30
|
+
"@aztec/bb-prover": "3.0.0-nightly.20251223",
|
|
31
|
+
"@aztec/blob-client": "3.0.0-nightly.20251223",
|
|
32
|
+
"@aztec/blob-lib": "3.0.0-nightly.20251223",
|
|
33
|
+
"@aztec/constants": "3.0.0-nightly.20251223",
|
|
34
|
+
"@aztec/epoch-cache": "3.0.0-nightly.20251223",
|
|
35
|
+
"@aztec/ethereum": "3.0.0-nightly.20251223",
|
|
36
|
+
"@aztec/foundation": "3.0.0-nightly.20251223",
|
|
37
|
+
"@aztec/l1-artifacts": "3.0.0-nightly.20251223",
|
|
38
|
+
"@aztec/merkle-tree": "3.0.0-nightly.20251223",
|
|
39
|
+
"@aztec/node-keystore": "3.0.0-nightly.20251223",
|
|
40
|
+
"@aztec/noir-acvm_js": "3.0.0-nightly.20251223",
|
|
41
|
+
"@aztec/noir-contracts.js": "3.0.0-nightly.20251223",
|
|
42
|
+
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.20251223",
|
|
43
|
+
"@aztec/noir-types": "3.0.0-nightly.20251223",
|
|
44
|
+
"@aztec/p2p": "3.0.0-nightly.20251223",
|
|
45
|
+
"@aztec/protocol-contracts": "3.0.0-nightly.20251223",
|
|
46
|
+
"@aztec/prover-client": "3.0.0-nightly.20251223",
|
|
47
|
+
"@aztec/simulator": "3.0.0-nightly.20251223",
|
|
48
|
+
"@aztec/slasher": "3.0.0-nightly.20251223",
|
|
49
|
+
"@aztec/stdlib": "3.0.0-nightly.20251223",
|
|
50
|
+
"@aztec/telemetry-client": "3.0.0-nightly.20251223",
|
|
51
|
+
"@aztec/validator-client": "3.0.0-nightly.20251223",
|
|
52
|
+
"@aztec/world-state": "3.0.0-nightly.20251223",
|
|
53
53
|
"lodash.chunk": "^4.2.0",
|
|
54
54
|
"tslib": "^2.4.0",
|
|
55
55
|
"viem": "npm:@aztec/viem@2.38.2"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@aztec/archiver": "3.0.0-nightly.
|
|
59
|
-
"@aztec/kv-store": "3.0.0-nightly.
|
|
58
|
+
"@aztec/archiver": "3.0.0-nightly.20251223",
|
|
59
|
+
"@aztec/kv-store": "3.0.0-nightly.20251223",
|
|
60
60
|
"@jest/globals": "^30.0.0",
|
|
61
61
|
"@types/jest": "^30.0.0",
|
|
62
62
|
"@types/lodash.chunk": "^4.2.7",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BlobClientInterface } from '@aztec/blob-client/client';
|
|
2
2
|
import { EpochCache } from '@aztec/epoch-cache';
|
|
3
3
|
import { isAnvilTestChain } from '@aztec/ethereum/chain';
|
|
4
4
|
import { getPublicClient } from '@aztec/ethereum/client';
|
|
@@ -12,11 +12,7 @@ import type { KeystoreManager } from '@aztec/node-keystore';
|
|
|
12
12
|
import type { P2P } from '@aztec/p2p';
|
|
13
13
|
import type { SlasherClientInterface } from '@aztec/slasher';
|
|
14
14
|
import type { L2BlockSource } from '@aztec/stdlib/block';
|
|
15
|
-
import type {
|
|
16
|
-
IFullNodeBlockBuilder,
|
|
17
|
-
ValidatorClientFullConfig,
|
|
18
|
-
WorldStateSynchronizer,
|
|
19
|
-
} from '@aztec/stdlib/interfaces/server';
|
|
15
|
+
import type { ValidatorClientFullConfig, WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
20
16
|
import { SlashFactoryContract } from '@aztec/stdlib/l1-contracts';
|
|
21
17
|
import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
22
18
|
import { L1Metrics, type TelemetryClient } from '@aztec/telemetry-client';
|
|
@@ -25,6 +21,7 @@ import { NodeKeystoreAdapter, type ValidatorClient } from '@aztec/validator-clie
|
|
|
25
21
|
import type { SequencerClientConfig } from '../config.js';
|
|
26
22
|
import { GlobalVariableBuilder } from '../global_variable_builder/index.js';
|
|
27
23
|
import { SequencerPublisherFactory } from '../publisher/sequencer-publisher-factory.js';
|
|
24
|
+
import { FullNodeCheckpointsBuilder } from '../sequencer/checkpoint_builder.js';
|
|
28
25
|
import { Sequencer, type SequencerConfig } from '../sequencer/index.js';
|
|
29
26
|
|
|
30
27
|
/**
|
|
@@ -34,7 +31,7 @@ export class SequencerClient {
|
|
|
34
31
|
constructor(
|
|
35
32
|
protected publisherManager: PublisherManager<L1TxUtilsWithBlobs>,
|
|
36
33
|
protected sequencer: Sequencer,
|
|
37
|
-
protected
|
|
34
|
+
protected checkpointsBuilder: FullNodeCheckpointsBuilder,
|
|
38
35
|
protected validatorClient?: ValidatorClient,
|
|
39
36
|
private l1Metrics?: L1Metrics,
|
|
40
37
|
) {}
|
|
@@ -54,16 +51,16 @@ export class SequencerClient {
|
|
|
54
51
|
public static async new(
|
|
55
52
|
config: SequencerClientConfig,
|
|
56
53
|
deps: {
|
|
57
|
-
validatorClient: ValidatorClient
|
|
54
|
+
validatorClient: ValidatorClient;
|
|
58
55
|
p2pClient: P2P;
|
|
59
56
|
worldStateSynchronizer: WorldStateSynchronizer;
|
|
60
57
|
slasherClient: SlasherClientInterface | undefined;
|
|
61
|
-
|
|
58
|
+
checkpointsBuilder: FullNodeCheckpointsBuilder;
|
|
62
59
|
l2BlockSource: L2BlockSource;
|
|
63
60
|
l1ToL2MessageSource: L1ToL2MessageSource;
|
|
64
61
|
telemetry: TelemetryClient;
|
|
65
62
|
publisherFactory?: SequencerPublisherFactory;
|
|
66
|
-
|
|
63
|
+
blobClient?: BlobClientInterface;
|
|
67
64
|
dateProvider: DateProvider;
|
|
68
65
|
epochCache?: EpochCache;
|
|
69
66
|
l1TxUtils: L1TxUtilsWithBlobs[];
|
|
@@ -75,7 +72,7 @@ export class SequencerClient {
|
|
|
75
72
|
p2pClient,
|
|
76
73
|
worldStateSynchronizer,
|
|
77
74
|
slasherClient,
|
|
78
|
-
|
|
75
|
+
checkpointsBuilder,
|
|
79
76
|
l2BlockSource,
|
|
80
77
|
l1ToL2MessageSource,
|
|
81
78
|
telemetry: telemetryClient,
|
|
@@ -91,9 +88,11 @@ export class SequencerClient {
|
|
|
91
88
|
);
|
|
92
89
|
const publisherManager = new PublisherManager(l1TxUtils, config);
|
|
93
90
|
const rollupContract = new RollupContract(publicClient, config.l1Contracts.rollupAddress.toString());
|
|
94
|
-
const [l1GenesisTime, slotDuration] = await Promise.all([
|
|
91
|
+
const [l1GenesisTime, slotDuration, rollupVersion, rollupManaLimit] = await Promise.all([
|
|
95
92
|
rollupContract.getL1GenesisTime(),
|
|
96
93
|
rollupContract.getSlotDuration(),
|
|
94
|
+
rollupContract.getVersion(),
|
|
95
|
+
rollupContract.getManaLimit().then(Number),
|
|
97
96
|
] as const);
|
|
98
97
|
|
|
99
98
|
const governanceProposerContract = new GovernanceProposerContract(
|
|
@@ -122,7 +121,7 @@ export class SequencerClient {
|
|
|
122
121
|
deps.publisherFactory ??
|
|
123
122
|
new SequencerPublisherFactory(config, {
|
|
124
123
|
telemetry: telemetryClient,
|
|
125
|
-
|
|
124
|
+
blobClient: deps.blobClient,
|
|
126
125
|
epochCache,
|
|
127
126
|
governanceProposerContract,
|
|
128
127
|
slashFactoryContract,
|
|
@@ -132,33 +131,27 @@ export class SequencerClient {
|
|
|
132
131
|
nodeKeyStore: NodeKeystoreAdapter.fromKeyStoreManager(deps.nodeKeyStore),
|
|
133
132
|
logger: log,
|
|
134
133
|
});
|
|
135
|
-
const globalsBuilder = new GlobalVariableBuilder(config);
|
|
136
134
|
|
|
137
135
|
const ethereumSlotDuration = config.ethereumSlotDuration;
|
|
136
|
+
const l1Constants = { l1GenesisTime, slotDuration: Number(slotDuration), ethereumSlotDuration };
|
|
137
|
+
|
|
138
|
+
const globalsBuilder = new GlobalVariableBuilder({ ...config, ...l1Constants, rollupVersion });
|
|
138
139
|
|
|
139
|
-
const rollupManaLimit = Number(await rollupContract.getManaLimit());
|
|
140
140
|
let sequencerManaLimit = config.maxL2BlockGas ?? rollupManaLimit;
|
|
141
141
|
if (sequencerManaLimit > rollupManaLimit) {
|
|
142
142
|
log.warn(
|
|
143
|
-
`Provided maxL2BlockGas
|
|
143
|
+
`Provided maxL2BlockGas ${sequencerManaLimit} is greater than the max allowed by L1. Setting limit to ${rollupManaLimit}.`,
|
|
144
144
|
);
|
|
145
145
|
sequencerManaLimit = rollupManaLimit;
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
// When running in anvil, assume we can post a tx up until one second before the end of an L1 slot.
|
|
149
|
-
// Otherwise,
|
|
150
|
-
// maxL1TxInclusionTimeIntoSlot of zero) to get the tx into that L1 slot.
|
|
149
|
+
// Otherwise, we need the full L1 slot duration for publishing to ensure inclusion.
|
|
151
150
|
// In theory, the L1 slot has an initial 4s phase where the block is propagated, so we could
|
|
152
|
-
//
|
|
151
|
+
// reduce the publishing time allowance. However, we prefer being conservative.
|
|
153
152
|
// See https://www.blocknative.com/blog/anatomy-of-a-slot#7 for more info.
|
|
154
|
-
const
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
const l1Constants = {
|
|
158
|
-
l1GenesisTime,
|
|
159
|
-
slotDuration: Number(slotDuration),
|
|
160
|
-
ethereumSlotDuration,
|
|
161
|
-
};
|
|
153
|
+
const l1PublishingTimeBasedOnChain = isAnvilTestChain(config.l1ChainId) ? 1 : ethereumSlotDuration;
|
|
154
|
+
const l1PublishingTime = config.l1PublishingTime ?? l1PublishingTimeBasedOnChain;
|
|
162
155
|
|
|
163
156
|
const sequencer = new Sequencer(
|
|
164
157
|
publisherFactory,
|
|
@@ -169,19 +162,19 @@ export class SequencerClient {
|
|
|
169
162
|
slasherClient,
|
|
170
163
|
l2BlockSource,
|
|
171
164
|
l1ToL2MessageSource,
|
|
172
|
-
|
|
165
|
+
checkpointsBuilder,
|
|
173
166
|
l1Constants,
|
|
174
167
|
deps.dateProvider,
|
|
175
168
|
epochCache,
|
|
176
169
|
rollupContract,
|
|
177
|
-
{ ...config,
|
|
170
|
+
{ ...config, l1PublishingTime, maxL2BlockGas: sequencerManaLimit },
|
|
178
171
|
telemetryClient,
|
|
179
172
|
log,
|
|
180
173
|
);
|
|
181
174
|
|
|
182
175
|
await sequencer.init();
|
|
183
176
|
|
|
184
|
-
return new SequencerClient(publisherManager, sequencer,
|
|
177
|
+
return new SequencerClient(publisherManager, sequencer, checkpointsBuilder, validatorClient, l1Metrics);
|
|
185
178
|
}
|
|
186
179
|
|
|
187
180
|
/**
|
|
@@ -190,7 +183,7 @@ export class SequencerClient {
|
|
|
190
183
|
*/
|
|
191
184
|
public updateConfig(config: SequencerConfig & Partial<ValidatorClientFullConfig>) {
|
|
192
185
|
this.sequencer.updateConfig(config);
|
|
193
|
-
this.
|
|
186
|
+
this.checkpointsBuilder.updateConfig(config);
|
|
194
187
|
this.validatorClient?.updateConfig(config);
|
|
195
188
|
}
|
|
196
189
|
|