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:
Marcin S
2024-01-22 11:29:13 +01:00
committed by GitHub
parent e2caa813bf
commit d53534c49e
22 changed files with 366 additions and 49 deletions
@@ -55,7 +55,6 @@ use frame_system::{
use pallet_asset_conversion_tx_payment::AssetConversionAdapter;
use pallet_nfts::{DestroyWitness, PalletFeatures};
use pallet_xcm::EnsureXcm;
pub use parachains_common as common;
use parachains_common::{
impls::DealWithFees,
message_queue::*,
@@ -32,7 +32,8 @@ use asset_hub_westend_runtime::{
};
pub use asset_hub_westend_runtime::{AssetConversion, AssetDeposit, CollatorSelection, System};
use asset_test_utils::{
test_cases_over_bridge::TestBridgingConfig, CollatorSessionKey, CollatorSessionKeys, ExtBuilder,
test_cases_over_bridge::TestBridgingConfig, CollatorSessionKey, CollatorSessionKeys,
ExtBuilder, SlotDurations,
};
use codec::{Decode, Encode};
use cumulus_primitives_utility::ChargeWeightInFungibles;
@@ -47,9 +48,10 @@ use frame_support::{
weights::{Weight, WeightToFee as WeightToFeeT},
};
use parachains_common::{
westend::{currency::UNITS, fee::WeightToFee},
AccountId, AssetIdForTrustBackedAssets, AuraId, Balance,
westend::{consensus::RELAY_CHAIN_SLOT_DURATION_MILLIS, currency::UNITS, fee::WeightToFee},
AccountId, AssetIdForTrustBackedAssets, AuraId, Balance, SLOT_DURATION,
};
use sp_consensus_aura::SlotDuration;
use sp_runtime::traits::MaybeEquivalence;
use std::convert::Into;
use xcm::latest::prelude::{Assets as XcmAssets, *};
@@ -79,6 +81,13 @@ fn collator_session_keys() -> CollatorSessionKeys<Runtime> {
CollatorSessionKeys::default().add(collator_session_key(ALICE))
}
fn slot_durations() -> SlotDurations {
SlotDurations {
relay: SlotDuration::from_millis(RELAY_CHAIN_SLOT_DURATION_MILLIS.into()),
para: SlotDuration::from_millis(SLOT_DURATION),
}
}
#[test]
fn test_buy_and_refund_weight_in_native() {
ExtBuilder::<Runtime>::default()
@@ -895,6 +904,7 @@ asset_test_utils::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[..]) {
@@ -915,6 +925,7 @@ asset_test_utils::include_teleports_for_foreign_assets_works!(
ForeignCreatorsSovereignAccountOf,
ForeignAssetsInstance,
collator_session_keys(),
slot_durations(),
ExistentialDeposit::get(),
Box::new(|runtime_event_encoded: Vec<u8>| {
match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) {
@@ -1041,6 +1052,7 @@ fn limited_reserve_transfer_assets_for_native_asset_to_asset_hub_rococo_works()
LocationToAccountId,
>(
collator_session_keys(),
slot_durations(),
ExistentialDeposit::get(),
AccountId::from(ALICE),
Box::new(|runtime_event_encoded: Vec<u8>| {
@@ -1208,6 +1220,7 @@ fn reserve_transfer_native_asset_to_non_teleport_para_works() {
LocationToAccountId,
>(
collator_session_keys(),
slot_durations(),
ExistentialDeposit::get(),
AccountId::from(ALICE),
Box::new(|runtime_event_encoded: Vec<u8>| {