2024-04-24 09:25:11 -04:00
|
|
|
use std::path::Path;
|
|
|
|
|
|
|
|
|
|
use crate::{Network, Os, mimalloc, os, write_dockerfile};
|
|
|
|
|
|
|
|
|
|
mod execution;
|
|
|
|
|
use execution::*;
|
|
|
|
|
|
|
|
|
|
mod consensus;
|
|
|
|
|
use consensus::*;
|
|
|
|
|
|
|
|
|
|
pub fn ethereum(orchestration_path: &Path, network: Network) {
|
|
|
|
|
let ((el_download, el_run_as_root, el_run), (cl_download, cl_run_as_root, cl_run)) =
|
|
|
|
|
if network == Network::Dev {
|
|
|
|
|
(anvil(network), (String::new(), String::new(), String::new()))
|
|
|
|
|
} else {
|
|
|
|
|
// TODO: Select an EL/CL based off a RNG seeded from the public key
|
|
|
|
|
(reth(network), nimbus(network))
|
|
|
|
|
};
|
|
|
|
|
|
2025-12-01 03:44:25 -05:00
|
|
|
let download = mimalloc(Os::Alpine) + &el_download + &cl_download;
|
2024-04-24 09:25:11 -04:00
|
|
|
|
|
|
|
|
let run = format!(
|
|
|
|
|
r#"
|
2024-07-18 12:16:45 -07:00
|
|
|
ADD /orchestration/{}/networks/ethereum/run.sh /run.sh
|
2024-04-24 09:25:11 -04:00
|
|
|
CMD ["/run.sh"]
|
|
|
|
|
"#,
|
|
|
|
|
network.label()
|
|
|
|
|
);
|
2025-12-01 03:44:25 -05:00
|
|
|
let run = mimalloc(Os::Debian) +
|
2024-04-24 09:25:11 -04:00
|
|
|
&os(Os::Debian, &(el_run_as_root + "\r\n" + &cl_run_as_root), "ethereum") +
|
|
|
|
|
&el_run +
|
|
|
|
|
&cl_run +
|
|
|
|
|
&run;
|
|
|
|
|
|
|
|
|
|
let res = download + &run;
|
|
|
|
|
|
|
|
|
|
let mut ethereum_path = orchestration_path.to_path_buf();
|
2024-07-18 12:16:45 -07:00
|
|
|
ethereum_path.push("networks");
|
2024-04-24 09:25:11 -04:00
|
|
|
ethereum_path.push("ethereum");
|
|
|
|
|
ethereum_path.push("Dockerfile");
|
|
|
|
|
|
|
|
|
|
write_dockerfile(ethereum_path, &res);
|
|
|
|
|
}
|