@aztec/foundation 0.0.1-commit.24de95ac → 0.0.1-commit.2606882
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
|
@@ -1,19 +1,16 @@
|
|
|
1
|
+
var _computedKey, _computedKey1;
|
|
1
2
|
import { BarretenbergSync } from '@aztec/bb.js';
|
|
2
3
|
import { inspect } from 'util';
|
|
3
|
-
import { toBigIntBE, toBufferBE } from '
|
|
4
|
-
import { randomBytes } from '
|
|
5
|
-
import { hexSchemaFor } from '
|
|
6
|
-
import { BufferReader } from '
|
|
7
|
-
import { TypeRegistry } from '../serialize/type_registry.js';
|
|
8
|
-
const ZERO_BUFFER = Buffer.alloc(32);
|
|
4
|
+
import { toBigIntBE, toBufferBE } from '../../bigint-buffer/index.js';
|
|
5
|
+
import { randomBytes } from '../../crypto/random/index.js';
|
|
6
|
+
import { hexSchemaFor } from '../../schemas/utils.js';
|
|
7
|
+
import { BufferReader } from '../../serialize/buffer_reader.js';
|
|
9
8
|
/**
|
|
10
9
|
* Base field class.
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* We only check we are within the field modulus when initializing with bigint.
|
|
10
|
+
* Uses bigint as the internal representation.
|
|
11
|
+
* Buffers are generated on demand from the bigint value.
|
|
14
12
|
*/ class BaseField {
|
|
15
13
|
static SIZE_IN_BYTES = 32;
|
|
16
|
-
asBuffer;
|
|
17
14
|
asBigInt;
|
|
18
15
|
/**
|
|
19
16
|
* Return bigint representation.
|
|
@@ -29,81 +26,72 @@ const ZERO_BUFFER = Buffer.alloc(32);
|
|
|
29
26
|
if (value.length > BaseField.SIZE_IN_BYTES) {
|
|
30
27
|
throw new Error(`Value length ${value.length} exceeds ${BaseField.SIZE_IN_BYTES}`);
|
|
31
28
|
}
|
|
32
|
-
this.
|
|
33
|
-
Buffer.alloc(BaseField.SIZE_IN_BYTES - value.length),
|
|
34
|
-
value
|
|
35
|
-
]);
|
|
29
|
+
this.asBigInt = toBigIntBE(value);
|
|
36
30
|
} else if (typeof value === 'bigint' || typeof value === 'number' || typeof value === 'boolean') {
|
|
37
31
|
this.asBigInt = BigInt(value);
|
|
38
|
-
if (this.asBigInt >= this.modulus()) {
|
|
39
|
-
throw new Error(`Value 0x${this.asBigInt.toString(16)} is greater or equal to field modulus.`);
|
|
40
|
-
} else if (this.asBigInt < 0n) {
|
|
41
|
-
throw new Error(`Value 0x${this.asBigInt.toString(16)} is negative.`);
|
|
42
|
-
}
|
|
43
32
|
} else if (value instanceof BaseField) {
|
|
44
|
-
this.asBuffer = value.asBuffer;
|
|
45
33
|
this.asBigInt = value.asBigInt;
|
|
46
34
|
} else {
|
|
47
35
|
throw new Error(`Type '${typeof value}' with value '${value}' passed to BaseField ctor.`);
|
|
48
36
|
}
|
|
37
|
+
if (this.asBigInt < 0n) {
|
|
38
|
+
throw new Error(`Value 0x${this.asBigInt.toString(16)} is negative.`);
|
|
39
|
+
} else if (this.asBigInt >= this.modulus()) {
|
|
40
|
+
throw new Error(`Value 0x${this.asBigInt.toString(16)} is greater or equal to field modulus.`);
|
|
41
|
+
}
|
|
49
42
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
if (!this.asBuffer) {
|
|
54
|
-
this.asBuffer = toBufferBE(this.asBigInt, 32);
|
|
43
|
+
toBuffer(sink) {
|
|
44
|
+
if (!sink) {
|
|
45
|
+
return toBufferBE(this.asBigInt, BaseField.SIZE_IN_BYTES);
|
|
55
46
|
}
|
|
56
|
-
|
|
47
|
+
sink.writeField(this.asBigInt);
|
|
57
48
|
}
|
|
58
49
|
toString() {
|
|
59
|
-
return `0x${this.
|
|
50
|
+
return `0x${this.asBigInt.toString(16).padStart(64, '0')}`;
|
|
60
51
|
}
|
|
61
52
|
toBigInt() {
|
|
62
|
-
if (this.asBigInt === undefined) {
|
|
63
|
-
this.asBigInt = toBigIntBE(this.asBuffer);
|
|
64
|
-
if (this.asBigInt >= this.modulus()) {
|
|
65
|
-
throw new Error(`Value 0x${this.asBigInt.toString(16)} is greater or equal to field modulus.`);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
53
|
return this.asBigInt;
|
|
69
54
|
}
|
|
70
55
|
toBool() {
|
|
71
|
-
return
|
|
56
|
+
return this.asBigInt !== 0n;
|
|
72
57
|
}
|
|
73
58
|
/**
|
|
74
59
|
* Converts this field to a number.
|
|
75
60
|
* Throws if the underlying value is greater than MAX_SAFE_INTEGER.
|
|
76
61
|
*/ toNumber() {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
throw new Error(`Value ${value.toString(16)} greater than than max safe integer`);
|
|
62
|
+
if (this.asBigInt > Number.MAX_SAFE_INTEGER) {
|
|
63
|
+
throw new Error(`Value ${this.asBigInt.toString(16)} greater than than max safe integer`);
|
|
80
64
|
}
|
|
81
|
-
return Number(
|
|
65
|
+
return Number(this.asBigInt);
|
|
82
66
|
}
|
|
83
67
|
/**
|
|
84
68
|
* Converts this field to a number.
|
|
85
69
|
* May cause loss of precision if the underlying value is greater than MAX_SAFE_INTEGER.
|
|
86
70
|
*/ toNumberUnsafe() {
|
|
87
|
-
|
|
88
|
-
return Number(value);
|
|
71
|
+
return Number(this.asBigInt);
|
|
89
72
|
}
|
|
90
73
|
toShortString() {
|
|
91
74
|
const str = this.toString();
|
|
92
75
|
return `${str.slice(0, 10)}...${str.slice(-4)}`;
|
|
93
76
|
}
|
|
94
77
|
equals(rhs) {
|
|
95
|
-
return this.
|
|
78
|
+
return this.asBigInt === rhs.asBigInt;
|
|
96
79
|
}
|
|
97
80
|
lt(rhs) {
|
|
98
|
-
return this.
|
|
81
|
+
return this.asBigInt < rhs.asBigInt;
|
|
99
82
|
}
|
|
100
83
|
cmp(rhs) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
84
|
+
return BaseField.cmpAsBigInt(this.asBigInt, rhs.asBigInt);
|
|
85
|
+
}
|
|
86
|
+
static cmp(lhs, rhs) {
|
|
87
|
+
return lhs.cmp(rhs);
|
|
88
|
+
}
|
|
89
|
+
// Actual bigint comparison. Arguments must have been validated previously.
|
|
90
|
+
static cmpAsBigInt(lhs, rhs) {
|
|
91
|
+
return lhs === rhs ? 0 : lhs < rhs ? -1 : 1;
|
|
104
92
|
}
|
|
105
93
|
isZero() {
|
|
106
|
-
return this.
|
|
94
|
+
return this.asBigInt === 0n;
|
|
107
95
|
}
|
|
108
96
|
isEmpty() {
|
|
109
97
|
return this.isZero();
|
|
@@ -143,26 +131,40 @@ const ZERO_BUFFER = Buffer.alloc(32);
|
|
|
143
131
|
throw new Error(`Invalid hex-encoded string: "${buf}"`);
|
|
144
132
|
}
|
|
145
133
|
const buffer = Buffer.from(checked.length % 2 === 1 ? '0' + checked : checked, 'hex');
|
|
146
|
-
return new f(buffer);
|
|
134
|
+
return new f(toBigIntBE(buffer));
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Abstract unbranded base class for BN254 scalar field elements.
|
|
138
|
+
* Extend this instead of Fr when defining a branded subtype (e.g. BlockHash)
|
|
139
|
+
* to avoid inheriting Fr's `_branding`.
|
|
140
|
+
*/ export class BaseFr extends BaseField {
|
|
141
|
+
static MODULUS = 0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001n;
|
|
142
|
+
constructor(value){
|
|
143
|
+
super(value);
|
|
144
|
+
}
|
|
145
|
+
modulus() {
|
|
146
|
+
return BaseFr.MODULUS;
|
|
147
|
+
}
|
|
148
|
+
toJSON() {
|
|
149
|
+
return this.toString();
|
|
150
|
+
}
|
|
147
151
|
}
|
|
152
|
+
_computedKey = inspect.custom;
|
|
148
153
|
/**
|
|
149
154
|
* Fr field class.
|
|
150
155
|
* @dev This class is used to represent elements of BN254 scalar field or elements in the base field of Grumpkin.
|
|
151
156
|
* (Grumpkin's scalar field corresponds to BN254's base field and vice versa.)
|
|
152
|
-
*/ export class Fr extends
|
|
157
|
+
*/ export class Fr extends BaseFr {
|
|
158
|
+
static MODULUS = 0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001n;
|
|
153
159
|
static ZERO = new Fr(0n);
|
|
154
160
|
static ONE = new Fr(1n);
|
|
155
|
-
static MODULUS = 0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001n;
|
|
156
161
|
static MAX_FIELD_VALUE = new Fr(this.MODULUS - 1n);
|
|
157
162
|
constructor(value){
|
|
158
163
|
super(value);
|
|
159
164
|
}
|
|
160
|
-
[
|
|
165
|
+
[_computedKey]() {
|
|
161
166
|
return `Fr<${this.toString()}>`;
|
|
162
167
|
}
|
|
163
|
-
modulus() {
|
|
164
|
-
return Fr.MODULUS;
|
|
165
|
-
}
|
|
166
168
|
static random() {
|
|
167
169
|
return random(Fr);
|
|
168
170
|
}
|
|
@@ -246,15 +248,25 @@ const ZERO_BUFFER = Buffer.alloc(32);
|
|
|
246
248
|
}
|
|
247
249
|
return Fr.fromBuffer(Buffer.from(response.value));
|
|
248
250
|
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
+
/**
|
|
252
|
+
* Creates an Fr instance from a plain object without Zod validation.
|
|
253
|
+
* This method is optimized for performance and skips validation, making it suitable
|
|
254
|
+
* for deserializing trusted data (e.g., from C++ via MessagePack).
|
|
255
|
+
* Handles buffers, strings, numbers, bigints, or existing instances.
|
|
256
|
+
* @param obj - Plain object, buffer, string, number, bigint, boolean, or Fr instance
|
|
257
|
+
* @returns An Fr instance
|
|
258
|
+
*/ static fromPlainObject(obj) {
|
|
259
|
+
if (obj instanceof Fr) {
|
|
260
|
+
return obj;
|
|
261
|
+
}
|
|
262
|
+
return new Fr(obj);
|
|
251
263
|
}
|
|
252
264
|
static get schema() {
|
|
265
|
+
// Serialization from hex string.
|
|
253
266
|
return hexSchemaFor(Fr);
|
|
254
267
|
}
|
|
255
268
|
}
|
|
256
|
-
|
|
257
|
-
TypeRegistry.register('Fr', Fr);
|
|
269
|
+
_computedKey1 = inspect.custom;
|
|
258
270
|
/**
|
|
259
271
|
* Fq field class.
|
|
260
272
|
* @dev This class is used to represent elements of BN254 base field or elements in the scalar field of Grumpkin.
|
|
@@ -264,7 +276,7 @@ TypeRegistry.register('Fr', Fr);
|
|
|
264
276
|
static MODULUS = 0x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47n;
|
|
265
277
|
static HIGH_SHIFT = BigInt(BaseField.SIZE_IN_BYTES / 2 * 8);
|
|
266
278
|
static LOW_MASK = (1n << Fq.HIGH_SHIFT) - 1n;
|
|
267
|
-
[
|
|
279
|
+
[_computedKey1]() {
|
|
268
280
|
return `Fq<${this.toString()}>`;
|
|
269
281
|
}
|
|
270
282
|
get lo() {
|
|
@@ -351,8 +363,6 @@ TypeRegistry.register('Fr', Fr);
|
|
|
351
363
|
return hexSchemaFor(Fq);
|
|
352
364
|
}
|
|
353
365
|
}
|
|
354
|
-
// For deserializing JSON.
|
|
355
|
-
TypeRegistry.register('Fq', Fq);
|
|
356
366
|
// Beware: Performance bottleneck below
|
|
357
367
|
/**
|
|
358
368
|
* Find the modular inverse of a given element, for BN254 Fr.
|
|
@@ -383,7 +393,6 @@ TypeRegistry.register('Fq', Fq);
|
|
|
383
393
|
];
|
|
384
394
|
}
|
|
385
395
|
}
|
|
386
|
-
export const GrumpkinScalar = Fq;
|
|
387
396
|
/** Wraps a function that returns a buffer so that all results are reduced into a field of the given type. */ export function reduceFn(fn, field) {
|
|
388
397
|
return (input)=>fromBufferReduce(fn(input), field);
|
|
389
398
|
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export * from './field.js';
|
|
2
|
+
export * from './point.js';
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jdXJ2ZXMvYm4yNTQvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyxZQUFZLENBQUM7QUFDM0IsY0FBYyxZQUFZLENBQUMifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/curves/bn254/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Fq, Fr } from './field.js';
|
|
2
|
+
/**
|
|
3
|
+
* BN254 G1 point using foundation field classes.
|
|
4
|
+
* Represents a point on the BN254 elliptic curve in affine coordinates.
|
|
5
|
+
*/
|
|
6
|
+
export declare class Bn254G1Point {
|
|
7
|
+
readonly x: Fq;
|
|
8
|
+
readonly y: Fq;
|
|
9
|
+
constructor(x: Fq, y: Fq);
|
|
10
|
+
private toBbApiPoint;
|
|
11
|
+
private static fromBbApiPoint;
|
|
12
|
+
isOnCurve(): Promise<boolean>;
|
|
13
|
+
/**
|
|
14
|
+
* Get the generator point for BN254 G1, or perform scalar multiplication.
|
|
15
|
+
* When called without arguments, returns the base generator point.
|
|
16
|
+
* When called with a scalar, returns scalar * generator (useful for public key derivation).
|
|
17
|
+
*/
|
|
18
|
+
static generator(scalar?: Fr): Promise<Bn254G1Point>;
|
|
19
|
+
/**
|
|
20
|
+
* Decompress a BN254 G1 point from compressed form (32 bytes).
|
|
21
|
+
* The compressed format encodes the x-coordinate and the sign bit of the y-coordinate
|
|
22
|
+
* in the most significant bit.
|
|
23
|
+
*/
|
|
24
|
+
static fromCompressed(compressed: Buffer): Promise<Bn254G1Point>;
|
|
25
|
+
/**
|
|
26
|
+
* Compress this BN254 G1 point to 32 bytes.
|
|
27
|
+
* The compressed format encodes the x-coordinate and the sign bit of the y-coordinate
|
|
28
|
+
* in the most significant bit (bit 255).
|
|
29
|
+
*/
|
|
30
|
+
compress(): Buffer;
|
|
31
|
+
equals(other: Bn254G1Point): boolean;
|
|
32
|
+
toString(): string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* BN254 G2 point using foundation field classes.
|
|
36
|
+
* Represents a point on the BN254 G2 curve (twist curve) in affine coordinates.
|
|
37
|
+
* G2 points use extension field coordinates (Fq2).
|
|
38
|
+
*/
|
|
39
|
+
export declare class Bn254G2Point {
|
|
40
|
+
readonly x: [Fq, Fq];
|
|
41
|
+
readonly y: [Fq, Fq];
|
|
42
|
+
constructor(x: [Fq, Fq], y: [Fq, Fq]);
|
|
43
|
+
private toBbApiPoint;
|
|
44
|
+
private static fromBbApiPoint;
|
|
45
|
+
/**
|
|
46
|
+
* Get the generator point for BN254 G2, or perform scalar multiplication.
|
|
47
|
+
* When called without arguments, returns the base generator point.
|
|
48
|
+
* When called with a scalar, returns scalar * generator.
|
|
49
|
+
*/
|
|
50
|
+
static generator(scalar?: Fr): Promise<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H,QAAQ,IAAI,MAAM,CASjB;IAED,MAAM,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAEnC;IAED,QAAQ,IAAI,MAAM,CAEjB;CACF;AAED;;;;GAIG;AACH,qBAAa,YAAY;aAEL,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;aACX,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;IAF7B,YACkB,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EACX,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EACzB;IAEJ,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,MAAM,CAAC,cAAc;IAO7B;;;;OAIG;IACH,OAAa,SAAS,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,OAAO,CAAC,YAAY,CAAC,CAiBzD;IAED,MAAM,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAOnC;IAED,QAAQ,IAAI,MAAM,CAEjB;CACF"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { BN254_G1_GENERATOR, BN254_G2_GENERATOR, BarretenbergSync } from '@aztec/bb.js';
|
|
2
|
+
import { Fq } from './field.js';
|
|
3
|
+
/**
|
|
4
|
+
* BN254 G1 point using foundation field classes.
|
|
5
|
+
* Represents a point on the BN254 elliptic curve in affine coordinates.
|
|
6
|
+
*/ export class Bn254G1Point {
|
|
7
|
+
x;
|
|
8
|
+
y;
|
|
9
|
+
constructor(x, y){
|
|
10
|
+
this.x = x;
|
|
11
|
+
this.y = y;
|
|
12
|
+
}
|
|
13
|
+
toBbApiPoint() {
|
|
14
|
+
return {
|
|
15
|
+
x: this.x.toBuffer(),
|
|
16
|
+
y: this.y.toBuffer()
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
static fromBbApiPoint(point) {
|
|
20
|
+
return new Bn254G1Point(Fq.fromBuffer(Buffer.from(point.x)), Fq.fromBuffer(Buffer.from(point.y)));
|
|
21
|
+
}
|
|
22
|
+
async isOnCurve() {
|
|
23
|
+
await BarretenbergSync.initSingleton();
|
|
24
|
+
const api = BarretenbergSync.getSingleton();
|
|
25
|
+
const apiPoint = this.toBbApiPoint();
|
|
26
|
+
const response = api.bn254G1IsOnCurve({
|
|
27
|
+
point: apiPoint
|
|
28
|
+
});
|
|
29
|
+
return response.isOnCurve;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Get the generator point for BN254 G1, or perform scalar multiplication.
|
|
33
|
+
* When called without arguments, returns the base generator point.
|
|
34
|
+
* When called with a scalar, returns scalar * generator (useful for public key derivation).
|
|
35
|
+
*/ static async generator(scalar) {
|
|
36
|
+
if (!scalar) {
|
|
37
|
+
return new Bn254G1Point(Fq.fromBuffer(Buffer.from(BN254_G1_GENERATOR.x)), Fq.fromBuffer(Buffer.from(BN254_G1_GENERATOR.y)));
|
|
38
|
+
}
|
|
39
|
+
await BarretenbergSync.initSingleton();
|
|
40
|
+
const api = BarretenbergSync.getSingleton();
|
|
41
|
+
const response = api.bn254G1Mul({
|
|
42
|
+
point: BN254_G1_GENERATOR,
|
|
43
|
+
scalar: scalar.toBuffer()
|
|
44
|
+
});
|
|
45
|
+
return Bn254G1Point.fromBbApiPoint(response.point);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Decompress a BN254 G1 point from compressed form (32 bytes).
|
|
49
|
+
* The compressed format encodes the x-coordinate and the sign bit of the y-coordinate
|
|
50
|
+
* in the most significant bit.
|
|
51
|
+
*/ static async fromCompressed(compressed) {
|
|
52
|
+
if (compressed.length !== 32) {
|
|
53
|
+
throw new Error('Invalid compressed point length');
|
|
54
|
+
}
|
|
55
|
+
await BarretenbergSync.initSingleton();
|
|
56
|
+
const api = BarretenbergSync.getSingleton();
|
|
57
|
+
const response = api.bn254G1FromCompressed({
|
|
58
|
+
compressed: new Uint8Array(compressed)
|
|
59
|
+
});
|
|
60
|
+
return Bn254G1Point.fromBbApiPoint(response.point);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Compress this BN254 G1 point to 32 bytes.
|
|
64
|
+
* The compressed format encodes the x-coordinate and the sign bit of the y-coordinate
|
|
65
|
+
* in the most significant bit (bit 255).
|
|
66
|
+
*/ compress() {
|
|
67
|
+
const xBytes = this.x.toBuffer();
|
|
68
|
+
// Get the least significant bit of y to determine the sign
|
|
69
|
+
const yLsb = this.y.toBigInt() & 1n;
|
|
70
|
+
// If y is odd, set the most significant bit (bit 255) of the output
|
|
71
|
+
if (yLsb === 1n) {
|
|
72
|
+
xBytes[0] |= 0x80;
|
|
73
|
+
}
|
|
74
|
+
return xBytes;
|
|
75
|
+
}
|
|
76
|
+
equals(other) {
|
|
77
|
+
return this.x.equals(other.x) && this.y.equals(other.y);
|
|
78
|
+
}
|
|
79
|
+
toString() {
|
|
80
|
+
return `Bn254G1Point(x: ${this.x.toString()}, y: ${this.y.toString()})`;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* BN254 G2 point using foundation field classes.
|
|
85
|
+
* Represents a point on the BN254 G2 curve (twist curve) in affine coordinates.
|
|
86
|
+
* G2 points use extension field coordinates (Fq2).
|
|
87
|
+
*/ export class Bn254G2Point {
|
|
88
|
+
x;
|
|
89
|
+
y;
|
|
90
|
+
constructor(x, y){
|
|
91
|
+
this.x = x;
|
|
92
|
+
this.y = y;
|
|
93
|
+
}
|
|
94
|
+
toBbApiPoint() {
|
|
95
|
+
return {
|
|
96
|
+
x: [
|
|
97
|
+
this.x[0].toBuffer(),
|
|
98
|
+
this.x[1].toBuffer()
|
|
99
|
+
],
|
|
100
|
+
y: [
|
|
101
|
+
this.y[0].toBuffer(),
|
|
102
|
+
this.y[1].toBuffer()
|
|
103
|
+
]
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
static fromBbApiPoint(point) {
|
|
107
|
+
return new Bn254G2Point([
|
|
108
|
+
Fq.fromBuffer(Buffer.from(point.x[0])),
|
|
109
|
+
Fq.fromBuffer(Buffer.from(point.x[1]))
|
|
110
|
+
], [
|
|
111
|
+
Fq.fromBuffer(Buffer.from(point.y[0])),
|
|
112
|
+
Fq.fromBuffer(Buffer.from(point.y[1]))
|
|
113
|
+
]);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Get the generator point for BN254 G2, or perform scalar multiplication.
|
|
117
|
+
* When called without arguments, returns the base generator point.
|
|
118
|
+
* When called with a scalar, returns scalar * generator.
|
|
119
|
+
*/ static async generator(scalar) {
|
|
120
|
+
if (!scalar) {
|
|
121
|
+
return new Bn254G2Point([
|
|
122
|
+
Fq.fromBuffer(Buffer.from(BN254_G2_GENERATOR.x[0])),
|
|
123
|
+
Fq.fromBuffer(Buffer.from(BN254_G2_GENERATOR.x[1]))
|
|
124
|
+
], [
|
|
125
|
+
Fq.fromBuffer(Buffer.from(BN254_G2_GENERATOR.y[0])),
|
|
126
|
+
Fq.fromBuffer(Buffer.from(BN254_G2_GENERATOR.y[1]))
|
|
127
|
+
]);
|
|
128
|
+
}
|
|
129
|
+
await BarretenbergSync.initSingleton();
|
|
130
|
+
const api = BarretenbergSync.getSingleton();
|
|
131
|
+
const response = api.bn254G2Mul({
|
|
132
|
+
point: BN254_G2_GENERATOR,
|
|
133
|
+
scalar: scalar.toBuffer()
|
|
134
|
+
});
|
|
135
|
+
return Bn254G2Point.fromBbApiPoint(response.point);
|
|
136
|
+
}
|
|
137
|
+
equals(other) {
|
|
138
|
+
return this.x[0].equals(other.x[0]) && this.x[1].equals(other.x[1]) && this.y[0].equals(other.y[0]) && this.y[1].equals(other.y[1]);
|
|
139
|
+
}
|
|
140
|
+
toString() {
|
|
141
|
+
return `Bn254G2Point(x: (${this.x[0].toString()}, ${this.x[1].toString()}), y: (${this.y[0].toString()}, ${this.y[1].toString()}))`;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Fq } from '../bn254/field.js';
|
|
2
|
+
export * from './point.js';
|
|
3
|
+
/**
|
|
4
|
+
* GrumpkinScalar is an Fq.
|
|
5
|
+
* @remarks Called GrumpkinScalar because it is used to represent elements in Grumpkin's scalar field as defined in
|
|
6
|
+
* the Aztec Protocol Specs.
|
|
7
|
+
*/
|
|
8
|
+
export type GrumpkinScalar = Fq;
|
|
9
|
+
export declare const GrumpkinScalar: typeof Fq;
|
|
10
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jdXJ2ZXMvZ3J1bXBraW4vaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBRXZDLGNBQWMsWUFBWSxDQUFDO0FBRTNCOzs7O0dBSUc7QUFDSCxNQUFNLE1BQU0sY0FBYyxHQUFHLEVBQUUsQ0FBQztBQUNoQyxlQUFPLE1BQU0sY0FBYyxXQUFLLENBQUMifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/curves/grumpkin/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AAEvC,cAAc,YAAY,CAAC;AAE3B;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,EAAE,CAAC;AAChC,eAAO,MAAM,cAAc,WAAK,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BufferReader, FieldReader } from '
|
|
2
|
-
import { Fr } from '
|
|
1
|
+
import { BufferReader, FieldReader } from '../../serialize/index.js';
|
|
2
|
+
import { Fr } from '../bn254/field.js';
|
|
3
3
|
/**
|
|
4
4
|
* Represents a Point on an elliptic curve with x and y coordinates.
|
|
5
5
|
* The Point class provides methods for creating instances from different input types,
|
|
@@ -15,15 +15,13 @@ export declare class Point {
|
|
|
15
15
|
* The point's y coordinate
|
|
16
16
|
*/
|
|
17
17
|
readonly y: Fr;
|
|
18
|
-
|
|
19
|
-
* Whether the point is at infinity
|
|
20
|
-
*/
|
|
21
|
-
readonly isInfinite: boolean;
|
|
22
|
-
static ZERO: Point;
|
|
18
|
+
static INFINITY: Point;
|
|
23
19
|
static SIZE_IN_BYTES: number;
|
|
24
20
|
static COMPRESSED_SIZE_IN_BYTES: number;
|
|
25
21
|
/** Used to differentiate this class from AztecAddress */
|
|
26
22
|
readonly kind = "point";
|
|
23
|
+
/** Whether the point is at infinity */
|
|
24
|
+
readonly isInfinite: boolean;
|
|
27
25
|
constructor(
|
|
28
26
|
/**
|
|
29
27
|
* The point's x coordinate
|
|
@@ -32,15 +30,20 @@ export declare class Point {
|
|
|
32
30
|
/**
|
|
33
31
|
* The point's y coordinate
|
|
34
32
|
*/
|
|
35
|
-
y: Fr
|
|
33
|
+
y: Fr);
|
|
34
|
+
toJSON(): `0x${string}`;
|
|
35
|
+
static get schema(): import("zod").ZodType<Point, string, import("zod/v4/core").$ZodTypeInternals<Point, string>>;
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
37
|
+
* Creates a Point from a plain object without Zod validation.
|
|
38
|
+
* This method is optimized for performance and skips validation, making it suitable
|
|
39
|
+
* for deserializing trusted data (e.g., from C++ via MessagePack).
|
|
40
|
+
* Handles buffers, existing instances, or objects with x, y, and isInfinite fields.
|
|
41
|
+
* @param obj - Plain object, buffer, or Point instance
|
|
42
|
+
* @returns A Point instance
|
|
38
43
|
*/
|
|
39
|
-
|
|
40
|
-
toJSON(): `0x${string}`;
|
|
41
|
-
static get schema(): import("zod").ZodType<Point, any, string>;
|
|
44
|
+
static fromPlainObject(obj: any): Point;
|
|
42
45
|
/**
|
|
43
|
-
* Generate a random Point instance.
|
|
46
|
+
* Generate a random Point instance that is on the curve.
|
|
44
47
|
*
|
|
45
48
|
* @returns A randomly generated Point instance.
|
|
46
49
|
*/
|
|
@@ -87,7 +90,8 @@ export declare class Point {
|
|
|
87
90
|
*/
|
|
88
91
|
static fromXAndSign(x: Fr, sign: boolean): Promise<Point>;
|
|
89
92
|
/**
|
|
90
|
-
* @
|
|
93
|
+
* @param x - The x coordinate of the point
|
|
94
|
+
* @returns y^2 such that y^2 = x^3 - 17
|
|
91
95
|
*/
|
|
92
96
|
static YFromX(x: Fr): Promise<Fr | null>;
|
|
93
97
|
/**
|
|
@@ -103,17 +107,11 @@ export declare class Point {
|
|
|
103
107
|
toBigInts(): {
|
|
104
108
|
x: bigint;
|
|
105
109
|
y: bigint;
|
|
106
|
-
isInfinite: bigint;
|
|
107
110
|
};
|
|
108
111
|
/**
|
|
109
112
|
* Converts the Point instance to a Buffer representation of the coordinates.
|
|
110
113
|
* @returns A Buffer representation of the Point instance.
|
|
111
|
-
* @dev Note that toBuffer does not include the isInfinite flag
|
|
112
|
-
* This is because currently when we work with point as bytes we don't want to populate the extra bytes for
|
|
113
|
-
* isInfinite flag because:
|
|
114
|
-
* 1. Our Grumpkin BB API currently does not handle point at infinity,
|
|
115
|
-
* 2. we use toBuffer when serializing notes and events and there we only work with public keys and point at infinity
|
|
116
|
-
* is not considered a valid public key and the extra byte would raise DA cost.
|
|
114
|
+
* @dev Note that toBuffer does not include the isInfinite flag. The point at infinity is serialized as (0, 0).
|
|
117
115
|
*/
|
|
118
116
|
toBuffer(): Buffer<ArrayBufferLike>;
|
|
119
117
|
/**
|
|
@@ -141,13 +139,11 @@ export declare class Point {
|
|
|
141
139
|
toNoirStruct(): {
|
|
142
140
|
x: Fr;
|
|
143
141
|
y: Fr;
|
|
144
|
-
is_infinite: boolean;
|
|
145
142
|
};
|
|
146
143
|
toWrappedNoirStruct(): {
|
|
147
144
|
inner: {
|
|
148
145
|
x: Fr;
|
|
149
146
|
y: Fr;
|
|
150
|
-
is_infinite: boolean;
|
|
151
147
|
};
|
|
152
148
|
};
|
|
153
149
|
/**
|
|
@@ -159,15 +155,14 @@ export declare class Point {
|
|
|
159
155
|
*/
|
|
160
156
|
equals(rhs: Point): boolean;
|
|
161
157
|
isZero(): boolean;
|
|
162
|
-
hash(): Promise<Fr>;
|
|
163
158
|
/**
|
|
164
|
-
*
|
|
165
|
-
*
|
|
159
|
+
* @param x - The x coordinate of the point
|
|
160
|
+
* @param y - The y coordinate of the point
|
|
161
|
+
* @returns Whether the point exists on Grumpkin
|
|
166
162
|
*/
|
|
167
|
-
|
|
168
|
-
isOnGrumpkin(): boolean;
|
|
163
|
+
isOnCurve(): boolean;
|
|
169
164
|
}
|
|
170
165
|
export declare class NotOnCurveError extends Error {
|
|
171
166
|
constructor(x: Fr);
|
|
172
167
|
}
|
|
173
|
-
//# sourceMappingURL=
|
|
168
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicG9pbnQuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jdXJ2ZXMvZ3J1bXBraW4vcG9pbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBR0EsT0FBTyxFQUFFLFlBQVksRUFBRSxXQUFXLEVBQXFCLE1BQU0sMEJBQTBCLENBQUM7QUFFeEYsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBRXZDOzs7OztHQUtHO0FBQ0gscUJBQWEsS0FBSztJQVlkOztPQUVHO2FBQ2EsQ0FBQyxFQUFFLEVBQUU7SUFDckI7O09BRUc7YUFDYSxDQUFDLEVBQUUsRUFBRTtJQWxCdkIsTUFBTSxDQUFDLFFBQVEsUUFBK0I7SUFDOUMsTUFBTSxDQUFDLGFBQWEsU0FBd0I7SUFDNUMsTUFBTSxDQUFDLHdCQUF3QixTQUFvQjtJQUVuRCx5REFBeUQ7SUFDekQsU0FBZ0IsSUFBSSxXQUFXO0lBRS9CLHVDQUF1QztJQUN2QyxTQUFnQixVQUFVLEVBQUUsT0FBTyxDQUFDO0lBRXBD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