Commit 7acd1bd9 authored by André Silva's avatar André Silva Committed by Bastian Köcher
Browse files

service: support setting fork blocks in config (#719)

parent b5e5c97f
Pipeline #73429 passed with stages
in 17 minutes and 42 seconds
......@@ -3982,6 +3982,7 @@ dependencies = [
"polkadot-runtime 0.7.11",
"polkadot-validation 0.7.11",
"sc-authority-discovery 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sc-chain-spec 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sc-client 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sc-client-api 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sc-client-db 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
......@@ -3993,6 +3994,7 @@ dependencies = [
"sc-service 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sc-telemetry 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sc-transaction-pool 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)",
"slog 2.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"sp-api 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
"sp-authority-discovery 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
......
......@@ -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"
......@@ -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" }
......
......@@ -25,6 +25,7 @@
"tokenSymbol": "KSM"
},
"consensusEngine": null,
"forkBlocks": null,
"genesis": {
"raw": [
{
......@@ -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;
......@@ -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")[..])
......@@ -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(),
)
}
......@@ -361,7 +377,7 @@ pub fn development_config() -> ChainSpec {
None,
Some(DEFAULT_PROTOCOL_ID),
None,
None,
Default::default(),
)
}
......@@ -386,6 +402,6 @@ pub fn local_testnet_config() -> ChainSpec {
None,
Some(DEFAULT_PROTOCOL_ID),
None,
None,
Default::default(),
)
}
......@@ -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 {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment