Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parametrize SlotDurations for system parachain tests (because of mock_open_hrmp_channel) #2864

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
".git/.scripts/commands/fmt/fmt.sh"
  • Loading branch information
command-bot committed Jan 6, 2024
commit b7c4ab2e7b8b6ef092ed54e81a628d773ccb4d9a
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ std = [
"cumulus-pallet-session-benchmarking/std",
"cumulus-pallet-xcm/std",
"cumulus-pallet-xcmp-queue/std",
"cumulus-primitives-aura/std", # TODO: guide is missing this step
"cumulus-primitives-aura/std", # TODO: guide is missing this step
"cumulus-primitives-core/std",
"cumulus-primitives-utility/std",
"frame-benchmarking?/std",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ pub use asset_hub_rococo_runtime::{
RuntimeCall, RuntimeEvent, SessionKeys, System, ToWestendXcmRouterInstance,
TrustBackedAssetsInstance, XcmpQueue,
};
use asset_test_utils::{test_cases_over_bridge::TestBridgingConfig, CollatorSessionKey, CollatorSessionKeys, ExtBuilder, SlotDurations};
use asset_test_utils::{
test_cases_over_bridge::TestBridgingConfig, CollatorSessionKey, CollatorSessionKeys,
ExtBuilder, SlotDurations,
};
use codec::{Decode, Encode};
use cumulus_primitives_utility::ChargeWeightInFungibles;
use frame_support::{
Expand Down Expand Up @@ -69,7 +72,9 @@ fn collator_session_keys() -> CollatorSessionKeys<Runtime> {

fn slot_durations() -> SlotDurations {
SlotDurations {
relay: SlotDuration::from_millis(asset_hub_rococo_runtime::RELAY_CHAIN_SLOT_DURATION_MILLIS.into()),
relay: SlotDuration::from_millis(
asset_hub_rococo_runtime::RELAY_CHAIN_SLOT_DURATION_MILLIS.into(),
),
para: SlotDuration::from_millis(asset_hub_rococo_runtime::SLOT_DURATION),
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ use parachains_common::{
Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT,
NORMAL_DISPATCH_RATIO,
};
pub use parachains_common::{SLOT_DURATION, westend::consensus::RELAY_CHAIN_SLOT_DURATION_MILLIS};
pub use parachains_common::{westend::consensus::RELAY_CHAIN_SLOT_DURATION_MILLIS, SLOT_DURATION};
use sp_api::impl_runtime_apis;
use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
use sp_runtime::{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ use asset_hub_westend_runtime::{
PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, SessionKeys,
ToRococoXcmRouterInstance, TrustBackedAssetsInstance, XcmpQueue,
};
use asset_test_utils::{test_cases_over_bridge::TestBridgingConfig, CollatorSessionKey, CollatorSessionKeys, ExtBuilder, SlotDurations};
use asset_test_utils::{
test_cases_over_bridge::TestBridgingConfig, CollatorSessionKey, CollatorSessionKeys,
ExtBuilder, SlotDurations,
};
use codec::{Decode, Encode};
use cumulus_primitives_utility::ChargeWeightInFungibles;
use frame_support::{
Expand All @@ -39,9 +42,9 @@ use frame_support::{
use parachains_common::{
westend::fee::WeightToFee, AccountId, AssetIdForTrustBackedAssets, AuraId, Balance,
};
use sp_consensus_aura::SlotDuration;
use sp_runtime::traits::MaybeEquivalence;
use std::convert::Into;
use sp_consensus_aura::SlotDuration;
use xcm::latest::prelude::*;
use xcm_executor::traits::{Identity, JustTry, WeightTrader};

Expand All @@ -67,7 +70,9 @@ fn collator_session_keys() -> CollatorSessionKeys<Runtime> {

fn slot_durations() -> SlotDurations {
SlotDurations {
relay: SlotDuration::from_millis(asset_hub_westend_runtime::RELAY_CHAIN_SLOT_DURATION_MILLIS.into()),
relay: SlotDuration::from_millis(
asset_hub_westend_runtime::RELAY_CHAIN_SLOT_DURATION_MILLIS.into(),
),
para: SlotDuration::from_millis(asset_hub_westend_runtime::SLOT_DURATION),
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ use frame_support::{
};
use frame_system::pallet_prelude::BlockNumberFor;
use parachains_common::{AccountId, Balance};
use parachains_runtimes_test_utils::{assert_metadata, assert_total, mock_open_hrmp_channel, AccountIdOf, BalanceOf, CollatorSessionKeys, ExtBuilder, ValidatorIdOf, XcmReceivedFrom, SlotDurations};
use parachains_runtimes_test_utils::{
assert_metadata, assert_total, mock_open_hrmp_channel, AccountIdOf, BalanceOf,
CollatorSessionKeys, ExtBuilder, SlotDurations, ValidatorIdOf, XcmReceivedFrom,
};
use sp_runtime::{
traits::{MaybeEquivalence, StaticLookup, Zero},
DispatchError, Saturating,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ use frame_support::{
};
use frame_system::pallet_prelude::BlockNumberFor;
use parachains_common::{AccountId, Balance};
use parachains_runtimes_test_utils::{mock_open_hrmp_channel, AccountIdOf, BalanceOf, CollatorSessionKeys, ExtBuilder, RuntimeHelper, ValidatorIdOf, XcmReceivedFrom, SlotDurations};
use parachains_runtimes_test_utils::{
mock_open_hrmp_channel, AccountIdOf, BalanceOf, CollatorSessionKeys, ExtBuilder, RuntimeHelper,
SlotDurations, ValidatorIdOf, XcmReceivedFrom,
};
use sp_runtime::{traits::StaticLookup, Saturating};
use xcm::{latest::prelude::*, VersionedMultiAssets};
use xcm_builder::{CreateMatcher, MatchXcm};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ use parachains_common::{
AccountId, Balance, BlockNumber, Hash, Header, Nonce, Signature, AVERAGE_ON_INITIALIZE_RATIO,
HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO,
};
pub use parachains_common::{SLOT_DURATION, rococo::consensus::RELAY_CHAIN_SLOT_DURATION_MILLIS};
pub use parachains_common::{rococo::consensus::RELAY_CHAIN_SLOT_DURATION_MILLIS, SLOT_DURATION};

#[cfg(feature = "runtime-benchmarks")]
use crate::xcm_config::benchmark_helpers::DoNothingRouter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ use bridge_hub_rococo_runtime::{
Executive, ExistentialDeposit, ParachainSystem, PolkadotXcm, Runtime, RuntimeCall,
RuntimeEvent, RuntimeOrigin, SessionKeys, SignedExtra, TransactionPayment, UncheckedExtrinsic,
};
use codec::{Decode, Encode};
use bridge_hub_test_utils::SlotDurations;
use codec::{Decode, Encode};
use frame_support::{dispatch::GetDispatchInfo, parameter_types, traits::ConstU8};
use parachains_common::{rococo::fee::WeightToFee, AccountId, AuraId, Balance};
use sp_consensus_aura::SlotDuration;
Expand Down Expand Up @@ -99,7 +99,9 @@ fn collator_session_keys() -> bridge_hub_test_utils::CollatorSessionKeys<Runtime

fn slot_durations() -> SlotDurations {
SlotDurations {
relay: SlotDuration::from_millis(bridge_hub_rococo_runtime::RELAY_CHAIN_SLOT_DURATION_MILLIS.into()),
relay: SlotDuration::from_millis(
bridge_hub_rococo_runtime::RELAY_CHAIN_SLOT_DURATION_MILLIS.into(),
),
para: SlotDuration::from_millis(bridge_hub_rococo_runtime::SLOT_DURATION),
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ use parachains_common::{
AccountId, Balance, BlockNumber, Hash, Header, Nonce, Signature, AVERAGE_ON_INITIALIZE_RATIO,
HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO,
};
pub use parachains_common::{SLOT_DURATION, westend::consensus::RELAY_CHAIN_SLOT_DURATION_MILLIS};
pub use parachains_common::{westend::consensus::RELAY_CHAIN_SLOT_DURATION_MILLIS, SLOT_DURATION};

/// The address format for describing accounts.
pub type Address = MultiAddress<AccountId, ()>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

use bp_polkadot_core::Signature;
use bridge_common_config::{DeliveryRewardInBalance, RequiredStakeForStakeAndSlash};
use bridge_hub_test_utils::test_cases::from_parachain;
use bridge_hub_test_utils::{test_cases::from_parachain, SlotDurations};
use bridge_hub_westend_runtime::{
bridge_common_config, bridge_to_rococo_config,
xcm_config::{RelayNetwork, WestendLocation, XcmConfig},
Expand All @@ -32,7 +32,6 @@ use bridge_to_rococo_config::{
WithBridgeHubRococoMessagesInstance, XCM_LANE_FOR_ASSET_HUB_WESTEND_TO_ASSET_HUB_ROCOCO,
};
use codec::{Decode, Encode};
use bridge_hub_test_utils::SlotDurations;
use frame_support::{dispatch::GetDispatchInfo, parameter_types, traits::ConstU8};
use parachains_common::{westend::fee::WeightToFee, AccountId, AuraId, Balance};
use sp_consensus_aura::SlotDuration;
Expand Down Expand Up @@ -115,7 +114,9 @@ fn collator_session_keys() -> bridge_hub_test_utils::CollatorSessionKeys<Runtime

fn slot_durations() -> SlotDurations {
SlotDurations {
relay: SlotDuration::from_millis(bridge_hub_westend_runtime::RELAY_CHAIN_SLOT_DURATION_MILLIS.into()),
relay: SlotDuration::from_millis(
bridge_hub_westend_runtime::RELAY_CHAIN_SLOT_DURATION_MILLIS.into(),
),
para: SlotDuration::from_millis(bridge_hub_westend_runtime::SLOT_DURATION),
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ use bridge_runtime_common::{
};
use frame_support::traits::{Get, OnFinalize, OnInitialize};
use frame_system::pallet_prelude::BlockNumberFor;
use parachains_runtimes_test_utils::{AccountIdOf, BasicParachainRuntime, CollatorSessionKeys, RuntimeCallOf, SlotDurations};
use parachains_runtimes_test_utils::{
AccountIdOf, BasicParachainRuntime, CollatorSessionKeys, RuntimeCallOf, SlotDurations,
};
use sp_keyring::AccountKeyring::*;
use sp_runtime::{traits::Header as HeaderT, AccountId32};
use xcm::latest::prelude::*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ use bridge_runtime_common::{
};
use frame_support::traits::{Get, OnFinalize, OnInitialize};
use frame_system::pallet_prelude::BlockNumberFor;
use parachains_runtimes_test_utils::{AccountIdOf, BasicParachainRuntime, CollatorSessionKeys, RuntimeCallOf, SlotDurations};
use parachains_runtimes_test_utils::{
AccountIdOf, BasicParachainRuntime, CollatorSessionKeys, RuntimeCallOf, SlotDurations,
};
use sp_keyring::AccountKeyring::*;
use sp_runtime::{traits::Header as HeaderT, AccountId32};
use xcm::latest::prelude::*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ use frame_support::{
use frame_system::pallet_prelude::BlockNumberFor;
use pallet_bridge_grandpa::{BridgedBlockHash, BridgedHeader};
use parachains_common::AccountId;
use parachains_runtimes_test_utils::{mock_open_hrmp_channel, AccountIdOf, CollatorSessionKeys, RuntimeCallOf, SlotDurations};
use parachains_runtimes_test_utils::{
mock_open_hrmp_channel, AccountIdOf, CollatorSessionKeys, RuntimeCallOf, SlotDurations,
};
use sp_core::Get;
use sp_keyring::AccountKeyring::*;
use sp_runtime::{traits::TrailingZeroInput, AccountId32};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ use frame_support::{
};
use frame_system::pallet_prelude::BlockNumberFor;
use parachains_common::AccountId;
use parachains_runtimes_test_utils::{mock_open_hrmp_channel, AccountIdOf, BalanceOf, CollatorSessionKeys, ExtBuilder, RuntimeCallOf, XcmReceivedFrom, SlotDurations};
use parachains_runtimes_test_utils::{
mock_open_hrmp_channel, AccountIdOf, BalanceOf, CollatorSessionKeys, ExtBuilder, RuntimeCallOf,
SlotDurations, XcmReceivedFrom,
};
use sp_runtime::{traits::Zero, AccountId32};
use xcm::{latest::prelude::*, AlwaysLatest};
use xcm_builder::DispatchBlobError;
Expand Down
2 changes: 1 addition & 1 deletion cumulus/parachains/runtimes/test-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ impl<Runtime: frame_system::Config + pallet_balances::Config + pallet_session::C

pub struct SlotDurations {
pub relay: SlotDuration,
pub para: SlotDuration
pub para: SlotDuration,
}

/// A set of traits for a minimal parachain runtime, that may be used in conjunction with the
Expand Down