@aztec/simulator 0.76.4 → 0.77.0-testnet-ignition.21
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 +3 -3
- package/dest/client.d.ts +5 -0
- package/dest/client.d.ts.map +1 -0
- package/dest/client.js +3 -0
- package/dest/{public → common}/db_interfaces.d.ts +8 -33
- package/dest/common/db_interfaces.d.ts.map +1 -0
- package/dest/common/db_interfaces.js +1 -0
- package/dest/common/debug_fn_name.d.ts +3 -2
- package/dest/common/debug_fn_name.d.ts.map +1 -1
- package/dest/common/debug_fn_name.js +2 -5
- package/dest/common/errors.d.ts +4 -4
- package/dest/common/errors.d.ts.map +1 -1
- package/dest/common/errors.js +30 -39
- package/dest/common/index.d.ts +2 -1
- package/dest/common/index.d.ts.map +1 -1
- package/dest/common/index.js +2 -2
- package/dest/common/message_load_oracle_inputs.d.ts +2 -2
- package/dest/common/message_load_oracle_inputs.d.ts.map +1 -1
- package/dest/common/message_load_oracle_inputs.js +8 -8
- package/dest/common/stats/index.d.ts.map +1 -0
- package/dest/{stats → common/stats}/stats.d.ts +2 -2
- package/dest/common/stats/stats.d.ts.map +1 -0
- package/dest/common/stats/stats.js +10 -0
- package/dest/{acvm → private/acvm}/acvm.d.ts +4 -4
- package/dest/private/acvm/acvm.d.ts.map +1 -0
- package/dest/private/acvm/acvm.js +70 -0
- package/dest/{acvm → private/acvm}/acvm_types.d.ts +1 -1
- package/dest/private/acvm/acvm_types.d.ts.map +1 -0
- package/dest/private/acvm/acvm_types.js +3 -0
- package/dest/{acvm → private/acvm}/deserialize.d.ts +2 -2
- package/dest/private/acvm/deserialize.d.ts.map +1 -0
- package/dest/private/acvm/deserialize.js +42 -0
- package/dest/private/acvm/index.d.ts.map +1 -0
- package/dest/private/acvm/index.js +5 -0
- package/dest/{acvm → private/acvm}/oracle/index.d.ts +1 -1
- package/dest/private/acvm/oracle/index.d.ts.map +1 -0
- package/dest/private/acvm/oracle/index.js +2 -0
- package/dest/{acvm → private/acvm}/oracle/oracle.d.ts +4 -3
- package/dest/private/acvm/oracle/oracle.d.ts.map +1 -0
- package/dest/private/acvm/oracle/oracle.js +263 -0
- package/dest/{acvm → private/acvm}/oracle/typed_oracle.d.ts +12 -6
- package/dest/private/acvm/oracle/typed_oracle.d.ts.map +1 -0
- package/dest/private/acvm/oracle/typed_oracle.js +132 -0
- package/dest/{acvm → private/acvm}/serialize.d.ts +7 -3
- package/dest/private/acvm/serialize.d.ts.map +1 -0
- package/dest/private/acvm/serialize.js +46 -0
- package/dest/{client → private}/client_execution_context.d.ts +20 -17
- package/dest/private/client_execution_context.d.ts.map +1 -0
- package/dest/private/client_execution_context.js +378 -0
- package/dest/{client → private}/db_oracle.d.ts +19 -7
- package/dest/private/db_oracle.d.ts.map +1 -0
- package/dest/private/db_oracle.js +14 -0
- package/dest/{client → private}/execution_note_cache.d.ts +2 -2
- package/dest/private/execution_note_cache.d.ts.map +1 -0
- package/dest/private/execution_note_cache.js +180 -0
- package/dest/{common → private}/hashed_values_cache.d.ts +2 -2
- package/dest/private/hashed_values_cache.d.ts.map +1 -0
- package/dest/private/hashed_values_cache.js +46 -0
- package/dest/private/index.d.ts +13 -0
- package/dest/private/index.d.ts.map +1 -0
- package/dest/private/index.js +12 -0
- package/dest/{client → private}/pick_notes.d.ts +1 -1
- package/dest/private/pick_notes.d.ts.map +1 -0
- package/dest/private/pick_notes.js +51 -0
- package/dest/private/private_execution.d.ts +24 -0
- package/dest/private/private_execution.d.ts.map +1 -0
- package/dest/private/private_execution.js +90 -0
- package/dest/{providers → private/providers}/acvm_native.d.ts +5 -5
- package/dest/private/providers/acvm_native.d.ts.map +1 -0
- package/dest/private/providers/acvm_native.js +139 -0
- package/dest/{providers → private/providers}/acvm_wasm.d.ts +4 -4
- package/dest/private/providers/acvm_wasm.d.ts.map +1 -0
- package/dest/private/providers/acvm_wasm.js +62 -0
- package/dest/{providers → private/providers}/acvm_wasm_with_blobs.d.ts +5 -5
- package/dest/private/providers/acvm_wasm_with_blobs.d.ts.map +1 -0
- package/dest/{providers → private/providers}/acvm_wasm_with_blobs.js +3 -6
- package/dest/{providers → private/providers}/factory.d.ts +1 -1
- package/dest/private/providers/factory.d.ts.map +1 -0
- package/dest/private/providers/factory.js +27 -0
- package/dest/{common → private/providers}/simulation_provider.d.ts +5 -5
- package/dest/private/providers/simulation_provider.d.ts.map +1 -0
- package/dest/private/providers/simulation_provider.js +24 -0
- package/dest/private/simulator.d.ts +36 -0
- package/dest/private/simulator.d.ts.map +1 -0
- package/dest/private/simulator.js +78 -0
- package/dest/{client → private}/unconstrained_execution.d.ts +5 -5
- package/dest/private/unconstrained_execution.d.ts.map +1 -0
- package/dest/private/unconstrained_execution.js +27 -0
- package/dest/{client → private}/view_data_oracle.d.ts +15 -7
- package/dest/private/view_data_oracle.d.ts.map +1 -0
- package/dest/private/view_data_oracle.js +260 -0
- package/dest/{avm → public/avm}/avm_context.d.ts +7 -5
- package/dest/public/avm/avm_context.d.ts.map +1 -0
- package/dest/public/avm/avm_context.js +44 -0
- package/dest/{avm → public/avm}/avm_contract_call_result.d.ts +5 -5
- package/dest/public/avm/avm_contract_call_result.d.ts.map +1 -0
- package/dest/public/avm/avm_contract_call_result.js +50 -0
- package/dest/{avm → public/avm}/avm_execution_environment.d.ts +2 -2
- package/dest/public/avm/avm_execution_environment.d.ts.map +1 -0
- package/dest/public/avm/avm_execution_environment.js +31 -0
- package/dest/public/avm/avm_gas.d.ts.map +1 -0
- package/dest/public/avm/avm_gas.js +202 -0
- package/dest/{avm → public/avm}/avm_machine_state.d.ts +2 -2
- package/dest/public/avm/avm_machine_state.d.ts.map +1 -0
- package/dest/public/avm/avm_machine_state.js +106 -0
- package/dest/{avm → public/avm}/avm_memory_types.d.ts +2 -2
- package/dest/public/avm/avm_memory_types.d.ts.map +1 -0
- package/dest/public/avm/avm_memory_types.js +340 -0
- package/dest/{avm → public/avm}/avm_simulator.d.ts +5 -3
- package/dest/public/avm/avm_simulator.d.ts.map +1 -0
- package/dest/public/avm/avm_simulator.js +202 -0
- package/dest/public/avm/bytecode_utils.d.ts.map +1 -0
- package/dest/public/avm/bytecode_utils.js +17 -0
- package/dest/{avm → public/avm}/errors.d.ts +5 -4
- package/dest/public/avm/errors.d.ts.map +1 -0
- package/dest/public/avm/errors.js +179 -0
- package/dest/{avm → public/avm}/fixtures/avm_simulation_tester.d.ts +6 -6
- package/dest/public/avm/fixtures/avm_simulation_tester.d.ts.map +1 -0
- package/dest/public/avm/fixtures/avm_simulation_tester.js +76 -0
- package/dest/{avm → public/avm}/fixtures/base_avm_simulation_tester.d.ts +13 -12
- package/dest/public/avm/fixtures/base_avm_simulation_tester.d.ts.map +1 -0
- package/dest/public/avm/fixtures/base_avm_simulation_tester.js +83 -0
- package/dest/{avm → public/avm}/fixtures/index.d.ts +24 -7
- package/dest/public/avm/fixtures/index.d.ts.map +1 -0
- package/dest/public/avm/fixtures/index.js +175 -0
- package/dest/{avm → public/avm}/fixtures/simple_contract_data_source.d.ts +10 -6
- package/dest/public/avm/fixtures/simple_contract_data_source.d.ts.map +1 -0
- package/dest/public/avm/fixtures/simple_contract_data_source.js +74 -0
- package/dest/public/avm/index.d.ts +4 -0
- package/dest/public/avm/index.d.ts.map +1 -0
- package/dest/{avm/index.d.ts → public/avm/index.js} +1 -2
- package/dest/public/avm/journal/index.d.ts.map +1 -0
- package/dest/{avm → public/avm}/journal/journal.d.ts +51 -18
- package/dest/public/avm/journal/journal.d.ts.map +1 -0
- package/dest/public/avm/journal/journal.js +486 -0
- package/dest/{avm → public/avm}/journal/nullifiers.d.ts +8 -6
- package/dest/public/avm/journal/nullifiers.d.ts.map +1 -0
- package/dest/public/avm/journal/nullifiers.js +97 -0
- package/dest/{avm → public/avm}/journal/public_storage.d.ts +2 -2
- package/dest/public/avm/journal/public_storage.d.ts.map +1 -0
- package/dest/public/avm/journal/public_storage.js +145 -0
- package/dest/public/avm/opcodes/accrued_substate.d.ts.map +1 -0
- package/dest/public/avm/opcodes/accrued_substate.js +252 -0
- package/dest/public/avm/opcodes/addressing_mode.d.ts.map +1 -0
- package/dest/public/avm/opcodes/addressing_mode.js +74 -0
- package/dest/public/avm/opcodes/arithmetic.d.ts.map +1 -0
- package/dest/public/avm/opcodes/arithmetic.js +73 -0
- package/dest/public/avm/opcodes/bitwise.d.ts.map +1 -0
- package/dest/public/avm/opcodes/bitwise.js +106 -0
- package/dest/public/avm/opcodes/comparators.d.ts.map +1 -0
- package/dest/public/avm/opcodes/comparators.js +43 -0
- package/dest/public/avm/opcodes/contract.d.ts.map +1 -0
- package/dest/public/avm/opcodes/contract.js +66 -0
- package/dest/public/avm/opcodes/control_flow.d.ts.map +1 -0
- package/dest/public/avm/opcodes/control_flow.js +105 -0
- package/dest/{avm → public/avm}/opcodes/conversion.d.ts +1 -1
- package/dest/public/avm/opcodes/conversion.d.ts.map +1 -0
- package/dest/public/avm/opcodes/conversion.js +69 -0
- package/dest/{avm → public/avm}/opcodes/ec_add.d.ts +1 -1
- package/dest/public/avm/opcodes/ec_add.d.ts.map +1 -0
- package/dest/public/avm/opcodes/ec_add.js +84 -0
- package/dest/public/avm/opcodes/environment_getters.d.ts.map +1 -0
- package/dest/public/avm/opcodes/environment_getters.js +79 -0
- package/dest/public/avm/opcodes/external_calls.d.ts.map +1 -0
- package/dest/public/avm/opcodes/external_calls.js +180 -0
- package/dest/{avm → public/avm}/opcodes/hashing.d.ts +1 -1
- package/dest/public/avm/opcodes/hashing.d.ts.map +1 -0
- package/dest/public/avm/opcodes/hashing.js +114 -0
- package/dest/public/avm/opcodes/index.d.ts.map +1 -0
- package/dest/{avm → public/avm}/opcodes/instruction.d.ts +2 -2
- package/dest/public/avm/opcodes/instruction.d.ts.map +1 -0
- package/dest/public/avm/opcodes/instruction.js +91 -0
- package/dest/public/avm/opcodes/instruction_impl.d.ts.map +1 -0
- package/dest/public/avm/opcodes/instruction_impl.js +30 -0
- package/dest/public/avm/opcodes/memory.d.ts.map +1 -0
- package/dest/public/avm/opcodes/memory.js +253 -0
- package/dest/{avm → public/avm}/opcodes/misc.d.ts +1 -1
- package/dest/public/avm/opcodes/misc.d.ts.map +1 -0
- package/dest/public/avm/opcodes/misc.js +48 -0
- package/dest/public/avm/opcodes/storage.d.ts.map +1 -0
- package/dest/public/avm/opcodes/storage.js +66 -0
- package/dest/public/avm/serialization/buffer_cursor.d.ts.map +1 -0
- package/dest/public/avm/serialization/buffer_cursor.js +99 -0
- package/dest/{avm → public/avm}/serialization/bytecode_serialization.d.ts +1 -1
- package/dest/public/avm/serialization/bytecode_serialization.d.ts.map +1 -0
- package/dest/public/avm/serialization/bytecode_serialization.js +328 -0
- package/dest/{avm → public/avm}/serialization/instruction_serialization.d.ts +1 -2
- package/dest/public/avm/serialization/instruction_serialization.d.ts.map +1 -0
- package/dest/public/avm/serialization/instruction_serialization.js +225 -0
- package/dest/{avm → public/avm}/test_utils.d.ts +6 -4
- package/dest/public/avm/test_utils.d.ts.map +1 -0
- package/dest/public/avm/test_utils.js +52 -0
- package/dest/public/bytecode_errors.js +1 -2
- package/dest/public/execution.d.ts +8 -2
- package/dest/public/execution.d.ts.map +1 -1
- package/dest/public/execution.js +4 -5
- package/dest/public/executor_metrics.js +16 -12
- package/dest/public/fixtures/index.js +0 -1
- package/dest/public/fixtures/public_tx_simulation_tester.d.ts +15 -9
- package/dest/public/fixtures/public_tx_simulation_tester.d.ts.map +1 -1
- package/dest/public/fixtures/public_tx_simulation_tester.js +54 -53
- package/dest/public/fixtures/utils.d.ts +7 -11
- package/dest/public/fixtures/utils.d.ts.map +1 -1
- package/dest/public/fixtures/utils.js +92 -32
- package/dest/public/index.d.ts +5 -4
- package/dest/public/index.d.ts.map +1 -1
- package/dest/public/index.js +5 -5
- package/dest/public/public_db_sources.d.ts +82 -34
- package/dest/public/public_db_sources.d.ts.map +1 -1
- package/dest/public/public_db_sources.js +171 -196
- package/dest/public/{public_processor.d.ts → public_processor/public_processor.d.ts} +10 -8
- package/dest/public/public_processor/public_processor.d.ts.map +1 -0
- package/dest/public/public_processor/public_processor.js +379 -0
- package/dest/public/{public_processor_metrics.d.ts → public_processor/public_processor_metrics.d.ts} +3 -3
- package/dest/public/public_processor/public_processor_metrics.d.ts.map +1 -0
- package/dest/public/public_processor/public_processor_metrics.js +125 -0
- package/dest/public/{public_tx_context.d.ts → public_tx_simulator/public_tx_context.d.ts} +14 -8
- package/dest/public/public_tx_simulator/public_tx_context.d.ts.map +1 -0
- package/dest/public/public_tx_simulator/public_tx_context.js +320 -0
- package/dest/public/{public_tx_simulator.d.ts → public_tx_simulator/public_tx_simulator.d.ts} +10 -7
- package/dest/public/public_tx_simulator/public_tx_simulator.d.ts.map +1 -0
- package/dest/public/public_tx_simulator/public_tx_simulator.js +325 -0
- package/dest/public/side_effect_errors.js +1 -2
- package/dest/public/side_effect_trace.d.ts +16 -10
- package/dest/public/side_effect_trace.d.ts.map +1 -1
- package/dest/public/side_effect_trace.js +82 -149
- package/dest/public/side_effect_trace_interface.d.ts +9 -7
- package/dest/public/side_effect_trace_interface.d.ts.map +1 -1
- package/dest/public/side_effect_trace_interface.js +1 -2
- package/dest/public/tx_contract_cache.d.ts +41 -0
- package/dest/public/tx_contract_cache.d.ts.map +1 -0
- package/dest/public/tx_contract_cache.js +49 -0
- package/dest/public/unique_class_ids.js +23 -28
- package/dest/public/utils.d.ts +2 -2
- package/dest/public/utils.d.ts.map +1 -1
- package/dest/public/utils.js +17 -12
- package/dest/server.d.ts +4 -4
- package/dest/server.d.ts.map +1 -1
- package/dest/server.js +3 -5
- package/dest/test/utils.d.ts +3 -2
- package/dest/test/utils.d.ts.map +1 -1
- package/dest/test/utils.js +9 -7
- package/package.json +19 -21
- package/src/client.ts +4 -0
- package/src/{public → common}/db_interfaces.ts +8 -40
- package/src/common/debug_fn_name.ts +4 -2
- package/src/common/errors.ts +5 -5
- package/src/common/index.ts +2 -1
- package/src/common/message_load_oracle_inputs.ts +2 -2
- package/src/common/stats/index.ts +1 -0
- package/src/{stats → common/stats}/stats.ts +2 -2
- package/src/{acvm → private/acvm}/acvm.ts +5 -5
- package/src/{acvm → private/acvm}/acvm_types.ts +1 -1
- package/src/{acvm → private/acvm}/deserialize.ts +2 -2
- package/src/{acvm → private/acvm}/oracle/index.ts +1 -1
- package/src/{acvm → private/acvm}/oracle/oracle.ts +22 -12
- package/src/{acvm → private/acvm}/oracle/typed_oracle.ts +50 -55
- package/src/{acvm → private/acvm}/serialize.ts +10 -3
- package/src/{client → private}/client_execution_context.ts +54 -37
- package/src/{client → private}/db_oracle.ts +20 -20
- package/src/{client → private}/execution_note_cache.ts +3 -3
- package/src/{common → private}/hashed_values_cache.ts +2 -2
- package/src/private/index.ts +12 -0
- package/src/{client → private}/pick_notes.ts +1 -1
- package/src/{client → private}/private_execution.ts +46 -14
- package/src/{providers → private/providers}/acvm_native.ts +6 -6
- package/src/{providers → private/providers}/acvm_wasm.ts +4 -4
- package/src/{providers → private/providers}/acvm_wasm_with_blobs.ts +5 -5
- package/src/{providers → private/providers}/factory.ts +1 -1
- package/src/{common → private/providers}/simulation_provider.ts +5 -5
- package/src/{client → private}/simulator.ts +31 -123
- package/src/{client → private}/unconstrained_execution.ts +7 -7
- package/src/{client → private}/view_data_oracle.ts +25 -28
- package/src/{avm → public/avm}/avm_context.ts +12 -7
- package/src/{avm → public/avm}/avm_contract_call_result.ts +6 -6
- package/src/{avm → public/avm}/avm_execution_environment.ts +2 -2
- package/src/{avm → public/avm}/avm_gas.ts +1 -3
- package/src/{avm → public/avm}/avm_machine_state.ts +2 -2
- package/src/{avm → public/avm}/avm_memory_types.ts +4 -4
- package/src/{avm → public/avm}/avm_simulator.ts +12 -6
- package/src/{avm → public/avm}/errors.ts +5 -4
- package/src/{avm → public/avm}/fixtures/avm_simulation_tester.ts +16 -15
- package/src/{avm → public/avm}/fixtures/base_avm_simulation_tester.ts +45 -40
- package/src/{avm → public/avm}/fixtures/index.ts +77 -12
- package/src/{avm → public/avm}/fixtures/simple_contract_data_source.ts +26 -19
- package/src/{avm → public/avm}/index.ts +1 -1
- package/src/public/avm/journal/index.ts +1 -0
- package/src/{avm → public/avm}/journal/journal.ts +330 -305
- package/src/{avm → public/avm}/journal/nullifiers.ts +20 -19
- package/src/{avm → public/avm}/journal/public_storage.ts +2 -2
- package/src/{avm → public/avm}/opcodes/contract.ts +1 -1
- package/src/{avm → public/avm}/opcodes/control_flow.ts +1 -1
- package/src/{avm → public/avm}/opcodes/conversion.ts +1 -1
- package/src/{avm → public/avm}/opcodes/ec_add.ts +2 -2
- package/src/{avm → public/avm}/opcodes/external_calls.ts +5 -6
- package/src/{avm → public/avm}/opcodes/hashing.ts +1 -1
- package/src/public/avm/opcodes/index.ts +15 -0
- package/src/{avm → public/avm}/opcodes/instruction.ts +2 -2
- package/src/{avm → public/avm}/opcodes/misc.ts +1 -1
- package/src/public/avm/serialization/bytecode_serialization.ts +204 -0
- package/src/{avm → public/avm}/serialization/instruction_serialization.ts +0 -1
- package/src/{avm → public/avm}/test_utils.ts +10 -7
- package/src/public/execution.ts +9 -12
- package/src/public/fixtures/public_tx_simulation_tester.ts +66 -72
- package/src/public/fixtures/utils.ts +122 -33
- package/src/public/index.ts +5 -4
- package/src/public/public_db_sources.ts +216 -222
- package/src/public/{public_processor.ts → public_processor/public_processor.ts} +78 -53
- package/src/public/{public_processor_metrics.ts → public_processor/public_processor_metrics.ts} +3 -3
- package/src/public/{public_tx_context.ts → public_tx_simulator/public_tx_context.ts} +70 -75
- package/src/public/{public_tx_simulator.ts → public_tx_simulator/public_tx_simulator.ts} +104 -91
- package/src/public/side_effect_trace.ts +85 -160
- package/src/public/side_effect_trace_interface.ts +10 -23
- package/src/public/tx_contract_cache.ts +69 -0
- package/src/public/unique_class_ids.ts +1 -1
- package/src/public/utils.ts +2 -2
- package/src/server.ts +4 -4
- package/src/test/utils.ts +5 -3
- package/dest/acvm/acvm.d.ts.map +0 -1
- package/dest/acvm/acvm.js +0 -73
- package/dest/acvm/acvm_types.d.ts.map +0 -1
- package/dest/acvm/acvm_types.js +0 -2
- package/dest/acvm/deserialize.d.ts.map +0 -1
- package/dest/acvm/deserialize.js +0 -46
- package/dest/acvm/index.d.ts.map +0 -1
- package/dest/acvm/index.js +0 -6
- package/dest/acvm/oracle/index.d.ts.map +0 -1
- package/dest/acvm/oracle/index.js +0 -3
- package/dest/acvm/oracle/oracle.d.ts.map +0 -1
- package/dest/acvm/oracle/oracle.js +0 -230
- package/dest/acvm/oracle/typed_oracle.d.ts.map +0 -1
- package/dest/acvm/oracle/typed_oracle.js +0 -131
- package/dest/acvm/serialize.d.ts.map +0 -1
- package/dest/acvm/serialize.js +0 -48
- package/dest/avm/avm_context.d.ts.map +0 -1
- package/dest/avm/avm_context.js +0 -44
- package/dest/avm/avm_contract_call_result.d.ts.map +0 -1
- package/dest/avm/avm_contract_call_result.js +0 -45
- package/dest/avm/avm_execution_environment.d.ts.map +0 -1
- package/dest/avm/avm_execution_environment.js +0 -28
- package/dest/avm/avm_gas.d.ts.map +0 -1
- package/dest/avm/avm_gas.js +0 -170
- package/dest/avm/avm_machine_state.d.ts.map +0 -1
- package/dest/avm/avm_machine_state.js +0 -112
- package/dest/avm/avm_memory_types.d.ts.map +0 -1
- package/dest/avm/avm_memory_types.js +0 -327
- package/dest/avm/avm_simulator.d.ts.map +0 -1
- package/dest/avm/avm_simulator.js +0 -193
- package/dest/avm/avm_tree.d.ts +0 -282
- package/dest/avm/avm_tree.d.ts.map +0 -1
- package/dest/avm/avm_tree.js +0 -684
- package/dest/avm/bytecode_utils.d.ts.map +0 -1
- package/dest/avm/bytecode_utils.js +0 -15
- package/dest/avm/errors.d.ts.map +0 -1
- package/dest/avm/errors.js +0 -196
- package/dest/avm/fixtures/avm_simulation_tester.d.ts.map +0 -1
- package/dest/avm/fixtures/avm_simulation_tester.js +0 -73
- package/dest/avm/fixtures/base_avm_simulation_tester.d.ts.map +0 -1
- package/dest/avm/fixtures/base_avm_simulation_tester.js +0 -76
- package/dest/avm/fixtures/index.d.ts.map +0 -1
- package/dest/avm/fixtures/index.js +0 -134
- package/dest/avm/fixtures/simple_contract_data_source.d.ts.map +0 -1
- package/dest/avm/fixtures/simple_contract_data_source.js +0 -75
- package/dest/avm/index.d.ts.map +0 -1
- package/dest/avm/index.js +0 -4
- package/dest/avm/journal/index.d.ts.map +0 -1
- package/dest/avm/journal/index.js +0 -2
- package/dest/avm/journal/journal.d.ts.map +0 -1
- package/dest/avm/journal/journal.js +0 -499
- package/dest/avm/journal/nullifiers.d.ts.map +0 -1
- package/dest/avm/journal/nullifiers.js +0 -99
- package/dest/avm/journal/public_storage.d.ts.map +0 -1
- package/dest/avm/journal/public_storage.js +0 -159
- package/dest/avm/opcodes/accrued_substate.d.ts.map +0 -1
- package/dest/avm/opcodes/accrued_substate.js +0 -215
- package/dest/avm/opcodes/addressing_mode.d.ts.map +0 -1
- package/dest/avm/opcodes/addressing_mode.js +0 -81
- package/dest/avm/opcodes/arithmetic.d.ts.map +0 -1
- package/dest/avm/opcodes/arithmetic.js +0 -70
- package/dest/avm/opcodes/bitwise.d.ts.map +0 -1
- package/dest/avm/opcodes/bitwise.js +0 -90
- package/dest/avm/opcodes/comparators.d.ts.map +0 -1
- package/dest/avm/opcodes/comparators.js +0 -40
- package/dest/avm/opcodes/contract.d.ts.map +0 -1
- package/dest/avm/opcodes/contract.js +0 -63
- package/dest/avm/opcodes/control_flow.d.ts.map +0 -1
- package/dest/avm/opcodes/control_flow.js +0 -97
- package/dest/avm/opcodes/conversion.d.ts.map +0 -1
- package/dest/avm/opcodes/conversion.js +0 -64
- package/dest/avm/opcodes/ec_add.d.ts.map +0 -1
- package/dest/avm/opcodes/ec_add.js +0 -82
- package/dest/avm/opcodes/environment_getters.d.ts.map +0 -1
- package/dest/avm/opcodes/environment_getters.js +0 -78
- package/dest/avm/opcodes/external_calls.d.ts.map +0 -1
- package/dest/avm/opcodes/external_calls.js +0 -169
- package/dest/avm/opcodes/hashing.d.ts.map +0 -1
- package/dest/avm/opcodes/hashing.js +0 -103
- package/dest/avm/opcodes/index.d.ts.map +0 -1
- package/dest/avm/opcodes/index.js +0 -16
- package/dest/avm/opcodes/instruction.d.ts.map +0 -1
- package/dest/avm/opcodes/instruction.js +0 -100
- package/dest/avm/opcodes/instruction_impl.d.ts.map +0 -1
- package/dest/avm/opcodes/instruction_impl.js +0 -33
- package/dest/avm/opcodes/memory.d.ts.map +0 -1
- package/dest/avm/opcodes/memory.js +0 -226
- package/dest/avm/opcodes/misc.d.ts.map +0 -1
- package/dest/avm/opcodes/misc.js +0 -45
- package/dest/avm/opcodes/multi_scalar_mul.d.ts +0 -16
- package/dest/avm/opcodes/multi_scalar_mul.d.ts.map +0 -1
- package/dest/avm/opcodes/multi_scalar_mul.js +0 -112
- package/dest/avm/opcodes/storage.d.ts.map +0 -1
- package/dest/avm/opcodes/storage.js +0 -61
- package/dest/avm/serialization/buffer_cursor.d.ts.map +0 -1
- package/dest/avm/serialization/buffer_cursor.js +0 -99
- package/dest/avm/serialization/bytecode_serialization.d.ts.map +0 -1
- package/dest/avm/serialization/bytecode_serialization.js +0 -132
- package/dest/avm/serialization/instruction_serialization.d.ts.map +0 -1
- package/dest/avm/serialization/instruction_serialization.js +0 -187
- package/dest/avm/test_utils.d.ts.map +0 -1
- package/dest/avm/test_utils.js +0 -52
- package/dest/client/client_execution_context.d.ts.map +0 -1
- package/dest/client/client_execution_context.js +0 -392
- package/dest/client/db_oracle.d.ts.map +0 -1
- package/dest/client/db_oracle.js +0 -17
- package/dest/client/execution_note_cache.d.ts.map +0 -1
- package/dest/client/execution_note_cache.js +0 -181
- package/dest/client/index.d.ts +0 -16
- package/dest/client/index.d.ts.map +0 -1
- package/dest/client/index.js +0 -15
- package/dest/client/pick_notes.d.ts.map +0 -1
- package/dest/client/pick_notes.js +0 -54
- package/dest/client/private_execution.d.ts +0 -19
- package/dest/client/private_execution.d.ts.map +0 -1
- package/dest/client/private_execution.js +0 -72
- package/dest/client/simulator.d.ts +0 -60
- package/dest/client/simulator.d.ts.map +0 -1
- package/dest/client/simulator.js +0 -136
- package/dest/client/unconstrained_execution.d.ts.map +0 -1
- package/dest/client/unconstrained_execution.js +0 -30
- package/dest/client/view_data_oracle.d.ts.map +0 -1
- package/dest/client/view_data_oracle.js +0 -268
- package/dest/common/hashed_values_cache.d.ts.map +0 -1
- package/dest/common/hashed_values_cache.js +0 -50
- package/dest/common/simulation_provider.d.ts.map +0 -1
- package/dest/common/simulation_provider.js +0 -27
- package/dest/common.d.ts +0 -2
- package/dest/common.d.ts.map +0 -1
- package/dest/common.js +0 -2
- package/dest/providers/acvm_native.d.ts.map +0 -1
- package/dest/providers/acvm_native.js +0 -125
- package/dest/providers/acvm_wasm.d.ts.map +0 -1
- package/dest/providers/acvm_wasm.js +0 -54
- package/dest/providers/acvm_wasm_with_blobs.d.ts.map +0 -1
- package/dest/providers/factory.d.ts.map +0 -1
- package/dest/providers/factory.js +0 -27
- package/dest/providers/index.d.ts +0 -5
- package/dest/providers/index.d.ts.map +0 -1
- package/dest/providers/index.js +0 -5
- package/dest/public/db_interfaces.d.ts.map +0 -1
- package/dest/public/db_interfaces.js +0 -2
- package/dest/public/fee_payment.d.ts +0 -11
- package/dest/public/fee_payment.d.ts.map +0 -1
- package/dest/public/fee_payment.js +0 -21
- package/dest/public/public_processor.d.ts.map +0 -1
- package/dest/public/public_processor.js +0 -352
- package/dest/public/public_processor_metrics.d.ts.map +0 -1
- package/dest/public/public_processor_metrics.js +0 -106
- package/dest/public/public_tx_context.d.ts.map +0 -1
- package/dest/public/public_tx_context.js +0 -341
- package/dest/public/public_tx_simulator.d.ts.map +0 -1
- package/dest/public/public_tx_simulator.js +0 -333
- package/dest/stats/index.d.ts.map +0 -1
- package/dest/stats/index.js +0 -2
- package/dest/stats/stats.d.ts.map +0 -1
- package/dest/stats/stats.js +0 -11
- package/src/avm/avm_tree.ts +0 -887
- package/src/avm/opcodes/multi_scalar_mul.ts +0 -121
- package/src/avm/serialization/bytecode_serialization.ts +0 -212
- package/src/client/index.ts +0 -15
- package/src/common.ts +0 -1
- package/src/providers/index.ts +0 -4
- package/src/public/fee_payment.ts +0 -23
- /package/dest/{stats → common/stats}/index.d.ts +0 -0
- /package/{src/stats/index.ts → dest/common/stats/index.js} +0 -0
- /package/dest/{acvm → private/acvm}/index.d.ts +0 -0
- /package/dest/{avm → public/avm}/avm_gas.d.ts +0 -0
- /package/dest/{avm → public/avm}/bytecode_utils.d.ts +0 -0
- /package/dest/{avm → public/avm}/journal/index.d.ts +0 -0
- /package/{src/avm/journal/index.ts → dest/public/avm/journal/index.js} +0 -0
- /package/dest/{avm → public/avm}/opcodes/accrued_substate.d.ts +0 -0
- /package/dest/{avm → public/avm}/opcodes/addressing_mode.d.ts +0 -0
- /package/dest/{avm → public/avm}/opcodes/arithmetic.d.ts +0 -0
- /package/dest/{avm → public/avm}/opcodes/bitwise.d.ts +0 -0
- /package/dest/{avm → public/avm}/opcodes/comparators.d.ts +0 -0
- /package/dest/{avm → public/avm}/opcodes/contract.d.ts +0 -0
- /package/dest/{avm → public/avm}/opcodes/control_flow.d.ts +0 -0
- /package/dest/{avm → public/avm}/opcodes/environment_getters.d.ts +0 -0
- /package/dest/{avm → public/avm}/opcodes/external_calls.d.ts +0 -0
- /package/dest/{avm → public/avm}/opcodes/index.d.ts +0 -0
- /package/{src/avm/opcodes/index.ts → dest/public/avm/opcodes/index.js} +0 -0
- /package/dest/{avm → public/avm}/opcodes/instruction_impl.d.ts +0 -0
- /package/dest/{avm → public/avm}/opcodes/memory.d.ts +0 -0
- /package/dest/{avm → public/avm}/opcodes/storage.d.ts +0 -0
- /package/dest/{avm → public/avm}/serialization/buffer_cursor.d.ts +0 -0
- /package/src/{acvm → private/acvm}/index.ts +0 -0
- /package/src/{avm → public/avm}/bytecode_utils.ts +0 -0
- /package/src/{avm → public/avm}/opcodes/.eslintrc.cjs +0 -0
- /package/src/{avm → public/avm}/opcodes/accrued_substate.ts +0 -0
- /package/src/{avm → public/avm}/opcodes/addressing_mode.ts +0 -0
- /package/src/{avm → public/avm}/opcodes/arithmetic.ts +0 -0
- /package/src/{avm → public/avm}/opcodes/bitwise.ts +0 -0
- /package/src/{avm → public/avm}/opcodes/comparators.ts +0 -0
- /package/src/{avm → public/avm}/opcodes/environment_getters.ts +0 -0
- /package/src/{avm → public/avm}/opcodes/instruction_impl.ts +0 -0
- /package/src/{avm → public/avm}/opcodes/memory.ts +0 -0
- /package/src/{avm → public/avm}/opcodes/storage.ts +0 -0
- /package/src/{avm → public/avm}/serialization/buffer_cursor.ts +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { foreignCallHandler } from '@aztec/noir-protocol-circuits-types/server';
|
|
2
|
-
import {
|
|
2
|
+
import type { NoirCompiledCircuit } from '@aztec/stdlib/noir';
|
|
3
3
|
|
|
4
4
|
import { type ExecutionError, executeCircuit } from '@noir-lang/acvm_js';
|
|
5
|
-
import {
|
|
5
|
+
import type { WitnessMap } from '@noir-lang/types';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { type SimulationProvider, parseErrorPayload } from '
|
|
7
|
+
import type { ACIRCallback, ACIRExecutionResult } from '../acvm/acvm.js';
|
|
8
|
+
import type { ACVMWitness } from '../acvm/acvm_types.js';
|
|
9
|
+
import { type SimulationProvider, parseErrorPayload } from './simulation_provider.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* A simulation provider that uses the WASM simulator with the ability to handle blobs via the foreign call handler.
|
|
@@ -2,9 +2,9 @@ import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
|
2
2
|
|
|
3
3
|
import { promises as fs } from 'fs';
|
|
4
4
|
|
|
5
|
-
import { type SimulationProvider } from '../common/simulation_provider.js';
|
|
6
5
|
import { NativeACVMSimulator } from './acvm_native.js';
|
|
7
6
|
import { WASMSimulator } from './acvm_wasm.js';
|
|
7
|
+
import type { SimulationProvider } from './simulation_provider.js';
|
|
8
8
|
|
|
9
9
|
export type SimulationProviderConfig = {
|
|
10
10
|
acvmBinaryPath?: string;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { NoirCompiledCircuit } from '@aztec/stdlib/noir';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import type { ExecutionError } from '@noir-lang/acvm_js';
|
|
4
4
|
import { abiDecodeError } from '@noir-lang/noirc_abi';
|
|
5
|
-
import {
|
|
5
|
+
import type { Abi, WitnessMap } from '@noir-lang/types';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import type { ACIRCallback, ACIRExecutionResult } from '../acvm/acvm.js';
|
|
8
|
+
import type { ACVMWitness } from '../acvm/acvm_types.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Low level simulation interface
|
|
@@ -1,30 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type AztecNode,
|
|
3
|
-
type FunctionCall,
|
|
4
|
-
type Note,
|
|
5
|
-
PrivateExecutionResult,
|
|
6
|
-
type TxExecutionRequest,
|
|
7
|
-
} from '@aztec/circuit-types';
|
|
8
|
-
import { CallContext } from '@aztec/circuits.js';
|
|
9
|
-
import {
|
|
10
|
-
type ArrayType,
|
|
11
|
-
type FunctionArtifact,
|
|
12
|
-
FunctionSelector,
|
|
13
|
-
FunctionType,
|
|
14
|
-
type NoteSelector,
|
|
15
|
-
encodeArguments,
|
|
16
|
-
} from '@aztec/foundation/abi';
|
|
17
|
-
import { AztecAddress } from '@aztec/foundation/aztec-address';
|
|
18
1
|
import { Fr } from '@aztec/foundation/fields';
|
|
19
2
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
3
|
+
import type { FunctionCall } from '@aztec/stdlib/abi';
|
|
4
|
+
import { FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
|
|
5
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
|
+
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
7
|
+
import { CallContext, PrivateExecutionResult, TxExecutionRequest } from '@aztec/stdlib/tx';
|
|
20
8
|
|
|
21
9
|
import { createSimulationError } from '../common/errors.js';
|
|
22
|
-
import { HashedValuesCache } from '../common/hashed_values_cache.js';
|
|
23
|
-
import { type SimulationProvider } from '../common/simulation_provider.js';
|
|
24
10
|
import { ClientExecutionContext } from './client_execution_context.js';
|
|
25
|
-
import {
|
|
11
|
+
import type { DBOracle } from './db_oracle.js';
|
|
26
12
|
import { ExecutionNoteCache } from './execution_note_cache.js';
|
|
27
|
-
import {
|
|
13
|
+
import { HashedValuesCache } from './hashed_values_cache.js';
|
|
14
|
+
import { executePrivateFunction, verifyCurrentClassId } from './private_execution.js';
|
|
15
|
+
import type { SimulationProvider } from './providers/simulation_provider.js';
|
|
28
16
|
import { executeUnconstrainedFunction } from './unconstrained_execution.js';
|
|
29
17
|
import { ViewDataOracle } from './view_data_oracle.js';
|
|
30
18
|
|
|
@@ -49,11 +37,21 @@ export class AcirSimulator {
|
|
|
49
37
|
*/
|
|
50
38
|
public async run(
|
|
51
39
|
request: TxExecutionRequest,
|
|
52
|
-
entryPointArtifact: FunctionArtifact,
|
|
53
40
|
contractAddress: AztecAddress,
|
|
41
|
+
selector: FunctionSelector,
|
|
54
42
|
msgSender = AztecAddress.fromField(Fr.MAX_FIELD_VALUE),
|
|
55
43
|
scopes?: AztecAddress[],
|
|
56
44
|
): Promise<PrivateExecutionResult> {
|
|
45
|
+
const header = await this.db.getBlockHeader();
|
|
46
|
+
|
|
47
|
+
await verifyCurrentClassId(
|
|
48
|
+
contractAddress,
|
|
49
|
+
await this.db.getContractInstance(contractAddress),
|
|
50
|
+
this.node,
|
|
51
|
+
header.globalVariables.blockNumber.toNumber(),
|
|
52
|
+
);
|
|
53
|
+
const entryPointArtifact = await this.db.getFunctionArtifact(contractAddress, selector);
|
|
54
|
+
|
|
57
55
|
if (entryPointArtifact.functionType !== FunctionType.PRIVATE) {
|
|
58
56
|
throw new Error(`Cannot run ${entryPointArtifact.functionType} function as private`);
|
|
59
57
|
}
|
|
@@ -64,8 +62,6 @@ export class AcirSimulator {
|
|
|
64
62
|
);
|
|
65
63
|
}
|
|
66
64
|
|
|
67
|
-
const header = await this.db.getBlockHeader();
|
|
68
|
-
|
|
69
65
|
// reserve the first side effect for the tx hash (inserted by the private kernel)
|
|
70
66
|
const startSideEffectCounter = 1;
|
|
71
67
|
|
|
@@ -85,6 +81,7 @@ export class AcirSimulator {
|
|
|
85
81
|
callContext,
|
|
86
82
|
header,
|
|
87
83
|
request.authWitnesses,
|
|
84
|
+
request.capsules,
|
|
88
85
|
HashedValuesCache.create(request.argsOfCalls),
|
|
89
86
|
noteCache,
|
|
90
87
|
this.db,
|
|
@@ -120,15 +117,23 @@ export class AcirSimulator {
|
|
|
120
117
|
*/
|
|
121
118
|
public async runUnconstrained(
|
|
122
119
|
request: FunctionCall,
|
|
123
|
-
entryPointArtifact: FunctionArtifact,
|
|
124
120
|
contractAddress: AztecAddress,
|
|
121
|
+
selector: FunctionSelector,
|
|
125
122
|
scopes?: AztecAddress[],
|
|
126
123
|
) {
|
|
124
|
+
await verifyCurrentClassId(
|
|
125
|
+
contractAddress,
|
|
126
|
+
await this.db.getContractInstance(contractAddress),
|
|
127
|
+
this.node,
|
|
128
|
+
await this.node.getBlockNumber(),
|
|
129
|
+
);
|
|
130
|
+
const entryPointArtifact = await this.db.getFunctionArtifact(contractAddress, selector);
|
|
131
|
+
|
|
127
132
|
if (entryPointArtifact.functionType !== FunctionType.UNCONSTRAINED) {
|
|
128
133
|
throw new Error(`Cannot run ${entryPointArtifact.functionType} function as unconstrained`);
|
|
129
134
|
}
|
|
130
135
|
|
|
131
|
-
const context = new ViewDataOracle(contractAddress, [], this.db, this.node, undefined, scopes);
|
|
136
|
+
const context = new ViewDataOracle(contractAddress, [], [], this.db, this.node, undefined, scopes);
|
|
132
137
|
|
|
133
138
|
try {
|
|
134
139
|
return await executeUnconstrainedFunction(
|
|
@@ -143,101 +148,4 @@ export class AcirSimulator {
|
|
|
143
148
|
throw createSimulationError(err instanceof Error ? err : new Error('Unknown error during private execution'));
|
|
144
149
|
}
|
|
145
150
|
}
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Computes the inner nullifier of a note.
|
|
149
|
-
* @param contractAddress - The address of the contract.
|
|
150
|
-
* @param nonce - The nonce of the note hash.
|
|
151
|
-
* @param storageSlot - The storage slot.
|
|
152
|
-
* @param noteTypeId - The note type identifier.
|
|
153
|
-
* @param computeNullifier - A flag indicating whether to compute the nullifier or just return 0.
|
|
154
|
-
* @param note - The note.
|
|
155
|
-
* @returns The nullifier.
|
|
156
|
-
*/
|
|
157
|
-
public async computeNoteHashAndOptionallyANullifier(
|
|
158
|
-
contractAddress: AztecAddress,
|
|
159
|
-
nonce: Fr,
|
|
160
|
-
storageSlot: Fr,
|
|
161
|
-
noteTypeId: NoteSelector,
|
|
162
|
-
computeNullifier: boolean,
|
|
163
|
-
note: Note,
|
|
164
|
-
) {
|
|
165
|
-
const artifact: FunctionArtifact | undefined = await this.db.getFunctionArtifactByName(
|
|
166
|
-
contractAddress,
|
|
167
|
-
'compute_note_hash_and_optionally_a_nullifier',
|
|
168
|
-
);
|
|
169
|
-
if (!artifact) {
|
|
170
|
-
throw new Error(
|
|
171
|
-
`Mandatory implementation of "compute_note_hash_and_optionally_a_nullifier" missing in noir contract ${contractAddress.toString()}.`,
|
|
172
|
-
);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
if (artifact.parameters.length != 6) {
|
|
176
|
-
throw new Error(
|
|
177
|
-
`Expected 6 parameters in mandatory implementation of "compute_note_hash_and_optionally_a_nullifier", but found ${
|
|
178
|
-
artifact.parameters.length
|
|
179
|
-
} in noir contract ${contractAddress.toString()}.`,
|
|
180
|
-
);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
const maxNoteFields = (artifact.parameters[artifact.parameters.length - 1].type as ArrayType).length;
|
|
184
|
-
if (maxNoteFields < note.items.length) {
|
|
185
|
-
throw new Error(
|
|
186
|
-
`The note being processed has ${note.items.length} fields, while "compute_note_hash_and_optionally_a_nullifier" can only handle a maximum of ${maxNoteFields} fields. Please reduce the number of fields in your note.`,
|
|
187
|
-
);
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
const extendedNoteItems = note.items.concat(Array(maxNoteFields - note.items.length).fill(Fr.ZERO));
|
|
191
|
-
|
|
192
|
-
const execRequest: FunctionCall = {
|
|
193
|
-
name: artifact.name,
|
|
194
|
-
to: contractAddress,
|
|
195
|
-
selector: await FunctionSelector.fromNameAndParameters(artifact),
|
|
196
|
-
type: FunctionType.UNCONSTRAINED,
|
|
197
|
-
isStatic: artifact.isStatic,
|
|
198
|
-
args: encodeArguments(artifact, [
|
|
199
|
-
contractAddress,
|
|
200
|
-
nonce,
|
|
201
|
-
storageSlot,
|
|
202
|
-
noteTypeId,
|
|
203
|
-
computeNullifier,
|
|
204
|
-
extendedNoteItems,
|
|
205
|
-
]),
|
|
206
|
-
returnTypes: artifact.returnTypes,
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
const [noteHash, uniqueNoteHash, siloedNoteHash, innerNullifier] = (await this.runUnconstrained(
|
|
210
|
-
execRequest,
|
|
211
|
-
artifact,
|
|
212
|
-
contractAddress,
|
|
213
|
-
// We can omit scopes here, because "compute_note_hash_and_optionally_a_nullifier" does not need access to any notes.
|
|
214
|
-
)) as bigint[];
|
|
215
|
-
|
|
216
|
-
return {
|
|
217
|
-
noteHash: new Fr(noteHash),
|
|
218
|
-
uniqueNoteHash: new Fr(uniqueNoteHash),
|
|
219
|
-
siloedNoteHash: new Fr(siloedNoteHash),
|
|
220
|
-
innerNullifier: new Fr(innerNullifier),
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* Computes a hash of the note.
|
|
226
|
-
* @param contractAddress - The address of the contract.
|
|
227
|
-
* @param storageSlot - The storage slot.
|
|
228
|
-
* @param noteTypeId - The note type identifier.
|
|
229
|
-
* @param note - The note.
|
|
230
|
-
* @returns The note hash.
|
|
231
|
-
*/
|
|
232
|
-
public async computeNoteHash(contractAddress: AztecAddress, storageSlot: Fr, noteTypeId: NoteSelector, note: Note) {
|
|
233
|
-
const { noteHash } = await this.computeNoteHashAndOptionallyANullifier(
|
|
234
|
-
contractAddress,
|
|
235
|
-
Fr.ZERO,
|
|
236
|
-
storageSlot,
|
|
237
|
-
noteTypeId,
|
|
238
|
-
false,
|
|
239
|
-
note,
|
|
240
|
-
);
|
|
241
|
-
return noteHash;
|
|
242
|
-
}
|
|
243
151
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { type AztecAddress } from '@aztec/foundation/aztec-address';
|
|
3
|
-
import { type Fr } from '@aztec/foundation/fields';
|
|
1
|
+
import type { Fr } from '@aztec/foundation/fields';
|
|
4
2
|
import { createLogger } from '@aztec/foundation/log';
|
|
3
|
+
import { type AbiDecoded, type FunctionArtifact, type FunctionSelector, decodeFromAbi } from '@aztec/stdlib/abi';
|
|
4
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
5
|
|
|
6
|
-
import { witnessMapToFields } from '../acvm/deserialize.js';
|
|
7
|
-
import { Oracle, extractCallStack, toACVMWitness } from '../acvm/index.js';
|
|
8
6
|
import { ExecutionError, resolveAssertionMessageFromError } from '../common/errors.js';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
7
|
+
import { witnessMapToFields } from './acvm/deserialize.js';
|
|
8
|
+
import { Oracle, extractCallStack, toACVMWitness } from './acvm/index.js';
|
|
9
|
+
import type { SimulationProvider } from './providers/simulation_provider.js';
|
|
10
|
+
import type { ViewDataOracle } from './view_data_oracle.js';
|
|
11
11
|
|
|
12
12
|
// docs:start:execute_unconstrained_function
|
|
13
13
|
/**
|
|
@@ -1,26 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type AuthWitness,
|
|
3
|
-
type AztecNode,
|
|
4
|
-
type CompleteAddress,
|
|
5
|
-
type MerkleTreeId,
|
|
6
|
-
type NoteStatus,
|
|
7
|
-
type NullifierMembershipWitness,
|
|
8
|
-
type PublicDataWitness,
|
|
9
|
-
} from '@aztec/circuit-types';
|
|
10
|
-
import {
|
|
11
|
-
type BlockHeader,
|
|
12
|
-
type ContractInstance,
|
|
13
|
-
type IndexedTaggingSecret,
|
|
14
|
-
type KeyValidationRequest,
|
|
15
|
-
} from '@aztec/circuits.js';
|
|
16
|
-
import { Aes128 } from '@aztec/circuits.js/barretenberg';
|
|
17
|
-
import { siloNullifier } from '@aztec/circuits.js/hash';
|
|
18
|
-
import { AztecAddress } from '@aztec/foundation/aztec-address';
|
|
1
|
+
import { Aes128 } from '@aztec/foundation/crypto';
|
|
19
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
20
3
|
import { applyStringFormatting, createLogger } from '@aztec/foundation/log';
|
|
21
|
-
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
4
|
+
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
5
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
|
+
import type { CompleteAddress, ContractInstance } from '@aztec/stdlib/contract';
|
|
7
|
+
import { siloNullifier } from '@aztec/stdlib/hash';
|
|
8
|
+
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
9
|
+
import type { KeyValidationRequest } from '@aztec/stdlib/kernel';
|
|
10
|
+
import { IndexedTaggingSecret, LogWithTxData } from '@aztec/stdlib/logs';
|
|
11
|
+
import type { NoteStatus } from '@aztec/stdlib/note';
|
|
12
|
+
import { type MerkleTreeId, type NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
|
|
13
|
+
import type { BlockHeader, Capsule } from '@aztec/stdlib/tx';
|
|
14
|
+
|
|
15
|
+
import { type NoteData, TypedOracle } from './acvm/index.js';
|
|
16
|
+
import type { DBOracle } from './db_oracle.js';
|
|
24
17
|
import { pickNotes } from './pick_notes.js';
|
|
25
18
|
|
|
26
19
|
/**
|
|
@@ -32,6 +25,7 @@ export class ViewDataOracle extends TypedOracle {
|
|
|
32
25
|
protected readonly contractAddress: AztecAddress,
|
|
33
26
|
/** List of transient auth witnesses to be used during this simulation */
|
|
34
27
|
protected readonly authWitnesses: AuthWitness[],
|
|
28
|
+
protected readonly capsules: Capsule[],
|
|
35
29
|
protected readonly db: DBOracle,
|
|
36
30
|
protected readonly aztecNode: AztecNode,
|
|
37
31
|
protected log = createLogger('simulator:client_view_context'),
|
|
@@ -320,6 +314,10 @@ export class ViewDataOracle extends TypedOracle {
|
|
|
320
314
|
await this.db.deliverNote(contractAddress, storageSlot, nonce, content, noteHash, nullifier, txHash, recipient);
|
|
321
315
|
}
|
|
322
316
|
|
|
317
|
+
public override getLogByTag(tag: Fr): Promise<LogWithTxData | null> {
|
|
318
|
+
return this.db.getLogByTag(tag);
|
|
319
|
+
}
|
|
320
|
+
|
|
323
321
|
public override storeCapsule(contractAddress: AztecAddress, slot: Fr, capsule: Fr[]): Promise<void> {
|
|
324
322
|
if (!contractAddress.equals(this.contractAddress)) {
|
|
325
323
|
// TODO(#10727): instead of this check that this.contractAddress is allowed to access the external DB
|
|
@@ -328,12 +326,15 @@ export class ViewDataOracle extends TypedOracle {
|
|
|
328
326
|
return this.db.storeCapsule(this.contractAddress, slot, capsule);
|
|
329
327
|
}
|
|
330
328
|
|
|
331
|
-
public override loadCapsule(contractAddress: AztecAddress, slot: Fr): Promise<Fr[] | null> {
|
|
329
|
+
public override async loadCapsule(contractAddress: AztecAddress, slot: Fr): Promise<Fr[] | null> {
|
|
332
330
|
if (!contractAddress.equals(this.contractAddress)) {
|
|
333
331
|
// TODO(#10727): instead of this check that this.contractAddress is allowed to access the external DB
|
|
334
332
|
throw new Error(`Contract ${contractAddress} is not allowed to access ${this.contractAddress}'s PXE DB`);
|
|
335
333
|
}
|
|
336
|
-
return
|
|
334
|
+
return (
|
|
335
|
+
this.capsules.find(c => c.contractAddress.equals(contractAddress) && c.storageSlot.equals(slot))?.data ??
|
|
336
|
+
(await this.db.loadCapsule(this.contractAddress, slot))
|
|
337
|
+
);
|
|
337
338
|
}
|
|
338
339
|
|
|
339
340
|
public override deleteCapsule(contractAddress: AztecAddress, slot: Fr): Promise<void> {
|
|
@@ -359,11 +360,7 @@ export class ViewDataOracle extends TypedOracle {
|
|
|
359
360
|
|
|
360
361
|
// TODO(#11849): consider replacing this oracle with a pure Noir implementation of aes decryption.
|
|
361
362
|
public override aes128Decrypt(ciphertext: Buffer, iv: Buffer, symKey: Buffer): Promise<Buffer> {
|
|
362
|
-
// Noir can't predict the amount of padding that gets trimmed,
|
|
363
|
-
// but it needs to know the length of the returned value.
|
|
364
|
-
// So we tell Noir that the length is the (predictable) length
|
|
365
|
-
// of the padded plaintext, we return that padded plaintext, and have Noir interpret the padding to do the trimming.
|
|
366
363
|
const aes128 = new Aes128();
|
|
367
|
-
return aes128.
|
|
364
|
+
return aes128.decryptBufferCBC(ciphertext, iv, symKey);
|
|
368
365
|
}
|
|
369
366
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { Fr } from '@aztec/foundation/fields';
|
|
2
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import type { AvmExecutionEnvironment } from './avm_execution_environment.js';
|
|
5
5
|
import { type Gas, gasToGasLeft } from './avm_gas.js';
|
|
6
6
|
import { AvmMachineState } from './avm_machine_state.js';
|
|
7
|
-
import {
|
|
7
|
+
import type { AvmSimulator } from './avm_simulator.js';
|
|
8
|
+
import type { AvmPersistableStateManager } from './journal/journal.js';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* An execution context includes the information necessary to initiate AVM
|
|
@@ -24,6 +25,10 @@ export class AvmContext {
|
|
|
24
25
|
public machineState: AvmMachineState,
|
|
25
26
|
) {}
|
|
26
27
|
|
|
28
|
+
// This is needed to break a dependency cycle created by the CALL opcode,
|
|
29
|
+
// which needs to create a new simulator but cannot depend directly on AvmSimulator.
|
|
30
|
+
public provideSimulator?: (ctx: this) => Promise<AvmSimulator>;
|
|
31
|
+
|
|
27
32
|
/**
|
|
28
33
|
* Prepare a new AVM context that will be ready for an external/nested call
|
|
29
34
|
* - Fork the world state journal
|
|
@@ -38,18 +43,18 @@ export class AvmContext {
|
|
|
38
43
|
* @param callType - Type of call (CALL or STATICCALL)
|
|
39
44
|
* @returns new AvmContext instance
|
|
40
45
|
*/
|
|
41
|
-
public createNestedContractCallContext(
|
|
46
|
+
public async createNestedContractCallContext(
|
|
42
47
|
address: AztecAddress,
|
|
43
48
|
calldata: Fr[],
|
|
44
49
|
allocatedGas: Gas,
|
|
45
50
|
callType: 'CALL' | 'STATICCALL',
|
|
46
|
-
): AvmContext {
|
|
51
|
+
): Promise<AvmContext> {
|
|
47
52
|
const deriveFn =
|
|
48
53
|
callType === 'CALL'
|
|
49
54
|
? this.environment.deriveEnvironmentForNestedCall
|
|
50
55
|
: this.environment.deriveEnvironmentForNestedStaticCall;
|
|
51
56
|
const newExecutionEnvironment = deriveFn.call(this.environment, address, calldata);
|
|
52
|
-
const forkedWorldState = this.persistableState.fork();
|
|
57
|
+
const forkedWorldState = await this.persistableState.fork();
|
|
53
58
|
const machineState = AvmMachineState.fromState(gasToGasLeft(allocatedGas));
|
|
54
59
|
return new AvmContext(forkedWorldState, newExecutionEnvironment, machineState);
|
|
55
60
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { Fr } from '@aztec/foundation/fields';
|
|
2
|
+
import type { SimulationError } from '@aztec/stdlib/errors';
|
|
3
|
+
import { Gas } from '@aztec/stdlib/gas';
|
|
4
4
|
|
|
5
5
|
import { inspect } from 'util';
|
|
6
6
|
|
|
7
|
-
import { createSimulationError } from '
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { createSimulationError } from '../../common/errors.js';
|
|
8
|
+
import type { Gas as AvmGas } from './avm_gas.js';
|
|
9
|
+
import type { AvmRevertReason } from './errors.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Results of an contract call's execution in the AVM.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type GlobalVariables } from '@aztec/circuits.js';
|
|
2
|
-
import { type AztecAddress } from '@aztec/foundation/aztec-address';
|
|
3
1
|
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
+
import type { GlobalVariables } from '@aztec/stdlib/tx';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Contains variables that remain constant during AVM execution
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as c from '@aztec/
|
|
1
|
+
import * as c from '@aztec/constants';
|
|
2
2
|
|
|
3
3
|
import { TypeTag } from './avm_memory_types.js';
|
|
4
4
|
import { InstructionExecutionError } from './errors.js';
|
|
@@ -123,7 +123,6 @@ const BASE_GAS_COSTS: Record<Opcode, Gas> = {
|
|
|
123
123
|
[Opcode.SHA256COMPRESSION]: makeCost(c.AVM_SHA256COMPRESSION_BASE_L2_GAS, 0),
|
|
124
124
|
[Opcode.KECCAKF1600]: makeCost(c.AVM_KECCAKF1600_BASE_L2_GAS, 0),
|
|
125
125
|
[Opcode.ECADD]: makeCost(c.AVM_ECADD_BASE_L2_GAS, 0),
|
|
126
|
-
[Opcode.MSM]: makeCost(c.AVM_MSM_BASE_L2_GAS, 0),
|
|
127
126
|
[Opcode.TORADIXBE]: makeCost(c.AVM_TORADIXBE_BASE_L2_GAS, 0),
|
|
128
127
|
};
|
|
129
128
|
|
|
@@ -137,7 +136,6 @@ const DYNAMIC_GAS_COSTS = new Map<Opcode, Gas>([
|
|
|
137
136
|
[Opcode.REVERT_8, makeCost(c.AVM_REVERT_DYN_L2_GAS, 0)],
|
|
138
137
|
[Opcode.REVERT_16, makeCost(c.AVM_REVERT_DYN_L2_GAS, 0)],
|
|
139
138
|
[Opcode.DEBUGLOG, makeCost(c.AVM_DEBUGLOG_DYN_L2_GAS, 0)],
|
|
140
|
-
[Opcode.MSM, makeCost(c.AVM_MSM_DYN_L2_GAS, 0)],
|
|
141
139
|
[Opcode.TORADIXBE, makeCost(c.AVM_TORADIXBE_DYN_L2_GAS, 0)],
|
|
142
140
|
]);
|
|
143
141
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Fr } from '@aztec/foundation/fields';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import type { Gas } from './avm_gas.js';
|
|
4
4
|
import { TaggedMemory } from './avm_memory_types.js';
|
|
5
5
|
import { type AvmRevertReason, OutOfGasError } from './errors.js';
|
|
6
6
|
|
|
@@ -6,12 +6,12 @@ import {
|
|
|
6
6
|
MEM_TAG_U32,
|
|
7
7
|
MEM_TAG_U64,
|
|
8
8
|
MEM_TAG_U128,
|
|
9
|
-
} from '@aztec/
|
|
10
|
-
import { AztecAddress } from '@aztec/foundation/aztec-address';
|
|
9
|
+
} from '@aztec/constants';
|
|
11
10
|
import { toBufferBE } from '@aztec/foundation/bigint-buffer';
|
|
12
11
|
import { Fr } from '@aztec/foundation/fields';
|
|
13
12
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
14
|
-
import {
|
|
13
|
+
import type { FunctionsOf } from '@aztec/foundation/types';
|
|
14
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
15
15
|
|
|
16
16
|
import { strict as assert } from 'assert';
|
|
17
17
|
|
|
@@ -219,7 +219,7 @@ export enum TypeTag {
|
|
|
219
219
|
UINT32 = MEM_TAG_U32,
|
|
220
220
|
UINT64 = MEM_TAG_U64,
|
|
221
221
|
UINT128 = MEM_TAG_U128,
|
|
222
|
-
INVALID,
|
|
222
|
+
INVALID = MEM_TAG_U128 + 1,
|
|
223
223
|
}
|
|
224
224
|
|
|
225
225
|
// Lazy interface definition for tagged memory
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MAX_L2_GAS_PER_TX_PUBLIC_PORTION } from '@aztec/constants';
|
|
2
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
2
3
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
4
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
+
import type { GlobalVariables } from '@aztec/stdlib/tx';
|
|
3
6
|
|
|
4
7
|
import { strict as assert } from 'assert';
|
|
5
8
|
|
|
6
|
-
import { SideEffectLimitReachedError } from '../
|
|
9
|
+
import { SideEffectLimitReachedError } from '../side_effect_errors.js';
|
|
7
10
|
import { AvmContext } from './avm_context.js';
|
|
8
11
|
import { AvmContractCallResult } from './avm_contract_call_result.js';
|
|
9
12
|
import { AvmExecutionEnvironment } from './avm_execution_environment.js';
|
|
10
|
-
import {
|
|
13
|
+
import type { Gas } from './avm_gas.js';
|
|
11
14
|
import { AvmMachineState } from './avm_machine_state.js';
|
|
12
15
|
import { isAvmBytecode } from './bytecode_utils.js';
|
|
13
16
|
import {
|
|
@@ -17,8 +20,8 @@ import {
|
|
|
17
20
|
revertReasonFromExceptionalHalt,
|
|
18
21
|
revertReasonFromExplicitRevert,
|
|
19
22
|
} from './errors.js';
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
23
|
+
import type { AvmPersistableStateManager } from './journal/journal.js';
|
|
24
|
+
import type { Instruction } from './opcodes/instruction.js';
|
|
22
25
|
import {
|
|
23
26
|
INSTRUCTION_SET,
|
|
24
27
|
type InstructionSet,
|
|
@@ -44,9 +47,12 @@ export class AvmSimulator {
|
|
|
44
47
|
// only. Otherwise, use build() below.
|
|
45
48
|
constructor(
|
|
46
49
|
private context: AvmContext,
|
|
47
|
-
private instructionSet: InstructionSet = INSTRUCTION_SET
|
|
50
|
+
private instructionSet: InstructionSet = INSTRUCTION_SET,
|
|
48
51
|
enableTallying = false,
|
|
49
52
|
) {
|
|
53
|
+
// This will be used by the CALL opcode to create a new simulator. It is required to
|
|
54
|
+
// avoid a dependency cycle.
|
|
55
|
+
context.provideSimulator = AvmSimulator.build;
|
|
50
56
|
assert(
|
|
51
57
|
context.machineState.gasLeft.l2Gas <= MAX_L2_GAS_PER_TX_PUBLIC_PORTION,
|
|
52
58
|
`Cannot allocate more than ${MAX_L2_GAS_PER_TX_PUBLIC_PORTION} to the AVM for execution.`,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { Fr, Point } from '@aztec/foundation/fields';
|
|
2
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
+
import type { FailingFunction, NoirCallStack } from '@aztec/stdlib/errors';
|
|
3
4
|
|
|
4
|
-
import { ExecutionError } from '
|
|
5
|
-
import {
|
|
5
|
+
import { ExecutionError } from '../../common/errors.js';
|
|
6
|
+
import type { AvmContext } from './avm_context.js';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Avm-specific errors should derive from this
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { type MerkleTreeWriteOperations } from '@aztec/circuit-types';
|
|
2
|
-
import { GasFees, GlobalVariables } from '@aztec/circuits.js';
|
|
3
|
-
import { encodeArguments } from '@aztec/foundation/abi';
|
|
4
|
-
import { type AztecAddress } from '@aztec/foundation/aztec-address';
|
|
5
1
|
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
+
import { encodeArguments } from '@aztec/stdlib/abi';
|
|
3
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
+
import { GasFees } from '@aztec/stdlib/gas';
|
|
5
|
+
import type { MerkleTreeWriteOperations } from '@aztec/stdlib/interfaces/server';
|
|
6
|
+
import { GlobalVariables } from '@aztec/stdlib/tx';
|
|
6
7
|
import { NativeWorldStateService } from '@aztec/world-state';
|
|
7
8
|
|
|
8
|
-
import {
|
|
9
|
+
import { SideEffectTrace } from '../../../public/side_effect_trace.js';
|
|
10
|
+
import type { AvmContractCallResult } from '../../avm/avm_contract_call_result.js';
|
|
9
11
|
import {
|
|
10
12
|
getContractFunctionArtifact,
|
|
11
13
|
getFunctionSelector,
|
|
@@ -13,9 +15,9 @@ import {
|
|
|
13
15
|
initExecutionEnvironment,
|
|
14
16
|
resolveContractAssertionMessage,
|
|
15
17
|
} from '../../avm/fixtures/index.js';
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
18
|
+
import { AvmPersistableStateManager } from '../../avm/journal/journal.js';
|
|
19
|
+
import { WorldStateDB } from '../../public_db_sources.js';
|
|
20
|
+
import { AvmSimulator } from '../avm_simulator.js';
|
|
19
21
|
import { BaseAvmSimulationTester } from './base_avm_simulation_tester.js';
|
|
20
22
|
import { SimpleContractDataSource } from './simple_contract_data_source.js';
|
|
21
23
|
|
|
@@ -31,13 +33,12 @@ export class AvmSimulationTester extends BaseAvmSimulationTester {
|
|
|
31
33
|
constructor(
|
|
32
34
|
contractDataSource: SimpleContractDataSource,
|
|
33
35
|
merkleTrees: MerkleTreeWriteOperations,
|
|
34
|
-
skipContractDeployments = false,
|
|
35
36
|
private stateManager: AvmPersistableStateManager,
|
|
36
37
|
) {
|
|
37
|
-
super(contractDataSource, merkleTrees
|
|
38
|
+
super(contractDataSource, merkleTrees);
|
|
38
39
|
}
|
|
39
40
|
|
|
40
|
-
static async create(
|
|
41
|
+
static async create(): Promise<AvmSimulationTester> {
|
|
41
42
|
const contractDataSource = new SimpleContractDataSource();
|
|
42
43
|
const merkleTrees = await (await NativeWorldStateService.tmp()).fork();
|
|
43
44
|
const worldStateDB = new WorldStateDB(merkleTrees, contractDataSource);
|
|
@@ -45,13 +46,13 @@ export class AvmSimulationTester extends BaseAvmSimulationTester {
|
|
|
45
46
|
const firstNullifier = new Fr(420000);
|
|
46
47
|
// FIXME: merkle ops should work, but I'm seeing frequent (but inconsistent) bytecode retrieval
|
|
47
48
|
// failures on 2nd call to simulateCall with merkle ops on
|
|
48
|
-
const stateManager =
|
|
49
|
+
const stateManager = AvmPersistableStateManager.create(
|
|
49
50
|
worldStateDB,
|
|
50
51
|
trace,
|
|
51
52
|
/*doMerkleOperations=*/ false,
|
|
52
53
|
firstNullifier,
|
|
53
54
|
);
|
|
54
|
-
return new AvmSimulationTester(contractDataSource, merkleTrees,
|
|
55
|
+
return new AvmSimulationTester(contractDataSource, merkleTrees, stateManager);
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
/**
|
|
@@ -84,7 +85,7 @@ export class AvmSimulationTester extends BaseAvmSimulationTester {
|
|
|
84
85
|
sender,
|
|
85
86
|
isStaticCall,
|
|
86
87
|
});
|
|
87
|
-
const persistableState = this.stateManager.fork();
|
|
88
|
+
const persistableState = await this.stateManager.fork();
|
|
88
89
|
const context = initContext({ env: environment, persistableState });
|
|
89
90
|
|
|
90
91
|
// First we simulate (though it's not needed in this simple case).
|
|
@@ -97,7 +98,7 @@ export class AvmSimulationTester extends BaseAvmSimulationTester {
|
|
|
97
98
|
);
|
|
98
99
|
} else {
|
|
99
100
|
this.logger.info(`Simulation of function ${fnName} succeeded!`);
|
|
100
|
-
this.stateManager.merge(persistableState);
|
|
101
|
+
await this.stateManager.merge(persistableState);
|
|
101
102
|
}
|
|
102
103
|
return result;
|
|
103
104
|
}
|