@aztec/sequencer-client 3.0.0-nightly.20251223 → 3.0.0-nightly.20251225

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.
@@ -2,9 +2,9 @@ import { createLogger } from '@aztec/aztec.js/log';
2
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
- export const MIN_EXECUTION_TIME = 1;
5
+ export const MIN_EXECUTION_TIME = 2;
6
6
  export const CHECKPOINT_INITIALIZATION_TIME = 1;
7
- export const CHECKPOINT_FINALIZATION_TIME = 1;
7
+ export const CHECKPOINT_ASSEMBLE_TIME = 1;
8
8
  export class SequencerTimetable {
9
9
  metrics;
10
10
  log;
@@ -14,6 +14,17 @@ export class SequencerTimetable {
14
14
  * starts building at this time, and all times hold, it will have at least `minExecutionTime` to execute txs for the block.
15
15
  */ initializeDeadline;
16
16
  /**
17
+ * Fixed time offset (in seconds) when the first sub-slot starts, used as baseline for all block deadlines.
18
+ * This is an estimate of how long initialization (sync + proposer check) typically takes.
19
+ * If actual initialization takes longer/shorter, blocks just get less/more time accordingly.
20
+ */ initializationOffset;
21
+ /**
22
+ * Total time needed to finalize and publish a checkpoint, including:
23
+ * - Assembling the checkpoint
24
+ * - Round-trip p2p propagation for the checkpoint proposal and its corresponding attestations
25
+ * - Publishing to L1
26
+ */ checkpointFinalizationTime;
27
+ /**
17
28
  * How long it takes to get a published block into L1. L1 builders typically accept txs up to 4 seconds into their slot,
18
29
  * but we'll timeout sooner to give it more time to propagate (remember we also have blobs!). Still, when working in anvil,
19
30
  * we can just post in the very last second of the L1 slot and still expect the tx to be accepted.
@@ -24,77 +35,73 @@ export class SequencerTimetable {
24
35
  */ minExecutionTime;
25
36
  /** How long it takes to get ready to start building */ checkpointInitializationTime;
26
37
  /** 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;
38
+ /** How much time we spend assembling a checkpoint after building the last block */ checkpointAssembleTime;
28
39
  /** Ethereum slot duration in seconds */ ethereumSlotDuration;
29
40
  /** Aztec slot duration in seconds (must be multiple of ethereum slot duration) */ aztecSlotDuration;
30
41
  /** Whether assertTimeLeft will throw if not enough time. */ enforce;
31
42
  /** Duration per block when building multiple blocks per slot (undefined = single block per slot) */ blockDuration;
43
+ /** Maximum number of blocks that can be built in this slot configuration */ maxNumberOfBlocks;
32
44
  constructor(opts, metrics, log = createLogger('sequencer:timetable')){
33
45
  this.metrics = metrics;
34
46
  this.log = log;
35
47
  this.minExecutionTime = MIN_EXECUTION_TIME;
36
48
  this.checkpointInitializationTime = CHECKPOINT_INITIALIZATION_TIME;
37
- this.checkpointFinalizationTime = CHECKPOINT_FINALIZATION_TIME;
49
+ this.checkpointAssembleTime = CHECKPOINT_ASSEMBLE_TIME;
38
50
  this.ethereumSlotDuration = opts.ethereumSlotDuration;
39
51
  this.aztecSlotDuration = opts.aztecSlotDuration;
40
52
  this.l1PublishingTime = opts.l1PublishingTime;
41
53
  this.p2pPropagationTime = opts.p2pPropagationTime ?? DEFAULT_P2P_PROPAGATION_TIME;
42
54
  this.blockDuration = opts.blockDurationMs ? opts.blockDurationMs / 1000 : undefined;
43
- this.minExecutionTime = MIN_EXECUTION_TIME;
44
55
  this.enforce = opts.enforce;
45
56
  // Assume zero-cost propagation time and faster runs in test environments where L1 slot duration is shortened
46
57
  if (this.ethereumSlotDuration < 8) {
47
58
  this.p2pPropagationTime = 0;
48
- this.checkpointFinalizationTime = 0.5;
59
+ this.checkpointAssembleTime = 0.5;
49
60
  this.checkpointInitializationTime = 0.5;
61
+ this.minExecutionTime = 1;
62
+ }
63
+ // Min execution time cannot be less than the block duration if set
64
+ if (this.blockDuration !== undefined && this.minExecutionTime > this.blockDuration) {
65
+ this.minExecutionTime = this.blockDuration;
66
+ }
67
+ // Calculate initialization offset - estimate of time needed for sync + proposer check
68
+ // This is the baseline for all sub-slot deadlines
69
+ this.initializationOffset = this.checkpointInitializationTime;
70
+ // Calculate total checkpoint finalization time (assembly + attestations + L1 publishing)
71
+ this.checkpointFinalizationTime = this.checkpointAssembleTime + this.p2pPropagationTime * 2 + // Round-trip propagation
72
+ this.l1PublishingTime; // L1 publishing
73
+ // Calculate maximum number of blocks that fit in this slot
74
+ if (!this.blockDuration) {
75
+ this.maxNumberOfBlocks = 1; // Single block per slot
76
+ } else {
77
+ const timeReservedAtEnd = this.blockDuration + // Last sub-slot for validator re-execution
78
+ this.checkpointFinalizationTime; // Checkpoint finalization
79
+ const timeAvailableForBlocks = this.aztecSlotDuration - this.initializationOffset - timeReservedAtEnd;
80
+ this.maxNumberOfBlocks = Math.floor(timeAvailableForBlocks / this.blockDuration);
50
81
  }
51
82
  // 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
83
+ const minWorkToDo = this.initializationOffset + this.minExecutionTime * 2 + // Execution and reexecution
84
+ this.checkpointFinalizationTime;
55
85
  const initializeDeadline = this.aztecSlotDuration - minWorkToDo;
56
86
  this.initializeDeadline = initializeDeadline;
57
- this.log.verbose(`Sequencer timetable initialized (${this.enforce ? 'enforced' : 'not enforced'})`, {
87
+ this.log.verbose(`Sequencer timetable initialized with ${this.maxNumberOfBlocks} blocks per slot (${this.enforce ? 'enforced' : 'not enforced'})`, {
58
88
  ethereumSlotDuration: this.ethereumSlotDuration,
59
89
  aztecSlotDuration: this.aztecSlotDuration,
60
90
  l1PublishingTime: this.l1PublishingTime,
61
91
  minExecutionTime: this.minExecutionTime,
62
92
  blockPrepareTime: this.checkpointInitializationTime,
63
93
  p2pPropagationTime: this.p2pPropagationTime,
64
- blockValidationTime: this.checkpointFinalizationTime,
94
+ blockAssembleTime: this.checkpointAssembleTime,
65
95
  initializeDeadline: this.initializeDeadline,
66
96
  enforce: this.enforce,
67
- allWorkToDo: minWorkToDo
97
+ minWorkToDo,
98
+ blockDuration: this.blockDuration,
99
+ maxNumberOfBlocks: this.maxNumberOfBlocks
68
100
  });
69
101
  if (initializeDeadline <= 0) {
70
102
  throw new Error(`Block proposal initialize deadline cannot be negative (got ${initializeDeadline} from total time needed ${minWorkToDo} and a slot duration of ${this.aztecSlotDuration}).`);
71
103
  }
72
104
  }
73
- /** Deadline for a block proposal execution. Ensures we have enough time left for reexecution and publishing. */ getProposerExecTimeEnd(secondsIntoSlot) {
74
- // We are N seconds into the slot. We need to account for `afterBlockBuildingTimeNeededWithoutReexec` seconds,
75
- // send then split the remaining time between the re-execution and the block building.
76
- const afterBlockBuildingTimeNeededWithoutReexec = this.checkpointFinalizationTime + this.p2pPropagationTime * 2 + this.l1PublishingTime;
77
- const maxAllowed = this.aztecSlotDuration - afterBlockBuildingTimeNeededWithoutReexec;
78
- const available = maxAllowed - secondsIntoSlot;
79
- const executionTimeEnd = secondsIntoSlot + available / 2;
80
- this.log.debug(`Block proposal execution time deadline is ${executionTimeEnd}`, {
81
- secondsIntoSlot,
82
- maxAllowed,
83
- available,
84
- executionTimeEnd
85
- });
86
- return executionTimeEnd;
87
- }
88
- /** Deadline for block proposal reexecution. Ensures the proposer has enough time for publishing. */ getValidatorReexecTimeEnd(secondsIntoSlot) {
89
- // We need to leave for `afterBlockReexecTimeNeeded` seconds available.
90
- const afterBlockReexecTimeNeeded = this.p2pPropagationTime + this.l1PublishingTime;
91
- const validationTimeEnd = this.aztecSlotDuration - afterBlockReexecTimeNeeded;
92
- this.log.debug(`Validator re-execution time deadline is ${validationTimeEnd}`, {
93
- secondsIntoSlot,
94
- validationTimeEnd
95
- });
96
- return validationTimeEnd;
97
- }
98
105
  getMaxAllowedTime(state) {
99
106
  switch(state){
100
107
  case SequencerState.STOPPED:
@@ -109,7 +116,7 @@ export class SequencerTimetable {
109
116
  case SequencerState.CREATING_BLOCK:
110
117
  case SequencerState.WAITING_UNTIL_NEXT_BLOCK:
111
118
  return this.initializeDeadline + this.checkpointInitializationTime;
112
- case SequencerState.FINALIZING_CHECKPOINT:
119
+ case SequencerState.ASSEMBLING_CHECKPOINT:
113
120
  case SequencerState.COLLECTING_ATTESTATIONS:
114
121
  return this.aztecSlotDuration - this.l1PublishingTime - 2 * this.p2pPropagationTime;
115
122
  case SequencerState.PUBLISHING_CHECKPOINT:
@@ -140,32 +147,80 @@ export class SequencerTimetable {
140
147
  });
141
148
  }
142
149
  /**
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
150
+ * Determines if we can start building the next block and returns its deadline.
151
+ *
152
+ * The timetable divides the slot into fixed sub-slots. This method finds the next
153
+ * available sub-slot that has enough time remaining to build a block.
154
+ *
155
+ * @param secondsIntoSlot - Current time (seconds into the slot)
156
+ * @returns Object with canStart flag, deadline, and whether this is the last block
149
157
  */ 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
158
+ // When timetable enforcement is disabled, always allow starting,
159
+ // and build a single block with no deadline. This is here just to
160
+ // satisfy a subset of e2e tests and the sandbox that assume that the
161
+ // sequencer is permanently mining every tx sent.
162
+ if (!this.enforce) {
163
+ return {
164
+ canStart: true,
165
+ deadline: undefined,
166
+ isLastBlock: true
167
+ };
168
+ }
169
+ // If no block duration is set, then we're in single-block mode, which
170
+ // is handled for backwards compatibility towards another subset of e2e tests.
155
171
  if (this.blockDuration === undefined) {
156
- this.log.debug(`${canStart ? 'Can' : 'Cannot'} start single-block checkpoint at ${secondsIntoSlot}s into slot`);
172
+ // In single block mode, execution and re-execution happen sequentially, so we need to
173
+ // split the available time between them. After building, we need time for attestations and L1.
174
+ const maxAllowed = this.aztecSlotDuration - this.checkpointFinalizationTime;
175
+ const available = (maxAllowed - secondsIntoSlot) / 2; // Split remaining time: half for execution, half for re-execution
176
+ const canStart = available >= this.minExecutionTime;
177
+ const deadline = secondsIntoSlot + available;
178
+ this.log.verbose(`${canStart ? 'Can' : 'Cannot'} start single-block checkpoint at ${secondsIntoSlot}s into slot`, {
179
+ secondsIntoSlot,
180
+ maxAllowed,
181
+ available,
182
+ deadline
183
+ });
157
184
  return {
158
- deadline,
159
185
  canStart,
186
+ deadline,
160
187
  isLastBlock: true
161
188
  };
162
189
  }
163
- // Multiple blocks per slot
164
- // TODO(palla/mbps) Implement me
190
+ // Otherwise, we're in multi-block-per-slot mode, the default when running in production
191
+ // Find the next available sub-slot that has enough time remaining
192
+ for(let subSlot = 1; subSlot <= this.maxNumberOfBlocks; subSlot++){
193
+ // Calculate end for this sub-slot
194
+ const deadline = this.initializationOffset + subSlot * this.blockDuration;
195
+ // Check if we have enough time to build a block with this deadline
196
+ const timeUntilDeadline = deadline - secondsIntoSlot;
197
+ if (timeUntilDeadline >= this.minExecutionTime) {
198
+ // Found an available sub-slot! Is this the last one?
199
+ const isLastBlock = subSlot === this.maxNumberOfBlocks;
200
+ this.log.verbose(`Can start ${isLastBlock ? 'last block' : 'block'} in sub-slot ${subSlot} with deadline ${deadline}s`, {
201
+ secondsIntoSlot,
202
+ deadline,
203
+ timeUntilDeadline,
204
+ subSlot,
205
+ maxBlocks: this.maxNumberOfBlocks
206
+ });
207
+ return {
208
+ canStart: true,
209
+ deadline,
210
+ isLastBlock
211
+ };
212
+ }
213
+ }
214
+ // No sub-slots available with enough time
215
+ this.log.verbose(`No time left to start any more blocks`, {
216
+ secondsIntoSlot,
217
+ maxBlocks: this.maxNumberOfBlocks,
218
+ initializationOffset: this.initializationOffset
219
+ });
165
220
  return {
166
- deadline,
167
- canStart,
168
- isLastBlock: true
221
+ canStart: false,
222
+ deadline: undefined,
223
+ isLastBlock: false
169
224
  };
170
225
  }
171
226
  }
@@ -17,14 +17,14 @@ export declare enum SequencerState {
17
17
  CREATING_BLOCK = "CREATING_BLOCK",
18
18
  /** Waiting until the next block can be created. */
19
19
  WAITING_UNTIL_NEXT_BLOCK = "WAITING_UNTIL_NEXT_BLOCK",
20
- /** Finalizing and broadcasting the checkpoint. */
21
- FINALIZING_CHECKPOINT = "FINALIZING_CHECKPOINT",
20
+ /** Assembling and broadcasting the checkpoint. */
21
+ ASSEMBLING_CHECKPOINT = "ASSEMBLING_CHECKPOINT",
22
22
  /** Collecting attestations from its peers. */
23
23
  COLLECTING_ATTESTATIONS = "COLLECTING_ATTESTATIONS",
24
24
  /** Sending the tx to L1 with the L2 checkpoint data and awaiting it to be mined.. */
25
25
  PUBLISHING_CHECKPOINT = "PUBLISHING_CHECKPOINT"
26
26
  }
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;
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.ASSEMBLING_CHECKPOINT;
28
28
  export type SequencerStateCallback = () => SequencerState;
29
29
  export declare function sequencerStateToNumber(state: SequencerState): number;
30
30
  //# sourceMappingUR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QyxLQUFLLEVBQUUsY0FBYyxHQUFHLE1BQU0sQ0FFcEUifQ==
@@ -8,7 +8,7 @@ export var SequencerState = /*#__PURE__*/ function(SequencerState) {
8
8
  /** Waiting for transactions to arrive in the pool. */ SequencerState["WAITING_FOR_TXS"] = "WAITING_FOR_TXS";
9
9
  /** Creating a new L2 block. Includes processing public function calls. */ SequencerState["CREATING_BLOCK"] = "CREATING_BLOCK";
10
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";
11
+ /** Assembling and broadcasting the checkpoint. */ SequencerState["ASSEMBLING_CHECKPOINT"] = "ASSEMBLING_CHECKPOINT";
12
12
  /** Collecting attestations from its peers. */ SequencerState["COLLECTING_ATTESTATIONS"] = "COLLECTING_ATTESTATIONS";
13
13
  /** Sending the tx to L1 with the L2 checkpoint data and awaiting it to be mined.. */ SequencerState["PUBLISHING_CHECKPOINT"] = "PUBLISHING_CHECKPOINT";
14
14
  return SequencerState;
@@ -0,0 +1,83 @@
1
+ import { type BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
2
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
+ import type { FunctionsOf } from '@aztec/foundation/types';
4
+ import { L2BlockNew } from '@aztec/stdlib/block';
5
+ import { Checkpoint } from '@aztec/stdlib/checkpoint';
6
+ import type { FullNodeBlockBuilderConfig, PublicProcessorLimits } from '@aztec/stdlib/interfaces/server';
7
+ import type { CheckpointGlobalVariables, Tx } from '@aztec/stdlib/tx';
8
+ import type { BuildBlockInCheckpointResult, CheckpointBuilder, FullNodeCheckpointsBuilder } from '../sequencer/checkpoint_builder.js';
9
+ /**
10
+ * A fake CheckpointBuilder for testing that implements the same interface as the real one.
11
+ * Can be seeded with blocks to return sequentially on each `buildBlock` call.
12
+ */
13
+ export declare class MockCheckpointBuilder implements FunctionsOf<CheckpointBuilder> {
14
+ private readonly constants;
15
+ private readonly checkpointNumber;
16
+ private blocks;
17
+ private builtBlocks;
18
+ private usedTxsPerBlock;
19
+ private blockIndex;
20
+ /** Optional function to dynamically provide the block (alternative to seedBlocks) */
21
+ private blockProvider;
22
+ /** Track calls for assertions */
23
+ buildBlockCalls: Array<{
24
+ blockNumber: BlockNumber;
25
+ timestamp: bigint;
26
+ opts: PublicProcessorLimits;
27
+ }>;
28
+ completeCheckpointCalled: boolean;
29
+ getCheckpointCalled: boolean;
30
+ /** Set to an error to make buildBlock throw on next call */
31
+ errorOnBuild: Error | undefined;
32
+ constructor(constants: CheckpointGlobalVariables, checkpointNumber: CheckpointNumber);
33
+ /** Seed the builder with blocks to return on successive buildBlock calls */
34
+ seedBlocks(blocks: L2BlockNew[], usedTxsPerBlock?: Tx[][]): this;
35
+ /**
36
+ * Set a function that provides blocks dynamically.
37
+ * Useful for tests where the block is determined at call time (e.g., sequencer tests).
38
+ */
39
+ setBlockProvider(provider: () => L2BlockNew): this;
40
+ getConstantData(): CheckpointGlobalVariables;
41
+ buildBlock(_pendingTxs: Iterable<Tx> | AsyncIterable<Tx>, blockNumber: BlockNumber, timestamp: bigint, opts: PublicProcessorLimits): Promise<BuildBlockInCheckpointResult>;
42
+ completeCheckpoint(): Promise<Checkpoint>;
43
+ getCheckpoint(): Promise<Checkpoint>;
44
+ /**
45
+ * Creates a CheckpointHeader from a block's header for testing.
46
+ * This is a simplified version that creates a minimal CheckpointHeader.
47
+ */
48
+ private createCheckpointHeader;
49
+ /** Reset for reuse in another test */
50
+ reset(): void;
51
+ }
52
+ /**
53
+ * A fake CheckpointsBuilder (factory) for testing that implements the same interface
54
+ * as FullNodeCheckpointsBuilder. Returns MockCheckpointBuilder instances.
55
+ * Does NOT use jest mocks - this is a proper test double.
56
+ */
57
+ export declare class MockCheckpointsBuilder implements FunctionsOf<FullNodeCheckpointsBuilder> {
58
+ private checkpointBuilder;
59
+ /** Track calls for assertions */
60
+ startCheckpointCalls: Array<{
61
+ checkpointNumber: CheckpointNumber;
62
+ constants: CheckpointGlobalVariables;
63
+ l1ToL2Messages: Fr[];
64
+ }>;
65
+ updateConfigCalls: Array<Partial<FullNodeBlockBuilderConfig>>;
66
+ /**
67
+ * Set the MockCheckpointBuilder to return from startCheckpoint.
68
+ * Must be called before startCheckpoint is invoked.
69
+ */
70
+ setCheckpointBuilder(builder: MockCheckpointBuilder): this;
71
+ /**
72
+ * Creates a new MockCheckpointBuilder with the given constants.
73
+ * Convenience method that creates and sets the builder in one call.
74
+ */
75
+ createCheckpointBuilder(constants: CheckpointGlobalVariables, checkpointNumber: CheckpointNumber): MockCheckpointBuilder;
76
+ /** Get the current checkpoint builder (for assertions) */
77
+ getCheckpointBuilder(): MockCheckpointBuilder | undefined;
78
+ updateConfig(config: Partial<FullNodeBlockBuilderConfig>): void;
79
+ startCheckpoint(checkpointNumber: CheckpointNumber, constants: CheckpointGlobalVariables, l1ToL2Messages: Fr[], _fork: unknown): Promise<CheckpointBuilder>;
80
+ /** Reset for reuse in another test */
81
+ reset(): void;
82
+ }
83
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9ja19jaGVja3BvaW50X2J1aWxkZXIuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0L21vY2tfY2hlY2twb2ludF9idWlsZGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxLQUFLLFdBQVcsRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ3JGLE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUVwRCxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUMzRCxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQ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AqB,GAC1B,OAAO,CAAC,4BAA4B,CAAC,CAgCvC;IAED,kBAAkB,IAAI,OAAO,CAAC,UAAU,CAAC,CAcxC;IAED,aAAa,IAAI,OAAO,CAAC,UAAU,CAAC,CAiBnC;IAED;;;OAGG;IACH,OAAO,CAAC,sBAAsB;IAe9B,sCAAsC;IACtC,KAAK,IAAI,IAAI,CAUZ;CACF;AAED;;;;GAIG;AACH,qBAAa,sBAAuB,YAAW,WAAW,CAAC,0BAA0B,CAAC;IACpF,OAAO,CAAC,iBAAiB,CAAoC;IAE7D,iCAAiC;IAC1B,oBAAoB,EAAE,KAAK,CAAC;QACjC,gBAAgB,EAAE,gBAAgB,CAAC;QACnC,SAAS,EAAE,yBAAyB,CAAC;QACrC,cAAc,EAAE,EAAE,EAAE,CAAC;KACtB,CAAC,CAAM;IACD,iBAAiB,EAAE,KAAK,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC,CAAM;IAE1E;;;OAGG;IACH,oBAAoB,CAAC,OAAO,EAAE,qBAAqB,GAAG,IAAI,CAGzD;IAED;;;OAGG;IACH,uBAAuB,CACrB,SAAS,EAAE,yBAAyB,EACpC,gBAAgB,EAAE,gBAAgB,GACjC,qBAAqB,CAGvB;IAED,0DAA0D;IAC1D,oBAAoB,IAAI,qBAAqB,GAAG,SAAS,CAExD;IAED,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,0BAA0B,CAAC,GAAG,IAAI,CAE9D;IAED,eAAe,CACb,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,yBAAyB,EACpC,cAAc,EAAE,EAAE,EAAE,EACpB,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,iBAAiB,CAAC,CAS5B;IAED,sCAAsC;IACtC,KAAK,IAAI,IAAI,CAIZ;CACF"}
@@ -0,0 +1,179 @@
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
+ import { Timer } from '@aztec/foundation/timer';
3
+ import { Checkpoint } from '@aztec/stdlib/checkpoint';
4
+ import { Gas } from '@aztec/stdlib/gas';
5
+ import { CheckpointHeader } from '@aztec/stdlib/rollup';
6
+ import { makeAppendOnlyTreeSnapshot } from '@aztec/stdlib/testing';
7
+ /**
8
+ * A fake CheckpointBuilder for testing that implements the same interface as the real one.
9
+ * Can be seeded with blocks to return sequentially on each `buildBlock` call.
10
+ */ export class MockCheckpointBuilder {
11
+ constants;
12
+ checkpointNumber;
13
+ blocks;
14
+ builtBlocks;
15
+ usedTxsPerBlock;
16
+ blockIndex;
17
+ /** Optional function to dynamically provide the block (alternative to seedBlocks) */ blockProvider;
18
+ /** Track calls for assertions */ buildBlockCalls;
19
+ completeCheckpointCalled;
20
+ getCheckpointCalled;
21
+ /** Set to an error to make buildBlock throw on next call */ errorOnBuild;
22
+ constructor(constants, checkpointNumber){
23
+ this.constants = constants;
24
+ this.checkpointNumber = checkpointNumber;
25
+ this.blocks = [];
26
+ this.builtBlocks = [];
27
+ this.usedTxsPerBlock = [];
28
+ this.blockIndex = 0;
29
+ this.blockProvider = undefined;
30
+ this.buildBlockCalls = [];
31
+ this.completeCheckpointCalled = false;
32
+ this.getCheckpointCalled = false;
33
+ this.errorOnBuild = undefined;
34
+ }
35
+ /** Seed the builder with blocks to return on successive buildBlock calls */ seedBlocks(blocks, usedTxsPerBlock) {
36
+ this.blocks = blocks;
37
+ this.usedTxsPerBlock = usedTxsPerBlock ?? blocks.map(()=>[]);
38
+ this.blockIndex = 0;
39
+ this.blockProvider = undefined;
40
+ return this;
41
+ }
42
+ /**
43
+ * Set a function that provides blocks dynamically.
44
+ * Useful for tests where the block is determined at call time (e.g., sequencer tests).
45
+ */ setBlockProvider(provider) {
46
+ this.blockProvider = provider;
47
+ this.blocks = [];
48
+ return this;
49
+ }
50
+ getConstantData() {
51
+ return this.constants;
52
+ }
53
+ buildBlock(_pendingTxs, blockNumber, timestamp, opts) {
54
+ this.buildBlockCalls.push({
55
+ blockNumber,
56
+ timestamp,
57
+ opts
58
+ });
59
+ if (this.errorOnBuild) {
60
+ return Promise.reject(this.errorOnBuild);
61
+ }
62
+ let block;
63
+ let usedTxs;
64
+ if (this.blockProvider) {
65
+ // Dynamic mode: get block from provider
66
+ block = this.blockProvider();
67
+ usedTxs = [];
68
+ this.builtBlocks.push(block);
69
+ } else {
70
+ // Seeded mode: get block from pre-seeded list
71
+ block = this.blocks[this.blockIndex];
72
+ usedTxs = this.usedTxsPerBlock[this.blockIndex] ?? [];
73
+ this.blockIndex++;
74
+ this.builtBlocks.push(block);
75
+ }
76
+ return Promise.resolve({
77
+ block,
78
+ publicGas: Gas.empty(),
79
+ publicProcessorDuration: 0,
80
+ numTxs: block?.body?.txEffects?.length ?? usedTxs.length,
81
+ blockBuildingTimer: new Timer(),
82
+ usedTxs,
83
+ failedTxs: []
84
+ });
85
+ }
86
+ completeCheckpoint() {
87
+ this.completeCheckpointCalled = true;
88
+ const allBlocks = this.blockProvider ? this.builtBlocks : this.blocks;
89
+ const lastBlock = allBlocks[allBlocks.length - 1];
90
+ // Create a CheckpointHeader from the last block's header for testing
91
+ const checkpointHeader = this.createCheckpointHeader(lastBlock);
92
+ return Promise.resolve(new Checkpoint(makeAppendOnlyTreeSnapshot(lastBlock.header.globalVariables.blockNumber + 1), checkpointHeader, allBlocks, this.checkpointNumber));
93
+ }
94
+ getCheckpoint() {
95
+ this.getCheckpointCalled = true;
96
+ const builtBlocks = this.blockProvider ? this.builtBlocks : this.blocks.slice(0, this.blockIndex);
97
+ const lastBlock = builtBlocks[builtBlocks.length - 1];
98
+ if (!lastBlock) {
99
+ throw new Error('No blocks built yet');
100
+ }
101
+ // Create a CheckpointHeader from the last block's header for testing
102
+ const checkpointHeader = this.createCheckpointHeader(lastBlock);
103
+ return Promise.resolve(new Checkpoint(makeAppendOnlyTreeSnapshot(lastBlock.header.globalVariables.blockNumber + 1), checkpointHeader, builtBlocks, this.checkpointNumber));
104
+ }
105
+ /**
106
+ * Creates a CheckpointHeader from a block's header for testing.
107
+ * This is a simplified version that creates a minimal CheckpointHeader.
108
+ */ createCheckpointHeader(block) {
109
+ const header = block.header;
110
+ const gv = header.globalVariables;
111
+ return CheckpointHeader.empty({
112
+ lastArchiveRoot: header.lastArchive.root,
113
+ blockHeadersHash: Fr.random(),
114
+ slotNumber: gv.slotNumber,
115
+ timestamp: gv.timestamp,
116
+ coinbase: gv.coinbase,
117
+ feeRecipient: gv.feeRecipient,
118
+ gasFees: gv.gasFees,
119
+ totalManaUsed: header.totalManaUsed
120
+ });
121
+ }
122
+ /** Reset for reuse in another test */ reset() {
123
+ this.blocks = [];
124
+ this.builtBlocks = [];
125
+ this.usedTxsPerBlock = [];
126
+ this.blockIndex = 0;
127
+ this.buildBlockCalls = [];
128
+ this.completeCheckpointCalled = false;
129
+ this.getCheckpointCalled = false;
130
+ this.errorOnBuild = undefined;
131
+ this.blockProvider = undefined;
132
+ }
133
+ }
134
+ /**
135
+ * A fake CheckpointsBuilder (factory) for testing that implements the same interface
136
+ * as FullNodeCheckpointsBuilder. Returns MockCheckpointBuilder instances.
137
+ * Does NOT use jest mocks - this is a proper test double.
138
+ */ export class MockCheckpointsBuilder {
139
+ checkpointBuilder;
140
+ /** Track calls for assertions */ startCheckpointCalls = [];
141
+ updateConfigCalls = [];
142
+ /**
143
+ * Set the MockCheckpointBuilder to return from startCheckpoint.
144
+ * Must be called before startCheckpoint is invoked.
145
+ */ setCheckpointBuilder(builder) {
146
+ this.checkpointBuilder = builder;
147
+ return this;
148
+ }
149
+ /**
150
+ * Creates a new MockCheckpointBuilder with the given constants.
151
+ * Convenience method that creates and sets the builder in one call.
152
+ */ createCheckpointBuilder(constants, checkpointNumber) {
153
+ this.checkpointBuilder = new MockCheckpointBuilder(constants, checkpointNumber);
154
+ return this.checkpointBuilder;
155
+ }
156
+ /** Get the current checkpoint builder (for assertions) */ getCheckpointBuilder() {
157
+ return this.checkpointBuilder;
158
+ }
159
+ updateConfig(config) {
160
+ this.updateConfigCalls.push(config);
161
+ }
162
+ startCheckpoint(checkpointNumber, constants, l1ToL2Messages, _fork) {
163
+ this.startCheckpointCalls.push({
164
+ checkpointNumber,
165
+ constants,
166
+ l1ToL2Messages
167
+ });
168
+ if (!this.checkpointBuilder) {
169
+ // Auto-create a builder if none was set
170
+ this.checkpointBuilder = new MockCheckpointBuilder(constants, checkpointNumber);
171
+ }
172
+ return Promise.resolve(this.checkpointBuilder);
173
+ }
174
+ /** Reset for reuse in another test */ reset() {
175
+ this.checkpointBuilder = undefined;
176
+ this.startCheckpointCalls = [];
177
+ this.updateConfigCalls = [];
178
+ }
179
+ }
@@ -0,0 +1,49 @@
1
+ import { Secp256k1Signer } from '@aztec/foundation/crypto/secp256k1-signer';
2
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
+ import type { EthAddress } from '@aztec/foundation/eth-address';
4
+ import { Signature } from '@aztec/foundation/eth-signature';
5
+ import type { P2P } from '@aztec/p2p';
6
+ import { CommitteeAttestation, L2BlockNew } from '@aztec/stdlib/block';
7
+ import { BlockAttestation, BlockProposal } from '@aztec/stdlib/p2p';
8
+ import { GlobalVariables, type Tx } from '@aztec/stdlib/tx';
9
+ import type { MockProxy } from 'jest-mock-extended';
10
+ export { MockCheckpointBuilder, MockCheckpointsBuilder } from './mock_checkpoint_builder.js';
11
+ /**
12
+ * Creates a mock transaction with a specific seed for deterministic testing
13
+ */
14
+ export declare function makeTx(seed?: number, chainId?: Fr): Promise<Tx>;
15
+ /**
16
+ * Creates an L2BlockNew from transactions and global variables
17
+ */
18
+ export declare function makeBlock(txs: Tx[], globalVariables: GlobalVariables): Promise<L2BlockNew>;
19
+ /**
20
+ * Mocks the P2P client to return specific pending transactions
21
+ */
22
+ export declare function mockPendingTxs(p2p: MockProxy<P2P>, txs: Tx[]): void;
23
+ /**
24
+ * Creates an async iterator for transactions
25
+ */
26
+ export declare function mockTxIterator(txs: Promise<Tx[]>): AsyncIterableIterator<Tx>;
27
+ /**
28
+ * Creates mock committee attestations from a signer
29
+ */
30
+ export declare function createMockSignatures(signer: Secp256k1Signer): CommitteeAttestation[];
31
+ /**
32
+ * Creates a block proposal from a block and signature
33
+ */
34
+ export declare function createBlockProposal(block: L2BlockNew, signature: Signature): BlockProposal;
35
+ /**
36
+ * Creates a block attestation from a block and signature.
37
+ * Note: We manually set the sender since we use random signatures in tests.
38
+ * In production, the sender is recovered from the signature.
39
+ */
40
+ export declare function createBlockAttestation(block: L2BlockNew, signature: Signature, sender: EthAddress): BlockAttestation;
41
+ /**
42
+ * Creates transactions and a block, and mocks P2P to return them.
43
+ * Helper for tests that need to set up a block with transactions.
44
+ */
45
+ export declare function setupTxsAndBlock(p2p: MockProxy<P2P>, globalVariables: GlobalVariables, txCount: number, chainId: Fr): Promise<{
46
+ txs: Tx[];
47
+ block: L2BlockNew;
48
+ }>;
49
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0L3V0aWxzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUdBLE9BQU8sRUFBRSxlQUFlLEVBQUUsTUFBTSwyQ0FBMkMsQ0FBQztBQUM1RSxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDcEQsT0FBTyxLQUFLLEVBQUUsVUFBVSxFQUFFLE1BQU0sK0JBQStCLENBQUM7QUFDaEUsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQzVELE9BQU8sS0FBSyxFQUFFLEdBQUcsRUFBRSxNQUFNLFlBQVksQ0FBQztBQUV0QyxPQUFPLEVBQUUsb0JBQW9CLEVBQUUsVUFBVSxFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFDdkUsT0FBTyxFQUFFLGdCQUFnQixFQUFFLGFBQWEsRUFBb0IsTUFBTSxtQkFBbUIsQ0FBQztBQUd0RixPQUFPLEVBR0wsZUFBZSxFQUNmLEtBQUssRUF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