From 5b55c1b35e592f91f6fd02cfe3f1bbb1e77138b9 Mon Sep 17 00:00:00 2001 From: Noah Citron Date: Thu, 22 Sep 2022 20:34:34 -0700 Subject: [PATCH] feat: require execution rpc (#49) --- cli/src/main.rs | 8 +++----- client/src/node.rs | 2 +- config/src/lib.rs | 2 +- config/src/networks.rs | 7 ++----- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/cli/src/main.rs b/cli/src/main.rs index f97f896..453fd72 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -46,14 +46,12 @@ fn get_config() -> Config { None => get_cached_checkpoint(&data_dir).unwrap_or(config.general.checkpoint), }; + config.general.execution_rpc = Some(cli.execution_rpc); + if let Some(port) = cli.port { config.general.rpc_port = Some(port); } - if let Some(execution_rpc) = cli.execution_rpc { - config.general.execution_rpc = execution_rpc; - } - if let Some(consensus_rpc) = cli.consensus_rpc { config.general.consensus_rpc = consensus_rpc; } @@ -94,7 +92,7 @@ struct Cli { #[clap(short = 'w', long)] checkpoint: Option, #[clap(short, long)] - execution_rpc: Option, + execution_rpc: String, #[clap(short, long)] consensus_rpc: Option, #[clap(long)] diff --git a/client/src/node.rs b/client/src/node.rs index 4d3f0af..e6141eb 100644 --- a/client/src/node.rs +++ b/client/src/node.rs @@ -31,7 +31,7 @@ impl Node { let consensus = ConsensusClient::new(consensus_rpc, checkpoint_hash, config.clone()).await?; - let execution = ExecutionClient::new(execution_rpc)?; + let execution = ExecutionClient::new(execution_rpc.as_ref().unwrap())?; let payloads = BTreeMap::new(); let finalized_payloads = BTreeMap::new(); diff --git a/config/src/lib.rs b/config/src/lib.rs index 6152c30..5dd1c5b 100644 --- a/config/src/lib.rs +++ b/config/src/lib.rs @@ -26,7 +26,7 @@ pub struct General { #[serde(deserialize_with = "bytes_deserialize")] pub checkpoint: Vec, pub consensus_rpc: String, - pub execution_rpc: String, + pub execution_rpc: Option, pub rpc_port: Option, } diff --git a/config/src/networks.rs b/config/src/networks.rs index c8733e5..50e0004 100644 --- a/config/src/networks.rs +++ b/config/src/networks.rs @@ -16,8 +16,7 @@ pub fn mainnet() -> Config { ) .unwrap(), consensus_rpc: "http://testing.mainnet.beacon-api.nimbus.team".to_string(), - execution_rpc: "https://eth-mainnet.g.alchemy.com/v2/Q0BqQPbTQfSMzrCNl4x80XS_PLLB1RNf" - .to_string(), + execution_rpc: None, rpc_port: Some(8545), }, forks: Forks { @@ -52,9 +51,7 @@ pub fn goerli() -> Config { ) .unwrap(), consensus_rpc: "http://34.207.158.131:5052".to_string(), - execution_rpc: - "https://eth-goerli.g.alchemy.com:443/v2/o_8Qa9kgwDPf9G8sroyQ-uQtyhyWa3ao" - .to_string(), + execution_rpc: None, rpc_port: Some(8545), }, forks: Forks {