@aztec/stdlib 0.0.1-commit.2ed92850 → 0.0.1-commit.43597cc1

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 (187) hide show
  1. package/dest/abi/function_call.d.ts +39 -9
  2. package/dest/abi/function_call.d.ts.map +1 -1
  3. package/dest/abi/function_call.js +20 -3
  4. package/dest/block/block_hash.d.ts +16 -19
  5. package/dest/block/block_hash.d.ts.map +1 -1
  6. package/dest/block/block_hash.js +21 -34
  7. package/dest/block/block_parameter.d.ts +4 -4
  8. package/dest/block/block_parameter.d.ts.map +1 -1
  9. package/dest/block/block_parameter.js +2 -2
  10. package/dest/block/in_block.d.ts +9 -9
  11. package/dest/block/in_block.d.ts.map +1 -1
  12. package/dest/block/in_block.js +5 -5
  13. package/dest/block/l2_block.d.ts +3 -2
  14. package/dest/block/l2_block.d.ts.map +1 -1
  15. package/dest/block/l2_block.js +2 -3
  16. package/dest/block/l2_block_source.d.ts +5 -4
  17. package/dest/block/l2_block_source.d.ts.map +1 -1
  18. package/dest/config/index.d.ts +2 -1
  19. package/dest/config/index.d.ts.map +1 -1
  20. package/dest/config/index.js +1 -0
  21. package/dest/config/sequencer-config.d.ts +10 -0
  22. package/dest/config/sequencer-config.d.ts.map +1 -0
  23. package/dest/config/sequencer-config.js +12 -0
  24. package/dest/contract/contract_address.js +1 -1
  25. package/dest/contract/contract_class_id.d.ts +1 -1
  26. package/dest/contract/contract_class_id.js +1 -1
  27. package/dest/contract/private_function.js +1 -1
  28. package/dest/contract/private_function_membership_proof.d.ts +1 -1
  29. package/dest/contract/private_function_membership_proof.js +1 -1
  30. package/dest/database-version/database_version.d.ts +58 -0
  31. package/dest/database-version/database_version.d.ts.map +1 -0
  32. package/dest/database-version/database_version.js +69 -0
  33. package/dest/database-version/version_manager.d.ts +2 -50
  34. package/dest/database-version/version_manager.d.ts.map +1 -1
  35. package/dest/database-version/version_manager.js +1 -66
  36. package/dest/epoch-helpers/index.d.ts +7 -1
  37. package/dest/epoch-helpers/index.d.ts.map +1 -1
  38. package/dest/epoch-helpers/index.js +8 -2
  39. package/dest/hash/hash.js +2 -2
  40. package/dest/hash/map_slot.d.ts +1 -1
  41. package/dest/hash/map_slot.d.ts.map +1 -1
  42. package/dest/hash/map_slot.js +4 -3
  43. package/dest/interfaces/archiver.d.ts +1 -1
  44. package/dest/interfaces/archiver.d.ts.map +1 -1
  45. package/dest/interfaces/archiver.js +4 -3
  46. package/dest/interfaces/aztec-node-admin.d.ts +11 -2
  47. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  48. package/dest/interfaces/aztec-node-admin.js +3 -1
  49. package/dest/interfaces/aztec-node.d.ts +33 -54
  50. package/dest/interfaces/aztec-node.d.ts.map +1 -1
  51. package/dest/interfaces/aztec-node.js +6 -10
  52. package/dest/interfaces/block-builder.d.ts +10 -4
  53. package/dest/interfaces/block-builder.d.ts.map +1 -1
  54. package/dest/interfaces/block-builder.js +7 -0
  55. package/dest/interfaces/get_logs_response.d.ts +15 -8
  56. package/dest/interfaces/get_logs_response.d.ts.map +1 -1
  57. package/dest/interfaces/p2p.d.ts +2 -2
  58. package/dest/interfaces/p2p.d.ts.map +1 -1
  59. package/dest/interfaces/prover-broker.d.ts +16 -1
  60. package/dest/interfaces/prover-broker.d.ts.map +1 -1
  61. package/dest/interfaces/prover-broker.js +4 -1
  62. package/dest/interfaces/prover-client.d.ts +6 -1
  63. package/dest/interfaces/prover-client.d.ts.map +1 -1
  64. package/dest/interfaces/prover-client.js +5 -0
  65. package/dest/interfaces/proving-job.d.ts +200 -200
  66. package/dest/interfaces/slasher.d.ts +5 -1
  67. package/dest/interfaces/slasher.d.ts.map +1 -1
  68. package/dest/interfaces/slasher.js +1 -0
  69. package/dest/interfaces/validator.d.ts +38 -3
  70. package/dest/interfaces/validator.d.ts.map +1 -1
  71. package/dest/interfaces/validator.js +1 -0
  72. package/dest/keys/derivation.d.ts +3 -3
  73. package/dest/keys/derivation.js +8 -8
  74. package/dest/keys/key_types.d.ts +1 -1
  75. package/dest/keys/utils.d.ts +1 -1
  76. package/dest/keys/utils.d.ts.map +1 -1
  77. package/dest/keys/utils.js +7 -3
  78. package/dest/l1-contracts/slash_factory.d.ts +1 -1
  79. package/dest/l1-contracts/slash_factory.d.ts.map +1 -1
  80. package/dest/l1-contracts/slash_factory.js +1 -0
  81. package/dest/logs/extended_public_log.d.ts +13 -7
  82. package/dest/logs/extended_public_log.d.ts.map +1 -1
  83. package/dest/logs/log_id.d.ts +17 -14
  84. package/dest/logs/log_id.d.ts.map +1 -1
  85. package/dest/logs/log_id.js +20 -17
  86. package/dest/logs/siloed_tag.d.ts +1 -1
  87. package/dest/logs/siloed_tag.d.ts.map +1 -1
  88. package/dest/logs/siloed_tag.js +4 -3
  89. package/dest/messaging/l2_to_l1_membership.d.ts +2 -2
  90. package/dest/messaging/l2_to_l1_membership.js +3 -3
  91. package/dest/p2p/block_proposal.d.ts +10 -3
  92. package/dest/p2p/block_proposal.d.ts.map +1 -1
  93. package/dest/p2p/checkpoint_proposal.d.ts +17 -3
  94. package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
  95. package/dest/p2p/checkpoint_proposal.js +9 -0
  96. package/dest/rollup/checkpoint_rollup_public_inputs.d.ts +6 -6
  97. package/dest/rollup/checkpoint_rollup_public_inputs.d.ts.map +1 -1
  98. package/dest/rollup/checkpoint_rollup_public_inputs.js +2 -2
  99. package/dest/rollup/checkpoint_root_rollup_private_inputs.d.ts +2 -2
  100. package/dest/rollup/checkpoint_root_rollup_private_inputs.d.ts.map +1 -1
  101. package/dest/rollup/root_rollup_public_inputs.d.ts +6 -6
  102. package/dest/rollup/root_rollup_public_inputs.d.ts.map +1 -1
  103. package/dest/rollup/root_rollup_public_inputs.js +3 -3
  104. package/dest/slashing/empire.d.ts +1 -1
  105. package/dest/slashing/empire.d.ts.map +1 -1
  106. package/dest/slashing/empire.js +1 -0
  107. package/dest/slashing/helpers.d.ts +2 -2
  108. package/dest/slashing/helpers.d.ts.map +1 -1
  109. package/dest/slashing/helpers.js +3 -0
  110. package/dest/slashing/tally.d.ts +2 -1
  111. package/dest/slashing/tally.d.ts.map +1 -1
  112. package/dest/slashing/tally.js +6 -2
  113. package/dest/slashing/types.d.ts +5 -3
  114. package/dest/slashing/types.d.ts.map +1 -1
  115. package/dest/slashing/types.js +7 -1
  116. package/dest/stats/stats.d.ts +1 -3
  117. package/dest/stats/stats.d.ts.map +1 -1
  118. package/dest/tests/factories.js +3 -3
  119. package/dest/tests/mocks.d.ts +6 -2
  120. package/dest/tests/mocks.d.ts.map +1 -1
  121. package/dest/tests/mocks.js +4 -3
  122. package/dest/timetable/index.d.ts +37 -0
  123. package/dest/timetable/index.d.ts.map +1 -0
  124. package/dest/timetable/index.js +39 -0
  125. package/dest/tx/block_header.d.ts +3 -3
  126. package/dest/tx/block_header.d.ts.map +1 -1
  127. package/dest/tx/block_header.js +3 -3
  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_receipt.d.ts +5 -5
  133. package/dest/tx/tx_receipt.d.ts.map +1 -1
  134. package/dest/tx/tx_receipt.js +2 -2
  135. package/package.json +24 -12
  136. package/src/abi/function_call.ts +25 -3
  137. package/src/block/block_hash.ts +25 -50
  138. package/src/block/block_parameter.ts +3 -3
  139. package/src/block/in_block.ts +6 -6
  140. package/src/block/l2_block.ts +3 -3
  141. package/src/block/l2_block_source.ts +4 -3
  142. package/src/config/index.ts +1 -0
  143. package/src/config/sequencer-config.ts +19 -0
  144. package/src/contract/contract_address.ts +1 -1
  145. package/src/contract/contract_class_id.ts +1 -1
  146. package/src/contract/private_function.ts +1 -1
  147. package/src/contract/private_function_membership_proof.ts +1 -1
  148. package/src/database-version/database_version.ts +87 -0
  149. package/src/database-version/version_manager.ts +1 -77
  150. package/src/epoch-helpers/index.ts +12 -0
  151. package/src/hash/hash.ts +2 -2
  152. package/src/hash/map_slot.ts +3 -2
  153. package/src/interfaces/archiver.ts +4 -3
  154. package/src/interfaces/aztec-node-admin.ts +3 -2
  155. package/src/interfaces/aztec-node.ts +42 -93
  156. package/src/interfaces/block-builder.ts +12 -2
  157. package/src/interfaces/p2p.ts +1 -1
  158. package/src/interfaces/prover-broker.ts +22 -0
  159. package/src/interfaces/prover-client.ts +7 -0
  160. package/src/interfaces/slasher.ts +2 -0
  161. package/src/interfaces/validator.ts +3 -3
  162. package/src/keys/derivation.ts +8 -8
  163. package/src/keys/key_types.ts +1 -1
  164. package/src/keys/utils.ts +7 -3
  165. package/src/l1-contracts/slash_factory.ts +1 -0
  166. package/src/logs/log_id.ts +22 -18
  167. package/src/logs/siloed_tag.ts +3 -2
  168. package/src/messaging/l2_to_l1_membership.ts +3 -3
  169. package/src/p2p/block_proposal.ts +9 -2
  170. package/src/p2p/checkpoint_proposal.ts +19 -2
  171. package/src/rollup/checkpoint_rollup_public_inputs.ts +5 -5
  172. package/src/rollup/root_rollup_public_inputs.ts +7 -7
  173. package/src/slashing/empire.ts +2 -1
  174. package/src/slashing/helpers.ts +4 -0
  175. package/src/slashing/tally.ts +8 -2
  176. package/src/slashing/types.ts +7 -0
  177. package/src/stats/stats.ts +0 -2
  178. package/src/tests/factories.ts +5 -5
  179. package/src/tests/mocks.ts +6 -4
  180. package/src/timetable/index.ts +66 -0
  181. package/src/tx/block_header.ts +6 -6
  182. package/src/tx/indexed_tx_effect.ts +3 -2
  183. package/src/tx/tx_receipt.ts +4 -4
  184. package/dest/database-version/index.d.ts +0 -2
  185. package/dest/database-version/index.d.ts.map +0 -1
  186. package/dest/database-version/index.js +0 -1
  187. package/src/database-version/index.ts +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"indexed_tx_effect.d.ts","sourceRoot":"","sources":["../../src/tx/indexed_tx_effect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAI9D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,KAAK,WAAW,EAA2C,MAAM,sBAAsB,CAAC;AACjG,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,QAAQ,CAAC,GAAG;IAAE,cAAc,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjF,wBAAgB,eAAe;;;;;;;;;;;;;;;;;;;GAE9B;AAED,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,eAAe,CAAC,CAKtE;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAExE;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe,CAc1E"}
1
+ {"version":3,"file":"indexed_tx_effect.d.ts","sourceRoot":"","sources":["../../src/tx/indexed_tx_effect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAK9D,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,KAAK,WAAW,EAA2C,MAAM,sBAAsB,CAAC;AACjG,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,QAAQ,CAAC,GAAG;IAAE,cAAc,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjF,wBAAgB,eAAe;;;;;;;;;;;;;;;;;;;GAE9B;AAED,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,eAAe,CAAC,CAKtE;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAExE;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe,CAc1E"}
@@ -1,7 +1,8 @@
1
1
  import { BlockNumber } from '@aztec/foundation/branded-types';
2
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
3
  import { schemas } from '@aztec/foundation/schemas';
3
4
  import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
4
- import { L2BlockHash } from '../block/block_hash.js';
5
+ import { BlockHash } from '../block/block_hash.js';
5
6
  import { dataInBlockSchemaFor, randomDataInBlock } from '../block/in_block.js';
6
7
  import { TxEffect } from './tx_effect.js';
7
8
  export function indexedTxSchema() {
@@ -22,7 +23,7 @@ export function serializeIndexedTxEffect(effect) {
22
23
  }
23
24
  export function deserializeIndexedTxEffect(buffer) {
24
25
  const reader = BufferReader.asReader(buffer);
25
- const l2BlockHash = reader.readObject(L2BlockHash);
26
+ const l2BlockHash = new BlockHash(reader.readObject(Fr));
26
27
  const l2BlockNumber = BlockNumber(reader.readNumber());
27
28
  const txIndexInBlock = reader.readNumber();
28
29
  const data = reader.readObject(TxEffect);
@@ -1,6 +1,6 @@
1
1
  import { BlockNumber } from '@aztec/foundation/branded-types';
2
2
  import { RevertCode } from '../avm/revert_code.js';
3
- import { L2BlockHash } from '../block/block_hash.js';
3
+ import { BlockHash } from '../block/block_hash.js';
4
4
  import { type ZodFor } from '../schemas/schemas.js';
5
5
  import { TxHash } from './tx_hash.js';
6
6
  /** Block inclusion/finalization status. */
@@ -39,7 +39,7 @@ export declare class TxReceipt {
39
39
  /** The transaction fee paid for the transaction. */
40
40
  transactionFee?: bigint | undefined;
41
41
  /** The hash of the block containing the transaction. */
42
- blockHash?: L2BlockHash | undefined;
42
+ blockHash?: BlockHash | undefined;
43
43
  /** The block number in which the transaction was included. */
44
44
  blockNumber?: BlockNumber | undefined;
45
45
  constructor(
@@ -54,7 +54,7 @@ export declare class TxReceipt {
54
54
  /** The transaction fee paid for the transaction. */
55
55
  transactionFee?: bigint | undefined,
56
56
  /** The hash of the block containing the transaction. */
57
- blockHash?: L2BlockHash | undefined,
57
+ blockHash?: BlockHash | undefined,
58
58
  /** The block number in which the transaction was included. */
59
59
  blockNumber?: BlockNumber | undefined);
60
60
  /** Returns true if the transaction was executed successfully. */
@@ -75,9 +75,9 @@ export declare class TxReceipt {
75
75
  executionResult?: TxExecutionResult;
76
76
  error?: string;
77
77
  transactionFee?: bigint;
78
- blockHash?: L2BlockHash;
78
+ blockHash?: BlockHash;
79
79
  blockNumber?: BlockNumber;
80
80
  }): TxReceipt;
81
81
  static executionResultFromRevertCode(revertCode: RevertCode): TxExecutionResult;
82
82
  }
83
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHhfcmVjZWlwdC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3R4L3R4X3JlY2VpcHQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFdBQVcsRUFBcUIsTUFBTSxpQ0FBaUMsQ0FBQztBQUlqRixPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFDbkQsT0FBTyxFQUFFLFdBQVcsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBQ3JELE9BQU8sRUFBRSxLQUFLLE1BQU0sRUFBVyxNQUFNLHVCQUF1QixDQUFDO0FBQzdELE9BQU8sRUFBRSxNQUFNLEVBQUUsTUFBTSxjQUFjLENBQUM7QUFFdEMsMkNBQTJDO0FBQzNDLG9CQUFZLFFBQVE7SUFDbEIsT0FBTyxZQUFZO0lBQ25CLE9BQU8sWUFBWTtJQUNuQixRQUFRLGFBQWE7SUFDckIsWUFBWSxpQkFBaUI7SUFDN0IsTUFBTSxXQUFXO0lBQ2pCLFNBQVMsY0FBYztDQUN4QjtBQUVELGlEQUFpRDtBQUNqRCxlQUFPLE1BQU0sZ0JBQWdCLEVBQUUsUUFBUSxFQU90QyxDQUFDO0FBRUYseURBQXlEO0FBQ3pELG9CQUFZLGlCQUFpQjtJQUMzQixPQUFPLFlBQVk7SUFDbkIsa0JBQWtCLHVCQUF1QjtJQ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,CAAC;QACtB,WAAW,CAAC,EAAE,WAAW,CAAC;KAC3B,aAUA;IAED,OAAc,6BAA6B,CAAC,UAAU,EAAE,UAAU,GAAG,iBAAiB,CAYrF;CACF"}
@@ -1,7 +1,7 @@
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
7
  /** Block inclusion/finalization status. */ export var TxStatus = /*#__PURE__*/ function(TxStatus) {
@@ -74,7 +74,7 @@ import { TxHash } from './tx_hash.js';
74
74
  status: z.nativeEnum(TxStatus),
75
75
  executionResult: z.nativeEnum(TxExecutionResult).optional(),
76
76
  error: z.string().optional(),
77
- blockHash: L2BlockHash.schema.optional(),
77
+ blockHash: BlockHash.schema.optional(),
78
78
  blockNumber: BlockNumberSchema.optional(),
79
79
  transactionFee: schemas.BigInt.optional()
80
80
  }).transform((fields)=>TxReceipt.from(fields));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/stdlib",
3
- "version": "0.0.1-commit.2ed92850",
3
+ "version": "0.0.1-commit.43597cc1",
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",
@@ -60,11 +61,22 @@
60
61
  "./zkpassport": "./dest/zkpassport/index.js",
61
62
  "./slashing": "./dest/slashing/index.js",
62
63
  "./l1-contracts": "./dest/l1-contracts/index.js",
63
- "./world-state": "./dest/world-state/index.js"
64
+ "./world-state": "./dest/world-state/index.js",
65
+ "./timetable": "./dest/timetable/index.js"
64
66
  },
65
67
  "typedocOptions": {
66
68
  "entryPoints": [
67
- "./src/index.ts"
69
+ "./src/abi/index.ts",
70
+ "./src/aztec-address/index.ts",
71
+ "./src/block/index.ts",
72
+ "./src/contract/index.ts",
73
+ "./src/gas/index.ts",
74
+ "./src/hash/index.ts",
75
+ "./src/keys/index.ts",
76
+ "./src/logs/index.ts",
77
+ "./src/note/index.ts",
78
+ "./src/proofs/index.ts",
79
+ "./src/tx/index.ts"
68
80
  ],
69
81
  "name": "stdlib",
70
82
  "tsconfig": "./tsconfig.json"
@@ -78,14 +90,14 @@
78
90
  },
79
91
  "dependencies": {
80
92
  "@aws-sdk/client-s3": "^3.892.0",
81
- "@aztec/bb.js": "0.0.1-commit.2ed92850",
82
- "@aztec/blob-lib": "0.0.1-commit.2ed92850",
83
- "@aztec/constants": "0.0.1-commit.2ed92850",
84
- "@aztec/ethereum": "0.0.1-commit.2ed92850",
85
- "@aztec/foundation": "0.0.1-commit.2ed92850",
86
- "@aztec/l1-artifacts": "0.0.1-commit.2ed92850",
87
- "@aztec/noir-noirc_abi": "0.0.1-commit.2ed92850",
88
- "@aztec/validator-ha-signer": "0.0.1-commit.2ed92850",
93
+ "@aztec/bb.js": "0.0.1-commit.43597cc1",
94
+ "@aztec/blob-lib": "0.0.1-commit.43597cc1",
95
+ "@aztec/constants": "0.0.1-commit.43597cc1",
96
+ "@aztec/ethereum": "0.0.1-commit.43597cc1",
97
+ "@aztec/foundation": "0.0.1-commit.43597cc1",
98
+ "@aztec/l1-artifacts": "0.0.1-commit.43597cc1",
99
+ "@aztec/noir-noirc_abi": "0.0.1-commit.43597cc1",
100
+ "@aztec/validator-ha-signer": "0.0.1-commit.43597cc1",
89
101
  "@google-cloud/storage": "^7.15.0",
90
102
  "axios": "^1.12.0",
91
103
  "json-stringify-deterministic": "1.0.12",
@@ -1,8 +1,11 @@
1
1
  import type { Fr } from '@aztec/foundation/curves/bn254';
2
2
  import type { FieldsOf } from '@aztec/foundation/types';
3
3
 
4
+ import { z } from 'zod';
5
+
4
6
  import { AztecAddress } from '../aztec-address/index.js';
5
- import { type AbiType, FunctionType } from './abi.js';
7
+ import { schemas } from '../schemas/index.js';
8
+ import { type AbiType, AbiTypeSchema, FunctionType } from './abi.js';
6
9
  import { FunctionSelector } from './function_selector.js';
7
10
 
8
11
  /** A request to call a function on a contract. */
@@ -43,12 +46,31 @@ export class FunctionCall {
43
46
  return new FunctionCall(...FunctionCall.getFields(fields));
44
47
  }
45
48
 
49
+ static get schema() {
50
+ return z
51
+ .object({
52
+ name: z.string(),
53
+ to: schemas.AztecAddress,
54
+ selector: schemas.FunctionSelector,
55
+ type: z.nativeEnum(FunctionType),
56
+ isStatic: z.boolean(),
57
+ hideMsgSender: z.boolean(),
58
+ args: z.array(schemas.Fr),
59
+ returnTypes: z.array(AbiTypeSchema),
60
+ })
61
+ .transform(FunctionCall.from);
62
+ }
63
+
64
+ public isPublicStatic(): boolean {
65
+ return this.type === FunctionType.PUBLIC && this.isStatic;
66
+ }
67
+
46
68
  /**
47
69
  * Creates an empty function call.
48
70
  * @returns an empty function call.
49
71
  */
50
72
  public static empty() {
51
- return {
73
+ return FunctionCall.from({
52
74
  name: '',
53
75
  to: AztecAddress.ZERO,
54
76
  selector: FunctionSelector.empty(),
@@ -57,6 +79,6 @@ export class FunctionCall {
57
79
  isStatic: false,
58
80
  args: [],
59
81
  returnTypes: [],
60
- };
82
+ });
61
83
  }
62
84
  }
@@ -1,70 +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());
40
- }
10
+ /** Hash of an L2 block. */
11
+ export class BlockHash extends Fr {
12
+ readonly [BLOCK_HASH_BRAND] = true as const;
41
13
 
42
- static override fromNumber(num: number): L2BlockHash {
43
- return new L2BlockHash(super.fromNumber(num).toBuffer());
14
+ constructor(hash: Fr) {
15
+ super(hash);
44
16
  }
45
17
 
46
- static override fromBuffer(buffer: Buffer | BufferReader) {
47
- const reader = BufferReader.asReader(buffer);
48
- return new L2BlockHash(reader.readBytes(L2BlockHash.SIZE));
18
+ override [inspect.custom]() {
19
+ return `BlockHash<${this.toString()}>`;
49
20
  }
50
21
 
51
- static override fromString(str: string): L2BlockHash {
52
- return new L2BlockHash(super.fromString(str).toBuffer());
22
+ toFr(): Fr {
23
+ return new Fr(this.toBigInt());
53
24
  }
54
25
 
55
- static get schema() {
56
- return schemas.BufferHex.transform(value => new L2BlockHash(value));
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;
57
32
  }
58
33
 
59
- static zero() {
60
- return new L2BlockHash(Buffer32.ZERO.toBuffer());
34
+ static override random() {
35
+ return new BlockHash(Fr.random());
61
36
  }
62
37
 
63
- static override fromField(hash: Fr) {
64
- return new L2BlockHash(hash.toBuffer());
38
+ static override fromString(str: string): BlockHash {
39
+ return new BlockHash(Fr.fromString(str));
65
40
  }
66
41
 
67
- toField(): Fr {
68
- return Fr.fromBuffer(this.toBuffer());
42
+ static override get schema() {
43
+ return hexSchemaFor(BlockHash) as ZodFor<BlockHash>;
69
44
  }
70
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>;
@@ -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';
5
+ import { BlockHash } from './block_hash.js';
6
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.
@@ -17,8 +17,8 @@ export type DataInBlock<T> = {
17
17
 
18
18
  export function randomInBlock(): InBlock {
19
19
  return {
20
- l2BlockNumber: BlockNumber(Math.floor(Math.random() * 1000)),
21
- l2BlockHash: L2BlockHash.random(),
20
+ l2BlockNumber: BlockNumber(Math.floor(Math.random() * 1000) + 1),
21
+ l2BlockHash: BlockHash.random(),
22
22
  };
23
23
  }
24
24
 
@@ -33,14 +33,14 @@ export async function wrapDataInBlock<T>(data: T, block: L2Block): Promise<DataI
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
 
@@ -15,6 +15,7 @@ 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
 
@@ -89,9 +90,8 @@ export class L2Block {
89
90
  * Returns the block's hash (hash of block header).
90
91
  * @returns The block's hash.
91
92
  */
92
- public async hash(): Promise<Fr> {
93
- const blockHash = await this.header.hash();
94
- return blockHash.toField();
93
+ public hash(): Promise<BlockHash> {
94
+ return this.header.hash();
95
95
  }
96
96
 
97
97
  /**
@@ -20,6 +20,7 @@ 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
25
  import type { L2Block } from './l2_block.js';
25
26
  import type { ValidateCheckpointNegativeResult, ValidateCheckpointResult } from './validate_block_result.js';
@@ -102,7 +103,7 @@ export interface L2BlockSource {
102
103
  * @param blockHash - The block hash to retrieve.
103
104
  * @returns The requested block header (or undefined if not found).
104
105
  */
105
- getBlockHeaderByHash(blockHash: Fr): Promise<BlockHeader | undefined>;
106
+ getBlockHeaderByHash(blockHash: BlockHash): Promise<BlockHeader | undefined>;
106
107
 
107
108
  /**
108
109
  * Gets a block header by its archive root.
@@ -123,7 +124,7 @@ export interface L2BlockSource {
123
124
  * @param blockHash - The block hash to retrieve.
124
125
  * @returns The requested L2 block (or undefined if not found).
125
126
  */
126
- getL2BlockByHash(blockHash: Fr): Promise<L2Block | undefined>;
127
+ getL2BlockByHash(blockHash: BlockHash): Promise<L2Block | undefined>;
127
128
 
128
129
  /**
129
130
  * Gets an L2 block by its archive root.
@@ -228,7 +229,7 @@ export interface L2BlockSource {
228
229
  * @param blockHash - The block hash to retrieve.
229
230
  * @returns The requested block (or undefined if not found).
230
231
  */
231
- getCheckpointedBlockByHash(blockHash: Fr): Promise<CheckpointedL2Block | undefined>;
232
+ getCheckpointedBlockByHash(blockHash: BlockHash): Promise<CheckpointedL2Block | undefined>;
232
233
 
233
234
  /**
234
235
  * Gets a checkpointed block by its archive root.
@@ -1,2 +1,3 @@
1
1
  export * from './chain-config.js';
2
2
  export * from './node-rpc-config.js';
3
+ export * from './sequencer-config.js';
@@ -0,0 +1,19 @@
1
+ import type { ConfigMappingsType } from '@aztec/foundation/config';
2
+
3
+ import type { SequencerConfig } from '../interfaces/configs.js';
4
+
5
+ /**
6
+ * Partial sequencer config mappings for fields that need to be shared across packages.
7
+ * The full sequencer config mappings remain in sequencer-client, but shared fields
8
+ * (like blockDurationMs needed by both p2p and sequencer-client) are defined here
9
+ * to avoid duplication.
10
+ */
11
+ export const sharedSequencerConfigMappings: ConfigMappingsType<Pick<SequencerConfig, 'blockDurationMs'>> = {
12
+ blockDurationMs: {
13
+ env: 'SEQ_BLOCK_DURATION_MS',
14
+ description:
15
+ 'Duration per block in milliseconds when building multiple blocks per slot. ' +
16
+ 'If undefined (default), builds a single block per slot using the full slot duration.',
17
+ parseEnv: (val: string) => (val ? parseInt(val, 10) : undefined),
18
+ },
19
+ };
@@ -87,5 +87,5 @@ export async function computeInitializationHashFromEncodedArgs(
87
87
  encodedArgs: Fr[],
88
88
  ): Promise<Fr> {
89
89
  const argsHash = await computeVarArgsHash(encodedArgs);
90
- return poseidon2HashWithSeparator([initFn, argsHash], GeneratorIndex.CONSTRUCTOR);
90
+ return poseidon2HashWithSeparator([initFn, argsHash], GeneratorIndex.INITIALIZER);
91
91
  }
@@ -13,7 +13,7 @@ import { computePrivateFunctionsRoot } from './private_function.js';
13
13
  *
14
14
  * ```
15
15
  * version = 1
16
- * private_function_leaves = private_functions.map(fn => pedersen([fn.function_selector as Field, fn.vk_hash], GENERATOR__FUNCTION_LEAF))
16
+ * private_function_leaves = private_functions.map(fn => pedersen([fn.function_selector as Field, fn.vk_hash], GENERATOR__PRIVATE_FUNCTION_LEAF))
17
17
  * private_functions_root = merkleize(private_function_leaves)
18
18
  * bytecode_commitment = calculate_commitment(packed_bytecode)
19
19
  * contract_class_id = pedersen([version, artifact_hash, private_functions_root, bytecode_commitment], GENERATOR__CLASS_IDENTIFIER)
@@ -31,7 +31,7 @@ function computePrivateFunctionLeaves(fns: PrivateFunction[]): Promise<Buffer[]>
31
31
 
32
32
  /** Returns the leaf for a given private function. */
33
33
  export async function computePrivateFunctionLeaf(fn: PrivateFunction): Promise<Buffer> {
34
- return (await poseidon2HashWithSeparator([fn.selector, fn.vkHash], GeneratorIndex.FUNCTION_LEAF)).toBuffer();
34
+ return (await poseidon2HashWithSeparator([fn.selector, fn.vkHash], GeneratorIndex.PRIVATE_FUNCTION_LEAF)).toBuffer();
35
35
  }
36
36
 
37
37
  async function getPrivateFunctionTreeCalculator(): Promise<MerkleTreeCalculator> {
@@ -99,7 +99,7 @@ export async function createPrivateFunctionMembershipProof(
99
99
  * contract_class = db.get_contract_class(contract_class_id)
100
100
  *
101
101
  * // Compute function leaf and assert it belongs to the private functions tree
102
- * function_leaf = pedersen([selector as Field, vk_hash], GENERATOR__FUNCTION_LEAF)
102
+ * function_leaf = pedersen([selector as Field, vk_hash], GENERATOR__PRIVATE_FUNCTION_LEAF)
103
103
  * computed_private_function_tree_root = compute_root(function_leaf, private_function_tree_sibling_path)
104
104
  * assert computed_private_function_tree_root == contract_class.private_functions_root
105
105
  *
@@ -0,0 +1,87 @@
1
+ import { EthAddress } from '@aztec/foundation/eth-address';
2
+ import { jsonParseWithSchema, jsonStringify } from '@aztec/foundation/json-rpc';
3
+
4
+ import { z } from 'zod';
5
+
6
+ /**
7
+ * Symbol for Node.js custom inspect. Using Symbol.for() is the documented way to
8
+ * reference this without importing node:util. In browsers, objects with this symbol
9
+ * simply won't have custom inspect behavior (which is fine).
10
+ * @see https://nodejs.org/api/util.html#utilinspectcustom
11
+ */
12
+ const inspectCustomSymbol = Symbol.for('nodejs.util.inspect.custom');
13
+
14
+ /**
15
+ * Represents a version record for storing in a version file.
16
+ */
17
+ export class DatabaseVersion {
18
+ constructor(
19
+ /** The version of the data on disk. Used to perform upgrades */
20
+ public readonly schemaVersion: number,
21
+ /** The rollup the data pertains to */
22
+ public readonly rollupAddress: EthAddress,
23
+ ) {}
24
+
25
+ public toBuffer(): Buffer {
26
+ return Buffer.from(jsonStringify(this));
27
+ }
28
+
29
+ public static fromBuffer(buf: Buffer): DatabaseVersion {
30
+ try {
31
+ return jsonParseWithSchema(buf.toString('utf-8'), DatabaseVersion.schema);
32
+ } catch (err) {
33
+ throw new Error(`Failed to deserialize version information: ${err}`, { cause: err });
34
+ }
35
+ }
36
+
37
+ /**
38
+ * Compares two versions. If the rollups addresses are different then it returns undefined
39
+ */
40
+ public cmp(other: DatabaseVersion): undefined | -1 | 0 | 1 {
41
+ if (this.rollupAddress.equals(other.rollupAddress)) {
42
+ if (this.schemaVersion < other.schemaVersion) {
43
+ return -1;
44
+ } else if (this.schemaVersion > other.schemaVersion) {
45
+ return 1;
46
+ } else {
47
+ return 0;
48
+ }
49
+ }
50
+ return undefined;
51
+ }
52
+
53
+ /**
54
+ * Checks if two versions exactly match
55
+ */
56
+ public equals(other: DatabaseVersion): boolean {
57
+ return this.cmp(other) === 0;
58
+ }
59
+
60
+ /**
61
+ * Returns the schema for this class
62
+ */
63
+ static get schema() {
64
+ return z
65
+ .object({
66
+ schemaVersion: z.number(),
67
+ rollupAddress: EthAddress.schema,
68
+ })
69
+ .transform(({ schemaVersion, rollupAddress }) => new DatabaseVersion(schemaVersion, rollupAddress));
70
+ }
71
+
72
+ /** Allows for better introspection in Node.js console. Ignored in browser envs. */
73
+ public [inspectCustomSymbol](): string {
74
+ return this.toString();
75
+ }
76
+
77
+ public toString(): string {
78
+ return `DatabaseVersion{schemaVersion=${this.schemaVersion},rollupAddress=${this.rollupAddress}"}`;
79
+ }
80
+
81
+ /**
82
+ * Returns an empty instance
83
+ */
84
+ static empty() {
85
+ return new DatabaseVersion(0, EthAddress.ZERO);
86
+ }
87
+ }