@aztec/simulator 0.0.1-fake-ceab37513c → 0.0.6-commit.a2d1860fe9
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 +6 -4
- package/dest/client.d.ts +1 -1
- package/dest/common/errors.d.ts +2 -2
- package/dest/common/errors.d.ts.map +1 -1
- package/dest/common/index.d.ts +1 -1
- package/dest/common/stats/index.d.ts +1 -1
- package/dest/common/stats/stats.d.ts +1 -1
- package/dest/private/acvm/acvm.d.ts +4 -2
- package/dest/private/acvm/acvm.d.ts.map +1 -1
- package/dest/private/acvm/acvm.js +4 -3
- package/dest/private/acvm/acvm_types.d.ts +1 -1
- package/dest/private/acvm/deserialize.d.ts +2 -2
- package/dest/private/acvm/deserialize.d.ts.map +1 -1
- package/dest/private/acvm/deserialize.js +1 -1
- package/dest/private/acvm/index.d.ts +1 -1
- package/dest/private/acvm/serialize.d.ts +2 -2
- package/dest/private/acvm/serialize.d.ts.map +1 -1
- package/dest/private/acvm/serialize.js +1 -1
- package/dest/private/acvm_native.d.ts +6 -5
- package/dest/private/acvm_native.d.ts.map +1 -1
- package/dest/private/acvm_native.js +23 -19
- package/dest/private/acvm_wasm.d.ts +4 -3
- package/dest/private/acvm_wasm.d.ts.map +1 -1
- package/dest/private/acvm_wasm.js +4 -4
- package/dest/private/acvm_wasm_with_blobs.d.ts +1 -1
- package/dest/private/acvm_wasm_with_blobs.d.ts.map +1 -1
- package/dest/private/circuit_recording/circuit_recorder.d.ts +4 -3
- package/dest/private/circuit_recording/circuit_recorder.d.ts.map +1 -1
- package/dest/private/circuit_recording/circuit_recorder.js +21 -18
- package/dest/private/circuit_recording/file_circuit_recorder.d.ts +3 -2
- package/dest/private/circuit_recording/file_circuit_recorder.d.ts.map +1 -1
- package/dest/private/circuit_recording/file_circuit_recorder.js +2 -2
- package/dest/private/circuit_recording/memory_circuit_recorder.d.ts +7 -2
- package/dest/private/circuit_recording/memory_circuit_recorder.d.ts.map +1 -1
- package/dest/private/circuit_recording/memory_circuit_recorder.js +4 -4
- package/dest/private/circuit_recording/simulator_recorder_wrapper.d.ts +2 -2
- package/dest/private/circuit_recording/simulator_recorder_wrapper.d.ts.map +1 -1
- package/dest/private/circuit_simulator.d.ts +1 -1
- package/dest/private/factory.d.ts +3 -3
- package/dest/private/factory.d.ts.map +1 -1
- package/dest/private/factory.js +7 -4
- package/dest/public/avm/avm_context.d.ts +3 -3
- package/dest/public/avm/avm_context.d.ts.map +1 -1
- package/dest/public/avm/avm_contract_call_result.d.ts +6 -6
- package/dest/public/avm/avm_contract_call_result.d.ts.map +1 -1
- package/dest/public/avm/avm_contract_call_result.js +3 -3
- package/dest/public/avm/avm_execution_environment.d.ts +9 -7
- package/dest/public/avm/avm_execution_environment.d.ts.map +1 -1
- package/dest/public/avm/avm_execution_environment.js +5 -5
- package/dest/public/avm/avm_gas.d.ts +2 -2
- package/dest/public/avm/avm_gas.d.ts.map +1 -1
- package/dest/public/avm/avm_gas.js +3 -3
- package/dest/public/avm/avm_machine_state.d.ts +7 -6
- package/dest/public/avm/avm_machine_state.d.ts.map +1 -1
- package/dest/public/avm/avm_machine_state.js +3 -2
- package/dest/public/avm/avm_memory_types.d.ts +14 -14
- package/dest/public/avm/avm_memory_types.d.ts.map +1 -1
- package/dest/public/avm/avm_memory_types.js +4 -1
- package/dest/public/avm/avm_simulator.d.ts +5 -3
- package/dest/public/avm/avm_simulator.d.ts.map +1 -1
- package/dest/public/avm/avm_simulator.js +24 -29
- package/dest/public/avm/avm_simulator_interface.d.ts +1 -1
- package/dest/public/avm/calldata.d.ts +51 -0
- package/dest/public/avm/calldata.d.ts.map +1 -0
- package/dest/public/avm/calldata.js +63 -0
- package/dest/public/avm/errors.d.ts +13 -16
- package/dest/public/avm/errors.d.ts.map +1 -1
- package/dest/public/avm/errors.js +21 -22
- package/dest/public/avm/fixtures/account_proof_fetcher.d.ts +2 -0
- package/dest/public/avm/fixtures/account_proof_fetcher.d.ts.map +1 -0
- package/dest/public/avm/fixtures/account_proof_fetcher.js +152 -0
- package/dest/public/avm/fixtures/avm_simulation_tester.d.ts +3 -2
- package/dest/public/avm/fixtures/avm_simulation_tester.d.ts.map +1 -1
- package/dest/public/avm/fixtures/avm_simulation_tester.js +17 -8
- package/dest/public/avm/fixtures/base_avm_simulation_tester.d.ts +4 -2
- package/dest/public/avm/fixtures/base_avm_simulation_tester.d.ts.map +1 -1
- package/dest/public/avm/fixtures/base_avm_simulation_tester.js +23 -1
- package/dest/public/avm/fixtures/initializers.d.ts +2 -3
- package/dest/public/avm/fixtures/initializers.d.ts.map +1 -1
- package/dest/public/avm/fixtures/initializers.js +7 -4
- package/dest/public/avm/fixtures/utils.d.ts +4 -3
- package/dest/public/avm/fixtures/utils.d.ts.map +1 -1
- package/dest/public/avm/fixtures/utils.js +3 -2
- package/dest/public/avm/index.d.ts +1 -1
- package/dest/public/avm/opcodes/accrued_substate.d.ts +18 -19
- package/dest/public/avm/opcodes/accrued_substate.d.ts.map +1 -1
- package/dest/public/avm/opcodes/accrued_substate.js +47 -48
- package/dest/public/avm/opcodes/addressing_mode.d.ts +1 -1
- package/dest/public/avm/opcodes/addressing_mode.d.ts.map +1 -1
- package/dest/public/avm/opcodes/addressing_mode.js +4 -5
- package/dest/public/avm/opcodes/arithmetic.d.ts +3 -1
- package/dest/public/avm/opcodes/arithmetic.d.ts.map +1 -1
- package/dest/public/avm/opcodes/arithmetic.js +12 -2
- package/dest/public/avm/opcodes/bitwise.d.ts +3 -3
- package/dest/public/avm/opcodes/bitwise.d.ts.map +1 -1
- package/dest/public/avm/opcodes/bitwise.js +5 -5
- package/dest/public/avm/opcodes/comparators.d.ts +1 -1
- package/dest/public/avm/opcodes/comparators.d.ts.map +1 -1
- package/dest/public/avm/opcodes/comparators.js +1 -1
- package/dest/public/avm/opcodes/contract.d.ts +3 -3
- package/dest/public/avm/opcodes/contract.d.ts.map +1 -1
- package/dest/public/avm/opcodes/contract.js +8 -8
- package/dest/public/avm/opcodes/control_flow.d.ts +3 -3
- package/dest/public/avm/opcodes/control_flow.d.ts.map +1 -1
- package/dest/public/avm/opcodes/control_flow.js +4 -4
- package/dest/public/avm/opcodes/conversion.d.ts +3 -3
- package/dest/public/avm/opcodes/conversion.d.ts.map +1 -1
- package/dest/public/avm/opcodes/conversion.js +7 -4
- package/dest/public/avm/opcodes/ec_add.d.ts +3 -3
- package/dest/public/avm/opcodes/ec_add.d.ts.map +1 -1
- package/dest/public/avm/opcodes/ec_add.js +20 -11
- package/dest/public/avm/opcodes/environment_getters.d.ts +5 -5
- package/dest/public/avm/opcodes/environment_getters.d.ts.map +1 -1
- package/dest/public/avm/opcodes/environment_getters.js +11 -13
- package/dest/public/avm/opcodes/external_calls.d.ts +9 -9
- package/dest/public/avm/opcodes/external_calls.d.ts.map +1 -1
- package/dest/public/avm/opcodes/external_calls.js +23 -23
- package/dest/public/avm/opcodes/hashing.d.ts +7 -7
- package/dest/public/avm/opcodes/hashing.d.ts.map +1 -1
- package/dest/public/avm/opcodes/hashing.js +21 -16
- package/dest/public/avm/opcodes/index.d.ts +1 -1
- package/dest/public/avm/opcodes/instruction.d.ts +2 -2
- package/dest/public/avm/opcodes/instruction.d.ts.map +1 -1
- package/dest/public/avm/opcodes/instruction.js +5 -6
- package/dest/public/avm/opcodes/instruction_impl.d.ts +4 -4
- package/dest/public/avm/opcodes/instruction_impl.d.ts.map +1 -1
- package/dest/public/avm/opcodes/instruction_impl.js +4 -4
- package/dest/public/avm/opcodes/memory.d.ts +13 -13
- package/dest/public/avm/opcodes/memory.d.ts.map +1 -1
- package/dest/public/avm/opcodes/memory.js +26 -26
- package/dest/public/avm/opcodes/misc.d.ts +4 -3
- package/dest/public/avm/opcodes/misc.d.ts.map +1 -1
- package/dest/public/avm/opcodes/misc.js +30 -10
- package/dest/public/avm/opcodes/storage.d.ts +14 -13
- package/dest/public/avm/opcodes/storage.d.ts.map +1 -1
- package/dest/public/avm/opcodes/storage.js +34 -24
- package/dest/public/avm/revert_reason.d.ts +2 -2
- package/dest/public/avm/revert_reason.d.ts.map +1 -1
- package/dest/public/avm/revert_reason.js +3 -2
- package/dest/public/avm/serialization/buffer_cursor.d.ts +1 -1
- package/dest/public/avm/serialization/buffer_cursor.d.ts.map +1 -1
- package/dest/public/avm/serialization/bytecode_serialization.d.ts +1 -1
- package/dest/public/avm/serialization/bytecode_serialization.d.ts.map +1 -1
- package/dest/public/avm/serialization/bytecode_serialization.js +12 -9
- package/dest/public/avm/serialization/instruction_serialization.d.ts +10 -2
- package/dest/public/avm/serialization/instruction_serialization.d.ts.map +1 -1
- package/dest/public/avm/serialization/instruction_serialization.js +12 -2
- package/dest/public/avm/test_utils.d.ts +4 -4
- package/dest/public/avm/test_utils.d.ts.map +1 -1
- package/dest/public/avm/test_utils.js +7 -10
- package/dest/public/contracts_db_checkpoint.d.ts +16 -0
- package/dest/public/contracts_db_checkpoint.d.ts.map +1 -0
- package/dest/public/contracts_db_checkpoint.js +30 -0
- package/dest/public/db_interfaces.d.ts +14 -2
- package/dest/public/db_interfaces.d.ts.map +1 -1
- package/dest/public/debug_fn_name.d.ts +16 -3
- package/dest/public/debug_fn_name.d.ts.map +1 -1
- package/dest/public/debug_fn_name.js +31 -3
- package/dest/public/executor_metrics.d.ts +3 -2
- package/dest/public/executor_metrics.d.ts.map +1 -1
- package/dest/public/executor_metrics.js +13 -34
- package/dest/public/executor_metrics_interface.d.ts +3 -2
- package/dest/public/executor_metrics_interface.d.ts.map +1 -1
- package/dest/public/fixtures/amm_test.d.ts +1 -1
- package/dest/public/fixtures/amm_test.js +4 -4
- package/dest/public/fixtures/bulk_test.d.ts +3 -3
- package/dest/public/fixtures/bulk_test.d.ts.map +1 -1
- package/dest/public/fixtures/bulk_test.js +63 -194
- package/dest/public/fixtures/custom_bytecode_tester.d.ts +34 -0
- package/dest/public/fixtures/custom_bytecode_tester.d.ts.map +1 -0
- package/dest/public/fixtures/custom_bytecode_tester.js +53 -0
- package/dest/public/fixtures/custom_bytecode_tests.d.ts +12 -0
- package/dest/public/fixtures/custom_bytecode_tests.d.ts.map +1 -0
- package/dest/public/fixtures/custom_bytecode_tests.js +174 -0
- package/dest/public/fixtures/index.d.ts +5 -2
- package/dest/public/fixtures/index.d.ts.map +1 -1
- package/dest/public/fixtures/index.js +4 -1
- package/dest/public/fixtures/minimal_public_tx.d.ts +4 -9
- package/dest/public/fixtures/minimal_public_tx.d.ts.map +1 -1
- package/dest/public/fixtures/minimal_public_tx.js +10 -34
- package/dest/public/fixtures/opcode_spammer.d.ts +122 -0
- package/dest/public/fixtures/opcode_spammer.d.ts.map +1 -0
- package/dest/public/fixtures/opcode_spammer.js +1653 -0
- package/dest/public/fixtures/public_tx_simulation_tester.d.ts +25 -5
- package/dest/public/fixtures/public_tx_simulation_tester.d.ts.map +1 -1
- package/dest/public/fixtures/public_tx_simulation_tester.js +63 -17
- package/dest/public/fixtures/simple_contract_data_source.d.ts +5 -4
- package/dest/public/fixtures/simple_contract_data_source.d.ts.map +1 -1
- package/dest/public/fixtures/simple_contract_data_source.js +4 -4
- package/dest/public/fixtures/token_test.d.ts +6 -2
- package/dest/public/fixtures/token_test.d.ts.map +1 -1
- package/dest/public/fixtures/token_test.js +13 -12
- package/dest/public/fixtures/utils.d.ts +2 -2
- package/dest/public/fixtures/utils.d.ts.map +1 -1
- package/dest/public/fixtures/utils.js +11 -10
- package/dest/public/fuzzing/avm_fuzzer_simulator.d.ts +60 -0
- package/dest/public/fuzzing/avm_fuzzer_simulator.d.ts.map +1 -0
- package/dest/public/fuzzing/avm_fuzzer_simulator.js +171 -0
- package/dest/public/fuzzing/avm_simulator_bin.d.ts +2 -0
- package/dest/public/fuzzing/avm_simulator_bin.d.ts.map +1 -0
- package/dest/public/fuzzing/avm_simulator_bin.js +118 -0
- package/dest/public/hinting_db_sources.d.ts +16 -4
- package/dest/public/hinting_db_sources.d.ts.map +1 -1
- package/dest/public/hinting_db_sources.js +74 -13
- package/dest/public/index.d.ts +3 -2
- package/dest/public/index.d.ts.map +1 -1
- package/dest/public/index.js +1 -1
- package/dest/public/public_db_sources.d.ts +27 -67
- package/dest/public/public_db_sources.d.ts.map +1 -1
- package/dest/public/public_db_sources.js +89 -136
- package/dest/public/public_errors.d.ts +12 -0
- package/dest/public/public_errors.d.ts.map +1 -0
- package/dest/public/public_errors.js +13 -0
- package/dest/public/public_processor/guarded_merkle_tree.d.ts +6 -2
- package/dest/public/public_processor/guarded_merkle_tree.d.ts.map +1 -1
- package/dest/public/public_processor/guarded_merkle_tree.js +8 -0
- package/dest/public/public_processor/public_processor.d.ts +16 -15
- package/dest/public/public_processor/public_processor.d.ts.map +1 -1
- package/dest/public/public_processor/public_processor.js +477 -70
- package/dest/public/public_processor/public_processor_metrics.d.ts +2 -2
- package/dest/public/public_processor/public_processor_metrics.d.ts.map +1 -1
- package/dest/public/public_processor/public_processor_metrics.js +28 -45
- package/dest/public/public_tx_simulator/contract_provider_for_cpp.d.ts +19 -0
- package/dest/public/public_tx_simulator/contract_provider_for_cpp.d.ts.map +1 -0
- package/dest/public/public_tx_simulator/contract_provider_for_cpp.js +98 -0
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator.d.ts +53 -0
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator.d.ts.map +1 -0
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator.js +132 -0
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.d.ts +42 -0
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.d.ts.map +1 -0
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.js +86 -0
- package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.d.ts +30 -0
- package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.d.ts.map +1 -0
- package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.js +171 -0
- package/dest/public/public_tx_simulator/dumping_cpp_public_tx_simulator.d.ts +23 -0
- package/dest/public/public_tx_simulator/dumping_cpp_public_tx_simulator.d.ts.map +1 -0
- package/dest/public/public_tx_simulator/dumping_cpp_public_tx_simulator.js +52 -0
- package/dest/public/public_tx_simulator/factories.d.ts +14 -0
- package/dest/public/public_tx_simulator/factories.d.ts.map +1 -0
- package/dest/public/public_tx_simulator/factories.js +28 -0
- package/dest/public/public_tx_simulator/index.d.ts +6 -1
- package/dest/public/public_tx_simulator/index.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/index.js +3 -0
- package/dest/public/public_tx_simulator/measured_public_tx_simulator.d.ts +16 -8
- package/dest/public/public_tx_simulator/measured_public_tx_simulator.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/measured_public_tx_simulator.js +7 -8
- package/dest/public/public_tx_simulator/public_tx_context.d.ts +11 -5
- package/dest/public/public_tx_simulator/public_tx_context.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/public_tx_context.js +26 -14
- package/dest/public/public_tx_simulator/public_tx_simulator.d.ts +26 -31
- package/dest/public/public_tx_simulator/public_tx_simulator.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/public_tx_simulator.js +186 -130
- package/dest/public/public_tx_simulator/public_tx_simulator_interface.d.ts +32 -0
- package/dest/public/public_tx_simulator/public_tx_simulator_interface.d.ts.map +1 -0
- package/dest/public/public_tx_simulator/public_tx_simulator_interface.js +1 -0
- package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.d.ts +4 -3
- package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.js +396 -20
- package/dest/public/side_effect_errors.d.ts +42 -2
- package/dest/public/side_effect_errors.d.ts.map +1 -1
- package/dest/public/side_effect_errors.js +70 -1
- package/dest/public/side_effect_trace.d.ts +15 -8
- package/dest/public/side_effect_trace.d.ts.map +1 -1
- package/dest/public/side_effect_trace.js +38 -23
- package/dest/public/side_effect_trace_interface.d.ts +9 -4
- package/dest/public/side_effect_trace_interface.d.ts.map +1 -1
- package/dest/public/state_manager/index.d.ts +1 -1
- package/dest/public/state_manager/nullifiers.d.ts +2 -5
- package/dest/public/state_manager/nullifiers.d.ts.map +1 -1
- package/dest/public/state_manager/nullifiers.js +1 -6
- package/dest/public/state_manager/public_storage.d.ts +2 -2
- package/dest/public/state_manager/public_storage.d.ts.map +1 -1
- package/dest/public/state_manager/public_storage.js +1 -1
- package/dest/public/state_manager/state_manager.d.ts +22 -13
- package/dest/public/state_manager/state_manager.d.ts.map +1 -1
- package/dest/public/state_manager/state_manager.js +75 -25
- package/dest/public/test_executor_metrics.d.ts +6 -4
- package/dest/public/test_executor_metrics.d.ts.map +1 -1
- package/dest/public/test_executor_metrics.js +7 -6
- package/dest/public/unique_class_ids.d.ts +1 -1
- package/dest/public/unique_class_ids.d.ts.map +1 -1
- package/dest/public/utils.d.ts +1 -1
- package/dest/server.d.ts +1 -1
- package/dest/testing.d.ts +1 -1
- package/package.json +24 -19
- package/src/common/errors.ts +1 -1
- package/src/private/acvm/acvm.ts +4 -3
- package/src/private/acvm/deserialize.ts +1 -1
- package/src/private/acvm/serialize.ts +1 -1
- package/src/private/acvm_native.ts +29 -16
- package/src/private/acvm_wasm.ts +7 -3
- package/src/private/circuit_recording/circuit_recorder.ts +22 -19
- package/src/private/circuit_recording/file_circuit_recorder.ts +7 -2
- package/src/private/circuit_recording/memory_circuit_recorder.ts +6 -4
- package/src/private/circuit_recording/simulator_recorder_wrapper.ts +1 -1
- package/src/private/factory.ts +7 -4
- package/src/public/avm/avm_context.ts +2 -2
- package/src/public/avm/avm_contract_call_result.ts +8 -6
- package/src/public/avm/avm_execution_environment.ts +13 -7
- package/src/public/avm/avm_gas.ts +5 -5
- package/src/public/avm/avm_machine_state.ts +7 -6
- package/src/public/avm/avm_memory_types.ts +5 -1
- package/src/public/avm/avm_simulator.ts +32 -38
- package/src/public/avm/calldata.ts +100 -0
- package/src/public/avm/errors.ts +24 -27
- package/src/public/avm/fixtures/account_proof.json +553 -0
- package/src/public/avm/fixtures/account_proof_fetcher.ts +166 -0
- package/src/public/avm/fixtures/avm_simulation_tester.ts +22 -6
- package/src/public/avm/fixtures/base_avm_simulation_tester.ts +33 -1
- package/src/public/avm/fixtures/initializers.ts +9 -9
- package/src/public/avm/fixtures/utils.ts +3 -2
- package/src/public/avm/opcodes/accrued_substate.ts +35 -38
- package/src/public/avm/opcodes/addressing_mode.ts +5 -5
- package/src/public/avm/opcodes/arithmetic.ts +14 -2
- package/src/public/avm/opcodes/bitwise.ts +3 -3
- package/src/public/avm/opcodes/comparators.ts +1 -1
- package/src/public/avm/opcodes/contract.ts +4 -7
- package/src/public/avm/opcodes/control_flow.ts +2 -2
- package/src/public/avm/opcodes/conversion.ts +7 -3
- package/src/public/avm/opcodes/ec_add.ts +18 -9
- package/src/public/avm/opcodes/environment_getters.ts +13 -15
- package/src/public/avm/opcodes/external_calls.ts +17 -16
- package/src/public/avm/opcodes/hashing.ts +16 -10
- package/src/public/avm/opcodes/instruction.ts +8 -6
- package/src/public/avm/opcodes/instruction_impl.ts +2 -2
- package/src/public/avm/opcodes/memory.ts +20 -20
- package/src/public/avm/opcodes/misc.ts +43 -9
- package/src/public/avm/opcodes/storage.ts +30 -22
- package/src/public/avm/revert_reason.ts +6 -3
- package/src/public/avm/serialization/bytecode_serialization.ts +19 -8
- package/src/public/avm/serialization/instruction_serialization.ts +14 -2
- package/src/public/avm/test_utils.ts +7 -15
- package/src/public/contracts_db_checkpoint.ts +41 -0
- package/src/public/db_interfaces.ts +16 -1
- package/src/public/debug_fn_name.ts +39 -5
- package/src/public/executor_metrics.ts +11 -34
- package/src/public/executor_metrics_interface.ts +2 -1
- package/src/public/fixtures/amm_test.ts +4 -4
- package/src/public/fixtures/bulk_test.ts +46 -28
- package/src/public/fixtures/custom_bytecode_tester.ts +83 -0
- package/src/public/fixtures/custom_bytecode_tests.ts +228 -0
- package/src/public/fixtures/index.ts +8 -1
- package/src/public/fixtures/minimal_public_tx.ts +11 -44
- package/src/public/fixtures/opcode_spammer.ts +1717 -0
- package/src/public/fixtures/public_tx_simulation_tester.ts +90 -22
- package/src/public/fixtures/simple_contract_data_source.ts +8 -9
- package/src/public/fixtures/token_test.ts +18 -10
- package/src/public/fixtures/utils.ts +9 -10
- package/src/public/fuzzing/avm_fuzzer_simulator.ts +288 -0
- package/src/public/fuzzing/avm_simulator_bin.ts +175 -0
- package/src/public/hinting_db_sources.ts +117 -10
- package/src/public/index.ts +8 -1
- package/src/public/public_db_sources.ts +126 -179
- package/src/public/public_errors.ts +14 -0
- package/src/public/public_processor/guarded_merkle_tree.ts +10 -1
- package/src/public/public_processor/public_processor.ts +123 -79
- package/src/public/public_processor/public_processor_metrics.ts +16 -44
- package/src/public/public_tx_simulator/contract_provider_for_cpp.ts +124 -0
- package/src/public/public_tx_simulator/cpp_public_tx_simulator.ts +211 -0
- package/src/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.ts +134 -0
- package/src/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.ts +239 -0
- package/src/public/public_tx_simulator/dumping_cpp_public_tx_simulator.ts +83 -0
- package/src/public/public_tx_simulator/factories.ts +43 -0
- package/src/public/public_tx_simulator/index.ts +5 -0
- package/src/public/public_tx_simulator/measured_public_tx_simulator.ts +13 -14
- package/src/public/public_tx_simulator/public_tx_context.ts +33 -13
- package/src/public/public_tx_simulator/public_tx_simulator.ts +281 -184
- package/src/public/public_tx_simulator/public_tx_simulator_interface.ts +33 -0
- package/src/public/public_tx_simulator/telemetry_public_tx_simulator.ts +4 -13
- package/src/public/side_effect_errors.ts +91 -1
- package/src/public/side_effect_trace.ts +53 -25
- package/src/public/side_effect_trace_interface.ts +7 -1
- package/src/public/state_manager/nullifiers.ts +2 -8
- package/src/public/state_manager/public_storage.ts +1 -1
- package/src/public/state_manager/state_manager.ts +107 -50
- package/src/public/test_executor_metrics.ts +10 -8
- package/dest/public/bytecode_errors.d.ts +0 -4
- package/dest/public/bytecode_errors.d.ts.map +0 -1
- package/dest/public/bytecode_errors.js +0 -6
- package/dest/public/tx_contract_cache.d.ts +0 -41
- package/dest/public/tx_contract_cache.d.ts.map +0 -1
- package/dest/public/tx_contract_cache.js +0 -49
- package/src/public/bytecode_errors.ts +0 -6
- package/src/public/tx_contract_cache.ts +0 -69
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { type LoggerBindings } from '@aztec/foundation/log';
|
|
1
2
|
import type { RevertCode } from '@aztec/stdlib/avm';
|
|
3
|
+
import type { GasUsed } from '@aztec/stdlib/gas';
|
|
2
4
|
import type { ExecutorMetricsInterface } from './executor_metrics_interface.js';
|
|
3
5
|
export interface PublicEnqueuedCallMetrics {
|
|
4
6
|
fnName: string;
|
|
@@ -9,7 +11,7 @@ export interface PublicEnqueuedCallMetrics {
|
|
|
9
11
|
}
|
|
10
12
|
export interface PublicTxMetrics {
|
|
11
13
|
totalDurationMs: number;
|
|
12
|
-
manaUsed: number;
|
|
14
|
+
manaUsed: number | undefined;
|
|
13
15
|
totalInstructionsExecuted: number;
|
|
14
16
|
nonRevertiblePrivateInsertionsUs: number | undefined;
|
|
15
17
|
revertiblePrivateInsertionsUs: number | undefined;
|
|
@@ -39,9 +41,9 @@ export declare class TestExecutorMetrics implements ExecutorMetricsInterface {
|
|
|
39
41
|
private txMetrics;
|
|
40
42
|
private currentTxLabel;
|
|
41
43
|
private txTimer;
|
|
42
|
-
constructor();
|
|
44
|
+
constructor(bindings?: LoggerBindings);
|
|
43
45
|
startRecordingTxSimulation(txLabel: string): void;
|
|
44
|
-
stopRecordingTxSimulation(txLabel: string, revertedCode?: RevertCode): void;
|
|
46
|
+
stopRecordingTxSimulation(txLabel: string, gasUsed?: GasUsed, revertedCode?: RevertCode): void;
|
|
45
47
|
recordEnqueuedCallSimulation(fnName: string, durationMs: number, manaUsed: number, totalInstructionsExecuted: number): void;
|
|
46
48
|
recordEnqueuedCallSimulationFailure(fnName: string, durationMs: number, manaUsed: number, totalInstructionsExecuted: number): void;
|
|
47
49
|
recordPrivateEffectsInsertion(durationUs: number, type: 'revertible' | 'non-revertible'): void;
|
|
@@ -51,4 +53,4 @@ export declare class TestExecutorMetrics implements ExecutorMetricsInterface {
|
|
|
51
53
|
toJSON(indent?: number): string;
|
|
52
54
|
toGithubActionBenchmarkJSON(indent?: number): string;
|
|
53
55
|
}
|
|
54
|
-
//# sourceMappingURL=
|
|
56
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdF9leGVjdXRvcl9tZXRyaWNzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvcHVibGljL3Rlc3RfZXhlY3V0b3JfbWV0cmljcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEVBQWUsS0FBSyxjQUFjLEVBQWdCLE1BQU0sdUJBQXVCLENBQUM7QUFFdkYsT0FBTyxLQUFLLEVBQUUsVUFBVSxFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFDcEQsT0FBTyxLQUFLLEVBQUUsT0FBTyxFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFJakQsT0FBTyxLQUFLLEVBQUUsd0JBQXdCLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUVoRixNQUFNLFdBQVcseUJBQXlCO0lBQ3hDLE1BQU0sRUFBRSxNQUFNLENBQUM7SUFDZixVQUFVLEVBQUUsTUFBTSxDQUFDO0lBQ25CLFFBQVEsRUFBRSxNQUFNLENBQUM7SUFDakIseUJBQXlCLEVBQUUsTUFBTSxDQUFDO0lBQ2xDLFFBQVEsRUFBRSxPQUFPLENBQUM7Q0FDbkI7QUFFRCxNQUFNLFdBQVcsZUFBZTtJQUU5QixlQUFlLEVBQUUsTUFBTSxDQUFDO0lBQ3hCLFFBQVEsRUFBRSxNQUFNLEdBQUcsU0FBUyxDQUFDO0lBQzdCLHlCQUF5QixFQUFFLE1BQU0sQ0FBQztJQUNsQyxnQ0FBZ0MsRUFBRSxNQUFNLEdBQUcsU0FBUyxDQUFDO0lBQ3JELDZCQUE2QixFQUFFLE1BQU0sR0FBRyxTQUFTLENBQUM7SUFDbEQsYUFBYSxFQUFFLHlCQUF5QixFQUFFLENBQUM7SUFDM0MsWUFBWSxFQUFFLFVBQVUsR0FBRyxTQUFTLENBQUM7SUFFckMsc0JBQXNCLEVBQUUsTUFBTSxHQUFHLFNBQVMsQ0FBQztJQUMzQyxtQkFBbUIsRUFBRSxNQUFNLEdBQUcsU0FBUyxDQUFDO0lBQ3hDLDJCQUEyQixFQUFFLE1BQU0sR0FBRyxTQUFTLENBQUM7SUFFaEQsNkJBQTZCLEVBQUUsTUFBTSxHQUFHLFNBQVMsQ0FBQztJQUNsRCx1QkFBdUIsRUFBRSxNQUFNLEdBQUcsU0FBUyxDQUFDO0lBQzVDLGlCQUFpQixFQUFFLE1BQU0sR0FBRyxTQUFTLENBQUM7SUFDdEMsWUFBWSxFQUFFLE1BQU0sR0FBRyxTQUFTLENBQUM7SUFDakMsNkJBQTZCLEVBQUUsTUFBTSxHQUFHLFNBQVMsQ0FBQztJQUNsRCx3Q0FBd0MsRUFBRSxNQUFNLEdBQUcsU0FBUyxDQUFDO0lBQzdELHdCQUF3QixFQUFFLE1BQU0sR0FBRyxTQUFTLENBQUM7Q0FDOUM7QUFXRCxvQkFBWSxxQkFBcUI7SUFDL0IsR0FBRyxJQUFBO0lBQ0gsTUFBTSxJQUFBO0lBQ04sU0FBUyxJQUFBO0lBQ1QsWUFBWSxJQUFBO0lBQ1osT0FBTyxJQUFBO0NBQ1I7QUEyQkQscUJBQWEsbUJBQW9CLFlBQVcsd0JBQXdCOztJQUNsRSxPQUFPLENBQUMsTUFBTSxDQUFTO0lBRXZCLE9BQU8sQ0FBQyxTQUFTLENBQTJDO0lBQzVELE9BQU8sQ0FBQyxjQUFjLENBQXFCO0lBQzNDLE9BQU8sQ0FBQyxPQUFPLENBQW9CO0lBRW5DLFlBQVksUUFBUSxDQUFDLEVBQUUsY0FBYyxFQUVwQztJQUVELDBCQUEwQixDQUFDLE9BQU8sRUFBRSxNQUFNLFFBTXpDO0lBRUQseUJBQXlCLENBQUMsT0FBTyxFQUFFLE1BQU0sRUFBRSxPQUFPLENBQUMsRUFBRSxPQUFPLEVBQUUsWUFBWSxDQUFDLEVBQUUsVUFBVSxRQWdCdEY7SUFFRCw0QkFBNEIsQ0FDMUIsTUFBTSxFQUFFLE1BQU0sRUFDZCxVQUFVLEVBQUUsTUFBTSxFQUNsQixRQUFRLEVBQUUsTUFBTSxFQUNoQix5QkFBeUIsRUFBRSxNQUFNLFFBR2xDO0lBRUQsbUNBQW1DLENBQ2pDLE1BQU0sRUFBRSxNQUFNLEVBQ2QsVUFBVSxFQUFFLE1BQU0sRUFDbEIsUUFBUSxFQUFFLE1BQU0sRUFDaEIseUJBQXlCLEVBQUUsTUFBTSxRQUdsQztJQW9CRCw2QkFBNkIsQ0FBQyxVQUFVLEVBQUUsTUFBTSxFQUFFLElBQUksRUFBRSxZQUFZLEdBQUcsZ0JBQWdCLFFBZ0J0RjtJQUVELG1CQUFtQixDQUFDLE9BQU8sRUFBRSxNQUFNLEVBQUUsT0FBTyxFQUFFLE9BQU8sQ0FBQyxlQUFlLENBQUMsUUFVckU7SUFFRCxXQUFXLENBQUMsTUFBTSxHQUFFLHFCQUFpRCxRQUVwRTtJQUVELGNBQWMsQ0FBQyxNQUFNLEdBQUUscUJBQWlELFVBK0V2RTtJQTBCRCxNQUFNLENBQUMsTUFBTSxTQUFJLFVBRWhCO0lBRUQsMkJBQTJCLENBQUMsTUFBTSxTQUFJLFVBNEZyQztDQUNGIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test_executor_metrics.d.ts","sourceRoot":"","sources":["../../src/public/test_executor_metrics.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"test_executor_metrics.d.ts","sourceRoot":"","sources":["../../src/public/test_executor_metrics.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,KAAK,cAAc,EAAgB,MAAM,uBAAuB,CAAC;AAEvF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAIjD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAEhF,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,yBAAyB,EAAE,MAAM,CAAC;IAClC,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAE9B,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,yBAAyB,EAAE,MAAM,CAAC;IAClC,gCAAgC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrD,6BAA6B,EAAE,MAAM,GAAG,SAAS,CAAC;IAClD,aAAa,EAAE,yBAAyB,EAAE,CAAC;IAC3C,YAAY,EAAE,UAAU,GAAG,SAAS,CAAC;IAErC,sBAAsB,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3C,mBAAmB,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,2BAA2B,EAAE,MAAM,GAAG,SAAS,CAAC;IAEhD,6BAA6B,EAAE,MAAM,GAAG,SAAS,CAAC;IAClD,uBAAuB,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5C,iBAAiB,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,6BAA6B,EAAE,MAAM,GAAG,SAAS,CAAC;IAClD,wCAAwC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7D,wBAAwB,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9C;AAWD,oBAAY,qBAAqB;IAC/B,GAAG,IAAA;IACH,MAAM,IAAA;IACN,SAAS,IAAA;IACT,YAAY,IAAA;IACZ,OAAO,IAAA;CACR;AA2BD,qBAAa,mBAAoB,YAAW,wBAAwB;;IAClE,OAAO,CAAC,MAAM,CAAS;IAEvB,OAAO,CAAC,SAAS,CAA2C;IAC5D,OAAO,CAAC,cAAc,CAAqB;IAC3C,OAAO,CAAC,OAAO,CAAoB;IAEnC,YAAY,QAAQ,CAAC,EAAE,cAAc,EAEpC;IAED,0BAA0B,CAAC,OAAO,EAAE,MAAM,QAMzC;IAED,yBAAyB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,YAAY,CAAC,EAAE,UAAU,QAgBtF;IAED,4BAA4B,CAC1B,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,yBAAyB,EAAE,MAAM,QAGlC;IAED,mCAAmC,CACjC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,yBAAyB,EAAE,MAAM,QAGlC;IAoBD,6BAA6B,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,GAAG,gBAAgB,QAgBtF;IAED,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,eAAe,CAAC,QAUrE;IAED,WAAW,CAAC,MAAM,GAAE,qBAAiD,QAEpE;IAED,cAAc,CAAC,MAAM,GAAE,qBAAiD,UA+EvE;IA0BD,MAAM,CAAC,MAAM,SAAI,UAEhB;IAED,2BAA2B,CAAC,MAAM,SAAI,UA4FrC;CACF"}
|
|
@@ -48,8 +48,8 @@ export class TestExecutorMetrics {
|
|
|
48
48
|
txMetrics = new Map();
|
|
49
49
|
currentTxLabel;
|
|
50
50
|
txTimer;
|
|
51
|
-
constructor(){
|
|
52
|
-
this.logger = createLogger(`simulator:test_executor_metrics
|
|
51
|
+
constructor(bindings){
|
|
52
|
+
this.logger = createLogger(`simulator:test_executor_metrics`, bindings);
|
|
53
53
|
}
|
|
54
54
|
startRecordingTxSimulation(txLabel) {
|
|
55
55
|
assert(!this.currentTxLabel, 'Cannot start recording tx simulation when another is live');
|
|
@@ -58,14 +58,14 @@ export class TestExecutorMetrics {
|
|
|
58
58
|
this.currentTxLabel = txLabel;
|
|
59
59
|
this.txTimer = new Timer();
|
|
60
60
|
}
|
|
61
|
-
stopRecordingTxSimulation(txLabel, revertedCode) {
|
|
61
|
+
stopRecordingTxSimulation(txLabel, gasUsed, revertedCode) {
|
|
62
62
|
assert(this.currentTxLabel === txLabel, 'Cannot stop recording metrics for tx when another is live');
|
|
63
63
|
const txMetrics = this.txMetrics.get(txLabel);
|
|
64
64
|
// total duration of tx
|
|
65
65
|
txMetrics.totalDurationMs = this.txTimer.ms();
|
|
66
66
|
this.logger.debug(`Public TX simulation of ${txLabel} took ${txMetrics.totalDurationMs}ms`);
|
|
67
67
|
// add manaUsed across all enqueued calls
|
|
68
|
-
txMetrics.manaUsed =
|
|
68
|
+
txMetrics.manaUsed = gasUsed?.publicGas.l2Gas;
|
|
69
69
|
// add totalInstructionsExecuted across all enqueued calls
|
|
70
70
|
txMetrics.totalInstructionsExecuted = sum(txMetrics.enqueuedCalls.map((call)=>call.totalInstructionsExecuted));
|
|
71
71
|
txMetrics.revertedCode = revertedCode;
|
|
@@ -124,8 +124,9 @@ export class TestExecutorMetrics {
|
|
|
124
124
|
pretty += `${INDENT0}Total duration: ${fmtNum(txMetrics.totalDurationMs, 'ms')}\n`;
|
|
125
125
|
}
|
|
126
126
|
if (filter === 1 || filter === 0) {
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
const manaUsed = txMetrics.manaUsed || 0;
|
|
128
|
+
pretty += `${INDENT0}Total mana used: ${fmtNum(manaUsed)}\n`;
|
|
129
|
+
const manaPerSecond = Math.round(manaUsed * 1000 / txMetrics.totalDurationMs);
|
|
129
130
|
pretty += `${INDENT0}Mana per second: ${fmtNum(manaPerSecond)}\n`;
|
|
130
131
|
}
|
|
131
132
|
if (filter === 3 || filter === 1 || filter === 0) {
|
|
@@ -34,4 +34,4 @@ export declare class UniqueClassIds {
|
|
|
34
34
|
*/
|
|
35
35
|
acceptAndMerge(incoming: UniqueClassIds): void;
|
|
36
36
|
}
|
|
37
|
-
//# sourceMappingURL=
|
|
37
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidW5pcXVlX2NsYXNzX2lkcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3B1YmxpYy91bmlxdWVfY2xhc3NfaWRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUlBOzs7R0FHRztBQUNILHFCQUFhLGNBQWM7SUFHYixPQUFPLENBQUMsUUFBUSxDQUFDLE1BQU0sQ0FBQztJQUZwQyxPQUFPLENBQUMsUUFBUSxDQUFDLFFBQVEsQ0FBMEI7SUFFbkQsWUFBNkIsTUFBTSxDQUFDLDRCQUFnQixFQUFJO0lBRXhEOztPQUVHO0lBQ0ksSUFBSSxtQkFFVjtJQUVEOzs7OztPQUtHO0lBQ0ksR0FBRyxDQUFDLE9BQU8sRUFBRSxNQUFNLEdBQUcsT0FBTyxDQVNuQztJQUVEOztPQUVHO0lBQ0ksSUFBSSxJQUFJLE1BQU0sQ0FFcEI7SUFFRDs7OztPQUlHO0lBQ0ksR0FBRyxDQUFDLE9BQU8sRUFBRSxNQUFNLFFBU3pCO0lBRUQ7Ozs7T0FJRztJQUNJLGNBQWMsQ0FBQyxRQUFRLEVBQUUsY0FBYyxRQWE3QztDQUNGIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unique_class_ids.d.ts","sourceRoot":"","sources":["../../src/public/unique_class_ids.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,qBAAa,cAAc;IAGb,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;IAFpC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA0B;
|
|
1
|
+
{"version":3,"file":"unique_class_ids.d.ts","sourceRoot":"","sources":["../../src/public/unique_class_ids.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,qBAAa,cAAc;IAGb,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;IAFpC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA0B;IAEnD,YAA6B,MAAM,CAAC,4BAAgB,EAAI;IAExD;;OAEG;IACI,IAAI,mBAEV;IAED;;;;;OAKG;IACI,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CASnC;IAED;;OAEG;IACI,IAAI,IAAI,MAAM,CAEpB;IAED;;;;OAIG;IACI,GAAG,CAAC,OAAO,EAAE,MAAM,QASzB;IAED;;;;OAIG;IACI,cAAc,CAAC,QAAQ,EAAE,cAAc,QAa7C;CACF"}
|
package/dest/public/utils.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { PublicCallRequestWithCalldata, type Tx, TxExecutionPhase } from '@aztec/stdlib/tx';
|
|
2
2
|
export declare function getCallRequestsWithCalldataByPhase(tx: Tx, phase: TxExecutionPhase): PublicCallRequestWithCalldata[];
|
|
3
|
-
//# sourceMappingURL=
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wdWJsaWMvdXRpbHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLDZCQUE2QixFQUFFLEtBQUssRUFBRSxFQUFFLGdCQUFnQixFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFFNUYsd0JBQWdCLGtDQUFrQyxDQUFDLEVBQUUsRUFBRSxFQUFFLEVBQUUsS0FBSyxFQUFFLGdCQUFnQixHQUFHLDZCQUE2QixFQUFFLENBYW5IIn0=
|
package/dest/server.d.ts
CHANGED
|
@@ -6,4 +6,4 @@ export { SimulatorRecorderWrapper } from './private/circuit_recording/simulator_
|
|
|
6
6
|
export { MemoryCircuitRecorder } from './private/circuit_recording/memory_circuit_recorder.js';
|
|
7
7
|
export { type CircuitSimulator, type DecodedError } from './private/circuit_simulator.js';
|
|
8
8
|
export * from './common/index.js';
|
|
9
|
-
//# sourceMappingURL=
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VydmVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvc2VydmVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsbUJBQW1CLENBQUM7QUFDbEMsY0FBYyx5QkFBeUIsQ0FBQztBQUN4QyxPQUFPLEVBQUUsc0JBQXNCLEVBQUUsTUFBTSxtQ0FBbUMsQ0FBQztBQUMzRSxPQUFPLEVBQUUsbUJBQW1CLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQztBQUMvRCxPQUFPLEVBQUUsd0JBQXdCLEVBQUUsTUFBTSwyREFBMkQsQ0FBQztBQUNyRyxPQUFPLEVBQUUscUJBQXFCLEVBQUUsTUFBTSx3REFBd0QsQ0FBQztBQUMvRixPQUFPLEVBQUUsS0FBSyxnQkFBZ0IsRUFBRSxLQUFLLFlBQVksRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQzFGLGNBQWMsbUJBQW1CLENBQUMifQ==
|
package/dest/testing.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { FileCircuitRecorder } from './private/circuit_recording/file_circuit_recorder.js';
|
|
2
|
-
//# sourceMappingURL=
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdGluZy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL3Rlc3RpbmcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLG1CQUFtQixFQUFFLE1BQU0sc0RBQXNELENBQUMifQ==
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/simulator",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6-commit.a2d1860fe9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./server": "./dest/server.js",
|
|
@@ -17,10 +17,11 @@
|
|
|
17
17
|
"tsconfig": "./tsconfig.json"
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
|
-
"build": "yarn clean && tsc
|
|
21
|
-
"build:dev": "tsc
|
|
20
|
+
"build": "yarn clean && ../scripts/tsc.sh",
|
|
21
|
+
"build:dev": "../scripts/tsc.sh --watch",
|
|
22
22
|
"clean": "rm -rf ./dest .tsbuildinfo",
|
|
23
|
-
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
|
|
23
|
+
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}",
|
|
24
|
+
"build:fuzzer": "yarn clean && ../scripts/tsc.sh"
|
|
24
25
|
},
|
|
25
26
|
"inherits": [
|
|
26
27
|
"../package.common.json"
|
|
@@ -63,35 +64,39 @@
|
|
|
63
64
|
]
|
|
64
65
|
},
|
|
65
66
|
"dependencies": {
|
|
66
|
-
"@aztec/constants": "0.0.
|
|
67
|
-
"@aztec/foundation": "0.0.
|
|
68
|
-
"@aztec/
|
|
69
|
-
"@aztec/noir-
|
|
70
|
-
"@aztec/noir-
|
|
71
|
-
"@aztec/noir-types": "0.0.
|
|
72
|
-
"@aztec/
|
|
73
|
-
"@aztec/
|
|
74
|
-
"@aztec/
|
|
75
|
-
"@aztec/
|
|
67
|
+
"@aztec/constants": "0.0.6-commit.a2d1860fe9",
|
|
68
|
+
"@aztec/foundation": "0.0.6-commit.a2d1860fe9",
|
|
69
|
+
"@aztec/native": "0.0.6-commit.a2d1860fe9",
|
|
70
|
+
"@aztec/noir-acvm_js": "0.0.6-commit.a2d1860fe9",
|
|
71
|
+
"@aztec/noir-noirc_abi": "0.0.6-commit.a2d1860fe9",
|
|
72
|
+
"@aztec/noir-protocol-circuits-types": "0.0.6-commit.a2d1860fe9",
|
|
73
|
+
"@aztec/noir-types": "0.0.6-commit.a2d1860fe9",
|
|
74
|
+
"@aztec/protocol-contracts": "0.0.6-commit.a2d1860fe9",
|
|
75
|
+
"@aztec/stdlib": "0.0.6-commit.a2d1860fe9",
|
|
76
|
+
"@aztec/telemetry-client": "0.0.6-commit.a2d1860fe9",
|
|
77
|
+
"@aztec/world-state": "0.0.6-commit.a2d1860fe9",
|
|
76
78
|
"lodash.clonedeep": "^4.5.0",
|
|
77
79
|
"lodash.merge": "^4.6.2",
|
|
78
80
|
"tslib": "^2.4.0"
|
|
79
81
|
},
|
|
80
82
|
"devDependencies": {
|
|
81
|
-
"@aztec/kv-store": "0.0.
|
|
82
|
-
"@aztec/merkle-tree": "0.0.
|
|
83
|
-
"@aztec/noir-contracts.js": "0.0.
|
|
84
|
-
"@aztec/noir-test-contracts.js": "0.0.
|
|
83
|
+
"@aztec/kv-store": "0.0.6-commit.a2d1860fe9",
|
|
84
|
+
"@aztec/merkle-tree": "0.0.6-commit.a2d1860fe9",
|
|
85
|
+
"@aztec/noir-contracts.js": "0.0.6-commit.a2d1860fe9",
|
|
86
|
+
"@aztec/noir-test-contracts.js": "0.0.6-commit.a2d1860fe9",
|
|
85
87
|
"@jest/globals": "^30.0.0",
|
|
86
88
|
"@types/jest": "^30.0.0",
|
|
87
89
|
"@types/lodash.clonedeep": "^4.5.7",
|
|
88
90
|
"@types/lodash.merge": "^4.6.9",
|
|
89
91
|
"@types/node": "^22.15.17",
|
|
92
|
+
"@typescript/native-preview": "7.0.0-dev.20260113.1",
|
|
93
|
+
"istanbul-lib-hook": "^3.0.0",
|
|
94
|
+
"istanbul-lib-instrument": "^6.0.3",
|
|
90
95
|
"jest": "^30.0.0",
|
|
91
96
|
"jest-mock-extended": "^4.0.0",
|
|
92
97
|
"ts-node": "^10.9.1",
|
|
93
98
|
"typescript": "^5.3.3",
|
|
94
|
-
"viem": "npm:@
|
|
99
|
+
"viem": "npm:@aztec/viem@2.38.2"
|
|
95
100
|
},
|
|
96
101
|
"files": [
|
|
97
102
|
"dest",
|
package/src/common/errors.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Fr } from '@aztec/foundation/
|
|
1
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
3
3
|
import type { RawAssertionPayload } from '@aztec/noir-acvm_js';
|
|
4
4
|
import { abiDecodeError } from '@aztec/noir-noirc_abi';
|
package/src/private/acvm/acvm.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type Logger, type LoggerBindings, resolveLogger } from '@aztec/foundation/log';
|
|
2
2
|
import {
|
|
3
3
|
type ExecutionError,
|
|
4
4
|
type ForeignCallInput,
|
|
@@ -37,6 +37,7 @@ export interface ACIRExecutionResult {
|
|
|
37
37
|
* @param acir - The ACIR circuit bytecode to execute.
|
|
38
38
|
* @param initialWitness - The initial witness map defining all of the inputs to `circuit`.
|
|
39
39
|
* @param callback - A callback to process any foreign calls from the circuit.
|
|
40
|
+
* @param logger - Optional logger for ACVM execution logs.
|
|
40
41
|
* @returns The solved witness calculated by executing the circuit on the provided inputs, as well as the return
|
|
41
42
|
* witness indices as specified by the circuit.
|
|
42
43
|
*/
|
|
@@ -44,9 +45,9 @@ export async function acvm(
|
|
|
44
45
|
acir: Buffer,
|
|
45
46
|
initialWitness: ACVMWitness,
|
|
46
47
|
callback: ACIRCallback,
|
|
48
|
+
loggerOrBindings?: Logger | LoggerBindings,
|
|
47
49
|
): Promise<ACIRExecutionResult> {
|
|
48
|
-
const logger =
|
|
49
|
-
|
|
50
|
+
const logger = resolveLogger('simulator:acvm', loggerOrBindings);
|
|
50
51
|
const solvedAndReturnWitness = await executeCircuitWithReturnWitness(
|
|
51
52
|
acir,
|
|
52
53
|
initialWitness,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
1
2
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
3
3
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
4
|
|
|
5
5
|
import type { ACVMField } from './acvm_types.js';
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { runInDirectory } from '@aztec/foundation/fs';
|
|
2
|
-
import {
|
|
2
|
+
import { type Logger, type LoggerBindings, resolveLogger } from '@aztec/foundation/log';
|
|
3
3
|
import { Timer } from '@aztec/foundation/timer';
|
|
4
|
-
import type { WitnessMap } from '@aztec/noir-acvm_js';
|
|
5
|
-
import type { ForeignCallHandler } from '@aztec/noir-protocol-circuits-types/types';
|
|
4
|
+
import type { ForeignCallHandler, WitnessMap } from '@aztec/noir-acvm_js';
|
|
6
5
|
import type { FunctionArtifactWithContractName } from '@aztec/stdlib/abi';
|
|
7
6
|
import type { NoirCompiledCircuitWithName } from '@aztec/stdlib/noir';
|
|
8
7
|
|
|
@@ -13,8 +12,6 @@ import type { ACIRCallback, ACIRExecutionResult } from './acvm/acvm.js';
|
|
|
13
12
|
import type { ACVMWitness } from './acvm/acvm_types.js';
|
|
14
13
|
import type { CircuitSimulator } from './circuit_simulator.js';
|
|
15
14
|
|
|
16
|
-
const logger = createLogger('simulator:acvm-native');
|
|
17
|
-
|
|
18
15
|
export enum ACVM_RESULT {
|
|
19
16
|
SUCCESS,
|
|
20
17
|
FAILURE,
|
|
@@ -65,7 +62,9 @@ export async function executeNativeCircuit(
|
|
|
65
62
|
workingDirectory: string,
|
|
66
63
|
pathToAcvm: string,
|
|
67
64
|
outputFilename?: string,
|
|
65
|
+
loggerOrBindings?: Logger | LoggerBindings,
|
|
68
66
|
): Promise<ACVMResult> {
|
|
67
|
+
const logger = resolveLogger('simulator:acvm-native', loggerOrBindings);
|
|
69
68
|
const bytecodeFilename = 'bytecode';
|
|
70
69
|
const witnessFilename = 'input_witness.toml';
|
|
71
70
|
|
|
@@ -104,21 +103,26 @@ export async function executeNativeCircuit(
|
|
|
104
103
|
logger.debug(`Calling ACVM with ${args.join(' ')}`);
|
|
105
104
|
|
|
106
105
|
const processPromise = new Promise<string>((resolve, reject) => {
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
const outChunks: Buffer[] = [];
|
|
107
|
+
const errChunks: Buffer[] = [];
|
|
108
|
+
let outLen = 0;
|
|
109
|
+
let errLen = 0;
|
|
109
110
|
const acvm = proc.spawn(pathToAcvm, args);
|
|
110
|
-
acvm.stdout.on('data', data => {
|
|
111
|
-
|
|
111
|
+
acvm.stdout.on('data', (data: Buffer) => {
|
|
112
|
+
outChunks.push(data);
|
|
113
|
+
outLen += data.length;
|
|
112
114
|
});
|
|
113
|
-
acvm.stderr.on('data', data => {
|
|
114
|
-
|
|
115
|
+
acvm.stderr.on('data', (data: Buffer) => {
|
|
116
|
+
errChunks.push(data);
|
|
117
|
+
errLen += data.length;
|
|
115
118
|
});
|
|
116
119
|
acvm.on('close', code => {
|
|
117
120
|
if (code === 0) {
|
|
118
|
-
resolve(
|
|
121
|
+
resolve(Buffer.concat(outChunks, outLen).toString('utf-8'));
|
|
119
122
|
} else {
|
|
120
|
-
|
|
121
|
-
|
|
123
|
+
const stderr = Buffer.concat(errChunks, errLen);
|
|
124
|
+
logger.error(`From ACVM: ${stderr.toString('utf-8')}`);
|
|
125
|
+
reject(stderr.toString('utf-8'));
|
|
122
126
|
}
|
|
123
127
|
});
|
|
124
128
|
});
|
|
@@ -130,6 +134,9 @@ export async function executeNativeCircuit(
|
|
|
130
134
|
const outputWitnessFileName = `${workingDirectory}/output-witness.gz`;
|
|
131
135
|
await fs.copyFile(outputWitnessFileName, outputFilename);
|
|
132
136
|
}
|
|
137
|
+
// TODO: We shouldn't be parsing the witness from stdout, it's not very performant, and we end up with two ways of fetching the witness.
|
|
138
|
+
// We probably should implement the WitnessStack type, run the ACVM with msgpack serialization mode (env variable), and ungzip and parse the witness from
|
|
139
|
+
// the outputted gz witness file.
|
|
133
140
|
const witness = parseIntoWitnessMap(output);
|
|
134
141
|
return { status: ACVM_RESULT.SUCCESS, witness, duration };
|
|
135
142
|
} catch (error) {
|
|
@@ -138,11 +145,16 @@ export async function executeNativeCircuit(
|
|
|
138
145
|
}
|
|
139
146
|
|
|
140
147
|
export class NativeACVMSimulator implements CircuitSimulator {
|
|
148
|
+
private logger: Logger;
|
|
149
|
+
|
|
141
150
|
constructor(
|
|
142
151
|
private workingDirectory: string,
|
|
143
152
|
private pathToAcvm: string,
|
|
144
153
|
private witnessFilename?: string,
|
|
145
|
-
|
|
154
|
+
loggerOrBindings?: Logger | LoggerBindings,
|
|
155
|
+
) {
|
|
156
|
+
this.logger = resolveLogger('simulator:acvm-native', loggerOrBindings);
|
|
157
|
+
}
|
|
146
158
|
|
|
147
159
|
async executeProtocolCircuit(
|
|
148
160
|
input: ACVMWitness,
|
|
@@ -165,6 +177,7 @@ export class NativeACVMSimulator implements CircuitSimulator {
|
|
|
165
177
|
directory,
|
|
166
178
|
this.pathToAcvm,
|
|
167
179
|
this.witnessFilename,
|
|
180
|
+
this.logger,
|
|
168
181
|
);
|
|
169
182
|
|
|
170
183
|
if (result.status == ACVM_RESULT.FAILURE) {
|
|
@@ -174,7 +187,7 @@ export class NativeACVMSimulator implements CircuitSimulator {
|
|
|
174
187
|
return result;
|
|
175
188
|
};
|
|
176
189
|
|
|
177
|
-
return await runInDirectory(this.workingDirectory, operation, false, logger);
|
|
190
|
+
return await runInDirectory(this.workingDirectory, operation, false, this.logger);
|
|
178
191
|
}
|
|
179
192
|
|
|
180
193
|
executeUserCircuit(
|
package/src/private/acvm_wasm.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type Logger, type LoggerBindings, resolveLogger } from '@aztec/foundation/log';
|
|
2
2
|
import { Timer } from '@aztec/foundation/timer';
|
|
3
3
|
import initACVM, { type ExecutionError, type ForeignCallHandler, executeCircuit } from '@aztec/noir-acvm_js';
|
|
4
4
|
import initAbi from '@aztec/noir-noirc_abi';
|
|
@@ -11,7 +11,11 @@ import type { ACVMSuccess } from './acvm_native.js';
|
|
|
11
11
|
import { type CircuitSimulator, enrichNoirError } from './circuit_simulator.js';
|
|
12
12
|
|
|
13
13
|
export class WASMSimulator implements CircuitSimulator {
|
|
14
|
-
|
|
14
|
+
protected log: Logger;
|
|
15
|
+
|
|
16
|
+
constructor(loggerOrBindings?: Logger | LoggerBindings) {
|
|
17
|
+
this.log = resolveLogger('wasm-simulator', loggerOrBindings);
|
|
18
|
+
}
|
|
15
19
|
|
|
16
20
|
async init(): Promise<void> {
|
|
17
21
|
// If these are available, then we are in the
|
|
@@ -67,6 +71,6 @@ export class WASMSimulator implements CircuitSimulator {
|
|
|
67
71
|
callback: ACIRCallback,
|
|
68
72
|
): Promise<ACIRExecutionResult> {
|
|
69
73
|
await this.init();
|
|
70
|
-
return acvm(artifact.bytecode, input, callback);
|
|
74
|
+
return acvm(artifact.bytecode, input, callback, this.log.createChild('acvm'));
|
|
71
75
|
}
|
|
72
76
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { sha512 } from '@aztec/foundation/crypto';
|
|
2
|
-
import {
|
|
1
|
+
import { sha512 } from '@aztec/foundation/crypto/sha512';
|
|
2
|
+
import { type Logger, type LoggerBindings, resolveLogger } from '@aztec/foundation/log';
|
|
3
3
|
import { Timer } from '@aztec/foundation/timer';
|
|
4
4
|
import type { ForeignCallHandler, ForeignCallInput, ForeignCallOutput } from '@aztec/noir-acvm_js';
|
|
5
5
|
|
|
@@ -89,14 +89,16 @@ export class CircuitRecording {
|
|
|
89
89
|
* ```
|
|
90
90
|
*/
|
|
91
91
|
export class CircuitRecorder {
|
|
92
|
-
protected readonly logger
|
|
92
|
+
protected readonly logger: Logger;
|
|
93
93
|
|
|
94
94
|
protected recording?: CircuitRecording;
|
|
95
95
|
|
|
96
96
|
private stackDepth: number = 0;
|
|
97
97
|
private newCircuit: boolean = true;
|
|
98
98
|
|
|
99
|
-
protected constructor() {
|
|
99
|
+
protected constructor(loggerOrBindings?: Logger | LoggerBindings) {
|
|
100
|
+
this.logger = resolveLogger('simulator:acvm:recording', loggerOrBindings);
|
|
101
|
+
}
|
|
100
102
|
|
|
101
103
|
/**
|
|
102
104
|
* Initializes a new circuit recording session.
|
|
@@ -108,16 +110,16 @@ export class CircuitRecorder {
|
|
|
108
110
|
* contracts as protocol circuits artifacts always contain a single entrypoint function called 'main'.
|
|
109
111
|
*/
|
|
110
112
|
start(input: ACVMWitness, circuitBytecode: Buffer, circuitName: string, functionName: string): Promise<void> {
|
|
111
|
-
const parentRef = this.recording;
|
|
112
113
|
if (this.newCircuit) {
|
|
114
|
+
const parentRef = this.recording;
|
|
113
115
|
this.recording = new CircuitRecording(
|
|
114
116
|
circuitName,
|
|
115
117
|
functionName,
|
|
116
118
|
sha512(circuitBytecode).toString('hex'),
|
|
117
119
|
Object.fromEntries(input),
|
|
118
120
|
);
|
|
121
|
+
this.recording.setParent(parentRef);
|
|
119
122
|
}
|
|
120
|
-
this.recording!.setParent(parentRef);
|
|
121
123
|
|
|
122
124
|
return Promise.resolve();
|
|
123
125
|
}
|
|
@@ -173,22 +175,22 @@ export class CircuitRecorder {
|
|
|
173
175
|
if (result instanceof Promise) {
|
|
174
176
|
return result.then(async r => {
|
|
175
177
|
// Once we leave the nested circuit, we decrease the stack depth and set newCircuit to false
|
|
176
|
-
//
|
|
178
|
+
// so that the parent circuit continues with its existing recording
|
|
179
|
+
// Note: recording restoration is handled by finish()
|
|
177
180
|
if (isExternalCall) {
|
|
178
181
|
this.stackDepth--;
|
|
179
182
|
this.newCircuit = false;
|
|
180
|
-
this.recording = this.recording!.parent;
|
|
181
183
|
}
|
|
182
184
|
await this.recordCall(name, args, r, timer.ms(), this.stackDepth);
|
|
183
185
|
return r;
|
|
184
186
|
}) as ReturnType<typeof fn>;
|
|
185
187
|
}
|
|
186
188
|
// Once we leave the nested circuit, we decrease the stack depth and set newCircuit to false
|
|
187
|
-
//
|
|
189
|
+
// so that the parent circuit continues with its existing recording
|
|
190
|
+
// Note: recording restoration is handled by finish()
|
|
188
191
|
if (isExternalCall) {
|
|
189
192
|
this.stackDepth--;
|
|
190
193
|
this.newCircuit = false;
|
|
191
|
-
this.recording = this.recording!.parent;
|
|
192
194
|
}
|
|
193
195
|
void this.recordCall(name, args, result, timer.ms(), this.stackDepth);
|
|
194
196
|
return result;
|
|
@@ -239,6 +241,12 @@ export class CircuitRecorder {
|
|
|
239
241
|
if (!result!.parent) {
|
|
240
242
|
this.newCircuit = true;
|
|
241
243
|
this.recording = undefined;
|
|
244
|
+
} else {
|
|
245
|
+
// For nested circuits (utility calls, nested contract calls), restore to parent recording
|
|
246
|
+
// Note: we don't set newCircuit=false here because:
|
|
247
|
+
// - For privateCallPrivateFunction, the callback wrapper will set it to false
|
|
248
|
+
// - For utility calls, we want newCircuit to remain true so the next circuit creates its own recording
|
|
249
|
+
this.recording = result!.parent;
|
|
242
250
|
}
|
|
243
251
|
return Promise.resolve(result!);
|
|
244
252
|
}
|
|
@@ -247,14 +255,9 @@ export class CircuitRecorder {
|
|
|
247
255
|
* Finalizes the recording by resetting the state and returning the recording object with an attached error.
|
|
248
256
|
* @param error - The error that occurred during circuit execution
|
|
249
257
|
*/
|
|
250
|
-
finishWithError(error: unknown): Promise<CircuitRecording> {
|
|
251
|
-
const result = this.
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
this.newCircuit = true;
|
|
255
|
-
this.recording = undefined;
|
|
256
|
-
}
|
|
257
|
-
result!.error = JSON.stringify(error);
|
|
258
|
-
return Promise.resolve(result!);
|
|
258
|
+
async finishWithError(error: unknown): Promise<CircuitRecording> {
|
|
259
|
+
const result = await this.finish();
|
|
260
|
+
result.error = JSON.stringify(error);
|
|
261
|
+
return result;
|
|
259
262
|
}
|
|
260
263
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Logger } from '@aztec/foundation/log';
|
|
2
|
+
|
|
1
3
|
import fs from 'fs/promises';
|
|
2
4
|
import path from 'path';
|
|
3
5
|
|
|
@@ -7,8 +9,11 @@ import { CircuitRecorder, type CircuitRecording } from './circuit_recorder.js';
|
|
|
7
9
|
export class FileCircuitRecorder extends CircuitRecorder {
|
|
8
10
|
declare recording?: CircuitRecording & { filePath: string; isFirstCall: boolean };
|
|
9
11
|
|
|
10
|
-
constructor(
|
|
11
|
-
|
|
12
|
+
constructor(
|
|
13
|
+
private readonly recordDir: string,
|
|
14
|
+
logger?: Logger,
|
|
15
|
+
) {
|
|
16
|
+
super(logger);
|
|
12
17
|
}
|
|
13
18
|
|
|
14
19
|
override async start(
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
import type { Logger } from '@aztec/foundation/log';
|
|
2
|
+
|
|
1
3
|
import { CircuitRecorder } from './circuit_recorder.js';
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
/**
|
|
4
6
|
* In memory circuit recorder uses the default implementation. This is kept
|
|
5
|
-
* while we decide the fate of the FileCircuitRecorder
|
|
7
|
+
* while we decide the fate of the FileCircuitRecorder.
|
|
6
8
|
*/
|
|
7
9
|
export class MemoryCircuitRecorder extends CircuitRecorder {
|
|
8
|
-
constructor() {
|
|
9
|
-
super();
|
|
10
|
+
constructor(logger?: Logger) {
|
|
11
|
+
super(logger);
|
|
10
12
|
}
|
|
11
13
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ForeignCallHandler } from '@aztec/noir-
|
|
1
|
+
import type { ForeignCallHandler } from '@aztec/noir-acvm_js';
|
|
2
2
|
import type { FunctionArtifactWithContractName } from '@aztec/stdlib/abi';
|
|
3
3
|
import type { NoirCompiledCircuitWithName } from '@aztec/stdlib/noir';
|
|
4
4
|
|
package/src/private/factory.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Logger,
|
|
1
|
+
import { type Logger, type LoggerBindings, resolveLogger } from '@aztec/foundation/log';
|
|
2
2
|
|
|
3
3
|
import { promises as fs } from 'fs';
|
|
4
4
|
|
|
@@ -21,18 +21,21 @@ export function getSimulatorConfigFromEnv() {
|
|
|
21
21
|
|
|
22
22
|
export async function createSimulator(
|
|
23
23
|
config: SimulatorConfig,
|
|
24
|
-
|
|
24
|
+
loggerOrBindings?: Logger | LoggerBindings,
|
|
25
25
|
): Promise<CircuitSimulator> {
|
|
26
|
+
const logger = resolveLogger('simulator', loggerOrBindings);
|
|
26
27
|
if (config.acvmBinaryPath && config.acvmWorkingDirectory) {
|
|
27
28
|
try {
|
|
28
29
|
await fs.access(config.acvmBinaryPath, fs.constants.R_OK);
|
|
29
30
|
await fs.mkdir(config.acvmWorkingDirectory, { recursive: true });
|
|
30
31
|
logger.info(`Using native ACVM at ${config.acvmBinaryPath} and working directory ${config.acvmWorkingDirectory}`);
|
|
31
|
-
|
|
32
|
+
const acvmLogger = logger.createChild('acvm-native');
|
|
33
|
+
return new NativeACVMSimulator(config.acvmWorkingDirectory, config.acvmBinaryPath, undefined, acvmLogger);
|
|
32
34
|
} catch {
|
|
33
35
|
logger.warn(`Failed to access ACVM at ${config.acvmBinaryPath}, falling back to WASM`);
|
|
34
36
|
}
|
|
35
37
|
}
|
|
36
38
|
logger.info('Using WASM ACVM simulation');
|
|
37
|
-
|
|
39
|
+
const wasmLogger = logger.createChild('wasm');
|
|
40
|
+
return new WASMSimulator(wasmLogger);
|
|
38
41
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Fr } from '@aztec/foundation/fields';
|
|
2
1
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
2
|
|
|
4
3
|
import type { PublicPersistableStateManager } from '../state_manager/state_manager.js';
|
|
@@ -6,6 +5,7 @@ import type { AvmExecutionEnvironment } from './avm_execution_environment.js';
|
|
|
6
5
|
import { type Gas, gasToGasLeft } from './avm_gas.js';
|
|
7
6
|
import { AvmMachineState } from './avm_machine_state.js';
|
|
8
7
|
import type { AvmSimulatorInterface } from './avm_simulator_interface.js';
|
|
8
|
+
import type { CallData } from './calldata.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* An execution context includes the information necessary to initiate AVM
|
|
@@ -45,7 +45,7 @@ export class AvmContext {
|
|
|
45
45
|
*/
|
|
46
46
|
public async createNestedContractCallContext(
|
|
47
47
|
address: AztecAddress,
|
|
48
|
-
calldata:
|
|
48
|
+
calldata: CallData,
|
|
49
49
|
allocatedGas: Gas,
|
|
50
50
|
callType: 'CALL' | 'STATICCALL',
|
|
51
51
|
): Promise<AvmContext> {
|