@aztec/stdlib 0.0.1-commit.3469e52 → 0.0.1-commit.59e663cd

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 (127) hide show
  1. package/dest/block/block_hash.d.ts +12 -11
  2. package/dest/block/block_hash.d.ts.map +1 -1
  3. package/dest/block/block_hash.js +13 -10
  4. package/dest/block/block_parameter.d.ts +4 -4
  5. package/dest/block/block_parameter.d.ts.map +1 -1
  6. package/dest/block/block_parameter.js +2 -2
  7. package/dest/block/checkpointed_l2_block.d.ts +6 -6
  8. package/dest/block/checkpointed_l2_block.d.ts.map +1 -1
  9. package/dest/block/checkpointed_l2_block.js +3 -3
  10. package/dest/block/in_block.d.ts +10 -10
  11. package/dest/block/in_block.d.ts.map +1 -1
  12. package/dest/block/in_block.js +4 -4
  13. package/dest/block/index.d.ts +2 -2
  14. package/dest/block/index.d.ts.map +1 -1
  15. package/dest/block/index.js +1 -1
  16. package/dest/block/{l2_block_new.d.ts → l2_block.d.ts} +6 -6
  17. package/dest/block/l2_block.d.ts.map +1 -0
  18. package/dest/block/{l2_block_new.js → l2_block.js} +8 -11
  19. package/dest/block/l2_block_source.d.ts +37 -29
  20. package/dest/block/l2_block_source.d.ts.map +1 -1
  21. package/dest/block/l2_block_stream/interfaces.d.ts +3 -3
  22. package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
  23. package/dest/block/l2_block_stream/l2_block_stream.d.ts +2 -3
  24. package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
  25. package/dest/block/l2_block_stream/l2_block_stream.js +4 -4
  26. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +3 -3
  27. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts.map +1 -1
  28. package/dest/block/test/l2_tips_store_test_suite.js +2 -2
  29. package/dest/checkpoint/checkpoint.d.ts +8 -8
  30. package/dest/checkpoint/checkpoint.d.ts.map +1 -1
  31. package/dest/checkpoint/checkpoint.js +4 -4
  32. package/dest/checkpoint/published_checkpoint.d.ts +2 -2
  33. package/dest/config/node-rpc-config.js +1 -1
  34. package/dest/contract/private_function.d.ts +1 -1
  35. package/dest/contract/private_function.d.ts.map +1 -1
  36. package/dest/contract/private_function.js +1 -2
  37. package/dest/delayed_public_mutable/delayed_public_mutable_values.d.ts +2 -2
  38. package/dest/delayed_public_mutable/delayed_public_mutable_values.d.ts.map +1 -1
  39. package/dest/delayed_public_mutable/delayed_public_mutable_values.js +7 -10
  40. package/dest/epoch-helpers/index.js +1 -1
  41. package/dest/interfaces/archiver.d.ts +1 -1
  42. package/dest/interfaces/archiver.d.ts.map +1 -1
  43. package/dest/interfaces/archiver.js +15 -15
  44. package/dest/interfaces/aztec-node-admin.d.ts +4 -1
  45. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  46. package/dest/interfaces/aztec-node.d.ts +23 -9
  47. package/dest/interfaces/aztec-node.d.ts.map +1 -1
  48. package/dest/interfaces/aztec-node.js +11 -11
  49. package/dest/interfaces/block-builder.d.ts +4 -4
  50. package/dest/interfaces/block-builder.d.ts.map +1 -1
  51. package/dest/interfaces/configs.d.ts +2 -2
  52. package/dest/interfaces/configs.d.ts.map +1 -1
  53. package/dest/interfaces/get_logs_response.d.ts +2 -2
  54. package/dest/interfaces/prover-client.d.ts +10 -1
  55. package/dest/interfaces/prover-client.d.ts.map +1 -1
  56. package/dest/interfaces/prover-client.js +7 -1
  57. package/dest/interfaces/tx_provider.d.ts +3 -3
  58. package/dest/interfaces/tx_provider.d.ts.map +1 -1
  59. package/dest/interfaces/validator.d.ts +3 -3
  60. package/dest/interfaces/validator.d.ts.map +1 -1
  61. package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts +3 -3
  62. package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts.map +1 -1
  63. package/dest/kernel/hints/build_nullifier_read_request_hints.js +4 -6
  64. package/dest/logs/extended_public_log.d.ts +2 -2
  65. package/dest/logs/log_id.d.ts +6 -6
  66. package/dest/logs/log_id.d.ts.map +1 -1
  67. package/dest/logs/log_id.js +5 -5
  68. package/dest/p2p/block_proposal.d.ts +13 -6
  69. package/dest/p2p/block_proposal.d.ts.map +1 -1
  70. package/dest/p2p/block_proposal.js +1 -1
  71. package/dest/p2p/checkpoint_proposal.d.ts +10 -3
  72. package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
  73. package/dest/p2p/message_validator.d.ts +18 -3
  74. package/dest/p2p/message_validator.d.ts.map +1 -1
  75. package/dest/p2p/message_validator.js +2 -1
  76. package/dest/tests/factories.js +1 -1
  77. package/dest/tests/jest.d.ts +4 -4
  78. package/dest/tests/jest.js +9 -9
  79. package/dest/tests/mocks.d.ts +15 -10
  80. package/dest/tests/mocks.d.ts.map +1 -1
  81. package/dest/tests/mocks.js +19 -13
  82. package/dest/tx/block_header.d.ts +3 -2
  83. package/dest/tx/block_header.d.ts.map +1 -1
  84. package/dest/tx/block_header.js +3 -2
  85. package/dest/tx/in_tx.d.ts +2 -2
  86. package/dest/tx/indexed_tx_effect.d.ts +4 -4
  87. package/dest/tx/indexed_tx_effect.d.ts.map +1 -1
  88. package/dest/tx/indexed_tx_effect.js +2 -2
  89. package/dest/tx/tx_receipt.d.ts +42 -14
  90. package/dest/tx/tx_receipt.d.ts.map +1 -1
  91. package/dest/tx/tx_receipt.js +46 -15
  92. package/package.json +9 -9
  93. package/src/block/block_hash.ts +17 -13
  94. package/src/block/block_parameter.ts +3 -3
  95. package/src/block/checkpointed_l2_block.ts +4 -4
  96. package/src/block/in_block.ts +7 -7
  97. package/src/block/index.ts +1 -1
  98. package/src/block/{l2_block_new.ts → l2_block.ts} +9 -13
  99. package/src/block/l2_block_source.ts +38 -30
  100. package/src/block/l2_block_stream/interfaces.ts +2 -2
  101. package/src/block/l2_block_stream/l2_block_stream.ts +5 -6
  102. package/src/block/l2_block_stream/l2_tips_store_base.ts +2 -2
  103. package/src/block/test/l2_tips_store_test_suite.ts +4 -4
  104. package/src/checkpoint/checkpoint.ts +7 -7
  105. package/src/config/node-rpc-config.ts +1 -1
  106. package/src/contract/private_function.ts +1 -2
  107. package/src/delayed_public_mutable/delayed_public_mutable_values.ts +9 -10
  108. package/src/epoch-helpers/index.ts +1 -1
  109. package/src/interfaces/archiver.ts +15 -24
  110. package/src/interfaces/aztec-node.ts +38 -31
  111. package/src/interfaces/block-builder.ts +3 -3
  112. package/src/interfaces/configs.ts +1 -3
  113. package/src/interfaces/prover-client.ts +15 -0
  114. package/src/interfaces/tx_provider.ts +2 -2
  115. package/src/interfaces/validator.ts +2 -4
  116. package/src/kernel/hints/build_nullifier_read_request_hints.ts +1 -10
  117. package/src/logs/log_id.ts +6 -6
  118. package/src/p2p/block_proposal.ts +12 -5
  119. package/src/p2p/checkpoint_proposal.ts +9 -2
  120. package/src/p2p/message_validator.ts +14 -2
  121. package/src/tests/factories.ts +1 -1
  122. package/src/tests/jest.ts +9 -9
  123. package/src/tests/mocks.ts +26 -17
  124. package/src/tx/block_header.ts +7 -4
  125. package/src/tx/indexed_tx_effect.ts +2 -2
  126. package/src/tx/tx_receipt.ts +75 -18
  127. package/dest/block/l2_block_new.d.ts.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/stdlib",
3
- "version": "0.0.1-commit.3469e52",
3
+ "version": "0.0.1-commit.59e663cd",
4
4
  "type": "module",
5
5
  "inherits": [
6
6
  "../package.common.json",
@@ -78,14 +78,14 @@
78
78
  },
79
79
  "dependencies": {
80
80
  "@aws-sdk/client-s3": "^3.892.0",
81
- "@aztec/bb.js": "0.0.1-commit.3469e52",
82
- "@aztec/blob-lib": "0.0.1-commit.3469e52",
83
- "@aztec/constants": "0.0.1-commit.3469e52",
84
- "@aztec/ethereum": "0.0.1-commit.3469e52",
85
- "@aztec/foundation": "0.0.1-commit.3469e52",
86
- "@aztec/l1-artifacts": "0.0.1-commit.3469e52",
87
- "@aztec/noir-noirc_abi": "0.0.1-commit.3469e52",
88
- "@aztec/validator-ha-signer": "0.0.1-commit.3469e52",
81
+ "@aztec/bb.js": "0.0.1-commit.59e663cd",
82
+ "@aztec/blob-lib": "0.0.1-commit.59e663cd",
83
+ "@aztec/constants": "0.0.1-commit.59e663cd",
84
+ "@aztec/ethereum": "0.0.1-commit.59e663cd",
85
+ "@aztec/foundation": "0.0.1-commit.59e663cd",
86
+ "@aztec/l1-artifacts": "0.0.1-commit.59e663cd",
87
+ "@aztec/noir-noirc_abi": "0.0.1-commit.59e663cd",
88
+ "@aztec/validator-ha-signer": "0.0.1-commit.59e663cd",
89
89
  "@google-cloud/storage": "^7.15.0",
90
90
  "axios": "^1.12.0",
91
91
  "json-stringify-deterministic": "1.0.12",
@@ -5,7 +5,7 @@ import { BufferReader } from '@aztec/foundation/serialize';
5
5
  import { schemas } from '../schemas/schemas.js';
6
6
 
7
7
  /** Hash of an L2 block. */
8
- export class L2BlockHash extends Buffer32 {
8
+ export class BlockHash extends Buffer32 {
9
9
  constructor(
10
10
  /** The buffer containing the hash. */
11
11
  hash: Buffer,
@@ -14,12 +14,12 @@ export class L2BlockHash extends Buffer32 {
14
14
  }
15
15
 
16
16
  /**
17
- * Type guard that checks if a value is an L2BlockHash instance.
17
+ * Type guard that checks if a value is an BlockHash instance.
18
18
  * Uses duck typing to handle cases where instanceof fails due to module duplication.
19
19
  * Checks for Buffer32-like structure with a 32-byte buffer.
20
20
  */
21
- static isL2BlockHash(value: unknown): value is L2BlockHash {
22
- if (value instanceof L2BlockHash) {
21
+ static isL2BlockHash(value: unknown): value is BlockHash {
22
+ if (value instanceof BlockHash) {
23
23
  return true;
24
24
  }
25
25
  // Duck typing fallback: check if it looks like a Buffer32 with a 32-byte buffer
@@ -36,31 +36,35 @@ export class L2BlockHash extends Buffer32 {
36
36
  }
37
37
 
38
38
  static override random() {
39
- return new L2BlockHash(Fr.random().toBuffer());
39
+ return new BlockHash(Fr.random().toBuffer());
40
40
  }
41
41
 
42
- static override fromNumber(num: number): L2BlockHash {
43
- return new L2BlockHash(super.fromNumber(num).toBuffer());
42
+ static override fromNumber(num: number): BlockHash {
43
+ return new BlockHash(super.fromNumber(num).toBuffer());
44
44
  }
45
45
 
46
46
  static override fromBuffer(buffer: Buffer | BufferReader) {
47
47
  const reader = BufferReader.asReader(buffer);
48
- return new L2BlockHash(reader.readBytes(L2BlockHash.SIZE));
48
+ return new BlockHash(reader.readBytes(BlockHash.SIZE));
49
49
  }
50
50
 
51
- static override fromString(str: string): Buffer32 {
52
- return new L2BlockHash(super.fromString(str).toBuffer());
51
+ static override fromString(str: string): BlockHash {
52
+ return new BlockHash(super.fromString(str).toBuffer());
53
53
  }
54
54
 
55
55
  static get schema() {
56
- return schemas.BufferHex.transform(value => new L2BlockHash(value));
56
+ return schemas.BufferHex.transform(value => new BlockHash(value));
57
57
  }
58
58
 
59
59
  static zero() {
60
- return new L2BlockHash(Buffer32.ZERO.toBuffer());
60
+ return new BlockHash(Buffer32.ZERO.toBuffer());
61
61
  }
62
62
 
63
63
  static override fromField(hash: Fr) {
64
- return new L2BlockHash(hash.toBuffer());
64
+ return new BlockHash(hash.toBuffer());
65
+ }
66
+
67
+ toField(): Fr {
68
+ return Fr.fromBuffer(this.toBuffer());
65
69
  }
66
70
  }
@@ -2,9 +2,9 @@ import { BlockNumberSchema } from '@aztec/foundation/branded-types';
2
2
 
3
3
  import { z } from 'zod';
4
4
 
5
- import { L2BlockHash } from './block_hash.js';
5
+ import { BlockHash } from './block_hash.js';
6
6
 
7
- export const BlockParameterSchema = z.union([L2BlockHash.schema, BlockNumberSchema, z.literal('latest')]);
7
+ export const BlockParameterSchema = z.union([BlockHash.schema, BlockNumberSchema, z.literal('latest')]);
8
8
 
9
- /** Block parameter - either a specific BlockNumber, block hash (L2BlockHash), or 'latest' */
9
+ /** Block parameter - either a specific BlockNumber, block hash (BlockHash), or 'latest' */
10
10
  export type BlockParameter = z.infer<typeof BlockParameterSchema>;
@@ -7,7 +7,7 @@ import { z } from 'zod';
7
7
 
8
8
  import { L1PublishedData } from '../checkpoint/published_checkpoint.js';
9
9
  import { MAX_BLOCK_HASH_STRING_LENGTH, MAX_COMMITTEE_SIZE } from '../deserialization/index.js';
10
- import { L2BlockNew } from './l2_block_new.js';
10
+ import { L2Block } from './l2_block.js';
11
11
  import { CommitteeAttestation } from './proposal/committee_attestation.js';
12
12
 
13
13
  /**
@@ -16,7 +16,7 @@ import { CommitteeAttestation } from './proposal/committee_attestation.js';
16
16
  export class CheckpointedL2Block {
17
17
  constructor(
18
18
  public checkpointNumber: CheckpointNumber,
19
- public block: L2BlockNew,
19
+ public block: L2Block,
20
20
  public l1: L1PublishedData,
21
21
  public attestations: CommitteeAttestation[],
22
22
  ) {}
@@ -24,7 +24,7 @@ export class CheckpointedL2Block {
24
24
  return z
25
25
  .object({
26
26
  checkpointNumber: CheckpointNumberSchema,
27
- block: L2BlockNew.schema,
27
+ block: L2Block.schema,
28
28
  l1: L1PublishedData.schema,
29
29
  attestations: z.array(CommitteeAttestation.schema),
30
30
  })
@@ -34,7 +34,7 @@ export class CheckpointedL2Block {
34
34
  static fromBuffer(bufferOrReader: Buffer | BufferReader): CheckpointedL2Block {
35
35
  const reader = BufferReader.asReader(bufferOrReader);
36
36
  const checkpointNumber = reader.readNumber();
37
- const block = reader.readObject(L2BlockNew);
37
+ const block = reader.readObject(L2Block);
38
38
  const l1BlockNumber = reader.readBigInt();
39
39
  const l1BlockHash = reader.readString(MAX_BLOCK_HASH_STRING_LENGTH);
40
40
  const l1Timestamp = reader.readBigInt();
@@ -2,12 +2,12 @@ import { BlockNumber, BlockNumberSchema } from '@aztec/foundation/branded-types'
2
2
 
3
3
  import { type ZodTypeAny, z } from 'zod';
4
4
 
5
- import { L2BlockHash } from './block_hash.js';
6
- import type { L2BlockNew } from './l2_block_new.js';
5
+ import { BlockHash } from './block_hash.js';
6
+ import type { L2Block } from './l2_block.js';
7
7
 
8
8
  export type InBlock = {
9
9
  l2BlockNumber: BlockNumber;
10
- l2BlockHash: L2BlockHash;
10
+ l2BlockHash: BlockHash;
11
11
  };
12
12
 
13
13
  // Note: If you expand this type with indexInBlock, then delete `IndexedTxEffect` and use this type instead.
@@ -18,7 +18,7 @@ export type DataInBlock<T> = {
18
18
  export function randomInBlock(): InBlock {
19
19
  return {
20
20
  l2BlockNumber: BlockNumber(Math.floor(Math.random() * 1000)),
21
- l2BlockHash: L2BlockHash.random(),
21
+ l2BlockHash: BlockHash.random(),
22
22
  };
23
23
  }
24
24
 
@@ -29,18 +29,18 @@ export function randomDataInBlock<T>(data: T): DataInBlock<T> {
29
29
  };
30
30
  }
31
31
 
32
- export async function wrapDataInBlock<T>(data: T, block: L2BlockNew): Promise<DataInBlock<T>> {
32
+ export async function wrapDataInBlock<T>(data: T, block: L2Block): Promise<DataInBlock<T>> {
33
33
  return {
34
34
  data,
35
35
  l2BlockNumber: block.number,
36
- l2BlockHash: L2BlockHash.fromField(await block.hash()),
36
+ l2BlockHash: BlockHash.fromField(await block.hash()),
37
37
  };
38
38
  }
39
39
 
40
40
  export function inBlockSchema() {
41
41
  return z.object({
42
42
  l2BlockNumber: BlockNumberSchema,
43
- l2BlockHash: L2BlockHash.schema,
43
+ l2BlockHash: BlockHash.schema,
44
44
  });
45
45
  }
46
46
 
@@ -1,4 +1,4 @@
1
- export * from './l2_block_new.js';
1
+ export * from './l2_block.js';
2
2
  export * from './l2_block_stream/index.js';
3
3
  export * from './in_block.js';
4
4
  export * from './body.js';
@@ -18,15 +18,10 @@ import { BlockHeader } from '../tx/block_header.js';
18
18
  import { Body } from './body.js';
19
19
  import type { L2BlockInfo } from './l2_block_info.js';
20
20
 
21
- // TODO(palla/mbps): Delete the existing `L2Block` class and rename this to `L2Block`.
22
- // TODO(palla/mbps): Consider moving the checkpointNumber and indexWithinCheckpoint to the header:
23
- // if the blockNumber is there, why not these as well? Consider whether they should be part of the
24
- // circuits structs though.
25
-
26
21
  /**
27
22
  * An L2 block with a header and a body.
28
23
  */
29
- export class L2BlockNew {
24
+ export class L2Block {
30
25
  constructor(
31
26
  /** Snapshot of archive tree after the block is applied. */
32
27
  public archive: AppendOnlyTreeSnapshot,
@@ -63,7 +58,7 @@ export class L2BlockNew {
63
58
  })
64
59
  .transform(
65
60
  ({ archive, header, body, checkpointNumber, indexWithinCheckpoint }) =>
66
- new L2BlockNew(archive, header, body, checkpointNumber, indexWithinCheckpoint),
61
+ new L2Block(archive, header, body, checkpointNumber, indexWithinCheckpoint),
67
62
  );
68
63
  }
69
64
 
@@ -79,7 +74,7 @@ export class L2BlockNew {
79
74
  const checkpointNumber = CheckpointNumber(reader.readNumber());
80
75
  const indexWithinCheckpoint = IndexWithinCheckpoint(reader.readNumber());
81
76
 
82
- return new L2BlockNew(archive, header, body, checkpointNumber, indexWithinCheckpoint);
77
+ return new L2Block(archive, header, body, checkpointNumber, indexWithinCheckpoint);
83
78
  }
84
79
 
85
80
  /**
@@ -94,8 +89,9 @@ export class L2BlockNew {
94
89
  * Returns the block's hash (hash of block header).
95
90
  * @returns The block's hash.
96
91
  */
97
- public hash(): Promise<Fr> {
98
- return this.header.hash();
92
+ public async hash(): Promise<Fr> {
93
+ const blockHash = await this.header.hash();
94
+ return blockHash.toField();
99
95
  }
100
96
 
101
97
  /**
@@ -143,7 +139,7 @@ export class L2BlockNew {
143
139
  }
144
140
 
145
141
  static empty(header?: BlockHeader) {
146
- return new L2BlockNew(
142
+ return new L2Block(
147
143
  AppendOnlyTreeSnapshot.empty(),
148
144
  header ?? BlockHeader.empty(),
149
145
  Body.empty(),
@@ -177,11 +173,11 @@ export class L2BlockNew {
177
173
  txOptions?: Partial<Parameters<typeof Body.random>[0]>;
178
174
  makeTxOptions?: (txIndex: number) => Partial<Parameters<typeof Body.random>[0]>;
179
175
  } & Partial<Parameters<typeof BlockHeader.random>[0]> = {},
180
- ): Promise<L2BlockNew> {
176
+ ): Promise<L2Block> {
181
177
  const archive = new AppendOnlyTreeSnapshot(Fr.random(), blockNumber + 1);
182
178
  const header = BlockHeader.random({ blockNumber, ...blockHeaderOverrides });
183
179
  const body = await Body.random({ txsPerBlock, makeTxOptions, ...txOptions });
184
- return new L2BlockNew(archive, header, body, checkpointNumber, indexWithinCheckpoint);
180
+ return new L2Block(archive, header, body, checkpointNumber, indexWithinCheckpoint);
185
181
  }
186
182
 
187
183
  /**
@@ -21,7 +21,7 @@ import type { IndexedTxEffect } from '../tx/indexed_tx_effect.js';
21
21
  import type { TxHash } from '../tx/tx_hash.js';
22
22
  import type { TxReceipt } from '../tx/tx_receipt.js';
23
23
  import type { CheckpointedL2Block } from './checkpointed_l2_block.js';
24
- import type { L2BlockNew } from './l2_block_new.js';
24
+ import type { L2Block } from './l2_block.js';
25
25
  import type { ValidateCheckpointNegativeResult, ValidateCheckpointResult } from './validate_block_result.js';
26
26
 
27
27
  /**
@@ -52,6 +52,20 @@ export interface L2BlockSource {
52
52
  */
53
53
  getProvenBlockNumber(): Promise<BlockNumber>;
54
54
 
55
+ /**
56
+ * Gets the number of the latest L2 block checkpointed seen by the block source implementation.
57
+ * @returns The number of the latest L2 block checkpointed seen by the block source implementation.
58
+ */
59
+ getCheckpointedL2BlockNumber(): Promise<BlockNumber>;
60
+
61
+ /**
62
+ * Computes the finalized block number based on the proven block number.
63
+ * A block is considered finalized when it's 2 epochs behind the proven block.
64
+ * TODO(#13569): Compute proper finalized block number based on L1 finalized block.
65
+ * @returns The finalized block number.
66
+ */
67
+ getFinalizedL2BlockNumber(): Promise<BlockNumber>;
68
+
55
69
  /**
56
70
  * Gets an l2 block header.
57
71
  * @param number - The block number to return or 'latest' for the most recent one.
@@ -67,15 +81,15 @@ export interface L2BlockSource {
67
81
  */
68
82
  getCheckpointedBlock(number: BlockNumber): Promise<CheckpointedL2Block | undefined>;
69
83
 
70
- getCheckpointedBlocks(from: BlockNumber, limit: number, proven?: boolean): Promise<CheckpointedL2Block[]>;
84
+ getCheckpointedBlocks(from: BlockNumber, limit: number): Promise<CheckpointedL2Block[]>;
71
85
 
72
86
  /**
73
- * Retrieves a collection of published checkpoints
74
- * @param checkpointNumber The first checkpoint to be retrieved
75
- * @param limit The number of checkpoints to be retrieved
76
- * @returns The collection of complete checkpoints
87
+ * Retrieves a collection of checkpoints.
88
+ * @param checkpointNumber The first checkpoint to be retrieved.
89
+ * @param limit The number of checkpoints to be retrieved.
90
+ * @returns The collection of complete checkpoints.
77
91
  */
78
- getPublishedCheckpoints(checkpointNumber: CheckpointNumber, limit: number): Promise<PublishedCheckpoint[]>;
92
+ getCheckpoints(checkpointNumber: CheckpointNumber, limit: number): Promise<PublishedCheckpoint[]>;
79
93
 
80
94
  /**
81
95
  * Gets the checkpoints for a given epoch
@@ -102,21 +116,21 @@ export interface L2BlockSource {
102
116
  * @param number - The block number to return.
103
117
  * @returns The requested L2 block (or undefined if not found).
104
118
  */
105
- getL2BlockNew(number: BlockNumber): Promise<L2BlockNew | undefined>;
119
+ getL2Block(number: BlockNumber): Promise<L2Block | undefined>;
106
120
 
107
121
  /**
108
122
  * Gets an L2 block by its hash.
109
123
  * @param blockHash - The block hash to retrieve.
110
124
  * @returns The requested L2 block (or undefined if not found).
111
125
  */
112
- getL2BlockNewByHash(blockHash: Fr): Promise<L2BlockNew | undefined>;
126
+ getL2BlockByHash(blockHash: Fr): Promise<L2Block | undefined>;
113
127
 
114
128
  /**
115
129
  * Gets an L2 block by its archive root.
116
130
  * @param archive - The archive root to retrieve.
117
131
  * @returns The requested L2 block (or undefined if not found).
118
132
  */
119
- getL2BlockNewByArchive(archive: Fr): Promise<L2BlockNew | undefined>;
133
+ getL2BlockByArchive(archive: Fr): Promise<L2Block | undefined>;
120
134
 
121
135
  /**
122
136
  * Gets a tx effect.
@@ -143,11 +157,11 @@ export interface L2BlockSource {
143
157
  getL2EpochNumber(): Promise<EpochNumber | undefined>;
144
158
 
145
159
  /**
146
- * Returns all block headers for a given epoch.
160
+ * Returns all checkpointed block headers for a given epoch.
147
161
  * @dev Use this method only with recent epochs, since it walks the block list backwards.
148
162
  * @param epochNumber - The epoch number to return headers for.
149
163
  */
150
- getBlockHeadersForEpoch(epochNumber: EpochNumber): Promise<BlockHeader[]>;
164
+ getCheckpointedBlockHeadersForEpoch(epochNumber: EpochNumber): Promise<BlockHeader[]>;
151
165
 
152
166
  /**
153
167
  * Returns whether the given epoch is completed on L1, based on the current L1 and L2 block numbers.
@@ -193,49 +207,43 @@ export interface L2BlockSource {
193
207
  * @param number - The block number to return (inclusive).
194
208
  * @returns The requested L2 block.
195
209
  */
196
- getBlock(number: BlockNumber): Promise<L2BlockNew | undefined>;
197
-
198
- getL2BlocksNew(from: BlockNumber, limit: number, proven?: boolean): Promise<L2BlockNew[]>;
210
+ getBlock(number: BlockNumber): Promise<L2Block | undefined>;
199
211
 
200
212
  /**
201
- * Returns all blocks for a given epoch.
213
+ * Returns all checkpointed blocks for a given epoch.
202
214
  * @dev Use this method only with recent epochs, since it walks the block list backwards.
203
215
  * @param epochNumber - The epoch number to return blocks for.
204
216
  */
205
- getBlocksForEpoch(epochNumber: EpochNumber): Promise<L2BlockNew[]>;
217
+ getCheckpointedBlocksForEpoch(epochNumber: EpochNumber): Promise<CheckpointedL2Block[]>;
206
218
 
207
219
  /**
208
220
  * Returns all blocks for a given slot.
209
221
  * @dev Use this method only with recent slots, since it walks the block list backwards.
210
222
  * @param slotNumber - The slot number to return blocks for.
211
223
  */
212
- getBlocksForSlot(slotNumber: SlotNumber): Promise<L2BlockNew[]>;
224
+ getBlocksForSlot(slotNumber: SlotNumber): Promise<L2Block[]>;
213
225
 
214
226
  /**
215
- * Gets a published block by its block hash.
227
+ * Gets a checkpointed block by its block hash.
216
228
  * @param blockHash - The block hash to retrieve.
217
229
  * @returns The requested block (or undefined if not found).
218
230
  */
219
- getPublishedBlockByHash(blockHash: Fr): Promise<CheckpointedL2Block | undefined>;
231
+ getCheckpointedBlockByHash(blockHash: Fr): Promise<CheckpointedL2Block | undefined>;
220
232
 
221
233
  /**
222
- * Gets a published block by its archive root.
234
+ * Gets a checkpointed block by its archive root.
223
235
  * @param archive - The archive root to retrieve.
224
236
  * @returns The requested block (or undefined if not found).
225
237
  */
226
- getPublishedBlockByArchive(archive: Fr): Promise<CheckpointedL2Block | undefined>;
238
+ getCheckpointedBlockByArchive(archive: Fr): Promise<CheckpointedL2Block | undefined>;
227
239
 
228
240
  /**
229
241
  * Gets up to `limit` amount of L2 blocks starting from `from`.
230
242
  * @param from - Number of the first block to return (inclusive).
231
243
  * @param limit - The maximum number of blocks to return.
232
- * @param proven - If true, only return blocks that have been proven.
233
244
  * @returns The requested L2 blocks.
234
245
  */
235
- getBlocks(from: BlockNumber, limit: number, proven?: boolean): Promise<L2BlockNew[]>;
236
-
237
- /** Equivalent to getBlocks but includes publish data. */
238
- getPublishedBlocks(from: BlockNumber, limit: number, proven?: boolean): Promise<CheckpointedL2Block[]>;
246
+ getBlocks(from: BlockNumber, limit: number): Promise<L2Block[]>;
239
247
  }
240
248
 
241
249
  /**
@@ -247,7 +255,7 @@ export interface L2BlockSink {
247
255
  * @param block - The L2 block to add.
248
256
  * @throws If block number is not incremental (i.e., not exactly one more than the last stored block).
249
257
  */
250
- addBlock(block: L2BlockNew): Promise<void>;
258
+ addBlock(block: L2Block): Promise<void>;
251
259
  }
252
260
 
253
261
  /**
@@ -344,13 +352,13 @@ export type L2BlockProvenEvent = {
344
352
  export type L2PruneUnprovenEvent = {
345
353
  type: 'l2PruneUnproven';
346
354
  epochNumber: EpochNumber;
347
- blocks: L2BlockNew[];
355
+ blocks: L2Block[];
348
356
  };
349
357
 
350
358
  export type L2PruneUncheckpointedEvent = {
351
359
  type: 'l2PruneUncheckpointed';
352
360
  slotNumber: SlotNumber;
353
- blocks: L2BlockNew[];
361
+ blocks: L2Block[];
354
362
  };
355
363
 
356
364
  export type L2CheckpointEvent = {
@@ -1,5 +1,5 @@
1
1
  import type { PublishedCheckpoint } from '../../checkpoint/published_checkpoint.js';
2
- import type { L2BlockNew } from '../l2_block_new.js';
2
+ import type { L2Block } from '../l2_block.js';
3
3
  import type { CheckpointId, L2BlockId, L2Tips } from '../l2_block_source.js';
4
4
 
5
5
  /** Interface to the local view of the chain. Implemented by world-state and l2-tips-store. */
@@ -16,7 +16,7 @@ export interface L2BlockStreamEventHandler {
16
16
  export type L2BlockStreamEvent =
17
17
  | /** Emits blocks added to the chain. */ {
18
18
  type: 'blocks-added';
19
- blocks: L2BlockNew[];
19
+ blocks: L2Block[];
20
20
  }
21
21
  | /** Emits checkpoints published to L1. */ {
22
22
  type: 'chain-checkpointed';
@@ -19,13 +19,12 @@ export class L2BlockStream {
19
19
  constructor(
20
20
  private l2BlockSource: Pick<
21
21
  L2BlockSource,
22
- 'getL2BlocksNew' | 'getBlockHeader' | 'getL2Tips' | 'getPublishedCheckpoints' | 'getCheckpointedBlocks'
22
+ 'getBlocks' | 'getBlockHeader' | 'getL2Tips' | 'getCheckpoints' | 'getCheckpointedBlocks'
23
23
  >,
24
24
  private localData: L2BlockStreamLocalDataProvider,
25
25
  private handler: L2BlockStreamEventHandler,
26
26
  private readonly log = createLogger('types:block_stream'),
27
27
  private opts: {
28
- proven?: boolean;
29
28
  pollIntervalMS?: number;
30
29
  batchSize?: number;
31
30
  startingBlock?: number;
@@ -129,7 +128,7 @@ export class L2BlockStream {
129
128
  if (!this.opts.ignoreCheckpoints) {
130
129
  let loop1Iterations = 0;
131
130
  while (nextCheckpointToEmit <= sourceTips.checkpointed.checkpoint.number) {
132
- const checkpoints = await this.l2BlockSource.getPublishedCheckpoints(nextCheckpointToEmit, 1);
131
+ const checkpoints = await this.l2BlockSource.getCheckpoints(nextCheckpointToEmit, 1);
133
132
  if (checkpoints.length === 0) {
134
133
  break;
135
134
  }
@@ -174,7 +173,7 @@ export class L2BlockStream {
174
173
  // Refill the prefetch buffer when exhausted
175
174
  if (prefetchIdx >= prefetchedCheckpoints.length) {
176
175
  const prefetchLimit = this.opts.checkpointPrefetchLimit ?? CHECKPOINT_PREFETCH_LIMIT;
177
- prefetchedCheckpoints = await this.l2BlockSource.getPublishedCheckpoints(nextCheckpointNumber, prefetchLimit);
176
+ prefetchedCheckpoints = await this.l2BlockSource.getCheckpoints(nextCheckpointNumber, prefetchLimit);
178
177
  prefetchIdx = 0;
179
178
  if (prefetchedCheckpoints.length === 0) {
180
179
  break;
@@ -213,8 +212,8 @@ export class L2BlockStream {
213
212
  // Loop 3: Fetch any remaining uncheckpointed (proposed) blocks.
214
213
  while (nextBlockNumber <= sourceTips.proposed.number) {
215
214
  const limit = Math.min(this.opts.batchSize ?? 50, sourceTips.proposed.number - nextBlockNumber + 1);
216
- this.log.trace(`Requesting blocks from ${nextBlockNumber} limit ${limit} proven=${this.opts.proven}`);
217
- const blocks = await this.l2BlockSource.getL2BlocksNew(BlockNumber(nextBlockNumber), limit, this.opts.proven);
215
+ this.log.trace(`Requesting blocks from ${nextBlockNumber} limit ${limit}`);
216
+ const blocks = await this.l2BlockSource.getBlocks(BlockNumber(nextBlockNumber), BlockNumber(limit));
218
217
  if (blocks.length === 0) {
219
218
  break;
220
219
  }
@@ -2,7 +2,7 @@ import { GENESIS_BLOCK_HEADER_HASH } from '@aztec/constants';
2
2
  import { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
3
3
 
4
4
  import type { PublishedCheckpoint } from '../../checkpoint/published_checkpoint.js';
5
- import type { L2BlockNew } from '../l2_block_new.js';
5
+ import type { L2Block } from '../l2_block.js';
6
6
  import {
7
7
  type CheckpointId,
8
8
  GENESIS_CHECKPOINT_HEADER_HASH,
@@ -109,7 +109,7 @@ export abstract class L2TipsStoreBase implements L2BlockStreamEventHandler, L2Bl
109
109
  }
110
110
 
111
111
  // Protected helper that subclasses can override for block hash computation
112
- protected computeBlockHash(block: L2BlockNew): Promise<string> {
112
+ protected computeBlockHash(block: L2Block): Promise<string> {
113
113
  return block.hash().then(hash => hash.toString());
114
114
  }
115
115
 
@@ -5,8 +5,8 @@ import { Fr } from '@aztec/foundation/curves/bn254';
5
5
  import {
6
6
  type CheckpointId,
7
7
  GENESIS_CHECKPOINT_HEADER_HASH,
8
+ L2Block,
8
9
  type L2BlockId,
9
- L2BlockNew,
10
10
  type L2TipId,
11
11
  } from '@aztec/stdlib/block';
12
12
  import { Checkpoint, L1PublishedData, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
@@ -31,8 +31,8 @@ export function testL2TipsStore(makeTipsStore: () => Promise<L2TipsStore>) {
31
31
  blockToCheckpoint.clear();
32
32
  });
33
33
 
34
- const makeBlock = async (number: number): Promise<L2BlockNew> => {
35
- const block = await L2BlockNew.random(BlockNumber(number));
34
+ const makeBlock = async (number: number): Promise<L2Block> => {
35
+ const block = await L2Block.random(BlockNumber(number));
36
36
  blockHashes.set(number, (await block.hash()).toString());
37
37
  return block;
38
38
  };
@@ -74,7 +74,7 @@ export function testL2TipsStore(makeTipsStore: () => Promise<L2TipsStore>) {
74
74
  checkpointed: makeTipId(checkpointed),
75
75
  });
76
76
 
77
- const makeCheckpoint = async (checkpointNumber: number, blocks: L2BlockNew[]): Promise<PublishedCheckpoint> => {
77
+ const makeCheckpoint = async (checkpointNumber: number, blocks: L2Block[]): Promise<PublishedCheckpoint> => {
78
78
  const checkpoint = await Checkpoint.random(CheckpointNumber(checkpointNumber), {
79
79
  numBlocks: blocks.length,
80
80
  startBlockNumber: blocks[0].number,
@@ -13,7 +13,7 @@ import type { FieldsOf } from '@aztec/foundation/types';
13
13
 
14
14
  import { z } from 'zod';
15
15
 
16
- import { L2BlockNew } from '../block/l2_block_new.js';
16
+ import { L2Block } from '../block/l2_block.js';
17
17
  import { MAX_BLOCKS_PER_CHECKPOINT } from '../deserialization/index.js';
18
18
  import { computeCheckpointOutHash } from '../messaging/out_hash.js';
19
19
  import { CheckpointHeader } from '../rollup/checkpoint_header.js';
@@ -29,7 +29,7 @@ export class Checkpoint {
29
29
  /** Header of the checkpoint. */
30
30
  public header: CheckpointHeader,
31
31
  /** L2 blocks in the checkpoint. */
32
- public blocks: L2BlockNew[],
32
+ public blocks: L2Block[],
33
33
  /** Number of the checkpoint. */
34
34
  public number: CheckpointNumber,
35
35
  ) {}
@@ -43,7 +43,7 @@ export class Checkpoint {
43
43
  .object({
44
44
  archive: AppendOnlyTreeSnapshot.schema,
45
45
  header: CheckpointHeader.schema,
46
- blocks: z.array(L2BlockNew.schema),
46
+ blocks: z.array(L2Block.schema),
47
47
  number: CheckpointNumberSchema,
48
48
  })
49
49
  .transform(({ archive, header, blocks, number }) => new Checkpoint(archive, header, blocks, number));
@@ -62,7 +62,7 @@ export class Checkpoint {
62
62
  return new Checkpoint(
63
63
  reader.readObject(AppendOnlyTreeSnapshot),
64
64
  reader.readObject(CheckpointHeader),
65
- reader.readVector(L2BlockNew, MAX_BLOCKS_PER_CHECKPOINT),
65
+ reader.readVector(L2Block, MAX_BLOCKS_PER_CHECKPOINT),
66
66
  CheckpointNumber(reader.readNumber()),
67
67
  );
68
68
  }
@@ -135,16 +135,16 @@ export class Checkpoint {
135
135
  startBlockNumber?: number;
136
136
  previousArchive?: AppendOnlyTreeSnapshot;
137
137
  } & Partial<Parameters<typeof CheckpointHeader.random>[0]> &
138
- Partial<Parameters<typeof L2BlockNew.random>[1]> = {},
138
+ Partial<Parameters<typeof L2Block.random>[1]> = {},
139
139
  ) {
140
140
  const header = CheckpointHeader.random(options);
141
141
 
142
142
  // Create blocks sequentially to chain archive roots properly.
143
143
  // Each block's header.lastArchive must equal the previous block's archive.
144
- const blocks: L2BlockNew[] = [];
144
+ const blocks: L2Block[] = [];
145
145
  let lastArchive = previousArchive;
146
146
  for (let i = 0; i < numBlocks; i++) {
147
- const block = await L2BlockNew.random(BlockNumber(startBlockNumber + i), {
147
+ const block = await L2Block.random(BlockNumber(startBlockNumber + i), {
148
148
  indexWithinCheckpoint: IndexWithinCheckpoint(i),
149
149
  ...options,
150
150
  ...(lastArchive ? { lastArchive } : {}),
@@ -21,7 +21,7 @@ export const nodeRpcConfigMappings: ConfigMappingsType<NodeRPCConfig> = {
21
21
  rpcMaxBodySize: {
22
22
  env: 'RPC_MAX_BODY_SIZE',
23
23
  description: 'Maximum allowed batch size for JSON RPC batch requests.',
24
- defaultValue: '50mb',
24
+ defaultValue: '1mb',
25
25
  },
26
26
  };
27
27
 
@@ -1,5 +1,4 @@
1
1
  import { FUNCTION_TREE_HEIGHT, GeneratorIndex } from '@aztec/constants';
2
- import { pedersenHash } from '@aztec/foundation/crypto/pedersen';
3
2
  import { poseidon2Hash, poseidon2HashWithSeparator } from '@aztec/foundation/crypto/poseidon';
4
3
  import { Fr } from '@aztec/foundation/curves/bn254';
5
4
  import { type MerkleTree, MerkleTreeCalculator } from '@aztec/foundation/trees';
@@ -38,7 +37,7 @@ export async function computePrivateFunctionLeaf(fn: PrivateFunction): Promise<B
38
37
  async function getPrivateFunctionTreeCalculator(): Promise<MerkleTreeCalculator> {
39
38
  if (!privateFunctionTreeCalculator) {
40
39
  const functionTreeZeroLeaf = (
41
- await pedersenHash(new Array(PRIVATE_FUNCTION_SIZE).fill(0))
40
+ await poseidon2Hash(new Array(PRIVATE_FUNCTION_SIZE).fill(0))
42
41
  ).toBuffer() as Buffer<ArrayBuffer>;
43
42
  privateFunctionTreeCalculator = await MerkleTreeCalculator.create(
44
43
  FUNCTION_TREE_HEIGHT,