Skip to content

Commit

Permalink
chore: cleanup chainspecs (#643)
Browse files Browse the repository at this point in the history
Fixes KILTprotocol/ticket#3404.

Cleaning up the different chainspecs required also the modules to be
restructured a bit. To note is the following:

* Removal of the `--runtime` flag. Now any possible runtime is parsed
solely from the provided `--chain` (or `--dev`) parameter (relevant for
starting up the node going forward)
* Removal of the unused chainspecs and renaming of the folder (relevant
for starting up the node going forward)
* Removal of all maintain scripts, which can be re-added if needed
* Removal of the clone runtime

Of interest is the change from this

```rust
match (id, runtime) {
		("clone-dev", _) => Ok(Box::new(chain_spec::clone::get_chain_spec_dev()?)),
		("clone-new", _) => Ok(Box::new(chain_spec::clone::new_chain_spec()?)),
		("dev", _) => Ok(Box::new(chain_spec::peregrine::get_chain_spec_dev()?)),
		("spiritnet-dev", _) => Ok(Box::new(chain_spec::spiritnet::get_chain_spec_dev()?)),
		("peregrine-new", _) => Ok(Box::new(chain_spec::peregrine::make_new_spec()?)),
		("rilt-new", _) => Ok(Box::new(chain_spec::peregrine::get_chain_spec_rilt()?)),
		("rilt", _) => Ok(Box::new(chain_spec::peregrine::load_rilt_spec()?)),
		("spiritnet", _) => Ok(Box::new(chain_spec::spiritnet::load_spiritnet_spec()?)),
		("", "spiritnet") => Ok(Box::new(chain_spec::spiritnet::get_chain_spec_dev()?)),
		("", "peregrine") => Ok(Box::new(chain_spec::peregrine::get_chain_spec_dev()?)),
		(path, "spiritnet") => Ok(Box::new(chain_spec::spiritnet::ChainSpec::from_json_file(path.into())?)),
		(path, "peregrine") => Ok(Box::new(chain_spec::peregrine::ChainSpec::from_json_file(path.into())?)),
		(path, "clone") => Ok(Box::new(chain_spec::clone::ChainSpec::from_json_file(path.into())?)),
		_ => Err("Unknown KILT parachain spec".to_owned()),
	}
```

to this

```rust
match s {
			// Peregrine development
			"dev" => Ok(Self::Peregrine(PeregrineRuntime::Dev)),
			// New blank Peregrine chainspec
			"peregrine-new" => Ok(Self::Peregrine(PeregrineRuntime::New)),
			// Peregrine chainspec
			"peregrine" => Ok(Self::Peregrine(PeregrineRuntime::Peregrine)),
			// Peregrine staging chainspec
			"peregrine-stg" => Ok(Self::Peregrine(PeregrineRuntime::PeregrineStg)),
			// RILT chainspec
			"rilt" => Ok(Self::Peregrine(PeregrineRuntime::Rilt)),
			// Any other Peregrine-based chainspec
			s if s.contains("peregrine") => Ok(Self::Peregrine(PeregrineRuntime::Other(s.to_string()))),

			// Spiritnet development
			"spiritnet-dev" => Ok(Self::Spiritnet(SpiritnetRuntime::Dev)),
			// New blank Spiritnet chainspec
			"spiritnet-new" => Ok(Self::Spiritnet(SpiritnetRuntime::New)),
			// Spiritnet chainspec
			"spiritnet" => Ok(Self::Spiritnet(SpiritnetRuntime::Spiritnet)),
			// Any other Spiritnet-based chainspec
			s if s.contains("spiritnet") => Ok(Self::Spiritnet(SpiritnetRuntime::Other(s.to_string()))),

			_ => Err(format!("Unknown chainspec id provided: {s}")),
		}
```
  • Loading branch information
ntn-x2 authored and Ad96el committed May 31, 2024
1 parent b8a830f commit f4faede
Show file tree
Hide file tree
Showing 68 changed files with 1,078 additions and 10,388 deletions.
12 changes: 0 additions & 12 deletions .maintain/reset-spec/README.md

This file was deleted.

229 changes: 0 additions & 229 deletions .maintain/reset-spec/app.py

This file was deleted.

68 changes: 0 additions & 68 deletions .maintain/reset-spec/peregrine_dev_kilt.py

This file was deleted.

Loading

0 comments on commit f4faede

Please sign in to comment.