zombienet_configuration/
lib.rs

1//! This crate is used to create type safe configuration for Zombienet SDK using nested builders.
2//!
3//!
4//! The main entry point of this crate is the [`NetworkConfigBuilder`] which is used to build a full network configuration
5//! but all inner builders are also exposed to allow more granular control over the configuration.
6//!
7//! **Note**: Not all options can be checked at compile time and some will be checked at runtime when spawning a
8//! network (e.g.: supported args for a specific node version).
9//!
10//! # Example
11//! ```
12//! use zombienet_configuration::NetworkConfigBuilder;
13//!
14//! let simple_configuration = NetworkConfigBuilder::new()
15//!     .with_relaychain(|relaychain| {
16//!         relaychain
17//!             .with_chain("polkadot")
18//!             .with_random_nominators_count(10)
19//!             .with_default_resources(|resources| {
20//!                 resources
21//!                     .with_limit_cpu("1000m")
22//!                     .with_request_memory("1Gi")
23//!                     .with_request_cpu(100_000)
24//!             })
25//!             .with_node(|node| {
26//!                 node.with_name("node")
27//!                     .with_command("command")
28//!                     .validator(true)
29//!             })
30//!     })
31//!     .with_parachain(|parachain| {
32//!         parachain
33//!             .with_id(1000)
34//!             .with_chain("myparachain1")
35//!             .with_initial_balance(100_000)
36//!             .with_default_image("myimage:version")
37//!             .with_collator(|collator| {
38//!                 collator
39//!                     .with_name("collator1")
40//!                     .with_command("command1")
41//!                     .validator(true)
42//!             })
43//!     })
44//!     .with_parachain(|parachain| {
45//!         parachain
46//!             .with_id(2000)
47//!             .with_chain("myparachain2")
48//!             .with_initial_balance(50_0000)
49//!             .with_collator(|collator| {
50//!                 collator
51//!                     .with_name("collator2")
52//!                     .with_command("command2")
53//!                     .validator(true)
54//!             })
55//!     })
56//!     .with_hrmp_channel(|hrmp_channel1| {
57//!         hrmp_channel1
58//!             .with_sender(1)
59//!             .with_recipient(2)
60//!             .with_max_capacity(200)
61//!             .with_max_message_size(500)
62//!     })
63//!     .with_hrmp_channel(|hrmp_channel2| {
64//!         hrmp_channel2
65//!             .with_sender(2)
66//!             .with_recipient(1)
67//!             .with_max_capacity(100)
68//!             .with_max_message_size(250)
69//!     })
70//!     .with_global_settings(|global_settings| {
71//!         global_settings
72//!             .with_network_spawn_timeout(1200)
73//!             .with_node_spawn_timeout(240)
74//!     })
75//!     .build();
76//!
77//! assert!(simple_configuration.is_ok())
78//! ```
79
80#![allow(clippy::expect_fun_call)]
81mod global_settings;
82mod hrmp_channel;
83mod network;
84mod parachain;
85mod relaychain;
86pub mod shared;
87mod utils;
88
89pub use global_settings::{GlobalSettings, GlobalSettingsBuilder};
90pub use hrmp_channel::{HrmpChannelConfig, HrmpChannelConfigBuilder};
91pub use network::{NetworkConfig, NetworkConfigBuilder};
92pub use parachain::{
93    states as para_states, ParachainConfig, ParachainConfigBuilder, RegistrationStrategy,
94};
95pub use relaychain::{RelaychainConfig, RelaychainConfigBuilder};
96// re-export shared
97pub use shared::{node::NodeConfig, types};