diff --git a/Cargo.lock b/Cargo.lock index 12dafafbe..ec7160695 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1259,6 +1259,7 @@ dependencies = [ "parity-scale-codec", "polkadot-parachain-primitives", "polkadot-primitives", + "polkadot-runtime-common", "scale-info", "smallvec", "sp-api", @@ -1427,6 +1428,7 @@ dependencies = [ "parity-scale-codec", "polkadot-parachain-primitives", "polkadot-primitives", + "polkadot-runtime-common", "scale-info", "smallvec", "sp-api", diff --git a/Cargo.toml b/Cargo.toml index 418f5a419..ea27da7c4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -228,6 +228,7 @@ kusama-runtime = { package = "staging-kusama-runtime", git = "https kusama-runtime-constants = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" } polkadot-cli = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" } polkadot-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" } +polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } polkadot-runtime-constants = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" } polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" } polkadot-service = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" } diff --git a/runtime/bifrost-kusama/Cargo.toml b/runtime/bifrost-kusama/Cargo.toml index 8340f6e9e..12291eb84 100644 --- a/runtime/bifrost-kusama/Cargo.toml +++ b/runtime/bifrost-kusama/Cargo.toml @@ -80,6 +80,7 @@ parachain-info = { workspace = true } pallet-xcm = { workspace = true } polkadot-parachain-primitives = { workspace = true } polkadot-primitives = { workspace = true } +polkadot-runtime-common = { workspace = true } xcm = { workspace = true } xcm-builder = { workspace = true } xcm-executor = { workspace = true } diff --git a/runtime/bifrost-kusama/src/lib.rs b/runtime/bifrost-kusama/src/lib.rs index cb0644d5b..13dd84ea3 100644 --- a/runtime/bifrost-kusama/src/lib.rs +++ b/runtime/bifrost-kusama/src/lib.rs @@ -79,9 +79,9 @@ pub use bifrost_primitives::{ Ratio, RpcContributionStatus, Shortfall, TimeUnit, TokenSymbol, }; pub use bifrost_runtime_common::{ - cent, constants::time::*, dollar, micro, milli, millicent, prod_or_test, AuraId, - CouncilCollective, EnsureRootOrAllTechnicalCommittee, MoreThanHalfCouncil, - SlowAdjustingFeeUpdate, TechnicalCollective, + cent, constants::time::*, dollar, micro, milli, millicent, AuraId, CouncilCollective, + EnsureRootOrAllTechnicalCommittee, MoreThanHalfCouncil, SlowAdjustingFeeUpdate, + TechnicalCollective, }; use bifrost_slp::QueryId; use constants::currency::*; @@ -95,6 +95,7 @@ use frame_system::{EnsureRoot, EnsureRootWithSuccess, EnsureSigned}; use hex_literal::hex; use orml_oracle::{DataFeeder, DataProvider, DataProviderExtended}; use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; +use polkadot_runtime_common::prod_or_fast; // zenlink imports use zenlink_protocol::{ @@ -976,7 +977,7 @@ parameter_types! { /// Minimum round length is 2 minutes (10 * 12 second block times) pub const MinBlocksPerRound: u32 = 10; /// Blocks per round - pub const DefaultBlocksPerRound: u32 = prod_or_test!(2 * HOURS, 10); + pub const DefaultBlocksPerRound: u32 = prod_or_fast!(2 * HOURS, 10); /// Rounds before the collator leaving the candidates request can be executed pub const LeaveCandidatesDelay: u32 = 84; /// Rounds before the candidate bond increase/decrease can be executed @@ -990,7 +991,7 @@ parameter_types! { /// Rounds before the reward is paid pub const RewardPaymentDelay: u32 = 2; /// Minimum collators selected per round, default at genesis and minimum forever after - pub const MinSelectedCandidates: u32 = prod_or_test!(16,6); + pub const MinSelectedCandidates: u32 = prod_or_fast!(16,6); /// Maximum top delegations per candidate pub const MaxTopDelegationsPerCandidate: u32 = 300; /// Maximum bottom delegations per candidate @@ -1008,7 +1009,7 @@ parameter_types! { /// Minimum stake required to be reserved to be a delegator pub MinDelegatorStk: u128 = 50 * BNCS; pub AllowInflation: bool = false; - pub ToMigrateInvulnables: Vec = prod_or_test!(vec![ + pub ToMigrateInvulnables: Vec = prod_or_fast!(vec![ hex!["8cf80f0bafcd0a3d80ca61cb688e4400e275b39d3411b4299b47e712e9dab809"].into(), hex!["40ac4effe39181731a8feb8a8ee0780e177bdd0d752b09c8fd71047e67189022"].into(), hex!["624d6a004c72a1abcf93131e185515ebe1410e43a301fe1f25d20d8da345376e"].into(), @@ -1426,7 +1427,7 @@ impl bifrost_farming::Config for Runtime { } parameter_types! { - pub const BlocksPerRound: u32 = prod_or_test!(1500, 50); + pub const BlocksPerRound: u32 = prod_or_fast!(1500, 50); pub const MaxTokenLen: u32 = 500; pub const MaxFarmingPoolIdLen: u32 = 100; } @@ -1786,7 +1787,7 @@ impl leverage_staking::Config for Runtime { } parameter_types! { - pub const ClearingDuration: u32 = 7 * DAYS; + pub const ClearingDuration: u32 = prod_or_fast!(7 * DAYS, 10 * MINUTES); pub const NameLengthLimit: u32 = 20; pub BifrostCommissionReceiver: AccountId = TreasuryPalletId::get().into_account_truncating(); } diff --git a/runtime/bifrost-polkadot/Cargo.toml b/runtime/bifrost-polkadot/Cargo.toml index 680f70952..18f2c4b17 100644 --- a/runtime/bifrost-polkadot/Cargo.toml +++ b/runtime/bifrost-polkadot/Cargo.toml @@ -80,6 +80,7 @@ parachain-info = { workspace = true } pallet-xcm = { workspace = true } polkadot-parachain-primitives = { workspace = true } polkadot-primitives = { workspace = true } +polkadot-runtime-common = { workspace = true } xcm = { workspace = true } xcm-builder = { workspace = true } xcm-executor = { workspace = true } diff --git a/runtime/bifrost-polkadot/src/lib.rs b/runtime/bifrost-polkadot/src/lib.rs index 8ba43fe96..ad92293ba 100644 --- a/runtime/bifrost-polkadot/src/lib.rs +++ b/runtime/bifrost-polkadot/src/lib.rs @@ -78,7 +78,7 @@ pub use bifrost_primitives::{ GLMR_TOKEN_ID, }; use bifrost_runtime_common::{ - constants::time::*, dollar, micro, milli, prod_or_test, AuraId, CouncilCollective, + constants::time::*, dollar, micro, milli, AuraId, CouncilCollective, EnsureRootOrAllTechnicalCommittee, MoreThanHalfCouncil, SlowAdjustingFeeUpdate, TechnicalCollective, }; @@ -103,6 +103,7 @@ use zenlink_protocol::{ pub mod xcm_config; use orml_traits::{currency::MutationHooks, location::RelativeReserveProvider}; use pallet_xcm::{EnsureResponse, QueryStatus}; +use polkadot_runtime_common::prod_or_fast; use static_assertions::const_assert; use xcm::v3::prelude::*; use xcm_config::{ @@ -1258,7 +1259,7 @@ impl bifrost_farming::Config for Runtime { } parameter_types! { - pub const BlocksPerRound: u32 = prod_or_test!(1500, 50); + pub const BlocksPerRound: u32 = prod_or_fast!(1500, 50); pub const MaxTokenLen: u32 = 500; pub const MaxFarmingPoolIdLen: u32 = 100; } @@ -1594,7 +1595,7 @@ impl leverage_staking::Config for Runtime { } parameter_types! { - pub const ClearingDuration: u32 = 7 * DAYS; + pub const ClearingDuration: u32 = prod_or_fast!(7 * DAYS, 10 * MINUTES); pub const NameLengthLimit: u32 = 20; pub BifrostCommissionReceiver: AccountId = TreasuryPalletId::get().into_account_truncating(); } diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index 3f4b184e2..3d5ed2397 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -132,21 +132,3 @@ impl BlockNumberProvider .unwrap_or_default() } } - -#[macro_export] -macro_rules! prod_or_test { - ($prod:expr, $test:expr) => { - if cfg!(feature = "fast-runtime") { - $test - } else { - $prod - } - }; - ($prod:expr, $test:expr, $env:expr) => { - if cfg!(feature = "fast-runtime") { - core::option_env!($env).map(|s| s.parse().ok()).flatten().unwrap_or($test) - } else { - $prod - } - }; -}