Skip to content

Commit

Permalink
Feature/plmc 460 upgrade to sdk 16 (#181)
Browse files Browse the repository at this point in the history
* update wip

* fix base runtime

* decrease election max values

* fix some migration issues

* fix xcm executor again

* fix test runtime

* fix node

* make integration tests build

* fix governance integration tests

* fix integration tests and properly configure xcm config with new pallet_funding

* first step benchmarks fix

* fix benchmarks

* add defaults to tests frame_system

* fix try-runtime

* fmt

* remove unused dependency

* fix warnings

* fmt

* fix integration tests and update funding cargo.toml

* feat: implement missing runtime api

* feat: use camelCase in JSON

* chore: zepter

* feat: switch to base

* fmt

* trying fix testnet chain spec

* fix std build for testing node

* fmt

* fmt

* chore: zepter

* fix: use the right runtime in the benchmarks

* chore: remove unused imports

* chore: lock upgrade

* chore: remove few unused deps from base

* chore: bump to 1.75.0

paritytech/polkadot-sdk#2590

* fix: testnet benchmarks

* fix: use camelCase in testnet

* chore: add chain flag to justfile

* benchmark fixes

* fmt

* feat: bump `spec_version` and `transaction_version`

* fix: post merge

* fix: restore integration tests

* chore: remove unused deps

* chore: fat fingers

* chore: zepter

* chore: fmt

* fic: partially fix build-spec test

* feat: use production profile in srtool

---------

Co-authored-by: Leonardo Razovic <4128940+lrazovic@users.noreply.github.com>
Co-authored-by: Juan Ignacio Rios <juani.rios.99@gmail.com>
  • Loading branch information
3 people authored Mar 22, 2024
1 parent 0fb2ef3 commit 22a25bb
Show file tree
Hide file tree
Showing 76 changed files with 5,201 additions and 3,665 deletions.
5,361 changes: 3,322 additions & 2,039 deletions Cargo.lock

Large diffs are not rendered by default.

263 changes: 134 additions & 129 deletions Cargo.toml

Large diffs are not rendered by default.

16 changes: 9 additions & 7 deletions integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ pallet-xcm.workspace = true
pallet-assets.workspace = true
polkadot-core-primitives.workspace = true
polkadot-runtime-parachains.workspace = true
polkadot-parachain.workspace = true
polkadot-parachain-primitives.workspace = true
pallet-collective.workspace = true
pallet-elections-phragmen.workspace = true
pallet-message-queue.workspace = true

cumulus-primitives-core.workspace = true
cumulus-pallet-xcm.workspace = true
cumulus-pallet-xcmp-queue.workspace = true

parachain-info.workspace = true
parachains-common.workspace = true
Expand All @@ -57,9 +57,10 @@ polkadot-primitives.workspace = true
polkadot-service.workspace = true
sp-authority-discovery.workspace = true
sp-consensus-babe.workspace = true
sp-consensus-beefy.workspace = true
polkadot-runtime-constants.workspace = true
system-parachains-constants.workspace = true
pallet-staking.workspace = true
pallet-message-queue.workspace = true
pallet-membership.workspace = true
orml-oracle.workspace = true
pallet-parachain-staking.workspace = true
Expand All @@ -85,7 +86,6 @@ instant-mode = [
std = [
"asset-hub-polkadot-runtime/std",
"cumulus-pallet-xcm/std",
"cumulus-pallet-xcmp-queue/std",
"cumulus-primitives-core/std",
"frame-support/std",
"frame-system/std",
Expand All @@ -111,12 +111,12 @@ std = [
"parachains-common/std",
"parity-scale-codec/std",
"penpal-runtime/std",
"polimec-common/std",
"polimec-common-test-utils/std",
"politest-runtime/std",
"polimec-common/std",
"polimec-receiver/std",
"politest-runtime/std",
"polkadot-core-primitives/std",
"polkadot-parachain/std",
"polkadot-parachain-primitives/std",
"polkadot-primitives/std",
"polkadot-runtime-constants/std",
"polkadot-runtime-parachains/std",
Expand All @@ -126,10 +126,12 @@ std = [
"sp-arithmetic/std",
"sp-authority-discovery/std",
"sp-consensus-babe/std",
"sp-consensus-beefy/std",
"sp-core/std",
"sp-io/std",
"sp-runtime/std",
"sp-std/std",
"system-parachains-constants/std",
"xcm-builder/std",
"xcm-executor/std",
"xcm/std",
Expand Down
16 changes: 12 additions & 4 deletions integration-tests/penpal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Anonymous"]
description = "A parachain for communication back and forth with XCM of assets and uniques."
license = "Unlicense"
homepage = "https://substrate.io"
repository = "https://github.com/paritytech/cumulus/"
repository = "https://github.com/paritytech/polkadot-sdk"
edition = "2021"

[package.metadata.docs.rs]
Expand Down Expand Up @@ -36,6 +36,7 @@ frame-try-runtime = { workspace = true, optional = true }
pallet-aura.workspace = true
pallet-authorship.workspace = true
pallet-balances.workspace = true
pallet-message-queue.workspace = true
pallet-session.workspace = true
pallet-sudo.workspace = true
pallet-timestamp.workspace = true
Expand All @@ -59,7 +60,7 @@ polkadot-runtime-parachains.workspace = true
# Polkadot
polkadot-primitives.workspace = true
pallet-xcm.workspace = true
polkadot-parachain.workspace = true
polkadot-parachain-primitives.workspace = true
polkadot-runtime-common.workspace = true
xcm.workspace = true
xcm-builder.workspace = true
Expand Down Expand Up @@ -107,6 +108,7 @@ std = [
"pallet-authorship/std",
"pallet-balances/std",
"pallet-collator-selection/std",
"pallet-message-queue/std",
"pallet-session/std",
"pallet-sudo/std",
"pallet-timestamp/std",
Expand All @@ -118,7 +120,7 @@ std = [
"parachains-common/std",
"polimec-common/std",
"polimec-receiver/std",
"polkadot-parachain/std",
"polkadot-parachain-primitives/std",
"polkadot-primitives/std",
"polkadot-runtime-common/std",
"polkadot-runtime-parachains/std",
Expand All @@ -141,9 +143,12 @@ std = [
]

runtime-benchmarks = [
"cumulus-pallet-dmp-queue/runtime-benchmarks",
"cumulus-pallet-parachain-system/runtime-benchmarks",
"cumulus-pallet-session-benchmarking/runtime-benchmarks",
"cumulus-pallet-xcmp-queue/runtime-benchmarks",
"cumulus-primitives-core/runtime-benchmarks",
"cumulus-primitives-utility/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system-benchmarking/runtime-benchmarks",
Expand All @@ -152,13 +157,15 @@ runtime-benchmarks = [
"pallet-assets/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-collator-selection/runtime-benchmarks",
"pallet-message-queue/runtime-benchmarks",
"pallet-sudo/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks",
"pallet-vesting/runtime-benchmarks",
"pallet-xcm/runtime-benchmarks",
"parachains-common/runtime-benchmarks",
"polimec-common/runtime-benchmarks",
"polimec-receiver/runtime-benchmarks",
"polkadot-parachain/runtime-benchmarks",
"polkadot-parachain-primitives/runtime-benchmarks",
"polkadot-primitives/runtime-benchmarks",
"polkadot-runtime-common/runtime-benchmarks",
"polkadot-runtime-parachains/runtime-benchmarks",
Expand All @@ -183,6 +190,7 @@ try-runtime = [
"pallet-authorship/try-runtime",
"pallet-balances/try-runtime",
"pallet-collator-selection/try-runtime",
"pallet-message-queue/try-runtime",
"pallet-session/try-runtime",
"pallet-sudo/try-runtime",
"pallet-timestamp/try-runtime",
Expand Down
68 changes: 55 additions & 13 deletions integration-tests/penpal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ mod weights;
pub mod xcm_config;

use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases;
use cumulus_primitives_core::ParaId;
use cumulus_primitives_core::{AggregateMessageOrigin, ParaId};
use frame_support::{
construct_runtime,
dispatch::DispatchClass,
pallet_prelude::Weight,
parameter_types,
traits::{AsEnsureOriginWithArg, ConstU32, ConstU64, ConstU8, Everything},
traits::{AsEnsureOriginWithArg, ConstU32, ConstU64, ConstU8, Everything, TransformOrigin},
weights::{
constants::WEIGHT_REF_TIME_PER_SECOND, ConstantMultiplier, FeePolynomial, WeightToFeeCoefficient,
WeightToFeeCoefficients, WeightToFeePolynomial,
Expand Down Expand Up @@ -70,13 +70,16 @@ use xcm_config::{AssetsToBlockAuthor, XcmConfig, XcmOriginToTransactDispatchOrig
pub use sp_runtime::BuildStorage;

// Polkadot imports
use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
use polkadot_runtime_common::{xcm_sender::NoPriceForMessageDelivery, BlockHashCount, SlowAdjustingFeeUpdate};

use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};

// XCM Imports
use frame_support::traits::WithdrawReasons;
use parachains_common::{AccountId, Signature};
use parachains_common::{
message_queue::{NarrowOriginToSibling, ParaIdToSibling},
AccountId, Signature,
};
use sp_runtime::traits::Convert;
use xcm::latest::prelude::BodyId;
use xcm_executor::XcmExecutor;
Expand Down Expand Up @@ -271,6 +274,15 @@ const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(
cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64,
);

/// Maximum number of blocks simultaneously accepted by the Runtime, not yet included
/// into the relay chain.
pub const UNINCLUDED_SEGMENT_CAPACITY: u32 = 1;
/// How many parachain blocks are processed by the relay chain per parent. Limits the
/// number of blocks authored per slot.
pub const BLOCK_PROCESSING_VELOCITY: u32 = 1;
/// Relay chain slot duration, in milliseconds.
pub const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32 = 6000;

/// The version information used to identify this runtime when compiled natively.
#[cfg(feature = "std")]
pub fn native_version() -> NativeVersion {
Expand Down Expand Up @@ -349,6 +361,8 @@ impl frame_system::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
/// The ubiquitous origin type.
type RuntimeOrigin = RuntimeOrigin;
/// The ubiquitous task type.
type RuntimeTask = RuntimeTask;
/// This is used as an identifier of the chain. 42 is the generic substrate prefix.
type SS58Prefix = SS58Prefix;
/// Weight information for the extrinsics of this pallet.
Expand Down Expand Up @@ -388,7 +402,8 @@ impl pallet_balances::Config for Runtime {
type ReserveIdentifier = [u8; 8];
/// The ubiquitous event type.
type RuntimeEvent = RuntimeEvent;
type RuntimeHoldReason = ();
type RuntimeFreezeReason = RuntimeFreezeReason;
type RuntimeHoldReason = RuntimeHoldReason;
type WeightInfo = pallet_balances::weights::SubstrateWeight<Runtime>;
}

Expand Down Expand Up @@ -447,15 +462,26 @@ parameter_types! {
pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4);
}

parameter_types! {
pub const RelayOrigin: AggregateMessageOrigin = AggregateMessageOrigin::Parent;
}

impl cumulus_pallet_parachain_system::Config for Runtime {
type CheckAssociatedRelayNumber = RelayNumberStrictlyIncreases;
type DmpMessageHandler = DmpQueue;
type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook<
Runtime,
RELAY_CHAIN_SLOT_DURATION_MILLIS,
BLOCK_PROCESSING_VELOCITY,
UNINCLUDED_SEGMENT_CAPACITY,
>;
type DmpQueue = frame_support::traits::EnqueueWithOrigin<MessageQueue, RelayOrigin>;
type OnSystemEvent = ();
type OutboundXcmpMessageSource = XcmpQueue;
type ReservedDmpWeight = ReservedDmpWeight;
type ReservedXcmpWeight = ReservedXcmpWeight;
type RuntimeEvent = RuntimeEvent;
type SelfParaId = parachain_info::Pallet<Runtime>;
type WeightInfo = ();
type XcmpMessageHandler = XcmpQueue;
}

Expand All @@ -467,18 +493,33 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime {
type ChannelInfo = ParachainSystem;
type ControllerOrigin = EnsureRoot<AccountId>;
type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;
type ExecuteOverweightOrigin = EnsureRoot<AccountId>;
type PriceForSiblingDelivery = ();
type MaxInboundSuspended = sp_core::ConstU32<1_000>;
type PriceForSiblingDelivery = NoPriceForMessageDelivery<ParaId>;
type RuntimeEvent = RuntimeEvent;
type VersionWrapper = PolkadotXcm;
type WeightInfo = ();
type XcmExecutor = XcmExecutor<XcmConfig>;
type XcmpQueue = TransformOrigin<MessageQueue, AggregateMessageOrigin, ParaId, ParaIdToSibling>;
}

impl cumulus_pallet_dmp_queue::Config for Runtime {
type ExecuteOverweightOrigin = EnsureRoot<AccountId>;
parameter_types! {
pub MessageQueueServiceWeight: Weight = Perbill::from_percent(35) * RuntimeBlockWeights::get().max_block;
}

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

parameter_types! {
Expand Down Expand Up @@ -556,6 +597,7 @@ parameter_types! {
}

impl pallet_vesting::Config for Runtime {
type BlockNumberProvider = System;
type BlockNumberToBalance = ConvertInto;
type Currency = Balances;
type MinVestedTransfer = MinVestedTransfer;
Expand Down Expand Up @@ -627,7 +669,7 @@ construct_runtime!(
XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 30,
PolkadotXcm: pallet_xcm::{Pallet, Call, Event<T>, Origin, Config<T>} = 31,
CumulusXcm: cumulus_pallet_xcm::{Pallet, Event<T>, Origin} = 32,
DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 33,
MessageQueue: pallet_message_queue = 34,

// The main stage.
Assets: pallet_assets::{Pallet, Call, Storage, Event<T>} = 50,
Expand Down
11 changes: 6 additions & 5 deletions integration-tests/penpal/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ use frame_support::{
use frame_system::EnsureRoot;
use pallet_asset_tx_payment::HandleCredit;
use pallet_xcm::XcmPassthrough;
use polkadot_parachain::primitives::Sibling;
use polkadot_parachain_primitives::primitives::Sibling;
use polkadot_runtime_common::impls::ToAuthor;
use sp_runtime::traits::Zero;
use xcm::latest::prelude::*;
use xcm_builder::{
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses, AllowSubscriptionsFrom,
AllowTopLevelPaidExecutionFrom, AsPrefixedGeneralIndex, ConvertedConcreteId, CurrencyAdapter,
DenyReserveTransferToRelayChain, DenyThenTry, EnsureXcmOrigin, FixedWeightBounds, FungiblesAdapter, IsConcrete,
LocalMint, NativeAsset, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
AllowTopLevelPaidExecutionFrom, AsPrefixedGeneralIndex, ConvertedConcreteId, DenyReserveTransferToRelayChain,
DenyThenTry, EnsureXcmOrigin, FixedWeightBounds, FungibleAdapter, FungiblesAdapter, IsConcrete, LocalMint,
NativeAsset, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents,
WithComputedOrigin,
};
Expand All @@ -75,7 +75,7 @@ pub type LocationToAccountId = (
);

/// Means for transacting assets on this chain.
pub type CurrencyTransactor = CurrencyAdapter<
pub type CurrencyTransactor = FungibleAdapter<
// Use this currency:
Balances,
// Use this currency when it is a fungible asset matching the given location or name:
Expand Down Expand Up @@ -294,6 +294,7 @@ impl xcm_executor::Config for XcmConfig {
type SafeCallFilter = Everything;
type SubscriptionService = PolkadotXcm;
type Trader = UsingComponents<WeightToFee, RelayLocation, AccountId, Balances, ToAuthor<Runtime>>;
type TransactionalProcessor = ();
type UniversalAliases = Nothing;
type UniversalLocation = UniversalLocation;
type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
Expand Down
Loading

0 comments on commit 22a25bb

Please sign in to comment.