@aztec/stdlib 0.0.1-commit.f295ac2 → 0.0.1-commit.fc805bf

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 (199) hide show
  1. package/dest/block/block_hash.d.ts +16 -18
  2. package/dest/block/block_hash.d.ts.map +1 -1
  3. package/dest/block/block_hash.js +21 -31
  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 +11 -11
  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} +8 -7
  17. package/dest/block/l2_block.d.ts.map +1 -0
  18. package/dest/block/{l2_block_new.js → l2_block.js} +5 -9
  19. package/dest/block/l2_block_source.d.ts +39 -30
  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 +6 -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 +37 -25
  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/contract_address.js +1 -1
  35. package/dest/contract/contract_class_id.d.ts +1 -1
  36. package/dest/contract/contract_class_id.js +1 -1
  37. package/dest/contract/private_function.d.ts +1 -1
  38. package/dest/contract/private_function.d.ts.map +1 -1
  39. package/dest/contract/private_function.js +2 -3
  40. package/dest/contract/private_function_membership_proof.d.ts +1 -1
  41. package/dest/contract/private_function_membership_proof.js +1 -1
  42. package/dest/database-version/database_version.d.ts +58 -0
  43. package/dest/database-version/database_version.d.ts.map +1 -0
  44. package/dest/database-version/database_version.js +69 -0
  45. package/dest/database-version/version_manager.d.ts +2 -50
  46. package/dest/database-version/version_manager.d.ts.map +1 -1
  47. package/dest/database-version/version_manager.js +1 -66
  48. package/dest/delayed_public_mutable/delayed_public_mutable_values.d.ts +2 -2
  49. package/dest/delayed_public_mutable/delayed_public_mutable_values.d.ts.map +1 -1
  50. package/dest/delayed_public_mutable/delayed_public_mutable_values.js +7 -10
  51. package/dest/epoch-helpers/index.d.ts +3 -1
  52. package/dest/epoch-helpers/index.d.ts.map +1 -1
  53. package/dest/epoch-helpers/index.js +5 -1
  54. package/dest/hash/hash.js +2 -2
  55. package/dest/hash/map_slot.d.ts +1 -1
  56. package/dest/hash/map_slot.d.ts.map +1 -1
  57. package/dest/hash/map_slot.js +4 -3
  58. package/dest/interfaces/api_limit.d.ts +2 -1
  59. package/dest/interfaces/api_limit.d.ts.map +1 -1
  60. package/dest/interfaces/api_limit.js +1 -0
  61. package/dest/interfaces/archiver.d.ts +1 -1
  62. package/dest/interfaces/archiver.d.ts.map +1 -1
  63. package/dest/interfaces/archiver.js +19 -18
  64. package/dest/interfaces/aztec-node-admin.d.ts +4 -1
  65. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  66. package/dest/interfaces/aztec-node.d.ts +64 -62
  67. package/dest/interfaces/aztec-node.d.ts.map +1 -1
  68. package/dest/interfaces/aztec-node.js +13 -17
  69. package/dest/interfaces/block-builder.d.ts +13 -7
  70. package/dest/interfaces/block-builder.d.ts.map +1 -1
  71. package/dest/interfaces/block-builder.js +7 -0
  72. package/dest/interfaces/configs.d.ts +2 -2
  73. package/dest/interfaces/configs.d.ts.map +1 -1
  74. package/dest/interfaces/get_logs_response.d.ts +7 -7
  75. package/dest/interfaces/l2_logs_source.d.ts +14 -5
  76. package/dest/interfaces/l2_logs_source.d.ts.map +1 -1
  77. package/dest/interfaces/prover-client.d.ts +10 -1
  78. package/dest/interfaces/prover-client.d.ts.map +1 -1
  79. package/dest/interfaces/prover-client.js +7 -1
  80. package/dest/interfaces/tx_provider.d.ts +3 -3
  81. package/dest/interfaces/tx_provider.d.ts.map +1 -1
  82. package/dest/interfaces/validator.d.ts +3 -3
  83. package/dest/interfaces/validator.d.ts.map +1 -1
  84. package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts +3 -3
  85. package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts.map +1 -1
  86. package/dest/kernel/hints/build_nullifier_read_request_hints.js +4 -6
  87. package/dest/keys/derivation.d.ts +3 -3
  88. package/dest/keys/derivation.js +8 -8
  89. package/dest/keys/key_types.d.ts +1 -1
  90. package/dest/keys/utils.d.ts +1 -1
  91. package/dest/keys/utils.d.ts.map +1 -1
  92. package/dest/keys/utils.js +7 -3
  93. package/dest/l1-contracts/slash_factory.d.ts +1 -1
  94. package/dest/l1-contracts/slash_factory.d.ts.map +1 -1
  95. package/dest/l1-contracts/slash_factory.js +1 -0
  96. package/dest/logs/extended_public_log.d.ts +6 -6
  97. package/dest/logs/log_id.d.ts +8 -8
  98. package/dest/logs/log_id.d.ts.map +1 -1
  99. package/dest/logs/log_id.js +6 -5
  100. package/dest/logs/siloed_tag.d.ts +1 -1
  101. package/dest/logs/siloed_tag.d.ts.map +1 -1
  102. package/dest/logs/siloed_tag.js +4 -3
  103. package/dest/p2p/block_proposal.d.ts +13 -6
  104. package/dest/p2p/block_proposal.d.ts.map +1 -1
  105. package/dest/p2p/block_proposal.js +1 -1
  106. package/dest/p2p/checkpoint_proposal.d.ts +10 -3
  107. package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
  108. package/dest/p2p/constants.d.ts +3 -0
  109. package/dest/p2p/constants.d.ts.map +1 -0
  110. package/dest/p2p/constants.js +2 -0
  111. package/dest/p2p/index.d.ts +2 -1
  112. package/dest/p2p/index.d.ts.map +1 -1
  113. package/dest/p2p/index.js +1 -0
  114. package/dest/p2p/message_validator.d.ts +18 -3
  115. package/dest/p2p/message_validator.d.ts.map +1 -1
  116. package/dest/p2p/message_validator.js +2 -1
  117. package/dest/stats/stats.d.ts +1 -3
  118. package/dest/stats/stats.d.ts.map +1 -1
  119. package/dest/tests/factories.js +1 -1
  120. package/dest/tests/jest.d.ts +4 -4
  121. package/dest/tests/jest.js +9 -9
  122. package/dest/tests/mocks.d.ts +15 -10
  123. package/dest/tests/mocks.d.ts.map +1 -1
  124. package/dest/tests/mocks.js +19 -13
  125. package/dest/tx/block_header.d.ts +3 -2
  126. package/dest/tx/block_header.d.ts.map +1 -1
  127. package/dest/tx/block_header.js +3 -2
  128. package/dest/tx/in_tx.d.ts +3 -3
  129. package/dest/tx/indexed_tx_effect.d.ts +5 -5
  130. package/dest/tx/indexed_tx_effect.d.ts.map +1 -1
  131. package/dest/tx/indexed_tx_effect.js +3 -2
  132. package/dest/tx/tx.d.ts +2 -1
  133. package/dest/tx/tx.d.ts.map +1 -1
  134. package/dest/tx/tx.js +6 -3
  135. package/dest/tx/tx_receipt.d.ts +42 -14
  136. package/dest/tx/tx_receipt.d.ts.map +1 -1
  137. package/dest/tx/tx_receipt.js +46 -15
  138. package/dest/tx/validator/error_texts.d.ts +2 -1
  139. package/dest/tx/validator/error_texts.d.ts.map +1 -1
  140. package/dest/tx/validator/error_texts.js +2 -0
  141. package/package.json +11 -10
  142. package/src/block/block_hash.ts +26 -47
  143. package/src/block/block_parameter.ts +3 -3
  144. package/src/block/checkpointed_l2_block.ts +4 -4
  145. package/src/block/in_block.ts +7 -7
  146. package/src/block/index.ts +1 -1
  147. package/src/block/{l2_block_new.ts → l2_block.ts} +8 -12
  148. package/src/block/l2_block_source.ts +40 -31
  149. package/src/block/l2_block_stream/interfaces.ts +2 -2
  150. package/src/block/l2_block_stream/l2_block_stream.ts +44 -27
  151. package/src/block/l2_block_stream/l2_tips_store_base.ts +2 -2
  152. package/src/block/test/l2_tips_store_test_suite.ts +4 -4
  153. package/src/checkpoint/checkpoint.ts +7 -7
  154. package/src/config/node-rpc-config.ts +1 -1
  155. package/src/contract/contract_address.ts +1 -1
  156. package/src/contract/contract_class_id.ts +1 -1
  157. package/src/contract/private_function.ts +2 -3
  158. package/src/contract/private_function_membership_proof.ts +1 -1
  159. package/src/database-version/database_version.ts +87 -0
  160. package/src/database-version/version_manager.ts +1 -77
  161. package/src/delayed_public_mutable/delayed_public_mutable_values.ts +9 -10
  162. package/src/epoch-helpers/index.ts +10 -1
  163. package/src/hash/hash.ts +2 -2
  164. package/src/hash/map_slot.ts +3 -2
  165. package/src/interfaces/api_limit.ts +1 -0
  166. package/src/interfaces/archiver.ts +19 -27
  167. package/src/interfaces/aztec-node.ts +89 -120
  168. package/src/interfaces/block-builder.ts +15 -5
  169. package/src/interfaces/configs.ts +1 -3
  170. package/src/interfaces/l2_logs_source.ts +17 -4
  171. package/src/interfaces/prover-client.ts +15 -0
  172. package/src/interfaces/tx_provider.ts +2 -2
  173. package/src/interfaces/validator.ts +2 -4
  174. package/src/kernel/hints/build_nullifier_read_request_hints.ts +1 -10
  175. package/src/keys/derivation.ts +8 -8
  176. package/src/keys/key_types.ts +1 -1
  177. package/src/keys/utils.ts +7 -3
  178. package/src/l1-contracts/slash_factory.ts +1 -0
  179. package/src/logs/log_id.ts +7 -6
  180. package/src/logs/siloed_tag.ts +3 -2
  181. package/src/p2p/block_proposal.ts +12 -5
  182. package/src/p2p/checkpoint_proposal.ts +9 -2
  183. package/src/p2p/constants.ts +3 -0
  184. package/src/p2p/index.ts +1 -0
  185. package/src/p2p/message_validator.ts +14 -2
  186. package/src/stats/stats.ts +0 -2
  187. package/src/tests/factories.ts +1 -1
  188. package/src/tests/jest.ts +9 -9
  189. package/src/tests/mocks.ts +26 -17
  190. package/src/tx/block_header.ts +7 -4
  191. package/src/tx/indexed_tx_effect.ts +3 -2
  192. package/src/tx/tx.ts +8 -9
  193. package/src/tx/tx_receipt.ts +75 -18
  194. package/src/tx/validator/error_texts.ts +3 -0
  195. package/dest/block/l2_block_new.d.ts.map +0 -1
  196. package/dest/database-version/index.d.ts +0 -2
  197. package/dest/database-version/index.d.ts.map +0 -1
  198. package/dest/database-version/index.js +0 -1
  199. package/src/database-version/index.ts +0 -1
@@ -1,20 +1,33 @@
1
1
  import { BlockNumberSchema } from '@aztec/foundation/branded-types';
2
2
  import { z } from 'zod';
3
3
  import { RevertCode } from '../avm/revert_code.js';
4
- import { L2BlockHash } from '../block/block_hash.js';
4
+ import { BlockHash } from '../block/block_hash.js';
5
5
  import { schemas } from '../schemas/schemas.js';
6
6
  import { TxHash } from './tx_hash.js';
7
- /**
8
- * Possible status of a transaction.
9
- */ export var TxStatus = /*#__PURE__*/ function(TxStatus) {
7
+ /** Block inclusion/finalization status. */ export var TxStatus = /*#__PURE__*/ function(TxStatus) {
10
8
  TxStatus["DROPPED"] = "dropped";
11
9
  TxStatus["PENDING"] = "pending";
12
- TxStatus["SUCCESS"] = "success";
13
- TxStatus["APP_LOGIC_REVERTED"] = "app_logic_reverted";
14
- TxStatus["TEARDOWN_REVERTED"] = "teardown_reverted";
15
- TxStatus["BOTH_REVERTED"] = "both_reverted";
10
+ TxStatus["PROPOSED"] = "proposed";
11
+ TxStatus["CHECKPOINTED"] = "checkpointed";
12
+ TxStatus["PROVEN"] = "proven";
13
+ TxStatus["FINALIZED"] = "finalized";
16
14
  return TxStatus;
17
15
  }({});
16
+ /** Tx status sorted by finalization progress. */ export const SortedTxStatuses = [
17
+ "dropped",
18
+ "pending",
19
+ "proposed",
20
+ "checkpointed",
21
+ "proven",
22
+ "finalized"
23
+ ];
24
+ /** Execution result - only set when tx is in a block. */ export var TxExecutionResult = /*#__PURE__*/ function(TxExecutionResult) {
25
+ TxExecutionResult["SUCCESS"] = "success";
26
+ TxExecutionResult["APP_LOGIC_REVERTED"] = "app_logic_reverted";
27
+ TxExecutionResult["TEARDOWN_REVERTED"] = "teardown_reverted";
28
+ TxExecutionResult["BOTH_REVERTED"] = "both_reverted";
29
+ return TxExecutionResult;
30
+ }({});
18
31
  /**
19
32
  * Represents a transaction receipt in the Aztec network.
20
33
  * Contains essential information about the transaction including its status, origin, and associated addresses.
@@ -23,35 +36,53 @@ import { TxHash } from './tx_hash.js';
23
36
  */ export class TxReceipt {
24
37
  txHash;
25
38
  status;
39
+ executionResult;
26
40
  error;
27
41
  transactionFee;
28
42
  blockHash;
29
43
  blockNumber;
30
- constructor(/** A unique identifier for a transaction. */ txHash, /** The transaction's status. */ status, /** Description of transaction error, if any. */ error, /** The transaction fee paid for the transaction. */ transactionFee, /** The hash of the block containing the transaction. */ blockHash, /** The block number in which the transaction was included. */ blockNumber){
44
+ constructor(/** A unique identifier for a transaction. */ txHash, /** The transaction's block finalization status. */ status, /** The execution result of the transaction, only set when tx is in a block. */ executionResult, /** Description of transaction error, if any. */ error, /** The transaction fee paid for the transaction. */ transactionFee, /** The hash of the block containing the transaction. */ blockHash, /** The block number in which the transaction was included. */ blockNumber){
31
45
  this.txHash = txHash;
32
46
  this.status = status;
47
+ this.executionResult = executionResult;
33
48
  this.error = error;
34
49
  this.transactionFee = transactionFee;
35
50
  this.blockHash = blockHash;
36
51
  this.blockNumber = blockNumber;
37
52
  }
53
+ /** Returns true if the transaction was executed successfully. */ hasExecutionSucceeded() {
54
+ return this.executionResult === "success";
55
+ }
56
+ /** Returns true if the transaction execution reverted. */ hasExecutionReverted() {
57
+ return this.executionResult !== undefined && this.executionResult !== "success";
58
+ }
59
+ /** Returns true if the transaction has been included in a block (proposed, checkpointed, proven, or finalized). */ isMined() {
60
+ return this.status === "proposed" || this.status === "checkpointed" || this.status === "proven" || this.status === "finalized";
61
+ }
62
+ /** Returns true if the transaction is pending. */ isPending() {
63
+ return this.status === "pending";
64
+ }
65
+ /** Returns true if the transaction was dropped. */ isDropped() {
66
+ return this.status === "dropped";
67
+ }
38
68
  static empty() {
39
- return new TxReceipt(TxHash.zero(), "dropped", '');
69
+ return new TxReceipt(TxHash.zero(), "dropped", undefined, undefined);
40
70
  }
41
71
  static get schema() {
42
72
  return z.object({
43
73
  txHash: TxHash.schema,
44
74
  status: z.nativeEnum(TxStatus),
45
- error: z.string(),
46
- blockHash: L2BlockHash.schema.optional(),
75
+ executionResult: z.nativeEnum(TxExecutionResult).optional(),
76
+ error: z.string().optional(),
77
+ blockHash: BlockHash.schema.optional(),
47
78
  blockNumber: BlockNumberSchema.optional(),
48
79
  transactionFee: schemas.BigInt.optional()
49
- }).transform(TxReceipt.from);
80
+ }).transform((fields)=>TxReceipt.from(fields));
50
81
  }
51
82
  static from(fields) {
52
- return new TxReceipt(fields.txHash, fields.status, fields.error, fields.transactionFee, fields.blockHash, fields.blockNumber);
83
+ return new TxReceipt(fields.txHash, fields.status, fields.executionResult, fields.error, fields.transactionFee, fields.blockHash, fields.blockNumber);
53
84
  }
54
- static statusFromRevertCode(revertCode) {
85
+ static executionResultFromRevertCode(revertCode) {
55
86
  if (revertCode.equals(RevertCode.OK)) {
56
87
  return "success";
57
88
  } else if (revertCode.equals(RevertCode.APP_LOGIC_REVERTED)) {
@@ -19,6 +19,7 @@ export declare const TX_ERROR_CONTRACT_CLASS_LOG_LENGTH = "Incorrect contract cl
19
19
  export declare const TX_ERROR_CONTRACT_CLASS_LOGS = "Mismatched contract class logs";
20
20
  export declare const TX_ERROR_CONTRACT_CLASS_LOG_SORTING = "Incorrectly sorted contract class logs";
21
21
  export declare const TX_ERROR_INCORRECT_HASH = "Incorrect tx hash";
22
+ export declare const TX_ERROR_SIZE_ABOVE_LIMIT = "Transaction size above size limit";
22
23
  export declare const TX_ERROR_BLOCK_HEADER = "Block header not found";
23
24
  export declare const TX_ERROR_DURING_VALIDATION = "Unexpected error during validation";
24
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXJyb3JfdGV4dHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy90eC92YWxpZGF0b3IvZXJyb3JfdGV4dHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsZUFBTyxNQUFNLGlDQUFpQyw2QkFBNkIsQ0FBQztBQUM1RSxlQUFPLE1BQU0sdUNBQXVDLG1DQUFtQyxDQUFDO0FBQ3hGLGVBQU8sTUFBTSwrQkFBK0IsOENBQThDLENBQUM7QUFDM0YsZUFBTyxNQUFNLDJCQUEyQix3RUFBd0UsQ0FBQztBQUdqSCxlQUFPLE1BQU0sbUNBQW1DLHFDQUFxQyxDQUFDO0FBR3RGLGVBQU8sTUFBTSxrQ0FBa0MsOEJBQThCLENBQUM7QUFDOUUsZUFBTyxNQUFNLDJCQUEyQix1QkFBdUIsQ0FBQztBQUdoRSxlQUFPLE1BQU0scUNBQXFDLGlDQUFpQyxDQUFDO0FBQ3BGLGVBQU8sTUFBTSw4QkFBOEIsMEJBQTBCLENBQUM7QUFDdEUsZUFBTyxNQUFNLGlDQUFpQyw2QkFBNkIsQ0FBQztBQUM1RSxlQUFPLE1BQU0sK0JBQStCLDBDQUEwQyxDQUFDO0FBQ3ZGLGVBQU8sTUFBTSwwQ0FBMEMsc0NBQXNDLENBQUM7QUFHOUYsZUFBTyxNQUFNLHNCQUFzQixrQkFBa0IsQ0FBQztBQUd0RCxlQUFPLE1BQU0sMkJBQTJCLHVDQUF1QyxDQUFDO0FBQ2hGLGVBQU8sTUFBTSxnQ0FBZ0MsOENBQThDLENBQUM7QUFDNUYsZUFBTyxNQUFNLGlDQUFpQyx1REFBdUQsQ0FBQztBQUN0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AgC,8CAA8C,CAAC;AAC5F,eAAO,MAAM,iCAAiC,uDAAuD,CAAC;AACtG,eAAO,MAAM,iCAAiC,6CAA6C,CAAC;AAC5F,eAAO,MAAM,kCAAkC,yCAAyC,CAAC;AACzF,eAAO,MAAM,4BAA4B,mCAAmC,CAAC;AAC7E,eAAO,MAAM,mCAAmC,2CAA2C,CAAC;AAC5F,eAAO,MAAM,uBAAuB,sBAAsB,CAAC;AAG3D,eAAO,MAAM,yBAAyB,sCAAsC,CAAC;AAG7E,eAAO,MAAM,qBAAqB,2BAA2B,CAAC;AAG9D,eAAO,MAAM,0BAA0B,uCAAuC,CAAC"}
@@ -25,6 +25,8 @@ export const TX_ERROR_CONTRACT_CLASS_LOG_LENGTH = 'Incorrect contract class logs
25
25
  export const TX_ERROR_CONTRACT_CLASS_LOGS = 'Mismatched contract class logs';
26
26
  export const TX_ERROR_CONTRACT_CLASS_LOG_SORTING = 'Incorrectly sorted contract class logs';
27
27
  export const TX_ERROR_INCORRECT_HASH = 'Incorrect tx hash';
28
+ // Size
29
+ export const TX_ERROR_SIZE_ABOVE_LIMIT = 'Transaction size above size limit';
28
30
  // Block header
29
31
  export const TX_ERROR_BLOCK_HEADER = 'Block header not found';
30
32
  // General
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/stdlib",
3
- "version": "0.0.1-commit.f295ac2",
3
+ "version": "0.0.1-commit.fc805bf",
4
4
  "type": "module",
5
5
  "inherits": [
6
6
  "../package.common.json",
@@ -52,7 +52,8 @@
52
52
  "./epoch-helpers": "./dest/epoch-helpers/index.js",
53
53
  "./config": "./dest/config/index.js",
54
54
  "./testing/jest": "./dest/tests/jest.js",
55
- "./database-version": "./dest/database-version/index.js",
55
+ "./database-version/version": "./dest/database-version/database_version.js",
56
+ "./database-version/manager": "./dest/database-version/version_manager.js",
56
57
  "./validators": "./dest/validators/index.js",
57
58
  "./file-store": "./dest/file-store/index.js",
58
59
  "./snapshots": "./dest/snapshots/index.js",
@@ -78,14 +79,14 @@
78
79
  },
79
80
  "dependencies": {
80
81
  "@aws-sdk/client-s3": "^3.892.0",
81
- "@aztec/bb.js": "0.0.1-commit.f295ac2",
82
- "@aztec/blob-lib": "0.0.1-commit.f295ac2",
83
- "@aztec/constants": "0.0.1-commit.f295ac2",
84
- "@aztec/ethereum": "0.0.1-commit.f295ac2",
85
- "@aztec/foundation": "0.0.1-commit.f295ac2",
86
- "@aztec/l1-artifacts": "0.0.1-commit.f295ac2",
87
- "@aztec/noir-noirc_abi": "0.0.1-commit.f295ac2",
88
- "@aztec/validator-ha-signer": "0.0.1-commit.f295ac2",
82
+ "@aztec/bb.js": "0.0.1-commit.fc805bf",
83
+ "@aztec/blob-lib": "0.0.1-commit.fc805bf",
84
+ "@aztec/constants": "0.0.1-commit.fc805bf",
85
+ "@aztec/ethereum": "0.0.1-commit.fc805bf",
86
+ "@aztec/foundation": "0.0.1-commit.fc805bf",
87
+ "@aztec/l1-artifacts": "0.0.1-commit.fc805bf",
88
+ "@aztec/noir-noirc_abi": "0.0.1-commit.fc805bf",
89
+ "@aztec/validator-ha-signer": "0.0.1-commit.fc805bf",
89
90
  "@google-cloud/storage": "^7.15.0",
90
91
  "axios": "^1.12.0",
91
92
  "json-stringify-deterministic": "1.0.12",
@@ -1,66 +1,45 @@
1
- import { Buffer32 } from '@aztec/foundation/buffer';
2
1
  import { Fr } from '@aztec/foundation/curves/bn254';
3
- import { BufferReader } from '@aztec/foundation/serialize';
2
+ import type { ZodFor } from '@aztec/foundation/schemas';
4
3
 
5
- import { schemas } from '../schemas/schemas.js';
4
+ import { inspect } from 'util';
6
5
 
7
- /** Hash of an L2 block. */
8
- export class L2BlockHash extends Buffer32 {
9
- constructor(
10
- /** The buffer containing the hash. */
11
- hash: Buffer,
12
- ) {
13
- super(hash);
14
- }
6
+ import { hexSchemaFor } from '../schemas/schemas.js';
15
7
 
16
- /**
17
- * Type guard that checks if a value is an L2BlockHash instance.
18
- * Uses duck typing to handle cases where instanceof fails due to module duplication.
19
- * Checks for Buffer32-like structure with a 32-byte buffer.
20
- */
21
- static isL2BlockHash(value: unknown): value is L2BlockHash {
22
- if (value instanceof L2BlockHash) {
23
- return true;
24
- }
25
- // Duck typing fallback: check if it looks like a Buffer32 with a 32-byte buffer
26
- // This helps when instanceof fails due to module duplication
27
- return (
28
- typeof value === 'object' &&
29
- value !== null &&
30
- 'buffer' in value &&
31
- Buffer.isBuffer((value as Buffer32).buffer) &&
32
- (value as Buffer32).buffer.length === 32 &&
33
- 'toBuffer' in value &&
34
- typeof (value as Buffer32).toBuffer === 'function'
35
- );
36
- }
8
+ const BLOCK_HASH_BRAND = Symbol.for('aztec.BlockHash');
37
9
 
38
- static override random() {
39
- return new L2BlockHash(Fr.random().toBuffer());
10
+ /** Hash of an L2 block. */
11
+ export class BlockHash extends Fr {
12
+ readonly [BLOCK_HASH_BRAND] = true as const;
13
+
14
+ constructor(hash: Fr) {
15
+ super(hash);
40
16
  }
41
17
 
42
- static override fromNumber(num: number): L2BlockHash {
43
- return new L2BlockHash(super.fromNumber(num).toBuffer());
18
+ override [inspect.custom]() {
19
+ return `BlockHash<${this.toString()}>`;
44
20
  }
45
21
 
46
- static override fromBuffer(buffer: Buffer | BufferReader) {
47
- const reader = BufferReader.asReader(buffer);
48
- return new L2BlockHash(reader.readBytes(L2BlockHash.SIZE));
22
+ toFr(): Fr {
23
+ return new Fr(this.toBigInt());
49
24
  }
50
25
 
51
- static override fromString(str: string): Buffer32 {
52
- return new L2BlockHash(super.fromString(str).toBuffer());
26
+ /**
27
+ * Type guard that checks if a value is a BlockHash instance.
28
+ * Uses Symbol.for to ensure cross-module compatibility.
29
+ */
30
+ static isBlockHash(value: unknown): value is BlockHash {
31
+ return typeof value === 'object' && value !== null && BLOCK_HASH_BRAND in value;
53
32
  }
54
33
 
55
- static get schema() {
56
- return schemas.BufferHex.transform(value => new L2BlockHash(value));
34
+ static override random() {
35
+ return new BlockHash(Fr.random());
57
36
  }
58
37
 
59
- static zero() {
60
- return new L2BlockHash(Buffer32.ZERO.toBuffer());
38
+ static override fromString(str: string): BlockHash {
39
+ return new BlockHash(Fr.fromString(str));
61
40
  }
62
41
 
63
- static override fromField(hash: Fr) {
64
- return new L2BlockHash(hash.toBuffer());
42
+ static override get schema() {
43
+ return hexSchemaFor(BlockHash) as ZodFor<BlockHash>;
65
44
  }
66
45
  }
@@ -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: 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';
@@ -15,18 +15,14 @@ import { z } from 'zod';
15
15
  import type { PrivateLog } from '../logs/private_log.js';
16
16
  import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
17
17
  import { BlockHeader } from '../tx/block_header.js';
18
+ import type { BlockHash } from './block_hash.js';
18
19
  import { Body } from './body.js';
19
20
  import type { L2BlockInfo } from './l2_block_info.js';
20
21
 
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
22
  /**
27
23
  * An L2 block with a header and a body.
28
24
  */
29
- export class L2BlockNew {
25
+ export class L2Block {
30
26
  constructor(
31
27
  /** Snapshot of archive tree after the block is applied. */
32
28
  public archive: AppendOnlyTreeSnapshot,
@@ -63,7 +59,7 @@ export class L2BlockNew {
63
59
  })
64
60
  .transform(
65
61
  ({ archive, header, body, checkpointNumber, indexWithinCheckpoint }) =>
66
- new L2BlockNew(archive, header, body, checkpointNumber, indexWithinCheckpoint),
62
+ new L2Block(archive, header, body, checkpointNumber, indexWithinCheckpoint),
67
63
  );
68
64
  }
69
65
 
@@ -79,7 +75,7 @@ export class L2BlockNew {
79
75
  const checkpointNumber = CheckpointNumber(reader.readNumber());
80
76
  const indexWithinCheckpoint = IndexWithinCheckpoint(reader.readNumber());
81
77
 
82
- return new L2BlockNew(archive, header, body, checkpointNumber, indexWithinCheckpoint);
78
+ return new L2Block(archive, header, body, checkpointNumber, indexWithinCheckpoint);
83
79
  }
84
80
 
85
81
  /**
@@ -94,7 +90,7 @@ export class L2BlockNew {
94
90
  * Returns the block's hash (hash of block header).
95
91
  * @returns The block's hash.
96
92
  */
97
- public hash(): Promise<Fr> {
93
+ public hash(): Promise<BlockHash> {
98
94
  return this.header.hash();
99
95
  }
100
96
 
@@ -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
  /**
@@ -20,8 +20,9 @@ import type { BlockHeader } from '../tx/block_header.js';
20
20
  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
+ import type { BlockHash } from './block_hash.js';
23
24
  import type { CheckpointedL2Block } from './checkpointed_l2_block.js';
24
- import type { L2BlockNew } from './l2_block_new.js';
25
+ import type { L2Block } from './l2_block.js';
25
26
  import type { ValidateCheckpointNegativeResult, ValidateCheckpointResult } from './validate_block_result.js';
26
27
 
27
28
  /**
@@ -52,6 +53,20 @@ export interface L2BlockSource {
52
53
  */
53
54
  getProvenBlockNumber(): Promise<BlockNumber>;
54
55
 
56
+ /**
57
+ * Gets the number of the latest L2 block checkpointed seen by the block source implementation.
58
+ * @returns The number of the latest L2 block checkpointed seen by the block source implementation.
59
+ */
60
+ getCheckpointedL2BlockNumber(): Promise<BlockNumber>;
61
+
62
+ /**
63
+ * Computes the finalized block number based on the proven block number.
64
+ * A block is considered finalized when it's 2 epochs behind the proven block.
65
+ * TODO(#13569): Compute proper finalized block number based on L1 finalized block.
66
+ * @returns The finalized block number.
67
+ */
68
+ getFinalizedL2BlockNumber(): Promise<BlockNumber>;
69
+
55
70
  /**
56
71
  * Gets an l2 block header.
57
72
  * @param number - The block number to return or 'latest' for the most recent one.
@@ -67,15 +82,15 @@ export interface L2BlockSource {
67
82
  */
68
83
  getCheckpointedBlock(number: BlockNumber): Promise<CheckpointedL2Block | undefined>;
69
84
 
70
- getCheckpointedBlocks(from: BlockNumber, limit: number, proven?: boolean): Promise<CheckpointedL2Block[]>;
85
+ getCheckpointedBlocks(from: BlockNumber, limit: number): Promise<CheckpointedL2Block[]>;
71
86
 
72
87
  /**
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
88
+ * Retrieves a collection of checkpoints.
89
+ * @param checkpointNumber The first checkpoint to be retrieved.
90
+ * @param limit The number of checkpoints to be retrieved.
91
+ * @returns The collection of complete checkpoints.
77
92
  */
78
- getPublishedCheckpoints(checkpointNumber: CheckpointNumber, limit: number): Promise<PublishedCheckpoint[]>;
93
+ getCheckpoints(checkpointNumber: CheckpointNumber, limit: number): Promise<PublishedCheckpoint[]>;
79
94
 
80
95
  /**
81
96
  * Gets the checkpoints for a given epoch
@@ -88,7 +103,7 @@ export interface L2BlockSource {
88
103
  * @param blockHash - The block hash to retrieve.
89
104
  * @returns The requested block header (or undefined if not found).
90
105
  */
91
- getBlockHeaderByHash(blockHash: Fr): Promise<BlockHeader | undefined>;
106
+ getBlockHeaderByHash(blockHash: BlockHash): Promise<BlockHeader | undefined>;
92
107
 
93
108
  /**
94
109
  * Gets a block header by its archive root.
@@ -102,21 +117,21 @@ export interface L2BlockSource {
102
117
  * @param number - The block number to return.
103
118
  * @returns The requested L2 block (or undefined if not found).
104
119
  */
105
- getL2BlockNew(number: BlockNumber): Promise<L2BlockNew | undefined>;
120
+ getL2Block(number: BlockNumber): Promise<L2Block | undefined>;
106
121
 
107
122
  /**
108
123
  * Gets an L2 block by its hash.
109
124
  * @param blockHash - The block hash to retrieve.
110
125
  * @returns The requested L2 block (or undefined if not found).
111
126
  */
112
- getL2BlockNewByHash(blockHash: Fr): Promise<L2BlockNew | undefined>;
127
+ getL2BlockByHash(blockHash: BlockHash): Promise<L2Block | undefined>;
113
128
 
114
129
  /**
115
130
  * Gets an L2 block by its archive root.
116
131
  * @param archive - The archive root to retrieve.
117
132
  * @returns The requested L2 block (or undefined if not found).
118
133
  */
119
- getL2BlockNewByArchive(archive: Fr): Promise<L2BlockNew | undefined>;
134
+ getL2BlockByArchive(archive: Fr): Promise<L2Block | undefined>;
120
135
 
121
136
  /**
122
137
  * Gets a tx effect.
@@ -143,11 +158,11 @@ export interface L2BlockSource {
143
158
  getL2EpochNumber(): Promise<EpochNumber | undefined>;
144
159
 
145
160
  /**
146
- * Returns all block headers for a given epoch.
161
+ * Returns all checkpointed block headers for a given epoch.
147
162
  * @dev Use this method only with recent epochs, since it walks the block list backwards.
148
163
  * @param epochNumber - The epoch number to return headers for.
149
164
  */
150
- getBlockHeadersForEpoch(epochNumber: EpochNumber): Promise<BlockHeader[]>;
165
+ getCheckpointedBlockHeadersForEpoch(epochNumber: EpochNumber): Promise<BlockHeader[]>;
151
166
 
152
167
  /**
153
168
  * Returns whether the given epoch is completed on L1, based on the current L1 and L2 block numbers.
@@ -193,49 +208,43 @@ export interface L2BlockSource {
193
208
  * @param number - The block number to return (inclusive).
194
209
  * @returns The requested L2 block.
195
210
  */
196
- getBlock(number: BlockNumber): Promise<L2BlockNew | undefined>;
197
-
198
- getL2BlocksNew(from: BlockNumber, limit: number, proven?: boolean): Promise<L2BlockNew[]>;
211
+ getBlock(number: BlockNumber): Promise<L2Block | undefined>;
199
212
 
200
213
  /**
201
- * Returns all blocks for a given epoch.
214
+ * Returns all checkpointed blocks for a given epoch.
202
215
  * @dev Use this method only with recent epochs, since it walks the block list backwards.
203
216
  * @param epochNumber - The epoch number to return blocks for.
204
217
  */
205
- getBlocksForEpoch(epochNumber: EpochNumber): Promise<L2BlockNew[]>;
218
+ getCheckpointedBlocksForEpoch(epochNumber: EpochNumber): Promise<CheckpointedL2Block[]>;
206
219
 
207
220
  /**
208
221
  * Returns all blocks for a given slot.
209
222
  * @dev Use this method only with recent slots, since it walks the block list backwards.
210
223
  * @param slotNumber - The slot number to return blocks for.
211
224
  */
212
- getBlocksForSlot(slotNumber: SlotNumber): Promise<L2BlockNew[]>;
225
+ getBlocksForSlot(slotNumber: SlotNumber): Promise<L2Block[]>;
213
226
 
214
227
  /**
215
- * Gets a published block by its block hash.
228
+ * Gets a checkpointed block by its block hash.
216
229
  * @param blockHash - The block hash to retrieve.
217
230
  * @returns The requested block (or undefined if not found).
218
231
  */
219
- getPublishedBlockByHash(blockHash: Fr): Promise<CheckpointedL2Block | undefined>;
232
+ getCheckpointedBlockByHash(blockHash: BlockHash): Promise<CheckpointedL2Block | undefined>;
220
233
 
221
234
  /**
222
- * Gets a published block by its archive root.
235
+ * Gets a checkpointed block by its archive root.
223
236
  * @param archive - The archive root to retrieve.
224
237
  * @returns The requested block (or undefined if not found).
225
238
  */
226
- getPublishedBlockByArchive(archive: Fr): Promise<CheckpointedL2Block | undefined>;
239
+ getCheckpointedBlockByArchive(archive: Fr): Promise<CheckpointedL2Block | undefined>;
227
240
 
228
241
  /**
229
242
  * Gets up to `limit` amount of L2 blocks starting from `from`.
230
243
  * @param from - Number of the first block to return (inclusive).
231
244
  * @param limit - The maximum number of blocks to return.
232
- * @param proven - If true, only return blocks that have been proven.
233
245
  * @returns The requested L2 blocks.
234
246
  */
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[]>;
247
+ getBlocks(from: BlockNumber, limit: number): Promise<L2Block[]>;
239
248
  }
240
249
 
241
250
  /**
@@ -247,7 +256,7 @@ export interface L2BlockSink {
247
256
  * @param block - The L2 block to add.
248
257
  * @throws If block number is not incremental (i.e., not exactly one more than the last stored block).
249
258
  */
250
- addBlock(block: L2BlockNew): Promise<void>;
259
+ addBlock(block: L2Block): Promise<void>;
251
260
  }
252
261
 
253
262
  /**
@@ -344,13 +353,13 @@ export type L2BlockProvenEvent = {
344
353
  export type L2PruneUnprovenEvent = {
345
354
  type: 'l2PruneUnproven';
346
355
  epochNumber: EpochNumber;
347
- blocks: L2BlockNew[];
356
+ blocks: L2Block[];
348
357
  };
349
358
 
350
359
  export type L2PruneUncheckpointedEvent = {
351
360
  type: 'l2PruneUncheckpointed';
352
361
  slotNumber: SlotNumber;
353
- blocks: L2BlockNew[];
362
+ blocks: L2Block[];
354
363
  };
355
364
 
356
365
  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';