Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Versi chainspec based on Rococo. (#4485)
Browse files Browse the repository at this point in the history
* Versi chainspec based on Rococo.

* Fix.

* Fix compilation without features.

* Spelling

* Another typo.

* Support versi in native version

* 🤦

* Regenerated genesis for versi.

* Update cli/src/command.rs

Co-authored-by: Bastian Köcher <info@kchr.de>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
  • Loading branch information
3 people authored and drahnr committed Dec 20, 2021
1 parent 5dc8df8 commit 66fceb7
Show file tree
Hide file tree
Showing 4 changed files with 302 additions and 8 deletions.
18 changes: 15 additions & 3 deletions cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ impl SubstrateCli for Cli {
fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
let id = if id == "" {
let n = get_exec_name().unwrap_or_default();
["polkadot", "kusama", "westend", "rococo"]
["polkadot", "kusama", "westend", "rococo", "versi"]
.iter()
.cloned()
.find(|&chain| n.starts_with(chain))
Expand Down Expand Up @@ -137,6 +137,14 @@ impl SubstrateCli for Cli {
#[cfg(not(feature = "rococo-native"))]
name if name.starts_with("wococo-") =>
Err(format!("`{}` only supported with `rococo-native` feature enabled.", name))?,
"versi" => Box::new(service::chain_spec::versi_config()?),
#[cfg(feature = "rococo-native")]
"versi-dev" => Box::new(service::chain_spec::versi_development_config()?),
#[cfg(feature = "rococo-native")]
"versi-local" => Box::new(service::chain_spec::versi_local_testnet_config()?),
#[cfg(not(feature = "rococo-native"))]
name if name.starts_with("versi-") =>
Err(format!("`{}` only supported with `rococo-native` feature enabled.", name))?,
path => {
let path = std::path::PathBuf::from(path);

Expand All @@ -145,7 +153,11 @@ impl SubstrateCli for Cli {

// When `force_*` is given or the file name starts with the name of one of the known chains,
// we use the chain spec for the specific chain.
if self.run.force_rococo || chain_spec.is_rococo() || chain_spec.is_wococo() {
if self.run.force_rococo ||
chain_spec.is_rococo() ||
chain_spec.is_wococo() ||
chain_spec.is_versi()
{
Box::new(service::RococoChainSpec::from_json_file(path)?)
} else if self.run.force_kusama || chain_spec.is_kusama() {
Box::new(service::KusamaChainSpec::from_json_file(path)?)
Expand All @@ -170,7 +182,7 @@ impl SubstrateCli for Cli {
}

#[cfg(feature = "rococo-native")]
if spec.is_rococo() || spec.is_wococo() {
if spec.is_rococo() || spec.is_wococo() || spec.is_versi() {
return &service::rococo_runtime::VERSION
}

Expand Down
Loading

0 comments on commit 66fceb7

Please sign in to comment.