Skip to content

Commit

Permalink
Merge pull request #5 from AstarNetwork/only-dev-chain-spec
Browse files Browse the repository at this point in the history
allow only dev chain spec
  • Loading branch information
shunsukew authored May 22, 2022
2 parents eef207b + 7be7203 commit a558d35
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 43 deletions.
40 changes: 1 addition & 39 deletions node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,44 +37,6 @@ pub fn development_config() -> Result<ChainSpec, String> {
// ID
"dev",
ChainType::Development,
move || {
testnet_genesis(
wasm_binary,
// Sudo account
get_account_id_from_seed::<sr25519::Public>("Alice"),
// Pre-funded accounts
vec![
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
],
true,
)
},
// Bootnodes
vec![],
// Telemetry
None,
// Protocol ID
None,
None,
// Properties
None,
// Extensions
None,
))
}

pub fn local_testnet_config() -> Result<ChainSpec, String> {
let wasm_binary = WASM_BINARY.ok_or_else(|| "Development wasm not available".to_string())?;

Ok(ChainSpec::from_genesis(
// Name
"Local Testnet",
// ID
"local_testnet",
ChainType::Local,
move || {
testnet_genesis(
wasm_binary,
Expand Down Expand Up @@ -104,8 +66,8 @@ pub fn local_testnet_config() -> Result<ChainSpec, String> {
None,
// Protocol ID
None,
// Properties
None,
// Properties
None,
// Extensions
None,
Expand Down
5 changes: 1 addition & 4 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ impl SubstrateCli for Cli {

fn load_spec(&self, id: &str) -> Result<Box<dyn sc_service::ChainSpec>, String> {
Ok(match id {
"dev" => Box::new(chain_spec::development_config()?),
"" | "local" => Box::new(chain_spec::local_testnet_config()?),
path =>
Box::new(chain_spec::ChainSpec::from_json_file(std::path::PathBuf::from(path))?),
"dev" | _ => Box::new(chain_spec::development_config()?),
})
}

Expand Down

0 comments on commit a558d35

Please sign in to comment.