@aztec/foundation 0.0.1-commit.9593d84 → 0.0.1-commit.96dac018d

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 (329) hide show
  1. package/dest/array/index.d.ts +2 -1
  2. package/dest/array/index.d.ts.map +1 -1
  3. package/dest/array/index.js +1 -0
  4. package/dest/array/sorted_array.d.ts +15 -0
  5. package/dest/array/sorted_array.d.ts.map +1 -0
  6. package/dest/array/sorted_array.js +109 -0
  7. package/dest/branded-types/block_number.d.ts +56 -0
  8. package/dest/branded-types/block_number.d.ts.map +1 -0
  9. package/dest/branded-types/block_number.js +78 -0
  10. package/dest/branded-types/checkpoint_number.d.ts +54 -0
  11. package/dest/branded-types/checkpoint_number.d.ts.map +1 -0
  12. package/dest/branded-types/checkpoint_number.js +77 -0
  13. package/dest/branded-types/index.d.ts +4 -1
  14. package/dest/branded-types/index.d.ts.map +1 -1
  15. package/dest/branded-types/index.js +3 -0
  16. package/dest/branded-types/index_within_checkpoint.d.ts +42 -0
  17. package/dest/branded-types/index_within_checkpoint.d.ts.map +1 -0
  18. package/dest/branded-types/index_within_checkpoint.js +59 -0
  19. package/dest/buffer/buffer16.d.ts +5 -2
  20. package/dest/buffer/buffer16.d.ts.map +1 -1
  21. package/dest/buffer/buffer16.js +4 -2
  22. package/dest/buffer/buffer32.d.ts +5 -2
  23. package/dest/buffer/buffer32.d.ts.map +1 -1
  24. package/dest/buffer/buffer32.js +4 -2
  25. package/dest/collection/array.d.ts +12 -1
  26. package/dest/collection/array.d.ts.map +1 -1
  27. package/dest/collection/array.js +51 -0
  28. package/dest/config/env_var.d.ts +2 -2
  29. package/dest/config/env_var.d.ts.map +1 -1
  30. package/dest/config/index.d.ts +15 -4
  31. package/dest/config/index.d.ts.map +1 -1
  32. package/dest/config/index.js +32 -9
  33. package/dest/config/network_config.d.ts +13 -1
  34. package/dest/config/network_config.d.ts.map +1 -1
  35. package/dest/config/network_config.js +3 -1
  36. package/dest/config/network_name.d.ts +2 -2
  37. package/dest/config/network_name.d.ts.map +1 -1
  38. package/dest/config/network_name.js +2 -0
  39. package/dest/config/parse-env.d.ts +3 -0
  40. package/dest/config/parse-env.d.ts.map +1 -0
  41. package/dest/config/parse-env.js +7 -0
  42. package/dest/config/secret_value.js +3 -1
  43. package/dest/crypto/bls/bn254_keystore.js +1 -1
  44. package/dest/crypto/bls/index.js +1 -1
  45. package/dest/crypto/bn254/index.d.ts +35 -51
  46. package/dest/crypto/bn254/index.d.ts.map +1 -1
  47. package/dest/crypto/bn254/index.js +51 -140
  48. package/dest/crypto/ecdsa/signature.d.ts +11 -2
  49. package/dest/crypto/ecdsa/signature.d.ts.map +1 -1
  50. package/dest/crypto/ecdsa/signature.js +2 -2
  51. package/dest/crypto/grumpkin/index.d.ts +4 -2
  52. package/dest/crypto/grumpkin/index.d.ts.map +1 -1
  53. package/dest/crypto/grumpkin/index.js +2 -1
  54. package/dest/crypto/keys/index.d.ts +2 -2
  55. package/dest/crypto/keys/index.d.ts.map +1 -1
  56. package/dest/crypto/keys/index.js +1 -1
  57. package/dest/crypto/pedersen/pedersen.wasm.d.ts +2 -2
  58. package/dest/crypto/pedersen/pedersen.wasm.d.ts.map +1 -1
  59. package/dest/crypto/pedersen/pedersen.wasm.js +1 -1
  60. package/dest/crypto/poseidon/index.d.ts +2 -3
  61. package/dest/crypto/poseidon/index.d.ts.map +1 -1
  62. package/dest/crypto/poseidon/index.js +1 -10
  63. package/dest/crypto/random/randomness_singleton.d.ts +4 -3
  64. package/dest/crypto/random/randomness_singleton.d.ts.map +1 -1
  65. package/dest/crypto/random/randomness_singleton.js +5 -5
  66. package/dest/crypto/schnorr/index.d.ts +3 -2
  67. package/dest/crypto/schnorr/index.d.ts.map +1 -1
  68. package/dest/crypto/schnorr/index.js +1 -1
  69. package/dest/crypto/schnorr/signature.d.ts +2 -2
  70. package/dest/crypto/schnorr/signature.d.ts.map +1 -1
  71. package/dest/crypto/schnorr/signature.js +2 -2
  72. package/dest/crypto/sha256/index.d.ts +2 -2
  73. package/dest/crypto/sha256/index.d.ts.map +1 -1
  74. package/dest/crypto/sha256/index.js +1 -1
  75. package/dest/crypto/sha512/index.d.ts +2 -2
  76. package/dest/crypto/sha512/index.d.ts.map +1 -1
  77. package/dest/crypto/sha512/index.js +1 -1
  78. package/dest/crypto/signature/index.d.ts +2 -2
  79. package/dest/crypto/signature/index.d.ts.map +1 -1
  80. package/dest/crypto/sync/pedersen/index.d.ts +2 -2
  81. package/dest/crypto/sync/pedersen/index.d.ts.map +1 -1
  82. package/dest/crypto/sync/pedersen/index.js +1 -1
  83. package/dest/crypto/sync/poseidon/index.d.ts +2 -3
  84. package/dest/crypto/sync/poseidon/index.d.ts.map +1 -1
  85. package/dest/crypto/sync/poseidon/index.js +1 -9
  86. package/dest/{fields/bls12_fields.d.ts → curves/bls12/field.d.ts} +3 -3
  87. package/dest/curves/bls12/field.d.ts.map +1 -0
  88. package/dest/{fields/bls12_fields.js → curves/bls12/field.js} +12 -9
  89. package/dest/curves/bls12/index.d.ts +3 -0
  90. package/dest/curves/bls12/index.d.ts.map +1 -0
  91. package/dest/curves/bls12/index.js +2 -0
  92. package/dest/{fields/bls12_point.d.ts → curves/bls12/point.d.ts} +13 -4
  93. package/dest/curves/bls12/point.d.ts.map +1 -0
  94. package/dest/{fields/bls12_point.js → curves/bls12/point.js} +10 -8
  95. package/dest/{fields/fields.d.ts → curves/bn254/field.d.ts} +7 -15
  96. package/dest/curves/bn254/field.d.ts.map +1 -0
  97. package/dest/{fields/fields.js → curves/bn254/field.js} +35 -49
  98. package/dest/curves/bn254/index.d.ts +3 -0
  99. package/dest/curves/bn254/index.d.ts.map +1 -0
  100. package/dest/curves/bn254/index.js +2 -0
  101. package/dest/curves/bn254/point.d.ts +54 -0
  102. package/dest/curves/bn254/point.d.ts.map +1 -0
  103. package/dest/curves/bn254/point.js +143 -0
  104. package/dest/curves/grumpkin/index.d.ts +10 -0
  105. package/dest/curves/grumpkin/index.d.ts.map +1 -0
  106. package/dest/curves/grumpkin/index.js +3 -0
  107. package/dest/{fields → curves/grumpkin}/point.d.ts +13 -4
  108. package/dest/curves/grumpkin/point.d.ts.map +1 -0
  109. package/dest/{fields → curves/grumpkin}/point.js +7 -7
  110. package/dest/error/index.d.ts +4 -4
  111. package/dest/error/index.d.ts.map +1 -1
  112. package/dest/eth-address/index.d.ts +3 -2
  113. package/dest/eth-address/index.d.ts.map +1 -1
  114. package/dest/eth-address/index.js +10 -3
  115. package/dest/eth-signature/eth_signature.d.ts +4 -1
  116. package/dest/eth-signature/eth_signature.d.ts.map +1 -1
  117. package/dest/iterator/filter.d.ts +3 -0
  118. package/dest/iterator/filter.d.ts.map +1 -0
  119. package/dest/iterator/filter.js +7 -0
  120. package/dest/iterator/index.d.ts +2 -0
  121. package/dest/iterator/index.d.ts.map +1 -0
  122. package/dest/iterator/index.js +1 -0
  123. package/dest/jest/setup.js +4 -1
  124. package/dest/json-rpc/client/safe_json_rpc_client.d.ts +2 -1
  125. package/dest/json-rpc/client/safe_json_rpc_client.d.ts.map +1 -1
  126. package/dest/json-rpc/client/safe_json_rpc_client.js +1 -1
  127. package/dest/json-rpc/client/undici.d.ts +1 -1
  128. package/dest/json-rpc/client/undici.d.ts.map +1 -1
  129. package/dest/json-rpc/client/undici.js +21 -4
  130. package/dest/json-rpc/fixtures/class_a.d.ts +3 -3
  131. package/dest/json-rpc/fixtures/class_a.d.ts.map +1 -1
  132. package/dest/json-rpc/fixtures/class_b.d.ts +3 -3
  133. package/dest/json-rpc/fixtures/class_b.d.ts.map +1 -1
  134. package/dest/json-rpc/server/api_key_auth.d.ts +19 -0
  135. package/dest/json-rpc/server/api_key_auth.d.ts.map +1 -0
  136. package/dest/json-rpc/server/api_key_auth.js +57 -0
  137. package/dest/json-rpc/server/index.d.ts +2 -1
  138. package/dest/json-rpc/server/index.d.ts.map +1 -1
  139. package/dest/json-rpc/server/index.js +1 -0
  140. package/dest/json-rpc/server/safe_json_rpc_server.js +1 -1
  141. package/dest/log/bigint-utils.d.ts +5 -0
  142. package/dest/log/bigint-utils.d.ts.map +1 -0
  143. package/dest/log/bigint-utils.js +18 -0
  144. package/dest/log/gcloud-logger-config.d.ts +1 -1
  145. package/dest/log/gcloud-logger-config.d.ts.map +1 -1
  146. package/dest/log/gcloud-logger-config.js +3 -0
  147. package/dest/log/libp2p_logger.d.ts +5 -2
  148. package/dest/log/libp2p_logger.d.ts.map +1 -1
  149. package/dest/log/libp2p_logger.js +14 -4
  150. package/dest/log/log-filters.d.ts +17 -4
  151. package/dest/log/log-filters.d.ts.map +1 -1
  152. package/dest/log/log-filters.js +26 -12
  153. package/dest/log/pino-logger-server.d.ts +9 -0
  154. package/dest/log/pino-logger-server.d.ts.map +1 -0
  155. package/dest/log/pino-logger-server.js +18 -0
  156. package/dest/log/pino-logger.d.ts +37 -8
  157. package/dest/log/pino-logger.d.ts.map +1 -1
  158. package/dest/log/pino-logger.js +122 -29
  159. package/dest/queue/base_memory_queue.d.ts +2 -2
  160. package/dest/queue/base_memory_queue.d.ts.map +1 -1
  161. package/dest/queue/semaphore.d.ts +5 -1
  162. package/dest/queue/semaphore.d.ts.map +1 -1
  163. package/dest/retry/index.d.ts +11 -1
  164. package/dest/retry/index.d.ts.map +1 -1
  165. package/dest/retry/index.js +11 -0
  166. package/dest/schemas/schemas.d.ts +7 -3
  167. package/dest/schemas/schemas.d.ts.map +1 -1
  168. package/dest/schemas/schemas.js +9 -3
  169. package/dest/schemas/types.d.ts +31 -1
  170. package/dest/schemas/types.d.ts.map +1 -1
  171. package/dest/schemas/types.js +25 -1
  172. package/dest/serialize/buffer_reader.d.ts +14 -4
  173. package/dest/serialize/buffer_reader.d.ts.map +1 -1
  174. package/dest/serialize/buffer_reader.js +26 -4
  175. package/dest/serialize/field_reader.d.ts +2 -2
  176. package/dest/serialize/field_reader.d.ts.map +1 -1
  177. package/dest/serialize/field_reader.js +1 -1
  178. package/dest/serialize/free_funcs.d.ts +2 -2
  179. package/dest/serialize/free_funcs.d.ts.map +1 -1
  180. package/dest/serialize/free_funcs.js +1 -1
  181. package/dest/serialize/serialize.d.ts +20 -2
  182. package/dest/serialize/serialize.d.ts.map +1 -1
  183. package/dest/serialize/serialize.js +32 -1
  184. package/dest/sleep/index.d.ts +3 -1
  185. package/dest/sleep/index.d.ts.map +1 -1
  186. package/dest/sleep/index.js +4 -0
  187. package/dest/timer/date.d.ts +26 -1
  188. package/dest/timer/date.d.ts.map +1 -1
  189. package/dest/timer/date.js +36 -0
  190. package/dest/transport/transport_client.js +2 -2
  191. package/dest/trees/balanced_merkle_tree_root.d.ts +17 -0
  192. package/dest/trees/balanced_merkle_tree_root.d.ts.map +1 -0
  193. package/dest/trees/{balanced_merkle_tree.js → balanced_merkle_tree_root.js} +2 -15
  194. package/dest/trees/hasher.d.ts +3 -1
  195. package/dest/trees/hasher.d.ts.map +1 -1
  196. package/dest/trees/hasher.js +10 -5
  197. package/dest/trees/index.d.ts +4 -4
  198. package/dest/trees/index.d.ts.map +1 -1
  199. package/dest/trees/index.js +3 -3
  200. package/dest/trees/indexed_merkle_tree.js +1 -1
  201. package/dest/trees/membership_witness.d.ts +12 -2
  202. package/dest/trees/membership_witness.d.ts.map +1 -1
  203. package/dest/trees/membership_witness.js +10 -1
  204. package/dest/trees/merkle_tree_calculator.d.ts +1 -1
  205. package/dest/trees/merkle_tree_calculator.d.ts.map +1 -1
  206. package/dest/trees/merkle_tree_calculator.js +2 -2
  207. package/dest/trees/sibling_path.d.ts +3 -2
  208. package/dest/trees/sibling_path.d.ts.map +1 -1
  209. package/dest/trees/sibling_path.js +3 -3
  210. package/dest/trees/unbalanced_merkle_tree_calculator.d.ts +2 -3
  211. package/dest/trees/unbalanced_merkle_tree_calculator.d.ts.map +1 -1
  212. package/dest/trees/unbalanced_merkle_tree_calculator.js +1 -5
  213. package/dest/trees/{unbalanced_merkle_tree.d.ts → unbalanced_merkle_tree_root.d.ts} +3 -5
  214. package/dest/trees/unbalanced_merkle_tree_root.d.ts.map +1 -0
  215. package/dest/trees/{unbalanced_merkle_tree.js → unbalanced_merkle_tree_root.js} +11 -49
  216. package/dest/trees/unbalanced_tree_store.d.ts +5 -1
  217. package/dest/trees/unbalanced_tree_store.d.ts.map +1 -1
  218. package/dest/trees/unbalanced_tree_store.js +49 -1
  219. package/dest/types/index.d.ts +6 -2
  220. package/dest/types/index.d.ts.map +1 -1
  221. package/dest/types/index.js +6 -0
  222. package/package.json +48 -9
  223. package/src/array/index.ts +1 -0
  224. package/src/array/sorted_array.ts +138 -0
  225. package/src/branded-types/block_number.ts +117 -0
  226. package/src/branded-types/checkpoint_number.ts +115 -0
  227. package/src/branded-types/index.ts +3 -0
  228. package/src/branded-types/index_within_checkpoint.ts +88 -0
  229. package/src/buffer/buffer16.ts +2 -2
  230. package/src/buffer/buffer32.ts +2 -2
  231. package/src/collection/array.ts +52 -0
  232. package/src/config/env_var.ts +71 -14
  233. package/src/config/index.ts +39 -6
  234. package/src/config/network_config.ts +2 -0
  235. package/src/config/network_name.ts +4 -1
  236. package/src/config/parse-env.ts +4 -0
  237. package/src/crypto/bls/bn254_keystore.ts +1 -1
  238. package/src/crypto/bls/index.ts +1 -1
  239. package/src/crypto/bn254/index.ts +50 -159
  240. package/src/crypto/ecdsa/signature.ts +2 -2
  241. package/src/crypto/grumpkin/index.ts +3 -1
  242. package/src/crypto/keys/index.ts +1 -1
  243. package/src/crypto/pedersen/pedersen.wasm.ts +1 -1
  244. package/src/crypto/poseidon/index.ts +1 -11
  245. package/src/crypto/random/randomness_singleton.ts +6 -4
  246. package/src/crypto/schnorr/index.ts +2 -1
  247. package/src/crypto/schnorr/signature.ts +2 -2
  248. package/src/crypto/sha256/index.ts +1 -1
  249. package/src/crypto/sha512/index.ts +1 -1
  250. package/src/crypto/signature/index.ts +1 -1
  251. package/src/crypto/sync/pedersen/index.ts +1 -1
  252. package/src/crypto/sync/poseidon/index.ts +1 -10
  253. package/src/{fields/bls12_fields.ts → curves/bls12/field.ts} +6 -6
  254. package/src/curves/bls12/index.ts +2 -0
  255. package/src/{fields/bls12_point.ts → curves/bls12/point.ts} +7 -7
  256. package/src/{fields/fields.ts → curves/bn254/field.ts} +33 -56
  257. package/src/curves/bn254/index.ts +2 -0
  258. package/src/curves/bn254/point.ts +170 -0
  259. package/src/curves/grumpkin/index.ts +11 -0
  260. package/src/{fields → curves/grumpkin}/point.ts +7 -7
  261. package/src/eth-address/index.ts +8 -2
  262. package/src/iterator/filter.ts +11 -0
  263. package/src/iterator/index.ts +1 -0
  264. package/src/jest/setup.mjs +4 -1
  265. package/src/json-rpc/client/safe_json_rpc_client.ts +2 -0
  266. package/src/json-rpc/client/undici.ts +21 -3
  267. package/src/json-rpc/server/api_key_auth.ts +63 -0
  268. package/src/json-rpc/server/index.ts +1 -0
  269. package/src/json-rpc/server/safe_json_rpc_server.ts +1 -1
  270. package/src/log/bigint-utils.ts +22 -0
  271. package/src/log/gcloud-logger-config.ts +5 -0
  272. package/src/log/libp2p_logger.ts +12 -5
  273. package/src/log/log-filters.ts +29 -11
  274. package/src/log/pino-logger-server.ts +25 -0
  275. package/src/log/pino-logger.ts +144 -39
  276. package/src/queue/base_memory_queue.ts +1 -1
  277. package/src/queue/semaphore.ts +5 -0
  278. package/src/retry/index.ts +18 -0
  279. package/src/schemas/schemas.ts +14 -3
  280. package/src/schemas/types.ts +33 -0
  281. package/src/serialize/buffer_reader.ts +36 -9
  282. package/src/serialize/field_reader.ts +1 -1
  283. package/src/serialize/free_funcs.ts +1 -1
  284. package/src/serialize/serialize.ts +33 -1
  285. package/src/sleep/index.ts +6 -0
  286. package/src/timer/date.ts +52 -0
  287. package/src/transport/transport_client.ts +2 -2
  288. package/src/trees/{balanced_merkle_tree.ts → balanced_merkle_tree_root.ts} +2 -16
  289. package/src/trees/hasher.ts +9 -0
  290. package/src/trees/index.ts +3 -3
  291. package/src/trees/indexed_merkle_tree.ts +1 -1
  292. package/src/trees/membership_witness.ts +9 -1
  293. package/src/trees/merkle_tree_calculator.ts +2 -2
  294. package/src/trees/sibling_path.ts +3 -3
  295. package/src/trees/unbalanced_merkle_tree_calculator.ts +1 -12
  296. package/src/trees/{unbalanced_merkle_tree.ts → unbalanced_merkle_tree_root.ts} +17 -61
  297. package/src/trees/unbalanced_tree_store.ts +57 -2
  298. package/src/types/index.ts +11 -1
  299. package/dest/crypto/bn254/bn254_utils.d.ts +0 -39
  300. package/dest/crypto/bn254/bn254_utils.d.ts.map +0 -1
  301. package/dest/crypto/bn254/bn254_utils.js +0 -56
  302. package/dest/crypto/index.d.ts +0 -17
  303. package/dest/crypto/index.d.ts.map +0 -1
  304. package/dest/crypto/index.js +0 -16
  305. package/dest/fields/bls12_fields.d.ts.map +0 -1
  306. package/dest/fields/bls12_point.d.ts.map +0 -1
  307. package/dest/fields/coordinate.d.ts +0 -63
  308. package/dest/fields/coordinate.d.ts.map +0 -1
  309. package/dest/fields/coordinate.js +0 -96
  310. package/dest/fields/fields.d.ts.map +0 -1
  311. package/dest/fields/index.d.ts +0 -6
  312. package/dest/fields/index.d.ts.map +0 -1
  313. package/dest/fields/index.js +0 -5
  314. package/dest/fields/point.d.ts.map +0 -1
  315. package/dest/index.d.ts +0 -31
  316. package/dest/index.d.ts.map +0 -1
  317. package/dest/index.js +0 -31
  318. package/dest/json-rpc/server/telemetry.d.ts +0 -2
  319. package/dest/json-rpc/server/telemetry.d.ts.map +0 -1
  320. package/dest/json-rpc/server/telemetry.js +0 -0
  321. package/dest/trees/balanced_merkle_tree.d.ts +0 -22
  322. package/dest/trees/balanced_merkle_tree.d.ts.map +0 -1
  323. package/dest/trees/unbalanced_merkle_tree.d.ts.map +0 -1
  324. package/src/crypto/bn254/bn254_utils.ts +0 -64
  325. package/src/crypto/index.ts +0 -16
  326. package/src/fields/coordinate.ts +0 -104
  327. package/src/fields/index.ts +0 -5
  328. package/src/index.ts +0 -31
  329. package/src/json-rpc/server/telemetry.ts +0 -0
@@ -0,0 +1,115 @@
1
+ import { z } from 'zod';
2
+
3
+ import type { BlockNumber } from './block_number.js';
4
+ import type { Branded } from './types.js';
5
+
6
+ /**
7
+ * A branded type representing an checkpoint number.
8
+ * Checkpoints are used in the Aztec protocol to group L2 blocks.
9
+ *
10
+ * This is a nominal type backed by a number, but TypeScript will treat it as
11
+ * incompatible with plain numbers and other branded numeric types (like Slot, BlockNumber, etc.).
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const checkpoint = CheckpointNumber(5);
16
+ * const plainNumber: number = checkpoint; // OK - CheckpointNumber is assignable to number
17
+ * const checkpointFromNumber: CheckpointNumber = 5; // ERROR - number is not assignable to CheckpointNumber
18
+ * ```
19
+ */
20
+ export type CheckpointNumber = Branded<number, 'CheckpointNumber'>;
21
+
22
+ /**
23
+ * Creates an CheckpointNumber from a number.
24
+ * @param value - The checkpoint number (must be a non-negative integer)
25
+ * @returns The branded CheckpointNumber value
26
+ * @throws If the value is negative or not an integer
27
+ */
28
+ export function CheckpointNumber(value: number): CheckpointNumber {
29
+ if (!Number.isInteger(value)) {
30
+ throw new Error(`CheckpointNumber must be an integer, got ${value}`);
31
+ }
32
+ if (value < 0) {
33
+ throw new Error(`CheckpointNumber must be non-negative, got ${value}`);
34
+ }
35
+ return value as CheckpointNumber;
36
+ }
37
+
38
+ /**
39
+ * @param value - The block number
40
+ * @returns The branded CheckpointNumber value
41
+ *
42
+ * @deprecated Checkpoint number and block number should no longer convert to each other once we support multiple blocks
43
+ * per checkpoint everywhere.
44
+ */
45
+ CheckpointNumber.fromBlockNumber = function (value: BlockNumber): CheckpointNumber {
46
+ return CheckpointNumber(value);
47
+ };
48
+
49
+ /**
50
+ * Creates an CheckpointNumber from a bigint.
51
+ * @param value - The checkpoint number as bigint (must be a non-negative integer within safe integer range)
52
+ * @returns The branded CheckpointNumber value
53
+ * @throws If the value is negative or exceeds Number.MAX_SAFE_INTEGER
54
+ */
55
+ CheckpointNumber.fromBigInt = function (value: bigint): CheckpointNumber {
56
+ if (value < 0n) {
57
+ throw new Error(`CheckpointNumber must be non-negative, got ${value}`);
58
+ }
59
+ if (value > BigInt(Number.MAX_SAFE_INTEGER)) {
60
+ throw new Error(`CheckpointNumber ${value} exceeds MAX_SAFE_INTEGER`);
61
+ }
62
+ return Number(value) as CheckpointNumber;
63
+ };
64
+
65
+ /**
66
+ * Creates an CheckpointNumber from a string.
67
+ * @param value - The checkpoint number as a string
68
+ * @returns The branded CheckpointNumber value
69
+ * @throws If the string cannot be parsed as a valid checkpoint
70
+ */
71
+ CheckpointNumber.fromString = function (value: string): CheckpointNumber {
72
+ const parsed = parseInt(value, 10);
73
+ if (isNaN(parsed)) {
74
+ throw new Error(`Cannot parse CheckpointNumber from string: ${value}`);
75
+ }
76
+ return CheckpointNumber(parsed);
77
+ };
78
+
79
+ /**
80
+ * Type guard to check if a value is a valid CheckpointNumber.
81
+ * Note: At runtime, an CheckpointNumber is just a number, so this checks if the value
82
+ * is a non-negative integer.
83
+ */
84
+ CheckpointNumber.isValid = function (value: unknown): value is CheckpointNumber {
85
+ return typeof value === 'number' && Number.isInteger(value) && value >= 0;
86
+ };
87
+
88
+ /** The zero checkpoint value. */
89
+ CheckpointNumber.ZERO = CheckpointNumber(0);
90
+
91
+ /** Initial checkpoint. */
92
+ CheckpointNumber.INITIAL = CheckpointNumber(1);
93
+
94
+ /**
95
+ * Zod schema for parsing and validating CheckpointNumber values.
96
+ * Accepts numbers, bigints, or strings and coerces them to CheckpointNumber.
97
+ */
98
+ function makeCheckpointNumberSchema(minValue: number) {
99
+ return z
100
+ .union([z.number(), z.bigint(), z.string()])
101
+ .pipe(z.coerce.number().int().min(minValue))
102
+ .transform(value => CheckpointNumber(value));
103
+ }
104
+
105
+ /**
106
+ * Zod schema for parsing and validating Checkpoint values.
107
+ * Accepts numbers, bigints, or strings and coerces them to CheckpointNumber.
108
+ */
109
+ export const CheckpointNumberSchema = makeCheckpointNumberSchema(0);
110
+
111
+ /**
112
+ * Zod schema for parsing and validating CheckpointNumber values that are strictly positive.
113
+ * Accepts numbers, bigints, or strings and coerces them to CheckpointNumber.
114
+ */
115
+ export const CheckpointNumberPositiveSchema = makeCheckpointNumberSchema(1);
@@ -1,4 +1,7 @@
1
+ export { BlockNumber, BlockNumberSchema, BlockNumberPositiveSchema } from './block_number.js';
2
+ export { CheckpointNumber, CheckpointNumberSchema, CheckpointNumberPositiveSchema } from './checkpoint_number.js';
1
3
  export { EpochNumber, EpochNumberSchema } from './epoch.js';
4
+ export { IndexWithinCheckpoint, IndexWithinCheckpointSchema } from './index_within_checkpoint.js';
2
5
  export { SlotNumber, SlotNumberSchema } from './slot.js';
3
6
 
4
7
  export type { Branded } from './types.js';
@@ -0,0 +1,88 @@
1
+ import { z } from 'zod';
2
+
3
+ import type { Branded } from './types.js';
4
+
5
+ /**
6
+ * A branded type representing the index of a block within a checkpoint.
7
+ * The first block in a checkpoint has index 0, the second has index 1, etc.
8
+ *
9
+ * This is a nominal type backed by a number, but TypeScript will treat it as
10
+ * incompatible with plain numbers and other branded numeric types.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const index = IndexWithinCheckpoint(0);
15
+ * const plainNumber: number = index; // OK - IndexWithinCheckpoint is assignable to number
16
+ * const indexFromNumber: IndexWithinCheckpoint = 0; // ERROR - number is not assignable to IndexWithinCheckpoint
17
+ * ```
18
+ */
19
+ export type IndexWithinCheckpoint = Branded<number, 'IndexWithinCheckpoint'>;
20
+
21
+ /**
22
+ * Creates an IndexWithinCheckpoint from a number.
23
+ * @param value - The index (must be a non-negative integer)
24
+ * @returns The branded IndexWithinCheckpoint value
25
+ * @throws If the value is negative or not an integer
26
+ */
27
+ export function IndexWithinCheckpoint(value: number): IndexWithinCheckpoint {
28
+ if (!Number.isInteger(value)) {
29
+ throw new Error(`IndexWithinCheckpoint must be an integer, got ${value}`);
30
+ }
31
+ if (value < 0) {
32
+ throw new Error(`IndexWithinCheckpoint must be non-negative, got ${value}`);
33
+ }
34
+ return value as IndexWithinCheckpoint;
35
+ }
36
+
37
+ /**
38
+ * Creates an IndexWithinCheckpoint from a bigint.
39
+ * @param value - The index as bigint (must be a non-negative integer within safe integer range)
40
+ * @returns The branded IndexWithinCheckpoint value
41
+ * @throws If the value is negative or exceeds Number.MAX_SAFE_INTEGER
42
+ */
43
+ IndexWithinCheckpoint.fromBigInt = function (value: bigint): IndexWithinCheckpoint {
44
+ if (value < 0n) {
45
+ throw new Error(`IndexWithinCheckpoint must be non-negative, got ${value}`);
46
+ }
47
+ if (value > BigInt(Number.MAX_SAFE_INTEGER)) {
48
+ throw new Error(`IndexWithinCheckpoint ${value} exceeds MAX_SAFE_INTEGER`);
49
+ }
50
+ return Number(value) as IndexWithinCheckpoint;
51
+ };
52
+
53
+ /**
54
+ * Creates an IndexWithinCheckpoint from a string.
55
+ * @param value - The index as a string
56
+ * @returns The branded IndexWithinCheckpoint value
57
+ * @throws If the string cannot be parsed as a valid index
58
+ */
59
+ IndexWithinCheckpoint.fromString = function (value: string): IndexWithinCheckpoint {
60
+ const parsed = parseInt(value, 10);
61
+ if (isNaN(parsed)) {
62
+ throw new Error(`Cannot parse IndexWithinCheckpoint from string: ${value}`);
63
+ }
64
+ return IndexWithinCheckpoint(parsed);
65
+ };
66
+
67
+ /**
68
+ * Type guard to check if a value is a valid IndexWithinCheckpoint.
69
+ * Note: At runtime, an IndexWithinCheckpoint is just a number, so this checks if the value
70
+ * is a non-negative integer.
71
+ */
72
+ IndexWithinCheckpoint.isValid = function (value: unknown): value is IndexWithinCheckpoint {
73
+ return typeof value === 'number' && Number.isInteger(value) && value >= 0;
74
+ };
75
+
76
+ /**
77
+ * The zero index value (first block in checkpoint).
78
+ */
79
+ IndexWithinCheckpoint.ZERO = IndexWithinCheckpoint(0);
80
+
81
+ /**
82
+ * Zod schema for parsing and validating IndexWithinCheckpoint values.
83
+ * Accepts numbers, bigints, or strings and coerces them to IndexWithinCheckpoint.
84
+ */
85
+ export const IndexWithinCheckpointSchema = z
86
+ .union([z.number(), z.bigint(), z.string()])
87
+ .pipe(z.coerce.number().int().min(0))
88
+ .transform(value => IndexWithinCheckpoint(value));
@@ -1,5 +1,5 @@
1
- import { randomBytes } from '@aztec/foundation/crypto';
2
- import type { Fr } from '@aztec/foundation/fields';
1
+ import { randomBytes } from '@aztec/foundation/crypto/random';
2
+ import type { Fr } from '@aztec/foundation/curves/bn254';
3
3
  import { BufferReader, deserializeBigInt, serializeBigInt } from '@aztec/foundation/serialize';
4
4
 
5
5
  import { inspect } from 'util';
@@ -1,5 +1,5 @@
1
- import { randomBytes } from '@aztec/foundation/crypto';
2
- import type { Fr } from '@aztec/foundation/fields';
1
+ import { randomBytes } from '@aztec/foundation/crypto/random';
2
+ import type { Fr } from '@aztec/foundation/curves/bn254';
3
3
  import { BufferReader, deserializeBigInt, serializeBigInt } from '@aztec/foundation/serialize';
4
4
 
5
5
  import { inspect } from 'util';
@@ -250,6 +250,58 @@ export function chunk<T>(items: T[], chunkSize: number): T[][] {
250
250
  return chunks;
251
251
  }
252
252
 
253
+ /**
254
+ * Splits the given array into chunks of the given size, wrapping around to the beginning
255
+ * if the last chunk would be smaller than the requested size.
256
+ * Returns empty array for empty input. Returns single chunk with all items if chunkSize <= 0.
257
+ */
258
+ export function chunkWrapAround<T>(items: T[], chunkSize: number): T[][] {
259
+ if (items.length === 0) {
260
+ return [];
261
+ }
262
+ if (chunkSize <= 0 || items.length <= chunkSize) {
263
+ return [items];
264
+ }
265
+ const remainder = items.length % chunkSize;
266
+ if (remainder === 0) {
267
+ return chunk(items, chunkSize);
268
+ }
269
+ const wrapAroundCount = chunkSize - remainder;
270
+ const wrappedItems = [...items, ...items.slice(0, wrapAroundCount)];
271
+ return chunk(wrappedItems, chunkSize);
272
+ }
273
+
274
+ const UNINITIALIZED = Symbol('uninitialized');
275
+
276
+ /**
277
+ * Splits the given iterable into chunks based on the key returned by the given function.
278
+ * Items must be contiguous to be included in the same chunk.
279
+ */
280
+ export function chunkBy<T, U>(items: T[], fn: (item: T) => U): T[][] {
281
+ const chunks: T[][] = [];
282
+ let currentChunk: T[] = [];
283
+ let currentKey: U | typeof UNINITIALIZED = UNINITIALIZED;
284
+
285
+ for (const item of items) {
286
+ const key = fn(item);
287
+ if (currentKey === UNINITIALIZED || key !== currentKey) {
288
+ if (currentChunk.length > 0) {
289
+ chunks.push(currentChunk);
290
+ }
291
+ currentChunk = [item];
292
+ currentKey = key;
293
+ } else {
294
+ currentChunk.push(item);
295
+ }
296
+ }
297
+
298
+ if (currentChunk.length > 0) {
299
+ chunks.push(currentChunk);
300
+ }
301
+
302
+ return chunks;
303
+ }
304
+
253
305
  /** Partitions the given iterable into two arrays based on the predicate. */
254
306
  export function partition<T>(items: T[], predicate: (item: T) => boolean): [T[], T[]] {
255
307
  const pass: T[] = [];
@@ -12,6 +12,9 @@ export type EnvVar =
12
12
  | 'ARCHIVER_VIEM_POLLING_INTERVAL_MS'
13
13
  | 'ARCHIVER_BATCH_SIZE'
14
14
  | 'AZTEC_ADMIN_PORT'
15
+ | 'AZTEC_ADMIN_API_KEY_HASH'
16
+ | 'AZTEC_DISABLE_ADMIN_API_KEY'
17
+ | 'AZTEC_RESET_ADMIN_API_KEY'
15
18
  | 'AZTEC_NODE_ADMIN_URL'
16
19
  | 'AZTEC_NODE_URL'
17
20
  | 'AZTEC_PORT'
@@ -21,12 +24,13 @@ export type EnvVar =
21
24
  | 'BB_NUM_IVC_VERIFIERS'
22
25
  | 'BB_IVC_CONCURRENCY'
23
26
  | 'BOOTSTRAP_NODES'
24
- | 'BLOB_SINK_ARCHIVE_API_URL'
25
- | 'BLOB_SINK_PORT'
26
- | 'BLOB_SINK_URL'
27
+ | 'BLOB_ARCHIVE_API_URL'
28
+ | 'BLOB_FILE_STORE_URLS'
29
+ | 'BLOB_FILE_STORE_UPLOAD_URL'
30
+ | 'BLOB_HEALTHCHECK_UPLOAD_INTERVAL_MINUTES'
27
31
  | 'BOT_DA_GAS_LIMIT'
28
32
  | 'BOT_FEE_PAYMENT_METHOD'
29
- | 'BOT_BASE_FEE_PADDING'
33
+ | 'BOT_MIN_FEE_PADDING'
30
34
  | 'BOT_FLUSH_SETUP_TRANSACTIONS'
31
35
  | 'BOT_FOLLOW_CHAIN'
32
36
  | 'BOT_L2_GAS_LIMIT'
@@ -46,7 +50,10 @@ export type EnvVar =
46
50
  | 'BOT_TX_MINED_WAIT_SECONDS'
47
51
  | 'BOT_MAX_CONSECUTIVE_ERRORS'
48
52
  | 'BOT_STOP_WHEN_UNHEALTHY'
49
- | 'BOT_AMM_TXS'
53
+ | 'BOT_MODE'
54
+ | 'BOT_L2_TO_L1_MESSAGES_PER_TX'
55
+ | 'BOT_L1_TO_L2_SEED_COUNT'
56
+ | 'BOT_L1_TO_L2_SEED_INTERVAL'
50
57
  | 'COINBASE'
51
58
  | 'CRS_PATH'
52
59
  | 'DATA_DIRECTORY'
@@ -63,8 +70,10 @@ export type EnvVar =
63
70
  | 'PUBLIC_DATA_TREE_MAP_SIZE_KB'
64
71
  | 'DEBUG'
65
72
  | 'DEBUG_P2P_DISABLE_COLOCATION_PENALTY'
66
- | 'DEPLOY_AZTEC_CONTRACTS_SALT'
73
+ | 'ENABLE_PROVER_NODE'
67
74
  | 'ETHEREUM_HOSTS'
75
+ | 'ETHEREUM_DEBUG_HOSTS'
76
+ | 'ETHEREUM_ALLOW_NO_DEBUG_HOSTS'
68
77
  | 'FEE_RECIPIENT'
69
78
  | 'FORCE_COLOR'
70
79
  | 'GOVERNANCE_PROPOSER_PAYLOAD_ADDRESS'
@@ -73,8 +82,10 @@ export type EnvVar =
73
82
  | 'L1_CONSENSUS_HOST_URLS'
74
83
  | 'L1_CONSENSUS_HOST_API_KEYS'
75
84
  | 'L1_CONSENSUS_HOST_API_KEY_HEADERS'
85
+ | 'L1_TX_FAILED_STORE'
76
86
  | 'LOG_JSON'
77
87
  | 'LOG_MULTILINE'
88
+ | 'LOG_NO_COLOR_PER_ACTOR'
78
89
  | 'LOG_LEVEL'
79
90
  | 'MNEMONIC'
80
91
  | 'NETWORK'
@@ -92,7 +103,12 @@ export type EnvVar =
92
103
  | 'PUBLIC_OTEL_INCLUDE_METRICS'
93
104
  | 'PUBLIC_OTEL_COLLECT_FROM'
94
105
  | 'PUBLIC_OTEL_OPT_OUT'
106
+ | 'P2P_BATCH_TX_REQUESTER_SMART_PARALLEL_WORKER_COUNT'
107
+ | 'P2P_BATCH_TX_REQUESTER_DUMB_PARALLEL_WORKER_COUNT'
108
+ | 'P2P_BATCH_TX_REQUESTER_TX_BATCH_SIZE'
109
+ | 'P2P_BATCH_TX_REQUESTER_BAD_PEER_THRESHOLD'
95
110
  | 'P2P_BLOCK_CHECK_INTERVAL_MS'
111
+ | 'P2P_SLOT_CHECK_INTERVAL_MS'
96
112
  | 'P2P_BLOCK_REQUEST_BATCH_SIZE'
97
113
  | 'P2P_BOOTSTRAP_NODE_ENR_VERSION_CHECK'
98
114
  | 'P2P_BOOTSTRAP_NODES_AS_FULL_PEERS'
@@ -131,12 +147,11 @@ export type EnvVar =
131
147
  | 'P2P_TRUSTED_PEERS'
132
148
  | 'P2P_PRIVATE_PEERS'
133
149
  | 'P2P_PREFERRED_PEERS'
134
- | 'P2P_MAX_TX_POOL_SIZE'
135
- | 'P2P_TX_POOL_OVERFLOW_FACTOR'
150
+ | 'P2P_MAX_PENDING_TX_COUNT'
136
151
  | 'P2P_SEEN_MSG_CACHE_SIZE'
137
- | 'P2P_DROP_TX'
138
152
  | 'P2P_DROP_TX_CHANCE'
139
153
  | 'P2P_TX_POOL_DELETE_TXS_AFTER_REORG'
154
+ | 'P2P_MIN_TX_POOL_AGE_MS'
140
155
  | 'DEBUG_P2P_INSTRUMENT_MESSAGES'
141
156
  | 'PEER_ID_PRIVATE_KEY'
142
157
  | 'PEER_ID_PRIVATE_KEY_PATH'
@@ -150,7 +165,10 @@ export type EnvVar =
150
165
  | 'PROVER_BROKER_BATCH_INTERVAL_MS'
151
166
  | 'PROVER_BROKER_BATCH_SIZE'
152
167
  | 'PROVER_BROKER_MAX_EPOCHS_TO_KEEP_RESULTS_FOR'
168
+ | 'PROVER_BROKER_DEBUG_REPLAY_ENABLED'
169
+ | 'PROVER_CANCEL_JOBS_ON_STOP'
153
170
  | 'PROVER_COORDINATION_NODE_URLS'
171
+ | 'PROVER_PROOF_STORE'
154
172
  | 'PROVER_FAILED_PROOF_STORE'
155
173
  | 'PROVER_NODE_FAILED_EPOCH_STORE'
156
174
  | 'PROVER_NODE_DISABLE_PROOF_PUBLISH'
@@ -166,6 +184,7 @@ export type EnvVar =
166
184
  | 'PROVER_PUBLISHER_PRIVATE_KEYS'
167
185
  | 'PROVER_PUBLISHER_ADDRESSES'
168
186
  | 'PROVER_PUBLISHER_ALLOW_INVALID_STATES'
187
+ | 'PROVER_PUBLISHER_FORWARDER_ADDRESS'
169
188
  | 'PROVER_REAL_PROOFS'
170
189
  | 'PROVER_TEST_DELAY_FACTOR'
171
190
  | 'PROVER_TEST_DELAY_MS'
@@ -173,6 +192,7 @@ export type EnvVar =
173
192
  | 'PROVER_TEST_VERIFICATION_DELAY_MS'
174
193
  | 'PXE_L2_BLOCK_BATCH_SIZE'
175
194
  | 'PXE_PROVER_ENABLED'
195
+ | 'PXE_SYNC_CHAIN_TIP'
176
196
  | 'RPC_MAX_BATCH_SIZE'
177
197
  | 'RPC_MAX_BODY_SIZE'
178
198
  | 'RPC_SIMULATE_PUBLIC_MAX_GAS_LIMIT'
@@ -190,12 +210,17 @@ export type EnvVar =
190
210
  | 'SEQ_PUBLISHER_PRIVATE_KEYS'
191
211
  | 'SEQ_PUBLISHER_ADDRESSES'
192
212
  | 'SEQ_PUBLISHER_ALLOW_INVALID_STATES'
193
- | 'SEQ_TX_POLLING_INTERVAL_MS'
213
+ | 'SEQ_PUBLISHER_FORWARDER_ADDRESS'
214
+ | 'SEQ_POLLING_INTERVAL_MS'
194
215
  | 'SEQ_ENFORCE_TIME_TABLE'
195
- | 'SEQ_MAX_L1_TX_INCLUSION_TIME_INTO_SLOT'
216
+ | 'SEQ_L1_PUBLISHING_TIME_ALLOWANCE_IN_SLOT'
196
217
  | 'SEQ_ATTESTATION_PROPAGATION_TIME'
218
+ | 'SEQ_BLOCK_DURATION_MS'
219
+ | 'SEQ_EXPECTED_BLOCK_PROPOSALS_PER_SLOT'
220
+ | 'SEQ_BUILD_CHECKPOINT_IF_EMPTY'
197
221
  | 'SEQ_SECONDS_BEFORE_INVALIDATING_BLOCK_AS_COMMITTEE_MEMBER'
198
222
  | 'SEQ_SECONDS_BEFORE_INVALIDATING_BLOCK_AS_NON_COMMITTEE_MEMBER'
223
+ | 'SEQ_SKIP_CHECKPOINT_PUBLISH_PERCENT'
199
224
  | 'SLASH_MIN_PENALTY_PERCENTAGE'
200
225
  | 'SLASH_MAX_PENALTY_PERCENTAGE'
201
226
  | 'SLASH_VALIDATORS_ALWAYS'
@@ -206,6 +231,8 @@ export type EnvVar =
206
231
  | 'SLASH_INACTIVITY_TARGET_PERCENTAGE'
207
232
  | 'SLASH_INACTIVITY_CONSECUTIVE_EPOCH_THRESHOLD'
208
233
  | 'SLASH_INVALID_BLOCK_PENALTY'
234
+ | 'SLASH_DUPLICATE_PROPOSAL_PENALTY'
235
+ | 'SLASH_DUPLICATE_ATTESTATION_PENALTY'
209
236
  | 'SLASH_OVERRIDE_PAYLOAD'
210
237
  | 'SLASH_PROPOSE_INVALID_ATTESTATIONS_PENALTY'
211
238
  | 'SLASH_ATTEST_DESCENDANT_OF_INVALID_PENALTY'
@@ -230,6 +257,20 @@ export type EnvVar =
230
257
  | 'TX_COLLECTION_FAST_MAX_PARALLEL_REQUESTS_PER_NODE'
231
258
  | 'TX_COLLECTION_NODE_RPC_MAX_BATCH_SIZE'
232
259
  | 'TX_COLLECTION_NODE_RPC_URLS'
260
+ | 'TX_COLLECTION_MISSING_TXS_COLLECTOR_TYPE'
261
+ | 'TX_COLLECTION_FILE_STORE_URLS'
262
+ | 'TX_COLLECTION_FILE_STORE_SLOW_DELAY_MS'
263
+ | 'TX_COLLECTION_FILE_STORE_FAST_DELAY_MS'
264
+ | 'TX_COLLECTION_FILE_STORE_FAST_WORKER_COUNT'
265
+ | 'TX_COLLECTION_FILE_STORE_SLOW_WORKER_COUNT'
266
+ | 'TX_COLLECTION_FILE_STORE_FAST_BACKOFF_BASE_MS'
267
+ | 'TX_COLLECTION_FILE_STORE_SLOW_BACKOFF_BASE_MS'
268
+ | 'TX_COLLECTION_FILE_STORE_FAST_BACKOFF_MAX_MS'
269
+ | 'TX_COLLECTION_FILE_STORE_SLOW_BACKOFF_MAX_MS'
270
+ | 'TX_FILE_STORE_URL'
271
+ | 'TX_FILE_STORE_UPLOAD_CONCURRENCY'
272
+ | 'TX_FILE_STORE_MAX_QUEUE_SIZE'
273
+ | 'TX_FILE_STORE_ENABLED'
233
274
  | 'TX_PUBLIC_SETUP_ALLOWLIST'
234
275
  | 'TXE_PORT'
235
276
  | 'TRANSACTIONS_DISABLED'
@@ -241,10 +282,10 @@ export type EnvVar =
241
282
  | 'VALIDATOR_ADDRESSES'
242
283
  | 'ROLLUP_VERSION'
243
284
  | 'WS_BLOCK_CHECK_INTERVAL_MS'
244
- | 'WS_PROVEN_BLOCKS_ONLY'
245
285
  | 'WS_BLOCK_REQUEST_BATCH_SIZE'
246
286
  | 'L1_READER_VIEM_POLLING_INTERVAL_MS'
247
287
  | 'WS_DATA_DIRECTORY'
288
+ | 'WS_NUM_HISTORIC_CHECKPOINTS'
248
289
  | 'WS_NUM_HISTORIC_BLOCKS'
249
290
  | 'ETHEREUM_SLOT_DURATION'
250
291
  | 'AZTEC_SLOT_DURATION'
@@ -252,12 +293,14 @@ export type EnvVar =
252
293
  | 'AZTEC_TARGET_COMMITTEE_SIZE'
253
294
  | 'AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET'
254
295
  | 'AZTEC_LAG_IN_EPOCHS_FOR_RANDAO'
296
+ | 'AZTEC_INBOX_LAG'
255
297
  | 'AZTEC_PROOF_SUBMISSION_EPOCHS'
256
298
  | 'AZTEC_ACTIVATION_THRESHOLD'
257
299
  | 'AZTEC_EJECTION_THRESHOLD'
258
300
  | 'AZTEC_LOCAL_EJECTION_THRESHOLD'
259
301
  | 'AZTEC_MANA_TARGET'
260
302
  | 'AZTEC_PROVING_COST_PER_MANA'
303
+ | 'AZTEC_INITIAL_ETH_PER_FEE_ASSET'
261
304
  | 'AZTEC_SLASHING_QUORUM'
262
305
  | 'AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS'
263
306
  | 'AZTEC_SLASHING_LIFETIME_IN_ROUNDS'
@@ -271,6 +314,7 @@ export type EnvVar =
271
314
  | 'AZTEC_SLASHER_FLAVOR'
272
315
  | 'AZTEC_GOVERNANCE_PROPOSER_QUORUM'
273
316
  | 'AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE'
317
+ | 'AZTEC_GOVERNANCE_VOTING_DURATION'
274
318
  | 'AZTEC_EXIT_DELAY_SECONDS'
275
319
  | 'L1_GAS_LIMIT_BUFFER_PERCENTAGE'
276
320
  | 'L1_GAS_PRICE_MAX'
@@ -279,6 +323,7 @@ export type EnvVar =
279
323
  | 'L1_BLOB_FEE_PER_GAS_GWEI_MAX'
280
324
  | 'L1_PRIORITY_FEE_BUMP_PERCENTAGE'
281
325
  | 'L1_PRIORITY_FEE_RETRY_BUMP_PERCENTAGE'
326
+ | 'L1_MINIMUM_PRIORITY_FEE_PER_GAS_GWEI'
282
327
  | 'L1_FIXED_PRIORITY_FEE_PER_GAS'
283
328
  | 'L1_FIXED_PRIORITY_FEE_PER_GAS_GWEI'
284
329
  | 'L1_TX_MONITOR_MAX_ATTEMPTS'
@@ -296,7 +341,6 @@ export type EnvVar =
296
341
  | 'K8S_POD_UID'
297
342
  | 'K8S_NAMESPACE_NAME'
298
343
  | 'VALIDATOR_REEXECUTE_DEADLINE_MS'
299
- | 'ALWAYS_REEXECUTE_BLOCK_PROPOSALS'
300
344
  | 'AUTO_UPDATE'
301
345
  | 'AUTO_UPDATE_URL'
302
346
  | 'WEB3_SIGNER_URL'
@@ -304,4 +348,17 @@ export type EnvVar =
304
348
  | 'BLOB_ALLOW_EMPTY_SOURCES'
305
349
  | 'FISHERMAN_MODE'
306
350
  | 'MAX_ALLOWED_ETH_CLIENT_DRIFT_SECONDS'
307
- | 'LEGACY_BLS_CLI';
351
+ | 'LEGACY_BLS_CLI'
352
+ | 'DEBUG_FORCE_TX_PROOF_VERIFICATION'
353
+ | 'VALIDATOR_HA_SIGNING_ENABLED'
354
+ | 'VALIDATOR_HA_NODE_ID'
355
+ | 'VALIDATOR_HA_POLLING_INTERVAL_MS'
356
+ | 'VALIDATOR_HA_SIGNING_TIMEOUT_MS'
357
+ | 'VALIDATOR_HA_MAX_STUCK_DUTIES_AGE_MS'
358
+ | 'VALIDATOR_HA_OLD_DUTIES_MAX_AGE_H'
359
+ | 'VALIDATOR_HA_DATABASE_URL'
360
+ | 'VALIDATOR_HA_RUN_MIGRATIONS'
361
+ | 'VALIDATOR_HA_POOL_MAX'
362
+ | 'VALIDATOR_HA_POOL_MIN'
363
+ | 'VALIDATOR_HA_POOL_IDLE_TIMEOUT_MS'
364
+ | 'VALIDATOR_HA_POOL_CONNECTION_TIMEOUT_MS';
@@ -1,6 +1,8 @@
1
- import { Fq, Fr } from '../fields/fields.js';
1
+ import { Fq, Fr } from '../curves/bn254/field.js';
2
+ import { createConsoleLogger } from '../log/console.js';
2
3
  import type { EnvVar } from './env_var.js';
3
4
  import { type NetworkNames, getActiveNetworkName } from './network_name.js';
5
+ import { parseBooleanEnv } from './parse-env.js';
4
6
  import { SecretValue } from './secret_value.js';
5
7
 
6
8
  export { SecretValue, getActiveNetworkName };
@@ -17,6 +19,11 @@ export interface ConfigMapping {
17
19
  isBoolean?: boolean;
18
20
  nested?: Record<string, ConfigMapping>;
19
21
  fallback?: EnvVar[];
22
+ /**
23
+ * List of deprecated env vars that are still supported but will log a warning.
24
+ * These should also be included in the fallback array for parsing.
25
+ */
26
+ deprecatedFallback?: { env: EnvVar; message?: string }[];
20
27
  }
21
28
 
22
29
  export function isBooleanConfigValue<T>(obj: T, key: keyof T): boolean {
@@ -72,12 +79,24 @@ export function getConfigFromMappings<T>(configMappings: ConfigMappingsType<T>):
72
79
  const config = {} as T;
73
80
 
74
81
  for (const key in configMappings) {
75
- const { env, parseEnv, defaultValue, nested, fallback } = configMappings[key];
82
+ const { env, parseEnv, defaultValue, nested, fallback, deprecatedFallback } = configMappings[key];
76
83
  if (nested) {
77
84
  (config as any)[key] = getConfigFromMappings(nested);
78
85
  } else {
79
86
  // Use the shared utility function
80
87
  (config as any)[key] = getValueFromEnvWithFallback(env, parseEnv, defaultValue, fallback);
88
+
89
+ // Check for deprecated env vars and warn if logger is set
90
+ if (deprecatedFallback?.length) {
91
+ const userLog = createConsoleLogger('[DEPRECATED]');
92
+ for (const { env: deprecatedEnv, message } of deprecatedFallback) {
93
+ if (process.env[deprecatedEnv]) {
94
+ const warningMessage =
95
+ message ?? `Environment variable ${deprecatedEnv} is deprecated. Please use ${env} instead.`;
96
+ userLog(warningMessage, { deprecatedEnvVar: deprecatedEnv, newEnvVar: env });
97
+ }
98
+ }
99
+ }
81
100
  }
82
101
  }
83
102
 
@@ -130,6 +149,23 @@ export function floatConfigHelper(
130
149
  };
131
150
  }
132
151
 
152
+ /**
153
+ * Parses an environment variable to a 0-1 percentage value
154
+ */
155
+ export function percentageConfigHelper(defaultVal: number): Pick<ConfigMapping, 'parseEnv' | 'defaultValue'> {
156
+ return {
157
+ parseEnv: (val: string): number => {
158
+ const parsed = safeParseFloat(val, defaultVal);
159
+ if (parsed < 0 || parsed > 1) {
160
+ throw new TypeError(`Invalid percentage value: ${parsed} should be between 0 and 1`);
161
+ }
162
+
163
+ return parsed;
164
+ },
165
+ defaultValue: defaultVal,
166
+ };
167
+ }
168
+
133
169
  /**
134
170
  * Generates parseEnv and default values for a numerical config value.
135
171
  * @param defaultVal - The default numerical value to use if the environment variable is not set or is invalid
@@ -213,10 +249,7 @@ export function secretValueConfigHelper<T>(parse: (val: string | undefined) => T
213
249
  };
214
250
  }
215
251
 
216
- /** Parses an env var as boolean. Returns true only if value is 1, true, or TRUE. */
217
- export function parseBooleanEnv(val: string | undefined): boolean {
218
- return val !== undefined && ['1', 'true', 'TRUE'].includes(val);
219
- }
252
+ export { parseBooleanEnv } from './parse-env.js';
220
253
 
221
254
  export function secretStringConfigHelper(): Required<
222
255
  Pick<ConfigMapping, 'parseEnv' | 'defaultValue' | 'isBoolean'> & {
@@ -4,9 +4,11 @@ export const NetworkConfigSchema = z
4
4
  .object({
5
5
  bootnodes: z.array(z.string()),
6
6
  snapshots: z.array(z.string()),
7
+ blobFileStoreUrls: z.array(z.string()).optional(),
7
8
  registryAddress: z.string(),
8
9
  feeAssetHandlerAddress: z.string().optional(),
9
10
  l1ChainId: z.number(),
11
+ blockDurationMs: z.number().positive().optional(),
10
12
  })
11
13
  .passthrough(); // Allow additional unknown fields to pass through
12
14
 
@@ -5,7 +5,8 @@ export type NetworkNames =
5
5
  | 'testnet'
6
6
  | 'mainnet'
7
7
  | 'next-net'
8
- | 'devnet';
8
+ | 'devnet'
9
+ | `v${number}-devnet-${number}`;
9
10
 
10
11
  export function getActiveNetworkName(name?: string): NetworkNames {
11
12
  const network = name || process.env.NETWORK;
@@ -23,6 +24,8 @@ export function getActiveNetworkName(name?: string): NetworkNames {
23
24
  return 'next-net';
24
25
  } else if (network === 'devnet') {
25
26
  return 'devnet';
27
+ } else if (/^v\d+-devnet-\d+$/.test(network)) {
28
+ return network as `v${number}-devnet-${number}`;
26
29
  }
27
30
  throw new Error(`Unknown network: ${network}`);
28
31
  }
@@ -0,0 +1,4 @@
1
+ /** Parses an env var as boolean. Returns true only if value is 1, true, or TRUE. */
2
+ export function parseBooleanEnv(val: string | undefined): boolean {
3
+ return val !== undefined && ['1', 'true', 'TRUE'].includes(val);
4
+ }
@@ -1,4 +1,4 @@
1
- import { randomBytes } from '@aztec/foundation/crypto';
1
+ import { randomBytes } from '@aztec/foundation/crypto/random';
2
2
 
3
3
  import { createCipheriv, createDecipheriv, createHash, pbkdf2Sync, randomUUID } from 'crypto';
4
4
  import { readFileSync } from 'fs';
@@ -1,4 +1,4 @@
1
- import { Fr } from '@aztec/foundation/fields';
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
2
  import type { Hex } from '@aztec/foundation/string';
3
3
 
4
4
  import { mod } from '@noble/curves/abstract/modular';