[lcli] the fork version is now inferred from the spec and can also be… (#1068)

* [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
This commit is contained in:
Viktor Kirilov 2020-04-29 02:25:54 +03:00 committed by GitHub
parent 41208d79b1
commit 37dc3d463d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -1,4 +1,5 @@
use clap::ArgMatches; use clap::ArgMatches;
use clap_utils::parse_ssz_optional;
use environment::Environment; use environment::Environment;
use eth2_testnet_config::Eth2TestnetConfig; use eth2_testnet_config::Eth2TestnetConfig;
use genesis::interop_genesis_state; use genesis::interop_genesis_state;
@ -49,7 +50,9 @@ pub fn run<T: EthSpec>(mut env: Environment<T>, 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 keypairs = generate_deterministic_keypairs(validator_count);
let genesis_state = interop_genesis_state(&keypairs, genesis_time, &spec)?; let genesis_state = interop_genesis_state(&keypairs, genesis_time, &spec)?;

View File

@ -225,6 +225,14 @@ fn main() {
.takes_value(true) .takes_value(true)
.help("The value for state.genesis_time. Defaults to now."), .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(
SubCommand::with_name("change-genesis-time") SubCommand::with_name("change-genesis-time")