@aztec/simulator 0.0.1-commit.b655e406 → 0.0.1-commit.b9865e97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -4
- package/dest/client.d.ts +1 -1
- package/dest/common/errors.d.ts +2 -2
- package/dest/common/errors.d.ts.map +1 -1
- package/dest/common/index.d.ts +1 -1
- package/dest/common/stats/index.d.ts +1 -1
- package/dest/common/stats/stats.d.ts +1 -1
- package/dest/private/acvm/acvm.d.ts +4 -2
- package/dest/private/acvm/acvm.d.ts.map +1 -1
- package/dest/private/acvm/acvm.js +4 -3
- package/dest/private/acvm/acvm_types.d.ts +1 -1
- package/dest/private/acvm/deserialize.d.ts +2 -2
- package/dest/private/acvm/deserialize.d.ts.map +1 -1
- package/dest/private/acvm/deserialize.js +1 -1
- package/dest/private/acvm/index.d.ts +1 -1
- package/dest/private/acvm/serialize.d.ts +2 -2
- package/dest/private/acvm/serialize.d.ts.map +1 -1
- package/dest/private/acvm/serialize.js +1 -1
- package/dest/private/acvm_native.d.ts +5 -3
- package/dest/private/acvm_native.d.ts.map +1 -1
- package/dest/private/acvm_native.js +8 -6
- package/dest/private/acvm_wasm.d.ts +4 -3
- package/dest/private/acvm_wasm.d.ts.map +1 -1
- package/dest/private/acvm_wasm.js +7 -5
- package/dest/private/acvm_wasm_with_blobs.d.ts +1 -1
- package/dest/private/acvm_wasm_with_blobs.d.ts.map +1 -1
- package/dest/private/circuit_recording/circuit_recorder.d.ts +4 -3
- package/dest/private/circuit_recording/circuit_recorder.d.ts.map +1 -1
- package/dest/private/circuit_recording/circuit_recorder.js +23 -20
- package/dest/private/circuit_recording/file_circuit_recorder.d.ts +3 -2
- package/dest/private/circuit_recording/file_circuit_recorder.d.ts.map +1 -1
- package/dest/private/circuit_recording/file_circuit_recorder.js +2 -2
- package/dest/private/circuit_recording/memory_circuit_recorder.d.ts +7 -2
- package/dest/private/circuit_recording/memory_circuit_recorder.d.ts.map +1 -1
- package/dest/private/circuit_recording/memory_circuit_recorder.js +4 -4
- package/dest/private/circuit_recording/simulator_recorder_wrapper.d.ts +1 -1
- package/dest/private/circuit_recording/simulator_recorder_wrapper.d.ts.map +1 -1
- package/dest/private/circuit_simulator.d.ts +1 -1
- package/dest/private/factory.d.ts +3 -3
- package/dest/private/factory.d.ts.map +1 -1
- package/dest/private/factory.js +7 -4
- package/dest/public/avm/testing/account_proof_fetcher.d.ts +2 -0
- package/dest/public/avm/testing/account_proof_fetcher.d.ts.map +1 -0
- package/dest/public/avm/testing/account_proof_fetcher.js +152 -0
- package/dest/public/avm/{fixtures → testing}/base_avm_simulation_tester.d.ts +3 -2
- package/dest/public/avm/testing/base_avm_simulation_tester.d.ts.map +1 -0
- package/dest/public/avm/{fixtures → testing}/base_avm_simulation_tester.js +18 -3
- package/dest/public/avm/{fixtures → testing}/utils.d.ts +4 -10
- package/dest/public/avm/testing/utils.d.ts.map +1 -0
- package/dest/public/avm/{fixtures → testing}/utils.js +6 -35
- package/dest/public/contracts_db_checkpoint.d.ts +16 -0
- package/dest/public/contracts_db_checkpoint.d.ts.map +1 -0
- package/dest/public/contracts_db_checkpoint.js +30 -0
- package/dest/public/db_interfaces.d.ts +14 -2
- package/dest/public/db_interfaces.d.ts.map +1 -1
- package/dest/public/executor_metrics.d.ts +3 -2
- package/dest/public/executor_metrics.d.ts.map +1 -1
- package/dest/public/executor_metrics.js +13 -34
- package/dest/public/executor_metrics_interface.d.ts +3 -2
- package/dest/public/executor_metrics_interface.d.ts.map +1 -1
- package/dest/public/fixtures/amm_test.d.ts +1 -1
- package/dest/public/fixtures/amm_test.js +4 -4
- package/dest/public/fixtures/bulk_test.d.ts +3 -3
- package/dest/public/fixtures/bulk_test.d.ts.map +1 -1
- package/dest/public/fixtures/bulk_test.js +36 -73
- package/dest/public/fixtures/custom_bytecode_tester.d.ts +29 -7
- package/dest/public/fixtures/custom_bytecode_tester.d.ts.map +1 -1
- package/dest/public/fixtures/custom_bytecode_tester.js +36 -12
- package/dest/public/fixtures/index.d.ts +2 -3
- package/dest/public/fixtures/index.d.ts.map +1 -1
- package/dest/public/fixtures/index.js +1 -2
- package/dest/public/fixtures/public_tx_simulation_tester.d.ts +30 -11
- package/dest/public/fixtures/public_tx_simulation_tester.d.ts.map +1 -1
- package/dest/public/fixtures/public_tx_simulation_tester.js +98 -31
- package/dest/public/fixtures/simple_contract_data_source.d.ts +5 -4
- package/dest/public/fixtures/simple_contract_data_source.d.ts.map +1 -1
- package/dest/public/fixtures/simple_contract_data_source.js +5 -5
- package/dest/public/fixtures/token_test.d.ts +6 -2
- package/dest/public/fixtures/token_test.d.ts.map +1 -1
- package/dest/public/fixtures/token_test.js +13 -12
- package/dest/public/fixtures/utils.d.ts +3 -3
- package/dest/public/fixtures/utils.d.ts.map +1 -1
- package/dest/public/fixtures/utils.js +23 -23
- package/dest/public/fuzzing/avm_fuzzer_simulator.d.ts +62 -0
- package/dest/public/fuzzing/avm_fuzzer_simulator.d.ts.map +1 -0
- package/dest/public/fuzzing/avm_fuzzer_simulator.js +176 -0
- package/dest/public/fuzzing/avm_simulator_bin.d.ts +2 -0
- package/dest/public/fuzzing/avm_simulator_bin.d.ts.map +1 -0
- package/dest/public/fuzzing/avm_simulator_bin.js +118 -0
- package/dest/public/index.d.ts +3 -2
- package/dest/public/index.d.ts.map +1 -1
- package/dest/public/index.js +1 -1
- package/dest/public/public_db_sources.d.ts +29 -66
- package/dest/public/public_db_sources.d.ts.map +1 -1
- package/dest/public/public_db_sources.js +83 -134
- package/dest/public/public_errors.d.ts +1 -1
- package/dest/public/public_errors.d.ts.map +1 -1
- package/dest/public/public_processor/guarded_merkle_tree.d.ts +8 -5
- package/dest/public/public_processor/guarded_merkle_tree.d.ts.map +1 -1
- package/dest/public/public_processor/guarded_merkle_tree.js +12 -4
- package/dest/public/public_processor/public_processor.d.ts +19 -21
- package/dest/public/public_processor/public_processor.d.ts.map +1 -1
- package/dest/public/public_processor/public_processor.js +553 -123
- package/dest/public/public_processor/public_processor_metrics.d.ts +5 -2
- package/dest/public/public_processor/public_processor_metrics.d.ts.map +1 -1
- package/dest/public/public_processor/public_processor_metrics.js +36 -45
- package/dest/public/public_tx_simulator/contract_provider_for_cpp.d.ts +19 -0
- package/dest/public/public_tx_simulator/contract_provider_for_cpp.d.ts.map +1 -0
- package/dest/public/public_tx_simulator/contract_provider_for_cpp.js +99 -0
- package/dest/public/public_tx_simulator/dumping_public_tx_simulator.d.ts +23 -0
- package/dest/public/public_tx_simulator/dumping_public_tx_simulator.d.ts.map +1 -0
- package/dest/public/public_tx_simulator/dumping_public_tx_simulator.js +52 -0
- package/dest/public/public_tx_simulator/factories.d.ts +14 -0
- package/dest/public/public_tx_simulator/factories.d.ts.map +1 -0
- package/dest/public/public_tx_simulator/factories.js +28 -0
- package/dest/public/public_tx_simulator/index.d.ts +5 -3
- package/dest/public/public_tx_simulator/index.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/index.js +3 -2
- package/dest/public/public_tx_simulator/public_tx_simulator.d.ts +42 -89
- package/dest/public/public_tx_simulator/public_tx_simulator.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/public_tx_simulator.js +101 -334
- package/dest/public/public_tx_simulator/public_tx_simulator_base.d.ts +22 -0
- package/dest/public/public_tx_simulator/public_tx_simulator_base.d.ts.map +1 -0
- package/dest/public/public_tx_simulator/public_tx_simulator_base.js +28 -0
- package/dest/public/public_tx_simulator/public_tx_simulator_interface.d.ts +25 -2
- package/dest/public/public_tx_simulator/public_tx_simulator_interface.d.ts.map +1 -1
- package/dest/public/side_effect_errors.d.ts +1 -1
- package/dest/public/side_effect_errors.d.ts.map +1 -1
- package/dest/public/test_executor_metrics.d.ts +11 -4
- package/dest/public/test_executor_metrics.d.ts.map +1 -1
- package/dest/public/test_executor_metrics.js +29 -6
- package/dest/public/unique_class_ids.d.ts +1 -1
- package/dest/public/unique_class_ids.d.ts.map +1 -1
- package/dest/public/utils.d.ts +1 -1
- package/dest/server.d.ts +1 -1
- package/dest/testing.d.ts +1 -1
- package/package.json +22 -22
- package/src/common/errors.ts +1 -1
- package/src/private/acvm/acvm.ts +4 -3
- package/src/private/acvm/deserialize.ts +1 -1
- package/src/private/acvm/serialize.ts +1 -1
- package/src/private/acvm_native.ts +11 -5
- package/src/private/acvm_wasm.ts +11 -4
- package/src/private/circuit_recording/circuit_recorder.ts +24 -21
- package/src/private/circuit_recording/file_circuit_recorder.ts +7 -2
- package/src/private/circuit_recording/memory_circuit_recorder.ts +6 -4
- package/src/private/factory.ts +7 -4
- package/src/public/avm/testing/account_proof.json +553 -0
- package/src/public/avm/testing/account_proof_fetcher.ts +166 -0
- package/src/public/avm/{fixtures → testing}/base_avm_simulation_tester.ts +23 -3
- package/src/public/avm/{fixtures → testing}/utils.ts +6 -41
- package/src/public/contracts_db_checkpoint.ts +41 -0
- package/src/public/db_interfaces.ts +16 -1
- package/src/public/executor_metrics.ts +11 -34
- package/src/public/executor_metrics_interface.ts +2 -1
- package/src/public/fixtures/amm_test.ts +4 -4
- package/src/public/fixtures/bulk_test.ts +38 -13
- package/src/public/fixtures/custom_bytecode_tester.ts +54 -20
- package/src/public/fixtures/index.ts +5 -2
- package/src/public/fixtures/public_tx_simulation_tester.ts +129 -27
- package/src/public/fixtures/simple_contract_data_source.ts +9 -10
- package/src/public/fixtures/token_test.ts +18 -10
- package/src/public/fixtures/utils.ts +28 -25
- package/src/public/fuzzing/avm_fuzzer_simulator.ts +285 -0
- package/src/public/fuzzing/avm_simulator_bin.ts +173 -0
- package/src/public/index.ts +4 -2
- package/src/public/public_db_sources.ts +112 -174
- package/src/public/public_processor/guarded_merkle_tree.ts +14 -6
- package/src/public/public_processor/public_processor.ts +225 -136
- package/src/public/public_processor/public_processor_metrics.ts +28 -44
- package/src/public/public_tx_simulator/contract_provider_for_cpp.ts +125 -0
- package/src/public/public_tx_simulator/dumping_public_tx_simulator.ts +83 -0
- package/src/public/public_tx_simulator/factories.ts +44 -0
- package/src/public/public_tx_simulator/index.ts +4 -2
- package/src/public/public_tx_simulator/public_tx_simulator.ts +153 -500
- package/src/public/public_tx_simulator/public_tx_simulator_base.ts +35 -0
- package/src/public/public_tx_simulator/public_tx_simulator_interface.ts +24 -2
- package/src/public/test_executor_metrics.ts +34 -8
- package/dest/public/avm/avm_context.d.ts +0 -41
- package/dest/public/avm/avm_context.d.ts.map +0 -1
- package/dest/public/avm/avm_context.js +0 -44
- package/dest/public/avm/avm_contract_call_result.d.ts +0 -32
- package/dest/public/avm/avm_contract_call_result.d.ts.map +0 -1
- package/dest/public/avm/avm_contract_call_result.js +0 -54
- package/dest/public/avm/avm_execution_environment.d.ts +0 -23
- package/dest/public/avm/avm_execution_environment.d.ts.map +0 -1
- package/dest/public/avm/avm_execution_environment.js +0 -36
- package/dest/public/avm/avm_gas.d.ts +0 -44
- package/dest/public/avm/avm_gas.d.ts.map +0 -1
- package/dest/public/avm/avm_gas.js +0 -195
- package/dest/public/avm/avm_machine_state.d.ts +0 -97
- package/dest/public/avm/avm_machine_state.d.ts.map +0 -1
- package/dest/public/avm/avm_machine_state.js +0 -109
- package/dest/public/avm/avm_memory_types.d.ts +0 -275
- package/dest/public/avm/avm_memory_types.d.ts.map +0 -1
- package/dest/public/avm/avm_memory_types.js +0 -351
- package/dest/public/avm/avm_simulator.d.ts +0 -39
- package/dest/public/avm/avm_simulator.d.ts.map +0 -1
- package/dest/public/avm/avm_simulator.js +0 -190
- package/dest/public/avm/avm_simulator_interface.d.ts +0 -9
- package/dest/public/avm/avm_simulator_interface.d.ts.map +0 -1
- package/dest/public/avm/avm_simulator_interface.js +0 -3
- package/dest/public/avm/errors.d.ts +0 -98
- package/dest/public/avm/errors.d.ts.map +0 -1
- package/dest/public/avm/errors.js +0 -129
- package/dest/public/avm/fixtures/avm_simulation_tester.d.ts +0 -22
- package/dest/public/avm/fixtures/avm_simulation_tester.d.ts.map +0 -1
- package/dest/public/avm/fixtures/avm_simulation_tester.js +0 -74
- package/dest/public/avm/fixtures/base_avm_simulation_tester.d.ts.map +0 -1
- package/dest/public/avm/fixtures/initializers.d.ts +0 -43
- package/dest/public/avm/fixtures/initializers.d.ts.map +0 -1
- package/dest/public/avm/fixtures/initializers.js +0 -42
- package/dest/public/avm/fixtures/utils.d.ts.map +0 -1
- package/dest/public/avm/index.d.ts +0 -2
- package/dest/public/avm/index.d.ts.map +0 -1
- package/dest/public/avm/index.js +0 -1
- package/dest/public/avm/opcodes/accrued_substate.d.ts +0 -75
- package/dest/public/avm/opcodes/accrued_substate.d.ts.map +0 -1
- package/dest/public/avm/opcodes/accrued_substate.js +0 -255
- package/dest/public/avm/opcodes/addressing_mode.d.ts +0 -31
- package/dest/public/avm/opcodes/addressing_mode.d.ts.map +0 -1
- package/dest/public/avm/opcodes/addressing_mode.js +0 -94
- package/dest/public/avm/opcodes/arithmetic.d.ts +0 -47
- package/dest/public/avm/opcodes/arithmetic.d.ts.map +0 -1
- package/dest/public/avm/opcodes/arithmetic.js +0 -87
- package/dest/public/avm/opcodes/bitwise.d.ts +0 -42
- package/dest/public/avm/opcodes/bitwise.d.ts.map +0 -1
- package/dest/public/avm/opcodes/bitwise.js +0 -99
- package/dest/public/avm/opcodes/comparators.d.ts +0 -25
- package/dest/public/avm/opcodes/comparators.d.ts.map +0 -1
- package/dest/public/avm/opcodes/comparators.js +0 -43
- package/dest/public/avm/opcodes/contract.d.ts +0 -20
- package/dest/public/avm/opcodes/contract.d.ts.map +0 -1
- package/dest/public/avm/opcodes/contract.js +0 -65
- package/dest/public/avm/opcodes/control_flow.d.ts +0 -41
- package/dest/public/avm/opcodes/control_flow.d.ts.map +0 -1
- package/dest/public/avm/opcodes/control_flow.js +0 -107
- package/dest/public/avm/opcodes/conversion.d.ts +0 -18
- package/dest/public/avm/opcodes/conversion.d.ts.map +0 -1
- package/dest/public/avm/opcodes/conversion.js +0 -333
- package/dest/public/avm/opcodes/ec_add.d.ts +0 -19
- package/dest/public/avm/opcodes/ec_add.d.ts.map +0 -1
- package/dest/public/avm/opcodes/ec_add.js +0 -84
- package/dest/public/avm/opcodes/environment_getters.d.ts +0 -28
- package/dest/public/avm/opcodes/environment_getters.d.ts.map +0 -1
- package/dest/public/avm/opcodes/environment_getters.js +0 -77
- package/dest/public/avm/opcodes/external_calls.d.ts +0 -59
- package/dest/public/avm/opcodes/external_calls.d.ts.map +0 -1
- package/dest/public/avm/opcodes/external_calls.js +0 -209
- package/dest/public/avm/opcodes/hashing.d.ts +0 -36
- package/dest/public/avm/opcodes/hashing.d.ts.map +0 -1
- package/dest/public/avm/opcodes/hashing.js +0 -114
- package/dest/public/avm/opcodes/index.d.ts +0 -16
- package/dest/public/avm/opcodes/index.d.ts.map +0 -1
- package/dest/public/avm/opcodes/index.js +0 -15
- package/dest/public/avm/opcodes/instruction.d.ts +0 -74
- package/dest/public/avm/opcodes/instruction.d.ts.map +0 -1
- package/dest/public/avm/opcodes/instruction.js +0 -95
- package/dest/public/avm/opcodes/instruction_impl.d.ts +0 -19
- package/dest/public/avm/opcodes/instruction_impl.d.ts.map +0 -1
- package/dest/public/avm/opcodes/instruction_impl.js +0 -30
- package/dest/public/avm/opcodes/memory.d.ts +0 -74
- package/dest/public/avm/opcodes/memory.d.ts.map +0 -1
- package/dest/public/avm/opcodes/memory.js +0 -257
- package/dest/public/avm/opcodes/misc.d.ts +0 -18
- package/dest/public/avm/opcodes/misc.d.ts.map +0 -1
- package/dest/public/avm/opcodes/misc.js +0 -73
- package/dest/public/avm/opcodes/storage.d.ts +0 -24
- package/dest/public/avm/opcodes/storage.d.ts.map +0 -1
- package/dest/public/avm/opcodes/storage.js +0 -68
- package/dest/public/avm/revert_reason.d.ts +0 -18
- package/dest/public/avm/revert_reason.d.ts.map +0 -1
- package/dest/public/avm/revert_reason.js +0 -38
- package/dest/public/avm/serialization/buffer_cursor.d.ts +0 -26
- package/dest/public/avm/serialization/buffer_cursor.d.ts.map +0 -1
- package/dest/public/avm/serialization/buffer_cursor.js +0 -99
- package/dest/public/avm/serialization/bytecode_serialization.d.ts +0 -17
- package/dest/public/avm/serialization/bytecode_serialization.d.ts.map +0 -1
- package/dest/public/avm/serialization/bytecode_serialization.js +0 -333
- package/dest/public/avm/serialization/instruction_serialization.d.ts +0 -114
- package/dest/public/avm/serialization/instruction_serialization.d.ts.map +0 -1
- package/dest/public/avm/serialization/instruction_serialization.js +0 -261
- package/dest/public/avm/test_utils.d.ts +0 -15
- package/dest/public/avm/test_utils.d.ts.map +0 -1
- package/dest/public/avm/test_utils.js +0 -44
- package/dest/public/debug_fn_name.d.ts +0 -5
- package/dest/public/debug_fn_name.d.ts.map +0 -1
- package/dest/public/debug_fn_name.js +0 -9
- package/dest/public/fixtures/custom_bytecode_tests.d.ts +0 -9
- package/dest/public/fixtures/custom_bytecode_tests.d.ts.map +0 -1
- package/dest/public/fixtures/custom_bytecode_tests.js +0 -109
- package/dest/public/fixtures/minimal_public_tx.d.ts +0 -10
- package/dest/public/fixtures/minimal_public_tx.d.ts.map +0 -1
- package/dest/public/fixtures/minimal_public_tx.js +0 -29
- package/dest/public/hinting_db_sources.d.ts +0 -70
- package/dest/public/hinting_db_sources.d.ts.map +0 -1
- package/dest/public/hinting_db_sources.js +0 -297
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator.d.ts +0 -41
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator.d.ts.map +0 -1
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator.js +0 -89
- package/dest/public/public_tx_simulator/measured_public_tx_simulator.d.ts +0 -24
- package/dest/public/public_tx_simulator/measured_public_tx_simulator.d.ts.map +0 -1
- package/dest/public/public_tx_simulator/measured_public_tx_simulator.js +0 -51
- package/dest/public/public_tx_simulator/public_tx_context.d.ts +0 -127
- package/dest/public/public_tx_simulator/public_tx_context.d.ts.map +0 -1
- package/dest/public/public_tx_simulator/public_tx_context.js +0 -292
- package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.d.ts +0 -21
- package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.d.ts.map +0 -1
- package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.js +0 -39
- package/dest/public/side_effect_trace.d.ts +0 -87
- package/dest/public/side_effect_trace.d.ts.map +0 -1
- package/dest/public/side_effect_trace.js +0 -199
- package/dest/public/side_effect_trace_interface.d.ts +0 -23
- package/dest/public/side_effect_trace_interface.d.ts.map +0 -1
- package/dest/public/side_effect_trace_interface.js +0 -1
- package/dest/public/state_manager/index.d.ts +0 -2
- package/dest/public/state_manager/index.d.ts.map +0 -1
- package/dest/public/state_manager/index.js +0 -1
- package/dest/public/state_manager/nullifiers.d.ts +0 -61
- package/dest/public/state_manager/nullifiers.d.ts.map +0 -1
- package/dest/public/state_manager/nullifiers.js +0 -92
- package/dest/public/state_manager/public_storage.d.ts +0 -66
- package/dest/public/state_manager/public_storage.d.ts.map +0 -1
- package/dest/public/state_manager/public_storage.js +0 -145
- package/dest/public/state_manager/state_manager.d.ts +0 -166
- package/dest/public/state_manager/state_manager.d.ts.map +0 -1
- package/dest/public/state_manager/state_manager.js +0 -391
- package/dest/public/tx_contract_cache.d.ts +0 -41
- package/dest/public/tx_contract_cache.d.ts.map +0 -1
- package/dest/public/tx_contract_cache.js +0 -49
- package/src/public/avm/avm_context.ts +0 -61
- package/src/public/avm/avm_contract_call_result.ts +0 -67
- package/src/public/avm/avm_execution_environment.ts +0 -48
- package/src/public/avm/avm_gas.ts +0 -183
- package/src/public/avm/avm_machine_state.ts +0 -169
- package/src/public/avm/avm_memory_types.ts +0 -436
- package/src/public/avm/avm_simulator.ts +0 -274
- package/src/public/avm/avm_simulator_interface.ts +0 -8
- package/src/public/avm/errors.ts +0 -163
- package/src/public/avm/fixtures/avm_simulation_tester.ts +0 -108
- package/src/public/avm/fixtures/initializers.ts +0 -104
- package/src/public/avm/index.ts +0 -1
- package/src/public/avm/opcodes/accrued_substate.ts +0 -288
- package/src/public/avm/opcodes/addressing_mode.ts +0 -111
- package/src/public/avm/opcodes/arithmetic.ts +0 -117
- package/src/public/avm/opcodes/bitwise.ts +0 -113
- package/src/public/avm/opcodes/comparators.ts +0 -55
- package/src/public/avm/opcodes/contract.ts +0 -75
- package/src/public/avm/opcodes/control_flow.ts +0 -123
- package/src/public/avm/opcodes/conversion.ts +0 -104
- package/src/public/avm/opcodes/ec_add.ts +0 -96
- package/src/public/avm/opcodes/environment_getters.ts +0 -87
- package/src/public/avm/opcodes/external_calls.ts +0 -260
- package/src/public/avm/opcodes/hashing.ts +0 -145
- package/src/public/avm/opcodes/index.ts +0 -15
- package/src/public/avm/opcodes/instruction.ts +0 -136
- package/src/public/avm/opcodes/instruction_impl.ts +0 -36
- package/src/public/avm/opcodes/memory.ts +0 -293
- package/src/public/avm/opcodes/misc.ts +0 -102
- package/src/public/avm/opcodes/storage.ts +0 -87
- package/src/public/avm/revert_reason.ts +0 -55
- package/src/public/avm/serialization/buffer_cursor.ts +0 -118
- package/src/public/avm/serialization/bytecode_serialization.ts +0 -204
- package/src/public/avm/serialization/instruction_serialization.ts +0 -249
- package/src/public/avm/test_utils.ts +0 -64
- package/src/public/debug_fn_name.ts +0 -18
- package/src/public/fixtures/custom_bytecode_tests.ts +0 -135
- package/src/public/fixtures/minimal_public_tx.ts +0 -36
- package/src/public/hinting_db_sources.ts +0 -505
- package/src/public/public_tx_simulator/cpp_public_tx_simulator.ts +0 -128
- package/src/public/public_tx_simulator/measured_public_tx_simulator.ts +0 -109
- package/src/public/public_tx_simulator/public_tx_context.ts +0 -471
- package/src/public/public_tx_simulator/telemetry_public_tx_simulator.ts +0 -63
- package/src/public/side_effect_trace.ts +0 -290
- package/src/public/side_effect_trace_interface.ts +0 -28
- package/src/public/state_manager/index.ts +0 -1
- package/src/public/state_manager/nullifiers.ts +0 -103
- package/src/public/state_manager/public_storage.ts +0 -174
- package/src/public/state_manager/state_manager.ts +0 -560
- package/src/public/tx_contract_cache.ts +0 -69
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { AvmContext } from '../avm_context.js';
|
|
2
|
-
import { type MemoryValue } from '../avm_memory_types.js';
|
|
3
|
-
import { Opcode } from '../serialization/instruction_serialization.js';
|
|
4
|
-
import { ThreeOperandInstruction } from './instruction_impl.js';
|
|
5
|
-
declare abstract class ComparatorInstruction extends ThreeOperandInstruction {
|
|
6
|
-
execute(context: AvmContext): Promise<void>;
|
|
7
|
-
protected abstract compare(a: MemoryValue, b: MemoryValue): boolean;
|
|
8
|
-
}
|
|
9
|
-
export declare class Eq extends ComparatorInstruction {
|
|
10
|
-
static readonly type: string;
|
|
11
|
-
static readonly opcode = Opcode.EQ_8;
|
|
12
|
-
protected compare(a: MemoryValue, b: MemoryValue): boolean;
|
|
13
|
-
}
|
|
14
|
-
export declare class Lt extends ComparatorInstruction {
|
|
15
|
-
static readonly type: string;
|
|
16
|
-
static readonly opcode = Opcode.LT_8;
|
|
17
|
-
protected compare(a: MemoryValue, b: MemoryValue): boolean;
|
|
18
|
-
}
|
|
19
|
-
export declare class Lte extends ComparatorInstruction {
|
|
20
|
-
static readonly type: string;
|
|
21
|
-
static readonly opcode = Opcode.LTE_8;
|
|
22
|
-
protected compare(a: MemoryValue, b: MemoryValue): boolean;
|
|
23
|
-
}
|
|
24
|
-
export {};
|
|
25
|
-
//# sourceMappingURL=comparators.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"comparators.d.ts","sourceRoot":"","sources":["../../../../src/public/avm/opcodes/comparators.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,KAAK,WAAW,EAAS,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,+CAA+C,CAAC;AAEvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,uBAAe,qBAAsB,SAAQ,uBAAuB;IACrD,OAAO,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBxD,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,WAAW,GAAG,OAAO;CACpE;AAED,qBAAa,EAAG,SAAQ,qBAAqB;IAC3C,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAQ;IACpC,MAAM,CAAC,QAAQ,CAAC,MAAM,eAAe;IAErC,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,WAAW,GAAG,OAAO;CAG3D;AAED,qBAAa,EAAG,SAAQ,qBAAqB;IAC3C,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAQ;IACpC,MAAM,CAAC,QAAQ,CAAC,MAAM,eAAe;IAErC,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,WAAW,GAAG,OAAO;CAG3D;AAED,qBAAa,GAAI,SAAQ,qBAAqB;IAC5C,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAS;IACrC,MAAM,CAAC,QAAQ,CAAC,MAAM,gBAAgB;IAEtC,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,WAAW,GAAG,OAAO;CAG3D"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { Uint1 } from '../avm_memory_types.js';
|
|
2
|
-
import { Opcode } from '../serialization/instruction_serialization.js';
|
|
3
|
-
import { Addressing } from './addressing_mode.js';
|
|
4
|
-
import { ThreeOperandInstruction } from './instruction_impl.js';
|
|
5
|
-
class ComparatorInstruction extends ThreeOperandInstruction {
|
|
6
|
-
async execute(context) {
|
|
7
|
-
const memory = context.machineState.memory;
|
|
8
|
-
const addressing = Addressing.fromWire(this.indirect);
|
|
9
|
-
context.machineState.consumeGas(this.baseGasCost(addressing.indirectOperandsCount(), addressing.relativeOperandsCount()));
|
|
10
|
-
const operands = [
|
|
11
|
-
this.aOffset,
|
|
12
|
-
this.bOffset,
|
|
13
|
-
this.dstOffset
|
|
14
|
-
];
|
|
15
|
-
const [aOffset, bOffset, dstOffset] = addressing.resolve(operands, memory);
|
|
16
|
-
memory.checkTagsAreSame(aOffset, bOffset); // Brillig semantic enforces that tags match.
|
|
17
|
-
const a = memory.get(aOffset);
|
|
18
|
-
const b = memory.get(bOffset);
|
|
19
|
-
const dest = new Uint1(this.compare(a, b) ? 1 : 0);
|
|
20
|
-
memory.set(dstOffset, dest);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
export class Eq extends ComparatorInstruction {
|
|
24
|
-
static type = 'EQ';
|
|
25
|
-
static opcode = Opcode.EQ_8;
|
|
26
|
-
compare(a, b) {
|
|
27
|
-
return a.equals(b);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
export class Lt extends ComparatorInstruction {
|
|
31
|
-
static type = 'LT';
|
|
32
|
-
static opcode = Opcode.LT_8;
|
|
33
|
-
compare(a, b) {
|
|
34
|
-
return a.lt(b);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
export class Lte extends ComparatorInstruction {
|
|
38
|
-
static type = 'LTE';
|
|
39
|
-
static opcode = Opcode.LTE_8;
|
|
40
|
-
compare(a, b) {
|
|
41
|
-
return a.lt(b) || a.equals(b);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { AvmContext } from '../avm_context.js';
|
|
2
|
-
import { Opcode, OperandType } from '../serialization/instruction_serialization.js';
|
|
3
|
-
import { Instruction } from './instruction.js';
|
|
4
|
-
export declare enum ContractInstanceMember {
|
|
5
|
-
DEPLOYER = 0,
|
|
6
|
-
CLASS_ID = 1,
|
|
7
|
-
INIT_HASH = 2
|
|
8
|
-
}
|
|
9
|
-
export declare class GetContractInstance extends Instruction {
|
|
10
|
-
private indirect;
|
|
11
|
-
private addressOffset;
|
|
12
|
-
private dstOffset;
|
|
13
|
-
private memberEnum;
|
|
14
|
-
static readonly type: string;
|
|
15
|
-
static readonly opcode: Opcode;
|
|
16
|
-
static readonly wireFormat: OperandType[];
|
|
17
|
-
constructor(indirect: number, addressOffset: number, dstOffset: number, memberEnum: number);
|
|
18
|
-
execute(context: AvmContext): Promise<void>;
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=contract.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../../src/public/avm/opcodes/contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGpD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAEpF,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,oBAAY,sBAAsB;IAChC,QAAQ,IAAA;IACR,QAAQ,IAAA;IACR,SAAS,IAAA;CACV;AAED,qBAAa,mBAAoB,SAAQ,WAAW;IAahD,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,UAAU;IAfpB,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAyB;IACrD,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAA8B;IAE5D,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,WAAW,EAAE,CAMvC;gBAGQ,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM;IAKtB,OAAO,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;CAwClD"}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { Field, TypeTag, Uint1 } from '../avm_memory_types.js';
|
|
2
|
-
import { InstructionExecutionError } from '../errors.js';
|
|
3
|
-
import { Opcode, OperandType } from '../serialization/instruction_serialization.js';
|
|
4
|
-
import { Addressing } from './addressing_mode.js';
|
|
5
|
-
import { Instruction } from './instruction.js';
|
|
6
|
-
export var ContractInstanceMember = /*#__PURE__*/ function(ContractInstanceMember) {
|
|
7
|
-
ContractInstanceMember[ContractInstanceMember["DEPLOYER"] = 0] = "DEPLOYER";
|
|
8
|
-
ContractInstanceMember[ContractInstanceMember["CLASS_ID"] = 1] = "CLASS_ID";
|
|
9
|
-
ContractInstanceMember[ContractInstanceMember["INIT_HASH"] = 2] = "INIT_HASH";
|
|
10
|
-
return ContractInstanceMember;
|
|
11
|
-
}({});
|
|
12
|
-
export class GetContractInstance extends Instruction {
|
|
13
|
-
indirect;
|
|
14
|
-
addressOffset;
|
|
15
|
-
dstOffset;
|
|
16
|
-
memberEnum;
|
|
17
|
-
static type = 'GETCONTRACTINSTANCE';
|
|
18
|
-
static opcode = Opcode.GETCONTRACTINSTANCE;
|
|
19
|
-
// Informs (de)serialization. See Instruction.deserialize.
|
|
20
|
-
static wireFormat = [
|
|
21
|
-
OperandType.UINT8,
|
|
22
|
-
OperandType.UINT8,
|
|
23
|
-
OperandType.UINT16,
|
|
24
|
-
OperandType.UINT16,
|
|
25
|
-
OperandType.UINT8
|
|
26
|
-
];
|
|
27
|
-
constructor(indirect, addressOffset, dstOffset, memberEnum){
|
|
28
|
-
super(), this.indirect = indirect, this.addressOffset = addressOffset, this.dstOffset = dstOffset, this.memberEnum = memberEnum;
|
|
29
|
-
}
|
|
30
|
-
async execute(context) {
|
|
31
|
-
const memory = context.machineState.memory;
|
|
32
|
-
const addressing = Addressing.fromWire(this.indirect);
|
|
33
|
-
context.machineState.consumeGas(this.baseGasCost(addressing.indirectOperandsCount(), addressing.relativeOperandsCount()));
|
|
34
|
-
if (!(this.memberEnum in ContractInstanceMember)) {
|
|
35
|
-
throw new InstructionExecutionError(`Invalid GETCONSTRACTINSTANCE member enum ${this.memberEnum}`);
|
|
36
|
-
}
|
|
37
|
-
const operands = [
|
|
38
|
-
this.addressOffset,
|
|
39
|
-
this.dstOffset
|
|
40
|
-
];
|
|
41
|
-
const [addressOffset, dstOffset] = addressing.resolve(operands, memory);
|
|
42
|
-
memory.checkTag(TypeTag.FIELD, addressOffset);
|
|
43
|
-
const address = memory.get(addressOffset).toAztecAddress();
|
|
44
|
-
const instance = await context.persistableState.getContractInstance(address);
|
|
45
|
-
const exists = instance !== undefined;
|
|
46
|
-
let memberValue = new Field(0);
|
|
47
|
-
if (exists) {
|
|
48
|
-
switch(this.memberEnum){
|
|
49
|
-
case 0:
|
|
50
|
-
memberValue = new Field(instance.deployer.toField());
|
|
51
|
-
break;
|
|
52
|
-
case 1:
|
|
53
|
-
memberValue = new Field(instance.currentContractClassId.toField());
|
|
54
|
-
break;
|
|
55
|
-
case 2:
|
|
56
|
-
memberValue = new Field(instance.initializationHash);
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
const existsOffset = dstOffset;
|
|
61
|
-
const memberValueOffset = dstOffset + 1;
|
|
62
|
-
memory.set(existsOffset, new Uint1(exists ? 1 : 0));
|
|
63
|
-
memory.set(memberValueOffset, memberValue);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { AvmContext } from '../avm_context.js';
|
|
2
|
-
import { Opcode, OperandType } from '../serialization/instruction_serialization.js';
|
|
3
|
-
import { Instruction } from './instruction.js';
|
|
4
|
-
export declare class Jump extends Instruction {
|
|
5
|
-
private jumpOffset;
|
|
6
|
-
static type: string;
|
|
7
|
-
static readonly opcode: Opcode;
|
|
8
|
-
static readonly wireFormat: OperandType[];
|
|
9
|
-
constructor(jumpOffset: number);
|
|
10
|
-
execute(context: AvmContext): Promise<void>;
|
|
11
|
-
handlesPC(): boolean;
|
|
12
|
-
}
|
|
13
|
-
export declare class JumpI extends Instruction {
|
|
14
|
-
private indirect;
|
|
15
|
-
private condOffset;
|
|
16
|
-
private loc;
|
|
17
|
-
static type: string;
|
|
18
|
-
static readonly opcode: Opcode;
|
|
19
|
-
static readonly wireFormat: OperandType[];
|
|
20
|
-
constructor(indirect: number, condOffset: number, loc: number);
|
|
21
|
-
execute(context: AvmContext): Promise<void>;
|
|
22
|
-
handlesPC(): boolean;
|
|
23
|
-
}
|
|
24
|
-
export declare class InternalCall extends Instruction {
|
|
25
|
-
private loc;
|
|
26
|
-
static readonly type: string;
|
|
27
|
-
static readonly opcode: Opcode;
|
|
28
|
-
static readonly wireFormat: OperandType[];
|
|
29
|
-
constructor(loc: number);
|
|
30
|
-
execute(context: AvmContext): Promise<void>;
|
|
31
|
-
handlesPC(): boolean;
|
|
32
|
-
}
|
|
33
|
-
export declare class InternalReturn extends Instruction {
|
|
34
|
-
static readonly type: string;
|
|
35
|
-
static readonly opcode: Opcode;
|
|
36
|
-
static readonly wireFormat: OperandType[];
|
|
37
|
-
constructor();
|
|
38
|
-
execute(context: AvmContext): Promise<void>;
|
|
39
|
-
handlesPC(): boolean;
|
|
40
|
-
}
|
|
41
|
-
//# sourceMappingURL=control_flow.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"control_flow.d.ts","sourceRoot":"","sources":["../../../../src/public/avm/opcodes/control_flow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGpD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAEpF,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,qBAAa,IAAK,SAAQ,WAAW;IAMvB,OAAO,CAAC,UAAU;IAL9B,MAAM,CAAC,IAAI,EAAE,MAAM,CAAU;IAC7B,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAkB;IAEhD,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,WAAW,EAAE,CAA2C;gBAEhE,UAAU,EAAE,MAAM;IAIzB,OAAO,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAMxC,SAAS,IAAI,OAAO;CAGrC;AAED,qBAAa,KAAM,SAAQ,WAAW;IAalC,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,GAAG;IAdb,MAAM,CAAC,IAAI,EAAE,MAAM,CAAW;IAC9B,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAmB;IAGjD,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,WAAW,EAAE,CAKvC;gBAGQ,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM;IAKR,OAAO,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAqBxC,SAAS,IAAI,OAAO;CAGrC;AAED,qBAAa,YAAa,SAAQ,WAAW;IAM/B,OAAO,CAAC,GAAG;IALvB,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAkB;IAC9C,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAuB;IAErD,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,WAAW,EAAE,CAA2C;gBAEhE,GAAG,EAAE,MAAM;IAIlB,OAAO,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAUxC,SAAS,IAAI,OAAO;CAGrC;AAED,qBAAa,cAAe,SAAQ,WAAW;IAC7C,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAoB;IAChD,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAyB;IAEvD,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,WAAW,EAAE,CAAuB;;IAMnD,OAAO,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAUxC,SAAS,IAAI,OAAO;CAGrC"}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { TypeTag } from '../avm_memory_types.js';
|
|
2
|
-
import { InstructionExecutionError } from '../errors.js';
|
|
3
|
-
import { Opcode, OperandType } from '../serialization/instruction_serialization.js';
|
|
4
|
-
import { Addressing } from './addressing_mode.js';
|
|
5
|
-
import { Instruction } from './instruction.js';
|
|
6
|
-
export class Jump extends Instruction {
|
|
7
|
-
jumpOffset;
|
|
8
|
-
static type = 'JUMP';
|
|
9
|
-
static opcode = Opcode.JUMP_32;
|
|
10
|
-
// Informs (de)serialization. See Instruction.deserialize.
|
|
11
|
-
static wireFormat = [
|
|
12
|
-
OperandType.UINT8,
|
|
13
|
-
OperandType.UINT32
|
|
14
|
-
];
|
|
15
|
-
constructor(jumpOffset){
|
|
16
|
-
super(), this.jumpOffset = jumpOffset;
|
|
17
|
-
}
|
|
18
|
-
async execute(context) {
|
|
19
|
-
context.machineState.consumeGas(this.baseGasCost(0, 0));
|
|
20
|
-
context.machineState.pc = this.jumpOffset;
|
|
21
|
-
}
|
|
22
|
-
handlesPC() {
|
|
23
|
-
return true;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
export class JumpI extends Instruction {
|
|
27
|
-
indirect;
|
|
28
|
-
condOffset;
|
|
29
|
-
loc;
|
|
30
|
-
static type = 'JUMPI';
|
|
31
|
-
static opcode = Opcode.JUMPI_32;
|
|
32
|
-
// Instruction wire format with opcode.
|
|
33
|
-
static wireFormat = [
|
|
34
|
-
OperandType.UINT8,
|
|
35
|
-
OperandType.UINT8,
|
|
36
|
-
OperandType.UINT16,
|
|
37
|
-
OperandType.UINT32
|
|
38
|
-
];
|
|
39
|
-
constructor(indirect, condOffset, loc){
|
|
40
|
-
super(), this.indirect = indirect, this.condOffset = condOffset, this.loc = loc;
|
|
41
|
-
}
|
|
42
|
-
async execute(context) {
|
|
43
|
-
const memory = context.machineState.memory;
|
|
44
|
-
const addressing = Addressing.fromWire(this.indirect);
|
|
45
|
-
context.machineState.consumeGas(this.baseGasCost(addressing.indirectOperandsCount(), addressing.relativeOperandsCount()));
|
|
46
|
-
const operands = [
|
|
47
|
-
this.condOffset
|
|
48
|
-
];
|
|
49
|
-
const [resolvedCondOffset] = addressing.resolve(operands, memory);
|
|
50
|
-
memory.checkTag(TypeTag.UINT1, resolvedCondOffset);
|
|
51
|
-
const condition = memory.getAs(resolvedCondOffset);
|
|
52
|
-
if (condition.toNumber() == 0) {
|
|
53
|
-
context.machineState.pc = context.machineState.nextPc;
|
|
54
|
-
} else {
|
|
55
|
-
context.machineState.pc = this.loc;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
handlesPC() {
|
|
59
|
-
return true;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
export class InternalCall extends Instruction {
|
|
63
|
-
loc;
|
|
64
|
-
static type = 'INTERNALCALL';
|
|
65
|
-
static opcode = Opcode.INTERNALCALL;
|
|
66
|
-
// Informs (de)serialization. See Instruction.deserialize.
|
|
67
|
-
static wireFormat = [
|
|
68
|
-
OperandType.UINT8,
|
|
69
|
-
OperandType.UINT32
|
|
70
|
-
];
|
|
71
|
-
constructor(loc){
|
|
72
|
-
super(), this.loc = loc;
|
|
73
|
-
}
|
|
74
|
-
async execute(context) {
|
|
75
|
-
context.machineState.consumeGas(this.baseGasCost(0, 0));
|
|
76
|
-
context.machineState.internalCallStack.push({
|
|
77
|
-
callPc: context.machineState.pc,
|
|
78
|
-
returnPc: context.machineState.nextPc
|
|
79
|
-
});
|
|
80
|
-
context.machineState.pc = this.loc;
|
|
81
|
-
}
|
|
82
|
-
handlesPC() {
|
|
83
|
-
return true;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
export class InternalReturn extends Instruction {
|
|
87
|
-
static type = 'INTERNALRETURN';
|
|
88
|
-
static opcode = Opcode.INTERNALRETURN;
|
|
89
|
-
// Informs (de)serialization. See Instruction.deserialize.
|
|
90
|
-
static wireFormat = [
|
|
91
|
-
OperandType.UINT8
|
|
92
|
-
];
|
|
93
|
-
constructor(){
|
|
94
|
-
super();
|
|
95
|
-
}
|
|
96
|
-
async execute(context) {
|
|
97
|
-
context.machineState.consumeGas(this.baseGasCost(0, 0));
|
|
98
|
-
const stackEntry = context.machineState.internalCallStack.pop();
|
|
99
|
-
if (stackEntry === undefined) {
|
|
100
|
-
throw new InstructionExecutionError('Internal call stack empty!');
|
|
101
|
-
}
|
|
102
|
-
context.machineState.pc = stackEntry.returnPc;
|
|
103
|
-
}
|
|
104
|
-
handlesPC() {
|
|
105
|
-
return true;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { AvmContext } from '../avm_context.js';
|
|
2
|
-
import { Opcode, OperandType } from '../serialization/instruction_serialization.js';
|
|
3
|
-
import { Instruction } from './instruction.js';
|
|
4
|
-
export declare class ToRadixBE extends Instruction {
|
|
5
|
-
private indirect;
|
|
6
|
-
private srcOffset;
|
|
7
|
-
private radixOffset;
|
|
8
|
-
private numLimbsOffset;
|
|
9
|
-
private outputBitsOffset;
|
|
10
|
-
private dstOffset;
|
|
11
|
-
static type: string;
|
|
12
|
-
static readonly opcode: Opcode;
|
|
13
|
-
static readonly wireFormat: OperandType[];
|
|
14
|
-
constructor(indirect: number, srcOffset: number, radixOffset: number, numLimbsOffset: number, outputBitsOffset: number, dstOffset: number);
|
|
15
|
-
execute(context: AvmContext): Promise<void>;
|
|
16
|
-
}
|
|
17
|
-
export declare const MODULUS_LIMBS_PER_RADIX: number[];
|
|
18
|
-
//# sourceMappingURL=conversion.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"conversion.d.ts","sourceRoot":"","sources":["../../../../src/public/avm/opcodes/conversion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGpD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAEpF,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,qBAAa,SAAU,SAAQ,WAAW;IAgBtC,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,gBAAgB;IACxB,OAAO,CAAC,SAAS;IApBnB,MAAM,CAAC,IAAI,EAAE,MAAM,CAAe;IAClC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAoB;IAGlD,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,WAAW,EAAE,CAQvC;gBAGQ,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,MAAM,EACtB,gBAAgB,EAAE,MAAM,EACxB,SAAS,EAAE,MAAM;IAKd,OAAO,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;CAyDzD;AAGD,eAAO,MAAM,uBAAuB,EAAE,MAAM,EAU3C,CAAC"}
|
|
@@ -1,333 +0,0 @@
|
|
|
1
|
-
import { TypeTag, Uint1, Uint8 } from '../avm_memory_types.js';
|
|
2
|
-
import { InvalidToRadixInputsError } from '../errors.js';
|
|
3
|
-
import { Opcode, OperandType } from '../serialization/instruction_serialization.js';
|
|
4
|
-
import { Addressing } from './addressing_mode.js';
|
|
5
|
-
import { Instruction } from './instruction.js';
|
|
6
|
-
export class ToRadixBE extends Instruction {
|
|
7
|
-
indirect;
|
|
8
|
-
srcOffset;
|
|
9
|
-
radixOffset;
|
|
10
|
-
numLimbsOffset;
|
|
11
|
-
outputBitsOffset;
|
|
12
|
-
dstOffset;
|
|
13
|
-
static type = 'TORADIXBE';
|
|
14
|
-
static opcode = Opcode.TORADIXBE;
|
|
15
|
-
// Informs (de)serialization. See Instruction.deserialize.
|
|
16
|
-
static wireFormat = [
|
|
17
|
-
OperandType.UINT8,
|
|
18
|
-
OperandType.UINT16,
|
|
19
|
-
OperandType.UINT16,
|
|
20
|
-
OperandType.UINT16,
|
|
21
|
-
OperandType.UINT16,
|
|
22
|
-
OperandType.UINT16,
|
|
23
|
-
OperandType.UINT16
|
|
24
|
-
];
|
|
25
|
-
constructor(indirect, srcOffset, radixOffset, numLimbsOffset, outputBitsOffset, dstOffset){
|
|
26
|
-
super(), this.indirect = indirect, this.srcOffset = srcOffset, this.radixOffset = radixOffset, this.numLimbsOffset = numLimbsOffset, this.outputBitsOffset = outputBitsOffset, this.dstOffset = dstOffset;
|
|
27
|
-
}
|
|
28
|
-
async execute(context) {
|
|
29
|
-
const memory = context.machineState.memory;
|
|
30
|
-
const addressing = Addressing.fromWire(this.indirect);
|
|
31
|
-
context.machineState.consumeGas(this.baseGasCost(addressing.indirectOperandsCount(), addressing.relativeOperandsCount()));
|
|
32
|
-
const operands = [
|
|
33
|
-
this.srcOffset,
|
|
34
|
-
this.radixOffset,
|
|
35
|
-
this.numLimbsOffset,
|
|
36
|
-
this.outputBitsOffset,
|
|
37
|
-
this.dstOffset
|
|
38
|
-
];
|
|
39
|
-
const [srcOffset, radixOffset, numLimbsOffset, outputBitsOffset, dstOffset] = addressing.resolve(operands, memory);
|
|
40
|
-
// The radix gadget only takes in a Field
|
|
41
|
-
memory.checkTag(TypeTag.FIELD, srcOffset);
|
|
42
|
-
memory.checkTag(TypeTag.UINT32, radixOffset);
|
|
43
|
-
memory.checkTag(TypeTag.UINT32, numLimbsOffset);
|
|
44
|
-
memory.checkTag(TypeTag.UINT1, outputBitsOffset);
|
|
45
|
-
const numLimbs = memory.get(numLimbsOffset).toNumber();
|
|
46
|
-
const radix = memory.get(radixOffset).toBigInt();
|
|
47
|
-
context.machineState.consumeGas(this.dynamicGasCost(Math.max(numLimbs, radix > 256n ? 32 : MODULUS_LIMBS_PER_RADIX[Number(radix)])));
|
|
48
|
-
const outputBits = memory.get(outputBitsOffset).toNumber();
|
|
49
|
-
let value = memory.get(srcOffset).toBigInt();
|
|
50
|
-
if (radix < 2 || radix > 256) {
|
|
51
|
-
throw new InvalidToRadixInputsError(`ToRadixBE instruction's radix should be in range [2,256] (was ${radix}).`);
|
|
52
|
-
}
|
|
53
|
-
if (numLimbs < 1 && value != BigInt(0n)) {
|
|
54
|
-
throw new InvalidToRadixInputsError(`ToRadixBE instruction's input value is not zero (was ${value}) but numLimbs zero.`);
|
|
55
|
-
}
|
|
56
|
-
if (outputBits != 0 && radix != BigInt(2n)) {
|
|
57
|
-
throw new InvalidToRadixInputsError(`Radix ${radix} is not equal to 2 and bit mode is activated.`);
|
|
58
|
-
}
|
|
59
|
-
const radixBN = BigInt(radix);
|
|
60
|
-
const limbArray = new Array(numLimbs);
|
|
61
|
-
for(let i = numLimbs - 1; i >= 0; i--){
|
|
62
|
-
const limb = value % radixBN;
|
|
63
|
-
limbArray[i] = limb;
|
|
64
|
-
value /= radixBN;
|
|
65
|
-
}
|
|
66
|
-
if (value !== 0n) {
|
|
67
|
-
throw new InvalidToRadixInputsError(`Field failed to decompose in ${numLimbs} limbs.`);
|
|
68
|
-
}
|
|
69
|
-
const outputType = outputBits != 0 ? Uint1 : Uint8;
|
|
70
|
-
const res = limbArray.map((byte)=>new outputType(byte));
|
|
71
|
-
memory.setSlice(dstOffset, res);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
// First two are for radix = 0 and 1, which are invalid, so we have 0 limbs for those cases.
|
|
75
|
-
export const MODULUS_LIMBS_PER_RADIX = [
|
|
76
|
-
0,
|
|
77
|
-
0,
|
|
78
|
-
254,
|
|
79
|
-
161,
|
|
80
|
-
127,
|
|
81
|
-
110,
|
|
82
|
-
99,
|
|
83
|
-
91,
|
|
84
|
-
85,
|
|
85
|
-
81,
|
|
86
|
-
77,
|
|
87
|
-
74,
|
|
88
|
-
71,
|
|
89
|
-
69,
|
|
90
|
-
67,
|
|
91
|
-
65,
|
|
92
|
-
64,
|
|
93
|
-
63,
|
|
94
|
-
61,
|
|
95
|
-
60,
|
|
96
|
-
59,
|
|
97
|
-
58,
|
|
98
|
-
57,
|
|
99
|
-
57,
|
|
100
|
-
56,
|
|
101
|
-
55,
|
|
102
|
-
54,
|
|
103
|
-
54,
|
|
104
|
-
53,
|
|
105
|
-
53,
|
|
106
|
-
52,
|
|
107
|
-
52,
|
|
108
|
-
51,
|
|
109
|
-
51,
|
|
110
|
-
50,
|
|
111
|
-
50,
|
|
112
|
-
50,
|
|
113
|
-
49,
|
|
114
|
-
49,
|
|
115
|
-
48,
|
|
116
|
-
48,
|
|
117
|
-
48,
|
|
118
|
-
48,
|
|
119
|
-
47,
|
|
120
|
-
47,
|
|
121
|
-
47,
|
|
122
|
-
46,
|
|
123
|
-
46,
|
|
124
|
-
46,
|
|
125
|
-
46,
|
|
126
|
-
45,
|
|
127
|
-
45,
|
|
128
|
-
45,
|
|
129
|
-
45,
|
|
130
|
-
45,
|
|
131
|
-
44,
|
|
132
|
-
44,
|
|
133
|
-
44,
|
|
134
|
-
44,
|
|
135
|
-
44,
|
|
136
|
-
43,
|
|
137
|
-
43,
|
|
138
|
-
43,
|
|
139
|
-
43,
|
|
140
|
-
43,
|
|
141
|
-
43,
|
|
142
|
-
42,
|
|
143
|
-
42,
|
|
144
|
-
42,
|
|
145
|
-
42,
|
|
146
|
-
42,
|
|
147
|
-
42,
|
|
148
|
-
42,
|
|
149
|
-
41,
|
|
150
|
-
41,
|
|
151
|
-
41,
|
|
152
|
-
41,
|
|
153
|
-
41,
|
|
154
|
-
41,
|
|
155
|
-
41,
|
|
156
|
-
41,
|
|
157
|
-
41,
|
|
158
|
-
40,
|
|
159
|
-
40,
|
|
160
|
-
40,
|
|
161
|
-
40,
|
|
162
|
-
40,
|
|
163
|
-
40,
|
|
164
|
-
40,
|
|
165
|
-
40,
|
|
166
|
-
40,
|
|
167
|
-
39,
|
|
168
|
-
39,
|
|
169
|
-
39,
|
|
170
|
-
39,
|
|
171
|
-
39,
|
|
172
|
-
39,
|
|
173
|
-
39,
|
|
174
|
-
39,
|
|
175
|
-
39,
|
|
176
|
-
39,
|
|
177
|
-
39,
|
|
178
|
-
39,
|
|
179
|
-
38,
|
|
180
|
-
38,
|
|
181
|
-
38,
|
|
182
|
-
38,
|
|
183
|
-
38,
|
|
184
|
-
38,
|
|
185
|
-
38,
|
|
186
|
-
38,
|
|
187
|
-
38,
|
|
188
|
-
38,
|
|
189
|
-
38,
|
|
190
|
-
38,
|
|
191
|
-
38,
|
|
192
|
-
37,
|
|
193
|
-
37,
|
|
194
|
-
37,
|
|
195
|
-
37,
|
|
196
|
-
37,
|
|
197
|
-
37,
|
|
198
|
-
37,
|
|
199
|
-
37,
|
|
200
|
-
37,
|
|
201
|
-
37,
|
|
202
|
-
37,
|
|
203
|
-
37,
|
|
204
|
-
37,
|
|
205
|
-
37,
|
|
206
|
-
37,
|
|
207
|
-
37,
|
|
208
|
-
36,
|
|
209
|
-
36,
|
|
210
|
-
36,
|
|
211
|
-
36,
|
|
212
|
-
36,
|
|
213
|
-
36,
|
|
214
|
-
36,
|
|
215
|
-
36,
|
|
216
|
-
36,
|
|
217
|
-
36,
|
|
218
|
-
36,
|
|
219
|
-
36,
|
|
220
|
-
36,
|
|
221
|
-
36,
|
|
222
|
-
36,
|
|
223
|
-
36,
|
|
224
|
-
36,
|
|
225
|
-
36,
|
|
226
|
-
36,
|
|
227
|
-
36,
|
|
228
|
-
35,
|
|
229
|
-
35,
|
|
230
|
-
35,
|
|
231
|
-
35,
|
|
232
|
-
35,
|
|
233
|
-
35,
|
|
234
|
-
35,
|
|
235
|
-
35,
|
|
236
|
-
35,
|
|
237
|
-
35,
|
|
238
|
-
35,
|
|
239
|
-
35,
|
|
240
|
-
35,
|
|
241
|
-
35,
|
|
242
|
-
35,
|
|
243
|
-
35,
|
|
244
|
-
35,
|
|
245
|
-
35,
|
|
246
|
-
35,
|
|
247
|
-
35,
|
|
248
|
-
35,
|
|
249
|
-
35,
|
|
250
|
-
35,
|
|
251
|
-
35,
|
|
252
|
-
34,
|
|
253
|
-
34,
|
|
254
|
-
34,
|
|
255
|
-
34,
|
|
256
|
-
34,
|
|
257
|
-
34,
|
|
258
|
-
34,
|
|
259
|
-
34,
|
|
260
|
-
34,
|
|
261
|
-
34,
|
|
262
|
-
34,
|
|
263
|
-
34,
|
|
264
|
-
34,
|
|
265
|
-
34,
|
|
266
|
-
34,
|
|
267
|
-
34,
|
|
268
|
-
34,
|
|
269
|
-
34,
|
|
270
|
-
34,
|
|
271
|
-
34,
|
|
272
|
-
34,
|
|
273
|
-
34,
|
|
274
|
-
34,
|
|
275
|
-
34,
|
|
276
|
-
34,
|
|
277
|
-
34,
|
|
278
|
-
34,
|
|
279
|
-
34,
|
|
280
|
-
34,
|
|
281
|
-
34,
|
|
282
|
-
33,
|
|
283
|
-
33,
|
|
284
|
-
33,
|
|
285
|
-
33,
|
|
286
|
-
33,
|
|
287
|
-
33,
|
|
288
|
-
33,
|
|
289
|
-
33,
|
|
290
|
-
33,
|
|
291
|
-
33,
|
|
292
|
-
33,
|
|
293
|
-
33,
|
|
294
|
-
33,
|
|
295
|
-
33,
|
|
296
|
-
33,
|
|
297
|
-
33,
|
|
298
|
-
33,
|
|
299
|
-
33,
|
|
300
|
-
33,
|
|
301
|
-
33,
|
|
302
|
-
33,
|
|
303
|
-
33,
|
|
304
|
-
33,
|
|
305
|
-
33,
|
|
306
|
-
33,
|
|
307
|
-
33,
|
|
308
|
-
33,
|
|
309
|
-
33,
|
|
310
|
-
33,
|
|
311
|
-
33,
|
|
312
|
-
33,
|
|
313
|
-
33,
|
|
314
|
-
33,
|
|
315
|
-
33,
|
|
316
|
-
33,
|
|
317
|
-
33,
|
|
318
|
-
33,
|
|
319
|
-
33,
|
|
320
|
-
32,
|
|
321
|
-
32,
|
|
322
|
-
32,
|
|
323
|
-
32,
|
|
324
|
-
32,
|
|
325
|
-
32,
|
|
326
|
-
32,
|
|
327
|
-
32,
|
|
328
|
-
32,
|
|
329
|
-
32,
|
|
330
|
-
32,
|
|
331
|
-
32,
|
|
332
|
-
32
|
|
333
|
-
];
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { AvmContext } from '../avm_context.js';
|
|
2
|
-
import { Opcode, OperandType } from '../serialization/instruction_serialization.js';
|
|
3
|
-
import { Instruction } from './instruction.js';
|
|
4
|
-
export declare class EcAdd extends Instruction {
|
|
5
|
-
private indirect;
|
|
6
|
-
private p1XOffset;
|
|
7
|
-
private p1YOffset;
|
|
8
|
-
private p1IsInfiniteOffset;
|
|
9
|
-
private p2XOffset;
|
|
10
|
-
private p2YOffset;
|
|
11
|
-
private p2IsInfiniteOffset;
|
|
12
|
-
private dstOffset;
|
|
13
|
-
static type: string;
|
|
14
|
-
static readonly opcode = Opcode.ECADD;
|
|
15
|
-
static readonly wireFormat: OperandType[];
|
|
16
|
-
constructor(indirect: number, p1XOffset: number, p1YOffset: number, p1IsInfiniteOffset: number, p2XOffset: number, p2YOffset: number, p2IsInfiniteOffset: number, dstOffset: number);
|
|
17
|
-
execute(context: AvmContext): Promise<void>;
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=ec_add.d.ts.map
|