add support for evan.network chains (#11289)

* add support for evan.network chains

* fix chainspec parsing errror

* add missing core param

* missing colon
This commit is contained in:
Sebastian Dechant 2019-12-03 15:00:29 +01:00 committed by Andronik Ordian
parent 4c3be46f93
commit f2f4217e3c
5 changed files with 218 additions and 1 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -62,6 +62,8 @@ bundle_release_spec! {
"ethereum/callisto" => new_callisto, "ethereum/callisto" => new_callisto,
"ethereum/classic" => new_classic, "ethereum/classic" => new_classic,
"ethereum/ellaism" => new_ellaism, "ethereum/ellaism" => new_ellaism,
"ethereum/evantestcore" => new_evantestcore,
"ethereum/evancore" => new_evancore,
"ethereum/expanse" => new_expanse, "ethereum/expanse" => new_expanse,
"ethereum/foundation" => new_foundation, "ethereum/foundation" => new_foundation,
"ethereum/goerli" => new_goerli, "ethereum/goerli" => new_goerli,

View File

@ -300,7 +300,7 @@ usage! {
ARG arg_chain: (String) = "foundation", or |c: &Config| c.parity.as_ref()?.chain.clone(), ARG arg_chain: (String) = "foundation", or |c: &Config| c.parity.as_ref()?.chain.clone(),
"--chain=[CHAIN]", "--chain=[CHAIN]",
"Specify the blockchain type. CHAIN may be either a JSON chain specification file or ethereum, classic, poacore, xdai, volta, ewc, musicoin, ellaism, mix, callisto, morden, mordor, ropsten, kovan, rinkeby, goerli, kotti, poasokol, testnet, or dev.", "Specify the blockchain type. CHAIN may be either a JSON chain specification file or ethereum, classic, poacore, xdai, volta, ewc, musicoin, ellaism, mix, callisto, morden, mordor, ropsten, kovan, rinkeby, goerli, kotti, poasokol, testnet, evantestcore, evancore or dev.",
ARG arg_keys_path: (String) = "$BASE/keys", or |c: &Config| c.parity.as_ref()?.keys_path.clone(), ARG arg_keys_path: (String) = "$BASE/keys", or |c: &Config| c.parity.as_ref()?.keys_path.clone(),
"--keys-path=[PATH]", "--keys-path=[PATH]",

View File

@ -51,6 +51,8 @@ pub enum SpecType {
Goerli, Goerli,
Kotti, Kotti,
Sokol, Sokol,
Evantestcore,
Evancore,
Dev, Dev,
Custom(String), Custom(String),
} }
@ -84,6 +86,8 @@ impl str::FromStr for SpecType {
"goerli" | "görli" | "testnet" => SpecType::Goerli, "goerli" | "görli" | "testnet" => SpecType::Goerli,
"kotti" => SpecType::Kotti, "kotti" => SpecType::Kotti,
"sokol" | "poasokol" => SpecType::Sokol, "sokol" | "poasokol" => SpecType::Sokol,
"evantestcore" => SpecType::Evantestcore,
"evancore" => SpecType::Evancore,
"dev" => SpecType::Dev, "dev" => SpecType::Dev,
other => SpecType::Custom(other.into()), other => SpecType::Custom(other.into()),
}; };
@ -112,6 +116,8 @@ impl fmt::Display for SpecType {
SpecType::Goerli => "goerli", SpecType::Goerli => "goerli",
SpecType::Kotti => "kotti", SpecType::Kotti => "kotti",
SpecType::Sokol => "sokol", SpecType::Sokol => "sokol",
SpecType::Evantestcore => "evantestcore",
SpecType::Evancore => "evancore",
SpecType::Dev => "dev", SpecType::Dev => "dev",
SpecType::Custom(ref custom) => custom, SpecType::Custom(ref custom) => custom,
}) })
@ -140,6 +146,8 @@ impl SpecType {
SpecType::Goerli => Ok(spec::new_goerli(params)), SpecType::Goerli => Ok(spec::new_goerli(params)),
SpecType::Kotti => Ok(spec::new_kotti(params)), SpecType::Kotti => Ok(spec::new_kotti(params)),
SpecType::Sokol => Ok(spec::new_sokol(params)), SpecType::Sokol => Ok(spec::new_sokol(params)),
SpecType::Evantestcore => Ok(spec::new_evantestcore(params)),
SpecType::Evancore => Ok(spec::new_evancore(params)),
SpecType::Dev => Ok(spec::new_instant()), SpecType::Dev => Ok(spec::new_instant()),
SpecType::Custom(ref filename) => { SpecType::Custom(ref filename) => {
let file = fs::File::open(filename).map_err(|e| format!("Could not load specification file at {}: {}", filename, e))?; let file = fs::File::open(filename).map_err(|e| format!("Could not load specification file at {}: {}", filename, e))?;
@ -401,6 +409,8 @@ mod tests {
assert_eq!(SpecType::Kotti, "kotti".parse().unwrap()); assert_eq!(SpecType::Kotti, "kotti".parse().unwrap());
assert_eq!(SpecType::Sokol, "sokol".parse().unwrap()); assert_eq!(SpecType::Sokol, "sokol".parse().unwrap());
assert_eq!(SpecType::Sokol, "poasokol".parse().unwrap()); assert_eq!(SpecType::Sokol, "poasokol".parse().unwrap());
assert_eq!(SpecType::Evantestcore, "evantestcore".parse().unwrap());
assert_eq!(SpecType::Evancore, "evancore".parse().unwrap());
} }
#[test] #[test]
@ -428,6 +438,8 @@ mod tests {
assert_eq!(format!("{}", SpecType::Goerli), "goerli"); assert_eq!(format!("{}", SpecType::Goerli), "goerli");
assert_eq!(format!("{}", SpecType::Kotti), "kotti"); assert_eq!(format!("{}", SpecType::Kotti), "kotti");
assert_eq!(format!("{}", SpecType::Sokol), "sokol"); assert_eq!(format!("{}", SpecType::Sokol), "sokol");
assert_eq!(format!("{}", SpecType::Evantestcore), "evantestcore");
assert_eq!(format!("{}", SpecType::Evancore), "evancore");
assert_eq!(format!("{}", SpecType::Dev), "dev"); assert_eq!(format!("{}", SpecType::Dev), "dev");
assert_eq!(format!("{}", SpecType::Custom("foo/bar".into())), "foo/bar"); assert_eq!(format!("{}", SpecType::Custom("foo/bar".into())), "foo/bar");
} }