diff --git a/Cargo.lock b/Cargo.lock index da9a05ed50..e50b95f8fb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3244,9 +3244,9 @@ dependencies = [ [[package]] name = "encointer-primitives" -version = "6.0.0" +version = "6.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33f9df6f65bba31665651e99a088ec32664fd585051e74069c8401a77f9951fa" +checksum = "a4d3adcceca350eed739e9677fae4e1bea6c7ad526eee456ca30037cbcfe9b9a" dependencies = [ "bs58 0.5.0", "crc", diff --git a/system-parachains/encointer/Cargo.toml b/system-parachains/encointer/Cargo.toml index e84d2a5a21..c537e03359 100644 --- a/system-parachains/encointer/Cargo.toml +++ b/system-parachains/encointer/Cargo.toml @@ -22,7 +22,7 @@ smallvec = "1.13.1" # encointer deps encointer-balances-tx-payment = { default-features = false, version = "6.0.0" } encointer-balances-tx-payment-rpc-runtime-api = { default-features = false, version = "6.0.0" } -encointer-primitives = { default-features = false, version = "6.0.0" } +encointer-primitives = { default-features = false, version = "6.0.2" } pallet-encointer-balances = { default-features = false, version = "6.0.0" } pallet-encointer-bazaar = { default-features = false, version = "6.0.0" } pallet-encointer-bazaar-rpc-runtime-api = { default-features = false, version = "6.0.0" } @@ -153,7 +153,7 @@ std = [ "frame-support/std", "frame-system-rpc-runtime-api/std", "frame-system/std", - "frame-try-runtime/std", + "frame-try-runtime?/std", "log/std", "pallet-asset-tx-payment/std", "pallet-aura/std", @@ -240,3 +240,4 @@ experimental = ["pallet-aura/experimental"] # deployment. This will disable stuff that shouldn't be part of the on-chain wasm # to make it smaller, like logging for example. on-chain-release-build = ["sp-api/disable-logging"] + diff --git a/system-parachains/encointer/src/lib.rs b/system-parachains/encointer/src/lib.rs index 7b89827999..177111c090 100644 --- a/system-parachains/encointer/src/lib.rs +++ b/system-parachains/encointer/src/lib.rs @@ -100,7 +100,7 @@ use system_parachains_constants::{ SLOT_DURATION, }; use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}; -use xcm::{latest::BodyId, v3::AssetId as XcmAssetId}; +use xcm::latest::prelude::{BodyId, AssetId as XcmAssetId}; use xcm_config::{KsmLocation, XcmOriginToTransactDispatchOrigin}; @@ -307,7 +307,6 @@ impl pallet_balances::Config for Runtime { type RuntimeHoldReason = (); type RuntimeFreezeReason = RuntimeFreezeReason; type FreezeIdentifier = (); - type MaxHolds = ConstU32<0>; type MaxFreezes = ConstU32<0>; } @@ -440,7 +439,7 @@ impl cumulus_pallet_aura_ext::Config for Runtime {} parameter_types! { pub const ExecutiveBody: BodyId = BodyId::Executive; /// The asset ID for the asset that we use to pay for message delivery fees. - pub FeeAssetId: XcmAssetId = XcmAssetId::Concrete(xcm_config::KsmLocation::get()); + pub FeeAssetId: XcmAssetId = XcmAssetId(xcm_config::KsmLocation::get()); /// The base fee for the message delivery fees. pub const ToSiblingBaseDeliveryFee: u128 = CENTS.saturating_mul(3); pub const ToParentBaseDeliveryFee: u128 = CENTS.saturating_mul(3); @@ -706,10 +705,7 @@ pub type CheckedExtrinsic = generic::CheckedExtrinsic, - // also here we're actually too late with applying the migration. however, the migration does + // we're actually too late with applying the migration. however, the migration does // work as-is. pallet_xcm::migration::v1::VersionUncheckedMigrateToV1, // balances are more tricky. We missed to do the migration to V1 and now we have inconsistent @@ -721,6 +717,8 @@ pub type Migrations = ( //then apply the proper migration as we should have done earlier pallet_balances::migration::MigrateToTrackInactive, cumulus_pallet_xcmp_queue::migration::v4::MigrationToV4, + // permanent + pallet_xcm::migration::MigrateToLatestXcmVersion, ); /// Executive: handles dispatch to the various modules. diff --git a/system-parachains/encointer/src/weights/pallet_balances.rs b/system-parachains/encointer/src/weights/pallet_balances.rs index 449621b5aa..c32d3f9d7d 100644 --- a/system-parachains/encointer/src/weights/pallet_balances.rs +++ b/system-parachains/encointer/src/weights/pallet_balances.rs @@ -1,25 +1,40 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . //! Autogenerated weights for `pallet_balances` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-12-19, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `caribe`, CPU: `12th Gen Intel(R) Core(TM) i7-1260P` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("encointer-rococo-local-dev"), DB CACHE: 1024 +//! HOSTNAME: `ggwpez-ref-hw`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("../asset-hub-kusama-chain-spec.json")`, DB CACHE: 1024 // Executed Command: -// target/release/encointer-collator +// ./target/production/polkadot // benchmark // pallet -// --chain=encointer-rococo-local-dev +// --chain=../asset-hub-kusama-chain-spec.json // --steps=50 // --repeat=20 // --pallet=pallet_balances // --extrinsic=* -// --execution=wasm // --wasm-execution=compiled // --heap-pages=4096 -// --output=polkadot-parachains/encointer-runtime/src/weights/pallet_balances.rs +// --output=./asset-hub-kusama-weights +// --header=./file_header.txt #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -32,104 +47,115 @@ use core::marker::PhantomData; /// Weight functions for `pallet_balances`. pub struct WeightInfo(PhantomData); impl pallet_balances::WeightInfo for WeightInfo { - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn transfer_allow_death() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 51_062_000 picoseconds. - Weight::from_parts(52_242_000, 0) + // Minimum execution time: 43_860_000 picoseconds. + Weight::from_parts(44_224_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn transfer_keep_alive() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 38_442_000 picoseconds. - Weight::from_parts(38_796_000, 0) + // Minimum execution time: 34_240_000 picoseconds. + Weight::from_parts(34_659_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn force_set_balance_creating() -> Weight { // Proof Size summary in bytes: - // Measured: `103` + // Measured: `174` // Estimated: `3593` - // Minimum execution time: 12_980_000 picoseconds. - Weight::from_parts(13_172_000, 0) + // Minimum execution time: 14_009_000 picoseconds. + Weight::from_parts(14_639_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn force_set_balance_killing() -> Weight { // Proof Size summary in bytes: - // Measured: `103` + // Measured: `174` // Estimated: `3593` - // Minimum execution time: 19_468_000 picoseconds. - Weight::from_parts(19_763_000, 0) + // Minimum execution time: 18_844_000 picoseconds. + Weight::from_parts(19_518_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } - /// Storage: System Account (r:2 w:2) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn force_transfer() -> Weight { // Proof Size summary in bytes: // Measured: `103` // Estimated: `6196` - // Minimum execution time: 51_765_000 picoseconds. - Weight::from_parts(52_610_000, 0) + // Minimum execution time: 46_279_000 picoseconds. + Weight::from_parts(47_441_000, 0) .saturating_add(Weight::from_parts(0, 6196)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn transfer_all() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 47_586_000 picoseconds. - Weight::from_parts(48_295_000, 0) + // Minimum execution time: 42_457_000 picoseconds. + Weight::from_parts(42_914_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn force_unreserve() -> Weight { // Proof Size summary in bytes: - // Measured: `103` + // Measured: `174` // Estimated: `3593` - // Minimum execution time: 15_891_000 picoseconds. - Weight::from_parts(16_204_000, 0) + // Minimum execution time: 16_297_000 picoseconds. + Weight::from_parts(16_925_000, 0) .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } - /// Storage: System Account (r:999 w:999) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + /// Storage: `System::Account` (r:999 w:999) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) /// The range of component `u` is `[1, 1000]`. fn upgrade_accounts(u: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `0 + u * (135 ±0)` + // Measured: `0 + u * (136 ±0)` // Estimated: `990 + u * (2603 ±0)` - // Minimum execution time: 15_647_000 picoseconds. - Weight::from_parts(15_952_000, 0) + // Minimum execution time: 15_740_000 picoseconds. + Weight::from_parts(15_870_000, 0) .saturating_add(Weight::from_parts(0, 990)) - // Standard Error: 99_031 - .saturating_add(Weight::from_parts(15_553_741, 0).saturating_mul(u.into())) + // Standard Error: 15_344 + .saturating_add(Weight::from_parts(13_532_274, 0).saturating_mul(u.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(u.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(u.into()))) .saturating_add(Weight::from_parts(0, 2603).saturating_mul(u.into())) } + /// Storage: `Balances::InactiveIssuance` (r:1 w:0) + /// Proof: `Balances::InactiveIssuance` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + fn force_adjust_total_issuance() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `1501` + // Minimum execution time: 5_208_000 picoseconds. + Weight::from_parts(5_619_000, 0) + .saturating_add(Weight::from_parts(0, 1501)) + .saturating_add(T::DbWeight::get().reads(1)) + } } diff --git a/system-parachains/encointer/src/xcm_config.rs b/system-parachains/encointer/src/xcm_config.rs index 4b796026b9..d0d5607f6b 100644 --- a/system-parachains/encointer/src/xcm_config.rs +++ b/system-parachains/encointer/src/xcm_config.rs @@ -20,37 +20,30 @@ use super::{ RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue, }; use frame_support::{ - match_types, parameter_types, + parameter_types, traits::{Everything, Nothing}, weights::Weight, }; +use frame_support::traits::{Contains}; use frame_system::EnsureRoot; use pallet_xcm::XcmPassthrough; -use parachains_common::xcm_config::ConcreteAssetFromSystem; +use parachains_common::xcm_config::{ConcreteAssetFromSystem, ParentRelayOrSiblingParachains}; use polkadot_parachain_primitives::primitives::Sibling; use sp_core::ConstU32; use xcm::latest::prelude::*; -use xcm_builder::{ - AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, - AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, DenyReserveTransferToRelayChain, - DenyThenTry, DescribeTerminus, EnsureXcmOrigin, FixedWeightBounds, FrameTransactionalProcessor, - FungibleAdapter, HashedDescription, IsConcrete, NativeAsset, ParentAsSuperuser, ParentIsPreset, - RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, - SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, - TrailingSetTopicAsId, UsingComponents, -}; +use xcm_builder::{AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, DenyReserveTransferToRelayChain, DenyThenTry, DescribeTerminus, EnsureXcmOrigin, FixedWeightBounds, FrameTransactionalProcessor, FungibleAdapter, HashedDescription, IsConcrete, NativeAsset, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId, UsingComponents, WithComputedOrigin}; use xcm_executor::XcmExecutor; parameter_types! { - pub const KsmLocation: MultiLocation = MultiLocation::parent(); + pub const KsmLocation: Location = Location::parent(); pub const RelayNetwork: NetworkId = NetworkId::Kusama; pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); - pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into(); + pub Ancestry: Location = Parachain(ParachainInfo::parachain_id().into()).into(); pub CheckingAccount: AccountId = PolkadotXcm::check_account(); - pub UniversalLocation: InteriorMultiLocation = - X2(GlobalConsensus(RelayNetwork::get()), Parachain(ParachainInfo::parachain_id().into())); + pub UniversalLocation: InteriorLocation = + [GlobalConsensus(RelayNetwork::get()), Parachain(ParachainInfo::parachain_id().into())].into(); } /// Type for specifying how a `Location` can be converted into an `AccountId`. This is used @@ -111,15 +104,11 @@ parameter_types! { pub const MaxInstructions: u32 = 100; } -match_types! { - pub type ParentOrParentsExecutivePlurality: impl Contains = { - MultiLocation { parents: 1, interior: Here } | - MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Executive, .. }) } - }; - pub type ParentOrSiblings: impl Contains = { - MultiLocation { parents: 1, interior: Here } | - MultiLocation { parents: 1, interior: X1(_) } - }; +pub struct ParentOrParentsPlurality; +impl Contains for ParentOrParentsPlurality { + fn contains(location: &Location) -> bool { + matches!(location.unpack(), (1, []) | (1, [Plurality { .. }])) + } } pub type Barrier = TrailingSetTopicAsId< @@ -127,16 +116,29 @@ pub type Barrier = TrailingSetTopicAsId< DenyReserveTransferToRelayChain, ( TakeWeightCredit, - AllowTopLevelPaidExecutionFrom, - // Parent and its exec plurality get free execution - AllowUnpaidExecutionFrom, // Expected responses are OK. AllowKnownQueryResponses, - // Subscriptions for version tracking are OK. - AllowSubscriptionsFrom, + // Allow XCMs with some computed origins to pass through. + WithComputedOrigin< + ( + // If the message is one that immediately attempts to pay for execution, then + // allow it. + AllowTopLevelPaidExecutionFrom, + // Parent, its pluralities (i.e. governance bodies), parent's treasury and + // sibling bridge hub get free execution. + AllowExplicitUnpaidExecutionFrom<( + ParentOrParentsPlurality, + )>, + // Subscriptions for version tracking are OK. + AllowSubscriptionsFrom, + ), + UniversalLocation, + ConstU32<8>, + >, ), >, >; + pub struct SafeCallFilter; impl frame_support::traits::Contains for SafeCallFilter { fn contains(_call: &RuntimeCall) -> bool { @@ -148,7 +150,7 @@ impl frame_support::traits::Contains for SafeCallFilter { parameter_types! { pub const MaxAssetsIntoHolding: u32 = 64; - pub const KsmRelayLocation: MultiLocation = MultiLocation::parent(); + pub const KsmRelayLocation: Location = Location::parent(); } /// Cases where a remote origin is accepted as trusted Teleporter for a given asset: @@ -201,7 +203,7 @@ pub type XcmRouter = ( #[cfg(feature = "runtime-benchmarks")] parameter_types! { - pub ReachableDest: Option = Some(Parent.into()); + pub ReachableDest: Option = Some(Parent.into()); } impl pallet_xcm::Config for Runtime {