Expand description
This crate is used to create type safe configuration for Zombienet SDK using nested builders.
The main entry point of this crate is the NetworkConfigBuilder which is used to build a full network configuration
but all inner builders are also exposed to allow more granular control over the configuration.
Note: Not all options can be checked at compile time and some will be checked at runtime when spawning a network (e.g.: supported args for a specific node version).
§Example
use zombienet_configuration::NetworkConfigBuilder;
let simple_configuration = NetworkConfigBuilder::new()
.with_relaychain(|relaychain| {
relaychain
.with_chain("polkadot")
.with_random_nominators_count(10)
.with_default_resources(|resources| {
resources
.with_limit_cpu("1000m")
.with_request_memory("1Gi")
.with_request_cpu(100_000)
})
.with_validator(|node| node.with_name("node").with_command("command"))
.with_validator(|node| node.with_name("node1").with_command("command"))
})
.with_parachain(|parachain| {
parachain
.with_id(1000)
.with_chain("myparachain1")
.with_initial_balance(100_000)
.with_default_image("myimage:version")
.with_collator(|collator| {
collator
.with_name("collator1")
.with_command("command1")
.validator(true)
})
})
.with_parachain(|parachain| {
parachain
.with_id(2000)
.with_chain("myparachain2")
.with_initial_balance(50_0000)
.with_collator(|collator| {
collator
.with_name("collator2")
.with_command("command2")
.validator(true)
})
})
.with_hrmp_channel(|hrmp_channel1| {
hrmp_channel1
.with_sender(1)
.with_recipient(2)
.with_max_capacity(200)
.with_max_message_size(500)
})
.with_hrmp_channel(|hrmp_channel2| {
hrmp_channel2
.with_sender(2)
.with_recipient(1)
.with_max_capacity(100)
.with_max_message_size(250)
})
.with_global_settings(|global_settings| {
global_settings
.with_network_spawn_timeout(1200)
.with_node_spawn_timeout(240)
})
.build();
assert!(simple_configuration.is_ok())Re-exports§
pub use shared::node::NodeConfig;pub use shared::types;pub use json_patch;
Modules§
Structs§
- Custom
Process - A custom process to spawn next to the nodes: its
command,args,env,image(provider specific), namedports,resources(provider specific), and its lifecycle:ready_check,depends_on,one_shotandtimeout. - Custom
Process Builder - A custom process builder, used to build a
CustomProcessdeclaratively with fields validation. - Dependency
- Another custom process this one starts after. Written as a bare name
(
"postgres") or as{ name = "init", condition = "..." }; without a condition the target’s natural one applies, seeCustomProcess::natural_condition. - Global
Settings - Global settings applied to an entire network.
- Global
Settings Builder - A global settings builder, used to build
GlobalSettingsdeclaratively with fields validation. - Hrmp
Channel Config - HRMP channel configuration, with fine-grained configuration options.
- Hrmp
Channel Config Builder - HRMP channel configuration builder, used to build an
HrmpChannelConfigdeclaratively with fields validation. - Jamchain
Config - A JAM chain configuration
- Jamchain
Config Builder - A relay chain configuration builder, used to build a
JamchainConfigdeclaratively with fields validation. - Named
Port - A port a custom process listens on, by name.
- Network
Config - A network configuration, composed of a relaychain (or a JAM chain), parachains and HRMP channels.
- Network
Config Builder - A network configuration builder, used to build a
NetworkConfigdeclaratively with fields validation. - Observability
Config - Configuration for the observability stack (Prometheus + Grafana)
- Observability
Config Builder - Builder for
ObservabilityConfig - Parachain
Config - A parachain configuration, composed of collators and fine-grained configuration options.
- Parachain
Config Builder - A parachain configuration builder, used to build a
ParachainConfigdeclaratively with fields validation. - Ready
Check - How a custom process is known to be ready.
tcpis a declared port name that must accept a connection;httpis a declared port name and a path that must answer 2xx. On kubernetes the check is the pod’s readiness probe; elsewhere zombienet probes the port from where it runs. How long to wait is the process’stimeout. - Relaychain
Config - A relay chain configuration, composed of nodes and fine-grained configuration options.
- Relaychain
Config Builder - A relay chain configuration builder, used to build a
RelaychainConfigdeclaratively with fields validation.
Enums§
- Buildable
- Dependency
Condition - When a dependency counts as met, as docker-compose names them.
- Ready
Target - What a
ReadyCheckprobes, by declared port name. - Registration
Strategy - The registration strategy that will be used for the parachain.
Constants§
- MAX_
TIMEOUT_ SECS - The longest
timeoutaccepted: a week, in seconds.