backport cumulus changes to polkadot-staging (#2167)

* backport cumulus changes

* bump substrate & polkadot and make it build

* fix runtimes

* bump substrate, polkadot & cumulus

* fix build: remove ump leftovers

* fix tests: disable runtime version check in tests

* fix build: use sp_version::runtime_version macro

Signed-off-by: acatangiu <adrian@parity.io>
This commit is contained in:
Adrian Catangiu
2023-06-01 15:07:35 +03:00
committed by Bastian Köcher
parent b3d6fe7cba
commit ac725ec93f
23 changed files with 99 additions and 81 deletions
+3
View File
@@ -38,6 +38,7 @@ pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "m
pallet-beefy = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-beefy-mmr = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-message-queue = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-mmr = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, features = ["historical"]}
pallet-sudo = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
@@ -101,6 +102,7 @@ std = [
"pallet-bridge-messages/std",
"pallet-bridge-relayers/std",
"pallet-grandpa/std",
"pallet-message-queue/std",
"pallet-mmr/std",
"pallet-xcm/std",
"pallet-session/std",
@@ -136,6 +138,7 @@ runtime-benchmarks = [
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"pallet-bridge-messages/runtime-benchmarks",
"pallet-message-queue/runtime-benchmarks",
"pallet-xcm/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
+1
View File
@@ -21,5 +21,6 @@ fn main() {
.with_current_project()
.import_memory()
.export_heap_base()
.disable_runtime_version_section_check()
.build()
}
+4 -4
View File
@@ -132,6 +132,7 @@ impl_opaque_keys! {
}
/// This runtime version.
#[sp_version::runtime_version]
pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("rialto-runtime"),
impl_name: create_runtime_str!("rialto-runtime"),
@@ -262,7 +263,6 @@ impl pallet_grandpa::Config for Runtime {
impl pallet_mmr::Config for Runtime {
const INDEXING_PREFIX: &'static [u8] = b"mmr";
type Hashing = Keccak256;
type Hash = <Keccak256 as sp_runtime::traits::Hash>::Output;
type LeafData = pallet_beefy_mmr::Pallet<Runtime>;
type OnNewRoot = pallet_beefy_mmr::DepositBeefyDigest<Runtime>;
type WeightInfo = ();
@@ -330,7 +330,7 @@ impl pallet_balances::Config for Runtime {
type MaxLocks = ConstU32<50>;
type MaxReserves = ConstU32<50>;
type ReserveIdentifier = [u8; 8];
type HoldIdentifier = ();
type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
@@ -498,12 +498,12 @@ construct_runtime!(
Paras: polkadot_runtime_parachains::paras::{Pallet, Call, Storage, Event, Config, ValidateUnsigned},
Initializer: polkadot_runtime_parachains::initializer::{Pallet, Call, Storage},
Dmp: polkadot_runtime_parachains::dmp::{Pallet, Storage},
Ump: polkadot_runtime_parachains::ump::{Pallet, Call, Storage, Event},
Hrmp: polkadot_runtime_parachains::hrmp::{Pallet, Call, Storage, Event<T>, Config},
SessionInfo: polkadot_runtime_parachains::session_info::{Pallet, Storage},
ParaSessionInfo: polkadot_runtime_parachains::session_info::{Pallet, Storage},
ParasDisputes: polkadot_runtime_parachains::disputes::{Pallet, Call, Storage, Event<T>},
ParasSlashing: polkadot_runtime_parachains::disputes::slashing::{Pallet, Call, Storage, ValidateUnsigned},
MessageQueue: pallet_message_queue::{Pallet, Call, Storage, Event<T>},
// Parachain Onboarding Pallets
Registrar: polkadot_runtime_common::paras_registrar::{Pallet, Call, Storage, Event<T>},
@@ -558,8 +558,8 @@ mod mmr {
pub use pallet_mmr::primitives::*;
pub type Leaf = <<Runtime as pallet_mmr::Config>::LeafData as LeafDataProvider>::LeafData;
pub type Hash = <Runtime as pallet_mmr::Config>::Hash;
pub type Hashing = <Runtime as pallet_mmr::Config>::Hashing;
pub type Hash = <Hashing as sp_runtime::traits::Hash>::Output;
}
impl_runtime_apis! {
+62 -12
View File
@@ -17,24 +17,30 @@
//! Parachains support in Rialto runtime.
use crate::{
AccountId, Babe, Balance, Balances, BlockNumber, Registrar, Runtime, RuntimeCall, RuntimeEvent,
RuntimeOrigin, ShiftSessionManager, Slots, UncheckedExtrinsic,
xcm_config, AccountId, Babe, Balance, Balances, BlockNumber, Registrar, Runtime, RuntimeCall,
RuntimeEvent, RuntimeOrigin, ShiftSessionManager, Slots, UncheckedExtrinsic,
};
use frame_support::{parameter_types, traits::KeyOwnerProofSystem, weights::Weight};
use frame_support::{
parameter_types,
traits::{KeyOwnerProofSystem, ProcessMessage, ProcessMessageError},
weights::{Weight, WeightMeter},
};
use frame_system::EnsureRoot;
use polkadot_primitives::v4::{ValidatorId, ValidatorIndex};
use polkadot_runtime_common::{paras_registrar, paras_sudo_wrapper, slots};
use polkadot_runtime_parachains::{
configuration as parachains_configuration, disputes as parachains_disputes,
disputes::slashing as parachains_slashing, dmp as parachains_dmp, hrmp as parachains_hrmp,
inclusion as parachains_inclusion, initializer as parachains_initializer,
origin as parachains_origin, paras as parachains_paras,
disputes::slashing as parachains_slashing,
dmp as parachains_dmp, hrmp as parachains_hrmp, inclusion as parachains_inclusion,
inclusion::{AggregateMessageOrigin, UmpQueueId},
initializer as parachains_initializer, origin as parachains_origin, paras as parachains_paras,
paras_inherent as parachains_paras_inherent, scheduler as parachains_scheduler,
session_info as parachains_session_info, shared as parachains_shared, ump as parachains_ump,
session_info as parachains_session_info, shared as parachains_shared,
};
use sp_core::crypto::KeyTypeId;
use sp_runtime::transaction_validity::TransactionPriority;
use xcm::latest::Junction;
impl<C> frame_system::offchain::SendTransactionTypes<C> for Runtime
where
@@ -70,6 +76,8 @@ impl parachains_inclusion::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RewardValidators = RewardValidators;
type DisputesHandler = ();
type MessageQueue = crate::MessageQueue;
type WeightInfo = ();
}
impl parachains_initializer::Config for Runtime {
@@ -108,6 +116,7 @@ impl parachains_paras::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type WeightInfo = ParasWeightInfo;
type UnsignedPriority = ParasUnsignedPriority;
type QueueFootprinter = crate::Inclusion;
type NextSessionRotation = Babe;
}
@@ -169,12 +178,53 @@ impl parachains_session_info::Config for Runtime {
impl parachains_shared::Config for Runtime {}
impl parachains_ump::Config for Runtime {
parameter_types! {
/// Amount of weight that can be spent per block to service messages.
///
/// # WARNING
///
/// This is not a good value for para-chains since the `Scheduler`
/// already uses up to 80 percent block weight.
pub MessageQueueServiceWeight: Weight = crate::Perbill::from_percent(20) * bp_rialto::BlockWeights::get().max_block;
pub const MessageQueueHeapSize: u32 = 32 * 1024;
pub const MessageQueueMaxStale: u32 = 96;
}
/// Message processor to handle any messages that were enqueued into the `MessageQueue` pallet.
pub struct MessageProcessor;
impl ProcessMessage for MessageProcessor {
type Origin = AggregateMessageOrigin;
fn process_message(
message: &[u8],
origin: Self::Origin,
meter: &mut WeightMeter,
id: &mut [u8; 32],
) -> Result<bool, ProcessMessageError> {
let para = match origin {
AggregateMessageOrigin::Ump(UmpQueueId::Para(para)) => para,
};
xcm_builder::ProcessXcmMessage::<
Junction,
xcm_executor::XcmExecutor<xcm_config::XcmConfig>,
RuntimeCall,
>::process_message(message, Junction::Parachain(para.into()), meter, id)
}
}
impl pallet_message_queue::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type UmpSink = ();
type FirstMessageFactorPercent = frame_support::traits::ConstU64<100>;
type ExecuteOverweightOrigin = EnsureRoot<AccountId>;
type WeightInfo = parachains_ump::TestWeightInfo;
type Size = u32;
type HeapSize = MessageQueueHeapSize;
type MaxStale = MessageQueueMaxStale;
type ServiceWeight = MessageQueueServiceWeight;
#[cfg(not(feature = "runtime-benchmarks"))]
type MessageProcessor = MessageProcessor;
#[cfg(feature = "runtime-benchmarks")]
type MessageProcessor =
pallet_message_queue::mock_helpers::NoopMessageProcessor<AggregateMessageOrigin>;
type QueueChangeHandler = crate::Inclusion;
type WeightInfo = ();
}
// required onboarding pallets. We're not going to use auctions or crowdloans, so they're missing