Skip to content
This repository has been archived by the owner on Dec 18, 2024. It is now read-only.

Commit

Permalink
Update to Polkadot-v1.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
weezy20 committed Jan 5, 2024
1 parent 2ef1fa8 commit af4f055
Show file tree
Hide file tree
Showing 10 changed files with 2,880 additions and 3,357 deletions.
5,203 changes: 2,390 additions & 2,813 deletions Cargo.lock

Large diffs are not rendered by default.

206 changes: 103 additions & 103 deletions Cargo.toml

Large diffs are not rendered by default.

618 changes: 273 additions & 345 deletions node/src/chain_spec.rs

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ where
+ sp_api::ApiExt<Block>
+ sp_offchain::OffchainWorkerApi<Block>
+ sp_block_builder::BlockBuilder<Block>,
sc_client_api::StateBackendFor<TFullBackend<Block>, Block>: sp_api::StateBackend<BlakeTwo256>,
sc_client_api::StateBackendFor<TFullBackend<Block>, Block>: sc_client_api::StateBackend<BlakeTwo256>,
Executor: NativeExecutionDispatch + 'static,
BIQ: FnOnce(
Arc<ParachainClient<RuntimeApi, Executor>>,
Expand Down Expand Up @@ -217,8 +217,7 @@ where
+ cumulus_primitives_core::CollectCollationInfo<Block>
+ pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>
+ substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>,

sc_client_api::StateBackendFor<TFullBackend<Block>, Block>: sp_api::StateBackend<BlakeTwo256>,
sc_client_api::StateBackendFor<TFullBackend<Block>, Block>: sc_client_api::StateBackend<BlakeTwo256>,
Executor: NativeExecutionDispatch + 'static,

BIQ: FnOnce(
Expand Down Expand Up @@ -344,7 +343,7 @@ where
// Here you can check whether the hardware meets your chains' requirements. Putting a link
// in there and swapping out the requirements for your own are probably a good idea. The
// requirements for a para-chain are dictated by its relay-chain.
if !SUBSTRATE_REFERENCE_HARDWARE.check_hardware(&hwbench) && validator {
if SUBSTRATE_REFERENCE_HARDWARE.check_hardware(&hwbench).is_err() && validator {
log::warn!(
"⚠️ The hardware does not meet the minimal requirements for role 'Authority'."
);
Expand Down
11 changes: 8 additions & 3 deletions runtime/devnet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ pallet-timestamp = { workspace = true, default-features = false }
pallet-transaction-payment = { workspace = true, default-features = false }
pallet-transaction-payment-rpc-runtime-api = { workspace = true, default-features = false }
pallet-utility = { workspace = true, default-features = false }
pallet-message-queue = { workspace = true, default-features = false }
pallet-multisig = { workspace = true, default-features = false }
pallet-preimage = { workspace = true, default-features = false }
pallet-safe-mode = { workspace = true, default-features = false }
Expand Down Expand Up @@ -76,7 +77,6 @@ xcm-executor = { workspace = true, default-features = false }
# Cumulus
assets-common = { workspace = true, default-features = false }
cumulus-pallet-aura-ext = { workspace = true, default-features = false }
cumulus-pallet-dmp-queue = { workspace = true, default-features = false }
cumulus-pallet-parachain-system = { workspace = true, default-features = false, features = [
"parameterized-consensus-hook",
] }
Expand All @@ -88,6 +88,8 @@ cumulus-primitives-timestamp = { workspace = true, default-features = false }
cumulus-primitives-utility = { workspace = true, default-features = false }
pallet-collator-selection = { workspace = true, default-features = false }
parachain-info = { workspace = true, default-features = false }
parachains-common = { workspace = true, default-features = false }


[features]
default = ["std"]
Expand All @@ -97,7 +99,7 @@ std = [
"scale-info/std",
"assets-common/std",
"cumulus-pallet-aura-ext/std",
"cumulus-pallet-dmp-queue/std",
"pallet-message-queue/std",
"cumulus-pallet-parachain-system/std",
"cumulus-pallet-xcm/std",
"cumulus-pallet-xcmp-queue/std",
Expand Down Expand Up @@ -128,6 +130,7 @@ std = [
"pallet-safe-mode/std",
"pallet-tx-pause/std",
"parachain-info/std",
"parachains-common/std",
"polkadot-parachain-primitives/std",
"polkadot-runtime-common/std",
"sp-api/std",
Expand Down Expand Up @@ -158,6 +161,7 @@ runtime-benchmarks = [
"pallet-balances/runtime-benchmarks",
"pallet-collator-selection/runtime-benchmarks",
"pallet-collective/runtime-benchmarks",
"pallet-message-queue/runtime-benchmarks",
"pallet-motion/runtime-benchmarks",
"pallet-multisig/runtime-benchmarks",
"pallet-preimage/runtime-benchmarks",
Expand All @@ -171,11 +175,12 @@ runtime-benchmarks = [
"xcm-builder/runtime-benchmarks",
"cumulus-pallet-session-benchmarking/runtime-benchmarks",
"cumulus-pallet-xcmp-queue/runtime-benchmarks",
"parachains-common/runtime-benchmarks"
]

try-runtime = [
"cumulus-pallet-aura-ext/try-runtime",
"cumulus-pallet-dmp-queue/try-runtime",
"pallet-message-queue/try-runtime",
"cumulus-pallet-parachain-system/try-runtime",
"cumulus-pallet-xcm/try-runtime",
"cumulus-pallet-xcmp-queue/try-runtime",
Expand Down
77 changes: 44 additions & 33 deletions runtime/devnet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub mod xcm_config;
pub use fee::WeightToFee;

use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases;
use cumulus_primitives_core::{AssetId, Concrete};
use cumulus_primitives_core::{AggregateMessageOrigin, AssetId, Concrete, ParaId};
use pallet_tx_pause::RuntimeCallNameOf;
use sp_api::impl_runtime_apis;
use sp_core::{crypto::KeyTypeId, ConstBool, OpaqueMetadata};
Expand All @@ -30,7 +30,7 @@ use sp_version::RuntimeVersion;
use frame_support::traits::fungible::HoldConsideration;
use frame_support::traits::LinearStoragePrice;
use frame_support::{
construct_runtime,
construct_runtime, derive_impl,
dispatch::DispatchClass,
parameter_types,
traits::{
Expand All @@ -44,6 +44,8 @@ use frame_system::{
EnsureRoot, EnsureRootWithSuccess, EnsureSigned,
};
use pallet_xcm::{EnsureXcm, IsVoiceOfBody};
use parachains_common::message_queue::{NarrowOriginToSibling, ParaIdToSibling};

pub use runtime_common::{
AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, MILLISECS_PER_BLOCK, MINUTES,
NORMAL_DISPATCH_RATIO, SLOT_DURATION,
Expand Down Expand Up @@ -272,30 +274,18 @@ parameter_types! {
}

// Configure FRAME pallets to include in runtime.

#[derive_impl(frame_system::config_preludes::ParaChainDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Runtime {
/// The ubiquitous event type.
type RuntimeEvent = RuntimeEvent;
/// The basic call filter to use in dispatchable.
type BaseCallFilter = Everything;
/// Block & extrinsics weights: base values and limits.
type BlockWeights = RuntimeBlockWeights;
/// The maximum length of a block (in bytes).
type BlockLength = RuntimeBlockLength;
/// The ubiquitous origin type.
type RuntimeOrigin = RuntimeOrigin;
/// The aggregated dispatch type that is available for extrinsics.
type RuntimeCall = RuntimeCall;
/// This stores the number of previous transactions associated with a sender account.
type Nonce = Nonce;
/// The type for hashing blocks and tries.
type Hash = Hash;
/// The hashing algorithm used.
type Hashing = BlakeTwo256;
/// The identifier used to distinguish between accounts.
type AccountId = AccountId;
/// The lookup mechanism to get account ID from whatever is passed in dispatchers.
type Lookup = AccountIdLookup<AccountId, ()>;
/// The Block type used by the runtime. This is used by `construct_runtime` to retrieve the
/// extrinsics or other block specific data as needed.
type Block = Block;
Expand All @@ -305,16 +295,8 @@ impl frame_system::Config for Runtime {
type DbWeight = RocksDbWeight;
/// Runtime version.
type Version = Version;
/// Converts a module to an index of this module in the runtime.
type PalletInfo = PalletInfo;
/// The data to be stored in an account.
type AccountData = pallet_balances::AccountData<Balance>;
/// What to do if a new account is created.
type OnNewAccount = ();
/// What to do if an account is fully reaped from the system.
type OnKilledAccount = ();
/// Weight information for the extrinsics of this pallet.
type SystemWeightInfo = ();
/// This is used as an identifier of the chain. 42 is the generic substrate prefix.
type SS58Prefix = SS58Prefix;
/// The action to take on a Runtime Upgrade
Expand Down Expand Up @@ -421,6 +403,7 @@ impl pallet_utility::Config for Runtime {
parameter_types! {
pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4);
pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4);
pub const RelayOrigin: AggregateMessageOrigin = AggregateMessageOrigin::Parent;
}

/// Maximum number of blocks simultaneously accepted by the Runtime, not yet included
Expand All @@ -437,7 +420,7 @@ impl cumulus_pallet_parachain_system::Config for Runtime {
type OnSystemEvent = ();
type SelfParaId = parachain_info::Pallet<Runtime>;
type OutboundXcmpMessageSource = XcmpQueue;
type DmpMessageHandler = DmpQueue;
type DmpQueue = frame_support::traits::EnqueueWithOrigin<MessageQueue, RelayOrigin>;
type ReservedDmpWeight = ReservedDmpWeight;
type XcmpMessageHandler = XcmpQueue;
type ReservedXcmpWeight = ReservedXcmpWeight;
Expand All @@ -448,10 +431,37 @@ impl cumulus_pallet_parachain_system::Config for Runtime {
BLOCK_PROCESSING_VELOCITY,
UNINCLUDED_SEGMENT_CAPACITY,
>;
type WeightInfo = ();
}

impl parachain_info::Config for Runtime {}

parameter_types! {
pub MessageQueueServiceWeight: Weight = Perbill::from_percent(35) * RuntimeBlockWeights::get().max_block;
}

impl pallet_message_queue::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type WeightInfo = ();
#[cfg(feature = "runtime-benchmarks")]
type MessageProcessor = pallet_message_queue::mock_helpers::NoopMessageProcessor<
cumulus_primitives_core::AggregateMessageOrigin,
>;
#[cfg(not(feature = "runtime-benchmarks"))]
type MessageProcessor = xcm_builder::ProcessXcmMessage<
AggregateMessageOrigin,
xcm_executor::XcmExecutor<xcm_config::XcmConfig>,
RuntimeCall,
>;
type Size = u32;
// The XCMP queue pallet is only ever able to handle the `Sibling(ParaId)` origin:
type QueueChangeHandler = NarrowOriginToSibling<XcmpQueue>;
type QueuePausedQuery = NarrowOriginToSibling<XcmpQueue>;
type HeapSize = sp_core::ConstU32<{ 64 * 1024 }>;
type MaxStale = sp_core::ConstU32<8>;
type ServiceWeight = MessageQueueServiceWeight;
}

impl cumulus_pallet_aura_ext::Config for Runtime {}

parameter_types! {
Expand All @@ -472,22 +482,22 @@ pub type PriceForSiblingParachainDelivery = polkadot_runtime_common::xcm_sender:

impl cumulus_pallet_xcmp_queue::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type XcmExecutor = XcmExecutor<XcmConfig>;
type ChannelInfo = ParachainSystem;
type VersionWrapper = ();
type ExecuteOverweightOrigin = EnsureRoot<AccountId>;
// Enqueue XCMP messages from siblings for later processing.
type XcmpQueue = frame_support::traits::TransformOrigin<
MessageQueue,
AggregateMessageOrigin,
ParaId,
ParaIdToSibling,
>;
type MaxInboundSuspended = sp_core::ConstU32<1_000>;
type ControllerOrigin = EnsureRoot<AccountId>;
type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;
type PriceForSiblingDelivery = PriceForSiblingParachainDelivery;
type WeightInfo = ();
}

impl cumulus_pallet_dmp_queue::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type XcmExecutor = XcmExecutor<XcmConfig>;
type ExecuteOverweightOrigin = EnsureRoot<AccountId>;
}

parameter_types! {
pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) *
RuntimeBlockWeights::get().max_block;
Expand Down Expand Up @@ -752,7 +762,7 @@ construct_runtime!(
XcmpQueue: cumulus_pallet_xcmp_queue = 30,
PolkadotXcm: pallet_xcm = 31,
CumulusXcm: cumulus_pallet_xcm = 32,
DmpQueue: cumulus_pallet_dmp_queue = 33,
MessageQueue: pallet_message_queue = 33,
}
);

Expand All @@ -765,6 +775,7 @@ mod benches {
[pallet_session, SessionBench::<Runtime>]
[pallet_scheduler, Scheduler]
[pallet_timestamp, Timestamp]
[pallet_message_queue, MessageQueue]
[pallet_collator_selection, CollatorSelection]
[pallet_multisig, Multisig]
[pallet_preimage, Preimage]
Expand Down
7 changes: 0 additions & 7 deletions runtime/devnet/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,6 @@ pub type XcmRouter = WithUniqueTopic<(
XcmpQueue,
)>;

#[cfg(feature = "runtime-benchmarks")]
parameter_types! {
pub ReachableDest: Option<MultiLocation> = Some(Parent.into());
}

impl pallet_xcm::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
// We disallow users to send arbitrary XCMs from this chain.
Expand Down Expand Up @@ -284,8 +279,6 @@ impl pallet_xcm::Config for Runtime {
type SovereignAccountOf = LocationToAccountId;
type MaxLockers = ConstU32<8>;
type WeightInfo = pallet_xcm::TestWeightInfo;
#[cfg(feature = "runtime-benchmarks")]
type ReachableDest = ReachableDest;
type MaxRemoteLockConsumers = ConstU32<0>;
type RemoteLockConsumerIdentifier = ();
}
Expand Down
11 changes: 8 additions & 3 deletions runtime/mainnet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ pallet-timestamp = { workspace = true, default-features = false }
pallet-transaction-payment = { workspace = true, default-features = false }
pallet-transaction-payment-rpc-runtime-api = { workspace = true, default-features = false }
pallet-utility = { workspace = true, default-features = false }
pallet-message-queue = { workspace = true, default-features = false }
pallet-multisig = { workspace = true, default-features = false }
pallet-preimage = { workspace = true, default-features = false }
pallet-safe-mode = { workspace = true, default-features = false }
Expand Down Expand Up @@ -76,7 +77,6 @@ xcm-executor = { workspace = true, default-features = false }
# Cumulus
assets-common = { workspace = true, default-features = false }
cumulus-pallet-aura-ext = { workspace = true, default-features = false }
cumulus-pallet-dmp-queue = { workspace = true, default-features = false }
cumulus-pallet-parachain-system = { workspace = true, default-features = false, features = [
"parameterized-consensus-hook",
] }
Expand All @@ -88,6 +88,8 @@ cumulus-primitives-timestamp = { workspace = true, default-features = false }
cumulus-primitives-utility = { workspace = true, default-features = false }
pallet-collator-selection = { workspace = true, default-features = false }
parachain-info = { workspace = true, default-features = false }
parachains-common = { workspace = true, default-features = false }


[features]
default = ["std"]
Expand All @@ -97,7 +99,7 @@ std = [
"scale-info/std",
"assets-common/std",
"cumulus-pallet-aura-ext/std",
"cumulus-pallet-dmp-queue/std",
"pallet-message-queue/std",
"cumulus-pallet-parachain-system/std",
"cumulus-pallet-xcm/std",
"cumulus-pallet-xcmp-queue/std",
Expand Down Expand Up @@ -128,6 +130,7 @@ std = [
"pallet-safe-mode/std",
"pallet-tx-pause/std",
"parachain-info/std",
"parachains-common/std",
"polkadot-parachain-primitives/std",
"polkadot-runtime-common/std",
"sp-api/std",
Expand Down Expand Up @@ -158,6 +161,7 @@ runtime-benchmarks = [
"pallet-balances/runtime-benchmarks",
"pallet-collator-selection/runtime-benchmarks",
"pallet-collective/runtime-benchmarks",
"pallet-message-queue/runtime-benchmarks",
"pallet-motion/runtime-benchmarks",
"pallet-multisig/runtime-benchmarks",
"pallet-preimage/runtime-benchmarks",
Expand All @@ -171,11 +175,12 @@ runtime-benchmarks = [
"xcm-builder/runtime-benchmarks",
"cumulus-pallet-session-benchmarking/runtime-benchmarks",
"cumulus-pallet-xcmp-queue/runtime-benchmarks",
"parachains-common/runtime-benchmarks",
]

try-runtime = [
"cumulus-pallet-aura-ext/try-runtime",
"cumulus-pallet-dmp-queue/try-runtime",
"pallet-message-queue/try-runtime",
"cumulus-pallet-parachain-system/try-runtime",
"cumulus-pallet-xcm/try-runtime",
"cumulus-pallet-xcmp-queue/try-runtime",
Expand Down
Loading

0 comments on commit af4f055

Please sign in to comment.