@aztec/stdlib 4.0.0-nightly.20260122 → 4.0.0-nightly.20260123

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 (70) hide show
  1. package/dest/block/checkpointed_l2_block.d.ts +6 -6
  2. package/dest/block/checkpointed_l2_block.d.ts.map +1 -1
  3. package/dest/block/checkpointed_l2_block.js +3 -3
  4. package/dest/block/in_block.d.ts +3 -3
  5. package/dest/block/in_block.d.ts.map +1 -1
  6. package/dest/block/index.d.ts +2 -2
  7. package/dest/block/index.d.ts.map +1 -1
  8. package/dest/block/index.js +1 -1
  9. package/dest/block/{l2_block_new.d.ts → l2_block.d.ts} +6 -6
  10. package/dest/block/l2_block.d.ts.map +1 -0
  11. package/dest/block/{l2_block_new.js → l2_block.js} +5 -9
  12. package/dest/block/l2_block_source.d.ts +25 -29
  13. package/dest/block/l2_block_source.d.ts.map +1 -1
  14. package/dest/block/l2_block_stream/interfaces.d.ts +3 -3
  15. package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
  16. package/dest/block/l2_block_stream/l2_block_stream.d.ts +2 -3
  17. package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
  18. package/dest/block/l2_block_stream/l2_block_stream.js +4 -4
  19. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +3 -3
  20. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts.map +1 -1
  21. package/dest/block/test/l2_tips_store_test_suite.js +2 -2
  22. package/dest/checkpoint/checkpoint.d.ts +8 -8
  23. package/dest/checkpoint/checkpoint.d.ts.map +1 -1
  24. package/dest/checkpoint/checkpoint.js +4 -4
  25. package/dest/checkpoint/published_checkpoint.d.ts +2 -2
  26. package/dest/contract/private_function.d.ts +1 -1
  27. package/dest/contract/private_function.d.ts.map +1 -1
  28. package/dest/contract/private_function.js +1 -2
  29. package/dest/epoch-helpers/index.js +1 -1
  30. package/dest/interfaces/archiver.d.ts +1 -1
  31. package/dest/interfaces/archiver.d.ts.map +1 -1
  32. package/dest/interfaces/archiver.js +13 -15
  33. package/dest/interfaces/aztec-node.d.ts +18 -9
  34. package/dest/interfaces/aztec-node.d.ts.map +1 -1
  35. package/dest/interfaces/aztec-node.js +10 -11
  36. package/dest/interfaces/block-builder.d.ts +4 -4
  37. package/dest/interfaces/block-builder.d.ts.map +1 -1
  38. package/dest/interfaces/tx_provider.d.ts +3 -3
  39. package/dest/interfaces/tx_provider.d.ts.map +1 -1
  40. package/dest/p2p/block_proposal.d.ts +4 -4
  41. package/dest/p2p/block_proposal.d.ts.map +1 -1
  42. package/dest/p2p/block_proposal.js +1 -1
  43. package/dest/tests/factories.js +1 -1
  44. package/dest/tests/jest.d.ts +4 -4
  45. package/dest/tests/jest.js +9 -9
  46. package/dest/tests/mocks.d.ts +10 -9
  47. package/dest/tests/mocks.d.ts.map +1 -1
  48. package/dest/tests/mocks.js +15 -10
  49. package/package.json +9 -9
  50. package/src/block/checkpointed_l2_block.ts +4 -4
  51. package/src/block/in_block.ts +2 -2
  52. package/src/block/index.ts +1 -1
  53. package/src/block/{l2_block_new.ts → l2_block.ts} +6 -11
  54. package/src/block/l2_block_source.ts +24 -30
  55. package/src/block/l2_block_stream/interfaces.ts +2 -2
  56. package/src/block/l2_block_stream/l2_block_stream.ts +5 -6
  57. package/src/block/l2_block_stream/l2_tips_store_base.ts +2 -2
  58. package/src/block/test/l2_tips_store_test_suite.ts +4 -4
  59. package/src/checkpoint/checkpoint.ts +7 -7
  60. package/src/contract/private_function.ts +1 -2
  61. package/src/epoch-helpers/index.ts +1 -1
  62. package/src/interfaces/archiver.ts +13 -24
  63. package/src/interfaces/aztec-node.ts +30 -31
  64. package/src/interfaces/block-builder.ts +3 -3
  65. package/src/interfaces/tx_provider.ts +2 -2
  66. package/src/p2p/block_proposal.ts +3 -3
  67. package/src/tests/factories.ts +1 -1
  68. package/src/tests/jest.ts +9 -9
  69. package/src/tests/mocks.ts +20 -13
  70. package/dest/block/l2_block_new.d.ts.map +0 -1
package/src/tests/jest.ts CHANGED
@@ -1,26 +1,26 @@
1
- import { L2BlockNew } from '../block/l2_block_new.js';
1
+ import { L2Block } from '../block/l2_block.js';
2
2
 
3
3
  /**
4
- * Checks if two objects are the same L2BlockNew.
4
+ * Checks if two objects are the same L2Block.
5
5
  *
6
- * Sometimes we might be comparing two L2BlockNew instances that represent the same block but one of them might not have
6
+ * Sometimes we might be comparing two L2Block instances that represent the same block but one of them might not have
7
7
  * calculated and filled its `blockHash` property (which is computed on demand). This function ensures both objects
8
- * are really the same L2BlockNew.
8
+ * are really the same L2Block.
9
9
  *
10
10
  * @param a - An object
11
11
  * @param b - Another object
12
- * @returns True if both a and b are the same L2BlockNew
12
+ * @returns True if both a and b are the same L2Block
13
13
  */
14
14
  export function equalL2Blocks(a: any, b: any) {
15
- const aAsL2Block = a && a instanceof L2BlockNew ? a : undefined;
16
- const bAsL2Block = b && b instanceof L2BlockNew ? b : undefined;
15
+ const aAsL2Block = a && a instanceof L2Block ? a : undefined;
16
+ const bAsL2Block = b && b instanceof L2Block ? b : undefined;
17
17
 
18
18
  if (aAsL2Block && bAsL2Block) {
19
- // we got two L2BlockNew instances, so we can compare them
19
+ // we got two L2Block instances, so we can compare them
20
20
  // use a custom comparator because the blockHash property is lazily computed and one instance might not have it
21
21
  return aAsL2Block.toBuffer().equals(bAsL2Block.toBuffer());
22
22
  } else if (aAsL2Block || bAsL2Block) {
23
- // one value is an L2BlockNew and the other isn't. Definitely not equal.
23
+ // one value is an L2Block and the other isn't. Definitely not equal.
24
24
  return false;
25
25
  } else {
26
26
  // we don't know what they are, tell Jest to keep looking
@@ -22,7 +22,7 @@ import { AvmCircuitPublicInputs } from '../avm/avm_circuit_public_inputs.js';
22
22
  import { PublicDataWrite } from '../avm/public_data_write.js';
23
23
  import { RevertCode } from '../avm/revert_code.js';
24
24
  import { AztecAddress } from '../aztec-address/index.js';
25
- import { CheckpointedL2Block, CommitteeAttestation, L2BlockNew } from '../block/index.js';
25
+ import { CheckpointedL2Block, CommitteeAttestation, L2Block } from '../block/index.js';
26
26
  import type { CommitteeAttestationsAndSigners } from '../block/proposal/attestations_and_signers.js';
27
27
  import { Checkpoint } from '../checkpoint/checkpoint.js';
28
28
  import { L1PublishedData } from '../checkpoint/published_checkpoint.js';
@@ -404,32 +404,37 @@ export async function mockCheckpointAndMessages(
404
404
  numL1ToL2Messages = 1,
405
405
  makeBlockOptions = () => ({}),
406
406
  previousArchive,
407
+ maxEffects,
407
408
  ...options
408
409
  }: {
409
410
  startBlockNumber?: BlockNumber;
410
411
  numBlocks?: number;
411
412
  numTxsPerBlock?: number;
412
413
  numL1ToL2Messages?: number;
413
- makeBlockOptions?: (blockNumber: BlockNumber) => Partial<Parameters<typeof L2BlockNew.random>[1]>;
414
+ makeBlockOptions?: (blockNumber: BlockNumber) => Partial<Parameters<typeof L2Block.random>[1]>;
414
415
  previousArchive?: AppendOnlyTreeSnapshot;
415
- blocks?: L2BlockNew[];
416
+ blocks?: L2Block[];
417
+ maxEffects?: number;
416
418
  } & Partial<Parameters<typeof Checkpoint.random>[1]> &
417
- Partial<Parameters<typeof L2BlockNew.random>[1]> = {},
419
+ Partial<Parameters<typeof L2Block.random>[1]> = {},
418
420
  ) {
419
- const slotNumber = options.slotNumber ?? SlotNumber(checkpointNumber * 10);
421
+ const slotNumber = options.slotNumber ?? SlotNumber(Number(checkpointNumber) * 10);
420
422
  const blocksAndMessages = [];
421
423
  // Track the previous block's archive to ensure consecutive blocks have consistent archive roots.
422
424
  // The current block's header.lastArchive must equal the previous block's archive.
423
425
  let lastArchive: AppendOnlyTreeSnapshot | undefined = previousArchive;
426
+ // Pass maxEffects via txOptions so it reaches TxEffect.random
427
+ const txOptions = maxEffects !== undefined ? { maxEffects } : {};
424
428
  for (let i = 0; i < (blocks?.length ?? numBlocks); i++) {
425
429
  const blockNumber = BlockNumber(startBlockNumber + i);
426
430
  const { block, messages } = {
427
431
  block:
428
432
  blocks?.[i] ??
429
- (await L2BlockNew.random(blockNumber, {
433
+ (await L2Block.random(blockNumber, {
430
434
  checkpointNumber,
431
435
  indexWithinCheckpoint: IndexWithinCheckpoint(i),
432
436
  txsPerBlock: numTxsPerBlock,
437
+ txOptions,
433
438
  slotNumber,
434
439
  ...options,
435
440
  ...makeBlockOptions(blockNumber),
@@ -670,15 +675,15 @@ export const makeCheckpointAttestationFromCheckpoint = (
670
675
  };
671
676
 
672
677
  /**
673
- * Create a checkpoint attestation from an L2BlockNew
674
- * Note: This is a compatibility function for tests. L2BlockNew doesn't have a checkpoint header directly.
678
+ * Create a checkpoint attestation from an L2Block
679
+ * Note: This is a compatibility function for tests. L2Block doesn't have a checkpoint header directly.
675
680
  */
676
681
  export const makeCheckpointAttestationFromBlock = (
677
- block: L2BlockNew,
682
+ block: L2Block,
678
683
  attesterSigner?: Secp256k1Signer,
679
684
  proposerSigner?: Secp256k1Signer,
680
685
  ): CheckpointAttestation => {
681
- // For L2BlockNew, we create a minimal checkpoint header for testing purposes
686
+ // For L2Block, we create a minimal checkpoint header for testing purposes
682
687
  const header = CheckpointHeader.empty({
683
688
  lastArchiveRoot: block.header.lastArchive.root,
684
689
  slotNumber: block.slot,
@@ -694,7 +699,7 @@ export async function randomPublishedL2Block(
694
699
  l2BlockNumber: number,
695
700
  opts: { signers?: Secp256k1Signer[] } = {},
696
701
  ): Promise<CheckpointedL2Block> {
697
- const block = await L2BlockNew.random(BlockNumber(l2BlockNumber));
702
+ const block = await L2Block.random(BlockNumber(l2BlockNumber));
698
703
  const l1 = L1PublishedData.fromFields({
699
704
  blockNumber: BigInt(block.number),
700
705
  timestamp: block.header.globalVariables.timestamp,
@@ -702,7 +707,9 @@ export async function randomPublishedL2Block(
702
707
  });
703
708
 
704
709
  const signers = opts.signers ?? times(3, () => Secp256k1Signer.random());
705
- const checkpoint = await Checkpoint.random(CheckpointNumber(l2BlockNumber), { numBlocks: 0 });
710
+ const checkpoint = await Checkpoint.random(CheckpointNumber.fromBlockNumber(BlockNumber(l2BlockNumber)), {
711
+ numBlocks: 0,
712
+ });
706
713
  checkpoint.blocks = [block];
707
714
  const atts = signers.map(signer =>
708
715
  makeCheckpointAttestation({
@@ -714,5 +721,5 @@ export async function randomPublishedL2Block(
714
721
  const attestations = atts.map(
715
722
  (attestation, i) => new CommitteeAttestation(signers[i].address, attestation.signature),
716
723
  );
717
- return new CheckpointedL2Block(CheckpointNumber(l2BlockNumber), block, l1, attestations);
724
+ return new CheckpointedL2Block(CheckpointNumber.fromBlockNumber(BlockNumber(l2BlockNumber)), block, l1, attestations);
718
725
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"l2_block_new.d.ts","sourceRoot":"","sources":["../../src/block/l2_block_new.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAuB,MAAM,0BAA0B,CAAC;AACnF,OAAO,EACL,WAAW,EACX,gBAAgB,EAEhB,qBAAqB,EAErB,UAAU,EACX,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAE9E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAOtD;;GAEG;AACH,qBAAa,UAAU;IAEnB,2DAA2D;IACpD,OAAO,EAAE,sBAAsB;IACtC,2BAA2B;IACpB,MAAM,EAAE,WAAW;IAC1B,qBAAqB;IACd,IAAI,EAAE,IAAI;IACjB,0DAA0D;IACnD,gBAAgB,EAAE,gBAAgB;IACzC,gDAAgD;IACzC,qBAAqB,EAAE,q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