Validate eth1 chain id (#1877)

## Issue Addressed

Resolves #1815 

## Proposed Changes

Adds extra validation for eth1 chain id apart from the existing check for eth1 network id.
This commit is contained in:
Pawan Dhananjay
2020-11-16 23:10:42 +00:00
parent 4d732a1f1d
commit 280334b1b0
5 changed files with 71 additions and 29 deletions

View File

@@ -1,6 +1,6 @@
use crate::{checks, LocalNetwork, E};
use clap::ArgMatches;
use eth1::http::Eth1NetworkId;
use eth1::http::Eth1Id;
use eth1_test_rig::GanacheEth1Instance;
use futures::prelude::*;
use node_test_rig::{
@@ -76,6 +76,7 @@ pub fn run_eth1_sim(matches: &ArgMatches) -> Result<(), String> {
let ganache_eth1_instance = GanacheEth1Instance::new().await?;
let deposit_contract = ganache_eth1_instance.deposit_contract;
let network_id = ganache_eth1_instance.ganache.network_id();
let chain_id = ganache_eth1_instance.ganache.chain_id();
let ganache = ganache_eth1_instance.ganache;
let eth1_endpoint = ganache.endpoint();
let deposit_contract_address = deposit_contract.address();
@@ -108,7 +109,8 @@ pub fn run_eth1_sim(matches: &ArgMatches) -> Result<(), String> {
beacon_config.eth1.follow_distance = 1;
beacon_config.dummy_eth1_backend = false;
beacon_config.sync_eth1_chain = true;
beacon_config.eth1.network_id = Eth1NetworkId::Custom(network_id);
beacon_config.eth1.network_id = Eth1Id::Custom(network_id);
beacon_config.eth1.chain_id = Eth1Id::Custom(chain_id);
beacon_config.network.enr_address = Some(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)));