@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,121 +0,0 @@
|
|
|
1
|
-
import { Fq, Point } from '@aztec/circuits.js';
|
|
2
|
-
import { Grumpkin } from '@aztec/circuits.js/barretenberg';
|
|
3
|
-
|
|
4
|
-
import { type AvmContext } from '../avm_context.js';
|
|
5
|
-
import { Field, TypeTag, Uint1 } from '../avm_memory_types.js';
|
|
6
|
-
import { MSMPointNotOnCurveError, MSMPointsLengthError } from '../errors.js';
|
|
7
|
-
import { Opcode, OperandType } from '../serialization/instruction_serialization.js';
|
|
8
|
-
import { Addressing } from './addressing_mode.js';
|
|
9
|
-
import { Instruction } from './instruction.js';
|
|
10
|
-
|
|
11
|
-
export class MultiScalarMul extends Instruction {
|
|
12
|
-
static type: string = 'MultiScalarMul';
|
|
13
|
-
static readonly opcode: Opcode = Opcode.MSM;
|
|
14
|
-
|
|
15
|
-
// Informs (de)serialization. See Instruction.deserialize.
|
|
16
|
-
static readonly wireFormat: OperandType[] = [
|
|
17
|
-
OperandType.UINT8 /* opcode */,
|
|
18
|
-
OperandType.UINT8 /* indirect */,
|
|
19
|
-
OperandType.UINT16 /* points vector offset */,
|
|
20
|
-
OperandType.UINT16 /* scalars vector offset */,
|
|
21
|
-
OperandType.UINT16 /* output offset (fixed triplet) */,
|
|
22
|
-
OperandType.UINT16 /* points length offset */,
|
|
23
|
-
];
|
|
24
|
-
|
|
25
|
-
constructor(
|
|
26
|
-
private indirect: number,
|
|
27
|
-
private pointsOffset: number,
|
|
28
|
-
private scalarsOffset: number,
|
|
29
|
-
private outputOffset: number,
|
|
30
|
-
private pointsLengthOffset: number,
|
|
31
|
-
) {
|
|
32
|
-
super();
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
public async execute(context: AvmContext): Promise<void> {
|
|
36
|
-
const memory = context.machineState.memory;
|
|
37
|
-
// Resolve indirects
|
|
38
|
-
const operands = [this.pointsOffset, this.scalarsOffset, this.outputOffset, this.pointsLengthOffset];
|
|
39
|
-
const addressing = Addressing.fromWire(this.indirect, operands.length);
|
|
40
|
-
const [pointsOffset, scalarsOffset, outputOffset, pointsLengthOffset] = addressing.resolve(operands, memory);
|
|
41
|
-
|
|
42
|
-
// Length of the points vector should be U32
|
|
43
|
-
memory.checkTag(TypeTag.UINT32, pointsLengthOffset);
|
|
44
|
-
// Get the size of the unrolled (x, y , inf) points vector
|
|
45
|
-
const pointsReadLength = memory.get(pointsLengthOffset).toNumber();
|
|
46
|
-
if (pointsReadLength % 3 !== 0) {
|
|
47
|
-
throw new MSMPointsLengthError(pointsReadLength);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// Get the unrolled (x, y, inf) representing the points
|
|
51
|
-
// Important to perform this before tag validation, as getSlice() first checks
|
|
52
|
-
// that the slice is not out of memory range. This needs to be aligned with circuit.
|
|
53
|
-
const pointsVector = memory.getSlice(pointsOffset, pointsReadLength);
|
|
54
|
-
|
|
55
|
-
// Divide by 3 since each point is represented as a triplet to get the number of points
|
|
56
|
-
const numPoints = pointsReadLength / 3;
|
|
57
|
-
// The tag for each triplet will be (Field, Field, Uint8)
|
|
58
|
-
for (let i = 0; i < numPoints; i++) {
|
|
59
|
-
const offset = pointsOffset + i * 3;
|
|
60
|
-
// Check (Field, Field)
|
|
61
|
-
memory.checkTagsRange(TypeTag.FIELD, offset, 2);
|
|
62
|
-
// Check Uint1 (inf flag)
|
|
63
|
-
memory.checkTag(TypeTag.UINT1, offset + 2);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// The size of the scalars vector is twice the NUMBER of points because of the scalar limb decomposition
|
|
67
|
-
const scalarReadLength = numPoints * 2;
|
|
68
|
-
context.machineState.consumeGas(this.gasCost(pointsReadLength));
|
|
69
|
-
// Get the unrolled scalar (lo & hi) representing the scalars
|
|
70
|
-
const scalarsVector = memory.getSlice(scalarsOffset, scalarReadLength);
|
|
71
|
-
memory.checkTagsRange(TypeTag.FIELD, scalarsOffset, scalarReadLength);
|
|
72
|
-
|
|
73
|
-
// Now we need to reconstruct the points and scalars into something we can operate on.
|
|
74
|
-
const grumpkinPoints: Point[] = [];
|
|
75
|
-
for (let i = 0; i < numPoints; i++) {
|
|
76
|
-
const isInf = pointsVector[3 * i + 2].toNumber() === 1;
|
|
77
|
-
const p: Point = new Point(pointsVector[3 * i].toFr(), pointsVector[3 * i + 1].toFr(), isInf);
|
|
78
|
-
if (!p.isOnGrumpkin()) {
|
|
79
|
-
throw new MSMPointNotOnCurveError(p);
|
|
80
|
-
}
|
|
81
|
-
grumpkinPoints.push(p);
|
|
82
|
-
}
|
|
83
|
-
// The scalars are read from memory as Fr elements, which are limbs of Fq elements
|
|
84
|
-
// So we need to reconstruct them before performing the scalar multiplications
|
|
85
|
-
const scalarFqVector: Fq[] = [];
|
|
86
|
-
for (let i = 0; i < numPoints; i++) {
|
|
87
|
-
const scalarLo = scalarsVector[2 * i].toFr();
|
|
88
|
-
const scalarHi = scalarsVector[2 * i + 1].toFr();
|
|
89
|
-
const fqScalar = Fq.fromHighLow(scalarHi, scalarLo);
|
|
90
|
-
scalarFqVector.push(fqScalar);
|
|
91
|
-
}
|
|
92
|
-
// TODO: Is there an efficient MSM implementation in ts that we can replace this by?
|
|
93
|
-
const grumpkin = new Grumpkin();
|
|
94
|
-
// Zip the points and scalars into pairs
|
|
95
|
-
const [firstBaseScalarPair, ...rest]: Array<[Point, Fq]> = grumpkinPoints.map((p, idx) => [p, scalarFqVector[idx]]);
|
|
96
|
-
// Fold the points and scalars into a single point
|
|
97
|
-
// We have to ensure get the first point, since the identity element (point at infinity) isn't quite working in ts
|
|
98
|
-
let acc = await grumpkin.mul(firstBaseScalarPair[0], firstBaseScalarPair[1]);
|
|
99
|
-
for (const curr of rest) {
|
|
100
|
-
if (curr[1] === Fq.ZERO) {
|
|
101
|
-
// If we multiply by 0, the result will the point at infinity - so we ignore it
|
|
102
|
-
continue;
|
|
103
|
-
} else if (curr[0].inf) {
|
|
104
|
-
// If we multiply the point at infinity by a scalar, it's still the point at infinity
|
|
105
|
-
continue;
|
|
106
|
-
} else if (acc.inf) {
|
|
107
|
-
// If we accumulator is the point at infinity, we can just return the current point
|
|
108
|
-
acc = curr[0];
|
|
109
|
-
} else {
|
|
110
|
-
acc = await grumpkin.add(acc, await grumpkin.mul(curr[0], curr[1]));
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
const outputPoint = acc;
|
|
114
|
-
|
|
115
|
-
// Important to use setSlice() and not set() in the two following statements as
|
|
116
|
-
// this checks that the offsets lie within memory range.
|
|
117
|
-
memory.setSlice(outputOffset, [new Field(outputPoint.x), new Field(outputPoint.y)]);
|
|
118
|
-
// Check representation of infinity for grumpkin
|
|
119
|
-
memory.setSlice(outputOffset + 2, [new Uint1(outputPoint.equals(Point.ZERO) ? 1 : 0)]);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
import { AvmExecutionError, AvmParsingError, InvalidOpcodeError, InvalidProgramCounterError } from '../errors.js';
|
|
2
|
-
import {
|
|
3
|
-
Add,
|
|
4
|
-
And,
|
|
5
|
-
Call,
|
|
6
|
-
CalldataCopy,
|
|
7
|
-
Cast,
|
|
8
|
-
DebugLog,
|
|
9
|
-
Div,
|
|
10
|
-
EcAdd,
|
|
11
|
-
EmitNoteHash,
|
|
12
|
-
EmitNullifier,
|
|
13
|
-
EmitUnencryptedLog,
|
|
14
|
-
Eq,
|
|
15
|
-
FieldDiv,
|
|
16
|
-
GetContractInstance,
|
|
17
|
-
GetEnvVar,
|
|
18
|
-
Instruction,
|
|
19
|
-
InternalCall,
|
|
20
|
-
InternalReturn,
|
|
21
|
-
Jump,
|
|
22
|
-
JumpI,
|
|
23
|
-
KeccakF1600,
|
|
24
|
-
L1ToL2MessageExists,
|
|
25
|
-
Lt,
|
|
26
|
-
Lte,
|
|
27
|
-
Mov,
|
|
28
|
-
Mul,
|
|
29
|
-
Not,
|
|
30
|
-
NoteHashExists,
|
|
31
|
-
NullifierExists,
|
|
32
|
-
Or,
|
|
33
|
-
Poseidon2,
|
|
34
|
-
Return,
|
|
35
|
-
ReturndataCopy,
|
|
36
|
-
ReturndataSize,
|
|
37
|
-
Revert,
|
|
38
|
-
SLoad,
|
|
39
|
-
SStore,
|
|
40
|
-
SendL2ToL1Message,
|
|
41
|
-
Set,
|
|
42
|
-
Sha256Compression,
|
|
43
|
-
Shl,
|
|
44
|
-
Shr,
|
|
45
|
-
StaticCall,
|
|
46
|
-
Sub,
|
|
47
|
-
ToRadixBE,
|
|
48
|
-
Xor,
|
|
49
|
-
} from '../opcodes/index.js';
|
|
50
|
-
import { MultiScalarMul } from '../opcodes/multi_scalar_mul.js';
|
|
51
|
-
import { BufferCursor } from './buffer_cursor.js';
|
|
52
|
-
import { MAX_OPCODE_VALUE, Opcode } from './instruction_serialization.js';
|
|
53
|
-
|
|
54
|
-
export type InstructionDeserializer = (buf: BufferCursor | Buffer) => Instruction;
|
|
55
|
-
|
|
56
|
-
export interface Serializable {
|
|
57
|
-
serialize(): Buffer;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export interface Deserializable {
|
|
61
|
-
deserialize: InstructionDeserializer;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export type InstructionSet = Map<Opcode, InstructionDeserializer>;
|
|
65
|
-
// TODO(4359): This is a function so that Call and StaticCall can be lazily resolved.
|
|
66
|
-
// This is a temporary solution until we solve the dependency cycle.
|
|
67
|
-
export const INSTRUCTION_SET = () =>
|
|
68
|
-
new Map<Opcode, InstructionDeserializer>([
|
|
69
|
-
[Opcode.ADD_8, Add.as(Add.wireFormat8).deserialize],
|
|
70
|
-
[Opcode.ADD_16, Add.as(Add.wireFormat16).deserialize],
|
|
71
|
-
[Opcode.SUB_8, Sub.as(Sub.wireFormat8).deserialize],
|
|
72
|
-
[Opcode.SUB_16, Sub.as(Sub.wireFormat16).deserialize],
|
|
73
|
-
[Opcode.MUL_8, Mul.as(Mul.wireFormat8).deserialize],
|
|
74
|
-
[Opcode.MUL_16, Mul.as(Mul.wireFormat16).deserialize],
|
|
75
|
-
[Opcode.DIV_8, Div.as(Div.wireFormat8).deserialize],
|
|
76
|
-
[Opcode.DIV_16, Div.as(Div.wireFormat16).deserialize],
|
|
77
|
-
[Opcode.FDIV_8, FieldDiv.as(FieldDiv.wireFormat8).deserialize],
|
|
78
|
-
[Opcode.FDIV_16, FieldDiv.as(FieldDiv.wireFormat16).deserialize],
|
|
79
|
-
[Opcode.EQ_8, Eq.as(Eq.wireFormat8).deserialize],
|
|
80
|
-
[Opcode.EQ_16, Eq.as(Eq.wireFormat16).deserialize],
|
|
81
|
-
[Opcode.LT_8, Lt.as(Lt.wireFormat8).deserialize],
|
|
82
|
-
[Opcode.LT_16, Lt.as(Lt.wireFormat16).deserialize],
|
|
83
|
-
[Opcode.LTE_8, Lte.as(Lte.wireFormat8).deserialize],
|
|
84
|
-
[Opcode.LTE_16, Lte.as(Lte.wireFormat16).deserialize],
|
|
85
|
-
[Opcode.AND_8, And.as(And.wireFormat8).deserialize],
|
|
86
|
-
[Opcode.AND_16, And.as(And.wireFormat16).deserialize],
|
|
87
|
-
[Opcode.OR_8, Or.as(Or.wireFormat8).deserialize],
|
|
88
|
-
[Opcode.OR_16, Or.as(Or.wireFormat16).deserialize],
|
|
89
|
-
[Opcode.XOR_8, Xor.as(Xor.wireFormat8).deserialize],
|
|
90
|
-
[Opcode.XOR_16, Xor.as(Xor.wireFormat16).deserialize],
|
|
91
|
-
[Opcode.NOT_8, Not.as(Not.wireFormat8).deserialize],
|
|
92
|
-
[Opcode.NOT_16, Not.as(Not.wireFormat16).deserialize],
|
|
93
|
-
[Opcode.SHL_8, Shl.as(Shl.wireFormat8).deserialize],
|
|
94
|
-
[Opcode.SHL_16, Shl.as(Shl.wireFormat16).deserialize],
|
|
95
|
-
[Opcode.SHR_8, Shr.as(Shr.wireFormat8).deserialize],
|
|
96
|
-
[Opcode.SHR_16, Shr.as(Shr.wireFormat16).deserialize],
|
|
97
|
-
[Opcode.CAST_8, Cast.as(Cast.wireFormat8).deserialize],
|
|
98
|
-
[Opcode.CAST_16, Cast.as(Cast.wireFormat16).deserialize],
|
|
99
|
-
// Execution Environment
|
|
100
|
-
[Opcode.GETENVVAR_16, GetEnvVar.as(GetEnvVar.wireFormat16).deserialize],
|
|
101
|
-
[CalldataCopy.opcode, Instruction.deserialize.bind(CalldataCopy)],
|
|
102
|
-
[Opcode.RETURNDATASIZE, Instruction.deserialize.bind(ReturndataSize)],
|
|
103
|
-
[Opcode.RETURNDATACOPY, Instruction.deserialize.bind(ReturndataCopy)],
|
|
104
|
-
|
|
105
|
-
// Machine State - Internal Control Flow
|
|
106
|
-
[Jump.opcode, Instruction.deserialize.bind(Jump)],
|
|
107
|
-
[JumpI.opcode, Instruction.deserialize.bind(JumpI)],
|
|
108
|
-
[InternalCall.opcode, Instruction.deserialize.bind(InternalCall)],
|
|
109
|
-
[InternalReturn.opcode, Instruction.deserialize.bind(InternalReturn)],
|
|
110
|
-
[Opcode.SET_8, Set.as(Set.wireFormat8).deserialize],
|
|
111
|
-
[Opcode.SET_16, Set.as(Set.wireFormat16).deserialize],
|
|
112
|
-
[Opcode.SET_32, Set.as(Set.wireFormat32).deserialize],
|
|
113
|
-
[Opcode.SET_64, Set.as(Set.wireFormat64).deserialize],
|
|
114
|
-
[Opcode.SET_128, Set.as(Set.wireFormat128).deserialize],
|
|
115
|
-
[Opcode.SET_FF, Set.as(Set.wireFormatFF).deserialize],
|
|
116
|
-
[Opcode.MOV_8, Mov.as(Mov.wireFormat8).deserialize],
|
|
117
|
-
[Opcode.MOV_16, Mov.as(Mov.wireFormat16).deserialize],
|
|
118
|
-
|
|
119
|
-
// World State
|
|
120
|
-
[SLoad.opcode, Instruction.deserialize.bind(SLoad)], // Public Storage
|
|
121
|
-
[SStore.opcode, Instruction.deserialize.bind(SStore)], // Public Storage
|
|
122
|
-
[NoteHashExists.opcode, Instruction.deserialize.bind(NoteHashExists)], // Notes & Nullifiers
|
|
123
|
-
[EmitNoteHash.opcode, Instruction.deserialize.bind(EmitNoteHash)], // Notes & Nullifiers
|
|
124
|
-
[NullifierExists.opcode, Instruction.deserialize.bind(NullifierExists)], // Notes & Nullifiers
|
|
125
|
-
[EmitNullifier.opcode, Instruction.deserialize.bind(EmitNullifier)], // Notes & Nullifiers
|
|
126
|
-
[L1ToL2MessageExists.opcode, Instruction.deserialize.bind(L1ToL2MessageExists)], // Messages
|
|
127
|
-
|
|
128
|
-
// Accrued Substate
|
|
129
|
-
[EmitUnencryptedLog.opcode, Instruction.deserialize.bind(EmitUnencryptedLog)],
|
|
130
|
-
[SendL2ToL1Message.opcode, Instruction.deserialize.bind(SendL2ToL1Message)],
|
|
131
|
-
[GetContractInstance.opcode, Instruction.deserialize.bind(GetContractInstance)],
|
|
132
|
-
|
|
133
|
-
// Control Flow - Contract Calls
|
|
134
|
-
[Call.opcode, Instruction.deserialize.bind(Call)],
|
|
135
|
-
[StaticCall.opcode, Instruction.deserialize.bind(StaticCall)],
|
|
136
|
-
[Return.opcode, Instruction.deserialize.bind(Return)],
|
|
137
|
-
[Opcode.REVERT_8, Revert.as(Revert.wireFormat8).deserialize],
|
|
138
|
-
[Opcode.REVERT_16, Revert.as(Revert.wireFormat16).deserialize],
|
|
139
|
-
|
|
140
|
-
// Misc
|
|
141
|
-
[DebugLog.opcode, Instruction.deserialize.bind(DebugLog)],
|
|
142
|
-
|
|
143
|
-
// Gadgets
|
|
144
|
-
[EcAdd.opcode, Instruction.deserialize.bind(EcAdd)],
|
|
145
|
-
[Poseidon2.opcode, Instruction.deserialize.bind(Poseidon2)],
|
|
146
|
-
[Sha256Compression.opcode, Instruction.deserialize.bind(Sha256Compression)],
|
|
147
|
-
[KeccakF1600.opcode, Instruction.deserialize.bind(KeccakF1600)],
|
|
148
|
-
[MultiScalarMul.opcode, Instruction.deserialize.bind(MultiScalarMul)],
|
|
149
|
-
|
|
150
|
-
// Conversions
|
|
151
|
-
[ToRadixBE.opcode, Instruction.deserialize.bind(ToRadixBE)],
|
|
152
|
-
]);
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Serializes an array of instructions to bytecode.
|
|
156
|
-
*/
|
|
157
|
-
export function encodeToBytecode(instructions: Serializable[]): Buffer {
|
|
158
|
-
return Buffer.concat(instructions.map(i => i.serialize()));
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
// For testing only
|
|
162
|
-
export function decodeFromBytecode(
|
|
163
|
-
bytecode: Buffer,
|
|
164
|
-
instructionSet: InstructionSet = INSTRUCTION_SET(),
|
|
165
|
-
): Instruction[] {
|
|
166
|
-
const instructions: Instruction[] = [];
|
|
167
|
-
let pc = 0;
|
|
168
|
-
while (pc < bytecode.length) {
|
|
169
|
-
const [instruction, bytesConsumed] = decodeInstructionFromBytecode(bytecode, pc, instructionSet);
|
|
170
|
-
instructions.push(instruction);
|
|
171
|
-
pc += bytesConsumed;
|
|
172
|
-
}
|
|
173
|
-
return instructions;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
// Returns the instruction and the number of bytes consumed.
|
|
177
|
-
export function decodeInstructionFromBytecode(
|
|
178
|
-
bytecode: Buffer,
|
|
179
|
-
pc: number,
|
|
180
|
-
instructionSet: InstructionSet = INSTRUCTION_SET(),
|
|
181
|
-
): [Instruction, number] {
|
|
182
|
-
if (pc >= bytecode.length) {
|
|
183
|
-
throw new InvalidProgramCounterError(pc, bytecode.length);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
try {
|
|
187
|
-
const cursor = new BufferCursor(bytecode, pc);
|
|
188
|
-
const startingPosition = cursor.position();
|
|
189
|
-
const opcode: number = cursor.bufferAtPosition().readUint8(); // peek.
|
|
190
|
-
|
|
191
|
-
if (opcode > MAX_OPCODE_VALUE) {
|
|
192
|
-
throw new InvalidOpcodeError(
|
|
193
|
-
`Opcode ${opcode} (0x${opcode.toString(16)}) value is not in the range of valid opcodes.`,
|
|
194
|
-
);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
const instructionDeserializerOrUndef = instructionSet.get(opcode);
|
|
198
|
-
if (instructionDeserializerOrUndef === undefined) {
|
|
199
|
-
throw new InvalidOpcodeError(`Opcode ${Opcode[opcode]} (0x${opcode.toString(16)}) is not implemented`);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
const instructionDeserializer: InstructionDeserializer = instructionDeserializerOrUndef;
|
|
203
|
-
const instruction = instructionDeserializer(cursor);
|
|
204
|
-
return [instruction, cursor.position() - startingPosition];
|
|
205
|
-
} catch (error) {
|
|
206
|
-
if (error instanceof InvalidOpcodeError || error instanceof AvmExecutionError) {
|
|
207
|
-
throw error;
|
|
208
|
-
} else {
|
|
209
|
-
throw new AvmParsingError(`${error}`);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
package/src/client/index.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export { AcirSimulator } from './simulator.js';
|
|
2
|
-
export { ViewDataOracle } from './view_data_oracle.js';
|
|
3
|
-
export { DBOracle, ContractClassNotFoundError, ContractNotFoundError } from './db_oracle.js';
|
|
4
|
-
export * from './pick_notes.js';
|
|
5
|
-
export { ExecutionNoteCache } from './execution_note_cache.js';
|
|
6
|
-
export { extractPrivateCircuitPublicInputs } from './private_execution.js';
|
|
7
|
-
export { witnessMapToFields } from '../acvm/deserialize.js';
|
|
8
|
-
export { toACVMWitness } from '../acvm/serialize.js';
|
|
9
|
-
export { extractCallStack } from '../acvm/acvm.js';
|
|
10
|
-
export { WASMSimulator } from '../providers/acvm_wasm.js';
|
|
11
|
-
export { NoteData, TypedOracle } from '../acvm/oracle/typed_oracle.js';
|
|
12
|
-
export { Oracle } from '../acvm/oracle/oracle.js';
|
|
13
|
-
export { type SimulationProvider } from '../common/simulation_provider.js';
|
|
14
|
-
export { MessageLoadOracleInputs } from '../common/message_load_oracle_inputs.js';
|
|
15
|
-
export { resolveAssertionMessageFromRevertData, resolveOpcodeLocations } from '../common/errors.js';
|
package/src/common.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './common/index.js';
|
package/src/providers/index.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { computePublicDataTreeLeafSlot, deriveStorageSlotInMap } from '@aztec/circuits.js/hash';
|
|
2
|
-
import { type AztecAddress } from '@aztec/foundation/aztec-address';
|
|
3
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
4
|
-
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
5
|
-
import { FeeJuiceArtifact } from '@aztec/protocol-contracts/fee-juice';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Computes the storage slot within the Fee Juice contract for the balance of the fee payer.
|
|
9
|
-
*/
|
|
10
|
-
export function computeFeePayerBalanceStorageSlot(feePayer: AztecAddress) {
|
|
11
|
-
return deriveStorageSlotInMap(FeeJuiceArtifact.storageLayout.balances.slot, feePayer);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Computes the leaf slot in the public data tree for the balance of the fee payer in the Fee Juice.
|
|
16
|
-
*/
|
|
17
|
-
export async function computeFeePayerBalanceLeafSlot(feePayer: AztecAddress): Promise<Fr> {
|
|
18
|
-
if (feePayer.isZero()) {
|
|
19
|
-
return Fr.ZERO;
|
|
20
|
-
}
|
|
21
|
-
const balanceSlot = await computeFeePayerBalanceStorageSlot(feePayer);
|
|
22
|
-
return computePublicDataTreeLeafSlot(ProtocolContractAddress.FeeJuice, balanceSlot);
|
|
23
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|