@aztec/foundation 0.0.1-commit.b655e406 → 0.0.1-commit.c31f2472
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.
- package/dest/array/array.d.ts +1 -9
- package/dest/array/array.d.ts.map +1 -1
- package/dest/array/array.js +0 -11
- package/dest/array/index.d.ts +2 -1
- package/dest/array/index.d.ts.map +1 -1
- package/dest/array/index.js +1 -0
- package/dest/array/sorted_array.d.ts +10 -0
- package/dest/array/sorted_array.d.ts.map +1 -0
- package/dest/array/sorted_array.js +106 -0
- package/dest/async-map/index.d.ts +1 -1
- package/dest/async-pool/index.d.ts +1 -1
- package/dest/bigint/index.d.ts +1 -1
- package/dest/bigint-buffer/index.d.ts +1 -1
- package/dest/branded-types/block_number.d.ts +56 -0
- package/dest/branded-types/block_number.d.ts.map +1 -0
- package/dest/branded-types/block_number.js +78 -0
- package/dest/branded-types/checkpoint_number.d.ts +54 -0
- package/dest/branded-types/checkpoint_number.d.ts.map +1 -0
- package/dest/branded-types/checkpoint_number.js +77 -0
- package/dest/branded-types/epoch.d.ts +42 -0
- package/dest/branded-types/epoch.d.ts.map +1 -0
- package/dest/branded-types/epoch.js +59 -0
- package/dest/branded-types/index.d.ts +7 -0
- package/dest/branded-types/index.d.ts.map +1 -0
- package/dest/branded-types/index.js +5 -0
- package/dest/branded-types/index_within_checkpoint.d.ts +42 -0
- package/dest/branded-types/index_within_checkpoint.d.ts.map +1 -0
- package/dest/branded-types/index_within_checkpoint.js +59 -0
- package/dest/branded-types/slot.d.ts +42 -0
- package/dest/branded-types/slot.d.ts.map +1 -0
- package/dest/branded-types/slot.js +59 -0
- package/dest/branded-types/types.d.ts +5 -0
- package/dest/branded-types/types.d.ts.map +1 -0
- package/dest/branded-types/types.js +1 -0
- package/dest/buffer/buffer16.d.ts +2 -2
- package/dest/buffer/buffer16.d.ts.map +1 -1
- package/dest/buffer/buffer16.js +4 -2
- package/dest/buffer/buffer32.d.ts +2 -2
- package/dest/buffer/buffer32.d.ts.map +1 -1
- package/dest/buffer/buffer32.js +4 -2
- package/dest/buffer/index.d.ts +1 -1
- package/dest/collection/array.d.ts +12 -1
- package/dest/collection/array.d.ts.map +1 -1
- package/dest/collection/array.js +51 -0
- package/dest/collection/index.d.ts +1 -1
- package/dest/collection/object.d.ts +1 -1
- package/dest/committable/committable.d.ts +1 -1
- package/dest/committable/committable.d.ts.map +1 -1
- package/dest/committable/index.d.ts +1 -1
- package/dest/config/env_var.d.ts +2 -2
- package/dest/config/env_var.d.ts.map +1 -1
- package/dest/config/index.d.ts +15 -4
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +32 -9
- package/dest/config/network_config.d.ts +13 -1
- package/dest/config/network_config.d.ts.map +1 -1
- package/dest/config/network_config.js +3 -1
- package/dest/config/network_name.d.ts +1 -1
- package/dest/config/parse-env.d.ts +3 -0
- package/dest/config/parse-env.d.ts.map +1 -0
- package/dest/config/parse-env.js +7 -0
- package/dest/config/secret_value.d.ts +1 -1
- package/dest/config/secret_value.d.ts.map +1 -1
- package/dest/config/secret_value.js +3 -1
- package/dest/crypto/aes128/index.d.ts +1 -1
- package/dest/crypto/aes128/index.d.ts.map +1 -1
- package/dest/crypto/aes128/index.js +2 -6
- package/dest/crypto/bls/bn254_keystore.d.ts +15 -15
- package/dest/crypto/bls/bn254_keystore.d.ts.map +1 -1
- package/dest/crypto/bls/bn254_keystore.js +1 -1
- package/dest/crypto/bls/index.d.ts +1 -1
- package/dest/crypto/bls/index.js +1 -1
- package/dest/crypto/bn254/index.d.ts +35 -51
- package/dest/crypto/bn254/index.d.ts.map +1 -1
- package/dest/crypto/bn254/index.js +51 -137
- package/dest/crypto/ecdsa/index.d.ts +1 -1
- package/dest/crypto/ecdsa/index.d.ts.map +1 -1
- package/dest/crypto/ecdsa/index.js +4 -12
- package/dest/crypto/ecdsa/signature.d.ts +2 -2
- package/dest/crypto/ecdsa/signature.d.ts.map +1 -1
- package/dest/crypto/ecdsa/signature.js +2 -2
- package/dest/crypto/grumpkin/index.d.ts +4 -2
- package/dest/crypto/grumpkin/index.d.ts.map +1 -1
- package/dest/crypto/grumpkin/index.js +7 -16
- package/dest/crypto/keccak/index.d.ts +1 -1
- package/dest/crypto/keys/index.d.ts +2 -2
- package/dest/crypto/keys/index.d.ts.map +1 -1
- package/dest/crypto/keys/index.js +2 -4
- package/dest/crypto/pedersen/index.d.ts +1 -1
- package/dest/crypto/pedersen/pedersen.noble.d.ts +1 -1
- package/dest/crypto/pedersen/pedersen.wasm.d.ts +2 -2
- package/dest/crypto/pedersen/pedersen.wasm.d.ts.map +1 -1
- package/dest/crypto/pedersen/pedersen.wasm.js +4 -10
- package/dest/crypto/poseidon/index.d.ts +2 -3
- package/dest/crypto/poseidon/index.d.ts.map +1 -1
- package/dest/crypto/poseidon/index.js +5 -24
- package/dest/crypto/random/index.d.ts +1 -1
- package/dest/crypto/random/index.d.ts.map +1 -1
- package/dest/crypto/random/randomness_singleton.d.ts +4 -3
- package/dest/crypto/random/randomness_singleton.d.ts.map +1 -1
- package/dest/crypto/random/randomness_singleton.js +5 -5
- package/dest/crypto/schnorr/index.d.ts +3 -2
- package/dest/crypto/schnorr/index.d.ts.map +1 -1
- package/dest/crypto/schnorr/index.js +4 -10
- package/dest/crypto/schnorr/signature.d.ts +2 -2
- package/dest/crypto/schnorr/signature.d.ts.map +1 -1
- package/dest/crypto/schnorr/signature.js +2 -2
- package/dest/crypto/secp256k1/index.d.ts +1 -1
- package/dest/crypto/secp256k1/index.d.ts.map +1 -1
- package/dest/crypto/secp256k1/index.js +3 -9
- package/dest/crypto/secp256k1-signer/index.d.ts +1 -1
- package/dest/crypto/secp256k1-signer/secp256k1_signer.d.ts +1 -1
- package/dest/crypto/secp256k1-signer/secp256k1_signer.d.ts.map +1 -1
- package/dest/crypto/secp256k1-signer/utils.d.ts +1 -1
- package/dest/crypto/secp256k1-signer/utils.d.ts.map +1 -1
- package/dest/crypto/serialize.d.ts +1 -1
- package/dest/crypto/sha256/index.d.ts +2 -2
- package/dest/crypto/sha256/index.d.ts.map +1 -1
- package/dest/crypto/sha256/index.js +1 -1
- package/dest/crypto/sha512/index.d.ts +3 -3
- package/dest/crypto/sha512/index.d.ts.map +1 -1
- package/dest/crypto/sha512/index.js +1 -1
- package/dest/crypto/signature/index.d.ts +2 -2
- package/dest/crypto/signature/index.d.ts.map +1 -1
- package/dest/crypto/sync/index.d.ts +1 -1
- package/dest/crypto/sync/index.js +1 -3
- package/dest/crypto/sync/pedersen/index.d.ts +2 -2
- package/dest/crypto/sync/pedersen/index.d.ts.map +1 -1
- package/dest/crypto/sync/pedersen/index.js +1 -1
- package/dest/crypto/sync/poseidon/index.d.ts +2 -3
- package/dest/crypto/sync/poseidon/index.d.ts.map +1 -1
- package/dest/crypto/sync/poseidon/index.js +1 -9
- package/dest/{fields/bls12_fields.d.ts → curves/bls12/field.d.ts} +3 -3
- package/dest/curves/bls12/field.d.ts.map +1 -0
- package/dest/{fields/bls12_fields.js → curves/bls12/field.js} +12 -9
- package/dest/curves/bls12/index.d.ts +3 -0
- package/dest/curves/bls12/index.d.ts.map +1 -0
- package/dest/curves/bls12/index.js +2 -0
- package/dest/{fields/bls12_point.d.ts → curves/bls12/point.d.ts} +4 -4
- package/dest/curves/bls12/point.d.ts.map +1 -0
- package/dest/{fields/bls12_point.js → curves/bls12/point.js} +10 -8
- package/dest/{fields/fields.d.ts → curves/bn254/field.d.ts} +16 -15
- package/dest/curves/bn254/field.d.ts.map +1 -0
- package/dest/{fields/fields.js → curves/bn254/field.js} +49 -49
- package/dest/curves/bn254/index.d.ts +3 -0
- package/dest/curves/bn254/index.d.ts.map +1 -0
- package/dest/curves/bn254/index.js +2 -0
- package/dest/curves/bn254/point.d.ts +54 -0
- package/dest/curves/bn254/point.d.ts.map +1 -0
- package/dest/curves/bn254/point.js +143 -0
- package/dest/curves/grumpkin/index.d.ts +10 -0
- package/dest/curves/grumpkin/index.d.ts.map +1 -0
- package/dest/curves/grumpkin/index.js +3 -0
- package/dest/{fields → curves/grumpkin}/point.d.ts +12 -3
- package/dest/curves/grumpkin/point.d.ts.map +1 -0
- package/dest/{fields → curves/grumpkin}/point.js +24 -7
- package/dest/decorators/index.d.ts +1 -1
- package/dest/decorators/memoize.d.ts +1 -1
- package/dest/decorators/memoize.d.ts.map +1 -1
- package/dest/error/index.d.ts +1 -1
- package/dest/eth-address/index.d.ts +12 -2
- package/dest/eth-address/index.d.ts.map +1 -1
- package/dest/eth-address/index.js +27 -3
- package/dest/eth-signature/eth_signature.d.ts +1 -1
- package/dest/eth-signature/eth_signature.d.ts.map +1 -1
- package/dest/eth-signature/index.d.ts +1 -1
- package/dest/fs/index.d.ts +1 -1
- package/dest/fs/run_in_dir.d.ts +1 -1
- package/dest/fs/try_rm_dir.d.ts +1 -1
- package/dest/iterable/all.d.ts +1 -1
- package/dest/iterable/filter.d.ts +1 -1
- package/dest/iterable/index.d.ts +1 -1
- package/dest/iterable/isAsyncIt.d.ts +1 -1
- package/dest/iterable/map.d.ts +1 -1
- package/dest/iterable/peek.d.ts +1 -1
- package/dest/iterable/sort.d.ts +1 -1
- package/dest/iterable/take.d.ts +1 -1
- package/dest/iterable/toArray.d.ts +1 -1
- package/dest/iterator/filter.d.ts +3 -0
- package/dest/iterator/filter.d.ts.map +1 -0
- package/dest/iterator/filter.js +7 -0
- package/dest/iterator/index.d.ts +2 -0
- package/dest/iterator/index.d.ts.map +1 -0
- package/dest/iterator/index.js +1 -0
- package/dest/jest/setup.js +4 -1
- package/dest/json-rpc/client/fetch.d.ts +1 -1
- package/dest/json-rpc/client/index.d.ts +1 -1
- package/dest/json-rpc/client/safe_json_rpc_client.d.ts +1 -1
- package/dest/json-rpc/client/undici.d.ts +1 -1
- package/dest/json-rpc/client/undici.d.ts.map +1 -1
- package/dest/json-rpc/client/undici.js +21 -4
- package/dest/json-rpc/convert.d.ts +1 -1
- package/dest/json-rpc/errors.d.ts +1 -1
- package/dest/json-rpc/errors.d.ts.map +1 -1
- package/dest/json-rpc/fixtures/class_a.d.ts +1 -1
- package/dest/json-rpc/fixtures/class_a.d.ts.map +1 -1
- package/dest/json-rpc/fixtures/class_b.d.ts +1 -1
- package/dest/json-rpc/fixtures/class_b.d.ts.map +1 -1
- package/dest/json-rpc/fixtures/test_state.d.ts +1 -1
- package/dest/json-rpc/fixtures/test_state.d.ts.map +1 -1
- package/dest/json-rpc/index.d.ts +1 -1
- package/dest/json-rpc/js_utils.d.ts +1 -1
- package/dest/json-rpc/js_utils.d.ts.map +1 -1
- package/dest/json-rpc/server/index.d.ts +1 -1
- package/dest/json-rpc/server/safe_json_rpc_server.d.ts +1 -1
- package/dest/json-rpc/server/safe_json_rpc_server.d.ts.map +1 -1
- package/dest/json-rpc/server/safe_json_rpc_server.js +1 -1
- package/dest/json-rpc/test/index.d.ts +1 -1
- package/dest/json-rpc/test/integration.d.ts +1 -1
- package/dest/log/console.d.ts +1 -1
- package/dest/log/gcloud-logger-config.d.ts +1 -1
- package/dest/log/gcloud-logger-config.d.ts.map +1 -1
- package/dest/log/index.d.ts +1 -1
- package/dest/log/libp2p_logger.d.ts +5 -2
- package/dest/log/libp2p_logger.d.ts.map +1 -1
- package/dest/log/libp2p_logger.js +14 -4
- package/dest/log/log-filters.d.ts +1 -1
- package/dest/log/log-levels.d.ts +1 -1
- package/dest/log/log_fn.d.ts +1 -1
- package/dest/log/noir_debug_log_util.d.ts +1 -1
- package/dest/log/pino-logger-server.d.ts +9 -0
- package/dest/log/pino-logger-server.d.ts.map +1 -0
- package/dest/log/pino-logger-server.js +18 -0
- package/dest/log/pino-logger.d.ts +38 -9
- package/dest/log/pino-logger.d.ts.map +1 -1
- package/dest/log/pino-logger.js +116 -27
- package/dest/message/index.d.ts +1 -1
- package/dest/message/index.d.ts.map +1 -1
- package/dest/mutex/index.d.ts +1 -1
- package/dest/mutex/index.d.ts.map +1 -1
- package/dest/mutex/mutex_database.d.ts +1 -1
- package/dest/noir/index.d.ts +1 -1
- package/dest/noir/noir_package_config.d.ts +9 -9
- package/dest/number/index.d.ts +1 -1
- package/dest/profiler/index.d.ts +1 -1
- package/dest/profiler/profiler.d.ts +1 -1
- package/dest/promise/index.d.ts +1 -1
- package/dest/promise/running-promise.d.ts +1 -1
- package/dest/promise/running-promise.d.ts.map +1 -1
- package/dest/promise/utils.d.ts +1 -1
- package/dest/queue/base_memory_queue.d.ts +1 -1
- package/dest/queue/base_memory_queue.d.ts.map +1 -1
- package/dest/queue/batch_queue.d.ts +1 -1
- package/dest/queue/batch_queue.d.ts.map +1 -1
- package/dest/queue/bounded_serial_queue.d.ts +1 -1
- package/dest/queue/bounded_serial_queue.d.ts.map +1 -1
- package/dest/queue/fifo_memory_queue.d.ts +1 -1
- package/dest/queue/fifo_memory_queue.d.ts.map +1 -1
- package/dest/queue/index.d.ts +1 -1
- package/dest/queue/priority_memory_queue.d.ts +1 -1
- package/dest/queue/priority_memory_queue.d.ts.map +1 -1
- package/dest/queue/priority_queue.d.ts +1 -1
- package/dest/queue/priority_queue.d.ts.map +1 -1
- package/dest/queue/semaphore.d.ts +5 -1
- package/dest/queue/semaphore.d.ts.map +1 -1
- package/dest/queue/serial_queue.d.ts +1 -1
- package/dest/queue/serial_queue.d.ts.map +1 -1
- package/dest/retry/index.d.ts +11 -1
- package/dest/retry/index.d.ts.map +1 -1
- package/dest/retry/index.js +11 -0
- package/dest/running-promise/index.d.ts +1 -1
- package/dest/schemas/api.d.ts +1 -1
- package/dest/schemas/index.d.ts +1 -1
- package/dest/schemas/parse.d.ts +1 -1
- package/dest/schemas/schemas.d.ts +15 -17
- package/dest/schemas/schemas.d.ts.map +1 -1
- package/dest/schemas/schemas.js +14 -10
- package/dest/schemas/types.d.ts +31 -1
- package/dest/schemas/types.d.ts.map +1 -1
- package/dest/schemas/types.js +25 -1
- package/dest/schemas/utils.d.ts +4 -4
- package/dest/schemas/utils.d.ts.map +1 -1
- package/dest/schemas/utils.js +15 -5
- package/dest/serialize/buffer_reader.d.ts +7 -4
- package/dest/serialize/buffer_reader.d.ts.map +1 -1
- package/dest/serialize/buffer_reader.js +13 -4
- package/dest/serialize/field_reader.d.ts +2 -2
- package/dest/serialize/field_reader.d.ts.map +1 -1
- package/dest/serialize/field_reader.js +1 -1
- package/dest/serialize/free_funcs.d.ts +2 -2
- package/dest/serialize/free_funcs.d.ts.map +1 -1
- package/dest/serialize/free_funcs.js +1 -1
- package/dest/serialize/index.d.ts +1 -1
- package/dest/serialize/serialize.d.ts +2 -2
- package/dest/serialize/serialize.d.ts.map +1 -1
- package/dest/serialize/serialize.js +1 -1
- package/dest/serialize/type_registry.d.ts +1 -1
- package/dest/serialize/type_registry.d.ts.map +1 -1
- package/dest/serialize/types.d.ts +1 -1
- package/dest/sleep/index.d.ts +3 -1
- package/dest/sleep/index.d.ts.map +1 -1
- package/dest/sleep/index.js +4 -0
- package/dest/string/index.d.ts +1 -1
- package/dest/testing/files/index.d.ts +2 -1
- package/dest/testing/files/index.d.ts.map +1 -1
- package/dest/testing/files/index.js +1 -1
- package/dest/testing/formatting.d.ts +1 -1
- package/dest/testing/index.d.ts +1 -1
- package/dest/testing/port_allocator.d.ts +1 -1
- package/dest/testing/snapshot_serializer.d.ts +1 -1
- package/dest/testing/test_data.d.ts +1 -1
- package/dest/timer/date.d.ts +2 -1
- package/dest/timer/date.d.ts.map +1 -1
- package/dest/timer/date.js +3 -0
- package/dest/timer/elapsed.d.ts +1 -1
- package/dest/timer/index.d.ts +1 -1
- package/dest/timer/timeout.d.ts +1 -1
- package/dest/timer/timeout.d.ts.map +1 -1
- package/dest/timer/timer.d.ts +1 -1
- package/dest/timer/timer.d.ts.map +1 -1
- package/dest/transport/dispatch/create_dispatch_fn.d.ts +1 -1
- package/dest/transport/dispatch/create_dispatch_fn.d.ts.map +1 -1
- package/dest/transport/dispatch/create_dispatch_proxy.d.ts +1 -1
- package/dest/transport/dispatch/messages.d.ts +1 -1
- package/dest/transport/index.d.ts +1 -1
- package/dest/transport/interface/connector.d.ts +1 -1
- package/dest/transport/interface/listener.d.ts +1 -1
- package/dest/transport/interface/socket.d.ts +1 -1
- package/dest/transport/interface/transferable.d.ts +1 -1
- package/dest/transport/node/index.d.ts +1 -1
- package/dest/transport/node/node_connector.d.ts +1 -1
- package/dest/transport/node/node_connector.d.ts.map +1 -1
- package/dest/transport/node/node_connector_socket.d.ts +1 -1
- package/dest/transport/node/node_connector_socket.d.ts.map +1 -1
- package/dest/transport/node/node_listener.d.ts +1 -1
- package/dest/transport/node/node_listener.d.ts.map +1 -1
- package/dest/transport/node/node_listener_socket.d.ts +1 -1
- package/dest/transport/node/node_listener_socket.d.ts.map +1 -1
- package/dest/transport/transport_client.d.ts +1 -1
- package/dest/transport/transport_client.d.ts.map +1 -1
- package/dest/transport/transport_server.d.ts +1 -10
- package/dest/transport/transport_server.d.ts.map +1 -1
- package/dest/trees/balanced_merkle_tree_root.d.ts +17 -0
- package/dest/trees/balanced_merkle_tree_root.d.ts.map +1 -0
- package/dest/trees/balanced_merkle_tree_root.js +51 -0
- package/dest/trees/hasher.d.ts +3 -1
- package/dest/trees/hasher.d.ts.map +1 -1
- package/dest/trees/hasher.js +10 -5
- package/dest/trees/index.d.ts +4 -3
- package/dest/trees/index.d.ts.map +1 -1
- package/dest/trees/index.js +3 -2
- package/dest/trees/indexed_merkle_tree.d.ts +1 -1
- package/dest/trees/indexed_merkle_tree.d.ts.map +1 -1
- package/dest/trees/indexed_merkle_tree.js +1 -1
- package/dest/trees/indexed_merkle_tree_calculator.d.ts +1 -1
- package/dest/trees/indexed_merkle_tree_calculator.d.ts.map +1 -1
- package/dest/trees/indexed_tree_leaf.d.ts +1 -1
- package/dest/trees/membership_witness.d.ts +7 -18
- package/dest/trees/membership_witness.d.ts.map +1 -1
- package/dest/trees/membership_witness.js +10 -1
- package/dest/trees/merkle_tree.d.ts +1 -1
- package/dest/trees/merkle_tree.d.ts.map +1 -1
- package/dest/trees/merkle_tree_calculator.d.ts +2 -12
- package/dest/trees/merkle_tree_calculator.d.ts.map +1 -1
- package/dest/trees/merkle_tree_calculator.js +2 -32
- package/dest/trees/sibling_path.d.ts +5 -38
- package/dest/trees/sibling_path.d.ts.map +1 -1
- package/dest/trees/sibling_path.js +3 -3
- package/dest/trees/unbalanced_merkle_tree_calculator.d.ts +6 -6
- package/dest/trees/unbalanced_merkle_tree_calculator.d.ts.map +1 -1
- package/dest/trees/unbalanced_merkle_tree_calculator.js +34 -42
- package/dest/trees/unbalanced_merkle_tree_root.d.ts +28 -0
- package/dest/trees/unbalanced_merkle_tree_root.d.ts.map +1 -0
- package/dest/trees/unbalanced_merkle_tree_root.js +84 -0
- package/dest/trees/unbalanced_tree_store.d.ts +5 -1
- package/dest/trees/unbalanced_tree_store.d.ts.map +1 -1
- package/dest/trees/unbalanced_tree_store.js +49 -1
- package/dest/types/index.d.ts +4 -2
- package/dest/types/index.d.ts.map +1 -1
- package/dest/types/index.js +3 -0
- package/dest/url/index.d.ts +1 -1
- package/dest/validation/index.d.ts +1 -1
- package/package.json +30 -9
- package/src/array/array.ts +0 -16
- package/src/array/index.ts +1 -0
- package/src/array/sorted_array.ts +133 -0
- package/src/branded-types/block_number.ts +117 -0
- package/src/branded-types/checkpoint_number.ts +115 -0
- package/src/branded-types/epoch.ts +88 -0
- package/src/branded-types/index.ts +7 -0
- package/src/branded-types/index_within_checkpoint.ts +88 -0
- package/src/branded-types/slot.ts +88 -0
- package/src/branded-types/types.ts +2 -0
- package/src/buffer/buffer16.ts +2 -2
- package/src/buffer/buffer32.ts +2 -2
- package/src/collection/array.ts +52 -0
- package/src/config/env_var.ts +50 -13
- package/src/config/index.ts +39 -6
- package/src/config/network_config.ts +2 -0
- package/src/config/parse-env.ts +4 -0
- package/src/crypto/aes128/index.ts +2 -2
- package/src/crypto/bls/bn254_keystore.ts +1 -1
- package/src/crypto/bls/index.ts +1 -1
- package/src/crypto/bn254/index.ts +50 -156
- package/src/crypto/ecdsa/index.ts +4 -4
- package/src/crypto/ecdsa/signature.ts +2 -2
- package/src/crypto/grumpkin/index.ts +8 -6
- package/src/crypto/keys/index.ts +2 -2
- package/src/crypto/pedersen/pedersen.wasm.ts +4 -4
- package/src/crypto/poseidon/index.ts +5 -15
- package/src/crypto/random/randomness_singleton.ts +6 -4
- package/src/crypto/schnorr/index.ts +5 -4
- package/src/crypto/schnorr/signature.ts +2 -2
- package/src/crypto/secp256k1/index.ts +3 -3
- package/src/crypto/sha256/index.ts +1 -1
- package/src/crypto/sha512/index.ts +1 -1
- package/src/crypto/signature/index.ts +1 -1
- package/src/crypto/sync/index.ts +1 -1
- package/src/crypto/sync/pedersen/index.ts +1 -1
- package/src/crypto/sync/poseidon/index.ts +1 -10
- package/src/{fields/bls12_fields.ts → curves/bls12/field.ts} +6 -6
- package/src/curves/bls12/index.ts +2 -0
- package/src/{fields/bls12_point.ts → curves/bls12/point.ts} +7 -7
- package/src/{fields/fields.ts → curves/bn254/field.ts} +49 -56
- package/src/curves/bn254/index.ts +2 -0
- package/src/curves/bn254/point.ts +170 -0
- package/src/curves/grumpkin/index.ts +11 -0
- package/src/{fields → curves/grumpkin}/point.ts +26 -7
- package/src/eth-address/index.ts +27 -2
- package/src/iterator/filter.ts +11 -0
- package/src/iterator/index.ts +1 -0
- package/src/jest/setup.mjs +4 -1
- package/src/json-rpc/client/undici.ts +21 -3
- package/src/json-rpc/server/safe_json_rpc_server.ts +1 -1
- package/src/log/libp2p_logger.ts +12 -5
- package/src/log/pino-logger-server.ts +25 -0
- package/src/log/pino-logger.ts +138 -37
- package/src/queue/semaphore.ts +5 -0
- package/src/retry/index.ts +18 -0
- package/src/schemas/schemas.ts +24 -13
- package/src/schemas/types.ts +33 -0
- package/src/schemas/utils.ts +21 -8
- package/src/serialize/buffer_reader.ts +21 -9
- package/src/serialize/field_reader.ts +1 -1
- package/src/serialize/free_funcs.ts +1 -1
- package/src/serialize/serialize.ts +1 -1
- package/src/sleep/index.ts +6 -0
- package/src/testing/files/index.ts +1 -1
- package/src/timer/date.ts +4 -0
- package/src/trees/balanced_merkle_tree_root.ts +68 -0
- package/src/trees/hasher.ts +9 -0
- package/src/trees/index.ts +3 -2
- package/src/trees/indexed_merkle_tree.ts +1 -1
- package/src/trees/membership_witness.ts +9 -1
- package/src/trees/merkle_tree_calculator.ts +2 -35
- package/src/trees/sibling_path.ts +3 -3
- package/src/trees/unbalanced_merkle_tree_calculator.ts +32 -50
- package/src/trees/unbalanced_merkle_tree_root.ts +115 -0
- package/src/trees/unbalanced_tree_store.ts +57 -2
- package/src/types/index.ts +6 -1
- package/dest/crypto/bn254/bn254_utils.d.ts +0 -39
- package/dest/crypto/bn254/bn254_utils.d.ts.map +0 -1
- package/dest/crypto/bn254/bn254_utils.js +0 -56
- package/dest/crypto/index.d.ts +0 -17
- package/dest/crypto/index.d.ts.map +0 -1
- package/dest/crypto/index.js +0 -16
- package/dest/fields/bls12_fields.d.ts.map +0 -1
- package/dest/fields/bls12_point.d.ts.map +0 -1
- package/dest/fields/coordinate.d.ts +0 -66
- package/dest/fields/coordinate.d.ts.map +0 -1
- package/dest/fields/coordinate.js +0 -96
- package/dest/fields/fields.d.ts.map +0 -1
- package/dest/fields/index.d.ts +0 -6
- package/dest/fields/index.d.ts.map +0 -1
- package/dest/fields/index.js +0 -5
- package/dest/fields/point.d.ts.map +0 -1
- package/dest/index.d.ts +0 -30
- package/dest/index.d.ts.map +0 -1
- package/dest/index.js +0 -30
- package/dest/json-rpc/server/telemetry.d.ts +0 -2
- package/dest/json-rpc/server/telemetry.d.ts.map +0 -1
- package/dest/json-rpc/server/telemetry.js +0 -0
- package/dest/trees/unbalanced_merkle_tree.d.ts +0 -28
- package/dest/trees/unbalanced_merkle_tree.d.ts.map +0 -1
- package/dest/trees/unbalanced_merkle_tree.js +0 -99
- package/src/crypto/bn254/bn254_utils.ts +0 -64
- package/src/crypto/index.ts +0 -16
- package/src/fields/coordinate.ts +0 -104
- package/src/fields/index.ts +0 -5
- package/src/index.ts +0 -30
- package/src/json-rpc/server/telemetry.ts +0 -0
- package/src/trees/unbalanced_merkle_tree.ts +0 -111
|
@@ -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));
|
package/src/buffer/buffer16.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { randomBytes } from '@aztec/foundation/crypto';
|
|
2
|
-
import type { Fr } from '@aztec/foundation/
|
|
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';
|
package/src/buffer/buffer32.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { randomBytes } from '@aztec/foundation/crypto';
|
|
2
|
-
import type { Fr } from '@aztec/foundation/
|
|
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';
|
package/src/collection/array.ts
CHANGED
|
@@ -250,6 +250,58 @@ export function chunk<T>(items: T[], chunkSize: number): T[][] {
|
|
|
250
250
|
return chunks;
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
+
/**
|
|
254
|
+
* Splits the given array into chunks of the given size, wrapping around to the beginning
|
|
255
|
+
* if the last chunk would be smaller than the requested size.
|
|
256
|
+
* Returns empty array for empty input. Returns single chunk with all items if chunkSize <= 0.
|
|
257
|
+
*/
|
|
258
|
+
export function chunkWrapAround<T>(items: T[], chunkSize: number): T[][] {
|
|
259
|
+
if (items.length === 0) {
|
|
260
|
+
return [];
|
|
261
|
+
}
|
|
262
|
+
if (chunkSize <= 0 || items.length <= chunkSize) {
|
|
263
|
+
return [items];
|
|
264
|
+
}
|
|
265
|
+
const remainder = items.length % chunkSize;
|
|
266
|
+
if (remainder === 0) {
|
|
267
|
+
return chunk(items, chunkSize);
|
|
268
|
+
}
|
|
269
|
+
const wrapAroundCount = chunkSize - remainder;
|
|
270
|
+
const wrappedItems = [...items, ...items.slice(0, wrapAroundCount)];
|
|
271
|
+
return chunk(wrappedItems, chunkSize);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
const UNINITIALIZED = Symbol('uninitialized');
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Splits the given iterable into chunks based on the key returned by the given function.
|
|
278
|
+
* Items must be contiguous to be included in the same chunk.
|
|
279
|
+
*/
|
|
280
|
+
export function chunkBy<T, U>(items: T[], fn: (item: T) => U): T[][] {
|
|
281
|
+
const chunks: T[][] = [];
|
|
282
|
+
let currentChunk: T[] = [];
|
|
283
|
+
let currentKey: U | typeof UNINITIALIZED = UNINITIALIZED;
|
|
284
|
+
|
|
285
|
+
for (const item of items) {
|
|
286
|
+
const key = fn(item);
|
|
287
|
+
if (currentKey === UNINITIALIZED || key !== currentKey) {
|
|
288
|
+
if (currentChunk.length > 0) {
|
|
289
|
+
chunks.push(currentChunk);
|
|
290
|
+
}
|
|
291
|
+
currentChunk = [item];
|
|
292
|
+
currentKey = key;
|
|
293
|
+
} else {
|
|
294
|
+
currentChunk.push(item);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
if (currentChunk.length > 0) {
|
|
299
|
+
chunks.push(currentChunk);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
return chunks;
|
|
303
|
+
}
|
|
304
|
+
|
|
253
305
|
/** Partitions the given iterable into two arrays based on the predicate. */
|
|
254
306
|
export function partition<T>(items: T[], predicate: (item: T) => boolean): [T[], T[]] {
|
|
255
307
|
const pass: T[] = [];
|
package/src/config/env_var.ts
CHANGED
|
@@ -21,12 +21,13 @@ export type EnvVar =
|
|
|
21
21
|
| 'BB_NUM_IVC_VERIFIERS'
|
|
22
22
|
| 'BB_IVC_CONCURRENCY'
|
|
23
23
|
| 'BOOTSTRAP_NODES'
|
|
24
|
-
| '
|
|
25
|
-
| '
|
|
26
|
-
| '
|
|
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
|
-
| '
|
|
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'
|
|
@@ -75,6 +77,7 @@ export type EnvVar =
|
|
|
75
77
|
| 'L1_CONSENSUS_HOST_API_KEY_HEADERS'
|
|
76
78
|
| 'LOG_JSON'
|
|
77
79
|
| 'LOG_MULTILINE'
|
|
80
|
+
| 'LOG_NO_COLOR_PER_ACTOR'
|
|
78
81
|
| 'LOG_LEVEL'
|
|
79
82
|
| 'MNEMONIC'
|
|
80
83
|
| 'NETWORK'
|
|
@@ -86,11 +89,16 @@ export type EnvVar =
|
|
|
86
89
|
| 'OTEL_EXPORTER_OTLP_LOGS_ENDPOINT'
|
|
87
90
|
| 'OTEL_COLLECT_INTERVAL_MS'
|
|
88
91
|
| 'OTEL_EXCLUDE_METRICS'
|
|
92
|
+
| 'OTEL_INCLUDE_METRICS'
|
|
89
93
|
| 'OTEL_EXPORT_TIMEOUT_MS'
|
|
90
94
|
| 'PUBLIC_OTEL_EXPORTER_OTLP_METRICS_ENDPOINT'
|
|
91
95
|
| 'PUBLIC_OTEL_INCLUDE_METRICS'
|
|
92
96
|
| 'PUBLIC_OTEL_COLLECT_FROM'
|
|
93
97
|
| 'PUBLIC_OTEL_OPT_OUT'
|
|
98
|
+
| 'P2P_BATCH_TX_REQUESTER_SMART_PARALLEL_WORKER_COUNT'
|
|
99
|
+
| 'P2P_BATCH_TX_REQUESTER_DUMB_PARALLEL_WORKER_COUNT'
|
|
100
|
+
| 'P2P_BATCH_TX_REQUESTER_TX_BATCH_SIZE'
|
|
101
|
+
| 'P2P_BATCH_TX_REQUESTER_BAD_PEER_THRESHOLD'
|
|
94
102
|
| 'P2P_BLOCK_CHECK_INTERVAL_MS'
|
|
95
103
|
| 'P2P_BLOCK_REQUEST_BATCH_SIZE'
|
|
96
104
|
| 'P2P_BOOTSTRAP_NODE_ENR_VERSION_CHECK'
|
|
@@ -130,12 +138,12 @@ export type EnvVar =
|
|
|
130
138
|
| 'P2P_TRUSTED_PEERS'
|
|
131
139
|
| 'P2P_PRIVATE_PEERS'
|
|
132
140
|
| 'P2P_PREFERRED_PEERS'
|
|
133
|
-
| '
|
|
134
|
-
| 'P2P_TX_POOL_OVERFLOW_FACTOR'
|
|
141
|
+
| 'P2P_MAX_PENDING_TX_COUNT'
|
|
135
142
|
| 'P2P_SEEN_MSG_CACHE_SIZE'
|
|
136
143
|
| 'P2P_DROP_TX'
|
|
137
144
|
| 'P2P_DROP_TX_CHANCE'
|
|
138
145
|
| 'P2P_TX_POOL_DELETE_TXS_AFTER_REORG'
|
|
146
|
+
| 'DEBUG_P2P_INSTRUMENT_MESSAGES'
|
|
139
147
|
| 'PEER_ID_PRIVATE_KEY'
|
|
140
148
|
| 'PEER_ID_PRIVATE_KEY_PATH'
|
|
141
149
|
| 'PROVER_AGENT_COUNT'
|
|
@@ -148,6 +156,7 @@ export type EnvVar =
|
|
|
148
156
|
| 'PROVER_BROKER_BATCH_INTERVAL_MS'
|
|
149
157
|
| 'PROVER_BROKER_BATCH_SIZE'
|
|
150
158
|
| 'PROVER_BROKER_MAX_EPOCHS_TO_KEEP_RESULTS_FOR'
|
|
159
|
+
| 'PROVER_CANCEL_JOBS_ON_STOP'
|
|
151
160
|
| 'PROVER_COORDINATION_NODE_URLS'
|
|
152
161
|
| 'PROVER_FAILED_PROOF_STORE'
|
|
153
162
|
| 'PROVER_NODE_FAILED_EPOCH_STORE'
|
|
@@ -164,12 +173,15 @@ export type EnvVar =
|
|
|
164
173
|
| 'PROVER_PUBLISHER_PRIVATE_KEYS'
|
|
165
174
|
| 'PROVER_PUBLISHER_ADDRESSES'
|
|
166
175
|
| 'PROVER_PUBLISHER_ALLOW_INVALID_STATES'
|
|
176
|
+
| 'PROVER_PUBLISHER_FORWARDER_ADDRESS'
|
|
167
177
|
| 'PROVER_REAL_PROOFS'
|
|
168
178
|
| 'PROVER_TEST_DELAY_FACTOR'
|
|
169
179
|
| 'PROVER_TEST_DELAY_MS'
|
|
170
180
|
| 'PROVER_TEST_DELAY_TYPE'
|
|
181
|
+
| 'PROVER_TEST_VERIFICATION_DELAY_MS'
|
|
171
182
|
| 'PXE_L2_BLOCK_BATCH_SIZE'
|
|
172
183
|
| 'PXE_PROVER_ENABLED'
|
|
184
|
+
| 'PXE_SYNC_CHAIN_TIP'
|
|
173
185
|
| 'RPC_MAX_BATCH_SIZE'
|
|
174
186
|
| 'RPC_MAX_BODY_SIZE'
|
|
175
187
|
| 'RPC_SIMULATE_PUBLIC_MAX_GAS_LIMIT'
|
|
@@ -187,10 +199,13 @@ export type EnvVar =
|
|
|
187
199
|
| 'SEQ_PUBLISHER_PRIVATE_KEYS'
|
|
188
200
|
| 'SEQ_PUBLISHER_ADDRESSES'
|
|
189
201
|
| 'SEQ_PUBLISHER_ALLOW_INVALID_STATES'
|
|
190
|
-
| '
|
|
202
|
+
| 'SEQ_PUBLISHER_FORWARDER_ADDRESS'
|
|
203
|
+
| 'SEQ_POLLING_INTERVAL_MS'
|
|
191
204
|
| 'SEQ_ENFORCE_TIME_TABLE'
|
|
192
|
-
| '
|
|
205
|
+
| 'SEQ_L1_PUBLISHING_TIME_ALLOWANCE_IN_SLOT'
|
|
193
206
|
| 'SEQ_ATTESTATION_PROPAGATION_TIME'
|
|
207
|
+
| 'SEQ_BLOCK_DURATION_MS'
|
|
208
|
+
| 'SEQ_BUILD_CHECKPOINT_IF_EMPTY'
|
|
194
209
|
| 'SEQ_SECONDS_BEFORE_INVALIDATING_BLOCK_AS_COMMITTEE_MEMBER'
|
|
195
210
|
| 'SEQ_SECONDS_BEFORE_INVALIDATING_BLOCK_AS_NON_COMMITTEE_MEMBER'
|
|
196
211
|
| 'SLASH_MIN_PENALTY_PERCENTAGE'
|
|
@@ -227,6 +242,7 @@ export type EnvVar =
|
|
|
227
242
|
| 'TX_COLLECTION_FAST_MAX_PARALLEL_REQUESTS_PER_NODE'
|
|
228
243
|
| 'TX_COLLECTION_NODE_RPC_MAX_BATCH_SIZE'
|
|
229
244
|
| 'TX_COLLECTION_NODE_RPC_URLS'
|
|
245
|
+
| 'TX_COLLECTION_PROPOSAL_TX_COLLECTOR_TYPE'
|
|
230
246
|
| 'TX_PUBLIC_SETUP_ALLOWLIST'
|
|
231
247
|
| 'TXE_PORT'
|
|
232
248
|
| 'TRANSACTIONS_DISABLED'
|
|
@@ -238,7 +254,6 @@ export type EnvVar =
|
|
|
238
254
|
| 'VALIDATOR_ADDRESSES'
|
|
239
255
|
| 'ROLLUP_VERSION'
|
|
240
256
|
| 'WS_BLOCK_CHECK_INTERVAL_MS'
|
|
241
|
-
| 'WS_PROVEN_BLOCKS_ONLY'
|
|
242
257
|
| 'WS_BLOCK_REQUEST_BATCH_SIZE'
|
|
243
258
|
| 'L1_READER_VIEM_POLLING_INTERVAL_MS'
|
|
244
259
|
| 'WS_DATA_DIRECTORY'
|
|
@@ -247,13 +262,16 @@ export type EnvVar =
|
|
|
247
262
|
| 'AZTEC_SLOT_DURATION'
|
|
248
263
|
| 'AZTEC_EPOCH_DURATION'
|
|
249
264
|
| 'AZTEC_TARGET_COMMITTEE_SIZE'
|
|
250
|
-
| '
|
|
265
|
+
| 'AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET'
|
|
266
|
+
| 'AZTEC_LAG_IN_EPOCHS_FOR_RANDAO'
|
|
267
|
+
| 'AZTEC_INBOX_LAG'
|
|
251
268
|
| 'AZTEC_PROOF_SUBMISSION_EPOCHS'
|
|
252
269
|
| 'AZTEC_ACTIVATION_THRESHOLD'
|
|
253
270
|
| 'AZTEC_EJECTION_THRESHOLD'
|
|
254
271
|
| 'AZTEC_LOCAL_EJECTION_THRESHOLD'
|
|
255
272
|
| 'AZTEC_MANA_TARGET'
|
|
256
273
|
| 'AZTEC_PROVING_COST_PER_MANA'
|
|
274
|
+
| 'AZTEC_INITIAL_ETH_PER_FEE_ASSET'
|
|
257
275
|
| 'AZTEC_SLASHING_QUORUM'
|
|
258
276
|
| 'AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS'
|
|
259
277
|
| 'AZTEC_SLASHING_LIFETIME_IN_ROUNDS'
|
|
@@ -267,13 +285,18 @@ export type EnvVar =
|
|
|
267
285
|
| 'AZTEC_SLASHER_FLAVOR'
|
|
268
286
|
| 'AZTEC_GOVERNANCE_PROPOSER_QUORUM'
|
|
269
287
|
| 'AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE'
|
|
288
|
+
| 'AZTEC_GOVERNANCE_VOTING_DURATION'
|
|
270
289
|
| 'AZTEC_EXIT_DELAY_SECONDS'
|
|
271
290
|
| 'L1_GAS_LIMIT_BUFFER_PERCENTAGE'
|
|
272
291
|
| 'L1_GAS_PRICE_MAX'
|
|
292
|
+
| 'L1_FEE_PER_GAS_GWEI_MAX'
|
|
273
293
|
| 'L1_BLOB_FEE_PER_GAS_MAX'
|
|
294
|
+
| 'L1_BLOB_FEE_PER_GAS_GWEI_MAX'
|
|
274
295
|
| 'L1_PRIORITY_FEE_BUMP_PERCENTAGE'
|
|
275
296
|
| 'L1_PRIORITY_FEE_RETRY_BUMP_PERCENTAGE'
|
|
297
|
+
| 'L1_MINIMUM_PRIORITY_FEE_PER_GAS_GWEI'
|
|
276
298
|
| 'L1_FIXED_PRIORITY_FEE_PER_GAS'
|
|
299
|
+
| 'L1_FIXED_PRIORITY_FEE_PER_GAS_GWEI'
|
|
277
300
|
| 'L1_TX_MONITOR_MAX_ATTEMPTS'
|
|
278
301
|
| 'L1_TX_MONITOR_CHECK_INTERVAL_MS'
|
|
279
302
|
| 'L1_TX_MONITOR_STALL_TIME_MS'
|
|
@@ -289,9 +312,23 @@ export type EnvVar =
|
|
|
289
312
|
| 'K8S_POD_UID'
|
|
290
313
|
| 'K8S_NAMESPACE_NAME'
|
|
291
314
|
| 'VALIDATOR_REEXECUTE_DEADLINE_MS'
|
|
292
|
-
| 'ALWAYS_REEXECUTE_BLOCK_PROPOSALS'
|
|
293
315
|
| 'AUTO_UPDATE'
|
|
294
316
|
| 'AUTO_UPDATE_URL'
|
|
295
317
|
| 'WEB3_SIGNER_URL'
|
|
296
318
|
| 'SKIP_ARCHIVER_INITIAL_SYNC'
|
|
297
|
-
| 'BLOB_ALLOW_EMPTY_SOURCES'
|
|
319
|
+
| 'BLOB_ALLOW_EMPTY_SOURCES'
|
|
320
|
+
| 'FISHERMAN_MODE'
|
|
321
|
+
| 'MAX_ALLOWED_ETH_CLIENT_DRIFT_SECONDS'
|
|
322
|
+
| 'LEGACY_BLS_CLI'
|
|
323
|
+
| 'DEBUG_FORCE_TX_PROOF_VERIFICATION'
|
|
324
|
+
| 'VALIDATOR_HA_SIGNING_ENABLED'
|
|
325
|
+
| 'VALIDATOR_HA_NODE_ID'
|
|
326
|
+
| 'VALIDATOR_HA_POLLING_INTERVAL_MS'
|
|
327
|
+
| 'VALIDATOR_HA_SIGNING_TIMEOUT_MS'
|
|
328
|
+
| 'VALIDATOR_HA_MAX_STUCK_DUTIES_AGE_MS'
|
|
329
|
+
| 'VALIDATOR_HA_DATABASE_URL'
|
|
330
|
+
| 'VALIDATOR_HA_RUN_MIGRATIONS'
|
|
331
|
+
| 'VALIDATOR_HA_POOL_MAX'
|
|
332
|
+
| 'VALIDATOR_HA_POOL_MIN'
|
|
333
|
+
| 'VALIDATOR_HA_POOL_IDLE_TIMEOUT_MS'
|
|
334
|
+
| 'VALIDATOR_HA_POOL_CONNECTION_TIMEOUT_MS';
|
package/src/config/index.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { Fq, Fr } from '../
|
|
1
|
+
import { Fq, Fr } from '../curves/bn254/field.js';
|
|
2
|
+
import { createConsoleLogger } from '../log/console.js';
|
|
2
3
|
import type { EnvVar } from './env_var.js';
|
|
3
4
|
import { type NetworkNames, getActiveNetworkName } from './network_name.js';
|
|
5
|
+
import { parseBooleanEnv } from './parse-env.js';
|
|
4
6
|
import { SecretValue } from './secret_value.js';
|
|
5
7
|
|
|
6
8
|
export { SecretValue, getActiveNetworkName };
|
|
@@ -17,6 +19,11 @@ export interface ConfigMapping {
|
|
|
17
19
|
isBoolean?: boolean;
|
|
18
20
|
nested?: Record<string, ConfigMapping>;
|
|
19
21
|
fallback?: EnvVar[];
|
|
22
|
+
/**
|
|
23
|
+
* List of deprecated env vars that are still supported but will log a warning.
|
|
24
|
+
* These should also be included in the fallback array for parsing.
|
|
25
|
+
*/
|
|
26
|
+
deprecatedFallback?: { env: EnvVar; message?: string }[];
|
|
20
27
|
}
|
|
21
28
|
|
|
22
29
|
export function isBooleanConfigValue<T>(obj: T, key: keyof T): boolean {
|
|
@@ -72,12 +79,24 @@ export function getConfigFromMappings<T>(configMappings: ConfigMappingsType<T>):
|
|
|
72
79
|
const config = {} as T;
|
|
73
80
|
|
|
74
81
|
for (const key in configMappings) {
|
|
75
|
-
const { env, parseEnv, defaultValue, nested, fallback } = configMappings[key];
|
|
82
|
+
const { env, parseEnv, defaultValue, nested, fallback, deprecatedFallback } = configMappings[key];
|
|
76
83
|
if (nested) {
|
|
77
84
|
(config as any)[key] = getConfigFromMappings(nested);
|
|
78
85
|
} else {
|
|
79
86
|
// Use the shared utility function
|
|
80
87
|
(config as any)[key] = getValueFromEnvWithFallback(env, parseEnv, defaultValue, fallback);
|
|
88
|
+
|
|
89
|
+
// Check for deprecated env vars and warn if logger is set
|
|
90
|
+
if (deprecatedFallback?.length) {
|
|
91
|
+
const userLog = createConsoleLogger('[DEPRECATED]');
|
|
92
|
+
for (const { env: deprecatedEnv, message } of deprecatedFallback) {
|
|
93
|
+
if (process.env[deprecatedEnv]) {
|
|
94
|
+
const warningMessage =
|
|
95
|
+
message ?? `Environment variable ${deprecatedEnv} is deprecated. Please use ${env} instead.`;
|
|
96
|
+
userLog(warningMessage, { deprecatedEnvVar: deprecatedEnv, newEnvVar: env });
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
81
100
|
}
|
|
82
101
|
}
|
|
83
102
|
|
|
@@ -130,6 +149,23 @@ export function floatConfigHelper(
|
|
|
130
149
|
};
|
|
131
150
|
}
|
|
132
151
|
|
|
152
|
+
/**
|
|
153
|
+
* Parses an environment variable to a 0-1 percentage value
|
|
154
|
+
*/
|
|
155
|
+
export function percentageConfigHelper(defaultVal: number): Pick<ConfigMapping, 'parseEnv' | 'defaultValue'> {
|
|
156
|
+
return {
|
|
157
|
+
parseEnv: (val: string): number => {
|
|
158
|
+
const parsed = safeParseFloat(val, defaultVal);
|
|
159
|
+
if (parsed < 0 || parsed > 1) {
|
|
160
|
+
throw new TypeError(`Invalid percentage value: ${parsed} should be between 0 and 1`);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return parsed;
|
|
164
|
+
},
|
|
165
|
+
defaultValue: defaultVal,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
|
|
133
169
|
/**
|
|
134
170
|
* Generates parseEnv and default values for a numerical config value.
|
|
135
171
|
* @param defaultVal - The default numerical value to use if the environment variable is not set or is invalid
|
|
@@ -213,10 +249,7 @@ export function secretValueConfigHelper<T>(parse: (val: string | undefined) => T
|
|
|
213
249
|
};
|
|
214
250
|
}
|
|
215
251
|
|
|
216
|
-
|
|
217
|
-
export function parseBooleanEnv(val: string | undefined): boolean {
|
|
218
|
-
return val !== undefined && ['1', 'true', 'TRUE'].includes(val);
|
|
219
|
-
}
|
|
252
|
+
export { parseBooleanEnv } from './parse-env.js';
|
|
220
253
|
|
|
221
254
|
export function secretStringConfigHelper(): Required<
|
|
222
255
|
Pick<ConfigMapping, 'parseEnv' | 'defaultValue' | 'isBoolean'> & {
|
|
@@ -4,9 +4,11 @@ export const NetworkConfigSchema = z
|
|
|
4
4
|
.object({
|
|
5
5
|
bootnodes: z.array(z.string()),
|
|
6
6
|
snapshots: z.array(z.string()),
|
|
7
|
+
blobFileStoreUrls: z.array(z.string()).optional(),
|
|
7
8
|
registryAddress: z.string(),
|
|
8
9
|
feeAssetHandlerAddress: z.string().optional(),
|
|
9
10
|
l1ChainId: z.number(),
|
|
11
|
+
blockDurationMs: z.number().positive().optional(),
|
|
10
12
|
})
|
|
11
13
|
.passthrough(); // Allow additional unknown fields to pass through
|
|
12
14
|
|
|
@@ -22,7 +22,7 @@ export class Aes128 {
|
|
|
22
22
|
paddingBuffer.fill(numPaddingBytes);
|
|
23
23
|
const input = Buffer.concat([data, paddingBuffer]);
|
|
24
24
|
|
|
25
|
-
await BarretenbergSync.initSingleton(
|
|
25
|
+
await BarretenbergSync.initSingleton();
|
|
26
26
|
const api = BarretenbergSync.getSingleton();
|
|
27
27
|
const response = api.aesEncrypt({
|
|
28
28
|
plaintext: input,
|
|
@@ -42,7 +42,7 @@ export class Aes128 {
|
|
|
42
42
|
* @returns Decrypted data.
|
|
43
43
|
*/
|
|
44
44
|
public async decryptBufferCBCKeepPadding(data: Uint8Array, iv: Uint8Array, key: Uint8Array): Promise<Buffer> {
|
|
45
|
-
await BarretenbergSync.initSingleton(
|
|
45
|
+
await BarretenbergSync.initSingleton();
|
|
46
46
|
const api = BarretenbergSync.getSingleton();
|
|
47
47
|
const response = api.aesDecrypt({
|
|
48
48
|
ciphertext: data,
|
package/src/crypto/bls/index.ts
CHANGED