mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 21:01:02 +00:00
Enable async backing on asset-hub-rococo (#2826)
The goal is to move all system chains on Rococo (+ other testnets?) to use async backing. Starting with `asset-hub-rococo` to get feedback, before I do the rest. ## Related Example: https://github.com/paritytech/polkadot-sdk/pull/1619/ Guide: https://github.com/w3f/polkadot-wiki/blob/master/docs/maintain/maintain-guides-async-backing.md --------- Co-authored-by: Branislav Kontur <bkontur@gmail.com> Co-authored-by: Dónal Murray <donal.murray@parity.io>
This commit is contained in:
@@ -24,9 +24,14 @@ use bridge_hub_rococo_runtime::{
|
||||
Executive, ExistentialDeposit, ParachainSystem, PolkadotXcm, Runtime, RuntimeCall,
|
||||
RuntimeEvent, RuntimeOrigin, SessionKeys, SignedExtra, TransactionPayment, UncheckedExtrinsic,
|
||||
};
|
||||
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 parachains_common::{
|
||||
rococo::{consensus::RELAY_CHAIN_SLOT_DURATION_MILLIS, fee::WeightToFee},
|
||||
AccountId, AuraId, Balance, SLOT_DURATION,
|
||||
};
|
||||
use sp_consensus_aura::SlotDuration;
|
||||
use sp_core::H160;
|
||||
use sp_keyring::AccountKeyring::Alice;
|
||||
use sp_runtime::{
|
||||
@@ -95,6 +100,13 @@ fn collator_session_keys() -> bridge_hub_test_utils::CollatorSessionKeys<Runtime
|
||||
)
|
||||
}
|
||||
|
||||
fn slot_durations() -> SlotDurations {
|
||||
SlotDurations {
|
||||
relay: SlotDuration::from_millis(RELAY_CHAIN_SLOT_DURATION_MILLIS.into()),
|
||||
para: SlotDuration::from_millis(SLOT_DURATION),
|
||||
}
|
||||
}
|
||||
|
||||
bridge_hub_test_utils::test_cases::include_teleports_for_native_asset_works!(
|
||||
Runtime,
|
||||
AllPalletsWithoutSystem,
|
||||
@@ -103,6 +115,7 @@ bridge_hub_test_utils::test_cases::include_teleports_for_native_asset_works!(
|
||||
WeightToFee,
|
||||
ParachainSystem,
|
||||
collator_session_keys(),
|
||||
slot_durations(),
|
||||
ExistentialDeposit::get(),
|
||||
Box::new(|runtime_event_encoded: Vec<u8>| {
|
||||
match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) {
|
||||
@@ -264,6 +277,7 @@ mod bridge_hub_westend_tests {
|
||||
ConstU8<2>,
|
||||
>(
|
||||
collator_session_keys(),
|
||||
slot_durations(),
|
||||
bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID,
|
||||
SIBLING_PARACHAIN_ID,
|
||||
Box::new(|runtime_event_encoded: Vec<u8>| {
|
||||
@@ -288,6 +302,7 @@ mod bridge_hub_westend_tests {
|
||||
// from Westend
|
||||
from_parachain::relayed_incoming_message_works::<RuntimeTestsAdapter>(
|
||||
collator_session_keys(),
|
||||
slot_durations(),
|
||||
bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID,
|
||||
bp_bridge_hub_westend::BRIDGE_HUB_WESTEND_PARACHAIN_ID,
|
||||
BridgeHubWestendChainId::get(),
|
||||
@@ -304,6 +319,7 @@ mod bridge_hub_westend_tests {
|
||||
// for Westend
|
||||
from_parachain::complex_relay_extrinsic_works::<RuntimeTestsAdapter>(
|
||||
collator_session_keys(),
|
||||
slot_durations(),
|
||||
bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID,
|
||||
bp_bridge_hub_westend::BRIDGE_HUB_WESTEND_PARACHAIN_ID,
|
||||
SIBLING_PARACHAIN_ID,
|
||||
@@ -459,6 +475,7 @@ mod bridge_hub_bulletin_tests {
|
||||
ConstU8<2>,
|
||||
>(
|
||||
collator_session_keys(),
|
||||
slot_durations(),
|
||||
bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID,
|
||||
SIBLING_PARACHAIN_ID,
|
||||
Box::new(|runtime_event_encoded: Vec<u8>| {
|
||||
@@ -483,6 +500,7 @@ mod bridge_hub_bulletin_tests {
|
||||
// from Bulletin
|
||||
from_grandpa_chain::relayed_incoming_message_works::<RuntimeTestsAdapter>(
|
||||
collator_session_keys(),
|
||||
slot_durations(),
|
||||
bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID,
|
||||
RococoBulletinChainId::get(),
|
||||
SIBLING_PARACHAIN_ID,
|
||||
@@ -498,6 +516,7 @@ mod bridge_hub_bulletin_tests {
|
||||
// for Bulletin
|
||||
from_grandpa_chain::complex_relay_extrinsic_works::<RuntimeTestsAdapter>(
|
||||
collator_session_keys(),
|
||||
slot_durations(),
|
||||
bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID,
|
||||
SIBLING_PARACHAIN_ID,
|
||||
RococoBulletinChainId::get(),
|
||||
|
||||
@@ -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},
|
||||
@@ -33,7 +33,11 @@ use bridge_to_rococo_config::{
|
||||
};
|
||||
use codec::{Decode, Encode};
|
||||
use frame_support::{dispatch::GetDispatchInfo, parameter_types, traits::ConstU8};
|
||||
use parachains_common::{westend::fee::WeightToFee, AccountId, AuraId, Balance};
|
||||
use parachains_common::{
|
||||
westend::{consensus::RELAY_CHAIN_SLOT_DURATION_MILLIS, fee::WeightToFee},
|
||||
AccountId, AuraId, Balance, SLOT_DURATION,
|
||||
};
|
||||
use sp_consensus_aura::SlotDuration;
|
||||
use sp_keyring::AccountKeyring::Alice;
|
||||
use sp_runtime::{
|
||||
generic::{Era, SignedPayload},
|
||||
@@ -111,6 +115,13 @@ fn collator_session_keys() -> bridge_hub_test_utils::CollatorSessionKeys<Runtime
|
||||
)
|
||||
}
|
||||
|
||||
fn slot_durations() -> SlotDurations {
|
||||
SlotDurations {
|
||||
relay: SlotDuration::from_millis(RELAY_CHAIN_SLOT_DURATION_MILLIS.into()),
|
||||
para: SlotDuration::from_millis(SLOT_DURATION),
|
||||
}
|
||||
}
|
||||
|
||||
bridge_hub_test_utils::test_cases::include_teleports_for_native_asset_works!(
|
||||
Runtime,
|
||||
AllPalletsWithoutSystem,
|
||||
@@ -119,6 +130,7 @@ bridge_hub_test_utils::test_cases::include_teleports_for_native_asset_works!(
|
||||
WeightToFee,
|
||||
ParachainSystem,
|
||||
collator_session_keys(),
|
||||
slot_durations(),
|
||||
ExistentialDeposit::get(),
|
||||
Box::new(|runtime_event_encoded: Vec<u8>| {
|
||||
match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) {
|
||||
@@ -229,6 +241,7 @@ fn message_dispatch_routing_works() {
|
||||
ConstU8<2>,
|
||||
>(
|
||||
collator_session_keys(),
|
||||
slot_durations(),
|
||||
bp_bridge_hub_westend::BRIDGE_HUB_WESTEND_PARACHAIN_ID,
|
||||
SIBLING_PARACHAIN_ID,
|
||||
Box::new(|runtime_event_encoded: Vec<u8>| {
|
||||
@@ -252,6 +265,7 @@ fn message_dispatch_routing_works() {
|
||||
fn relayed_incoming_message_works() {
|
||||
from_parachain::relayed_incoming_message_works::<RuntimeTestsAdapter>(
|
||||
collator_session_keys(),
|
||||
slot_durations(),
|
||||
bp_bridge_hub_westend::BRIDGE_HUB_WESTEND_PARACHAIN_ID,
|
||||
bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID,
|
||||
BridgeHubRococoChainId::get(),
|
||||
@@ -267,6 +281,7 @@ fn relayed_incoming_message_works() {
|
||||
pub fn complex_relay_extrinsic_works() {
|
||||
from_parachain::complex_relay_extrinsic_works::<RuntimeTestsAdapter>(
|
||||
collator_session_keys(),
|
||||
slot_durations(),
|
||||
bp_bridge_hub_westend::BRIDGE_HUB_WESTEND_PARACHAIN_ID,
|
||||
bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID,
|
||||
SIBLING_PARACHAIN_ID,
|
||||
|
||||
+5
-1
@@ -39,7 +39,7 @@ 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,
|
||||
AccountIdOf, BasicParachainRuntime, CollatorSessionKeys, RuntimeCallOf, SlotDurations,
|
||||
};
|
||||
use sp_keyring::AccountKeyring::*;
|
||||
use sp_runtime::{traits::Header as HeaderT, AccountId32};
|
||||
@@ -107,6 +107,7 @@ where
|
||||
/// Also verifies relayer transaction signed extensions work as intended.
|
||||
pub fn relayed_incoming_message_works<RuntimeHelper>(
|
||||
collator_session_key: CollatorSessionKeys<RuntimeHelper::Runtime>,
|
||||
slot_durations: SlotDurations,
|
||||
runtime_para_id: u32,
|
||||
bridged_chain_id: bp_runtime::ChainId,
|
||||
sibling_parachain_id: u32,
|
||||
@@ -136,6 +137,7 @@ pub fn relayed_incoming_message_works<RuntimeHelper>(
|
||||
RuntimeHelper::MPI,
|
||||
>(
|
||||
collator_session_key,
|
||||
slot_durations,
|
||||
runtime_para_id,
|
||||
sibling_parachain_id,
|
||||
local_relay_chain_id,
|
||||
@@ -205,6 +207,7 @@ pub fn relayed_incoming_message_works<RuntimeHelper>(
|
||||
/// Also verifies relayer transaction signed extensions work as intended.
|
||||
pub fn complex_relay_extrinsic_works<RuntimeHelper>(
|
||||
collator_session_key: CollatorSessionKeys<RuntimeHelper::Runtime>,
|
||||
slot_durations: SlotDurations,
|
||||
runtime_para_id: u32,
|
||||
sibling_parachain_id: u32,
|
||||
bridged_chain_id: bp_runtime::ChainId,
|
||||
@@ -237,6 +240,7 @@ pub fn complex_relay_extrinsic_works<RuntimeHelper>(
|
||||
RuntimeHelper::MPI,
|
||||
>(
|
||||
collator_session_key,
|
||||
slot_durations,
|
||||
runtime_para_id,
|
||||
sibling_parachain_id,
|
||||
local_relay_chain_id,
|
||||
|
||||
@@ -40,7 +40,7 @@ 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,
|
||||
AccountIdOf, BasicParachainRuntime, CollatorSessionKeys, RuntimeCallOf, SlotDurations,
|
||||
};
|
||||
use sp_keyring::AccountKeyring::*;
|
||||
use sp_runtime::{traits::Header as HeaderT, AccountId32};
|
||||
@@ -112,6 +112,7 @@ where
|
||||
/// Also verifies relayer transaction signed extensions work as intended.
|
||||
pub fn relayed_incoming_message_works<RuntimeHelper>(
|
||||
collator_session_key: CollatorSessionKeys<RuntimeHelper::Runtime>,
|
||||
slot_durations: SlotDurations,
|
||||
runtime_para_id: u32,
|
||||
bridged_para_id: u32,
|
||||
bridged_chain_id: bp_runtime::ChainId,
|
||||
@@ -146,6 +147,7 @@ pub fn relayed_incoming_message_works<RuntimeHelper>(
|
||||
RuntimeHelper::MPI,
|
||||
>(
|
||||
collator_session_key,
|
||||
slot_durations,
|
||||
runtime_para_id,
|
||||
sibling_parachain_id,
|
||||
local_relay_chain_id,
|
||||
@@ -244,6 +246,7 @@ pub fn relayed_incoming_message_works<RuntimeHelper>(
|
||||
/// Also verifies relayer transaction signed extensions work as intended.
|
||||
pub fn complex_relay_extrinsic_works<RuntimeHelper>(
|
||||
collator_session_key: CollatorSessionKeys<RuntimeHelper::Runtime>,
|
||||
slot_durations: SlotDurations,
|
||||
runtime_para_id: u32,
|
||||
bridged_para_id: u32,
|
||||
sibling_parachain_id: u32,
|
||||
@@ -281,6 +284,7 @@ pub fn complex_relay_extrinsic_works<RuntimeHelper>(
|
||||
RuntimeHelper::MPI,
|
||||
>(
|
||||
collator_session_key,
|
||||
slot_durations,
|
||||
runtime_para_id,
|
||||
sibling_parachain_id,
|
||||
local_relay_chain_id,
|
||||
|
||||
@@ -31,7 +31,7 @@ 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,
|
||||
mock_open_hrmp_channel, AccountIdOf, CollatorSessionKeys, RuntimeCallOf, SlotDurations,
|
||||
};
|
||||
use sp_core::Get;
|
||||
use sp_keyring::AccountKeyring::*;
|
||||
@@ -220,6 +220,7 @@ pub fn relayer_id_at_bridged_chain<Runtime: pallet_bridge_messages::Config<MPI>,
|
||||
/// with proofs (finality, message) independently submitted.
|
||||
pub fn relayed_incoming_message_works<Runtime, AllPalletsWithoutSystem, MPI>(
|
||||
collator_session_key: CollatorSessionKeys<Runtime>,
|
||||
slot_durations: SlotDurations,
|
||||
runtime_para_id: u32,
|
||||
sibling_parachain_id: u32,
|
||||
local_relay_chain_id: NetworkId,
|
||||
@@ -272,6 +273,7 @@ pub fn relayed_incoming_message_works<Runtime, AllPalletsWithoutSystem, MPI>(
|
||||
sibling_parachain_id.into(),
|
||||
included_head,
|
||||
&alice,
|
||||
&slot_durations,
|
||||
);
|
||||
|
||||
// set up relayer details and proofs
|
||||
|
||||
@@ -45,7 +45,7 @@ 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, XcmReceivedFrom,
|
||||
};
|
||||
use sp_runtime::{traits::Zero, AccountId32};
|
||||
use xcm::{latest::prelude::*, AlwaysLatest};
|
||||
@@ -419,6 +419,7 @@ pub fn message_dispatch_routing_works<
|
||||
NetworkDistanceAsParentCount,
|
||||
>(
|
||||
collator_session_key: CollatorSessionKeys<Runtime>,
|
||||
slot_durations: SlotDurations,
|
||||
runtime_para_id: u32,
|
||||
sibling_parachain_id: u32,
|
||||
unwrap_cumulus_pallet_parachain_system_event: Box<
|
||||
@@ -529,6 +530,7 @@ pub fn message_dispatch_routing_works<
|
||||
sibling_parachain_id.into(),
|
||||
included_head,
|
||||
&alice,
|
||||
&slot_durations,
|
||||
);
|
||||
let result =
|
||||
<<Runtime as BridgeMessagesConfig<MessagesPalletInstance>>::MessageDispatch>::dispatch(
|
||||
|
||||
Reference in New Issue
Block a user