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
+1
View File
@@ -21,5 +21,6 @@ fn main() {
.with_current_project()
.import_memory()
.export_heap_base()
.disable_runtime_version_section_check()
.build()
}
+3 -4
View File
@@ -146,6 +146,7 @@ impl_opaque_keys! {
}
/// This runtime version.
#[sp_version::runtime_version]
pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("millau-runtime"),
impl_name: create_runtime_str!("millau-runtime"),
@@ -254,17 +255,15 @@ impl pallet_grandpa::Config for Runtime {
mod mmr {
use super::Runtime;
pub use pallet_mmr::primitives::*;
use sp_runtime::traits::Keccak256;
pub type Leaf = <<Runtime as pallet_mmr::Config>::LeafData as LeafDataProvider>::LeafData;
pub type Hash = <Keccak256 as sp_runtime::traits::Hash>::Output;
pub type Hashing = <Runtime as pallet_mmr::Config>::Hashing;
pub type Hash = <Hashing as sp_runtime::traits::Hash>::Output;
}
impl pallet_mmr::Config for Runtime {
const INDEXING_PREFIX: &'static [u8] = b"mmr";
type Hashing = Keccak256;
type Hash = mmr::Hash;
type OnNewRoot = pallet_beefy_mmr::DepositBeefyDigest<Runtime>;
type WeightInfo = ();
type LeafData = pallet_beefy_mmr::Pallet<Runtime>;
@@ -332,7 +331,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>;
@@ -21,5 +21,6 @@ fn main() {
.with_current_project()
.export_heap_base()
.import_memory()
.disable_runtime_version_section_check()
.build()
}
@@ -304,7 +304,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>;
+1 -1
View File
@@ -33,7 +33,7 @@ sp-consensus-grandpa = { git = "https://github.com/paritytech/substrate", branch
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" }
# Polkadot Dependencies
polkadot-node-core-pvf-worker = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-node-core-pvf = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false, features = [ "full-node", "polkadot-native" ] }
@@ -14,7 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
use frame_support::weights::Weight;
use polkadot_primitives::v4::{AssignmentId, ValidatorId};
use rialto_runtime::{
AccountId, BabeConfig, BalancesConfig, BeefyConfig, BridgeMillauMessagesConfig,
@@ -253,10 +252,6 @@ fn testnet_genesis(
max_upward_queue_count: 8,
max_upward_queue_size: 1024 * 1024,
max_downward_message_size: 1024 * 1024,
ump_service_total_weight: Weight::from_parts(
100_000_000_000,
polkadot_primitives::v4::MAX_POV_SIZE as u64,
),
max_upward_message_size: 50 * 1024,
max_upward_message_num_per_candidate: 5,
hrmp_sender_deposit: 0,
+2 -2
View File
@@ -164,7 +164,7 @@ pub fn run() -> sc_cli::Result<()> {
builder.with_colors(false);
let _ = builder.init();
polkadot_node_core_pvf_worker::prepare_worker_entrypoint(
polkadot_node_core_pvf::prepare_worker_entrypoint(
&cmd.socket_path,
Some(&cmd.node_impl_version),
);
@@ -175,7 +175,7 @@ pub fn run() -> sc_cli::Result<()> {
builder.with_colors(false);
let _ = builder.init();
polkadot_node_core_pvf_worker::execute_worker_entrypoint(
polkadot_node_core_pvf::execute_worker_entrypoint(
&cmd.socket_path,
Some(&cmd.node_impl_version),
);
+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
+2 -2
View File
@@ -9,8 +9,8 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies]
codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] }
hash-db = { version = "0.16.0", default-features = false }
log = { version = "0.4.17", default-features = false }
scale-info = { version = "2.6.0", default-features = false, features = ["derive"] }
log = { version = "0.4.18", default-features = false }
scale-info = { version = "2.7.0", default-features = false, features = ["derive"] }
static_assertions = { version = "1.1", optional = true }
# Bridge dependencies
+1 -1
View File
@@ -190,7 +190,7 @@ impl pallet_balances::Config for TestRuntime {
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>;
+1 -7
View File
@@ -328,6 +328,7 @@ pub mod pallet {
StorageValue<_, BasicOperatingMode, ValueQuery>;
#[pallet::genesis_config]
#[derive(frame_support::DefaultNoBound)]
pub struct GenesisConfig<T: Config<I>, I: 'static = ()> {
/// Optional module owner account.
pub owner: Option<T::AccountId>,
@@ -335,13 +336,6 @@ pub mod pallet {
pub init_data: Option<InitializationDataOf<T, I>>,
}
#[cfg(feature = "std")]
impl<T: Config<I>, I: 'static> Default for GenesisConfig<T, I> {
fn default() -> Self {
Self { owner: None, init_data: None }
}
}
#[pallet::genesis_build]
impl<T: Config<I>, I: 'static> GenesisBuild<T, I> for GenesisConfig<T, I> {
fn build(&self) {
+2 -2
View File
@@ -10,8 +10,8 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies]
codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false }
finality-grandpa = { version = "0.16.2", default-features = false }
log = { version = "0.4.17", default-features = false }
scale-info = { version = "2.6.0", default-features = false, features = ["derive"] }
log = { version = "0.4.18", default-features = false }
scale-info = { version = "2.7.0", default-features = false, features = ["derive"] }
# Bridge Dependencies
+2 -8
View File
@@ -44,7 +44,7 @@ use bp_header_chain::{
};
use bp_runtime::{BlockNumberOf, HashOf, HasherOf, HeaderId, HeaderOf, OwnedBridgeModule};
use finality_grandpa::voter_set::VoterSet;
use frame_support::{dispatch::PostDispatchInfo, ensure};
use frame_support::{dispatch::PostDispatchInfo, ensure, DefaultNoBound};
use sp_consensus_grandpa::{ConsensusLog, GRANDPA_ENGINE_ID};
use sp_runtime::{
traits::{Header as HeaderT, Zero},
@@ -370,6 +370,7 @@ pub mod pallet {
StorageValue<_, BasicOperatingMode, ValueQuery>;
#[pallet::genesis_config]
#[derive(DefaultNoBound)]
pub struct GenesisConfig<T: Config<I>, I: 'static = ()> {
/// Optional module owner account.
pub owner: Option<T::AccountId>,
@@ -377,13 +378,6 @@ pub mod pallet {
pub init_data: Option<super::InitializationData<BridgedHeader<T, I>>>,
}
#[cfg(feature = "std")]
impl<T: Config<I>, I: 'static> Default for GenesisConfig<T, I> {
fn default() -> Self {
Self { owner: None, init_data: None }
}
}
#[pallet::genesis_build]
impl<T: Config<I>, I: 'static> GenesisBuild<T, I> for GenesisConfig<T, I> {
fn build(&self) {
+2 -2
View File
@@ -8,9 +8,9 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies]
codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false }
log = { version = "0.4.17", default-features = false }
log = { version = "0.4.18", default-features = false }
num-traits = { version = "0.2", default-features = false }
scale-info = { version = "2.6.0", default-features = false, features = ["derive"] }
scale-info = { version = "2.7.0", default-features = false, features = ["derive"] }
# Bridge dependencies
+2 -12
View File
@@ -65,7 +65,7 @@ use bp_messages::{
};
use bp_runtime::{BasicOperatingMode, ChainId, OwnedBridgeModule, PreComputedSize, Size};
use codec::{Decode, Encode, MaxEncodedLen};
use frame_support::{dispatch::PostDispatchInfo, ensure, fail, traits::Get};
use frame_support::{dispatch::PostDispatchInfo, ensure, fail, traits::Get, DefaultNoBound};
use sp_runtime::traits::UniqueSaturatedFrom;
use sp_std::{marker::PhantomData, prelude::*};
@@ -586,6 +586,7 @@ pub mod pallet {
StorageMap<_, Blake2_128Concat, MessageKey, StoredMessagePayload<T, I>>;
#[pallet::genesis_config]
#[derive(DefaultNoBound)]
pub struct GenesisConfig<T: Config<I>, I: 'static = ()> {
/// Initial pallet operating mode.
pub operating_mode: MessagesOperatingMode,
@@ -595,17 +596,6 @@ pub mod pallet {
pub phantom: sp_std::marker::PhantomData<I>,
}
#[cfg(feature = "std")]
impl<T: Config<I>, I: 'static> Default for GenesisConfig<T, I> {
fn default() -> Self {
Self {
operating_mode: Default::default(),
owner: Default::default(),
phantom: Default::default(),
}
}
}
#[pallet::genesis_build]
impl<T: Config<I>, I: 'static> GenesisBuild<T, I> for GenesisConfig<T, I> {
fn build(&self) {
+1 -1
View File
@@ -133,7 +133,7 @@ impl pallet_balances::Config for TestRuntime {
type WeightInfo = ();
type MaxReserves = ();
type ReserveIdentifier = ();
type HoldIdentifier = ();
type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;
+2 -2
View File
@@ -7,8 +7,8 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies]
codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false }
log = { version = "0.4.17", default-features = false }
scale-info = { version = "2.6.0", default-features = false, features = ["derive"] }
log = { version = "0.4.18", default-features = false }
scale-info = { version = "2.7.0", default-features = false, features = ["derive"] }
# Bridge Dependencies
+2 -12
View File
@@ -30,7 +30,7 @@ use bp_header_chain::{HeaderChain, HeaderChainError};
use bp_parachains::{parachain_head_storage_key_at_source, ParaInfo, ParaStoredHeaderData};
use bp_polkadot_core::parachains::{ParaHash, ParaHead, ParaHeadsProof, ParaId};
use bp_runtime::{Chain, HashOf, HeaderId, HeaderIdOf, Parachain, StorageProofError};
use frame_support::dispatch::PostDispatchInfo;
use frame_support::{dispatch::PostDispatchInfo, DefaultNoBound};
use sp_std::{marker::PhantomData, vec::Vec};
#[cfg(feature = "runtime-benchmarks")]
@@ -611,6 +611,7 @@ pub mod pallet {
}
#[pallet::genesis_config]
#[derive(DefaultNoBound)]
pub struct GenesisConfig<T: Config<I>, I: 'static = ()> {
/// Initial pallet operating mode.
pub operating_mode: BasicOperatingMode,
@@ -620,17 +621,6 @@ pub mod pallet {
pub phantom: sp_std::marker::PhantomData<I>,
}
#[cfg(feature = "std")]
impl<T: Config<I>, I: 'static> Default for GenesisConfig<T, I> {
fn default() -> Self {
Self {
operating_mode: Default::default(),
owner: Default::default(),
phantom: Default::default(),
}
}
}
#[pallet::genesis_build]
impl<T: Config<I>, I: 'static> GenesisBuild<T, I> for GenesisConfig<T, I> {
fn build(&self) {
+2 -2
View File
@@ -8,8 +8,8 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies]
codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false }
log = { version = "0.4.17", default-features = false }
scale-info = { version = "2.6.0", default-features = false, features = ["derive"] }
log = { version = "0.4.18", default-features = false }
scale-info = { version = "2.7.0", default-features = false, features = ["derive"] }
# Bridge dependencies
+1 -1
View File
@@ -102,7 +102,7 @@ impl pallet_balances::Config for TestRuntime {
type WeightInfo = ();
type MaxReserves = ConstU32<1>;
type ReserveIdentifier = [u8; 8];
type HoldIdentifier = ();
type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxFreezes = ConstU32<0>;