@aztec/pxe 0.0.0-test.1 → 0.0.1-commit.5476d83
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 +11 -24
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +18 -33
- package/dest/config/package_info.d.ts +1 -1
- 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 +300 -0
- package/dest/contract_function_simulator/execution_data_provider.d.ts +265 -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 +94 -0
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -0
- package/dest/contract_function_simulator/execution_note_cache.js +190 -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 +23 -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 +48 -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 +100 -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 +17 -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 +24 -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 +50 -0
- package/dest/contract_function_simulator/oracle/oracle.d.ts +58 -0
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/oracle.js +333 -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 +231 -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 +428 -0
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +153 -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 +694 -0
- package/dest/entrypoints/client/bundle/index.d.ts +5 -3
- 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 +10 -10
- 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 +5 -3
- 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 +9 -9
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +17 -11
- package/dest/entrypoints/pxe_creation_options.d.ts +14 -0
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -0
- package/dest/entrypoints/server/index.d.ts +6 -4
- 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 +8 -16
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +30 -35
- package/dest/error_enriching.d.ts +11 -0
- 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/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +28 -0
- 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_side_effect_uniqueness_hints.d.ts +3 -0
- package/dest/private_kernel/hints/compute_side_effect_uniqueness_hints.d.ts.map +1 -0
- package/dest/private_kernel/hints/compute_side_effect_uniqueness_hints.js +48 -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 +289 -0
- package/dest/private_kernel/private_kernel_oracle.d.ts +62 -0
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -0
- package/dest/private_kernel/private_kernel_oracle.js +4 -0
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts +45 -0
- 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 +240 -0
- package/dest/pxe.d.ts.map +1 -0
- package/dest/pxe.js +771 -0
- package/dest/storage/address_data_provider/address_data_provider.d.ts +2 -4
- 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/address_data_provider/index.d.ts +1 -1
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +15 -6
- 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/capsule_data_provider/index.d.ts +1 -1
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts +13 -58
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +1 -1
- package/dest/storage/contract_data_provider/contract_data_provider.js +89 -79
- package/dest/storage/contract_data_provider/index.d.ts +1 -2
- 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 +3 -42
- 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 +3 -4
- 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/index.d.ts +2 -2
- package/dest/storage/note_data_provider/index.d.ts.map +1 -1
- package/dest/storage/note_data_provider/index.js +1 -1
- package/dest/storage/note_data_provider/note_data_provider.d.ts +73 -10
- package/dest/storage/note_data_provider/note_data_provider.d.ts.map +1 -1
- package/dest/storage/note_data_provider/note_data_provider.js +145 -83
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +37 -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 +105 -0
- package/dest/storage/sync_data_provider/index.d.ts +1 -1
- package/dest/storage/sync_data_provider/sync_data_provider.d.ts +3 -5
- 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/index.d.ts +1 -1
- package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts +29 -7
- 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/index.d.ts +1 -1
- package/dest/synchronizer/synchronizer.d.ts +8 -10
- 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 +37 -34
- package/src/bin/check_oracle_version.ts +50 -0
- package/src/config/index.ts +27 -55
- package/src/config/package_info.ts +1 -1
- package/src/contract_function_simulator/contract_function_simulator.ts +553 -0
- package/src/contract_function_simulator/execution_data_provider.ts +333 -0
- package/src/contract_function_simulator/execution_note_cache.ts +229 -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 +61 -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 +170 -0
- package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +23 -0
- package/src/contract_function_simulator/oracle/note_packing_utils.ts +54 -0
- package/src/contract_function_simulator/oracle/oracle.ts +583 -0
- package/src/contract_function_simulator/oracle/private_execution.ts +207 -0
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +633 -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 +1008 -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 +58 -50
- 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 -146
- package/src/private_kernel/hints/compute_side_effect_uniqueness_hints.ts +173 -0
- 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 +1085 -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 +109 -93
- 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/index.ts +1 -1
- package/src/storage/note_data_provider/note_data_provider.ts +176 -122
- package/src/storage/private_event_data_provider/private_event_data_provider.ts +143 -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 +0 -11
- package/dest/entrypoints/client/pxe_creation_options.d.ts.map +0 -1
- package/dest/kernel_oracle/index.d.ts +0 -45
- package/dest/kernel_oracle/index.d.ts.map +0 -1
- package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts +0 -28
- 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 +0 -73
- 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 +0 -11
- 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/storage/note_data_provider/note_dao.d.ts +0 -106
- package/dest/storage/note_data_provider/note_dao.d.ts.map +0 -1
- package/dest/storage/note_data_provider/note_dao.js +0 -106
- 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/storage/note_data_provider/note_dao.ts +0 -162
- package/src/test/pxe_test_suite.ts +0 -111
- /package/dest/entrypoints/{client/pxe_creation_options.js → pxe_creation_options.js} +0 -0
|
@@ -1,351 +0,0 @@
|
|
|
1
|
-
import { CLIENT_IVC_VERIFICATION_KEY_LENGTH_IN_FIELDS, VK_TREE_HEIGHT } from '@aztec/constants';
|
|
2
|
-
import { vkAsFieldsMegaHonk } from '@aztec/foundation/crypto';
|
|
3
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
4
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
5
|
-
import { assertLength } from '@aztec/foundation/serialize';
|
|
6
|
-
import { pushTestData } from '@aztec/foundation/testing';
|
|
7
|
-
import { Timer } from '@aztec/foundation/timer';
|
|
8
|
-
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
9
|
-
import { getProtocolContractLeafAndMembershipWitness, protocolContractTreeRoot } from '@aztec/protocol-contracts';
|
|
10
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
11
|
-
import { computeContractAddressFromInstance } from '@aztec/stdlib/contract';
|
|
12
|
-
import { hashVK } from '@aztec/stdlib/hash';
|
|
13
|
-
import type { PrivateKernelProver } from '@aztec/stdlib/interfaces/client';
|
|
14
|
-
import {
|
|
15
|
-
PrivateCallData,
|
|
16
|
-
PrivateKernelCircuitPublicInputs,
|
|
17
|
-
PrivateKernelData,
|
|
18
|
-
PrivateKernelInitCircuitPrivateInputs,
|
|
19
|
-
PrivateKernelInnerCircuitPrivateInputs,
|
|
20
|
-
type PrivateKernelSimulateOutput,
|
|
21
|
-
PrivateKernelTailCircuitPrivateInputs,
|
|
22
|
-
type PrivateKernelTailCircuitPublicInputs,
|
|
23
|
-
PrivateVerificationKeyHints,
|
|
24
|
-
} from '@aztec/stdlib/kernel';
|
|
25
|
-
import { ClientIvcProof } from '@aztec/stdlib/proofs';
|
|
26
|
-
import {
|
|
27
|
-
type PrivateCallExecutionResult,
|
|
28
|
-
type PrivateExecutionResult,
|
|
29
|
-
TxRequest,
|
|
30
|
-
collectEnqueuedPublicFunctionCalls,
|
|
31
|
-
collectNoteHashLeafIndexMap,
|
|
32
|
-
collectNoteHashNullifierCounterMap,
|
|
33
|
-
collectPublicTeardownFunctionCall,
|
|
34
|
-
getFinalMinRevertibleSideEffectCounter,
|
|
35
|
-
} from '@aztec/stdlib/tx';
|
|
36
|
-
import { VerificationKeyAsFields } from '@aztec/stdlib/vks';
|
|
37
|
-
|
|
38
|
-
import type { WitnessMap } from '@noir-lang/types';
|
|
39
|
-
|
|
40
|
-
import { PrivateKernelResetPrivateInputsBuilder } from './hints/build_private_kernel_reset_private_inputs.js';
|
|
41
|
-
import type { ProvingDataOracle } from './proving_data_oracle.js';
|
|
42
|
-
|
|
43
|
-
const NULL_PROVE_OUTPUT: PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs> = {
|
|
44
|
-
publicInputs: PrivateKernelCircuitPublicInputs.empty(),
|
|
45
|
-
verificationKey: VerificationKeyAsFields.makeEmpty(CLIENT_IVC_VERIFICATION_KEY_LENGTH_IN_FIELDS),
|
|
46
|
-
outputWitness: new Map(),
|
|
47
|
-
bytecode: Buffer.from([]),
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export type ProvingConfig = {
|
|
51
|
-
simulate: boolean;
|
|
52
|
-
skipFeeEnforcement: boolean;
|
|
53
|
-
profile: boolean;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* The KernelProver class is responsible for generating kernel proofs.
|
|
58
|
-
* It takes a transaction request, its signature, and the simulation result as inputs, and outputs a proof
|
|
59
|
-
* along with output notes. The class interacts with a ProvingDataOracle to fetch membership witnesses and
|
|
60
|
-
* constructs private call data based on the execution results.
|
|
61
|
-
*/
|
|
62
|
-
export class KernelProver {
|
|
63
|
-
private log = createLogger('pxe:kernel-prover');
|
|
64
|
-
|
|
65
|
-
constructor(
|
|
66
|
-
private oracle: ProvingDataOracle,
|
|
67
|
-
private proofCreator: PrivateKernelProver,
|
|
68
|
-
private fakeProofs = false,
|
|
69
|
-
) {}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Generate a proof for a given transaction request and execution result.
|
|
73
|
-
* The function iterates through the nested executions in the execution result, creates private call data,
|
|
74
|
-
* and generates a proof using the provided ProofCreator instance. It also maintains an index of new notes
|
|
75
|
-
* created during the execution and returns them as a part of the KernelProverOutput.
|
|
76
|
-
*
|
|
77
|
-
* @param txRequest - The authenticated transaction request object.
|
|
78
|
-
* @param executionResult - The execution result object containing nested executions and preimages.
|
|
79
|
-
* @param profile - Set true to profile the gate count for each circuit
|
|
80
|
-
* @returns A Promise that resolves to a KernelProverOutput object containing proof, public inputs, and output notes.
|
|
81
|
-
* TODO(#7368) this should be refactored to not recreate the ACIR bytecode now that it operates on a program stack
|
|
82
|
-
*/
|
|
83
|
-
async prove(
|
|
84
|
-
txRequest: TxRequest,
|
|
85
|
-
executionResult: PrivateExecutionResult,
|
|
86
|
-
{ simulate, skipFeeEnforcement, profile }: ProvingConfig = {
|
|
87
|
-
simulate: false,
|
|
88
|
-
skipFeeEnforcement: false,
|
|
89
|
-
profile: false,
|
|
90
|
-
},
|
|
91
|
-
): Promise<PrivateKernelSimulateOutput<PrivateKernelTailCircuitPublicInputs>> {
|
|
92
|
-
const skipProofGeneration = this.fakeProofs || simulate;
|
|
93
|
-
const generateWitnesses = !skipProofGeneration || profile;
|
|
94
|
-
|
|
95
|
-
const timer = new Timer();
|
|
96
|
-
|
|
97
|
-
const isPrivateOnlyTx = this.isPrivateOnly(executionResult);
|
|
98
|
-
|
|
99
|
-
const executionStack = [executionResult.entrypoint];
|
|
100
|
-
let firstIteration = true;
|
|
101
|
-
|
|
102
|
-
let output = NULL_PROVE_OUTPUT;
|
|
103
|
-
|
|
104
|
-
const gateCounts: { circuitName: string; gateCount: number }[] = [];
|
|
105
|
-
const addGateCount = async (circuitName: string, bytecode: Buffer) => {
|
|
106
|
-
const gateCount = (await this.proofCreator.computeGateCountForCircuit(bytecode, circuitName)) as number;
|
|
107
|
-
gateCounts.push({ circuitName, gateCount });
|
|
108
|
-
|
|
109
|
-
this.log.debug(`Gate count for ${circuitName} - ${gateCount}`);
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
const noteHashLeafIndexMap = collectNoteHashLeafIndexMap(executionResult);
|
|
113
|
-
const noteHashNullifierCounterMap = collectNoteHashNullifierCounterMap(executionResult);
|
|
114
|
-
const enqueuedPublicFunctions = collectEnqueuedPublicFunctionCalls(executionResult);
|
|
115
|
-
const hasPublicCalls =
|
|
116
|
-
enqueuedPublicFunctions.length > 0 || !collectPublicTeardownFunctionCall(executionResult).isEmpty();
|
|
117
|
-
const validationRequestsSplitCounter = hasPublicCalls ? getFinalMinRevertibleSideEffectCounter(executionResult) : 0;
|
|
118
|
-
// vector of gzipped bincode acirs
|
|
119
|
-
const acirs: Buffer[] = [];
|
|
120
|
-
const witnessStack: WitnessMap[] = [];
|
|
121
|
-
|
|
122
|
-
while (executionStack.length) {
|
|
123
|
-
if (!firstIteration) {
|
|
124
|
-
let resetBuilder = new PrivateKernelResetPrivateInputsBuilder(
|
|
125
|
-
output,
|
|
126
|
-
executionStack,
|
|
127
|
-
noteHashNullifierCounterMap,
|
|
128
|
-
validationRequestsSplitCounter,
|
|
129
|
-
);
|
|
130
|
-
while (resetBuilder.needsReset()) {
|
|
131
|
-
const privateInputs = await resetBuilder.build(this.oracle, noteHashLeafIndexMap);
|
|
132
|
-
output = generateWitnesses
|
|
133
|
-
? await this.proofCreator.generateResetOutput(privateInputs)
|
|
134
|
-
: await this.proofCreator.simulateReset(privateInputs);
|
|
135
|
-
// TODO(#7368) consider refactoring this redundant bytecode pushing
|
|
136
|
-
acirs.push(output.bytecode);
|
|
137
|
-
witnessStack.push(output.outputWitness);
|
|
138
|
-
if (profile) {
|
|
139
|
-
await addGateCount('private_kernel_reset', output.bytecode);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
resetBuilder = new PrivateKernelResetPrivateInputsBuilder(
|
|
143
|
-
output,
|
|
144
|
-
executionStack,
|
|
145
|
-
noteHashNullifierCounterMap,
|
|
146
|
-
validationRequestsSplitCounter,
|
|
147
|
-
);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
const currentExecution = executionStack.pop()!;
|
|
152
|
-
|
|
153
|
-
executionStack.push(...[...currentExecution.nestedExecutions].reverse());
|
|
154
|
-
|
|
155
|
-
const functionName = await this.oracle.getDebugFunctionName(
|
|
156
|
-
currentExecution.publicInputs.callContext.contractAddress,
|
|
157
|
-
currentExecution.publicInputs.callContext.functionSelector,
|
|
158
|
-
);
|
|
159
|
-
|
|
160
|
-
// TODO(#7368): This used to be associated with getDebugFunctionName
|
|
161
|
-
// TODO(#7368): Is there any way to use this with client IVC proving?
|
|
162
|
-
acirs.push(currentExecution.acir);
|
|
163
|
-
witnessStack.push(currentExecution.partialWitness);
|
|
164
|
-
if (profile) {
|
|
165
|
-
await addGateCount(functionName as string, currentExecution.acir);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
const privateCallData = await this.createPrivateCallData(currentExecution);
|
|
169
|
-
|
|
170
|
-
if (firstIteration) {
|
|
171
|
-
const proofInput = new PrivateKernelInitCircuitPrivateInputs(
|
|
172
|
-
txRequest,
|
|
173
|
-
getVKTreeRoot(),
|
|
174
|
-
protocolContractTreeRoot,
|
|
175
|
-
privateCallData,
|
|
176
|
-
isPrivateOnlyTx,
|
|
177
|
-
executionResult.firstNullifier,
|
|
178
|
-
);
|
|
179
|
-
this.log.debug(
|
|
180
|
-
`Calling private kernel init with isPrivateOnly ${isPrivateOnlyTx} and firstNullifierHint ${proofInput.firstNullifierHint}`,
|
|
181
|
-
);
|
|
182
|
-
|
|
183
|
-
pushTestData('private-kernel-inputs-init', proofInput);
|
|
184
|
-
|
|
185
|
-
output = generateWitnesses
|
|
186
|
-
? await this.proofCreator.generateInitOutput(proofInput)
|
|
187
|
-
: await this.proofCreator.simulateInit(proofInput);
|
|
188
|
-
|
|
189
|
-
acirs.push(output.bytecode);
|
|
190
|
-
witnessStack.push(output.outputWitness);
|
|
191
|
-
if (profile) {
|
|
192
|
-
await addGateCount('private_kernel_init', output.bytecode);
|
|
193
|
-
}
|
|
194
|
-
} else {
|
|
195
|
-
const previousVkMembershipWitness = await this.oracle.getVkMembershipWitness(output.verificationKey);
|
|
196
|
-
const previousKernelData = new PrivateKernelData(
|
|
197
|
-
output.publicInputs,
|
|
198
|
-
output.verificationKey,
|
|
199
|
-
Number(previousVkMembershipWitness.leafIndex),
|
|
200
|
-
assertLength<Fr, typeof VK_TREE_HEIGHT>(previousVkMembershipWitness.siblingPath, VK_TREE_HEIGHT),
|
|
201
|
-
);
|
|
202
|
-
const proofInput = new PrivateKernelInnerCircuitPrivateInputs(previousKernelData, privateCallData);
|
|
203
|
-
|
|
204
|
-
pushTestData('private-kernel-inputs-inner', proofInput);
|
|
205
|
-
|
|
206
|
-
output = generateWitnesses
|
|
207
|
-
? await this.proofCreator.generateInnerOutput(proofInput)
|
|
208
|
-
: await this.proofCreator.simulateInner(proofInput);
|
|
209
|
-
|
|
210
|
-
acirs.push(output.bytecode);
|
|
211
|
-
witnessStack.push(output.outputWitness);
|
|
212
|
-
if (profile) {
|
|
213
|
-
await addGateCount('private_kernel_inner', output.bytecode);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
firstIteration = false;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
// Reset.
|
|
220
|
-
let resetBuilder = new PrivateKernelResetPrivateInputsBuilder(
|
|
221
|
-
output,
|
|
222
|
-
[],
|
|
223
|
-
noteHashNullifierCounterMap,
|
|
224
|
-
validationRequestsSplitCounter,
|
|
225
|
-
);
|
|
226
|
-
while (resetBuilder.needsReset()) {
|
|
227
|
-
const privateInputs = await resetBuilder.build(this.oracle, noteHashLeafIndexMap);
|
|
228
|
-
output = generateWitnesses
|
|
229
|
-
? await this.proofCreator.generateResetOutput(privateInputs)
|
|
230
|
-
: await this.proofCreator.simulateReset(privateInputs);
|
|
231
|
-
|
|
232
|
-
acirs.push(output.bytecode);
|
|
233
|
-
witnessStack.push(output.outputWitness);
|
|
234
|
-
if (profile) {
|
|
235
|
-
await addGateCount('private_kernel_reset', output.bytecode);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
resetBuilder = new PrivateKernelResetPrivateInputsBuilder(
|
|
239
|
-
output,
|
|
240
|
-
[],
|
|
241
|
-
noteHashNullifierCounterMap,
|
|
242
|
-
validationRequestsSplitCounter,
|
|
243
|
-
);
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
if (output.publicInputs.feePayer.isZero() && skipFeeEnforcement) {
|
|
247
|
-
if (!skipProofGeneration) {
|
|
248
|
-
throw new Error('Fee payment must be enforced when creating real proof.');
|
|
249
|
-
}
|
|
250
|
-
output.publicInputs.feePayer = new AztecAddress(Fr.MAX_FIELD_VALUE);
|
|
251
|
-
}
|
|
252
|
-
// Private tail.
|
|
253
|
-
const previousVkMembershipWitness = await this.oracle.getVkMembershipWitness(output.verificationKey);
|
|
254
|
-
const previousKernelData = new PrivateKernelData(
|
|
255
|
-
output.publicInputs,
|
|
256
|
-
output.verificationKey,
|
|
257
|
-
Number(previousVkMembershipWitness.leafIndex),
|
|
258
|
-
assertLength<Fr, typeof VK_TREE_HEIGHT>(previousVkMembershipWitness.siblingPath, VK_TREE_HEIGHT),
|
|
259
|
-
);
|
|
260
|
-
|
|
261
|
-
this.log.debug(
|
|
262
|
-
`Calling private kernel tail with hwm ${previousKernelData.publicInputs.minRevertibleSideEffectCounter}`,
|
|
263
|
-
);
|
|
264
|
-
|
|
265
|
-
const privateInputs = new PrivateKernelTailCircuitPrivateInputs(previousKernelData);
|
|
266
|
-
|
|
267
|
-
pushTestData('private-kernel-inputs-ordering', privateInputs);
|
|
268
|
-
|
|
269
|
-
const tailOutput = generateWitnesses
|
|
270
|
-
? await this.proofCreator.generateTailOutput(privateInputs)
|
|
271
|
-
: await this.proofCreator.simulateTail(privateInputs);
|
|
272
|
-
|
|
273
|
-
acirs.push(tailOutput.bytecode);
|
|
274
|
-
witnessStack.push(tailOutput.outputWitness);
|
|
275
|
-
if (profile) {
|
|
276
|
-
await addGateCount('private_kernel_tail', tailOutput.bytecode);
|
|
277
|
-
tailOutput.profileResult = { gateCounts };
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
if (generateWitnesses) {
|
|
281
|
-
this.log.info(`Private kernel witness generation took ${timer.ms()}ms`);
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
// TODO(#7368) how do we 'bincode' encode these inputs?
|
|
285
|
-
if (!skipProofGeneration) {
|
|
286
|
-
const ivcProof = await this.proofCreator.createClientIvcProof(acirs, witnessStack);
|
|
287
|
-
tailOutput.clientIvcProof = ivcProof;
|
|
288
|
-
} else {
|
|
289
|
-
tailOutput.clientIvcProof = ClientIvcProof.random();
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
return tailOutput;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
private async createPrivateCallData({ publicInputs, vk: vkAsBuffer }: PrivateCallExecutionResult) {
|
|
296
|
-
const { contractAddress, functionSelector } = publicInputs.callContext;
|
|
297
|
-
|
|
298
|
-
const vkAsFields = await vkAsFieldsMegaHonk(vkAsBuffer);
|
|
299
|
-
const vk = new VerificationKeyAsFields(vkAsFields, await hashVK(vkAsFields));
|
|
300
|
-
|
|
301
|
-
const { currentContractClassId, publicKeys, saltedInitializationHash } =
|
|
302
|
-
await this.oracle.getContractAddressPreimage(contractAddress);
|
|
303
|
-
const functionLeafMembershipWitness = await this.oracle.getFunctionMembershipWitness(
|
|
304
|
-
currentContractClassId,
|
|
305
|
-
functionSelector,
|
|
306
|
-
);
|
|
307
|
-
|
|
308
|
-
const { artifactHash: contractClassArtifactHash, publicBytecodeCommitment: contractClassPublicBytecodeCommitment } =
|
|
309
|
-
await this.oracle.getContractClassIdPreimage(currentContractClassId);
|
|
310
|
-
|
|
311
|
-
// This will be the address computed in the kernel by the executed class. We need to provide non membership of it in the protocol contract tree.
|
|
312
|
-
// This would only be equal to contractAddress if the currentClassId is equal to the original class id (no update happened).
|
|
313
|
-
const computedAddress = await computeContractAddressFromInstance({
|
|
314
|
-
originalContractClassId: currentContractClassId,
|
|
315
|
-
saltedInitializationHash,
|
|
316
|
-
publicKeys,
|
|
317
|
-
});
|
|
318
|
-
|
|
319
|
-
const { lowLeaf: protocolContractLeaf, witness: protocolContractMembershipWitness } =
|
|
320
|
-
await getProtocolContractLeafAndMembershipWitness(contractAddress, computedAddress);
|
|
321
|
-
|
|
322
|
-
const updatedClassIdHints = await this.oracle.getUpdatedClassIdHints(contractAddress);
|
|
323
|
-
return PrivateCallData.from({
|
|
324
|
-
publicInputs,
|
|
325
|
-
vk,
|
|
326
|
-
verificationKeyHints: PrivateVerificationKeyHints.from({
|
|
327
|
-
publicKeys,
|
|
328
|
-
contractClassArtifactHash,
|
|
329
|
-
contractClassPublicBytecodeCommitment,
|
|
330
|
-
saltedInitializationHash,
|
|
331
|
-
functionLeafMembershipWitness,
|
|
332
|
-
protocolContractMembershipWitness,
|
|
333
|
-
protocolContractLeaf,
|
|
334
|
-
updatedClassIdHints,
|
|
335
|
-
}),
|
|
336
|
-
});
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
private isPrivateOnly(executionResult: PrivateExecutionResult): boolean {
|
|
340
|
-
const isPrivateOnlyRecursive = (callResult: PrivateCallExecutionResult): boolean => {
|
|
341
|
-
const makesPublicCalls =
|
|
342
|
-
callResult.enqueuedPublicFunctionCalls.some(enqueuedCall => !enqueuedCall.isEmpty()) ||
|
|
343
|
-
!callResult.publicTeardownFunctionCall.isEmpty();
|
|
344
|
-
return (
|
|
345
|
-
!makesPublicCalls &&
|
|
346
|
-
callResult.nestedExecutions.every(nestedExecution => isPrivateOnlyRecursive(nestedExecution))
|
|
347
|
-
);
|
|
348
|
-
};
|
|
349
|
-
return isPrivateOnlyRecursive(executionResult.entrypoint);
|
|
350
|
-
}
|
|
351
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { ContractNotFoundError } from '@aztec/simulator/client';
|
|
2
|
-
import type { L1NotePayload } from '@aztec/stdlib/logs';
|
|
3
|
-
import { Note } from '@aztec/stdlib/note';
|
|
4
|
-
|
|
5
|
-
import type { ContractDataProvider } from '../storage/contract_data_provider/contract_data_provider.js';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Merges privately and publicly delivered note values.
|
|
9
|
-
* @param db - PXE database used to fetch contract instance and artifact.
|
|
10
|
-
* @param payload - Payload corresponding to the note.
|
|
11
|
-
* @returns Note payload with public fields added.
|
|
12
|
-
*/
|
|
13
|
-
export async function getOrderedNoteItems(
|
|
14
|
-
contractDataProvider: ContractDataProvider,
|
|
15
|
-
{ contractAddress, noteTypeId, privateNoteValues, publicNoteValues }: L1NotePayload,
|
|
16
|
-
): Promise<Note> {
|
|
17
|
-
if (publicNoteValues.length === 0) {
|
|
18
|
-
return new Note(privateNoteValues);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const instance = await contractDataProvider.getContractInstance(contractAddress);
|
|
22
|
-
if (!instance) {
|
|
23
|
-
throw new ContractNotFoundError(
|
|
24
|
-
`Could not find instance for ${contractAddress.toString()}. This should never happen here as the partial notes flow should be triggered only for non-deferred notes.`,
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const artifact = await contractDataProvider.getContractArtifact(instance.currentContractClassId);
|
|
29
|
-
if (!artifact) {
|
|
30
|
-
throw new Error(
|
|
31
|
-
`Could not find artifact for contract class ${instance.currentContractClassId.toString()}. This should never happen here as the partial notes flow should be triggered only for non-deferred notes.`,
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const noteFields = Object.values(artifact.notes).find(note => note.id.equals(noteTypeId))?.fields;
|
|
36
|
-
|
|
37
|
-
if (!noteFields) {
|
|
38
|
-
throw new Error(`Could not find note fields for note type ${noteTypeId.toString()}.`);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// We sort note fields by index so that we can iterate over them in order.
|
|
42
|
-
noteFields.sort((a, b) => a.index - b.index);
|
|
43
|
-
|
|
44
|
-
// Now we insert the public fields into the note based on its indices defined in the ABI.
|
|
45
|
-
const modifiedNoteItems = [...privateNoteValues];
|
|
46
|
-
let indexInPublicValues = 0;
|
|
47
|
-
for (let i = 0; i < noteFields.length; i++) {
|
|
48
|
-
const noteField = noteFields[i];
|
|
49
|
-
if (noteField.nullable) {
|
|
50
|
-
if (i == noteFields.length - 1) {
|
|
51
|
-
// We are processing the last field so we simply insert the rest of the public fields at the end
|
|
52
|
-
modifiedNoteItems.push(...publicNoteValues.slice(indexInPublicValues));
|
|
53
|
-
} else {
|
|
54
|
-
const noteFieldLength = noteFields[i + 1].index - noteField.index;
|
|
55
|
-
const publicValuesToInsert = publicNoteValues.slice(indexInPublicValues, indexInPublicValues + noteFieldLength);
|
|
56
|
-
indexInPublicValues += noteFieldLength;
|
|
57
|
-
// Now we insert the public fields at the note field index
|
|
58
|
-
modifiedNoteItems.splice(noteField.index, 0, ...publicValuesToInsert);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return new Note(modifiedNoteItems);
|
|
64
|
-
}
|
package/src/pxe_http/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './pxe_http_server.js';
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { createNamespacedSafeJsonRpcServer, createSafeJsonRpcServer } from '@aztec/foundation/json-rpc/server';
|
|
2
|
-
import { type PXE, PXESchema } from '@aztec/stdlib/interfaces/client';
|
|
3
|
-
|
|
4
|
-
import http from 'http';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Wraps an instance of Private eXecution Environment (PXE) implementation to a JSON RPC HTTP interface.
|
|
8
|
-
* @returns A new instance of the HTTP server.
|
|
9
|
-
*/
|
|
10
|
-
export function createPXERpcServer(pxeService: PXE) {
|
|
11
|
-
return createSafeJsonRpcServer(pxeService, PXESchema);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Creates an http server that forwards calls to the PXE and starts it on the given port.
|
|
16
|
-
* @param pxeService - PXE that answers queries to the created HTTP server.
|
|
17
|
-
* @param port - Port to listen in.
|
|
18
|
-
* @returns A running http server.
|
|
19
|
-
*/
|
|
20
|
-
export function startPXEHttpServer(pxeService: PXE, port: string | number): http.Server {
|
|
21
|
-
const rpcServer = createNamespacedSafeJsonRpcServer({ pxe: [pxeService, PXESchema] });
|
|
22
|
-
|
|
23
|
-
const app = rpcServer.getApp();
|
|
24
|
-
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
25
|
-
const httpServer = http.createServer(app.callback());
|
|
26
|
-
httpServer.listen(port);
|
|
27
|
-
|
|
28
|
-
return httpServer;
|
|
29
|
-
}
|