Skip to content

Commit

Permalink
fix sync states for light client
Browse files Browse the repository at this point in the history
  • Loading branch information
Centril committed Jan 13, 2022
1 parent 44f260e commit dbd4259
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ sc-rpc = "4.0.0-dev"
sc-service = { version = "0.10.0-dev", features = ["wasmtime"] }
sc-telemetry = "4.0.0-dev"
sc-transaction-pool = "4.0.0-dev"
sc-sync-state-rpc = { version = "0.10.0-dev" }
sp-api = "4.0.0-dev"
sp-authority-discovery = "4.0.0-dev"
sp-authorship = "4.0.0-dev"
Expand Down
25 changes: 20 additions & 5 deletions src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,21 @@ const BABE_GENESIS: pallet_babe::GenesisConfig = pallet_babe::GenesisConfig {
epoch_config: Some(BABE_GENESIS_EPOCH_CONFIG),
};

/// Node `ChainSpec` extensions.
///
/// Additional parameters for some Substrate core modules,
/// customizable from the chain spec.
#[derive(Default, Clone, Serialize, Deserialize, sc_chain_spec::ChainSpecExtension)]
#[serde(rename_all = "camelCase")]
pub struct Extensions {
/// The light sync state.
///
/// This value will be set by the `sync-state rpc` implementation.
pub light_sync_state: sc_sync_state_rpc::LightSyncStateExtension,
}

pub type GenericChainSpec<R> = sc_service::GenericChainSpec<R, Extensions>;

/// Generate a crypto pair from seed.
pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
TPublic::Pair::from_string(&format!("//{}", seed), None)
Expand Down Expand Up @@ -608,7 +623,7 @@ pub mod general {
use super::*;
use polymesh_runtime_develop::{self as rt, constants::time};

pub type ChainSpec = sc_service::GenericChainSpec<rt::runtime::GenesisConfig>;
pub type ChainSpec = GenericChainSpec<rt::runtime::GenesisConfig>;

session_keys!();

Expand Down Expand Up @@ -717,7 +732,7 @@ pub mod general {
genesis: impl 'static + Sync + Send + Fn() -> rt::runtime::GenesisConfig,
) -> ChainSpec {
let props = Some(polymath_props(42));
ChainSpec::from_genesis(name, id, ctype, genesis, vec![], None, None, props, None)
ChainSpec::from_genesis(name, id, ctype, genesis, vec![], None, None, props, <_>::default())
}

pub fn develop_config() -> ChainSpec {
Expand Down Expand Up @@ -766,7 +781,7 @@ pub mod testnet {
use super::*;
use polymesh_runtime_testnet::{self as rt, constants::time};

pub type ChainSpec = sc_service::GenericChainSpec<rt::runtime::GenesisConfig>;
pub type ChainSpec = GenericChainSpec<rt::runtime::GenesisConfig>;

session_keys!();

Expand Down Expand Up @@ -958,7 +973,7 @@ pub mod mainnet {
use super::*;
use polymesh_runtime_mainnet::{self as rt, constants::time};

pub type ChainSpec = sc_service::GenericChainSpec<rt::runtime::GenesisConfig>;
pub type ChainSpec = GenericChainSpec<rt::runtime::GenesisConfig>;

session_keys!();

Expand Down Expand Up @@ -1154,7 +1169,7 @@ pub mod ci {
use super::*;
use polymesh_runtime_ci::{self as rt, constants::time};

pub type ChainSpec = sc_service::GenericChainSpec<rt::runtime::GenesisConfig>;
pub type ChainSpec = GenericChainSpec<rt::runtime::GenesisConfig>;

session_keys!();

Expand Down

0 comments on commit dbd4259

Please sign in to comment.