From 37dc3d463dca7820bd2c574ca534d2d67db80af9 Mon Sep 17 00:00:00 2001 From: Viktor Kirilov Date: Wed, 29 Apr 2020 02:25:54 +0300 Subject: [PATCH] =?UTF-8?q?[lcli]=20the=20fork=20version=20is=20now=20infe?= =?UTF-8?q?rred=20from=20the=20spec=20and=20can=20also=20be=E2=80=A6=20(#1?= =?UTF-8?q?068)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [lcli] the fork version is now inferred from the spec and can also be overridden for the interop-genesis subcommand with a command line flag just like for the new-testnet subcommand * fixed formatting --- lcli/src/interop_genesis.rs | 5 ++++- lcli/src/main.rs | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lcli/src/interop_genesis.rs b/lcli/src/interop_genesis.rs index 61055f9b8..9c8609b5c 100644 --- a/lcli/src/interop_genesis.rs +++ b/lcli/src/interop_genesis.rs @@ -1,4 +1,5 @@ use clap::ArgMatches; +use clap_utils::parse_ssz_optional; use environment::Environment; use eth2_testnet_config::Eth2TestnetConfig; use genesis::interop_genesis_state; @@ -49,7 +50,9 @@ pub fn run(mut env: Environment, matches: &ArgMatches) -> Result< ) })?; - spec.genesis_fork_version = [1, 3, 3, 7]; + if let Some(v) = parse_ssz_optional(matches, "genesis-fork-version")? { + spec.genesis_fork_version = v; + } let keypairs = generate_deterministic_keypairs(validator_count); let genesis_state = interop_genesis_state(&keypairs, genesis_time, &spec)?; diff --git a/lcli/src/main.rs b/lcli/src/main.rs index be1a93b70..f4cd748f2 100644 --- a/lcli/src/main.rs +++ b/lcli/src/main.rs @@ -225,6 +225,14 @@ fn main() { .takes_value(true) .help("The value for state.genesis_time. Defaults to now."), ) + .arg( + Arg::with_name("genesis-fork-version") + .long("genesis-fork-version") + .value_name("HEX") + .takes_value(true) + .help("Used to avoid reply attacks between testnets. Recommended to set to + non-default."), + ) ) .subcommand( SubCommand::with_name("change-genesis-time")