Tweaks from template downstream review #80 (#705)

* tweaks from template downstream review #80

* more tweaks

* Update parachain-template/node/src/command.rs

* tweaks to template and other chainspecs

* fmt

* update more tweaks from downstream

* fix build
This commit is contained in:
Dan Shields
2021-11-11 12:20:39 -07:00
committed by GitHub
parent 7100363a35
commit 496fab27b5
25 changed files with 107 additions and 132 deletions
+8 -9
View File
@@ -11,7 +11,7 @@ pub type ChainSpec =
sc_service::GenericChainSpec<parachain_template_runtime::GenesisConfig, Extensions>;
/// Helper function to generate a crypto pair from seed
pub fn get_pair_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
pub fn get_public_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
TPublic::Pair::from_string(&format!("//{}", seed), None)
.expect("static values are valid; qed")
.public()
@@ -40,7 +40,7 @@ type AccountPublic = <Signature as Verify>::Signer;
///
/// This function's return type must always match the session keys of the chain in tuple format.
pub fn get_collator_keys_from_seed(seed: &str) -> AuraId {
get_pair_from_seed::<AuraId>(seed)
get_public_from_seed::<AuraId>(seed)
}
/// Helper function to generate an account ID from seed
@@ -48,7 +48,7 @@ pub fn get_account_id_from_seed<TPublic: Public>(seed: &str) -> AccountId
where
AccountPublic: From<<TPublic::Pair as Pair>::Public>,
{
AccountPublic::from(get_pair_from_seed::<TPublic>(seed)).into_account()
AccountPublic::from(get_public_from_seed::<TPublic>(seed)).into_account()
}
/// Generate the session keys from individual elements.
@@ -61,7 +61,7 @@ pub fn template_session_keys(keys: AuraId) -> parachain_template_runtime::Sessio
pub fn development_config() -> ChainSpec {
// Give your base currency a unit name and decimal places
let mut properties = sc_chain_spec::Properties::new();
properties.insert("tokenSymbol".into(), "ROC".into());
properties.insert("tokenSymbol".into(), "UNIT".into());
properties.insert("tokenDecimals".into(), 12.into());
properties.insert("ss58Format".into(), 42.into());
@@ -101,7 +101,7 @@ pub fn development_config() -> ChainSpec {
1000.into(),
)
},
vec![],
Vec::new(),
None,
None,
None,
@@ -115,7 +115,7 @@ pub fn development_config() -> ChainSpec {
pub fn local_testnet_config() -> ChainSpec {
// Give your base currency a unit name and decimal places
let mut properties = sc_chain_spec::Properties::new();
properties.insert("tokenSymbol".into(), "ROC".into());
properties.insert("tokenSymbol".into(), "UNIT".into());
properties.insert("tokenDecimals".into(), 12.into());
properties.insert("ss58Format".into(), 42.into());
@@ -156,7 +156,7 @@ pub fn local_testnet_config() -> ChainSpec {
)
},
// Bootnodes
vec![],
Vec::new(),
// Telemetry
None,
// Protocol ID
@@ -194,8 +194,7 @@ fn testnet_genesis(
},
session: parachain_template_runtime::SessionConfig {
keys: invulnerables
.iter()
.cloned()
.into_iter()
.map(|(acc, aura)| {
(
acc.clone(), // account id
+3 -3
View File
@@ -51,7 +51,7 @@ pub struct ExportGenesisStateCommand {
pub raw: bool,
/// The name of the chain for that the genesis state should be exported.
#[structopt(long, conflicts_with = "parachain-id")]
#[structopt(long)]
pub chain: Option<String>,
}
@@ -84,9 +84,9 @@ pub struct Cli {
#[structopt(flatten)]
pub run: cumulus_client_cli::RunCmd,
/// Relaychain arguments
/// Relay chain arguments
#[structopt(raw = true)]
pub relaychain_args: Vec<String>,
pub relay_chain_args: Vec<String>,
}
#[derive(Debug)]
+9 -11
View File
@@ -37,13 +37,11 @@ impl SubstrateCli for Cli {
}
fn description() -> String {
format!(
"Parachain Collator Template\n\nThe command-line arguments provided first will be \
"Parachain Collator Template\n\nThe command-line arguments provided first will be \
passed to the parachain node, while the arguments provided after -- will be passed \
to the relaychain node.\n\n\
{} [parachain-args] -- [relaychain-args]",
Self::executable_name()
)
to the relay chain node.\n\n\
parachain-collator <parachain-args> -- <relay-chain-args>"
.into()
}
fn author() -> String {
@@ -79,8 +77,8 @@ impl SubstrateCli for RelayChainCli {
fn description() -> String {
"Parachain Collator Template\n\nThe command-line arguments provided first will be \
passed to the parachain node, while the arguments provided after -- will be passed \
to the relaychain node.\n\n\
parachain-collator [parachain-args] -- [relaychain-args]"
to the relay chain node.\n\n\
parachain-collator <parachain-args> -- <relay-chain-args>"
.into()
}
@@ -168,7 +166,7 @@ pub fn run() -> Result<()> {
runner.sync_run(|config| {
let polkadot_cli = RelayChainCli::new(
&config,
[RelayChainCli::executable_name()].iter().chain(cli.relaychain_args.iter()),
[RelayChainCli::executable_name()].iter().chain(cli.relay_chain_args.iter()),
);
let polkadot_config = SubstrateCli::create_configuration(
@@ -245,11 +243,11 @@ pub fn run() -> Result<()> {
runner.run_node_until_exit(|config| async move {
let para_id = chain_spec::Extensions::try_get(&*config.chain_spec)
.map(|e| e.para_id)
.ok_or_else(|| "Could not find parachain extension for chain-spec.")?;
.ok_or_else(|| "Could not find parachain ID in chain-spec.")?;
let polkadot_cli = RelayChainCli::new(
&config,
[RelayChainCli::executable_name()].iter().chain(cli.relaychain_args.iter()),
[RelayChainCli::executable_name()].iter().chain(cli.relay_chain_args.iter()),
);
let id = ParaId::from(para_id);
+1 -1
View File
@@ -1,4 +1,4 @@
//! Substrate Node CLI library.
//! Substrate Parachain Node Template CLI
#![warn(missing_docs)]