@aztec/prover-client 3.0.0-nightly.20251113 → 3.0.0-nightly.20251115

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.
Files changed (32) hide show
  1. package/dest/block-factory/light.d.ts +6 -6
  2. package/dest/block-factory/light.d.ts.map +1 -1
  3. package/dest/block-factory/light.js +35 -22
  4. package/dest/light/lightweight_checkpoint_builder.d.ts +29 -0
  5. package/dest/light/lightweight_checkpoint_builder.d.ts.map +1 -0
  6. package/dest/light/lightweight_checkpoint_builder.js +107 -0
  7. package/dest/mocks/fixtures.d.ts +0 -3
  8. package/dest/mocks/fixtures.d.ts.map +1 -1
  9. package/dest/mocks/fixtures.js +1 -12
  10. package/dest/mocks/test_context.d.ts +26 -44
  11. package/dest/mocks/test_context.d.ts.map +1 -1
  12. package/dest/mocks/test_context.js +101 -112
  13. package/dest/orchestrator/block-building-helpers.d.ts +12 -14
  14. package/dest/orchestrator/block-building-helpers.d.ts.map +1 -1
  15. package/dest/orchestrator/block-building-helpers.js +81 -105
  16. package/dest/orchestrator/block-proving-state.d.ts +9 -4
  17. package/dest/orchestrator/block-proving-state.d.ts.map +1 -1
  18. package/dest/orchestrator/block-proving-state.js +80 -19
  19. package/dest/orchestrator/checkpoint-proving-state.d.ts.map +1 -1
  20. package/dest/orchestrator/checkpoint-proving-state.js +6 -4
  21. package/dest/orchestrator/orchestrator.d.ts +0 -1
  22. package/dest/orchestrator/orchestrator.d.ts.map +1 -1
  23. package/dest/orchestrator/orchestrator.js +15 -23
  24. package/package.json +15 -15
  25. package/src/block-factory/light.ts +43 -42
  26. package/src/light/lightweight_checkpoint_builder.ts +141 -0
  27. package/src/mocks/fixtures.ts +1 -25
  28. package/src/mocks/test_context.ts +141 -174
  29. package/src/orchestrator/block-building-helpers.ts +120 -198
  30. package/src/orchestrator/block-proving-state.ts +100 -22
  31. package/src/orchestrator/checkpoint-proving-state.ts +12 -5
  32. package/src/orchestrator/orchestrator.ts +18 -25
@@ -16,7 +16,7 @@ import { pushTestData } from '@aztec/foundation/testing';
16
16
  import { elapsed } from '@aztec/foundation/timer';
17
17
  import type { TreeNodeLocation } from '@aztec/foundation/trees';
18
18
  import { readAvmMinimalPublicTxInputsFromFile } from '@aztec/simulator/public/fixtures';
19
- import { EthAddress, createBlockEndMarker } from '@aztec/stdlib/block';
19
+ import { EthAddress } from '@aztec/stdlib/block';
20
20
  import type {
21
21
  EpochProver,
22
22
  ForkMerkleTreeOperations,
@@ -54,7 +54,6 @@ import {
54
54
  import { inspect } from 'util';
55
55
 
56
56
  import {
57
- buildBlockHeaderFromTxs,
58
57
  buildHeaderFromCircuitOutputs,
59
58
  getLastSiblingPath,
60
59
  getPublicChonkVerifierPrivateInputsFromTx,
@@ -248,8 +247,12 @@ export class ProvingOrchestrator implements EpochProver {
248
247
  // Because `addTxs` won't be called for a block without txs, and that's where the sponge blob state is computed.
249
248
  // We need to set its end sponge blob here, which will become the start sponge blob for the next block.
250
249
  if (totalNumTxs === 0) {
250
+ const endState = await db.getStateReference();
251
+ blockProvingState.setEndState(endState);
252
+
251
253
  const endSpongeBlob = blockProvingState.getStartSpongeBlob().clone();
252
- await endSpongeBlob.absorb([createBlockEndMarker(0)]);
254
+ const blockEndBlobFields = blockProvingState.getBlockEndBlobFields();
255
+ await endSpongeBlob.absorb(blockEndBlobFields);
253
256
  blockProvingState.setEndSpongeBlob(endSpongeBlob);
254
257
 
255
258
  // And also try to accumulate the blobs as far as we can:
@@ -341,7 +344,11 @@ export class ProvingOrchestrator implements EpochProver {
341
344
  }
342
345
  }
343
346
 
344
- await spongeBlobState.absorb([createBlockEndMarker(txs.length)]);
347
+ const endState = await db.getStateReference();
348
+ provingState.setEndState(endState);
349
+
350
+ const blockEndBlobFields = provingState.getBlockEndBlobFields();
351
+ await spongeBlobState.absorb(blockEndBlobFields);
345
352
 
346
353
  provingState.setEndSpongeBlob(spongeBlobState);
347
354
 
@@ -408,39 +415,25 @@ export class ProvingOrchestrator implements EpochProver {
408
415
  );
409
416
  }
410
417
 
411
- // And build the block header
418
+ // Given we've applied every change from this block, now assemble the block header:
412
419
  logger.verbose(`Block ${blockNumber} completed. Assembling header.`);
413
- const header = await this.buildL2BlockHeader(provingState, expectedHeader);
414
-
415
- await this.verifyBuiltBlockAgainstSyncedState(provingState);
416
-
417
- return header;
418
- }
419
-
420
- private async buildL2BlockHeader(provingState: BlockProvingState, expectedHeader?: BlockHeader) {
421
- // Collect all txs in this block to build the header. The function calling this has made sure that all txs have been added.
422
- const txs = provingState.getProcessedTxs();
423
-
424
- const startSpongeBlob = provingState.getStartSpongeBlob();
425
-
426
- // Get db for this block
427
- const db = this.dbs.get(provingState.blockNumber)!;
428
-
429
- // Given we've applied every change from this block, now assemble the block header
430
- // and update the archive tree, so we're ready to start processing the next block
431
- const header = await buildBlockHeaderFromTxs(txs, provingState.getGlobalVariables(), startSpongeBlob, db);
420
+ const header = await provingState.buildBlockHeader();
432
421
 
433
422
  if (expectedHeader && !header.equals(expectedHeader)) {
434
423
  logger.error(`Block header mismatch: header=${header} expectedHeader=${expectedHeader}`);
435
424
  throw new Error('Block header mismatch');
436
425
  }
437
426
 
427
+ // Get db for this block
428
+ const db = this.dbs.get(provingState.blockNumber)!;
429
+
430
+ // Update the archive tree, so we're ready to start processing the next block:
438
431
  logger.verbose(
439
432
  `Updating archive tree with block ${provingState.blockNumber} header ${(await header.hash()).toString()}`,
440
433
  );
441
434
  await db.updateArchive(header);
442
435
 
443
- provingState.setBuiltBlockHeader(header);
436
+ await this.verifyBuiltBlockAgainstSyncedState(provingState);
444
437
 
445
438
  return header;
446
439
  }