Extract Runtime Constants into Separate Crates (#4456)

* kusama-runtime-constants created

* polkadot_runtime_constants added

* runtime constants extracted

* update node

* cargo +nightly fmt

* Delete constants.rs

* update Cargo.toml

* 2021

* runtime constants update

* utils

* utils

* node test service

* Update runtime/rococo/constants/Cargo.toml

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* runtime-native

* bridge messages

* re-export DOLLARS

* Update runtime/westend/Cargo.toml

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Update runtime/test-runtime/Cargo.toml

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* std feature

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Doordashcon
2021-12-11 08:10:32 +01:00
committed by GitHub
parent 7c5249c951
commit 11d343e258
28 changed files with 238 additions and 36 deletions
+6 -6
View File
@@ -21,21 +21,21 @@ use grandpa::AuthorityId as GrandpaId;
#[cfg(feature = "kusama-native")]
use kusama_runtime as kusama;
#[cfg(feature = "kusama-native")]
use kusama_runtime::constants::currency::UNITS as KSM;
use kusama_runtime_constants::currency::UNITS as KSM;
use pallet_im_online::sr25519::AuthorityId as ImOnlineId;
use pallet_staking::Forcing;
#[cfg(feature = "polkadot-native")]
use polkadot::constants::currency::UNITS as DOT;
use polkadot_primitives::v1::{AccountId, AccountPublic, AssignmentId, ValidatorId};
#[cfg(feature = "polkadot-native")]
use polkadot_runtime as polkadot;
#[cfg(feature = "polkadot-native")]
use polkadot_runtime_constants::currency::UNITS as DOT;
use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId;
use sp_consensus_babe::AuthorityId as BabeId;
#[cfg(feature = "rococo-native")]
use rococo_runtime as rococo;
#[cfg(feature = "rococo-native")]
use rococo_runtime::constants::currency::UNITS as ROC;
use rococo_runtime_constants::currency::UNITS as ROC;
use sc_chain_spec::{ChainSpecExtension, ChainType};
use serde::{Deserialize, Serialize};
use sp_core::{sr25519, Pair, Public};
@@ -44,7 +44,7 @@ use telemetry::TelemetryEndpoints;
#[cfg(feature = "westend-native")]
use westend_runtime as westend;
#[cfg(feature = "westend-native")]
use westend_runtime::constants::currency::UNITS as WND;
use westend_runtime_constants::currency::UNITS as WND;
#[cfg(feature = "polkadot-native")]
const POLKADOT_STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/";
@@ -128,7 +128,7 @@ impl sp_runtime::BuildStorage for RococoGenesisExt {
fn assimilate_storage(&self, storage: &mut sp_core::storage::Storage) -> Result<(), String> {
sp_state_machine::BasicExternalities::execute_with_storage(storage, || {
if let Some(length) = self.session_length_in_blocks.as_ref() {
rococo::constants::time::EpochDurationInBlocks::set(length);
rococo_runtime_constants::time::EpochDurationInBlocks::set(length);
}
});
self.runtime_genesis_config.assimilate_storage(storage)