@aztec/foundation 0.0.1-commit.24de95ac → 0.0.1-commit.3469e52

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 (464) hide show
  1. package/dest/array/array.d.ts +1 -9
  2. package/dest/array/array.d.ts.map +1 -1
  3. package/dest/array/array.js +0 -11
  4. package/dest/array/index.d.ts +2 -1
  5. package/dest/array/index.d.ts.map +1 -1
  6. package/dest/array/index.js +1 -0
  7. package/dest/array/sorted_array.d.ts +10 -0
  8. package/dest/array/sorted_array.d.ts.map +1 -0
  9. package/dest/array/sorted_array.js +106 -0
  10. package/dest/async-map/index.d.ts +1 -1
  11. package/dest/async-pool/index.d.ts +1 -1
  12. package/dest/bigint/index.d.ts +1 -1
  13. package/dest/bigint-buffer/index.d.ts +1 -1
  14. package/dest/branded-types/block_number.d.ts +56 -0
  15. package/dest/branded-types/block_number.d.ts.map +1 -0
  16. package/dest/branded-types/block_number.js +78 -0
  17. package/dest/branded-types/checkpoint_number.d.ts +54 -0
  18. package/dest/branded-types/checkpoint_number.d.ts.map +1 -0
  19. package/dest/branded-types/checkpoint_number.js +77 -0
  20. package/dest/branded-types/epoch.d.ts +42 -0
  21. package/dest/branded-types/epoch.d.ts.map +1 -0
  22. package/dest/branded-types/epoch.js +59 -0
  23. package/dest/branded-types/index.d.ts +7 -0
  24. package/dest/branded-types/index.d.ts.map +1 -0
  25. package/dest/branded-types/index.js +5 -0
  26. package/dest/branded-types/index_within_checkpoint.d.ts +42 -0
  27. package/dest/branded-types/index_within_checkpoint.d.ts.map +1 -0
  28. package/dest/branded-types/index_within_checkpoint.js +59 -0
  29. package/dest/branded-types/slot.d.ts +42 -0
  30. package/dest/branded-types/slot.d.ts.map +1 -0
  31. package/dest/branded-types/slot.js +59 -0
  32. package/dest/branded-types/types.d.ts +5 -0
  33. package/dest/branded-types/types.d.ts.map +1 -0
  34. package/dest/branded-types/types.js +1 -0
  35. package/dest/buffer/buffer16.d.ts +2 -2
  36. package/dest/buffer/buffer16.d.ts.map +1 -1
  37. package/dest/buffer/buffer16.js +4 -2
  38. package/dest/buffer/buffer32.d.ts +2 -2
  39. package/dest/buffer/buffer32.d.ts.map +1 -1
  40. package/dest/buffer/buffer32.js +4 -2
  41. package/dest/buffer/index.d.ts +1 -1
  42. package/dest/collection/array.d.ts +1 -1
  43. package/dest/collection/index.d.ts +1 -1
  44. package/dest/collection/object.d.ts +1 -1
  45. package/dest/committable/committable.d.ts +1 -1
  46. package/dest/committable/committable.d.ts.map +1 -1
  47. package/dest/committable/index.d.ts +1 -1
  48. package/dest/config/env_var.d.ts +2 -2
  49. package/dest/config/env_var.d.ts.map +1 -1
  50. package/dest/config/index.d.ts +15 -4
  51. package/dest/config/index.d.ts.map +1 -1
  52. package/dest/config/index.js +32 -9
  53. package/dest/config/network_config.d.ts +13 -1
  54. package/dest/config/network_config.d.ts.map +1 -1
  55. package/dest/config/network_config.js +3 -1
  56. package/dest/config/network_name.d.ts +1 -1
  57. package/dest/config/parse-env.d.ts +3 -0
  58. package/dest/config/parse-env.d.ts.map +1 -0
  59. package/dest/config/parse-env.js +7 -0
  60. package/dest/config/secret_value.d.ts +1 -1
  61. package/dest/config/secret_value.d.ts.map +1 -1
  62. package/dest/config/secret_value.js +3 -1
  63. package/dest/crypto/aes128/index.d.ts +1 -1
  64. package/dest/crypto/aes128/index.d.ts.map +1 -1
  65. package/dest/crypto/aes128/index.js +2 -6
  66. package/dest/crypto/bls/bn254_keystore.d.ts +15 -15
  67. package/dest/crypto/bls/bn254_keystore.d.ts.map +1 -1
  68. package/dest/crypto/bls/bn254_keystore.js +1 -1
  69. package/dest/crypto/bls/index.d.ts +1 -1
  70. package/dest/crypto/bls/index.js +1 -1
  71. package/dest/crypto/bn254/index.d.ts +35 -51
  72. package/dest/crypto/bn254/index.d.ts.map +1 -1
  73. package/dest/crypto/bn254/index.js +51 -137
  74. package/dest/crypto/ecdsa/index.d.ts +1 -1
  75. package/dest/crypto/ecdsa/index.d.ts.map +1 -1
  76. package/dest/crypto/ecdsa/index.js +4 -12
  77. package/dest/crypto/ecdsa/signature.d.ts +2 -2
  78. package/dest/crypto/ecdsa/signature.d.ts.map +1 -1
  79. package/dest/crypto/ecdsa/signature.js +2 -2
  80. package/dest/crypto/grumpkin/index.d.ts +4 -2
  81. package/dest/crypto/grumpkin/index.d.ts.map +1 -1
  82. package/dest/crypto/grumpkin/index.js +7 -16
  83. package/dest/crypto/keccak/index.d.ts +1 -1
  84. package/dest/crypto/keys/index.d.ts +2 -2
  85. package/dest/crypto/keys/index.d.ts.map +1 -1
  86. package/dest/crypto/keys/index.js +2 -4
  87. package/dest/crypto/pedersen/index.d.ts +1 -1
  88. package/dest/crypto/pedersen/pedersen.noble.d.ts +1 -1
  89. package/dest/crypto/pedersen/pedersen.wasm.d.ts +2 -2
  90. package/dest/crypto/pedersen/pedersen.wasm.d.ts.map +1 -1
  91. package/dest/crypto/pedersen/pedersen.wasm.js +4 -10
  92. package/dest/crypto/poseidon/index.d.ts +2 -2
  93. package/dest/crypto/poseidon/index.d.ts.map +1 -1
  94. package/dest/crypto/poseidon/index.js +6 -16
  95. package/dest/crypto/random/index.d.ts +1 -1
  96. package/dest/crypto/random/index.d.ts.map +1 -1
  97. package/dest/crypto/random/randomness_singleton.d.ts +2 -2
  98. package/dest/crypto/random/randomness_singleton.d.ts.map +1 -1
  99. package/dest/crypto/random/randomness_singleton.js +3 -3
  100. package/dest/crypto/schnorr/index.d.ts +3 -2
  101. package/dest/crypto/schnorr/index.d.ts.map +1 -1
  102. package/dest/crypto/schnorr/index.js +4 -10
  103. package/dest/crypto/schnorr/signature.d.ts +2 -2
  104. package/dest/crypto/schnorr/signature.d.ts.map +1 -1
  105. package/dest/crypto/schnorr/signature.js +2 -2
  106. package/dest/crypto/secp256k1/index.d.ts +1 -1
  107. package/dest/crypto/secp256k1/index.d.ts.map +1 -1
  108. package/dest/crypto/secp256k1/index.js +3 -9
  109. package/dest/crypto/secp256k1-signer/index.d.ts +1 -1
  110. package/dest/crypto/secp256k1-signer/secp256k1_signer.d.ts +1 -1
  111. package/dest/crypto/secp256k1-signer/secp256k1_signer.d.ts.map +1 -1
  112. package/dest/crypto/secp256k1-signer/utils.d.ts +1 -1
  113. package/dest/crypto/secp256k1-signer/utils.d.ts.map +1 -1
  114. package/dest/crypto/serialize.d.ts +1 -1
  115. package/dest/crypto/sha256/index.d.ts +2 -2
  116. package/dest/crypto/sha256/index.d.ts.map +1 -1
  117. package/dest/crypto/sha256/index.js +1 -1
  118. package/dest/crypto/sha512/index.d.ts +3 -3
  119. package/dest/crypto/sha512/index.d.ts.map +1 -1
  120. package/dest/crypto/sha512/index.js +1 -1
  121. package/dest/crypto/signature/index.d.ts +2 -2
  122. package/dest/crypto/signature/index.d.ts.map +1 -1
  123. package/dest/crypto/sync/index.d.ts +1 -1
  124. package/dest/crypto/sync/index.js +1 -3
  125. package/dest/crypto/sync/pedersen/index.d.ts +2 -2
  126. package/dest/crypto/sync/pedersen/index.d.ts.map +1 -1
  127. package/dest/crypto/sync/pedersen/index.js +1 -1
  128. package/dest/crypto/sync/poseidon/index.d.ts +2 -2
  129. package/dest/crypto/sync/poseidon/index.d.ts.map +1 -1
  130. package/dest/crypto/sync/poseidon/index.js +1 -1
  131. package/dest/{fields/bls12_fields.d.ts → curves/bls12/field.d.ts} +3 -3
  132. package/dest/curves/bls12/field.d.ts.map +1 -0
  133. package/dest/{fields/bls12_fields.js → curves/bls12/field.js} +12 -9
  134. package/dest/curves/bls12/index.d.ts +3 -0
  135. package/dest/curves/bls12/index.d.ts.map +1 -0
  136. package/dest/curves/bls12/index.js +2 -0
  137. package/dest/{fields/bls12_point.d.ts → curves/bls12/point.d.ts} +4 -4
  138. package/dest/curves/bls12/point.d.ts.map +1 -0
  139. package/dest/{fields/bls12_point.js → curves/bls12/point.js} +10 -8
  140. package/dest/{fields/fields.d.ts → curves/bn254/field.d.ts} +16 -15
  141. package/dest/curves/bn254/field.d.ts.map +1 -0
  142. package/dest/{fields/fields.js → curves/bn254/field.js} +49 -49
  143. package/dest/curves/bn254/index.d.ts +3 -0
  144. package/dest/curves/bn254/index.d.ts.map +1 -0
  145. package/dest/curves/bn254/index.js +2 -0
  146. package/dest/curves/bn254/point.d.ts +54 -0
  147. package/dest/curves/bn254/point.d.ts.map +1 -0
  148. package/dest/curves/bn254/point.js +143 -0
  149. package/dest/curves/grumpkin/index.d.ts +10 -0
  150. package/dest/curves/grumpkin/index.d.ts.map +1 -0
  151. package/dest/curves/grumpkin/index.js +3 -0
  152. package/dest/{fields → curves/grumpkin}/point.d.ts +12 -3
  153. package/dest/curves/grumpkin/point.d.ts.map +1 -0
  154. package/dest/{fields → curves/grumpkin}/point.js +24 -7
  155. package/dest/decorators/index.d.ts +1 -1
  156. package/dest/decorators/memoize.d.ts +1 -1
  157. package/dest/decorators/memoize.d.ts.map +1 -1
  158. package/dest/error/index.d.ts +1 -1
  159. package/dest/eth-address/index.d.ts +12 -2
  160. package/dest/eth-address/index.d.ts.map +1 -1
  161. package/dest/eth-address/index.js +27 -3
  162. package/dest/eth-signature/eth_signature.d.ts +1 -1
  163. package/dest/eth-signature/eth_signature.d.ts.map +1 -1
  164. package/dest/eth-signature/index.d.ts +1 -1
  165. package/dest/fs/index.d.ts +1 -1
  166. package/dest/fs/run_in_dir.d.ts +1 -1
  167. package/dest/fs/try_rm_dir.d.ts +1 -1
  168. package/dest/iterable/all.d.ts +1 -1
  169. package/dest/iterable/filter.d.ts +1 -1
  170. package/dest/iterable/index.d.ts +1 -1
  171. package/dest/iterable/isAsyncIt.d.ts +1 -1
  172. package/dest/iterable/map.d.ts +1 -1
  173. package/dest/iterable/peek.d.ts +1 -1
  174. package/dest/iterable/sort.d.ts +1 -1
  175. package/dest/iterable/take.d.ts +1 -1
  176. package/dest/iterable/toArray.d.ts +1 -1
  177. package/dest/iterator/filter.d.ts +3 -0
  178. package/dest/iterator/filter.d.ts.map +1 -0
  179. package/dest/iterator/filter.js +7 -0
  180. package/dest/iterator/index.d.ts +2 -0
  181. package/dest/iterator/index.d.ts.map +1 -0
  182. package/dest/iterator/index.js +1 -0
  183. package/dest/json-rpc/client/fetch.d.ts +1 -1
  184. package/dest/json-rpc/client/index.d.ts +1 -1
  185. package/dest/json-rpc/client/safe_json_rpc_client.d.ts +1 -1
  186. package/dest/json-rpc/client/undici.d.ts +1 -1
  187. package/dest/json-rpc/convert.d.ts +1 -1
  188. package/dest/json-rpc/errors.d.ts +1 -1
  189. package/dest/json-rpc/errors.d.ts.map +1 -1
  190. package/dest/json-rpc/fixtures/class_a.d.ts +1 -1
  191. package/dest/json-rpc/fixtures/class_a.d.ts.map +1 -1
  192. package/dest/json-rpc/fixtures/class_b.d.ts +1 -1
  193. package/dest/json-rpc/fixtures/class_b.d.ts.map +1 -1
  194. package/dest/json-rpc/fixtures/test_state.d.ts +1 -1
  195. package/dest/json-rpc/fixtures/test_state.d.ts.map +1 -1
  196. package/dest/json-rpc/index.d.ts +1 -1
  197. package/dest/json-rpc/js_utils.d.ts +1 -1
  198. package/dest/json-rpc/js_utils.d.ts.map +1 -1
  199. package/dest/json-rpc/server/index.d.ts +1 -1
  200. package/dest/json-rpc/server/safe_json_rpc_server.d.ts +1 -1
  201. package/dest/json-rpc/server/safe_json_rpc_server.d.ts.map +1 -1
  202. package/dest/json-rpc/test/index.d.ts +1 -1
  203. package/dest/json-rpc/test/integration.d.ts +1 -1
  204. package/dest/log/console.d.ts +1 -1
  205. package/dest/log/gcloud-logger-config.d.ts +1 -1
  206. package/dest/log/gcloud-logger-config.d.ts.map +1 -1
  207. package/dest/log/index.d.ts +1 -1
  208. package/dest/log/libp2p_logger.d.ts +1 -1
  209. package/dest/log/log-filters.d.ts +1 -1
  210. package/dest/log/log-levels.d.ts +1 -1
  211. package/dest/log/log_fn.d.ts +1 -1
  212. package/dest/log/noir_debug_log_util.d.ts +1 -1
  213. package/dest/log/pino-logger.d.ts +2 -2
  214. package/dest/log/pino-logger.d.ts.map +1 -1
  215. package/dest/log/pino-logger.js +1 -1
  216. package/dest/message/index.d.ts +1 -1
  217. package/dest/message/index.d.ts.map +1 -1
  218. package/dest/mutex/index.d.ts +1 -1
  219. package/dest/mutex/index.d.ts.map +1 -1
  220. package/dest/mutex/mutex_database.d.ts +1 -1
  221. package/dest/noir/index.d.ts +1 -1
  222. package/dest/noir/noir_package_config.d.ts +9 -9
  223. package/dest/number/index.d.ts +1 -1
  224. package/dest/profiler/index.d.ts +1 -1
  225. package/dest/profiler/profiler.d.ts +1 -1
  226. package/dest/promise/index.d.ts +1 -1
  227. package/dest/promise/running-promise.d.ts +1 -1
  228. package/dest/promise/running-promise.d.ts.map +1 -1
  229. package/dest/promise/utils.d.ts +1 -1
  230. package/dest/queue/base_memory_queue.d.ts +1 -1
  231. package/dest/queue/base_memory_queue.d.ts.map +1 -1
  232. package/dest/queue/batch_queue.d.ts +1 -1
  233. package/dest/queue/batch_queue.d.ts.map +1 -1
  234. package/dest/queue/bounded_serial_queue.d.ts +1 -1
  235. package/dest/queue/bounded_serial_queue.d.ts.map +1 -1
  236. package/dest/queue/fifo_memory_queue.d.ts +1 -1
  237. package/dest/queue/fifo_memory_queue.d.ts.map +1 -1
  238. package/dest/queue/index.d.ts +1 -1
  239. package/dest/queue/priority_memory_queue.d.ts +1 -1
  240. package/dest/queue/priority_memory_queue.d.ts.map +1 -1
  241. package/dest/queue/priority_queue.d.ts +1 -1
  242. package/dest/queue/priority_queue.d.ts.map +1 -1
  243. package/dest/queue/semaphore.d.ts +1 -1
  244. package/dest/queue/semaphore.d.ts.map +1 -1
  245. package/dest/queue/serial_queue.d.ts +1 -1
  246. package/dest/queue/serial_queue.d.ts.map +1 -1
  247. package/dest/retry/index.d.ts +11 -1
  248. package/dest/retry/index.d.ts.map +1 -1
  249. package/dest/retry/index.js +11 -0
  250. package/dest/running-promise/index.d.ts +1 -1
  251. package/dest/schemas/api.d.ts +1 -1
  252. package/dest/schemas/index.d.ts +1 -1
  253. package/dest/schemas/parse.d.ts +1 -1
  254. package/dest/schemas/schemas.d.ts +15 -17
  255. package/dest/schemas/schemas.d.ts.map +1 -1
  256. package/dest/schemas/schemas.js +14 -10
  257. package/dest/schemas/types.d.ts +31 -1
  258. package/dest/schemas/types.d.ts.map +1 -1
  259. package/dest/schemas/types.js +25 -1
  260. package/dest/schemas/utils.d.ts +4 -4
  261. package/dest/schemas/utils.d.ts.map +1 -1
  262. package/dest/schemas/utils.js +15 -5
  263. package/dest/serialize/buffer_reader.d.ts +7 -4
  264. package/dest/serialize/buffer_reader.d.ts.map +1 -1
  265. package/dest/serialize/buffer_reader.js +13 -4
  266. package/dest/serialize/field_reader.d.ts +2 -2
  267. package/dest/serialize/field_reader.d.ts.map +1 -1
  268. package/dest/serialize/field_reader.js +1 -1
  269. package/dest/serialize/free_funcs.d.ts +2 -2
  270. package/dest/serialize/free_funcs.d.ts.map +1 -1
  271. package/dest/serialize/free_funcs.js +1 -1
  272. package/dest/serialize/index.d.ts +1 -1
  273. package/dest/serialize/serialize.d.ts +2 -2
  274. package/dest/serialize/serialize.d.ts.map +1 -1
  275. package/dest/serialize/serialize.js +1 -1
  276. package/dest/serialize/type_registry.d.ts +1 -1
  277. package/dest/serialize/type_registry.d.ts.map +1 -1
  278. package/dest/serialize/types.d.ts +1 -1
  279. package/dest/sleep/index.d.ts +3 -1
  280. package/dest/sleep/index.d.ts.map +1 -1
  281. package/dest/sleep/index.js +4 -0
  282. package/dest/string/index.d.ts +1 -1
  283. package/dest/testing/files/index.d.ts +2 -1
  284. package/dest/testing/files/index.d.ts.map +1 -1
  285. package/dest/testing/files/index.js +1 -1
  286. package/dest/testing/formatting.d.ts +1 -1
  287. package/dest/testing/index.d.ts +1 -1
  288. package/dest/testing/port_allocator.d.ts +1 -1
  289. package/dest/testing/snapshot_serializer.d.ts +1 -1
  290. package/dest/testing/test_data.d.ts +1 -1
  291. package/dest/timer/date.d.ts +2 -1
  292. package/dest/timer/date.d.ts.map +1 -1
  293. package/dest/timer/date.js +3 -0
  294. package/dest/timer/elapsed.d.ts +1 -1
  295. package/dest/timer/index.d.ts +1 -1
  296. package/dest/timer/timeout.d.ts +1 -1
  297. package/dest/timer/timeout.d.ts.map +1 -1
  298. package/dest/timer/timer.d.ts +1 -1
  299. package/dest/timer/timer.d.ts.map +1 -1
  300. package/dest/transport/dispatch/create_dispatch_fn.d.ts +1 -1
  301. package/dest/transport/dispatch/create_dispatch_fn.d.ts.map +1 -1
  302. package/dest/transport/dispatch/create_dispatch_proxy.d.ts +1 -1
  303. package/dest/transport/dispatch/messages.d.ts +1 -1
  304. package/dest/transport/index.d.ts +1 -1
  305. package/dest/transport/interface/connector.d.ts +1 -1
  306. package/dest/transport/interface/listener.d.ts +1 -1
  307. package/dest/transport/interface/socket.d.ts +1 -1
  308. package/dest/transport/interface/transferable.d.ts +1 -1
  309. package/dest/transport/node/index.d.ts +1 -1
  310. package/dest/transport/node/node_connector.d.ts +1 -1
  311. package/dest/transport/node/node_connector.d.ts.map +1 -1
  312. package/dest/transport/node/node_connector_socket.d.ts +1 -1
  313. package/dest/transport/node/node_connector_socket.d.ts.map +1 -1
  314. package/dest/transport/node/node_listener.d.ts +1 -1
  315. package/dest/transport/node/node_listener.d.ts.map +1 -1
  316. package/dest/transport/node/node_listener_socket.d.ts +1 -1
  317. package/dest/transport/node/node_listener_socket.d.ts.map +1 -1
  318. package/dest/transport/transport_client.d.ts +1 -1
  319. package/dest/transport/transport_client.d.ts.map +1 -1
  320. package/dest/transport/transport_server.d.ts +1 -10
  321. package/dest/transport/transport_server.d.ts.map +1 -1
  322. package/dest/trees/balanced_merkle_tree_root.d.ts +18 -0
  323. package/dest/trees/balanced_merkle_tree_root.d.ts.map +1 -0
  324. package/dest/trees/balanced_merkle_tree_root.js +52 -0
  325. package/dest/trees/hasher.d.ts +4 -1
  326. package/dest/trees/hasher.d.ts.map +1 -1
  327. package/dest/trees/hasher.js +15 -5
  328. package/dest/trees/index.d.ts +4 -3
  329. package/dest/trees/index.d.ts.map +1 -1
  330. package/dest/trees/index.js +3 -2
  331. package/dest/trees/indexed_merkle_tree.d.ts +1 -1
  332. package/dest/trees/indexed_merkle_tree.d.ts.map +1 -1
  333. package/dest/trees/indexed_merkle_tree.js +1 -1
  334. package/dest/trees/indexed_merkle_tree_calculator.d.ts +1 -1
  335. package/dest/trees/indexed_merkle_tree_calculator.d.ts.map +1 -1
  336. package/dest/trees/indexed_tree_leaf.d.ts +1 -1
  337. package/dest/trees/membership_witness.d.ts +3 -18
  338. package/dest/trees/membership_witness.d.ts.map +1 -1
  339. package/dest/trees/membership_witness.js +1 -1
  340. package/dest/trees/merkle_tree.d.ts +1 -1
  341. package/dest/trees/merkle_tree.d.ts.map +1 -1
  342. package/dest/trees/merkle_tree_calculator.d.ts +2 -12
  343. package/dest/trees/merkle_tree_calculator.d.ts.map +1 -1
  344. package/dest/trees/merkle_tree_calculator.js +1 -31
  345. package/dest/trees/sibling_path.d.ts +5 -38
  346. package/dest/trees/sibling_path.d.ts.map +1 -1
  347. package/dest/trees/sibling_path.js +2 -2
  348. package/dest/trees/unbalanced_merkle_tree_calculator.d.ts +6 -6
  349. package/dest/trees/unbalanced_merkle_tree_calculator.d.ts.map +1 -1
  350. package/dest/trees/unbalanced_merkle_tree_calculator.js +34 -42
  351. package/dest/trees/unbalanced_merkle_tree_root.d.ts +28 -0
  352. package/dest/trees/unbalanced_merkle_tree_root.d.ts.map +1 -0
  353. package/dest/trees/unbalanced_merkle_tree_root.js +84 -0
  354. package/dest/trees/unbalanced_tree_store.d.ts +5 -1
  355. package/dest/trees/unbalanced_tree_store.d.ts.map +1 -1
  356. package/dest/trees/unbalanced_tree_store.js +49 -1
  357. package/dest/types/index.d.ts +4 -2
  358. package/dest/types/index.d.ts.map +1 -1
  359. package/dest/types/index.js +3 -0
  360. package/dest/url/index.d.ts +1 -1
  361. package/dest/validation/index.d.ts +1 -1
  362. package/package.json +29 -9
  363. package/src/array/array.ts +0 -16
  364. package/src/array/index.ts +1 -0
  365. package/src/array/sorted_array.ts +133 -0
  366. package/src/branded-types/block_number.ts +117 -0
  367. package/src/branded-types/checkpoint_number.ts +115 -0
  368. package/src/branded-types/epoch.ts +88 -0
  369. package/src/branded-types/index.ts +7 -0
  370. package/src/branded-types/index_within_checkpoint.ts +88 -0
  371. package/src/branded-types/slot.ts +88 -0
  372. package/src/branded-types/types.ts +2 -0
  373. package/src/buffer/buffer16.ts +2 -2
  374. package/src/buffer/buffer32.ts +2 -2
  375. package/src/config/env_var.ts +41 -12
  376. package/src/config/index.ts +39 -6
  377. package/src/config/network_config.ts +2 -0
  378. package/src/config/parse-env.ts +4 -0
  379. package/src/crypto/aes128/index.ts +2 -2
  380. package/src/crypto/bls/bn254_keystore.ts +1 -1
  381. package/src/crypto/bls/index.ts +1 -1
  382. package/src/crypto/bn254/index.ts +50 -156
  383. package/src/crypto/ecdsa/index.ts +4 -4
  384. package/src/crypto/ecdsa/signature.ts +2 -2
  385. package/src/crypto/grumpkin/index.ts +8 -6
  386. package/src/crypto/keys/index.ts +2 -2
  387. package/src/crypto/pedersen/pedersen.wasm.ts +4 -4
  388. package/src/crypto/poseidon/index.ts +6 -6
  389. package/src/crypto/random/randomness_singleton.ts +2 -4
  390. package/src/crypto/schnorr/index.ts +5 -4
  391. package/src/crypto/schnorr/signature.ts +2 -2
  392. package/src/crypto/secp256k1/index.ts +3 -3
  393. package/src/crypto/sha256/index.ts +1 -1
  394. package/src/crypto/sha512/index.ts +1 -1
  395. package/src/crypto/signature/index.ts +1 -1
  396. package/src/crypto/sync/index.ts +1 -1
  397. package/src/crypto/sync/pedersen/index.ts +1 -1
  398. package/src/crypto/sync/poseidon/index.ts +1 -1
  399. package/src/{fields/bls12_fields.ts → curves/bls12/field.ts} +6 -6
  400. package/src/curves/bls12/index.ts +2 -0
  401. package/src/{fields/bls12_point.ts → curves/bls12/point.ts} +7 -7
  402. package/src/{fields/fields.ts → curves/bn254/field.ts} +49 -56
  403. package/src/curves/bn254/index.ts +2 -0
  404. package/src/curves/bn254/point.ts +170 -0
  405. package/src/curves/grumpkin/index.ts +11 -0
  406. package/src/{fields → curves/grumpkin}/point.ts +26 -7
  407. package/src/eth-address/index.ts +27 -2
  408. package/src/iterator/filter.ts +11 -0
  409. package/src/iterator/index.ts +1 -0
  410. package/src/log/pino-logger.ts +2 -1
  411. package/src/retry/index.ts +18 -0
  412. package/src/schemas/schemas.ts +24 -13
  413. package/src/schemas/types.ts +33 -0
  414. package/src/schemas/utils.ts +21 -8
  415. package/src/serialize/buffer_reader.ts +21 -9
  416. package/src/serialize/field_reader.ts +1 -1
  417. package/src/serialize/free_funcs.ts +1 -1
  418. package/src/serialize/serialize.ts +1 -1
  419. package/src/sleep/index.ts +6 -0
  420. package/src/testing/files/index.ts +1 -1
  421. package/src/timer/date.ts +4 -0
  422. package/src/trees/balanced_merkle_tree_root.ts +71 -0
  423. package/src/trees/hasher.ts +13 -0
  424. package/src/trees/index.ts +3 -2
  425. package/src/trees/indexed_merkle_tree.ts +1 -1
  426. package/src/trees/membership_witness.ts +1 -1
  427. package/src/trees/merkle_tree_calculator.ts +1 -34
  428. package/src/trees/sibling_path.ts +2 -2
  429. package/src/trees/unbalanced_merkle_tree_calculator.ts +32 -50
  430. package/src/trees/unbalanced_merkle_tree_root.ts +115 -0
  431. package/src/trees/unbalanced_tree_store.ts +57 -2
  432. package/src/types/index.ts +6 -1
  433. package/dest/crypto/bn254/bn254_utils.d.ts +0 -39
  434. package/dest/crypto/bn254/bn254_utils.d.ts.map +0 -1
  435. package/dest/crypto/bn254/bn254_utils.js +0 -56
  436. package/dest/crypto/index.d.ts +0 -17
  437. package/dest/crypto/index.d.ts.map +0 -1
  438. package/dest/crypto/index.js +0 -16
  439. package/dest/fields/bls12_fields.d.ts.map +0 -1
  440. package/dest/fields/bls12_point.d.ts.map +0 -1
  441. package/dest/fields/coordinate.d.ts +0 -66
  442. package/dest/fields/coordinate.d.ts.map +0 -1
  443. package/dest/fields/coordinate.js +0 -96
  444. package/dest/fields/fields.d.ts.map +0 -1
  445. package/dest/fields/index.d.ts +0 -6
  446. package/dest/fields/index.d.ts.map +0 -1
  447. package/dest/fields/index.js +0 -5
  448. package/dest/fields/point.d.ts.map +0 -1
  449. package/dest/index.d.ts +0 -30
  450. package/dest/index.d.ts.map +0 -1
  451. package/dest/index.js +0 -30
  452. package/dest/json-rpc/server/telemetry.d.ts +0 -2
  453. package/dest/json-rpc/server/telemetry.d.ts.map +0 -1
  454. package/dest/json-rpc/server/telemetry.js +0 -0
  455. package/dest/trees/unbalanced_merkle_tree.d.ts +0 -28
  456. package/dest/trees/unbalanced_merkle_tree.d.ts.map +0 -1
  457. package/dest/trees/unbalanced_merkle_tree.js +0 -99
  458. package/src/crypto/bn254/bn254_utils.ts +0 -64
  459. package/src/crypto/index.ts +0 -16
  460. package/src/fields/coordinate.ts +0 -104
  461. package/src/fields/index.ts +0 -5
  462. package/src/index.ts +0 -30
  463. package/src/json-rpc/server/telemetry.ts +0 -0
  464. package/src/trees/unbalanced_merkle_tree.ts +0 -111
@@ -0,0 +1,117 @@
1
+ import { z } from 'zod';
2
+
3
+ import type { CheckpointNumber } from './checkpoint_number.js';
4
+ import type { Branded } from './types.js';
5
+
6
+ /**
7
+ * A branded type representing an Aztec (L2) block number.
8
+ * Block numbers are sequential identifiers for blocks in the Aztec rollup chain.
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 EpochNumber, SlotNumber, etc.).
12
+ *
13
+ * Note: This type should ONLY be used for Aztec L2 block numbers, NOT for Ethereum L1 block numbers.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * const blockNumber = BlockNumber(100);
18
+ * const plainNumber: number = blockNumber; // OK - BlockNumber is assignable to number
19
+ * const blockFromNumber: BlockNumber = 100; // ERROR - number is not assignable to BlockNumber
20
+ * ```
21
+ */
22
+ export type BlockNumber = Branded<number, 'BlockNumber'>;
23
+
24
+ /**
25
+ * Creates a BlockNumber from a number.
26
+ * @param value - The block number (must be a non-negative integer)
27
+ * @returns The branded BlockNumber value
28
+ * @throws If the value is negative or not an integer
29
+ */
30
+ export function BlockNumber(value: number): BlockNumber {
31
+ if (!Number.isInteger(value)) {
32
+ throw new Error(`BlockNumber must be an integer, got ${value}`);
33
+ }
34
+ if (value < 0) {
35
+ throw new Error(`BlockNumber must be non-negative, got ${value}`);
36
+ }
37
+ return value as BlockNumber;
38
+ }
39
+
40
+ /**
41
+ * Creates a BlockNumber from a bigint.
42
+ * @param value - The block number as bigint (must be a non-negative integer within safe integer range)
43
+ * @returns The branded BlockNumber value
44
+ * @throws If the value is negative or exceeds Number.MAX_SAFE_INTEGER
45
+ */
46
+ BlockNumber.fromBigInt = function (value: bigint): BlockNumber {
47
+ if (value < 0n) {
48
+ throw new Error(`BlockNumber must be non-negative, got ${value}`);
49
+ }
50
+ if (value > BigInt(Number.MAX_SAFE_INTEGER)) {
51
+ throw new Error(`BlockNumber ${value} exceeds MAX_SAFE_INTEGER`);
52
+ }
53
+ return Number(value) as BlockNumber;
54
+ };
55
+
56
+ /**
57
+ * Creates a BlockNumber from a string.
58
+ * @param value - The block number as a string
59
+ * @returns The branded BlockNumber value
60
+ * @throws If the string cannot be parsed as a valid block number
61
+ */
62
+ BlockNumber.fromString = function (value: string): BlockNumber {
63
+ const parsed = parseInt(value, 10);
64
+ if (isNaN(parsed)) {
65
+ throw new Error(`Cannot parse BlockNumber from string: ${value}`);
66
+ }
67
+ return BlockNumber(parsed);
68
+ };
69
+
70
+ /**
71
+ * Converts a CheckpointNumber to a BlockNumber.
72
+ * This is used in checkpoint-based systems where checkpoint numbers align with block numbers.
73
+ * WARNING: This should only be used when you know the checkpoint number corresponds to a block number.
74
+ * @param value - The checkpoint number to convert
75
+ * @returns The corresponding BlockNumber
76
+ */
77
+ BlockNumber.fromCheckpointNumber = function (value: CheckpointNumber): BlockNumber {
78
+ return value as unknown as BlockNumber;
79
+ };
80
+
81
+ /**
82
+ * Type guard to check if a value is a valid BlockNumber.
83
+ * Note: At runtime, a BlockNumber is just a number, so this checks if the value
84
+ * is a non-negative integer.
85
+ */
86
+ BlockNumber.isValid = function (value: unknown): value is BlockNumber {
87
+ return typeof value === 'number' && Number.isInteger(value) && value >= 0;
88
+ };
89
+
90
+ /** Increments a BlockNumber by a given value. */
91
+ BlockNumber.add = function (bn: BlockNumber, increment: number): BlockNumber {
92
+ return BlockNumber(bn + increment);
93
+ };
94
+
95
+ /**
96
+ * The zero block value (genesis block).
97
+ */
98
+ BlockNumber.ZERO = BlockNumber(0);
99
+
100
+ function makeBlockNumberSchema(minValue: number) {
101
+ return z
102
+ .union([z.number(), z.bigint(), z.string()])
103
+ .pipe(z.coerce.number().int().min(minValue))
104
+ .transform(value => BlockNumber(value));
105
+ }
106
+
107
+ /**
108
+ * Zod schema for parsing and validating BlockNumber values.
109
+ * Accepts numbers, bigints, or strings and coerces them to BlockNumber.
110
+ */
111
+ export const BlockNumberSchema = makeBlockNumberSchema(0);
112
+
113
+ /**
114
+ * Zod schema for parsing and validating BlockNumber values that are strictly positive.
115
+ * Accepts numbers, bigints, or strings and coerces them to BlockNumber.
116
+ */
117
+ export const BlockNumberPositiveSchema = makeBlockNumberSchema(1);
@@ -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);
@@ -0,0 +1,88 @@
1
+ import { z } from 'zod';
2
+
3
+ import type { Branded } from './types.js';
4
+
5
+ /**
6
+ * A branded type representing an epoch number.
7
+ * Epochs are used in the Aztec protocol to group slots and manage validator committees.
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 (like Slot, BlockNumber, etc.).
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const epoch = EpochNumber(5);
15
+ * const plainNumber: number = epoch; // OK - EpochNumber is assignable to number
16
+ * const epochFromNumber: EpochNumber = 5; // ERROR - number is not assignable to EpochNumber
17
+ * ```
18
+ */
19
+ export type EpochNumber = Branded<number, 'EpochNumber'>;
20
+
21
+ /**
22
+ * Creates an EpochNumber from a number.
23
+ * @param value - The epoch number (must be a non-negative integer)
24
+ * @returns The branded EpochNumber value
25
+ * @throws If the value is negative or not an integer
26
+ */
27
+ export function EpochNumber(value: number): EpochNumber {
28
+ if (!Number.isInteger(value)) {
29
+ throw new Error(`EpochNumber must be an integer, got ${value}`);
30
+ }
31
+ if (value < 0) {
32
+ throw new Error(`EpochNumber must be non-negative, got ${value}`);
33
+ }
34
+ return value as EpochNumber;
35
+ }
36
+
37
+ /**
38
+ * Creates an EpochNumber from a bigint.
39
+ * @param value - The epoch number as bigint (must be a non-negative integer within safe integer range)
40
+ * @returns The branded EpochNumber value
41
+ * @throws If the value is negative or exceeds Number.MAX_SAFE_INTEGER
42
+ */
43
+ EpochNumber.fromBigInt = function (value: bigint): EpochNumber {
44
+ if (value < 0n) {
45
+ throw new Error(`EpochNumber must be non-negative, got ${value}`);
46
+ }
47
+ if (value > BigInt(Number.MAX_SAFE_INTEGER)) {
48
+ throw new Error(`EpochNumber ${value} exceeds MAX_SAFE_INTEGER`);
49
+ }
50
+ return Number(value) as EpochNumber;
51
+ };
52
+
53
+ /**
54
+ * Creates an EpochNumber from a string.
55
+ * @param value - The epoch number as a string
56
+ * @returns The branded EpochNumber value
57
+ * @throws If the string cannot be parsed as a valid epoch
58
+ */
59
+ EpochNumber.fromString = function (value: string): EpochNumber {
60
+ const parsed = parseInt(value, 10);
61
+ if (isNaN(parsed)) {
62
+ throw new Error(`Cannot parse EpochNumber from string: ${value}`);
63
+ }
64
+ return EpochNumber(parsed);
65
+ };
66
+
67
+ /**
68
+ * Type guard to check if a value is a valid EpochNumber.
69
+ * Note: At runtime, an EpochNumber is just a number, so this checks if the value
70
+ * is a non-negative integer.
71
+ */
72
+ EpochNumber.isValid = function (value: unknown): value is EpochNumber {
73
+ return typeof value === 'number' && Number.isInteger(value) && value >= 0;
74
+ };
75
+
76
+ /**
77
+ * The zero epoch value.
78
+ */
79
+ EpochNumber.ZERO = EpochNumber(0);
80
+
81
+ /**
82
+ * Zod schema for parsing and validating EpochNumber values.
83
+ * Accepts numbers, bigints, or strings and coerces them to EpochNumber.
84
+ */
85
+ export const EpochNumberSchema = z
86
+ .union([z.number(), z.bigint(), z.string()])
87
+ .pipe(z.coerce.number().int().min(0))
88
+ .transform(value => EpochNumber(value));
@@ -0,0 +1,7 @@
1
+ export { BlockNumber, BlockNumberSchema, BlockNumberPositiveSchema } from './block_number.js';
2
+ export { CheckpointNumber, CheckpointNumberSchema, CheckpointNumberPositiveSchema } from './checkpoint_number.js';
3
+ export { EpochNumber, EpochNumberSchema } from './epoch.js';
4
+ export { IndexWithinCheckpoint, IndexWithinCheckpointSchema } from './index_within_checkpoint.js';
5
+ export { SlotNumber, SlotNumberSchema } from './slot.js';
6
+
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));
@@ -0,0 +1,88 @@
1
+ import { z } from 'zod';
2
+
3
+ import type { Branded } from './types.js';
4
+
5
+ /**
6
+ * A branded type representing a slot number.
7
+ * Slots are the fundamental time unit in the Aztec protocol, with multiple slots comprising an epoch.
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 (like EpochNumber, BlockNumber, etc.).
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const slot = SlotNumber(5);
15
+ * const plainNumber: number = slot; // OK - SlotNumber is assignable to number
16
+ * const slotFromNumber: SlotNumber = 5; // ERROR - number is not assignable to SlotNumber
17
+ * ```
18
+ */
19
+ export type SlotNumber = Branded<number, 'SlotNumber'>;
20
+
21
+ /**
22
+ * Creates a SlotNumber from a number.
23
+ * @param value - The slot number (must be a non-negative integer)
24
+ * @returns The branded SlotNumber value
25
+ * @throws If the value is negative or not an integer
26
+ */
27
+ export function SlotNumber(value: number): SlotNumber {
28
+ if (!Number.isInteger(value)) {
29
+ throw new Error(`SlotNumber must be an integer, got ${value}`);
30
+ }
31
+ if (value < 0) {
32
+ throw new Error(`SlotNumber must be non-negative, got ${value}`);
33
+ }
34
+ return value as SlotNumber;
35
+ }
36
+
37
+ /**
38
+ * Creates a SlotNumber from a bigint.
39
+ * @param value - The slot number as bigint (must be a non-negative integer within safe integer range)
40
+ * @returns The branded SlotNumber value
41
+ * @throws If the value is negative or exceeds Number.MAX_SAFE_INTEGER
42
+ */
43
+ SlotNumber.fromBigInt = function (value: bigint): SlotNumber {
44
+ if (value < 0n) {
45
+ throw new Error(`SlotNumber must be non-negative, got ${value}`);
46
+ }
47
+ if (value > BigInt(Number.MAX_SAFE_INTEGER)) {
48
+ throw new Error(`SlotNumber ${value} exceeds MAX_SAFE_INTEGER`);
49
+ }
50
+ return Number(value) as SlotNumber;
51
+ };
52
+
53
+ /**
54
+ * Creates a SlotNumber from a string.
55
+ * @param value - The slot number as a string
56
+ * @returns The branded SlotNumber value
57
+ * @throws If the string cannot be parsed as a valid slot
58
+ */
59
+ SlotNumber.fromString = function (value: string): SlotNumber {
60
+ const parsed = parseInt(value, 10);
61
+ if (isNaN(parsed)) {
62
+ throw new Error(`Cannot parse SlotNumber from string: ${value}`);
63
+ }
64
+ return SlotNumber(parsed);
65
+ };
66
+
67
+ /**
68
+ * Type guard to check if a value is a valid SlotNumber.
69
+ * Note: At runtime, a SlotNumber is just a number, so this checks if the value
70
+ * is a non-negative integer.
71
+ */
72
+ SlotNumber.isValid = function (value: unknown): value is SlotNumber {
73
+ return typeof value === 'number' && Number.isInteger(value) && value >= 0;
74
+ };
75
+
76
+ /**
77
+ * The zero slot value.
78
+ */
79
+ SlotNumber.ZERO = SlotNumber(0);
80
+
81
+ /**
82
+ * Zod schema for parsing and validating SlotNumber values.
83
+ * Accepts numbers, bigints, or strings and coerces them to SlotNumber.
84
+ */
85
+ export const SlotNumberSchema = z
86
+ .union([z.number(), z.bigint(), z.string()])
87
+ .pipe(z.coerce.number().int().min(0))
88
+ .transform(value => SlotNumber(value));
@@ -0,0 +1,2 @@
1
+ /** Adds a branding to a type for nominal typing. */
2
+ export type Branded<T, Brand> = T & { _branding: Brand };
@@ -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';
@@ -21,12 +21,13 @@ export type EnvVar =
21
21
  | 'BB_NUM_IVC_VERIFIERS'
22
22
  | 'BB_IVC_CONCURRENCY'
23
23
  | 'BOOTSTRAP_NODES'
24
- | 'BLOB_SINK_ARCHIVE_API_URL'
25
- | 'BLOB_SINK_PORT'
26
- | 'BLOB_SINK_URL'
24
+ | 'BLOB_ARCHIVE_API_URL'
25
+ | 'BLOB_FILE_STORE_URLS'
26
+ | 'BLOB_FILE_STORE_UPLOAD_URL'
27
+ | 'BLOB_HEALTHCHECK_UPLOAD_INTERVAL_MINUTES'
27
28
  | 'BOT_DA_GAS_LIMIT'
28
29
  | 'BOT_FEE_PAYMENT_METHOD'
29
- | 'BOT_BASE_FEE_PADDING'
30
+ | 'BOT_MIN_FEE_PADDING'
30
31
  | 'BOT_FLUSH_SETUP_TRANSACTIONS'
31
32
  | 'BOT_FOLLOW_CHAIN'
32
33
  | 'BOT_L2_GAS_LIMIT'
@@ -63,8 +64,9 @@ export type EnvVar =
63
64
  | 'PUBLIC_DATA_TREE_MAP_SIZE_KB'
64
65
  | 'DEBUG'
65
66
  | 'DEBUG_P2P_DISABLE_COLOCATION_PENALTY'
66
- | 'DEPLOY_AZTEC_CONTRACTS_SALT'
67
67
  | 'ETHEREUM_HOSTS'
68
+ | 'ETHEREUM_DEBUG_HOSTS'
69
+ | 'ETHEREUM_ALLOW_NO_DEBUG_HOSTS'
68
70
  | 'FEE_RECIPIENT'
69
71
  | 'FORCE_COLOR'
70
72
  | 'GOVERNANCE_PROPOSER_PAYLOAD_ADDRESS'
@@ -86,6 +88,7 @@ export type EnvVar =
86
88
  | 'OTEL_EXPORTER_OTLP_LOGS_ENDPOINT'
87
89
  | 'OTEL_COLLECT_INTERVAL_MS'
88
90
  | 'OTEL_EXCLUDE_METRICS'
91
+ | 'OTEL_INCLUDE_METRICS'
89
92
  | 'OTEL_EXPORT_TIMEOUT_MS'
90
93
  | 'PUBLIC_OTEL_EXPORTER_OTLP_METRICS_ENDPOINT'
91
94
  | 'PUBLIC_OTEL_INCLUDE_METRICS'
@@ -130,12 +133,12 @@ export type EnvVar =
130
133
  | 'P2P_TRUSTED_PEERS'
131
134
  | 'P2P_PRIVATE_PEERS'
132
135
  | 'P2P_PREFERRED_PEERS'
133
- | 'P2P_MAX_TX_POOL_SIZE'
134
- | 'P2P_TX_POOL_OVERFLOW_FACTOR'
136
+ | 'P2P_MAX_PENDING_TX_COUNT'
135
137
  | 'P2P_SEEN_MSG_CACHE_SIZE'
136
138
  | 'P2P_DROP_TX'
137
139
  | 'P2P_DROP_TX_CHANCE'
138
140
  | 'P2P_TX_POOL_DELETE_TXS_AFTER_REORG'
141
+ | 'DEBUG_P2P_INSTRUMENT_MESSAGES'
139
142
  | 'PEER_ID_PRIVATE_KEY'
140
143
  | 'PEER_ID_PRIVATE_KEY_PATH'
141
144
  | 'PROVER_AGENT_COUNT'
@@ -164,10 +167,12 @@ export type EnvVar =
164
167
  | 'PROVER_PUBLISHER_PRIVATE_KEYS'
165
168
  | 'PROVER_PUBLISHER_ADDRESSES'
166
169
  | 'PROVER_PUBLISHER_ALLOW_INVALID_STATES'
170
+ | 'PROVER_PUBLISHER_FORWARDER_ADDRESS'
167
171
  | 'PROVER_REAL_PROOFS'
168
172
  | 'PROVER_TEST_DELAY_FACTOR'
169
173
  | 'PROVER_TEST_DELAY_MS'
170
174
  | 'PROVER_TEST_DELAY_TYPE'
175
+ | 'PROVER_TEST_VERIFICATION_DELAY_MS'
171
176
  | 'PXE_L2_BLOCK_BATCH_SIZE'
172
177
  | 'PXE_PROVER_ENABLED'
173
178
  | 'RPC_MAX_BATCH_SIZE'
@@ -187,10 +192,13 @@ export type EnvVar =
187
192
  | 'SEQ_PUBLISHER_PRIVATE_KEYS'
188
193
  | 'SEQ_PUBLISHER_ADDRESSES'
189
194
  | 'SEQ_PUBLISHER_ALLOW_INVALID_STATES'
190
- | 'SEQ_TX_POLLING_INTERVAL_MS'
195
+ | 'SEQ_PUBLISHER_FORWARDER_ADDRESS'
196
+ | 'SEQ_POLLING_INTERVAL_MS'
191
197
  | 'SEQ_ENFORCE_TIME_TABLE'
192
- | 'SEQ_MAX_L1_TX_INCLUSION_TIME_INTO_SLOT'
198
+ | 'SEQ_L1_PUBLISHING_TIME_ALLOWANCE_IN_SLOT'
193
199
  | 'SEQ_ATTESTATION_PROPAGATION_TIME'
200
+ | 'SEQ_BLOCK_DURATION_MS'
201
+ | 'SEQ_BUILD_CHECKPOINT_IF_EMPTY'
194
202
  | 'SEQ_SECONDS_BEFORE_INVALIDATING_BLOCK_AS_COMMITTEE_MEMBER'
195
203
  | 'SEQ_SECONDS_BEFORE_INVALIDATING_BLOCK_AS_NON_COMMITTEE_MEMBER'
196
204
  | 'SLASH_MIN_PENALTY_PERCENTAGE'
@@ -247,7 +255,9 @@ export type EnvVar =
247
255
  | 'AZTEC_SLOT_DURATION'
248
256
  | 'AZTEC_EPOCH_DURATION'
249
257
  | 'AZTEC_TARGET_COMMITTEE_SIZE'
250
- | 'AZTEC_LAG_IN_EPOCHS'
258
+ | 'AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET'
259
+ | 'AZTEC_LAG_IN_EPOCHS_FOR_RANDAO'
260
+ | 'AZTEC_INBOX_LAG'
251
261
  | 'AZTEC_PROOF_SUBMISSION_EPOCHS'
252
262
  | 'AZTEC_ACTIVATION_THRESHOLD'
253
263
  | 'AZTEC_EJECTION_THRESHOLD'
@@ -267,13 +277,18 @@ export type EnvVar =
267
277
  | 'AZTEC_SLASHER_FLAVOR'
268
278
  | 'AZTEC_GOVERNANCE_PROPOSER_QUORUM'
269
279
  | 'AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE'
280
+ | 'AZTEC_GOVERNANCE_VOTING_DURATION'
270
281
  | 'AZTEC_EXIT_DELAY_SECONDS'
271
282
  | 'L1_GAS_LIMIT_BUFFER_PERCENTAGE'
272
283
  | 'L1_GAS_PRICE_MAX'
284
+ | 'L1_FEE_PER_GAS_GWEI_MAX'
273
285
  | 'L1_BLOB_FEE_PER_GAS_MAX'
286
+ | 'L1_BLOB_FEE_PER_GAS_GWEI_MAX'
274
287
  | 'L1_PRIORITY_FEE_BUMP_PERCENTAGE'
275
288
  | 'L1_PRIORITY_FEE_RETRY_BUMP_PERCENTAGE'
289
+ | 'L1_MINIMUM_PRIORITY_FEE_PER_GAS_GWEI'
276
290
  | 'L1_FIXED_PRIORITY_FEE_PER_GAS'
291
+ | 'L1_FIXED_PRIORITY_FEE_PER_GAS_GWEI'
277
292
  | 'L1_TX_MONITOR_MAX_ATTEMPTS'
278
293
  | 'L1_TX_MONITOR_CHECK_INTERVAL_MS'
279
294
  | 'L1_TX_MONITOR_STALL_TIME_MS'
@@ -289,9 +304,23 @@ export type EnvVar =
289
304
  | 'K8S_POD_UID'
290
305
  | 'K8S_NAMESPACE_NAME'
291
306
  | 'VALIDATOR_REEXECUTE_DEADLINE_MS'
292
- | 'ALWAYS_REEXECUTE_BLOCK_PROPOSALS'
293
307
  | 'AUTO_UPDATE'
294
308
  | 'AUTO_UPDATE_URL'
295
309
  | 'WEB3_SIGNER_URL'
296
310
  | 'SKIP_ARCHIVER_INITIAL_SYNC'
297
- | 'BLOB_ALLOW_EMPTY_SOURCES';
311
+ | 'BLOB_ALLOW_EMPTY_SOURCES'
312
+ | 'FISHERMAN_MODE'
313
+ | 'MAX_ALLOWED_ETH_CLIENT_DRIFT_SECONDS'
314
+ | 'LEGACY_BLS_CLI'
315
+ | 'DEBUG_FORCE_TX_PROOF_VERIFICATION'
316
+ | 'VALIDATOR_HA_SIGNING_ENABLED'
317
+ | 'VALIDATOR_HA_NODE_ID'
318
+ | 'VALIDATOR_HA_POLLING_INTERVAL_MS'
319
+ | 'VALIDATOR_HA_SIGNING_TIMEOUT_MS'
320
+ | 'VALIDATOR_HA_MAX_STUCK_DUTIES_AGE_MS'
321
+ | 'VALIDATOR_HA_DATABASE_URL'
322
+ | 'VALIDATOR_HA_RUN_MIGRATIONS'
323
+ | 'VALIDATOR_HA_POOL_MAX'
324
+ | 'VALIDATOR_HA_POOL_MIN'
325
+ | 'VALIDATOR_HA_POOL_IDLE_TIMEOUT_MS'
326
+ | 'VALIDATOR_HA_POOL_CONNECTION_TIMEOUT_MS';