diff --git a/node/src/chain_spec/crab.rs b/node/src/chain_spec/crab.rs index c1eb487d1..426353994 100644 --- a/node/src/chain_spec/crab.rs +++ b/node/src/chain_spec/crab.rs @@ -24,51 +24,42 @@ use std::{collections::BTreeMap, str::FromStr}; use cumulus_primitives_core::ParaId; // darwinia use super::*; -use crab_runtime::{AuraId, CrabPrecompiles, EvmConfig, Runtime}; +use crab_runtime::*; use dc_primitives::*; // frontier use fp_evm::GenesisAccount; // substrate +use sc_chain_spec::Properties; use sc_service::ChainType; use sp_core::H160; /// Specialized `ChainSpec` for the normal parachain runtime. -pub type ChainSpec = sc_service::GenericChainSpec; +pub type ChainSpec = sc_service::GenericChainSpec; -/// Generate the session keys from individual elements. -/// -/// The input must be a tuple of individual keys (a single arg for now since we have just one key). -pub fn session_keys(keys: AuraId) -> crab_runtime::SessionKeys { - crab_runtime::SessionKeys { aura: keys } +fn properties() -> Properties { + super::properties("CRAB", 42) } -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(), "CRAB".into()); - properties.insert("tokenDecimals".into(), 18.into()); - properties.insert("ss58Format".into(), 42.into()); +// Generate the session keys from individual elements. +// +// The input must be a tuple of individual keys (a single arg for now since we have just one key). +fn session_keys(keys: AuraId) -> SessionKeys { + SessionKeys { aura: keys } +} +pub fn development_config() -> ChainSpec { ChainSpec::from_genesis( - // Name "Crab2 Development", - // ID - "crab-dev", + "crab2-development", ChainType::Development, move || { testnet_genesis( - // initial collators. vec![ // Bind the `Alice` to `Alith` to make `--alice` available for testnet. ( array_bytes::hex_n_into_unchecked(ALITH), get_collator_keys_from_seed("Alice"), ), - // Bind the `Bob` to `Balthar` to make `--bob` available for testnet. - ( - array_bytes::hex_n_into_unchecked(BALTATHAR), - get_collator_keys_from_seed("Bob"), - ), ], vec![ array_bytes::hex_n_into_unchecked(ALITH), @@ -83,9 +74,9 @@ pub fn development_config() -> ChainSpec { }, Vec::new(), None, + Some(PROTOCOL_ID), None, - None, - Some(properties), + Some(properties()), Extensions { relay_chain: "rococo-local".into(), // You MUST set this to the correct network! para_id: 2105, @@ -93,22 +84,13 @@ 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(), "CRAB".into()); - properties.insert("tokenDecimals".into(), 18.into()); - properties.insert("ss58Format".into(), 42.into()); - +pub fn local_config() -> ChainSpec { ChainSpec::from_genesis( - // Name - "Crab2 Local Testnet", - // ID - "crab_local_testnet", + "Crab2 Local", + "crab2-local", ChainType::Local, move || { testnet_genesis( - // initial collators. vec![ // Bind the `Alice` to `Alith` to make `--alice` available for testnet. ( @@ -120,6 +102,11 @@ pub fn local_testnet_config() -> ChainSpec { array_bytes::hex_n_into_unchecked(BALTATHAR), get_collator_keys_from_seed("Bob"), ), + // Bind the `Charlie` to `CHARLETH` to make `--charlie` available for testnet. + ( + array_bytes::hex_n_into_unchecked(CHARLETH), + get_collator_keys_from_seed("Charlie"), + ), ], vec![ array_bytes::hex_n_into_unchecked(ALITH), @@ -132,17 +119,11 @@ pub fn local_testnet_config() -> ChainSpec { 2105.into(), ) }, - // Bootnodes Vec::new(), - // Telemetry None, - // Protocol ID - Some("crab"), - // Fork ID + Some(PROTOCOL_ID), None, - // Properties - Some(properties), - // Extensions + Some(properties()), Extensions { relay_chain: "rococo-local".into(), // You MUST set this to the correct network! para_id: 2105, @@ -150,30 +131,20 @@ pub fn local_testnet_config() -> ChainSpec { ) } -pub fn config() -> ChainSpec { - // Give your base currency a unit name and decimal places - let mut properties = sc_chain_spec::Properties::new(); - properties.insert("tokenSymbol".into(), "CRAB".into()); - properties.insert("tokenDecimals".into(), 18.into()); - properties.insert("ss58Format".into(), 42.into()); - +pub fn genesis_config() -> ChainSpec { // TODO: update this before final release ChainSpec::from_genesis( // Name "Crab2", // ID - "crab", + "crab2", ChainType::Live, move || { - crab_runtime::GenesisConfig { + GenesisConfig { // System stuff. - system: crab_runtime::SystemConfig { - code: crab_runtime::WASM_BINARY - .expect("WASM binary was not build, please build it!") - .to_vec(), - }, + system: SystemConfig { code: WASM_BINARY.unwrap().to_vec() }, parachain_system: Default::default(), - parachain_info: crab_runtime::ParachainInfoConfig { parachain_id: 2105.into() }, + parachain_info: ParachainInfoConfig { parachain_id: 2105.into() }, // Monetary stuff. balances: Default::default(), @@ -182,11 +153,11 @@ pub fn config() -> ChainSpec { account_migration: Default::default(), // Consensus stuff. - collator_selection: crab_runtime::CollatorSelectionConfig { + collator_selection: CollatorSelectionConfig { invulnerables: vec![array_bytes::hex_n_into_unchecked(ALITH)], ..Default::default() }, - session: crab_runtime::SessionConfig { + session: SessionConfig { keys: vec![( array_bytes::hex_n_into_unchecked(ALITH), array_bytes::hex_n_into_unchecked(ALITH), @@ -211,32 +182,24 @@ pub fn config() -> ChainSpec { vesting: Default::default(), // XCM stuff. - polkadot_xcm: crab_runtime::PolkadotXcmConfig { - safe_xcm_version: Some(SAFE_XCM_VERSION), - }, + polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION) }, // EVM stuff. ethereum: Default::default(), evm: Default::default(), base_fee: Default::default(), - // S2S stuff + // S2S stuff. bridge_darwinia_grandpa: Default::default(), bridge_darwinia_messages: Default::default(), darwinia_fee_market: Default::default(), } }, - // Bootnodes Vec::new(), - // Telemetry None, - // Protocol ID - Some("crab"), - // Fork ID + Some(PROTOCOL_ID), None, - // Properties - Some(properties), - // Extensions + Some(properties()), Extensions { relay_chain: "kusama".into(), // You MUST set this to the correct network! para_id: 2105, @@ -244,19 +207,23 @@ pub fn config() -> ChainSpec { ) } +pub fn config() -> ChainSpec { + unimplemented!("TODO") +} + fn testnet_genesis( invulnerables: Vec<(AccountId, AuraId)>, endowed_accounts: Vec, id: ParaId, -) -> crab_runtime::GenesisConfig { - crab_runtime::GenesisConfig { +) -> GenesisConfig { + GenesisConfig { // System stuff. - system: crab_runtime::SystemConfig { code: crab_runtime::WASM_BINARY.unwrap().to_vec() }, + system: SystemConfig { code: WASM_BINARY.unwrap().to_vec() }, parachain_system: Default::default(), - parachain_info: crab_runtime::ParachainInfoConfig { parachain_id: id }, + parachain_info: ParachainInfoConfig { parachain_id: id }, // Monetary stuff. - balances: crab_runtime::BalancesConfig { + balances: BalancesConfig { balances: endowed_accounts.iter().cloned().map(|k| (k, 100_000_000 * UNIT)).collect(), }, transaction_payment: Default::default(), @@ -264,12 +231,12 @@ fn testnet_genesis( account_migration: Default::default(), // Consensus stuff. - collator_selection: crab_runtime::CollatorSelectionConfig { + collator_selection: CollatorSelectionConfig { invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), candidacy_bond: UNIT, ..Default::default() }, - session: crab_runtime::SessionConfig { + session: SessionConfig { keys: invulnerables .into_iter() .map(|(acc, aura)| { @@ -281,8 +248,6 @@ fn testnet_genesis( }) .collect(), }, - // no need to pass anything to aura, in fact it will panic if we do. Session will take care - // of this. aura: Default::default(), aura_ext: Default::default(), @@ -299,7 +264,7 @@ fn testnet_genesis( vesting: Default::default(), // XCM stuff. - polkadot_xcm: crab_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION) }, + polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION) }, // EVM stuff. ethereum: Default::default(), @@ -347,13 +312,9 @@ fn testnet_genesis( }, base_fee: Default::default(), - // S2S stuff + // S2S stuff. bridge_darwinia_grandpa: Default::default(), bridge_darwinia_messages: Default::default(), darwinia_fee_market: Default::default(), } } - -pub fn genesis_config() -> ChainSpec { - unimplemented!("TODO") -} diff --git a/node/src/chain_spec/darwinia.rs b/node/src/chain_spec/darwinia.rs index 0c42b96c4..9fa5ce7af 100644 --- a/node/src/chain_spec/darwinia.rs +++ b/node/src/chain_spec/darwinia.rs @@ -41,10 +41,9 @@ use sp_core::H160; pub type ChainSpec = sc_service::GenericChainSpec; fn properties() -> Properties { - super::properties("RING") + super::properties("RING", 18) } -// TODO: maybe a more general one // Generate the session keys from individual elements. // // The input must be a tuple of individual keys (a single arg for now since we have just one key). @@ -54,30 +53,17 @@ fn session_keys(keys: AuraId) -> SessionKeys { pub fn development_config() -> ChainSpec { ChainSpec::from_genesis( - // Name "Darwinia2 Development", - // ID "darwinia2-development", ChainType::Development, move || { testnet_genesis( - // Initial collators. vec![ // Bind the `Alice` to `Alith` to make `--alice` available for testnet. ( array_bytes::hex_n_into_unchecked(ALITH), get_collator_keys_from_seed("Alice"), ), - // Bind the `Bob` to `Balthar` to make `--bob` available for testnet. - ( - array_bytes::hex_n_into_unchecked(BALTATHAR), - get_collator_keys_from_seed("Bob"), - ), - // Bind the `Charlie` to `CHARLETH` to make `--charlie` available for testnet. - ( - array_bytes::hex_n_into_unchecked(CHARLETH), - get_collator_keys_from_seed("Charlie"), - ), ], vec![ array_bytes::hex_n_into_unchecked(ALITH), @@ -92,7 +78,7 @@ pub fn development_config() -> ChainSpec { }, Vec::new(), None, - None, + Some(PROTOCOL_ID), None, Some(properties()), Extensions { @@ -104,14 +90,11 @@ pub fn development_config() -> ChainSpec { pub fn local_config() -> ChainSpec { ChainSpec::from_genesis( - // Name "Darwinia2 Local", - // ID "darwinia2-local", ChainType::Local, move || { testnet_genesis( - // Initial collators. vec![ // Bind the `Alice` to `Alith` to make `--alice` available for testnet. ( @@ -142,7 +125,7 @@ pub fn local_config() -> ChainSpec { }, Vec::new(), None, - None, + Some(PROTOCOL_ID), None, Some(properties()), Extensions { @@ -163,11 +146,7 @@ pub fn genesis_config() -> ChainSpec { move || { GenesisConfig { // System stuff. - system: SystemConfig { - code: WASM_BINARY - .expect("WASM binary was not build, please build it!") - .to_vec(), - }, + system: SystemConfig { code: WASM_BINARY.unwrap().to_vec() }, parachain_system: Default::default(), parachain_info: ParachainInfoConfig { parachain_id: 2046.into() }, @@ -214,23 +193,17 @@ pub fn genesis_config() -> ChainSpec { evm: Default::default(), base_fee: Default::default(), - // S2S stuff + // S2S stuff. bridge_crab_grandpa: Default::default(), bridge_crab_messages: Default::default(), crab_fee_market: Default::default(), } }, - // Bootnodes Vec::new(), - // Telemetry None, - // Protocol ID - Some("darwinia"), - // Fork ID + Some(PROTOCOL_ID), None, - // Properties Some(properties()), - // Extensions Extensions { relay_chain: "polkadot".into(), // You MUST set this to the correct network! para_id: 2046, @@ -344,7 +317,7 @@ fn testnet_genesis( }, base_fee: Default::default(), - // S2S stuff + // S2S stuff. bridge_crab_grandpa: Default::default(), bridge_crab_messages: Default::default(), crab_fee_market: Default::default(), diff --git a/node/src/chain_spec/mod.rs b/node/src/chain_spec/mod.rs index 9ec06988b..6f7cfbaba 100644 --- a/node/src/chain_spec/mod.rs +++ b/node/src/chain_spec/mod.rs @@ -50,6 +50,8 @@ const FAITH: &str = "0xC0F0f4ab324C46e55D02D0033343B4Be8A55532d"; /// The default XCM version to set in genesis config. const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION; +const PROTOCOL_ID: &str = "dar"; + /// The extensions for the [`ChainSpec`]. #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, ChainSpecGroup, ChainSpecExtension)] #[serde(deny_unknown_fields)] @@ -66,12 +68,12 @@ impl Extensions { } } -fn properties(token_symbol: &str) -> Properties { +fn properties(token_symbol: &str, ss58_format: u16) -> Properties { let mut properties = Properties::new(); properties.insert("tokenSymbol".into(), token_symbol.into()); properties.insert("tokenDecimals".into(), 18.into()); - properties.insert("ss58Format".into(), 18.into()); + properties.insert("ss58Format".into(), ss58_format.into()); properties } diff --git a/node/src/chain_spec/pangolin.rs b/node/src/chain_spec/pangolin.rs index d6f66de12..42a58a0fd 100644 --- a/node/src/chain_spec/pangolin.rs +++ b/node/src/chain_spec/pangolin.rs @@ -25,50 +25,41 @@ use cumulus_primitives_core::ParaId; // darwinia use super::*; use dc_primitives::*; -use pangolin_runtime::{AuraId, EvmConfig, PangolinPrecompiles, Runtime}; +use pangolin_runtime::*; // frontier use fp_evm::GenesisAccount; // substrate +use sc_chain_spec::Properties; use sc_service::ChainType; use sp_core::H160; /// Specialized `ChainSpec` for the normal parachain runtime. -pub type ChainSpec = sc_service::GenericChainSpec; +pub type ChainSpec = sc_service::GenericChainSpec; -/// Generate the session keys from individual elements. -/// -/// The input must be a tuple of individual keys (a single arg for now since we have just one key). -pub fn session_keys(keys: AuraId) -> pangolin_runtime::SessionKeys { - pangolin_runtime::SessionKeys { aura: keys } +fn properties() -> Properties { + super::properties("PRING", 42) } -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(), "PRING".into()); - properties.insert("tokenDecimals".into(), 18.into()); - properties.insert("ss58Format".into(), 42.into()); +// Generate the session keys from individual elements. +// +// The input must be a tuple of individual keys (a single arg for now since we have just one key). +fn session_keys(keys: AuraId) -> SessionKeys { + SessionKeys { aura: keys } +} +pub fn development_config() -> ChainSpec { ChainSpec::from_genesis( - // Name "Pangolin2 Development", - // ID - "pangolin-dev", + "pangolin2-development", ChainType::Development, move || { testnet_genesis( - // initial collators. vec![ // Bind the `Alice` to `Alith` to make `--alice` available for testnet. ( array_bytes::hex_n_into_unchecked(ALITH), get_collator_keys_from_seed("Alice"), ), - // Bind the `Bob` to `Balthar` to make `--bob` available for testnet. - ( - array_bytes::hex_n_into_unchecked(BALTATHAR), - get_collator_keys_from_seed("Bob"), - ), ], vec![ array_bytes::hex_n_into_unchecked(ALITH), @@ -83,9 +74,9 @@ pub fn development_config() -> ChainSpec { }, Vec::new(), None, + Some(PROTOCOL_ID), None, - None, - Some(properties), + Some(properties()), Extensions { relay_chain: "rococo-local".into(), // You MUST set this to the correct network! para_id: 2105, @@ -93,22 +84,13 @@ 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(), "PRING".into()); - properties.insert("tokenDecimals".into(), 18.into()); - properties.insert("ss58Format".into(), 42.into()); - +pub fn local_config() -> ChainSpec { ChainSpec::from_genesis( - // Name - "Pangolin2 Local Testnet", - // ID - "pangolin_local_testnet", + "Pangolin2 Local", + "pangolin2-local", ChainType::Local, move || { testnet_genesis( - // initial collators. vec![ // Bind the `Alice` to `Alith` to make `--alice` available for testnet. ( @@ -120,6 +102,11 @@ pub fn local_testnet_config() -> ChainSpec { array_bytes::hex_n_into_unchecked(BALTATHAR), get_collator_keys_from_seed("Bob"), ), + // Bind the `Charlie` to `CHARLETH` to make `--charlie` available for testnet. + ( + array_bytes::hex_n_into_unchecked(CHARLETH), + get_collator_keys_from_seed("Charlie"), + ), ], vec![ array_bytes::hex_n_into_unchecked(ALITH), @@ -132,17 +119,11 @@ pub fn local_testnet_config() -> ChainSpec { 2105.into(), ) }, - // Bootnodes Vec::new(), - // Telemetry None, - // Protocol ID - Some("crab"), - // Fork ID + Some(PROTOCOL_ID), None, - // Properties - Some(properties), - // Extensions + Some(properties()), Extensions { relay_chain: "rococo-local".into(), // You MUST set this to the correct network! para_id: 2105, @@ -150,30 +131,20 @@ pub fn local_testnet_config() -> ChainSpec { ) } -pub fn config() -> ChainSpec { - // Give your base currency a unit name and decimal places - let mut properties = sc_chain_spec::Properties::new(); - properties.insert("tokenSymbol".into(), "PRING".into()); - properties.insert("tokenDecimals".into(), 18.into()); - properties.insert("ss58Format".into(), 42.into()); - +pub fn genesis_config() -> ChainSpec { // TODO: update this before final release ChainSpec::from_genesis( // Name "Pangolin2", // ID - "pangolin", + "pangolin2", ChainType::Live, move || { - pangolin_runtime::GenesisConfig { + GenesisConfig { // System stuff. - system: pangolin_runtime::SystemConfig { - code: pangolin_runtime::WASM_BINARY - .expect("WASM binary was not build, please build it!") - .to_vec(), - }, + system: SystemConfig { code: WASM_BINARY.unwrap().to_vec() }, parachain_system: Default::default(), - parachain_info: pangolin_runtime::ParachainInfoConfig { parachain_id: 2105.into() }, + parachain_info: ParachainInfoConfig { parachain_id: 2105.into() }, // Monetary stuff. balances: Default::default(), @@ -182,11 +153,11 @@ pub fn config() -> ChainSpec { account_migration: Default::default(), // Consensus stuff. - collator_selection: pangolin_runtime::CollatorSelectionConfig { + collator_selection: CollatorSelectionConfig { invulnerables: vec![array_bytes::hex_n_into_unchecked(ALITH)], ..Default::default() }, - session: pangolin_runtime::SessionConfig { + session: SessionConfig { keys: vec![( array_bytes::hex_n_into_unchecked(ALITH), array_bytes::hex_n_into_unchecked(ALITH), @@ -211,9 +182,7 @@ pub fn config() -> ChainSpec { vesting: Default::default(), // XCM stuff. - polkadot_xcm: pangolin_runtime::PolkadotXcmConfig { - safe_xcm_version: Some(SAFE_XCM_VERSION), - }, + polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION) }, // EVM stuff. ethereum: Default::default(), @@ -221,17 +190,11 @@ pub fn config() -> ChainSpec { base_fee: Default::default(), } }, - // Bootnodes Vec::new(), - // Telemetry None, - // Protocol ID - Some("pangolin"), - // Fork ID + Some(PROTOCOL_ID), None, - // Properties - Some(properties), - // Extensions + Some(properties()), Extensions { relay_chain: "rococo".into(), // You MUST set this to the correct network! para_id: 2105, @@ -239,21 +202,23 @@ pub fn config() -> ChainSpec { ) } +pub fn config() -> ChainSpec { + unimplemented!("TODO") +} + fn testnet_genesis( invulnerables: Vec<(AccountId, AuraId)>, endowed_accounts: Vec, id: ParaId, -) -> pangolin_runtime::GenesisConfig { - pangolin_runtime::GenesisConfig { +) -> GenesisConfig { + GenesisConfig { // System stuff. - system: pangolin_runtime::SystemConfig { - code: pangolin_runtime::WASM_BINARY.unwrap().to_vec(), - }, + system: SystemConfig { code: WASM_BINARY.unwrap().to_vec() }, parachain_system: Default::default(), - parachain_info: pangolin_runtime::ParachainInfoConfig { parachain_id: id }, + parachain_info: ParachainInfoConfig { parachain_id: id }, // Monetary stuff. - balances: pangolin_runtime::BalancesConfig { + balances: BalancesConfig { balances: endowed_accounts.iter().cloned().map(|k| (k, 100_000_000 * UNIT)).collect(), }, transaction_payment: Default::default(), @@ -261,12 +226,12 @@ fn testnet_genesis( account_migration: Default::default(), // Consensus stuff. - collator_selection: pangolin_runtime::CollatorSelectionConfig { + collator_selection: CollatorSelectionConfig { invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), candidacy_bond: UNIT, ..Default::default() }, - session: pangolin_runtime::SessionConfig { + session: SessionConfig { keys: invulnerables .into_iter() .map(|(acc, aura)| { @@ -278,8 +243,6 @@ fn testnet_genesis( }) .collect(), }, - // no need to pass anything to aura, in fact it will panic if we do. Session will take care - // of this. aura: Default::default(), aura_ext: Default::default(), @@ -296,9 +259,7 @@ fn testnet_genesis( vesting: Default::default(), // XCM stuff. - polkadot_xcm: pangolin_runtime::PolkadotXcmConfig { - safe_xcm_version: Some(SAFE_XCM_VERSION), - }, + polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION) }, // EVM stuff. ethereum: Default::default(), @@ -347,7 +308,3 @@ fn testnet_genesis( base_fee: Default::default(), } } - -pub fn genesis_config() -> ChainSpec { - unimplemented!("TODO") -} diff --git a/node/src/command.rs b/node/src/command.rs index 1cf8b0783..566199932 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -607,11 +607,11 @@ fn load_spec(id: &str) -> std::result::Result, String> { "crab" => Box::new(crab_chain_spec::config()), "crab-genesis" => Box::new(crab_chain_spec::genesis_config()), "crab-dev" => Box::new(crab_chain_spec::development_config()), - "crab-local" => Box::new(crab_chain_spec::local_testnet_config()), + "crab-local" => Box::new(crab_chain_spec::local_config()), "pangolin" => Box::new(pangolin_chain_spec::config()), "pangolin-genesis" => Box::new(pangolin_chain_spec::genesis_config()), "pangolin-dev" => Box::new(pangolin_chain_spec::development_config()), - "pangolin-local" => Box::new(pangolin_chain_spec::local_testnet_config()), + "pangolin-local" => Box::new(pangolin_chain_spec::local_config()), _ => { let path = PathBuf::from(id); let chain_spec = diff --git a/pallet/staking/src/lib.rs b/pallet/staking/src/lib.rs index b61ded027..91b78e9be 100644 --- a/pallet/staking/src/lib.rs +++ b/pallet/staking/src/lib.rs @@ -294,10 +294,10 @@ pub mod pallet { pub type RewardPoints = StorageValue<_, (RewardPoint, BTreeMap), ValueQuery>; - /// Active session's started timestamp. + /// Active session's start-time. #[pallet::storage] - #[pallet::getter(fn session_started_time)] - pub type SessionStartedTime = StorageValue<_, Moment, ValueQuery>; + #[pallet::getter(fn session_start_time)] + pub type SessionStartTime = StorageValue<_, Moment, ValueQuery>; /// Elapsed time. #[pallet::storage] @@ -324,7 +324,7 @@ pub mod pallet { #[pallet::genesis_build] impl GenesisBuild for GenesisConfig { fn build(&self) { - >::put(self.now); + >::put(self.now); >::put(self.elapsed_time); >::put(self.collator_count); @@ -895,14 +895,14 @@ where fn end_session(_: u32) { let now = T::UnixTime::now().as_millis(); - let session_duration = now - >::get(); + let session_duration = now - >::get(); let elapsed_time = >::mutate(|t| { *t += session_duration; *t }); - >::put(now); + >::put(now); Self::payout(session_duration, elapsed_time); Self::clean_old_session(); diff --git a/runtime/crab/src/lib.rs b/runtime/crab/src/lib.rs index 63201b349..9789a29b5 100644 --- a/runtime/crab/src/lib.rs +++ b/runtime/crab/src/lib.rs @@ -316,7 +316,7 @@ frame_support::construct_runtime! { BaseFee: pallet_base_fee = 33, MessageTransact: darwinia_message_transact = 39, - // S2S stuff + // S2S stuff. BridgeDarwiniaGrandpa: pallet_bridge_grandpa:: = 35, BridgeDarwiniaMessages: pallet_bridge_messages:: = 36, BridgeDarwiniaDispatch: pallet_bridge_dispatch:: = 37, diff --git a/runtime/crab/src/pallets/mod.rs b/runtime/crab/src/pallets/mod.rs index 493f9ddc5..169c4eff8 100644 --- a/runtime/crab/src/pallets/mod.rs +++ b/runtime/crab/src/pallets/mod.rs @@ -104,7 +104,7 @@ mod base_fee; mod message_transact; -// S2S stuff +// S2S stuff. mod bridge_dispatch; pub use bridge_dispatch::*; diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index d8f6bafdb..c1f694ab2 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -315,7 +315,7 @@ frame_support::construct_runtime! { BaseFee: pallet_base_fee = 33, MessageTransact: darwinia_message_transact = 39, - // S2S stuff + // S2S stuff. BridgeCrabGrandpa: pallet_bridge_grandpa:: = 35, BridgeCrabMessages: pallet_bridge_messages:: = 36, BridgeCrabDispatch: pallet_bridge_dispatch:: = 37, diff --git a/runtime/darwinia/src/pallets/mod.rs b/runtime/darwinia/src/pallets/mod.rs index 31c61b9d9..01d8f6b29 100644 --- a/runtime/darwinia/src/pallets/mod.rs +++ b/runtime/darwinia/src/pallets/mod.rs @@ -105,7 +105,7 @@ mod base_fee; mod message_transact; -// S2S stuff +// S2S stuff. mod bridge_dispatch; pub use bridge_dispatch::*;