@aztec/simulator 0.0.0-test.0
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 +49 -0
- package/dest/client.d.ts +5 -0
- package/dest/client.d.ts.map +1 -0
- package/dest/client.js +3 -0
- package/dest/common/db_interfaces.d.ts +80 -0
- package/dest/common/db_interfaces.d.ts.map +1 -0
- package/dest/common/db_interfaces.js +1 -0
- package/dest/common/debug_fn_name.d.ts +5 -0
- package/dest/common/debug_fn_name.d.ts.map +1 -0
- package/dest/common/debug_fn_name.js +6 -0
- package/dest/common/errors.d.ts +54 -0
- package/dest/common/errors.d.ts.map +1 -0
- package/dest/common/errors.js +135 -0
- package/dest/common/index.d.ts +4 -0
- package/dest/common/index.d.ts.map +1 -0
- package/dest/common/index.js +3 -0
- package/dest/common/message_load_oracle_inputs.d.ts +15 -0
- package/dest/common/message_load_oracle_inputs.d.ts.map +1 -0
- package/dest/common/message_load_oracle_inputs.js +15 -0
- package/dest/common/stats/index.d.ts +2 -0
- package/dest/common/stats/index.d.ts.map +1 -0
- package/dest/common/stats/index.js +1 -0
- package/dest/common/stats/stats.d.ts +4 -0
- package/dest/common/stats/stats.d.ts.map +1 -0
- package/dest/common/stats/stats.js +10 -0
- package/dest/private/acvm/acvm.d.ts +35 -0
- package/dest/private/acvm/acvm.d.ts.map +1 -0
- package/dest/private/acvm/acvm.js +70 -0
- package/dest/private/acvm/acvm_types.d.ts +10 -0
- package/dest/private/acvm/acvm_types.d.ts.map +1 -0
- package/dest/private/acvm/acvm_types.js +3 -0
- package/dest/private/acvm/deserialize.d.ts +36 -0
- package/dest/private/acvm/deserialize.d.ts.map +1 -0
- package/dest/private/acvm/deserialize.js +42 -0
- package/dest/private/acvm/index.d.ts +6 -0
- package/dest/private/acvm/index.d.ts.map +1 -0
- package/dest/private/acvm/index.js +5 -0
- package/dest/private/acvm/oracle/index.d.ts +14 -0
- package/dest/private/acvm/oracle/index.d.ts.map +1 -0
- package/dest/private/acvm/oracle/index.js +2 -0
- package/dest/private/acvm/oracle/oracle.d.ts +49 -0
- package/dest/private/acvm/oracle/oracle.d.ts.map +1 -0
- package/dest/private/acvm/oracle/oracle.js +263 -0
- package/dest/private/acvm/oracle/typed_oracle.d.ts +83 -0
- package/dest/private/acvm/oracle/typed_oracle.d.ts.map +1 -0
- package/dest/private/acvm/oracle/typed_oracle.js +132 -0
- package/dest/private/acvm/serialize.d.ts +24 -0
- package/dest/private/acvm/serialize.d.ts.map +1 -0
- package/dest/private/acvm/serialize.js +46 -0
- package/dest/private/execution_data_provider.d.ts +261 -0
- package/dest/private/execution_data_provider.d.ts.map +1 -0
- package/dest/private/execution_data_provider.js +14 -0
- package/dest/private/execution_note_cache.d.ts +93 -0
- package/dest/private/execution_note_cache.d.ts.map +1 -0
- package/dest/private/execution_note_cache.js +180 -0
- package/dest/private/hashed_values_cache.d.ts +28 -0
- package/dest/private/hashed_values_cache.d.ts.map +1 -0
- package/dest/private/hashed_values_cache.js +46 -0
- package/dest/private/index.d.ts +13 -0
- package/dest/private/index.d.ts.map +1 -0
- package/dest/private/index.js +12 -0
- package/dest/private/pick_notes.d.ts +85 -0
- package/dest/private/pick_notes.d.ts.map +1 -0
- package/dest/private/pick_notes.js +51 -0
- package/dest/private/private_execution.d.ts +25 -0
- package/dest/private/private_execution.d.ts.map +1 -0
- package/dest/private/private_execution.js +92 -0
- package/dest/private/private_execution_oracle.d.ts +215 -0
- package/dest/private/private_execution_oracle.d.ts.map +1 -0
- package/dest/private/private_execution_oracle.js +382 -0
- package/dest/private/providers/acvm_native.d.ts +40 -0
- package/dest/private/providers/acvm_native.d.ts.map +1 -0
- package/dest/private/providers/acvm_native.js +139 -0
- package/dest/private/providers/acvm_wasm.d.ts +15 -0
- package/dest/private/providers/acvm_wasm.d.ts.map +1 -0
- package/dest/private/providers/acvm_wasm.js +62 -0
- package/dest/private/providers/acvm_wasm_with_blobs.d.ts +19 -0
- package/dest/private/providers/acvm_wasm_with_blobs.d.ts.map +1 -0
- package/dest/private/providers/acvm_wasm_with_blobs.js +32 -0
- package/dest/private/providers/factory.d.ts +12 -0
- package/dest/private/providers/factory.d.ts.map +1 -0
- package/dest/private/providers/factory.js +27 -0
- package/dest/private/providers/simulation_provider.d.ts +19 -0
- package/dest/private/providers/simulation_provider.d.ts.map +1 -0
- package/dest/private/providers/simulation_provider.js +24 -0
- package/dest/private/simulator.d.ts +34 -0
- package/dest/private/simulator.d.ts.map +1 -0
- package/dest/private/simulator.js +76 -0
- package/dest/private/unconstrained_execution.d.ts +10 -0
- package/dest/private/unconstrained_execution.d.ts.map +1 -0
- package/dest/private/unconstrained_execution.js +27 -0
- package/dest/private/unconstrained_execution_oracle.d.ts +161 -0
- package/dest/private/unconstrained_execution_oracle.d.ts.map +1 -0
- package/dest/private/unconstrained_execution_oracle.js +258 -0
- package/dest/public/avm/avm_context.d.ts +41 -0
- package/dest/public/avm/avm_context.d.ts.map +1 -0
- package/dest/public/avm/avm_context.js +44 -0
- package/dest/public/avm/avm_contract_call_result.d.ts +30 -0
- package/dest/public/avm/avm_contract_call_result.d.ts.map +1 -0
- package/dest/public/avm/avm_contract_call_result.js +50 -0
- package/dest/public/avm/avm_execution_environment.d.ts +21 -0
- package/dest/public/avm/avm_execution_environment.d.ts.map +1 -0
- package/dest/public/avm/avm_execution_environment.js +31 -0
- package/dest/public/avm/avm_gas.d.ts +60 -0
- package/dest/public/avm/avm_gas.d.ts.map +1 -0
- package/dest/public/avm/avm_gas.js +203 -0
- package/dest/public/avm/avm_machine_state.d.ts +95 -0
- package/dest/public/avm/avm_machine_state.d.ts.map +1 -0
- package/dest/public/avm/avm_machine_state.js +107 -0
- package/dest/public/avm/avm_memory_types.d.ts +264 -0
- package/dest/public/avm/avm_memory_types.d.ts.map +1 -0
- package/dest/public/avm/avm_memory_types.js +340 -0
- package/dest/public/avm/avm_simulator.d.ts +40 -0
- package/dest/public/avm/avm_simulator.d.ts.map +1 -0
- package/dest/public/avm/avm_simulator.js +202 -0
- package/dest/public/avm/bytecode_utils.d.ts +5 -0
- package/dest/public/avm/bytecode_utils.d.ts.map +1 -0
- package/dest/public/avm/bytecode_utils.js +17 -0
- package/dest/public/avm/errors.d.ts +122 -0
- package/dest/public/avm/errors.d.ts.map +1 -0
- package/dest/public/avm/errors.js +179 -0
- package/dest/public/avm/fixtures/avm_simulation_tester.d.ts +21 -0
- package/dest/public/avm/fixtures/avm_simulation_tester.d.ts.map +1 -0
- package/dest/public/avm/fixtures/avm_simulation_tester.js +76 -0
- package/dest/public/avm/fixtures/base_avm_simulation_tester.d.ts +36 -0
- package/dest/public/avm/fixtures/base_avm_simulation_tester.d.ts.map +1 -0
- package/dest/public/avm/fixtures/base_avm_simulation_tester.js +83 -0
- package/dest/public/avm/fixtures/index.d.ts +84 -0
- package/dest/public/avm/fixtures/index.d.ts.map +1 -0
- package/dest/public/avm/fixtures/index.js +175 -0
- package/dest/public/avm/fixtures/simple_contract_data_source.d.ts +35 -0
- package/dest/public/avm/fixtures/simple_contract_data_source.d.ts.map +1 -0
- package/dest/public/avm/fixtures/simple_contract_data_source.js +74 -0
- package/dest/public/avm/index.d.ts +4 -0
- package/dest/public/avm/index.d.ts.map +1 -0
- package/dest/public/avm/index.js +3 -0
- package/dest/public/avm/journal/index.d.ts +2 -0
- package/dest/public/avm/journal/index.d.ts.map +1 -0
- package/dest/public/avm/journal/index.js +1 -0
- package/dest/public/avm/journal/journal.d.ts +209 -0
- package/dest/public/avm/journal/journal.d.ts.map +1 -0
- package/dest/public/avm/journal/journal.js +486 -0
- package/dest/public/avm/journal/nullifiers.d.ts +64 -0
- package/dest/public/avm/journal/nullifiers.d.ts.map +1 -0
- package/dest/public/avm/journal/nullifiers.js +97 -0
- package/dest/public/avm/journal/public_storage.d.ts +66 -0
- package/dest/public/avm/journal/public_storage.d.ts.map +1 -0
- package/dest/public/avm/journal/public_storage.js +145 -0
- package/dest/public/avm/opcodes/accrued_substate.d.ts +75 -0
- package/dest/public/avm/opcodes/accrued_substate.d.ts.map +1 -0
- package/dest/public/avm/opcodes/accrued_substate.js +252 -0
- package/dest/public/avm/opcodes/addressing_mode.d.ts +27 -0
- package/dest/public/avm/opcodes/addressing_mode.d.ts.map +1 -0
- package/dest/public/avm/opcodes/addressing_mode.js +74 -0
- package/dest/public/avm/opcodes/arithmetic.d.ts +37 -0
- package/dest/public/avm/opcodes/arithmetic.d.ts.map +1 -0
- package/dest/public/avm/opcodes/arithmetic.js +73 -0
- package/dest/public/avm/opcodes/bitwise.d.ts +50 -0
- package/dest/public/avm/opcodes/bitwise.d.ts.map +1 -0
- package/dest/public/avm/opcodes/bitwise.js +106 -0
- package/dest/public/avm/opcodes/comparators.d.ts +25 -0
- package/dest/public/avm/opcodes/comparators.d.ts.map +1 -0
- package/dest/public/avm/opcodes/comparators.js +43 -0
- package/dest/public/avm/opcodes/contract.d.ts +21 -0
- package/dest/public/avm/opcodes/contract.d.ts.map +1 -0
- package/dest/public/avm/opcodes/contract.js +66 -0
- package/dest/public/avm/opcodes/control_flow.d.ts +41 -0
- package/dest/public/avm/opcodes/control_flow.d.ts.map +1 -0
- package/dest/public/avm/opcodes/control_flow.js +105 -0
- package/dest/public/avm/opcodes/conversion.d.ts +17 -0
- package/dest/public/avm/opcodes/conversion.d.ts.map +1 -0
- package/dest/public/avm/opcodes/conversion.js +69 -0
- package/dest/public/avm/opcodes/ec_add.d.ts +19 -0
- package/dest/public/avm/opcodes/ec_add.d.ts.map +1 -0
- package/dest/public/avm/opcodes/ec_add.js +84 -0
- package/dest/public/avm/opcodes/environment_getters.d.ts +28 -0
- package/dest/public/avm/opcodes/environment_getters.d.ts.map +1 -0
- package/dest/public/avm/opcodes/environment_getters.js +79 -0
- package/dest/public/avm/opcodes/external_calls.d.ts +58 -0
- package/dest/public/avm/opcodes/external_calls.d.ts.map +1 -0
- package/dest/public/avm/opcodes/external_calls.js +204 -0
- package/dest/public/avm/opcodes/hashing.d.ts +36 -0
- package/dest/public/avm/opcodes/hashing.d.ts.map +1 -0
- package/dest/public/avm/opcodes/hashing.js +114 -0
- package/dest/public/avm/opcodes/index.d.ts +16 -0
- package/dest/public/avm/opcodes/index.d.ts.map +1 -0
- package/dest/public/avm/opcodes/index.js +15 -0
- package/dest/public/avm/opcodes/instruction.d.ts +70 -0
- package/dest/public/avm/opcodes/instruction.d.ts.map +1 -0
- package/dest/public/avm/opcodes/instruction.js +91 -0
- package/dest/public/avm/opcodes/instruction_impl.d.ts +19 -0
- package/dest/public/avm/opcodes/instruction_impl.d.ts.map +1 -0
- package/dest/public/avm/opcodes/instruction_impl.js +30 -0
- package/dest/public/avm/opcodes/memory.d.ts +74 -0
- package/dest/public/avm/opcodes/memory.d.ts.map +1 -0
- package/dest/public/avm/opcodes/memory.js +253 -0
- package/dest/public/avm/opcodes/misc.d.ts +17 -0
- package/dest/public/avm/opcodes/misc.d.ts.map +1 -0
- package/dest/public/avm/opcodes/misc.js +48 -0
- package/dest/public/avm/opcodes/storage.d.ts +24 -0
- package/dest/public/avm/opcodes/storage.d.ts.map +1 -0
- package/dest/public/avm/opcodes/storage.js +66 -0
- package/dest/public/avm/serialization/buffer_cursor.d.ts +28 -0
- package/dest/public/avm/serialization/buffer_cursor.d.ts.map +1 -0
- package/dest/public/avm/serialization/buffer_cursor.js +99 -0
- package/dest/public/avm/serialization/bytecode_serialization.d.ts +21 -0
- package/dest/public/avm/serialization/bytecode_serialization.d.ts.map +1 -0
- package/dest/public/avm/serialization/bytecode_serialization.js +332 -0
- package/dest/public/avm/serialization/instruction_serialization.d.ts +105 -0
- package/dest/public/avm/serialization/instruction_serialization.d.ts.map +1 -0
- package/dest/public/avm/serialization/instruction_serialization.js +226 -0
- package/dest/public/avm/test_utils.d.ts +18 -0
- package/dest/public/avm/test_utils.d.ts.map +1 -0
- package/dest/public/avm/test_utils.js +52 -0
- package/dest/public/bytecode_errors.d.ts +4 -0
- package/dest/public/bytecode_errors.d.ts.map +1 -0
- package/dest/public/bytecode_errors.js +6 -0
- package/dest/public/execution.d.ts +108 -0
- package/dest/public/execution.d.ts.map +1 -0
- package/dest/public/execution.js +9 -0
- package/dest/public/executor_metrics.d.ts +13 -0
- package/dest/public/executor_metrics.d.ts.map +1 -0
- package/dest/public/executor_metrics.js +54 -0
- package/dest/public/fixtures/index.d.ts +3 -0
- package/dest/public/fixtures/index.d.ts.map +1 -0
- package/dest/public/fixtures/index.js +2 -0
- package/dest/public/fixtures/public_tx_simulation_tester.d.ts +32 -0
- package/dest/public/fixtures/public_tx_simulation_tester.d.ts.map +1 -0
- package/dest/public/fixtures/public_tx_simulation_tester.js +93 -0
- package/dest/public/fixtures/utils.d.ts +13 -0
- package/dest/public/fixtures/utils.d.ts.map +1 -0
- package/dest/public/fixtures/utils.js +126 -0
- package/dest/public/index.d.ts +10 -0
- package/dest/public/index.d.ts.map +1 -0
- package/dest/public/index.js +8 -0
- package/dest/public/public_db_sources.d.ts +129 -0
- package/dest/public/public_db_sources.d.ts.map +1 -0
- package/dest/public/public_db_sources.js +264 -0
- package/dest/public/public_processor/public_processor.d.ts +74 -0
- package/dest/public/public_processor/public_processor.d.ts.map +1 -0
- package/dest/public/public_processor/public_processor.js +379 -0
- package/dest/public/public_processor/public_processor_metrics.d.ts +27 -0
- package/dest/public/public_processor/public_processor_metrics.d.ts.map +1 -0
- package/dest/public/public_processor/public_processor_metrics.js +125 -0
- package/dest/public/public_tx_simulator/public_tx_context.d.ts +137 -0
- package/dest/public/public_tx_simulator/public_tx_context.d.ts.map +1 -0
- package/dest/public/public_tx_simulator/public_tx_context.js +320 -0
- package/dest/public/public_tx_simulator/public_tx_simulator.d.ts +102 -0
- package/dest/public/public_tx_simulator/public_tx_simulator.d.ts.map +1 -0
- package/dest/public/public_tx_simulator/public_tx_simulator.js +334 -0
- package/dest/public/side_effect_errors.d.ts +4 -0
- package/dest/public/side_effect_errors.d.ts.map +1 -0
- package/dest/public/side_effect_errors.js +6 -0
- package/dest/public/side_effect_trace.d.ts +132 -0
- package/dest/public/side_effect_trace.d.ts.map +1 -0
- package/dest/public/side_effect_trace.js +249 -0
- package/dest/public/side_effect_trace_interface.d.ts +34 -0
- package/dest/public/side_effect_trace_interface.d.ts.map +1 -0
- package/dest/public/side_effect_trace_interface.js +1 -0
- package/dest/public/tx_contract_cache.d.ts +41 -0
- package/dest/public/tx_contract_cache.d.ts.map +1 -0
- package/dest/public/tx_contract_cache.js +49 -0
- package/dest/public/unique_class_ids.d.ts +37 -0
- package/dest/public/unique_class_ids.d.ts.map +1 -0
- package/dest/public/unique_class_ids.js +61 -0
- package/dest/public/utils.d.ts +5 -0
- package/dest/public/utils.d.ts.map +1 -0
- package/dest/public/utils.js +35 -0
- package/dest/server.d.ts +6 -0
- package/dest/server.d.ts.map +1 -0
- package/dest/server.js +4 -0
- package/dest/test/utils.d.ts +13 -0
- package/dest/test/utils.d.ts.map +1 -0
- package/dest/test/utils.js +22 -0
- package/package.json +104 -0
- package/src/client.ts +4 -0
- package/src/common/db_interfaces.ts +94 -0
- package/src/common/debug_fn_name.ts +18 -0
- package/src/common/errors.ts +183 -0
- package/src/common/index.ts +3 -0
- package/src/common/message_load_oracle_inputs.ts +15 -0
- package/src/common/stats/index.ts +1 -0
- package/src/common/stats/stats.ts +20 -0
- package/src/private/acvm/acvm.ts +127 -0
- package/src/private/acvm/acvm_types.ts +11 -0
- package/src/private/acvm/deserialize.ts +52 -0
- package/src/private/acvm/index.ts +5 -0
- package/src/private/acvm/oracle/index.ts +16 -0
- package/src/private/acvm/oracle/oracle.ts +455 -0
- package/src/private/acvm/oracle/typed_oracle.ts +259 -0
- package/src/private/acvm/serialize.ts +60 -0
- package/src/private/execution_data_provider.ts +323 -0
- package/src/private/execution_note_cache.ts +217 -0
- package/src/private/hashed_values_cache.ts +55 -0
- package/src/private/index.ts +16 -0
- package/src/private/pick_notes.ts +141 -0
- package/src/private/private_execution.ts +151 -0
- package/src/private/private_execution_oracle.ts +614 -0
- package/src/private/providers/acvm_native.ts +171 -0
- package/src/private/providers/acvm_wasm.ts +63 -0
- package/src/private/providers/acvm_wasm_with_blobs.ts +50 -0
- package/src/private/providers/factory.ts +38 -0
- package/src/private/providers/simulation_provider.ts +45 -0
- package/src/private/simulator.ts +147 -0
- package/src/private/unconstrained_execution.ts +50 -0
- package/src/private/unconstrained_execution_oracle.ts +373 -0
- package/src/public/avm/avm_context.ts +61 -0
- package/src/public/avm/avm_contract_call_result.ts +55 -0
- package/src/public/avm/avm_execution_environment.ts +39 -0
- package/src/public/avm/avm_gas.ts +195 -0
- package/src/public/avm/avm_machine_state.ts +164 -0
- package/src/public/avm/avm_memory_types.ts +423 -0
- package/src/public/avm/avm_simulator.ts +284 -0
- package/src/public/avm/bytecode_utils.ts +17 -0
- package/src/public/avm/errors.ts +232 -0
- package/src/public/avm/fixtures/avm_simulation_tester.ts +105 -0
- package/src/public/avm/fixtures/base_avm_simulation_tester.ts +109 -0
- package/src/public/avm/fixtures/index.ts +296 -0
- package/src/public/avm/fixtures/simple_contract_data_source.ts +105 -0
- package/src/public/avm/index.ts +3 -0
- package/src/public/avm/journal/index.ts +1 -0
- package/src/public/avm/journal/journal.ts +742 -0
- package/src/public/avm/journal/nullifiers.ts +109 -0
- package/src/public/avm/journal/public_storage.ts +174 -0
- package/src/public/avm/opcodes/.eslintrc.cjs +8 -0
- package/src/public/avm/opcodes/accrued_substate.ts +253 -0
- package/src/public/avm/opcodes/addressing_mode.ts +87 -0
- package/src/public/avm/opcodes/arithmetic.ts +95 -0
- package/src/public/avm/opcodes/bitwise.ts +109 -0
- package/src/public/avm/opcodes/comparators.ts +52 -0
- package/src/public/avm/opcodes/contract.ts +72 -0
- package/src/public/avm/opcodes/control_flow.ts +114 -0
- package/src/public/avm/opcodes/conversion.ts +80 -0
- package/src/public/avm/opcodes/ec_add.ts +93 -0
- package/src/public/avm/opcodes/environment_getters.ts +82 -0
- package/src/public/avm/opcodes/external_calls.ts +228 -0
- package/src/public/avm/opcodes/hashing.ts +125 -0
- package/src/public/avm/opcodes/index.ts +15 -0
- package/src/public/avm/opcodes/instruction.ts +126 -0
- package/src/public/avm/opcodes/instruction_impl.ts +36 -0
- package/src/public/avm/opcodes/memory.ts +254 -0
- package/src/public/avm/opcodes/misc.ts +60 -0
- package/src/public/avm/opcodes/storage.ts +71 -0
- package/src/public/avm/serialization/buffer_cursor.ts +115 -0
- package/src/public/avm/serialization/bytecode_serialization.ts +206 -0
- package/src/public/avm/serialization/instruction_serialization.ts +208 -0
- package/src/public/avm/test_utils.ts +81 -0
- package/src/public/bytecode_errors.ts +6 -0
- package/src/public/execution.ts +140 -0
- package/src/public/executor_metrics.ts +71 -0
- package/src/public/fixtures/index.ts +2 -0
- package/src/public/fixtures/public_tx_simulation_tester.ts +179 -0
- package/src/public/fixtures/utils.ts +199 -0
- package/src/public/index.ts +9 -0
- package/src/public/public_db_sources.ts +369 -0
- package/src/public/public_processor/public_processor.ts +521 -0
- package/src/public/public_processor/public_processor_metrics.ts +154 -0
- package/src/public/public_tx_simulator/public_tx_context.ts +504 -0
- package/src/public/public_tx_simulator/public_tx_simulator.ts +474 -0
- package/src/public/side_effect_errors.ts +6 -0
- package/src/public/side_effect_trace.ts +516 -0
- package/src/public/side_effect_trace_interface.ts +76 -0
- package/src/public/tx_contract_cache.ts +69 -0
- package/src/public/unique_class_ids.ts +80 -0
- package/src/public/utils.ts +32 -0
- package/src/server.ts +5 -0
- package/src/test/utils.ts +36 -0
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { L1_TO_L2_MSG_TREE_HEIGHT, MAX_ENQUEUED_CALLS_PER_TX, MAX_L2_TO_L1_MSGS_PER_TX, MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, MAX_PUBLIC_CALLS_TO_UNIQUE_CONTRACT_CLASS_IDS, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, MAX_PUBLIC_LOGS_PER_TX, MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, NOTE_HASH_TREE_HEIGHT, NULLIFIER_TREE_HEIGHT, PROTOCOL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, PUBLIC_DATA_TREE_HEIGHT, PUBLIC_LOG_DATA_SIZE_IN_FIELDS } from '@aztec/constants';
|
|
2
|
+
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
3
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
5
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
6
|
+
import { AvmAccumulatedData, AvmAppendTreeHint, AvmCircuitPublicInputs, AvmContractClassHint, AvmContractInstanceHint, AvmEnqueuedCallHint, AvmExecutionHints, AvmNullifierReadTreeHint, AvmNullifierWriteTreeHint, AvmPublicDataReadTreeHint, AvmPublicDataWriteTreeHint, PublicDataUpdateRequest, PublicDataWrite } from '@aztec/stdlib/avm';
|
|
7
|
+
import { SerializableContractInstance } from '@aztec/stdlib/contract';
|
|
8
|
+
import { computePublicDataTreeLeafSlot } from '@aztec/stdlib/hash';
|
|
9
|
+
import { NoteHash, Nullifier, PrivateToAvmAccumulatedData, PrivateToAvmAccumulatedDataArrayLengths, PublicCallRequest } from '@aztec/stdlib/kernel';
|
|
10
|
+
import { PublicLog } from '@aztec/stdlib/logs';
|
|
11
|
+
import { L2ToL1Message, ScopedL2ToL1Message } from '@aztec/stdlib/messaging';
|
|
12
|
+
import { NullifierLeafPreimage, PublicDataTreeLeafPreimage } from '@aztec/stdlib/trees';
|
|
13
|
+
import { strict as assert } from 'assert';
|
|
14
|
+
import { SideEffectLimitReachedError } from './side_effect_errors.js';
|
|
15
|
+
import { UniqueClassIds } from './unique_class_ids.js';
|
|
16
|
+
const emptyPublicDataPath = ()=>new Array(PUBLIC_DATA_TREE_HEIGHT).fill(Fr.zero());
|
|
17
|
+
const emptyNoteHashPath = ()=>new Array(NOTE_HASH_TREE_HEIGHT).fill(Fr.zero());
|
|
18
|
+
const emptyNullifierPath = ()=>new Array(NULLIFIER_TREE_HEIGHT).fill(Fr.zero());
|
|
19
|
+
const emptyL1ToL2MessagePath = ()=>new Array(L1_TO_L2_MSG_TREE_HEIGHT).fill(Fr.zero());
|
|
20
|
+
export class SideEffectArrayLengths {
|
|
21
|
+
publicDataWrites;
|
|
22
|
+
protocolPublicDataWrites;
|
|
23
|
+
noteHashes;
|
|
24
|
+
nullifiers;
|
|
25
|
+
l2ToL1Msgs;
|
|
26
|
+
publicLogs;
|
|
27
|
+
constructor(publicDataWrites, protocolPublicDataWrites, noteHashes, nullifiers, l2ToL1Msgs, publicLogs){
|
|
28
|
+
this.publicDataWrites = publicDataWrites;
|
|
29
|
+
this.protocolPublicDataWrites = protocolPublicDataWrites;
|
|
30
|
+
this.noteHashes = noteHashes;
|
|
31
|
+
this.nullifiers = nullifiers;
|
|
32
|
+
this.l2ToL1Msgs = l2ToL1Msgs;
|
|
33
|
+
this.publicLogs = publicLogs;
|
|
34
|
+
}
|
|
35
|
+
static empty() {
|
|
36
|
+
return new this(0, 0, 0, 0, 0, 0);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Trace side effects for an enqueued public call's execution.
|
|
41
|
+
*/ export class SideEffectTrace {
|
|
42
|
+
startSideEffectCounter;
|
|
43
|
+
previousSideEffectArrayLengths;
|
|
44
|
+
uniqueClassIds;
|
|
45
|
+
log;
|
|
46
|
+
/** The side effect counter increments with every call to the trace. */ sideEffectCounter;
|
|
47
|
+
enqueuedCalls;
|
|
48
|
+
publicDataWrites;
|
|
49
|
+
protocolPublicDataWritesLength;
|
|
50
|
+
userPublicDataWritesLength;
|
|
51
|
+
noteHashes;
|
|
52
|
+
nullifiers;
|
|
53
|
+
l2ToL1Messages;
|
|
54
|
+
publicLogs;
|
|
55
|
+
avmCircuitHints;
|
|
56
|
+
/** Make sure a forked trace is never merged twice. */ alreadyMergedIntoParent;
|
|
57
|
+
constructor(/** The counter of this trace's first side effect. */ startSideEffectCounter = 0, /** Track parent's (or previous kernel's) lengths so the AVM can properly enforce TX-wide limits,
|
|
58
|
+
* otherwise the public kernel can fail to prove because TX limits are breached.
|
|
59
|
+
*/ previousSideEffectArrayLengths = SideEffectArrayLengths.empty(), /** We need to track the set of class IDs used, to enforce limits. */ uniqueClassIds = new UniqueClassIds()){
|
|
60
|
+
this.startSideEffectCounter = startSideEffectCounter;
|
|
61
|
+
this.previousSideEffectArrayLengths = previousSideEffectArrayLengths;
|
|
62
|
+
this.uniqueClassIds = uniqueClassIds;
|
|
63
|
+
this.log = createLogger('simulator:side_effect_trace');
|
|
64
|
+
this.enqueuedCalls = [];
|
|
65
|
+
this.publicDataWrites = [];
|
|
66
|
+
this.protocolPublicDataWritesLength = 0;
|
|
67
|
+
this.userPublicDataWritesLength = 0;
|
|
68
|
+
this.noteHashes = [];
|
|
69
|
+
this.nullifiers = [];
|
|
70
|
+
this.l2ToL1Messages = [];
|
|
71
|
+
this.publicLogs = [];
|
|
72
|
+
this.alreadyMergedIntoParent = false;
|
|
73
|
+
this.sideEffectCounter = startSideEffectCounter;
|
|
74
|
+
this.avmCircuitHints = AvmExecutionHints.empty();
|
|
75
|
+
}
|
|
76
|
+
fork() {
|
|
77
|
+
return new SideEffectTrace(this.sideEffectCounter, new SideEffectArrayLengths(this.previousSideEffectArrayLengths.publicDataWrites + this.userPublicDataWritesLength, this.previousSideEffectArrayLengths.protocolPublicDataWrites + this.protocolPublicDataWritesLength, this.previousSideEffectArrayLengths.noteHashes + this.noteHashes.length, this.previousSideEffectArrayLengths.nullifiers + this.nullifiers.length, this.previousSideEffectArrayLengths.l2ToL1Msgs + this.l2ToL1Messages.length, this.previousSideEffectArrayLengths.publicLogs + this.publicLogs.length), this.uniqueClassIds.fork());
|
|
78
|
+
}
|
|
79
|
+
merge(forkedTrace, reverted = false) {
|
|
80
|
+
// sanity check to avoid merging the same forked trace twice
|
|
81
|
+
assert(!forkedTrace.alreadyMergedIntoParent, 'Bug! Cannot merge a forked trace that has already been merged into its parent!');
|
|
82
|
+
forkedTrace.alreadyMergedIntoParent = true;
|
|
83
|
+
this.sideEffectCounter = forkedTrace.sideEffectCounter;
|
|
84
|
+
this.enqueuedCalls.push(...forkedTrace.enqueuedCalls);
|
|
85
|
+
if (!reverted) {
|
|
86
|
+
this.publicDataWrites.push(...forkedTrace.publicDataWrites);
|
|
87
|
+
this.noteHashes.push(...forkedTrace.noteHashes);
|
|
88
|
+
this.nullifiers.push(...forkedTrace.nullifiers);
|
|
89
|
+
this.l2ToL1Messages.push(...forkedTrace.l2ToL1Messages);
|
|
90
|
+
this.publicLogs.push(...forkedTrace.publicLogs);
|
|
91
|
+
}
|
|
92
|
+
this.mergeHints(forkedTrace);
|
|
93
|
+
}
|
|
94
|
+
mergeHints(forkedTrace) {
|
|
95
|
+
this.uniqueClassIds.acceptAndMerge(forkedTrace.uniqueClassIds);
|
|
96
|
+
this.avmCircuitHints.enqueuedCalls.push(...forkedTrace.avmCircuitHints.enqueuedCalls);
|
|
97
|
+
this.avmCircuitHints.contractInstances.push(...forkedTrace.avmCircuitHints.contractInstances);
|
|
98
|
+
this.avmCircuitHints.contractClasses.push(...forkedTrace.avmCircuitHints.contractClasses);
|
|
99
|
+
this.avmCircuitHints.publicDataReads.push(...forkedTrace.avmCircuitHints.publicDataReads);
|
|
100
|
+
this.avmCircuitHints.publicDataWrites.push(...forkedTrace.avmCircuitHints.publicDataWrites);
|
|
101
|
+
this.avmCircuitHints.nullifierReads.push(...forkedTrace.avmCircuitHints.nullifierReads);
|
|
102
|
+
this.avmCircuitHints.nullifierWrites.push(...forkedTrace.avmCircuitHints.nullifierWrites);
|
|
103
|
+
this.avmCircuitHints.noteHashReads.push(...forkedTrace.avmCircuitHints.noteHashReads);
|
|
104
|
+
this.avmCircuitHints.noteHashWrites.push(...forkedTrace.avmCircuitHints.noteHashWrites);
|
|
105
|
+
this.avmCircuitHints.l1ToL2MessageReads.push(...forkedTrace.avmCircuitHints.l1ToL2MessageReads);
|
|
106
|
+
}
|
|
107
|
+
getCounter() {
|
|
108
|
+
return this.sideEffectCounter;
|
|
109
|
+
}
|
|
110
|
+
incrementSideEffectCounter() {
|
|
111
|
+
this.sideEffectCounter++;
|
|
112
|
+
}
|
|
113
|
+
getNoteHashCount() {
|
|
114
|
+
return this.previousSideEffectArrayLengths.noteHashes + this.noteHashes.length;
|
|
115
|
+
}
|
|
116
|
+
tracePublicStorageRead(contractAddress, slot, value, leafPreimage = PublicDataTreeLeafPreimage.empty(), leafIndex = Fr.zero(), path = emptyPublicDataPath()) {
|
|
117
|
+
this.avmCircuitHints.publicDataReads.push(new AvmPublicDataReadTreeHint(leafPreimage, leafIndex, path));
|
|
118
|
+
this.log.trace(`Tracing storage read (address=${contractAddress}, slot=${slot}): value=${value} (counter=${this.sideEffectCounter})`);
|
|
119
|
+
this.incrementSideEffectCounter();
|
|
120
|
+
}
|
|
121
|
+
async tracePublicStorageWrite(contractAddress, slot, value, protocolWrite, lowLeafPreimage = PublicDataTreeLeafPreimage.empty(), lowLeafIndex = Fr.zero(), lowLeafPath = emptyPublicDataPath(), newLeafPreimage = PublicDataTreeLeafPreimage.empty(), insertionPath = emptyPublicDataPath()) {
|
|
122
|
+
if (protocolWrite) {
|
|
123
|
+
if (this.protocolPublicDataWritesLength + this.previousSideEffectArrayLengths.protocolPublicDataWrites >= PROTOCOL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX) {
|
|
124
|
+
throw new SideEffectLimitReachedError('protocol public data (contract storage) write', PROTOCOL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX);
|
|
125
|
+
}
|
|
126
|
+
this.protocolPublicDataWritesLength++;
|
|
127
|
+
} else {
|
|
128
|
+
if (this.userPublicDataWritesLength + this.previousSideEffectArrayLengths.publicDataWrites >= MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX) {
|
|
129
|
+
throw new SideEffectLimitReachedError('public data (contract storage) write', MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX);
|
|
130
|
+
}
|
|
131
|
+
this.userPublicDataWritesLength++;
|
|
132
|
+
}
|
|
133
|
+
const leafSlot = await computePublicDataTreeLeafSlot(contractAddress, slot);
|
|
134
|
+
this.publicDataWrites.push(new PublicDataUpdateRequest(leafSlot, value, this.sideEffectCounter));
|
|
135
|
+
// New hinting
|
|
136
|
+
const readHint = new AvmPublicDataReadTreeHint(lowLeafPreimage, lowLeafIndex, lowLeafPath);
|
|
137
|
+
this.avmCircuitHints.publicDataWrites.push(new AvmPublicDataWriteTreeHint(readHint, newLeafPreimage, insertionPath));
|
|
138
|
+
this.log.trace(`Traced public data write (address=${contractAddress}, slot=${slot}): value=${value} (counter=${this.sideEffectCounter}, isProtocol:${protocolWrite})`);
|
|
139
|
+
this.incrementSideEffectCounter();
|
|
140
|
+
}
|
|
141
|
+
// TODO(8287): _exists can be removed once we have the vm properly handling the equality check
|
|
142
|
+
traceNoteHashCheck(_contractAddress, noteHash, leafIndex, _exists, path = emptyNoteHashPath()) {
|
|
143
|
+
// New Hinting
|
|
144
|
+
this.avmCircuitHints.noteHashReads.push(new AvmAppendTreeHint(leafIndex, noteHash, path));
|
|
145
|
+
// NOTE: counter does not increment for note hash checks (because it doesn't rely on pending note hashes)
|
|
146
|
+
this.log.trace(`Tracing note hash check (counter=${this.sideEffectCounter})`);
|
|
147
|
+
}
|
|
148
|
+
traceNewNoteHash(noteHash, leafIndex = Fr.zero(), path = emptyNoteHashPath()) {
|
|
149
|
+
if (this.noteHashes.length + this.previousSideEffectArrayLengths.noteHashes >= MAX_NOTE_HASHES_PER_TX) {
|
|
150
|
+
throw new SideEffectLimitReachedError('note hash', MAX_NOTE_HASHES_PER_TX);
|
|
151
|
+
}
|
|
152
|
+
this.noteHashes.push(new NoteHash(noteHash, this.sideEffectCounter));
|
|
153
|
+
this.avmCircuitHints.noteHashWrites.push(new AvmAppendTreeHint(leafIndex, noteHash, path));
|
|
154
|
+
this.log.trace(`Tracing new note hash (counter=${this.sideEffectCounter})`);
|
|
155
|
+
this.incrementSideEffectCounter();
|
|
156
|
+
}
|
|
157
|
+
traceNullifierCheck(_siloedNullifier, _exists, lowLeafPreimage = NullifierLeafPreimage.empty(), lowLeafIndex = Fr.zero(), lowLeafPath = emptyNullifierPath()) {
|
|
158
|
+
this.avmCircuitHints.nullifierReads.push(new AvmNullifierReadTreeHint(lowLeafPreimage, lowLeafIndex, lowLeafPath));
|
|
159
|
+
this.log.trace(`Tracing nullifier check (counter=${this.sideEffectCounter})`);
|
|
160
|
+
this.incrementSideEffectCounter();
|
|
161
|
+
}
|
|
162
|
+
traceNewNullifier(siloedNullifier, lowLeafPreimage = NullifierLeafPreimage.empty(), lowLeafIndex = Fr.zero(), lowLeafPath = emptyNullifierPath(), insertionPath = emptyNullifierPath()) {
|
|
163
|
+
if (this.nullifiers.length + this.previousSideEffectArrayLengths.nullifiers >= MAX_NULLIFIERS_PER_TX) {
|
|
164
|
+
throw new SideEffectLimitReachedError('nullifier', MAX_NULLIFIERS_PER_TX);
|
|
165
|
+
}
|
|
166
|
+
this.nullifiers.push(new Nullifier(siloedNullifier, this.sideEffectCounter, /*noteHash=*/ Fr.ZERO));
|
|
167
|
+
const lowLeafReadHint = new AvmNullifierReadTreeHint(lowLeafPreimage, lowLeafIndex, lowLeafPath);
|
|
168
|
+
this.avmCircuitHints.nullifierWrites.push(new AvmNullifierWriteTreeHint(lowLeafReadHint, insertionPath));
|
|
169
|
+
this.log.trace(`Tracing new nullifier (counter=${this.sideEffectCounter})`);
|
|
170
|
+
this.incrementSideEffectCounter();
|
|
171
|
+
}
|
|
172
|
+
// TODO(8287): _exists can be removed once we have the vm properly handling the equality check
|
|
173
|
+
traceL1ToL2MessageCheck(_contractAddress, msgHash, msgLeafIndex, _exists, path = emptyL1ToL2MessagePath()) {
|
|
174
|
+
this.avmCircuitHints.l1ToL2MessageReads.push(new AvmAppendTreeHint(msgLeafIndex, msgHash, path));
|
|
175
|
+
this.log.trace(`Tracing l1 to l2 message check (counter=${this.sideEffectCounter})`);
|
|
176
|
+
}
|
|
177
|
+
traceNewL2ToL1Message(contractAddress, recipient, content) {
|
|
178
|
+
if (this.l2ToL1Messages.length + this.previousSideEffectArrayLengths.l2ToL1Msgs >= MAX_L2_TO_L1_MSGS_PER_TX) {
|
|
179
|
+
throw new SideEffectLimitReachedError('l2 to l1 message', MAX_L2_TO_L1_MSGS_PER_TX);
|
|
180
|
+
}
|
|
181
|
+
const recipientAddress = EthAddress.fromField(recipient);
|
|
182
|
+
this.l2ToL1Messages.push(new L2ToL1Message(recipientAddress, content, this.sideEffectCounter).scope(contractAddress));
|
|
183
|
+
this.log.trace(`Tracing new l2 to l1 message (counter=${this.sideEffectCounter})`);
|
|
184
|
+
this.incrementSideEffectCounter();
|
|
185
|
+
}
|
|
186
|
+
tracePublicLog(contractAddress, log) {
|
|
187
|
+
if (this.publicLogs.length + this.previousSideEffectArrayLengths.publicLogs >= MAX_PUBLIC_LOGS_PER_TX) {
|
|
188
|
+
throw new SideEffectLimitReachedError('public log', MAX_PUBLIC_LOGS_PER_TX);
|
|
189
|
+
}
|
|
190
|
+
if (log.length > PUBLIC_LOG_DATA_SIZE_IN_FIELDS) {
|
|
191
|
+
throw new Error(`Emitted public log is too large, max: ${PUBLIC_LOG_DATA_SIZE_IN_FIELDS}, passed: ${log.length}`);
|
|
192
|
+
}
|
|
193
|
+
const publicLog = new PublicLog(contractAddress, padArrayEnd(log, Fr.ZERO, PUBLIC_LOG_DATA_SIZE_IN_FIELDS));
|
|
194
|
+
this.publicLogs.push(publicLog);
|
|
195
|
+
this.log.trace(`Tracing new public log (counter=${this.sideEffectCounter})`);
|
|
196
|
+
this.incrementSideEffectCounter();
|
|
197
|
+
}
|
|
198
|
+
traceGetContractInstance(contractAddress, exists, instance = SerializableContractInstance.default(), updateMembershipHint = AvmPublicDataReadTreeHint.empty(), updatePreimage = []) {
|
|
199
|
+
this.avmCircuitHints.contractInstances.push(new AvmContractInstanceHint(contractAddress, exists, instance.salt, instance.deployer, instance.currentContractClassId, instance.originalContractClassId, instance.initializationHash, instance.publicKeys, updateMembershipHint, updatePreimage));
|
|
200
|
+
this.log.trace(`Tracing contract instance retrieval (counter=${this.sideEffectCounter})`);
|
|
201
|
+
this.incrementSideEffectCounter();
|
|
202
|
+
}
|
|
203
|
+
traceGetContractClass(contractClassId, exists, contractClass) {
|
|
204
|
+
if (!exists) {
|
|
205
|
+
this.avmCircuitHints.contractClasses.push(new AvmContractClassHint(contractClassId, exists, Fr.zero(), Fr.zero(), Fr.zero(), Buffer.alloc(0)));
|
|
206
|
+
} else if (!this.uniqueClassIds.has(contractClassId.toString())) {
|
|
207
|
+
if (this.uniqueClassIds.size() >= MAX_PUBLIC_CALLS_TO_UNIQUE_CONTRACT_CLASS_IDS) {
|
|
208
|
+
this.log.debug(`Bytecode retrieval failure for contract class ID ${contractClassId} (limit reached)`);
|
|
209
|
+
throw new SideEffectLimitReachedError('contract calls to unique class IDs', MAX_PUBLIC_CALLS_TO_UNIQUE_CONTRACT_CLASS_IDS);
|
|
210
|
+
}
|
|
211
|
+
this.uniqueClassIds.add(contractClassId.toString());
|
|
212
|
+
this.avmCircuitHints.contractClasses.push(new AvmContractClassHint(contractClassId, exists, contractClass.artifactHash, contractClass.privateFunctionsRoot, contractClass.publicBytecodeCommitment, contractClass.packedBytecode));
|
|
213
|
+
this.incrementSideEffectCounter();
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Trace an enqueued call.
|
|
218
|
+
* Accept some results from a finished call's trace into this one.
|
|
219
|
+
*/ traceEnqueuedCall(/** The call request from private that enqueued this call. */ publicCallRequest, /** The call's calldata */ calldata, /** Did the call revert? */ _reverted) {
|
|
220
|
+
// TODO(4805): check if some threshold is reached for max enqueued or nested calls (to unique contracts?)
|
|
221
|
+
this.enqueuedCalls.push(publicCallRequest);
|
|
222
|
+
this.avmCircuitHints.enqueuedCalls.push(new AvmEnqueuedCallHint(publicCallRequest.contractAddress, calldata));
|
|
223
|
+
}
|
|
224
|
+
getSideEffects() {
|
|
225
|
+
return {
|
|
226
|
+
enqueuedCalls: this.enqueuedCalls,
|
|
227
|
+
publicDataWrites: this.publicDataWrites,
|
|
228
|
+
noteHashes: this.noteHashes,
|
|
229
|
+
nullifiers: this.nullifiers,
|
|
230
|
+
l2ToL1Msgs: this.l2ToL1Messages,
|
|
231
|
+
publicLogs: this.publicLogs
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
toAvmCircuitPublicInputs(/** Globals. */ globalVariables, /** Start tree snapshots. */ startTreeSnapshots, /** Gas used at start of TX. */ startGasUsed, /** How much gas was available for this public execution. */ gasLimits, /** Address of the fee payer. */ feePayer, /** Call requests for setup phase. */ publicSetupCallRequests, /** Call requests for app logic phase. */ publicAppLogicCallRequests, /** Call request for teardown phase. */ publicTeardownCallRequest, /** End tree snapshots. */ endTreeSnapshots, /**
|
|
235
|
+
* Gas used by the whole transaction, assuming entire teardown limit is used.
|
|
236
|
+
* This is the gas used when computing transaction fee.
|
|
237
|
+
*/ endGasUsed, /** Transaction fee. */ transactionFee, /** The call's results */ reverted) {
|
|
238
|
+
return new AvmCircuitPublicInputs(globalVariables, startTreeSnapshots, startGasUsed, gasLimits, feePayer, padArrayEnd(publicSetupCallRequests, PublicCallRequest.empty(), MAX_ENQUEUED_CALLS_PER_TX), padArrayEnd(publicAppLogicCallRequests, PublicCallRequest.empty(), MAX_ENQUEUED_CALLS_PER_TX), publicTeardownCallRequest, /*previousNonRevertibleAccumulatedDataArrayLengths=*/ PrivateToAvmAccumulatedDataArrayLengths.empty(), /*previousRevertibleAccumulatedDataArrayLengths=*/ PrivateToAvmAccumulatedDataArrayLengths.empty(), /*previousNonRevertibleAccumulatedDataArray=*/ PrivateToAvmAccumulatedData.empty(), /*previousRevertibleAccumulatedDataArray=*/ PrivateToAvmAccumulatedData.empty(), endTreeSnapshots, endGasUsed, /*accumulatedData=*/ this.getAvmAccumulatedData(), transactionFee, reverted);
|
|
239
|
+
}
|
|
240
|
+
getPublicLogs() {
|
|
241
|
+
return this.publicLogs;
|
|
242
|
+
}
|
|
243
|
+
getAvmCircuitHints() {
|
|
244
|
+
return this.avmCircuitHints;
|
|
245
|
+
}
|
|
246
|
+
getAvmAccumulatedData() {
|
|
247
|
+
return new AvmAccumulatedData(padArrayEnd(this.noteHashes.map((n)=>n.value), Fr.zero(), MAX_NOTE_HASHES_PER_TX), padArrayEnd(this.nullifiers.map((n)=>n.value), Fr.zero(), MAX_NULLIFIERS_PER_TX), padArrayEnd(this.l2ToL1Messages, ScopedL2ToL1Message.empty(), MAX_L2_TO_L1_MSGS_PER_TX), padArrayEnd(this.publicLogs, PublicLog.empty(), MAX_PUBLIC_LOGS_PER_TX), padArrayEnd(this.publicDataWrites.map((w)=>new PublicDataWrite(w.leafSlot, w.newValue)), PublicDataWrite.empty(), MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX));
|
|
248
|
+
}
|
|
249
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Fr } from '@aztec/foundation/fields';
|
|
2
|
+
import type { AvmPublicDataReadTreeHint } from '@aztec/stdlib/avm';
|
|
3
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
+
import type { ContractClassWithCommitment, SerializableContractInstance } from '@aztec/stdlib/contract';
|
|
5
|
+
import type { PublicCallRequest } from '@aztec/stdlib/kernel';
|
|
6
|
+
import type { PublicLog } from '@aztec/stdlib/logs';
|
|
7
|
+
import type { NullifierLeafPreimage, PublicDataTreeLeafPreimage } from '@aztec/stdlib/trees';
|
|
8
|
+
export interface PublicSideEffectTraceInterface {
|
|
9
|
+
fork(): PublicSideEffectTraceInterface;
|
|
10
|
+
merge(nestedTrace: PublicSideEffectTraceInterface, reverted?: boolean): void;
|
|
11
|
+
getCounter(): number;
|
|
12
|
+
tracePublicStorageRead(contractAddress: AztecAddress, slot: Fr, value: Fr, leafPreimage?: PublicDataTreeLeafPreimage, leafIndex?: Fr, path?: Fr[]): void;
|
|
13
|
+
tracePublicStorageWrite(contractAddress: AztecAddress, slot: Fr, // This is the storage slot not the computed leaf slot
|
|
14
|
+
value: Fr, protocolWrite: boolean, lowLeafPreimage?: PublicDataTreeLeafPreimage, lowLeafIndex?: Fr, lowLeafPath?: Fr[], newLeafPreimage?: PublicDataTreeLeafPreimage, insertionPath?: Fr[]): Promise<void>;
|
|
15
|
+
traceNoteHashCheck(contractAddress: AztecAddress, noteHash: Fr, leafIndex: Fr, exists: boolean, path?: Fr[]): void;
|
|
16
|
+
traceNewNoteHash(uniqueNoteHash: Fr, leafIndex?: Fr, path?: Fr[]): void;
|
|
17
|
+
getNoteHashCount(): number;
|
|
18
|
+
traceNullifierCheck(siloedNullifier: Fr, exists: boolean, lowLeafPreimage?: NullifierLeafPreimage, lowLeafIndex?: Fr, lowLeafPath?: Fr[]): void;
|
|
19
|
+
traceNewNullifier(siloedNullifier: Fr, lowLeafPreimage?: NullifierLeafPreimage, lowLeafIndex?: Fr, lowLeafPath?: Fr[], insertionPath?: Fr[]): void;
|
|
20
|
+
traceL1ToL2MessageCheck(contractAddress: AztecAddress, msgHash: Fr, msgLeafIndex: Fr, exists: boolean, path?: Fr[]): void;
|
|
21
|
+
traceNewL2ToL1Message(contractAddress: AztecAddress, recipient: Fr, content: Fr): void;
|
|
22
|
+
tracePublicLog(contractAddress: AztecAddress, log: Fr[]): void;
|
|
23
|
+
traceGetContractInstance(contractAddress: AztecAddress, exists: boolean, instance?: SerializableContractInstance, updateMembershipHint?: AvmPublicDataReadTreeHint, updatePreimage?: Fr[]): void;
|
|
24
|
+
traceGetContractClass(contractClassId: Fr, exists: boolean, contractClass?: ContractClassWithCommitment): void;
|
|
25
|
+
traceEnqueuedCall(
|
|
26
|
+
/** The call request from private that enqueued this call. */
|
|
27
|
+
publicCallRequest: PublicCallRequest,
|
|
28
|
+
/** The call's calldata */
|
|
29
|
+
calldata: Fr[],
|
|
30
|
+
/** Did the call revert? */
|
|
31
|
+
reverted: boolean): void;
|
|
32
|
+
getPublicLogs(): PublicLog[];
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=side_effect_trace_interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"side_effect_trace_interface.d.ts","sourceRoot":"","sources":["../../src/public/side_effect_trace_interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AACxG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,qBAAqB,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAE7F,MAAM,WAAW,8BAA8B;IAC7C,IAAI,IAAI,8BAA8B,CAAC;IACvC,KAAK,CAAC,WAAW,EAAE,8BAA8B,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC7E,UAAU,IAAI,MAAM,CAAC;IAErB,sBAAsB,CACpB,eAAe,EAAE,YAAY,EAC7B,IAAI,EAAE,EAAE,EACR,KAAK,EAAE,EAAE,EACT,YAAY,CAAC,EAAE,0BAA0B,EACzC,SAAS,CAAC,EAAE,EAAE,EACd,IAAI,CAAC,EAAE,EAAE,EAAE,GACV,IAAI,CAAC;IACR,uBAAuB,CACrB,eAAe,EAAE,YAAY,EAC7B,IAAI,EAAE,EAAE,EAAE,sDAAsD;IAChE,KAAK,EAAE,EAAE,EACT,aAAa,EAAE,OAAO,EACtB,eAAe,CAAC,EAAE,0BAA0B,EAC5C,YAAY,CAAC,EAAE,EAAE,EACjB,WAAW,CAAC,EAAE,EAAE,EAAE,EAClB,eAAe,CAAC,EAAE,0BAA0B,EAC5C,aAAa,CAAC,EAAE,EAAE,EAAE,GACnB,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,kBAAkB,CAAC,eAAe,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC;IACnH,gBAAgB,CAAC,cAAc,EAAE,EAAE,EAAE,SAAS,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC;IACxE,gBAAgB,IAAI,MAAM,CAAC;IAC3B,mBAAmB,CACjB,eAAe,EAAE,EAAE,EACnB,MAAM,EAAE,OAAO,EACf,eAAe,CAAC,EAAE,qBAAqB,EACvC,YAAY,CAAC,EAAE,EAAE,EACjB,WAAW,CAAC,EAAE,EAAE,EAAE,GACjB,IAAI,CAAC;IACR,iBAAiB,CACf,eAAe,EAAE,EAAE,EACnB,eAAe,CAAC,EAAE,qBAAqB,EACvC,YAAY,CAAC,EAAE,EAAE,EACjB,WAAW,CAAC,EAAE,EAAE,EAAE,EAClB,aAAa,CAAC,EAAE,EAAE,EAAE,GACnB,IAAI,CAAC;IACR,uBAAuB,CACrB,eAAe,EAAE,YAAY,EAC7B,OAAO,EAAE,EAAE,EACX,YAAY,EAAE,EAAE,EAChB,MAAM,EAAE,OAAO,EACf,IAAI,CAAC,EAAE,EAAE,EAAE,GACV,IAAI,CAAC;IACR,qBAAqB,CAAC,eAAe,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC;IACvF,cAAc,CAAC,eAAe,EAAE,YAAY,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC;IAC/D,wBAAwB,CACtB,eAAe,EAAE,YAAY,EAC7B,MAAM,EAAE,OAAO,EACf,QAAQ,CAAC,EAAE,4BAA4B,EACvC,oBAAoB,CAAC,EAAE,yBAAyB,EAChD,cAAc,CAAC,EAAE,EAAE,EAAE,GACpB,IAAI,CAAC;IACR,qBAAqB,CAAC,eAAe,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,CAAC,EAAE,2BAA2B,GAAG,IAAI,CAAC;IAC/G,iBAAiB;IACf,6DAA6D;IAC7D,iBAAiB,EAAE,iBAAiB;IACpC,0BAA0B;IAC1B,QAAQ,EAAE,EAAE,EAAE;IACd,2BAA2B;IAC3B,QAAQ,EAAE,OAAO,GAChB,IAAI,CAAC;IACR,aAAa,IAAI,SAAS,EAAE,CAAC;CAC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Fr } from '@aztec/foundation/fields';
|
|
2
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
+
import type { ContractClassPublic, ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
4
|
+
/**
|
|
5
|
+
* A cache for contract classes and instances for a single transaction.
|
|
6
|
+
* Useful for tracking/retrieving contracts for a tx while leaving
|
|
7
|
+
* the option to clear them if the tx is reverted.
|
|
8
|
+
*/
|
|
9
|
+
export declare class TxContractCache {
|
|
10
|
+
private instanceCache;
|
|
11
|
+
private classCache;
|
|
12
|
+
/**
|
|
13
|
+
* Add a contract instance to the cache
|
|
14
|
+
*/
|
|
15
|
+
addInstance(address: AztecAddress, instance: ContractInstanceWithAddress): void;
|
|
16
|
+
/**
|
|
17
|
+
* Add a contract class to the cache
|
|
18
|
+
*/
|
|
19
|
+
addClass(classId: Fr, contractClass: ContractClassPublic): void;
|
|
20
|
+
/**
|
|
21
|
+
* Get a contract instance from the cache
|
|
22
|
+
*/
|
|
23
|
+
getInstance(address: AztecAddress): ContractInstanceWithAddress | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Get a contract class from the cache
|
|
26
|
+
*/
|
|
27
|
+
getClass(classId: Fr): ContractClassPublic | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Check if the cache has a contract class
|
|
30
|
+
*/
|
|
31
|
+
hasClass(classId: Fr): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Clear all entries from the cache
|
|
34
|
+
*/
|
|
35
|
+
clear(): void;
|
|
36
|
+
/**
|
|
37
|
+
* Merge another cache into this one
|
|
38
|
+
*/
|
|
39
|
+
mergeFrom(other: TxContractCache): void;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=tx_contract_cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tx_contract_cache.d.ts","sourceRoot":"","sources":["../../src/public/tx_contract_cache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAE/F;;;;GAIG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,aAAa,CAAkD;IACvE,OAAO,CAAC,UAAU,CAA0C;IAE5D;;OAEG;IACI,WAAW,CAAC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,2BAA2B,GAAG,IAAI;IAItF;;OAEG;IACI,QAAQ,CAAC,OAAO,EAAE,EAAE,EAAE,aAAa,EAAE,mBAAmB,GAAG,IAAI;IAItE;;OAEG;IACI,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,2BAA2B,GAAG,SAAS;IAIlF;;OAEG;IACI,QAAQ,CAAC,OAAO,EAAE,EAAE,GAAG,mBAAmB,GAAG,SAAS;IAI7D;;OAEG;IACI,QAAQ,CAAC,OAAO,EAAE,EAAE,GAAG,OAAO;IAIrC;;OAEG;IACI,KAAK,IAAI,IAAI;IAKpB;;OAEG;IACI,SAAS,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI;CAS/C"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A cache for contract classes and instances for a single transaction.
|
|
3
|
+
* Useful for tracking/retrieving contracts for a tx while leaving
|
|
4
|
+
* the option to clear them if the tx is reverted.
|
|
5
|
+
*/ export class TxContractCache {
|
|
6
|
+
instanceCache = new Map();
|
|
7
|
+
classCache = new Map();
|
|
8
|
+
/**
|
|
9
|
+
* Add a contract instance to the cache
|
|
10
|
+
*/ addInstance(address, instance) {
|
|
11
|
+
this.instanceCache.set(address.toString(), instance);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Add a contract class to the cache
|
|
15
|
+
*/ addClass(classId, contractClass) {
|
|
16
|
+
this.classCache.set(classId.toString(), contractClass);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Get a contract instance from the cache
|
|
20
|
+
*/ getInstance(address) {
|
|
21
|
+
return this.instanceCache.get(address.toString());
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Get a contract class from the cache
|
|
25
|
+
*/ getClass(classId) {
|
|
26
|
+
return this.classCache.get(classId.toString());
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Check if the cache has a contract class
|
|
30
|
+
*/ hasClass(classId) {
|
|
31
|
+
return this.classCache.has(classId.toString());
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Clear all entries from the cache
|
|
35
|
+
*/ clear() {
|
|
36
|
+
this.instanceCache.clear();
|
|
37
|
+
this.classCache.clear();
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Merge another cache into this one
|
|
41
|
+
*/ mergeFrom(other) {
|
|
42
|
+
other.instanceCache.forEach((value, key)=>{
|
|
43
|
+
this.instanceCache.set(key, value);
|
|
44
|
+
});
|
|
45
|
+
other.classCache.forEach((value, key)=>{
|
|
46
|
+
this.classCache.set(key, value);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A class manage a de-duplicated set of class IDs that errors if you try to add a duplicate.
|
|
3
|
+
* Useful for bytecode retrieval hints to avoid duplicates in parent trace & grandparent trace....
|
|
4
|
+
*/
|
|
5
|
+
export declare class UniqueClassIds {
|
|
6
|
+
private readonly parent?;
|
|
7
|
+
private readonly classIds;
|
|
8
|
+
constructor(parent?: UniqueClassIds | undefined);
|
|
9
|
+
/**
|
|
10
|
+
* Create a fork that references this one as its parent
|
|
11
|
+
*/
|
|
12
|
+
fork(): UniqueClassIds;
|
|
13
|
+
/**
|
|
14
|
+
* Check for a class ID here or in parent's (recursively).
|
|
15
|
+
*
|
|
16
|
+
* @param classId - the contract class ID (as a string) to check
|
|
17
|
+
* @returns boolean: whether the class ID is here
|
|
18
|
+
*/
|
|
19
|
+
has(classId: string): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Get the total number of classIds
|
|
22
|
+
*/
|
|
23
|
+
size(): number;
|
|
24
|
+
/**
|
|
25
|
+
* Add a class ID (if not already present) to the set.
|
|
26
|
+
*
|
|
27
|
+
* @param classId - the contract class ID (as a string)
|
|
28
|
+
*/
|
|
29
|
+
add(classId: string): void;
|
|
30
|
+
/**
|
|
31
|
+
* Merge in another set of unique class IDs into this one, but fail on duplicates.
|
|
32
|
+
*
|
|
33
|
+
* @param incoming: other unique class IDs
|
|
34
|
+
*/
|
|
35
|
+
acceptAndMerge(incoming: UniqueClassIds): void;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=unique_class_ids.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unique_class_ids.d.ts","sourceRoot":"","sources":["../../src/public/unique_class_ids.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,qBAAa,cAAc;IAGb,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;IAFpC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA0B;gBAEtB,MAAM,CAAC,4BAAgB;IAEpD;;OAEG;IACI,IAAI;IAIX;;;;;OAKG;IACI,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAWpC;;OAEG;IACI,IAAI,IAAI,MAAM;IAIrB;;;;OAIG;IACI,GAAG,CAAC,OAAO,EAAE,MAAM;IAW1B;;;;OAIG;IACI,cAAc,CAAC,QAAQ,EAAE,cAAc;CAc/C"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { MAX_PUBLIC_CALLS_TO_UNIQUE_CONTRACT_CLASS_IDS } from '@aztec/constants';
|
|
2
|
+
import { strict as assert } from 'assert';
|
|
3
|
+
/**
|
|
4
|
+
* A class manage a de-duplicated set of class IDs that errors if you try to add a duplicate.
|
|
5
|
+
* Useful for bytecode retrieval hints to avoid duplicates in parent trace & grandparent trace....
|
|
6
|
+
*/ export class UniqueClassIds {
|
|
7
|
+
parent;
|
|
8
|
+
classIds;
|
|
9
|
+
constructor(parent){
|
|
10
|
+
this.parent = parent;
|
|
11
|
+
this.classIds = new Set();
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Create a fork that references this one as its parent
|
|
15
|
+
*/ fork() {
|
|
16
|
+
return new UniqueClassIds(/*parent=*/ this);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Check for a class ID here or in parent's (recursively).
|
|
20
|
+
*
|
|
21
|
+
* @param classId - the contract class ID (as a string) to check
|
|
22
|
+
* @returns boolean: whether the class ID is here
|
|
23
|
+
*/ has(classId) {
|
|
24
|
+
// First try check this' classIds
|
|
25
|
+
let here = this.classIds.has(classId);
|
|
26
|
+
// Then try parent's
|
|
27
|
+
if (!here && this.parent) {
|
|
28
|
+
// Note: this will recurse to grandparent/etc until we reach top or find it
|
|
29
|
+
here = this.parent.has(classId);
|
|
30
|
+
}
|
|
31
|
+
return here;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Get the total number of classIds
|
|
35
|
+
*/ size() {
|
|
36
|
+
return this.classIds.size + (this.parent ? this.parent.size() : 0);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Add a class ID (if not already present) to the set.
|
|
40
|
+
*
|
|
41
|
+
* @param classId - the contract class ID (as a string)
|
|
42
|
+
*/ add(classId) {
|
|
43
|
+
assert(!this.has(classId), `Bug! Tried to add duplicate classId ${classId} to set of unique classIds.`);
|
|
44
|
+
if (!this.has(classId)) {
|
|
45
|
+
this.classIds.add(classId);
|
|
46
|
+
assert(this.size() <= MAX_PUBLIC_CALLS_TO_UNIQUE_CONTRACT_CLASS_IDS, `Bug! Surpassed limit (${MAX_PUBLIC_CALLS_TO_UNIQUE_CONTRACT_CLASS_IDS}) of unique contract class IDs used for bytecode retrievals.`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Merge in another set of unique class IDs into this one, but fail on duplicates.
|
|
51
|
+
*
|
|
52
|
+
* @param incoming: other unique class IDs
|
|
53
|
+
*/ acceptAndMerge(incoming) {
|
|
54
|
+
for (const classId of incoming.classIds.keys()){
|
|
55
|
+
assert(!this.has(classId), `Bug! Cannot merge classId ${classId} into set of unique classIds as it already exists.`);
|
|
56
|
+
this.classIds.add(classId);
|
|
57
|
+
}
|
|
58
|
+
// since set() has an assertion, and size() always checks parent, this should be impossible
|
|
59
|
+
assert(this.size() <= MAX_PUBLIC_CALLS_TO_UNIQUE_CONTRACT_CLASS_IDS, `Bug! Merging unique class Ids should never exceed the limit of ${MAX_PUBLIC_CALLS_TO_UNIQUE_CONTRACT_CLASS_IDS}.`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PublicCallRequest } from '@aztec/stdlib/kernel';
|
|
2
|
+
import { type PublicExecutionRequest, type Tx, TxExecutionPhase } from '@aztec/stdlib/tx';
|
|
3
|
+
export declare function getExecutionRequestsByPhase(tx: Tx, phase: TxExecutionPhase): PublicExecutionRequest[];
|
|
4
|
+
export declare function getCallRequestsByPhase(tx: Tx, phase: TxExecutionPhase): PublicCallRequest[];
|
|
5
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/public/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,KAAK,sBAAsB,EAAE,KAAK,EAAE,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAE1F,wBAAgB,2BAA2B,CAAC,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,gBAAgB,GAAG,sBAAsB,EAAE,CAarG;AAED,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,gBAAgB,GAAG,iBAAiB,EAAE,CAa3F"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { TxExecutionPhase } from '@aztec/stdlib/tx';
|
|
2
|
+
export function getExecutionRequestsByPhase(tx, phase) {
|
|
3
|
+
switch(phase){
|
|
4
|
+
case TxExecutionPhase.SETUP:
|
|
5
|
+
return tx.getNonRevertiblePublicExecutionRequests();
|
|
6
|
+
case TxExecutionPhase.APP_LOGIC:
|
|
7
|
+
return tx.getRevertiblePublicExecutionRequests();
|
|
8
|
+
case TxExecutionPhase.TEARDOWN:
|
|
9
|
+
{
|
|
10
|
+
const request = tx.getPublicTeardownExecutionRequest();
|
|
11
|
+
return request ? [
|
|
12
|
+
request
|
|
13
|
+
] : [];
|
|
14
|
+
}
|
|
15
|
+
default:
|
|
16
|
+
throw new Error(`Unknown phase: ${phase}`);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export function getCallRequestsByPhase(tx, phase) {
|
|
20
|
+
switch(phase){
|
|
21
|
+
case TxExecutionPhase.SETUP:
|
|
22
|
+
return tx.data.getNonRevertiblePublicCallRequests();
|
|
23
|
+
case TxExecutionPhase.APP_LOGIC:
|
|
24
|
+
return tx.data.getRevertiblePublicCallRequests();
|
|
25
|
+
case TxExecutionPhase.TEARDOWN:
|
|
26
|
+
{
|
|
27
|
+
const request = tx.data.getTeardownPublicCallRequest();
|
|
28
|
+
return request ? [
|
|
29
|
+
request
|
|
30
|
+
] : [];
|
|
31
|
+
}
|
|
32
|
+
default:
|
|
33
|
+
throw new Error(`Unknown phase: ${phase}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
package/dest/server.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './public/index.js';
|
|
2
|
+
export { WASMSimulatorWithBlobs } from './private/providers/acvm_wasm_with_blobs.js';
|
|
3
|
+
export { NativeACVMSimulator } from './private/providers/acvm_native.js';
|
|
4
|
+
export { type SimulationProvider } from './private/providers/simulation_provider.js';
|
|
5
|
+
export * from './common/index.js';
|
|
6
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AACrF,cAAc,mBAAmB,CAAC"}
|
package/dest/server.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
+
import { L1ToL2Message } from '@aztec/stdlib/messaging';
|
|
4
|
+
/**
|
|
5
|
+
* Test utility function to craft an L1 to L2 message.
|
|
6
|
+
* @param selector - The cross chain message selector.
|
|
7
|
+
* @param contentPreimage - The args after the selector.
|
|
8
|
+
* @param targetContract - The contract to consume the message.
|
|
9
|
+
* @param secret - The secret to unlock the message.
|
|
10
|
+
* @returns The L1 to L2 message.
|
|
11
|
+
*/
|
|
12
|
+
export declare const buildL1ToL2Message: (selector: string, contentPreimage: Fr[], targetContract: AztecAddress, secret: Fr, msgIndex: Fr | number) => Promise<L1ToL2Message>;
|
|
13
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/test/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAW,aAAa,EAAW,MAAM,yBAAyB,CAAC;AAE1E;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,aACnB,MAAM,mBACC,EAAE,EAAE,kBACL,YAAY,UACpB,EAAE,YACA,EAAE,GAAG,MAAM,2BAetB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { sha256ToField } from '@aztec/foundation/crypto';
|
|
2
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
4
|
+
import { computeSecretHash } from '@aztec/stdlib/hash';
|
|
5
|
+
import { L1Actor, L1ToL2Message, L2Actor } from '@aztec/stdlib/messaging';
|
|
6
|
+
/**
|
|
7
|
+
* Test utility function to craft an L1 to L2 message.
|
|
8
|
+
* @param selector - The cross chain message selector.
|
|
9
|
+
* @param contentPreimage - The args after the selector.
|
|
10
|
+
* @param targetContract - The contract to consume the message.
|
|
11
|
+
* @param secret - The secret to unlock the message.
|
|
12
|
+
* @returns The L1 to L2 message.
|
|
13
|
+
*/ export const buildL1ToL2Message = async (selector, contentPreimage, targetContract, secret, msgIndex)=>{
|
|
14
|
+
// Write the selector into a buffer.
|
|
15
|
+
const selectorBuf = Buffer.from(selector, 'hex');
|
|
16
|
+
const content = sha256ToField([
|
|
17
|
+
selectorBuf,
|
|
18
|
+
...contentPreimage
|
|
19
|
+
]);
|
|
20
|
+
const secretHash = await computeSecretHash(secret);
|
|
21
|
+
return new L1ToL2Message(new L1Actor(EthAddress.random(), 1), new L2Actor(targetContract, 1), content, secretHash, new Fr(msgIndex));
|
|
22
|
+
};
|