@aztec/pxe 0.0.0-test.1 → 0.0.1-commit.24de95ac
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/README.md +5 -5
- package/dest/bin/check_oracle_version.d.ts +2 -0
- package/dest/bin/check_oracle_version.d.ts.map +1 -0
- package/dest/bin/check_oracle_version.js +39 -0
- package/dest/config/index.d.ts +10 -15
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +11 -20
- package/dest/config/package_info.js +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +56 -0
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -0
- package/dest/contract_function_simulator/contract_function_simulator.js +301 -0
- package/dest/contract_function_simulator/execution_data_provider.d.ts +274 -0
- package/dest/contract_function_simulator/execution_data_provider.d.ts.map +1 -0
- package/dest/contract_function_simulator/execution_data_provider.js +14 -0
- package/dest/contract_function_simulator/execution_note_cache.d.ts +93 -0
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -0
- package/dest/contract_function_simulator/execution_note_cache.js +183 -0
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +16 -0
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -0
- package/dest/contract_function_simulator/execution_tagging_index_cache.js +26 -0
- package/dest/contract_function_simulator/hashed_values_cache.d.ts +28 -0
- package/dest/contract_function_simulator/hashed_values_cache.d.ts.map +1 -0
- package/dest/contract_function_simulator/hashed_values_cache.js +36 -0
- package/dest/contract_function_simulator/index.d.ts +14 -0
- package/dest/contract_function_simulator/index.d.ts.map +1 -0
- package/dest/contract_function_simulator/index.js +12 -0
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +20 -0
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/event_validation_request.js +37 -0
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +15 -0
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +25 -0
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +17 -0
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +65 -0
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +22 -0
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/note_validation_request.js +42 -0
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +22 -0
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/utility_context.js +33 -0
- package/dest/contract_function_simulator/oracle/index.d.ts +14 -0
- package/dest/contract_function_simulator/oracle/index.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/index.js +2 -0
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +97 -0
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/interfaces.js +4 -0
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +19 -0
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +24 -0
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +22 -0
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/note_packing_utils.js +49 -0
- package/dest/contract_function_simulator/oracle/oracle.d.ts +57 -0
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/oracle.js +328 -0
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +48 -0
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/private_execution.js +123 -0
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +236 -0
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +417 -0
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +154 -0
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +265 -0
- package/dest/contract_function_simulator/pick_notes.d.ts +85 -0
- package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -0
- package/dest/contract_function_simulator/pick_notes.js +51 -0
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +6 -0
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -0
- package/dest/contract_function_simulator/proxied_contract_data_source.js +62 -0
- package/dest/contract_function_simulator/proxied_node.d.ts +9 -0
- package/dest/contract_function_simulator/proxied_node.d.ts.map +1 -0
- package/dest/contract_function_simulator/proxied_node.js +27 -0
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts +122 -0
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts.map +1 -0
- package/dest/contract_function_simulator/pxe_oracle_interface.js +701 -0
- package/dest/entrypoints/client/bundle/index.d.ts +4 -2
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +3 -2
- package/dest/entrypoints/client/bundle/utils.d.ts +9 -9
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +18 -12
- package/dest/entrypoints/client/lazy/index.d.ts +4 -2
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +3 -2
- package/dest/entrypoints/client/lazy/utils.d.ts +8 -8
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +17 -11
- package/dest/entrypoints/{client/pxe_creation_options.d.ts → pxe_creation_options.d.ts} +4 -1
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -0
- package/dest/entrypoints/server/index.d.ts +5 -3
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +4 -3
- package/dest/entrypoints/server/utils.d.ts +7 -15
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +34 -28
- package/dest/{pxe_service/error_enriching.d.ts → error_enriching.d.ts} +1 -1
- package/dest/error_enriching.d.ts.map +1 -0
- package/dest/{pxe_service/error_enriching.js → error_enriching.js} +26 -18
- package/dest/oracle_version.d.ts +3 -0
- package/dest/oracle_version.d.ts.map +1 -0
- package/dest/oracle_version.js +10 -0
- package/dest/{kernel_prover → private_kernel}/hints/build_private_kernel_reset_private_inputs.d.ts +6 -6
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +1 -0
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.js +271 -0
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +4 -0
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +1 -0
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.js +41 -0
- package/dest/private_kernel/hints/index.d.ts +3 -0
- package/dest/private_kernel/hints/index.d.ts.map +1 -0
- package/dest/{kernel_prover → private_kernel}/hints/index.js +1 -0
- package/dest/private_kernel/index.d.ts +3 -0
- package/dest/private_kernel/index.d.ts.map +1 -0
- package/dest/private_kernel/index.js +2 -0
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +44 -0
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -0
- package/dest/private_kernel/private_kernel_execution_prover.js +285 -0
- package/dest/{kernel_prover/proving_data_oracle.d.ts → private_kernel/private_kernel_oracle.d.ts} +17 -28
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -0
- package/dest/private_kernel/private_kernel_oracle.js +4 -0
- package/dest/{kernel_oracle/index.d.ts → private_kernel/private_kernel_oracle_impl.d.ts} +8 -8
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +1 -0
- package/dest/{kernel_oracle/index.js → private_kernel/private_kernel_oracle_impl.js} +19 -9
- package/dest/pxe.d.ts +233 -0
- package/dest/pxe.d.ts.map +1 -0
- package/dest/pxe.js +789 -0
- package/dest/storage/address_data_provider/address_data_provider.d.ts +1 -3
- package/dest/storage/address_data_provider/address_data_provider.d.ts.map +1 -1
- package/dest/storage/address_data_provider/address_data_provider.js +0 -3
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +14 -5
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +1 -1
- package/dest/storage/capsule_data_provider/capsule_data_provider.js +85 -24
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts +12 -47
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +1 -1
- package/dest/storage/contract_data_provider/contract_data_provider.js +92 -70
- package/dest/storage/contract_data_provider/index.d.ts +0 -1
- package/dest/storage/contract_data_provider/index.d.ts.map +1 -1
- package/dest/storage/contract_data_provider/index.js +0 -1
- package/dest/storage/contract_data_provider/private_functions_tree.d.ts +2 -41
- package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +1 -1
- package/dest/storage/contract_data_provider/private_functions_tree.js +9 -61
- package/dest/storage/index.d.ts +2 -3
- package/dest/storage/index.d.ts.map +1 -1
- package/dest/storage/index.js +2 -3
- package/dest/storage/metadata.d.ts +2 -0
- package/dest/storage/metadata.d.ts.map +1 -0
- package/dest/storage/metadata.js +1 -0
- package/dest/storage/note_data_provider/note_dao.d.ts +16 -22
- package/dest/storage/note_data_provider/note_dao.d.ts.map +1 -1
- package/dest/storage/note_data_provider/note_dao.js +16 -20
- package/dest/storage/note_data_provider/note_data_provider.d.ts +71 -8
- package/dest/storage/note_data_provider/note_data_provider.d.ts.map +1 -1
- package/dest/storage/note_data_provider/note_data_provider.js +133 -74
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +43 -0
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts.map +1 -0
- package/dest/storage/private_event_data_provider/private_event_data_provider.js +104 -0
- package/dest/storage/sync_data_provider/sync_data_provider.d.ts +2 -4
- package/dest/storage/sync_data_provider/sync_data_provider.d.ts.map +1 -1
- package/dest/storage/sync_data_provider/sync_data_provider.js +2 -5
- package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts +28 -6
- package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts.map +1 -1
- package/dest/storage/tagging_data_provider/tagging_data_provider.js +48 -24
- package/dest/synchronizer/synchronizer.d.ts +7 -9
- package/dest/synchronizer/synchronizer.d.ts.map +1 -1
- package/dest/synchronizer/synchronizer.js +17 -19
- package/dest/tagging/constants.d.ts +2 -0
- package/dest/tagging/constants.d.ts.map +1 -0
- package/dest/tagging/constants.js +2 -0
- package/dest/tagging/index.d.ts +7 -0
- package/dest/tagging/index.d.ts.map +1 -0
- package/dest/tagging/index.js +5 -0
- package/dest/tagging/siloed_tag.d.ts +14 -0
- package/dest/tagging/siloed_tag.d.ts.map +1 -0
- package/dest/tagging/siloed_tag.js +20 -0
- package/dest/tagging/tag.d.ts +12 -0
- package/dest/tagging/tag.d.ts.map +1 -0
- package/dest/tagging/tag.js +17 -0
- package/dest/tagging/utils.d.ts +18 -0
- package/dest/tagging/utils.d.ts.map +1 -0
- package/dest/tagging/utils.js +24 -0
- package/package.json +34 -32
- package/src/bin/check_oracle_version.ts +50 -0
- package/src/config/index.ts +20 -33
- package/src/config/package_info.ts +1 -1
- package/src/contract_function_simulator/contract_function_simulator.ts +548 -0
- package/src/contract_function_simulator/execution_data_provider.ts +343 -0
- package/src/contract_function_simulator/execution_note_cache.ts +222 -0
- package/src/contract_function_simulator/execution_tagging_index_cache.ts +32 -0
- package/src/contract_function_simulator/hashed_values_cache.ts +47 -0
- package/src/contract_function_simulator/index.ts +13 -0
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +47 -0
- package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +27 -0
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +69 -0
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +52 -0
- package/src/contract_function_simulator/noir-structs/utility_context.ts +42 -0
- package/src/contract_function_simulator/oracle/index.ts +16 -0
- package/src/contract_function_simulator/oracle/interfaces.ts +160 -0
- package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +23 -0
- package/src/contract_function_simulator/oracle/note_packing_utils.ts +52 -0
- package/src/contract_function_simulator/oracle/oracle.ts +575 -0
- package/src/contract_function_simulator/oracle/private_execution.ts +207 -0
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +625 -0
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +358 -0
- package/src/contract_function_simulator/pick_notes.ts +141 -0
- package/src/contract_function_simulator/proxied_contract_data_source.ts +66 -0
- package/src/contract_function_simulator/proxied_node.ts +33 -0
- package/src/contract_function_simulator/pxe_oracle_interface.ts +1019 -0
- package/src/entrypoints/client/bundle/index.ts +4 -2
- package/src/entrypoints/client/bundle/utils.ts +36 -36
- package/src/entrypoints/client/lazy/index.ts +4 -2
- package/src/entrypoints/client/lazy/utils.ts +36 -31
- package/src/entrypoints/{client/pxe_creation_options.ts → pxe_creation_options.ts} +4 -1
- package/src/entrypoints/server/index.ts +5 -3
- package/src/entrypoints/server/utils.ts +69 -47
- package/src/{pxe_service/error_enriching.ts → error_enriching.ts} +36 -27
- package/src/oracle_version.ts +11 -0
- package/src/{kernel_prover → private_kernel}/hints/build_private_kernel_reset_private_inputs.ts +158 -142
- package/src/private_kernel/hints/compute_tx_include_by_timestamp.ts +58 -0
- package/src/{kernel_prover → private_kernel}/hints/index.ts +1 -0
- package/src/private_kernel/index.ts +2 -0
- package/src/private_kernel/private_kernel_execution_prover.ts +436 -0
- package/src/{kernel_prover/proving_data_oracle.ts → private_kernel/private_kernel_oracle.ts} +17 -29
- package/src/{kernel_oracle/index.ts → private_kernel/private_kernel_oracle_impl.ts} +30 -15
- package/src/pxe.ts +1113 -0
- package/src/storage/address_data_provider/address_data_provider.ts +1 -7
- package/src/storage/capsule_data_provider/capsule_data_provider.ts +97 -30
- package/src/storage/contract_data_provider/contract_data_provider.ts +114 -81
- package/src/storage/contract_data_provider/index.ts +0 -1
- package/src/storage/contract_data_provider/private_functions_tree.ts +11 -75
- package/src/storage/index.ts +2 -4
- package/src/storage/metadata.ts +1 -0
- package/src/storage/note_data_provider/note_dao.ts +19 -27
- package/src/storage/note_data_provider/note_data_provider.ts +161 -113
- package/src/storage/private_event_data_provider/private_event_data_provider.ts +148 -0
- package/src/storage/sync_data_provider/sync_data_provider.ts +4 -10
- package/src/storage/tagging_data_provider/tagging_data_provider.ts +58 -30
- package/src/synchronizer/synchronizer.ts +21 -22
- package/src/tagging/constants.ts +2 -0
- package/src/tagging/index.ts +6 -0
- package/src/tagging/siloed_tag.ts +22 -0
- package/src/tagging/tag.ts +16 -0
- package/src/tagging/utils.ts +31 -0
- package/dest/bin/index.d.ts +0 -3
- package/dest/bin/index.d.ts.map +0 -1
- package/dest/bin/index.js +0 -28
- package/dest/entrypoints/client/pxe_creation_options.d.ts.map +0 -1
- package/dest/kernel_oracle/index.d.ts.map +0 -1
- package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
- package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.js +0 -270
- package/dest/kernel_prover/hints/index.d.ts +0 -2
- package/dest/kernel_prover/hints/index.d.ts.map +0 -1
- package/dest/kernel_prover/index.d.ts +0 -3
- package/dest/kernel_prover/index.d.ts.map +0 -1
- package/dest/kernel_prover/index.js +0 -2
- package/dest/kernel_prover/kernel_prover.d.ts +0 -38
- package/dest/kernel_prover/kernel_prover.d.ts.map +0 -1
- package/dest/kernel_prover/kernel_prover.js +0 -217
- package/dest/kernel_prover/proving_data_oracle.d.ts.map +0 -1
- package/dest/kernel_prover/proving_data_oracle.js +0 -4
- package/dest/note_decryption_utils/add_public_values_to_payload.d.ts +0 -11
- package/dest/note_decryption_utils/add_public_values_to_payload.d.ts.map +0 -1
- package/dest/note_decryption_utils/add_public_values_to_payload.js +0 -47
- package/dest/pxe_http/index.d.ts +0 -2
- package/dest/pxe_http/index.d.ts.map +0 -1
- package/dest/pxe_http/index.js +0 -1
- package/dest/pxe_http/pxe_http_server.d.ts +0 -16
- package/dest/pxe_http/pxe_http_server.d.ts.map +0 -1
- package/dest/pxe_http/pxe_http_server.js +0 -27
- package/dest/pxe_oracle_interface/index.d.ts +0 -159
- package/dest/pxe_oracle_interface/index.d.ts.map +0 -1
- package/dest/pxe_oracle_interface/index.js +0 -692
- package/dest/pxe_oracle_interface/tagging_utils.d.ts +0 -17
- package/dest/pxe_oracle_interface/tagging_utils.d.ts.map +0 -1
- package/dest/pxe_oracle_interface/tagging_utils.js +0 -23
- package/dest/pxe_service/error_enriching.d.ts.map +0 -1
- package/dest/pxe_service/index.d.ts +0 -3
- package/dest/pxe_service/index.d.ts.map +0 -1
- package/dest/pxe_service/index.js +0 -2
- package/dest/pxe_service/pxe_service.d.ts +0 -111
- package/dest/pxe_service/pxe_service.d.ts.map +0 -1
- package/dest/pxe_service/pxe_service.js +0 -664
- package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.d.ts +0 -11
- package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.d.ts.map +0 -1
- package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.js +0 -20
- package/dest/storage/auth_witness_data_provider/index.d.ts +0 -2
- package/dest/storage/auth_witness_data_provider/index.d.ts.map +0 -1
- package/dest/storage/auth_witness_data_provider/index.js +0 -1
- package/dest/storage/data_provider.d.ts +0 -4
- package/dest/storage/data_provider.d.ts.map +0 -1
- package/dest/storage/data_provider.js +0 -1
- package/dest/test/pxe_test_suite.d.ts +0 -3
- package/dest/test/pxe_test_suite.d.ts.map +0 -1
- package/dest/test/pxe_test_suite.js +0 -97
- package/src/bin/index.ts +0 -38
- package/src/kernel_prover/index.ts +0 -2
- package/src/kernel_prover/kernel_prover.ts +0 -351
- package/src/note_decryption_utils/add_public_values_to_payload.ts +0 -64
- package/src/pxe_http/index.ts +0 -1
- package/src/pxe_http/pxe_http_server.ts +0 -29
- package/src/pxe_oracle_interface/index.ts +0 -925
- package/src/pxe_oracle_interface/tagging_utils.ts +0 -32
- package/src/pxe_service/index.ts +0 -2
- package/src/pxe_service/pxe_service.ts +0 -949
- package/src/storage/auth_witness_data_provider/auth_witness_data_provider.ts +0 -34
- package/src/storage/auth_witness_data_provider/index.ts +0 -1
- package/src/storage/data_provider.ts +0 -3
- package/src/test/pxe_test_suite.ts +0 -111
- /package/dest/entrypoints/{client/pxe_creation_options.js → pxe_creation_options.js} +0 -0
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
1
|
import { FUNCTION_TREE_HEIGHT } from '@aztec/constants';
|
|
4
|
-
import {
|
|
5
|
-
import { MembershipWitness, type MerkleTree } from '@aztec/foundation/trees';
|
|
2
|
+
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
6
3
|
import { type ContractArtifact, FunctionSelector } from '@aztec/stdlib/abi';
|
|
7
|
-
import { type ContractClassWithId } from '@aztec/stdlib/contract';
|
|
8
4
|
/**
|
|
9
5
|
* Represents a Merkle tree of functions for a particular Contract Class.
|
|
10
6
|
* It manages the construction of the function tree, computes its root, and generates membership witnesses
|
|
@@ -12,45 +8,10 @@ import { type ContractClassWithId } from '@aztec/stdlib/contract';
|
|
|
12
8
|
* It is used in combination with the AztecNode to compute various data for executing private transactions.
|
|
13
9
|
*/
|
|
14
10
|
export declare class PrivateFunctionsTree {
|
|
15
|
-
private readonly
|
|
16
|
-
private contractClass;
|
|
11
|
+
private readonly privateFunctions;
|
|
17
12
|
private tree?;
|
|
18
13
|
private constructor();
|
|
19
14
|
static create(artifact: ContractArtifact): Promise<PrivateFunctionsTree>;
|
|
20
|
-
/**
|
|
21
|
-
* Retrieve the artifact of a given function.
|
|
22
|
-
* The function is identified by its selector, which represents a unique identifier for the function's signature.
|
|
23
|
-
* Throws an error if the function with the provided selector is not found in the contract.
|
|
24
|
-
*
|
|
25
|
-
* @param selector - The function selector.
|
|
26
|
-
* @returns The artifact object containing relevant information about the targeted function.
|
|
27
|
-
*/
|
|
28
|
-
getFunctionArtifact(selector: FunctionSelector): Promise<import("@aztec/stdlib/abi").FunctionArtifact>;
|
|
29
|
-
/**
|
|
30
|
-
* Retrieve the bytecode of a function in the contract by its function selector.
|
|
31
|
-
* The function selector is a unique identifier for each function in a contract.
|
|
32
|
-
* Throws an error if the function with the given selector is not found in the contract.
|
|
33
|
-
*
|
|
34
|
-
* @param selector - The selector of a function to get bytecode for.
|
|
35
|
-
* @returns The bytecode of the function as a string.
|
|
36
|
-
*/
|
|
37
|
-
getBytecode(selector: FunctionSelector): Promise<Buffer>;
|
|
38
|
-
/**
|
|
39
|
-
* Calculate and return the root of the function tree for the current contract.
|
|
40
|
-
* This root is a cryptographic commitment to the set of constrained functions within the contract,
|
|
41
|
-
* which is used in the Aztec node's proof system. The root will be cached after the first call.
|
|
42
|
-
*
|
|
43
|
-
* @returns A promise that resolves to the Fr (finite field element) representation of the function tree root.
|
|
44
|
-
*/
|
|
45
|
-
getFunctionTreeRoot(): Promise<MerkleTree>;
|
|
46
|
-
/** Returns the contract class object. */
|
|
47
|
-
getContractClass(): ContractClassWithId;
|
|
48
|
-
/** Returns the contract artifact. */
|
|
49
|
-
getArtifact(): ContractArtifact;
|
|
50
|
-
/**
|
|
51
|
-
* Returns the contract class identifier for the given artifact.
|
|
52
|
-
*/
|
|
53
|
-
getContractClassId(): Fr;
|
|
54
15
|
/**
|
|
55
16
|
* Retrieve the membership witness of a function within a contract's function tree.
|
|
56
17
|
* A membership witness represents the position and authentication path of a target function
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private_functions_tree.d.ts","sourceRoot":"","sources":["../../../src/storage/contract_data_provider/private_functions_tree.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"private_functions_tree.d.ts","sourceRoot":"","sources":["../../../src/storage/contract_data_provider/private_functions_tree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAGxD,OAAO,EAAE,iBAAiB,EAAmB,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EAAE,KAAK,gBAAgB,EAAE,gBAAgB,EAAgB,MAAM,mBAAmB,CAAC;AAQ1F;;;;;GAKG;AACH,qBAAa,oBAAoB;IAGX,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAFrD,OAAO,CAAC,IAAI,CAAC,CAAa;IAE1B,OAAO;WAEM,MAAM,CAAC,QAAQ,EAAE,gBAAgB;IAS9C;;;;;;;;OAQG;IACU,4BAA4B,CACvC,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,iBAAiB,CAAC,OAAO,oBAAoB,CAAC,CAAC;YAiB5C,OAAO;CAMtB"}
|
|
@@ -2,73 +2,22 @@ import { FUNCTION_TREE_HEIGHT } from '@aztec/constants';
|
|
|
2
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
3
|
import { assertLength } from '@aztec/foundation/serialize';
|
|
4
4
|
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
5
|
-
import {
|
|
6
|
-
import { computePrivateFunctionLeaf, computePrivateFunctionsTree,
|
|
5
|
+
import { FunctionType } from '@aztec/stdlib/abi';
|
|
6
|
+
import { computePrivateFunctionLeaf, computePrivateFunctionsTree, getContractClassPrivateFunctionFromArtifact } from '@aztec/stdlib/contract';
|
|
7
7
|
/**
|
|
8
8
|
* Represents a Merkle tree of functions for a particular Contract Class.
|
|
9
9
|
* It manages the construction of the function tree, computes its root, and generates membership witnesses
|
|
10
10
|
* for constrained functions. This class also enables lookup of specific function artifact using selectors.
|
|
11
11
|
* It is used in combination with the AztecNode to compute various data for executing private transactions.
|
|
12
12
|
*/ export class PrivateFunctionsTree {
|
|
13
|
-
|
|
14
|
-
contractClass;
|
|
13
|
+
privateFunctions;
|
|
15
14
|
tree;
|
|
16
|
-
constructor(
|
|
17
|
-
this.
|
|
18
|
-
this.contractClass = contractClass;
|
|
15
|
+
constructor(privateFunctions){
|
|
16
|
+
this.privateFunctions = privateFunctions;
|
|
19
17
|
}
|
|
20
18
|
static async create(artifact) {
|
|
21
|
-
const
|
|
22
|
-
return new PrivateFunctionsTree(
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Retrieve the artifact of a given function.
|
|
26
|
-
* The function is identified by its selector, which represents a unique identifier for the function's signature.
|
|
27
|
-
* Throws an error if the function with the provided selector is not found in the contract.
|
|
28
|
-
*
|
|
29
|
-
* @param selector - The function selector.
|
|
30
|
-
* @returns The artifact object containing relevant information about the targeted function.
|
|
31
|
-
*/ async getFunctionArtifact(selector) {
|
|
32
|
-
const functionsAndSelectors = await Promise.all(this.artifact.functions.map(async (f)=>({
|
|
33
|
-
f,
|
|
34
|
-
selector: await FunctionSelector.fromNameAndParameters(f.name, f.parameters)
|
|
35
|
-
})));
|
|
36
|
-
const artifact = functionsAndSelectors.find((f)=>selector.equals(f.selector))?.f;
|
|
37
|
-
if (!artifact) {
|
|
38
|
-
throw new Error(`Unknown function. Selector ${selector.toString()} not found in the artifact ${this.artifact.name} with class ${this.getContractClassId().toString()}.`);
|
|
39
|
-
}
|
|
40
|
-
return artifact;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Retrieve the bytecode of a function in the contract by its function selector.
|
|
44
|
-
* The function selector is a unique identifier for each function in a contract.
|
|
45
|
-
* Throws an error if the function with the given selector is not found in the contract.
|
|
46
|
-
*
|
|
47
|
-
* @param selector - The selector of a function to get bytecode for.
|
|
48
|
-
* @returns The bytecode of the function as a string.
|
|
49
|
-
*/ async getBytecode(selector) {
|
|
50
|
-
const artifact = await this.getFunctionArtifact(selector);
|
|
51
|
-
return artifact.bytecode;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Calculate and return the root of the function tree for the current contract.
|
|
55
|
-
* This root is a cryptographic commitment to the set of constrained functions within the contract,
|
|
56
|
-
* which is used in the Aztec node's proof system. The root will be cached after the first call.
|
|
57
|
-
*
|
|
58
|
-
* @returns A promise that resolves to the Fr (finite field element) representation of the function tree root.
|
|
59
|
-
*/ getFunctionTreeRoot() {
|
|
60
|
-
return this.getTree();
|
|
61
|
-
}
|
|
62
|
-
/** Returns the contract class object. */ getContractClass() {
|
|
63
|
-
return this.contractClass;
|
|
64
|
-
}
|
|
65
|
-
/** Returns the contract artifact. */ getArtifact() {
|
|
66
|
-
return this.artifact;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Returns the contract class identifier for the given artifact.
|
|
70
|
-
*/ getContractClassId() {
|
|
71
|
-
return this.getContractClass().id;
|
|
19
|
+
const privateFunctions = await Promise.all(artifact.functions.filter((fn)=>fn.functionType === FunctionType.PRIVATE).map(getContractClassPrivateFunctionFromArtifact));
|
|
20
|
+
return new PrivateFunctionsTree(privateFunctions);
|
|
72
21
|
}
|
|
73
22
|
/**
|
|
74
23
|
* Retrieve the membership witness of a function within a contract's function tree.
|
|
@@ -79,7 +28,7 @@ import { computePrivateFunctionLeaf, computePrivateFunctionsTree, getContractCla
|
|
|
79
28
|
* @param selector - The function selector.
|
|
80
29
|
* @returns A MembershipWitness instance representing the position and authentication path of the function in the function tree.
|
|
81
30
|
*/ async getFunctionMembershipWitness(selector) {
|
|
82
|
-
const fn = this.
|
|
31
|
+
const fn = this.privateFunctions.find((f)=>f.selector.equals(selector));
|
|
83
32
|
if (!fn) {
|
|
84
33
|
throw new Error(`Private function with selector ${selector.toString()} not found in contract class.`);
|
|
85
34
|
}
|
|
@@ -91,8 +40,7 @@ import { computePrivateFunctionLeaf, computePrivateFunctionsTree, getContractCla
|
|
|
91
40
|
}
|
|
92
41
|
async getTree() {
|
|
93
42
|
if (!this.tree) {
|
|
94
|
-
|
|
95
|
-
this.tree = await computePrivateFunctionsTree(fns);
|
|
43
|
+
this.tree = await computePrivateFunctionsTree(this.privateFunctions);
|
|
96
44
|
}
|
|
97
45
|
return this.tree;
|
|
98
46
|
}
|
package/dest/storage/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
export * from './address_data_provider/index.js';
|
|
2
|
-
export * from './auth_witness_data_provider/index.js';
|
|
3
2
|
export * from './capsule_data_provider/index.js';
|
|
4
3
|
export * from './contract_data_provider/index.js';
|
|
5
4
|
export * from './note_data_provider/index.js';
|
|
6
5
|
export * from './sync_data_provider/index.js';
|
|
7
6
|
export * from './tagging_data_provider/index.js';
|
|
8
|
-
export * from './
|
|
9
|
-
export
|
|
7
|
+
export * from './metadata.js';
|
|
8
|
+
export * from './private_event_data_provider/private_event_data_provider.js';
|
|
10
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC;AAClD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,eAAe,CAAC;AAC9B,cAAc,8DAA8D,CAAC"}
|
package/dest/storage/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
export * from './address_data_provider/index.js';
|
|
2
|
-
export * from './auth_witness_data_provider/index.js';
|
|
3
2
|
export * from './capsule_data_provider/index.js';
|
|
4
3
|
export * from './contract_data_provider/index.js';
|
|
5
4
|
export * from './note_data_provider/index.js';
|
|
6
5
|
export * from './sync_data_provider/index.js';
|
|
7
6
|
export * from './tagging_data_provider/index.js';
|
|
8
|
-
export * from './
|
|
9
|
-
export
|
|
7
|
+
export * from './metadata.js';
|
|
8
|
+
export * from './private_event_data_provider/private_event_data_provider.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../src/storage/metadata.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const PXE_DATA_SCHEMA_VERSION = 2;
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
1
|
import { Fr } from '@aztec/foundation/fields';
|
|
4
2
|
import { BufferReader } from '@aztec/foundation/serialize';
|
|
5
|
-
import type { NoteData } from '@aztec/simulator/client';
|
|
6
|
-
import { NoteSelector } from '@aztec/stdlib/abi';
|
|
7
3
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
8
|
-
import type { PublicKey } from '@aztec/stdlib/keys';
|
|
9
4
|
import { Note } from '@aztec/stdlib/note';
|
|
10
5
|
import { TxHash } from '@aztec/stdlib/tx';
|
|
6
|
+
import type { NoteData } from '../../contract_function_simulator/oracle/interfaces.js';
|
|
11
7
|
/**
|
|
12
8
|
* A Note Data Access Object, representing a note that was committed to the note hash tree, holding all of the
|
|
13
9
|
* information required to use it during execution and manage its state.
|
|
@@ -20,10 +16,10 @@ export declare class NoteDao implements NoteData {
|
|
|
20
16
|
/**
|
|
21
17
|
* The storage location of the note. This value is not used for anything in PXE, but we do index by storage slot
|
|
22
18
|
* since contracts typically make queries based on it.
|
|
23
|
-
|
|
19
|
+
*/
|
|
24
20
|
storageSlot: Fr;
|
|
25
|
-
/** The
|
|
26
|
-
|
|
21
|
+
/** The nonce that was injected into the note hash preimage in order to guarantee uniqueness. */
|
|
22
|
+
noteNonce: Fr;
|
|
27
23
|
/**
|
|
28
24
|
* The inner hash (non-unique, non-siloed) of the note. Each contract determines how the note is hashed. Can
|
|
29
25
|
* be used alongside contractAddress and nonce to compute the uniqueNoteHash and the siloedNoteHash.
|
|
@@ -46,12 +42,11 @@ export declare class NoteDao implements NoteData {
|
|
|
46
42
|
l2BlockHash: string;
|
|
47
43
|
/** The index of the leaf in the global note hash tree the note is stored at */
|
|
48
44
|
index: bigint;
|
|
49
|
-
/**
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
* TODO(#12013): remove
|
|
45
|
+
/**
|
|
46
|
+
* The address whose public key was used to encrypt the note log during delivery.
|
|
47
|
+
* (This is the x-coordinate of the public key.)
|
|
53
48
|
*/
|
|
54
|
-
|
|
49
|
+
recipient: AztecAddress;
|
|
55
50
|
constructor(
|
|
56
51
|
/** The packed content of the note, as will be returned in the getNotes oracle. */
|
|
57
52
|
note: Note,
|
|
@@ -60,10 +55,10 @@ export declare class NoteDao implements NoteData {
|
|
|
60
55
|
/**
|
|
61
56
|
* The storage location of the note. This value is not used for anything in PXE, but we do index by storage slot
|
|
62
57
|
* since contracts typically make queries based on it.
|
|
63
|
-
|
|
58
|
+
*/
|
|
64
59
|
storageSlot: Fr,
|
|
65
|
-
/** The
|
|
66
|
-
|
|
60
|
+
/** The nonce that was injected into the note hash preimage in order to guarantee uniqueness. */
|
|
61
|
+
noteNonce: Fr,
|
|
67
62
|
/**
|
|
68
63
|
* The inner hash (non-unique, non-siloed) of the note. Each contract determines how the note is hashed. Can
|
|
69
64
|
* be used alongside contractAddress and nonce to compute the uniqueNoteHash and the siloedNoteHash.
|
|
@@ -86,12 +81,11 @@ export declare class NoteDao implements NoteData {
|
|
|
86
81
|
l2BlockHash: string,
|
|
87
82
|
/** The index of the leaf in the global note hash tree the note is stored at */
|
|
88
83
|
index: bigint,
|
|
89
|
-
/**
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
* TODO(#12013): remove
|
|
84
|
+
/**
|
|
85
|
+
* The address whose public key was used to encrypt the note log during delivery.
|
|
86
|
+
* (This is the x-coordinate of the public key.)
|
|
93
87
|
*/
|
|
94
|
-
|
|
88
|
+
recipient: AztecAddress);
|
|
95
89
|
toBuffer(): Buffer;
|
|
96
90
|
static fromBuffer(buffer: Buffer | BufferReader): NoteDao;
|
|
97
91
|
toString(): string;
|
|
@@ -101,6 +95,6 @@ export declare class NoteDao implements NoteData {
|
|
|
101
95
|
* @returns - Its size in bytes.
|
|
102
96
|
*/
|
|
103
97
|
getSize(): number;
|
|
104
|
-
static random({ note, contractAddress, storageSlot,
|
|
98
|
+
static random({ note, contractAddress, storageSlot, noteNonce, noteHash, siloedNullifier, txHash, l2BlockNumber, l2BlockHash, index, recipient, }?: Partial<NoteDao>): Promise<NoteDao>;
|
|
105
99
|
}
|
|
106
100
|
//# sourceMappingURL=note_dao.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"note_dao.d.ts","sourceRoot":"","sources":["../../../src/storage/note_data_provider/note_dao.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"note_dao.d.ts","sourceRoot":"","sources":["../../../src/storage/note_data_provider/note_dao.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAS,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wDAAwD,CAAC;AAEvF;;;GAGG;AACH,qBAAa,OAAQ,YAAW,QAAQ;IAIpC,kFAAkF;IAC3E,IAAI,EAAE,IAAI;IACjB,8GAA8G;IACvG,eAAe,EAAE,YAAY;IACpC;;;OAGG;IACI,WAAW,EAAE,EAAE;IACtB,gGAAgG;IACzF,SAAS,EAAE,EAAE;IAGpB;;;OAGG;IACI,QAAQ,EAAE,EAAE;IACnB;;;OAGG;IACI,eAAe,EAAE,EAAE;IAG1B;;OAEG;IACI,MAAM,EAAE,MAAM;IACrB;gBACY;IACL,aAAa,EAAE,MAAM;IAC5B;gBACY;IACL,WAAW,EAAE,MAAM;IAC1B,+EAA+E;IACxE,KAAK,EAAE,MAAM;IACpB;;;OAGG;IACI,SAAS,EAAE,YAAY;;IAzC9B,kFAAkF;IAC3E,IAAI,EAAE,IAAI;IACjB,8GAA8G;IACvG,eAAe,EAAE,YAAY;IACpC;;;OAGG;IACI,WAAW,EAAE,EAAE;IACtB,gGAAgG;IACzF,SAAS,EAAE,EAAE;IAGpB;;;OAGG;IACI,QAAQ,EAAE,EAAE;IACnB;;;OAGG;IACI,eAAe,EAAE,EAAE;IAG1B;;OAEG;IACI,MAAM,EAAE,MAAM;IACrB;gBACY;IACL,aAAa,EAAE,MAAM;IAC5B;gBACY;IACL,WAAW,EAAE,MAAM;IAC1B,+EAA+E;IACxE,KAAK,EAAE,MAAM;IACpB;;;OAGG;IACI,SAAS,EAAE,YAAY;IAGhC,QAAQ,IAAI,MAAM;IAgBlB,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY;IA8B/C,QAAQ;IAIR,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM;IAK7B;;;OAGG;IACI,OAAO;WAMD,MAAM,CAAC,EAClB,IAAoB,EACpB,eAA2B,EAC3B,WAAyB,EACzB,SAAuB,EACvB,QAAsB,EACtB,eAA6B,EAC7B,MAAwB,EACxB,aAAgD,EAChD,WAAoC,EACpC,KAA8B,EAC9B,SAAqB,GACtB,GAAE,OAAO,CAAC,OAAO,CAAM;CAezB"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { toBigIntBE } from '@aztec/foundation/bigint-buffer';
|
|
2
2
|
import { Fr, Point } from '@aztec/foundation/fields';
|
|
3
3
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
4
|
-
import { NoteSelector } from '@aztec/stdlib/abi';
|
|
5
4
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
5
|
import { Note } from '@aztec/stdlib/note';
|
|
7
6
|
import { TxHash } from '@aztec/stdlib/tx';
|
|
@@ -12,20 +11,19 @@ import { TxHash } from '@aztec/stdlib/tx';
|
|
|
12
11
|
note;
|
|
13
12
|
contractAddress;
|
|
14
13
|
storageSlot;
|
|
15
|
-
|
|
14
|
+
noteNonce;
|
|
16
15
|
noteHash;
|
|
17
16
|
siloedNullifier;
|
|
18
17
|
txHash;
|
|
19
18
|
l2BlockNumber;
|
|
20
19
|
l2BlockHash;
|
|
21
20
|
index;
|
|
22
|
-
|
|
23
|
-
noteTypeId;
|
|
21
|
+
recipient;
|
|
24
22
|
constructor(// Note information
|
|
25
23
|
/** The packed content of the note, as will be returned in the getNotes oracle. */ note, /** The address of the contract that created the note (i.e. the address used by the kernel during siloing). */ contractAddress, /**
|
|
26
24
|
* The storage location of the note. This value is not used for anything in PXE, but we do index by storage slot
|
|
27
25
|
* since contracts typically make queries based on it.
|
|
28
|
-
|
|
26
|
+
*/ storageSlot, /** The nonce that was injected into the note hash preimage in order to guarantee uniqueness. */ noteNonce, // Computed values
|
|
29
27
|
/**
|
|
30
28
|
* The inner hash (non-unique, non-siloed) of the note. Each contract determines how the note is hashed. Can
|
|
31
29
|
* be used alongside contractAddress and nonce to compute the uniqueNoteHash and the siloedNoteHash.
|
|
@@ -37,36 +35,35 @@ import { TxHash } from '@aztec/stdlib/tx';
|
|
|
37
35
|
* when searching for txEffects.
|
|
38
36
|
*/ txHash, /** The L2 block number in which the tx with this note was included. Used for note management while processing
|
|
39
37
|
* reorgs.*/ l2BlockNumber, /** The L2 block hash in which the tx with this note was included. Used for note management while processing
|
|
40
|
-
* reorgs.*/ l2BlockHash, /** The index of the leaf in the global note hash tree the note is stored at */ index, /**
|
|
41
|
-
*
|
|
42
|
-
|
|
38
|
+
* reorgs.*/ l2BlockHash, /** The index of the leaf in the global note hash tree the note is stored at */ index, /**
|
|
39
|
+
* The address whose public key was used to encrypt the note log during delivery.
|
|
40
|
+
* (This is the x-coordinate of the public key.)
|
|
41
|
+
*/ recipient){
|
|
43
42
|
this.note = note;
|
|
44
43
|
this.contractAddress = contractAddress;
|
|
45
44
|
this.storageSlot = storageSlot;
|
|
46
|
-
this.
|
|
45
|
+
this.noteNonce = noteNonce;
|
|
47
46
|
this.noteHash = noteHash;
|
|
48
47
|
this.siloedNullifier = siloedNullifier;
|
|
49
48
|
this.txHash = txHash;
|
|
50
49
|
this.l2BlockNumber = l2BlockNumber;
|
|
51
50
|
this.l2BlockHash = l2BlockHash;
|
|
52
51
|
this.index = index;
|
|
53
|
-
this.
|
|
54
|
-
this.noteTypeId = noteTypeId;
|
|
52
|
+
this.recipient = recipient;
|
|
55
53
|
}
|
|
56
54
|
toBuffer() {
|
|
57
55
|
return serializeToBuffer([
|
|
58
56
|
this.note,
|
|
59
57
|
this.contractAddress,
|
|
60
58
|
this.storageSlot,
|
|
61
|
-
this.
|
|
59
|
+
this.noteNonce,
|
|
62
60
|
this.noteHash,
|
|
63
61
|
this.siloedNullifier,
|
|
64
62
|
this.txHash,
|
|
65
63
|
this.l2BlockNumber,
|
|
66
64
|
Fr.fromHexString(this.l2BlockHash),
|
|
67
65
|
this.index,
|
|
68
|
-
this.
|
|
69
|
-
this.noteTypeId
|
|
66
|
+
this.recipient
|
|
70
67
|
]);
|
|
71
68
|
}
|
|
72
69
|
static fromBuffer(buffer) {
|
|
@@ -74,16 +71,15 @@ import { TxHash } from '@aztec/stdlib/tx';
|
|
|
74
71
|
const note = Note.fromBuffer(reader);
|
|
75
72
|
const contractAddress = AztecAddress.fromBuffer(reader);
|
|
76
73
|
const storageSlot = Fr.fromBuffer(reader);
|
|
77
|
-
const
|
|
74
|
+
const noteNonce = Fr.fromBuffer(reader);
|
|
78
75
|
const noteHash = Fr.fromBuffer(reader);
|
|
79
76
|
const siloedNullifier = Fr.fromBuffer(reader);
|
|
80
77
|
const txHash = reader.readObject(TxHash);
|
|
81
78
|
const l2BlockNumber = reader.readNumber();
|
|
82
79
|
const l2BlockHash = Fr.fromBuffer(reader).toString();
|
|
83
80
|
const index = toBigIntBE(reader.readBytes(32));
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
return new NoteDao(note, contractAddress, storageSlot, nonce, noteHash, siloedNullifier, txHash, l2BlockNumber, l2BlockHash, index, publicKey, noteTypeId);
|
|
81
|
+
const recipient = AztecAddress.fromBuffer(reader);
|
|
82
|
+
return new NoteDao(note, contractAddress, storageSlot, noteNonce, noteHash, siloedNullifier, txHash, l2BlockNumber, l2BlockHash, index, recipient);
|
|
87
83
|
}
|
|
88
84
|
toString() {
|
|
89
85
|
return '0x' + this.toBuffer().toString('hex');
|
|
@@ -100,7 +96,7 @@ import { TxHash } from '@aztec/stdlib/tx';
|
|
|
100
96
|
const noteSize = 4 + this.note.items.length * Fr.SIZE_IN_BYTES;
|
|
101
97
|
return noteSize + AztecAddress.SIZE_IN_BYTES + Fr.SIZE_IN_BYTES * 4 + TxHash.SIZE + Point.SIZE_IN_BYTES + indexSize;
|
|
102
98
|
}
|
|
103
|
-
static async random({ note = Note.random(), contractAddress = undefined, storageSlot = Fr.random(),
|
|
104
|
-
return new NoteDao(note, contractAddress ?? await AztecAddress.random(), storageSlot,
|
|
99
|
+
static async random({ note = Note.random(), contractAddress = undefined, storageSlot = Fr.random(), noteNonce = Fr.random(), noteHash = Fr.random(), siloedNullifier = Fr.random(), txHash = TxHash.random(), l2BlockNumber = Math.floor(Math.random() * 1000), l2BlockHash = Fr.random().toString(), index = Fr.random().toBigInt(), recipient = undefined } = {}) {
|
|
100
|
+
return new NoteDao(note, contractAddress ?? await AztecAddress.random(), storageSlot, noteNonce, noteHash, siloedNullifier, txHash, l2BlockNumber, l2BlockHash, index, recipient ?? await AztecAddress.random());
|
|
105
101
|
}
|
|
106
102
|
}
|
|
@@ -1,20 +1,83 @@
|
|
|
1
|
-
import type { Fr
|
|
1
|
+
import type { Fr } from '@aztec/foundation/fields';
|
|
2
2
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
3
3
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
4
|
import type { InBlock } from '@aztec/stdlib/block';
|
|
5
5
|
import { type NotesFilter } from '@aztec/stdlib/note';
|
|
6
|
-
import type { DataProvider } from '../data_provider.js';
|
|
7
6
|
import { NoteDao } from './note_dao.js';
|
|
8
|
-
|
|
7
|
+
/**
|
|
8
|
+
* NoteDataProvider manages the storage and retrieval of notes.
|
|
9
|
+
*
|
|
10
|
+
* Notes can be active or nullified. This class processes new notes, nullifications,
|
|
11
|
+
* and performs rollback handling in the case of a reorg.
|
|
12
|
+
**/
|
|
13
|
+
export declare class NoteDataProvider {
|
|
9
14
|
#private;
|
|
10
15
|
private constructor();
|
|
16
|
+
/**
|
|
17
|
+
* Creates and initializes a new NoteDataProvider instance.
|
|
18
|
+
*
|
|
19
|
+
* This factory method creates a NoteDataProvider and restores any existing
|
|
20
|
+
* scope-specific indexes from the database.
|
|
21
|
+
*
|
|
22
|
+
* @param store - The key-value store to use for persistence
|
|
23
|
+
* @returns Promise resolving to a fully initialized NoteDataProvider instance
|
|
24
|
+
*/
|
|
11
25
|
static create(store: AztecAsyncKVStore): Promise<NoteDataProvider>;
|
|
26
|
+
/**
|
|
27
|
+
* Adds a new scope to the note data provider.
|
|
28
|
+
*
|
|
29
|
+
* Scopes provide privacy isolation by creating separate indexes for each user.
|
|
30
|
+
* Each scope gets its own set of indexes for efficient note retrieval by various criteria.
|
|
31
|
+
*
|
|
32
|
+
* @param scope - The AztecAddress representing the scope/user to add
|
|
33
|
+
* @returns Promise resolving to true if scope was added, false if it already existed
|
|
34
|
+
*/
|
|
12
35
|
addScope(scope: AztecAddress): Promise<boolean>;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Adds multiple notes to the data provider under the specified scope.
|
|
38
|
+
*
|
|
39
|
+
* Notes are stored using their index from the notes hash tree as the key, which provides
|
|
40
|
+
* uniqueness and maintains creation order. Each note is indexed by multiple criteria
|
|
41
|
+
* for efficient retrieval.
|
|
42
|
+
*
|
|
43
|
+
* @param notes - Notes to store
|
|
44
|
+
* @param scope - The scope (user/account) under which to store the notes
|
|
45
|
+
*/
|
|
46
|
+
addNotes(notes: NoteDao[], scope: AztecAddress): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Synchronizes notes and nullifiers to a specific block number.
|
|
49
|
+
*
|
|
50
|
+
* This method ensures that the state of notes and nullifiers is consistent with the
|
|
51
|
+
* specified block number. It restores any notes that were nullified after the given block
|
|
52
|
+
* and deletes any active notes created after that block.
|
|
53
|
+
*
|
|
54
|
+
* @param blockNumber - The new chain tip after a reorg
|
|
55
|
+
* @param synchedBlockNumber - The block number up to which PXE managed to sync before the reorg happened.
|
|
56
|
+
*/
|
|
57
|
+
rollbackNotesAndNullifiers(blockNumber: number, synchedBlockNumber: number): Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* Retrieves notes based on the provided filter criteria.
|
|
60
|
+
*
|
|
61
|
+
* This method queries both active and optionally nullified notes based on the filter
|
|
62
|
+
* parameters.
|
|
63
|
+
*
|
|
64
|
+
* @param filter - Filter criteria including contractAddress (required), and optional
|
|
65
|
+
* storageSlot, status, scopes and siloedNullifier.
|
|
66
|
+
* @returns Promise resolving to array of NoteDao objects matching the filter
|
|
67
|
+
* @throws If filtering by an empty scopes array. Scopes have to be set to undefined or to a non-empty array.
|
|
68
|
+
*/
|
|
16
69
|
getNotes(filter: NotesFilter): Promise<NoteDao[]>;
|
|
17
|
-
|
|
18
|
-
|
|
70
|
+
/**
|
|
71
|
+
* Transitions notes from "active" to "nullified" state.
|
|
72
|
+
*
|
|
73
|
+
* This operation processes a batch of nullifiers to mark the corresponding notes
|
|
74
|
+
* as spent/nullified. The operation is atomic - if any nullifier is not found,
|
|
75
|
+
* the entire operation fails and no notes are modified.
|
|
76
|
+
*
|
|
77
|
+
* @param nullifiers - Array of nullifiers with their block numbers to process
|
|
78
|
+
* @returns Promise resolving to array of nullified NoteDao objects
|
|
79
|
+
* @throws Error if any nullifier is not found in the active notes
|
|
80
|
+
*/
|
|
81
|
+
applyNullifiers(nullifiers: InBlock<Fr>[]): Promise<NoteDao[]>;
|
|
19
82
|
}
|
|
20
83
|
//# sourceMappingURL=note_data_provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"note_data_provider.d.ts","sourceRoot":"","sources":["../../../src/storage/note_data_provider/note_data_provider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"note_data_provider.d.ts","sourceRoot":"","sources":["../../../src/storage/note_data_provider/note_data_provider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAEnD,OAAO,KAAK,EAAE,iBAAiB,EAAqC,MAAM,iBAAiB,CAAC;AAC5F,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAc,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAElE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC;;;;;IAKI;AACJ,qBAAa,gBAAgB;;IAiB3B,OAAO;IAkBP;;;;;;;;OAQG;WACiB,MAAM,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAS/E;;;;;;;;OAQG;IACU,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC;IAc5D;;;;;;;;;OASG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAkB9D;;;;;;;;;OASG;IACU,0BAA0B,CAAC,WAAW,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAwFvG;;;;;;;;;;OAUG;IACG,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IA8FvD;;;;;;;;;;OAUG;IACH,eAAe,CAAC,UAAU,EAAE,OAAO,CAAC,EAAE,CAAC,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CA0D/D"}
|