@aztec/simulator 6.0.0-nightly.20260605 → 6.0.0-nightly.20260721
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/client.d.ts +1 -3
- package/dest/client.d.ts.map +1 -1
- package/dest/client.js +0 -2
- package/dest/private/circuit_recording/circuit_recorder.d.ts +36 -23
- package/dest/private/circuit_recording/circuit_recorder.d.ts.map +1 -1
- package/dest/private/circuit_recording/circuit_recorder.js +65 -69
- package/dest/private/circuit_recording/file_circuit_recorder.d.ts +7 -19
- package/dest/private/circuit_recording/file_circuit_recorder.d.ts.map +1 -1
- package/dest/private/circuit_recording/file_circuit_recorder.js +38 -42
- 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_recording/simulator_recorder_wrapper.js +11 -14
- 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/{fixtures → testing}/base_avm_simulation_tester.d.ts +1 -1
- 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 +1 -1
- package/dest/public/avm/testing/utils.d.ts +32 -0
- package/dest/public/avm/testing/utils.d.ts.map +1 -0
- package/dest/public/avm/{fixtures → testing}/utils.js +1 -34
- package/dest/public/avm_simulator.d.ts +28 -0
- package/dest/public/avm_simulator.d.ts.map +1 -0
- package/dest/public/avm_simulator.js +4 -0
- package/dest/public/avm_simulator_pool.d.ts +45 -0
- package/dest/public/avm_simulator_pool.d.ts.map +1 -0
- package/dest/public/avm_simulator_pool.js +197 -0
- package/dest/public/cdb/generated/api_types.d.ts +171 -0
- package/dest/public/cdb/generated/api_types.d.ts.map +1 -0
- package/dest/public/cdb/generated/api_types.js +314 -0
- package/dest/public/cdb/generated/server.d.ts +26 -0
- package/dest/public/cdb/generated/server.d.ts.map +1 -0
- package/dest/public/cdb/generated/server.js +135 -0
- package/dest/public/cdb_ipc_server.d.ts +33 -0
- package/dest/public/cdb_ipc_server.d.ts.map +1 -0
- package/dest/public/cdb_ipc_server.js +153 -0
- package/dest/public/fixtures/amm_test.js +2 -2
- package/dest/public/fixtures/bulk_test.js +2 -2
- package/dest/public/fixtures/custom_bytecode_tester.d.ts +1 -1
- package/dest/public/fixtures/custom_bytecode_tester.d.ts.map +1 -1
- package/dest/public/fixtures/custom_bytecode_tester.js +2 -2
- package/dest/public/fixtures/index.d.ts +2 -4
- package/dest/public/fixtures/index.d.ts.map +1 -1
- package/dest/public/fixtures/index.js +1 -3
- package/dest/public/fixtures/public_processor_test_env.d.ts +30 -0
- package/dest/public/fixtures/public_processor_test_env.d.ts.map +1 -0
- package/dest/public/fixtures/public_processor_test_env.js +73 -0
- package/dest/public/fixtures/public_tx_simulation_tester.d.ts +11 -7
- package/dest/public/fixtures/public_tx_simulation_tester.d.ts.map +1 -1
- package/dest/public/fixtures/public_tx_simulation_tester.js +33 -43
- package/dest/public/fixtures/simple_contract_data_source.js +1 -1
- package/dest/public/fixtures/token_test.js +3 -3
- package/dest/public/fixtures/utils.d.ts +1 -1
- package/dest/public/fixtures/utils.d.ts.map +1 -1
- package/dest/public/fixtures/utils.js +5 -3
- package/dest/public/fuzzing/avm_fuzzer_simulator.d.ts +11 -4
- package/dest/public/fuzzing/avm_fuzzer_simulator.d.ts.map +1 -1
- package/dest/public/fuzzing/avm_fuzzer_simulator.js +24 -10
- package/dest/public/fuzzing/avm_simulator_bin.js +4 -4
- package/dest/public/index.d.ts +5 -2
- package/dest/public/index.d.ts.map +1 -1
- package/dest/public/index.js +2 -1
- package/dest/public/public_db_sources.d.ts +2 -2
- package/dest/public/public_db_sources.d.ts.map +1 -1
- package/dest/public/public_db_sources.js +1 -1
- package/dest/public/public_processor/guarded_merkle_tree.d.ts +4 -3
- package/dest/public/public_processor/guarded_merkle_tree.d.ts.map +1 -1
- package/dest/public/public_processor/guarded_merkle_tree.js +3 -0
- package/dest/public/public_processor/public_processor.d.ts +8 -4
- package/dest/public/public_processor/public_processor.d.ts.map +1 -1
- package/dest/public/public_processor/public_processor.js +18 -14
- package/dest/public/public_tx_simulator/dumping_public_tx_simulator.d.ts +17 -0
- package/dest/public/public_tx_simulator/dumping_public_tx_simulator.d.ts.map +1 -0
- package/dest/public/public_tx_simulator/{dumping_cpp_public_tx_simulator.js → dumping_public_tx_simulator.js} +10 -23
- package/dest/public/public_tx_simulator/factories.d.ts +8 -8
- package/dest/public/public_tx_simulator/factories.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/factories.js +8 -8
- package/dest/public/public_tx_simulator/index.d.ts +4 -6
- package/dest/public/public_tx_simulator/index.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/index.js +2 -4
- package/dest/public/public_tx_simulator/public_tx_simulator.d.ts +42 -75
- package/dest/public/public_tx_simulator/public_tx_simulator.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/public_tx_simulator.js +98 -323
- package/dest/public/public_tx_simulator/public_tx_simulator_base.d.ts +24 -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 +31 -0
- package/dest/public/public_tx_simulator/public_tx_simulator_interface.d.ts +5 -5
- package/dest/public/test_executor_metrics.d.ts +1 -6
- package/dest/public/test_executor_metrics.d.ts.map +1 -1
- package/dest/public/test_executor_metrics.js +0 -22
- package/package.json +22 -19
- package/src/client.ts +0 -2
- package/src/private/circuit_recording/circuit_recorder.ts +84 -78
- package/src/private/circuit_recording/file_circuit_recorder.ts +38 -48
- package/src/private/circuit_recording/simulator_recorder_wrapper.ts +9 -15
- package/src/public/avm/{fixtures → testing}/base_avm_simulation_tester.ts +1 -1
- package/src/public/avm/{fixtures → testing}/utils.ts +1 -40
- package/src/public/avm_simulator.ts +29 -0
- package/src/public/avm_simulator_pool.ts +226 -0
- package/src/public/cdb/generated/api_types.ts +457 -0
- package/src/public/cdb/generated/server.ts +109 -0
- package/src/public/cdb_ipc_server.ts +197 -0
- package/src/public/fixtures/amm_test.ts +2 -2
- package/src/public/fixtures/bulk_test.ts +2 -2
- package/src/public/fixtures/custom_bytecode_tester.ts +2 -2
- package/src/public/fixtures/index.ts +1 -3
- package/src/public/fixtures/public_processor_test_env.ts +88 -0
- package/src/public/fixtures/public_tx_simulation_tester.ts +41 -55
- package/src/public/fixtures/simple_contract_data_source.ts +1 -1
- package/src/public/fixtures/token_test.ts +3 -3
- package/src/public/fixtures/utils.ts +6 -11
- package/src/public/fuzzing/avm_fuzzer_simulator.ts +25 -10
- package/src/public/fuzzing/avm_simulator_bin.ts +3 -5
- package/src/public/index.ts +7 -3
- package/src/public/public_db_sources.ts +1 -1
- package/src/public/public_processor/guarded_merkle_tree.ts +5 -2
- package/src/public/public_processor/public_processor.ts +24 -17
- package/src/public/public_tx_simulator/{dumping_cpp_public_tx_simulator.ts → dumping_public_tx_simulator.ts} +15 -31
- package/src/public/public_tx_simulator/factories.ts +27 -10
- package/src/public/public_tx_simulator/index.ts +6 -5
- package/src/public/public_tx_simulator/public_tx_simulator.ts +139 -480
- package/src/public/public_tx_simulator/public_tx_simulator_base.ts +37 -0
- package/src/public/public_tx_simulator/public_tx_simulator_interface.ts +5 -5
- package/src/public/test_executor_metrics.ts +0 -24
- 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 -24
- package/dest/public/avm/avm_execution_environment.d.ts.map +0 -1
- package/dest/public/avm/avm_execution_environment.js +0 -33
- 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 -98
- package/dest/public/avm/avm_machine_state.d.ts.map +0 -1
- package/dest/public/avm/avm_machine_state.js +0 -110
- 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 -354
- package/dest/public/avm/avm_simulator.d.ts +0 -41
- package/dest/public/avm/avm_simulator.d.ts.map +0 -1
- package/dest/public/avm/avm_simulator.js +0 -192
- 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/calldata.d.ts +0 -51
- package/dest/public/avm/calldata.d.ts.map +0 -1
- package/dest/public/avm/calldata.js +0 -64
- package/dest/public/avm/errors.d.ts +0 -104
- package/dest/public/avm/errors.d.ts.map +0 -1
- package/dest/public/avm/errors.js +0 -141
- package/dest/public/avm/fixtures/account_proof_fetcher.d.ts +0 -2
- package/dest/public/avm/fixtures/account_proof_fetcher.d.ts.map +0 -1
- 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 -84
- package/dest/public/avm/fixtures/base_avm_simulation_tester.d.ts.map +0 -1
- package/dest/public/avm/fixtures/initializers.d.ts +0 -42
- package/dest/public/avm/fixtures/initializers.d.ts.map +0 -1
- package/dest/public/avm/fixtures/initializers.js +0 -45
- package/dest/public/avm/fixtures/utils.d.ts +0 -39
- 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 -74
- package/dest/public/avm/opcodes/accrued_substate.d.ts.map +0 -1
- package/dest/public/avm/opcodes/accrued_substate.js +0 -254
- 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 -49
- package/dest/public/avm/opcodes/arithmetic.d.ts.map +0 -1
- package/dest/public/avm/opcodes/arithmetic.js +0 -97
- 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 -21
- package/dest/public/avm/opcodes/contract.d.ts.map +0 -1
- package/dest/public/avm/opcodes/contract.js +0 -69
- 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 -17
- package/dest/public/avm/opcodes/ec_add.d.ts.map +0 -1
- package/dest/public/avm/opcodes/ec_add.js +0 -79
- 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 -210
- 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 -119
- 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 -25
- package/dest/public/avm/opcodes/storage.d.ts.map +0 -1
- package/dest/public/avm/opcodes/storage.js +0 -78
- 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 -39
- 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 -336
- 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 -18
- package/dest/public/debug_fn_name.d.ts.map +0 -1
- package/dest/public/debug_fn_name.js +0 -37
- package/dest/public/fixtures/custom_bytecode_tests.d.ts +0 -14
- package/dest/public/fixtures/custom_bytecode_tests.d.ts.map +0 -1
- package/dest/public/fixtures/custom_bytecode_tests.js +0 -234
- package/dest/public/fixtures/minimal_public_tx.d.ts +0 -4
- package/dest/public/fixtures/minimal_public_tx.d.ts.map +0 -1
- package/dest/public/fixtures/minimal_public_tx.js +0 -19
- package/dest/public/fixtures/opcode_spammer.d.ts +0 -122
- package/dest/public/fixtures/opcode_spammer.d.ts.map +0 -1
- package/dest/public/fixtures/opcode_spammer.js +0 -1645
- package/dest/public/hinting_db_sources.d.ts +0 -80
- package/dest/public/hinting_db_sources.d.ts.map +0 -1
- package/dest/public/hinting_db_sources.js +0 -356
- package/dest/public/public_tx_simulator/contract_provider_for_cpp.d.ts +0 -19
- package/dest/public/public_tx_simulator/contract_provider_for_cpp.d.ts.map +0 -1
- package/dest/public/public_tx_simulator/contract_provider_for_cpp.js +0 -99
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator.d.ts +0 -53
- 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 -131
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.d.ts +0 -42
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.d.ts.map +0 -1
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.js +0 -86
- package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.d.ts +0 -30
- package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.d.ts.map +0 -1
- package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.js +0 -171
- package/dest/public/public_tx_simulator/dumping_cpp_public_tx_simulator.d.ts +0 -23
- package/dest/public/public_tx_simulator/dumping_cpp_public_tx_simulator.d.ts.map +0 -1
- package/dest/public/public_tx_simulator/measured_public_tx_simulator.d.ts +0 -31
- 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 -135
- 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 -298
- 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 -415
- 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 -22
- 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 -170
- package/dest/public/state_manager/state_manager.d.ts.map +0 -1
- package/dest/public/state_manager/state_manager.js +0 -402
- package/src/public/avm/avm_context.ts +0 -61
- package/src/public/avm/avm_contract_call_result.ts +0 -69
- package/src/public/avm/avm_execution_environment.ts +0 -51
- package/src/public/avm/avm_gas.ts +0 -183
- package/src/public/avm/avm_machine_state.ts +0 -170
- package/src/public/avm/avm_memory_types.ts +0 -440
- package/src/public/avm/avm_simulator.ts +0 -279
- package/src/public/avm/avm_simulator_interface.ts +0 -8
- package/src/public/avm/calldata.ts +0 -101
- package/src/public/avm/errors.ts +0 -177
- package/src/public/avm/fixtures/avm_simulation_tester.ts +0 -122
- package/src/public/avm/fixtures/initializers.ts +0 -103
- package/src/public/avm/index.ts +0 -1
- package/src/public/avm/opcodes/accrued_substate.ts +0 -285
- package/src/public/avm/opcodes/addressing_mode.ts +0 -111
- package/src/public/avm/opcodes/arithmetic.ts +0 -129
- 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 -76
- 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 -86
- package/src/public/avm/opcodes/environment_getters.ts +0 -87
- package/src/public/avm/opcodes/external_calls.ts +0 -262
- package/src/public/avm/opcodes/hashing.ts +0 -151
- 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 -95
- package/src/public/avm/revert_reason.ts +0 -58
- package/src/public/avm/serialization/buffer_cursor.ts +0 -118
- package/src/public/avm/serialization/bytecode_serialization.ts +0 -215
- 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 -52
- package/src/public/fixtures/custom_bytecode_tests.ts +0 -366
- package/src/public/fixtures/minimal_public_tx.ts +0 -26
- package/src/public/fixtures/opcode_spammer.ts +0 -1713
- package/src/public/hinting_db_sources.ts +0 -610
- package/src/public/public_tx_simulator/contract_provider_for_cpp.ts +0 -125
- package/src/public/public_tx_simulator/cpp_public_tx_simulator.ts +0 -210
- package/src/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.ts +0 -134
- package/src/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.ts +0 -239
- package/src/public/public_tx_simulator/measured_public_tx_simulator.ts +0 -105
- package/src/public/public_tx_simulator/public_tx_context.ts +0 -482
- package/src/public/public_tx_simulator/telemetry_public_tx_simulator.ts +0 -63
- package/src/public/side_effect_trace.ts +0 -293
- 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 -569
- /package/dest/public/avm/{fixtures → testing}/account_proof_fetcher.js +0 -0
- /package/src/public/avm/{fixtures → testing}/account_proof.json +0 -0
- /package/src/public/avm/{fixtures → testing}/account_proof_fetcher.ts +0 -0
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
// AUTOGENERATED FILE - DO NOT EDIT
|
|
2
|
+
/** Schema version hash for compatibility checking */ export const SCHEMA_HASH = 'ef6a34b441b65d90238d2b3616a763136f5f53f9239ecabe9163ebf9388c89bd';
|
|
3
|
+
// Runtime guards for wire types that JS cannot represent natively.
|
|
4
|
+
// TODO: migrate u64 fields to bigint end-to-end and drop these.
|
|
5
|
+
//
|
|
6
|
+
// Decode: msgpackr returns uint64/int64 wire values as bigint once they
|
|
7
|
+
// exceed 32 bits; values must fit in the JS safe integer range.
|
|
8
|
+
function assertU64(value, ctx) {
|
|
9
|
+
if (typeof value === "bigint") {
|
|
10
|
+
if (value < 0n || value > BigInt(Number.MAX_SAFE_INTEGER)) {
|
|
11
|
+
throw new Error(`${ctx}: u64 value ${value} is outside JS safe integer range`);
|
|
12
|
+
}
|
|
13
|
+
return Number(value);
|
|
14
|
+
}
|
|
15
|
+
if (!Number.isSafeInteger(value) || value < 0) {
|
|
16
|
+
throw new Error(`${ctx}: u64 value ${value} is outside JS safe integer range`);
|
|
17
|
+
}
|
|
18
|
+
return value;
|
|
19
|
+
}
|
|
20
|
+
// Encode: msgpackr encodes JS numbers above 2^32 as float64, which strict
|
|
21
|
+
// u64 decoders reject; route them through bigint so the wire type stays uint.
|
|
22
|
+
function toWireU64(value, ctx) {
|
|
23
|
+
const checked = assertU64(value, ctx);
|
|
24
|
+
return checked > 0xffffffff ? BigInt(checked) : checked;
|
|
25
|
+
}
|
|
26
|
+
function assertBin32(value, ctx) {
|
|
27
|
+
if (value.length !== 32) {
|
|
28
|
+
throw new Error(`${ctx}: expected 32 bytes, got ${value.length}`);
|
|
29
|
+
}
|
|
30
|
+
return value;
|
|
31
|
+
}
|
|
32
|
+
// Conversion functions (exported)
|
|
33
|
+
export function toCdbGetContractInstance(o) {
|
|
34
|
+
if (o.address === undefined) {
|
|
35
|
+
throw new Error("Expected address in CdbGetContractInstance deserialization");
|
|
36
|
+
}
|
|
37
|
+
if (o.forkId === undefined) {
|
|
38
|
+
throw new Error("Expected forkId in CdbGetContractInstance deserialization");
|
|
39
|
+
}
|
|
40
|
+
;
|
|
41
|
+
return {
|
|
42
|
+
address: assertBin32(o.address, "o.address"),
|
|
43
|
+
forkId: assertU64(o.forkId, "o.forkId")
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export function toCdbGetContractClass(o) {
|
|
47
|
+
if (o.classId === undefined) {
|
|
48
|
+
throw new Error("Expected classId in CdbGetContractClass deserialization");
|
|
49
|
+
}
|
|
50
|
+
if (o.forkId === undefined) {
|
|
51
|
+
throw new Error("Expected forkId in CdbGetContractClass deserialization");
|
|
52
|
+
}
|
|
53
|
+
;
|
|
54
|
+
return {
|
|
55
|
+
classId: assertBin32(o.classId, "o.classId"),
|
|
56
|
+
forkId: assertU64(o.forkId, "o.forkId")
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export function toCdbGetBytecodeCommitment(o) {
|
|
60
|
+
if (o.classId === undefined) {
|
|
61
|
+
throw new Error("Expected classId in CdbGetBytecodeCommitment deserialization");
|
|
62
|
+
}
|
|
63
|
+
if (o.forkId === undefined) {
|
|
64
|
+
throw new Error("Expected forkId in CdbGetBytecodeCommitment deserialization");
|
|
65
|
+
}
|
|
66
|
+
;
|
|
67
|
+
return {
|
|
68
|
+
classId: assertBin32(o.classId, "o.classId"),
|
|
69
|
+
forkId: assertU64(o.forkId, "o.forkId")
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
export function toCdbGetDebugFunctionName(o) {
|
|
73
|
+
if (o.address === undefined) {
|
|
74
|
+
throw new Error("Expected address in CdbGetDebugFunctionName deserialization");
|
|
75
|
+
}
|
|
76
|
+
if (o.selector === undefined) {
|
|
77
|
+
throw new Error("Expected selector in CdbGetDebugFunctionName deserialization");
|
|
78
|
+
}
|
|
79
|
+
if (o.forkId === undefined) {
|
|
80
|
+
throw new Error("Expected forkId in CdbGetDebugFunctionName deserialization");
|
|
81
|
+
}
|
|
82
|
+
;
|
|
83
|
+
return {
|
|
84
|
+
address: assertBin32(o.address, "o.address"),
|
|
85
|
+
selector: assertBin32(o.selector, "o.selector"),
|
|
86
|
+
forkId: assertU64(o.forkId, "o.forkId")
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
export function toCdbAddContracts(o) {
|
|
90
|
+
if (o.contractDeploymentData === undefined) {
|
|
91
|
+
throw new Error("Expected contractDeploymentData in CdbAddContracts deserialization");
|
|
92
|
+
}
|
|
93
|
+
if (o.forkId === undefined) {
|
|
94
|
+
throw new Error("Expected forkId in CdbAddContracts deserialization");
|
|
95
|
+
}
|
|
96
|
+
;
|
|
97
|
+
return {
|
|
98
|
+
contractDeploymentData: o.contractDeploymentData,
|
|
99
|
+
forkId: assertU64(o.forkId, "o.forkId")
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
export function toCdbCreateCheckpoint(o) {
|
|
103
|
+
if (o.forkId === undefined) {
|
|
104
|
+
throw new Error("Expected forkId in CdbCreateCheckpoint deserialization");
|
|
105
|
+
}
|
|
106
|
+
;
|
|
107
|
+
return {
|
|
108
|
+
forkId: assertU64(o.forkId, "o.forkId")
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
export function toCdbCommitCheckpoint(o) {
|
|
112
|
+
if (o.forkId === undefined) {
|
|
113
|
+
throw new Error("Expected forkId in CdbCommitCheckpoint deserialization");
|
|
114
|
+
}
|
|
115
|
+
;
|
|
116
|
+
return {
|
|
117
|
+
forkId: assertU64(o.forkId, "o.forkId")
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
export function toCdbRevertCheckpoint(o) {
|
|
121
|
+
if (o.forkId === undefined) {
|
|
122
|
+
throw new Error("Expected forkId in CdbRevertCheckpoint deserialization");
|
|
123
|
+
}
|
|
124
|
+
;
|
|
125
|
+
return {
|
|
126
|
+
forkId: assertU64(o.forkId, "o.forkId")
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
export function toCdbGetContractInstanceResponse(o) {
|
|
130
|
+
;
|
|
131
|
+
return {
|
|
132
|
+
instance: o.instance ?? null
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
export function toCdbGetContractClassResponse(o) {
|
|
136
|
+
;
|
|
137
|
+
return {
|
|
138
|
+
contractClass: o.contractClass ?? null
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
export function toCdbGetBytecodeCommitmentResponse(o) {
|
|
142
|
+
;
|
|
143
|
+
return {
|
|
144
|
+
commitment: o.commitment != null ? assertBin32(o.commitment, "o.commitment") : null
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
export function toCdbGetDebugFunctionNameResponse(o) {
|
|
148
|
+
;
|
|
149
|
+
return {
|
|
150
|
+
name: o.name ?? null
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
export function toCdbAddContractsResponse(o) {
|
|
154
|
+
return {};
|
|
155
|
+
}
|
|
156
|
+
export function toCdbCreateCheckpointResponse(o) {
|
|
157
|
+
return {};
|
|
158
|
+
}
|
|
159
|
+
export function toCdbCommitCheckpointResponse(o) {
|
|
160
|
+
return {};
|
|
161
|
+
}
|
|
162
|
+
export function toCdbRevertCheckpointResponse(o) {
|
|
163
|
+
return {};
|
|
164
|
+
}
|
|
165
|
+
export function toCdbErrorResponse(o) {
|
|
166
|
+
if (o.message === undefined) {
|
|
167
|
+
throw new Error("Expected message in CdbErrorResponse deserialization");
|
|
168
|
+
}
|
|
169
|
+
;
|
|
170
|
+
return {
|
|
171
|
+
message: o.message
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
export function fromCdbGetContractInstance(o) {
|
|
175
|
+
if (o.address === undefined) {
|
|
176
|
+
throw new Error("Expected address in CdbGetContractInstance serialization");
|
|
177
|
+
}
|
|
178
|
+
if (o.forkId === undefined) {
|
|
179
|
+
throw new Error("Expected forkId in CdbGetContractInstance serialization");
|
|
180
|
+
}
|
|
181
|
+
;
|
|
182
|
+
return {
|
|
183
|
+
address: assertBin32(o.address, "o.address"),
|
|
184
|
+
forkId: toWireU64(o.forkId, "o.forkId")
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
export function fromCdbGetContractClass(o) {
|
|
188
|
+
if (o.classId === undefined) {
|
|
189
|
+
throw new Error("Expected classId in CdbGetContractClass serialization");
|
|
190
|
+
}
|
|
191
|
+
if (o.forkId === undefined) {
|
|
192
|
+
throw new Error("Expected forkId in CdbGetContractClass serialization");
|
|
193
|
+
}
|
|
194
|
+
;
|
|
195
|
+
return {
|
|
196
|
+
classId: assertBin32(o.classId, "o.classId"),
|
|
197
|
+
forkId: toWireU64(o.forkId, "o.forkId")
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
export function fromCdbGetBytecodeCommitment(o) {
|
|
201
|
+
if (o.classId === undefined) {
|
|
202
|
+
throw new Error("Expected classId in CdbGetBytecodeCommitment serialization");
|
|
203
|
+
}
|
|
204
|
+
if (o.forkId === undefined) {
|
|
205
|
+
throw new Error("Expected forkId in CdbGetBytecodeCommitment serialization");
|
|
206
|
+
}
|
|
207
|
+
;
|
|
208
|
+
return {
|
|
209
|
+
classId: assertBin32(o.classId, "o.classId"),
|
|
210
|
+
forkId: toWireU64(o.forkId, "o.forkId")
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
export function fromCdbGetDebugFunctionName(o) {
|
|
214
|
+
if (o.address === undefined) {
|
|
215
|
+
throw new Error("Expected address in CdbGetDebugFunctionName serialization");
|
|
216
|
+
}
|
|
217
|
+
if (o.selector === undefined) {
|
|
218
|
+
throw new Error("Expected selector in CdbGetDebugFunctionName serialization");
|
|
219
|
+
}
|
|
220
|
+
if (o.forkId === undefined) {
|
|
221
|
+
throw new Error("Expected forkId in CdbGetDebugFunctionName serialization");
|
|
222
|
+
}
|
|
223
|
+
;
|
|
224
|
+
return {
|
|
225
|
+
address: assertBin32(o.address, "o.address"),
|
|
226
|
+
selector: assertBin32(o.selector, "o.selector"),
|
|
227
|
+
forkId: toWireU64(o.forkId, "o.forkId")
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
export function fromCdbAddContracts(o) {
|
|
231
|
+
if (o.contractDeploymentData === undefined) {
|
|
232
|
+
throw new Error("Expected contractDeploymentData in CdbAddContracts serialization");
|
|
233
|
+
}
|
|
234
|
+
if (o.forkId === undefined) {
|
|
235
|
+
throw new Error("Expected forkId in CdbAddContracts serialization");
|
|
236
|
+
}
|
|
237
|
+
;
|
|
238
|
+
return {
|
|
239
|
+
contractDeploymentData: o.contractDeploymentData,
|
|
240
|
+
forkId: toWireU64(o.forkId, "o.forkId")
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
export function fromCdbCreateCheckpoint(o) {
|
|
244
|
+
if (o.forkId === undefined) {
|
|
245
|
+
throw new Error("Expected forkId in CdbCreateCheckpoint serialization");
|
|
246
|
+
}
|
|
247
|
+
;
|
|
248
|
+
return {
|
|
249
|
+
forkId: toWireU64(o.forkId, "o.forkId")
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
export function fromCdbCommitCheckpoint(o) {
|
|
253
|
+
if (o.forkId === undefined) {
|
|
254
|
+
throw new Error("Expected forkId in CdbCommitCheckpoint serialization");
|
|
255
|
+
}
|
|
256
|
+
;
|
|
257
|
+
return {
|
|
258
|
+
forkId: toWireU64(o.forkId, "o.forkId")
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
export function fromCdbRevertCheckpoint(o) {
|
|
262
|
+
if (o.forkId === undefined) {
|
|
263
|
+
throw new Error("Expected forkId in CdbRevertCheckpoint serialization");
|
|
264
|
+
}
|
|
265
|
+
;
|
|
266
|
+
return {
|
|
267
|
+
forkId: toWireU64(o.forkId, "o.forkId")
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
export function fromCdbGetContractInstanceResponse(o) {
|
|
271
|
+
;
|
|
272
|
+
return {
|
|
273
|
+
instance: o.instance ?? null
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
export function fromCdbGetContractClassResponse(o) {
|
|
277
|
+
;
|
|
278
|
+
return {
|
|
279
|
+
contractClass: o.contractClass ?? null
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
export function fromCdbGetBytecodeCommitmentResponse(o) {
|
|
283
|
+
;
|
|
284
|
+
return {
|
|
285
|
+
commitment: o.commitment != null ? assertBin32(o.commitment, "o.commitment") : null
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
export function fromCdbGetDebugFunctionNameResponse(o) {
|
|
289
|
+
;
|
|
290
|
+
return {
|
|
291
|
+
name: o.name ?? null
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
export function fromCdbAddContractsResponse(o) {
|
|
295
|
+
return {};
|
|
296
|
+
}
|
|
297
|
+
export function fromCdbCreateCheckpointResponse(o) {
|
|
298
|
+
return {};
|
|
299
|
+
}
|
|
300
|
+
export function fromCdbCommitCheckpointResponse(o) {
|
|
301
|
+
return {};
|
|
302
|
+
}
|
|
303
|
+
export function fromCdbRevertCheckpointResponse(o) {
|
|
304
|
+
return {};
|
|
305
|
+
}
|
|
306
|
+
export function fromCdbErrorResponse(o) {
|
|
307
|
+
if (o.message === undefined) {
|
|
308
|
+
throw new Error("Expected message in CdbErrorResponse serialization");
|
|
309
|
+
}
|
|
310
|
+
;
|
|
311
|
+
return {
|
|
312
|
+
message: o.message
|
|
313
|
+
};
|
|
314
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { CdbAddContracts, CdbAddContractsResponse, CdbCommitCheckpoint, CdbCommitCheckpointResponse, CdbCreateCheckpoint, CdbCreateCheckpointResponse, CdbGetBytecodeCommitment, CdbGetBytecodeCommitmentResponse, CdbGetContractClass, CdbGetContractClassResponse, CdbGetContractInstance, CdbGetContractInstanceResponse, CdbGetDebugFunctionName, CdbGetDebugFunctionNameResponse, CdbRevertCheckpoint, CdbRevertCheckpointResponse } from './api_types.js';
|
|
2
|
+
/** Handler interface — implement this to serve commands. */
|
|
3
|
+
export interface Handler {
|
|
4
|
+
getContractInstance(command: CdbGetContractInstance): Promise<CdbGetContractInstanceResponse>;
|
|
5
|
+
getContractClass(command: CdbGetContractClass): Promise<CdbGetContractClassResponse>;
|
|
6
|
+
getBytecodeCommitment(command: CdbGetBytecodeCommitment): Promise<CdbGetBytecodeCommitmentResponse>;
|
|
7
|
+
getDebugFunctionName(command: CdbGetDebugFunctionName): Promise<CdbGetDebugFunctionNameResponse>;
|
|
8
|
+
addContracts(command: CdbAddContracts): Promise<CdbAddContractsResponse>;
|
|
9
|
+
createCheckpoint(command: CdbCreateCheckpoint): Promise<CdbCreateCheckpointResponse>;
|
|
10
|
+
commitCheckpoint(command: CdbCommitCheckpoint): Promise<CdbCommitCheckpointResponse>;
|
|
11
|
+
revertCheckpoint(command: CdbRevertCheckpoint): Promise<CdbRevertCheckpointResponse>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Dispatch a [commandName, payload] pair to the handler.
|
|
15
|
+
* Returns [responseName, responsePayload] for serialization.
|
|
16
|
+
* Handler failures are wrapped into the schema error variant.
|
|
17
|
+
*/
|
|
18
|
+
export declare function dispatch(handler: Handler, commandName: string, payload: any): Promise<[string, any]>;
|
|
19
|
+
/**
|
|
20
|
+
* Decode a framed request, dispatch it, and encode the framed response.
|
|
21
|
+
* All failures (malformed framing included) produce a decodable error
|
|
22
|
+
* variant rather than a throw, so transports can use this directly as
|
|
23
|
+
* their request handler.
|
|
24
|
+
*/
|
|
25
|
+
export declare function handleRequest(handler: Handler, requestBytes: Uint8Array): Promise<Uint8Array>;
|
|
26
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VydmVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvcHVibGljL2NkYi9nZW5lcmF0ZWQvc2VydmVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUlBLE9BQU8sS0FBSyxFQUFFLGVBQWUsRUFBRSx1QkFBdUIsRUFBRSxtQkFBbUIsRUFBRSwyQkFBMkIsRUFBRSxtQkFBbUIsRUFBRSwyQkFBMkIsRUFBRSx3QkFBd0IsRUFBRSxnQ0FBZ0MsRUFBRSxtQkFBbUIsRUFBRSwyQkFBMkIsRUFBRSxzQkFBc0IsRUFBRSw4QkFBOEIsRUFBRSx1QkFBdUIsRUFBRSwrQkFBK0IsRUFBRSxtQkFBbUIsRUFBRSwyQkFBMkIsRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBR3JjLDhEQUE0RDtBQUM1RCxNQUFNLFdBQVcsT0FBTztJQUN0QixtQkFBbUIsQ0FBQyxPQUFPLEVBQUUsc0JBQXNCLEdBQUcsT0FBTyxDQUFDLDhCQUE4QixDQUFDLENBQUM7SUFDOUYsZ0JBQWdCLENBQUMsT0FBTyxFQUFFLG1CQUFtQixHQUFHLE9BQU8sQ0FBQywyQkFBMkIsQ0FBQyxDQUFDO0lBQ3JGLHFCQUFxQixDQUFDLE9BQU8sRUFBRSx3QkFBd0IsR0FBRyxPQUFPLENBQUMsZ0NBQWdDLENBQUMsQ0FBQztJQUNwR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E,uBAAuB,EAAE,+BAA+B,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAGrc,8DAA4D;AAC5D,MAAM,WAAW,OAAO;IACtB,mBAAmB,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAC;IAC9F,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;IACrF,qBAAqB,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,gCAAgC,CAAC,CAAC;IACpG,oBAAoB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,+BAA+B,CAAC,CAAC;IACjG,YAAY,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;IACzE,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;IACrF,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;IACrF,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;CACtF;AAED;;;;GAIG;AACH,wBAAsB,QAAQ,CAC5B,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,GAAG,GACX,OAAO,CAAC,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAiDxB;AAKD;;;;;GAKG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,UAAU,GACvB,OAAO,CAAC,UAAU,CAAC,CAiBrB"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
// AUTOGENERATED FILE - DO NOT EDIT
|
|
2
|
+
// Server-side dispatch for IPC protocol
|
|
3
|
+
import { Decoder, Encoder } from 'msgpackr';
|
|
4
|
+
import { fromCdbAddContractsResponse, fromCdbCommitCheckpointResponse, fromCdbCreateCheckpointResponse, fromCdbGetBytecodeCommitmentResponse, fromCdbGetContractClassResponse, fromCdbGetContractInstanceResponse, fromCdbGetDebugFunctionNameResponse, fromCdbRevertCheckpointResponse, toCdbAddContracts, toCdbCommitCheckpoint, toCdbCreateCheckpoint, toCdbGetBytecodeCommitment, toCdbGetContractClass, toCdbGetContractInstance, toCdbGetDebugFunctionName, toCdbRevertCheckpoint } from './api_types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Dispatch a [commandName, payload] pair to the handler.
|
|
7
|
+
* Returns [responseName, responsePayload] for serialization.
|
|
8
|
+
* Handler failures are wrapped into the schema error variant.
|
|
9
|
+
*/ export async function dispatch(handler, commandName, payload) {
|
|
10
|
+
try {
|
|
11
|
+
switch(commandName){
|
|
12
|
+
case 'CdbGetContractInstance':
|
|
13
|
+
{
|
|
14
|
+
const cmd = toCdbGetContractInstance(payload);
|
|
15
|
+
const result = await handler.getContractInstance(cmd);
|
|
16
|
+
return [
|
|
17
|
+
'CdbGetContractInstanceResponse',
|
|
18
|
+
fromCdbGetContractInstanceResponse(result)
|
|
19
|
+
];
|
|
20
|
+
}
|
|
21
|
+
case 'CdbGetContractClass':
|
|
22
|
+
{
|
|
23
|
+
const cmd = toCdbGetContractClass(payload);
|
|
24
|
+
const result = await handler.getContractClass(cmd);
|
|
25
|
+
return [
|
|
26
|
+
'CdbGetContractClassResponse',
|
|
27
|
+
fromCdbGetContractClassResponse(result)
|
|
28
|
+
];
|
|
29
|
+
}
|
|
30
|
+
case 'CdbGetBytecodeCommitment':
|
|
31
|
+
{
|
|
32
|
+
const cmd = toCdbGetBytecodeCommitment(payload);
|
|
33
|
+
const result = await handler.getBytecodeCommitment(cmd);
|
|
34
|
+
return [
|
|
35
|
+
'CdbGetBytecodeCommitmentResponse',
|
|
36
|
+
fromCdbGetBytecodeCommitmentResponse(result)
|
|
37
|
+
];
|
|
38
|
+
}
|
|
39
|
+
case 'CdbGetDebugFunctionName':
|
|
40
|
+
{
|
|
41
|
+
const cmd = toCdbGetDebugFunctionName(payload);
|
|
42
|
+
const result = await handler.getDebugFunctionName(cmd);
|
|
43
|
+
return [
|
|
44
|
+
'CdbGetDebugFunctionNameResponse',
|
|
45
|
+
fromCdbGetDebugFunctionNameResponse(result)
|
|
46
|
+
];
|
|
47
|
+
}
|
|
48
|
+
case 'CdbAddContracts':
|
|
49
|
+
{
|
|
50
|
+
const cmd = toCdbAddContracts(payload);
|
|
51
|
+
const result = await handler.addContracts(cmd);
|
|
52
|
+
return [
|
|
53
|
+
'CdbAddContractsResponse',
|
|
54
|
+
fromCdbAddContractsResponse(result)
|
|
55
|
+
];
|
|
56
|
+
}
|
|
57
|
+
case 'CdbCreateCheckpoint':
|
|
58
|
+
{
|
|
59
|
+
const cmd = toCdbCreateCheckpoint(payload);
|
|
60
|
+
const result = await handler.createCheckpoint(cmd);
|
|
61
|
+
return [
|
|
62
|
+
'CdbCreateCheckpointResponse',
|
|
63
|
+
fromCdbCreateCheckpointResponse(result)
|
|
64
|
+
];
|
|
65
|
+
}
|
|
66
|
+
case 'CdbCommitCheckpoint':
|
|
67
|
+
{
|
|
68
|
+
const cmd = toCdbCommitCheckpoint(payload);
|
|
69
|
+
const result = await handler.commitCheckpoint(cmd);
|
|
70
|
+
return [
|
|
71
|
+
'CdbCommitCheckpointResponse',
|
|
72
|
+
fromCdbCommitCheckpointResponse(result)
|
|
73
|
+
];
|
|
74
|
+
}
|
|
75
|
+
case 'CdbRevertCheckpoint':
|
|
76
|
+
{
|
|
77
|
+
const cmd = toCdbRevertCheckpoint(payload);
|
|
78
|
+
const result = await handler.revertCheckpoint(cmd);
|
|
79
|
+
return [
|
|
80
|
+
'CdbRevertCheckpointResponse',
|
|
81
|
+
fromCdbRevertCheckpointResponse(result)
|
|
82
|
+
];
|
|
83
|
+
}
|
|
84
|
+
default:
|
|
85
|
+
return [
|
|
86
|
+
'CdbErrorResponse',
|
|
87
|
+
{
|
|
88
|
+
message: `Unknown command: ${commandName}`
|
|
89
|
+
}
|
|
90
|
+
];
|
|
91
|
+
}
|
|
92
|
+
} catch (err) {
|
|
93
|
+
return [
|
|
94
|
+
'CdbErrorResponse',
|
|
95
|
+
{
|
|
96
|
+
message: err?.message ?? String(err)
|
|
97
|
+
}
|
|
98
|
+
];
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
const requestDecoder = new Decoder({
|
|
102
|
+
useRecords: false
|
|
103
|
+
});
|
|
104
|
+
const responseEncoder = new Encoder({
|
|
105
|
+
useRecords: false,
|
|
106
|
+
variableMapSize: true
|
|
107
|
+
});
|
|
108
|
+
/**
|
|
109
|
+
* Decode a framed request, dispatch it, and encode the framed response.
|
|
110
|
+
* All failures (malformed framing included) produce a decodable error
|
|
111
|
+
* variant rather than a throw, so transports can use this directly as
|
|
112
|
+
* their request handler.
|
|
113
|
+
*/ export async function handleRequest(handler, requestBytes) {
|
|
114
|
+
let commandName;
|
|
115
|
+
let payload;
|
|
116
|
+
try {
|
|
117
|
+
const request = requestDecoder.unpack(requestBytes);
|
|
118
|
+
[[commandName, payload]] = request;
|
|
119
|
+
if (typeof commandName !== 'string') {
|
|
120
|
+
throw new Error('expected [name, payload] request framing');
|
|
121
|
+
}
|
|
122
|
+
} catch (err) {
|
|
123
|
+
return responseEncoder.pack([
|
|
124
|
+
'CdbErrorResponse',
|
|
125
|
+
{
|
|
126
|
+
message: `Malformed request: ${err?.message ?? String(err)}`
|
|
127
|
+
}
|
|
128
|
+
]);
|
|
129
|
+
}
|
|
130
|
+
const [respName, respPayload] = await dispatch(handler, commandName, payload ?? {});
|
|
131
|
+
return responseEncoder.pack([
|
|
132
|
+
respName,
|
|
133
|
+
respPayload
|
|
134
|
+
]);
|
|
135
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
2
|
+
import type { CdbAddContracts, CdbAddContractsResponse, CdbCommitCheckpoint, CdbCommitCheckpointResponse, CdbCreateCheckpoint, CdbCreateCheckpointResponse, CdbGetBytecodeCommitment, CdbGetBytecodeCommitmentResponse, CdbGetContractClass, CdbGetContractClassResponse, CdbGetContractInstance, CdbGetContractInstanceResponse, CdbGetDebugFunctionName, CdbGetDebugFunctionNameResponse, CdbRevertCheckpoint, CdbRevertCheckpointResponse } from './cdb/generated/api_types.js';
|
|
3
|
+
import { type Handler as CdbHandler } from './cdb/generated/server.js';
|
|
4
|
+
import type { PublicContractsDB } from './public_db_sources.js';
|
|
5
|
+
/** Serializes contract instances to the AVM CDB wire shape. */
|
|
6
|
+
export declare function serializeContractInstance(instance: ContractInstanceWithAddress): Record<string, unknown>;
|
|
7
|
+
/** Routes AVM CDB IPC requests to registered PublicContractsDB forks. */
|
|
8
|
+
export declare class CdbIpcServer implements CdbHandler {
|
|
9
|
+
readonly ipcPath: string;
|
|
10
|
+
private server;
|
|
11
|
+
private log;
|
|
12
|
+
/** Maps WSDB fork IDs to contracts DB/timestamp pairs for concurrent simulations. */
|
|
13
|
+
private forks;
|
|
14
|
+
constructor();
|
|
15
|
+
/** Register a PublicContractsDB for a given WSDB fork ID. */
|
|
16
|
+
registerFork(forkId: number, contractsDB: PublicContractsDB, timestamp: bigint): void;
|
|
17
|
+
/** Unregister a fork's contracts DB (call after simulation completes). */
|
|
18
|
+
unregisterFork(forkId: number): void;
|
|
19
|
+
/** Close the server and all active connections. */
|
|
20
|
+
close(): Promise<void>;
|
|
21
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
22
|
+
/** Look up the contracts DB for a given fork ID, throwing if not registered. */
|
|
23
|
+
private getFork;
|
|
24
|
+
getContractInstance(command: CdbGetContractInstance): Promise<CdbGetContractInstanceResponse>;
|
|
25
|
+
getContractClass(command: CdbGetContractClass): Promise<CdbGetContractClassResponse>;
|
|
26
|
+
getBytecodeCommitment(command: CdbGetBytecodeCommitment): Promise<CdbGetBytecodeCommitmentResponse>;
|
|
27
|
+
getDebugFunctionName(command: CdbGetDebugFunctionName): Promise<CdbGetDebugFunctionNameResponse>;
|
|
28
|
+
addContracts(command: CdbAddContracts): Promise<CdbAddContractsResponse>;
|
|
29
|
+
createCheckpoint(command: CdbCreateCheckpoint): Promise<CdbCreateCheckpointResponse>;
|
|
30
|
+
commitCheckpoint(command: CdbCommitCheckpoint): Promise<CdbCommitCheckpointResponse>;
|
|
31
|
+
revertCheckpoint(command: CdbRevertCheckpoint): Promise<CdbRevertCheckpointResponse>;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2RiX2lwY19zZXJ2ZXIuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wdWJsaWMvY2RiX2lwY19zZXJ2ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBYUEsT0FBTyxFQUEwQixLQUFLLDJCQUEyQixFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFPbEcsT0FBTyxLQUFLLEVBQ1YsZUFBZSxFQUNmLHVCQUF1QixFQUN2QixtQkFBbUIsRUFDbkIsMkJBQTJCLEVBQzNCLG1CQUFtQixFQUNuQiwyQkFBMkIsRUFDM0Isd0JBQXdCLEVBQ3hCLGdDQUFnQyxFQUNoQyxtQkFBbUIsRUFDbkIsMkJBQTJCLEVBQzNCLHNCQUFzQixFQUN0Qiw4QkFBOEIsRUFDOUIsdUJBQXVCLEVBQ3ZCLCtCQUErQixFQUMvQixtQkFBbUIsRUFDbkIsMkJBQTJCLEVBQzVCLE1BQU0sOEJBQThCLENBQUM7QUFDdEMsT0FBTyxFQUFFLEtBQUssT0FBTyxJQUFJLFVBQVUsRUFBaUIsTUFBTSwyQkFBMkIsQ0FBQztBQUN0RixPQUFPLEtBQUssRUFBRSxpQkFBaUIsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBV2hFLCtEQUErRDtBQUMvRCx3QkFBZ0IseUJBQXlCLENBQUMsUUFBUSxFQUFFL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|
|
4
|
+
* Transport (socket, framing, per-connection response ordering) is handled by the shared
|
|
5
|
+
* `UdsIpcServer` from `@aztec/ipc-runtime`; message dispatch comes from the generated CDB
|
|
6
|
+
* server. This class only implements the generated handler interface and routes requests to
|
|
7
|
+
* PublicContractsDB instances by fork ID.
|
|
8
|
+
*/ var _computedKey;
|
|
9
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
10
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
11
|
+
import { UdsIpcServer } from '@aztec/ipc-runtime';
|
|
12
|
+
import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
13
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
14
|
+
import { ContractDeploymentData } from '@aztec/stdlib/contract';
|
|
15
|
+
import { Decoder, Encoder } from 'msgpackr';
|
|
16
|
+
import * as os from 'node:os';
|
|
17
|
+
import * as path from 'node:path';
|
|
18
|
+
import { threadId } from 'node:worker_threads';
|
|
19
|
+
import { handleRequest } from './cdb/generated/server.js';
|
|
20
|
+
const encoder = new Encoder({
|
|
21
|
+
useRecords: false
|
|
22
|
+
});
|
|
23
|
+
const decoder = new Decoder({
|
|
24
|
+
useRecords: false
|
|
25
|
+
});
|
|
26
|
+
let instanceCounter = 0;
|
|
27
|
+
function toFieldBuffer(field) {
|
|
28
|
+
return field.toBuffer();
|
|
29
|
+
}
|
|
30
|
+
/** Serializes contract instances to the AVM CDB wire shape. */ export function serializeContractInstance(instance) {
|
|
31
|
+
return {
|
|
32
|
+
salt: toFieldBuffer(instance.salt),
|
|
33
|
+
deployer: toFieldBuffer(instance.deployer),
|
|
34
|
+
currentContractClassId: toFieldBuffer(instance.currentContractClassId),
|
|
35
|
+
originalContractClassId: toFieldBuffer(instance.originalContractClassId),
|
|
36
|
+
initializationHash: toFieldBuffer(instance.initializationHash),
|
|
37
|
+
immutablesHash: toFieldBuffer(instance.immutablesHash),
|
|
38
|
+
publicKeys: {
|
|
39
|
+
npkMHash: toFieldBuffer(instance.publicKeys.npkMHash),
|
|
40
|
+
ivpkM: {
|
|
41
|
+
x: toFieldBuffer(instance.publicKeys.ivpkM.x),
|
|
42
|
+
y: toFieldBuffer(instance.publicKeys.ivpkM.y)
|
|
43
|
+
},
|
|
44
|
+
ovpkMHash: toFieldBuffer(instance.publicKeys.ovpkMHash),
|
|
45
|
+
tpkMHash: toFieldBuffer(instance.publicKeys.tpkMHash),
|
|
46
|
+
mspkMHash: toFieldBuffer(instance.publicKeys.mspkMHash),
|
|
47
|
+
fbpkMHash: toFieldBuffer(instance.publicKeys.fbpkMHash)
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/** Serializes contract classes to the AVM CDB wire shape. */ function serializeContractClass(contractClass) {
|
|
52
|
+
return {
|
|
53
|
+
id: toFieldBuffer(contractClass.id),
|
|
54
|
+
artifactHash: toFieldBuffer(contractClass.artifactHash),
|
|
55
|
+
privateFunctionsRoot: toFieldBuffer(contractClass.privateFunctionsRoot),
|
|
56
|
+
packedBytecode: contractClass.packedBytecode
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
_computedKey = Symbol.asyncDispose;
|
|
60
|
+
/** Routes AVM CDB IPC requests to registered PublicContractsDB forks. */ export class CdbIpcServer {
|
|
61
|
+
ipcPath;
|
|
62
|
+
server;
|
|
63
|
+
log;
|
|
64
|
+
/** Maps WSDB fork IDs to contracts DB/timestamp pairs for concurrent simulations. */ forks = new Map();
|
|
65
|
+
constructor(){
|
|
66
|
+
this.log = createLogger('cdb-ipc-server');
|
|
67
|
+
this.ipcPath = path.join(os.tmpdir(), `cdb-ts-${process.pid}-${threadId}-${instanceCounter++}.sock`);
|
|
68
|
+
// Listen asynchronously; the C++ AVM retries connecting until the socket is up.
|
|
69
|
+
this.server = UdsIpcServer.listen(this.ipcPath, (_clientId, request)=>handleRequest(this, request));
|
|
70
|
+
this.server.then(()=>this.log.debug(`CDB IPC server listening on ${this.ipcPath}`), (err)=>this.log.error(`CDB IPC server failed to listen on ${this.ipcPath}`, {
|
|
71
|
+
err
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
74
|
+
/** Register a PublicContractsDB for a given WSDB fork ID. */ registerFork(forkId, contractsDB, timestamp) {
|
|
75
|
+
this.forks.set(forkId, {
|
|
76
|
+
db: contractsDB,
|
|
77
|
+
timestamp
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
/** Unregister a fork's contracts DB (call after simulation completes). */ unregisterFork(forkId) {
|
|
81
|
+
this.forks.delete(forkId);
|
|
82
|
+
}
|
|
83
|
+
/** Close the server and all active connections. */ async close() {
|
|
84
|
+
const server = await this.server.catch(()=>undefined);
|
|
85
|
+
await server?.close();
|
|
86
|
+
}
|
|
87
|
+
async [_computedKey]() {
|
|
88
|
+
await this.close();
|
|
89
|
+
}
|
|
90
|
+
/** Look up the contracts DB for a given fork ID, throwing if not registered. */ getFork(forkId) {
|
|
91
|
+
const fork = this.forks.get(forkId);
|
|
92
|
+
if (!fork) {
|
|
93
|
+
const registered = Array.from(this.forks.keys()).sort((a, b)=>a - b);
|
|
94
|
+
throw new Error(`CDB server: no contracts DB registered for forkId ${forkId} (registered=[${registered.join(',')}])`);
|
|
95
|
+
}
|
|
96
|
+
return fork;
|
|
97
|
+
}
|
|
98
|
+
async getContractInstance(command) {
|
|
99
|
+
const { db, timestamp } = this.getFork(command.forkId);
|
|
100
|
+
const address = AztecAddress.fromBuffer(Buffer.from(command.address));
|
|
101
|
+
const instance = await db.getContractInstance(address, timestamp);
|
|
102
|
+
return {
|
|
103
|
+
instance: instance ? encoder.encode(serializeContractInstance(instance)) : null
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
async getContractClass(command) {
|
|
107
|
+
const { db } = this.getFork(command.forkId);
|
|
108
|
+
const classId = Fr.fromBuffer(Buffer.from(command.classId));
|
|
109
|
+
const contractClass = await db.getContractClass(classId);
|
|
110
|
+
return {
|
|
111
|
+
contractClass: contractClass ? encoder.encode(serializeContractClass(contractClass)) : null
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
async getBytecodeCommitment(command) {
|
|
115
|
+
const { db } = this.getFork(command.forkId);
|
|
116
|
+
const classId = Fr.fromBuffer(Buffer.from(command.classId));
|
|
117
|
+
const commitment = await db.getBytecodeCommitment(classId);
|
|
118
|
+
return {
|
|
119
|
+
commitment: commitment ? toFieldBuffer(commitment) : null
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
async getDebugFunctionName(command) {
|
|
123
|
+
const { db } = this.getFork(command.forkId);
|
|
124
|
+
const address = AztecAddress.fromBuffer(Buffer.from(command.address));
|
|
125
|
+
const selectorField = Fr.fromBuffer(Buffer.from(command.selector));
|
|
126
|
+
const selector = FunctionSelector.fromFieldOrUndefined(selectorField);
|
|
127
|
+
const name = selector ? await db.getDebugFunctionName(address, selector) : undefined;
|
|
128
|
+
return {
|
|
129
|
+
name: name ?? null
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
addContracts(command) {
|
|
133
|
+
const { db } = this.getFork(command.forkId);
|
|
134
|
+
const contractDeploymentData = ContractDeploymentData.fromPlainObject(decoder.decode(command.contractDeploymentData));
|
|
135
|
+
db.addContractsFromLogs(contractDeploymentData);
|
|
136
|
+
return Promise.resolve({});
|
|
137
|
+
}
|
|
138
|
+
createCheckpoint(command) {
|
|
139
|
+
const { db } = this.getFork(command.forkId);
|
|
140
|
+
db.createCheckpoint();
|
|
141
|
+
return Promise.resolve({});
|
|
142
|
+
}
|
|
143
|
+
commitCheckpoint(command) {
|
|
144
|
+
const { db } = this.getFork(command.forkId);
|
|
145
|
+
db.commitCheckpoint();
|
|
146
|
+
return Promise.resolve({});
|
|
147
|
+
}
|
|
148
|
+
revertCheckpoint(command) {
|
|
149
|
+
const { db } = this.getFork(command.forkId);
|
|
150
|
+
db.revertCheckpoint();
|
|
151
|
+
return Promise.resolve({});
|
|
152
|
+
}
|
|
153
|
+
}
|