@aztec/pxe 0.0.0-test.1 → 0.0.1-commit.b655e406
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
package/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
# PXE
|
|
1
|
+
# PXE & PXE
|
|
2
2
|
|
|
3
|
-
`PXE
|
|
3
|
+
`PXE` (pronounced "pixie service") is a server-side software that provides a set of apis for interacting with the Aztec network. It acts as a bridge between the network and client applications by exposing methods to manage accounts, deploy contracts, create transactions, and retrieve public and account-specific information. It provides a secure environment for the execution of sensitive operations, ensuring private information and decrypted data are not accessible to unauthorized applications. The PXE is a critical component of the Aztec network, and its security and reliability are essential to the overall trustworthiness of user's data.
|
|
4
4
|
|
|
5
|
-
`PXE` is the interface the PXE
|
|
5
|
+
`PXE` is the interface the PXE and every client-side instance implement. Various implementations of the client-side can exist, including those for different platforms such as mobile apps and web browsers. It is a relay between the dApps and the actual PXE.
|
|
6
6
|
|
|
7
|
-
### Main Components in an PXE
|
|
7
|
+
### Main Components in an PXE
|
|
8
8
|
|
|
9
9
|
- [Simulator](../simulator/)
|
|
10
10
|
- [Key Store](../key-store/)
|
|
11
11
|
- [Account State](./src/account_state/account_state.ts): It coordinates other components to synchronize and decrypt data, simulate transactions, and generate kernel proofs, for a specific account.
|
|
12
12
|
|
|
13
|
-

|
|
13
|
+

|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check_oracle_version.d.ts","sourceRoot":"","sources":["../../src/bin/check_oracle_version.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { keccak256String } from '@aztec/foundation/crypto';
|
|
2
|
+
import { Oracle } from '../contract_function_simulator/oracle/oracle.js';
|
|
3
|
+
import { ORACLE_INTERFACE_HASH } from '../oracle_version.js';
|
|
4
|
+
/**
|
|
5
|
+
* Verifies that the Oracle interface matches the expected interface hash.
|
|
6
|
+
*
|
|
7
|
+
* The Oracle interface needs to be versioned to ensure compatibility between Aztec.nr and PXE. This function computes
|
|
8
|
+
* a hash of the Oracle interface and compares it against a known hash. If they don't match, it means the interface has
|
|
9
|
+
* changed and the ORACLE_VERSION constant needs to be incremented and the ORACLE_INTERFACE_HASH constant needs to be
|
|
10
|
+
* updated.
|
|
11
|
+
*
|
|
12
|
+
* TODO(#16581): The following only takes into consideration changes to the oracles defined in Oracle.ts and omits TXE
|
|
13
|
+
* oracles. Ensure this checks TXE oracles as well. This hasn't been implemented yet since we don't have a clean TXE
|
|
14
|
+
* oracle interface like we do in PXE (i.e., there is no single Oracle class that contains only the oracles).
|
|
15
|
+
*/ function assertOracleInterfaceMatches() {
|
|
16
|
+
const excludedProps = [
|
|
17
|
+
'handler',
|
|
18
|
+
'constructor',
|
|
19
|
+
'toACIRCallback',
|
|
20
|
+
'handlerAsMisc',
|
|
21
|
+
'handlerAsUtility',
|
|
22
|
+
'handlerAsPrivate'
|
|
23
|
+
];
|
|
24
|
+
// Create a hashable representation of the oracle interface by concatenating its method names. Return values are
|
|
25
|
+
// excluded from the hash calculation since they are typically arrays of fields and I didn't manage to reliably
|
|
26
|
+
// stringify them.
|
|
27
|
+
// TODO(#16581): we're only checking the functions implemented by the Oracle object, which is really an ACVM
|
|
28
|
+
// translator, akin to TXE's RPC translator. This is correct in that it is ultimately the foreign interface that
|
|
29
|
+
// matters, but incorrect in that it does not take into consideration TXE's extended interface. An improvement would
|
|
30
|
+
// be to check RPCTranslator from TXE, though that still seems a bit fragile.
|
|
31
|
+
const oracleInterfaceMethodNames = Object.getOwnPropertyNames(Oracle.prototype).filter((name)=>!excludedProps.includes(name)).sort().join('');
|
|
32
|
+
// We use keccak256 here just because we already have it in the dependencies.
|
|
33
|
+
const oracleInterfaceHash = keccak256String(oracleInterfaceMethodNames);
|
|
34
|
+
if (oracleInterfaceHash !== ORACLE_INTERFACE_HASH) {
|
|
35
|
+
// This check exists only to notify you when you need to update the ORACLE_VERSION constant.
|
|
36
|
+
throw new Error(`The Oracle interface has changed, which implies a breaking change in the aztec.nr/PXE oracle interface. Update ORACLE_INTERFACE_HASH to ${oracleInterfaceHash} and bump ORACLE_VERSION in pxe/src/oracle_version.ts.`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
assertOracleInterfaceMatches();
|
package/dest/config/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type ConfigMappingsType } from '@aztec/foundation/config';
|
|
2
2
|
import { type DataStoreConfig } from '@aztec/kv-store/config';
|
|
3
3
|
import { type ChainConfig } from '@aztec/stdlib/config';
|
|
4
|
-
import type { Network } from '@aztec/stdlib/network';
|
|
5
4
|
export { getPackageInfo } from './package_info.js';
|
|
6
5
|
/**
|
|
7
6
|
* Temporary configuration until WASM can be used instead of native
|
|
@@ -19,30 +18,26 @@ export interface KernelProverConfig {
|
|
|
19
18
|
proverEnabled?: boolean;
|
|
20
19
|
}
|
|
21
20
|
/**
|
|
22
|
-
* Configuration settings for the
|
|
21
|
+
* Configuration settings for the synchronizer.
|
|
23
22
|
*/
|
|
24
|
-
export interface
|
|
25
|
-
/**
|
|
26
|
-
|
|
23
|
+
export interface SynchronizerConfig {
|
|
24
|
+
/** Maximum amount of blocks to pull from the stream in one request when synchronizing */
|
|
25
|
+
l2BlockBatchSize: number;
|
|
27
26
|
}
|
|
28
|
-
export type
|
|
27
|
+
export type PXEConfig = KernelProverConfig & BBProverConfig & DataStoreConfig & ChainConfig & SynchronizerConfig;
|
|
29
28
|
export type CliPXEOptions = {
|
|
30
|
-
/** External Aztec network to connect to. e.g. devnet */
|
|
31
|
-
network?: Network;
|
|
32
|
-
/** API Key required by the external network's node */
|
|
33
|
-
apiKey?: string;
|
|
34
29
|
/** Custom Aztec Node URL to connect to */
|
|
35
30
|
nodeUrl?: string;
|
|
36
31
|
};
|
|
37
|
-
export declare const pxeConfigMappings: ConfigMappingsType<
|
|
32
|
+
export declare const pxeConfigMappings: ConfigMappingsType<PXEConfig>;
|
|
38
33
|
/**
|
|
39
|
-
* Creates an instance of
|
|
34
|
+
* Creates an instance of PXEConfig out of environment variables using sensible defaults for integration testing if not set.
|
|
40
35
|
*/
|
|
41
|
-
export declare function
|
|
36
|
+
export declare function getPXEConfig(): PXEConfig;
|
|
42
37
|
export declare const pxeCliConfigMappings: ConfigMappingsType<CliPXEOptions>;
|
|
43
|
-
export declare const allPxeConfigMappings: ConfigMappingsType<CliPXEOptions &
|
|
38
|
+
export declare const allPxeConfigMappings: ConfigMappingsType<CliPXEOptions & PXEConfig>;
|
|
44
39
|
/**
|
|
45
40
|
* Creates an instance of CliPxeOptions out of environment variables
|
|
46
41
|
*/
|
|
47
|
-
export declare function getCliPXEOptions(): CliPXEOptions &
|
|
42
|
+
export declare function getCliPXEOptions(): CliPXEOptions & PXEConfig;
|
|
48
43
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EAKxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,KAAK,eAAe,EAAsB,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAE,KAAK,WAAW,EAAuB,MAAM,sBAAsB,CAAC;AAE7E,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,8CAA8C;IAC9C,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,yFAAyF;IACzF,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,MAAM,SAAS,GAAG,kBAAkB,GAAG,cAAc,GAAG,eAAe,GAAG,WAAW,GAAG,kBAAkB,CAAC;AAEjH,MAAM,MAAM,aAAa,GAAG;IAC1B,2CAA2C;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,kBAAkB,CAAC,SAAS,CA0B3D,CAAC;AAEF;;GAEG;AACH,wBAAgB,YAAY,IAAI,SAAS,CAExC;AAED,eAAO,MAAM,oBAAoB,EAAE,kBAAkB,CAAC,aAAa,CAKlE,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,kBAAkB,CAAC,aAAa,GAAG,SAAS,CAW9E,CAAC;AAEF;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,aAAa,GAAG,SAAS,CAQ5D"}
|
package/dest/config/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
|
|
2
1
|
import { booleanConfigHelper, getConfigFromMappings, numberConfigHelper, parseBooleanEnv } from '@aztec/foundation/config';
|
|
3
2
|
import { dataConfigMappings } from '@aztec/kv-store/config';
|
|
4
3
|
import { chainConfigMappings } from '@aztec/stdlib/config';
|
|
@@ -6,10 +5,10 @@ export { getPackageInfo } from './package_info.js';
|
|
|
6
5
|
export const pxeConfigMappings = {
|
|
7
6
|
...dataConfigMappings,
|
|
8
7
|
...chainConfigMappings,
|
|
9
|
-
|
|
10
|
-
env: '
|
|
11
|
-
...numberConfigHelper(
|
|
12
|
-
description: '
|
|
8
|
+
l2BlockBatchSize: {
|
|
9
|
+
env: 'PXE_L2_BLOCK_BATCH_SIZE',
|
|
10
|
+
...numberConfigHelper(50),
|
|
11
|
+
description: 'Maximum amount of blocks to pull from the stream in one request when synchronizing'
|
|
13
12
|
},
|
|
14
13
|
bbBinaryPath: {
|
|
15
14
|
env: 'BB_BINARY_PATH',
|
|
@@ -27,24 +26,15 @@ export const pxeConfigMappings = {
|
|
|
27
26
|
proverEnabled: {
|
|
28
27
|
env: 'PXE_PROVER_ENABLED',
|
|
29
28
|
description: 'Enable real proofs',
|
|
30
|
-
...booleanConfigHelper()
|
|
29
|
+
...booleanConfigHelper(true)
|
|
31
30
|
}
|
|
32
31
|
};
|
|
33
32
|
/**
|
|
34
|
-
* Creates an instance of
|
|
35
|
-
*/ export function
|
|
33
|
+
* Creates an instance of PXEConfig out of environment variables using sensible defaults for integration testing if not set.
|
|
34
|
+
*/ export function getPXEConfig() {
|
|
36
35
|
return getConfigFromMappings(pxeConfigMappings);
|
|
37
36
|
}
|
|
38
37
|
export const pxeCliConfigMappings = {
|
|
39
|
-
network: {
|
|
40
|
-
env: 'NETWORK',
|
|
41
|
-
parseEnv: (val)=>val,
|
|
42
|
-
description: 'External Aztec network to connect to. e.g. devnet'
|
|
43
|
-
},
|
|
44
|
-
apiKey: {
|
|
45
|
-
env: 'API_KEY',
|
|
46
|
-
description: "API Key required by the external network's node"
|
|
47
|
-
},
|
|
48
38
|
nodeUrl: {
|
|
49
39
|
env: 'AZTEC_NODE_URL',
|
|
50
40
|
description: 'Custom Aztec Node URL to connect to'
|
|
@@ -58,17 +48,18 @@ export const allPxeConfigMappings = {
|
|
|
58
48
|
env: 'PXE_PROVER_ENABLED',
|
|
59
49
|
parseEnv: (val)=>parseBooleanEnv(val) || !!process.env.NETWORK,
|
|
60
50
|
description: 'Enable real proofs',
|
|
61
|
-
isBoolean: true
|
|
51
|
+
isBoolean: true,
|
|
52
|
+
defaultValue: true
|
|
62
53
|
}
|
|
63
54
|
};
|
|
64
55
|
/**
|
|
65
56
|
* Creates an instance of CliPxeOptions out of environment variables
|
|
66
57
|
*/ export function getCliPXEOptions() {
|
|
67
|
-
const pxeConfig =
|
|
58
|
+
const pxeConfig = getPXEConfig();
|
|
68
59
|
const cliOptions = getConfigFromMappings(pxeCliConfigMappings);
|
|
69
60
|
return {
|
|
70
61
|
...pxeConfig,
|
|
71
62
|
...cliOptions,
|
|
72
|
-
proverEnabled: pxeConfig.proverEnabled
|
|
63
|
+
proverEnabled: pxeConfig.proverEnabled
|
|
73
64
|
};
|
|
74
65
|
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
+
import { type CircuitSimulator } from '@aztec/simulator/client';
|
|
3
|
+
import type { AbiDecoded, FunctionCall } from '@aztec/stdlib/abi';
|
|
4
|
+
import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
5
|
+
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
6
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
7
|
+
import { type PrivateKernelExecutionProofOutput, PrivateKernelTailCircuitPublicInputs } from '@aztec/stdlib/kernel';
|
|
8
|
+
import { PrivateExecutionResult, TxExecutionRequest } from '@aztec/stdlib/tx';
|
|
9
|
+
import type { ContractDataProvider } from '../storage/index.js';
|
|
10
|
+
import type { ExecutionDataProvider } from './execution_data_provider.js';
|
|
11
|
+
/**
|
|
12
|
+
* The contract function simulator.
|
|
13
|
+
*/
|
|
14
|
+
export declare class ContractFunctionSimulator {
|
|
15
|
+
private executionDataProvider;
|
|
16
|
+
private simulator;
|
|
17
|
+
private log;
|
|
18
|
+
constructor(executionDataProvider: ExecutionDataProvider, simulator: CircuitSimulator);
|
|
19
|
+
/**
|
|
20
|
+
* Runs a private function.
|
|
21
|
+
* @param request - The transaction request.
|
|
22
|
+
* @param entryPointArtifact - The artifact of the entry point function.
|
|
23
|
+
* @param contractAddress - The address of the contract (should match request.origin)
|
|
24
|
+
* @param msgSender - The address calling the function. This can be replaced to simulate a call from another contract
|
|
25
|
+
* or a specific account.
|
|
26
|
+
* @param senderForTags - The address that is used as a tagging sender when emitting private logs. Returned from
|
|
27
|
+
* the `privateGetSenderForTags` oracle.
|
|
28
|
+
* @param scopes - The accounts whose notes we can access in this call. Currently optional and will default to all.
|
|
29
|
+
* @returns The result of the execution.
|
|
30
|
+
*/
|
|
31
|
+
run(request: TxExecutionRequest, contractAddress: AztecAddress, selector: FunctionSelector, msgSender?: AztecAddress, senderForTags?: AztecAddress, scopes?: AztecAddress[]): Promise<PrivateExecutionResult>;
|
|
32
|
+
/**
|
|
33
|
+
* Runs a utility function.
|
|
34
|
+
* @param call - The function call to execute.
|
|
35
|
+
* @param authwits - Authentication witnesses required for the function call.
|
|
36
|
+
* @param scopes - Optional array of account addresses whose notes can be accessed in this call. Defaults to all
|
|
37
|
+
* accounts if not specified.
|
|
38
|
+
* @returns A decoded ABI value containing the function's return data.
|
|
39
|
+
*/
|
|
40
|
+
runUtility(call: FunctionCall, authwits: AuthWitness[], scopes?: AztecAddress[]): Promise<AbiDecoded>;
|
|
41
|
+
getStats(): import("./execution_data_provider.js").ExecutionStats;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Generates the final public inputs of the tail kernel circuit, an empty Chonk proof
|
|
45
|
+
* and the execution steps for a `PrivateExecutionResult` as if it had been
|
|
46
|
+
* processed by the private kernel prover. This skips many of the checks performed by the kernels
|
|
47
|
+
* (allowing state overrides) and is much faster, while still generating a valid
|
|
48
|
+
* output that can be sent to the node for public simulation
|
|
49
|
+
* @param privateExecutionResult - The result of the private execution.
|
|
50
|
+
* @param nonceGenerator - A nonce generator for note hashes. According to the protocol rules,
|
|
51
|
+
* it can either be the first nullifier in the tx or the hash of the initial tx request if there are none.
|
|
52
|
+
* @param contractDataProvider - A provider for contract data in order to get function names and debug info.
|
|
53
|
+
* @returns The simulated proving result.
|
|
54
|
+
*/
|
|
55
|
+
export declare function generateSimulatedProvingResult(privateExecutionResult: PrivateExecutionResult, nonceGenerator: Fr, contractDataProvider: ContractDataProvider): Promise<PrivateKernelExecutionProofOutput<PrivateKernelTailCircuitPublicInputs>>;
|
|
56
|
+
//# sourceMappingURL=contract_function_simulator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract_function_simulator.d.ts","sourceRoot":"","sources":["../../src/contract_function_simulator/contract_function_simulator.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAK9C,OAAO,EACL,KAAK,gBAAgB,EAOtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAA+B,MAAM,mBAAmB,CAAC;AAClF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAG3D,OAAO,EAIL,KAAK,iCAAiC,EACtC,oCAAoC,EAKrC,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EAGL,sBAAsB,EAEtB,kBAAkB,EAGnB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAS1E;;GAEG;AACH,qBAAa,yBAAyB;IAIlC,OAAO,CAAC,qBAAqB;IAC7B,OAAO,CAAC,SAAS;IAJnB,OAAO,CAAC,GAAG,CAAS;gBAGV,qBAAqB,EAAE,qBAAqB,EAC5C,SAAS,EAAE,gBAAgB;IAKrC;;;;;;;;;;;OAWG;IACU,GAAG,CACd,OAAO,EAAE,kBAAkB,EAC3B,eAAe,EAAE,YAAY,EAC7B,QAAQ,EAAE,gBAAgB,EAC1B,SAAS,eAA6C,EACtD,aAAa,CAAC,EAAE,YAAY,EAC5B,MAAM,CAAC,EAAE,YAAY,EAAE,GACtB,OAAO,CAAC,sBAAsB,CAAC;IAmGlC;;;;;;;OAOG;IACU,UAAU,CAAC,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAE,MAAM,CAAC,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;IA0ClH,QAAQ;CAGT;AAYD;;;;;;;;;;;GAWG;AACH,wBAAsB,8BAA8B,CAClD,sBAAsB,EAAE,sBAAsB,EAC9C,cAAc,EAAE,EAAE,EAClB,oBAAoB,EAAE,oBAAoB,GACzC,OAAO,CAAC,iCAAiC,CAAC,oCAAoC,CAAC,CAAC,CAgNlF"}
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import { AVM_EMITNOTEHASH_BASE_L2_GAS, AVM_EMITNULLIFIER_BASE_L2_GAS, AVM_SENDL2TOL1MSG_BASE_L2_GAS, DA_BYTES_PER_FIELD, DA_GAS_PER_BYTE, FIXED_AVM_STARTUP_L2_GAS, FIXED_DA_GAS, FIXED_L2_GAS, L2_GAS_PER_CONTRACT_CLASS_LOG, L2_GAS_PER_PRIVATE_LOG, MAX_CONTRACT_CLASS_LOGS_PER_TX, MAX_ENQUEUED_CALLS_PER_TX, MAX_L2_TO_L1_MSGS_PER_TX, MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, MAX_PRIVATE_LOGS_PER_TX } from '@aztec/constants';
|
|
2
|
+
import { arrayNonEmptyLength, padArrayEnd } from '@aztec/foundation/collection';
|
|
3
|
+
import { poseidon2Hash } from '@aztec/foundation/crypto';
|
|
4
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
5
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
6
|
+
import { Timer } from '@aztec/foundation/timer';
|
|
7
|
+
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
8
|
+
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
9
|
+
import { ExecutionError, createSimulationError, extractCallStack, resolveAssertionMessageFromError, toACVMWitness, witnessMapToFields } from '@aztec/simulator/client';
|
|
10
|
+
import { FunctionSelector, FunctionType, decodeFromAbi } from '@aztec/stdlib/abi';
|
|
11
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
12
|
+
import { Gas } from '@aztec/stdlib/gas';
|
|
13
|
+
import { computeNoteHashNonce, computeUniqueNoteHash, siloNoteHash, siloNullifier } from '@aztec/stdlib/hash';
|
|
14
|
+
import { PartialPrivateTailPublicInputsForPublic, PartialPrivateTailPublicInputsForRollup, PrivateKernelTailCircuitPublicInputs, PrivateToPublicAccumulatedData, PrivateToRollupAccumulatedData, PublicCallRequest, ScopedLogHash } from '@aztec/stdlib/kernel';
|
|
15
|
+
import { PrivateLog } from '@aztec/stdlib/logs';
|
|
16
|
+
import { ScopedL2ToL1Message } from '@aztec/stdlib/messaging';
|
|
17
|
+
import { ChonkProof } from '@aztec/stdlib/proofs';
|
|
18
|
+
import { CallContext, HashedValues, PrivateExecutionResult, TxConstantData, collectNested, getFinalMinRevertibleSideEffectCounter } from '@aztec/stdlib/tx';
|
|
19
|
+
import { ExecutionNoteCache } from './execution_note_cache.js';
|
|
20
|
+
import { ExecutionTaggingIndexCache } from './execution_tagging_index_cache.js';
|
|
21
|
+
import { HashedValuesCache } from './hashed_values_cache.js';
|
|
22
|
+
import { Oracle } from './oracle/oracle.js';
|
|
23
|
+
import { executePrivateFunction, verifyCurrentClassId } from './oracle/private_execution.js';
|
|
24
|
+
import { PrivateExecutionOracle } from './oracle/private_execution_oracle.js';
|
|
25
|
+
import { UtilityExecutionOracle } from './oracle/utility_execution_oracle.js';
|
|
26
|
+
/**
|
|
27
|
+
* The contract function simulator.
|
|
28
|
+
*/ export class ContractFunctionSimulator {
|
|
29
|
+
executionDataProvider;
|
|
30
|
+
simulator;
|
|
31
|
+
log;
|
|
32
|
+
constructor(executionDataProvider, simulator){
|
|
33
|
+
this.executionDataProvider = executionDataProvider;
|
|
34
|
+
this.simulator = simulator;
|
|
35
|
+
this.log = createLogger('simulator');
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Runs a private function.
|
|
39
|
+
* @param request - The transaction request.
|
|
40
|
+
* @param entryPointArtifact - The artifact of the entry point function.
|
|
41
|
+
* @param contractAddress - The address of the contract (should match request.origin)
|
|
42
|
+
* @param msgSender - The address calling the function. This can be replaced to simulate a call from another contract
|
|
43
|
+
* or a specific account.
|
|
44
|
+
* @param senderForTags - The address that is used as a tagging sender when emitting private logs. Returned from
|
|
45
|
+
* the `privateGetSenderForTags` oracle.
|
|
46
|
+
* @param scopes - The accounts whose notes we can access in this call. Currently optional and will default to all.
|
|
47
|
+
* @returns The result of the execution.
|
|
48
|
+
*/ async run(request, contractAddress, selector, msgSender = AztecAddress.fromField(Fr.MAX_FIELD_VALUE), senderForTags, scopes) {
|
|
49
|
+
const simulatorSetupTimer = new Timer();
|
|
50
|
+
const anchorBlockHeader = await this.executionDataProvider.getAnchorBlockHeader();
|
|
51
|
+
await verifyCurrentClassId(contractAddress, this.executionDataProvider);
|
|
52
|
+
const entryPointArtifact = await this.executionDataProvider.getFunctionArtifact(contractAddress, selector);
|
|
53
|
+
if (entryPointArtifact.functionType !== FunctionType.PRIVATE) {
|
|
54
|
+
throw new Error(`Cannot run ${entryPointArtifact.functionType} function as private`);
|
|
55
|
+
}
|
|
56
|
+
if (request.origin !== contractAddress) {
|
|
57
|
+
this.log.warn(`Request origin does not match contract address in simulation. Request origin: ${request.origin}, contract address: ${contractAddress}`);
|
|
58
|
+
}
|
|
59
|
+
// reserve the first side effect for the tx hash (inserted by the private kernel)
|
|
60
|
+
const startSideEffectCounter = 1;
|
|
61
|
+
const callContext = new CallContext(msgSender, contractAddress, await FunctionSelector.fromNameAndParameters(entryPointArtifact.name, entryPointArtifact.parameters), entryPointArtifact.isStatic);
|
|
62
|
+
const txRequestHash = await request.toTxRequest().hash();
|
|
63
|
+
const noteCache = new ExecutionNoteCache(txRequestHash);
|
|
64
|
+
const taggingIndexCache = new ExecutionTaggingIndexCache();
|
|
65
|
+
const privateExecutionOracle = new PrivateExecutionOracle(request.firstCallArgsHash, request.txContext, callContext, anchorBlockHeader, request.authWitnesses, request.capsules, HashedValuesCache.create(request.argsOfCalls), noteCache, taggingIndexCache, this.executionDataProvider, 0, startSideEffectCounter, undefined, scopes, senderForTags, this.simulator);
|
|
66
|
+
const setupTime = simulatorSetupTimer.ms();
|
|
67
|
+
try {
|
|
68
|
+
// Note: any nested private function calls are made recursively within this
|
|
69
|
+
// function call. So this execution result is the result of executing _all_
|
|
70
|
+
// private functions of this tx (the results of those executions are contained
|
|
71
|
+
// within executionResult.nestedExecutionResults).
|
|
72
|
+
const executionResult = await executePrivateFunction(this.simulator, privateExecutionOracle, entryPointArtifact, contractAddress, request.functionSelector);
|
|
73
|
+
const simulatorTeardownTimer = new Timer();
|
|
74
|
+
const { usedTxRequestHashForNonces } = noteCache.finish();
|
|
75
|
+
const firstNullifierHint = usedTxRequestHashForNonces ? Fr.ZERO : noteCache.getAllNullifiers()[0];
|
|
76
|
+
const publicCallRequests = collectNested([
|
|
77
|
+
executionResult
|
|
78
|
+
], (r)=>r.publicInputs.publicCallRequests.getActiveItems().map((r)=>r.inner).concat(r.publicInputs.publicTeardownCallRequest.isEmpty() ? [] : [
|
|
79
|
+
r.publicInputs.publicTeardownCallRequest
|
|
80
|
+
]));
|
|
81
|
+
const publicFunctionsCalldata = await Promise.all(publicCallRequests.map(async (r)=>{
|
|
82
|
+
const calldata = await privateExecutionOracle.privateLoadFromExecutionCache(r.calldataHash);
|
|
83
|
+
return new HashedValues(calldata, r.calldataHash);
|
|
84
|
+
}));
|
|
85
|
+
const teardownTime = simulatorTeardownTimer.ms();
|
|
86
|
+
// Add simulator overhead to topmost call in the stack
|
|
87
|
+
if (executionResult.profileResult) {
|
|
88
|
+
executionResult.profileResult.timings.witgen += setupTime + teardownTime;
|
|
89
|
+
}
|
|
90
|
+
// Not to be confused with a PrivateCallExecutionResult. This is a superset
|
|
91
|
+
// of the PrivateCallExecutionResult, containing also firstNullifierHint
|
|
92
|
+
// and publicFunctionsCalldata.
|
|
93
|
+
return new PrivateExecutionResult(executionResult, firstNullifierHint, publicFunctionsCalldata);
|
|
94
|
+
} catch (err) {
|
|
95
|
+
throw createSimulationError(err instanceof Error ? err : new Error('Unknown error during private execution'));
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
// docs:start:execute_utility_function
|
|
99
|
+
/**
|
|
100
|
+
* Runs a utility function.
|
|
101
|
+
* @param call - The function call to execute.
|
|
102
|
+
* @param authwits - Authentication witnesses required for the function call.
|
|
103
|
+
* @param scopes - Optional array of account addresses whose notes can be accessed in this call. Defaults to all
|
|
104
|
+
* accounts if not specified.
|
|
105
|
+
* @returns A decoded ABI value containing the function's return data.
|
|
106
|
+
*/ async runUtility(call, authwits, scopes) {
|
|
107
|
+
await verifyCurrentClassId(call.to, this.executionDataProvider);
|
|
108
|
+
const entryPointArtifact = await this.executionDataProvider.getFunctionArtifact(call.to, call.selector);
|
|
109
|
+
if (entryPointArtifact.functionType !== FunctionType.UTILITY) {
|
|
110
|
+
throw new Error(`Cannot run ${entryPointArtifact.functionType} function as utility`);
|
|
111
|
+
}
|
|
112
|
+
const oracle = new UtilityExecutionOracle(call.to, authwits, [], this.executionDataProvider, undefined, scopes);
|
|
113
|
+
try {
|
|
114
|
+
this.log.verbose(`Executing utility function ${entryPointArtifact.name}`, {
|
|
115
|
+
contract: call.to,
|
|
116
|
+
selector: call.selector
|
|
117
|
+
});
|
|
118
|
+
const initialWitness = toACVMWitness(0, call.args);
|
|
119
|
+
const acirExecutionResult = await this.simulator.executeUserCircuit(initialWitness, entryPointArtifact, new Oracle(oracle).toACIRCallback()).catch((err)=>{
|
|
120
|
+
err.message = resolveAssertionMessageFromError(err, entryPointArtifact);
|
|
121
|
+
throw new ExecutionError(err.message, {
|
|
122
|
+
contractAddress: call.to,
|
|
123
|
+
functionSelector: call.selector
|
|
124
|
+
}, extractCallStack(err, entryPointArtifact.debug), {
|
|
125
|
+
cause: err
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
const returnWitness = witnessMapToFields(acirExecutionResult.returnWitness);
|
|
129
|
+
this.log.verbose(`Utility simulation for ${call.to}.${call.selector} completed`);
|
|
130
|
+
return decodeFromAbi(entryPointArtifact.returnTypes, returnWitness);
|
|
131
|
+
} catch (err) {
|
|
132
|
+
throw createSimulationError(err instanceof Error ? err : new Error('Unknown error during private execution'));
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
// docs:end:execute_utility_function
|
|
136
|
+
getStats() {
|
|
137
|
+
return this.executionDataProvider.getStats();
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
class OrderedSideEffect {
|
|
141
|
+
sideEffect;
|
|
142
|
+
counter;
|
|
143
|
+
constructor(sideEffect, counter){
|
|
144
|
+
this.sideEffect = sideEffect;
|
|
145
|
+
this.counter = counter;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Generates the final public inputs of the tail kernel circuit, an empty Chonk proof
|
|
150
|
+
* and the execution steps for a `PrivateExecutionResult` as if it had been
|
|
151
|
+
* processed by the private kernel prover. This skips many of the checks performed by the kernels
|
|
152
|
+
* (allowing state overrides) and is much faster, while still generating a valid
|
|
153
|
+
* output that can be sent to the node for public simulation
|
|
154
|
+
* @param privateExecutionResult - The result of the private execution.
|
|
155
|
+
* @param nonceGenerator - A nonce generator for note hashes. According to the protocol rules,
|
|
156
|
+
* it can either be the first nullifier in the tx or the hash of the initial tx request if there are none.
|
|
157
|
+
* @param contractDataProvider - A provider for contract data in order to get function names and debug info.
|
|
158
|
+
* @returns The simulated proving result.
|
|
159
|
+
*/ export async function generateSimulatedProvingResult(privateExecutionResult, nonceGenerator, contractDataProvider) {
|
|
160
|
+
const siloedNoteHashes = [];
|
|
161
|
+
const nullifiers = [];
|
|
162
|
+
const taggedPrivateLogs = [];
|
|
163
|
+
const l2ToL1Messages = [];
|
|
164
|
+
const contractClassLogsHashes = [];
|
|
165
|
+
const publicCallRequests = [];
|
|
166
|
+
const executionSteps = [];
|
|
167
|
+
let publicTeardownCallRequest;
|
|
168
|
+
const executions = [
|
|
169
|
+
privateExecutionResult.entrypoint
|
|
170
|
+
];
|
|
171
|
+
while(executions.length !== 0){
|
|
172
|
+
const execution = executions.shift();
|
|
173
|
+
executions.unshift(...execution.nestedExecutionResults);
|
|
174
|
+
const { contractAddress } = execution.publicInputs.callContext;
|
|
175
|
+
const noteHashesFromExecution = await Promise.all(execution.publicInputs.noteHashes.getActiveItems().filter((noteHash)=>!noteHash.isEmpty()).map(async (noteHash)=>new OrderedSideEffect(await siloNoteHash(contractAddress, noteHash.value), noteHash.counter)));
|
|
176
|
+
const nullifiersFromExecution = await Promise.all(execution.publicInputs.nullifiers.getActiveItems().map(async (nullifier)=>new OrderedSideEffect(await siloNullifier(contractAddress, nullifier.value), nullifier.counter)));
|
|
177
|
+
const privateLogsFromExecution = await Promise.all(execution.publicInputs.privateLogs.getActiveItems().map(async (metadata)=>{
|
|
178
|
+
metadata.log.fields[0] = await poseidon2Hash([
|
|
179
|
+
contractAddress,
|
|
180
|
+
metadata.log.fields[0]
|
|
181
|
+
]);
|
|
182
|
+
return new OrderedSideEffect(metadata.log, metadata.counter);
|
|
183
|
+
}));
|
|
184
|
+
siloedNoteHashes.push(...noteHashesFromExecution);
|
|
185
|
+
taggedPrivateLogs.push(...privateLogsFromExecution);
|
|
186
|
+
nullifiers.push(...nullifiersFromExecution);
|
|
187
|
+
l2ToL1Messages.push(...execution.publicInputs.l2ToL1Msgs.getActiveItems().map((message)=>new OrderedSideEffect(message.message.scope(contractAddress), message.counter)));
|
|
188
|
+
contractClassLogsHashes.push(...execution.publicInputs.contractClassLogsHashes.getActiveItems().map((contractClassLogHash)=>new OrderedSideEffect(contractClassLogHash.logHash.scope(contractAddress), contractClassLogHash.counter)));
|
|
189
|
+
publicCallRequests.push(...execution.publicInputs.publicCallRequests.getActiveItems().map((callRequest)=>new OrderedSideEffect(callRequest.inner, callRequest.counter)));
|
|
190
|
+
if (publicTeardownCallRequest !== undefined && !execution.publicInputs.publicTeardownCallRequest.isEmpty()) {
|
|
191
|
+
throw new Error('Trying to set multiple teardown requests');
|
|
192
|
+
}
|
|
193
|
+
publicTeardownCallRequest = execution.publicInputs.publicTeardownCallRequest.isEmpty() ? publicTeardownCallRequest : execution.publicInputs.publicTeardownCallRequest;
|
|
194
|
+
executionSteps.push({
|
|
195
|
+
functionName: await contractDataProvider.getDebugFunctionName(execution.publicInputs.callContext.contractAddress, execution.publicInputs.callContext.functionSelector),
|
|
196
|
+
timings: execution.profileResult?.timings ?? {
|
|
197
|
+
witgen: 0,
|
|
198
|
+
oracles: {}
|
|
199
|
+
},
|
|
200
|
+
bytecode: execution.acir,
|
|
201
|
+
vk: execution.vk,
|
|
202
|
+
witness: execution.partialWitness
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
const constantData = new TxConstantData(privateExecutionResult.entrypoint.publicInputs.anchorBlockHeader, privateExecutionResult.entrypoint.publicInputs.txContext, getVKTreeRoot(), protocolContractsHash);
|
|
206
|
+
const hasPublicCalls = privateExecutionResult.publicFunctionCalldata.length !== 0;
|
|
207
|
+
let inputsForRollup;
|
|
208
|
+
let inputsForPublic;
|
|
209
|
+
let gasUsed;
|
|
210
|
+
const sortByCounter = (a, b)=>a.counter - b.counter;
|
|
211
|
+
const getEffect = (orderedSideEffect)=>orderedSideEffect.sideEffect;
|
|
212
|
+
const isPrivateOnlyTx = privateExecutionResult.publicFunctionCalldata.length === 0;
|
|
213
|
+
const minRevertibleSideEffectCounter = getFinalMinRevertibleSideEffectCounter(privateExecutionResult);
|
|
214
|
+
const [nonRevertibleNullifiers, revertibleNullifiers] = splitOrderedSideEffects(nullifiers.sort(sortByCounter), minRevertibleSideEffectCounter);
|
|
215
|
+
if (nonRevertibleNullifiers.length > 0 && !nonRevertibleNullifiers[0].equals(nonceGenerator)) {
|
|
216
|
+
throw new Error('The first non revertible nullifier should be equal to the nonce generator. This is a bug!');
|
|
217
|
+
} else {
|
|
218
|
+
nonRevertibleNullifiers.unshift(nonceGenerator);
|
|
219
|
+
}
|
|
220
|
+
if (isPrivateOnlyTx) {
|
|
221
|
+
// We must make the note hashes unique by using the
|
|
222
|
+
// nonce generator and their index in the tx.
|
|
223
|
+
const uniqueNoteHashes = await Promise.all(siloedNoteHashes.sort(sortByCounter).map(async (orderedSideEffect, i)=>{
|
|
224
|
+
const siloedNoteHash = orderedSideEffect.sideEffect;
|
|
225
|
+
const nonce = await computeNoteHashNonce(nonceGenerator, i);
|
|
226
|
+
const uniqueNoteHash = await computeUniqueNoteHash(nonce, siloedNoteHash);
|
|
227
|
+
return uniqueNoteHash;
|
|
228
|
+
}));
|
|
229
|
+
const accumulatedDataForRollup = new PrivateToRollupAccumulatedData(padArrayEnd(uniqueNoteHashes, Fr.ZERO, MAX_NOTE_HASHES_PER_TX), padArrayEnd(nonRevertibleNullifiers.concat(revertibleNullifiers), Fr.ZERO, MAX_NULLIFIERS_PER_TX), padArrayEnd(l2ToL1Messages.sort(sortByCounter).map(getEffect), ScopedL2ToL1Message.empty(), MAX_L2_TO_L1_MSGS_PER_TX), padArrayEnd(taggedPrivateLogs.sort(sortByCounter).map(getEffect), PrivateLog.empty(), MAX_PRIVATE_LOGS_PER_TX), padArrayEnd(contractClassLogsHashes.sort(sortByCounter).map(getEffect), ScopedLogHash.empty(), MAX_CONTRACT_CLASS_LOGS_PER_TX));
|
|
230
|
+
gasUsed = meterGasUsed(accumulatedDataForRollup);
|
|
231
|
+
inputsForRollup = new PartialPrivateTailPublicInputsForRollup(accumulatedDataForRollup);
|
|
232
|
+
} else {
|
|
233
|
+
const [nonRevertibleNoteHashes, revertibleNoteHashes] = splitOrderedSideEffects(siloedNoteHashes.sort(sortByCounter), minRevertibleSideEffectCounter);
|
|
234
|
+
const [nonRevertibleL2ToL1Messages, revertibleL2ToL1Messages] = splitOrderedSideEffects(l2ToL1Messages.sort(sortByCounter), minRevertibleSideEffectCounter);
|
|
235
|
+
const [nonRevertibleTaggedPrivateLogs, revertibleTaggedPrivateLogs] = splitOrderedSideEffects(taggedPrivateLogs, minRevertibleSideEffectCounter);
|
|
236
|
+
const [nonRevertibleContractClassLogHashes, revertibleContractClassLogHashes] = splitOrderedSideEffects(contractClassLogsHashes.sort(sortByCounter), minRevertibleSideEffectCounter);
|
|
237
|
+
const [nonRevertiblePublicCallRequests, revertiblePublicCallRequests] = splitOrderedSideEffects(publicCallRequests.sort(sortByCounter), minRevertibleSideEffectCounter);
|
|
238
|
+
const nonRevertibleData = new PrivateToPublicAccumulatedData(padArrayEnd(nonRevertibleNoteHashes, Fr.ZERO, MAX_NOTE_HASHES_PER_TX), padArrayEnd(nonRevertibleNullifiers, Fr.ZERO, MAX_NULLIFIERS_PER_TX), padArrayEnd(nonRevertibleL2ToL1Messages, ScopedL2ToL1Message.empty(), MAX_L2_TO_L1_MSGS_PER_TX), padArrayEnd(nonRevertibleTaggedPrivateLogs, PrivateLog.empty(), MAX_PRIVATE_LOGS_PER_TX), padArrayEnd(nonRevertibleContractClassLogHashes, ScopedLogHash.empty(), MAX_CONTRACT_CLASS_LOGS_PER_TX), padArrayEnd(nonRevertiblePublicCallRequests, PublicCallRequest.empty(), MAX_ENQUEUED_CALLS_PER_TX));
|
|
239
|
+
const revertibleData = new PrivateToPublicAccumulatedData(padArrayEnd(revertibleNoteHashes, Fr.ZERO, MAX_NOTE_HASHES_PER_TX), padArrayEnd(revertibleNullifiers, Fr.ZERO, MAX_NULLIFIERS_PER_TX), padArrayEnd(revertibleL2ToL1Messages, ScopedL2ToL1Message.empty(), MAX_L2_TO_L1_MSGS_PER_TX), padArrayEnd(revertibleTaggedPrivateLogs, PrivateLog.empty(), MAX_PRIVATE_LOGS_PER_TX), padArrayEnd(revertibleContractClassLogHashes, ScopedLogHash.empty(), MAX_CONTRACT_CLASS_LOGS_PER_TX), padArrayEnd(revertiblePublicCallRequests, PublicCallRequest.empty(), MAX_ENQUEUED_CALLS_PER_TX));
|
|
240
|
+
gasUsed = meterGasUsed(revertibleData).add(meterGasUsed(nonRevertibleData));
|
|
241
|
+
if (publicTeardownCallRequest) {
|
|
242
|
+
gasUsed.add(privateExecutionResult.entrypoint.publicInputs.txContext.gasSettings.teardownGasLimits);
|
|
243
|
+
}
|
|
244
|
+
inputsForPublic = new PartialPrivateTailPublicInputsForPublic(nonRevertibleData, revertibleData, publicTeardownCallRequest ?? PublicCallRequest.empty());
|
|
245
|
+
}
|
|
246
|
+
const publicInputs = new PrivateKernelTailCircuitPublicInputs(constantData, /*gasUsed=*/ gasUsed.add(Gas.from({
|
|
247
|
+
l2Gas: FIXED_L2_GAS,
|
|
248
|
+
daGas: FIXED_DA_GAS
|
|
249
|
+
})), /*feePayer=*/ AztecAddress.zero(), /*includeByTimestamp=*/ 0n, hasPublicCalls ? inputsForPublic : undefined, !hasPublicCalls ? inputsForRollup : undefined);
|
|
250
|
+
return {
|
|
251
|
+
publicInputs,
|
|
252
|
+
chonkProof: ChonkProof.empty(),
|
|
253
|
+
executionSteps
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
function splitOrderedSideEffects(effects, minRevertibleSideEffectCounter) {
|
|
257
|
+
const revertibleSideEffects = [];
|
|
258
|
+
const nonRevertibleSideEffects = [];
|
|
259
|
+
effects.forEach((effect)=>{
|
|
260
|
+
if (effect.counter < minRevertibleSideEffectCounter) {
|
|
261
|
+
nonRevertibleSideEffects.push(effect.sideEffect);
|
|
262
|
+
} else {
|
|
263
|
+
revertibleSideEffects.push(effect.sideEffect);
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
return [
|
|
267
|
+
nonRevertibleSideEffects,
|
|
268
|
+
revertibleSideEffects
|
|
269
|
+
];
|
|
270
|
+
}
|
|
271
|
+
function meterGasUsed(data) {
|
|
272
|
+
let meteredDAFields = 0;
|
|
273
|
+
let meteredL2Gas = 0;
|
|
274
|
+
const numNoteHashes = arrayNonEmptyLength(data.noteHashes, (hash)=>hash.isEmpty());
|
|
275
|
+
meteredDAFields += numNoteHashes;
|
|
276
|
+
meteredL2Gas += numNoteHashes * AVM_EMITNOTEHASH_BASE_L2_GAS;
|
|
277
|
+
const numNullifiers = arrayNonEmptyLength(data.nullifiers, (nullifier)=>nullifier.isEmpty());
|
|
278
|
+
meteredDAFields += numNullifiers;
|
|
279
|
+
meteredL2Gas += numNullifiers * AVM_EMITNULLIFIER_BASE_L2_GAS;
|
|
280
|
+
const numL2toL1Messages = arrayNonEmptyLength(data.l2ToL1Msgs, (msg)=>msg.isEmpty());
|
|
281
|
+
meteredDAFields += numL2toL1Messages;
|
|
282
|
+
meteredL2Gas += numL2toL1Messages * AVM_SENDL2TOL1MSG_BASE_L2_GAS;
|
|
283
|
+
const numPrivatelogs = arrayNonEmptyLength(data.privateLogs, (log)=>log.isEmpty());
|
|
284
|
+
// Every private log emits its length as an additional field
|
|
285
|
+
meteredDAFields += data.privateLogs.reduce((acc, log)=>!log.isEmpty() ? acc + log.emittedLength + 1 : acc, 0);
|
|
286
|
+
meteredL2Gas += numPrivatelogs * L2_GAS_PER_PRIVATE_LOG;
|
|
287
|
+
const numContractClassLogs = arrayNonEmptyLength(data.contractClassLogsHashes, (log)=>log.isEmpty());
|
|
288
|
+
// Every contract class log emits its length and contract address as additional fields
|
|
289
|
+
meteredDAFields += data.contractClassLogsHashes.reduce((acc, log)=>!log.isEmpty() ? acc + log.logHash.length + 2 : acc, 0);
|
|
290
|
+
meteredL2Gas += numContractClassLogs * L2_GAS_PER_CONTRACT_CLASS_LOG;
|
|
291
|
+
const meteredDAGas = meteredDAFields * DA_BYTES_PER_FIELD * DA_GAS_PER_BYTE;
|
|
292
|
+
if (data.publicCallRequests) {
|
|
293
|
+
const dataForPublic = data;
|
|
294
|
+
const numPublicCallRequests = arrayNonEmptyLength(dataForPublic.publicCallRequests, (req)=>req.isEmpty());
|
|
295
|
+
meteredL2Gas += numPublicCallRequests * FIXED_AVM_STARTUP_L2_GAS;
|
|
296
|
+
}
|
|
297
|
+
return Gas.from({
|
|
298
|
+
l2Gas: meteredL2Gas,
|
|
299
|
+
daGas: meteredDAGas
|
|
300
|
+
});
|
|
301
|
+
}
|