@aztec/simulator 0.0.0-test.1 → 0.0.1-commit.5daedc8
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 -0
- package/dest/client.d.ts +6 -4
- package/dest/client.d.ts.map +1 -1
- package/dest/client.js +4 -2
- package/dest/common/errors.d.ts +5 -14
- package/dest/common/errors.d.ts.map +1 -1
- package/dest/common/errors.js +51 -32
- package/dest/common/index.d.ts +1 -2
- package/dest/common/index.d.ts.map +1 -1
- package/dest/common/index.js +0 -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 +12 -6
- package/dest/private/acvm/acvm.d.ts.map +1 -1
- package/dest/private/acvm/acvm.js +10 -16
- package/dest/private/acvm/acvm_types.d.ts +2 -2
- package/dest/private/acvm/acvm_types.d.ts.map +1 -1
- package/dest/private/acvm/deserialize.d.ts +18 -19
- package/dest/private/acvm/deserialize.d.ts.map +1 -1
- package/dest/private/acvm/deserialize.js +31 -23
- package/dest/private/acvm/index.d.ts +1 -2
- package/dest/private/acvm/index.d.ts.map +1 -1
- package/dest/private/acvm/index.js +0 -1
- package/dest/private/acvm/serialize.d.ts +20 -3
- package/dest/private/acvm/serialize.d.ts.map +1 -1
- package/dest/private/acvm/serialize.js +53 -0
- package/dest/private/acvm_native.d.ts +39 -0
- package/dest/private/acvm_native.d.ts.map +1 -0
- package/dest/private/{providers/acvm_native.js → acvm_native.js} +26 -20
- package/dest/private/acvm_wasm.d.ts +15 -0
- package/dest/private/acvm_wasm.d.ts.map +1 -0
- package/dest/private/{providers/acvm_wasm.js → acvm_wasm.js} +22 -19
- package/dest/private/acvm_wasm_with_blobs.d.ts +20 -0
- package/dest/private/acvm_wasm_with_blobs.d.ts.map +1 -0
- package/dest/private/acvm_wasm_with_blobs.js +35 -0
- package/dest/private/circuit_recording/circuit_recorder.d.ts +108 -0
- package/dest/private/circuit_recording/circuit_recorder.d.ts.map +1 -0
- package/dest/private/circuit_recording/circuit_recorder.js +209 -0
- package/dest/private/circuit_recording/file_circuit_recorder.d.ts +31 -0
- package/dest/private/circuit_recording/file_circuit_recorder.d.ts.map +1 -0
- package/dest/private/circuit_recording/file_circuit_recorder.js +135 -0
- package/dest/private/circuit_recording/memory_circuit_recorder.d.ts +5 -0
- package/dest/private/circuit_recording/memory_circuit_recorder.d.ts.map +1 -0
- package/dest/private/circuit_recording/memory_circuit_recorder.js +9 -0
- package/dest/private/circuit_recording/simulator_recorder_wrapper.d.ts +21 -0
- package/dest/private/circuit_recording/simulator_recorder_wrapper.d.ts.map +1 -0
- package/dest/private/circuit_recording/simulator_recorder_wrapper.js +44 -0
- package/dest/private/circuit_simulator.d.ts +35 -0
- package/dest/private/circuit_simulator.d.ts.map +1 -0
- package/dest/private/circuit_simulator.js +43 -0
- package/dest/private/factory.d.ts +12 -0
- package/dest/private/factory.d.ts.map +1 -0
- package/dest/private/{providers/factory.js → factory.js} +2 -2
- package/dest/public/avm/avm_context.d.ts +6 -6
- package/dest/public/avm/avm_context.d.ts.map +1 -1
- package/dest/public/avm/avm_contract_call_result.d.ts +5 -3
- package/dest/public/avm/avm_contract_call_result.d.ts.map +1 -1
- package/dest/public/avm/avm_contract_call_result.js +11 -7
- package/dest/public/avm/avm_execution_environment.d.ts +4 -2
- package/dest/public/avm/avm_execution_environment.d.ts.map +1 -1
- package/dest/public/avm/avm_execution_environment.js +4 -2
- package/dest/public/avm/avm_gas.d.ts +5 -21
- package/dest/public/avm/avm_gas.d.ts.map +1 -1
- package/dest/public/avm/avm_gas.js +27 -35
- package/dest/public/avm/avm_machine_state.d.ts +3 -1
- package/dest/public/avm/avm_machine_state.d.ts.map +1 -1
- package/dest/public/avm/avm_machine_state.js +2 -0
- package/dest/public/avm/avm_memory_types.d.ts +99 -88
- package/dest/public/avm/avm_memory_types.d.ts.map +1 -1
- package/dest/public/avm/avm_memory_types.js +17 -6
- package/dest/public/avm/avm_simulator.d.ts +6 -6
- package/dest/public/avm/avm_simulator.d.ts.map +1 -1
- package/dest/public/avm/avm_simulator.js +23 -35
- package/dest/public/avm/avm_simulator_interface.d.ts +9 -0
- package/dest/public/avm/avm_simulator_interface.d.ts.map +1 -0
- package/dest/public/avm/avm_simulator_interface.js +3 -0
- package/dest/public/avm/errors.d.ts +7 -31
- package/dest/public/avm/errors.d.ts.map +1 -1
- package/dest/public/avm/errors.js +7 -57
- package/dest/public/avm/fixtures/avm_simulation_tester.d.ts +6 -5
- package/dest/public/avm/fixtures/avm_simulation_tester.d.ts.map +1 -1
- package/dest/public/avm/fixtures/avm_simulation_tester.js +22 -15
- package/dest/public/avm/fixtures/base_avm_simulation_tester.d.ts +7 -5
- package/dest/public/avm/fixtures/base_avm_simulation_tester.d.ts.map +1 -1
- package/dest/public/avm/fixtures/base_avm_simulation_tester.js +37 -14
- package/dest/public/avm/fixtures/initializers.d.ts +42 -0
- package/dest/public/avm/fixtures/initializers.d.ts.map +1 -0
- package/dest/public/avm/fixtures/initializers.js +44 -0
- package/dest/public/avm/fixtures/utils.d.ts +38 -0
- package/dest/public/avm/fixtures/utils.d.ts.map +1 -0
- package/dest/public/avm/fixtures/utils.js +95 -0
- package/dest/public/avm/index.d.ts +1 -3
- package/dest/public/avm/index.d.ts.map +1 -1
- package/dest/public/avm/index.js +0 -2
- package/dest/public/avm/opcodes/accrued_substate.d.ts +3 -3
- package/dest/public/avm/opcodes/accrued_substate.d.ts.map +1 -1
- package/dest/public/avm/opcodes/accrued_substate.js +28 -25
- package/dest/public/avm/opcodes/addressing_mode.d.ts +12 -8
- package/dest/public/avm/opcodes/addressing_mode.d.ts.map +1 -1
- package/dest/public/avm/opcodes/addressing_mode.js +46 -26
- package/dest/public/avm/opcodes/arithmetic.d.ts +17 -7
- package/dest/public/avm/opcodes/arithmetic.d.ts.map +1 -1
- package/dest/public/avm/opcodes/arithmetic.js +16 -2
- package/dest/public/avm/opcodes/bitwise.d.ts +10 -18
- package/dest/public/avm/opcodes/bitwise.d.ts.map +1 -1
- package/dest/public/avm/opcodes/bitwise.js +19 -26
- package/dest/public/avm/opcodes/comparators.d.ts +4 -4
- package/dest/public/avm/opcodes/comparators.d.ts.map +1 -1
- package/dest/public/avm/opcodes/comparators.js +3 -3
- package/dest/public/avm/opcodes/contract.d.ts +2 -3
- package/dest/public/avm/opcodes/contract.d.ts.map +1 -1
- package/dest/public/avm/opcodes/contract.js +9 -10
- package/dest/public/avm/opcodes/control_flow.d.ts +1 -1
- package/dest/public/avm/opcodes/control_flow.d.ts.map +1 -1
- package/dest/public/avm/opcodes/control_flow.js +10 -8
- package/dest/public/avm/opcodes/conversion.d.ts +2 -1
- package/dest/public/avm/opcodes/conversion.d.ts.map +1 -1
- package/dest/public/avm/opcodes/conversion.js +267 -3
- package/dest/public/avm/opcodes/ec_add.d.ts +2 -2
- package/dest/public/avm/opcodes/ec_add.d.ts.map +1 -1
- package/dest/public/avm/opcodes/ec_add.js +6 -6
- package/dest/public/avm/opcodes/environment_getters.d.ts +3 -3
- package/dest/public/avm/opcodes/environment_getters.d.ts.map +1 -1
- package/dest/public/avm/opcodes/environment_getters.js +17 -19
- package/dest/public/avm/opcodes/external_calls.d.ts +9 -8
- package/dest/public/avm/opcodes/external_calls.d.ts.map +1 -1
- package/dest/public/avm/opcodes/external_calls.js +39 -34
- package/dest/public/avm/opcodes/hashing.d.ts +2 -2
- package/dest/public/avm/opcodes/hashing.d.ts.map +1 -1
- package/dest/public/avm/opcodes/hashing.js +6 -6
- package/dest/public/avm/opcodes/index.d.ts +1 -1
- package/dest/public/avm/opcodes/instruction.d.ts +15 -11
- package/dest/public/avm/opcodes/instruction.d.ts.map +1 -1
- package/dest/public/avm/opcodes/instruction.js +23 -19
- package/dest/public/avm/opcodes/instruction_impl.d.ts +1 -1
- package/dest/public/avm/opcodes/instruction_impl.d.ts.map +1 -1
- package/dest/public/avm/opcodes/memory.d.ts +6 -6
- package/dest/public/avm/opcodes/memory.d.ts.map +1 -1
- package/dest/public/avm/opcodes/memory.js +37 -33
- package/dest/public/avm/opcodes/misc.d.ts +3 -2
- package/dest/public/avm/opcodes/misc.d.ts.map +1 -1
- package/dest/public/avm/opcodes/misc.js +41 -16
- package/dest/public/avm/opcodes/storage.d.ts +3 -3
- package/dest/public/avm/opcodes/storage.d.ts.map +1 -1
- package/dest/public/avm/opcodes/storage.js +7 -5
- package/dest/public/avm/revert_reason.d.ts +18 -0
- package/dest/public/avm/revert_reason.d.ts.map +1 -0
- package/dest/public/avm/revert_reason.js +38 -0
- package/dest/public/avm/serialization/buffer_cursor.d.ts +1 -3
- package/dest/public/avm/serialization/buffer_cursor.d.ts.map +1 -1
- package/dest/public/avm/serialization/bytecode_serialization.d.ts +3 -7
- package/dest/public/avm/serialization/bytecode_serialization.d.ts.map +1 -1
- package/dest/public/avm/serialization/bytecode_serialization.js +70 -69
- package/dest/public/avm/serialization/instruction_serialization.d.ts +14 -5
- package/dest/public/avm/serialization/instruction_serialization.d.ts.map +1 -1
- package/dest/public/avm/serialization/instruction_serialization.js +70 -35
- package/dest/public/avm/test_utils.d.ts +11 -14
- package/dest/public/avm/test_utils.d.ts.map +1 -1
- package/dest/public/avm/test_utils.js +16 -24
- 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 +68 -0
- package/dest/public/db_interfaces.d.ts.map +1 -0
- package/dest/public/db_interfaces.js +3 -0
- package/dest/public/debug_fn_name.d.ts +5 -0
- package/dest/public/debug_fn_name.d.ts.map +1 -0
- package/dest/public/debug_fn_name.js +9 -0
- package/dest/public/executor_metrics.d.ts +12 -4
- package/dest/public/executor_metrics.d.ts.map +1 -1
- package/dest/public/executor_metrics.js +37 -6
- package/dest/public/executor_metrics_interface.d.ts +10 -0
- package/dest/public/executor_metrics_interface.d.ts.map +1 -0
- package/dest/public/executor_metrics_interface.js +1 -0
- package/dest/public/fixtures/amm_test.d.ts +10 -0
- package/dest/public/fixtures/amm_test.d.ts.map +1 -0
- package/dest/public/fixtures/amm_test.js +213 -0
- package/dest/public/fixtures/bulk_test.d.ts +6 -0
- package/dest/public/fixtures/bulk_test.d.ts.map +1 -0
- package/dest/public/fixtures/bulk_test.js +326 -0
- package/dest/public/fixtures/custom_bytecode_tester.d.ts +12 -0
- package/dest/public/fixtures/custom_bytecode_tester.d.ts.map +1 -0
- package/dest/public/fixtures/custom_bytecode_tester.js +29 -0
- package/dest/public/fixtures/custom_bytecode_tests.d.ts +9 -0
- package/dest/public/fixtures/custom_bytecode_tests.d.ts.map +1 -0
- package/dest/public/fixtures/custom_bytecode_tests.js +109 -0
- package/dest/public/fixtures/index.d.ts +8 -1
- package/dest/public/fixtures/index.d.ts.map +1 -1
- package/dest/public/fixtures/index.js +7 -0
- package/dest/public/fixtures/minimal_public_tx.d.ts +9 -0
- package/dest/public/fixtures/minimal_public_tx.d.ts.map +1 -0
- package/dest/public/fixtures/minimal_public_tx.js +29 -0
- package/dest/public/fixtures/public_tx_simulation_tester.d.ts +35 -14
- package/dest/public/fixtures/public_tx_simulation_tester.d.ts.map +1 -1
- package/dest/public/fixtures/public_tx_simulation_tester.js +100 -71
- package/dest/public/fixtures/simple_contract_data_source.d.ts +35 -0
- package/dest/public/fixtures/simple_contract_data_source.d.ts.map +1 -0
- package/dest/public/{avm/fixtures → fixtures}/simple_contract_data_source.js +31 -10
- package/dest/public/fixtures/token_test.d.ts +8 -0
- package/dest/public/fixtures/token_test.d.ts.map +1 -0
- package/dest/public/fixtures/token_test.js +94 -0
- package/dest/public/fixtures/utils.d.ts +17 -4
- package/dest/public/fixtures/utils.d.ts.map +1 -1
- package/dest/public/fixtures/utils.js +100 -58
- package/dest/public/hinting_db_sources.d.ts +78 -0
- package/dest/public/hinting_db_sources.d.ts.map +1 -0
- package/dest/public/hinting_db_sources.js +350 -0
- package/dest/public/index.d.ts +6 -9
- package/dest/public/index.d.ts.map +1 -1
- package/dest/public/index.js +4 -7
- package/dest/public/public_db_sources.d.ts +51 -101
- package/dest/public/public_db_sources.d.ts.map +1 -1
- package/dest/public/public_db_sources.js +219 -192
- 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 +49 -0
- package/dest/public/public_processor/guarded_merkle_tree.d.ts.map +1 -0
- package/dest/public/public_processor/guarded_merkle_tree.js +108 -0
- package/dest/public/public_processor/public_processor.d.ts +25 -37
- package/dest/public/public_processor/public_processor.d.ts.map +1 -1
- package/dest/public/public_processor/public_processor.js +154 -111
- package/dest/public/public_processor/public_processor_metrics.d.ts +3 -3
- package/dest/public/public_processor/public_processor_metrics.d.ts.map +1 -1
- package/dest/public/public_processor/public_processor_metrics.js +1 -1
- package/dest/public/public_tx_simulator/contract_provider_for_cpp.d.ts +30 -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 +133 -0
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator.d.ts +66 -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 +210 -0
- package/dest/public/public_tx_simulator/index.d.ts +5 -0
- package/dest/public/public_tx_simulator/index.d.ts.map +1 -0
- package/dest/public/public_tx_simulator/index.js +2 -0
- package/dest/public/public_tx_simulator/measured_public_tx_simulator.d.ts +31 -0
- package/dest/public/public_tx_simulator/measured_public_tx_simulator.d.ts.map +1 -0
- package/dest/public/public_tx_simulator/measured_public_tx_simulator.js +51 -0
- package/dest/public/public_tx_simulator/public_tx_context.d.ts +23 -30
- package/dest/public/public_tx_simulator/public_tx_context.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/public_tx_context.js +71 -91
- package/dest/public/public_tx_simulator/public_tx_simulator.d.ts +36 -58
- package/dest/public/public_tx_simulator/public_tx_simulator.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/public_tx_simulator.js +208 -206
- package/dest/public/public_tx_simulator/public_tx_simulator_interface.d.ts +9 -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 +21 -0
- package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.d.ts.map +1 -0
- package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.js +39 -0
- 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 +21 -67
- package/dest/public/side_effect_trace.d.ts.map +1 -1
- package/dest/public/side_effect_trace.js +71 -121
- package/dest/public/side_effect_trace_interface.d.ts +12 -24
- package/dest/public/side_effect_trace_interface.d.ts.map +1 -1
- package/dest/public/state_manager/index.d.ts +2 -0
- package/dest/public/state_manager/index.d.ts.map +1 -0
- package/dest/public/state_manager/index.js +1 -0
- package/dest/public/{avm/journal → state_manager}/nullifiers.d.ts +3 -6
- package/dest/public/state_manager/nullifiers.d.ts.map +1 -0
- package/dest/public/{avm/journal → state_manager}/nullifiers.js +3 -8
- package/dest/public/{avm/journal → state_manager}/public_storage.d.ts +3 -3
- package/dest/public/state_manager/public_storage.d.ts.map +1 -0
- package/dest/public/state_manager/state_manager.d.ts +159 -0
- package/dest/public/state_manager/state_manager.d.ts.map +1 -0
- package/dest/public/state_manager/state_manager.js +392 -0
- package/dest/public/test_executor_metrics.d.ts +55 -0
- package/dest/public/test_executor_metrics.d.ts.map +1 -0
- package/dest/public/test_executor_metrics.js +307 -0
- 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 +3 -5
- package/dest/public/utils.d.ts.map +1 -1
- package/dest/public/utils.js +4 -21
- package/dest/server.d.ts +7 -4
- package/dest/server.d.ts.map +1 -1
- package/dest/server.js +5 -2
- package/dest/testing.d.ts +2 -0
- package/dest/testing.d.ts.map +1 -0
- package/dest/testing.js +1 -0
- package/package.json +39 -33
- package/src/client.ts +5 -3
- package/src/common/errors.ts +79 -44
- package/src/common/index.ts +0 -1
- package/src/private/acvm/acvm.ts +17 -32
- package/src/private/acvm/acvm_types.ts +1 -1
- package/src/private/acvm/deserialize.ts +35 -29
- package/src/private/acvm/index.ts +0 -1
- package/src/private/acvm/serialize.ts +63 -0
- package/src/private/{providers/acvm_native.ts → acvm_native.ts} +47 -24
- package/src/private/acvm_wasm.ts +72 -0
- package/src/private/acvm_wasm_with_blobs.ts +54 -0
- package/src/private/circuit_recording/circuit_recorder.ts +260 -0
- package/src/private/circuit_recording/file_circuit_recorder.ts +158 -0
- package/src/private/circuit_recording/memory_circuit_recorder.ts +11 -0
- package/src/private/circuit_recording/simulator_recorder_wrapper.ts +91 -0
- package/src/private/circuit_simulator.ts +90 -0
- package/src/private/{providers/factory.ts → factory.ts} +6 -6
- package/src/public/avm/avm_context.ts +4 -4
- package/src/public/avm/avm_contract_call_result.ts +17 -5
- package/src/public/avm/avm_execution_environment.ts +8 -1
- package/src/public/avm/avm_gas.ts +23 -35
- package/src/public/avm/avm_machine_state.ts +5 -0
- package/src/public/avm/avm_memory_types.ts +19 -6
- package/src/public/avm/avm_simulator.ts +43 -54
- package/src/public/avm/avm_simulator_interface.ts +8 -0
- package/src/public/avm/errors.ts +8 -77
- package/src/public/avm/fixtures/avm_simulation_tester.ts +32 -21
- package/src/public/avm/fixtures/base_avm_simulation_tester.ts +45 -12
- package/src/public/avm/fixtures/initializers.ts +102 -0
- package/src/public/avm/fixtures/utils.ts +150 -0
- package/src/public/avm/index.ts +0 -2
- package/src/public/avm/opcodes/accrued_substate.ts +64 -29
- package/src/public/avm/opcodes/addressing_mode.ts +56 -32
- package/src/public/avm/opcodes/arithmetic.ts +24 -2
- package/src/public/avm/opcodes/bitwise.ts +33 -29
- package/src/public/avm/opcodes/comparators.ts +6 -3
- package/src/public/avm/opcodes/contract.ts +10 -7
- package/src/public/avm/opcodes/control_flow.ts +19 -10
- package/src/public/avm/opcodes/conversion.ts +27 -3
- package/src/public/avm/opcodes/ec_add.ts +9 -6
- package/src/public/avm/opcodes/environment_getters.ts +27 -22
- package/src/public/avm/opcodes/external_calls.ts +61 -29
- package/src/public/avm/opcodes/hashing.ts +28 -8
- package/src/public/avm/opcodes/instruction.ts +31 -21
- package/src/public/avm/opcodes/memory.ts +71 -32
- package/src/public/avm/opcodes/misc.ts +60 -18
- package/src/public/avm/opcodes/storage.ts +22 -6
- package/src/public/avm/revert_reason.ts +55 -0
- package/src/public/avm/serialization/buffer_cursor.ts +4 -1
- package/src/public/avm/serialization/bytecode_serialization.ts +72 -74
- package/src/public/avm/serialization/instruction_serialization.ts +75 -34
- package/src/public/avm/test_utils.ts +24 -41
- package/src/public/contracts_db_checkpoint.ts +41 -0
- package/src/public/db_interfaces.ts +76 -0
- package/src/{common → public}/debug_fn_name.ts +7 -7
- package/src/public/executor_metrics.ts +56 -6
- package/src/public/executor_metrics_interface.ts +15 -0
- package/src/public/fixtures/amm_test.ts +331 -0
- package/src/public/fixtures/bulk_test.ts +169 -0
- package/src/public/fixtures/custom_bytecode_tester.ts +49 -0
- package/src/public/fixtures/custom_bytecode_tests.ts +135 -0
- package/src/public/fixtures/index.ts +7 -0
- package/src/public/fixtures/minimal_public_tx.ts +35 -0
- package/src/public/fixtures/public_tx_simulation_tester.ts +166 -113
- package/src/public/{avm/fixtures → fixtures}/simple_contract_data_source.ts +36 -18
- package/src/public/fixtures/token_test.ts +139 -0
- package/src/public/fixtures/utils.ts +141 -68
- package/src/public/hinting_db_sources.ts +602 -0
- package/src/public/index.ts +5 -8
- package/src/public/public_db_sources.ts +278 -258
- package/src/public/public_errors.ts +14 -0
- package/src/public/public_processor/guarded_merkle_tree.ts +153 -0
- package/src/public/public_processor/public_processor.ts +212 -164
- package/src/public/public_processor/public_processor_metrics.ts +2 -2
- package/src/public/public_tx_simulator/contract_provider_for_cpp.ts +162 -0
- package/src/public/public_tx_simulator/cpp_public_tx_simulator.ts +306 -0
- package/src/public/public_tx_simulator/index.ts +4 -0
- package/src/public/public_tx_simulator/measured_public_tx_simulator.ts +105 -0
- package/src/public/public_tx_simulator/public_tx_context.ts +167 -194
- package/src/public/public_tx_simulator/public_tx_simulator.ts +292 -265
- package/src/public/public_tx_simulator/public_tx_simulator_interface.ts +10 -0
- package/src/public/public_tx_simulator/telemetry_public_tx_simulator.ts +63 -0
- package/src/public/side_effect_errors.ts +91 -1
- package/src/public/side_effect_trace.ts +94 -320
- package/src/public/side_effect_trace_interface.ts +10 -58
- package/src/public/state_manager/index.ts +1 -0
- package/src/public/{avm/journal → state_manager}/nullifiers.ts +5 -11
- package/src/public/{avm/journal → state_manager}/public_storage.ts +2 -2
- package/src/public/state_manager/state_manager.ts +553 -0
- package/src/public/test_executor_metrics.ts +397 -0
- package/src/public/utils.ts +5 -21
- package/src/server.ts +6 -3
- package/src/testing.ts +1 -0
- package/dest/common/db_interfaces.d.ts +0 -80
- package/dest/common/db_interfaces.d.ts.map +0 -1
- package/dest/common/db_interfaces.js +0 -1
- package/dest/common/debug_fn_name.d.ts +0 -5
- package/dest/common/debug_fn_name.d.ts.map +0 -1
- package/dest/common/debug_fn_name.js +0 -6
- package/dest/common/message_load_oracle_inputs.d.ts +0 -15
- package/dest/common/message_load_oracle_inputs.d.ts.map +0 -1
- package/dest/common/message_load_oracle_inputs.js +0 -15
- package/dest/private/acvm/oracle/index.d.ts +0 -14
- package/dest/private/acvm/oracle/index.d.ts.map +0 -1
- package/dest/private/acvm/oracle/index.js +0 -2
- package/dest/private/acvm/oracle/oracle.d.ts +0 -49
- package/dest/private/acvm/oracle/oracle.d.ts.map +0 -1
- package/dest/private/acvm/oracle/oracle.js +0 -263
- package/dest/private/acvm/oracle/typed_oracle.d.ts +0 -83
- package/dest/private/acvm/oracle/typed_oracle.d.ts.map +0 -1
- package/dest/private/acvm/oracle/typed_oracle.js +0 -132
- package/dest/private/execution_data_provider.d.ts +0 -261
- package/dest/private/execution_data_provider.d.ts.map +0 -1
- package/dest/private/execution_data_provider.js +0 -14
- package/dest/private/execution_note_cache.d.ts +0 -93
- package/dest/private/execution_note_cache.d.ts.map +0 -1
- package/dest/private/execution_note_cache.js +0 -180
- package/dest/private/hashed_values_cache.d.ts +0 -28
- package/dest/private/hashed_values_cache.d.ts.map +0 -1
- package/dest/private/hashed_values_cache.js +0 -46
- package/dest/private/index.d.ts +0 -13
- package/dest/private/index.d.ts.map +0 -1
- package/dest/private/index.js +0 -12
- package/dest/private/pick_notes.d.ts +0 -85
- package/dest/private/pick_notes.d.ts.map +0 -1
- package/dest/private/pick_notes.js +0 -51
- package/dest/private/private_execution.d.ts +0 -25
- package/dest/private/private_execution.d.ts.map +0 -1
- package/dest/private/private_execution.js +0 -92
- package/dest/private/private_execution_oracle.d.ts +0 -215
- package/dest/private/private_execution_oracle.d.ts.map +0 -1
- package/dest/private/private_execution_oracle.js +0 -382
- package/dest/private/providers/acvm_native.d.ts +0 -40
- package/dest/private/providers/acvm_native.d.ts.map +0 -1
- package/dest/private/providers/acvm_wasm.d.ts +0 -15
- package/dest/private/providers/acvm_wasm.d.ts.map +0 -1
- package/dest/private/providers/acvm_wasm_with_blobs.d.ts +0 -19
- package/dest/private/providers/acvm_wasm_with_blobs.d.ts.map +0 -1
- package/dest/private/providers/acvm_wasm_with_blobs.js +0 -32
- package/dest/private/providers/factory.d.ts +0 -12
- package/dest/private/providers/factory.d.ts.map +0 -1
- package/dest/private/providers/simulation_provider.d.ts +0 -19
- package/dest/private/providers/simulation_provider.d.ts.map +0 -1
- package/dest/private/providers/simulation_provider.js +0 -24
- package/dest/private/simulator.d.ts +0 -34
- package/dest/private/simulator.d.ts.map +0 -1
- package/dest/private/simulator.js +0 -76
- package/dest/private/unconstrained_execution.d.ts +0 -10
- package/dest/private/unconstrained_execution.d.ts.map +0 -1
- package/dest/private/unconstrained_execution.js +0 -27
- package/dest/private/unconstrained_execution_oracle.d.ts +0 -161
- package/dest/private/unconstrained_execution_oracle.d.ts.map +0 -1
- package/dest/private/unconstrained_execution_oracle.js +0 -258
- package/dest/public/avm/bytecode_utils.d.ts +0 -5
- package/dest/public/avm/bytecode_utils.d.ts.map +0 -1
- package/dest/public/avm/bytecode_utils.js +0 -17
- package/dest/public/avm/fixtures/index.d.ts +0 -84
- package/dest/public/avm/fixtures/index.d.ts.map +0 -1
- package/dest/public/avm/fixtures/index.js +0 -175
- package/dest/public/avm/fixtures/simple_contract_data_source.d.ts +0 -35
- package/dest/public/avm/fixtures/simple_contract_data_source.d.ts.map +0 -1
- package/dest/public/avm/journal/index.d.ts +0 -2
- package/dest/public/avm/journal/index.d.ts.map +0 -1
- package/dest/public/avm/journal/index.js +0 -1
- package/dest/public/avm/journal/journal.d.ts +0 -209
- package/dest/public/avm/journal/journal.d.ts.map +0 -1
- package/dest/public/avm/journal/journal.js +0 -486
- package/dest/public/avm/journal/nullifiers.d.ts.map +0 -1
- package/dest/public/avm/journal/public_storage.d.ts.map +0 -1
- 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/execution.d.ts +0 -108
- package/dest/public/execution.d.ts.map +0 -1
- package/dest/public/execution.js +0 -9
- 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/dest/test/utils.d.ts +0 -13
- package/dest/test/utils.d.ts.map +0 -1
- package/dest/test/utils.js +0 -22
- package/src/common/db_interfaces.ts +0 -94
- package/src/common/message_load_oracle_inputs.ts +0 -15
- package/src/private/acvm/oracle/index.ts +0 -16
- package/src/private/acvm/oracle/oracle.ts +0 -455
- package/src/private/acvm/oracle/typed_oracle.ts +0 -259
- package/src/private/execution_data_provider.ts +0 -323
- package/src/private/execution_note_cache.ts +0 -217
- package/src/private/hashed_values_cache.ts +0 -55
- package/src/private/index.ts +0 -16
- package/src/private/pick_notes.ts +0 -141
- package/src/private/private_execution.ts +0 -151
- package/src/private/private_execution_oracle.ts +0 -614
- package/src/private/providers/acvm_wasm.ts +0 -63
- package/src/private/providers/acvm_wasm_with_blobs.ts +0 -50
- package/src/private/providers/simulation_provider.ts +0 -45
- package/src/private/simulator.ts +0 -147
- package/src/private/unconstrained_execution.ts +0 -50
- package/src/private/unconstrained_execution_oracle.ts +0 -373
- package/src/public/avm/bytecode_utils.ts +0 -17
- package/src/public/avm/fixtures/index.ts +0 -296
- package/src/public/avm/journal/index.ts +0 -1
- package/src/public/avm/journal/journal.ts +0 -742
- package/src/public/avm/opcodes/.eslintrc.cjs +0 -8
- package/src/public/bytecode_errors.ts +0 -6
- package/src/public/execution.ts +0 -140
- package/src/public/tx_contract_cache.ts +0 -69
- package/src/test/utils.ts +0 -36
- /package/dest/public/{avm/journal → state_manager}/public_storage.js +0 -0
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
4
|
-
import { type ContractArtifact, type FunctionArtifact, FunctionSelector } from '@aztec/stdlib/abi';
|
|
5
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
|
-
import { type ContractClassPublic, type ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
7
|
-
import type { MerkleTreeWriteOperations } from '@aztec/stdlib/interfaces/server';
|
|
8
|
-
import { GlobalVariables } from '@aztec/stdlib/tx';
|
|
9
|
-
import type { WorldStateDB } from '../../public_db_sources.js';
|
|
10
|
-
import type { PublicSideEffectTraceInterface } from '../../side_effect_trace_interface.js';
|
|
11
|
-
import { AvmContext } from '../avm_context.js';
|
|
12
|
-
import { AvmExecutionEnvironment } from '../avm_execution_environment.js';
|
|
13
|
-
import { AvmMachineState } from '../avm_machine_state.js';
|
|
14
|
-
import { Field, Uint8, Uint32, Uint64 } from '../avm_memory_types.js';
|
|
15
|
-
import type { AvmRevertReason } from '../errors.js';
|
|
16
|
-
import { AvmPersistableStateManager } from '../journal/journal.js';
|
|
17
|
-
import { NullifierManager } from '../journal/nullifiers.js';
|
|
18
|
-
import { PublicStorage } from '../journal/public_storage.js';
|
|
19
|
-
export declare const PUBLIC_DISPATCH_FN_NAME = "public_dispatch";
|
|
20
|
-
/**
|
|
21
|
-
* Create a new AVM context with default values.
|
|
22
|
-
*/
|
|
23
|
-
export declare function initContext(overrides?: {
|
|
24
|
-
persistableState?: AvmPersistableStateManager;
|
|
25
|
-
env?: AvmExecutionEnvironment;
|
|
26
|
-
machineState?: AvmMachineState;
|
|
27
|
-
}): AvmContext;
|
|
28
|
-
/** Creates an empty state manager with mocked host storage. */
|
|
29
|
-
export declare function initPersistableStateManager(overrides?: {
|
|
30
|
-
worldStateDB?: WorldStateDB;
|
|
31
|
-
trace?: PublicSideEffectTraceInterface;
|
|
32
|
-
publicStorage?: PublicStorage;
|
|
33
|
-
nullifiers?: NullifierManager;
|
|
34
|
-
doMerkleOperations?: boolean;
|
|
35
|
-
db?: MerkleTreeWriteOperations;
|
|
36
|
-
firstNullifier?: Fr;
|
|
37
|
-
}): AvmPersistableStateManager;
|
|
38
|
-
/**
|
|
39
|
-
* Create an empty instance of the Execution Environment where all values are zero, unless overridden in the overrides object
|
|
40
|
-
*/
|
|
41
|
-
export declare function initExecutionEnvironment(overrides?: Partial<AvmExecutionEnvironment>): AvmExecutionEnvironment;
|
|
42
|
-
/**
|
|
43
|
-
* Create an empty instance of the Execution Environment where all values are zero, unless overridden in the overrides object
|
|
44
|
-
*/
|
|
45
|
-
export declare function initGlobalVariables(overrides?: Partial<GlobalVariables>): GlobalVariables;
|
|
46
|
-
/**
|
|
47
|
-
* Create an empty instance of the Machine State where all values are set to a large enough amount, unless overridden in the overrides object
|
|
48
|
-
*/
|
|
49
|
-
export declare function initMachineState(overrides?: Partial<AvmMachineState>): AvmMachineState;
|
|
50
|
-
/**
|
|
51
|
-
* Create a new object with all the same properties as the original, except for the ones in the overrides object.
|
|
52
|
-
*/
|
|
53
|
-
export declare function allSameExcept(original: any, overrides: any): any;
|
|
54
|
-
export declare function randomMemoryBytes(length: number): Uint8[];
|
|
55
|
-
export declare function randomMemoryUint32s(length: number): Uint32[];
|
|
56
|
-
export declare function randomMemoryUint64s(length: number): Uint64[];
|
|
57
|
-
export declare function randomMemoryFields(length: number): Field[];
|
|
58
|
-
export declare function getFunctionSelector(functionName: string, contractArtifact: ContractArtifact): Promise<FunctionSelector>;
|
|
59
|
-
export declare function getContractFunctionArtifact(functionName: string, contractArtifact: ContractArtifact): FunctionArtifact | undefined;
|
|
60
|
-
export declare function resolveContractAssertionMessage(functionName: string, revertReason: AvmRevertReason, output: Fr[], contractArtifact: ContractArtifact): string | undefined;
|
|
61
|
-
export declare function getAvmTestContractFunctionSelector(functionName: string): Promise<FunctionSelector>;
|
|
62
|
-
export declare function getAvmGadgetsTestContractFunctionSelector(functionName: string): Promise<FunctionSelector>;
|
|
63
|
-
export declare function getAvmTestContractArtifact(functionName: string): FunctionArtifact;
|
|
64
|
-
export declare function getAvmGadgetsTestContractArtifact(functionName: string): FunctionArtifact;
|
|
65
|
-
export declare function getAvmTestContractBytecode(functionName: string): Buffer;
|
|
66
|
-
export declare function getAvmGadgetsTestContractBytecode(functionName: string): Buffer;
|
|
67
|
-
export declare function resolveAvmTestContractAssertionMessage(functionName: string, revertReason: AvmRevertReason, output: Fr[]): string | undefined;
|
|
68
|
-
export declare function resolveAvmGadgetsTestContractAssertionMessage(functionName: string, revertReason: AvmRevertReason, output: Fr[]): string | undefined;
|
|
69
|
-
/**
|
|
70
|
-
* Create a contract class and instance given constructor args, artifact, etc.
|
|
71
|
-
* NOTE: This is useful for testing real-ish contract class registration and instance deployment TXs (via logs)
|
|
72
|
-
* @param constructorArgs - The constructor arguments for the contract.
|
|
73
|
-
* @param deployer - The deployer of the contract.
|
|
74
|
-
* @param contractArtifact - The contract artifact for the contract.
|
|
75
|
-
* @param seed - The seed for the contract.
|
|
76
|
-
* @param originalContractClassId - The original contract class ID (if upgraded)
|
|
77
|
-
* @returns The contract class, instance, and contract address nullifier.
|
|
78
|
-
*/
|
|
79
|
-
export declare function createContractClassAndInstance(constructorArgs: any[], deployer: AztecAddress, contractArtifact: ContractArtifact, seed?: number, originalContractClassId?: Fr): Promise<{
|
|
80
|
-
contractClass: ContractClassPublic;
|
|
81
|
-
contractInstance: ContractInstanceWithAddress;
|
|
82
|
-
contractAddressNullifier: Fr;
|
|
83
|
-
}>;
|
|
84
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/public/avm/fixtures/index.ts"],"names":[],"mappings":";;AAMA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAG9C,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACnG,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,2BAA2B,EAEjC,MAAM,wBAAwB,CAAC;AAIhC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAEjF,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAOnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;AAC3F,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB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EACpB,YAAY,EAAE,eAAe,EAC7B,MAAM,EAAE,EAAE,EAAE,GACX,MAAM,GAAG,SAAS,CAEpB;AAED,wBAAgB,6CAA6C,CAC3D,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,eAAe,EAC7B,MAAM,EAAE,EAAE,EAAE,GACX,MAAM,GAAG,SAAS,CAWpB;AAED;;;;;;;;;GASG;AACH,wBAAsB,8BAA8B,CAClD,eAAe,EAAE,GAAG,EAAE,EACtB,QAAQ,EAAE,YAAY,EACtB,gBAAgB,EAAE,gBAAgB,EAClC,IAAI,SAAI,EACR,uBAAuB,CAAC,EAAE,EAAE,GAC3B,OAAO,CAAC;IACT,aAAa,EAAE,mBAAmB,CAAC;IACnC,gBAAgB,EAAE,2BAA2B,CAAC;IAC9C,wBAAwB,EAAE,EAAE,CAAC;CAC9B,CAAC,CA2BD"}
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
import { DEPLOYER_CONTRACT_ADDRESS, MAX_L2_GAS_PER_TX_PUBLIC_PORTION, PUBLIC_DISPATCH_SELECTOR } from '@aztec/constants';
|
|
2
|
-
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
4
|
-
import { AvmGadgetsTestContractArtifact } from '@aztec/noir-contracts.js/AvmGadgetsTest';
|
|
5
|
-
import { AvmTestContractArtifact } from '@aztec/noir-contracts.js/AvmTest';
|
|
6
|
-
import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
7
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
8
|
-
import { computeInitializationHash } from '@aztec/stdlib/contract';
|
|
9
|
-
import { isNoirCallStackUnresolved } from '@aztec/stdlib/errors';
|
|
10
|
-
import { GasFees } from '@aztec/stdlib/gas';
|
|
11
|
-
import { siloNullifier } from '@aztec/stdlib/hash';
|
|
12
|
-
import { makeContractClassPublic, makeContractInstanceFromClassId } from '@aztec/stdlib/testing';
|
|
13
|
-
import { GlobalVariables } from '@aztec/stdlib/tx';
|
|
14
|
-
import { strict as assert } from 'assert';
|
|
15
|
-
import { mock } from 'jest-mock-extended';
|
|
16
|
-
import merge from 'lodash.merge';
|
|
17
|
-
import { resolveAssertionMessageFromRevertData, traverseCauseChain } from '../../../common/index.js';
|
|
18
|
-
import { AvmContext } from '../avm_context.js';
|
|
19
|
-
import { AvmExecutionEnvironment } from '../avm_execution_environment.js';
|
|
20
|
-
import { AvmMachineState } from '../avm_machine_state.js';
|
|
21
|
-
import { Field, Uint8, Uint32, Uint64 } from '../avm_memory_types.js';
|
|
22
|
-
import { AvmSimulator } from '../avm_simulator.js';
|
|
23
|
-
import { AvmPersistableStateManager } from '../journal/journal.js';
|
|
24
|
-
import { NullifierManager } from '../journal/nullifiers.js';
|
|
25
|
-
import { PublicStorage } from '../journal/public_storage.js';
|
|
26
|
-
export const PUBLIC_DISPATCH_FN_NAME = 'public_dispatch';
|
|
27
|
-
/**
|
|
28
|
-
* Create a new AVM context with default values.
|
|
29
|
-
*/ export function initContext(overrides) {
|
|
30
|
-
const ctx = new AvmContext(overrides?.persistableState || initPersistableStateManager(), overrides?.env || initExecutionEnvironment(), overrides?.machineState || initMachineState());
|
|
31
|
-
ctx.provideSimulator = AvmSimulator.build;
|
|
32
|
-
return ctx;
|
|
33
|
-
}
|
|
34
|
-
/** Creates an empty state manager with mocked host storage. */ export function initPersistableStateManager(overrides) {
|
|
35
|
-
const worldStateDB = overrides?.worldStateDB || mock();
|
|
36
|
-
return new AvmPersistableStateManager(worldStateDB, overrides?.trace || mock(), overrides?.publicStorage || new PublicStorage(worldStateDB), overrides?.nullifiers || new NullifierManager(worldStateDB), overrides?.doMerkleOperations || false, overrides?.db || mock(), overrides?.firstNullifier || new Fr(27));
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Create an empty instance of the Execution Environment where all values are zero, unless overridden in the overrides object
|
|
40
|
-
*/ export function initExecutionEnvironment(overrides) {
|
|
41
|
-
return new AvmExecutionEnvironment(overrides?.address ?? AztecAddress.zero(), overrides?.sender ?? AztecAddress.zero(), overrides?.contractCallDepth ?? Fr.zero(), overrides?.transactionFee ?? Fr.zero(), overrides?.globals ?? GlobalVariables.empty(), overrides?.isStaticCall ?? false, overrides?.calldata ?? []);
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Create an empty instance of the Execution Environment where all values are zero, unless overridden in the overrides object
|
|
45
|
-
*/ export function initGlobalVariables(overrides) {
|
|
46
|
-
return new GlobalVariables(overrides?.chainId ?? Fr.zero(), overrides?.version ?? Fr.zero(), overrides?.blockNumber ?? Fr.zero(), overrides?.slotNumber ?? Fr.zero(), overrides?.timestamp ?? Fr.zero(), overrides?.coinbase ?? EthAddress.ZERO, overrides?.feeRecipient ?? AztecAddress.zero(), overrides?.gasFees ?? GasFees.empty());
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Create an empty instance of the Machine State where all values are set to a large enough amount, unless overridden in the overrides object
|
|
50
|
-
*/ export function initMachineState(overrides) {
|
|
51
|
-
return AvmMachineState.fromState({
|
|
52
|
-
l2GasLeft: overrides?.l2GasLeft ?? MAX_L2_GAS_PER_TX_PUBLIC_PORTION,
|
|
53
|
-
daGasLeft: overrides?.daGasLeft ?? 1e8
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Create a new object with all the same properties as the original, except for the ones in the overrides object.
|
|
58
|
-
*/ export function allSameExcept(original, overrides) {
|
|
59
|
-
return merge({}, original, overrides);
|
|
60
|
-
}
|
|
61
|
-
export function randomMemoryBytes(length) {
|
|
62
|
-
return [
|
|
63
|
-
...Array(length)
|
|
64
|
-
].map((_)=>new Uint8(Math.floor(Math.random() * 255)));
|
|
65
|
-
}
|
|
66
|
-
export function randomMemoryUint32s(length) {
|
|
67
|
-
return [
|
|
68
|
-
...Array(length)
|
|
69
|
-
].map((_)=>new Uint32(Math.floor(Math.random() * 255)));
|
|
70
|
-
}
|
|
71
|
-
export function randomMemoryUint64s(length) {
|
|
72
|
-
return [
|
|
73
|
-
...Array(length)
|
|
74
|
-
].map((_)=>new Uint64(Math.floor(Math.random() * 255)));
|
|
75
|
-
}
|
|
76
|
-
export function randomMemoryFields(length) {
|
|
77
|
-
return [
|
|
78
|
-
...Array(length)
|
|
79
|
-
].map((_)=>new Field(Fr.random()));
|
|
80
|
-
}
|
|
81
|
-
export function getFunctionSelector(functionName, contractArtifact) {
|
|
82
|
-
const fnArtifact = contractArtifact.functions.find((f)=>f.name === functionName);
|
|
83
|
-
assert(!!fnArtifact, `Function ${functionName} not found in ${contractArtifact.name}`);
|
|
84
|
-
const params = fnArtifact.parameters;
|
|
85
|
-
return FunctionSelector.fromNameAndParameters(fnArtifact.name, params);
|
|
86
|
-
}
|
|
87
|
-
export function getContractFunctionArtifact(functionName, contractArtifact) {
|
|
88
|
-
const artifact = contractArtifact.functions.find((f)=>f.name === functionName);
|
|
89
|
-
if (!artifact) {
|
|
90
|
-
return undefined;
|
|
91
|
-
}
|
|
92
|
-
return artifact;
|
|
93
|
-
}
|
|
94
|
-
export function resolveContractAssertionMessage(functionName, revertReason, output, contractArtifact) {
|
|
95
|
-
traverseCauseChain(revertReason, (cause)=>{
|
|
96
|
-
revertReason = cause;
|
|
97
|
-
});
|
|
98
|
-
const functionArtifact = contractArtifact.functions.find((f)=>f.name === functionName);
|
|
99
|
-
if (!functionArtifact || !revertReason.noirCallStack || !isNoirCallStackUnresolved(revertReason.noirCallStack)) {
|
|
100
|
-
return undefined;
|
|
101
|
-
}
|
|
102
|
-
return resolveAssertionMessageFromRevertData(output, functionArtifact);
|
|
103
|
-
}
|
|
104
|
-
export function getAvmTestContractFunctionSelector(functionName) {
|
|
105
|
-
return getFunctionSelector(functionName, AvmTestContractArtifact);
|
|
106
|
-
}
|
|
107
|
-
export function getAvmGadgetsTestContractFunctionSelector(functionName) {
|
|
108
|
-
const artifact = AvmGadgetsTestContractArtifact.functions.find((f)=>f.name === functionName);
|
|
109
|
-
assert(!!artifact, `Function ${functionName} not found in AvmGadgetsTestContractArtifact`);
|
|
110
|
-
const params = artifact.parameters;
|
|
111
|
-
return FunctionSelector.fromNameAndParameters(artifact.name, params);
|
|
112
|
-
}
|
|
113
|
-
export function getAvmTestContractArtifact(functionName) {
|
|
114
|
-
const artifact = getContractFunctionArtifact(functionName, AvmTestContractArtifact);
|
|
115
|
-
assert(!!artifact?.bytecode, `No bytecode found for function ${functionName}. Try re-running bootstrap.sh on the repository root.`);
|
|
116
|
-
return artifact;
|
|
117
|
-
}
|
|
118
|
-
export function getAvmGadgetsTestContractArtifact(functionName) {
|
|
119
|
-
const artifact = AvmGadgetsTestContractArtifact.functions.find((f)=>f.name === functionName);
|
|
120
|
-
assert(!!artifact?.bytecode, `No bytecode found for function ${functionName}. Try re-running bootstrap.sh on the repository root.`);
|
|
121
|
-
return artifact;
|
|
122
|
-
}
|
|
123
|
-
export function getAvmTestContractBytecode(functionName) {
|
|
124
|
-
const artifact = getAvmTestContractArtifact(functionName);
|
|
125
|
-
return artifact.bytecode;
|
|
126
|
-
}
|
|
127
|
-
export function getAvmGadgetsTestContractBytecode(functionName) {
|
|
128
|
-
const artifact = getAvmGadgetsTestContractArtifact(functionName);
|
|
129
|
-
return artifact.bytecode;
|
|
130
|
-
}
|
|
131
|
-
export function resolveAvmTestContractAssertionMessage(functionName, revertReason, output) {
|
|
132
|
-
return resolveContractAssertionMessage(functionName, revertReason, output, AvmTestContractArtifact);
|
|
133
|
-
}
|
|
134
|
-
export function resolveAvmGadgetsTestContractAssertionMessage(functionName, revertReason, output) {
|
|
135
|
-
traverseCauseChain(revertReason, (cause)=>{
|
|
136
|
-
revertReason = cause;
|
|
137
|
-
});
|
|
138
|
-
const functionArtifact = AvmGadgetsTestContractArtifact.functions.find((f)=>f.name === functionName);
|
|
139
|
-
if (!functionArtifact || !revertReason.noirCallStack || !isNoirCallStackUnresolved(revertReason.noirCallStack)) {
|
|
140
|
-
return undefined;
|
|
141
|
-
}
|
|
142
|
-
return resolveAssertionMessageFromRevertData(output, functionArtifact);
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Create a contract class and instance given constructor args, artifact, etc.
|
|
146
|
-
* NOTE: This is useful for testing real-ish contract class registration and instance deployment TXs (via logs)
|
|
147
|
-
* @param constructorArgs - The constructor arguments for the contract.
|
|
148
|
-
* @param deployer - The deployer of the contract.
|
|
149
|
-
* @param contractArtifact - The contract artifact for the contract.
|
|
150
|
-
* @param seed - The seed for the contract.
|
|
151
|
-
* @param originalContractClassId - The original contract class ID (if upgraded)
|
|
152
|
-
* @returns The contract class, instance, and contract address nullifier.
|
|
153
|
-
*/ export async function createContractClassAndInstance(constructorArgs, deployer, contractArtifact, seed = 0, originalContractClassId) {
|
|
154
|
-
const bytecode = getContractFunctionArtifact(PUBLIC_DISPATCH_FN_NAME, contractArtifact).bytecode;
|
|
155
|
-
const contractClass = await makeContractClassPublic(seed, /*publicDispatchFunction=*/ {
|
|
156
|
-
bytecode,
|
|
157
|
-
selector: new FunctionSelector(PUBLIC_DISPATCH_SELECTOR)
|
|
158
|
-
});
|
|
159
|
-
const constructorAbi = getContractFunctionArtifact('constructor', contractArtifact);
|
|
160
|
-
const initializationHash = await computeInitializationHash(constructorAbi, constructorArgs);
|
|
161
|
-
const contractInstance = originalContractClassId === undefined ? await makeContractInstanceFromClassId(contractClass.id, seed, {
|
|
162
|
-
deployer,
|
|
163
|
-
initializationHash
|
|
164
|
-
}) : await makeContractInstanceFromClassId(originalContractClassId, seed, {
|
|
165
|
-
deployer,
|
|
166
|
-
initializationHash,
|
|
167
|
-
currentClassId: contractClass.id
|
|
168
|
-
});
|
|
169
|
-
const contractAddressNullifier = await siloNullifier(AztecAddress.fromNumber(DEPLOYER_CONTRACT_ADDRESS), contractInstance.address.toField());
|
|
170
|
-
return {
|
|
171
|
-
contractClass,
|
|
172
|
-
contractInstance,
|
|
173
|
-
contractAddressNullifier
|
|
174
|
-
};
|
|
175
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import { type ContractArtifact, FunctionSelector } from '@aztec/stdlib/abi';
|
|
3
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
-
import type { ContractClassPublic, ContractDataSource, ContractInstanceWithAddress, PublicFunction } from '@aztec/stdlib/contract';
|
|
5
|
-
/**
|
|
6
|
-
* This class is used during public/avm testing to function as a database of
|
|
7
|
-
* contract contract classes and instances. Tests can populate it with classes
|
|
8
|
-
* and instances and then probe it via the ContractDataSource interface.
|
|
9
|
-
*
|
|
10
|
-
* This class does not include any real merkle trees & merkle operations.
|
|
11
|
-
*/
|
|
12
|
-
export declare class SimpleContractDataSource implements ContractDataSource {
|
|
13
|
-
logger: import("@aztec/foundation/log").Logger;
|
|
14
|
-
private contractClasses;
|
|
15
|
-
private contractInstances;
|
|
16
|
-
private contractArtifacts;
|
|
17
|
-
/**
|
|
18
|
-
* Derive the contract class and instance with some seed.
|
|
19
|
-
* Add both to the contract data source along with the contract artifact.
|
|
20
|
-
*/
|
|
21
|
-
addNewContract(contractArtifact: ContractArtifact, contractClass: ContractClassPublic, contractInstance: ContractInstanceWithAddress): Promise<void>;
|
|
22
|
-
addContractArtifact(classId: Fr, artifact: ContractArtifact): void;
|
|
23
|
-
getPublicFunction(_address: AztecAddress, _selector: FunctionSelector): Promise<PublicFunction>;
|
|
24
|
-
getBlockNumber(): Promise<number>;
|
|
25
|
-
getContractClass(id: Fr): Promise<ContractClassPublic | undefined>;
|
|
26
|
-
getBytecodeCommitment(_id: Fr): Promise<Fr | undefined>;
|
|
27
|
-
getContract(address: AztecAddress): Promise<ContractInstanceWithAddress | undefined>;
|
|
28
|
-
getContractClassIds(): Promise<Fr[]>;
|
|
29
|
-
getContractArtifact(address: AztecAddress): Promise<ContractArtifact | undefined>;
|
|
30
|
-
getContractFunctionName(_address: AztecAddress, _selector: FunctionSelector): Promise<string>;
|
|
31
|
-
registerContractFunctionSignatures(_address: AztecAddress, _signatures: string[]): Promise<void>;
|
|
32
|
-
addContractClass(contractClass: ContractClassPublic): Promise<void>;
|
|
33
|
-
addContractInstance(contractInstance: ContractInstanceWithAddress): Promise<void>;
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=simple_contract_data_source.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"simple_contract_data_source.d.ts","sourceRoot":"","sources":["../../../../src/public/avm/fixtures/simple_contract_data_source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAEnD,OAAO,EAAE,KAAK,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EAClB,2BAA2B,EAC3B,cAAc,EACf,MAAM,wBAAwB,CAAC;AAIhC;;;;;;GAMG;AACH,qBAAa,wBAAyB,YAAW,kBAAkB;IAC1D,MAAM,yCAA+C;IAG5D,OAAO,CAAC,eAAe,CAA+C;IAEtE,OAAO,CAAC,iBAAiB,CAAuD;IAEhF,OAAO,CAAC,iBAAiB,CAA4C;IAIrE;;;OAGG;IACG,cAAc,CAClB,gBAAgB,EAAE,gBAAgB,EAClC,aAAa,EAAE,mBAAmB,EAClC,gBAAgB,EAAE,2BAA2B;IAO/C,mBAAmB,CAAC,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,gBAAgB,GAAG,IAAI;IAMlE,iBAAiB,CAAC,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC;IAI/F,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC;IAIjC,gBAAgB,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC;IAIlE,qBAAqB,CAAC,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,EAAE,GAAG,SAAS,CAAC;IAIvD,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,2BAA2B,GAAG,SAAS,CAAC;IAIpF,mBAAmB,IAAI,OAAO,CAAC,EAAE,EAAE,CAAC;IAI9B,mBAAmB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;IAWvF,uBAAuB,CAAC,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC;IAI7F,kCAAkC,CAAC,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAIhG,gBAAgB,CAAC,aAAa,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAKnE,mBAAmB,CAAC,gBAAgB,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC;CAIlF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/public/avm/journal/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './journal.js';
|
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
4
|
-
import type { IndexedTreeLeafPreimage } from '@aztec/foundation/trees';
|
|
5
|
-
import { AvmPublicDataReadTreeHint } from '@aztec/stdlib/avm';
|
|
6
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
7
|
-
import { SerializableContractInstance } from '@aztec/stdlib/contract';
|
|
8
|
-
import type { ContractClassWithCommitment } from '@aztec/stdlib/contract';
|
|
9
|
-
import type { IndexedTreeId, MerkleTreeWriteOperations } from '@aztec/stdlib/interfaces/server';
|
|
10
|
-
import type { PublicCallRequest } from '@aztec/stdlib/kernel';
|
|
11
|
-
import { PublicDataTreeLeafPreimage } from '@aztec/stdlib/trees';
|
|
12
|
-
import type { WorldStateDB } from '../../../public/public_db_sources.js';
|
|
13
|
-
import type { PublicSideEffectTraceInterface } from '../../side_effect_trace_interface.js';
|
|
14
|
-
import type { AvmExecutionEnvironment } from '../avm_execution_environment.js';
|
|
15
|
-
import { NullifierManager } from './nullifiers.js';
|
|
16
|
-
import { PublicStorage } from './public_storage.js';
|
|
17
|
-
/**
|
|
18
|
-
* The result of fetching a leaf from an indexed tree. Contains the preimage and wether the leaf was already present
|
|
19
|
-
* or it's a low leaf.
|
|
20
|
-
*/
|
|
21
|
-
type GetLeafResult<T extends IndexedTreeLeafPreimage> = {
|
|
22
|
-
preimage: T;
|
|
23
|
-
leafOrLowLeafIndex: bigint;
|
|
24
|
-
alreadyPresent: boolean;
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* A class to manage persistable AVM state for contract calls.
|
|
28
|
-
* Maintains a cache of the current world state,
|
|
29
|
-
* a trace of all side effects.
|
|
30
|
-
*
|
|
31
|
-
* The simulator should make any world state / tree queries through this object.
|
|
32
|
-
*
|
|
33
|
-
* Manages merging of successful/reverted child state into current state.
|
|
34
|
-
*/
|
|
35
|
-
export declare class AvmPersistableStateManager {
|
|
36
|
-
/** Reference to node storage */
|
|
37
|
-
private readonly worldStateDB;
|
|
38
|
-
/** Side effect trace */
|
|
39
|
-
readonly trace: PublicSideEffectTraceInterface;
|
|
40
|
-
/** Public storage, including cached writes */
|
|
41
|
-
private readonly publicStorage;
|
|
42
|
-
/** Nullifier set, including cached/recently-emitted nullifiers */
|
|
43
|
-
private readonly nullifiers;
|
|
44
|
-
private readonly doMerkleOperations;
|
|
45
|
-
/** DB interface for merkle tree operations */
|
|
46
|
-
db: MerkleTreeWriteOperations;
|
|
47
|
-
readonly firstNullifier: Fr;
|
|
48
|
-
private readonly log;
|
|
49
|
-
/** Make sure a forked state is never merged twice. */
|
|
50
|
-
private alreadyMergedIntoParent;
|
|
51
|
-
constructor(
|
|
52
|
-
/** Reference to node storage */
|
|
53
|
-
worldStateDB: WorldStateDB,
|
|
54
|
-
/** Side effect trace */
|
|
55
|
-
trace: PublicSideEffectTraceInterface,
|
|
56
|
-
/** Public storage, including cached writes */
|
|
57
|
-
publicStorage: PublicStorage,
|
|
58
|
-
/** Nullifier set, including cached/recently-emitted nullifiers */
|
|
59
|
-
nullifiers: NullifierManager, doMerkleOperations: boolean,
|
|
60
|
-
/** DB interface for merkle tree operations */
|
|
61
|
-
db: MerkleTreeWriteOperations, firstNullifier: Fr);
|
|
62
|
-
/**
|
|
63
|
-
* Create a new state manager
|
|
64
|
-
*/
|
|
65
|
-
static create(worldStateDB: WorldStateDB, trace: PublicSideEffectTraceInterface, doMerkleOperations: boolean | undefined, firstNullifier: Fr): AvmPersistableStateManager;
|
|
66
|
-
/**
|
|
67
|
-
* Create a new state manager forked from this one
|
|
68
|
-
*/
|
|
69
|
-
fork(): Promise<AvmPersistableStateManager>;
|
|
70
|
-
/**
|
|
71
|
-
* Accept forked world state modifications & traced side effects / hints
|
|
72
|
-
*/
|
|
73
|
-
merge(forkedState: AvmPersistableStateManager): Promise<void>;
|
|
74
|
-
/**
|
|
75
|
-
* Reject forked world state modifications & traced side effects, keep traced hints
|
|
76
|
-
*/
|
|
77
|
-
reject(forkedState: AvmPersistableStateManager): Promise<void>;
|
|
78
|
-
private _merge;
|
|
79
|
-
/**
|
|
80
|
-
* Write to public storage, journal/trace the write.
|
|
81
|
-
*
|
|
82
|
-
* @param contractAddress - the address of the contract whose storage is being written to
|
|
83
|
-
* @param slot - the slot in the contract's storage being written to
|
|
84
|
-
* @param value - the value being written to the slot
|
|
85
|
-
*/
|
|
86
|
-
writeStorage(contractAddress: AztecAddress, slot: Fr, value: Fr, protocolWrite?: boolean): Promise<void>;
|
|
87
|
-
/**
|
|
88
|
-
* Read from public storage, trace the read.
|
|
89
|
-
*
|
|
90
|
-
* @param contractAddress - the address of the contract whose storage is being read from
|
|
91
|
-
* @param slot - the slot in the contract's storage being read from
|
|
92
|
-
* @returns the latest value written to slot, or 0 if never written to before
|
|
93
|
-
*/
|
|
94
|
-
readStorage(contractAddress: AztecAddress, slot: Fr): Promise<Fr>;
|
|
95
|
-
getPublicDataMembership(contractAddress: AztecAddress, slot: Fr): Promise<{
|
|
96
|
-
value: Fr;
|
|
97
|
-
leafPreimage: PublicDataTreeLeafPreimage;
|
|
98
|
-
leafIndex: Fr;
|
|
99
|
-
leafPath: Fr[];
|
|
100
|
-
}>;
|
|
101
|
-
/**
|
|
102
|
-
* Read from public storage, don't trace the read.
|
|
103
|
-
*
|
|
104
|
-
* @param contractAddress - the address of the contract whose storage is being read from
|
|
105
|
-
* @param slot - the slot in the contract's storage being read from
|
|
106
|
-
* @returns the latest value written to slot, or 0 if never written to before
|
|
107
|
-
*/
|
|
108
|
-
peekStorage(contractAddress: AztecAddress, slot: Fr): Promise<Fr>;
|
|
109
|
-
/**
|
|
110
|
-
* Check if a note hash exists at the given leaf index, trace the check.
|
|
111
|
-
*
|
|
112
|
-
* @param contractAddress - the address of the contract whose storage is being read from
|
|
113
|
-
* @param noteHash - the unsiloed note hash being checked
|
|
114
|
-
* @param leafIndex - the leaf index being checked
|
|
115
|
-
* @returns true if the note hash exists at the given leaf index, false otherwise
|
|
116
|
-
*/
|
|
117
|
-
checkNoteHashExists(contractAddress: AztecAddress, noteHash: Fr, leafIndex: Fr): Promise<boolean>;
|
|
118
|
-
/**
|
|
119
|
-
* Write a raw note hash, silo it and make it unique, then trace the write.
|
|
120
|
-
* @param noteHash - the unsiloed note hash to write
|
|
121
|
-
*/
|
|
122
|
-
writeNoteHash(contractAddress: AztecAddress, noteHash: Fr): Promise<void>;
|
|
123
|
-
/**
|
|
124
|
-
* Write a note hash, make it unique, trace the write.
|
|
125
|
-
* @param siloedNoteHash - the non unique note hash to write
|
|
126
|
-
*/
|
|
127
|
-
writeSiloedNoteHash(siloedNoteHash: Fr): Promise<void>;
|
|
128
|
-
/**
|
|
129
|
-
* Write a note hash, trace the write.
|
|
130
|
-
* @param uniqueNoteHash - the siloed unique hash to write
|
|
131
|
-
*/
|
|
132
|
-
writeUniqueNoteHash(uniqueNoteHash: Fr): Promise<void>;
|
|
133
|
-
/**
|
|
134
|
-
* Check if a nullifier exists, trace the check.
|
|
135
|
-
* @param contractAddress - address of the contract that the nullifier is associated with
|
|
136
|
-
* @param nullifier - the unsiloed nullifier to check
|
|
137
|
-
* @returns exists - whether the nullifier exists in the nullifier set
|
|
138
|
-
*/
|
|
139
|
-
checkNullifierExists(contractAddress: AztecAddress, nullifier: Fr): Promise<boolean>;
|
|
140
|
-
/**
|
|
141
|
-
* Helper to get membership information for a siloed nullifier when checking its existence.
|
|
142
|
-
* Optionally trace the nullifier check.
|
|
143
|
-
*
|
|
144
|
-
* @param siloedNullifier - the siloed nullifier to get membership information for
|
|
145
|
-
* @returns
|
|
146
|
-
* - exists - whether the nullifier exists in the nullifier set
|
|
147
|
-
* - leafOrLowLeafPreimage - the preimage of the nullifier leaf or its low-leaf if it doesn't exist
|
|
148
|
-
* - leafOrLowLeafIndex - the leaf index of the nullifier leaf or its low-leaf if it doesn't exist
|
|
149
|
-
* - leafOrLowLeafPath - the sibling path of the nullifier leaf or its low-leaf if it doesn't exist
|
|
150
|
-
*/
|
|
151
|
-
private getNullifierMembership;
|
|
152
|
-
/**
|
|
153
|
-
* Write a nullifier to the nullifier set, trace the write.
|
|
154
|
-
* @param contractAddress - address of the contract that the nullifier is associated with
|
|
155
|
-
* @param nullifier - the unsiloed nullifier to write
|
|
156
|
-
*/
|
|
157
|
-
writeNullifier(contractAddress: AztecAddress, nullifier: Fr): Promise<void>;
|
|
158
|
-
/**
|
|
159
|
-
* Write a nullifier to the nullifier set, trace the write.
|
|
160
|
-
* @param siloedNullifier - the siloed nullifier to write
|
|
161
|
-
*/
|
|
162
|
-
writeSiloedNullifier(siloedNullifier: Fr): Promise<void>;
|
|
163
|
-
writeSiloedNullifiersFromPrivate(siloedNullifiers: Fr[]): Promise<void>;
|
|
164
|
-
/**
|
|
165
|
-
* Check if an L1 to L2 message exists, trace the check.
|
|
166
|
-
* @param msgHash - the message hash to check existence of
|
|
167
|
-
* @param msgLeafIndex - the message leaf index to use in the check
|
|
168
|
-
* @returns exists - whether the message exists in the L1 to L2 Messages tree
|
|
169
|
-
*/
|
|
170
|
-
checkL1ToL2MessageExists(contractAddress: AztecAddress, msgHash: Fr, msgLeafIndex: Fr): Promise<boolean>;
|
|
171
|
-
/**
|
|
172
|
-
* Write an L2 to L1 message.
|
|
173
|
-
* @param contractAddress - L2 contract address that created this message
|
|
174
|
-
* @param recipient - L1 contract address to send the message to.
|
|
175
|
-
* @param content - Message content.
|
|
176
|
-
*/
|
|
177
|
-
writeL2ToL1Message(contractAddress: AztecAddress, recipient: Fr, content: Fr): void;
|
|
178
|
-
/**
|
|
179
|
-
* Write a public log
|
|
180
|
-
* @param contractAddress - address of the contract that emitted the log
|
|
181
|
-
* @param log - log contents
|
|
182
|
-
*/
|
|
183
|
-
writePublicLog(contractAddress: AztecAddress, log: Fr[]): void;
|
|
184
|
-
/**
|
|
185
|
-
* Get a contract instance.
|
|
186
|
-
* @param contractAddress - address of the contract instance to retrieve.
|
|
187
|
-
* @returns the contract instance or undefined if it does not exist.
|
|
188
|
-
*/
|
|
189
|
-
getContractInstance(contractAddress: AztecAddress): Promise<SerializableContractInstance | undefined>;
|
|
190
|
-
/**
|
|
191
|
-
* Get a contract class.
|
|
192
|
-
* @param classId - class id to retrieve.
|
|
193
|
-
* @returns the contract class or undefined if it does not exist.
|
|
194
|
-
*/
|
|
195
|
-
getContractClass(classId: Fr): Promise<ContractClassWithCommitment | undefined>;
|
|
196
|
-
/**
|
|
197
|
-
* Get a contract's bytecode from the contracts DB, also trace the contract class and instance indirectly.
|
|
198
|
-
*/
|
|
199
|
-
getBytecode(contractAddress: AztecAddress): Promise<Buffer | undefined>;
|
|
200
|
-
getContractUpdateHints(contractAddress: AztecAddress): Promise<{
|
|
201
|
-
updateMembership: AvmPublicDataReadTreeHint;
|
|
202
|
-
updatePreimage: Fr[];
|
|
203
|
-
}>;
|
|
204
|
-
traceEnqueuedCall(publicCallRequest: PublicCallRequest, calldata: Fr[], reverted: boolean): void;
|
|
205
|
-
getPublicFunctionDebugName(avmEnvironment: AvmExecutionEnvironment): Promise<string>;
|
|
206
|
-
getLeafOrLowLeafInfo<ID extends IndexedTreeId, T extends IndexedTreeLeafPreimage>(treeId: ID, key: bigint): Promise<GetLeafResult<T>>;
|
|
207
|
-
}
|
|
208
|
-
export {};
|
|
209
|
-
//# sourceMappingURL=journal.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"journal.d.ts","sourceRoot":"","sources":["../../../../src/public/avm/journal/journal.ts"],"names":[],"mappings":";;AASA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAG9C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAEvE,OAAO,EAAE,yBAAyB,EAAmB,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAQ1E,OAAO,KAAK,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAChG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,OAAO,EAAuC,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAMtG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;AAC3F,OAAO,KAAK,EAAE,uBAAuB,EAAE,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