@aztec/simulator 0.0.1-commit.b655e406 → 0.0.1-commit.d1f2d6c
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 +2 -0
- 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 +1 -1
- 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 +1 -1
- package/dest/private/acvm_native.d.ts.map +1 -1
- package/dest/private/acvm_wasm.d.ts +1 -1
- package/dest/private/acvm_wasm.d.ts.map +1 -1
- 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 +1 -1
- package/dest/private/circuit_recording/circuit_recorder.d.ts.map +1 -1
- package/dest/private/circuit_recording/circuit_recorder.js +16 -15
- package/dest/private/circuit_recording/file_circuit_recorder.d.ts +1 -1
- package/dest/private/circuit_recording/file_circuit_recorder.d.ts.map +1 -1
- package/dest/private/circuit_recording/memory_circuit_recorder.d.ts +1 -1
- package/dest/private/circuit_recording/memory_circuit_recorder.d.ts.map +1 -1
- package/dest/private/circuit_recording/simulator_recorder_wrapper.d.ts +1 -1
- 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 +1 -1
- package/dest/public/avm/avm_context.d.ts +2 -2
- package/dest/public/avm/avm_context.d.ts.map +1 -1
- package/dest/public/avm/avm_contract_call_result.d.ts +2 -2
- package/dest/public/avm/avm_contract_call_result.d.ts.map +1 -1
- package/dest/public/avm/avm_execution_environment.d.ts +5 -5
- package/dest/public/avm/avm_execution_environment.d.ts.map +1 -1
- package/dest/public/avm/avm_execution_environment.js +5 -8
- 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_machine_state.d.ts +2 -2
- package/dest/public/avm/avm_machine_state.d.ts.map +1 -1
- 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 +4 -3
- package/dest/public/avm/avm_simulator.d.ts.map +1 -1
- package/dest/public/avm/avm_simulator.js +8 -7
- package/dest/public/avm/avm_simulator_interface.d.ts +1 -1
- package/dest/public/avm/errors.d.ts +8 -2
- package/dest/public/avm/errors.d.ts.map +1 -1
- package/dest/public/avm/errors.js +14 -2
- package/dest/public/avm/fixtures/avm_simulation_tester.d.ts +1 -1
- package/dest/public/avm/fixtures/avm_simulation_tester.d.ts.map +1 -1
- package/dest/public/avm/fixtures/avm_simulation_tester.js +12 -3
- package/dest/public/avm/fixtures/base_avm_simulation_tester.d.ts +2 -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 +1 -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 -5
- 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 +15 -15
- package/dest/public/avm/opcodes/accrued_substate.d.ts.map +1 -1
- package/dest/public/avm/opcodes/accrued_substate.js +29 -29
- 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 +2 -2
- 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 +4 -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 +17 -8
- 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 +6 -6
- 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 +17 -16
- 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_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 +25 -25
- package/dest/public/avm/opcodes/misc.d.ts +3 -3
- package/dest/public/avm/opcodes/misc.d.ts.map +1 -1
- package/dest/public/avm/opcodes/misc.js +8 -8
- 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 +9 -6
- package/dest/public/avm/serialization/instruction_serialization.d.ts +1 -1
- package/dest/public/avm/serialization/instruction_serialization.js +1 -1
- package/dest/public/avm/test_utils.d.ts +2 -2
- package/dest/public/avm/test_utils.d.ts.map +1 -1
- package/dest/public/avm/test_utils.js +1 -1
- 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 +15 -2
- package/dest/public/debug_fn_name.d.ts.map +1 -1
- package/dest/public/debug_fn_name.js +28 -2
- 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 +9 -35
- 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 +2 -2
- 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 +5 -69
- package/dest/public/fixtures/custom_bytecode_tester.d.ts +29 -7
- package/dest/public/fixtures/custom_bytecode_tester.d.ts.map +1 -1
- package/dest/public/fixtures/custom_bytecode_tester.js +36 -12
- package/dest/public/fixtures/custom_bytecode_tests.d.ts +11 -8
- package/dest/public/fixtures/custom_bytecode_tests.d.ts.map +1 -1
- package/dest/public/fixtures/custom_bytecode_tests.js +83 -18
- package/dest/public/fixtures/index.d.ts +4 -2
- package/dest/public/fixtures/index.d.ts.map +1 -1
- package/dest/public/fixtures/index.js +3 -1
- package/dest/public/fixtures/minimal_public_tx.d.ts +2 -8
- package/dest/public/fixtures/minimal_public_tx.d.ts.map +1 -1
- package/dest/public/fixtures/minimal_public_tx.js +6 -16
- package/dest/public/fixtures/opcode_spammer.d.ts +123 -0
- package/dest/public/fixtures/opcode_spammer.d.ts.map +1 -0
- package/dest/public/fixtures/opcode_spammer.js +1693 -0
- package/dest/public/fixtures/public_tx_simulation_tester.d.ts +24 -6
- package/dest/public/fixtures/public_tx_simulation_tester.d.ts.map +1 -1
- package/dest/public/fixtures/public_tx_simulation_tester.js +62 -21
- 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 +4 -3
- 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 +14 -4
- package/dest/public/hinting_db_sources.d.ts.map +1 -1
- package/dest/public/hinting_db_sources.js +71 -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 +22 -63
- package/dest/public/public_db_sources.d.ts.map +1 -1
- package/dest/public/public_db_sources.js +74 -131
- package/dest/public/public_errors.d.ts +1 -1
- package/dest/public/public_errors.d.ts.map +1 -1
- package/dest/public/public_processor/guarded_merkle_tree.d.ts +6 -4
- package/dest/public/public_processor/guarded_merkle_tree.d.ts.map +1 -1
- package/dest/public/public_processor/guarded_merkle_tree.js +5 -0
- package/dest/public/public_processor/public_processor.d.ts +12 -19
- package/dest/public/public_processor/public_processor.d.ts.map +1 -1
- package/dest/public/public_processor/public_processor.js +456 -64
- package/dest/public/public_processor/public_processor_metrics.d.ts +1 -1
- package/dest/public/public_processor/public_processor_metrics.d.ts.map +1 -1
- package/dest/public/public_processor/public_processor_metrics.js +12 -45
- package/dest/public/public_tx_simulator/contract_provider_for_cpp.d.ts +18 -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 +34 -22
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator.js +93 -50
- 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 +22 -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 +13 -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 +5 -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 +14 -7
- 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 +5 -5
- package/dest/public/public_tx_simulator/public_tx_context.d.ts +6 -3
- package/dest/public/public_tx_simulator/public_tx_context.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/public_tx_context.js +13 -5
- package/dest/public/public_tx_simulator/public_tx_simulator.d.ts +13 -32
- package/dest/public/public_tx_simulator/public_tx_simulator.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/public_tx_simulator.js +112 -127
- package/dest/public/public_tx_simulator/public_tx_simulator_interface.d.ts +25 -2
- package/dest/public/public_tx_simulator/public_tx_simulator_interface.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.d.ts +4 -4
- 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 +395 -19
- package/dest/public/side_effect_errors.d.ts +1 -1
- package/dest/public/side_effect_errors.d.ts.map +1 -1
- package/dest/public/side_effect_trace.d.ts +2 -2
- package/dest/public/side_effect_trace.d.ts.map +1 -1
- package/dest/public/side_effect_trace.js +1 -1
- package/dest/public/side_effect_trace_interface.d.ts +3 -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 -2
- package/dest/public/state_manager/nullifiers.d.ts.map +1 -1
- 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 +9 -11
- package/dest/public/state_manager/state_manager.d.ts.map +1 -1
- package/dest/public/state_manager/state_manager.js +12 -8
- package/dest/public/test_executor_metrics.d.ts +4 -3
- package/dest/public/test_executor_metrics.d.ts.map +1 -1
- package/dest/public/test_executor_metrics.js +5 -4
- 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 +21 -20
- package/src/common/errors.ts +1 -1
- package/src/private/acvm/deserialize.ts +1 -1
- package/src/private/acvm/serialize.ts +1 -1
- package/src/private/circuit_recording/circuit_recorder.ts +17 -16
- package/src/public/avm/avm_context.ts +1 -1
- package/src/public/avm/avm_contract_call_result.ts +1 -1
- package/src/public/avm/avm_execution_environment.ts +4 -6
- package/src/public/avm/avm_gas.ts +3 -3
- package/src/public/avm/avm_machine_state.ts +1 -1
- package/src/public/avm/avm_memory_types.ts +5 -1
- package/src/public/avm/avm_simulator.ts +11 -9
- package/src/public/avm/errors.ts +17 -3
- package/src/public/avm/fixtures/avm_simulation_tester.ts +10 -2
- package/src/public/avm/fixtures/base_avm_simulation_tester.ts +1 -1
- package/src/public/avm/fixtures/initializers.ts +8 -10
- package/src/public/avm/fixtures/utils.ts +3 -2
- package/src/public/avm/opcodes/accrued_substate.ts +15 -15
- package/src/public/avm/opcodes/addressing_mode.ts +2 -2
- 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 +3 -3
- package/src/public/avm/opcodes/ec_add.ts +15 -6
- package/src/public/avm/opcodes/environment_getters.ts +7 -7
- package/src/public/avm/opcodes/external_calls.ts +10 -9
- package/src/public/avm/opcodes/hashing.ts +16 -10
- package/src/public/avm/opcodes/instruction_impl.ts +2 -2
- package/src/public/avm/opcodes/memory.ts +19 -19
- package/src/public/avm/opcodes/misc.ts +6 -6
- 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 +17 -6
- package/src/public/avm/serialization/instruction_serialization.ts +1 -1
- package/src/public/avm/test_utils.ts +1 -1
- package/src/public/contracts_db_checkpoint.ts +41 -0
- package/src/public/db_interfaces.ts +16 -1
- package/src/public/debug_fn_name.ts +35 -3
- package/src/public/executor_metrics.ts +9 -35
- package/src/public/executor_metrics_interface.ts +2 -1
- package/src/public/fixtures/amm_test.ts +2 -2
- package/src/public/fixtures/bulk_test.ts +9 -9
- package/src/public/fixtures/custom_bytecode_tester.ts +54 -20
- package/src/public/fixtures/custom_bytecode_tests.ts +111 -18
- package/src/public/fixtures/index.ts +7 -1
- package/src/public/fixtures/minimal_public_tx.ts +7 -17
- package/src/public/fixtures/opcode_spammer.ts +1754 -0
- package/src/public/fixtures/public_tx_simulation_tester.ts +85 -21
- 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 +2 -3
- 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 +112 -10
- package/src/public/index.ts +6 -4
- package/src/public/public_db_sources.ts +93 -172
- package/src/public/public_processor/guarded_merkle_tree.ts +8 -3
- package/src/public/public_processor/public_processor.ts +86 -59
- package/src/public/public_processor/public_processor_metrics.ts +11 -45
- package/src/public/public_tx_simulator/contract_provider_for_cpp.ts +121 -0
- package/src/public/public_tx_simulator/cpp_public_tx_simulator.ts +137 -57
- package/src/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.ts +132 -0
- package/src/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.ts +237 -0
- package/src/public/public_tx_simulator/dumping_cpp_public_tx_simulator.ts +81 -0
- package/src/public/public_tx_simulator/factories.ts +41 -0
- package/src/public/public_tx_simulator/index.ts +4 -0
- package/src/public/public_tx_simulator/measured_public_tx_simulator.ts +10 -14
- package/src/public/public_tx_simulator/public_tx_context.ts +9 -3
- package/src/public/public_tx_simulator/public_tx_simulator.ts +163 -193
- package/src/public/public_tx_simulator/public_tx_simulator_interface.ts +24 -2
- package/src/public/public_tx_simulator/telemetry_public_tx_simulator.ts +3 -3
- package/src/public/side_effect_trace.ts +1 -1
- package/src/public/side_effect_trace_interface.ts +1 -1
- package/src/public/state_manager/nullifiers.ts +1 -1
- package/src/public/state_manager/public_storage.ts +1 -1
- package/src/public/state_manager/state_manager.ts +16 -30
- package/src/public/test_executor_metrics.ts +7 -5
- 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/tx_contract_cache.ts +0 -69
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state_manager.d.ts","sourceRoot":"","sources":["../../../src/public/state_manager/state_manager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"state_manager.d.ts","sourceRoot":"","sources":["../../../src/public/state_manager/state_manager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAEpD,OAAO,EAAE,KAAK,QAAQ,EAAgB,MAAM,uBAAuB,CAAC;AAEpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAGtE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAIlD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AACnF,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAEtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAO7D,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,mCAAmC,CAAC;AACxF,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;;;;;GAQG;AACH,qBAAa,6BA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E5B;IAEM,OAAO,IAAI,QAAQ,EAAE,CAE3B;IAED;;;;OAIG;IACI,cAAc,CAAC,eAAe,EAAE,YAAY,EAAE,GAAG,EAAE,EAAE,EAAE,QAG7D;IAED;;;;OAIG;IACU,mBAAmB,CAAC,eAAe,EAAE,YAAY,GAAG,OAAO,CAAC,4BAA4B,GAAG,SAAS,CAAC,CAuCjH;YAEa,8BAA8B;YAiE9B,gBAAgB;IA6B9B;;OAEG;IACU,WAAW,CAAC,eAAe,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAsBnF;IAEY,0BAA0B,CAAC,cAAc,EAAE,uBAAuB,GAAG,OAAO,CAAC,MAAM,CAAC,CAEhG;IAEY,gCAAgC,CAC3C,cAAc,EAAE,uBAAuB,GACtC,OAAO,CAAC;QAAE,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAEzE;IAEY,OAAO,CAAC,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEhF;IAEY,gBAAgB,IAAI,OAAO,CAAC,aAAa,CAAC,CAEtD;CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { poseidon2Hash } from '@aztec/foundation/crypto';
|
|
1
|
+
import { CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS, MAX_PROTOCOL_CONTRACTS } from '@aztec/constants';
|
|
2
|
+
import { poseidon2Hash } from '@aztec/foundation/crypto/poseidon';
|
|
3
3
|
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
4
4
|
import { createLogger } from '@aztec/foundation/log';
|
|
5
5
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
@@ -8,7 +8,7 @@ import { SerializableContractInstance } from '@aztec/stdlib/contract';
|
|
|
8
8
|
import { DelayedPublicMutableValues, DelayedPublicMutableValuesWithHash } from '@aztec/stdlib/delayed-public-mutable';
|
|
9
9
|
import { computeNoteHashNonce, computeUniqueNoteHash, siloNoteHash, siloNullifier } from '@aztec/stdlib/hash';
|
|
10
10
|
import { strict as assert } from 'assert';
|
|
11
|
-
import { getPublicFunctionDebugName } from '../debug_fn_name.js';
|
|
11
|
+
import { getPublicFunctionDebugName, getPublicFunctionSelectorAndName } from '../debug_fn_name.js';
|
|
12
12
|
import { L1ToL2MessageIndexOutOfRangeError, MaxCallsToUniqueContractClassIdsError, NoteHashIndexOutOfRangeError, NullifierCollisionError } from '../side_effect_errors.js';
|
|
13
13
|
import { NullifierManager } from './nullifiers.js';
|
|
14
14
|
import { PublicStorage } from './public_storage.js';
|
|
@@ -31,7 +31,7 @@ import { PublicStorage } from './public_storage.js';
|
|
|
31
31
|
nullifiers;
|
|
32
32
|
log;
|
|
33
33
|
/** Make sure a forked state is never merged twice. */ alreadyMergedIntoParent;
|
|
34
|
-
constructor(treesDB, contractsDB, trace, firstNullifier, timestamp, doMerkleOperations =
|
|
34
|
+
constructor(treesDB, contractsDB, trace, firstNullifier, timestamp, doMerkleOperations = true, publicStorage = new PublicStorage(treesDB), nullifiers = new NullifierManager(treesDB)){
|
|
35
35
|
this.treesDB = treesDB;
|
|
36
36
|
this.contractsDB = contractsDB;
|
|
37
37
|
this.trace = trace;
|
|
@@ -45,8 +45,8 @@ import { PublicStorage } from './public_storage.js';
|
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
47
|
* Create a new state manager
|
|
48
|
-
*/ static create(treesDB, contractsDB, trace,
|
|
49
|
-
return new PublicPersistableStateManager(treesDB, contractsDB, trace, firstNullifier, timestamp
|
|
48
|
+
*/ static create(treesDB, contractsDB, trace, firstNullifier, timestamp) {
|
|
49
|
+
return new PublicPersistableStateManager(treesDB, contractsDB, trace, firstNullifier, timestamp);
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
52
|
* Create a new state manager forked from this one
|
|
@@ -109,7 +109,6 @@ import { PublicStorage } from './public_storage.js';
|
|
|
109
109
|
if (this.doMerkleOperations) {
|
|
110
110
|
return await this.treesDB.storageRead(contractAddress, slot);
|
|
111
111
|
} else {
|
|
112
|
-
// TODO(fcarreiro): I don't get this. PublicStorage CAN end up reading the tree. Why is it in the "dont do merkle operations" branch?
|
|
113
112
|
const read = await this.publicStorage.read(contractAddress, slot);
|
|
114
113
|
this.log.trace(`Storage read results (address=${contractAddress}, slot=${slot}): value=${read.value}, cached=${read.cached}`);
|
|
115
114
|
return read.value;
|
|
@@ -311,6 +310,8 @@ import { PublicStorage } from './public_storage.js';
|
|
|
311
310
|
const { delayedPublicMutableSlot, delayedPublicMutableHashSlot } = await DelayedPublicMutableValuesWithHash.getContractUpdateSlots(instance.address);
|
|
312
311
|
const readDeployerStorage = async (storageSlot)=>await this.readStorage(ProtocolContractAddress.ContractInstanceRegistry, storageSlot);
|
|
313
312
|
const hash = await readDeployerStorage(delayedPublicMutableHashSlot);
|
|
313
|
+
// NOTE: The below reads are either not performed (if hash.isZero()) or only performed in unconstrained in c++ simulation.
|
|
314
|
+
// See UpdateCheck::check_current_class_id documentation - this means if we generate hints from the merkle db, they are unused:
|
|
314
315
|
const delayedPublicMutableValues = await DelayedPublicMutableValues.readFromTree(delayedPublicMutableSlot, readDeployerStorage);
|
|
315
316
|
const preImage = delayedPublicMutableValues.toFields();
|
|
316
317
|
// 1) update never scheduled: hash == 0 and preimage should be empty (but poseidon2hash(preimage) will not be 0s)
|
|
@@ -379,6 +380,9 @@ import { PublicStorage } from './public_storage.js';
|
|
|
379
380
|
async getPublicFunctionDebugName(avmEnvironment) {
|
|
380
381
|
return await getPublicFunctionDebugName(this.contractsDB, avmEnvironment.address, avmEnvironment.calldata);
|
|
381
382
|
}
|
|
383
|
+
async getPublicFunctionSelectorAndName(avmEnvironment) {
|
|
384
|
+
return await getPublicFunctionSelectorAndName(this.contractsDB, avmEnvironment.address, avmEnvironment.calldata);
|
|
385
|
+
}
|
|
382
386
|
async padTree(treeId, leavesToInsert) {
|
|
383
387
|
await this.treesDB.padTree(treeId, leavesToInsert);
|
|
384
388
|
}
|
|
@@ -387,5 +391,5 @@ import { PublicStorage } from './public_storage.js';
|
|
|
387
391
|
}
|
|
388
392
|
}
|
|
389
393
|
function contractAddressIsCanonical(contractAddress) {
|
|
390
|
-
return contractAddress.
|
|
394
|
+
return contractAddress.toBigInt() >= 1 && contractAddress.toBigInt() <= MAX_PROTOCOL_CONTRACTS;
|
|
391
395
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { RevertCode } from '@aztec/stdlib/avm';
|
|
2
|
+
import type { GasUsed } from '@aztec/stdlib/gas';
|
|
2
3
|
import type { ExecutorMetricsInterface } from './executor_metrics_interface.js';
|
|
3
4
|
export interface PublicEnqueuedCallMetrics {
|
|
4
5
|
fnName: string;
|
|
@@ -9,7 +10,7 @@ export interface PublicEnqueuedCallMetrics {
|
|
|
9
10
|
}
|
|
10
11
|
export interface PublicTxMetrics {
|
|
11
12
|
totalDurationMs: number;
|
|
12
|
-
manaUsed: number;
|
|
13
|
+
manaUsed: number | undefined;
|
|
13
14
|
totalInstructionsExecuted: number;
|
|
14
15
|
nonRevertiblePrivateInsertionsUs: number | undefined;
|
|
15
16
|
revertiblePrivateInsertionsUs: number | undefined;
|
|
@@ -41,7 +42,7 @@ export declare class TestExecutorMetrics implements ExecutorMetricsInterface {
|
|
|
41
42
|
private txTimer;
|
|
42
43
|
constructor();
|
|
43
44
|
startRecordingTxSimulation(txLabel: string): void;
|
|
44
|
-
stopRecordingTxSimulation(txLabel: string, revertedCode?: RevertCode): void;
|
|
45
|
+
stopRecordingTxSimulation(txLabel: string, gasUsed?: GasUsed, revertedCode?: RevertCode): void;
|
|
45
46
|
recordEnqueuedCallSimulation(fnName: string, durationMs: number, manaUsed: number, totalInstructionsExecuted: number): void;
|
|
46
47
|
recordEnqueuedCallSimulationFailure(fnName: string, durationMs: number, manaUsed: number, totalInstructionsExecuted: number): void;
|
|
47
48
|
recordPrivateEffectsInsertion(durationUs: number, type: 'revertible' | 'non-revertible'): void;
|
|
@@ -51,4 +52,4 @@ export declare class TestExecutorMetrics implements ExecutorMetricsInterface {
|
|
|
51
52
|
toJSON(indent?: number): string;
|
|
52
53
|
toGithubActionBenchmarkJSON(indent?: number): string;
|
|
53
54
|
}
|
|
54
|
-
//# sourceMappingURL=
|
|
55
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdF9leGVjdXRvcl9tZXRyaWNzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvcHVibGljL3Rlc3RfZXhlY3V0b3JfbWV0cmljcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFHQSxPQUFPLEtBQUssRUFBRSxVQUFVLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQztBQUNwRCxPQUFPLEtBQUssRUFBRSxPQUFPLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQztBQUlqRCxPQUFPLEtBQUssRUFBRSx3QkFBd0IsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBRWhGLE1BQU0sV0FBVyx5QkFBeUI7SUFDeEMsTUFBTSxFQUFFLE1BQU0sQ0FBQztJQUNmLFVBQVUsRUFBRSxNQUFNLENBQUM7SUFDbkIsUUFBUSxFQUFFLE1BQU0sQ0FBQztJQUNqQix5QkFBeUIsRUFBRSxNQUFNLENBQUM7SUFDbEMsUUFBUSxFQUFFLE9BQU8sQ0FBQztDQUNuQjtBQUVELE1BQU0sV0FBVyxlQUFlO0lBRTlCLGVBQWUsRUFBRSxNQUFNLENBQUM7SUFDeEIsUUFBUSxFQUFFLE1BQU0sR0FBRyxTQUFTLENBQUM7SUFDN0IseUJBQXlCLEVBQUUsTUFBTSxDQUFDO0lBQ2xDLGdDQUFnQyxFQUFFLE1BQU0sR0FBRyxTQUFTLENBQUM7SUFDckQsNkJBQTZCLEVBQUUsTUFBTSxHQUFHLFNBQVM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FBRSxPQUFPLENBQUMsRUFBRSxPQUFPLEVBQUUsWUFBWSxDQUFDLEVBQUUsVUFBVSxRQWdCdEY7SUFFRCw0QkFBNEIsQ0FDMUIsTUFBTSxFQUFFLE1BQU0sRUFDZCxVQUFVLEVBQUUsTUFBTSxFQUNsQixRQUFRLEVBQUUsTUFBTSxFQUNoQix5QkFBeUIsRUFBRSxNQUFNLFFBR2xDO0lBRUQsbUNBQW1DLENBQ2pDLE1BQU0sRUFBRSxNQUFNLEVBQ2QsVUFBVSxFQUFFLE1BQU0sRUFDbEIsUUFBUSxFQUFFLE1BQU0sRUFDaEIseUJBQXlCLEVBQUUsTUFBTSxRQUdsQztJQW9CRCw2QkFBNkIsQ0FBQyxVQUFVLEVBQUUsTUFBTSxFQUFFLElBQUksRUFBRSxZQUFZLEdBQUcsZ0JBQWdCLFFBZ0J0RjtJQUVELG1CQUFtQixDQUFDLE9BQU8sRUFBRSxNQUFNLEVBQUUsT0FBTyxFQUFFLE9BQU8sQ0FBQyxlQUFlLENBQUMsUUFVckU7SUFFRCxXQUFXLENBQUMsTUFBTSxHQUFFLHFCQUFpRCxRQUVwRTtJQUVELGNBQWMsQ0FBQyxNQUFNLEdBQUUscUJBQWlELFVBK0V2RTtJQTBCRCxNQUFNLENBQUMsTUFBTSxTQUFJLFVBRWhCO0lBRUQsMkJBQTJCLENBQUMsTUFBTSxTQUFJLFVBNEZyQztDQUNGIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test_executor_metrics.d.ts","sourceRoot":"","sources":["../../src/public/test_executor_metrics.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"test_executor_metrics.d.ts","sourceRoot":"","sources":["../../src/public/test_executor_metrics.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,OAAO,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,SAAS,CAA2C;IAC5D,OAAO,CAAC,cAAc,CAAqB;IAC3C,OAAO,CAAC,OAAO,CAAoB;IAEnC,cAEC;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"}
|
|
@@ -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.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.d1f2d6c",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./server": "./dest/server.js",
|
|
@@ -17,11 +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
23
|
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}",
|
|
24
|
-
"build:fuzzer": "
|
|
24
|
+
"build:fuzzer": "yarn clean && ../scripts/tsc.sh"
|
|
25
25
|
},
|
|
26
26
|
"inherits": [
|
|
27
27
|
"../package.common.json"
|
|
@@ -64,38 +64,39 @@
|
|
|
64
64
|
]
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@aztec/constants": "0.0.1-commit.
|
|
68
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
69
|
-
"@aztec/native": "0.0.1-commit.
|
|
70
|
-
"@aztec/noir-acvm_js": "0.0.1-commit.
|
|
71
|
-
"@aztec/noir-noirc_abi": "0.0.1-commit.
|
|
72
|
-
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.
|
|
73
|
-
"@aztec/noir-types": "0.0.1-commit.
|
|
74
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
75
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
76
|
-
"@aztec/telemetry-client": "0.0.1-commit.
|
|
77
|
-
"@aztec/world-state": "0.0.1-commit.
|
|
67
|
+
"@aztec/constants": "0.0.1-commit.d1f2d6c",
|
|
68
|
+
"@aztec/foundation": "0.0.1-commit.d1f2d6c",
|
|
69
|
+
"@aztec/native": "0.0.1-commit.d1f2d6c",
|
|
70
|
+
"@aztec/noir-acvm_js": "0.0.1-commit.d1f2d6c",
|
|
71
|
+
"@aztec/noir-noirc_abi": "0.0.1-commit.d1f2d6c",
|
|
72
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.d1f2d6c",
|
|
73
|
+
"@aztec/noir-types": "0.0.1-commit.d1f2d6c",
|
|
74
|
+
"@aztec/protocol-contracts": "0.0.1-commit.d1f2d6c",
|
|
75
|
+
"@aztec/stdlib": "0.0.1-commit.d1f2d6c",
|
|
76
|
+
"@aztec/telemetry-client": "0.0.1-commit.d1f2d6c",
|
|
77
|
+
"@aztec/world-state": "0.0.1-commit.d1f2d6c",
|
|
78
78
|
"lodash.clonedeep": "^4.5.0",
|
|
79
79
|
"lodash.merge": "^4.6.2",
|
|
80
80
|
"tslib": "^2.4.0"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
84
|
-
"@aztec/merkle-tree": "0.0.1-commit.
|
|
85
|
-
"@aztec/noir-contracts.js": "0.0.1-commit.
|
|
86
|
-
"@aztec/noir-test-contracts.js": "0.0.1-commit.
|
|
83
|
+
"@aztec/kv-store": "0.0.1-commit.d1f2d6c",
|
|
84
|
+
"@aztec/merkle-tree": "0.0.1-commit.d1f2d6c",
|
|
85
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.d1f2d6c",
|
|
86
|
+
"@aztec/noir-test-contracts.js": "0.0.1-commit.d1f2d6c",
|
|
87
87
|
"@jest/globals": "^30.0.0",
|
|
88
88
|
"@types/jest": "^30.0.0",
|
|
89
89
|
"@types/lodash.clonedeep": "^4.5.7",
|
|
90
90
|
"@types/lodash.merge": "^4.6.9",
|
|
91
91
|
"@types/node": "^22.15.17",
|
|
92
|
+
"@typescript/native-preview": "7.0.0-dev.20260113.1",
|
|
92
93
|
"istanbul-lib-hook": "^3.0.0",
|
|
93
94
|
"istanbul-lib-instrument": "^6.0.3",
|
|
94
95
|
"jest": "^30.0.0",
|
|
95
96
|
"jest-mock-extended": "^4.0.0",
|
|
96
97
|
"ts-node": "^10.9.1",
|
|
97
98
|
"typescript": "^5.3.3",
|
|
98
|
-
"viem": "npm:@
|
|
99
|
+
"viem": "npm:@aztec/viem@2.38.2"
|
|
99
100
|
},
|
|
100
101
|
"files": [
|
|
101
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';
|
|
@@ -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,4 +1,4 @@
|
|
|
1
|
-
import { sha512 } from '@aztec/foundation/crypto';
|
|
1
|
+
import { sha512 } from '@aztec/foundation/crypto/sha512';
|
|
2
2
|
import { createLogger } from '@aztec/foundation/log';
|
|
3
3
|
import { Timer } from '@aztec/foundation/timer';
|
|
4
4
|
import type { ForeignCallHandler, ForeignCallInput, ForeignCallOutput } from '@aztec/noir-acvm_js';
|
|
@@ -108,16 +108,16 @@ export class CircuitRecorder {
|
|
|
108
108
|
* contracts as protocol circuits artifacts always contain a single entrypoint function called 'main'.
|
|
109
109
|
*/
|
|
110
110
|
start(input: ACVMWitness, circuitBytecode: Buffer, circuitName: string, functionName: string): Promise<void> {
|
|
111
|
-
const parentRef = this.recording;
|
|
112
111
|
if (this.newCircuit) {
|
|
112
|
+
const parentRef = this.recording;
|
|
113
113
|
this.recording = new CircuitRecording(
|
|
114
114
|
circuitName,
|
|
115
115
|
functionName,
|
|
116
116
|
sha512(circuitBytecode).toString('hex'),
|
|
117
117
|
Object.fromEntries(input),
|
|
118
118
|
);
|
|
119
|
+
this.recording.setParent(parentRef);
|
|
119
120
|
}
|
|
120
|
-
this.recording!.setParent(parentRef);
|
|
121
121
|
|
|
122
122
|
return Promise.resolve();
|
|
123
123
|
}
|
|
@@ -173,22 +173,22 @@ export class CircuitRecorder {
|
|
|
173
173
|
if (result instanceof Promise) {
|
|
174
174
|
return result.then(async r => {
|
|
175
175
|
// Once we leave the nested circuit, we decrease the stack depth and set newCircuit to false
|
|
176
|
-
//
|
|
176
|
+
// so that the parent circuit continues with its existing recording
|
|
177
|
+
// Note: recording restoration is handled by finish()
|
|
177
178
|
if (isExternalCall) {
|
|
178
179
|
this.stackDepth--;
|
|
179
180
|
this.newCircuit = false;
|
|
180
|
-
this.recording = this.recording!.parent;
|
|
181
181
|
}
|
|
182
182
|
await this.recordCall(name, args, r, timer.ms(), this.stackDepth);
|
|
183
183
|
return r;
|
|
184
184
|
}) as ReturnType<typeof fn>;
|
|
185
185
|
}
|
|
186
186
|
// Once we leave the nested circuit, we decrease the stack depth and set newCircuit to false
|
|
187
|
-
//
|
|
187
|
+
// so that the parent circuit continues with its existing recording
|
|
188
|
+
// Note: recording restoration is handled by finish()
|
|
188
189
|
if (isExternalCall) {
|
|
189
190
|
this.stackDepth--;
|
|
190
191
|
this.newCircuit = false;
|
|
191
|
-
this.recording = this.recording!.parent;
|
|
192
192
|
}
|
|
193
193
|
void this.recordCall(name, args, result, timer.ms(), this.stackDepth);
|
|
194
194
|
return result;
|
|
@@ -239,6 +239,12 @@ export class CircuitRecorder {
|
|
|
239
239
|
if (!result!.parent) {
|
|
240
240
|
this.newCircuit = true;
|
|
241
241
|
this.recording = undefined;
|
|
242
|
+
} else {
|
|
243
|
+
// For nested circuits (utility calls, nested contract calls), restore to parent recording
|
|
244
|
+
// Note: we don't set newCircuit=false here because:
|
|
245
|
+
// - For privateCallPrivateFunction, the callback wrapper will set it to false
|
|
246
|
+
// - For utility calls, we want newCircuit to remain true so the next circuit creates its own recording
|
|
247
|
+
this.recording = result!.parent;
|
|
242
248
|
}
|
|
243
249
|
return Promise.resolve(result!);
|
|
244
250
|
}
|
|
@@ -247,14 +253,9 @@ export class CircuitRecorder {
|
|
|
247
253
|
* Finalizes the recording by resetting the state and returning the recording object with an attached error.
|
|
248
254
|
* @param error - The error that occurred during circuit execution
|
|
249
255
|
*/
|
|
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!);
|
|
256
|
+
async finishWithError(error: unknown): Promise<CircuitRecording> {
|
|
257
|
+
const result = await this.finish();
|
|
258
|
+
result.error = JSON.stringify(error);
|
|
259
|
+
return result;
|
|
259
260
|
}
|
|
260
261
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import type { PublicSimulatorConfig } from '@aztec/stdlib/avm';
|
|
3
3
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
4
|
import type { GlobalVariables } from '@aztec/stdlib/tx';
|
|
5
5
|
|
|
@@ -16,8 +16,7 @@ export class AvmExecutionEnvironment {
|
|
|
16
16
|
public readonly globals: GlobalVariables,
|
|
17
17
|
public readonly isStaticCall: boolean,
|
|
18
18
|
public readonly calldata: Fr[],
|
|
19
|
-
public readonly
|
|
20
|
-
public readonly maxDebugLogMemoryReads: number = DEFAULT_MAX_DEBUG_LOG_MEMORY_READS,
|
|
19
|
+
public readonly config: PublicSimulatorConfig,
|
|
21
20
|
) {}
|
|
22
21
|
|
|
23
22
|
private deriveEnvironmentForNestedCallInternal(
|
|
@@ -33,8 +32,7 @@ export class AvmExecutionEnvironment {
|
|
|
33
32
|
this.globals,
|
|
34
33
|
isStaticCall,
|
|
35
34
|
calldata,
|
|
36
|
-
this.
|
|
37
|
-
this.maxDebugLogMemoryReads,
|
|
35
|
+
this.config,
|
|
38
36
|
);
|
|
39
37
|
}
|
|
40
38
|
|
|
@@ -26,9 +26,9 @@ export function makeGas(gasCost: Partial<Gas>) {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/** Sums together multiple instances of Gas. */
|
|
29
|
-
export function sumGas(...gases: Partial<Gas>[]) {
|
|
30
|
-
return gases.reduce(
|
|
31
|
-
(acc
|
|
29
|
+
export function sumGas(...gases: Partial<Gas>[]): Gas {
|
|
30
|
+
return gases.reduce<Gas>(
|
|
31
|
+
(acc, gas) => ({
|
|
32
32
|
l2Gas: acc.l2Gas + (gas.l2Gas ?? 0),
|
|
33
33
|
daGas: acc.daGas + (gas.daGas ?? 0),
|
|
34
34
|
}),
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
MEM_TAG_U128,
|
|
9
9
|
} from '@aztec/constants';
|
|
10
10
|
import { toBufferBE } from '@aztec/foundation/bigint-buffer';
|
|
11
|
-
import { Fr } from '@aztec/foundation/
|
|
11
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
12
12
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
13
13
|
import type { FunctionsOf } from '@aztec/foundation/types';
|
|
14
14
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
@@ -369,6 +369,10 @@ export class TaggedMemory implements TaggedMemoryInterface {
|
|
|
369
369
|
* Check tags for all memory in the specified range.
|
|
370
370
|
*/
|
|
371
371
|
public checkTagsRange(tag: TypeTag, startOffset: number, size: number) {
|
|
372
|
+
if (startOffset + size > TaggedMemory.MAX_MEMORY_SIZE) {
|
|
373
|
+
throw new MemorySliceOutOfRangeError(startOffset, size);
|
|
374
|
+
}
|
|
375
|
+
|
|
372
376
|
for (let offset = startOffset; offset < startOffset + size; offset++) {
|
|
373
377
|
this.checkTag(tag, offset);
|
|
374
378
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
3
3
|
import { Timer } from '@aztec/foundation/timer';
|
|
4
|
+
import type { PublicSimulatorConfig } from '@aztec/stdlib/avm';
|
|
4
5
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
6
|
import type { GlobalVariables } from '@aztec/stdlib/tx';
|
|
6
7
|
|
|
@@ -75,8 +76,7 @@ export class AvmSimulator implements AvmSimulatorInterface {
|
|
|
75
76
|
isStaticCall: boolean,
|
|
76
77
|
calldata: Fr[],
|
|
77
78
|
allocatedGas: Gas,
|
|
78
|
-
|
|
79
|
-
maxDebugLogMemoryReads?: number,
|
|
79
|
+
config: PublicSimulatorConfig,
|
|
80
80
|
) {
|
|
81
81
|
const avmExecutionEnv = new AvmExecutionEnvironment(
|
|
82
82
|
address,
|
|
@@ -86,8 +86,7 @@ export class AvmSimulator implements AvmSimulatorInterface {
|
|
|
86
86
|
globals,
|
|
87
87
|
isStaticCall,
|
|
88
88
|
calldata,
|
|
89
|
-
|
|
90
|
-
maxDebugLogMemoryReads,
|
|
89
|
+
config,
|
|
91
90
|
);
|
|
92
91
|
|
|
93
92
|
const avmMachineState = new AvmMachineState(allocatedGas);
|
|
@@ -105,7 +104,7 @@ export class AvmSimulator implements AvmSimulatorInterface {
|
|
|
105
104
|
|
|
106
105
|
if (!bytecode) {
|
|
107
106
|
return await this.handleFailureToRetrieveBytecode(
|
|
108
|
-
`No bytecode found, or limit encountered for max calls to unique contract class IDs. Contract address: ${this.context.environment.address}. Reverting...`,
|
|
107
|
+
`No bytecode found. Contract is not deployed, or limit encountered for max calls to unique contract class IDs. Contract address: ${this.context.environment.address}. Reverting...`,
|
|
109
108
|
);
|
|
110
109
|
}
|
|
111
110
|
|
|
@@ -178,7 +177,7 @@ export class AvmSimulator implements AvmSimulatorInterface {
|
|
|
178
177
|
|
|
179
178
|
if (machineState.pc >= bytecode.length) {
|
|
180
179
|
this.log.warn('Passed end of program');
|
|
181
|
-
throw new InvalidProgramCounterError(machineState.pc, /*max=*/ bytecode.length);
|
|
180
|
+
throw new InvalidProgramCounterError(machineState.pc, /*max=*/ bytecode.length - 1);
|
|
182
181
|
}
|
|
183
182
|
}
|
|
184
183
|
|
|
@@ -236,12 +235,15 @@ export class AvmSimulator implements AvmSimulatorInterface {
|
|
|
236
235
|
|
|
237
236
|
private async handleFailureToRetrieveBytecode(message: string): Promise<AvmContractCallResult> {
|
|
238
237
|
// revert, consuming all gas
|
|
239
|
-
const
|
|
238
|
+
const { functionSelector, functionName } = await this.context.persistableState.getPublicFunctionSelectorAndName(
|
|
239
|
+
this.context.environment,
|
|
240
|
+
);
|
|
240
241
|
const revertReason = new AvmRevertReason(
|
|
241
242
|
message,
|
|
242
243
|
/*failingFunction=*/ {
|
|
243
244
|
contractAddress: this.context.environment.address,
|
|
244
|
-
|
|
245
|
+
functionSelector,
|
|
246
|
+
functionName,
|
|
245
247
|
},
|
|
246
248
|
/*noirCallStack=*/ [],
|
|
247
249
|
);
|
package/src/public/avm/errors.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Point } from '@aztec/foundation/
|
|
1
|
+
import type { Point } from '@aztec/foundation/curves/grumpkin';
|
|
2
2
|
import type { FailingFunction, NoirCallStack } from '@aztec/stdlib/errors';
|
|
3
3
|
|
|
4
4
|
import { ExecutionError } from '../../common/errors.js';
|
|
@@ -58,7 +58,7 @@ export class AvmParsingError extends AvmExecutionError {
|
|
|
58
58
|
*/
|
|
59
59
|
export class InvalidTagValueError extends AvmExecutionError {
|
|
60
60
|
constructor(tagValue: number) {
|
|
61
|
-
super(`Tag value ${tagValue} is invalid.`);
|
|
61
|
+
super(`Tag check failed: Tag value ${tagValue} is invalid.`);
|
|
62
62
|
this.name = 'InvalidTagValueError';
|
|
63
63
|
}
|
|
64
64
|
}
|
|
@@ -77,6 +77,12 @@ export class InstructionExecutionError extends AvmExecutionError {
|
|
|
77
77
|
* Error thrown on failed AVM memory tag check.
|
|
78
78
|
*/
|
|
79
79
|
export class TagCheckError extends AvmExecutionError {
|
|
80
|
+
public static forBaseAddress(gotTag: string): TagCheckError {
|
|
81
|
+
return new TagCheckError(`Base address (mem[0]) is not a valid address (has tag ${gotTag})`);
|
|
82
|
+
}
|
|
83
|
+
public static forIndirectAddress(address: number, gotTag: string): TagCheckError {
|
|
84
|
+
return new TagCheckError(`Address after indirection is not a valid address (address ${address} has tag ${gotTag})`);
|
|
85
|
+
}
|
|
80
86
|
public static forOffset(offset: number, gotTag: string, expectedTag: string): TagCheckError {
|
|
81
87
|
return new TagCheckError(`Tag mismatch at offset ${offset}, got ${gotTag}, expected ${expectedTag}`);
|
|
82
88
|
}
|
|
@@ -97,7 +103,7 @@ export class TagCheckError extends AvmExecutionError {
|
|
|
97
103
|
*/
|
|
98
104
|
export class RelativeAddressOutOfRangeError extends AvmExecutionError {
|
|
99
105
|
constructor(baseAddr: number, relOffset: number) {
|
|
100
|
-
super(`
|
|
106
|
+
super(`Relative address out of range. Base address ${baseAddr}, relative offset ${relOffset}`);
|
|
101
107
|
this.name = 'RelativeAddressOutOfRangeError';
|
|
102
108
|
}
|
|
103
109
|
}
|
|
@@ -161,3 +167,11 @@ export class AvmRevertReason extends ExecutionError {
|
|
|
161
167
|
super(message, failingFunction, noirCallStack, options);
|
|
162
168
|
}
|
|
163
169
|
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Helper to annotate errors occurring during instruction fetching.
|
|
173
|
+
*/
|
|
174
|
+
export function duringInstrFetch(error: Error, pc: number) {
|
|
175
|
+
error.message = `Instruction fetching error at pc ${pc}: ${error.message}`;
|
|
176
|
+
return error;
|
|
177
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import { encodeArguments } from '@aztec/stdlib/abi';
|
|
3
|
+
import { PublicSimulatorConfig } from '@aztec/stdlib/avm';
|
|
3
4
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
5
|
import { GasFees } from '@aztec/stdlib/gas';
|
|
5
6
|
import type { MerkleTreeWriteOperations } from '@aztec/stdlib/interfaces/server';
|
|
@@ -51,7 +52,6 @@ export class AvmSimulationTester extends BaseAvmSimulationTester {
|
|
|
51
52
|
treesDB,
|
|
52
53
|
contractsDB,
|
|
53
54
|
trace,
|
|
54
|
-
/*doMerkleOperations=*/ false,
|
|
55
55
|
firstNullifier,
|
|
56
56
|
DEFAULT_TIMESTAMP,
|
|
57
57
|
);
|
|
@@ -81,12 +81,20 @@ export class AvmSimulationTester extends BaseAvmSimulationTester {
|
|
|
81
81
|
globals.timestamp = DEFAULT_TIMESTAMP;
|
|
82
82
|
globals.gasFees = DEFAULT_GAS_FEES;
|
|
83
83
|
|
|
84
|
+
const config = PublicSimulatorConfig.from({
|
|
85
|
+
skipFeeEnforcement: false,
|
|
86
|
+
collectDebugLogs: true,
|
|
87
|
+
collectHints: false,
|
|
88
|
+
collectStatistics: false,
|
|
89
|
+
collectCallMetadata: true,
|
|
90
|
+
});
|
|
84
91
|
const environment = initExecutionEnvironment({
|
|
85
92
|
calldata,
|
|
86
93
|
globals,
|
|
87
94
|
address,
|
|
88
95
|
sender,
|
|
89
96
|
isStaticCall,
|
|
97
|
+
config,
|
|
90
98
|
});
|
|
91
99
|
const persistableState = await this.stateManager.fork();
|
|
92
100
|
const context = initContext({ env: environment, persistableState });
|