mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 11:01:01 +00:00
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:
committed by
Bastian Köcher
parent
b3d6fe7cba
commit
ac725ec93f
@@ -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,
|
||||
|
||||
@@ -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),
|
||||
);
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -21,5 +21,6 @@ fn main() {
|
||||
.with_current_project()
|
||||
.import_memory()
|
||||
.export_heap_base()
|
||||
.disable_runtime_version_section_check()
|
||||
.build()
|
||||
}
|
||||
|
||||
@@ -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! {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user