Skip to content

Commit

Permalink
fix: paths
Browse files Browse the repository at this point in the history
Fix warnings
  • Loading branch information
vcastellm committed Aug 12, 2024
1 parent 9233174 commit 36e3619
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 257 deletions.
112 changes: 0 additions & 112 deletions crates/cdk-config/src/auth.rs

This file was deleted.

15 changes: 0 additions & 15 deletions crates/cdk-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,12 @@ use serde::Deserialize;

pub(crate) const DEFAULT_IP: std::net::Ipv4Addr = std::net::Ipv4Addr::new(0, 0, 0, 0);

pub(crate) mod auth;
pub(crate) mod layer1;
pub mod log;
pub(crate) mod rpc;
pub(crate) mod telemetry;

pub use auth::{AuthConfig, GcpKmsConfig, LocalConfig, PrivateKey};
pub use layer1::Layer1;
pub use log::Log;
pub use rpc::RpcConfig;

/// The Agglayer configuration.
#[derive(Deserialize, Debug)]
Expand All @@ -27,17 +23,6 @@ pub struct Config {
#[serde(rename = "Log")]
pub log: Log,

/// The local RPC server configuration.
#[serde(rename = "RPC")]
pub rpc: RpcConfig,

#[serde(rename = "ForkUpgradeBatchNumber")]
pub fork_upgrade_batch_number: Option<u64>,
}

impl Config {
/// Get the target RPC socket address from the configuration.
pub fn rpc_addr(&self) -> std::net::SocketAddr {
std::net::SocketAddr::from((self.rpc.host, self.rpc.port))
}
}
126 changes: 0 additions & 126 deletions crates/cdk-config/src/rpc.rs

This file was deleted.

19 changes: 15 additions & 4 deletions crates/cdk/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ use cdk_config::Config;
use clap::Parser;
use cli::Cli;
use execute::Execute;
use std::env;
use std::path::PathBuf;
use std::process::Command;
use std::sync::Arc;

mod cli;
mod logging;

const CDK_CLIENT_PATH: &str = "target/cdk-node";
const CDK_ERIGON_PATH: &str = "target/cdk-erigon";
const CDK_CLIENT_PATH: &str = "cdk-node";
const CDK_ERIGON_PATH: &str = "cdk-erigon";

fn main() -> anyhow::Result<()> {
dotenvy::dotenv().ok();
Expand Down Expand Up @@ -41,8 +42,13 @@ pub fn node(config_path: PathBuf) -> anyhow::Result<()> {
config_path.clone(),
)?)?);

let mut bin_path = env::var("CARGO_MANIFEST_DIR").unwrap_or(CDK_CLIENT_PATH.into());
if bin_path != CDK_CLIENT_PATH {
bin_path = format!("{}/../../{}", bin_path, CDK_CLIENT_PATH);
}

// Run the node passing the parsed config values as flags
let mut command = Command::new(CDK_CLIENT_PATH);
let mut command = Command::new(bin_path);
command.args(&["run", "-cfg", config_path.canonicalize()?.to_str().unwrap()]);

let output = command.execute_output().unwrap();
Expand Down Expand Up @@ -71,7 +77,12 @@ pub fn erigon(config_path: PathBuf) -> anyhow::Result<()> {
config_path.clone(),
)?)?);

let mut command = Command::new(CDK_ERIGON_PATH);
let target = env::var("CARGO_TARGET_DIR")?;
let mut binpath = CDK_ERIGON_PATH.to_string();
if target != "" {
binpath = format!("{}/{}", target, CDK_ERIGON_PATH);
}
let mut command = Command::new(binpath);

// TODO: 1. Prepare erigon config files or flags

Expand Down

0 comments on commit 36e3619

Please sign in to comment.