# Polkadot Virtual Machine (PVM) Runtime Configuration
# Generated by provisioning system

[runtime]
name = "{{ polkadot_solochain.runtime.name }}"
version = "{{ polkadot_solochain.runtime.version }}"
pvm_enabled = {{ polkadot_solochain.runtime.pvm_enabled | lower }}

[execution]
wasm_execution = "{{ polkadot_solochain.runtime.wasm_execution }}"
native_execution_available = true
heap_pages = {{ polkadot_solochain.runtime.heap_pages }}

[limits]
max_block_weight = {{ polkadot_solochain.runtime.max_block_weight }}
max_block_length = {{ polkadot_solochain.runtime.max_block_length }}
max_extrinsic_weight = {{ (polkadot_solochain.runtime.max_block_weight * 0.75) | int }}

[pallets]
{% for pallet in polkadot_solochain.runtime.pallets %}
{{ pallet }} = true
{% endfor %}

{% if polkadot_solochain.runtime.pvm_enabled %}
[pvm]
# Polkadot Virtual Machine specific configurations
enabled = true
version = "1.0"

# PVM execution parameters
max_code_size = 2097152  # 2MB
max_heap_pages = {{ polkadot_solochain.runtime.heap_pages }}
max_stack_size = 1048576  # 1MB
max_memory_pages = 1024

# WebAssembly runtime parameters
wasm_instantiation_strategy = "legacy-instance-reuse"
wasm_bulk_memory = true
wasm_reference_types = false
wasm_simd = false
wasm_multi_value = true

# Runtime cache configuration
runtime_cache_size = 8
{% endif %}

[performance]
state_cache_size = {{ polkadot_solochain.state_cache_size }}
database_cache = 128
{% if polkadot_solochain.wasm_runtime_overrides is defined %}
wasm_runtime_overrides_dir = "{{ polkadot_solochain.wasm_runtime_overrides }}"
{% endif %}