Skip to content

Commit

Permalink
dft
Browse files Browse the repository at this point in the history
  • Loading branch information
haxjump committed Oct 8, 2024
1 parent 0d9a1a8 commit 86950b7
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/cfg/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use chaindev::{beacon_ddev::HostExpression, NodeID};
use clap::{Args, Parser, Subcommand};
use ruc::*;
use std::env;

#[derive(Parser, Debug)]
Expand Down
10 changes: 10 additions & 0 deletions src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,13 @@ impl NodePorts for Ports {
self.cl_vc_rpc
}
}

/// Return: "enode,enode,enode"
pub fn el_get_bootnodes(rpc_endpoints: &[&str]) -> Result<String> {
todo!()
}

/// Return: "enr,enr,enr"
pub fn cl_get_bootnodes(rpc_endpoints: &[&str]) -> Result<String> {
todo!()
}
38 changes: 34 additions & 4 deletions src/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,24 @@ impl NodeCmdGenerator<Node<Ports>, EnvMeta<CustomInfo, Node<Ports>>> for CmdGene
let ext_ip = &e.host_ip;
let local_ip = &e.host_ip;

let online_nodes = e.nodes_should_be_online.iter().take(3);
let online_nodes = e
.nodes_should_be_online
.iter()
.copied()
.take(3)
.collect::<Vec<_>>();
let (el_rpc_endpoints, cl_bn_rpc_endpoints): (Vec<_>, Vec<_>) = e
.nodes
.values()
.chain(e.bootstraps.values())
.filter(|n| online_nodes.contains(&n.id))
.map(|n| {
(
format!("http://{}:{}", &e.host_ip, n.ports.el_rpc),
format!("http://{}:{}", &e.host_ip, n.ports.cl_bn_rpc),
)
})
.unzip();

let el_cmd = if GETH_MARK == mark {
let geth = &e.custom_data.el_geth_bin;
Expand All @@ -200,7 +217,12 @@ impl NodeCmdGenerator<Node<Ports>, EnvMeta<CustomInfo, Node<Ports>>> for CmdGene
let el_engine_port = n.ports.el_engine_api;
let el_metric_port = n.ports.el_metric;

let el_bootnodes = ""; // TODO HTTP REQ
let el_rpc_endpoints = el_rpc_endpoints
.iter()
.map(|i| i.as_str())
.collect::<Vec<_>>();
let el_bootnodes =
info!(el_get_bootnodes(&el_rpc_endpoints)).unwrap_or_default();

let el_gc_mode = if matches!(n.kind, NodeKind::ArchiveNode) {
"archive"
Expand Down Expand Up @@ -244,7 +266,7 @@ fi
let cmd_run_part_1 = if el_bootnodes.is_empty() {
String::new()
} else {
format!(" --bootnodes={el_bootnodes}")
format!(" --bootnodes='{el_bootnodes}'")
};

let cmd_run_part_2 = format!(" >>{el_dir}/{EL_LOG_NAME} 2>&1 ");
Expand All @@ -256,7 +278,15 @@ fi
pnk!(Err(eg!("The fucking world is over!")))
};

let cl_bn_cmd = format!("");
let cl_bn_cmd = {
let cl_bn_rpc_endpoints = cl_bn_rpc_endpoints
.iter()
.map(|i| i.as_str())
.collect::<Vec<_>>();

format!("")
};

let cl_vc_cmd = format!("");

format!(
Expand Down

0 comments on commit 86950b7

Please sign in to comment.