Skip to content

Commit 9501b9e

Browse files
committed
llms
1 parent 61d08fb commit 9501b9e

File tree

6 files changed

+1077
-11
lines changed

6 files changed

+1077
-11
lines changed

.ai/categories/parachains.md

Lines changed: 325 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13145,3 +13145,328 @@ Key features include:
1314513145
- **Comprehensive documentation**: Includes usage guides and API references for both packages.
1314613146

1314713147
For detailed usage examples and API documentation, visit the [official Moonbeam XCM SDK documentation](https://moonbeam-foundation.github.io/xcm-sdk/latest/){target=\_blank}.
13148+
13149+
13150+
---
13151+
13152+
Page Title: Zombienet
13153+
13154+
- Source (raw): https://raw.githubusercontent.com/polkadot-developers/polkadot-docs/master/.ai/pages/reference-tools-zombienet.md
13155+
- Canonical (HTML): https://docs.polkadot.com/reference/tools/zombienet/
13156+
- Summary: Zombienet is a testing framework for Polkadot SDK-based blockchain networks, enabling developers to deploy and test ephemeral environments across various platforms.
13157+
13158+
# Zombienet
13159+
13160+
## Introduction
13161+
13162+
Zombienet is a testing framework designed for Polkadot SDK-based blockchain networks. It enables developers to efficiently deploy and test ephemeral blockchain environments on platforms like Kubernetes, Podman, and native setups. With its simple CLI and Domain Specific Language (DSL) for writing tests, Zombienet streamlines network spawning, testing, and performance validation.
13163+
13164+
Key features include:
13165+
13166+
- **Multi-provider support**: Run networks on Kubernetes, Podman, or locally as native processes.
13167+
- **Network orchestration**: Spawn relay chains with multiple validators and parachains with collators.
13168+
- **Test DSL**: Write natural-language test scripts to evaluate metrics, logs, events, and on-chain storage.
13169+
- **Monitoring integration**: Built-in support for Prometheus, Grafana, and Tempo on supported providers.
13170+
13171+
## Install Zombienet
13172+
13173+
Zombienet releases are available on the [Zombienet repository](https://github.com/paritytech/zombienet){target=\_blank}. Choose one of the following installation methods:
13174+
13175+
=== "Use the executable"
13176+
13177+
Download the appropriate executable for your operating system from the [latest release](https://github.com/paritytech/zombienet/releases){target=\_blank} page. Each release includes executables for Linux and macOS.
13178+
13179+
Make the downloaded file executable:
13180+
13181+
```bash
13182+
chmod +x zombienet-macos-arm64
13183+
```
13184+
13185+
Verify the installation:
13186+
13187+
```bash
13188+
./zombienet-macos-arm64 version
13189+
```
13190+
13191+
Optionally, move the executable to your PATH:
13192+
13193+
```bash
13194+
mv zombienet-macos-arm64 /usr/local/bin/zombienet
13195+
```
13196+
13197+
Now you can use the `zombienet` command directly:
13198+
13199+
```bash
13200+
zombienet version
13201+
```
13202+
13203+
=== "Use Nix"
13204+
13205+
For Nix users, the Zombienet repository provides a [`flake.nix`](https://github.com/paritytech/zombienet/blob/main/flake.nix){target=\_blank} file. You need [Flakes](https://nixos.wiki/wiki/Flakes#Enable_flakes){target=\_blank} enabled.
13206+
13207+
Run Zombienet directly:
13208+
13209+
```bash
13210+
nix run github:paritytech/zombienet/INSERT_ZOMBIENET_VERSION -- \
13211+
spawn INSERT_ZOMBIENET_CONFIG_FILE_NAME.toml
13212+
```
13213+
13214+
Or include Zombienet in your current shell:
13215+
13216+
```bash
13217+
nix shell github:paritytech/zombienet/INSERT_ZOMBIENET_VERSION
13218+
```
13219+
13220+
=== "Use Docker"
13221+
13222+
Run Zombienet using Docker:
13223+
13224+
```bash
13225+
docker run -it --rm \
13226+
-v $(pwd):/home/nonroot/zombie-net/host-current-files \
13227+
paritytech/zombienet
13228+
```
13229+
13230+
Inside the container, set up the necessary binaries:
13231+
13232+
```bash
13233+
npm run zombie -- setup polkadot polkadot-parachain
13234+
```
13235+
13236+
Add the binaries to your PATH:
13237+
13238+
```bash
13239+
export PATH=/home/nonroot/zombie-net:$PATH
13240+
```
13241+
13242+
Spawn a network:
13243+
13244+
```bash
13245+
npm run zombie -- -p native spawn host-current-files/minimal.toml
13246+
```
13247+
13248+
## Providers
13249+
13250+
Zombienet supports different backend providers for running nodes: [Kubernetes](https://kubernetes.io/){target=\_blank}, [Podman](https://podman.io/){target=\_blank}, and native (local processes). Specify the provider using the `--provider` flag or in your network configuration file:
13251+
13252+
```bash
13253+
zombienet spawn network.toml --provider INSERT_PROVIDER
13254+
```
13255+
13256+
Or set it in the configuration:
13257+
13258+
```toml title="network.toml"
13259+
[settings]
13260+
provider = "INSERT_PROVIDER"
13261+
...
13262+
```
13263+
13264+
Ensure to replace `INSERT_PROVIDER` with the appropriate provider: `kubernetes`, `podman`, or `native`.
13265+
13266+
### Kubernetes
13267+
13268+
Kubernetes is compatible with [GKE](https://cloud.google.com/kubernetes-engine){target=\_blank}, [Docker Desktop](https://docs.docker.com/desktop/features/kubernetes/){target=\_blank}, and [kind](https://kind.sigs.k8s.io/){target=\_blank}.
13269+
13270+
- **Requirements**: Install [`kubectl`](https://kubernetes.io/docs/tasks/tools/#kubectl){target=\_blank} and ensure proper cluster permissions.
13271+
- **Features**: Uses Prometheus operator for monitoring when available.
13272+
13273+
### Podman
13274+
13275+
Podman is a daemonless container engine for Linux. Zombienet supports Podman rootless as a provider.
13276+
13277+
- **Requirements**: Install [Podman](https://podman.io/getting-started/installation){target=\_blank} on Linux.
13278+
13279+
- **Features**: Deploys Prometheus, Tempo, and Grafana for monitoring. Services are accessible at `http://127.0.0.1:34123` (Prometheus), `http://127.0.0.1:34125` (Tempo), and `http://127.0.0.1:41461` (Grafana).
13280+
13281+
### Native
13282+
13283+
The native provider runs nodes as local processes on your machine.
13284+
13285+
- **Requirements**: Have the necessary binaries (`polkadot`, `polkadot-parachain`) in your PATH. Install them using:
13286+
13287+
```bash
13288+
zombienet setup polkadot polkadot-parachain
13289+
```
13290+
13291+
For custom binaries, specify the path in your configuration or add them to your PATH:
13292+
13293+
```bash
13294+
export PATH=$PATH:INSERT_PATH_TO_BINARY
13295+
```
13296+
13297+
- **Features**: No additional monitoring features.
13298+
13299+
## Configure Zombienet
13300+
13301+
Zombienet uses JSON or TOML configuration files to define network topology, nodes, and parameters. The [Zombienet repository](https://github.com/paritytech/zombienet/tree/main/examples){target=\_blank} provides example configurations.
13302+
13303+
### Basic Configuration
13304+
13305+
A minimal configuration includes settings, relay chain configuration, and parachain configuration:
13306+
13307+
=== "TOML"
13308+
13309+
```toml title="basic-network.toml"
13310+
[settings]
13311+
timeout = 1000
13312+
13313+
[relaychain]
13314+
chain = "rococo-local"
13315+
default_command = "polkadot"
13316+
13317+
[[relaychain.nodes]]
13318+
name = "alice"
13319+
validator = true
13320+
13321+
[[relaychain.nodes]]
13322+
name = "bob"
13323+
validator = true
13324+
13325+
[[parachains]]
13326+
id = 1000
13327+
chain = "asset-hub-rococo-local"
13328+
13329+
[parachains.collator]
13330+
name = "collator-01"
13331+
command = "polkadot-parachain"
13332+
```
13333+
13334+
=== "JSON"
13335+
13336+
```json title="basic-network.json"
13337+
{
13338+
"settings": {
13339+
"timeout": 1000
13340+
},
13341+
"relaychain": {
13342+
"chain": "rococo-local",
13343+
"default_command": "polkadot",
13344+
"nodes": [
13345+
{
13346+
"name": "alice",
13347+
"validator": true
13348+
},
13349+
{
13350+
"name": "bob",
13351+
"validator": true
13352+
}
13353+
]
13354+
},
13355+
"parachains": [
13356+
{
13357+
"id": 1000,
13358+
"chain": "asset-hub-rococo-local",
13359+
"collator": {
13360+
"name": "collator-01",
13361+
"command": "polkadot-parachain"
13362+
}
13363+
}
13364+
]
13365+
}
13366+
```
13367+
13368+
### CLI Commands
13369+
13370+
Zombienet provides the following commands:
13371+
13372+
- **`spawn <networkConfig>`**: Spawn the network defined in the configuration file.
13373+
- **`test <testFile>`**: Run tests on the spawned network.
13374+
- **`setup <binaries>`**: Download and set up `polkadot` or `polkadot-parachain` binaries.
13375+
- **`convert <filePath>`**: Convert a [polkadot-launch](https://github.com/paritytech/polkadot-launch){target=\_blank} configuration to Zombienet format.
13376+
- **`version`**: Print Zombienet version.
13377+
- **`help`**: Print help information.
13378+
13379+
Common flags:
13380+
13381+
- **`-p`, `--provider`**: Override the provider.
13382+
- **`-d`, `--dir`**: Specify directory for network files.
13383+
- **`-m`, `--monitor`**: Start as monitor without auto cleanup.
13384+
- **`-c`, `--spawn-concurrency`**: Number of concurrent spawning processes.
13385+
13386+
## Spawn a Network
13387+
13388+
To spawn a network, create a configuration file and run:
13389+
13390+
```bash
13391+
zombienet spawn network.toml --provider native
13392+
```
13393+
13394+
Zombienet will:
13395+
13396+
1. Download or locate the required binaries.
13397+
2. Generate chain specifications.
13398+
3. Start relay chain validators.
13399+
4. Register and start parachain collators.
13400+
5. Display connection endpoints and logs.
13401+
13402+
Access the running nodes via the provided RPC endpoints (typically `ws://127.0.0.1:9944` for the first node).
13403+
13404+
## Write Tests
13405+
13406+
Zombienet provides a Domain Specific Language (DSL) for writing tests in `.zndsl` files. Tests can evaluate:
13407+
13408+
- Metrics from Prometheus
13409+
- Log patterns
13410+
- System events
13411+
- On-chain storage
13412+
- Custom JavaScript/TypeScript scripts
13413+
13414+
### Test File Structure
13415+
13416+
Test files contain a header and body:
13417+
13418+
```toml title="example-test.zndsl"
13419+
Description: Example test suite
13420+
Network: ./network.toml
13421+
Creds: config
13422+
13423+
# Test assertions
13424+
alice: is up
13425+
bob: is up
13426+
alice: parachain 1000 is registered within 200 seconds
13427+
alice: parachain 1000 block height is at least 10 within 300 seconds
13428+
```
13429+
13430+
### Run Tests
13431+
13432+
Execute tests using:
13433+
13434+
```bash
13435+
zombienet test example-test.zndsl --provider native
13436+
```
13437+
13438+
The test runner will execute each assertion and report pass/fail status.
13439+
13440+
### Common Assertions
13441+
13442+
Some frequently used assertions include:
13443+
13444+
- **Well-known functions**: `alice: is up`, `alice: parachain 100 is registered within 225 seconds`
13445+
- **Metrics**: `alice: reports node_roles is 4`
13446+
- **Logs**: `alice: log line matches glob "Imported #1" within 10 seconds`
13447+
- **System events**: `alice: system event matches ""paraId":[0-9]+" within 10 seconds`
13448+
- **Custom scripts**: `alice: js-script ./script.js return is greater than 1 within 200 seconds`
13449+
13450+
## Configuration Reference
13451+
13452+
For detailed configuration options, see:
13453+
13454+
- [Configuration examples](https://github.com/paritytech/zombienet/tree/main/examples){target=\_blank}: Sample configurations for various scenarios.
13455+
- [Testing DSL specification](https://paritytech.github.io/zombienet/cli/test-dsl-definition-spec.html){target=\_blank}: Complete DSL syntax reference.
13456+
- [Zombienet book](https://paritytech.github.io/zombienet/){target=\_blank}: Comprehensive documentation.
13457+
13458+
## Where to Go Next
13459+
13460+
<div class="grid cards" markdown>
13461+
13462+
- <span class="badge external">External</span> __Zombienet Support__
13463+
13464+
---
13465+
13466+
For further support and information, refer to the official resources.
13467+
13468+
[:octicons-arrow-right-24: GitHub Repository](https://github.com/paritytech/zombienet){target=\_blank}
13469+
13470+
[:octicons-arrow-right-24: Element Channel](https://matrix.to/#/!FWyuEyNvIFygLnWNMh:parity.io?via=parity.io&via=matrix.org&via=web3.foundation){target=\_blank}
13471+
13472+
</div>

0 commit comments

Comments
 (0)