@aztec/simulator 4.0.0-nightly.20250907 → 4.0.0-nightly.20260107
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/dest/client.d.ts +1 -1
- package/dest/common/errors.d.ts +2 -8
- package/dest/common/errors.d.ts.map +1 -1
- package/dest/common/index.d.ts +1 -1
- package/dest/common/stats/index.d.ts +1 -1
- package/dest/common/stats/stats.d.ts +1 -1
- package/dest/private/acvm/acvm.d.ts +1 -1
- package/dest/private/acvm/acvm_types.d.ts +1 -1
- package/dest/private/acvm/deserialize.d.ts +2 -2
- package/dest/private/acvm/deserialize.d.ts.map +1 -1
- package/dest/private/acvm/deserialize.js +1 -1
- package/dest/private/acvm/index.d.ts +1 -1
- package/dest/private/acvm/serialize.d.ts +2 -2
- package/dest/private/acvm/serialize.d.ts.map +1 -1
- package/dest/private/acvm/serialize.js +1 -1
- package/dest/private/acvm_native.d.ts +2 -3
- package/dest/private/acvm_native.d.ts.map +1 -1
- package/dest/private/acvm_native.js +15 -13
- package/dest/private/acvm_wasm.d.ts +1 -1
- package/dest/private/acvm_wasm.d.ts.map +1 -1
- package/dest/private/acvm_wasm_with_blobs.d.ts +1 -1
- package/dest/private/acvm_wasm_with_blobs.d.ts.map +1 -1
- package/dest/private/circuit_recording/circuit_recorder.d.ts +1 -1
- package/dest/private/circuit_recording/circuit_recorder.d.ts.map +1 -1
- package/dest/private/circuit_recording/circuit_recorder.js +16 -15
- package/dest/private/circuit_recording/file_circuit_recorder.d.ts +1 -1
- package/dest/private/circuit_recording/file_circuit_recorder.d.ts.map +1 -1
- package/dest/private/circuit_recording/memory_circuit_recorder.d.ts +1 -1
- package/dest/private/circuit_recording/memory_circuit_recorder.d.ts.map +1 -1
- package/dest/private/circuit_recording/simulator_recorder_wrapper.d.ts +2 -2
- package/dest/private/circuit_recording/simulator_recorder_wrapper.d.ts.map +1 -1
- package/dest/private/circuit_simulator.d.ts +1 -1
- package/dest/private/factory.d.ts +1 -1
- package/dest/public/avm/avm_context.d.ts +2 -2
- package/dest/public/avm/avm_context.d.ts.map +1 -1
- package/dest/public/avm/avm_contract_call_result.d.ts +2 -2
- package/dest/public/avm/avm_contract_call_result.d.ts.map +1 -1
- package/dest/public/avm/avm_execution_environment.d.ts +5 -4
- package/dest/public/avm/avm_execution_environment.d.ts.map +1 -1
- package/dest/public/avm/avm_execution_environment.js +5 -5
- package/dest/public/avm/avm_gas.d.ts +2 -2
- package/dest/public/avm/avm_gas.d.ts.map +1 -1
- package/dest/public/avm/avm_gas.js +2 -2
- package/dest/public/avm/avm_machine_state.d.ts +2 -2
- package/dest/public/avm/avm_machine_state.d.ts.map +1 -1
- package/dest/public/avm/avm_memory_types.d.ts +20 -14
- package/dest/public/avm/avm_memory_types.d.ts.map +1 -1
- package/dest/public/avm/avm_memory_types.js +10 -3
- package/dest/public/avm/avm_simulator.d.ts +4 -3
- package/dest/public/avm/avm_simulator.d.ts.map +1 -1
- package/dest/public/avm/avm_simulator.js +19 -25
- package/dest/public/avm/avm_simulator_interface.d.ts +1 -1
- package/dest/public/avm/errors.d.ts +13 -16
- package/dest/public/avm/errors.d.ts.map +1 -1
- package/dest/public/avm/errors.js +21 -22
- package/dest/public/avm/fixtures/avm_simulation_tester.d.ts +3 -2
- package/dest/public/avm/fixtures/avm_simulation_tester.d.ts.map +1 -1
- package/dest/public/avm/fixtures/avm_simulation_tester.js +14 -6
- package/dest/public/avm/fixtures/base_avm_simulation_tester.d.ts +4 -2
- package/dest/public/avm/fixtures/base_avm_simulation_tester.d.ts.map +1 -1
- package/dest/public/avm/fixtures/base_avm_simulation_tester.js +23 -1
- package/dest/public/avm/fixtures/initializers.d.ts +2 -3
- package/dest/public/avm/fixtures/initializers.d.ts.map +1 -1
- package/dest/public/avm/fixtures/initializers.js +6 -4
- package/dest/public/avm/fixtures/utils.d.ts +4 -3
- package/dest/public/avm/fixtures/utils.d.ts.map +1 -1
- package/dest/public/avm/fixtures/utils.js +3 -2
- package/dest/public/avm/index.d.ts +1 -1
- package/dest/public/avm/opcodes/accrued_substate.d.ts +3 -3
- package/dest/public/avm/opcodes/accrued_substate.d.ts.map +1 -1
- package/dest/public/avm/opcodes/accrued_substate.js +8 -8
- package/dest/public/avm/opcodes/addressing_mode.d.ts +1 -1
- package/dest/public/avm/opcodes/addressing_mode.d.ts.map +1 -1
- package/dest/public/avm/opcodes/addressing_mode.js +4 -5
- package/dest/public/avm/opcodes/arithmetic.d.ts +10 -8
- package/dest/public/avm/opcodes/arithmetic.d.ts.map +1 -1
- package/dest/public/avm/opcodes/arithmetic.js +11 -1
- package/dest/public/avm/opcodes/bitwise.d.ts +5 -5
- package/dest/public/avm/opcodes/bitwise.d.ts.map +1 -1
- 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/contract.d.ts +1 -1
- package/dest/public/avm/opcodes/contract.d.ts.map +1 -1
- 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/conversion.d.ts +1 -1
- package/dest/public/avm/opcodes/conversion.d.ts.map +1 -1
- package/dest/public/avm/opcodes/conversion.js +3 -0
- 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 +1 -1
- package/dest/public/avm/opcodes/environment_getters.d.ts.map +1 -1
- package/dest/public/avm/opcodes/environment_getters.js +5 -7
- package/dest/public/avm/opcodes/external_calls.d.ts +1 -1
- package/dest/public/avm/opcodes/external_calls.d.ts.map +1 -1
- package/dest/public/avm/opcodes/external_calls.js +1 -1
- 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 +9 -4
- package/dest/public/avm/opcodes/index.d.ts +1 -1
- package/dest/public/avm/opcodes/instruction.d.ts +2 -2
- package/dest/public/avm/opcodes/instruction.d.ts.map +1 -1
- package/dest/public/avm/opcodes/instruction.js +5 -6
- package/dest/public/avm/opcodes/instruction_impl.d.ts +1 -1
- package/dest/public/avm/opcodes/instruction_impl.d.ts.map +1 -1
- package/dest/public/avm/opcodes/memory.d.ts +2 -2
- package/dest/public/avm/opcodes/memory.d.ts.map +1 -1
- package/dest/public/avm/opcodes/memory.js +1 -1
- 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 +28 -8
- 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/revert_reason.d.ts +2 -2
- package/dest/public/avm/revert_reason.d.ts.map +1 -1
- package/dest/public/avm/revert_reason.js +3 -2
- package/dest/public/avm/serialization/buffer_cursor.d.ts +1 -1
- package/dest/public/avm/serialization/buffer_cursor.d.ts.map +1 -1
- package/dest/public/avm/serialization/bytecode_serialization.d.ts +1 -1
- package/dest/public/avm/serialization/bytecode_serialization.d.ts.map +1 -1
- package/dest/public/avm/serialization/bytecode_serialization.js +9 -6
- package/dest/public/avm/serialization/instruction_serialization.d.ts +9 -1
- package/dest/public/avm/serialization/instruction_serialization.d.ts.map +1 -1
- package/dest/public/avm/serialization/instruction_serialization.js +11 -1
- package/dest/public/avm/test_utils.d.ts +4 -4
- package/dest/public/avm/test_utils.d.ts.map +1 -1
- package/dest/public/avm/test_utils.js +7 -10
- package/dest/public/contracts_db_checkpoint.d.ts +16 -0
- package/dest/public/contracts_db_checkpoint.d.ts.map +1 -0
- package/dest/public/contracts_db_checkpoint.js +30 -0
- package/dest/public/db_interfaces.d.ts +14 -2
- package/dest/public/db_interfaces.d.ts.map +1 -1
- package/dest/public/debug_fn_name.d.ts +15 -2
- package/dest/public/debug_fn_name.d.ts.map +1 -1
- package/dest/public/debug_fn_name.js +28 -2
- package/dest/public/executor_metrics.d.ts +3 -2
- package/dest/public/executor_metrics.d.ts.map +1 -1
- package/dest/public/executor_metrics.js +1 -1
- package/dest/public/executor_metrics_interface.d.ts +3 -2
- package/dest/public/executor_metrics_interface.d.ts.map +1 -1
- package/dest/public/fixtures/amm_test.d.ts +1 -1
- package/dest/public/fixtures/amm_test.js +2 -2
- package/dest/public/fixtures/bulk_test.d.ts +1 -1
- package/dest/public/fixtures/bulk_test.d.ts.map +1 -1
- package/dest/public/fixtures/bulk_test.js +59 -161
- package/dest/public/fixtures/custom_bytecode_tester.d.ts +34 -0
- package/dest/public/fixtures/custom_bytecode_tester.d.ts.map +1 -0
- package/dest/public/fixtures/custom_bytecode_tester.js +53 -0
- package/dest/public/fixtures/custom_bytecode_tests.d.ts +12 -0
- package/dest/public/fixtures/custom_bytecode_tests.d.ts.map +1 -0
- package/dest/public/fixtures/custom_bytecode_tests.js +174 -0
- package/dest/public/fixtures/index.d.ts +5 -2
- package/dest/public/fixtures/index.d.ts.map +1 -1
- package/dest/public/fixtures/index.js +4 -1
- package/dest/public/fixtures/minimal_public_tx.d.ts +4 -9
- package/dest/public/fixtures/minimal_public_tx.d.ts.map +1 -1
- package/dest/public/fixtures/minimal_public_tx.js +8 -32
- package/dest/public/fixtures/opcode_spammer.d.ts +123 -0
- package/dest/public/fixtures/opcode_spammer.d.ts.map +1 -0
- package/dest/public/fixtures/opcode_spammer.js +1681 -0
- package/dest/public/fixtures/public_tx_simulation_tester.d.ts +25 -5
- package/dest/public/fixtures/public_tx_simulation_tester.d.ts.map +1 -1
- package/dest/public/fixtures/public_tx_simulation_tester.js +63 -17
- package/dest/public/fixtures/simple_contract_data_source.d.ts +5 -4
- package/dest/public/fixtures/simple_contract_data_source.d.ts.map +1 -1
- package/dest/public/fixtures/simple_contract_data_source.js +4 -4
- package/dest/public/fixtures/token_test.d.ts +6 -2
- package/dest/public/fixtures/token_test.d.ts.map +1 -1
- package/dest/public/fixtures/token_test.js +13 -12
- package/dest/public/fixtures/utils.d.ts +2 -2
- package/dest/public/fixtures/utils.d.ts.map +1 -1
- package/dest/public/fixtures/utils.js +7 -6
- package/dest/public/fuzzing/avm_fuzzer_simulator.d.ts +46 -0
- package/dest/public/fuzzing/avm_fuzzer_simulator.d.ts.map +1 -0
- package/dest/public/fuzzing/avm_fuzzer_simulator.js +139 -0
- package/dest/public/fuzzing/avm_simulator_bin.d.ts +2 -0
- package/dest/public/fuzzing/avm_simulator_bin.d.ts.map +1 -0
- package/dest/public/fuzzing/avm_simulator_bin.js +100 -0
- package/dest/public/hinting_db_sources.d.ts +16 -4
- package/dest/public/hinting_db_sources.d.ts.map +1 -1
- package/dest/public/hinting_db_sources.js +74 -13
- package/dest/public/index.d.ts +3 -2
- package/dest/public/index.d.ts.map +1 -1
- package/dest/public/index.js +1 -1
- package/dest/public/public_db_sources.d.ts +24 -65
- package/dest/public/public_db_sources.d.ts.map +1 -1
- package/dest/public/public_db_sources.js +85 -132
- package/dest/public/public_errors.d.ts +12 -0
- package/dest/public/public_errors.d.ts.map +1 -0
- package/dest/public/public_errors.js +13 -0
- package/dest/public/public_processor/guarded_merkle_tree.d.ts +6 -2
- package/dest/public/public_processor/guarded_merkle_tree.d.ts.map +1 -1
- package/dest/public/public_processor/guarded_merkle_tree.js +8 -0
- package/dest/public/public_processor/public_processor.d.ts +11 -13
- package/dest/public/public_processor/public_processor.d.ts.map +1 -1
- package/dest/public/public_processor/public_processor.js +477 -70
- package/dest/public/public_processor/public_processor_metrics.d.ts +1 -1
- package/dest/public/public_processor/public_processor_metrics.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/contract_provider_for_cpp.d.ts +18 -0
- package/dest/public/public_tx_simulator/contract_provider_for_cpp.d.ts.map +1 -0
- package/dest/public/public_tx_simulator/contract_provider_for_cpp.js +98 -0
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator.d.ts +53 -0
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator.d.ts.map +1 -0
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator.js +131 -0
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.d.ts +42 -0
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.d.ts.map +1 -0
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.js +86 -0
- package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.d.ts +30 -0
- package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.d.ts.map +1 -0
- package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.js +171 -0
- package/dest/public/public_tx_simulator/dumping_cpp_public_tx_simulator.d.ts +22 -0
- package/dest/public/public_tx_simulator/dumping_cpp_public_tx_simulator.d.ts.map +1 -0
- package/dest/public/public_tx_simulator/dumping_cpp_public_tx_simulator.js +52 -0
- package/dest/public/public_tx_simulator/factories.d.ts +13 -0
- package/dest/public/public_tx_simulator/factories.d.ts.map +1 -0
- package/dest/public/public_tx_simulator/factories.js +28 -0
- package/dest/public/public_tx_simulator/index.d.ts +6 -1
- package/dest/public/public_tx_simulator/index.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/index.js +3 -0
- package/dest/public/public_tx_simulator/measured_public_tx_simulator.d.ts +16 -8
- package/dest/public/public_tx_simulator/measured_public_tx_simulator.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/measured_public_tx_simulator.js +7 -8
- package/dest/public/public_tx_simulator/public_tx_context.d.ts +9 -4
- package/dest/public/public_tx_simulator/public_tx_context.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/public_tx_context.js +22 -10
- package/dest/public/public_tx_simulator/public_tx_simulator.d.ts +22 -29
- package/dest/public/public_tx_simulator/public_tx_simulator.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/public_tx_simulator.js +178 -127
- package/dest/public/public_tx_simulator/public_tx_simulator_interface.d.ts +32 -0
- package/dest/public/public_tx_simulator/public_tx_simulator_interface.d.ts.map +1 -0
- package/dest/public/public_tx_simulator/public_tx_simulator_interface.js +1 -0
- package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.d.ts +4 -3
- package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.js +396 -20
- package/dest/public/side_effect_errors.d.ts +42 -2
- package/dest/public/side_effect_errors.d.ts.map +1 -1
- package/dest/public/side_effect_errors.js +70 -1
- package/dest/public/side_effect_trace.d.ts +13 -7
- package/dest/public/side_effect_trace.d.ts.map +1 -1
- package/dest/public/side_effect_trace.js +36 -21
- package/dest/public/side_effect_trace_interface.d.ts +9 -4
- package/dest/public/side_effect_trace_interface.d.ts.map +1 -1
- package/dest/public/state_manager/index.d.ts +1 -1
- package/dest/public/state_manager/nullifiers.d.ts +2 -5
- package/dest/public/state_manager/nullifiers.d.ts.map +1 -1
- package/dest/public/state_manager/nullifiers.js +1 -6
- package/dest/public/state_manager/public_storage.d.ts +2 -2
- package/dest/public/state_manager/public_storage.d.ts.map +1 -1
- package/dest/public/state_manager/public_storage.js +1 -1
- package/dest/public/state_manager/state_manager.d.ts +16 -13
- package/dest/public/state_manager/state_manager.d.ts.map +1 -1
- package/dest/public/state_manager/state_manager.js +64 -21
- package/dest/public/test_executor_metrics.d.ts +4 -3
- package/dest/public/test_executor_metrics.d.ts.map +1 -1
- package/dest/public/test_executor_metrics.js +5 -4
- package/dest/public/unique_class_ids.d.ts +1 -1
- package/dest/public/unique_class_ids.d.ts.map +1 -1
- package/dest/public/utils.d.ts +1 -1
- package/dest/server.d.ts +1 -1
- package/dest/testing.d.ts +1 -1
- package/package.json +24 -19
- package/src/common/errors.ts +1 -1
- package/src/private/acvm/deserialize.ts +1 -1
- package/src/private/acvm/serialize.ts +1 -1
- package/src/private/acvm_native.ts +18 -11
- package/src/private/circuit_recording/circuit_recorder.ts +17 -16
- package/src/private/circuit_recording/simulator_recorder_wrapper.ts +1 -1
- package/src/public/avm/avm_context.ts +1 -1
- package/src/public/avm/avm_contract_call_result.ts +1 -1
- package/src/public/avm/avm_execution_environment.ts +4 -3
- package/src/public/avm/avm_gas.ts +5 -5
- package/src/public/avm/avm_machine_state.ts +1 -1
- package/src/public/avm/avm_memory_types.ts +12 -3
- package/src/public/avm/avm_simulator.ts +24 -33
- package/src/public/avm/errors.ts +24 -27
- package/src/public/avm/fixtures/avm_simulation_tester.ts +14 -4
- package/src/public/avm/fixtures/base_avm_simulation_tester.ts +33 -1
- package/src/public/avm/fixtures/initializers.ts +7 -8
- package/src/public/avm/fixtures/utils.ts +3 -2
- package/src/public/avm/opcodes/accrued_substate.ts +5 -5
- package/src/public/avm/opcodes/addressing_mode.ts +5 -5
- package/src/public/avm/opcodes/arithmetic.ts +13 -1
- package/src/public/avm/opcodes/conversion.ts +4 -0
- package/src/public/avm/opcodes/ec_add.ts +6 -6
- package/src/public/avm/opcodes/environment_getters.ts +6 -8
- package/src/public/avm/opcodes/external_calls.ts +1 -1
- package/src/public/avm/opcodes/hashing.ts +10 -4
- package/src/public/avm/opcodes/instruction.ts +8 -6
- package/src/public/avm/opcodes/memory.ts +1 -1
- package/src/public/avm/opcodes/misc.ts +41 -7
- package/src/public/avm/revert_reason.ts +6 -3
- package/src/public/avm/serialization/bytecode_serialization.ts +17 -6
- package/src/public/avm/serialization/instruction_serialization.ts +13 -1
- package/src/public/avm/test_utils.ts +7 -15
- package/src/public/contracts_db_checkpoint.ts +41 -0
- package/src/public/db_interfaces.ts +16 -1
- package/src/public/debug_fn_name.ts +35 -3
- package/src/public/executor_metrics.ts +2 -1
- package/src/public/executor_metrics_interface.ts +2 -1
- package/src/public/fixtures/amm_test.ts +2 -2
- package/src/public/fixtures/bulk_test.ts +38 -25
- package/src/public/fixtures/custom_bytecode_tester.ts +83 -0
- package/src/public/fixtures/custom_bytecode_tests.ts +219 -0
- package/src/public/fixtures/index.ts +8 -1
- package/src/public/fixtures/minimal_public_tx.ts +9 -42
- package/src/public/fixtures/opcode_spammer.ts +1638 -0
- package/src/public/fixtures/public_tx_simulation_tester.ts +90 -22
- package/src/public/fixtures/simple_contract_data_source.ts +8 -9
- package/src/public/fixtures/token_test.ts +18 -10
- package/src/public/fixtures/utils.ts +5 -6
- package/src/public/fuzzing/avm_fuzzer_simulator.ts +240 -0
- package/src/public/fuzzing/avm_simulator_bin.ts +140 -0
- package/src/public/hinting_db_sources.ts +117 -10
- package/src/public/index.ts +8 -1
- package/src/public/public_db_sources.ts +112 -175
- package/src/public/public_errors.ts +14 -0
- package/src/public/public_processor/guarded_merkle_tree.ts +10 -1
- package/src/public/public_processor/public_processor.ts +112 -79
- package/src/public/public_tx_simulator/contract_provider_for_cpp.ts +121 -0
- package/src/public/public_tx_simulator/cpp_public_tx_simulator.ts +200 -0
- package/src/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.ts +132 -0
- package/src/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.ts +237 -0
- package/src/public/public_tx_simulator/dumping_cpp_public_tx_simulator.ts +81 -0
- package/src/public/public_tx_simulator/factories.ts +41 -0
- package/src/public/public_tx_simulator/index.ts +5 -0
- package/src/public/public_tx_simulator/measured_public_tx_simulator.ts +13 -14
- package/src/public/public_tx_simulator/public_tx_context.ts +20 -7
- package/src/public/public_tx_simulator/public_tx_simulator.ts +265 -179
- package/src/public/public_tx_simulator/public_tx_simulator_interface.ts +33 -0
- package/src/public/public_tx_simulator/telemetry_public_tx_simulator.ts +4 -13
- package/src/public/side_effect_errors.ts +91 -1
- package/src/public/side_effect_trace.ts +49 -24
- package/src/public/side_effect_trace_interface.ts +7 -1
- package/src/public/state_manager/nullifiers.ts +2 -8
- package/src/public/state_manager/public_storage.ts +1 -1
- package/src/public/state_manager/state_manager.ts +87 -39
- package/src/public/test_executor_metrics.ts +7 -5
- package/dest/public/bytecode_errors.d.ts +0 -4
- package/dest/public/bytecode_errors.d.ts.map +0 -1
- package/dest/public/bytecode_errors.js +0 -6
- package/dest/public/tx_contract_cache.d.ts +0 -41
- package/dest/public/tx_contract_cache.d.ts.map +0 -1
- package/dest/public/tx_contract_cache.js +0 -49
- package/src/public/bytecode_errors.ts +0 -6
- package/src/public/tx_contract_cache.ts +0 -69
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
L1_TO_L2_MSG_TREE_LEAF_COUNT,
|
|
3
|
+
NOTE_HASH_TREE_LEAF_COUNT,
|
|
4
|
+
NULLIFIER_SUBTREE_HEIGHT,
|
|
5
|
+
PUBLIC_DATA_SUBTREE_HEIGHT,
|
|
6
|
+
} from '@aztec/constants';
|
|
7
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
8
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
9
|
import { Timer } from '@aztec/foundation/timer';
|
|
5
10
|
import { ContractClassPublishedEvent } from '@aztec/protocol-contracts/class-registry';
|
|
@@ -8,14 +13,15 @@ import type { FunctionSelector } from '@aztec/stdlib/abi';
|
|
|
8
13
|
import { PublicDataWrite } from '@aztec/stdlib/avm';
|
|
9
14
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
10
15
|
import {
|
|
16
|
+
AllContractDeploymentData,
|
|
11
17
|
type ContractClassPublic,
|
|
12
18
|
type ContractDataSource,
|
|
19
|
+
type ContractDeploymentData,
|
|
13
20
|
type ContractInstanceWithAddress,
|
|
14
21
|
computePublicBytecodeCommitment,
|
|
15
22
|
} from '@aztec/stdlib/contract';
|
|
16
23
|
import { computePublicDataTreeLeafSlot } from '@aztec/stdlib/hash';
|
|
17
24
|
import type { MerkleTreeWriteOperations } from '@aztec/stdlib/interfaces/server';
|
|
18
|
-
import { ContractClassLog, PrivateLog } from '@aztec/stdlib/logs';
|
|
19
25
|
import type { PublicDBAccessStats } from '@aztec/stdlib/stats';
|
|
20
26
|
import {
|
|
21
27
|
MerkleTreeId,
|
|
@@ -27,181 +33,91 @@ import {
|
|
|
27
33
|
import { TreeSnapshots, type Tx } from '@aztec/stdlib/tx';
|
|
28
34
|
import type { UInt64 } from '@aztec/stdlib/types';
|
|
29
35
|
|
|
36
|
+
import { strict as assert } from 'assert';
|
|
37
|
+
|
|
38
|
+
import { ContractsDbCheckpoint } from './contracts_db_checkpoint.js';
|
|
30
39
|
import type { PublicContractsDBInterface, PublicStateDBInterface } from './db_interfaces.js';
|
|
31
|
-
import {
|
|
40
|
+
import { L1ToL2MessageIndexOutOfRangeError, NoteHashIndexOutOfRangeError } from './side_effect_errors.js';
|
|
32
41
|
|
|
33
42
|
/**
|
|
34
43
|
* Implements the PublicContractsDBInterface using a ContractDataSource.
|
|
35
|
-
*
|
|
36
|
-
* Separates block-level contract information (from processed/included txs) from the
|
|
37
|
-
* current tx's contract information (which may be cleared on tx revert/death).
|
|
44
|
+
* Uses a stack-based checkpoint model for managing contract state.
|
|
38
45
|
*/
|
|
39
46
|
export class PublicContractsDB implements PublicContractsDBInterface {
|
|
40
|
-
|
|
41
|
-
// Tx-level cache:
|
|
42
|
-
// - The current tx's new contract information is cached
|
|
43
|
-
// in currentTxNonRevertibleCache and currentTxRevertibleCache.
|
|
44
|
-
// Block-level cache:
|
|
45
|
-
// - Contract information from earlier in the block, usable by later txs.
|
|
46
|
-
// When a tx succeeds, that tx's caches are merged into the block cache and cleared.
|
|
47
|
-
private currentTxNonRevertibleCache = new TxContractCache();
|
|
48
|
-
private currentTxRevertibleCache = new TxContractCache();
|
|
49
|
-
private blockCache = new TxContractCache();
|
|
50
|
-
// Separate flat cache for bytecode commitments.
|
|
51
|
-
private bytecodeCommitmentCache = new Map<string, Fr>();
|
|
47
|
+
private contractStateStack: ContractsDbCheckpoint[] = [new ContractsDbCheckpoint()];
|
|
52
48
|
|
|
53
49
|
private log = createLogger('simulator:contracts-data-source');
|
|
54
50
|
|
|
55
51
|
constructor(private dataSource: ContractDataSource) {}
|
|
56
52
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
* @param tx - The transaction to add contracts from.
|
|
60
|
-
*/
|
|
61
|
-
public async addNewContracts(tx: Tx): Promise<void> {
|
|
62
|
-
await this.addNonRevertibleContractClasses(tx);
|
|
63
|
-
await this.addRevertibleContractClasses(tx);
|
|
64
|
-
this.addNonRevertibleContractInstances(tx);
|
|
65
|
-
this.addRevertibleContractInstances(tx);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Add non revertible contracts from a transaction
|
|
70
|
-
* @param tx - The transaction to add non revertible contracts from.
|
|
71
|
-
*/
|
|
72
|
-
public async addNewNonRevertibleContracts(tx: Tx) {
|
|
73
|
-
await this.addNonRevertibleContractClasses(tx);
|
|
74
|
-
this.addNonRevertibleContractInstances(tx);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Add revertible contracts from a transaction
|
|
79
|
-
* @param tx - The transaction to add revertible contracts from.
|
|
80
|
-
*/
|
|
81
|
-
public async addNewRevertibleContracts(tx: Tx) {
|
|
82
|
-
await this.addRevertibleContractClasses(tx);
|
|
83
|
-
this.addRevertibleContractInstances(tx);
|
|
84
|
-
}
|
|
53
|
+
public async addContracts(contractDeploymentData: ContractDeploymentData): Promise<void> {
|
|
54
|
+
const currentState = this.getCurrentState();
|
|
85
55
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
*/
|
|
91
|
-
private async addNonRevertibleContractClasses(tx: Tx) {
|
|
92
|
-
const siloedContractClassLogs = tx.data.forPublic
|
|
93
|
-
? tx.getSplitContractClassLogs(false /* revertible */)
|
|
94
|
-
: tx.getContractClassLogs();
|
|
95
|
-
await this.addContractClassesFromLogs(siloedContractClassLogs, this.currentTxNonRevertibleCache, 'non-revertible');
|
|
96
|
-
}
|
|
56
|
+
await this.addContractClassesFromEvents(
|
|
57
|
+
ContractClassPublishedEvent.extractContractClassEvents(contractDeploymentData.getContractClassLogs()),
|
|
58
|
+
currentState,
|
|
59
|
+
);
|
|
97
60
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
*/
|
|
103
|
-
private async addRevertibleContractClasses(tx: Tx) {
|
|
104
|
-
const siloedContractClassLogs = tx.data.forPublic ? tx.getSplitContractClassLogs(true /* revertible */) : [];
|
|
105
|
-
await this.addContractClassesFromLogs(siloedContractClassLogs, this.currentTxRevertibleCache, 'revertible');
|
|
61
|
+
this.addContractInstancesFromEvents(
|
|
62
|
+
ContractInstancePublishedEvent.extractContractInstanceEvents(contractDeploymentData.getPrivateLogs()),
|
|
63
|
+
currentState,
|
|
64
|
+
);
|
|
106
65
|
}
|
|
107
66
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
*/
|
|
113
|
-
private addNonRevertibleContractInstances(tx: Tx) {
|
|
114
|
-
const contractInstanceLogs = tx.data.forPublic
|
|
115
|
-
? tx.data.forPublic!.nonRevertibleAccumulatedData.privateLogs.filter(l => !l.isEmpty())
|
|
116
|
-
: tx.data.forRollup!.end.privateLogs.filter(l => !l.isEmpty());
|
|
117
|
-
|
|
118
|
-
this.addContractInstancesFromLogs(contractInstanceLogs, this.currentTxNonRevertibleCache, 'non-revertible');
|
|
67
|
+
public async addNewContracts(tx: Tx): Promise<void> {
|
|
68
|
+
const contractDeploymentData = AllContractDeploymentData.fromTx(tx);
|
|
69
|
+
await this.addContracts(contractDeploymentData.getNonRevertibleContractDeploymentData());
|
|
70
|
+
await this.addContracts(contractDeploymentData.getRevertibleContractDeploymentData());
|
|
119
71
|
}
|
|
120
72
|
|
|
121
73
|
/**
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
* @param tx - The transaction to add revertible contract instances from.
|
|
74
|
+
* Creates a new checkpoint, copying the current state for upcoming modifications,
|
|
75
|
+
* and enabling rollbacks to current state in case of a revert.
|
|
125
76
|
*/
|
|
126
|
-
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
this.addContractInstancesFromLogs(contractInstanceLogs, this.currentTxRevertibleCache, 'revertible');
|
|
77
|
+
public createCheckpoint(): void {
|
|
78
|
+
const currentState = this.getCurrentState();
|
|
79
|
+
const newState = currentState.deepCopy();
|
|
80
|
+
this.contractStateStack.push(newState);
|
|
132
81
|
}
|
|
133
82
|
|
|
134
83
|
/**
|
|
135
|
-
*
|
|
136
|
-
* @param siloedContractClassLogs - Contract class logs to process
|
|
137
|
-
* @param cache - The cache to store the contract classes in
|
|
138
|
-
* @param cacheType - Type of cache (for logging)
|
|
84
|
+
* Commits the current checkpoint, accepting its state latest.
|
|
139
85
|
*/
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
.filter((log: ContractClassLog) => ContractClassPublishedEvent.isContractClassPublishedEvent(log))
|
|
147
|
-
.map((log: ContractClassLog) => ContractClassPublishedEvent.fromLog(log));
|
|
148
|
-
|
|
149
|
-
// Cache contract classes
|
|
150
|
-
await Promise.all(
|
|
151
|
-
contractClassEvents.map(async (event: ContractClassPublishedEvent) => {
|
|
152
|
-
this.log.debug(`Adding class ${event.contractClassId.toString()} to contract's ${cacheType} tx cache`);
|
|
153
|
-
const contractClass = await event.toContractClassPublic();
|
|
154
|
-
|
|
155
|
-
cache.addClass(event.contractClassId, contractClass);
|
|
156
|
-
}),
|
|
157
|
-
);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Given a tx's contract instance logs, add the contract instances to the cache
|
|
162
|
-
* @param contractInstanceLogs - Contract instance logs to process
|
|
163
|
-
* @param cache - The cache to store the contract instances in
|
|
164
|
-
* @param cacheType - Type of cache (for logging)
|
|
165
|
-
*/
|
|
166
|
-
private addContractInstancesFromLogs(contractInstanceLogs: PrivateLog[], cache: TxContractCache, cacheType: string) {
|
|
167
|
-
const contractInstanceEvents = contractInstanceLogs
|
|
168
|
-
.filter(log => ContractInstancePublishedEvent.isContractInstancePublishedEvent(log))
|
|
169
|
-
.map(log => ContractInstancePublishedEvent.fromLog(log));
|
|
170
|
-
|
|
171
|
-
// Cache contract instances
|
|
172
|
-
contractInstanceEvents.forEach(e => {
|
|
173
|
-
this.log.debug(
|
|
174
|
-
`Adding instance ${e.address.toString()} with class ${e.contractClassId.toString()} to ${cacheType} tx contract cache`,
|
|
175
|
-
);
|
|
176
|
-
cache.addInstance(e.address, e.toContractInstance());
|
|
177
|
-
});
|
|
86
|
+
public commitCheckpoint(): void {
|
|
87
|
+
if (this.contractStateStack.length <= 1) {
|
|
88
|
+
throw new Error('No checkpoint to commit');
|
|
89
|
+
}
|
|
90
|
+
const topState = this.contractStateStack.pop()!;
|
|
91
|
+
this.contractStateStack[this.contractStateStack.length - 1] = topState;
|
|
178
92
|
}
|
|
179
93
|
|
|
180
94
|
/**
|
|
181
|
-
*
|
|
95
|
+
* Commits the current checkpoint, not erroring if there is no checkpoint
|
|
96
|
+
* to commit. This is useful to do a sanity commit at the end of tx execution,
|
|
97
|
+
* doing nothing if the checkpoint was already reverted, but truly committing
|
|
98
|
+
* otherwise.
|
|
182
99
|
*/
|
|
183
|
-
public
|
|
184
|
-
this.
|
|
185
|
-
|
|
186
|
-
|
|
100
|
+
public commitCheckpointOkIfNone(): void {
|
|
101
|
+
if (this.contractStateStack.length <= 1) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const topState = this.contractStateStack.pop()!;
|
|
105
|
+
this.contractStateStack[this.contractStateStack.length - 1] = topState;
|
|
187
106
|
}
|
|
188
107
|
|
|
189
108
|
/**
|
|
190
|
-
*
|
|
191
|
-
*
|
|
109
|
+
* Reverts the current checkpoint, discarding its state and rolling back
|
|
110
|
+
* to the state as of the latest checkpoint.
|
|
192
111
|
*/
|
|
193
|
-
public
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
if (!onlyNonRevertibles) {
|
|
198
|
-
// Merge revertible tx cache into block cache
|
|
199
|
-
this.blockCache.mergeFrom(this.currentTxRevertibleCache);
|
|
112
|
+
public revertCheckpoint(): void {
|
|
113
|
+
if (this.contractStateStack.length <= 1) {
|
|
114
|
+
throw new Error('No checkpoint to revert');
|
|
200
115
|
}
|
|
116
|
+
this.contractStateStack.pop();
|
|
117
|
+
}
|
|
201
118
|
|
|
202
|
-
|
|
203
|
-
this.
|
|
204
|
-
this.currentTxRevertibleCache.clear();
|
|
119
|
+
private getCurrentState(): ContractsDbCheckpoint {
|
|
120
|
+
return this.contractStateStack[this.contractStateStack.length - 1];
|
|
205
121
|
}
|
|
206
122
|
|
|
207
123
|
// TODO(fcarreiro/alvaro): This method currently needs a blockNumber. Since this class
|
|
@@ -217,53 +133,66 @@ export class PublicContractsDB implements PublicContractsDBInterface {
|
|
|
217
133
|
address: AztecAddress,
|
|
218
134
|
timestamp: UInt64,
|
|
219
135
|
): Promise<ContractInstanceWithAddress | undefined> {
|
|
220
|
-
|
|
221
|
-
return (
|
|
222
|
-
this.currentTxRevertibleCache.getInstance(address) ??
|
|
223
|
-
this.currentTxNonRevertibleCache.getInstance(address) ??
|
|
224
|
-
this.blockCache.getInstance(address) ??
|
|
225
|
-
(await this.dataSource.getContract(address, timestamp))
|
|
226
|
-
);
|
|
136
|
+
const currentState = this.getCurrentState();
|
|
137
|
+
return currentState.getInstance(address) ?? (await this.dataSource.getContract(address, timestamp));
|
|
227
138
|
}
|
|
228
139
|
|
|
229
140
|
public async getContractClass(contractClassId: Fr): Promise<ContractClassPublic | undefined> {
|
|
230
|
-
|
|
231
|
-
return (
|
|
232
|
-
this.currentTxRevertibleCache.getClass(contractClassId) ??
|
|
233
|
-
this.currentTxNonRevertibleCache.getClass(contractClassId) ??
|
|
234
|
-
this.blockCache.getClass(contractClassId) ??
|
|
235
|
-
(await this.dataSource.getContractClass(contractClassId))
|
|
236
|
-
);
|
|
141
|
+
const currentState = this.getCurrentState();
|
|
142
|
+
return currentState.getClass(contractClassId) ?? (await this.dataSource.getContractClass(contractClassId));
|
|
237
143
|
}
|
|
238
144
|
|
|
239
145
|
public async getBytecodeCommitment(contractClassId: Fr): Promise<Fr | undefined> {
|
|
240
|
-
|
|
241
|
-
const
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
// Now try from the store
|
|
247
|
-
const fromStore = await this.dataSource.getBytecodeCommitment(contractClassId);
|
|
248
|
-
if (fromStore !== undefined) {
|
|
249
|
-
this.bytecodeCommitmentCache.set(key, fromStore);
|
|
250
|
-
return fromStore;
|
|
146
|
+
const currentState = this.getCurrentState();
|
|
147
|
+
const commitment =
|
|
148
|
+
currentState.getBytecodeCommitment(contractClassId) ??
|
|
149
|
+
(await this.dataSource.getBytecodeCommitment(contractClassId));
|
|
150
|
+
if (commitment !== undefined) {
|
|
151
|
+
return commitment;
|
|
251
152
|
}
|
|
252
|
-
|
|
253
|
-
//
|
|
153
|
+
// Not in the current state or the store, compute it here
|
|
154
|
+
// Get the contract class
|
|
254
155
|
const contractClass = await this.getContractClass(contractClassId);
|
|
156
|
+
|
|
255
157
|
if (contractClass === undefined) {
|
|
158
|
+
// cannot compute bytecode commitment if contract class is not found
|
|
256
159
|
return undefined;
|
|
257
160
|
}
|
|
258
161
|
|
|
259
162
|
const value = await computePublicBytecodeCommitment(contractClass.packedBytecode);
|
|
260
|
-
|
|
163
|
+
// Add to cache (current checkpoint state) so we don't compute again
|
|
164
|
+
currentState.addBytecodeCommitment(contractClassId, value);
|
|
261
165
|
return value;
|
|
262
166
|
}
|
|
263
167
|
|
|
264
168
|
public async getDebugFunctionName(address: AztecAddress, selector: FunctionSelector): Promise<string | undefined> {
|
|
265
169
|
return await this.dataSource.getDebugFunctionName(address, selector);
|
|
266
170
|
}
|
|
171
|
+
|
|
172
|
+
private async addContractClassesFromEvents(
|
|
173
|
+
contractClassEvents: ContractClassPublishedEvent[],
|
|
174
|
+
state: ContractsDbCheckpoint,
|
|
175
|
+
) {
|
|
176
|
+
await Promise.all(
|
|
177
|
+
contractClassEvents.map(async (event: ContractClassPublishedEvent) => {
|
|
178
|
+
this.log.debug(`Adding class ${event.contractClassId.toString()} to contract state`);
|
|
179
|
+
const contractClass = await event.toContractClassPublic();
|
|
180
|
+
state.addClass(event.contractClassId, contractClass);
|
|
181
|
+
}),
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
private addContractInstancesFromEvents(
|
|
186
|
+
contractInstanceEvents: ContractInstancePublishedEvent[],
|
|
187
|
+
state: ContractsDbCheckpoint,
|
|
188
|
+
) {
|
|
189
|
+
contractInstanceEvents.forEach(e => {
|
|
190
|
+
this.log.debug(
|
|
191
|
+
`Adding instance ${e.address.toString()} with class ${e.contractClassId.toString()} to contract state`,
|
|
192
|
+
);
|
|
193
|
+
state.addInstance(e.address, e.toContractInstance());
|
|
194
|
+
});
|
|
195
|
+
}
|
|
267
196
|
}
|
|
268
197
|
|
|
269
198
|
/**
|
|
@@ -323,9 +252,13 @@ export class PublicTreesDB implements PublicStateDBInterface {
|
|
|
323
252
|
} satisfies PublicDBAccessStats);
|
|
324
253
|
}
|
|
325
254
|
|
|
326
|
-
public async getL1ToL2LeafValue(leafIndex: bigint): Promise<Fr
|
|
255
|
+
public async getL1ToL2LeafValue(leafIndex: bigint): Promise<Fr> {
|
|
327
256
|
const timer = new Timer();
|
|
257
|
+
if (leafIndex > L1_TO_L2_MSG_TREE_LEAF_COUNT) {
|
|
258
|
+
throw new L1ToL2MessageIndexOutOfRangeError(Number(leafIndex));
|
|
259
|
+
}
|
|
328
260
|
const leafValue = await this.db.getLeafValue(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, leafIndex);
|
|
261
|
+
assert(leafValue !== undefined, 'Unexpected null response from l1 to l2 message tree');
|
|
329
262
|
// TODO: We need this for the hints. See class comment for more details.
|
|
330
263
|
await this.db.getSiblingPath(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, leafIndex);
|
|
331
264
|
|
|
@@ -337,9 +270,13 @@ export class PublicTreesDB implements PublicStateDBInterface {
|
|
|
337
270
|
return leafValue;
|
|
338
271
|
}
|
|
339
272
|
|
|
340
|
-
public async getNoteHash(leafIndex: bigint): Promise<Fr
|
|
273
|
+
public async getNoteHash(leafIndex: bigint): Promise<Fr> {
|
|
341
274
|
const timer = new Timer();
|
|
275
|
+
if (leafIndex > NOTE_HASH_TREE_LEAF_COUNT) {
|
|
276
|
+
throw new NoteHashIndexOutOfRangeError(Number(leafIndex));
|
|
277
|
+
}
|
|
342
278
|
const leafValue = await this.db.getLeafValue(MerkleTreeId.NOTE_HASH_TREE, leafIndex);
|
|
279
|
+
assert(leafValue !== undefined, 'Unexpected null response from note hash tree');
|
|
343
280
|
// TODO: We need this for the hints. See class comment for more details.
|
|
344
281
|
await this.db.getSiblingPath(MerkleTreeId.NOTE_HASH_TREE, leafIndex);
|
|
345
282
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Any known (and checked) error that can be thrown during public execution.
|
|
3
|
+
* Includes AvmExecutionErrors and SideEffectErrors.
|
|
4
|
+
*
|
|
5
|
+
* AvmSimulator catches any checked errors before returning a boolean "reverted".
|
|
6
|
+
* Unchecked errors are generally the result of a bug. They are propagated and
|
|
7
|
+
* ultimately will be the resonsibility of PublicProcessor to handle.
|
|
8
|
+
*/
|
|
9
|
+
export abstract class CheckedPublicExecutionError extends Error {
|
|
10
|
+
constructor(message: string) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.name = 'CheckedPublicExecutionError';
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { BlockNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import { SerialQueue } from '@aztec/foundation/queue';
|
|
2
3
|
import type { IndexedTreeLeafPreimage, SiblingPath } from '@aztec/foundation/trees';
|
|
3
4
|
import type {
|
|
@@ -11,6 +12,7 @@ import type {
|
|
|
11
12
|
TreeInfo,
|
|
12
13
|
} from '@aztec/stdlib/trees';
|
|
13
14
|
import type { BlockHeader, StateReference } from '@aztec/stdlib/tx';
|
|
15
|
+
import type { WorldStateRevision, WorldStateRevisionWithHandle } from '@aztec/stdlib/world-state';
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
18
|
* Wraps an instance of `MerkleTreeWriteOperations` to allow the sequencer to gate access.
|
|
@@ -79,6 +81,10 @@ export class GuardedMerkleTreeOperations implements MerkleTreeWriteOperations {
|
|
|
79
81
|
close(): Promise<void> {
|
|
80
82
|
return this.guardAndPush(() => this.target.close());
|
|
81
83
|
}
|
|
84
|
+
|
|
85
|
+
async [Symbol.dispose](): Promise<void> {
|
|
86
|
+
await this.close();
|
|
87
|
+
}
|
|
82
88
|
getTreeInfo(treeId: MerkleTreeId): Promise<TreeInfo> {
|
|
83
89
|
return this.guardAndPush(() => this.target.getTreeInfo(treeId));
|
|
84
90
|
}
|
|
@@ -88,6 +94,9 @@ export class GuardedMerkleTreeOperations implements MerkleTreeWriteOperations {
|
|
|
88
94
|
getInitialHeader(): BlockHeader {
|
|
89
95
|
return this.target.getInitialHeader();
|
|
90
96
|
}
|
|
97
|
+
public getRevision(): WorldStateRevision | WorldStateRevisionWithHandle {
|
|
98
|
+
return this.target.getRevision();
|
|
99
|
+
}
|
|
91
100
|
getSiblingPath<ID extends MerkleTreeId>(treeId: ID, index: bigint): Promise<SiblingPath<TreeHeights[ID]>> {
|
|
92
101
|
return this.guardAndPush(() => this.target.getSiblingPath(treeId, index));
|
|
93
102
|
}
|
|
@@ -122,7 +131,7 @@ export class GuardedMerkleTreeOperations implements MerkleTreeWriteOperations {
|
|
|
122
131
|
getBlockNumbersForLeafIndices<ID extends MerkleTreeId>(
|
|
123
132
|
treeId: ID,
|
|
124
133
|
leafIndices: bigint[],
|
|
125
|
-
): Promise<(
|
|
134
|
+
): Promise<(BlockNumber | undefined)[]> {
|
|
126
135
|
return this.guardAndPush(() => this.target.getBlockNumbersForLeafIndices(treeId, leafIndices));
|
|
127
136
|
}
|
|
128
137
|
createCheckpoint(): Promise<void> {
|