mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 02:17:58 +00:00
Moves node-template into substrate repo (#1637)
* Make runtime macros work without required `macro_use` * Adds node-template * Adds node-template-release tool * Fixes building `node-template` and improve the release * Add `profile.release` by release script to remove warning * Adds script for releasing the node template * Fixes compilation after master merge * Port node-template to edition 2018 * Remove license * Fixes compilation after master merge * Add `node-template-release.sh` into the CI * WIP Ci integrate node template (#1701) * copy artifacts to s3 bucket latest path * typo * bucket name * Update wasm files
This commit is contained in:
@@ -0,0 +1,104 @@
|
||||
use primitives::{Ed25519AuthorityId, ed25519};
|
||||
use node_template_runtime::{
|
||||
AccountId, GenesisConfig, ConsensusConfig, TimestampConfig, BalancesConfig,
|
||||
SudoConfig, IndicesConfig
|
||||
};
|
||||
use substrate_service;
|
||||
|
||||
// Note this is the URL for the telemetry server
|
||||
//const STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/";
|
||||
|
||||
/// Specialised `ChainSpec`. This is a specialisation of the general Substrate ChainSpec type.
|
||||
pub type ChainSpec = substrate_service::ChainSpec<GenesisConfig>;
|
||||
|
||||
/// The chain specification option. This is expected to come in from the CLI and
|
||||
/// is little more than one of a number of alternatives which can easily be converted
|
||||
/// from a string (`--chain=...`) into a `ChainSpec`.
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum Alternative {
|
||||
/// Whatever the current runtime is, with just Alice as an auth.
|
||||
Development,
|
||||
/// Whatever the current runtime is, with simple Alice/Bob auths.
|
||||
LocalTestnet,
|
||||
}
|
||||
|
||||
impl Alternative {
|
||||
/// Get an actual chain config from one of the alternatives.
|
||||
pub(crate) fn load(self) -> Result<ChainSpec, String> {
|
||||
Ok(match self {
|
||||
Alternative::Development => ChainSpec::from_genesis(
|
||||
"Development",
|
||||
"dev",
|
||||
|| testnet_genesis(vec![
|
||||
ed25519::Pair::from_seed(b"Alice ").public().into(),
|
||||
], vec![
|
||||
ed25519::Pair::from_seed(b"Alice ").public().0.into(),
|
||||
],
|
||||
ed25519::Pair::from_seed(b"Alice ").public().0.into()
|
||||
),
|
||||
vec![],
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None
|
||||
),
|
||||
Alternative::LocalTestnet => ChainSpec::from_genesis(
|
||||
"Local Testnet",
|
||||
"local_testnet",
|
||||
|| testnet_genesis(vec![
|
||||
ed25519::Pair::from_seed(b"Alice ").public().into(),
|
||||
ed25519::Pair::from_seed(b"Bob ").public().into(),
|
||||
], vec![
|
||||
ed25519::Pair::from_seed(b"Alice ").public().0.into(),
|
||||
ed25519::Pair::from_seed(b"Bob ").public().0.into(),
|
||||
ed25519::Pair::from_seed(b"Charlie ").public().0.into(),
|
||||
ed25519::Pair::from_seed(b"Dave ").public().0.into(),
|
||||
ed25519::Pair::from_seed(b"Eve ").public().0.into(),
|
||||
ed25519::Pair::from_seed(b"Ferdie ").public().0.into(),
|
||||
],
|
||||
ed25519::Pair::from_seed(b"Alice ").public().0.into()
|
||||
),
|
||||
vec![],
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None
|
||||
),
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn from(s: &str) -> Option<Self> {
|
||||
match s {
|
||||
"dev" => Some(Alternative::Development),
|
||||
"" | "local" => Some(Alternative::LocalTestnet),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn testnet_genesis(initial_authorities: Vec<Ed25519AuthorityId>, endowed_accounts: Vec<AccountId>, root_key: AccountId) -> GenesisConfig {
|
||||
GenesisConfig {
|
||||
consensus: Some(ConsensusConfig {
|
||||
code: include_bytes!("../runtime/wasm/target/wasm32-unknown-unknown/release/node_template_runtime_wasm.compact.wasm").to_vec(),
|
||||
authorities: initial_authorities.clone(),
|
||||
}),
|
||||
system: None,
|
||||
timestamp: Some(TimestampConfig {
|
||||
period: 5, // 5 second block time.
|
||||
}),
|
||||
indices: Some(IndicesConfig {
|
||||
ids: endowed_accounts.clone(),
|
||||
}),
|
||||
balances: Some(BalancesConfig {
|
||||
transaction_base_fee: 1,
|
||||
transaction_byte_fee: 0,
|
||||
existential_deposit: 500,
|
||||
transfer_fee: 0,
|
||||
creation_fee: 0,
|
||||
balances: endowed_accounts.iter().map(|&k|(k, (1 << 60))).collect(),
|
||||
}),
|
||||
sudo: Some(SudoConfig {
|
||||
key: root_key,
|
||||
}),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user