Add interop chain spec and rename chain_id

This commit is contained in:
Age Manning
2019-07-24 21:31:49 +10:00
parent 88e89f9ab2
commit 40c0b70b22
11 changed files with 83 additions and 19 deletions

View File

@@ -14,7 +14,7 @@ use protos::services_grpc::ValidatorServiceClient;
use slog::{crit, error, info, o, Drain, Level};
use std::fs;
use std::path::PathBuf;
use types::{Keypair, MainnetEthSpec, MinimalEthSpec};
use types::{InteropEthSpec, Keypair, MainnetEthSpec, MinimalEthSpec};
pub const DEFAULT_SPEC: &str = "minimal";
pub const DEFAULT_DATA_DIR: &str = ".lighthouse-validator";
@@ -70,7 +70,7 @@ fn main() {
.short("s")
.help("The title of the spec constants for chain config.")
.takes_value(true)
.possible_values(&["mainnet", "minimal"])
.possible_values(&["mainnet", "minimal", "interop"])
.default_value("minimal"),
)
.arg(
@@ -214,6 +214,11 @@ fn main() {
eth2_config,
log.clone(),
),
"interop" => ValidatorService::<ValidatorServiceClient, Keypair>::start::<InteropEthSpec>(
client_config,
eth2_config,
log.clone(),
),
other => {
crit!(log, "Unknown spec constants"; "title" => other);
return;

View File

@@ -107,12 +107,12 @@ impl<B: BeaconNodeDuties + 'static, S: Signer + 'static, E: EthSpec> Service<B,
return Err("Genesis time in the future".into());
}
// verify the node's chain id
if eth2_config.spec.chain_id != info.chain_id as u8 {
if eth2_config.spec.network_id != info.network_id as u8 {
error!(
log,
"Beacon Node's genesis time is in the future. No work to do.\n Exiting"
);
return Err(format!("Beacon node has the wrong chain id. Expected chain id: {}, node's chain id: {}", eth2_config.spec.chain_id, info.chain_id).into());
return Err(format!("Beacon node has the wrong chain id. Expected chain id: {}, node's chain id: {}", eth2_config.spec.network_id, info.network_id).into());
}
break info;
}
@@ -123,7 +123,7 @@ impl<B: BeaconNodeDuties + 'static, S: Signer + 'static, E: EthSpec> Service<B,
let genesis_time = node_info.get_genesis_time();
let genesis_slot = Slot::from(node_info.get_genesis_slot());
info!(log,"Beacon node connected"; "Node Version" => node_info.version.clone(), "Chain ID" => node_info.chain_id, "Genesis time" => genesis_time);
info!(log,"Beacon node connected"; "Node Version" => node_info.version.clone(), "Chain ID" => node_info.network_id, "Genesis time" => genesis_time);
let proto_fork = node_info.get_fork();
let mut previous_version: [u8; 4] = [0; 4];