2025-10-07 11:20:26 +01:00

138 lines
3.7 KiB
Plaintext

# Info: KCL Polkadot Zombienet task schemas for provisioning (Provisioning)
# Author: Provisioning System
# Release: 0.0.1
# Date: 2025-07-24
import regex
schema User:
"""
User settings for Zombienet
"""
name: str
group: str = name
home?: str = "/home/${name}"
schema RelayChainNode:
"""
Relay chain node configuration
"""
name: str
image?: str = "parity/polkadot:latest"
command?: str = "polkadot"
args?: [str] = []
validator: bool = True
balance?: int = 1000000000000
check:
len(name) > 0, "Node name cannot be empty"
schema CollatorNode:
"""
Parachain collator node configuration
"""
name: str
image?: str = "parity/polkadot-parachain:latest"
command?: str = "polkadot-parachain"
args?: [str] = []
balance?: int = 1000000000000
check:
len(name) > 0, "Collator name cannot be empty"
schema Parachain:
"""
Parachain configuration
"""
id: int
chain?: str
balance?: int = 1000000
collators: [CollatorNode] = []
genesis_wasm?: str
genesis_state?: str
check:
1 <= id <= 4000, "Parachain ID must be between 1 and 4000"
len(collators) > 0, "At least one collator required"
schema RelayChain:
"""
Relay chain configuration
"""
chain: "rococo-local" | "westend-local" | "kusama-local" | "polkadot-local" = "rococo-local"
default_image?: str = "parity/polkadot:latest"
default_command?: str = "polkadot"
nodes: [RelayChainNode] = []
genesis?: str
runtime_genesis_patch?: str
check:
len(nodes) >= 2, "At least 2 relay chain nodes required"
schema Settings:
"""
Zombienet settings configuration
"""
timeout: int = 1000
node_spawn_timeout?: int = 300
provider: "native" | "kubernetes" | "podman" = "native"
enable_tracing?: bool = False
backchannel?: bool = True
check:
timeout > 0, "Timeout must be positive"
node_spawn_timeout == Undefined or node_spawn_timeout > 0, "Node spawn timeout must be positive"
schema KubernetesProvider:
"""
Kubernetes provider specific configuration
"""
namespace?: str = "zombienet"
monitoring?: bool = True
prometheus_prefix?: str = "substrate_"
schema PodmanProvider:
"""
Podman provider specific configuration
"""
monitoring?: bool = True
monitoring_port?: int = 9090
check:
monitoring_port == Undefined or (1 <= monitoring_port <= 65535), "Monitoring port must be between 1 and 65535"
schema NativeProvider:
"""
Native provider specific configuration
"""
monitoring?: bool = False
schema PolkadotZombienet:
"""
Polkadot Zombienet configuration
"""
name: str = "polkadot-zombienet"
version: str = "1.3.133"
run_user: User = {
name = "zombienet"
}
work_path: str = "/var/lib/zombienet"
config_path: str = "/etc/zombienet"
bin_path: str = "/usr/local/bin"
zombienet_binary: str = "zombienet"
networks_path: str = "/var/lib/zombienet/networks"
binaries_path: str = "/var/lib/zombienet/binaries"
logs_path: str = "/var/lib/zombienet/logs"
settings: Settings = {}
relaychain: RelayChain = {}
parachains: [Parachain] = []
kubernetes_config?: KubernetesProvider = {}
podman_config?: PodmanProvider = {}
native_config?: NativeProvider = {}
log_level: "error" | "warn" | "info" | "debug" | "trace" = "info"
check:
len(run_user.name) > 0, "Check run_user name"
len(work_path) > 0, "Check work_path"
len(config_path) > 0, "Check config_path"
len(relaychain.nodes) >= 2, "At least 2 relay chain nodes required"