@aztec/foundation 0.0.1-commit.b655e406 → 0.0.1-commit.b9865e97
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 +15 -0
- package/dest/array/sorted_array.d.ts.map +1 -0
- package/dest/array/sorted_array.js +109 -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/bigint-buffer/index.d.ts.map +1 -1
- package/dest/bigint-buffer/index.js +6 -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 +89 -0
- package/dest/branded-types/buffer32_hash.d.ts +27 -0
- package/dest/branded-types/buffer32_hash.d.ts.map +1 -0
- package/dest/branded-types/buffer32_hash.js +12 -0
- package/dest/branded-types/checkpoint_number.d.ts +60 -0
- package/dest/branded-types/checkpoint_number.d.ts.map +1 -0
- package/dest/branded-types/checkpoint_number.js +88 -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 +8 -0
- package/dest/branded-types/index.d.ts.map +1 -0
- package/dest/branded-types/index.js +6 -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 +45 -0
- package/dest/branded-types/slot.d.ts.map +1 -0
- package/dest/branded-types/slot.js +62 -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 +4 -2
- package/dest/buffer/buffer16.d.ts.map +1 -1
- package/dest/buffer/buffer16.js +4 -2
- package/dest/buffer/buffer32.d.ts +29 -62
- package/dest/buffer/buffer32.d.ts.map +1 -1
- package/dest/buffer/buffer32.js +33 -65
- package/dest/buffer/index.d.ts +2 -1
- package/dest/buffer/index.d.ts.map +1 -1
- package/dest/buffer/index.js +1 -0
- package/dest/buffer/utils.d.ts +3 -0
- package/dest/buffer/utils.d.ts.map +1 -0
- package/dest/buffer/utils.js +7 -0
- package/dest/collection/array.d.ts +22 -1
- package/dest/collection/array.d.ts.map +1 -1
- package/dest/collection/array.js +84 -0
- package/dest/collection/index.d.ts +3 -1
- package/dest/collection/index.d.ts.map +1 -1
- package/dest/collection/index.js +2 -0
- package/dest/collection/lru_map.d.ts +41 -0
- package/dest/collection/lru_map.d.ts.map +1 -0
- package/dest/collection/lru_map.js +119 -0
- package/dest/collection/lru_set.d.ts +35 -0
- package/dest/collection/lru_set.d.ts.map +1 -0
- package/dest/collection/lru_set.js +95 -0
- 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/committable.js +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 +60 -32
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +63 -40
- package/dest/config/network_config.d.ts +17 -31
- package/dest/config/network_config.d.ts.map +1 -1
- package/dest/config/network_config.js +6 -1
- package/dest/config/network_name.d.ts +2 -2
- package/dest/config/network_name.d.ts.map +1 -1
- package/dest/config/network_name.js +3 -3
- 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 +2 -2
- 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 +2 -1
- package/dest/crypto/aes128/index.d.ts.map +1 -1
- package/dest/crypto/aes128/index.js +13 -8
- package/dest/crypto/bls/bn254_keystore.d.ts +9 -176
- package/dest/crypto/bls/bn254_keystore.d.ts.map +1 -1
- package/dest/crypto/bls/bn254_keystore.js +1 -18
- 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 +41 -53
- 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 +10 -8
- package/dest/crypto/schnorr/index.d.ts.map +1 -1
- package/dest/crypto/schnorr/index.js +10 -16
- package/dest/crypto/schnorr/signature.d.ts +10 -30
- package/dest/crypto/schnorr/signature.d.ts.map +1 -1
- package/dest/crypto/schnorr/signature.js +21 -37
- 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 +12 -1
- package/dest/crypto/secp256k1-signer/utils.d.ts.map +1 -1
- package/dest/crypto/secp256k1-signer/utils.js +26 -0
- 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} +5 -5
- package/dest/curves/bls12/field.d.ts.map +1 -0
- package/dest/{fields/bls12_fields.js → curves/bls12/field.js} +11 -13
- 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} +5 -5
- package/dest/curves/bls12/point.d.ts.map +1 -0
- package/dest/{fields/bls12_point.js → curves/bls12/point.js} +10 -8
- package/dest/curves/bn254/field.d.ts +185 -0
- package/dest/curves/bn254/field.d.ts.map +1 -0
- package/dest/{fields/fields.js → curves/bn254/field.js} +70 -61
- 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 +24 -29
- package/dest/curves/grumpkin/point.d.ts.map +1 -0
- package/dest/{fields → curves/grumpkin}/point.js +51 -48
- 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 +13 -3
- package/dest/eth-address/index.d.ts.map +1 -1
- package/dest/eth-address/index.js +27 -6
- package/dest/eth-signature/eth_signature.d.ts +3 -2
- package/dest/eth-signature/eth_signature.d.ts.map +1 -1
- package/dest/eth-signature/eth_signature.js +7 -2
- package/dest/eth-signature/index.d.ts +1 -1
- package/dest/fifo/fifo_frame_reader.d.ts +41 -0
- package/dest/fifo/fifo_frame_reader.d.ts.map +1 -0
- package/dest/fifo/fifo_frame_reader.js +91 -0
- package/dest/fifo/index.d.ts +2 -0
- package/dest/fifo/index.d.ts.map +1 -0
- package/dest/fifo/index.js +1 -0
- package/dest/fifo_set/fifo_set.d.ts +15 -0
- package/dest/fifo_set/fifo_set.d.ts.map +1 -0
- package/dest/fifo_set/fifo_set.js +39 -0
- package/dest/fifo_set/index.d.ts +2 -0
- package/dest/fifo_set/index.d.ts.map +1 -0
- package/dest/fifo_set/index.js +1 -0
- 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 +28 -1
- package/dest/json-rpc/client/fetch.d.ts +1 -1
- package/dest/json-rpc/client/fetch.d.ts.map +1 -1
- package/dest/json-rpc/client/fetch.js +4 -3
- package/dest/json-rpc/client/index.d.ts +1 -1
- package/dest/json-rpc/client/safe_json_rpc_client.d.ts +2 -1
- package/dest/json-rpc/client/safe_json_rpc_client.d.ts.map +1 -1
- package/dest/json-rpc/client/safe_json_rpc_client.js +3 -3
- 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 +23 -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 +4 -8
- package/dest/json-rpc/fixtures/test_state.d.ts.map +1 -1
- package/dest/json-rpc/fixtures/test_state.js +57 -17
- 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/api_key_auth.d.ts +19 -0
- package/dest/json-rpc/server/api_key_auth.d.ts.map +1 -0
- package/dest/json-rpc/server/api_key_auth.js +57 -0
- package/dest/json-rpc/server/index.d.ts +2 -1
- package/dest/json-rpc/server/index.d.ts.map +1 -1
- package/dest/json-rpc/server/index.js +1 -0
- package/dest/json-rpc/server/safe_json_rpc_server.d.ts +8 -3
- package/dest/json-rpc/server/safe_json_rpc_server.d.ts.map +1 -1
- package/dest/json-rpc/server/safe_json_rpc_server.js +28 -14
- package/dest/json-rpc/test/index.d.ts +1 -1
- package/dest/json-rpc/test/integration.d.ts +1 -1
- package/dest/log/bigint-utils.d.ts +5 -0
- package/dest/log/bigint-utils.d.ts.map +1 -0
- package/dest/log/bigint-utils.js +21 -0
- 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/gcloud-logger-config.js +3 -0
- 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 +17 -4
- package/dest/log/log-filters.d.ts.map +1 -1
- package/dest/log/log-filters.js +26 -12
- 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 +138 -30
- 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 +19 -104
- package/dest/noir/noir_package_config.d.ts.map +1 -1
- package/dest/noir/noir_package_config.js +1 -1
- 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 +2 -2
- 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/batch_queue.js +1 -0
- 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 +22 -1
- package/dest/retry/index.d.ts.map +1 -1
- package/dest/retry/index.js +32 -0
- package/dest/running-promise/index.d.ts +1 -1
- package/dest/schemas/api.d.ts +12 -10
- package/dest/schemas/api.d.ts.map +1 -1
- package/dest/schemas/api.js +7 -1
- package/dest/schemas/index.d.ts +1 -1
- package/dest/schemas/parse.d.ts +4 -4
- package/dest/schemas/parse.d.ts.map +1 -1
- package/dest/schemas/parse.js +6 -5
- package/dest/schemas/schemas.d.ts +26 -28
- package/dest/schemas/schemas.d.ts.map +1 -1
- package/dest/schemas/schemas.js +14 -10
- package/dest/schemas/types.d.ts +32 -2
- package/dest/schemas/types.d.ts.map +1 -1
- package/dest/schemas/types.js +25 -1
- package/dest/schemas/utils.d.ts +10 -14
- package/dest/schemas/utils.d.ts.map +1 -1
- package/dest/schemas/utils.js +17 -23
- package/dest/serialize/buffer_reader.d.ts +14 -4
- package/dest/serialize/buffer_reader.d.ts.map +1 -1
- package/dest/serialize/buffer_reader.js +26 -4
- package/dest/serialize/buffer_sink.d.ts +134 -0
- package/dest/serialize/buffer_sink.d.ts.map +1 -0
- package/dest/serialize/buffer_sink.js +297 -0
- 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 +2 -1
- package/dest/serialize/index.d.ts.map +1 -1
- package/dest/serialize/index.js +1 -0
- package/dest/serialize/serialize.d.ts +20 -2
- package/dest/serialize/serialize.d.ts.map +1 -1
- package/dest/serialize/serialize.js +32 -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 +4 -1
- package/dest/sleep/index.d.ts.map +1 -1
- package/dest/sleep/index.js +14 -1
- package/dest/string/index.d.ts +1 -1
- package/dest/string/index.js +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 +26 -1
- package/dest/timer/date.d.ts.map +1 -1
- package/dest/timer/date.js +36 -0
- package/dest/timer/elapsed.d.ts +1 -1
- package/dest/timer/index.d.ts +2 -2
- package/dest/timer/index.d.ts.map +1 -1
- package/dest/timer/index.js +1 -1
- package/dest/timer/timeout.d.ts +3 -1
- package/dest/timer/timeout.d.ts.map +1 -1
- package/dest/timer/timeout.js +26 -0
- package/dest/timer/timer.d.ts +1 -1
- package/dest/timer/timer.d.ts.map +1 -1
- package/dest/transport/dispatch/create_dispatch_proxy.d.ts +11 -2
- package/dest/transport/dispatch/create_dispatch_proxy.d.ts.map +1 -1
- package/dest/transport/dispatch/messages.d.ts +1 -1
- package/dest/transport/index.d.ts +1 -2
- package/dest/transport/index.d.ts.map +1 -1
- package/dest/transport/index.js +0 -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_client.js +2 -2
- 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 +16 -0
- package/dest/trees/balanced_merkle_tree_root.d.ts.map +1 -0
- package/dest/trees/balanced_merkle_tree_root.js +50 -0
- package/dest/trees/hasher.d.ts +4 -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_merkle_tree_calculator.js +5 -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 +4 -12
- package/dest/trees/merkle_tree_calculator.d.ts.map +1 -1
- package/dest/trees/merkle_tree_calculator.js +1 -35
- package/dest/trees/sibling_path.d.ts +6 -38
- package/dest/trees/sibling_path.d.ts.map +1 -1
- package/dest/trees/sibling_path.js +11 -9
- 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 +27 -0
- package/dest/trees/unbalanced_merkle_tree_root.d.ts.map +1 -0
- package/dest/trees/unbalanced_merkle_tree_root.js +83 -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 +28 -2
- package/dest/types/index.d.ts.map +1 -1
- package/dest/types/index.js +21 -0
- package/dest/url/index.d.ts +1 -1
- package/dest/validation/index.d.ts +1 -1
- package/package.json +54 -11
- package/src/array/array.ts +0 -16
- package/src/array/index.ts +1 -0
- package/src/array/sorted_array.ts +138 -0
- package/src/bigint-buffer/index.ts +6 -1
- package/src/branded-types/block_number.ts +135 -0
- package/src/branded-types/buffer32_hash.ts +38 -0
- package/src/branded-types/checkpoint_number.ts +130 -0
- package/src/branded-types/epoch.ts +88 -0
- package/src/branded-types/index.ts +8 -0
- package/src/branded-types/index_within_checkpoint.ts +88 -0
- package/src/branded-types/slot.ts +93 -0
- package/src/branded-types/types.ts +2 -0
- package/src/buffer/buffer16.ts +5 -2
- package/src/buffer/buffer32.ts +41 -70
- package/src/buffer/index.ts +1 -0
- package/src/buffer/utils.ts +8 -0
- package/src/collection/array.ts +86 -0
- package/src/collection/index.ts +2 -0
- package/src/collection/lru_map.ts +143 -0
- package/src/collection/lru_set.ts +115 -0
- package/src/committable/committable.ts +1 -1
- package/src/config/env_var.ts +118 -34
- package/src/config/index.ts +144 -91
- package/src/config/network_config.ts +5 -0
- package/src/config/network_name.ts +6 -6
- package/src/config/parse-env.ts +4 -0
- package/src/config/secret_value.ts +1 -1
- package/src/crypto/aes128/index.ts +13 -4
- package/src/crypto/bls/bn254_keystore.ts +1 -24
- 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 +43 -45
- package/src/crypto/random/randomness_singleton.ts +6 -4
- package/src/crypto/schnorr/index.ts +14 -12
- package/src/crypto/schnorr/signature.ts +18 -47
- package/src/crypto/secp256k1/index.ts +3 -3
- package/src/crypto/secp256k1-signer/utils.ts +32 -0
- 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} +5 -12
- 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} +82 -84
- 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 +47 -45
- package/src/eth-address/index.ts +27 -6
- package/src/eth-signature/eth_signature.ts +7 -1
- package/src/fifo/fifo_frame_reader.ts +113 -0
- package/src/fifo/index.ts +1 -0
- package/src/fifo_set/fifo_set.ts +52 -0
- package/src/fifo_set/index.ts +1 -0
- package/src/iterator/filter.ts +11 -0
- package/src/iterator/index.ts +1 -0
- package/src/jest/setup.mjs +31 -1
- package/src/json-rpc/client/fetch.ts +4 -3
- package/src/json-rpc/client/safe_json_rpc_client.ts +4 -2
- package/src/json-rpc/client/undici.ts +23 -3
- package/src/json-rpc/fixtures/test_state.ts +10 -10
- package/src/json-rpc/server/api_key_auth.ts +63 -0
- package/src/json-rpc/server/index.ts +1 -0
- package/src/json-rpc/server/safe_json_rpc_server.ts +32 -14
- package/src/log/bigint-utils.ts +25 -0
- package/src/log/gcloud-logger-config.ts +5 -0
- package/src/log/libp2p_logger.ts +12 -5
- package/src/log/log-filters.ts +29 -11
- package/src/log/pino-logger-server.ts +25 -0
- package/src/log/pino-logger.ts +162 -40
- package/src/noir/noir_package_config.ts +32 -20
- package/src/queue/base_memory_queue.ts +1 -1
- package/src/queue/batch_queue.ts +1 -0
- package/src/queue/semaphore.ts +5 -0
- package/src/retry/index.ts +48 -0
- package/src/schemas/api.ts +25 -25
- package/src/schemas/parse.ts +9 -6
- package/src/schemas/schemas.ts +27 -16
- package/src/schemas/types.ts +34 -1
- package/src/schemas/utils.ts +25 -46
- package/src/serialize/buffer_reader.ts +36 -9
- package/src/serialize/buffer_sink.ts +350 -0
- package/src/serialize/field_reader.ts +1 -1
- package/src/serialize/free_funcs.ts +1 -1
- package/src/serialize/index.ts +1 -0
- package/src/serialize/serialize.ts +33 -1
- package/src/sleep/index.ts +16 -1
- package/src/string/index.ts +1 -1
- package/src/testing/files/index.ts +1 -1
- package/src/timer/date.ts +52 -0
- package/src/timer/index.ts +1 -1
- package/src/timer/timeout.ts +31 -0
- package/src/transport/dispatch/create_dispatch_proxy.ts +11 -1
- package/src/transport/index.ts +0 -1
- package/src/transport/transport_client.ts +2 -2
- package/src/trees/balanced_merkle_tree_root.ts +65 -0
- package/src/trees/hasher.ts +12 -0
- package/src/trees/index.ts +3 -2
- package/src/trees/indexed_merkle_tree.ts +1 -1
- package/src/trees/indexed_merkle_tree_calculator.ts +5 -1
- package/src/trees/membership_witness.ts +9 -1
- package/src/trees/merkle_tree_calculator.ts +4 -43
- package/src/trees/sibling_path.ts +12 -7
- package/src/trees/unbalanced_merkle_tree_calculator.ts +32 -50
- package/src/trees/unbalanced_merkle_tree_root.ts +112 -0
- package/src/trees/unbalanced_tree_store.ts +57 -2
- package/src/types/index.ts +58 -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/crypto/serialize.d.ts +0 -51
- package/dest/crypto/serialize.d.ts.map +0 -1
- package/dest/crypto/serialize.js +0 -68
- 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 +0 -179
- 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/transport/dispatch/create_dispatch_fn.d.ts +0 -25
- package/dest/transport/dispatch/create_dispatch_fn.d.ts.map +0 -1
- package/dest/transport/dispatch/create_dispatch_fn.js +0 -17
- 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/crypto/serialize.ts +0 -85
- 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/transport/dispatch/create_dispatch_fn.ts +0 -35
- package/src/trees/unbalanced_merkle_tree.ts +0 -111
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BN254_G1_GENERATOR,
|
|
3
|
+
BN254_G2_GENERATOR,
|
|
4
|
+
BarretenbergSync,
|
|
5
|
+
type Bn254G1Point as BbApiBn254G1Point,
|
|
6
|
+
type Bn254G2Point as BbApiBn254G2Point,
|
|
7
|
+
} from '@aztec/bb.js';
|
|
8
|
+
|
|
9
|
+
import { Fq, Fr } from './field.js';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* BN254 G1 point using foundation field classes.
|
|
13
|
+
* Represents a point on the BN254 elliptic curve in affine coordinates.
|
|
14
|
+
*/
|
|
15
|
+
export class Bn254G1Point {
|
|
16
|
+
constructor(
|
|
17
|
+
public readonly x: Fq,
|
|
18
|
+
public readonly y: Fq,
|
|
19
|
+
) {}
|
|
20
|
+
|
|
21
|
+
private toBbApiPoint(): BbApiBn254G1Point {
|
|
22
|
+
return {
|
|
23
|
+
x: this.x.toBuffer(),
|
|
24
|
+
y: this.y.toBuffer(),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
private static fromBbApiPoint(point: BbApiBn254G1Point): Bn254G1Point {
|
|
29
|
+
return new Bn254G1Point(Fq.fromBuffer(Buffer.from(point.x)), Fq.fromBuffer(Buffer.from(point.y)));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async isOnCurve(): Promise<boolean> {
|
|
33
|
+
await BarretenbergSync.initSingleton();
|
|
34
|
+
const api = BarretenbergSync.getSingleton();
|
|
35
|
+
|
|
36
|
+
const apiPoint = this.toBbApiPoint();
|
|
37
|
+
const response = api.bn254G1IsOnCurve({ point: apiPoint });
|
|
38
|
+
return response.isOnCurve;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Get the generator point for BN254 G1, or perform scalar multiplication.
|
|
43
|
+
* When called without arguments, returns the base generator point.
|
|
44
|
+
* When called with a scalar, returns scalar * generator (useful for public key derivation).
|
|
45
|
+
*/
|
|
46
|
+
static async generator(scalar?: Fr): Promise<Bn254G1Point> {
|
|
47
|
+
if (!scalar) {
|
|
48
|
+
return new Bn254G1Point(
|
|
49
|
+
Fq.fromBuffer(Buffer.from(BN254_G1_GENERATOR.x)),
|
|
50
|
+
Fq.fromBuffer(Buffer.from(BN254_G1_GENERATOR.y)),
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
await BarretenbergSync.initSingleton();
|
|
55
|
+
const api = BarretenbergSync.getSingleton();
|
|
56
|
+
|
|
57
|
+
const response = api.bn254G1Mul({
|
|
58
|
+
point: BN254_G1_GENERATOR,
|
|
59
|
+
scalar: scalar.toBuffer(),
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
return Bn254G1Point.fromBbApiPoint(response.point);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Decompress a BN254 G1 point from compressed form (32 bytes).
|
|
67
|
+
* The compressed format encodes the x-coordinate and the sign bit of the y-coordinate
|
|
68
|
+
* in the most significant bit.
|
|
69
|
+
*/
|
|
70
|
+
static async fromCompressed(compressed: Buffer): Promise<Bn254G1Point> {
|
|
71
|
+
if (compressed.length !== 32) {
|
|
72
|
+
throw new Error('Invalid compressed point length');
|
|
73
|
+
}
|
|
74
|
+
await BarretenbergSync.initSingleton();
|
|
75
|
+
const api = BarretenbergSync.getSingleton();
|
|
76
|
+
|
|
77
|
+
const response = api.bn254G1FromCompressed({
|
|
78
|
+
compressed: new Uint8Array(compressed),
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
return Bn254G1Point.fromBbApiPoint(response.point);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Compress this BN254 G1 point to 32 bytes.
|
|
86
|
+
* The compressed format encodes the x-coordinate and the sign bit of the y-coordinate
|
|
87
|
+
* in the most significant bit (bit 255).
|
|
88
|
+
*/
|
|
89
|
+
compress(): Buffer {
|
|
90
|
+
const xBytes = this.x.toBuffer();
|
|
91
|
+
// Get the least significant bit of y to determine the sign
|
|
92
|
+
const yLsb = this.y.toBigInt() & 1n;
|
|
93
|
+
// If y is odd, set the most significant bit (bit 255) of the output
|
|
94
|
+
if (yLsb === 1n) {
|
|
95
|
+
xBytes[0] |= 0x80;
|
|
96
|
+
}
|
|
97
|
+
return xBytes;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
equals(other: Bn254G1Point): boolean {
|
|
101
|
+
return this.x.equals(other.x) && this.y.equals(other.y);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
toString(): string {
|
|
105
|
+
return `Bn254G1Point(x: ${this.x.toString()}, y: ${this.y.toString()})`;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* BN254 G2 point using foundation field classes.
|
|
111
|
+
* Represents a point on the BN254 G2 curve (twist curve) in affine coordinates.
|
|
112
|
+
* G2 points use extension field coordinates (Fq2).
|
|
113
|
+
*/
|
|
114
|
+
export class Bn254G2Point {
|
|
115
|
+
constructor(
|
|
116
|
+
public readonly x: [Fq, Fq],
|
|
117
|
+
public readonly y: [Fq, Fq],
|
|
118
|
+
) {}
|
|
119
|
+
|
|
120
|
+
private toBbApiPoint(): BbApiBn254G2Point {
|
|
121
|
+
return {
|
|
122
|
+
x: [this.x[0].toBuffer(), this.x[1].toBuffer()],
|
|
123
|
+
y: [this.y[0].toBuffer(), this.y[1].toBuffer()],
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
private static fromBbApiPoint(point: BbApiBn254G2Point): Bn254G2Point {
|
|
128
|
+
return new Bn254G2Point(
|
|
129
|
+
[Fq.fromBuffer(Buffer.from(point.x[0])), Fq.fromBuffer(Buffer.from(point.x[1]))],
|
|
130
|
+
[Fq.fromBuffer(Buffer.from(point.y[0])), Fq.fromBuffer(Buffer.from(point.y[1]))],
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Get the generator point for BN254 G2, or perform scalar multiplication.
|
|
136
|
+
* When called without arguments, returns the base generator point.
|
|
137
|
+
* When called with a scalar, returns scalar * generator.
|
|
138
|
+
*/
|
|
139
|
+
static async generator(scalar?: Fr): Promise<Bn254G2Point> {
|
|
140
|
+
if (!scalar) {
|
|
141
|
+
return new Bn254G2Point(
|
|
142
|
+
[Fq.fromBuffer(Buffer.from(BN254_G2_GENERATOR.x[0])), Fq.fromBuffer(Buffer.from(BN254_G2_GENERATOR.x[1]))],
|
|
143
|
+
[Fq.fromBuffer(Buffer.from(BN254_G2_GENERATOR.y[0])), Fq.fromBuffer(Buffer.from(BN254_G2_GENERATOR.y[1]))],
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
await BarretenbergSync.initSingleton();
|
|
148
|
+
const api = BarretenbergSync.getSingleton();
|
|
149
|
+
|
|
150
|
+
const response = api.bn254G2Mul({
|
|
151
|
+
point: BN254_G2_GENERATOR as BbApiBn254G2Point,
|
|
152
|
+
scalar: scalar.toBuffer(),
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
return Bn254G2Point.fromBbApiPoint(response.point);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
equals(other: Bn254G2Point): boolean {
|
|
159
|
+
return (
|
|
160
|
+
this.x[0].equals(other.x[0]) &&
|
|
161
|
+
this.x[1].equals(other.x[1]) &&
|
|
162
|
+
this.y[0].equals(other.y[0]) &&
|
|
163
|
+
this.y[1].equals(other.y[1])
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
toString(): string {
|
|
168
|
+
return `Bn254G2Point(x: (${this.x[0].toString()}, ${this.x[1].toString()}), y: (${this.y[0].toString()}, ${this.y[1].toString()}))`;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Fq } from '../bn254/field.js';
|
|
2
|
+
|
|
3
|
+
export * from './point.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* GrumpkinScalar is an Fq.
|
|
7
|
+
* @remarks Called GrumpkinScalar because it is used to represent elements in Grumpkin's scalar field as defined in
|
|
8
|
+
* the Aztec Protocol Specs.
|
|
9
|
+
*/
|
|
10
|
+
export type GrumpkinScalar = Fq;
|
|
11
|
+
export const GrumpkinScalar = Fq;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { toBigIntBE } from '
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { Fr } from './fields.js';
|
|
1
|
+
import { toBigIntBE } from '../../bigint-buffer/index.js';
|
|
2
|
+
import { randomBoolean } from '../../crypto/random/index.js';
|
|
3
|
+
import { hexSchemaFor } from '../../schemas/utils.js';
|
|
4
|
+
import { BufferReader, FieldReader, serializeToBuffer } from '../../serialize/index.js';
|
|
5
|
+
import { bufferToHex, hexToBuffer } from '../../string/index.js';
|
|
6
|
+
import { Fr } from '../bn254/field.js';
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* Represents a Point on an elliptic curve with x and y coordinates.
|
|
@@ -13,13 +12,16 @@ import { Fr } from './fields.js';
|
|
|
13
12
|
* TODO(#7386): Clean up this class.
|
|
14
13
|
*/
|
|
15
14
|
export class Point {
|
|
16
|
-
static
|
|
15
|
+
static INFINITY = new Point(Fr.ZERO, Fr.ZERO);
|
|
17
16
|
static SIZE_IN_BYTES = Fr.SIZE_IN_BYTES * 2;
|
|
18
17
|
static COMPRESSED_SIZE_IN_BYTES = Fr.SIZE_IN_BYTES;
|
|
19
18
|
|
|
20
19
|
/** Used to differentiate this class from AztecAddress */
|
|
21
20
|
public readonly kind = 'point';
|
|
22
21
|
|
|
22
|
+
/** Whether the point is at infinity */
|
|
23
|
+
public readonly isInfinite: boolean;
|
|
24
|
+
|
|
23
25
|
constructor(
|
|
24
26
|
/**
|
|
25
27
|
* The point's x coordinate
|
|
@@ -29,12 +31,10 @@ export class Point {
|
|
|
29
31
|
* The point's y coordinate
|
|
30
32
|
*/
|
|
31
33
|
public readonly y: Fr,
|
|
32
|
-
/**
|
|
33
|
-
* Whether the point is at infinity
|
|
34
|
-
*/
|
|
35
|
-
public readonly isInfinite: boolean,
|
|
36
34
|
) {
|
|
37
35
|
// TODO(#7386): check if on curve
|
|
36
|
+
// NOTE: now there is no isInfinite in the struct, empty == inf, so an empty class would pass an on-curve check. This may be fine depending on the usage.
|
|
37
|
+
this.isInfinite = x.isZero() && y.isZero();
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
toJSON() {
|
|
@@ -42,11 +42,30 @@ export class Point {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
static get schema() {
|
|
45
|
+
// Serialization from hex string.
|
|
45
46
|
return hexSchemaFor(Point);
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
/**
|
|
49
|
-
*
|
|
50
|
+
* Creates a Point from a plain object without Zod validation.
|
|
51
|
+
* This method is optimized for performance and skips validation, making it suitable
|
|
52
|
+
* for deserializing trusted data (e.g., from C++ via MessagePack).
|
|
53
|
+
* Handles buffers, existing instances, or objects with x, y, and isInfinite fields.
|
|
54
|
+
* @param obj - Plain object, buffer, or Point instance
|
|
55
|
+
* @returns A Point instance
|
|
56
|
+
*/
|
|
57
|
+
static fromPlainObject(obj: any): Point {
|
|
58
|
+
if (obj instanceof Point) {
|
|
59
|
+
return obj;
|
|
60
|
+
}
|
|
61
|
+
if (obj instanceof Buffer || Buffer.isBuffer(obj)) {
|
|
62
|
+
return Point.fromBuffer(obj);
|
|
63
|
+
}
|
|
64
|
+
return new this(Fr.fromPlainObject(obj.x), Fr.fromPlainObject(obj.y));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Generate a random Point instance that is on the curve.
|
|
50
69
|
*
|
|
51
70
|
* @returns A randomly generated Point instance.
|
|
52
71
|
*/
|
|
@@ -73,7 +92,7 @@ export class Point {
|
|
|
73
92
|
*/
|
|
74
93
|
static fromBuffer(buffer: Buffer | BufferReader) {
|
|
75
94
|
const reader = BufferReader.asReader(buffer);
|
|
76
|
-
return new this(Fr.fromBuffer(reader), Fr.fromBuffer(reader)
|
|
95
|
+
return new this(Fr.fromBuffer(reader), Fr.fromBuffer(reader));
|
|
77
96
|
}
|
|
78
97
|
|
|
79
98
|
/**
|
|
@@ -110,12 +129,13 @@ export class Point {
|
|
|
110
129
|
* @returns The point as an array of 2 fields
|
|
111
130
|
*/
|
|
112
131
|
toFields() {
|
|
113
|
-
return [this.x, this.y
|
|
132
|
+
return [this.x, this.y];
|
|
114
133
|
}
|
|
115
134
|
|
|
116
135
|
static fromFields(fields: Fr[] | FieldReader) {
|
|
117
136
|
const reader = FieldReader.asReader(fields);
|
|
118
|
-
|
|
137
|
+
const [x, y] = [reader.readField(), reader.readField()];
|
|
138
|
+
return new this(x, y);
|
|
119
139
|
}
|
|
120
140
|
|
|
121
141
|
/**
|
|
@@ -140,11 +160,12 @@ export class Point {
|
|
|
140
160
|
const finalY = sign ? new Fr(yPositiveBigInt) : new Fr(yNegativeBigInt);
|
|
141
161
|
|
|
142
162
|
// Create and return the new Point
|
|
143
|
-
return new this(x, finalY
|
|
163
|
+
return new this(x, finalY);
|
|
144
164
|
}
|
|
145
165
|
|
|
146
166
|
/**
|
|
147
|
-
* @
|
|
167
|
+
* @param x - The x coordinate of the point
|
|
168
|
+
* @returns y^2 such that y^2 = x^3 - 17
|
|
148
169
|
*/
|
|
149
170
|
static YFromX(x: Fr): Promise<Fr | null> {
|
|
150
171
|
// Calculate y^2 = x^3 - 17 (i.e. the Grumpkin curve equation)
|
|
@@ -172,24 +193,15 @@ export class Point {
|
|
|
172
193
|
return {
|
|
173
194
|
x: this.x.toBigInt(),
|
|
174
195
|
y: this.y.toBigInt(),
|
|
175
|
-
isInfinite: this.isInfinite ? 1n : 0n,
|
|
176
196
|
};
|
|
177
197
|
}
|
|
178
198
|
|
|
179
199
|
/**
|
|
180
200
|
* Converts the Point instance to a Buffer representation of the coordinates.
|
|
181
201
|
* @returns A Buffer representation of the Point instance.
|
|
182
|
-
* @dev Note that toBuffer does not include the isInfinite flag
|
|
183
|
-
* This is because currently when we work with point as bytes we don't want to populate the extra bytes for
|
|
184
|
-
* isInfinite flag because:
|
|
185
|
-
* 1. Our Grumpkin BB API currently does not handle point at infinity,
|
|
186
|
-
* 2. we use toBuffer when serializing notes and events and there we only work with public keys and point at infinity
|
|
187
|
-
* is not considered a valid public key and the extra byte would raise DA cost.
|
|
202
|
+
* @dev Note that toBuffer does not include the isInfinite flag. The point at infinity is serialized as (0, 0).
|
|
188
203
|
*/
|
|
189
204
|
toBuffer() {
|
|
190
|
-
if (this.isInfinite) {
|
|
191
|
-
throw new Error('Cannot serialize infinite point with isInfinite flag');
|
|
192
|
-
}
|
|
193
205
|
const buf = serializeToBuffer([this.x, this.y]);
|
|
194
206
|
if (buf.length !== Point.SIZE_IN_BYTES) {
|
|
195
207
|
throw new Error(`Invalid buffer length for Point: ${buf.length}`);
|
|
@@ -239,12 +251,10 @@ export class Point {
|
|
|
239
251
|
}
|
|
240
252
|
|
|
241
253
|
toNoirStruct() {
|
|
242
|
-
|
|
243
|
-
return { x: this.x, y: this.y, is_infinite: this.isInfinite };
|
|
244
|
-
/* eslint-enable camelcase */
|
|
254
|
+
return { x: this.x, y: this.y };
|
|
245
255
|
}
|
|
246
256
|
|
|
247
|
-
// Used for IvpkM
|
|
257
|
+
// Used for IvpkM. TODO(#8124): Consider removing this method.
|
|
248
258
|
toWrappedNoirStruct() {
|
|
249
259
|
return { inner: this.toNoirStruct() };
|
|
250
260
|
}
|
|
@@ -264,21 +274,13 @@ export class Point {
|
|
|
264
274
|
return this.x.isZero() && this.y.isZero();
|
|
265
275
|
}
|
|
266
276
|
|
|
267
|
-
hash() {
|
|
268
|
-
return poseidon2Hash(this.toFields());
|
|
269
|
-
}
|
|
270
|
-
|
|
271
277
|
/**
|
|
272
|
-
*
|
|
273
|
-
*
|
|
278
|
+
* @param x - The x coordinate of the point
|
|
279
|
+
* @param y - The y coordinate of the point
|
|
280
|
+
* @returns Whether the point exists on Grumpkin
|
|
274
281
|
*/
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
isOnGrumpkin() {
|
|
280
|
-
// TODO: Check this against how bb handles curve check and infinity point check
|
|
281
|
-
if (this.inf) {
|
|
282
|
+
isOnCurve() {
|
|
283
|
+
if (this.isInfinite) {
|
|
282
284
|
return true;
|
|
283
285
|
}
|
|
284
286
|
|
package/src/eth-address/index.ts
CHANGED
|
@@ -2,10 +2,9 @@ import { inspect } from 'util';
|
|
|
2
2
|
|
|
3
3
|
import { keccak256String } from '../crypto/keccak/index.js';
|
|
4
4
|
import { randomBytes } from '../crypto/random/index.js';
|
|
5
|
-
import { Fr } from '../
|
|
5
|
+
import { Fr } from '../curves/bn254/index.js';
|
|
6
6
|
import { hexSchemaFor } from '../schemas/utils.js';
|
|
7
7
|
import { BufferReader, FieldReader } from '../serialize/index.js';
|
|
8
|
-
import { TypeRegistry } from '../serialize/type_registry.js';
|
|
9
8
|
import { bufferToHex } from '../string/index.js';
|
|
10
9
|
|
|
11
10
|
/**
|
|
@@ -41,6 +40,24 @@ export class EthAddress {
|
|
|
41
40
|
return new EthAddress(Buffer.from(address.replace(/^0x/i, ''), 'hex'));
|
|
42
41
|
}
|
|
43
42
|
|
|
43
|
+
/**
|
|
44
|
+
* Creates an EthAddress from a plain object without Zod validation.
|
|
45
|
+
* This method is optimized for performance and skips validation, making it suitable
|
|
46
|
+
* for deserializing trusted data (e.g., from C++ via MessagePack).
|
|
47
|
+
* Handles buffers (20 or 32 bytes), strings, or existing instances.
|
|
48
|
+
* @param obj - Plain object, buffer, string, or EthAddress instance
|
|
49
|
+
* @returns An EthAddress instance
|
|
50
|
+
*/
|
|
51
|
+
public static fromPlainObject(obj: any): EthAddress {
|
|
52
|
+
if (obj instanceof EthAddress) {
|
|
53
|
+
return obj;
|
|
54
|
+
}
|
|
55
|
+
if (obj instanceof Buffer || Buffer.isBuffer(obj)) {
|
|
56
|
+
return obj.length === 20 ? new EthAddress(obj) : EthAddress.fromField(new Fr(obj));
|
|
57
|
+
}
|
|
58
|
+
return EthAddress.fromString(obj);
|
|
59
|
+
}
|
|
60
|
+
|
|
44
61
|
/**
|
|
45
62
|
* Create a random EthAddress instance with 20 random bytes.
|
|
46
63
|
* This method generates a new Ethereum address with a randomly generated set of 20 bytes.
|
|
@@ -231,7 +248,7 @@ export class EthAddress {
|
|
|
231
248
|
/** Converts a number into an address. Useful for testing. */
|
|
232
249
|
static fromNumber(num: bigint | number): EthAddress {
|
|
233
250
|
const buffer = Buffer.alloc(EthAddress.SIZE_IN_BYTES);
|
|
234
|
-
buffer.writeBigUInt64BE(BigInt(num),
|
|
251
|
+
buffer.writeBigUInt64BE(BigInt(num), EthAddress.SIZE_IN_BYTES - 8);
|
|
235
252
|
return new EthAddress(buffer);
|
|
236
253
|
}
|
|
237
254
|
|
|
@@ -240,9 +257,13 @@ export class EthAddress {
|
|
|
240
257
|
}
|
|
241
258
|
|
|
242
259
|
static get schema() {
|
|
260
|
+
// Serialization from hex string.
|
|
243
261
|
return hexSchemaFor(EthAddress, EthAddress.isAddress);
|
|
244
262
|
}
|
|
245
|
-
}
|
|
246
263
|
|
|
247
|
-
|
|
248
|
-
|
|
264
|
+
static areEqual(a: EthAddress | string, b: EthAddress | string) {
|
|
265
|
+
const addrA = typeof a === 'string' ? EthAddress.fromString(a) : a;
|
|
266
|
+
const addrB = typeof b === 'string' ? EthAddress.fromString(b) : b;
|
|
267
|
+
return addrA.equals(addrB);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
2
2
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
3
3
|
|
|
4
|
+
import { secp256k1 } from '@noble/curves/secp256k1';
|
|
4
5
|
import { z } from 'zod';
|
|
5
6
|
|
|
7
|
+
import { randomBytes } from '../crypto/random/index.js';
|
|
6
8
|
import { hasHexPrefix, hexToBuffer } from '../string/index.js';
|
|
7
9
|
|
|
8
10
|
/**
|
|
@@ -77,8 +79,12 @@ export class Signature {
|
|
|
77
79
|
return new Signature(Buffer32.fromBuffer(hexToBuffer(sig.r)), Buffer32.fromBuffer(hexToBuffer(sig.s)), sig.yParity);
|
|
78
80
|
}
|
|
79
81
|
|
|
82
|
+
/** Generates a random valid ECDSA signature with a low s-value by signing a random message with a random key. */
|
|
80
83
|
static random(): Signature {
|
|
81
|
-
|
|
84
|
+
const privateKey = randomBytes(32);
|
|
85
|
+
const message = randomBytes(32);
|
|
86
|
+
const { r, s, recovery } = secp256k1.sign(message, privateKey);
|
|
87
|
+
return new Signature(Buffer32.fromBigInt(r), Buffer32.fromBigInt(s), recovery ? 28 : 27);
|
|
82
88
|
}
|
|
83
89
|
|
|
84
90
|
static empty(): Signature {
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import EventEmitter from 'node:events';
|
|
2
|
+
import * as fs from 'node:fs';
|
|
3
|
+
import * as net from 'node:net';
|
|
4
|
+
import type { Readable } from 'node:stream';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Events emitted by FifoFrameReader.
|
|
8
|
+
*
|
|
9
|
+
* - `frame`: A complete frame payload (without the 4-byte length header).
|
|
10
|
+
* - `error`: An unrecoverable error (invalid frame length, stream error).
|
|
11
|
+
* - `end`: The underlying stream has ended.
|
|
12
|
+
*/
|
|
13
|
+
export interface FifoFrameReaderEvents {
|
|
14
|
+
frame: [payload: Buffer];
|
|
15
|
+
error: [error: Error];
|
|
16
|
+
end: [];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Reads length-delimited frames from a readable stream (typically a named FIFO pipe).
|
|
21
|
+
*
|
|
22
|
+
* Wire format: `[4-byte big-endian payload length][payload bytes]`
|
|
23
|
+
*
|
|
24
|
+
* Emits a `frame` event for each complete frame with the raw payload buffer.
|
|
25
|
+
* Callers are responsible for deserializing the payload (e.g., via msgpack).
|
|
26
|
+
*
|
|
27
|
+
* On encountering an invalid payload length (0 or >maxPayloadSize), emits `error`
|
|
28
|
+
* and destroys the stream.
|
|
29
|
+
*/
|
|
30
|
+
export class FifoFrameReader extends EventEmitter<FifoFrameReaderEvents> {
|
|
31
|
+
private stream: Readable | null = null;
|
|
32
|
+
private pendingBuf: Buffer = Buffer.alloc(0);
|
|
33
|
+
private running = false;
|
|
34
|
+
|
|
35
|
+
constructor(private readonly maxPayloadSize = 10 * 1024 * 1024) {
|
|
36
|
+
super();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Open a FIFO at the given path and start reading frames. */
|
|
40
|
+
start(fifoPath: string): void {
|
|
41
|
+
// Read the FIFO through a libuv pipe handle (net.Socket) rather than fs.createReadStream.
|
|
42
|
+
// An fs read stream services the pipe with a blocking threadpool read that destroy() cannot
|
|
43
|
+
// cancel: if a writer never closes, that read stays parked and keeps the host process alive
|
|
44
|
+
// (manifesting as Jest "did not exit"). Opening O_NONBLOCK and wrapping the fd in a pipe
|
|
45
|
+
// handle makes reads epoll-based, so stop()'s destroy() releases the handle immediately,
|
|
46
|
+
// regardless of whether the writer is still attached.
|
|
47
|
+
const fd = fs.openSync(fifoPath, fs.constants.O_RDONLY | fs.constants.O_NONBLOCK);
|
|
48
|
+
let socket: net.Socket;
|
|
49
|
+
try {
|
|
50
|
+
socket = new net.Socket({ fd, readable: true, writable: false });
|
|
51
|
+
} catch (err) {
|
|
52
|
+
fs.closeSync(fd);
|
|
53
|
+
throw err;
|
|
54
|
+
}
|
|
55
|
+
this.startFromStream(socket);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Start reading frames from an existing readable stream. */
|
|
59
|
+
startFromStream(stream: Readable): void {
|
|
60
|
+
if (this.running) {
|
|
61
|
+
throw new Error('FifoFrameReader is already running');
|
|
62
|
+
}
|
|
63
|
+
this.running = true;
|
|
64
|
+
this.pendingBuf = Buffer.alloc(0);
|
|
65
|
+
this.stream = stream;
|
|
66
|
+
|
|
67
|
+
stream.on('data', (chunk: Buffer | string) => {
|
|
68
|
+
const buf = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
69
|
+
this.pendingBuf = this.pendingBuf.length > 0 ? Buffer.concat([this.pendingBuf, buf]) : buf;
|
|
70
|
+
this.drainFrames();
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
stream.on('error', (err: Error) => {
|
|
74
|
+
if (this.running) {
|
|
75
|
+
this.emit('error', err);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
stream.on('end', () => {
|
|
80
|
+
this.emit('end');
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** Stop reading and destroy the underlying stream. */
|
|
85
|
+
stop(): void {
|
|
86
|
+
this.running = false;
|
|
87
|
+
if (this.stream) {
|
|
88
|
+
this.stream.destroy();
|
|
89
|
+
this.stream = null;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** Parse complete frames out of the pending buffer. */
|
|
94
|
+
private drainFrames(): void {
|
|
95
|
+
while (this.pendingBuf.length >= 4) {
|
|
96
|
+
const payloadLen = this.pendingBuf.readUInt32BE(0);
|
|
97
|
+
if (payloadLen === 0 || payloadLen > this.maxPayloadSize) {
|
|
98
|
+
this.emit('error', new Error(`Invalid payload length: ${payloadLen}`));
|
|
99
|
+
this.stop();
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const frameLen = 4 + payloadLen;
|
|
104
|
+
if (this.pendingBuf.length < frameLen) {
|
|
105
|
+
break; // Wait for more data
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const payload = this.pendingBuf.subarray(4, frameLen);
|
|
109
|
+
this.pendingBuf = this.pendingBuf.subarray(frameLen);
|
|
110
|
+
this.emit('frame', Buffer.from(payload));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FifoFrameReader } from './fifo_frame_reader.js';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/** A Set capped to a fixed number of entries, evicting the oldest inserted value when full. */
|
|
2
|
+
export class FifoSet<T> extends Set<T> {
|
|
3
|
+
private _limit: number | undefined;
|
|
4
|
+
|
|
5
|
+
private constructor(values?: Iterable<T>) {
|
|
6
|
+
super(values);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** Creates a bounded set with a positive integer limit. */
|
|
10
|
+
static withLimit<T>(limit: number, values?: Iterable<T>): FifoSet<T> {
|
|
11
|
+
if (!Number.isSafeInteger(limit) || limit <= 0) {
|
|
12
|
+
throw new TypeError(`FifoSet limit must be a positive safe integer: ${limit}`);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const set = new FifoSet(values);
|
|
16
|
+
set._limit = limit;
|
|
17
|
+
set.compact();
|
|
18
|
+
|
|
19
|
+
return set;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
override add(value: T): this {
|
|
23
|
+
super.add(value);
|
|
24
|
+
this.compact();
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Maximum number of entries retained by this set. */
|
|
29
|
+
public get limit(): number {
|
|
30
|
+
return this._limit ?? Infinity;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Evicts oldest entries until the set is within its limit. */
|
|
34
|
+
public compact(): void {
|
|
35
|
+
while (this.size > this.limit) {
|
|
36
|
+
const head = this.values().next();
|
|
37
|
+
if (head.done) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
this.delete(head.value);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Adds a value only if it is absent, returning whether the set changed. */
|
|
45
|
+
public addIfAbsent(value: T): boolean {
|
|
46
|
+
if (this.has(value)) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
this.add(value);
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './fifo_set.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Wraps an async iterable iterator such that it filters values based on a predicate. */
|
|
2
|
+
export async function* filter<T>(
|
|
3
|
+
iterator: AsyncIterableIterator<T>,
|
|
4
|
+
predicate: (item: T) => boolean | Promise<boolean>,
|
|
5
|
+
): AsyncIterableIterator<T> {
|
|
6
|
+
for await (const item of iterator) {
|
|
7
|
+
if (await predicate(item)) {
|
|
8
|
+
yield item;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { filter } from './filter.js';
|
package/src/jest/setup.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { parseBooleanEnv } from '@aztec/foundation/config';
|
|
1
2
|
import { overwriteLoggingStream, pinoPrettyOpts } from '@aztec/foundation/log';
|
|
2
3
|
|
|
3
4
|
import pretty from 'pino-pretty';
|
|
@@ -6,4 +7,33 @@ import pretty from 'pino-pretty';
|
|
|
6
7
|
// file so we don't mess up with dependencies in non-testing environments,
|
|
7
8
|
// since pino-pretty messes up with browser bundles.
|
|
8
9
|
// See also https://www.npmjs.com/package/pino-pretty?activeTab=readme#user-content-usage-with-jest
|
|
9
|
-
|
|
10
|
+
if (!parseBooleanEnv(process.env.LOG_JSON)) {
|
|
11
|
+
overwriteLoggingStream(pretty(pinoPrettyOpts));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// Prevent timers from keeping the process alive after tests complete.
|
|
15
|
+
// Libraries like viem create internal polling loops (via setTimeout) that
|
|
16
|
+
// reschedule themselves indefinitely. In test environments we never want a
|
|
17
|
+
// timer to be the reason the process can't exit. We also unref stdout/stderr
|
|
18
|
+
// which, when they are pipes (as in Jest workers), remain ref'd by default.
|
|
19
|
+
{
|
|
20
|
+
const origSetTimeout = globalThis.setTimeout;
|
|
21
|
+
const origSetInterval = globalThis.setInterval;
|
|
22
|
+
globalThis.setTimeout = function unrefSetTimeout(...args) {
|
|
23
|
+
const id = origSetTimeout.apply(this, args);
|
|
24
|
+
id?.unref?.();
|
|
25
|
+
return id;
|
|
26
|
+
};
|
|
27
|
+
// Preserve .unref, .__promisify__ etc. that may exist on the original
|
|
28
|
+
Object.setPrototypeOf(globalThis.setTimeout, origSetTimeout);
|
|
29
|
+
|
|
30
|
+
globalThis.setInterval = function unrefSetInterval(...args) {
|
|
31
|
+
const id = origSetInterval.apply(this, args);
|
|
32
|
+
id?.unref?.();
|
|
33
|
+
return id;
|
|
34
|
+
};
|
|
35
|
+
Object.setPrototypeOf(globalThis.setInterval, origSetInterval);
|
|
36
|
+
|
|
37
|
+
if (process.stdout?._handle?.unref) process.stdout._handle.unref();
|
|
38
|
+
if (process.stderr?._handle?.unref) process.stderr._handle.unref();
|
|
39
|
+
}
|