@aztec-labs/foundation 6.0.0-nightly.20260829

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 (805) hide show
  1. package/README.md +1 -0
  2. package/dest/array/array.d.ts +68 -0
  3. package/dest/array/array.d.ts.map +1 -0
  4. package/dest/array/array.js +100 -0
  5. package/dest/array/index.d.ts +3 -0
  6. package/dest/array/index.d.ts.map +1 -0
  7. package/dest/array/index.js +2 -0
  8. package/dest/array/sorted_array.d.ts +15 -0
  9. package/dest/array/sorted_array.d.ts.map +1 -0
  10. package/dest/array/sorted_array.js +109 -0
  11. package/dest/async-map/index.d.ts +13 -0
  12. package/dest/async-map/index.d.ts.map +1 -0
  13. package/dest/async-map/index.js +17 -0
  14. package/dest/async-pool/index.d.ts +3 -0
  15. package/dest/async-pool/index.d.ts.map +1 -0
  16. package/dest/async-pool/index.js +48 -0
  17. package/dest/bigint/index.d.ts +7 -0
  18. package/dest/bigint/index.d.ts.map +1 -0
  19. package/dest/bigint/index.js +15 -0
  20. package/dest/bigint-buffer/index.d.ts +40 -0
  21. package/dest/bigint-buffer/index.d.ts.map +1 -0
  22. package/dest/bigint-buffer/index.js +81 -0
  23. package/dest/branded-types/block_number.d.ts +56 -0
  24. package/dest/branded-types/block_number.d.ts.map +1 -0
  25. package/dest/branded-types/block_number.js +89 -0
  26. package/dest/branded-types/buffer32_hash.d.ts +27 -0
  27. package/dest/branded-types/buffer32_hash.d.ts.map +1 -0
  28. package/dest/branded-types/buffer32_hash.js +12 -0
  29. package/dest/branded-types/checkpoint_number.d.ts +60 -0
  30. package/dest/branded-types/checkpoint_number.d.ts.map +1 -0
  31. package/dest/branded-types/checkpoint_number.js +88 -0
  32. package/dest/branded-types/epoch.d.ts +42 -0
  33. package/dest/branded-types/epoch.d.ts.map +1 -0
  34. package/dest/branded-types/epoch.js +59 -0
  35. package/dest/branded-types/index.d.ts +8 -0
  36. package/dest/branded-types/index.d.ts.map +1 -0
  37. package/dest/branded-types/index.js +6 -0
  38. package/dest/branded-types/index_within_checkpoint.d.ts +42 -0
  39. package/dest/branded-types/index_within_checkpoint.d.ts.map +1 -0
  40. package/dest/branded-types/index_within_checkpoint.js +59 -0
  41. package/dest/branded-types/slot.d.ts +45 -0
  42. package/dest/branded-types/slot.d.ts.map +1 -0
  43. package/dest/branded-types/slot.js +62 -0
  44. package/dest/branded-types/types.d.ts +5 -0
  45. package/dest/branded-types/types.d.ts.map +1 -0
  46. package/dest/branded-types/types.js +1 -0
  47. package/dest/buffer/buffer16.d.ts +82 -0
  48. package/dest/buffer/buffer16.d.ts.map +1 -0
  49. package/dest/buffer/buffer16.js +102 -0
  50. package/dest/buffer/buffer32.d.ts +54 -0
  51. package/dest/buffer/buffer32.d.ts.map +1 -0
  52. package/dest/buffer/buffer32.js +83 -0
  53. package/dest/buffer/index.d.ts +4 -0
  54. package/dest/buffer/index.d.ts.map +1 -0
  55. package/dest/buffer/index.js +3 -0
  56. package/dest/buffer/utils.d.ts +3 -0
  57. package/dest/buffer/utils.d.ts.map +1 -0
  58. package/dest/buffer/utils.js +7 -0
  59. package/dest/collection/array.d.ts +135 -0
  60. package/dest/collection/array.d.ts.map +1 -0
  61. package/dest/collection/array.js +302 -0
  62. package/dest/collection/index.d.ts +5 -0
  63. package/dest/collection/index.d.ts.map +1 -0
  64. package/dest/collection/index.js +4 -0
  65. package/dest/collection/lru_map.d.ts +41 -0
  66. package/dest/collection/lru_map.d.ts.map +1 -0
  67. package/dest/collection/lru_map.js +119 -0
  68. package/dest/collection/lru_set.d.ts +35 -0
  69. package/dest/collection/lru_set.d.ts.map +1 -0
  70. package/dest/collection/lru_set.js +95 -0
  71. package/dest/collection/object.d.ts +30 -0
  72. package/dest/collection/object.d.ts.map +1 -0
  73. package/dest/collection/object.js +57 -0
  74. package/dest/committable/committable.d.ts +28 -0
  75. package/dest/committable/committable.d.ts.map +1 -0
  76. package/dest/committable/committable.js +36 -0
  77. package/dest/committable/index.d.ts +2 -0
  78. package/dest/committable/index.d.ts.map +1 -0
  79. package/dest/committable/index.js +1 -0
  80. package/dest/config/env_var.d.ts +2 -0
  81. package/dest/config/env_var.d.ts.map +1 -0
  82. package/dest/config/env_var.js +1 -0
  83. package/dest/config/index.d.ts +154 -0
  84. package/dest/config/index.d.ts.map +1 -0
  85. package/dest/config/index.js +272 -0
  86. package/dest/config/network_config.d.ts +28 -0
  87. package/dest/config/network_config.d.ts.map +1 -0
  88. package/dest/config/network_config.js +14 -0
  89. package/dest/config/network_name.d.ts +3 -0
  90. package/dest/config/network_name.d.ts.map +1 -0
  91. package/dest/config/network_name.js +19 -0
  92. package/dest/config/parse-env.d.ts +3 -0
  93. package/dest/config/parse-env.d.ts.map +1 -0
  94. package/dest/config/parse-env.js +7 -0
  95. package/dest/config/secret_value.d.ts +28 -0
  96. package/dest/config/secret_value.d.ts.map +1 -0
  97. package/dest/config/secret_value.js +36 -0
  98. package/dest/crypto/aes128/index.d.ts +33 -0
  99. package/dest/crypto/aes128/index.d.ts.map +1 -0
  100. package/dest/crypto/aes128/index.js +71 -0
  101. package/dest/crypto/bls/bn254_keystore.d.ts +129 -0
  102. package/dest/crypto/bls/bn254_keystore.d.ts.map +1 -0
  103. package/dest/crypto/bls/bn254_keystore.js +206 -0
  104. package/dest/crypto/bls/index.d.ts +13 -0
  105. package/dest/crypto/bls/index.d.ts.map +1 -0
  106. package/dest/crypto/bls/index.js +87 -0
  107. package/dest/crypto/bn254/index.d.ts +39 -0
  108. package/dest/crypto/bn254/index.d.ts.map +1 -0
  109. package/dest/crypto/bn254/index.js +56 -0
  110. package/dest/crypto/ecdsa/index.d.ts +39 -0
  111. package/dest/crypto/ecdsa/index.d.ts.map +1 -0
  112. package/dest/crypto/ecdsa/index.js +102 -0
  113. package/dest/crypto/ecdsa/signature.d.ts +69 -0
  114. package/dest/crypto/ecdsa/signature.d.ts.map +1 -0
  115. package/dest/crypto/ecdsa/signature.js +92 -0
  116. package/dest/crypto/grumpkin/index.d.ts +42 -0
  117. package/dest/crypto/grumpkin/index.d.ts.map +1 -0
  118. package/dest/crypto/grumpkin/index.js +160 -0
  119. package/dest/crypto/keccak/index.d.ts +26 -0
  120. package/dest/crypto/keccak/index.d.ts.map +1 -0
  121. package/dest/crypto/keccak/index.js +248 -0
  122. package/dest/crypto/keys/index.d.ts +4 -0
  123. package/dest/crypto/keys/index.d.ts.map +1 -0
  124. package/dest/crypto/keys/index.js +34 -0
  125. package/dest/crypto/pedersen/index.d.ts +2 -0
  126. package/dest/crypto/pedersen/index.d.ts.map +1 -0
  127. package/dest/crypto/pedersen/index.js +1 -0
  128. package/dest/crypto/pedersen/pedersen.noble.d.ts +9 -0
  129. package/dest/crypto/pedersen/pedersen.noble.d.ts.map +1 -0
  130. package/dest/crypto/pedersen/pedersen.noble.js +558 -0
  131. package/dest/crypto/pedersen/pedersen.wasm.d.ts +19 -0
  132. package/dest/crypto/pedersen/pedersen.wasm.d.ts.map +1 -0
  133. package/dest/crypto/pedersen/pedersen.wasm.js +51 -0
  134. package/dest/crypto/poseidon/index.d.ts +23 -0
  135. package/dest/crypto/poseidon/index.d.ts.map +1 -0
  136. package/dest/crypto/poseidon/index.js +71 -0
  137. package/dest/crypto/random/index.d.ts +23 -0
  138. package/dest/crypto/random/index.d.ts.map +1 -0
  139. package/dest/crypto/random/index.js +38 -0
  140. package/dest/crypto/random/randomness_singleton.d.ts +24 -0
  141. package/dest/crypto/random/randomness_singleton.d.ts.map +1 -0
  142. package/dest/crypto/random/randomness_singleton.js +55 -0
  143. package/dest/crypto/schnorr/index.d.ts +32 -0
  144. package/dest/crypto/schnorr/index.d.ts.map +1 -0
  145. package/dest/crypto/schnorr/index.js +60 -0
  146. package/dest/crypto/schnorr/signature.d.ts +48 -0
  147. package/dest/crypto/schnorr/signature.d.ts.map +1 -0
  148. package/dest/crypto/schnorr/signature.js +77 -0
  149. package/dest/crypto/secp256k1/index.d.ts +30 -0
  150. package/dest/crypto/secp256k1/index.d.ts.map +1 -0
  151. package/dest/crypto/secp256k1/index.js +121 -0
  152. package/dest/crypto/secp256k1-signer/index.d.ts +3 -0
  153. package/dest/crypto/secp256k1-signer/index.d.ts.map +1 -0
  154. package/dest/crypto/secp256k1-signer/index.js +2 -0
  155. package/dest/crypto/secp256k1-signer/secp256k1_signer.d.ts +24 -0
  156. package/dest/crypto/secp256k1-signer/secp256k1_signer.d.ts.map +1 -0
  157. package/dest/crypto/secp256k1-signer/secp256k1_signer.js +30 -0
  158. package/dest/crypto/secp256k1-signer/utils.d.ts +102 -0
  159. package/dest/crypto/secp256k1-signer/utils.d.ts.map +1 -0
  160. package/dest/crypto/secp256k1-signer/utils.js +196 -0
  161. package/dest/crypto/sha256/index.d.ts +37 -0
  162. package/dest/crypto/sha256/index.d.ts.map +1 -0
  163. package/dest/crypto/sha256/index.js +208 -0
  164. package/dest/crypto/sha512/index.d.ts +9 -0
  165. package/dest/crypto/sha512/index.d.ts.map +1 -0
  166. package/dest/crypto/sha512/index.js +12 -0
  167. package/dest/crypto/signature/index.d.ts +17 -0
  168. package/dest/crypto/signature/index.d.ts.map +1 -0
  169. package/dest/crypto/signature/index.js +3 -0
  170. package/dest/crypto/sync/index.d.ts +3 -0
  171. package/dest/crypto/sync/index.d.ts.map +1 -0
  172. package/dest/crypto/sync/index.js +4 -0
  173. package/dest/crypto/sync/pedersen/index.d.ts +19 -0
  174. package/dest/crypto/sync/pedersen/index.d.ts.map +1 -0
  175. package/dest/crypto/sync/pedersen/index.js +45 -0
  176. package/dest/crypto/sync/poseidon/index.d.ts +23 -0
  177. package/dest/crypto/sync/poseidon/index.d.ts.map +1 -0
  178. package/dest/crypto/sync/poseidon/index.js +60 -0
  179. package/dest/curves/bls12/field.d.ts +148 -0
  180. package/dest/curves/bls12/field.d.ts.map +1 -0
  181. package/dest/curves/bls12/field.js +357 -0
  182. package/dest/curves/bls12/index.d.ts +3 -0
  183. package/dest/curves/bls12/index.d.ts.map +1 -0
  184. package/dest/curves/bls12/index.js +2 -0
  185. package/dest/curves/bls12/point.d.ts +229 -0
  186. package/dest/curves/bls12/point.d.ts.map +1 -0
  187. package/dest/curves/bls12/point.js +400 -0
  188. package/dest/curves/bn254/field.d.ts +185 -0
  189. package/dest/curves/bn254/field.d.ts.map +1 -0
  190. package/dest/curves/bn254/field.js +420 -0
  191. package/dest/curves/bn254/index.d.ts +3 -0
  192. package/dest/curves/bn254/index.d.ts.map +1 -0
  193. package/dest/curves/bn254/index.js +2 -0
  194. package/dest/curves/bn254/point.d.ts +54 -0
  195. package/dest/curves/bn254/point.d.ts.map +1 -0
  196. package/dest/curves/bn254/point.js +143 -0
  197. package/dest/curves/grumpkin/index.d.ts +10 -0
  198. package/dest/curves/grumpkin/index.d.ts.map +1 -0
  199. package/dest/curves/grumpkin/index.js +3 -0
  200. package/dest/curves/grumpkin/point.d.ts +168 -0
  201. package/dest/curves/grumpkin/point.d.ts.map +1 -0
  202. package/dest/curves/grumpkin/point.js +263 -0
  203. package/dest/decorators/index.d.ts +2 -0
  204. package/dest/decorators/index.d.ts.map +1 -0
  205. package/dest/decorators/index.js +1 -0
  206. package/dest/decorators/memoize.d.ts +2 -0
  207. package/dest/decorators/memoize.d.ts.map +1 -0
  208. package/dest/decorators/memoize.js +11 -0
  209. package/dest/error/index.d.ts +21 -0
  210. package/dest/error/index.d.ts.map +1 -0
  211. package/dest/error/index.js +17 -0
  212. package/dest/eth-address/index.d.ts +143 -0
  213. package/dest/eth-address/index.d.ts.map +1 -0
  214. package/dest/eth-address/index.js +224 -0
  215. package/dest/eth-signature/eth_signature.d.ts +65 -0
  216. package/dest/eth-signature/eth_signature.d.ts.map +1 -0
  217. package/dest/eth-signature/eth_signature.js +110 -0
  218. package/dest/eth-signature/index.d.ts +2 -0
  219. package/dest/eth-signature/index.d.ts.map +1 -0
  220. package/dest/eth-signature/index.js +1 -0
  221. package/dest/fifo/fifo_frame_reader.d.ts +41 -0
  222. package/dest/fifo/fifo_frame_reader.d.ts.map +1 -0
  223. package/dest/fifo/fifo_frame_reader.js +91 -0
  224. package/dest/fifo/index.d.ts +2 -0
  225. package/dest/fifo/index.d.ts.map +1 -0
  226. package/dest/fifo/index.js +1 -0
  227. package/dest/fifo_set/fifo_set.d.ts +15 -0
  228. package/dest/fifo_set/fifo_set.d.ts.map +1 -0
  229. package/dest/fifo_set/fifo_set.js +39 -0
  230. package/dest/fifo_set/index.d.ts +2 -0
  231. package/dest/fifo_set/index.d.ts.map +1 -0
  232. package/dest/fifo_set/index.js +1 -0
  233. package/dest/fs/index.d.ts +3 -0
  234. package/dest/fs/index.d.ts.map +1 -0
  235. package/dest/fs/index.js +2 -0
  236. package/dest/fs/run_in_dir.d.ts +2 -0
  237. package/dest/fs/run_in_dir.d.ts.map +1 -0
  238. package/dest/fs/run_in_dir.js +31 -0
  239. package/dest/fs/try_rm_dir.d.ts +3 -0
  240. package/dest/fs/try_rm_dir.d.ts.map +1 -0
  241. package/dest/fs/try_rm_dir.js +16 -0
  242. package/dest/iterable/all.d.ts +9 -0
  243. package/dest/iterable/all.d.ts.map +1 -0
  244. package/dest/iterable/all.js +18 -0
  245. package/dest/iterable/filter.d.ts +10 -0
  246. package/dest/iterable/filter.d.ts.map +1 -0
  247. package/dest/iterable/filter.js +48 -0
  248. package/dest/iterable/first.d.ts +8 -0
  249. package/dest/iterable/first.d.ts.map +1 -0
  250. package/dest/iterable/first.js +11 -0
  251. package/dest/iterable/index.d.ts +9 -0
  252. package/dest/iterable/index.d.ts.map +1 -0
  253. package/dest/iterable/index.js +8 -0
  254. package/dest/iterable/isAsyncIt.d.ts +7 -0
  255. package/dest/iterable/isAsyncIt.d.ts.map +1 -0
  256. package/dest/iterable/isAsyncIt.js +7 -0
  257. package/dest/iterable/map.d.ts +12 -0
  258. package/dest/iterable/map.d.ts.map +1 -0
  259. package/dest/iterable/map.js +36 -0
  260. package/dest/iterable/peek.d.ts +19 -0
  261. package/dest/iterable/peek.d.ts.map +1 -0
  262. package/dest/iterable/peek.js +33 -0
  263. package/dest/iterable/sort.d.ts +14 -0
  264. package/dest/iterable/sort.d.ts.map +1 -0
  265. package/dest/iterable/sort.js +15 -0
  266. package/dest/iterable/take.d.ts +10 -0
  267. package/dest/iterable/take.d.ts.map +1 -0
  268. package/dest/iterable/take.js +32 -0
  269. package/dest/iterable/toArray.d.ts +2 -0
  270. package/dest/iterable/toArray.d.ts.map +1 -0
  271. package/dest/iterable/toArray.js +7 -0
  272. package/dest/iterator/filter.d.ts +3 -0
  273. package/dest/iterator/filter.d.ts.map +1 -0
  274. package/dest/iterator/filter.js +7 -0
  275. package/dest/iterator/index.d.ts +2 -0
  276. package/dest/iterator/index.d.ts.map +1 -0
  277. package/dest/iterator/index.js +1 -0
  278. package/dest/jest/env.js +48 -0
  279. package/dest/jest/setup.js +34 -0
  280. package/dest/jest/setupAfterEnv.js +3 -0
  281. package/dest/json-rpc/client/fetch.d.ts +37 -0
  282. package/dest/json-rpc/client/fetch.d.ts.map +1 -0
  283. package/dest/json-rpc/client/fetch.js +67 -0
  284. package/dest/json-rpc/client/index.d.ts +3 -0
  285. package/dest/json-rpc/client/index.d.ts.map +1 -0
  286. package/dest/json-rpc/client/index.js +2 -0
  287. package/dest/json-rpc/client/safe_json_rpc_client.d.ts +33 -0
  288. package/dest/json-rpc/client/safe_json_rpc_client.d.ts.map +1 -0
  289. package/dest/json-rpc/client/safe_json_rpc_client.js +218 -0
  290. package/dest/json-rpc/client/undici.d.ts +16 -0
  291. package/dest/json-rpc/client/undici.d.ts.map +1 -0
  292. package/dest/json-rpc/client/undici.js +112 -0
  293. package/dest/json-rpc/convert.d.ts +20 -0
  294. package/dest/json-rpc/convert.d.ts.map +1 -0
  295. package/dest/json-rpc/convert.js +40 -0
  296. package/dest/json-rpc/errors.d.ts +4 -0
  297. package/dest/json-rpc/errors.d.ts.map +1 -0
  298. package/dest/json-rpc/errors.js +6 -0
  299. package/dest/json-rpc/fixtures/class_a.d.ts +13 -0
  300. package/dest/json-rpc/fixtures/class_a.d.ts.map +1 -0
  301. package/dest/json-rpc/fixtures/class_a.js +20 -0
  302. package/dest/json-rpc/fixtures/class_b.d.ts +13 -0
  303. package/dest/json-rpc/fixtures/class_b.d.ts.map +1 -0
  304. package/dest/json-rpc/fixtures/class_b.js +20 -0
  305. package/dest/json-rpc/fixtures/test_state.d.ts +85 -0
  306. package/dest/json-rpc/fixtures/test_state.d.ts.map +1 -0
  307. package/dest/json-rpc/fixtures/test_state.js +171 -0
  308. package/dest/json-rpc/index.d.ts +3 -0
  309. package/dest/json-rpc/index.d.ts.map +1 -0
  310. package/dest/json-rpc/index.js +2 -0
  311. package/dest/json-rpc/js_utils.d.ts +13 -0
  312. package/dest/json-rpc/js_utils.d.ts.map +1 -0
  313. package/dest/json-rpc/js_utils.js +16 -0
  314. package/dest/json-rpc/server/api_key_auth.d.ts +19 -0
  315. package/dest/json-rpc/server/api_key_auth.d.ts.map +1 -0
  316. package/dest/json-rpc/server/api_key_auth.js +57 -0
  317. package/dest/json-rpc/server/index.d.ts +3 -0
  318. package/dest/json-rpc/server/index.d.ts.map +1 -0
  319. package/dest/json-rpc/server/index.js +2 -0
  320. package/dest/json-rpc/server/safe_json_rpc_server.d.ts +177 -0
  321. package/dest/json-rpc/server/safe_json_rpc_server.d.ts.map +1 -0
  322. package/dest/json-rpc/server/safe_json_rpc_server.js +570 -0
  323. package/dest/json-rpc/test/index.d.ts +2 -0
  324. package/dest/json-rpc/test/index.d.ts.map +1 -0
  325. package/dest/json-rpc/test/index.js +1 -0
  326. package/dest/json-rpc/test/integration.d.ts +14 -0
  327. package/dest/json-rpc/test/integration.d.ts.map +1 -0
  328. package/dest/json-rpc/test/integration.js +21 -0
  329. package/dest/log/aws-logger-config.d.ts +8 -0
  330. package/dest/log/aws-logger-config.d.ts.map +1 -0
  331. package/dest/log/aws-logger-config.js +55 -0
  332. package/dest/log/bigint-utils.d.ts +5 -0
  333. package/dest/log/bigint-utils.d.ts.map +1 -0
  334. package/dest/log/bigint-utils.js +21 -0
  335. package/dest/log/console.d.ts +11 -0
  336. package/dest/log/console.d.ts.map +1 -0
  337. package/dest/log/console.js +36 -0
  338. package/dest/log/gcloud-logger-config.d.ts +13 -0
  339. package/dest/log/gcloud-logger-config.d.ts.map +1 -0
  340. package/dest/log/gcloud-logger-config.js +61 -0
  341. package/dest/log/index.d.ts +7 -0
  342. package/dest/log/index.d.ts.map +1 -0
  343. package/dest/log/index.js +6 -0
  344. package/dest/log/libp2p_logger.d.ts +10 -0
  345. package/dest/log/libp2p_logger.d.ts.map +1 -0
  346. package/dest/log/libp2p_logger.js +76 -0
  347. package/dest/log/log-filters.d.ts +20 -0
  348. package/dest/log/log-filters.d.ts.map +1 -0
  349. package/dest/log/log-filters.js +73 -0
  350. package/dest/log/log-levels.d.ts +3 -0
  351. package/dest/log/log-levels.d.ts.map +1 -0
  352. package/dest/log/log-levels.js +10 -0
  353. package/dest/log/log_fn.d.ts +7 -0
  354. package/dest/log/log_fn.d.ts.map +1 -0
  355. package/dest/log/log_fn.js +1 -0
  356. package/dest/log/noir_debug_log_util.d.ts +14 -0
  357. package/dest/log/noir_debug_log_util.d.ts.map +1 -0
  358. package/dest/log/noir_debug_log_util.js +14 -0
  359. package/dest/log/pino-logger-server.d.ts +9 -0
  360. package/dest/log/pino-logger-server.d.ts.map +1 -0
  361. package/dest/log/pino-logger-server.js +18 -0
  362. package/dest/log/pino-logger.d.ts +86 -0
  363. package/dest/log/pino-logger.d.ts.map +1 -0
  364. package/dest/log/pino-logger.js +347 -0
  365. package/dest/message/index.d.ts +32 -0
  366. package/dest/message/index.d.ts.map +1 -0
  367. package/dest/message/index.js +27 -0
  368. package/dest/mutex/index.d.ts +53 -0
  369. package/dest/mutex/index.d.ts.map +1 -0
  370. package/dest/mutex/index.js +78 -0
  371. package/dest/mutex/mutex_database.d.ts +10 -0
  372. package/dest/mutex/mutex_database.d.ts.map +1 -0
  373. package/dest/mutex/mutex_database.js +4 -0
  374. package/dest/noir/index.d.ts +2 -0
  375. package/dest/noir/index.d.ts.map +1 -0
  376. package/dest/noir/index.js +1 -0
  377. package/dest/noir/noir_package_config.d.ts +44 -0
  378. package/dest/noir/noir_package_config.d.ts.map +1 -0
  379. package/dest/noir/noir_package_config.js +36 -0
  380. package/dest/number/index.d.ts +3 -0
  381. package/dest/number/index.d.ts.map +1 -0
  382. package/dest/number/index.js +12 -0
  383. package/dest/profiler/index.d.ts +2 -0
  384. package/dest/profiler/index.d.ts.map +1 -0
  385. package/dest/profiler/index.js +1 -0
  386. package/dest/profiler/profiler.d.ts +8 -0
  387. package/dest/profiler/profiler.d.ts.map +1 -0
  388. package/dest/profiler/profiler.js +97 -0
  389. package/dest/promise/index.d.ts +3 -0
  390. package/dest/promise/index.d.ts.map +1 -0
  391. package/dest/promise/index.js +2 -0
  392. package/dest/promise/running-promise.d.ts +53 -0
  393. package/dest/promise/running-promise.d.ts.map +1 -0
  394. package/dest/promise/running-promise.js +122 -0
  395. package/dest/promise/utils.d.ts +25 -0
  396. package/dest/promise/utils.d.ts.map +1 -0
  397. package/dest/promise/utils.js +40 -0
  398. package/dest/queue/base_memory_queue.d.ts +65 -0
  399. package/dest/queue/base_memory_queue.d.ts.map +1 -0
  400. package/dest/queue/base_memory_queue.js +116 -0
  401. package/dest/queue/batch_queue.d.ts +47 -0
  402. package/dest/queue/batch_queue.d.ts.map +1 -0
  403. package/dest/queue/batch_queue.js +106 -0
  404. package/dest/queue/bounded_serial_queue.d.ts +56 -0
  405. package/dest/queue/bounded_serial_queue.d.ts.map +1 -0
  406. package/dest/queue/bounded_serial_queue.js +84 -0
  407. package/dest/queue/fifo_memory_queue.d.ts +21 -0
  408. package/dest/queue/fifo_memory_queue.d.ts.map +1 -0
  409. package/dest/queue/fifo_memory_queue.js +29 -0
  410. package/dest/queue/index.d.ts +7 -0
  411. package/dest/queue/index.d.ts.map +1 -0
  412. package/dest/queue/index.js +6 -0
  413. package/dest/queue/priority_memory_queue.d.ts +13 -0
  414. package/dest/queue/priority_memory_queue.d.ts.map +1 -0
  415. package/dest/queue/priority_memory_queue.js +16 -0
  416. package/dest/queue/priority_queue.d.ts +14 -0
  417. package/dest/queue/priority_queue.d.ts.map +1 -0
  418. package/dest/queue/priority_queue.js +29 -0
  419. package/dest/queue/semaphore.d.ts +27 -0
  420. package/dest/queue/semaphore.d.ts.map +1 -0
  421. package/dest/queue/semaphore.js +26 -0
  422. package/dest/queue/serial_queue.d.ts +49 -0
  423. package/dest/queue/serial_queue.d.ts.map +1 -0
  424. package/dest/queue/serial_queue.js +74 -0
  425. package/dest/retry/index.d.ts +83 -0
  426. package/dest/retry/index.d.ts.map +1 -0
  427. package/dest/retry/index.js +146 -0
  428. package/dest/running-promise/index.d.ts +2 -0
  429. package/dest/running-promise/index.d.ts.map +1 -0
  430. package/dest/running-promise/index.js +1 -0
  431. package/dest/schemas/api.d.ts +23 -0
  432. package/dest/schemas/api.d.ts.map +1 -0
  433. package/dest/schemas/api.js +9 -0
  434. package/dest/schemas/index.d.ts +6 -0
  435. package/dest/schemas/index.d.ts.map +1 -0
  436. package/dest/schemas/index.js +5 -0
  437. package/dest/schemas/parse.d.ts +9 -0
  438. package/dest/schemas/parse.d.ts.map +1 -0
  439. package/dest/schemas/parse.js +23 -0
  440. package/dest/schemas/schemas.d.ts +46 -0
  441. package/dest/schemas/schemas.d.ts.map +1 -0
  442. package/dest/schemas/schemas.js +56 -0
  443. package/dest/schemas/types.d.ts +33 -0
  444. package/dest/schemas/types.d.ts.map +1 -0
  445. package/dest/schemas/types.js +25 -0
  446. package/dest/schemas/utils.d.ts +47 -0
  447. package/dest/schemas/utils.d.ts.map +1 -0
  448. package/dest/schemas/utils.js +54 -0
  449. package/dest/serialize/buffer_reader.d.ts +274 -0
  450. package/dest/serialize/buffer_reader.d.ts.map +1 -0
  451. package/dest/serialize/buffer_reader.js +359 -0
  452. package/dest/serialize/buffer_sink.d.ts +134 -0
  453. package/dest/serialize/buffer_sink.d.ts.map +1 -0
  454. package/dest/serialize/buffer_sink.js +297 -0
  455. package/dest/serialize/field_reader.d.ts +121 -0
  456. package/dest/serialize/field_reader.d.ts.map +1 -0
  457. package/dest/serialize/field_reader.js +164 -0
  458. package/dest/serialize/free_funcs.d.ts +107 -0
  459. package/dest/serialize/free_funcs.d.ts.map +1 -0
  460. package/dest/serialize/free_funcs.js +183 -0
  461. package/dest/serialize/index.d.ts +8 -0
  462. package/dest/serialize/index.d.ts.map +1 -0
  463. package/dest/serialize/index.js +7 -0
  464. package/dest/serialize/serialize.d.ts +168 -0
  465. package/dest/serialize/serialize.d.ts.map +1 -0
  466. package/dest/serialize/serialize.js +258 -0
  467. package/dest/serialize/type_registry.d.ts +23 -0
  468. package/dest/serialize/type_registry.d.ts.map +1 -0
  469. package/dest/serialize/type_registry.js +61 -0
  470. package/dest/serialize/types.d.ts +33 -0
  471. package/dest/serialize/types.d.ts.map +1 -0
  472. package/dest/serialize/types.js +21 -0
  473. package/dest/sleep/index.d.ts +54 -0
  474. package/dest/sleep/index.d.ts.map +1 -0
  475. package/dest/sleep/index.js +80 -0
  476. package/dest/string/index.d.ts +18 -0
  477. package/dest/string/index.d.ts.map +1 -0
  478. package/dest/string/index.js +62 -0
  479. package/dest/testing/files/index.d.ts +20 -0
  480. package/dest/testing/files/index.d.ts.map +1 -0
  481. package/dest/testing/files/index.js +59 -0
  482. package/dest/testing/formatting.d.ts +4 -0
  483. package/dest/testing/formatting.d.ts.map +1 -0
  484. package/dest/testing/formatting.js +3 -0
  485. package/dest/testing/index.d.ts +5 -0
  486. package/dest/testing/index.d.ts.map +1 -0
  487. package/dest/testing/index.js +4 -0
  488. package/dest/testing/port_allocator.d.ts +10 -0
  489. package/dest/testing/port_allocator.d.ts.map +1 -0
  490. package/dest/testing/port_allocator.js +29 -0
  491. package/dest/testing/snapshot_serializer.d.ts +5 -0
  492. package/dest/testing/snapshot_serializer.d.ts.map +1 -0
  493. package/dest/testing/snapshot_serializer.js +32 -0
  494. package/dest/testing/test_data.d.ts +7 -0
  495. package/dest/testing/test_data.d.ts.map +1 -0
  496. package/dest/testing/test_data.js +29 -0
  497. package/dest/timer/date.d.ts +39 -0
  498. package/dest/timer/date.d.ts.map +1 -0
  499. package/dest/timer/date.js +62 -0
  500. package/dest/timer/elapsed.d.ts +13 -0
  501. package/dest/timer/elapsed.d.ts.map +1 -0
  502. package/dest/timer/elapsed.js +25 -0
  503. package/dest/timer/index.d.ts +5 -0
  504. package/dest/timer/index.d.ts.map +1 -0
  505. package/dest/timer/index.js +4 -0
  506. package/dest/timer/timeout.d.ts +56 -0
  507. package/dest/timer/timeout.d.ts.map +1 -0
  508. package/dest/timer/timeout.js +113 -0
  509. package/dest/timer/timer.d.ts +37 -0
  510. package/dest/timer/timer.d.ts.map +1 -0
  511. package/dest/timer/timer.js +40 -0
  512. package/dest/transport/dispatch/create_dispatch_proxy.d.ts +111 -0
  513. package/dest/transport/dispatch/create_dispatch_proxy.d.ts.map +1 -0
  514. package/dest/transport/dispatch/create_dispatch_proxy.js +59 -0
  515. package/dest/transport/dispatch/messages.d.ts +52 -0
  516. package/dest/transport/dispatch/messages.d.ts.map +1 -0
  517. package/dest/transport/dispatch/messages.js +13 -0
  518. package/dest/transport/index.d.ts +10 -0
  519. package/dest/transport/index.d.ts.map +1 -0
  520. package/dest/transport/index.js +9 -0
  521. package/dest/transport/interface/connector.d.ts +8 -0
  522. package/dest/transport/interface/connector.d.ts.map +1 -0
  523. package/dest/transport/interface/connector.js +3 -0
  524. package/dest/transport/interface/listener.d.ts +12 -0
  525. package/dest/transport/interface/listener.d.ts.map +1 -0
  526. package/dest/transport/interface/listener.js +4 -0
  527. package/dest/transport/interface/socket.d.ts +13 -0
  528. package/dest/transport/interface/socket.d.ts.map +1 -0
  529. package/dest/transport/interface/socket.js +7 -0
  530. package/dest/transport/interface/transferable.d.ts +68 -0
  531. package/dest/transport/interface/transferable.d.ts.map +1 -0
  532. package/dest/transport/interface/transferable.js +63 -0
  533. package/dest/transport/node/index.d.ts +3 -0
  534. package/dest/transport/node/index.d.ts.map +1 -0
  535. package/dest/transport/node/index.js +2 -0
  536. package/dest/transport/node/node_connector.d.ts +27 -0
  537. package/dest/transport/node/node_connector.d.ts.map +1 -0
  538. package/dest/transport/node/node_connector.js +26 -0
  539. package/dest/transport/node/node_connector_socket.d.ts +41 -0
  540. package/dest/transport/node/node_connector_socket.d.ts.map +1 -0
  541. package/dest/transport/node/node_connector_socket.js +44 -0
  542. package/dest/transport/node/node_listener.d.ts +25 -0
  543. package/dest/transport/node/node_listener.d.ts.map +1 -0
  544. package/dest/transport/node/node_listener.js +26 -0
  545. package/dest/transport/node/node_listener_socket.d.ts +36 -0
  546. package/dest/transport/node/node_listener_socket.d.ts.map +1 -0
  547. package/dest/transport/node/node_listener_socket.js +40 -0
  548. package/dest/transport/transport_client.d.ts +60 -0
  549. package/dest/transport/transport_client.d.ts.map +1 -0
  550. package/dest/transport/transport_client.js +96 -0
  551. package/dest/transport/transport_server.d.ts +47 -0
  552. package/dest/transport/transport_server.d.ts.map +1 -0
  553. package/dest/transport/transport_server.js +114 -0
  554. package/dest/trees/balanced_merkle_tree_root.d.ts +16 -0
  555. package/dest/trees/balanced_merkle_tree_root.d.ts.map +1 -0
  556. package/dest/trees/balanced_merkle_tree_root.js +50 -0
  557. package/dest/trees/hasher.d.ts +40 -0
  558. package/dest/trees/hasher.d.ts.map +1 -0
  559. package/dest/trees/hasher.js +10 -0
  560. package/dest/trees/index.d.ts +13 -0
  561. package/dest/trees/index.d.ts.map +1 -0
  562. package/dest/trees/index.js +12 -0
  563. package/dest/trees/indexed_merkle_tree.d.ts +11 -0
  564. package/dest/trees/indexed_merkle_tree.d.ts.map +1 -0
  565. package/dest/trees/indexed_merkle_tree.js +27 -0
  566. package/dest/trees/indexed_merkle_tree_calculator.d.ts +21 -0
  567. package/dest/trees/indexed_merkle_tree_calculator.d.ts.map +1 -0
  568. package/dest/trees/indexed_merkle_tree_calculator.js +87 -0
  569. package/dest/trees/indexed_tree_leaf.d.ts +55 -0
  570. package/dest/trees/indexed_tree_leaf.d.ts.map +1 -0
  571. package/dest/trees/indexed_tree_leaf.js +5 -0
  572. package/dest/trees/membership_witness.d.ts +63 -0
  573. package/dest/trees/membership_witness.d.ts.map +1 -0
  574. package/dest/trees/membership_witness.js +83 -0
  575. package/dest/trees/merkle_tree.d.ts +16 -0
  576. package/dest/trees/merkle_tree.d.ts.map +1 -0
  577. package/dest/trees/merkle_tree.js +58 -0
  578. package/dest/trees/merkle_tree_calculator.d.ts +16 -0
  579. package/dest/trees/merkle_tree_calculator.d.ts.map +1 -0
  580. package/dest/trees/merkle_tree_calculator.js +57 -0
  581. package/dest/trees/sibling_path.d.ts +96 -0
  582. package/dest/trees/sibling_path.d.ts.map +1 -0
  583. package/dest/trees/sibling_path.js +139 -0
  584. package/dest/trees/unbalanced_merkle_tree_calculator.d.ts +48 -0
  585. package/dest/trees/unbalanced_merkle_tree_calculator.d.ts.map +1 -0
  586. package/dest/trees/unbalanced_merkle_tree_calculator.js +154 -0
  587. package/dest/trees/unbalanced_merkle_tree_root.d.ts +27 -0
  588. package/dest/trees/unbalanced_merkle_tree_root.d.ts.map +1 -0
  589. package/dest/trees/unbalanced_merkle_tree_root.js +83 -0
  590. package/dest/trees/unbalanced_tree_store.d.ts +24 -0
  591. package/dest/trees/unbalanced_tree_store.d.ts.map +1 -0
  592. package/dest/trees/unbalanced_tree_store.js +148 -0
  593. package/dest/types/index.d.ts +68 -0
  594. package/dest/types/index.d.ts.map +1 -0
  595. package/dest/types/index.js +24 -0
  596. package/dest/url/index.d.ts +9 -0
  597. package/dest/url/index.d.ts.map +1 -0
  598. package/dest/url/index.js +62 -0
  599. package/dest/validation/index.d.ts +9 -0
  600. package/dest/validation/index.d.ts.map +1 -0
  601. package/dest/validation/index.js +15 -0
  602. package/package.json +213 -0
  603. package/src/array/array.ts +147 -0
  604. package/src/array/index.ts +2 -0
  605. package/src/array/sorted_array.ts +138 -0
  606. package/src/async-map/index.ts +18 -0
  607. package/src/async-pool/index.ts +51 -0
  608. package/src/bigint/index.ts +20 -0
  609. package/src/bigint-buffer/index.ts +92 -0
  610. package/src/branded-types/block_number.ts +135 -0
  611. package/src/branded-types/buffer32_hash.ts +38 -0
  612. package/src/branded-types/checkpoint_number.ts +130 -0
  613. package/src/branded-types/epoch.ts +88 -0
  614. package/src/branded-types/index.ts +8 -0
  615. package/src/branded-types/index_within_checkpoint.ts +88 -0
  616. package/src/branded-types/slot.ts +93 -0
  617. package/src/branded-types/types.ts +2 -0
  618. package/src/buffer/buffer16.ts +135 -0
  619. package/src/buffer/buffer32.ts +116 -0
  620. package/src/buffer/index.ts +3 -0
  621. package/src/buffer/utils.ts +8 -0
  622. package/src/collection/array.ts +351 -0
  623. package/src/collection/index.ts +4 -0
  624. package/src/collection/lru_map.ts +143 -0
  625. package/src/collection/lru_set.ts +115 -0
  626. package/src/collection/object.ts +89 -0
  627. package/src/committable/committable.ts +46 -0
  628. package/src/committable/index.ts +1 -0
  629. package/src/config/env_var.ts +412 -0
  630. package/src/config/index.ts +419 -0
  631. package/src/config/network_config.ts +21 -0
  632. package/src/config/network_name.ts +28 -0
  633. package/src/config/parse-env.ts +4 -0
  634. package/src/config/secret_value.ts +49 -0
  635. package/src/crypto/aes128/index.ts +77 -0
  636. package/src/crypto/bls/bn254_keystore.ts +276 -0
  637. package/src/crypto/bls/index.ts +76 -0
  638. package/src/crypto/bn254/index.ts +64 -0
  639. package/src/crypto/ecdsa/index.ts +88 -0
  640. package/src/crypto/ecdsa/signature.ts +100 -0
  641. package/src/crypto/grumpkin/index.ts +90 -0
  642. package/src/crypto/keccak/index.ts +283 -0
  643. package/src/crypto/keys/index.ts +26 -0
  644. package/src/crypto/pedersen/index.ts +1 -0
  645. package/src/crypto/pedersen/pedersen.noble.ts +573 -0
  646. package/src/crypto/pedersen/pedersen.wasm.ts +52 -0
  647. package/src/crypto/poseidon/index.ts +83 -0
  648. package/src/crypto/random/index.ts +47 -0
  649. package/src/crypto/random/randomness_singleton.ts +64 -0
  650. package/src/crypto/schnorr/index.ts +61 -0
  651. package/src/crypto/schnorr/signature.ts +87 -0
  652. package/src/crypto/secp256k1/index.ts +61 -0
  653. package/src/crypto/secp256k1-signer/index.ts +2 -0
  654. package/src/crypto/secp256k1-signer/secp256k1_signer.ts +38 -0
  655. package/src/crypto/secp256k1-signer/utils.ts +244 -0
  656. package/src/crypto/sha256/index.ts +194 -0
  657. package/src/crypto/sha512/index.ts +16 -0
  658. package/src/crypto/signature/index.ts +17 -0
  659. package/src/crypto/sync/index.ts +6 -0
  660. package/src/crypto/sync/pedersen/index.ts +46 -0
  661. package/src/crypto/sync/poseidon/index.ts +72 -0
  662. package/src/curves/bls12/field.ts +456 -0
  663. package/src/curves/bls12/index.ts +2 -0
  664. package/src/curves/bls12/point.ts +450 -0
  665. package/src/curves/bn254/field.ts +531 -0
  666. package/src/curves/bn254/index.ts +2 -0
  667. package/src/curves/bn254/point.ts +170 -0
  668. package/src/curves/grumpkin/index.ts +11 -0
  669. package/src/curves/grumpkin/point.ts +300 -0
  670. package/src/decorators/index.ts +1 -0
  671. package/src/decorators/memoize.ts +11 -0
  672. package/src/error/index.ts +22 -0
  673. package/src/eth-address/index.ts +269 -0
  674. package/src/eth-signature/eth_signature.ts +155 -0
  675. package/src/eth-signature/index.ts +1 -0
  676. package/src/fifo/fifo_frame_reader.ts +113 -0
  677. package/src/fifo/index.ts +1 -0
  678. package/src/fifo_set/fifo_set.ts +52 -0
  679. package/src/fifo_set/index.ts +1 -0
  680. package/src/fs/index.ts +2 -0
  681. package/src/fs/run_in_dir.ts +33 -0
  682. package/src/fs/try_rm_dir.ts +15 -0
  683. package/src/iterable/all.ts +32 -0
  684. package/src/iterable/filter.ts +77 -0
  685. package/src/iterable/first.ts +14 -0
  686. package/src/iterable/index.ts +8 -0
  687. package/src/iterable/isAsyncIt.ts +8 -0
  688. package/src/iterable/map.ts +66 -0
  689. package/src/iterable/peek.ts +58 -0
  690. package/src/iterable/sort.ts +39 -0
  691. package/src/iterable/take.ts +54 -0
  692. package/src/iterable/toArray.ts +9 -0
  693. package/src/iterator/filter.ts +11 -0
  694. package/src/iterator/index.ts +1 -0
  695. package/src/jest/env.mjs +52 -0
  696. package/src/jest/setup.mjs +38 -0
  697. package/src/jest/setupAfterEnv.mjs +3 -0
  698. package/src/json-rpc/README.md +55 -0
  699. package/src/json-rpc/client/fetch.ts +98 -0
  700. package/src/json-rpc/client/index.ts +2 -0
  701. package/src/json-rpc/client/safe_json_rpc_client.ts +283 -0
  702. package/src/json-rpc/client/undici.ts +128 -0
  703. package/src/json-rpc/convert.ts +52 -0
  704. package/src/json-rpc/errors.ts +6 -0
  705. package/src/json-rpc/fixtures/class_a.ts +18 -0
  706. package/src/json-rpc/fixtures/class_b.ts +18 -0
  707. package/src/json-rpc/fixtures/test_state.ts +143 -0
  708. package/src/json-rpc/index.ts +2 -0
  709. package/src/json-rpc/js_utils.ts +21 -0
  710. package/src/json-rpc/server/api_key_auth.ts +63 -0
  711. package/src/json-rpc/server/index.ts +2 -0
  712. package/src/json-rpc/server/safe_json_rpc_server.ts +626 -0
  713. package/src/json-rpc/test/index.ts +1 -0
  714. package/src/json-rpc/test/integration.ts +35 -0
  715. package/src/log/aws-logger-config.ts +32 -0
  716. package/src/log/bigint-utils.ts +25 -0
  717. package/src/log/console.ts +42 -0
  718. package/src/log/gcloud-logger-config.ts +72 -0
  719. package/src/log/index.ts +6 -0
  720. package/src/log/libp2p_logger.ts +93 -0
  721. package/src/log/log-filters.ts +81 -0
  722. package/src/log/log-levels.ts +3 -0
  723. package/src/log/log_fn.ts +5 -0
  724. package/src/log/noir_debug_log_util.ts +21 -0
  725. package/src/log/pino-logger-server.ts +25 -0
  726. package/src/log/pino-logger.ts +406 -0
  727. package/src/message/index.ts +47 -0
  728. package/src/mutex/index.ts +84 -0
  729. package/src/mutex/mutex_database.ts +11 -0
  730. package/src/noir/index.ts +1 -0
  731. package/src/noir/noir_package_config.ts +66 -0
  732. package/src/number/index.ts +14 -0
  733. package/src/profiler/index.ts +1 -0
  734. package/src/profiler/profiler.ts +125 -0
  735. package/src/promise/index.ts +2 -0
  736. package/src/promise/running-promise.ts +138 -0
  737. package/src/promise/utils.ts +60 -0
  738. package/src/queue/base_memory_queue.ts +138 -0
  739. package/src/queue/batch_queue.ts +121 -0
  740. package/src/queue/bounded_serial_queue.ts +103 -0
  741. package/src/queue/fifo_memory_queue.ts +39 -0
  742. package/src/queue/index.ts +6 -0
  743. package/src/queue/priority_memory_queue.ts +20 -0
  744. package/src/queue/priority_queue.ts +34 -0
  745. package/src/queue/semaphore.ts +38 -0
  746. package/src/queue/serial_queue.ts +86 -0
  747. package/src/retry/index.ts +185 -0
  748. package/src/running-promise/index.ts +1 -0
  749. package/src/schemas/api.ts +47 -0
  750. package/src/schemas/index.ts +5 -0
  751. package/src/schemas/parse.ts +32 -0
  752. package/src/schemas/schemas.ts +93 -0
  753. package/src/schemas/types.ts +36 -0
  754. package/src/schemas/utils.ts +91 -0
  755. package/src/serialize/buffer_reader.ts +472 -0
  756. package/src/serialize/buffer_sink.ts +350 -0
  757. package/src/serialize/field_reader.ts +208 -0
  758. package/src/serialize/free_funcs.ts +198 -0
  759. package/src/serialize/index.ts +7 -0
  760. package/src/serialize/serialize.ts +320 -0
  761. package/src/serialize/type_registry.ts +75 -0
  762. package/src/serialize/types.ts +40 -0
  763. package/src/sleep/index.ts +90 -0
  764. package/src/string/index.ts +80 -0
  765. package/src/testing/files/index.ts +74 -0
  766. package/src/testing/formatting.ts +3 -0
  767. package/src/testing/index.ts +4 -0
  768. package/src/testing/port_allocator.ts +31 -0
  769. package/src/testing/snapshot_serializer.ts +33 -0
  770. package/src/testing/test_data.ts +36 -0
  771. package/src/timer/date.ts +82 -0
  772. package/src/timer/elapsed.ts +23 -0
  773. package/src/timer/index.ts +4 -0
  774. package/src/timer/timeout.ts +136 -0
  775. package/src/timer/timer.ts +48 -0
  776. package/src/transport/dispatch/create_dispatch_proxy.ts +151 -0
  777. package/src/transport/dispatch/messages.ts +58 -0
  778. package/src/transport/index.ts +9 -0
  779. package/src/transport/interface/connector.ts +8 -0
  780. package/src/transport/interface/listener.ts +15 -0
  781. package/src/transport/interface/socket.ts +14 -0
  782. package/src/transport/interface/transferable.ts +125 -0
  783. package/src/transport/node/index.ts +2 -0
  784. package/src/transport/node/node_connector.ts +30 -0
  785. package/src/transport/node/node_connector_socket.ts +52 -0
  786. package/src/transport/node/node_listener.ts +34 -0
  787. package/src/transport/node/node_listener_socket.ts +48 -0
  788. package/src/transport/transport_client.ts +130 -0
  789. package/src/transport/transport_server.ts +111 -0
  790. package/src/trees/balanced_merkle_tree_root.ts +65 -0
  791. package/src/trees/hasher.ts +51 -0
  792. package/src/trees/index.ts +12 -0
  793. package/src/trees/indexed_merkle_tree.ts +40 -0
  794. package/src/trees/indexed_merkle_tree_calculator.ts +98 -0
  795. package/src/trees/indexed_tree_leaf.ts +56 -0
  796. package/src/trees/membership_witness.ts +112 -0
  797. package/src/trees/merkle_tree.ts +75 -0
  798. package/src/trees/merkle_tree_calculator.ts +66 -0
  799. package/src/trees/sibling_path.ts +177 -0
  800. package/src/trees/unbalanced_merkle_tree_calculator.ts +176 -0
  801. package/src/trees/unbalanced_merkle_tree_root.ts +112 -0
  802. package/src/trees/unbalanced_tree_store.ts +161 -0
  803. package/src/types/index.ts +103 -0
  804. package/src/url/index.ts +72 -0
  805. package/src/validation/index.ts +18 -0
@@ -0,0 +1,96 @@
1
+ import { z } from 'zod';
2
+ import { Fr } from '../curves/bn254/index.js';
3
+ import { type Tuple } from '../serialize/index.js';
4
+ import type { Hasher } from './hasher.js';
5
+ /**
6
+ * Upper bound on the elements a serialized sibling path may declare. The deepest protocol tree is 42 levels,
7
+ * and the stacked path proving L2-to-L1 message inclusion spans four unbalanced trees, so this leaves room to
8
+ * spare while keeping a malformed length prefix from driving a large allocation. `stdlib` asserts that it stays
9
+ * above every protocol tree height, which this package cannot check itself without depending on `@aztec-labs/constants`.
10
+ */
11
+ export declare const MAX_SIBLING_PATH_LENGTH = 128;
12
+ /**
13
+ * Contains functionality to compute and serialize/deserialize a sibling path.
14
+ * E.g. Sibling path for a leaf at index 3 in a tree of depth 3 consists of:
15
+ * d0: [ root ]
16
+ * d1: [ ] [*]
17
+ * d2: [*] [ ] [ ] [ ]
18
+ * d3: [ ] [ ] [*] [ ] [ ] [ ] [ ] [ ].
19
+ *
20
+ * And the elements would be ordered as: [ leaf_at_index_2, node_at_level_2_index_0, node_at_level_1_index_1 ].
21
+ */
22
+ export declare class SiblingPath<N extends number> {
23
+ /** Size of the sibling path (number of fields it contains). */
24
+ pathSize: N;
25
+ private data;
26
+ /**
27
+ * Constructor.
28
+ * @param pathSize - The size of the sibling path.
29
+ * @param path - The sibling path data.
30
+ */
31
+ constructor(
32
+ /** Size of the sibling path (number of fields it contains). */
33
+ pathSize: N,
34
+ /** The sibling path data. */
35
+ path: Buffer[]);
36
+ static get schema(): z.ZodPipe<import("../schemas/types.js").ZodFor<Buffer<ArrayBufferLike>>, z.ZodTransform<SiblingPath<number>, Buffer<ArrayBufferLike>>>;
37
+ static schemaFor<N extends number>(size: N): z.ZodPipe<import("../schemas/types.js").ZodFor<Buffer<ArrayBufferLike>>, z.ZodTransform<SiblingPath<N>, Buffer<ArrayBufferLike>>>;
38
+ toJSON(): Buffer<ArrayBufferLike>;
39
+ /**
40
+ * Returns sibling path hashed up from the a element.
41
+ * @param size - The number of elements in a given path.
42
+ * @param zeroElement - Value of the zero element.
43
+ * @param hasher - Implementation of a hasher interface.
44
+ * @returns A sibling path hashed up from a zero element.
45
+ */
46
+ static ZERO<N extends number>(size: N, zeroElement: Buffer, hasher: Hasher): SiblingPath<N>;
47
+ static random<N extends number>(number: N): SiblingPath<N>;
48
+ /**
49
+ * Serializes this SiblingPath object to a buffer.
50
+ * @returns The buffer representation of this object.
51
+ */
52
+ toBuffer(): Buffer;
53
+ /**
54
+ * Returns the path buffer underlying the sibling path.
55
+ * @returns The Buffer array representation of this object.
56
+ */
57
+ toBufferArray(): Buffer[];
58
+ /**
59
+ * Convert the Sibling Path object into an array of field elements.
60
+ * @returns The field array representation of this object.
61
+ */
62
+ toFields(): Fr[];
63
+ /**
64
+ * Convert Sibling Path object into a tuple of field elements.
65
+ * @returns A tuple representation of the sibling path.
66
+ */
67
+ toTuple(): Tuple<Fr, N>;
68
+ /**
69
+ * Deserializes a SiblingPath from a buffer.
70
+ * @param buf - A buffer containing the buffer representation of SiblingPath.
71
+ * @param offset - An offset to start deserializing from.
72
+ * @returns A SiblingPath object.
73
+ * @throws If the length prefix exceeds MAX_SIBLING_PATH_LENGTH or the buffer holds fewer elements than it declares.
74
+ */
75
+ static fromBuffer<N extends number>(buf: Buffer, offset?: number): SiblingPath<N>;
76
+ /**
77
+ * Serializes this SiblingPath object to a hex string representation.
78
+ * @returns A hex string representation of the sibling path.
79
+ */
80
+ toString(): string;
81
+ /**
82
+ * Deserializes a SiblingPath object from a hex string representation.
83
+ * @param repr - A hex string representation of the sibling path.
84
+ * @returns A SiblingPath object.
85
+ */
86
+ static fromString<N extends number>(repr: string): SiblingPath<N>;
87
+ /**
88
+ * Generate a subtree path from the current sibling path.
89
+ * @param subtreeHeight - The size of the subtree that we are getting the path for.
90
+ * @returns A new sibling path that is the for the requested subtree.
91
+ */
92
+ getSubtreeSiblingPath<SubtreeHeight extends number, SubtreeSiblingPathHeight extends number>(subtreeHeight: SubtreeHeight): SiblingPath<SubtreeSiblingPathHeight>;
93
+ }
94
+ /** Computes the expected root of a merkle tree given a leaf and its sibling path. */
95
+ export declare function computeRootFromSiblingPath(leaf: Buffer, siblingPath: Buffer[], index: number, hasher: (left: Buffer, right: Buffer) => Promise<Buffer>): Promise<Buffer<ArrayBufferLike>>;
96
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2libGluZ19wYXRoLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdHJlZXMvc2libGluZ19wYXRoLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxDQUFD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GAAG,WAAW,CAAC,CAAC,CAAC,CAI3E;IAED;;;OAGG;IACI,QAAQ,IAAI,MAAM,CAExB;IAED;;;;OAIG;IACH,OAAc,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,CAEvE;IAED;;;;OAIG;IACI,qBAAqB,CAAC,aAAa,SAAS,MAAM,EAAE,wBAAwB,SAAS,MAAM,EAChG,aAAa,EAAE,aAAa,GAC3B,WAAW,CAAC,wBAAwB,CAAC,CAKvC;CACF;AAED,qFAAqF;AACrF,wBAAsB,0BAA0B,CAC9C,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EAAE,EACrB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,oCAQzD"}
@@ -0,0 +1,139 @@
1
+ import { z } from 'zod';
2
+ import { makeTuple } from '../array/array.js';
3
+ import { Fr } from '../curves/bn254/index.js';
4
+ import { schemas } from '../schemas/index.js';
5
+ import { BufferReader, assertLength, serializeArrayOfBufferableToVector } from '../serialize/index.js';
6
+ import { bufferToHex, hexToBuffer } from '../string/index.js';
7
+ /**
8
+ * Upper bound on the elements a serialized sibling path may declare. The deepest protocol tree is 42 levels,
9
+ * and the stacked path proving L2-to-L1 message inclusion spans four unbalanced trees, so this leaves room to
10
+ * spare while keeping a malformed length prefix from driving a large allocation. `stdlib` asserts that it stays
11
+ * above every protocol tree height, which this package cannot check itself without depending on `@aztec-labs/constants`.
12
+ */ export const MAX_SIBLING_PATH_LENGTH = 128;
13
+ /**
14
+ * Contains functionality to compute and serialize/deserialize a sibling path.
15
+ * E.g. Sibling path for a leaf at index 3 in a tree of depth 3 consists of:
16
+ * d0: [ root ]
17
+ * d1: [ ] [*]
18
+ * d2: [*] [ ] [ ] [ ]
19
+ * d3: [ ] [ ] [*] [ ] [ ] [ ] [ ] [ ].
20
+ *
21
+ * And the elements would be ordered as: [ leaf_at_index_2, node_at_level_2_index_0, node_at_level_1_index_1 ].
22
+ */ export class SiblingPath {
23
+ pathSize;
24
+ data;
25
+ /**
26
+ * Constructor.
27
+ * @param pathSize - The size of the sibling path.
28
+ * @param path - The sibling path data.
29
+ */ constructor(/** Size of the sibling path (number of fields it contains). */ pathSize, /** The sibling path data. */ path){
30
+ this.pathSize = pathSize;
31
+ this.data = assertLength(path, pathSize);
32
+ }
33
+ static get schema() {
34
+ return schemas.Buffer.transform((b)=>SiblingPath.fromBuffer(b));
35
+ }
36
+ static schemaFor(size) {
37
+ return schemas.Buffer.transform((b)=>SiblingPath.fromBuffer(b)).superRefine((path, ctx)=>{
38
+ if (path.pathSize !== size) {
39
+ ctx.addIssue({
40
+ code: z.ZodIssueCode.custom,
41
+ message: `Expected sibling path size ${size} but got ${path.pathSize}`
42
+ });
43
+ }
44
+ });
45
+ }
46
+ toJSON() {
47
+ return this.toBuffer();
48
+ }
49
+ /**
50
+ * Returns sibling path hashed up from the a element.
51
+ * @param size - The number of elements in a given path.
52
+ * @param zeroElement - Value of the zero element.
53
+ * @param hasher - Implementation of a hasher interface.
54
+ * @returns A sibling path hashed up from a zero element.
55
+ */ static ZERO(size, zeroElement, hasher) {
56
+ const bufs = [];
57
+ let current = zeroElement;
58
+ for(let i = 0; i < size; ++i){
59
+ bufs.push(current);
60
+ current = hasher.hash(current, current);
61
+ }
62
+ return new SiblingPath(size, bufs);
63
+ }
64
+ static random(number) {
65
+ const data = Array.from({
66
+ length: number
67
+ }, ()=>Fr.random().toBuffer());
68
+ return new SiblingPath(number, data);
69
+ }
70
+ /**
71
+ * Serializes this SiblingPath object to a buffer.
72
+ * @returns The buffer representation of this object.
73
+ */ toBuffer() {
74
+ return serializeArrayOfBufferableToVector(this.data);
75
+ }
76
+ /**
77
+ * Returns the path buffer underlying the sibling path.
78
+ * @returns The Buffer array representation of this object.
79
+ */ toBufferArray() {
80
+ return this.data;
81
+ }
82
+ /**
83
+ * Convert the Sibling Path object into an array of field elements.
84
+ * @returns The field array representation of this object.
85
+ */ toFields() {
86
+ return this.data.map((buf)=>Fr.fromBuffer(buf));
87
+ }
88
+ /**
89
+ * Convert Sibling Path object into a tuple of field elements.
90
+ * @returns A tuple representation of the sibling path.
91
+ */ toTuple() {
92
+ const array = this.toFields();
93
+ return makeTuple(array.length, (i)=>array[i], 0);
94
+ }
95
+ /**
96
+ * Deserializes a SiblingPath from a buffer.
97
+ * @param buf - A buffer containing the buffer representation of SiblingPath.
98
+ * @param offset - An offset to start deserializing from.
99
+ * @returns A SiblingPath object.
100
+ * @throws If the length prefix exceeds MAX_SIBLING_PATH_LENGTH or the buffer holds fewer elements than it declares.
101
+ */ static fromBuffer(buf, offset = 0) {
102
+ const reader = new BufferReader(buf, offset);
103
+ const path = reader.readVector({
104
+ fromBuffer: (r)=>r.readBytes(Fr.SIZE_IN_BYTES)
105
+ }, MAX_SIBLING_PATH_LENGTH);
106
+ return new SiblingPath(path.length, path);
107
+ }
108
+ /**
109
+ * Serializes this SiblingPath object to a hex string representation.
110
+ * @returns A hex string representation of the sibling path.
111
+ */ toString() {
112
+ return bufferToHex(this.toBuffer());
113
+ }
114
+ /**
115
+ * Deserializes a SiblingPath object from a hex string representation.
116
+ * @param repr - A hex string representation of the sibling path.
117
+ * @returns A SiblingPath object.
118
+ */ static fromString(repr) {
119
+ return SiblingPath.fromBuffer(hexToBuffer(repr));
120
+ }
121
+ /**
122
+ * Generate a subtree path from the current sibling path.
123
+ * @param subtreeHeight - The size of the subtree that we are getting the path for.
124
+ * @returns A new sibling path that is the for the requested subtree.
125
+ */ getSubtreeSiblingPath(subtreeHeight) {
126
+ // Drop the size of the subtree from the path, and return the rest.
127
+ const subtreeData = this.data.slice(subtreeHeight);
128
+ const subtreePathSize = this.pathSize - subtreeHeight;
129
+ return new SiblingPath(subtreePathSize, subtreeData);
130
+ }
131
+ }
132
+ /** Computes the expected root of a merkle tree given a leaf and its sibling path. */ export async function computeRootFromSiblingPath(leaf, siblingPath, index, hasher) {
133
+ let result = leaf;
134
+ for (const sibling of siblingPath){
135
+ result = index & 1 ? await hasher(sibling, result) : await hasher(result, sibling);
136
+ index >>= 1;
137
+ }
138
+ return result;
139
+ }
@@ -0,0 +1,48 @@
1
+ import { type Hasher } from './hasher.js';
2
+ import { SiblingPath } from './sibling_path.js';
3
+ import { type TreeNodeLocation } from './unbalanced_tree_store.js';
4
+ /**
5
+ * An ephemeral unbalanced Merkle tree implementation.
6
+ * Follows the rollup implementation which greedily hashes pairs of nodes up the tree.
7
+ * Remaining rightmost nodes are shifted up until they can be paired.
8
+ * The values that match the `valueToCompress` are skipped and the sibling of the compressed leaf are shifted up until
9
+ * they can be paired.
10
+ * If there is only one leaf, the root is the leaf.
11
+ */
12
+ export declare class UnbalancedMerkleTreeCalculator {
13
+ private readonly leaves;
14
+ private readonly valueToCompress;
15
+ private readonly emptyRoot;
16
+ private readonly hasher;
17
+ private store;
18
+ private leafLocations;
19
+ constructor(leaves: Buffer[], valueToCompress: Buffer, emptyRoot: Buffer, hasher: Hasher['hash']);
20
+ static create(leaves: Buffer[], valueToCompress?: Buffer<ArrayBuffer>, emptyRoot?: Buffer<ArrayBuffer>, hasher?: (lhs: Uint8Array<ArrayBufferLike>, rhs: Uint8Array<ArrayBufferLike>) => Buffer<ArrayBuffer>): UnbalancedMerkleTreeCalculator;
21
+ /**
22
+ * Returns the root of the tree.
23
+ * @returns The root of the tree.
24
+ */
25
+ getRoot(): Buffer;
26
+ /**
27
+ * Returns a sibling path for the element.
28
+ * @param value - The value of the element.
29
+ * @returns A sibling path for the element.
30
+ * Note: The sibling path is an array of sibling hashes, with the lowest hash (leaf hash) first, and the highest hash last.
31
+ */
32
+ getSiblingPath<N extends number>(value: Buffer): SiblingPath<N>;
33
+ /**
34
+ * Returns a sibling path for the leaf at the given index.
35
+ * @param leafIndex - The index of the leaf.
36
+ * @returns A sibling path for the leaf.
37
+ */
38
+ getSiblingPathByLeafIndex<N extends number>(leafIndex: number): SiblingPath<N>;
39
+ getLeafLocation(leafIndex: number): TreeNodeLocation;
40
+ /**
41
+ * Adds leaves and nodes to the store. Updates the leafLocations.
42
+ * @param leaves - The leaves of the tree.
43
+ */
44
+ private buildTree;
45
+ private shiftNodeUp;
46
+ private collectNodesToShift;
47
+ }
48
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidW5iYWxhbmNlZF9tZXJrbGVfdHJlZV9jYWxjdWxhdG9yLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdHJlZXMvdW5iYWxhbmNlZF9tZXJrbGVfdHJlZV9jYWxjdWxhdG9yLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxLQUFLLE1BQU0sRUFBaUIsTUFBTSxhQUFhLENBQUM7QUFDekQsT0FBTyxFQUFFLFdBQVcsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBQ2hELE9BQU8sRUFBRSxLQUFLLGdCQUFnQixFQUF1QixNQUFNLDRCQUE0QixDQUFDO0FBT3hGOzs7Ozs7O0dBT0c7QUFDSCxxQkFBYSw4QkFBOEI7SUFLdkMsT0FBTyxDQUFDLFFBQVEsQ0FBQyxNQUFNO0lBQ3ZCLE9BQU8sQ0FBQyxRQUFRLENBQUMsZUFBZTtJQUNoQyxPQUFPLENBQUMsUUFBUSxDQUFDLFNBQVM7SUFDMUIsT0FBTyxDQUFDLFFBQVEsQ0FBQyxNQUFNO0lBUHpCLE9BQU8sQ0FBQyxLQUFLLENBQWdDO0lBQzdDLE9BQU8sQ0FBQyxhQUFhLENBQTBCO0lBRS9DLFlBQ21CLE1BQU0sRUFBRSxNQUFNLEVBQUUsRUFDaEIsZUFBZSxFQUFFLE1BQU0sRUFDdkIsU0FBUyxFQUFFLE1BQU0sRUFDakIsTUFBTSxFQUFFLE1BQU0sQ0FBQyxNQUFNLENBQUMsRUFJ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PzB,OAAO,CAAC,KAAK,CAAgC;IAC7C,OAAO,CAAC,aAAa,CAA0B;IAE/C,YACmB,MAAM,EAAE,MAAM,EAAE,EAChB,eAAe,EAAE,MAAM,EACvB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,EAIxC;IAED,MAAM,CAAC,MAAM,CACX,MAAM,EAAE,MAAM,EAAE,EAChB,eAAe,sBAAkB,EACjC,SAAS,sBAAmB,EAC5B,MAAM,8FAAgB,kCAGvB;IAED;;;OAGG;IACI,OAAO,IAAI,MAAM,CAEvB;IAED;;;;;OAKG;IACI,cAAc,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,CAOrE;IAED;;;;OAIG;IACI,yBAAyB,CAAC,CAAC,SAAS,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,CAmBpF;IAEM,eAAe,CAAC,SAAS,EAAE,MAAM,oBAEvC;IAED;;;OAGG;IACH,OAAO,CAAC,SAAS;IA+CjB,OAAO,CAAC,WAAW;IAYnB,OAAO,CAAC,mBAAmB;CAmB5B"}
@@ -0,0 +1,154 @@
1
+ import { shaMerkleHash } from './hasher.js';
2
+ import { SiblingPath } from './sibling_path.js';
3
+ import { UnbalancedTreeStore } from './unbalanced_tree_store.js';
4
+ /**
5
+ * An ephemeral unbalanced Merkle tree implementation.
6
+ * Follows the rollup implementation which greedily hashes pairs of nodes up the tree.
7
+ * Remaining rightmost nodes are shifted up until they can be paired.
8
+ * The values that match the `valueToCompress` are skipped and the sibling of the compressed leaf are shifted up until
9
+ * they can be paired.
10
+ * If there is only one leaf, the root is the leaf.
11
+ */ export class UnbalancedMerkleTreeCalculator {
12
+ leaves;
13
+ valueToCompress;
14
+ emptyRoot;
15
+ hasher;
16
+ store;
17
+ leafLocations;
18
+ constructor(leaves, valueToCompress, emptyRoot, hasher){
19
+ this.leaves = leaves;
20
+ this.valueToCompress = valueToCompress;
21
+ this.emptyRoot = emptyRoot;
22
+ this.hasher = hasher;
23
+ this.leafLocations = [];
24
+ this.store = new UnbalancedTreeStore(leaves.length);
25
+ this.buildTree();
26
+ }
27
+ static create(leaves, valueToCompress = Buffer.alloc(0), emptyRoot = Buffer.alloc(32), hasher = shaMerkleHash) {
28
+ return new UnbalancedMerkleTreeCalculator(leaves, valueToCompress, emptyRoot, hasher);
29
+ }
30
+ /**
31
+ * Returns the root of the tree.
32
+ * @returns The root of the tree.
33
+ */ getRoot() {
34
+ return this.store.getRoot().value;
35
+ }
36
+ /**
37
+ * Returns a sibling path for the element.
38
+ * @param value - The value of the element.
39
+ * @returns A sibling path for the element.
40
+ * Note: The sibling path is an array of sibling hashes, with the lowest hash (leaf hash) first, and the highest hash last.
41
+ */ getSiblingPath(value) {
42
+ const leafIndex = this.leaves.findIndex((leaf)=>leaf.equals(value));
43
+ if (leafIndex === -1) {
44
+ throw Error(`Leaf value ${value.toString('hex')} not found in tree.`);
45
+ }
46
+ return this.getSiblingPathByLeafIndex(leafIndex);
47
+ }
48
+ /**
49
+ * Returns a sibling path for the leaf at the given index.
50
+ * @param leafIndex - The index of the leaf.
51
+ * @returns A sibling path for the leaf.
52
+ */ getSiblingPathByLeafIndex(leafIndex) {
53
+ if (leafIndex >= this.leaves.length) {
54
+ throw Error(`Leaf index ${leafIndex} out of bounds. Tree has ${this.leaves.length} leaves.`);
55
+ }
56
+ const leaf = this.leaves[leafIndex];
57
+ if (leaf.equals(this.valueToCompress)) {
58
+ throw Error(`Leaf at index ${leafIndex} has been compressed.`);
59
+ }
60
+ const path = [];
61
+ let location = this.leafLocations[leafIndex];
62
+ while(location.level > 0){
63
+ const sibling = this.store.getSibling(location);
64
+ path.push(sibling.value);
65
+ location = this.store.getParentLocation(location);
66
+ }
67
+ return new SiblingPath(path.length, path);
68
+ }
69
+ getLeafLocation(leafIndex) {
70
+ return this.leafLocations[leafIndex];
71
+ }
72
+ /**
73
+ * Adds leaves and nodes to the store. Updates the leafLocations.
74
+ * @param leaves - The leaves of the tree.
75
+ */ buildTree() {
76
+ this.leafLocations = this.leaves.map((value, i)=>this.store.setLeaf(i, {
77
+ value,
78
+ leafIndex: i
79
+ }));
80
+ // Start with the leaves that are not compressed.
81
+ let toProcess = this.leafLocations.filter((_, i)=>!this.leaves[i].equals(this.valueToCompress));
82
+ if (!toProcess.length) {
83
+ // All leaves are compressed. Set empty root to the root.
84
+ this.store.setNode({
85
+ level: 0,
86
+ index: 0
87
+ }, {
88
+ value: this.emptyRoot
89
+ });
90
+ return;
91
+ }
92
+ const level = toProcess[0].level;
93
+ for(let i = level; i > 0; i--){
94
+ const toProcessNext = [];
95
+ for (const location of toProcess){
96
+ if (location.level !== i) {
97
+ toProcessNext.push(location);
98
+ continue;
99
+ }
100
+ const parentLocation = this.store.getParentLocation(location);
101
+ if (this.store.getNode(parentLocation)) {
102
+ continue;
103
+ }
104
+ const sibling = this.store.getSibling(location);
105
+ // If sibling is undefined, all its children are compressed.
106
+ const shouldShiftUp = !sibling || sibling.value.equals(this.valueToCompress);
107
+ if (shouldShiftUp) {
108
+ // The node becomes the parent if the sibling is a compressed leaf.
109
+ this.shiftNodeUp(location, parentLocation);
110
+ } else {
111
+ // Hash the value with the (right) sibling and update the parent node.
112
+ const node = this.store.getNode(location);
113
+ const parentValue = this.hasher(node.value, sibling.value);
114
+ this.store.setNode(parentLocation, {
115
+ value: parentValue
116
+ });
117
+ }
118
+ // Add the parent location to be processed next.
119
+ toProcessNext.push(parentLocation);
120
+ }
121
+ toProcess = toProcessNext;
122
+ }
123
+ }
124
+ shiftNodeUp(from, to) {
125
+ // Collect all nodes that need to shift.
126
+ const nodesToShift = this.collectNodesToShift(from, to);
127
+ // Move all nodes to their new locations.
128
+ for (const { node, newLocation } of nodesToShift){
129
+ this.store.setNode(newLocation, node);
130
+ if (node.leafIndex !== undefined) {
131
+ this.leafLocations[node.leafIndex] = newLocation;
132
+ }
133
+ }
134
+ }
135
+ collectNodesToShift(from, to) {
136
+ const node = this.store.getNode(from);
137
+ if (!node) {
138
+ return [];
139
+ }
140
+ let result = [
141
+ {
142
+ node,
143
+ newLocation: to
144
+ }
145
+ ];
146
+ // If not a leaf, collect its children.
147
+ if (node.leafIndex === undefined) {
148
+ const [leftChild, rightChild] = this.store.getChildLocations(from);
149
+ const [leftChildNew, rightChildNew] = this.store.getChildLocations(to);
150
+ result = result.concat(this.collectNodesToShift(leftChild, leftChildNew)).concat(this.collectNodesToShift(rightChild, rightChildNew));
151
+ }
152
+ return result;
153
+ }
154
+ }
@@ -0,0 +1,27 @@
1
+ export declare const computeUnbalancedShaRoot: (leaves: Buffer<ArrayBufferLike>[]) => Buffer<ArrayBufferLike>;
2
+ export declare const computeWonkyShaRoot: (leaves: Buffer<ArrayBufferLike>[]) => Buffer<ArrayBufferLike>;
3
+ /**
4
+ * Computes the Merkle root of an unbalanced tree.
5
+ *
6
+ * Unlike a balanced Merkle tree, which requires the number of leaves to be a power of two, an unbalanced tree can have
7
+ * any number of leaves.
8
+ *
9
+ * The tree is constructed by iteratively extracting the smallest power-of-two-sized subtrees from **right to left**.
10
+ * For each such subtree, it computes the subtree root and then combines all subtree roots (again from right to left)
11
+ * into a single root using the provided hash function.
12
+ *
13
+ * Note: We need the final tree to be as shallow as possible, to minimize the size of the sibling path required to prove
14
+ * membership of a leaf. Therefor, the computation proceeds from right to left - smaller subtrees must always be
15
+ * combined before being merged with a larger sibling on their left.
16
+ *
17
+ * For example, consider an unbalanced tree made of three subtrees of sizes 2, 4, and 8. If we combine the size-2 and
18
+ * size-4 subtrees first (producing a subtree of depth 3), and then merge it with the size-8 subtree (also depth 3), the
19
+ * resulting tree has a maximum depth of 4.
20
+ *
21
+ * But if we instead combine the size-4 and size-8 subtrees first (depth 4), and then merge with the size-2 subtree
22
+ * (depth 1), the final tree has a depth of 5.
23
+ */
24
+ export declare function computeUnbalancedMerkleTreeRoot(leaves: Buffer[], hasher?: (lhs: Uint8Array<ArrayBufferLike>, rhs: Uint8Array<ArrayBufferLike>) => Buffer<ArrayBuffer>, emptyRoot?: Buffer<ArrayBuffer>): Buffer;
25
+ export declare function computeUnbalancedMerkleTreeRootAsync(leaves: Buffer[], hasher: (left: Uint8Array, right: Uint8Array) => Promise<Buffer<ArrayBuffer>>, emptyRoot?: Buffer<ArrayBuffer>): Promise<Buffer>;
26
+ export declare function computeWonkyMerkleTreeRoot(leaves: Buffer[], valueToCompress?: Buffer<ArrayBuffer>, emptyRoot?: Buffer<ArrayBuffer>, hasher?: (lhs: Uint8Array<ArrayBufferLike>, rhs: Uint8Array<ArrayBufferLike>) => Buffer<ArrayBuffer>): Buffer;
27
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidW5iYWxhbmNlZF9tZXJrbGVfdHJlZV9yb290LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdHJlZXMvdW5iYWxhbmNlZF9tZXJrbGVfdHJlZV9yb290LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUlBLGVBQU8sTUFBTSx3QkFBd0IsZ0VBQStFLENBQUM7QUFFckgsZUFBTyxNQUFNLG1CQUFtQixnRUFBMkQsQ0FBQztBQUU1Rjs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7R0FvQkc7QUFDSCx3QkFBZ0IsK0JBQStCLENBQzdDLE1BQU0sRUFBRSxNQUFNLEVBQUUsRUFDaEIsTUFBTSw4RkFBZ0IsRUFDdEIsU0FBUyxzQkFBbUIsR0FDM0IsTUFBTSxDQTZCUjtBQUVELHdCQUFzQixvQ0FBb0MsQ0FDeEQsTUFBTSxFQUFFLE1BQU0sRUFBRSxFQUNoQixNQUFNLEVBQUUsQ0FBQyxJQUFJLEVBQUUsVUFBVSxFQUFFLEtBQUssRUFBRSxVQUFVLEtBQUssT0FBTyxDQUFDLE1BQU0sQ0FBQyxXQUFXLENBQUMsQ0FBQyxFQUM3RSxTQUFTLHNCQUFtQixHQUMzQixPQUFPLENBQUMsTUFBTSxDQUFDLENBNkJqQjtBQU1ELHdCQUFnQiwwQkFBMEIsQ0FDeEMsTUFBTSxFQUFFLE1BQU0sRUFBRSxFQUNoQixlQUFlLHNCQUFtQixFQUNsQyxTQUFTLHNCQUFtQixFQUM1QixNQUFNLDhGQUFnQixHQUNyQixNQUFNLENBR1IifQ==
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unbalanced_merkle_tree_root.d.ts","sourceRoot":"","sources":["../../src/trees/unbalanced_merkle_tree_root.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,wBAAwB,gEAA+E,CAAC;AAErH,eAAO,MAAM,mBAAmB,gEAA2D,CAAC;AAE5F;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,MAAM,EAAE,EAChB,MAAM,8FAAgB,EACtB,SAAS,sBAAmB,GAC3B,MAAM,CA6BR;AAED,wBAAsB,oCAAoC,CACxD,MAAM,EAAE,MAAM,EAAE,EAChB,MAAM,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,KAAK,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,EAC7E,SAAS,sBAAmB,GAC3B,OAAO,CAAC,MAAM,CAAC,CA6BjB;AAMD,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,MAAM,EAAE,EAChB,eAAe,sBAAmB,EAClC,SAAS,sBAAmB,EAC5B,MAAM,8FAAgB,GACrB,MAAM,CAGR"}
@@ -0,0 +1,83 @@
1
+ import { computeBalancedMerkleTreeRoot, computeBalancedMerkleTreeRootAsync } from './balanced_merkle_tree_root.js';
2
+ import { shaMerkleHash } from './hasher.js';
3
+ import { UnbalancedMerkleTreeCalculator } from './unbalanced_merkle_tree_calculator.js';
4
+ export const computeUnbalancedShaRoot = (leaves)=>computeUnbalancedMerkleTreeRoot(leaves, shaMerkleHash);
5
+ export const computeWonkyShaRoot = (leaves)=>computeWonkyMerkleTreeRoot(leaves);
6
+ /**
7
+ * Computes the Merkle root of an unbalanced tree.
8
+ *
9
+ * Unlike a balanced Merkle tree, which requires the number of leaves to be a power of two, an unbalanced tree can have
10
+ * any number of leaves.
11
+ *
12
+ * The tree is constructed by iteratively extracting the smallest power-of-two-sized subtrees from **right to left**.
13
+ * For each such subtree, it computes the subtree root and then combines all subtree roots (again from right to left)
14
+ * into a single root using the provided hash function.
15
+ *
16
+ * Note: We need the final tree to be as shallow as possible, to minimize the size of the sibling path required to prove
17
+ * membership of a leaf. Therefor, the computation proceeds from right to left - smaller subtrees must always be
18
+ * combined before being merged with a larger sibling on their left.
19
+ *
20
+ * For example, consider an unbalanced tree made of three subtrees of sizes 2, 4, and 8. If we combine the size-2 and
21
+ * size-4 subtrees first (producing a subtree of depth 3), and then merge it with the size-8 subtree (also depth 3), the
22
+ * resulting tree has a maximum depth of 4.
23
+ *
24
+ * But if we instead combine the size-4 and size-8 subtrees first (depth 4), and then merge with the size-2 subtree
25
+ * (depth 1), the final tree has a depth of 5.
26
+ */ export function computeUnbalancedMerkleTreeRoot(leaves, hasher = shaMerkleHash, emptyRoot = Buffer.alloc(32)) {
27
+ if (!leaves.length) {
28
+ return emptyRoot;
29
+ }
30
+ if (leaves.length === 1) {
31
+ return leaves[0];
32
+ }
33
+ let numRemainingLeaves = leaves.length;
34
+ let subtreeSize = 1;
35
+ let root;
36
+ while(numRemainingLeaves > 1){
37
+ if ((numRemainingLeaves & subtreeSize) !== 0) {
38
+ const subtreeLeaves = leaves.slice(numRemainingLeaves - subtreeSize, numRemainingLeaves);
39
+ const subtreeRoot = computeBalancedMerkleTreeRoot(subtreeLeaves, hasher);
40
+ if (!root) {
41
+ root = subtreeRoot;
42
+ } else {
43
+ root = hasher(subtreeRoot, root);
44
+ }
45
+ numRemainingLeaves -= subtreeSize;
46
+ }
47
+ subtreeSize *= 2;
48
+ }
49
+ return root;
50
+ }
51
+ export async function computeUnbalancedMerkleTreeRootAsync(leaves, hasher, emptyRoot = Buffer.alloc(32)) {
52
+ if (!leaves.length) {
53
+ return emptyRoot;
54
+ }
55
+ if (leaves.length === 1) {
56
+ return leaves[0];
57
+ }
58
+ let numRemainingLeaves = leaves.length;
59
+ let subtreeSize = 1;
60
+ let root;
61
+ while(numRemainingLeaves > 1){
62
+ if ((numRemainingLeaves & subtreeSize) !== 0) {
63
+ const subtreeLeaves = leaves.slice(numRemainingLeaves - subtreeSize, numRemainingLeaves);
64
+ const subtreeRoot = await computeBalancedMerkleTreeRootAsync(subtreeLeaves, hasher);
65
+ if (!root) {
66
+ root = subtreeRoot;
67
+ } else {
68
+ root = await hasher(subtreeRoot, root);
69
+ }
70
+ numRemainingLeaves -= subtreeSize;
71
+ }
72
+ subtreeSize *= 2;
73
+ }
74
+ return root;
75
+ }
76
+ // A **wonky** tree is a "compressed" unbalanced Merkle tree.
77
+ // It is constructed in the same way as an unbalanced tree: by first creating the largest possible left subtree, with
78
+ // the remaining leaves forming a right subtree that follows the same process recursively.
79
+ // During construction, leaves equal to `valueToCompress` are skipped (compressed) and do not contribute to the tree.
80
+ export function computeWonkyMerkleTreeRoot(leaves, valueToCompress = Buffer.alloc(32), emptyRoot = Buffer.alloc(32), hasher = shaMerkleHash) {
81
+ const calculator = UnbalancedMerkleTreeCalculator.create(leaves, valueToCompress, emptyRoot, hasher);
82
+ return calculator.getRoot();
83
+ }
@@ -0,0 +1,24 @@
1
+ export interface TreeNodeLocation {
2
+ level: number;
3
+ index: number;
4
+ }
5
+ export declare class UnbalancedTreeStore<T> {
6
+ #private;
7
+ constructor(numLeaves: number);
8
+ setLeaf(leafIndex: number, value: T): TreeNodeLocation;
9
+ setNode({ level, index }: TreeNodeLocation, value: T): void;
10
+ getParentLocation({ level, index }: TreeNodeLocation): TreeNodeLocation;
11
+ getSiblingLocation({ level, index }: TreeNodeLocation): TreeNodeLocation;
12
+ getChildLocations({ level, index }: TreeNodeLocation): [TreeNodeLocation, TreeNodeLocation];
13
+ getLeaf(leafIndex: number): T | undefined;
14
+ getNode(location: TreeNodeLocation): T | undefined;
15
+ getRoot(): T | undefined;
16
+ getParent(location: TreeNodeLocation): T | undefined;
17
+ getSibling(location: TreeNodeLocation): T | undefined;
18
+ getChildren(location: TreeNodeLocation): [T | undefined, T | undefined];
19
+ }
20
+ export declare function findLeafLevelAndIndex(numLeaves: number, leafIndex: number): {
21
+ level: number;
22
+ indexAtLevel: number;
23
+ };
24
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidW5iYWxhbmNlZF90cmVlX3N0b3JlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdHJlZXMvdW5iYWxhbmNlZF90cmVlX3N0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE1BQU0sV0FBVyxnQkFBZ0I7SUFDL0IsS0FBSyxFQUFFLE1BQU0sQ0FBQztJQUNkLEtBQUssRUFBRSxNQUFNLENBQUM7Q0FDZjtBQU9ELHFCQUFhLG1CQUFtQixDQUFDLENBQUM7O0lBSWhDLFlBQVksU0FBUyxFQUFFLE1BQU0sRUFFNUI7SUFFRCxPQUFPLENBQUMsU0FBUyxFQUFFLE1BQU0sRUFBRSxLQUFLLEVBQUUsQ0FBQyxHQUFHLGdCQUFnQixDQWVyRDtJQUVELE9BQU8sQ0FBQyxFQUFFLEtBQUssRUFBRSxLQUFLLEVBQUUsRUFBRSxnQkFBZ0IsRUFBRSxLQUFLLEVBQUUsQ0FBQyxRQVNuRDtJQUVELGlCQUFpQixDQUFDLEVBQUUsS0FBSyxFQUFFLEtBQUssRUFBRSxFQUFFLGdCQUFnQixHQUFHLGdCQUFnQixDQU10RTtJQUVELGtCQUFrQixDQUFDLEVBQUUsS0FBSyxFQUFFLEtBQUssRUFBRSxFQUFFLGdCQUFnQixHQUFHLGdCQUFnQixDQU12RTtJQUVELGlCQUFpQixDQUFDLEVBQUUsS0FBSyxFQUFF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