@aztec/prover-node 6.0.0-nightly.20260810 → 6.0.0-nightly.20260821

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.
@@ -3,6 +3,7 @@ import type { RollupContract } from '@aztec/ethereum/contracts';
3
3
  import type { Delayer } from '@aztec/ethereum/l1-tx-utils';
4
4
  import { BlockNumber, CheckpointNumber, EpochNumber } from '@aztec/foundation/branded-types';
5
5
  import { assertRequired, compact, pick } from '@aztec/foundation/collection';
6
+ import { Fr } from '@aztec/foundation/curves/bn254';
6
7
  import { memoize } from '@aztec/foundation/decorators';
7
8
  import { createLogger } from '@aztec/foundation/log';
8
9
  import { RunningPromise } from '@aztec/foundation/running-promise';
@@ -349,8 +350,15 @@ export class ProverNode implements L2BlockStreamEventHandler, ProverNodeApi, Tra
349
350
  ): Promise<RegisterCheckpointData> {
350
351
  const previousBlockNumber = BlockNumber(checkpoint.blocks[0].number - 1);
351
352
  const previousBlockHeader = await this.gatherPreviousBlockHeader(previousBlockNumber);
352
- const l1ToL2Messages = await this.l1ToL2MessageSource.getL1ToL2Messages(checkpoint.number);
353
353
  const lastBlock = checkpoint.blocks.at(-1)!;
354
+ // Streaming Inbox: the checkpoint's consumed messages are those between the parent
355
+ // checkpoint's consumed position and this checkpoint's last block, as a compact leaf-count range. The prover
356
+ // slices them per block.
357
+ const l1ToL2Messages = await this.l1ToL2MessageSource.getL1ToL2MessagesBetweenLeafCounts(
358
+ BigInt(previousBlockHeader.state.l1ToL2MessageTree.nextAvailableLeafIndex),
359
+ BigInt(lastBlock.header.state.l1ToL2MessageTree.nextAvailableLeafIndex),
360
+ );
361
+ const previousInboxRollingHash = await this.gatherPreviousInboxRollingHash(checkpoint.number);
354
362
  const lastBlockHash = await lastBlock.header.hash();
355
363
  await this.worldState.syncImmediate(lastBlock.number, lastBlockHash);
356
364
  const previousArchiveSiblingPath = await getLastSiblingPath(
@@ -361,10 +369,27 @@ export class ProverNode implements L2BlockStreamEventHandler, ProverNodeApi, Tra
361
369
  attestations,
362
370
  previousBlockHeader,
363
371
  l1ToL2Messages,
372
+ previousInboxRollingHash,
364
373
  previousArchiveSiblingPath,
365
374
  };
366
375
  }
367
376
 
377
+ /**
378
+ * Sources the inbox rolling hash chain-start for a checkpoint: the previous checkpoint's `inboxRollingHash`, or zero
379
+ * for the genesis checkpoint. The prover threads this into the base parity circuits so the rebuilt checkpoint header
380
+ * matches the proposer's.
381
+ */
382
+ private async gatherPreviousInboxRollingHash(checkpointNumber: CheckpointNumber): Promise<Fr> {
383
+ if (checkpointNumber <= 1) {
384
+ return Fr.ZERO;
385
+ }
386
+ const previous = await this.l2BlockSource.getCheckpoint({ number: CheckpointNumber(checkpointNumber - 1) });
387
+ if (!previous) {
388
+ throw new Error(`Previous checkpoint ${checkpointNumber - 1} not found when sourcing inbox rolling hash`);
389
+ }
390
+ return previous.checkpoint.header.inboxRollingHash;
391
+ }
392
+
368
393
  /**
369
394
  * Marks every prover orphaned by the prune as pruned, clamps the catch-up cursor below the prune target's
370
395
  * checkpoint, and notifies the session manager. Keyed off the prune target block (the highest surviving block)
@@ -456,6 +456,7 @@ export class SessionManager {
456
456
  txs,
457
457
  l1ToL2Messages,
458
458
  previousBlockHeader: checkpoints[0].previousBlockHeader,
459
+ previousInboxRollingHash: checkpoints[0].previousInboxRollingHash,
459
460
  attestations: [],
460
461
  };
461
462
  }