pub mod types;
use hotshot::helpers::initialize_logging;
use hotshot_example_types::{node_types::TestVersions, state_types::TestTypes};
use hotshot_orchestrator::client::ValidatorArgs;
use infra::{gen_local_address, BUILDER_BASE_PORT, VALIDATOR_BASE_PORT};
use tokio::spawn;
use tracing::instrument;
use crate::{
infra::{read_orchestrator_init_config, run_orchestrator, OrchestratorArgs},
types::{Network, NodeImpl, ThisRun},
};
#[path = "../infra/mod.rs"]
pub mod infra;
#[tokio::main]
#[instrument]
async fn main() {
initialize_logging();
let (config, orchestrator_url) = read_orchestrator_init_config::<TestTypes>();
spawn(run_orchestrator::<TestTypes>(OrchestratorArgs {
url: orchestrator_url.clone(),
config: config.clone(),
}));
let mut nodes = Vec::new();
for i in 0..config.config.num_nodes_with_stake.into() {
let advertise_address = gen_local_address::<VALIDATOR_BASE_PORT>(i);
let builder_address = gen_local_address::<BUILDER_BASE_PORT>(i);
let orchestrator_url = orchestrator_url.clone();
let node = spawn(async move {
infra::main_entry_point::<TestTypes, Network, NodeImpl, TestVersions, ThisRun>(
ValidatorArgs {
url: orchestrator_url,
advertise_address: Some(advertise_address.to_string()),
builder_address: Some(builder_address),
network_config_file: None,
},
)
.await;
});
nodes.push(node);
}
futures::future::join_all(nodes).await;
}