From b56dfbb5a7e446af5bb2af8f1c7f00b406034cbc Mon Sep 17 00:00:00 2001 From: Noah Citron Date: Mon, 7 Nov 2022 10:24:37 -0500 Subject: [PATCH] feat: provide default consensus rpc (#91) --- README.md | 4 +++- config/src/lib.rs | 1 + config/src/networks.rs | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ce66eb8..6e4dd7c 100644 --- a/README.md +++ b/README.md @@ -17,11 +17,13 @@ To install Helios, run `heliosup`. ## Usage To run Helios, run the below command, replacing `$ETH_RPC_URL` with an RPC provider URL such as Alchemy or Infura: ``` -helios --consensus-rpc https://www.lightclientdata.org --execution-rpc $ETH_RPC_URL +helios --execution-rpc $ETH_RPC_URL ``` Helios will now run a local RPC server at `http://127.0.0.1:8545`. ### Additional Options +`--consensus-rpc` or `-c` can be used to set a custom consensus layer rpc endpoint. This must be a consenus node that supports the light client beaconchain api. We recomment using Nimbus for this. If no consensus rpc is supplied, it defaults to `https://www.lightclientdata.org` which is run by us. + `--checkpoint` or `-w` can be used to set a custom weak subjectivity checkpoint. This must be equal the first beacon blockhash of an epoch. Weak subjectivity checkpoints are the root of trust in the system. If this is set to a malicious value, an attacker can cause the client to sync to the wrong chain. Helios sets a default value initially, then caches the most recent finalized block it has seen for later use. `--network` or `-n` sets the network to sync to. Current valid option are `mainnet` and `goerli`, however users can add custom networks in their configurationf files. diff --git a/config/src/lib.rs b/config/src/lib.rs index fdad5a8..b861562 100644 --- a/config/src/lib.rs +++ b/config/src/lib.rs @@ -89,6 +89,7 @@ impl Config { pub fn to_base_config(&self) -> BaseConfig { BaseConfig { rpc_port: self.rpc_port.unwrap_or(8545), + consensus_rpc: Some(self.consensus_rpc.clone()), checkpoint: self.checkpoint.clone(), chain: self.chain.clone(), forks: self.forks.clone(), diff --git a/config/src/networks.rs b/config/src/networks.rs index 1507f1b..354a76b 100644 --- a/config/src/networks.rs +++ b/config/src/networks.rs @@ -20,6 +20,7 @@ impl Network { #[derive(Serialize, Default)] pub struct BaseConfig { pub rpc_port: u16, + pub consensus_rpc: Option, #[serde( deserialize_with = "bytes_deserialize", serialize_with = "bytes_serialize" @@ -36,6 +37,7 @@ pub fn mainnet() -> BaseConfig { ) .unwrap(), rpc_port: 8545, + consensus_rpc: Some("https://www.lightclientdata.org".to_string()), chain: ChainConfig { chain_id: 1, genesis_time: 1606824023, @@ -68,6 +70,7 @@ pub fn goerli() -> BaseConfig { ) .unwrap(), rpc_port: 8545, + consensus_rpc: None, chain: ChainConfig { chain_id: 5, genesis_time: 1616508000,