@aztec/simulator 0.0.0-test.0 → 0.0.1-commit.24de95ac
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 +5 -3
- package/dest/client.d.ts.map +1 -1
- package/dest/client.js +4 -2
- package/dest/common/errors.d.ts +4 -7
- package/dest/common/errors.d.ts.map +1 -1
- package/dest/common/errors.js +51 -32
- package/dest/common/index.d.ts +0 -1
- package/dest/common/index.d.ts.map +1 -1
- package/dest/common/index.js +0 -1
- package/dest/private/acvm/acvm.d.ts +11 -5
- 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 +1 -1
- package/dest/private/acvm/acvm_types.d.ts.map +1 -1
- package/dest/private/acvm/deserialize.d.ts +17 -18
- 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 +0 -1
- 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 +19 -2
- package/dest/private/acvm/serialize.d.ts.map +1 -1
- package/dest/private/acvm/serialize.js +53 -0
- package/dest/private/{providers/acvm_native.d.ts → acvm_native.d.ts} +9 -10
- 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 +5 -5
- package/dest/public/avm/avm_context.d.ts.map +1 -1
- package/dest/public/avm/avm_contract_call_result.d.ts +4 -2
- 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 +3 -1
- package/dest/public/avm/avm_execution_environment.d.ts.map +1 -1
- package/dest/public/avm/avm_execution_environment.js +7 -2
- package/dest/public/avm/avm_gas.d.ts +4 -20
- 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 +2 -0
- 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 +98 -87
- 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 +4 -5
- 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 +6 -30
- 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 +5 -4
- package/dest/public/avm/fixtures/avm_simulation_tester.d.ts.map +1 -1
- package/dest/public/avm/fixtures/avm_simulation_tester.js +12 -14
- package/dest/public/avm/fixtures/base_avm_simulation_tester.d.ts +6 -4
- 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 +43 -0
- package/dest/public/avm/fixtures/initializers.d.ts.map +1 -0
- package/dest/public/avm/fixtures/initializers.js +42 -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 +0 -2
- 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 +2 -2
- 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 +11 -7
- 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 +11 -1
- 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 +5 -13
- 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.map +1 -1
- package/dest/public/avm/opcodes/comparators.js +3 -3
- package/dest/public/avm/opcodes/contract.d.ts +1 -2
- 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.map +1 -1
- package/dest/public/avm/opcodes/control_flow.js +10 -8
- package/dest/public/avm/opcodes/conversion.d.ts +1 -0
- 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.map +1 -1
- package/dest/public/avm/opcodes/ec_add.js +6 -6
- package/dest/public/avm/opcodes/environment_getters.d.ts +2 -2
- 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 +8 -7
- 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.map +1 -1
- package/dest/public/avm/opcodes/hashing.js +6 -6
- package/dest/public/avm/opcodes/instruction.d.ts +14 -10
- 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/memory.d.ts +4 -4
- 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 +2 -1
- 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.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 +0 -2
- package/dest/public/avm/serialization/buffer_cursor.d.ts.map +1 -1
- package/dest/public/avm/serialization/bytecode_serialization.d.ts +2 -6
- 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 +13 -4
- 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 +10 -13
- package/dest/public/avm/test_utils.d.ts.map +1 -1
- package/dest/public/avm/test_utils.js +16 -24
- package/dest/public/db_interfaces.d.ts +56 -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 +10 -3
- 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 +9 -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 +7 -0
- 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 +10 -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 -13
- package/dest/public/fixtures/public_tx_simulation_tester.d.ts.map +1 -1
- package/dest/public/fixtures/public_tx_simulation_tester.js +96 -71
- package/dest/public/{avm/fixtures → fixtures}/simple_contract_data_source.d.ts +6 -6
- 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 +95 -0
- package/dest/public/fixtures/utils.d.ts +16 -3
- 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 +70 -0
- package/dest/public/hinting_db_sources.d.ts.map +1 -0
- package/dest/public/hinting_db_sources.js +297 -0
- package/dest/public/index.d.ts +4 -8
- package/dest/public/index.d.ts.map +1 -1
- package/dest/public/index.js +4 -7
- package/dest/public/public_db_sources.d.ts +30 -39
- package/dest/public/public_db_sources.d.ts.map +1 -1
- package/dest/public/public_db_sources.js +151 -67
- 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 -30
- package/dest/public/public_processor/public_processor.d.ts.map +1 -1
- package/dest/public/public_processor/public_processor.js +141 -96
- package/dest/public/public_processor/public_processor_metrics.d.ts +2 -2
- package/dest/public/public_processor/public_processor_metrics.d.ts.map +1 -1
- package/dest/public/public_processor/public_processor_metrics.js +1 -1
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator.d.ts +41 -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 +89 -0
- package/dest/public/public_tx_simulator/index.d.ts +4 -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 +24 -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 +19 -29
- package/dest/public/public_tx_simulator/public_tx_context.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/public_tx_context.js +63 -91
- package/dest/public/public_tx_simulator/public_tx_simulator.d.ts +45 -47
- package/dest/public/public_tx_simulator/public_tx_simulator.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/public_tx_simulator.js +209 -184
- 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 +41 -1
- 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 +20 -65
- 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 +11 -22
- 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 +2 -5
- 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 +2 -2
- package/dest/public/state_manager/public_storage.d.ts.map +1 -0
- package/dest/public/{avm/journal/journal.d.ts → state_manager/state_manager.d.ts} +42 -85
- package/dest/public/state_manager/state_manager.d.ts.map +1 -0
- package/dest/public/state_manager/state_manager.js +391 -0
- package/dest/public/test_executor_metrics.d.ts +54 -0
- package/dest/public/test_executor_metrics.d.ts.map +1 -0
- package/dest/public/test_executor_metrics.js +306 -0
- package/dest/public/unique_class_ids.d.ts.map +1 -1
- package/dest/public/utils.d.ts +2 -4
- package/dest/public/utils.d.ts.map +1 -1
- package/dest/public/utils.js +4 -21
- package/dest/server.d.ts +6 -3
- 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 +36 -31
- 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 +10 -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 +44 -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 +23 -20
- package/src/public/avm/fixtures/base_avm_simulation_tester.ts +45 -12
- package/src/public/avm/fixtures/initializers.ts +104 -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/db_interfaces.ts +61 -0
- package/src/{common → public}/debug_fn_name.ts +7 -7
- package/src/public/executor_metrics.ts +55 -6
- package/src/public/executor_metrics_interface.ts +14 -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 +36 -0
- package/src/public/fixtures/public_tx_simulation_tester.ts +158 -113
- package/src/public/{avm/fixtures → fixtures}/simple_contract_data_source.ts +36 -18
- package/src/public/fixtures/token_test.ts +140 -0
- package/src/public/fixtures/utils.ts +141 -68
- package/src/public/hinting_db_sources.ts +505 -0
- package/src/public/index.ts +9 -8
- package/src/public/public_db_sources.ts +196 -97
- 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 +191 -153
- package/src/public/public_processor/public_processor_metrics.ts +2 -2
- package/src/public/public_tx_simulator/cpp_public_tx_simulator.ts +128 -0
- package/src/public/public_tx_simulator/index.ts +3 -0
- package/src/public/public_tx_simulator/measured_public_tx_simulator.ts +109 -0
- package/src/public/public_tx_simulator/public_tx_context.ts +160 -193
- package/src/public/public_tx_simulator/public_tx_simulator.ts +294 -220
- package/src/public/public_tx_simulator/public_tx_simulator_interface.ts +11 -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 +560 -0
- package/src/public/test_executor_metrics.ts +395 -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.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.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.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/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/test/utils.ts +0 -36
- /package/dest/public/{avm/journal → state_manager}/public_storage.js +0 -0
package/dest/test/utils.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/test/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAW,aAAa,EAAW,MAAM,yBAAyB,CAAC;AAE1E;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,aACnB,MAAM,mBACC,EAAE,EAAE,kBACL,YAAY,UACpB,EAAE,YACA,EAAE,GAAG,MAAM,2BAetB,CAAC"}
|
package/dest/test/utils.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { sha256ToField } from '@aztec/foundation/crypto';
|
|
2
|
-
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
4
|
-
import { computeSecretHash } from '@aztec/stdlib/hash';
|
|
5
|
-
import { L1Actor, L1ToL2Message, L2Actor } from '@aztec/stdlib/messaging';
|
|
6
|
-
/**
|
|
7
|
-
* Test utility function to craft an L1 to L2 message.
|
|
8
|
-
* @param selector - The cross chain message selector.
|
|
9
|
-
* @param contentPreimage - The args after the selector.
|
|
10
|
-
* @param targetContract - The contract to consume the message.
|
|
11
|
-
* @param secret - The secret to unlock the message.
|
|
12
|
-
* @returns The L1 to L2 message.
|
|
13
|
-
*/ export const buildL1ToL2Message = async (selector, contentPreimage, targetContract, secret, msgIndex)=>{
|
|
14
|
-
// Write the selector into a buffer.
|
|
15
|
-
const selectorBuf = Buffer.from(selector, 'hex');
|
|
16
|
-
const content = sha256ToField([
|
|
17
|
-
selectorBuf,
|
|
18
|
-
...contentPreimage
|
|
19
|
-
]);
|
|
20
|
-
const secretHash = await computeSecretHash(secret);
|
|
21
|
-
return new L1ToL2Message(new L1Actor(EthAddress.random(), 1), new L2Actor(targetContract, 1), content, secretHash, new Fr(msgIndex));
|
|
22
|
-
};
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import type { L1_TO_L2_MSG_TREE_HEIGHT } from '@aztec/constants';
|
|
2
|
-
import type { Fr } from '@aztec/foundation/fields';
|
|
3
|
-
import type { FunctionSelector } from '@aztec/stdlib/abi';
|
|
4
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
-
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
6
|
-
import type { NullifierMembershipWitness } from '@aztec/stdlib/trees';
|
|
7
|
-
|
|
8
|
-
import type { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Database interface for providing access to public state.
|
|
12
|
-
*/
|
|
13
|
-
export interface PublicStateDB {
|
|
14
|
-
/**
|
|
15
|
-
* Reads a value from public storage, returning zero if none.
|
|
16
|
-
* @param contract - Owner of the storage.
|
|
17
|
-
* @param slot - Slot to read in the contract storage.
|
|
18
|
-
* @returns The current value in the storage slot.
|
|
19
|
-
*/
|
|
20
|
-
storageRead(contract: AztecAddress, slot: Fr): Promise<Fr>;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Records a write to public storage.
|
|
24
|
-
* @param contract - Owner of the storage.
|
|
25
|
-
* @param slot - Slot to read in the contract storage.
|
|
26
|
-
* @param newValue - The new value to store.
|
|
27
|
-
*/
|
|
28
|
-
storageWrite(contract: AztecAddress, slot: Fr, newValue: Fr): Promise<void>;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Database interface for providing access to public contract data.
|
|
33
|
-
*/
|
|
34
|
-
export interface PublicContractsDB {
|
|
35
|
-
/**
|
|
36
|
-
* Returns a publicly deployed contract instance.
|
|
37
|
-
* @param address - Address of the contract.
|
|
38
|
-
* @returns The contract instance or undefined if not found.
|
|
39
|
-
*/
|
|
40
|
-
getContractInstance(address: AztecAddress): Promise<ContractInstanceWithAddress | undefined>;
|
|
41
|
-
|
|
42
|
-
getDebugFunctionName(contractAddress: AztecAddress, selector: FunctionSelector): Promise<string | undefined>;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/** Database interface for providing access to commitment tree, l1 to l2 message tree, and nullifier tree. */
|
|
46
|
-
export interface CommitmentsDB {
|
|
47
|
-
/**
|
|
48
|
-
* Fetches a message from the db, given its key.
|
|
49
|
-
* @param contractAddress - Address of a contract by which the message was emitted.
|
|
50
|
-
* @param messageHash - Hash of the message.
|
|
51
|
-
* @param secret - Secret used to compute a nullifier.
|
|
52
|
-
* @dev Contract address and secret are only used to compute the nullifier to get non-nullified messages
|
|
53
|
-
* @returns The l1 to l2 membership witness (index of message in the tree and sibling path).
|
|
54
|
-
*/
|
|
55
|
-
getL1ToL2MembershipWitness(
|
|
56
|
-
contractAddress: AztecAddress,
|
|
57
|
-
messageHash: Fr,
|
|
58
|
-
secret: Fr,
|
|
59
|
-
): Promise<MessageLoadOracleInputs<typeof L1_TO_L2_MSG_TREE_HEIGHT>>;
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* @param leafIndex the leaf to look up
|
|
63
|
-
* @returns The l1 to l2 leaf value or undefined if not found.
|
|
64
|
-
*/
|
|
65
|
-
getL1ToL2LeafValue(leafIndex: bigint): Promise<Fr | undefined>;
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Gets the index of a commitment in the note hash tree.
|
|
69
|
-
* @param commitment - The commitment.
|
|
70
|
-
* @returns - The index of the commitment. Undefined if it does not exist in the tree.
|
|
71
|
-
*/
|
|
72
|
-
getCommitmentIndex(commitment: Fr): Promise<bigint | undefined>;
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Gets commitment in the note hash tree given a leaf index.
|
|
76
|
-
* @param leafIndex - the leaf to look up.
|
|
77
|
-
* @returns - The commitment at that index. Undefined if leaf index is not found.
|
|
78
|
-
*/
|
|
79
|
-
getCommitmentValue(leafIndex: bigint): Promise<Fr | undefined>;
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Gets the index of a nullifier in the nullifier tree.
|
|
83
|
-
* @param nullifier - The nullifier.
|
|
84
|
-
* @returns - The index of the nullifier. Undefined if it does not exist in the tree.
|
|
85
|
-
*/
|
|
86
|
-
getNullifierIndex(nullifier: Fr): Promise<bigint | undefined>;
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Returns a nullifier membership witness for the given nullifier or undefined if not found.
|
|
90
|
-
* REFACTOR: Same as getL1ToL2MembershipWitness, can be combined with aztec-node method that does almost the same thing.
|
|
91
|
-
* @param nullifier - Nullifier we're looking for.
|
|
92
|
-
*/
|
|
93
|
-
getNullifierMembershipWitnessAtLatestBlock(nullifier: Fr): Promise<NullifierMembershipWitness | undefined>;
|
|
94
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import type { SiblingPath } from '@aztec/foundation/trees';
|
|
3
|
-
|
|
4
|
-
export class MessageLoadOracleInputs<N extends number> {
|
|
5
|
-
constructor(
|
|
6
|
-
/** The index of the message commitment in the merkle tree. */
|
|
7
|
-
public index: bigint,
|
|
8
|
-
/** The path in the merkle tree to the message. */
|
|
9
|
-
public siblingPath: SiblingPath<N>,
|
|
10
|
-
) {}
|
|
11
|
-
|
|
12
|
-
toFields(): Fr[] {
|
|
13
|
-
return [new Fr(this.index), ...this.siblingPath.toFields()];
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { Oracle } from './oracle.js';
|
|
2
|
-
|
|
3
|
-
export * from './oracle.js';
|
|
4
|
-
export * from './typed_oracle.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* A conditional type that takes a type `T` and returns a union of its method names.
|
|
8
|
-
*/
|
|
9
|
-
type MethodNames<T> = {
|
|
10
|
-
[K in keyof T]: T[K] extends (...args: any[]) => any ? K : never;
|
|
11
|
-
}[keyof T];
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Available oracle function names.
|
|
15
|
-
*/
|
|
16
|
-
export type ORACLE_NAMES = MethodNames<Oracle>;
|
|
@@ -1,455 +0,0 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import { FunctionSelector, NoteSelector } from '@aztec/stdlib/abi';
|
|
3
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
-
import { ContractClassLog, LogWithTxData } from '@aztec/stdlib/logs';
|
|
5
|
-
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
6
|
-
|
|
7
|
-
import type { ACVMField } from '../acvm_types.js';
|
|
8
|
-
import { frToBoolean, frToNumber, fromACVMField, fromBoundedVec } from '../deserialize.js';
|
|
9
|
-
import { toACVMField, toACVMFieldSingleOrArray } from '../serialize.js';
|
|
10
|
-
import type { TypedOracle } from './typed_oracle.js';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* A data source that has all the apis required by Aztec.nr.
|
|
14
|
-
*/
|
|
15
|
-
export class Oracle {
|
|
16
|
-
constructor(private typedOracle: TypedOracle) {}
|
|
17
|
-
|
|
18
|
-
getRandomField(): ACVMField {
|
|
19
|
-
const val = this.typedOracle.getRandomField();
|
|
20
|
-
return toACVMField(val);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// Since the argument is a slice, noir automatically adds a length field to oracle call.
|
|
24
|
-
async storeInExecutionCache(_length: ACVMField[], values: ACVMField[]): Promise<ACVMField> {
|
|
25
|
-
const hash = await this.typedOracle.storeInExecutionCache(values.map(fromACVMField));
|
|
26
|
-
return toACVMField(hash);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
async loadFromExecutionCache([returnsHash]: ACVMField[]): Promise<ACVMField[]> {
|
|
30
|
-
const values = await this.typedOracle.loadFromExecutionCache(fromACVMField(returnsHash));
|
|
31
|
-
return values.map(toACVMField);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
async getBlockNumber(): Promise<ACVMField> {
|
|
35
|
-
return toACVMField(await this.typedOracle.getBlockNumber());
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
async getContractAddress(): Promise<ACVMField> {
|
|
39
|
-
return toACVMField(await this.typedOracle.getContractAddress());
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
async getVersion(): Promise<ACVMField> {
|
|
43
|
-
return toACVMField(await this.typedOracle.getVersion());
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
async getChainId(): Promise<ACVMField> {
|
|
47
|
-
return toACVMField(await this.typedOracle.getChainId());
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
async getKeyValidationRequest([pkMHash]: ACVMField[]): Promise<ACVMField[]> {
|
|
51
|
-
const { pkM, skApp } = await this.typedOracle.getKeyValidationRequest(fromACVMField(pkMHash));
|
|
52
|
-
|
|
53
|
-
return [toACVMField(pkM.x), toACVMField(pkM.y), toACVMField(pkM.isInfinite), toACVMField(skApp)];
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
async getContractInstance([address]: ACVMField[]) {
|
|
57
|
-
const instance = await this.typedOracle.getContractInstance(AztecAddress.fromField(fromACVMField(address)));
|
|
58
|
-
|
|
59
|
-
return [
|
|
60
|
-
instance.salt,
|
|
61
|
-
instance.deployer,
|
|
62
|
-
instance.currentContractClassId,
|
|
63
|
-
instance.initializationHash,
|
|
64
|
-
...instance.publicKeys.toFields(),
|
|
65
|
-
].map(toACVMField);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
async getMembershipWitness(
|
|
69
|
-
[blockNumber]: ACVMField[],
|
|
70
|
-
[treeId]: ACVMField[],
|
|
71
|
-
[leafValue]: ACVMField[],
|
|
72
|
-
): Promise<ACVMField[]> {
|
|
73
|
-
const parsedBlockNumber = frToNumber(fromACVMField(blockNumber));
|
|
74
|
-
const parsedTreeId = frToNumber(fromACVMField(treeId));
|
|
75
|
-
const parsedLeafValue = fromACVMField(leafValue);
|
|
76
|
-
|
|
77
|
-
const witness = await this.typedOracle.getMembershipWitness(parsedBlockNumber, parsedTreeId, parsedLeafValue);
|
|
78
|
-
if (!witness) {
|
|
79
|
-
throw new Error(
|
|
80
|
-
`Leaf ${leafValue} not found in the tree ${MerkleTreeId[parsedTreeId]} at block ${parsedBlockNumber}.`,
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
return witness.map(toACVMField);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
async getNullifierMembershipWitness(
|
|
87
|
-
[blockNumber]: ACVMField[],
|
|
88
|
-
[nullifier]: ACVMField[], // nullifier, we try to find the witness for (to prove inclusion)
|
|
89
|
-
): Promise<ACVMField[]> {
|
|
90
|
-
const parsedBlockNumber = frToNumber(fromACVMField(blockNumber));
|
|
91
|
-
const parsedNullifier = fromACVMField(nullifier);
|
|
92
|
-
|
|
93
|
-
const witness = await this.typedOracle.getNullifierMembershipWitness(parsedBlockNumber, parsedNullifier);
|
|
94
|
-
if (!witness) {
|
|
95
|
-
throw new Error(`Nullifier witness not found for nullifier ${parsedNullifier} at block ${parsedBlockNumber}.`);
|
|
96
|
-
}
|
|
97
|
-
return witness.toFields().map(toACVMField);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
async getLowNullifierMembershipWitness(
|
|
101
|
-
[blockNumber]: ACVMField[],
|
|
102
|
-
[nullifier]: ACVMField[], // nullifier, we try to find the low nullifier witness for (to prove non-inclusion)
|
|
103
|
-
): Promise<ACVMField[]> {
|
|
104
|
-
const parsedBlockNumber = frToNumber(fromACVMField(blockNumber));
|
|
105
|
-
const parsedNullifier = fromACVMField(nullifier);
|
|
106
|
-
|
|
107
|
-
const witness = await this.typedOracle.getLowNullifierMembershipWitness(parsedBlockNumber, parsedNullifier);
|
|
108
|
-
if (!witness) {
|
|
109
|
-
throw new Error(
|
|
110
|
-
`Low nullifier witness not found for nullifier ${parsedNullifier} at block ${parsedBlockNumber}.`,
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
return witness.toFields().map(toACVMField);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
async getPublicDataTreeWitness([blockNumber]: ACVMField[], [leafSlot]: ACVMField[]): Promise<ACVMField[]> {
|
|
117
|
-
const parsedBlockNumber = frToNumber(fromACVMField(blockNumber));
|
|
118
|
-
const parsedLeafSlot = fromACVMField(leafSlot);
|
|
119
|
-
|
|
120
|
-
const witness = await this.typedOracle.getPublicDataTreeWitness(parsedBlockNumber, parsedLeafSlot);
|
|
121
|
-
if (!witness) {
|
|
122
|
-
throw new Error(`Public data witness not found for slot ${parsedLeafSlot} at block ${parsedBlockNumber}.`);
|
|
123
|
-
}
|
|
124
|
-
return witness.toFields().map(toACVMField);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
async getBlockHeader([blockNumber]: ACVMField[]): Promise<ACVMField[]> {
|
|
128
|
-
const parsedBlockNumber = frToNumber(fromACVMField(blockNumber));
|
|
129
|
-
|
|
130
|
-
const header = await this.typedOracle.getBlockHeader(parsedBlockNumber);
|
|
131
|
-
if (!header) {
|
|
132
|
-
throw new Error(`Block header not found for block ${parsedBlockNumber}.`);
|
|
133
|
-
}
|
|
134
|
-
return header.toFields().map(toACVMField);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
async getAuthWitness([messageHash]: ACVMField[]): Promise<ACVMField[]> {
|
|
138
|
-
const messageHashField = fromACVMField(messageHash);
|
|
139
|
-
const witness = await this.typedOracle.getAuthWitness(messageHashField);
|
|
140
|
-
if (!witness) {
|
|
141
|
-
throw new Error(`Unknown auth witness for message hash ${messageHashField}`);
|
|
142
|
-
}
|
|
143
|
-
return witness.map(toACVMField);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
async getPublicKeysAndPartialAddress([address]: ACVMField[]): Promise<ACVMField[]> {
|
|
147
|
-
const parsedAddress = AztecAddress.fromField(fromACVMField(address));
|
|
148
|
-
const { publicKeys, partialAddress } = await this.typedOracle.getCompleteAddress(parsedAddress);
|
|
149
|
-
|
|
150
|
-
return [...publicKeys.toFields(), partialAddress].map(toACVMField);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
async getNotes(
|
|
154
|
-
[storageSlot]: ACVMField[],
|
|
155
|
-
[numSelects]: ACVMField[],
|
|
156
|
-
selectByIndexes: ACVMField[],
|
|
157
|
-
selectByOffsets: ACVMField[],
|
|
158
|
-
selectByLengths: ACVMField[],
|
|
159
|
-
selectValues: ACVMField[],
|
|
160
|
-
selectComparators: ACVMField[],
|
|
161
|
-
sortByIndexes: ACVMField[],
|
|
162
|
-
sortByOffsets: ACVMField[],
|
|
163
|
-
sortByLengths: ACVMField[],
|
|
164
|
-
sortOrder: ACVMField[],
|
|
165
|
-
[limit]: ACVMField[],
|
|
166
|
-
[offset]: ACVMField[],
|
|
167
|
-
[status]: ACVMField[],
|
|
168
|
-
[returnSize]: ACVMField[],
|
|
169
|
-
): Promise<ACVMField[]> {
|
|
170
|
-
const noteDatas = await this.typedOracle.getNotes(
|
|
171
|
-
fromACVMField(storageSlot),
|
|
172
|
-
+numSelects,
|
|
173
|
-
selectByIndexes.map(s => +s),
|
|
174
|
-
selectByOffsets.map(s => +s),
|
|
175
|
-
selectByLengths.map(s => +s),
|
|
176
|
-
selectValues.map(fromACVMField),
|
|
177
|
-
selectComparators.map(s => +s),
|
|
178
|
-
sortByIndexes.map(s => +s),
|
|
179
|
-
sortByOffsets.map(s => +s),
|
|
180
|
-
sortByLengths.map(s => +s),
|
|
181
|
-
sortOrder.map(s => +s),
|
|
182
|
-
+limit,
|
|
183
|
-
+offset,
|
|
184
|
-
+status,
|
|
185
|
-
);
|
|
186
|
-
|
|
187
|
-
const noteLength = noteDatas?.[0]?.note.items.length ?? 0;
|
|
188
|
-
if (!noteDatas.every(({ note }) => noteLength === note.items.length)) {
|
|
189
|
-
throw new Error('Notes should all be the same length.');
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
const contractAddress = noteDatas[0]?.contractAddress ?? Fr.ZERO;
|
|
193
|
-
|
|
194
|
-
// Values indicates whether the note is settled or transient.
|
|
195
|
-
const noteTypes = {
|
|
196
|
-
isSettled: new Fr(0),
|
|
197
|
-
isTransient: new Fr(1),
|
|
198
|
-
};
|
|
199
|
-
const flattenData = noteDatas.flatMap(({ nonce, note, index }) => [
|
|
200
|
-
nonce,
|
|
201
|
-
index === undefined ? noteTypes.isTransient : noteTypes.isSettled,
|
|
202
|
-
...note.items,
|
|
203
|
-
]);
|
|
204
|
-
|
|
205
|
-
const returnFieldSize = +returnSize;
|
|
206
|
-
const returnData = [noteDatas.length, contractAddress, ...flattenData].map(v => toACVMField(v));
|
|
207
|
-
if (returnData.length > returnFieldSize) {
|
|
208
|
-
throw new Error(`Return data size too big. Maximum ${returnFieldSize} fields. Got ${flattenData.length}.`);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
const paddedZeros = Array(returnFieldSize - returnData.length).fill(toACVMField(0));
|
|
212
|
-
return returnData.concat(paddedZeros);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
notifyCreatedNote(
|
|
216
|
-
[storageSlot]: ACVMField[],
|
|
217
|
-
[noteTypeId]: ACVMField[],
|
|
218
|
-
note: ACVMField[],
|
|
219
|
-
[noteHash]: ACVMField[],
|
|
220
|
-
[counter]: ACVMField[],
|
|
221
|
-
): ACVMField {
|
|
222
|
-
this.typedOracle.notifyCreatedNote(
|
|
223
|
-
fromACVMField(storageSlot),
|
|
224
|
-
NoteSelector.fromField(fromACVMField(noteTypeId)),
|
|
225
|
-
note.map(fromACVMField),
|
|
226
|
-
fromACVMField(noteHash),
|
|
227
|
-
+counter,
|
|
228
|
-
);
|
|
229
|
-
return toACVMField(0);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
async notifyNullifiedNote(
|
|
233
|
-
[innerNullifier]: ACVMField[],
|
|
234
|
-
[noteHash]: ACVMField[],
|
|
235
|
-
[counter]: ACVMField[],
|
|
236
|
-
): Promise<ACVMField> {
|
|
237
|
-
await this.typedOracle.notifyNullifiedNote(fromACVMField(innerNullifier), fromACVMField(noteHash), +counter);
|
|
238
|
-
return toACVMField(0);
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
async notifyCreatedNullifier([innerNullifier]: ACVMField[]): Promise<ACVMField> {
|
|
242
|
-
await this.typedOracle.notifyCreatedNullifier(fromACVMField(innerNullifier));
|
|
243
|
-
return toACVMField(0);
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
async checkNullifierExists([innerNullifier]: ACVMField[]): Promise<ACVMField> {
|
|
247
|
-
const exists = await this.typedOracle.checkNullifierExists(fromACVMField(innerNullifier));
|
|
248
|
-
return toACVMField(exists);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
async getL1ToL2MembershipWitness(
|
|
252
|
-
[contractAddress]: ACVMField[],
|
|
253
|
-
[messageHash]: ACVMField[],
|
|
254
|
-
[secret]: ACVMField[],
|
|
255
|
-
): Promise<ACVMField[]> {
|
|
256
|
-
const message = await this.typedOracle.getL1ToL2MembershipWitness(
|
|
257
|
-
AztecAddress.fromString(contractAddress),
|
|
258
|
-
fromACVMField(messageHash),
|
|
259
|
-
fromACVMField(secret),
|
|
260
|
-
);
|
|
261
|
-
return message.toFields().map(toACVMField);
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
async storageRead(
|
|
265
|
-
[contractAddress]: ACVMField[],
|
|
266
|
-
[startStorageSlot]: ACVMField[],
|
|
267
|
-
[blockNumber]: ACVMField[],
|
|
268
|
-
[numberOfElements]: ACVMField[],
|
|
269
|
-
): Promise<ACVMField[]> {
|
|
270
|
-
const values = await this.typedOracle.storageRead(
|
|
271
|
-
new AztecAddress(fromACVMField(contractAddress)),
|
|
272
|
-
fromACVMField(startStorageSlot),
|
|
273
|
-
+blockNumber,
|
|
274
|
-
+numberOfElements,
|
|
275
|
-
);
|
|
276
|
-
return values.map(toACVMField);
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
async storageWrite([startStorageSlot]: ACVMField[], values: ACVMField[]): Promise<ACVMField[]> {
|
|
280
|
-
const newValues = await this.typedOracle.storageWrite(fromACVMField(startStorageSlot), values.map(fromACVMField));
|
|
281
|
-
return newValues.map(toACVMField);
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
notifyCreatedContractClassLog([contractAddress]: ACVMField[], message: ACVMField[], [counter]: ACVMField[]): void {
|
|
285
|
-
const logPayload = message.map(fromACVMField);
|
|
286
|
-
const log = new ContractClassLog(new AztecAddress(fromACVMField(contractAddress)), logPayload);
|
|
287
|
-
|
|
288
|
-
this.typedOracle.notifyCreatedContractClassLog(log, +counter);
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
debugLog(message: ACVMField[], _ignoredFieldsSize: ACVMField[], fields: ACVMField[]): void {
|
|
292
|
-
const messageStr = message.map(acvmField => String.fromCharCode(fromACVMField(acvmField).toNumber())).join('');
|
|
293
|
-
const fieldsFr = fields.map(fromACVMField);
|
|
294
|
-
this.typedOracle.debugLog(messageStr, fieldsFr);
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
async callPrivateFunction(
|
|
298
|
-
[contractAddress]: ACVMField[],
|
|
299
|
-
[functionSelector]: ACVMField[],
|
|
300
|
-
[argsHash]: ACVMField[],
|
|
301
|
-
[sideEffectCounter]: ACVMField[],
|
|
302
|
-
[isStaticCall]: ACVMField[],
|
|
303
|
-
): Promise<ACVMField[]> {
|
|
304
|
-
const { endSideEffectCounter, returnsHash } = await this.typedOracle.callPrivateFunction(
|
|
305
|
-
AztecAddress.fromField(fromACVMField(contractAddress)),
|
|
306
|
-
FunctionSelector.fromField(fromACVMField(functionSelector)),
|
|
307
|
-
fromACVMField(argsHash),
|
|
308
|
-
frToNumber(fromACVMField(sideEffectCounter)),
|
|
309
|
-
frToBoolean(fromACVMField(isStaticCall)),
|
|
310
|
-
);
|
|
311
|
-
return [endSideEffectCounter, returnsHash].map(toACVMField);
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
async enqueuePublicFunctionCall(
|
|
315
|
-
[contractAddress]: ACVMField[],
|
|
316
|
-
[functionSelector]: ACVMField[],
|
|
317
|
-
[argsHash]: ACVMField[],
|
|
318
|
-
[sideEffectCounter]: ACVMField[],
|
|
319
|
-
[isStaticCall]: ACVMField[],
|
|
320
|
-
): Promise<ACVMField> {
|
|
321
|
-
const newArgsHash = await this.typedOracle.enqueuePublicFunctionCall(
|
|
322
|
-
AztecAddress.fromString(contractAddress),
|
|
323
|
-
FunctionSelector.fromField(fromACVMField(functionSelector)),
|
|
324
|
-
fromACVMField(argsHash),
|
|
325
|
-
frToNumber(fromACVMField(sideEffectCounter)),
|
|
326
|
-
frToBoolean(fromACVMField(isStaticCall)),
|
|
327
|
-
);
|
|
328
|
-
return toACVMField(newArgsHash);
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
async setPublicTeardownFunctionCall(
|
|
332
|
-
[contractAddress]: ACVMField[],
|
|
333
|
-
[functionSelector]: ACVMField[],
|
|
334
|
-
[argsHash]: ACVMField[],
|
|
335
|
-
[sideEffectCounter]: ACVMField[],
|
|
336
|
-
[isStaticCall]: ACVMField[],
|
|
337
|
-
): Promise<ACVMField> {
|
|
338
|
-
const newArgsHash = await this.typedOracle.setPublicTeardownFunctionCall(
|
|
339
|
-
AztecAddress.fromString(contractAddress),
|
|
340
|
-
FunctionSelector.fromField(fromACVMField(functionSelector)),
|
|
341
|
-
fromACVMField(argsHash),
|
|
342
|
-
frToNumber(fromACVMField(sideEffectCounter)),
|
|
343
|
-
frToBoolean(fromACVMField(isStaticCall)),
|
|
344
|
-
);
|
|
345
|
-
return toACVMField(newArgsHash);
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
notifySetMinRevertibleSideEffectCounter([minRevertibleSideEffectCounter]: ACVMField[]) {
|
|
349
|
-
this.typedOracle.notifySetMinRevertibleSideEffectCounter(frToNumber(fromACVMField(minRevertibleSideEffectCounter)));
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
async getIndexedTaggingSecretAsSender([sender]: ACVMField[], [recipient]: ACVMField[]): Promise<ACVMField[]> {
|
|
353
|
-
const taggingSecret = await this.typedOracle.getIndexedTaggingSecretAsSender(
|
|
354
|
-
AztecAddress.fromString(sender),
|
|
355
|
-
AztecAddress.fromString(recipient),
|
|
356
|
-
);
|
|
357
|
-
return taggingSecret.toFields().map(toACVMField);
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
async incrementAppTaggingSecretIndexAsSender([sender]: ACVMField[], [recipient]: ACVMField[]) {
|
|
361
|
-
await this.typedOracle.incrementAppTaggingSecretIndexAsSender(
|
|
362
|
-
AztecAddress.fromString(sender),
|
|
363
|
-
AztecAddress.fromString(recipient),
|
|
364
|
-
);
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
async syncNotes() {
|
|
368
|
-
await this.typedOracle.syncNotes();
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
async deliverNote(
|
|
372
|
-
[contractAddress]: ACVMField[],
|
|
373
|
-
[storageSlot]: ACVMField[],
|
|
374
|
-
[nonce]: ACVMField[],
|
|
375
|
-
content: ACVMField[],
|
|
376
|
-
[contentLength]: ACVMField[],
|
|
377
|
-
[noteHash]: ACVMField[],
|
|
378
|
-
[nullifier]: ACVMField[],
|
|
379
|
-
[txHash]: ACVMField[],
|
|
380
|
-
[recipient]: ACVMField[],
|
|
381
|
-
): Promise<ACVMField> {
|
|
382
|
-
// TODO(#10728): try-catch this block and return false if we get an exception so that the contract can decide what
|
|
383
|
-
// to do if a note fails delivery (e.g. not increment the tagging index, or add it to some pending work list).
|
|
384
|
-
// Delivery might fail due to temporary issues, such as poor node connectivity.
|
|
385
|
-
await this.typedOracle.deliverNote(
|
|
386
|
-
AztecAddress.fromString(contractAddress),
|
|
387
|
-
fromACVMField(storageSlot),
|
|
388
|
-
fromACVMField(nonce),
|
|
389
|
-
fromBoundedVec(content, contentLength),
|
|
390
|
-
fromACVMField(noteHash),
|
|
391
|
-
fromACVMField(nullifier),
|
|
392
|
-
fromACVMField(txHash),
|
|
393
|
-
AztecAddress.fromString(recipient),
|
|
394
|
-
);
|
|
395
|
-
|
|
396
|
-
return toACVMField(true);
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
async getLogByTag([tag]: ACVMField[]): Promise<(ACVMField | ACVMField[])[]> {
|
|
400
|
-
const log = await this.typedOracle.getLogByTag(fromACVMField(tag));
|
|
401
|
-
|
|
402
|
-
if (log == null) {
|
|
403
|
-
return [toACVMField(0), ...LogWithTxData.noirSerializationOfEmpty().map(toACVMFieldSingleOrArray)];
|
|
404
|
-
} else {
|
|
405
|
-
return [toACVMField(1), ...log.toNoirSerialization().map(toACVMFieldSingleOrArray)];
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
async storeCapsule([contractAddress]: ACVMField[], [slot]: ACVMField[], capsule: ACVMField[]) {
|
|
410
|
-
await this.typedOracle.storeCapsule(
|
|
411
|
-
AztecAddress.fromField(fromACVMField(contractAddress)),
|
|
412
|
-
fromACVMField(slot),
|
|
413
|
-
capsule.map(fromACVMField),
|
|
414
|
-
);
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
async loadCapsule(
|
|
418
|
-
[contractAddress]: ACVMField[],
|
|
419
|
-
[slot]: ACVMField[],
|
|
420
|
-
[tSize]: ACVMField[],
|
|
421
|
-
): Promise<(ACVMField | ACVMField[])[]> {
|
|
422
|
-
const values = await this.typedOracle.loadCapsule(
|
|
423
|
-
AztecAddress.fromField(fromACVMField(contractAddress)),
|
|
424
|
-
fromACVMField(slot),
|
|
425
|
-
);
|
|
426
|
-
|
|
427
|
-
// We are going to return a Noir Option struct to represent the possibility of null values. Options are a struct
|
|
428
|
-
// with two fields: `some` (a boolean) and `value` (a field array in this case).
|
|
429
|
-
if (values === null) {
|
|
430
|
-
// No data was found so we set `some` to 0 and pad `value` with zeros get the correct return size.
|
|
431
|
-
return [toACVMField(0), Array(frToNumber(fromACVMField(tSize))).fill(toACVMField(0))];
|
|
432
|
-
} else {
|
|
433
|
-
// Data was found so we set `some` to 1 and return it along with `value`.
|
|
434
|
-
return [toACVMField(1), values.map(toACVMField)];
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
async deleteCapsule([contractAddress]: ACVMField[], [slot]: ACVMField[]) {
|
|
439
|
-
await this.typedOracle.deleteCapsule(AztecAddress.fromField(fromACVMField(contractAddress)), fromACVMField(slot));
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
async copyCapsule(
|
|
443
|
-
[contractAddress]: ACVMField[],
|
|
444
|
-
[srcSlot]: ACVMField[],
|
|
445
|
-
[dstSlot]: ACVMField[],
|
|
446
|
-
[numEntries]: ACVMField[],
|
|
447
|
-
) {
|
|
448
|
-
await this.typedOracle.copyCapsule(
|
|
449
|
-
AztecAddress.fromField(fromACVMField(contractAddress)),
|
|
450
|
-
fromACVMField(srcSlot),
|
|
451
|
-
fromACVMField(dstSlot),
|
|
452
|
-
frToNumber(fromACVMField(numEntries)),
|
|
453
|
-
);
|
|
454
|
-
}
|
|
455
|
-
}
|