Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into lexnv/storage-diff
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandru Vasile <[email protected]>
  • Loading branch information
lexnv committed Nov 12, 2024
2 parents a7e54a5 + 9f603b1 commit 5341227
Show file tree
Hide file tree
Showing 69 changed files with 10,731 additions and 4,803 deletions.
12,537 changes: 8,502 additions & 4,035 deletions Cargo.lock

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ enumn = { version = "0.1.13" }
env_logger = { version = "0.11.2" }
environmental = { version = "1.1.4", default-features = false }
equivocation-detector = { path = "bridges/relays/equivocation" }
ethabi = { version = "1.0.0", default-features = false, package = "ethabi-decode" }
ethabi = { version = "2.0.0", default-features = false, package = "ethabi-decode" }
ethbloom = { version = "0.14.1", default-features = false }
ethereum-types = { version = "0.15.1", default-features = false }
exit-future = { version = "0.2.0" }
Expand Down Expand Up @@ -1316,8 +1316,8 @@ substrate-test-runtime-client = { path = "substrate/test-utils/runtime/client" }
substrate-test-runtime-transaction-pool = { path = "substrate/test-utils/runtime/transaction-pool" }
substrate-test-utils = { path = "substrate/test-utils" }
substrate-wasm-builder = { path = "substrate/utils/wasm-builder", default-features = false }
subxt = { version = "0.37", default-features = false }
subxt-signer = { version = "0.37" }
subxt = { version = "0.38", default-features = false }
subxt-signer = { version = "0.38" }
syn = { version = "2.0.87" }
sysinfo = { version = "0.30" }
tar = { version = "0.4" }
Expand Down Expand Up @@ -1387,7 +1387,7 @@ xcm-procedural = { path = "polkadot/xcm/procedural", default-features = false }
xcm-runtime-apis = { path = "polkadot/xcm/xcm-runtime-apis", default-features = false }
xcm-simulator = { path = "polkadot/xcm/xcm-simulator", default-features = false }
zeroize = { version = "1.7.0", default-features = false }
zombienet-sdk = { version = "0.2.13" }
zombienet-sdk = { version = "0.2.15" }
zstd = { version = "0.12.4", default-features = false }

[profile.release]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ use xcm_builder::{
use xcm_executor::XcmExecutor;

parameter_types! {
pub const RootLocation: Location = Location::here();
pub const TokenLocation: Location = Location::parent();
pub const RelayNetwork: NetworkId = NetworkId::ByGenesis(ROCOCO_GENESIS_HASH);
pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into();
Expand Down Expand Up @@ -315,6 +316,7 @@ pub type ForeignAssetFeeAsExistentialDepositMultiplierFeeCharger =
/// either execution or delivery.
/// We only waive fees for system functions, which these locations represent.
pub type WaivedLocations = (
Equals<RootLocation>,
RelayOrOtherSystemParachains<AllSiblingSystemParachains, Runtime>,
Equals<RelayTreasuryLocation>,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: alloc::borrow::Cow::Borrowed("westmint"),
impl_name: alloc::borrow::Cow::Borrowed("westmint"),
authoring_version: 1,
spec_version: 1_016_004,
spec_version: 1_016_005,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 16,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ use xcm_builder::{
use xcm_executor::XcmExecutor;

parameter_types! {
pub const RootLocation: Location = Location::here();
pub const WestendLocation: Location = Location::parent();
pub const RelayNetwork: Option<NetworkId> = Some(NetworkId::ByGenesis(WESTEND_GENESIS_HASH));
pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into();
Expand Down Expand Up @@ -336,6 +337,7 @@ pub type ForeignAssetFeeAsExistentialDepositMultiplierFeeCharger =
/// either execution or delivery.
/// We only waive fees for system functions, which these locations represent.
pub type WaivedLocations = (
Equals<RootLocation>,
RelayOrOtherSystemParachains<AllSiblingSystemParachains, Runtime>,
Equals<RelayTreasuryLocation>,
FellowshipEntities,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ use xcm_executor::{
};

parameter_types! {
pub const RootLocation: Location = Location::here();
pub const TokenLocation: Location = Location::parent();
pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into();
pub RelayNetwork: NetworkId = NetworkId::ByGenesis(ROCOCO_GENESIS_HASH);
Expand Down Expand Up @@ -164,6 +165,7 @@ pub type Barrier = TrailingSetTopicAsId<
/// either execution or delivery.
/// We only waive fees for system functions, which these locations represent.
pub type WaivedLocations = (
Equals<RootLocation>,
RelayOrOtherSystemParachains<AllSiblingSystemParachains, Runtime>,
Equals<RelayTreasuryLocation>,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ use xcm_executor::{
};

parameter_types! {
pub const RootLocation: Location = Location::here();
pub const WestendLocation: Location = Location::parent();
pub const RelayNetwork: NetworkId = NetworkId::ByGenesis(WESTEND_GENESIS_HASH);
pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into();
Expand Down Expand Up @@ -161,6 +162,7 @@ pub type Barrier = TrailingSetTopicAsId<
/// either execution or delivery.
/// We only waive fees for system functions, which these locations represent.
pub type WaivedLocations = (
Equals<RootLocation>,
RelayOrOtherSystemParachains<AllSiblingSystemParachains, Runtime>,
Equals<RelayTreasuryLocation>,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ use xcm_builder::{
use xcm_executor::XcmExecutor;

parameter_types! {
pub const RootLocation: Location = Location::here();
pub const RelayLocation: Location = Location::parent();
pub const RelayNetwork: NetworkId = NetworkId::ByGenesis(ROCOCO_GENESIS_HASH);
pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into();
Expand Down Expand Up @@ -166,6 +167,7 @@ pub type Barrier = TrailingSetTopicAsId<
/// either execution or delivery.
/// We only waive fees for system functions, which these locations represent.
pub type WaivedLocations = (
Equals<RootLocation>,
RelayOrOtherSystemParachains<AllSiblingSystemParachains, Runtime>,
Equals<RelayTreasuryLocation>,
);
Expand Down
22 changes: 21 additions & 1 deletion cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
pub use sp_runtime::BuildStorage;
use sp_runtime::{
generic, impl_opaque_keys,
traits::{BlakeTwo256, Block as BlockT},
traits::{BlakeTwo256, Block as BlockT, BlockNumberProvider},
transaction_validity::{TransactionSource, TransactionValidity},
ApplyExtrinsicResult, DispatchError, MultiAddress, Perbill, RuntimeDebug,
};
Expand Down Expand Up @@ -124,6 +124,7 @@ pub type Migrations = (
pallet_broker::migration::MigrateV0ToV1<Runtime>,
pallet_broker::migration::MigrateV1ToV2<Runtime>,
pallet_broker::migration::MigrateV2ToV3<Runtime>,
pallet_broker::migration::MigrateV3ToV4<Runtime, BrokerMigrationV4BlockConversion>,
// permanent
pallet_xcm::migration::MigrateToLatestXcmVersion<Runtime>,
);
Expand Down Expand Up @@ -591,6 +592,25 @@ impl pallet_sudo::Config for Runtime {
type WeightInfo = pallet_sudo::weights::SubstrateWeight<Runtime>;
}

pub struct BrokerMigrationV4BlockConversion;

impl pallet_broker::migration::v4::BlockToRelayHeightConversion<Runtime>
for BrokerMigrationV4BlockConversion
{
fn convert_block_number_to_relay_height(input_block_number: u32) -> u32 {
let relay_height = pallet_broker::RCBlockNumberProviderOf::<
<Runtime as pallet_broker::Config>::Coretime,
>::current_block_number();
let parachain_block_number = frame_system::Pallet::<Runtime>::block_number();
let offset = relay_height - parachain_block_number * 2;
offset + input_block_number * 2
}

fn convert_block_length_to_relay_length(input_block_length: u32) -> u32 {
input_block_length * 2
}
}

// Create the runtime by composing the FRAME pallets that were previously configured.
construct_runtime!(
pub enum Runtime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ use xcm_builder::{
use xcm_executor::XcmExecutor;

parameter_types! {
pub const RootLocation: Location = Location::here();
pub const RocRelayLocation: Location = Location::parent();
pub const RelayNetwork: Option<NetworkId> = Some(NetworkId::ByGenesis(ROCOCO_GENESIS_HASH));
pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into();
Expand Down Expand Up @@ -177,6 +178,7 @@ parameter_types! {
/// Locations that will not be charged fees in the executor, neither for execution nor delivery.
/// We only waive fees for system functions, which these locations represent.
pub type WaivedLocations = (
Equals<RootLocation>,
RelayOrOtherSystemParachains<AllSiblingSystemParachains, Runtime>,
Equals<RelayTreasuryLocation>,
);
Expand Down
22 changes: 21 additions & 1 deletion cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
pub use sp_runtime::BuildStorage;
use sp_runtime::{
generic, impl_opaque_keys,
traits::{BlakeTwo256, Block as BlockT},
traits::{BlakeTwo256, Block as BlockT, BlockNumberProvider},
transaction_validity::{TransactionSource, TransactionValidity},
ApplyExtrinsicResult, DispatchError, MultiAddress, Perbill, RuntimeDebug,
};
Expand Down Expand Up @@ -124,6 +124,7 @@ pub type Migrations = (
pallet_broker::migration::MigrateV0ToV1<Runtime>,
pallet_broker::migration::MigrateV1ToV2<Runtime>,
pallet_broker::migration::MigrateV2ToV3<Runtime>,
pallet_broker::migration::MigrateV3ToV4<Runtime, BrokerMigrationV4BlockConversion>,
// permanent
pallet_xcm::migration::MigrateToLatestXcmVersion<Runtime>,
);
Expand Down Expand Up @@ -586,6 +587,25 @@ impl pallet_utility::Config for Runtime {
type WeightInfo = weights::pallet_utility::WeightInfo<Runtime>;
}

pub struct BrokerMigrationV4BlockConversion;

impl pallet_broker::migration::v4::BlockToRelayHeightConversion<Runtime>
for BrokerMigrationV4BlockConversion
{
fn convert_block_number_to_relay_height(input_block_number: u32) -> u32 {
let relay_height = pallet_broker::RCBlockNumberProviderOf::<
<Runtime as pallet_broker::Config>::Coretime,
>::current_block_number();
let parachain_block_number = frame_system::Pallet::<Runtime>::block_number();
let offset = relay_height - parachain_block_number * 2;
offset + input_block_number * 2
}

fn convert_block_length_to_relay_length(input_block_length: u32) -> u32 {
input_block_length * 2
}
}

// Create the runtime by composing the FRAME pallets that were previously configured.
construct_runtime!(
pub enum Runtime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ use xcm_builder::{
use xcm_executor::XcmExecutor;

parameter_types! {
pub const RootLocation: Location = Location::here();
pub const TokenRelayLocation: Location = Location::parent();
pub const RelayNetwork: Option<NetworkId> = Some(NetworkId::ByGenesis(WESTEND_GENESIS_HASH));
pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into();
Expand Down Expand Up @@ -185,6 +186,7 @@ parameter_types! {
/// Locations that will not be charged fees in the executor, neither for execution nor delivery.
/// We only waive fees for system functions, which these locations represent.
pub type WaivedLocations = (
Equals<RootLocation>,
RelayOrOtherSystemParachains<AllSiblingSystemParachains, Runtime>,
Equals<RelayTreasuryLocation>,
);
Expand Down
6 changes: 4 additions & 2 deletions cumulus/parachains/runtimes/testing/penpal/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use core::marker::PhantomData;
use frame_support::{
parameter_types,
traits::{
tokens::imbalance::ResolveAssetTo, ConstU32, Contains, ContainsPair, Everything,
tokens::imbalance::ResolveAssetTo, ConstU32, Contains, ContainsPair, Equals, Everything,
EverythingBut, Get, Nothing, PalletInfoAccess,
},
weights::Weight,
Expand Down Expand Up @@ -210,6 +210,7 @@ pub type XcmOriginToTransactDispatchOrigin = (
);

parameter_types! {
pub const RootLocation: Location = Location::here();
// One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate.
pub UnitWeightCost: Weight = Weight::from_parts(1_000_000_000, 64 * 1024);
pub const MaxInstructions: u32 = 100;
Expand Down Expand Up @@ -336,6 +337,7 @@ pub type TrustedReserves = (
pub type TrustedTeleporters =
(AssetFromChain<LocalTeleportableToAssetHub, SystemAssetHubLocation>,);

pub type WaivedLocations = Equals<RootLocation>;
/// `AssetId`/`Balance` converter for `TrustBackedAssets`.
pub type TrustBackedAssetsConvertedConcreteId =
assets_common::TrustBackedAssetsConvertedConcreteId<AssetsPalletLocation, Balance>;
Expand Down Expand Up @@ -399,7 +401,7 @@ impl xcm_executor::Config for XcmConfig {
type AssetLocker = ();
type AssetExchanger = PoolAssetsExchanger;
type FeeManager = XcmFeeManagerFromComponents<
(),
WaivedLocations,
SendXcmFeeToAccount<Self::AssetTransactor, TreasuryAccount>,
>;
type MessageExporter = ();
Expand Down
17 changes: 9 additions & 8 deletions polkadot/xcm/pallet-xcm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ use xcm_runtime_apis::{

#[cfg(any(feature = "try-runtime", test))]
use sp_runtime::TryRuntimeError;
use xcm_executor::traits::{FeeManager, FeeReason};

pub trait WeightInfo {
fn send() -> Weight;
Expand Down Expand Up @@ -240,7 +241,7 @@ pub mod pallet {
type XcmExecuteFilter: Contains<(Location, Xcm<<Self as Config>::RuntimeCall>)>;

/// Something to execute an XCM message.
type XcmExecutor: ExecuteXcm<<Self as Config>::RuntimeCall> + XcmAssetTransfers;
type XcmExecutor: ExecuteXcm<<Self as Config>::RuntimeCall> + XcmAssetTransfers + FeeManager;

/// Our XCM filter which messages to be teleported using the dedicated extrinsic must pass.
type XcmTeleportFilter: Contains<(Location, Vec<Asset>)>;
Expand Down Expand Up @@ -2468,17 +2469,17 @@ impl<T: Config> Pallet<T> {
mut message: Xcm<()>,
) -> Result<XcmHash, SendError> {
let interior = interior.into();
let local_origin = interior.clone().into();
let dest = dest.into();
let maybe_fee_payer = if interior != Junctions::Here {
let is_waived =
<T::XcmExecutor as FeeManager>::is_waived(Some(&local_origin), FeeReason::ChargeFees);
if interior != Junctions::Here {
message.0.insert(0, DescendOrigin(interior.clone()));
Some(interior.into())
} else {
None
};
}
tracing::debug!(target: "xcm::send_xcm", "{:?}, {:?}", dest.clone(), message.clone());
let (ticket, price) = validate_send::<T::XcmRouter>(dest, message)?;
if let Some(fee_payer) = maybe_fee_payer {
Self::charge_fees(fee_payer, price).map_err(|e| {
if !is_waived {
Self::charge_fees(local_origin, price).map_err(|e| {
tracing::error!(
target: "xcm::pallet_xcm::send_xcm",
?e,
Expand Down
10 changes: 10 additions & 0 deletions polkadot/xcm/xcm-executor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,16 @@ impl<Config: config::Config> XcmAssetTransfers for XcmExecutor<Config> {
type AssetTransactor = Config::AssetTransactor;
}

impl<Config: config::Config> FeeManager for XcmExecutor<Config> {
fn is_waived(origin: Option<&Location>, r: FeeReason) -> bool {
Config::FeeManager::is_waived(origin, r)
}

fn handle_fee(fee: Assets, context: Option<&XcmContext>, r: FeeReason) {
Config::FeeManager::handle_fee(fee, context, r)
}
}

#[derive(Debug)]
pub struct ExecutorError {
pub index: u32,
Expand Down
16 changes: 16 additions & 0 deletions prdoc/pr_5311.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
title: No-op Impl Polling Trait

doc:
- audience: Runtime Dev
description: |
Provide a NoOp implementation of the Polling trait for unit where the trait is defined and skiping benchmarks that necessitate it's definition.

crates:
- name: pallet-core-fellowship
bump: minor
- name: pallet-ranked-collective
bump: minor
- name: pallet-salary
bump: minor
- name: frame-support
bump: minor
14 changes: 14 additions & 0 deletions prdoc/pr_5363.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
title: "[pallet-xcm] waive transport fees based on XcmConfig"

doc:
- audience: Runtime Dev
description: |
pallet-xcm::send() no longer implicitly waives transport fees for the local root location,
but instead relies on xcm_executor::Config::FeeManager to determine whether certain locations have free transport.

🚨 Warning: 🚨 If your chain relies on free transport for local root, please make
sure to add Location::here() to the waived-fee locations in your configured xcm_executor::Config::FeeManager.

crates:
- name: pallet-xcm
bump: major
18 changes: 18 additions & 0 deletions prdoc/pr_5656.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0
# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json

title: Use Relay Blocknumber in Pallet Broker

doc:
- audience: Runtime Dev
description: |
Changing `sale_start`, `interlude_length` and `leading_length` in `pallet_broker` to use relay chain block numbers instead of parachain block numbers.
Relay chain block numbers are almost deterministic and more future proof.

crates:
- name: pallet-broker
bump: major
- name: coretime-rococo-runtime
bump: major
- name: coretime-westend-runtime
bump: major
11 changes: 11 additions & 0 deletions prdoc/pr_6301.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
title: migrate pallet-nft-fractionalization to benchmarking v2 syntax
doc:
- audience: Runtime Dev
description: |-
Migrates pallet-nft-fractionalization to benchmarking v2 syntax.

Part of:
* #6202
crates:
- name: pallet-nft-fractionalization
bump: patch
Loading

0 comments on commit 5341227

Please sign in to comment.