Skip to content
Snippets Groups Projects
Unverified Commit 28a106dc authored by Nikos Kontakis's avatar Nikos Kontakis
Browse files

tmp

parent dac57211
Branches
No related merge requests found
......@@ -82,7 +82,7 @@ impl NetworkConfig {
// retrieve the defaults relaychain for assigning to nodes if needed
let relaychain_default_command: Option<Command> =
network_config.relaychain().default_command().cloned();
network_config.relaychain().default_command().cloned() | network_config.relaychain().command().cloned();
let relaychain_default_image: Option<Image> =
network_config.relaychain().default_image().cloned();
......
......@@ -119,7 +119,7 @@ pub struct ParachainConfig {
genesis_state_generator: Option<Command>,
chain_spec_path: Option<AssetLocation>,
#[serde(rename = "cumulus_based")]
is_cumulus_based: bool,
is_cumulus_based: Option<bool>,
#[serde(skip_serializing_if = "std::vec::Vec::is_empty", default)]
bootnodes_addresses: Vec<Multiaddr>,
genesis_overrides: Option<serde_json::Value>,
......@@ -210,7 +210,11 @@ impl ParachainConfig {
/// Whether the parachain is based on cumulus.
pub fn is_cumulus_based(&self) -> bool {
self.is_cumulus_based
if let Some(true) = self.is_cumulus_based {
true
} else {
false
}
}
/// The bootnodes addresses the collators will connect to.
......@@ -258,7 +262,7 @@ impl Default for ParachainConfigBuilder<Initial> {
genesis_state_generator: None,
genesis_overrides: None,
chain_spec_path: None,
is_cumulus_based: true,
is_cumulus_based: Some(true),
bootnodes_addresses: vec![],
collators: vec![],
},
......@@ -575,7 +579,7 @@ impl ParachainConfigBuilder<WithId> {
pub fn cumulus_based(self, choice: bool) -> Self {
Self::transition(
ParachainConfig {
is_cumulus_based: choice,
is_cumulus_based: Some(choice),
..self.config
},
self.validation_context,
......
......@@ -28,6 +28,7 @@ pub struct RelaychainConfig {
#[serde(skip_serializing_if = "std::vec::Vec::is_empty", default)]
nodes: Vec<NodeConfig>,
genesis_overrides: Option<serde_json::Value>,
command: Option<Command>,
}
impl RelaychainConfig {
......@@ -66,6 +67,12 @@ impl RelaychainConfig {
self.chain_spec_path.as_ref()
}
/// The non-default command used for nodes.
pub fn command(&self) -> Option<&Command> {
self.command.as_ref()
}
/// The number of `random nominators` to create for chains using staking, this is used in tandem with `max_nominations` to simulate the amount of nominators and nominations.
pub fn random_nominators_count(&self) -> Option<u32> {
self.random_nominators_count
......@@ -118,6 +125,7 @@ impl Default for RelaychainConfigBuilder<Initial> {
default_db_snapshot: None,
default_args: vec![],
chain_spec_path: None,
command: None,
random_nominators_count: None,
max_nominations: None,
genesis_overrides: None,
......
[settings]
timeout = 1000
node_spawn_timeout = 1000
[relaychain]
default_image = "docker.io/parity/polkadot-sdk:latest"
chain = "rococo-local"
command = "polkadot"
default_command = "polkadot"
[[relaychain.nodes]]
name = "alice"
args = [ "--alice", "-lruntime=debug,parachain=trace" ]
is_bootnode = true
[[relaychain.nodes]]
name = "bob"
args = [ "--bob", "-lruntime=debug,parachain=trace" ]
is_bootnode = true
[[parachains]]
id = 100
addToGenesis = false
balance = 200000000
chain="some"
[parachains.collator]
name = "collator01"
......
use std::time::Duration;
use configuration::NetworkConfig;
use orchestrator::Orchestrator;
use provider::NativeProvider;
use support::fs::local::LocalFileSystem;
fn main() {
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = NetworkConfig::load_from_toml("./crates/examples/examples/0001-simple.toml").expect("errored?");
let load_from_toml =
NetworkConfig::load_from_toml("./0001-simple.toml").unwrap();
let fs = LocalFileSystem;
let provider = NativeProvider::new(fs.clone());
let orchestrator = Orchestrator::new(fs, provider);
orchestrator.spawn(config).await?;
println!("🚀🚀🚀🚀 network deployed");
// For now let just loop....
#[allow(clippy::empty_loop)]
loop {}
// let config = NetworkConfigBuilder::new()
// .with_relaychain(|r| {
// r.with_chain("rococo-local")
// .with_node(|node| node.with_name("alice").with_command("polkadot"))
// })
// .build();
// Ok(())
println!("{:?}", load_from_toml);
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment