diff --git a/CHANGELOG.md b/CHANGELOG.md index e88e80691e..c85b89f7a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Fixed - Handle extra erroneous consumer reference when a nomination pool is destroying ([polkadot-fellows/runtimes#318](https://github.com/polkadot-fellows/runtimes/pull/318)) +- Introduce [Encointer](https://encointer.org) collator selection and send fees to authors instead of treasury ([polkadot-fellows/runtimes#270](https://github.com/polkadot-fellows/runtimes/pull/270)) ## [1.2.4] 20.05.2024 @@ -69,8 +70,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Remove state-trie-migration pallet from kusama, add state trie migration to V1 on polkadot ([polkadot-fellows/runtimes#170](https://github.com/polkadot-fellows/runtimes/pull/170)) - Introduce chain spec generator ([polkadot-fellows/runtimes#127](https://github.com/polkadot-fellows/runtimes/pull/127)) -- Add [Encointer](https://encointer.org) system parachain runtime, completing [RFC22](https://github.com/polkadot-fellows/RFCs/blob/main/text/ -0022-adopt-encointer-runtime.md) ([polkadot-fellows/runtimes#80](https://github.com/polkadot-fellows/runtimes/pull/80)) +- Add [Encointer](https://encointer.org) system parachain runtime, completing [RFC22](https://github.com/polkadot-fellows/RFCs/blob/main/text/0022-adopt-encointer-runtime.md) ([polkadot-fellows/runtimes#80](https://github.com/polkadot-fellows/runtimes/pull/80)) - Feature for enabling debug prints in the Polkadot and Kusama runtime ([polkadot-fellows/runtimes#85](https://github.com/polkadot-fellows/runtimes/pull/85)) - Added new "Wish for Change" track ([polkadot-fellows/runtimes#184](https://github.com/polkadot-fellows/runtimes/pull/184)) - Enable Coretime and on-demand on Kusama ([polkadot-fellows/runtimes#159](https://github.com/polkadot-fellows/runtimes/pull/159)) diff --git a/Cargo.lock b/Cargo.lock index fecbd67910..f9a124c27a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3551,6 +3551,7 @@ version = "1.0.0" dependencies = [ "cumulus-pallet-aura-ext", "cumulus-pallet-parachain-system", + "cumulus-pallet-session-benchmarking", "cumulus-pallet-xcm", "cumulus-pallet-xcmp-queue", "cumulus-primitives-aura", @@ -3571,7 +3572,9 @@ dependencies = [ "log", "pallet-asset-tx-payment", "pallet-aura", + "pallet-authorship", "pallet-balances", + "pallet-collator-selection", "pallet-collective", "pallet-encointer-balances", "pallet-encointer-bazaar", @@ -3588,10 +3591,10 @@ dependencies = [ "pallet-message-queue", "pallet-proxy", "pallet-scheduler", + "pallet-session", "pallet-timestamp", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", - "pallet-treasury", "pallet-utility", "pallet-xcm", "parachains-common", @@ -7557,9 +7560,9 @@ dependencies = [ [[package]] name = "pallet-encointer-faucet" -version = "6.1.0" +version = "6.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef912a2cdd0f586054d5df1078037ef324fd64515671d6630cfbd1787c4ebe2a" +checksum = "3024bc49c1fd7fffa68f4aa636b199c7a0772690049d0471a6b60d17080024d8" dependencies = [ "approx", "encointer-primitives", @@ -7569,7 +7572,6 @@ dependencies = [ "log", "pallet-encointer-communities", "pallet-encointer-reputation-commitments", - "pallet-treasury", "parity-scale-codec", "scale-info", "sp-core", diff --git a/Cargo.toml b/Cargo.toml index 931205d088..feaa1e5d57 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -111,7 +111,7 @@ pallet-encointer-ceremonies = { version = "~6.1.0", default-features = false } pallet-encointer-ceremonies-rpc-runtime-api = { version = "~6.1.0", default-features = false } pallet-encointer-communities = { version = "~6.1.0", default-features = false } pallet-encointer-communities-rpc-runtime-api = { version = "~6.1.0", default-features = false } -pallet-encointer-faucet = { version = "~6.1.0", default-features = false } +pallet-encointer-faucet = { version = "~6.2.0", default-features = false } pallet-encointer-reputation-commitments = { version = "~6.1.0", default-features = false } pallet-encointer-scheduler = { version = "~6.1.0", default-features = false } pallet-fast-unstake = { version = "28.0.0", default-features = false } diff --git a/chain-spec-generator/src/system_parachains_specs.rs b/chain-spec-generator/src/system_parachains_specs.rs index 3c2f0c40d2..965b56f9de 100644 --- a/chain-spec-generator/src/system_parachains_specs.rs +++ b/chain-spec-generator/src/system_parachains_specs.rs @@ -562,6 +562,23 @@ fn encointer_kusama_genesis(endowed_accounts: Vec, id: u32) -> serde_ parachain_id: id.into(), ..Default::default() }, + "collatorSelection": encointer_kusama_runtime::CollatorSelectionConfig { + invulnerables: invulnerables().iter().cloned().map(|(acc, _)| acc).collect(), + candidacy_bond: ENCOINTER_KUSAMA_ED * 16, + ..Default::default() + }, + "session": asset_hub_kusama_runtime::SessionConfig { + keys: invulnerables() + .into_iter() + .map(|(acc, aura)| { + ( + acc.clone(), // account id + acc, // validator id + asset_hub_kusama_session_keys(aura), // session keys + ) + }) + .collect(), + }, "polkadotXcm": { "safeXcmVersion": Some(SAFE_XCM_VERSION), }, diff --git a/system-parachains/encointer/Cargo.toml b/system-parachains/encointer/Cargo.toml index a36eba2f53..2bbe1e188d 100644 --- a/system-parachains/encointer/Cargo.toml +++ b/system-parachains/encointer/Cargo.toml @@ -10,7 +10,7 @@ version.workspace = true [dependencies] codec = { features = ["derive"], workspace = true } -hex-literal = { optional = true, workspace = true } +hex-literal = { workspace = true } log = { workspace = true } scale-info = { features = ["derive"], workspace = true } smallvec = { workspace = true } @@ -50,6 +50,7 @@ frame-system-rpc-runtime-api = { workspace = true } frame-try-runtime = { optional = true, workspace = true } pallet-asset-tx-payment = { workspace = true } pallet-aura = { features = ["experimental"], workspace = true } +pallet-authorship = { workspace = true } pallet-balances = { workspace = true } pallet-collective = { workspace = true } pallet-insecure-randomness-collective-flip = { workspace = true } @@ -57,15 +58,16 @@ pallet-membership = { workspace = true } pallet-message-queue = { workspace = true } pallet-proxy = { workspace = true } pallet-scheduler = { workspace = true } +pallet-session = { workspace = true } pallet-timestamp = { workspace = true } pallet-transaction-payment = { workspace = true } pallet-transaction-payment-rpc-runtime-api = { workspace = true } -pallet-treasury = { workspace = true } pallet-utility = { workspace = true } sp-api = { workspace = true } sp-block-builder = { workspace = true } sp-consensus-aura = { workspace = true } sp-core = { workspace = true } +sp-genesis-builder = { workspace = true } sp-inherents = { workspace = true } sp-offchain = { workspace = true } sp-runtime = { workspace = true } @@ -73,7 +75,6 @@ sp-session = { workspace = true } sp-std = { workspace = true } sp-transaction-pool = { workspace = true } sp-version = { workspace = true } -sp-genesis-builder = { workspace = true } # Polkadot dependencies pallet-xcm = { workspace = true } @@ -88,11 +89,13 @@ cumulus-pallet-aura-ext = { workspace = true } cumulus-pallet-parachain-system = { features = [ "parameterized-consensus-hook", ], workspace = true } +cumulus-pallet-session-benchmarking = { optional = true, workspace = true } cumulus-pallet-xcm = { workspace = true } cumulus-pallet-xcmp-queue = { workspace = true } cumulus-primitives-aura = { workspace = true } cumulus-primitives-core = { workspace = true } cumulus-primitives-utility = { workspace = true } +pallet-collator-selection = { workspace = true } parachain-info = { workspace = true } parachains-common = { workspace = true } polkadot-core-primitives = { workspace = true } @@ -113,6 +116,7 @@ system-parachains-constants = { workspace = true, default-features = true } default = ["std"] 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", @@ -122,9 +126,9 @@ runtime-benchmarks = [ "frame-support/runtime-benchmarks", "frame-system-benchmarking/runtime-benchmarks", "frame-system/runtime-benchmarks", - "hex-literal", "pallet-asset-tx-payment/runtime-benchmarks", "pallet-balances/runtime-benchmarks", + "pallet-collator-selection/runtime-benchmarks", "pallet-collective/runtime-benchmarks", "pallet-encointer-balances/runtime-benchmarks", "pallet-encointer-bazaar/runtime-benchmarks", @@ -138,7 +142,6 @@ runtime-benchmarks = [ "pallet-proxy/runtime-benchmarks", "pallet-scheduler/runtime-benchmarks", "pallet-timestamp/runtime-benchmarks", - "pallet-treasury/runtime-benchmarks", "pallet-utility/runtime-benchmarks", "pallet-xcm/runtime-benchmarks", "parachains-common/runtime-benchmarks", @@ -153,6 +156,7 @@ std = [ "codec/std", "cumulus-pallet-aura-ext/std", "cumulus-pallet-parachain-system/std", + "cumulus-pallet-session-benchmarking?/std", "cumulus-pallet-xcm/std", "cumulus-pallet-xcmp-queue/std", "cumulus-primitives-aura/std", @@ -172,7 +176,9 @@ std = [ "log/std", "pallet-asset-tx-payment/std", "pallet-aura/std", + "pallet-authorship/std", "pallet-balances/std", + "pallet-collator-selection/std", "pallet-collective/std", "pallet-encointer-balances/std", "pallet-encointer-bazaar-rpc-runtime-api/std", @@ -189,10 +195,10 @@ std = [ "pallet-message-queue/std", "pallet-proxy/std", "pallet-scheduler/std", + "pallet-session/std", "pallet-timestamp/std", "pallet-transaction-payment-rpc-runtime-api/std", "pallet-transaction-payment/std", - "pallet-treasury/std", "pallet-utility/std", "pallet-xcm/std", "parachain-info/std", @@ -234,7 +240,9 @@ try-runtime = [ "frame-try-runtime/try-runtime", "pallet-asset-tx-payment/try-runtime", "pallet-aura/try-runtime", + "pallet-authorship/try-runtime", "pallet-balances/try-runtime", + "pallet-collator-selection/try-runtime", "pallet-collective/try-runtime", "pallet-encointer-balances/try-runtime", "pallet-encointer-bazaar/try-runtime", @@ -248,9 +256,9 @@ try-runtime = [ "pallet-message-queue/try-runtime", "pallet-proxy/try-runtime", "pallet-scheduler/try-runtime", + "pallet-session/try-runtime", "pallet-timestamp/try-runtime", "pallet-transaction-payment/try-runtime", - "pallet-treasury/try-runtime", "pallet-utility/try-runtime", "pallet-xcm/try-runtime", "parachain-info/try-runtime", diff --git a/system-parachains/encointer/src/deal_with_fees.rs b/system-parachains/encointer/src/deal_with_fees.rs deleted file mode 100644 index 3abe942713..0000000000 --- a/system-parachains/encointer/src/deal_with_fees.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) 2023 Encointer Association -// This file is part of Encointer -// -// Encointer 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. -// -// Encointer 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 Encointer. If not, see . - -use frame_support::traits::{Currency, Imbalance, OnUnbalanced}; -use sp_runtime::sp_std::marker::PhantomData; - -/// Type alias to conveniently refer to the `Currency::NegativeImbalance` associated type. -pub type NegativeImbalance = as Currency< - ::AccountId, ->>::NegativeImbalance; - -/// Moves all the fees to the treasury. -/// -/// This does only handle the native currency. The community currencies are managed by the -/// `pallet-asset-tx-payment`. -pub struct FeesToTreasury(PhantomData); - -impl OnUnbalanced> for FeesToTreasury -where - Runtime: pallet_balances::Config + pallet_treasury::Config, -{ - fn on_unbalanceds(mut fees_then_tips: impl Iterator>) { - if let Some(mut fees) = fees_then_tips.next() { - // no burning, add all fees and tips to the treasury - - if let Some(tips) = fees_then_tips.next() { - tips.merge_into(&mut fees); - } - as OnUnbalanced<_>>::on_unbalanced(fees); - } - } -} diff --git a/system-parachains/encointer/src/lib.rs b/system-parachains/encointer/src/lib.rs index a5aee56894..ad12dc9882 100644 --- a/system-parachains/encointer/src/lib.rs +++ b/system-parachains/encointer/src/lib.rs @@ -31,15 +31,17 @@ #[cfg(feature = "std")] include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); -mod deal_with_fees; mod migrations_fix; mod weights; pub mod xcm_config; + use codec::{Decode, Encode, MaxEncodedLen}; +use core::marker::PhantomData; use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases; use cumulus_primitives_core::{AggregateMessageOrigin, ParaId}; -use deal_with_fees::FeesToTreasury; -use encointer_balances_tx_payment::{AssetBalanceOf, AssetIdOf, BalanceToCommunityBalance}; +use encointer_balances_tx_payment::{ + AccountIdOf, AssetBalanceOf, AssetIdOf, BalanceToCommunityBalance, +}; pub use encointer_primitives::{ balances::{BalanceEntry, BalanceType, Demurrage}, bazaar::{BusinessData, BusinessIdentifier, OfferingData}, @@ -48,17 +50,16 @@ pub use encointer_primitives::{ communities::{CommunityIdentifier, Location}, scheduler::CeremonyPhaseType, }; -use frame_support::traits::TransformOrigin; -use parachains_common::message_queue::{NarrowOriginToSibling, ParaIdToSibling}; - use frame_support::{ construct_runtime, dispatch::DispatchClass, genesis_builder_helper::{build_config, create_default_config}, parameter_types, traits::{ - tokens::{pay::PayFromAccount, ConversionFromAssetBalance, ConversionToAssetBalance}, + fungibles::{Balanced, Credit}, + tokens::ConversionToAssetBalance, ConstBool, ConstU64, Contains, EitherOfDiverse, EqualPrivilegeOnly, InstanceFilter, + TransformOrigin, }, weights::{ConstantMultiplier, Weight}, PalletId, @@ -67,6 +68,7 @@ use frame_system::{ limits::{BlockLength, BlockWeights}, EnsureRoot, }; +use pallet_asset_tx_payment::HandleCredit; pub use pallet_encointer_balances::Call as EncointerBalancesCall; pub use pallet_encointer_bazaar::Call as EncointerBazaarCall; pub use pallet_encointer_ceremonies::Call as EncointerCeremoniesCall; @@ -75,6 +77,7 @@ pub use pallet_encointer_faucet::Call as EncointerFaucetCall; pub use pallet_encointer_reputation_commitments::Call as EncointerReputationCommitmentsCall; pub use pallet_encointer_scheduler::Call as EncointerSchedulerCall; use pallet_xcm::{EnsureXcm, IsMajorityOfBody}; +use parachains_common::message_queue::{NarrowOriginToSibling, ParaIdToSibling}; pub use parachains_common::{ impls::DealWithFees, AccountId, AssetIdForTrustBackedAssets, AuraId, Balance, BlockNumber, Hash, Header, Nonce, Signature, @@ -86,9 +89,9 @@ use sp_core::{crypto::KeyTypeId, ConstU32, OpaqueMetadata}; pub use sp_runtime::BuildStorage; use sp_runtime::{ create_runtime_str, generic, impl_opaque_keys, - traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, IdentityLookup, Verify}, + traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, Verify}, transaction_validity::{TransactionSource, TransactionValidity}, - ApplyExtrinsicResult, Perbill, Permill, RuntimeDebug, + ApplyExtrinsicResult, Perbill, RuntimeDebug, }; use sp_std::prelude::*; #[cfg(feature = "std")] @@ -172,6 +175,7 @@ impl Default for ProxyType { Self::Any } } + impl InstanceFilter for ProxyType { fn filter(&self, c: &RuntimeCall) -> bool { match self { @@ -239,6 +243,7 @@ parameter_types! { } pub struct BaseFilter; + impl Contains for BaseFilter { fn contains(_c: &RuntimeCall) -> bool { true @@ -318,67 +323,14 @@ parameter_types! { impl pallet_transaction_payment::Config for Runtime { type RuntimeEvent = RuntimeEvent; - // `FeesToTreasury is an encointer adaptation. type OnChargeTransaction = - pallet_transaction_payment::CurrencyAdapter>; + pallet_transaction_payment::CurrencyAdapter>; type WeightToFee = WeightToFee; type LengthToFee = ConstantMultiplier; type FeeMultiplierUpdate = SlowAdjustingFeeUpdate; type OperationalFeeMultiplier = OperationalFeeMultiplier; } -pub const ENCOINTER_TREASURY_PALLET_ID: u8 = 43; - -parameter_types! { - pub const ProposalBond: Permill = Permill::from_percent(5); - pub const ProposalBondMinimum: Balance = 100 * MILLICENTS; - pub const ProposalBondMaximum: Balance = 500 * CENTS; - pub const SpendPeriod: BlockNumber = 6 * DAYS; - pub const Burn: Permill = Permill::from_percent(1); - pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry"); - pub const PayoutSpendPeriod: BlockNumber = 30 * DAYS; - pub const MaxApprovals: u32 = 10; - pub TreasuryAccount: AccountId = Treasury::account_id(); -} - -pub struct NoConversion; -impl ConversionFromAssetBalance for NoConversion { - type Error = (); - fn from_asset_balance(balance: Balance, _asset_id: ()) -> Result { - Ok(balance) - } - #[cfg(feature = "runtime-benchmarks")] - fn ensure_successful(_: ()) {} -} - -impl pallet_treasury::Config for Runtime { - type PalletId = TreasuryPalletId; - type Currency = pallet_balances::Pallet; - type ApproveOrigin = MoreThanHalfCouncil; - type RejectOrigin = MoreThanHalfCouncil; - type RuntimeEvent = RuntimeEvent; - type OnSlash = (); //No proposal - type ProposalBond = ProposalBond; - type ProposalBondMinimum = ProposalBondMinimum; - type ProposalBondMaximum = ProposalBondMaximum; - type SpendPeriod = SpendPeriod; //Cannot be 0: Error: Thread 'tokio-runtime-worker' panicked at 'attempt to calculate the - // remainder with a divisor of zero - type Burn = (); //No burn - type BurnDestination = (); //No burn - type SpendFunds = (); //No spend, no bounty - type MaxApprovals = MaxApprovals; - type WeightInfo = weights::pallet_treasury::WeightInfo; - type SpendOrigin = frame_support::traits::NeverEnsureOrigin; //No spend, no bounty - type AssetKind = (); - type Beneficiary = AccountId; - type BeneficiaryLookup = IdentityLookup; - type Paymaster = PayFromAccount; - type BalanceConverter = NoConversion; - type PayoutPeriod = PayoutSpendPeriod; - #[cfg(feature = "runtime-benchmarks")] - type BenchmarkHelper = (); -} - impl pallet_utility::Config for Runtime { type RuntimeEvent = RuntimeEvent; type RuntimeCall = RuntimeCall; @@ -590,6 +542,7 @@ type MoreThanHalfCouncil = EitherOfDiverse< >; pub type CouncilCollective = pallet_collective::Instance1; + impl pallet_collective::Config for Runtime { type RuntimeOrigin = RuntimeOrigin; type Proposal = RuntimeCall; @@ -617,16 +570,92 @@ impl pallet_membership::Config for Runtime { type WeightInfo = weights::pallet_membership::WeightInfo; } +/// A `HandleCredit` implementation that naively transfers the fees to the block author. +/// Will drop and burn the assets in case the transfer fails. +pub struct AssetsToBlockAuthor(PhantomData); + +impl HandleCredit, pallet_encointer_balances::Pallet> + for AssetsToBlockAuthor +where + R: pallet_authorship::Config + pallet_encointer_balances::Config, + AccountIdOf: From + + Into + + From<[u8; 32]>, +{ + fn handle_credit(credit: Credit, pallet_encointer_balances::Pallet>) { + if let Some(author) = pallet_authorship::Pallet::::author() { + // This only affects fees paid in CC! + + // We will only grant 50% of CC fees to the current block author + // reasoning: If you send 100% to the author, then the author can attempt to increase + // the fee rate by making transactions up to the block limit at zero cost + // (since they pocket the fees). + // In the future, fees might be collected in community treasuries instead of being + // "burned" to dead account 0x00 = 5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUpnhM + // See: https://forum.polkadot.network/t/towards-encointer-self-sustainability/4195 + + let half_amount = credit.peek() / 2; + let community_pot = AccountIdOf::::from([0u8; 32]); + + let (author_credit, community_credit) = credit.split(half_amount); + // In case of error: Will drop the result triggering the `OnDrop` of the imbalance. + let _ = pallet_encointer_balances::Pallet::::resolve(&author, author_credit); + let _ = + pallet_encointer_balances::Pallet::::resolve(&community_pot, community_credit); + } + } +} + // Allow fee payment in community currency impl pallet_asset_tx_payment::Config for Runtime { type RuntimeEvent = RuntimeEvent; type Fungibles = pallet_encointer_balances::Pallet; type OnChargeAssetTransaction = pallet_asset_tx_payment::FungiblesAdapter< encointer_balances_tx_payment::BalanceToCommunityBalance, - encointer_balances_tx_payment::BurnCredit, + AssetsToBlockAuthor, >; } +impl pallet_authorship::Config for Runtime { + type FindAuthor = pallet_session::FindAccountFromAuthorIndex; + type EventHandler = (CollatorSelection,); +} + +impl pallet_session::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type ValidatorId = ::AccountId; + // we don't have stash and controller, thus we don't need the convert as well. + type ValidatorIdOf = pallet_collator_selection::IdentityCollator; + type ShouldEndSession = pallet_session::PeriodicSessions; + type NextSessionRotation = pallet_session::PeriodicSessions; + type SessionManager = CollatorSelection; + // Essentially just Aura, but let's be pedantic. + type SessionHandler = ::KeyTypeIdProviders; + type Keys = SessionKeys; + type WeightInfo = weights::pallet_session::WeightInfo; +} + +parameter_types! { + pub const PotId: PalletId = PalletId(*b"PotStake"); + pub const SessionLength: BlockNumber = 6 * HOURS; +} + +impl pallet_collator_selection::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type Currency = Balances; + type UpdateOrigin = MoreThanHalfCouncil; + type PotId = PotId; + type MaxCandidates = ConstU32<100>; + type MinEligibleCollators = ConstU32<4>; + type MaxInvulnerables = ConstU32<20>; + // should be a multiple of session or things will get inconsistent + type KickThreshold = Period; + type ValidatorId = ::AccountId; + type ValidatorIdOf = pallet_collator_selection::IdentityCollator; + type ValidatorRegistration = Session; + type WeightInfo = weights::pallet_collator_selection::WeightInfo; +} + construct_runtime! { pub enum Runtime { // System support stuff. @@ -641,6 +670,10 @@ construct_runtime! { TransactionPayment: pallet_transaction_payment = 11, AssetTxPayment: pallet_asset_tx_payment = 12, + // Collator support. the order of these 5 are important and shall not change. + Authorship: pallet_authorship = 20, + CollatorSelection: pallet_collator_selection = 21, + Session: pallet_session = 22, Aura: pallet_aura = 23, AuraExt: cumulus_pallet_aura_ext = 24, @@ -653,7 +686,6 @@ construct_runtime! { // Handy utilities. Utility: pallet_utility = 40, - Treasury: pallet_treasury = 43, Proxy: pallet_proxy = 44, Scheduler: pallet_scheduler = 48, @@ -703,14 +735,7 @@ parameter_types! { /// Migrations to apply on runtime upgrade. pub type Migrations = ( frame_support::migrations::RemovePallet, - // balances are more tricky. We missed to do the migration to V1 and now we have inconsistent - // state which can't be decoded to V0, yet the StorageVersion is V0. - // the strategy is to: just pretend we're on V1 - migrations_fix::balances::v1::BruteForceToV1, - // then reset to V0 - pallet_balances::migration::ResetInactive, - //then apply the proper migration as we should have done earlier - pallet_balances::migration::MigrateToTrackInactive, + migrations_fix::collator_selection_init::v0::InitInvulnerables, // permanent pallet_xcm::migration::MigrateToLatestXcmVersion, ); @@ -733,9 +758,9 @@ mod benches { [pallet_collective, Collective] [pallet_message_queue, MessageQueue] [pallet_membership, Membership] + [pallet_session, SessionBench::] + [pallet_collator_selection, CollatorSelection] [pallet_timestamp, Timestamp] - // todo: treasury will be removed in separate PR, so no need to fix broken benchmarks: https://github.com/polkadot-fellows/runtimes/issues/176 - //[pallet_treasury, Treasury] [pallet_utility, Utility] [pallet_proxy, Proxy] [pallet_encointer_balances, EncointerBalances] @@ -968,6 +993,7 @@ impl_runtime_apis! { use frame_benchmarking::{Benchmarking, BenchmarkList}; use frame_support::traits::StorageInfoTrait; use frame_system_benchmarking::Pallet as SystemBench; + use cumulus_pallet_session_benchmarking::Pallet as SessionBench; let mut list = Vec::::new(); list_benchmarks!(list, extra); @@ -981,7 +1007,8 @@ impl_runtime_apis! { ) -> Result, sp_runtime::RuntimeString> { use frame_benchmarking::{Benchmarking, BenchmarkBatch, BenchmarkError}; use frame_support::traits::TrackedStorageKey; - + use cumulus_pallet_session_benchmarking::Pallet as SessionBench; + impl cumulus_pallet_session_benchmarking::Config for Runtime {} use frame_system_benchmarking::Pallet as SystemBench; impl frame_system_benchmarking::Config for Runtime { fn setup_set_code_requirements(code: &sp_std::vec::Vec) -> Result<(), BenchmarkError> { @@ -1005,8 +1032,6 @@ impl_runtime_apis! { hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(), // System Events hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(), - // Treasury Account - hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da95ecffd7b6c0f78751baa9d281e0bfa3a6d6f646c70792f74727372790000000000000000000000000000000000000000").to_vec().into(), ]; let mut batches = Vec::::new(); @@ -1043,17 +1068,6 @@ pub fn aura_config_for_chain_spec(seeds: &[&str]) -> AuraConfig { } } -#[cfg(test)] -mod multiplier_tests { - use super::*; - use frame_support::pallet_prelude::PalletInfoAccess; - - #[test] - fn treasury_pallet_index_is_correct() { - assert_eq!(ENCOINTER_TREASURY_PALLET_ID, ::index() as u8); - } -} - #[test] fn test_ed_is_one_tenth_of_relay() { let relay_ed = kusama_runtime_constants::currency::EXISTENTIAL_DEPOSIT; diff --git a/system-parachains/encointer/src/migrations_fix.rs b/system-parachains/encointer/src/migrations_fix.rs index f5992de5a1..472fbd5852 100644 --- a/system-parachains/encointer/src/migrations_fix.rs +++ b/system-parachains/encointer/src/migrations_fix.rs @@ -17,174 +17,153 @@ // the following are temporary local migration fixes to solve inconsistencies caused by not // migrating Storage at the time of migrating runtime code -pub mod balances { +pub mod collator_selection_init { use frame_support::traits::OnRuntimeUpgrade; - use pallet_balances::*; #[cfg(feature = "try-runtime")] use sp_runtime::TryRuntimeError; /// The log target. - const TARGET: &str = "runtime::fix::balances::migration"; - pub mod v1 { + const TARGET: &str = "runtime::fix::collator_selection_init"; + pub mod v0 { use super::*; - use frame_support::pallet_prelude::*; - pub struct BruteForceToV1(sp_std::marker::PhantomData); - - impl OnRuntimeUpgrade for BruteForceToV1 { + use crate::SessionKeys; + use codec::EncodeLike; + use frame_support::{pallet_prelude::*, traits::Currency}; + use hex_literal::hex; + use log::info; + use parachains_common::impls::BalanceOf; + use sp_core::{crypto::key_types::AURA, sr25519}; + use sp_std::{vec, vec::Vec}; + + const INVULNERABLE_AURA_A: [u8; 32] = + hex!("5e962096da68302d5c47fce0178d72fab503c4f00a3f1df64856748f0d9dd51e"); + const INVULNERABLE_AURA_B: [u8; 32] = + hex!("0cecb8d1c2c744ca4c5cea57f5d6c40238f4dad17afa213672b8b7d43b80a659"); + const INVULNERABLE_AURA_C: [u8; 32] = + hex!("ca1951a3c4e100fb5a899e7bae3ea124491930a72000c5e4b2775fea27ecf05d"); + const INVULNERABLE_AURA_D: [u8; 32] = + hex!("484b443bd95068b860c92b0f66487b78f58234eca0f88e2adbe80bae4807b809"); + const INVULNERABLE_AURA_E: [u8; 32] = + hex!("6c642fb4b571a5685a869cd291fafd575be47a918b231ba28165e5c0cd0cfa15"); + + const INVULNERABLE_ACCOUNT_A: [u8; 32] = + hex!("920534bf448645557bae98bc7f681bd3ebed13d39bee28e10b193d4073357572"); + const INVULNERABLE_ACCOUNT_B: [u8; 32] = + hex!("76bff5abc7a4fce647fab172c9f016af8f5b5f8c3da56a92b619bbc02989fb71"); + const INVULNERABLE_ACCOUNT_C: [u8; 32] = + hex!("c0e021ab805fa956f29661c4380377e5296c5fa5fc16be26ffd516675a66bf6d"); + const INVULNERABLE_ACCOUNT_D: [u8; 32] = + hex!("9c17e9b360d9ca3cf8e42ce015ab649281d42484e7240020a12f5b16acc0d718"); + const INVULNERABLE_ACCOUNT_E: [u8; 32] = + hex!("2c3b7e77d0a8db2e3389669c4bc8112c34d5d1619cf20edc79c12c57a75f8c19"); + + pub struct InitInvulnerables(sp_std::marker::PhantomData); + impl OnRuntimeUpgrade for InitInvulnerables + where + T: frame_system::Config + + pallet_collator_selection::Config + + pallet_session::Config + + pallet_balances::Config, + ::AccountId: From<[u8; 32]>, + ::ValidatorId: From<[u8; 32]>, + ::Keys: From, + ::Balance: From, + ::Balance: EncodeLike< + <::Currency as Currency< + ::AccountId, + >>::Balance, + >, + { #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result, TryRuntimeError> { - Ok(().encode()) + let invulnerables_len = pallet_collator_selection::Invulnerables::::get().len(); + Ok((invulnerables_len as u32).encode()) } fn on_runtime_upgrade() -> Weight { - let onchain_version = Pallet::::on_chain_storage_version(); - if onchain_version >= 1 { - log::warn!( - target: TARGET, - "skipping bruteforce to v1 migration: executed on wrong storage version." + let invulnerables_len = pallet_collator_selection::Invulnerables::::get().len(); + if invulnerables_len > 0 { + info!(target: TARGET, "no need to initialize invulnerables"); + return T::DbWeight::get().reads_writes(1, 0) + } + info!(target: TARGET, "initializing the set of invulnerables"); + + let raw_aura_keys: Vec<[u8; 32]> = vec![ + INVULNERABLE_AURA_A, + INVULNERABLE_AURA_B, + INVULNERABLE_AURA_C, + INVULNERABLE_AURA_D, + INVULNERABLE_AURA_E, + ]; + let raw_account_keys: Vec<[u8; 32]> = vec![ + INVULNERABLE_ACCOUNT_A, + INVULNERABLE_ACCOUNT_B, + INVULNERABLE_ACCOUNT_C, + INVULNERABLE_ACCOUNT_D, + INVULNERABLE_ACCOUNT_E, + ]; + + let validatorids: Vec<::ValidatorId> = + raw_account_keys.iter().map(|&pk| pk.into()).collect(); + + pallet_session::Validators::::put(validatorids); + + let queued_keys: Vec<( + ::ValidatorId, + ::Keys, + )> = raw_account_keys + .iter() + .zip(raw_aura_keys.iter()) + .map(|(&account, &aura)| { + ( + account.into(), + SessionKeys { aura: sr25519::Public::from_raw(aura).into() }.into(), + ) + }) + .collect(); + + pallet_session::QueuedKeys::::put(queued_keys); + + for (&account, &aura) in raw_account_keys.iter().zip(raw_aura_keys.iter()) { + pallet_session::NextKeys::::insert::< + ::ValidatorId, + ::Keys, + >( + account.into(), + SessionKeys { aura: sr25519::Public::from_raw(aura).into() }.into(), ); - return T::DbWeight::get().reads(1) + pallet_session::KeyOwner::::insert::< + _, + ::ValidatorId, + >((AURA, aura.encode()), account.into()); } - log::info!(target: TARGET, "bruteforcing from {:?} to 1", onchain_version); - StorageVersion::new(1).put::>(); - - T::DbWeight::get().reads_writes(1, 1) - } - - #[cfg(feature = "try-runtime")] - fn post_upgrade(_state: sp_std::vec::Vec) -> Result<(), TryRuntimeError> { - ensure!(StorageVersion::get::>() == 1, "Must upgrade"); - Ok(()) - } - } - } -} -pub mod scheduler { - // this is necessary because migrations from v0 to v3 are no longer available in the scheduler - // pallet code and migrating is only possible from v3. The strategy here is to empty the agenda - // (has been empty since genesis) - use frame_support::traits::OnRuntimeUpgrade; - use frame_system::pallet_prelude::BlockNumberFor; - use pallet_scheduler::*; - use sp_std::vec::Vec; - - #[cfg(feature = "try-runtime")] - use sp_runtime::TryRuntimeError; - /// The log target. - const TARGET: &str = "runtime::fix::scheduler::migration"; + let mut invulnerables: Vec<::AccountId> = + raw_account_keys.iter().map(|&pk| pk.into()).collect(); + invulnerables.sort(); + let invulnerables: BoundedVec<_, T::MaxInvulnerables> = + invulnerables.try_into().unwrap(); + pallet_collator_selection::Invulnerables::::put(invulnerables); - pub mod v1 { - use super::*; - use frame_support::{pallet_prelude::*, traits::schedule}; - - #[cfg_attr(any(feature = "std", test), derive(PartialEq, Eq))] - #[derive(Clone, RuntimeDebug, Encode, Decode)] - pub(crate) struct ScheduledV1 { - maybe_id: Option>, - priority: schedule::Priority, - call: Call, - maybe_periodic: Option>, - } + pallet_collator_selection::CandidacyBond::::put::>( + 5_000_000_000_000u128.into(), + ); - #[frame_support::storage_alias] - pub(crate) type Agenda = StorageMap< - Pallet, - Twox64Concat, - BlockNumberFor, - Vec::RuntimeCall, BlockNumberFor>>>, - ValueQuery, - >; - - #[frame_support::storage_alias] - pub(crate) type Lookup = - StorageMap, Twox64Concat, Vec, TaskAddress>>; - } - - pub mod v3 { - use super::*; - use frame_support::pallet_prelude::*; - - #[frame_support::storage_alias] - pub(crate) type Agenda = StorageMap< - Pallet, - Twox64Concat, - BlockNumberFor, - Vec>>, - ValueQuery, - >; - - #[frame_support::storage_alias] - pub(crate) type Lookup = - StorageMap, Twox64Concat, Vec, TaskAddress>>; - } - - pub mod v4 { - use super::*; - use frame_support::pallet_prelude::*; - - #[frame_support::storage_alias] - pub type Agenda = StorageMap< - Pallet, - Twox64Concat, - BlockNumberFor, - BoundedVec< - Option>, - ::MaxScheduledPerBlock, - >, - ValueQuery, - >; - - #[cfg(feature = "try-runtime")] - pub(crate) type TaskName = [u8; 32]; - - #[cfg(feature = "try-runtime")] - #[frame_support::storage_alias] - pub(crate) type Lookup = - StorageMap, Twox64Concat, TaskName, TaskAddress>>; - - /// Migrate the scheduler pallet from V0 to V4 by brute-force emptying the agenda. - #[allow(dead_code)] - pub struct MigrateToV4(sp_std::marker::PhantomData); - - impl OnRuntimeUpgrade for MigrateToV4 { - #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result, TryRuntimeError> { - let agendas = v1::Agenda::::iter_keys().count() as u32; - let lookups = v1::Lookup::::iter_keys().count() as u32; - log::info!(target: TARGET, "agendas present which will be dropped: {}/{}...", agendas, lookups); - Ok((agendas, lookups).encode()) - } - - fn on_runtime_upgrade() -> Weight { - let onchain_version = Pallet::::on_chain_storage_version(); - if onchain_version >= 3 { - log::warn!( - target: TARGET, - "skipping v0 to v4 migration: executed on wrong storage version.\ - Expected version < 3, found {:?}", - onchain_version, - ); - return T::DbWeight::get().reads(1) - } - log::info!(target: TARGET, "migrating from {:?} to 4", onchain_version); - let purged_agendas = v1::Agenda::::clear(u32::MAX, None).unique as u64; - let purged_lookups = v1::Lookup::::clear(u32::MAX, None).unique as u64; - StorageVersion::new(4).put::>(); - - T::DbWeight::get() - .reads_writes(purged_agendas + purged_lookups, purged_agendas + purged_lookups) + T::DbWeight::get().reads_writes(0, 4 + 5 * 2) } #[cfg(feature = "try-runtime")] - fn post_upgrade(_state: Vec) -> Result<(), TryRuntimeError> { - ensure!(StorageVersion::get::>() == 4, "Must upgrade"); - - let agendas = Agenda::::iter_keys().count() as u32; - ensure!(agendas == 0, "agenda must be empty after now"); - let lookups = Lookup::::iter_keys().count() as u32; - ensure!(lookups == 0, "agenda must be empty after now"); - + fn post_upgrade(state: sp_std::vec::Vec) -> Result<(), TryRuntimeError> { + let invulnerables_len = + pallet_collator_selection::Invulnerables::::get().len() as u32; + let apriori_invulnerables_len: u32 = Decode::decode(&mut state.as_slice()).expect( + "the state parameter should be something that was generated by pre_upgrade", + ); + ensure!( + invulnerables_len > 0, + "invulnerables are empty after initialization. that should not happen" + ); + info!(target: TARGET, "apriori invulnerables: {}, aposteriori: {}", apriori_invulnerables_len, invulnerables_len); Ok(()) } } diff --git a/system-parachains/encointer/src/weights/mod.rs b/system-parachains/encointer/src/weights/mod.rs index a04c849297..321d486ed6 100644 --- a/system-parachains/encointer/src/weights/mod.rs +++ b/system-parachains/encointer/src/weights/mod.rs @@ -25,6 +25,7 @@ pub mod cumulus_pallet_xcmp_queue; pub mod extrinsic_weights; pub mod frame_system; pub mod pallet_balances; +pub mod pallet_collator_selection; pub mod pallet_collective; pub mod pallet_encointer_balances; pub mod pallet_encointer_bazaar; @@ -36,8 +37,8 @@ pub mod pallet_encointer_scheduler; pub mod pallet_membership; pub mod pallet_message_queue; pub mod pallet_proxy; +pub mod pallet_session; pub mod pallet_timestamp; -pub mod pallet_treasury; pub mod pallet_utility; pub mod paritydb_weights; pub mod rocksdb_weights; diff --git a/system-parachains/encointer/src/weights/pallet_collator_selection.rs b/system-parachains/encointer/src/weights/pallet_collator_selection.rs new file mode 100644 index 0000000000..bae142fdca --- /dev/null +++ b/system-parachains/encointer/src/weights/pallet_collator_selection.rs @@ -0,0 +1,281 @@ +// Copyright (C) Parity Technologies and the various Polkadot contributors, see Contributions.md +// for a list of specific contributors. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//! Autogenerated weights for `pallet_collator_selection` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-03-10, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! 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/production/polkadot +// benchmark +// pallet +// --chain=./asset-hub-kusama-chain-spec.json +// --steps=50 +// --repeat=20 +// --pallet=pallet_collator_selection +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./asset-hub-kusama-weights/ +// --header=./file_header.txt + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_collator_selection`. +pub struct WeightInfo(PhantomData); +impl pallet_collator_selection::WeightInfo for WeightInfo { + /// Storage: `Session::NextKeys` (r:20 w:0) + /// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `CollatorSelection::Invulnerables` (r:0 w:1) + /// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`) + /// The range of component `b` is `[1, 20]`. + fn set_invulnerables(b: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `196 + b * (79 ±0)` + // Estimated: `1187 + b * (2555 ±0)` + // Minimum execution time: 11_226_000 picoseconds. + Weight::from_parts(8_468_753, 0) + .saturating_add(Weight::from_parts(0, 1187)) + // Standard Error: 5_521 + .saturating_add(Weight::from_parts(3_196_761, 0).saturating_mul(b.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(b.into()))) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(Weight::from_parts(0, 2555).saturating_mul(b.into())) + } + /// Storage: `Session::NextKeys` (r:1 w:0) + /// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `CollatorSelection::Invulnerables` (r:1 w:1) + /// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::CandidateList` (r:1 w:1) + /// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `b` is `[1, 19]`. + /// The range of component `c` is `[1, 99]`. + fn add_invulnerable(b: u32, c: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `794 + b * (32 ±0) + c * (53 ±0)` + // Estimated: `6287 + b * (37 ±0) + c * (53 ±0)` + // Minimum execution time: 38_853_000 picoseconds. + Weight::from_parts(38_821_751, 0) + .saturating_add(Weight::from_parts(0, 6287)) + // Standard Error: 10_642 + .saturating_add(Weight::from_parts(102_671, 0).saturating_mul(b.into())) + // Standard Error: 2_017 + .saturating_add(Weight::from_parts(158_479, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(Weight::from_parts(0, 37).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(0, 53).saturating_mul(c.into())) + } + /// Storage: `CollatorSelection::CandidateList` (r:1 w:0) + /// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::Invulnerables` (r:1 w:1) + /// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`) + /// The range of component `b` is `[5, 20]`. + fn remove_invulnerable(b: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `119 + b * (32 ±0)` + // Estimated: `6287` + // Minimum execution time: 11_265_000 picoseconds. + Weight::from_parts(11_014_480, 0) + .saturating_add(Weight::from_parts(0, 6287)) + // Standard Error: 2_214 + .saturating_add(Weight::from_parts(161_950, 0).saturating_mul(b.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `CollatorSelection::DesiredCandidates` (r:0 w:1) + /// Proof: `CollatorSelection::DesiredCandidates` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + fn set_desired_candidates() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 4_093_000 picoseconds. + Weight::from_parts(4_325_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `CollatorSelection::CandidacyBond` (r:1 w:1) + /// Proof: `CollatorSelection::CandidacyBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::CandidateList` (r:1 w:1) + /// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:100 w:100) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:100) + /// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) + /// The range of component `c` is `[0, 100]`. + /// The range of component `k` is `[0, 100]`. + fn set_candidacy_bond(c: u32, k: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0 + c * (182 ±0) + k * (115 ±0)` + // Estimated: `6287 + c * (901 ±29) + k * (901 ±29)` + // Minimum execution time: 9_449_000 picoseconds. + Weight::from_parts(9_513_000, 0) + .saturating_add(Weight::from_parts(0, 6287)) + // Standard Error: 155_542 + .saturating_add(Weight::from_parts(5_194_785, 0).saturating_mul(c.into())) + // Standard Error: 155_542 + .saturating_add(Weight::from_parts(4_961_103, 0).saturating_mul(k.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(k.into()))) + .saturating_add(Weight::from_parts(0, 901).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0, 901).saturating_mul(k.into())) + } + /// Storage: `CollatorSelection::CandidacyBond` (r:1 w:0) + /// Proof: `CollatorSelection::CandidacyBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::CandidateList` (r:1 w:1) + /// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`) + /// The range of component `c` is `[3, 100]`. + fn update_bond(c: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `319 + c * (49 ±0)` + // Estimated: `6287` + // Minimum execution time: 23_774_000 picoseconds. + Weight::from_parts(26_546_147, 0) + .saturating_add(Weight::from_parts(0, 6287)) + // Standard Error: 1_740 + .saturating_add(Weight::from_parts(123_165, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `CollatorSelection::CandidateList` (r:1 w:1) + /// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::Invulnerables` (r:1 w:0) + /// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`) + /// Storage: `Session::NextKeys` (r:1 w:0) + /// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `CollatorSelection::CandidacyBond` (r:1 w:0) + /// Proof: `CollatorSelection::CandidacyBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:1) + /// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) + /// The range of component `c` is `[1, 99]`. + fn register_as_candidate(c: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `764 + c * (52 ±0)` + // Estimated: `6287 + c * (54 ±0)` + // Minimum execution time: 31_024_000 picoseconds. + Weight::from_parts(35_079_112, 0) + .saturating_add(Weight::from_parts(0, 6287)) + // Standard Error: 2_113 + .saturating_add(Weight::from_parts(136_243, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(Weight::from_parts(0, 54).saturating_mul(c.into())) + } + /// Storage: `CollatorSelection::Invulnerables` (r:1 w:0) + /// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::CandidacyBond` (r:1 w:0) + /// Proof: `CollatorSelection::CandidacyBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Session::NextKeys` (r:1 w:0) + /// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `CollatorSelection::CandidateList` (r:1 w:1) + /// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:2) + /// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) + /// The range of component `c` is `[3, 100]`. + fn take_candidate_slot(c: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `904 + c * (53 ±0)` + // Estimated: `6287 + c * (54 ±0)` + // Minimum execution time: 48_643_000 picoseconds. + Weight::from_parts(53_241_186, 0) + .saturating_add(Weight::from_parts(0, 6287)) + // Standard Error: 2_631 + .saturating_add(Weight::from_parts(156_227, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) + .saturating_add(Weight::from_parts(0, 54).saturating_mul(c.into())) + } + /// Storage: `CollatorSelection::CandidateList` (r:1 w:1) + /// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::Invulnerables` (r:1 w:0) + /// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:1) + /// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) + /// The range of component `c` is `[3, 100]`. + fn leave_intent(c: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `347 + c * (48 ±0)` + // Estimated: `6287` + // Minimum execution time: 26_974_000 picoseconds. + Weight::from_parts(30_461_854, 0) + .saturating_add(Weight::from_parts(0, 6287)) + // Standard Error: 2_180 + .saturating_add(Weight::from_parts(134_254, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `System::BlockWeight` (r:1 w:1) + /// Proof: `System::BlockWeight` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:1) + /// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) + fn note_author() -> Weight { + // Proof Size summary in bytes: + // Measured: `155` + // Estimated: `6196` + // Minimum execution time: 39_365_000 picoseconds. + Weight::from_parts(39_875_000, 0) + .saturating_add(Weight::from_parts(0, 6196)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `CollatorSelection::CandidateList` (r:1 w:0) + /// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::LastAuthoredBlock` (r:100 w:0) + /// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::Invulnerables` (r:1 w:0) + /// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::DesiredCandidates` (r:1 w:0) + /// Proof: `CollatorSelection::DesiredCandidates` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `System::BlockWeight` (r:1 w:1) + /// Proof: `System::BlockWeight` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:97 w:97) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `r` is `[1, 100]`. + /// The range of component `c` is `[1, 100]`. + fn new_session(r: u32, c: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `2302 + c * (97 ±0) + r * (114 ±0)` + // Estimated: `6287 + c * (2519 ±0) + r * (2603 ±0)` + // Minimum execution time: 18_553_000 picoseconds. + Weight::from_parts(18_854_000, 0) + .saturating_add(Weight::from_parts(0, 6287)) + // Standard Error: 280_994 + .saturating_add(Weight::from_parts(12_419_756, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(c.into()))) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) + .saturating_add(Weight::from_parts(0, 2519).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0, 2603).saturating_mul(r.into())) + } +} diff --git a/system-parachains/encointer/src/weights/pallet_session.rs b/system-parachains/encointer/src/weights/pallet_session.rs new file mode 100644 index 0000000000..e3579d5aaf --- /dev/null +++ b/system-parachains/encointer/src/weights/pallet_session.rs @@ -0,0 +1,77 @@ +// Copyright (C) Parity Technologies and the various Polkadot contributors, see Contributions.md +// for a list of specific contributors. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//! Autogenerated weights for `pallet_session` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-03-10, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! 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/production/polkadot +// benchmark +// pallet +// --chain=./asset-hub-kusama-chain-spec.json +// --steps=50 +// --repeat=20 +// --pallet=pallet_session +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./asset-hub-kusama-weights/ +// --header=./file_header.txt + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_session`. +pub struct WeightInfo(PhantomData); +impl pallet_session::WeightInfo for WeightInfo { + /// Storage: `Session::NextKeys` (r:1 w:1) + /// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Session::KeyOwner` (r:1 w:1) + /// Proof: `Session::KeyOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn set_keys() -> Weight { + // Proof Size summary in bytes: + // Measured: `297` + // Estimated: `3762` + // Minimum execution time: 15_064_000 picoseconds. + Weight::from_parts(15_441_000, 0) + .saturating_add(Weight::from_parts(0, 3762)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Session::NextKeys` (r:1 w:1) + /// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Session::KeyOwner` (r:0 w:1) + /// Proof: `Session::KeyOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn purge_keys() -> Weight { + // Proof Size summary in bytes: + // Measured: `279` + // Estimated: `3744` + // Minimum execution time: 10_865_000 picoseconds. + Weight::from_parts(11_276_000, 0) + .saturating_add(Weight::from_parts(0, 3744)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/system-parachains/encointer/src/weights/pallet_treasury.rs b/system-parachains/encointer/src/weights/pallet_treasury.rs deleted file mode 100644 index 52b59a25cd..0000000000 --- a/system-parachains/encointer/src/weights/pallet_treasury.rs +++ /dev/null @@ -1,211 +0,0 @@ -// 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_treasury` -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-09-22, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `a3dce7bd4066`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("spec-kusama.json")`, DB CACHE: 1024 - -// Executed Command: -// /builds/polkadot-sdk/target/production/polkadot -// benchmark -// pallet -// --chain=spec-kusama.json -// --pallet=pallet_treasury -// --extrinsic= -// --output=/builds/runtimes/relay/kusama/src/weights -// --header=/builds/bench/header.txt -// --no-median-slopes -// --no-min-squares - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] -#![allow(missing_docs)] - -use frame_support::{traits::Get, weights::Weight}; -use core::marker::PhantomData; - -/// Weight functions for `pallet_treasury`. -pub struct WeightInfo(PhantomData); -impl pallet_treasury::WeightInfo for WeightInfo { - /// Storage: `Treasury::ProposalCount` (r:1 w:1) - /// Proof: `Treasury::ProposalCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) - /// Storage: `Treasury::Approvals` (r:1 w:1) - /// Proof: `Treasury::Approvals` (`max_values`: Some(1), `max_size`: Some(402), added: 897, mode: `MaxEncodedLen`) - /// Storage: `Treasury::Proposals` (r:0 w:1) - /// Proof: `Treasury::Proposals` (`max_values`: None, `max_size`: Some(108), added: 2583, mode: `MaxEncodedLen`) - fn spend_local() -> Weight { - // Proof Size summary in bytes: - // Measured: `6` - // Estimated: `1887` - // Minimum execution time: 7_563_000 picoseconds. - Weight::from_parts(7_868_000, 0) - .saturating_add(Weight::from_parts(0, 1887)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: `Treasury::ProposalCount` (r:1 w:1) - /// Proof: `Treasury::ProposalCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) - /// Storage: `Treasury::Proposals` (r:0 w:1) - /// Proof: `Treasury::Proposals` (`max_values`: None, `max_size`: Some(108), added: 2583, mode: `MaxEncodedLen`) - fn propose_spend() -> Weight { - // Proof Size summary in bytes: - // Measured: `107` - // Estimated: `1489` - // Minimum execution time: 16_827_000 picoseconds. - Weight::from_parts(17_262_000, 0) - .saturating_add(Weight::from_parts(0, 1489)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: `Treasury::Proposals` (r:1 w:1) - /// Proof: `Treasury::Proposals` (`max_values`: None, `max_size`: Some(108), added: 2583, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - fn reject_proposal() -> Weight { - // Proof Size summary in bytes: - // Measured: `265` - // Estimated: `3593` - // Minimum execution time: 25_789_000 picoseconds. - Weight::from_parts(26_398_000, 0) - .saturating_add(Weight::from_parts(0, 3593)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: `Treasury::Proposals` (r:1 w:0) - /// Proof: `Treasury::Proposals` (`max_values`: None, `max_size`: Some(108), added: 2583, mode: `MaxEncodedLen`) - /// Storage: `Treasury::Approvals` (r:1 w:1) - /// Proof: `Treasury::Approvals` (`max_values`: Some(1), `max_size`: Some(402), added: 897, mode: `MaxEncodedLen`) - /// The range of component `p` is `[0, 99]`. - fn approve_proposal(p: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `433 + p * (8 ±0)` - // Estimated: `3573` - // Minimum execution time: 5_353_000 picoseconds. - Weight::from_parts(8_423_989, 0) - .saturating_add(Weight::from_parts(0, 3573)) - // Standard Error: 1_120 - .saturating_add(Weight::from_parts(45_883, 0).saturating_mul(p.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `Treasury::Approvals` (r:1 w:1) - /// Proof: `Treasury::Approvals` (`max_values`: Some(1), `max_size`: Some(402), added: 897, mode: `MaxEncodedLen`) - fn remove_approval() -> Weight { - // Proof Size summary in bytes: - // Measured: `90` - // Estimated: `1887` - // Minimum execution time: 4_075_000 picoseconds. - Weight::from_parts(4_286_000, 0) - .saturating_add(Weight::from_parts(0, 1887)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `Treasury::Deactivated` (r:1 w:1) - /// Proof: `Treasury::Deactivated` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) - /// Storage: `Treasury::Approvals` (r:1 w:1) - /// Proof: `Treasury::Approvals` (`max_values`: Some(1), `max_size`: Some(402), added: 897, mode: `MaxEncodedLen`) - /// Storage: `Treasury::Proposals` (r:99 w:99) - /// Proof: `Treasury::Proposals` (`max_values`: None, `max_size`: Some(108), added: 2583, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:199 w:199) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - /// Storage: `Bounties::BountyApprovals` (r:1 w:1) - /// Proof: `Bounties::BountyApprovals` (`max_values`: Some(1), `max_size`: Some(402), added: 897, mode: `MaxEncodedLen`) - /// The range of component `p` is `[0, 99]`. - fn on_initialize_proposals(p: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `294 + p * (251 ±0)` - // Estimated: `3593 + p * (5206 ±0)` - // Minimum execution time: 34_895_000 picoseconds. - Weight::from_parts(40_046_318, 0) - .saturating_add(Weight::from_parts(0, 3593)) - // Standard Error: 6_188 - .saturating_add(Weight::from_parts(25_772_314, 0).saturating_mul(p.into())) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(p.into()))) - .saturating_add(T::DbWeight::get().writes(4)) - .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(p.into()))) - .saturating_add(Weight::from_parts(0, 5206).saturating_mul(p.into())) - } - /// Storage: `Treasury::SpendCount` (r:1 w:1) - /// Proof: `Treasury::SpendCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) - /// Storage: `Treasury::Spends` (r:0 w:1) - /// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(1853), added: 4328, mode: `MaxEncodedLen`) - fn spend() -> Weight { - // Proof Size summary in bytes: - // Measured: `6` - // Estimated: `1489` - // Minimum execution time: 8_598_000 picoseconds. - Weight::from_parts(8_937_000, 0) - .saturating_add(Weight::from_parts(0, 1489)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: `Treasury::Spends` (r:1 w:1) - /// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(1853), added: 4328, mode: `MaxEncodedLen`) - /// Storage: `XcmPallet::QueryCounter` (r:1 w:1) - /// Proof: `XcmPallet::QueryCounter` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0) - /// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) - /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) - /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) - /// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `XcmPallet::Queries` (r:0 w:1) - /// Proof: `XcmPallet::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn payout() -> Weight { - // Proof Size summary in bytes: - // Measured: `251` - // Estimated: `5318` - // Minimum execution time: 29_981_000 picoseconds. - Weight::from_parts(30_787_000, 0) - .saturating_add(Weight::from_parts(0, 5318)) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(5)) - } - /// Storage: `Treasury::Spends` (r:1 w:1) - /// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(1853), added: 4328, mode: `MaxEncodedLen`) - /// Storage: `XcmPallet::Queries` (r:1 w:1) - /// Proof: `XcmPallet::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn check_status() -> Weight { - // Proof Size summary in bytes: - // Measured: `170` - // Estimated: `5318` - // Minimum execution time: 15_985_000 picoseconds. - Weight::from_parts(16_431_000, 0) - .saturating_add(Weight::from_parts(0, 5318)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: `Treasury::Spends` (r:1 w:1) - /// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(1853), added: 4328, mode: `MaxEncodedLen`) - fn void_spend() -> Weight { - // Proof Size summary in bytes: - // Measured: `142` - // Estimated: `5318` - // Minimum execution time: 8_515_000 picoseconds. - Weight::from_parts(8_795_000, 0) - .saturating_add(Weight::from_parts(0, 5318)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } -} diff --git a/system-parachains/encointer/src/xcm_config.rs b/system-parachains/encointer/src/xcm_config.rs index 6639eecfb3..4ace23f012 100644 --- a/system-parachains/encointer/src/xcm_config.rs +++ b/system-parachains/encointer/src/xcm_config.rs @@ -16,8 +16,8 @@ //! Almost identical to ../asset-hubs/asset-hub-kusama use super::{ - AccountId, Balances, FeesToTreasury, ParachainInfo, ParachainSystem, PolkadotXcm, Runtime, - RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue, + AccountId, Balances, ParachainInfo, ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, + RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue, }; use frame_support::{ parameter_types, @@ -25,7 +25,10 @@ use frame_support::{ }; use frame_system::EnsureRoot; use pallet_xcm::XcmPassthrough; -use parachains_common::xcm_config::{ConcreteAssetFromSystem, ParentRelayOrSiblingParachains}; +use parachains_common::{ + impls::ToStakingPot, + xcm_config::{ConcreteAssetFromSystem, ParentRelayOrSiblingParachains}, +}; use polkadot_parachain_primitives::primitives::Sibling; use sp_core::ConstU32; @@ -111,6 +114,7 @@ parameter_types! { } pub struct ParentOrParentsPlurality; + impl Contains for ParentOrParentsPlurality { fn contains(location: &Location) -> bool { matches!(location.unpack(), (1, []) | (1, [Plurality { .. }])) @@ -153,6 +157,7 @@ parameter_types! { pub type TrustedTeleporters = ConcreteAssetFromSystem; pub struct XcmConfig; + impl xcm_executor::Config for XcmConfig { type RuntimeCall = RuntimeCall; type XcmSender = XcmRouter; @@ -163,9 +168,8 @@ impl xcm_executor::Config for XcmConfig { type UniversalLocation = UniversalLocation; type Barrier = Barrier; type Weigher = FixedWeightBounds; - // `FeesToTreasury` is an encointer adaptation type Trader = - UsingComponents>; + UsingComponents>; type ResponseHandler = PolkadotXcm; type AssetTrap = PolkadotXcm; type AssetClaims = PolkadotXcm;