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
@@ -29,7 +29,6 @@ use frame_support::{
weights::Weight,
};
use frame_system::pallet_prelude::{BlockNumberFor, HeaderFor};
use parachains_common::SLOT_DURATION;
use polkadot_parachain_primitives::primitives::{
HeadData, HrmpChannelId, RelayChainBlockNumber, XcmpMessageFormat,
};
@@ -115,6 +114,11 @@ impl<Runtime: frame_system::Config + pallet_balances::Config + pallet_session::C
}
}
pub struct SlotDurations {
pub relay: SlotDuration,
pub para: SlotDuration,
}
/// A set of traits for a minimal parachain runtime, that may be used in conjunction with the
/// `ExtBuilder` and the `RuntimeHelper`.
pub trait BasicParachainRuntime:
@@ -335,6 +339,7 @@ impl<
open_hrmp_channel: Option<(u32, u32)>,
included_head: HeaderFor<Runtime>,
slot_digest: &[u8],
slot_durations: &SlotDurations,
) -> DispatchResult
where
HrmpChannelOpener: frame_support::inherent::ProvideInherent<
@@ -348,6 +353,7 @@ impl<
target_para_id.into(),
included_head,
slot_digest,
slot_durations,
);
}
@@ -493,12 +499,12 @@ pub fn mock_open_hrmp_channel<
recipient: ParaId,
included_head: HeaderFor<C>,
mut slot_digest: &[u8],
slot_durations: &SlotDurations,
) {
const RELAY_CHAIN_SLOT_DURATION: SlotDuration = SlotDuration::from_millis(6000);
let slot = Slot::decode(&mut slot_digest).expect("failed to decode digest");
// Convert para slot to relay chain.
let timestamp = slot.saturating_mul(SLOT_DURATION);
let relay_slot = Slot::from_timestamp(timestamp.into(), RELAY_CHAIN_SLOT_DURATION);
let timestamp = slot.saturating_mul(slot_durations.para.as_millis());
let relay_slot = Slot::from_timestamp(timestamp.into(), slot_durations.relay);
let n = 1_u32;
let mut sproof_builder = RelayStateSproofBuilder {