Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ edition = "2018"

[dependencies]
parking_lot = "0.9.0"
serde = { version = "1.0.102", features = ["derive"] }
lazy_static = "1.4.0"
log = "0.4.8"
futures = "0.3.1"
Expand All @@ -27,6 +28,7 @@ primitives = { package = "sp-core", git = "https://github.com/paritytech/substra
client = { package = "sc-client", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
client-api = { package = "sc-client-api", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
client-db = { package = "sc-client-db", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
consensus_common = { package = "sp-consensus", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
Expand Down
1 change: 1 addition & 0 deletions service/res/kusama.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"tokenSymbol": "KSM"
},
"consensusEngine": null,
"forkBlocks": null,
"genesis": {
"raw": [
{
Expand Down
24 changes: 20 additions & 4 deletions service/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ use primitives::{Pair, Public, crypto::UncheckedInto, sr25519};
use polkadot_primitives::{AccountId, AccountPublic, parachain::ValidatorId};
use polkadot_runtime as polkadot;
use polkadot_runtime::constants::currency::DOTS;
use sc_chain_spec::ChainSpecExtension;
use sp_runtime::{traits::IdentifyAccount, Perbill};
use serde::{Serialize, Deserialize};
use telemetry::TelemetryEndpoints;
use hex_literal::hex;
use babe_primitives::AuthorityId as BabeId;
Expand All @@ -32,11 +34,25 @@ use pallet_staking::Forcing;
const STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/";
const DEFAULT_PROTOCOL_ID: &str = "dot";

/// Node `ChainSpec` extensions.
///
/// Additional parameters for some Substrate core modules,
/// customizable from the chain spec.
#[derive(Default, Clone, Serialize, Deserialize, ChainSpecExtension)]
#[serde(rename_all = "camelCase")]
pub struct Extensions {
/// Block numbers with known hashes.
pub fork_blocks: client::ForkBlocks<polkadot_primitives::Block>,
}

/// The `ChainSpec`.
///
/// We use the same `ChainSpec` type for Polkadot and Kusama. As Kusama
/// is only loaded from a file, the `GenesisConfig` type is not used.
pub type ChainSpec = service::ChainSpec<polkadot::GenesisConfig>;
pub type ChainSpec = service::ChainSpec<
polkadot::GenesisConfig,
Extensions,
>;

pub fn kusama_config() -> Result<ChainSpec, String> {
ChainSpec::from_json_bytes(&include_bytes!("../res/kusama.json")[..])
Expand Down Expand Up @@ -214,7 +230,7 @@ pub fn staging_testnet_config() -> ChainSpec {
Some(TelemetryEndpoints::new(vec![(STAGING_TELEMETRY_URL.to_string(), 0)])),
Some(DEFAULT_PROTOCOL_ID),
None,
None,
Default::default(),
)
}

Expand Down Expand Up @@ -361,7 +377,7 @@ pub fn development_config() -> ChainSpec {
None,
Some(DEFAULT_PROTOCOL_ID),
None,
None,
Default::default(),
)
}

Expand All @@ -386,6 +402,6 @@ pub fn local_testnet_config() -> ChainSpec {
None,
Some(DEFAULT_PROTOCOL_ID),
None,
None,
Default::default(),
)
}
6 changes: 5 additions & 1 deletion service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ pub struct CustomConfiguration {
/// Configuration type that is being used.
///
/// See [`ChainSpec`] for more information why Polkadot `GenesisConfig` is safe here.
pub type Configuration = service::Configuration<CustomConfiguration, polkadot_runtime::GenesisConfig>;
pub type Configuration = service::Configuration<
CustomConfiguration,
polkadot_runtime::GenesisConfig,
chain_spec::Extensions,
>;

impl Default for CustomConfiguration {
fn default() -> Self {
Expand Down