From 8ad5ba5ccc6ba17e81c425cdcb8f5c4f68e542f2 Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Tue, 9 Apr 2024 16:11:23 +0200 Subject: [PATCH 01/29] 3 new pallets for collator selection. copy-paste from AH --- Cargo.lock | 3 + system-parachains/encointer/Cargo.toml | 304 ++-- system-parachains/encointer/src/lib.rs | 1227 +++++++++-------- .../encointer/src/weights/mod.rs | 2 + .../src/weights/pallet_collator_selection.rs | 281 ++++ .../encointer/src/weights/pallet_session.rs | 77 ++ 6 files changed, 1163 insertions(+), 731 deletions(-) create mode 100644 system-parachains/encointer/src/weights/pallet_collator_selection.rs create mode 100644 system-parachains/encointer/src/weights/pallet_session.rs diff --git a/Cargo.lock b/Cargo.lock index 10aca79f1a..d40b91d724 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3570,7 +3570,9 @@ dependencies = [ "log", "pallet-asset-tx-payment", "pallet-aura", + "pallet-authorship", "pallet-balances", + "pallet-collator-selection", "pallet-collective", "pallet-encointer-balances", "pallet-encointer-bazaar", @@ -3587,6 +3589,7 @@ dependencies = [ "pallet-message-queue", "pallet-proxy", "pallet-scheduler", + "pallet-session", "pallet-timestamp", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", diff --git a/system-parachains/encointer/Cargo.toml b/system-parachains/encointer/Cargo.toml index 83add20a71..9c10924868 100644 --- a/system-parachains/encointer/Cargo.toml +++ b/system-parachains/encointer/Cargo.toml @@ -10,13 +10,13 @@ version.workspace = true [dependencies] codec = { package = "parity-scale-codec", version = "3.6.9", default-features = false, features = [ - "derive", + "derive", ] } -hex-literal = { optional = true , workspace = true } +hex-literal = { optional = true, workspace = true } log = { workspace = true } scale-info = { features = [ - "derive", -] , workspace = true } + "derive", +], workspace = true } smallvec = { workspace = true } @@ -53,7 +53,8 @@ frame-system-benchmarking = { optional = true, workspace = true } 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-aura = { features = ["experimental"], workspace = true } +pallet-authorship = { workspace = true } pallet-balances = { workspace = true } pallet-collective = { workspace = true } pallet-insecure-randomness-collective-flip = { workspace = true } @@ -61,6 +62,7 @@ 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 } @@ -91,13 +93,14 @@ xcm-executor = { package = "staging-xcm-executor", default-features = false, ver cumulus-pallet-aura-ext = { workspace = true } cumulus-pallet-dmp-queue = { workspace = true } cumulus-pallet-parachain-system = { features = [ - "parameterized-consensus-hook", + "parameterized-consensus-hook", ], 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 = { package = "staging-parachain-info", default-features = false, version = "0.8.0" } parachains-common = { workspace = true } polkadot-core-primitives = { workspace = true } @@ -117,153 +120,160 @@ system-parachains-constants = { path = "../constants" } [features] default = ["std"] runtime-benchmarks = [ - "cumulus-pallet-dmp-queue/runtime-benchmarks", - "cumulus-pallet-xcmp-queue/runtime-benchmarks", - "cumulus-pallet-parachain-system/runtime-benchmarks", - "frame-benchmarking/runtime-benchmarks", - "frame-support/runtime-benchmarks", - "frame-system-benchmarking/runtime-benchmarks", - "frame-system/runtime-benchmarks", - "hex-literal", - "pallet-balances/runtime-benchmarks", - "pallet-collective/runtime-benchmarks", - "pallet-encointer-balances/runtime-benchmarks", - "pallet-encointer-bazaar/runtime-benchmarks", - "pallet-encointer-ceremonies/runtime-benchmarks", - "pallet-encointer-communities/runtime-benchmarks", - "pallet-encointer-faucet/runtime-benchmarks", - "pallet-encointer-reputation-commitments/runtime-benchmarks", - "pallet-encointer-scheduler/runtime-benchmarks", - "pallet-message-queue/runtime-benchmarks", - "pallet-membership/runtime-benchmarks", - "pallet-proxy/runtime-benchmarks", - "pallet-timestamp/runtime-benchmarks", - "pallet-treasury/runtime-benchmarks", - "pallet-utility/runtime-benchmarks", - "pallet-xcm/runtime-benchmarks", - "polkadot-runtime-common/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", - "xcm-builder/runtime-benchmarks", - "xcm-executor/runtime-benchmarks", - "cumulus-primitives-core/runtime-benchmarks", - "cumulus-primitives-utility/runtime-benchmarks", - "encointer-balances-tx-payment/runtime-benchmarks", - "encointer-primitives/runtime-benchmarks", - "pallet-asset-tx-payment/runtime-benchmarks", - "pallet-scheduler/runtime-benchmarks", - "parachains-common/runtime-benchmarks", - "polkadot-parachain-primitives/runtime-benchmarks", - "polkadot-primitives/runtime-benchmarks" + "cumulus-pallet-dmp-queue/runtime-benchmarks", + "cumulus-pallet-xcmp-queue/runtime-benchmarks", + "cumulus-pallet-parachain-system/runtime-benchmarks", + "frame-benchmarking/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system-benchmarking/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "hex-literal", + "pallet-balances/runtime-benchmarks", + "pallet-collator-selection/runtime-benchmarks", + "pallet-collective/runtime-benchmarks", + "pallet-encointer-balances/runtime-benchmarks", + "pallet-encointer-bazaar/runtime-benchmarks", + "pallet-encointer-ceremonies/runtime-benchmarks", + "pallet-encointer-communities/runtime-benchmarks", + "pallet-encointer-faucet/runtime-benchmarks", + "pallet-encointer-reputation-commitments/runtime-benchmarks", + "pallet-encointer-scheduler/runtime-benchmarks", + "pallet-message-queue/runtime-benchmarks", + "pallet-membership/runtime-benchmarks", + "pallet-proxy/runtime-benchmarks", + "pallet-timestamp/runtime-benchmarks", + "pallet-treasury/runtime-benchmarks", + "pallet-utility/runtime-benchmarks", + "pallet-xcm/runtime-benchmarks", + "polkadot-runtime-common/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", + "xcm-builder/runtime-benchmarks", + "xcm-executor/runtime-benchmarks", + "cumulus-primitives-core/runtime-benchmarks", + "cumulus-primitives-utility/runtime-benchmarks", + "encointer-balances-tx-payment/runtime-benchmarks", + "encointer-primitives/runtime-benchmarks", + "pallet-asset-tx-payment/runtime-benchmarks", + "pallet-scheduler/runtime-benchmarks", + "parachains-common/runtime-benchmarks", + "polkadot-parachain-primitives/runtime-benchmarks", + "polkadot-primitives/runtime-benchmarks" ] std = [ - "codec/std", - "cumulus-pallet-aura-ext/std", - "cumulus-pallet-dmp-queue/std", - "cumulus-pallet-parachain-system/std", - "cumulus-pallet-xcm/std", - "cumulus-pallet-xcmp-queue/std", - "cumulus-primitives-aura/std", - "cumulus-primitives-core/std", - "cumulus-primitives-utility/std", - "encointer-balances-tx-payment-rpc-runtime-api/std", - "encointer-balances-tx-payment/std", - "encointer-primitives/serde_derive", - "encointer-primitives/std", - "frame-executive/std", - "frame-support/std", - "frame-system-rpc-runtime-api/std", - "frame-system/std", - "frame-try-runtime?/std", - "log/std", - "pallet-asset-tx-payment/std", - "pallet-aura/std", - "pallet-balances/std", - "pallet-collective/std", - "pallet-encointer-balances/std", - "pallet-encointer-bazaar-rpc-runtime-api/std", - "pallet-encointer-bazaar/std", - "pallet-encointer-ceremonies-rpc-runtime-api/std", - "pallet-encointer-ceremonies/std", - "pallet-encointer-communities-rpc-runtime-api/std", - "pallet-encointer-communities/std", - "pallet-encointer-faucet/std", - "pallet-encointer-reputation-commitments/std", - "pallet-encointer-scheduler/std", - "pallet-insecure-randomness-collective-flip/std", - "pallet-message-queue/std", - "pallet-membership/std", - "pallet-proxy/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", - "parachains-common/std", - "scale-info/std", - "sp-api/std", - "sp-block-builder/std", - "sp-consensus-aura/std", - "sp-core/std", - "sp-genesis-builder/std", - "sp-inherents/std", - "sp-offchain/std", - "sp-runtime/std", - "sp-session/std", - "sp-std/std", - "sp-transaction-pool/std", - "sp-version/std", - "substrate-wasm-builder", - "xcm-builder/std", - "xcm-executor/std", - "xcm/std", - "frame-benchmarking?/std", - "frame-system-benchmarking?/std", - "pallet-scheduler/std", - "polkadot-core-primitives/std", - "polkadot-parachain-primitives/std", - "polkadot-primitives/std", - "polkadot-runtime-common/std" + "codec/std", + "cumulus-pallet-aura-ext/std", + "cumulus-pallet-dmp-queue/std", + "cumulus-pallet-parachain-system/std", + "cumulus-pallet-xcm/std", + "cumulus-pallet-xcmp-queue/std", + "cumulus-primitives-aura/std", + "cumulus-primitives-core/std", + "cumulus-primitives-utility/std", + "encointer-balances-tx-payment-rpc-runtime-api/std", + "encointer-balances-tx-payment/std", + "encointer-primitives/serde_derive", + "encointer-primitives/std", + "frame-executive/std", + "frame-support/std", + "frame-system-rpc-runtime-api/std", + "frame-system/std", + "frame-try-runtime?/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", + "pallet-encointer-bazaar/std", + "pallet-encointer-ceremonies-rpc-runtime-api/std", + "pallet-encointer-ceremonies/std", + "pallet-encointer-communities-rpc-runtime-api/std", + "pallet-encointer-communities/std", + "pallet-encointer-faucet/std", + "pallet-encointer-reputation-commitments/std", + "pallet-encointer-scheduler/std", + "pallet-insecure-randomness-collective-flip/std", + "pallet-message-queue/std", + "pallet-membership/std", + "pallet-proxy/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", + "parachains-common/std", + "scale-info/std", + "sp-api/std", + "sp-block-builder/std", + "sp-consensus-aura/std", + "sp-core/std", + "sp-genesis-builder/std", + "sp-inherents/std", + "sp-offchain/std", + "sp-runtime/std", + "sp-session/std", + "sp-std/std", + "sp-transaction-pool/std", + "sp-version/std", + "substrate-wasm-builder", + "xcm-builder/std", + "xcm-executor/std", + "xcm/std", + "frame-benchmarking?/std", + "frame-system-benchmarking?/std", + "pallet-scheduler/std", + "polkadot-core-primitives/std", + "polkadot-parachain-primitives/std", + "polkadot-primitives/std", + "polkadot-runtime-common/std" ] try-runtime = [ - "cumulus-pallet-aura-ext/try-runtime", - "cumulus-pallet-dmp-queue/try-runtime", - "cumulus-pallet-parachain-system/try-runtime", - "cumulus-pallet-xcm/try-runtime", - "cumulus-pallet-xcmp-queue/try-runtime", - "frame-executive/try-runtime", - "frame-system/try-runtime", - "frame-try-runtime/try-runtime", - "pallet-asset-tx-payment/try-runtime", - "pallet-aura/try-runtime", - "pallet-balances/try-runtime", - "pallet-collective/try-runtime", - "pallet-encointer-balances/try-runtime", - "pallet-encointer-bazaar/try-runtime", - "pallet-encointer-ceremonies/try-runtime", - "pallet-encointer-communities/try-runtime", - "pallet-encointer-faucet/try-runtime", - "pallet-encointer-reputation-commitments/try-runtime", - "pallet-encointer-scheduler/try-runtime", - "pallet-insecure-randomness-collective-flip/try-runtime", - "pallet-message-queue/try-runtime", - "pallet-membership/try-runtime", - "pallet-proxy/try-runtime", - "pallet-scheduler/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", - "encointer-balances-tx-payment/try-runtime", - "encointer-primitives/try-runtime", - "frame-support/try-runtime", - "polkadot-runtime-common/try-runtime", - "sp-runtime/try-runtime" + "cumulus-pallet-aura-ext/try-runtime", + "cumulus-pallet-dmp-queue/try-runtime", + "cumulus-pallet-parachain-system/try-runtime", + "cumulus-pallet-xcm/try-runtime", + "cumulus-pallet-xcmp-queue/try-runtime", + "frame-executive/try-runtime", + "frame-system/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", + "pallet-encointer-ceremonies/try-runtime", + "pallet-encointer-communities/try-runtime", + "pallet-encointer-faucet/try-runtime", + "pallet-encointer-reputation-commitments/try-runtime", + "pallet-encointer-scheduler/try-runtime", + "pallet-insecure-randomness-collective-flip/try-runtime", + "pallet-message-queue/try-runtime", + "pallet-membership/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", + "encointer-balances-tx-payment/try-runtime", + "encointer-primitives/try-runtime", + "frame-support/try-runtime", + "polkadot-runtime-common/try-runtime", + "sp-runtime/try-runtime" ] # A feature that should be enabled when the runtime should be built for on-chain diff --git a/system-parachains/encointer/src/lib.rs b/system-parachains/encointer/src/lib.rs index 9abb68d443..1c936e0636 100644 --- a/system-parachains/encointer/src/lib.rs +++ b/system-parachains/encointer/src/lib.rs @@ -35,37 +35,38 @@ mod deal_with_fees; mod migrations_fix; mod weights; pub mod xcm_config; + use codec::{Decode, Encode, MaxEncodedLen}; 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}; pub use encointer_primitives::{ - balances::{BalanceEntry, BalanceType, Demurrage}, - bazaar::{BusinessData, BusinessIdentifier, OfferingData}, - ceremonies::{AggregatedAccountData, CeremonyIndexType, CeremonyInfo, CommunityReputation}, - common::PalletString, - communities::{CommunityIdentifier, Location}, - scheduler::CeremonyPhaseType, + balances::{BalanceEntry, BalanceType, Demurrage}, + bazaar::{BusinessData, BusinessIdentifier, OfferingData}, + ceremonies::{AggregatedAccountData, CeremonyIndexType, CeremonyInfo, CommunityReputation}, + common::PalletString, + 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}, - ConstBool, ConstU64, Contains, EitherOfDiverse, EqualPrivilegeOnly, InstanceFilter, - }, - weights::{ConstantMultiplier, Weight}, - PalletId, + construct_runtime, + dispatch::DispatchClass, + genesis_builder_helper::{build_config, create_default_config}, + parameter_types, + traits::{ + tokens::{pay::PayFromAccount, ConversionFromAssetBalance, ConversionToAssetBalance}, + ConstBool, ConstU64, Contains, EitherOfDiverse, EqualPrivilegeOnly, InstanceFilter, + }, + weights::{ConstantMultiplier, Weight}, + PalletId, }; use frame_system::{ - limits::{BlockLength, BlockWeights}, - EnsureRoot, + limits::{BlockLength, BlockWeights}, + EnsureRoot, }; pub use pallet_encointer_balances::Call as EncointerBalancesCall; pub use pallet_encointer_bazaar::Call as EncointerBazaarCall; @@ -74,10 +75,10 @@ pub use pallet_encointer_communities::Call as EncointerCommunitiesCall; 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 pallet_xcm::{EnsureXcm, IsMajorityOfBody, IsVoiceOfBody}; pub use parachains_common::{ - impls::DealWithFees, AccountId, AssetIdForTrustBackedAssets, AuraId, Balance, BlockNumber, - Hash, Header, Nonce, Signature, + impls::DealWithFees, AccountId, AssetIdForTrustBackedAssets, AuraId, Balance, BlockNumber, + Hash, Header, Nonce, Signature, }; use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate}; use sp_api::impl_runtime_apis; @@ -85,19 +86,19 @@ use sp_core::{crypto::KeyTypeId, ConstU32, OpaqueMetadata}; #[cfg(any(feature = "std", test))] pub use sp_runtime::BuildStorage; use sp_runtime::{ - create_runtime_str, generic, impl_opaque_keys, - traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, IdentityLookup, Verify}, - transaction_validity::{TransactionSource, TransactionValidity}, - ApplyExtrinsicResult, Perbill, Permill, RuntimeDebug, + create_runtime_str, generic, impl_opaque_keys, + traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, IdentityLookup, Verify}, + transaction_validity::{TransactionSource, TransactionValidity}, + ApplyExtrinsicResult, Perbill, Permill, RuntimeDebug, }; use sp_std::prelude::*; #[cfg(feature = "std")] use sp_version::NativeVersion; use sp_version::RuntimeVersion; use system_parachains_constants::{ - kusama::{consensus::*, currency::*, fee::WeightToFee}, - AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, - SLOT_DURATION, + kusama::{consensus::*, currency::*, fee::WeightToFee}, + AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, + SLOT_DURATION, }; use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}; use xcm::latest::prelude::{AssetId as XcmAssetId, BodyId}; @@ -119,20 +120,20 @@ impl_opaque_keys! { /// This runtime version. #[sp_version::runtime_version] pub const VERSION: RuntimeVersion = RuntimeVersion { - spec_name: create_runtime_str!("encointer-parachain"), - impl_name: create_runtime_str!("encointer-parachain"), - authoring_version: 1, - spec_version: 1_002_000, - impl_version: 1, - apis: RUNTIME_API_VERSIONS, - transaction_version: 3, - state_version: 0, + spec_name: create_runtime_str!("encointer-parachain"), + impl_name: create_runtime_str!("encointer-parachain"), + authoring_version: 1, + spec_version: 1_002_010, + impl_version: 1, + apis: RUNTIME_API_VERSIONS, + transaction_version: 3, + state_version: 0, }; /// The version information used to identify this runtime when compiled natively. #[cfg(feature = "std")] pub fn native_version() -> NativeVersion { - NativeVersion { runtime_version: VERSION, can_author_with: Default::default() } + NativeVersion { runtime_version: VERSION, can_author_with: Default::default() } } parameter_types! { @@ -149,68 +150,69 @@ parameter_types! { /// The type used to represent the kinds of proxying allowed. #[derive( - Copy, - Clone, - Eq, - PartialEq, - Ord, - PartialOrd, - Encode, - Decode, - RuntimeDebug, - scale_info::TypeInfo, - MaxEncodedLen, +Copy, +Clone, +Eq, +PartialEq, +Ord, +PartialOrd, +Encode, +Decode, +RuntimeDebug, +scale_info::TypeInfo, +MaxEncodedLen, )] pub enum ProxyType { - Any, - NonTransfer, - BazaarEdit, + Any, + NonTransfer, + BazaarEdit, } impl Default for ProxyType { - fn default() -> Self { - Self::Any - } + fn default() -> Self { + Self::Any + } } + impl InstanceFilter for ProxyType { - fn filter(&self, c: &RuntimeCall) -> bool { - match self { - ProxyType::Any => true, - ProxyType::NonTransfer => - !matches!(c, RuntimeCall::Balances { .. } | RuntimeCall::EncointerBalances { .. }), - ProxyType::BazaarEdit => matches!( + fn filter(&self, c: &RuntimeCall) -> bool { + match self { + ProxyType::Any => true, + ProxyType::NonTransfer => + !matches!(c, RuntimeCall::Balances { .. } | RuntimeCall::EncointerBalances { .. }), + ProxyType::BazaarEdit => matches!( c, RuntimeCall::EncointerBazaar(EncointerBazaarCall::create_offering { .. }) | RuntimeCall::EncointerBazaar(EncointerBazaarCall::update_offering { .. }) | RuntimeCall::EncointerBazaar(EncointerBazaarCall::delete_offering { .. }) ), - } - } - - fn is_superset(&self, o: &Self) -> bool { - match (self, o) { - (x, y) if x == y => true, - (ProxyType::Any, _) => true, - (_, ProxyType::Any) => false, - (ProxyType::NonTransfer, ProxyType::BazaarEdit) => true, - _ => false, - } - } + } + } + + fn is_superset(&self, o: &Self) -> bool { + match (self, o) { + (x, y) if x == y => true, + (ProxyType::Any, _) => true, + (_, ProxyType::Any) => false, + (ProxyType::NonTransfer, ProxyType::BazaarEdit) => true, + _ => false, + } + } } impl pallet_proxy::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type RuntimeCall = RuntimeCall; - type Currency = Balances; - type ProxyType = ProxyType; - type ProxyDepositBase = ProxyDepositBase; - type ProxyDepositFactor = ProxyDepositFactor; - type MaxProxies = MaxProxies; - type WeightInfo = weights::pallet_proxy::WeightInfo; - type MaxPending = MaxPending; - type CallHasher = BlakeTwo256; - type AnnouncementDepositBase = AnnouncementDepositBase; - type AnnouncementDepositFactor = AnnouncementDepositFactor; + type RuntimeEvent = RuntimeEvent; + type RuntimeCall = RuntimeCall; + type Currency = Balances; + type ProxyType = ProxyType; + type ProxyDepositBase = ProxyDepositBase; + type ProxyDepositFactor = ProxyDepositFactor; + type MaxProxies = MaxProxies; + type WeightInfo = weights::pallet_proxy::WeightInfo; + type MaxPending = MaxPending; + type CallHasher = BlakeTwo256; + type AnnouncementDepositBase = AnnouncementDepositBase; + type AnnouncementDepositFactor = AnnouncementDepositFactor; } parameter_types! { @@ -239,39 +241,40 @@ parameter_types! { } pub struct BaseFilter; + impl Contains for BaseFilter { - fn contains(_c: &RuntimeCall) -> bool { - true - } + fn contains(_c: &RuntimeCall) -> bool { + true + } } // Configure FRAME pallets to include in runtime. impl frame_system::Config for Runtime { - type BaseCallFilter = BaseFilter; - // The block type. - type Block = generic::Block; - type BlockWeights = RuntimeBlockWeights; - type BlockLength = RuntimeBlockLength; - type AccountId = AccountId; - type RuntimeCall = RuntimeCall; - type RuntimeTask = RuntimeTask; - type Lookup = AccountIdLookup; - type Nonce = Nonce; - type Hash = Hash; - type Hashing = BlakeTwo256; - type RuntimeEvent = RuntimeEvent; - type RuntimeOrigin = RuntimeOrigin; - type BlockHashCount = BlockHashCount; - type DbWeight = RocksDbWeight; - type Version = Version; - type PalletInfo = PalletInfo; - type OnNewAccount = (); - type OnKilledAccount = (); - type AccountData = pallet_balances::AccountData; - type SystemWeightInfo = weights::frame_system::WeightInfo; - type SS58Prefix = SS58Prefix; - type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode; - type MaxConsumers = frame_support::traits::ConstU32<16>; + type BaseCallFilter = BaseFilter; + // The block type. + type Block = generic::Block; + type BlockWeights = RuntimeBlockWeights; + type BlockLength = RuntimeBlockLength; + type AccountId = AccountId; + type RuntimeCall = RuntimeCall; + type RuntimeTask = RuntimeTask; + type Lookup = AccountIdLookup; + type Nonce = Nonce; + type Hash = Hash; + type Hashing = BlakeTwo256; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; + type BlockHashCount = BlockHashCount; + type DbWeight = RocksDbWeight; + type Version = Version; + type PalletInfo = PalletInfo; + type OnNewAccount = (); + type OnKilledAccount = (); + type AccountData = pallet_balances::AccountData; + type SystemWeightInfo = weights::frame_system::WeightInfo; + type SS58Prefix = SS58Prefix; + type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode; + type MaxConsumers = frame_support::traits::ConstU32<16>; } parameter_types! { @@ -279,11 +282,11 @@ parameter_types! { } impl pallet_timestamp::Config for Runtime { - /// A timestamp: milliseconds since the unix epoch. - type Moment = Moment; - type OnTimestampSet = EncointerScheduler; - type MinimumPeriod = MinimumPeriod; - type WeightInfo = weights::pallet_timestamp::WeightInfo; + /// A timestamp: milliseconds since the unix epoch. + type Moment = Moment; + type OnTimestampSet = EncointerScheduler; + type MinimumPeriod = MinimumPeriod; + type WeightInfo = weights::pallet_timestamp::WeightInfo; } parameter_types! { @@ -293,21 +296,21 @@ parameter_types! { } impl pallet_balances::Config for Runtime { - type MaxLocks = MaxLocks; - /// The type for recording an account's balance. - type Balance = Balance; - /// The ubiquitous event type. - type RuntimeEvent = RuntimeEvent; - type DustRemoval = (); - type ExistentialDeposit = ExistentialDeposit; - type AccountStore = System; - type WeightInfo = weights::pallet_balances::WeightInfo; - type MaxReserves = MaxReserves; - type ReserveIdentifier = [u8; 8]; - type RuntimeHoldReason = (); - type RuntimeFreezeReason = RuntimeFreezeReason; - type FreezeIdentifier = (); - type MaxFreezes = ConstU32<0>; + type MaxLocks = MaxLocks; + /// The type for recording an account's balance. + type Balance = Balance; + /// The ubiquitous event type. + type RuntimeEvent = RuntimeEvent; + type DustRemoval = (); + type ExistentialDeposit = ExistentialDeposit; + type AccountStore = System; + type WeightInfo = weights::pallet_balances::WeightInfo; + type MaxReserves = MaxReserves; + type ReserveIdentifier = [u8; 8]; + type RuntimeHoldReason = (); + type RuntimeFreezeReason = RuntimeFreezeReason; + type FreezeIdentifier = (); + type MaxFreezes = ConstU32<0>; } parameter_types! { @@ -317,14 +320,14 @@ parameter_types! { } impl pallet_transaction_payment::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - // `FeesToTreasury is an encointer adaptation. - type OnChargeTransaction = - pallet_transaction_payment::CurrencyAdapter>; - type WeightToFee = WeightToFee; - type LengthToFee = ConstantMultiplier; - type FeeMultiplierUpdate = SlowAdjustingFeeUpdate; - type OperationalFeeMultiplier = OperationalFeeMultiplier; + type RuntimeEvent = RuntimeEvent; + // `FeesToTreasury is an encointer adaptation. + type OnChargeTransaction = + pallet_transaction_payment::CurrencyAdapter>; + type WeightToFee = WeightToFee; + type LengthToFee = ConstantMultiplier; + type FeeMultiplierUpdate = SlowAdjustingFeeUpdate; + type OperationalFeeMultiplier = OperationalFeeMultiplier; } pub const ENCOINTER_TREASURY_PALLET_ID: u8 = 43; @@ -342,48 +345,55 @@ parameter_types! { } pub struct NoConversion; + impl ConversionFromAssetBalance for NoConversion { - type Error = (); - fn from_asset_balance(balance: Balance, _asset_id: ()) -> Result { - return Ok(balance) - } - #[cfg(feature = "runtime-benchmarks")] - fn ensure_successful(_: ()) {} + type Error = (); + fn from_asset_balance(balance: Balance, _asset_id: ()) -> Result { + return 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 = (); + 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; - type PalletsOrigin = OriginCaller; - type WeightInfo = weights::pallet_utility::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type RuntimeCall = RuntimeCall; + type PalletsOrigin = OriginCaller; + type WeightInfo = weights::pallet_utility::WeightInfo; } parameter_types! { @@ -393,16 +403,16 @@ parameter_types! { } impl pallet_scheduler::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type RuntimeOrigin = RuntimeOrigin; - type PalletsOrigin = OriginCaller; - type RuntimeCall = RuntimeCall; - type MaximumWeight = MaximumSchedulerWeight; - type ScheduleOrigin = MoreThanHalfCouncil; - type MaxScheduledPerBlock = MaxScheduledPerBlock; - type WeightInfo = pallet_scheduler::weights::SubstrateWeight; - type OriginPrivilegeCmp = EqualPrivilegeOnly; - type Preimages = (); + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; + type PalletsOrigin = OriginCaller; + type RuntimeCall = RuntimeCall; + type MaximumWeight = MaximumSchedulerWeight; + type ScheduleOrigin = MoreThanHalfCouncil; + type MaxScheduledPerBlock = MaxScheduledPerBlock; + type WeightInfo = pallet_scheduler::weights::SubstrateWeight; + type OriginPrivilegeCmp = EqualPrivilegeOnly; + type Preimages = (); } parameter_types! { @@ -412,24 +422,24 @@ parameter_types! { } impl cumulus_pallet_parachain_system::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type OnSystemEvent = (); - type SelfParaId = parachain_info::Pallet; - type DmpQueue = frame_support::traits::EnqueueWithOrigin; - type ReservedDmpWeight = ReservedDmpWeight; - type OutboundXcmpMessageSource = XcmpQueue; - type XcmpMessageHandler = XcmpQueue; - type ReservedXcmpWeight = ReservedXcmpWeight; - type CheckAssociatedRelayNumber = RelayNumberMonotonicallyIncreases; - type ConsensusHook = ConsensusHook; - type WeightInfo = weights::cumulus_pallet_parachain_system::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type OnSystemEvent = (); + type SelfParaId = parachain_info::Pallet; + type DmpQueue = frame_support::traits::EnqueueWithOrigin; + type ReservedDmpWeight = ReservedDmpWeight; + type OutboundXcmpMessageSource = XcmpQueue; + type XcmpMessageHandler = XcmpQueue; + type ReservedXcmpWeight = ReservedXcmpWeight; + type CheckAssociatedRelayNumber = RelayNumberMonotonicallyIncreases; + type ConsensusHook = ConsensusHook; + type WeightInfo = weights::cumulus_pallet_parachain_system::WeightInfo; } type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook< - Runtime, - RELAY_CHAIN_SLOT_DURATION_MILLIS, - BLOCK_PROCESSING_VELOCITY, - UNINCLUDED_SEGMENT_CAPACITY, + Runtime, + RELAY_CHAIN_SLOT_DURATION_MILLIS, + BLOCK_PROCESSING_VELOCITY, + UNINCLUDED_SEGMENT_CAPACITY, >; impl pallet_insecure_randomness_collective_flip::Config for Runtime {} @@ -448,32 +458,32 @@ parameter_types! { } pub type PriceForSiblingParachainDelivery = polkadot_runtime_common::xcm_sender::ExponentialPrice< - FeeAssetId, - ToSiblingBaseDeliveryFee, - TransactionByteFee, - XcmpQueue, + FeeAssetId, + ToSiblingBaseDeliveryFee, + TransactionByteFee, + XcmpQueue, >; impl cumulus_pallet_xcmp_queue::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type ChannelInfo = ParachainSystem; - type VersionWrapper = PolkadotXcm; - type XcmpQueue = TransformOrigin; - type MaxInboundSuspended = sp_core::ConstU32<1_000>; - type ControllerOrigin = EitherOfDiverse< - EnsureRoot, - EnsureXcm>, - >; - type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin; - type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo; - type PriceForSiblingDelivery = PriceForSiblingParachainDelivery; + type RuntimeEvent = RuntimeEvent; + type ChannelInfo = ParachainSystem; + type VersionWrapper = PolkadotXcm; + type XcmpQueue = TransformOrigin; + type MaxInboundSuspended = sp_core::ConstU32<1_000>; + type ControllerOrigin = EitherOfDiverse< + EnsureRoot, + EnsureXcm>, + >; + type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin; + type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo; + type PriceForSiblingDelivery = PriceForSiblingParachainDelivery; } // TODO: remove dmp with 1.3.0 (https://github.com/polkadot-fellows/runtimes/issues/186) impl cumulus_pallet_dmp_queue::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type WeightInfo = weights::cumulus_pallet_dmp_queue::WeightInfo; - type DmpSink = frame_support::traits::EnqueueWithOrigin; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = weights::cumulus_pallet_dmp_queue::WeightInfo; + type DmpSink = frame_support::traits::EnqueueWithOrigin; } parameter_types! { @@ -481,25 +491,25 @@ parameter_types! { } impl pallet_message_queue::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type WeightInfo = weights::pallet_message_queue::WeightInfo; - #[cfg(feature = "runtime-benchmarks")] - type MessageProcessor = pallet_message_queue::mock_helpers::NoopMessageProcessor< - cumulus_primitives_core::AggregateMessageOrigin, - >; - #[cfg(not(feature = "runtime-benchmarks"))] - type MessageProcessor = xcm_builder::ProcessXcmMessage< - AggregateMessageOrigin, - xcm_executor::XcmExecutor, - RuntimeCall, - >; - type Size = u32; - // The XCMP queue pallet is only ever able to handle the `Sibling(ParaId)` origin: - type QueueChangeHandler = NarrowOriginToSibling; - type QueuePausedQuery = NarrowOriginToSibling; - type HeapSize = sp_core::ConstU32<{ 64 * 1024 }>; - type MaxStale = sp_core::ConstU32<8>; - type ServiceWeight = MessageQueueServiceWeight; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = weights::pallet_message_queue::WeightInfo; + #[cfg(feature = "runtime-benchmarks")] + type MessageProcessor = pallet_message_queue::mock_helpers::NoopMessageProcessor< + cumulus_primitives_core::AggregateMessageOrigin, + >; + #[cfg(not(feature = "runtime-benchmarks"))] + type MessageProcessor = xcm_builder::ProcessXcmMessage< + AggregateMessageOrigin, + xcm_executor::XcmExecutor, + RuntimeCall, + >; + type Size = u32; + // The XCMP queue pallet is only ever able to handle the `Sibling(ParaId)` origin: + type QueueChangeHandler = NarrowOriginToSibling; + type QueuePausedQuery = NarrowOriginToSibling; + type HeapSize = sp_core::ConstU32<{ 64 * 1024 }>; + type MaxStale = sp_core::ConstU32<8>; + type ServiceWeight = MessageQueueServiceWeight; } parameter_types! { @@ -519,69 +529,69 @@ parameter_types! { } impl pallet_encointer_scheduler::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type OnCeremonyPhaseChange = EncointerCeremonies; - type MomentsPerDay = MomentsPerDay; - type CeremonyMaster = MoreThanHalfCouncil; - type WeightInfo = weights::pallet_encointer_scheduler::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type OnCeremonyPhaseChange = EncointerCeremonies; + type MomentsPerDay = MomentsPerDay; + type CeremonyMaster = MoreThanHalfCouncil; + type WeightInfo = weights::pallet_encointer_scheduler::WeightInfo; } impl pallet_encointer_ceremonies::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type Public = ::Signer; - type Signature = Signature; - type RandomnessSource = RandomnessCollectiveFlip; - type MeetupSizeTarget = MeetupSizeTarget; - type MeetupMinSize = MeetupMinSize; - type MeetupNewbieLimitDivider = MeetupNewbieLimitDivider; - type CeremonyMaster = MoreThanHalfCouncil; - type WeightInfo = weights::pallet_encointer_ceremonies::WeightInfo; - type MaxAttestations = ConstU32<100>; + type RuntimeEvent = RuntimeEvent; + type Public = ::Signer; + type Signature = Signature; + type RandomnessSource = RandomnessCollectiveFlip; + type MeetupSizeTarget = MeetupSizeTarget; + type MeetupMinSize = MeetupMinSize; + type MeetupNewbieLimitDivider = MeetupNewbieLimitDivider; + type CeremonyMaster = MoreThanHalfCouncil; + type WeightInfo = weights::pallet_encointer_ceremonies::WeightInfo; + type MaxAttestations = ConstU32<100>; } impl pallet_encointer_communities::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type CommunityMaster = MoreThanHalfCouncil; - type TrustableForNonDestructiveAction = MoreThanHalfCouncil; - type WeightInfo = weights::pallet_encointer_communities::WeightInfo; - type MaxCommunityIdentifiers = ConstU32<10000>; - type MaxBootstrappers = ConstU32<10000>; - type MaxLocationsPerGeohash = ConstU32<10000>; - type MaxCommunityIdentifiersPerGeohash = ConstU32<10000>; + type RuntimeEvent = RuntimeEvent; + type CommunityMaster = MoreThanHalfCouncil; + type TrustableForNonDestructiveAction = MoreThanHalfCouncil; + type WeightInfo = weights::pallet_encointer_communities::WeightInfo; + type MaxCommunityIdentifiers = ConstU32<10000>; + type MaxBootstrappers = ConstU32<10000>; + type MaxLocationsPerGeohash = ConstU32<10000>; + type MaxCommunityIdentifiersPerGeohash = ConstU32<10000>; } impl pallet_encointer_balances::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type DefaultDemurrage = DefaultDemurrage; - type ExistentialDeposit = EncointerExistentialDeposit; - type CeremonyMaster = MoreThanHalfCouncil; - type WeightInfo = weights::pallet_encointer_balances::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type DefaultDemurrage = DefaultDemurrage; + type ExistentialDeposit = EncointerExistentialDeposit; + type CeremonyMaster = MoreThanHalfCouncil; + type WeightInfo = weights::pallet_encointer_balances::WeightInfo; } impl pallet_encointer_bazaar::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type WeightInfo = weights::pallet_encointer_bazaar::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = weights::pallet_encointer_bazaar::WeightInfo; } impl pallet_encointer_reputation_commitments::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type WeightInfo = weights::pallet_encointer_reputation_commitments::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = weights::pallet_encointer_reputation_commitments::WeightInfo; } impl pallet_encointer_faucet::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type ControllerOrigin = EnsureRoot; - type Currency = Balances; - type PalletId = FaucetPalletId; - type WeightInfo = weights::pallet_encointer_faucet::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type ControllerOrigin = EnsureRoot; + type Currency = Balances; + type PalletId = FaucetPalletId; + type WeightInfo = weights::pallet_encointer_faucet::WeightInfo; } impl pallet_aura::Config for Runtime { - type AuthorityId = AuraId; - type DisabledValidators = (); - type MaxAuthorities = MaxAuthorities; - type AllowMultipleBlocksPerSlot = ConstBool; - type SlotDuration = ConstU64; + type AuthorityId = AuraId; + type DisabledValidators = (); + type MaxAuthorities = MaxAuthorities; + type AllowMultipleBlocksPerSlot = ConstBool; + type SlotDuration = ConstU64; } parameter_types! { @@ -592,46 +602,87 @@ parameter_types! { } type MoreThanHalfCouncil = EitherOfDiverse< - EnsureRoot, - pallet_collective::EnsureProportionMoreThan, + EnsureRoot, + pallet_collective::EnsureProportionMoreThan, >; pub type CouncilCollective = pallet_collective::Instance1; + impl pallet_collective::Config for Runtime { - type RuntimeOrigin = RuntimeOrigin; - type Proposal = RuntimeCall; - type RuntimeEvent = RuntimeEvent; - type MotionDuration = CouncilMotionDuration; - type MaxProposals = CouncilMaxProposals; - type DefaultVote = pallet_collective::PrimeDefaultVote; - type MaxMembers = CouncilMaxMembers; - type WeightInfo = weights::pallet_collective::WeightInfo; - type SetMembersOrigin = MoreThanHalfCouncil; - type MaxProposalWeight = MaxProposalWeight; + type RuntimeOrigin = RuntimeOrigin; + type Proposal = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type MotionDuration = CouncilMotionDuration; + type MaxProposals = CouncilMaxProposals; + type DefaultVote = pallet_collective::PrimeDefaultVote; + type MaxMembers = CouncilMaxMembers; + type WeightInfo = weights::pallet_collective::WeightInfo; + type SetMembersOrigin = MoreThanHalfCouncil; + type MaxProposalWeight = MaxProposalWeight; } // support for collective pallet impl pallet_membership::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type AddOrigin = MoreThanHalfCouncil; - type RemoveOrigin = MoreThanHalfCouncil; - type SwapOrigin = MoreThanHalfCouncil; - type ResetOrigin = MoreThanHalfCouncil; - type PrimeOrigin = MoreThanHalfCouncil; - type MembershipInitialized = Collective; - type MembershipChanged = Collective; - type MaxMembers = CouncilMaxMembers; - type WeightInfo = weights::pallet_membership::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type AddOrigin = MoreThanHalfCouncil; + type RemoveOrigin = MoreThanHalfCouncil; + type SwapOrigin = MoreThanHalfCouncil; + type ResetOrigin = MoreThanHalfCouncil; + type PrimeOrigin = MoreThanHalfCouncil; + type MembershipInitialized = Collective; + type MembershipChanged = Collective; + type MaxMembers = CouncilMaxMembers; + type WeightInfo = weights::pallet_membership::WeightInfo; } // 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, - >; + 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, + >; +} + +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! { @@ -648,6 +699,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, @@ -689,58 +744,60 @@ pub type SignedBlock = generic::SignedBlock; pub type BlockId = generic::BlockId; /// The SignedExtension to the basic transaction logic. pub type SignedExtra = ( - frame_system::CheckNonZeroSender, - frame_system::CheckSpecVersion, - frame_system::CheckTxVersion, - frame_system::CheckGenesis, - frame_system::CheckEra, - frame_system::CheckNonce, - frame_system::CheckWeight, - pallet_asset_tx_payment::ChargeAssetTxPayment, + frame_system::CheckNonZeroSender, + frame_system::CheckSpecVersion, + frame_system::CheckTxVersion, + frame_system::CheckGenesis, + frame_system::CheckEra, + frame_system::CheckNonce, + frame_system::CheckWeight, + pallet_asset_tx_payment::ChargeAssetTxPayment, ); /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = - generic::UncheckedExtrinsic; +generic::UncheckedExtrinsic; /// Extrinsic type that has already been checked. pub type CheckedExtrinsic = generic::CheckedExtrinsic; /// Migrations to apply on runtime upgrade. pub type Migrations = ( - // 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 - // 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, - cumulus_pallet_xcmp_queue::migration::v4::MigrationToV4, - pallet_encointer_ceremonies::migrations::v2::MigrateToV2, - // permanent - pallet_xcm::migration::MigrateToLatestXcmVersion, + // 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 + // 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, + cumulus_pallet_xcmp_queue::migration::v4::MigrationToV4, + pallet_encointer_ceremonies::migrations::v2::MigrateToV2, + // permanent + pallet_xcm::migration::MigrateToLatestXcmVersion, ); /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< - Runtime, - Block, - frame_system::ChainContext, - Runtime, - AllPalletsWithSystem, - Migrations, + Runtime, + Block, + frame_system::ChainContext, + Runtime, + AllPalletsWithSystem, + Migrations, >; #[cfg(feature = "runtime-benchmarks")] mod benches { - frame_benchmarking::define_benchmarks!( + frame_benchmarking::define_benchmarks!( [frame_system, SystemBench::] [pallet_balances, Balances] [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] @@ -977,6 +1034,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); @@ -990,7 +1048,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> { @@ -1037,284 +1096,284 @@ cumulus_pallet_parachain_system::register_validate_block! { /// but it avoids potential collisions caused by different versions of crates. #[cfg(feature = "std")] pub fn aura_config_for_chain_spec(seeds: &[&str]) -> AuraConfig { - use sp_core::{ - crypto::{Pair, Public}, - sr25519, - }; - fn get_from_seed(seed: &str) -> ::Public { - TPublic::Pair::from_string(&format!("//{}", seed), None) - .expect("static values are valid; qed") - .public() - } - - AuraConfig { - authorities: seeds.iter().map(|s| get_from_seed::(s).into()).collect(), - } + use sp_core::{ + crypto::{Pair, Public}, + sr25519, + }; + fn get_from_seed(seed: &str) -> ::Public { + TPublic::Pair::from_string(&format!("//{}", seed), None) + .expect("static values are valid; qed") + .public() + } + + AuraConfig { + authorities: seeds.iter().map(|s| get_from_seed::(s).into()).collect(), + } } #[cfg(test)] mod multiplier_tests { - use super::*; - use frame_support::pallet_prelude::PalletInfoAccess; + 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 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; - let encointer_ed = ExistentialDeposit::get(); - assert_eq!(relay_ed / 10, encointer_ed); + let relay_ed = kusama_runtime_constants::currency::EXISTENTIAL_DEPOSIT; + let encointer_ed = ExistentialDeposit::get(); + assert_eq!(relay_ed / 10, encointer_ed); } #[test] fn test_constants_compatiblity() { - assert_eq!( - ::kusama_runtime_constants::currency::EXISTENTIAL_DEPOSIT, - system_parachains_constants::kusama_runtime_constants::currency::EXISTENTIAL_DEPOSIT - ); - assert_eq!( - ::kusama_runtime_constants::currency::deposit(5, 3), - system_parachains_constants::kusama_runtime_constants::currency::deposit(5, 3) - ); - assert_eq!( - ::system_parachains_constants::AVERAGE_ON_INITIALIZE_RATIO * 1u32, - system_parachains_constants::AVERAGE_ON_INITIALIZE_RATIO * 1u32 - ); - assert_eq!( - ::system_parachains_constants::NORMAL_DISPATCH_RATIO * 1u32, - system_parachains_constants::NORMAL_DISPATCH_RATIO * 1u32 - ); - assert_eq!( - ::system_parachains_constants::MAXIMUM_BLOCK_WEIGHT.encode(), - system_parachains_constants::MAXIMUM_BLOCK_WEIGHT.encode() - ); - assert_eq!(::system_parachains_constants::MINUTES, system_parachains_constants::MINUTES); - assert_eq!(::system_parachains_constants::HOURS, system_parachains_constants::HOURS); - assert_eq!(::system_parachains_constants::DAYS, system_parachains_constants::DAYS); - assert_eq!( - ::system_parachains_constants::kusama::currency::SYSTEM_PARA_EXISTENTIAL_DEPOSIT, - system_parachains_constants::kusama::currency::SYSTEM_PARA_EXISTENTIAL_DEPOSIT - ); - assert_eq!( - ::system_parachains_constants::kusama::currency::UNITS, - system_parachains_constants::kusama::currency::UNITS - ); - assert_eq!( - ::system_parachains_constants::kusama::currency::QUID, - system_parachains_constants::kusama::currency::QUID - ); - assert_eq!( - ::system_parachains_constants::kusama::currency::CENTS, - system_parachains_constants::kusama::currency::CENTS - ); - assert_eq!( - ::system_parachains_constants::kusama::currency::MILLICENTS, - system_parachains_constants::kusama::currency::MILLICENTS - ); - assert_eq!( - ::system_parachains_constants::kusama::currency::system_para_deposit(5, 3), - system_parachains_constants::kusama::currency::system_para_deposit(5, 3) - ); - assert_eq!( - ::system_parachains_constants::kusama::fee::TRANSACTION_BYTE_FEE, - system_parachains_constants::kusama::fee::TRANSACTION_BYTE_FEE - ); - assert_eq!( - ::system_parachains_constants::kusama::fee::calculate_weight_to_fee( - &::system_parachains_constants::MAXIMUM_BLOCK_WEIGHT - ), - system_parachains_constants::kusama::fee::calculate_weight_to_fee( - &system_parachains_constants::MAXIMUM_BLOCK_WEIGHT - ) - ); + assert_eq!( + ::kusama_runtime_constants::currency::EXISTENTIAL_DEPOSIT, + system_parachains_constants::kusama_runtime_constants::currency::EXISTENTIAL_DEPOSIT + ); + assert_eq!( + ::kusama_runtime_constants::currency::deposit(5, 3), + system_parachains_constants::kusama_runtime_constants::currency::deposit(5, 3) + ); + assert_eq!( + ::system_parachains_constants::AVERAGE_ON_INITIALIZE_RATIO * 1u32, + system_parachains_constants::AVERAGE_ON_INITIALIZE_RATIO * 1u32 + ); + assert_eq!( + ::system_parachains_constants::NORMAL_DISPATCH_RATIO * 1u32, + system_parachains_constants::NORMAL_DISPATCH_RATIO * 1u32 + ); + assert_eq!( + ::system_parachains_constants::MAXIMUM_BLOCK_WEIGHT.encode(), + system_parachains_constants::MAXIMUM_BLOCK_WEIGHT.encode() + ); + assert_eq!(::system_parachains_constants::MINUTES, system_parachains_constants::MINUTES); + assert_eq!(::system_parachains_constants::HOURS, system_parachains_constants::HOURS); + assert_eq!(::system_parachains_constants::DAYS, system_parachains_constants::DAYS); + assert_eq!( + ::system_parachains_constants::kusama::currency::SYSTEM_PARA_EXISTENTIAL_DEPOSIT, + system_parachains_constants::kusama::currency::SYSTEM_PARA_EXISTENTIAL_DEPOSIT + ); + assert_eq!( + ::system_parachains_constants::kusama::currency::UNITS, + system_parachains_constants::kusama::currency::UNITS + ); + assert_eq!( + ::system_parachains_constants::kusama::currency::QUID, + system_parachains_constants::kusama::currency::QUID + ); + assert_eq!( + ::system_parachains_constants::kusama::currency::CENTS, + system_parachains_constants::kusama::currency::CENTS + ); + assert_eq!( + ::system_parachains_constants::kusama::currency::MILLICENTS, + system_parachains_constants::kusama::currency::MILLICENTS + ); + assert_eq!( + ::system_parachains_constants::kusama::currency::system_para_deposit(5, 3), + system_parachains_constants::kusama::currency::system_para_deposit(5, 3) + ); + assert_eq!( + ::system_parachains_constants::kusama::fee::TRANSACTION_BYTE_FEE, + system_parachains_constants::kusama::fee::TRANSACTION_BYTE_FEE + ); + assert_eq!( + ::system_parachains_constants::kusama::fee::calculate_weight_to_fee( + &::system_parachains_constants::MAXIMUM_BLOCK_WEIGHT + ), + system_parachains_constants::kusama::fee::calculate_weight_to_fee( + &system_parachains_constants::MAXIMUM_BLOCK_WEIGHT + ) + ); } #[test] fn test_transasction_byte_fee_is_one_tenth_of_relay() { - let relay_tbf = ::kusama_runtime_constants::fee::TRANSACTION_BYTE_FEE; - let parachain_tbf = TransactionByteFee::get(); - assert_eq!(relay_tbf / 10, parachain_tbf); + let relay_tbf = ::kusama_runtime_constants::fee::TRANSACTION_BYTE_FEE; + let parachain_tbf = TransactionByteFee::get(); + assert_eq!(relay_tbf / 10, parachain_tbf); } // The Encointer pallets do not have compatible versions with `polkadot-sdk`, making it difficult // for us to reuse the `system-parachains-constants` module. Therefore, we have copies of it here // with `test_constants_compatiblity`. mod system_parachains_constants { - use super::*; - use frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND; - - /// This determines the average expected block time that we are targeting. Blocks will be - /// produced at a minimum duration defined by `SLOT_DURATION`. `SLOT_DURATION` is picked up by - /// `pallet_timestamp` which is in turn picked up by `pallet_aura` to implement `fn - /// slot_duration()`. - /// - /// Change this to adjust the block time. - pub const MILLISECS_PER_BLOCK: u64 = 12000; - pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK; - - // Time is measured by number of blocks. - pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber); - pub const HOURS: BlockNumber = MINUTES * 60; - pub const DAYS: BlockNumber = HOURS * 24; - - /// We assume that ~5% of the block weight is consumed by `on_initialize` handlers. This is - /// used to limit the maximal weight of a single extrinsic. - pub const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5); - /// We allow `Normal` extrinsics to fill up the block up to 75%, the rest can be used by - /// Operational extrinsics. - pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); - - /// We allow for 0.5 seconds of compute with a 6 second average block time. - pub const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts( - WEIGHT_REF_TIME_PER_SECOND.saturating_div(2), - polkadot_primitives::MAX_POV_SIZE as u64, - ); - - pub(crate) mod kusama { - /// Consensus-related. - pub mod consensus { - /// Maximum number of blocks simultaneously accepted by the Runtime, not yet included - /// into the relay chain. - pub const UNINCLUDED_SEGMENT_CAPACITY: u32 = 1; - /// How many parachain blocks are processed by the relay chain per parent. Limits the - /// number of blocks authored per slot. - pub const BLOCK_PROCESSING_VELOCITY: u32 = 1; - /// Relay chain slot duration, in milliseconds. - pub const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32 = 6000; - } - - /// Constants relating to KSM. - pub mod currency { - use super::super::kusama_runtime_constants; - use polkadot_core_primitives::Balance; - - /// The default existential deposit for system chains. 1/10th of the Relay Chain's - /// existential deposit. Individual system parachains may modify this in special cases. - pub const SYSTEM_PARA_EXISTENTIAL_DEPOSIT: Balance = - kusama_runtime_constants::currency::EXISTENTIAL_DEPOSIT / 10; - - /// One "KSM" that a UI would show a user. - pub const UNITS: Balance = 1_000_000_000_000; - pub const QUID: Balance = UNITS / 30; - pub const CENTS: Balance = QUID / 100; - pub const MILLICENTS: Balance = CENTS / 1_000; - - /// Deposit rate for stored data. 1/100th of the Relay Chain's deposit rate. `items` is - /// the number of keys in storage and `bytes` is the size of the value. - pub const fn system_para_deposit(items: u32, bytes: u32) -> Balance { - kusama_runtime_constants::currency::deposit(items, bytes) / 100 - } - } - - /// Constants related to Kusama fee payment. - pub mod fee { - use frame_support::{ - pallet_prelude::Weight, - weights::{ - constants::ExtrinsicBaseWeight, FeePolynomial, WeightToFeeCoefficient, - WeightToFeeCoefficients, WeightToFeePolynomial, - }, - }; - use polkadot_core_primitives::Balance; - use smallvec::smallvec; - pub use sp_runtime::Perbill; - - /// Cost of every transaction byte at Kusama system parachains. - /// - /// It is the Relay Chain (Kusama) `TransactionByteFee` / 10. - pub const TRANSACTION_BYTE_FEE: Balance = super::currency::MILLICENTS; - - /// Handles converting a weight scalar to a fee value, based on the scale and - /// granularity of the node's balance type. - /// - /// This should typically create a mapping between the following ranges: - /// - [0, MAXIMUM_BLOCK_WEIGHT] - /// - [Balance::min, Balance::max] - /// - /// Yet, it can be used for any other sort of change to weight-fee. Some examples being: - /// - Setting it to `0` will essentially disable the weight fee. - /// - Setting it to `1` will cause the literal `#[weight = x]` values to be charged. - pub struct WeightToFee; - - impl frame_support::weights::WeightToFee for WeightToFee { - type Balance = Balance; - - fn weight_to_fee(weight: &Weight) -> Self::Balance { - let time_poly: FeePolynomial = RefTimeToFee::polynomial().into(); - let proof_poly: FeePolynomial = ProofSizeToFee::polynomial().into(); - - // Take the maximum instead of the sum to charge by the more scarce resource. - time_poly.eval(weight.ref_time()).max(proof_poly.eval(weight.proof_size())) - } - } - - /// Maps the reference time component of `Weight` to a fee. - pub struct RefTimeToFee; - - impl WeightToFeePolynomial for RefTimeToFee { - type Balance = Balance; - fn polynomial() -> WeightToFeeCoefficients { - // In Kusama, extrinsic base weight (smallest non-zero weight) is mapped to 1/10 - // CENT: The standard system parachain configuration is 1/10 of that, as in - // 1/100 CENT. - let p = super::currency::CENTS; - let q = 100 * Balance::from(ExtrinsicBaseWeight::get().ref_time()); - - smallvec![WeightToFeeCoefficient { + use super::*; + use frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND; + + /// This determines the average expected block time that we are targeting. Blocks will be + /// produced at a minimum duration defined by `SLOT_DURATION`. `SLOT_DURATION` is picked up by + /// `pallet_timestamp` which is in turn picked up by `pallet_aura` to implement `fn + /// slot_duration()`. + /// + /// Change this to adjust the block time. + pub const MILLISECS_PER_BLOCK: u64 = 12000; + pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK; + + // Time is measured by number of blocks. + pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber); + pub const HOURS: BlockNumber = MINUTES * 60; + pub const DAYS: BlockNumber = HOURS * 24; + + /// We assume that ~5% of the block weight is consumed by `on_initialize` handlers. This is + /// used to limit the maximal weight of a single extrinsic. + pub const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5); + /// We allow `Normal` extrinsics to fill up the block up to 75%, the rest can be used by + /// Operational extrinsics. + pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); + + /// We allow for 0.5 seconds of compute with a 6 second average block time. + pub const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts( + WEIGHT_REF_TIME_PER_SECOND.saturating_div(2), + polkadot_primitives::MAX_POV_SIZE as u64, + ); + + pub(crate) mod kusama { + /// Consensus-related. + pub mod consensus { + /// Maximum number of blocks simultaneously accepted by the Runtime, not yet included + /// into the relay chain. + pub const UNINCLUDED_SEGMENT_CAPACITY: u32 = 1; + /// How many parachain blocks are processed by the relay chain per parent. Limits the + /// number of blocks authored per slot. + pub const BLOCK_PROCESSING_VELOCITY: u32 = 1; + /// Relay chain slot duration, in milliseconds. + pub const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32 = 6000; + } + + /// Constants relating to KSM. + pub mod currency { + use super::super::kusama_runtime_constants; + use polkadot_core_primitives::Balance; + + /// The default existential deposit for system chains. 1/10th of the Relay Chain's + /// existential deposit. Individual system parachains may modify this in special cases. + pub const SYSTEM_PARA_EXISTENTIAL_DEPOSIT: Balance = + kusama_runtime_constants::currency::EXISTENTIAL_DEPOSIT / 10; + + /// One "KSM" that a UI would show a user. + pub const UNITS: Balance = 1_000_000_000_000; + pub const QUID: Balance = UNITS / 30; + pub const CENTS: Balance = QUID / 100; + pub const MILLICENTS: Balance = CENTS / 1_000; + + /// Deposit rate for stored data. 1/100th of the Relay Chain's deposit rate. `items` is + /// the number of keys in storage and `bytes` is the size of the value. + pub const fn system_para_deposit(items: u32, bytes: u32) -> Balance { + kusama_runtime_constants::currency::deposit(items, bytes) / 100 + } + } + + /// Constants related to Kusama fee payment. + pub mod fee { + use frame_support::{ + pallet_prelude::Weight, + weights::{ + constants::ExtrinsicBaseWeight, FeePolynomial, WeightToFeeCoefficient, + WeightToFeeCoefficients, WeightToFeePolynomial, + }, + }; + use polkadot_core_primitives::Balance; + use smallvec::smallvec; + pub use sp_runtime::Perbill; + + /// Cost of every transaction byte at Kusama system parachains. + /// + /// It is the Relay Chain (Kusama) `TransactionByteFee` / 10. + pub const TRANSACTION_BYTE_FEE: Balance = super::currency::MILLICENTS; + + /// Handles converting a weight scalar to a fee value, based on the scale and + /// granularity of the node's balance type. + /// + /// This should typically create a mapping between the following ranges: + /// - [0, MAXIMUM_BLOCK_WEIGHT] + /// - [Balance::min, Balance::max] + /// + /// Yet, it can be used for any other sort of change to weight-fee. Some examples being: + /// - Setting it to `0` will essentially disable the weight fee. + /// - Setting it to `1` will cause the literal `#[weight = x]` values to be charged. + pub struct WeightToFee; + + impl frame_support::weights::WeightToFee for WeightToFee { + type Balance = Balance; + + fn weight_to_fee(weight: &Weight) -> Self::Balance { + let time_poly: FeePolynomial = RefTimeToFee::polynomial().into(); + let proof_poly: FeePolynomial = ProofSizeToFee::polynomial().into(); + + // Take the maximum instead of the sum to charge by the more scarce resource. + time_poly.eval(weight.ref_time()).max(proof_poly.eval(weight.proof_size())) + } + } + + /// Maps the reference time component of `Weight` to a fee. + pub struct RefTimeToFee; + + impl WeightToFeePolynomial for RefTimeToFee { + type Balance = Balance; + fn polynomial() -> WeightToFeeCoefficients { + // In Kusama, extrinsic base weight (smallest non-zero weight) is mapped to 1/10 + // CENT: The standard system parachain configuration is 1/10 of that, as in + // 1/100 CENT. + let p = super::currency::CENTS; + let q = 100 * Balance::from(ExtrinsicBaseWeight::get().ref_time()); + + smallvec![WeightToFeeCoefficient { degree: 1, negative: false, coeff_frac: Perbill::from_rational(p % q, q), coeff_integer: p / q, }] - } - } + } + } - /// Maps the proof size component of `Weight` to a fee. - pub struct ProofSizeToFee; + /// Maps the proof size component of `Weight` to a fee. + pub struct ProofSizeToFee; - impl WeightToFeePolynomial for ProofSizeToFee { - type Balance = Balance; - fn polynomial() -> WeightToFeeCoefficients { - // Map 10kb proof to 1 CENT. - let p = super::currency::CENTS; - let q = 10_000; + impl WeightToFeePolynomial for ProofSizeToFee { + type Balance = Balance; + fn polynomial() -> WeightToFeeCoefficients { + // Map 10kb proof to 1 CENT. + let p = super::currency::CENTS; + let q = 10_000; - smallvec![WeightToFeeCoefficient { + smallvec![WeightToFeeCoefficient { degree: 1, negative: false, coeff_frac: Perbill::from_rational(p % q, q), coeff_integer: p / q, }] - } - } - - #[cfg(test)] - pub fn calculate_weight_to_fee(weight: &Weight) -> Balance { - ::weight_to_fee(weight) - } - } - } - - pub(crate) mod kusama_runtime_constants { - /// Money matters. - pub mod currency { - use polkadot_primitives::Balance; - - /// The existential deposit. - pub const EXISTENTIAL_DEPOSIT: Balance = 1 * CENTS; - - pub const UNITS: Balance = 1_000_000_000_000; - pub const QUID: Balance = UNITS / 30; - pub const CENTS: Balance = QUID / 100; - pub const MILLICENTS: Balance = CENTS / 1_000; - - pub const fn deposit(items: u32, bytes: u32) -> Balance { - items as Balance * 2_000 * CENTS + (bytes as Balance) * 100 * MILLICENTS - } - } - } + } + } + + #[cfg(test)] + pub fn calculate_weight_to_fee(weight: &Weight) -> Balance { + ::weight_to_fee(weight) + } + } + } + + pub(crate) mod kusama_runtime_constants { + /// Money matters. + pub mod currency { + use polkadot_primitives::Balance; + + /// The existential deposit. + pub const EXISTENTIAL_DEPOSIT: Balance = 1 * CENTS; + + pub const UNITS: Balance = 1_000_000_000_000; + pub const QUID: Balance = UNITS / 30; + pub const CENTS: Balance = QUID / 100; + pub const MILLICENTS: Balance = CENTS / 1_000; + + pub const fn deposit(items: u32, bytes: u32) -> Balance { + items as Balance * 2_000 * CENTS + (bytes as Balance) * 100 * MILLICENTS + } + } + } } diff --git a/system-parachains/encointer/src/weights/mod.rs b/system-parachains/encointer/src/weights/mod.rs index ec61f38ee0..047a446f40 100644 --- a/system-parachains/encointer/src/weights/mod.rs +++ b/system-parachains/encointer/src/weights/mod.rs @@ -26,6 +26,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; @@ -37,6 +38,7 @@ 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; 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)) + } +} From 87157967fb64e40ee73072352047e05e87fe70bd Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Tue, 9 Apr 2024 16:17:05 +0200 Subject: [PATCH 02/29] remove DMP queue pallet --- Cargo.lock | 1 - system-parachains/encointer/Cargo.toml | 4 - system-parachains/encointer/src/lib.rs | 11 +- .../src/weights/cumulus_pallet_dmp_queue.rs | 129 ------------------ .../encointer/src/weights/mod.rs | 1 - 5 files changed, 1 insertion(+), 145 deletions(-) delete mode 100644 system-parachains/encointer/src/weights/cumulus_pallet_dmp_queue.rs diff --git a/Cargo.lock b/Cargo.lock index d40b91d724..d425ea5b76 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3548,7 +3548,6 @@ name = "encointer-kusama-runtime" version = "1.0.0" dependencies = [ "cumulus-pallet-aura-ext", - "cumulus-pallet-dmp-queue", "cumulus-pallet-parachain-system", "cumulus-pallet-xcm", "cumulus-pallet-xcmp-queue", diff --git a/system-parachains/encointer/Cargo.toml b/system-parachains/encointer/Cargo.toml index 9c10924868..3215b63f20 100644 --- a/system-parachains/encointer/Cargo.toml +++ b/system-parachains/encointer/Cargo.toml @@ -91,7 +91,6 @@ xcm-executor = { package = "staging-xcm-executor", default-features = false, ver # Cumulus dependencies cumulus-pallet-aura-ext = { workspace = true } -cumulus-pallet-dmp-queue = { workspace = true } cumulus-pallet-parachain-system = { features = [ "parameterized-consensus-hook", ], workspace = true } @@ -120,7 +119,6 @@ system-parachains-constants = { path = "../constants" } [features] default = ["std"] runtime-benchmarks = [ - "cumulus-pallet-dmp-queue/runtime-benchmarks", "cumulus-pallet-xcmp-queue/runtime-benchmarks", "cumulus-pallet-parachain-system/runtime-benchmarks", "frame-benchmarking/runtime-benchmarks", @@ -162,7 +160,6 @@ runtime-benchmarks = [ std = [ "codec/std", "cumulus-pallet-aura-ext/std", - "cumulus-pallet-dmp-queue/std", "cumulus-pallet-parachain-system/std", "cumulus-pallet-xcm/std", "cumulus-pallet-xcmp-queue/std", @@ -237,7 +234,6 @@ std = [ try-runtime = [ "cumulus-pallet-aura-ext/try-runtime", - "cumulus-pallet-dmp-queue/try-runtime", "cumulus-pallet-parachain-system/try-runtime", "cumulus-pallet-xcm/try-runtime", "cumulus-pallet-xcmp-queue/try-runtime", diff --git a/system-parachains/encointer/src/lib.rs b/system-parachains/encointer/src/lib.rs index 1c936e0636..a029fe8b54 100644 --- a/system-parachains/encointer/src/lib.rs +++ b/system-parachains/encointer/src/lib.rs @@ -75,7 +75,7 @@ pub use pallet_encointer_communities::Call as EncointerCommunitiesCall; 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, IsVoiceOfBody}; +use pallet_xcm::{EnsureXcm, IsMajorityOfBody}; pub use parachains_common::{ impls::DealWithFees, AccountId, AssetIdForTrustBackedAssets, AuraId, Balance, BlockNumber, Hash, Header, Nonce, Signature, @@ -479,13 +479,6 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { type PriceForSiblingDelivery = PriceForSiblingParachainDelivery; } -// TODO: remove dmp with 1.3.0 (https://github.com/polkadot-fellows/runtimes/issues/186) -impl cumulus_pallet_dmp_queue::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type WeightInfo = weights::cumulus_pallet_dmp_queue::WeightInfo; - type DmpSink = frame_support::traits::EnqueueWithOrigin; -} - parameter_types! { pub MessageQueueServiceWeight: Weight = Perbill::from_percent(35) * RuntimeBlockWeights::get().max_block; } @@ -710,8 +703,6 @@ construct_runtime! { XcmpQueue: cumulus_pallet_xcmp_queue = 30, PolkadotXcm: pallet_xcm = 31, CumulusXcm: cumulus_pallet_xcm = 32, - // TODO: remove dmp with 1.3.0 (https://github.com/polkadot-fellows/runtimes/issues/186) - DmpQueue: cumulus_pallet_dmp_queue = 33, MessageQueue: pallet_message_queue = 35, // Handy utilities. diff --git a/system-parachains/encointer/src/weights/cumulus_pallet_dmp_queue.rs b/system-parachains/encointer/src/weights/cumulus_pallet_dmp_queue.rs deleted file mode 100644 index 7c7514fd84..0000000000 --- a/system-parachains/encointer/src/weights/cumulus_pallet_dmp_queue.rs +++ /dev/null @@ -1,129 +0,0 @@ -// 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 `cumulus_pallet_dmp_queue` -//! -//! 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("./encointer-kusama-chain-spec.json")`, DB CACHE: 1024 - -// Executed Command: -// ./target/production/polkadot -// benchmark -// pallet -// --chain=./encointer-kusama-chain-spec.json -// --steps=50 -// --repeat=20 -// --pallet=cumulus_pallet_dmp_queue -// --extrinsic=* -// --wasm-execution=compiled -// --heap-pages=4096 -// --output=./encointer-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 `cumulus_pallet_dmp_queue`. -pub struct WeightInfo(PhantomData); -impl cumulus_pallet_dmp_queue::WeightInfo for WeightInfo { - /// Storage: `DmpQueue::MigrationStatus` (r:1 w:1) - /// Proof: `DmpQueue::MigrationStatus` (`max_values`: Some(1), `max_size`: Some(1028), added: 1523, mode: `MaxEncodedLen`) - /// Storage: UNKNOWN KEY `0xcd5c1f6df63bc97f4a8ce37f14a50ca754904d6d8c6fe06c4e5965f9b8397421` (r:1 w:0) - /// Proof: UNKNOWN KEY `0xcd5c1f6df63bc97f4a8ce37f14a50ca754904d6d8c6fe06c4e5965f9b8397421` (r:1 w:0) - /// Storage: UNKNOWN KEY `0xcd5c1f6df63bc97f4a8ce37f14a50ca7d95d3e948effbeccff2de2c182672836` (r:1 w:1) - /// Proof: UNKNOWN KEY `0xcd5c1f6df63bc97f4a8ce37f14a50ca7d95d3e948effbeccff2de2c182672836` (r:1 w:1) - /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) - /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) - /// Storage: `MessageQueue::ServiceHead` (r:1 w:1) - /// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) - /// Storage: `MessageQueue::Pages` (r:0 w:1) - /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(65585), added: 68060, mode: `MaxEncodedLen`) - fn on_idle_good_msg() -> Weight { - // Proof Size summary in bytes: - // Measured: `65697` - // Estimated: `69162` - // Minimum execution time: 140_937_000 picoseconds. - Weight::from_parts(146_081_000, 0) - .saturating_add(Weight::from_parts(0, 69162)) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(5)) - } - /// Storage: `DmpQueue::MigrationStatus` (r:1 w:1) - /// Proof: `DmpQueue::MigrationStatus` (`max_values`: Some(1), `max_size`: Some(1028), added: 1523, mode: `MaxEncodedLen`) - /// Storage: UNKNOWN KEY `0xcd5c1f6df63bc97f4a8ce37f14a50ca754904d6d8c6fe06c4e5965f9b8397421` (r:1 w:0) - /// Proof: UNKNOWN KEY `0xcd5c1f6df63bc97f4a8ce37f14a50ca754904d6d8c6fe06c4e5965f9b8397421` (r:1 w:0) - /// Storage: UNKNOWN KEY `0xcd5c1f6df63bc97f4a8ce37f14a50ca7d95d3e948effbeccff2de2c182672836` (r:1 w:1) - /// Proof: UNKNOWN KEY `0xcd5c1f6df63bc97f4a8ce37f14a50ca7d95d3e948effbeccff2de2c182672836` (r:1 w:1) - fn on_idle_large_msg() -> Weight { - // Proof Size summary in bytes: - // Measured: `65660` - // Estimated: `69125` - // Minimum execution time: 69_001_000 picoseconds. - Weight::from_parts(69_783_000, 0) - .saturating_add(Weight::from_parts(0, 69125)) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: `DmpQueue::MigrationStatus` (r:1 w:1) - /// Proof: `DmpQueue::MigrationStatus` (`max_values`: Some(1), `max_size`: Some(1028), added: 1523, mode: `MaxEncodedLen`) - /// Storage: UNKNOWN KEY `0xcd5c1f6df63bc97f4a8ce37f14a50ca754904d6d8c6fe06c4e5965f9b8397421` (r:1 w:0) - /// Proof: UNKNOWN KEY `0xcd5c1f6df63bc97f4a8ce37f14a50ca754904d6d8c6fe06c4e5965f9b8397421` (r:1 w:0) - /// Storage: UNKNOWN KEY `0xcd5c1f6df63bc97f4a8ce37f14a50ca70f923ef3252d0166429d36d20ed665a8` (r:1 w:1) - /// Proof: UNKNOWN KEY `0xcd5c1f6df63bc97f4a8ce37f14a50ca70f923ef3252d0166429d36d20ed665a8` (r:1 w:1) - /// Storage: UNKNOWN KEY `0xcd5c1f6df63bc97f4a8ce37f14a50ca772275f64c354954352b71eea39cfaca2` (r:1 w:1) - /// Proof: UNKNOWN KEY `0xcd5c1f6df63bc97f4a8ce37f14a50ca772275f64c354954352b71eea39cfaca2` (r:1 w:1) - /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) - /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) - /// Storage: `MessageQueue::ServiceHead` (r:1 w:1) - /// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) - /// Storage: `MessageQueue::Pages` (r:0 w:1) - /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(65585), added: 68060, mode: `MaxEncodedLen`) - fn on_idle_overweight_good_msg() -> Weight { - // Proof Size summary in bytes: - // Measured: `65727` - // Estimated: `69192` - // Minimum execution time: 119_383_000 picoseconds. - Weight::from_parts(120_255_000, 0) - .saturating_add(Weight::from_parts(0, 69192)) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(6)) - } - /// Storage: `DmpQueue::MigrationStatus` (r:1 w:1) - /// Proof: `DmpQueue::MigrationStatus` (`max_values`: Some(1), `max_size`: Some(1028), added: 1523, mode: `MaxEncodedLen`) - /// Storage: UNKNOWN KEY `0xcd5c1f6df63bc97f4a8ce37f14a50ca754904d6d8c6fe06c4e5965f9b8397421` (r:1 w:0) - /// Proof: UNKNOWN KEY `0xcd5c1f6df63bc97f4a8ce37f14a50ca754904d6d8c6fe06c4e5965f9b8397421` (r:1 w:0) - /// Storage: UNKNOWN KEY `0xcd5c1f6df63bc97f4a8ce37f14a50ca70f923ef3252d0166429d36d20ed665a8` (r:1 w:1) - /// Proof: UNKNOWN KEY `0xcd5c1f6df63bc97f4a8ce37f14a50ca70f923ef3252d0166429d36d20ed665a8` (r:1 w:1) - /// Storage: UNKNOWN KEY `0xcd5c1f6df63bc97f4a8ce37f14a50ca772275f64c354954352b71eea39cfaca2` (r:1 w:1) - /// Proof: UNKNOWN KEY `0xcd5c1f6df63bc97f4a8ce37f14a50ca772275f64c354954352b71eea39cfaca2` (r:1 w:1) - fn on_idle_overweight_large_msg() -> Weight { - // Proof Size summary in bytes: - // Measured: `65690` - // Estimated: `69155` - // Minimum execution time: 55_657_000 picoseconds. - Weight::from_parts(57_245_000, 0) - .saturating_add(Weight::from_parts(0, 69155)) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(3)) - } -} diff --git a/system-parachains/encointer/src/weights/mod.rs b/system-parachains/encointer/src/weights/mod.rs index 047a446f40..1d36525972 100644 --- a/system-parachains/encointer/src/weights/mod.rs +++ b/system-parachains/encointer/src/weights/mod.rs @@ -20,7 +20,6 @@ #![allow(clippy::all)] pub mod block_weights; -pub mod cumulus_pallet_dmp_queue; pub mod cumulus_pallet_parachain_system; pub mod cumulus_pallet_xcmp_queue; pub mod extrinsic_weights; From f70d07dcb857b6a4bbec3a4ee234a34a2796e1ee Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Tue, 9 Apr 2024 16:21:42 +0200 Subject: [PATCH 03/29] add encointer invulnerables for testnet genesis --- .../src/system_parachains_specs.rs | 521 +++++++++--------- 1 file changed, 263 insertions(+), 258 deletions(-) diff --git a/chain-spec-generator/src/system_parachains_specs.rs b/chain-spec-generator/src/system_parachains_specs.rs index 3c2f0c40d2..8d84e41ac4 100644 --- a/chain-spec-generator/src/system_parachains_specs.rs +++ b/chain-spec-generator/src/system_parachains_specs.rs @@ -26,10 +26,10 @@ use sp_core::sr25519; #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, ChainSpecGroup, ChainSpecExtension)] #[serde(deny_unknown_fields)] pub struct Extensions { - /// The relay chain of the Parachain. - pub relay_chain: String, - /// The id of the Parachain. - pub para_id: u32, + /// The relay chain of the Parachain. + pub relay_chain: String, + /// The id of the Parachain. + pub para_id: u32, } pub type AssetHubPolkadotChainSpec = sc_chain_spec::GenericChainSpec<(), Extensions>; @@ -71,86 +71,86 @@ const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION; /// Invulnerable Collators pub fn invulnerables() -> Vec<(AccountId, AuraId)> { - vec![ - (get_account_id_from_seed::("Alice"), get_from_seed::("Alice")), - (get_account_id_from_seed::("Bob"), get_from_seed::("Bob")), - ] + vec![ + (get_account_id_from_seed::("Alice"), get_from_seed::("Alice")), + (get_account_id_from_seed::("Bob"), get_from_seed::("Bob")), + ] } /// Invulnerable Collators for the particular case of AssetHubPolkadot pub fn invulnerables_asset_hub_polkadot() -> Vec<(AccountId, AssetHubPolkadotAuraId)> { - vec![ - ( - get_account_id_from_seed::("Alice"), - get_from_seed::("Alice"), - ), - ( - get_account_id_from_seed::("Bob"), - get_from_seed::("Bob"), - ), - ] + vec![ + ( + get_account_id_from_seed::("Alice"), + get_from_seed::("Alice"), + ), + ( + get_account_id_from_seed::("Bob"), + get_from_seed::("Bob"), + ), + ] } /// Generate the session keys from individual elements. /// /// The input must be a tuple of individual keys (a single arg for now since we have just one key). pub fn coretime_kusama_session_keys(keys: AuraId) -> coretime_kusama_runtime::SessionKeys { - coretime_kusama_runtime::SessionKeys { aura: keys } + coretime_kusama_runtime::SessionKeys { aura: keys } } /// Generate the session keys from individual elements. /// /// The input must be a tuple of individual keys (a single arg for now since we have just one key). pub fn asset_hub_polkadot_session_keys( - keys: AssetHubPolkadotAuraId, + keys: AssetHubPolkadotAuraId, ) -> asset_hub_polkadot_runtime::SessionKeys { - asset_hub_polkadot_runtime::SessionKeys { aura: keys } + asset_hub_polkadot_runtime::SessionKeys { aura: keys } } /// Generate the session keys from individual elements. /// /// The input must be a tuple of individual keys (a single arg for now since we have just one key). pub fn asset_hub_kusama_session_keys(keys: AuraId) -> asset_hub_kusama_runtime::SessionKeys { - asset_hub_kusama_runtime::SessionKeys { aura: keys } + asset_hub_kusama_runtime::SessionKeys { aura: keys } } /// Generate the session keys from individual elements. /// /// The input must be a tuple of individual keys (a single arg for now since we have just one key). pub fn collectives_polkadot_session_keys( - keys: AuraId, + keys: AuraId, ) -> collectives_polkadot_runtime::SessionKeys { - collectives_polkadot_runtime::SessionKeys { aura: keys } + collectives_polkadot_runtime::SessionKeys { aura: keys } } /// Generate the session keys from individual elements. /// /// The input must be a tuple of individual keys (a single arg for now since we have just one key). pub fn bridge_hub_polkadot_session_keys(keys: AuraId) -> bridge_hub_polkadot_runtime::SessionKeys { - bridge_hub_polkadot_runtime::SessionKeys { aura: keys } + bridge_hub_polkadot_runtime::SessionKeys { aura: keys } } /// Generate the session keys from individual elements. /// /// The input must be a tuple of individual keys (a single arg for now since we have just one key). pub fn bridge_hub_kusama_session_keys(keys: AuraId) -> bridge_hub_kusama_runtime::SessionKeys { - bridge_hub_kusama_runtime::SessionKeys { aura: keys } + bridge_hub_kusama_runtime::SessionKeys { aura: keys } } /// Generate the session keys from individual elements. /// /// The input must be a tuple of individual keys (a single arg for now since we have just one key). pub fn people_kusama_session_keys(keys: AuraId) -> people_kusama_runtime::SessionKeys { - people_kusama_runtime::SessionKeys { aura: keys } + people_kusama_runtime::SessionKeys { aura: keys } } // AssetHubPolkadot fn asset_hub_polkadot_genesis( - invulnerables: Vec<(AccountId, AssetHubPolkadotAuraId)>, - endowed_accounts: Vec, - id: ParaId, + invulnerables: Vec<(AccountId, AssetHubPolkadotAuraId)>, + endowed_accounts: Vec, + id: ParaId, ) -> serde_json::Value { - serde_json::json!({ + serde_json::json!({ "balances": asset_hub_polkadot_runtime::BalancesConfig { balances: endowed_accounts .iter() @@ -188,41 +188,41 @@ fn asset_hub_polkadot_genesis( } fn asset_hub_polkadot_local_genesis(para_id: ParaId) -> serde_json::Value { - asset_hub_polkadot_genesis( - // initial collators. - invulnerables_asset_hub_polkadot(), - testnet_accounts(), - para_id, - ) + asset_hub_polkadot_genesis( + // initial collators. + invulnerables_asset_hub_polkadot(), + testnet_accounts(), + para_id, + ) } pub fn asset_hub_polkadot_local_testnet_config() -> Result, String> { - let mut properties = sc_chain_spec::Properties::new(); - properties.insert("ss58Format".into(), 0.into()); - properties.insert("tokenSymbol".into(), "DOT".into()); - properties.insert("tokenDecimals".into(), 10.into()); - - Ok(Box::new( - AssetHubPolkadotChainSpec::builder( - asset_hub_polkadot_runtime::WASM_BINARY.expect("AssetHubPolkadot wasm not available!"), - Extensions { relay_chain: "polkadot-local".into(), para_id: 1000 }, - ) - .with_name("Polkadot Asset Hub Local") - .with_id("asset-hub-polkadot-local") - .with_chain_type(ChainType::Local) - .with_genesis_config_patch(asset_hub_polkadot_local_genesis(1000.into())) - .with_properties(properties) - .build(), - )) + let mut properties = sc_chain_spec::Properties::new(); + properties.insert("ss58Format".into(), 0.into()); + properties.insert("tokenSymbol".into(), "DOT".into()); + properties.insert("tokenDecimals".into(), 10.into()); + + Ok(Box::new( + AssetHubPolkadotChainSpec::builder( + asset_hub_polkadot_runtime::WASM_BINARY.expect("AssetHubPolkadot wasm not available!"), + Extensions { relay_chain: "polkadot-local".into(), para_id: 1000 }, + ) + .with_name("Polkadot Asset Hub Local") + .with_id("asset-hub-polkadot-local") + .with_chain_type(ChainType::Local) + .with_genesis_config_patch(asset_hub_polkadot_local_genesis(1000.into())) + .with_properties(properties) + .build(), + )) } // AssetHubKusama fn asset_hub_kusama_genesis( - invulnerables: Vec<(AccountId, AuraId)>, - endowed_accounts: Vec, - id: ParaId, + invulnerables: Vec<(AccountId, AuraId)>, + endowed_accounts: Vec, + id: ParaId, ) -> serde_json::Value { - serde_json::json!({ + serde_json::json!({ "balances": asset_hub_kusama_runtime::BalancesConfig { balances: endowed_accounts .iter() @@ -260,41 +260,41 @@ fn asset_hub_kusama_genesis( } fn asset_hub_kusama_local_genesis(para_id: ParaId) -> serde_json::Value { - asset_hub_kusama_genesis( - // initial collators. - invulnerables(), - testnet_accounts(), - para_id, - ) + asset_hub_kusama_genesis( + // initial collators. + invulnerables(), + testnet_accounts(), + para_id, + ) } pub fn asset_hub_kusama_local_testnet_config() -> Result, String> { - let mut properties = sc_chain_spec::Properties::new(); - properties.insert("ss58Format".into(), 2.into()); - properties.insert("tokenSymbol".into(), "KSM".into()); - properties.insert("tokenDecimals".into(), 12.into()); - - Ok(Box::new( - AssetHubKusamaChainSpec::builder( - asset_hub_kusama_runtime::WASM_BINARY.expect("AssetHubKusama wasm not available!"), - Extensions { relay_chain: "kusama-local".into(), para_id: 1000 }, - ) - .with_name("Kusama Asset Hub Local") - .with_id("asset-hub-kusama-local") - .with_chain_type(ChainType::Local) - .with_genesis_config_patch(asset_hub_kusama_local_genesis(1000.into())) - .with_properties(properties) - .build(), - )) + let mut properties = sc_chain_spec::Properties::new(); + properties.insert("ss58Format".into(), 2.into()); + properties.insert("tokenSymbol".into(), "KSM".into()); + properties.insert("tokenDecimals".into(), 12.into()); + + Ok(Box::new( + AssetHubKusamaChainSpec::builder( + asset_hub_kusama_runtime::WASM_BINARY.expect("AssetHubKusama wasm not available!"), + Extensions { relay_chain: "kusama-local".into(), para_id: 1000 }, + ) + .with_name("Kusama Asset Hub Local") + .with_id("asset-hub-kusama-local") + .with_chain_type(ChainType::Local) + .with_genesis_config_patch(asset_hub_kusama_local_genesis(1000.into())) + .with_properties(properties) + .build(), + )) } // CollectivesPolkadot fn collectives_polkadot_genesis( - invulnerables: Vec<(AccountId, AuraId)>, - endowed_accounts: Vec, - id: ParaId, + invulnerables: Vec<(AccountId, AuraId)>, + endowed_accounts: Vec, + id: ParaId, ) -> serde_json::Value { - serde_json::json!({ + serde_json::json!({ "balances": collectives_polkadot_runtime::BalancesConfig { balances: endowed_accounts .iter() @@ -332,42 +332,42 @@ fn collectives_polkadot_genesis( } fn collectives_polkadot_local_genesis(para_id: ParaId) -> serde_json::Value { - collectives_polkadot_genesis( - // initial collators. - invulnerables(), - testnet_accounts(), - para_id, - ) + collectives_polkadot_genesis( + // initial collators. + invulnerables(), + testnet_accounts(), + para_id, + ) } pub fn collectives_polkadot_local_testnet_config() -> Result, String> { - let mut properties = sc_chain_spec::Properties::new(); - properties.insert("ss58Format".into(), 0.into()); - properties.insert("tokenSymbol".into(), "DOT".into()); - properties.insert("tokenDecimals".into(), 10.into()); - - Ok(Box::new( - CollectivesPolkadotChainSpec::builder( - collectives_polkadot_runtime::WASM_BINARY - .expect("CollectivesPolkadot wasm not available!"), - Extensions { relay_chain: "polkadot-local".into(), para_id: 1001 }, - ) - .with_name("Polkadot Collectives Local") - .with_id("collectives-polkadot-local") - .with_chain_type(ChainType::Local) - .with_genesis_config_patch(collectives_polkadot_local_genesis(1001.into())) - .with_properties(properties) - .build(), - )) + let mut properties = sc_chain_spec::Properties::new(); + properties.insert("ss58Format".into(), 0.into()); + properties.insert("tokenSymbol".into(), "DOT".into()); + properties.insert("tokenDecimals".into(), 10.into()); + + Ok(Box::new( + CollectivesPolkadotChainSpec::builder( + collectives_polkadot_runtime::WASM_BINARY + .expect("CollectivesPolkadot wasm not available!"), + Extensions { relay_chain: "polkadot-local".into(), para_id: 1001 }, + ) + .with_name("Polkadot Collectives Local") + .with_id("collectives-polkadot-local") + .with_chain_type(ChainType::Local) + .with_genesis_config_patch(collectives_polkadot_local_genesis(1001.into())) + .with_properties(properties) + .build(), + )) } // BridgeHubPolkadot fn bridge_hub_polkadot_genesis( - invulnerables: Vec<(AccountId, AuraId)>, - endowed_accounts: Vec, - id: ParaId, + invulnerables: Vec<(AccountId, AuraId)>, + endowed_accounts: Vec, + id: ParaId, ) -> serde_json::Value { - serde_json::json!({ + serde_json::json!({ "balances": bridge_hub_polkadot_runtime::BalancesConfig { balances: endowed_accounts .iter() @@ -410,42 +410,42 @@ fn bridge_hub_polkadot_genesis( } fn bridge_hub_polkadot_local_genesis(para_id: ParaId) -> serde_json::Value { - bridge_hub_polkadot_genesis( - // initial collators. - invulnerables(), - testnet_accounts(), - para_id, - ) + bridge_hub_polkadot_genesis( + // initial collators. + invulnerables(), + testnet_accounts(), + para_id, + ) } pub fn bridge_hub_polkadot_local_testnet_config() -> Result, String> { - let mut properties = sc_chain_spec::Properties::new(); - properties.insert("ss58Format".into(), 0.into()); - properties.insert("tokenSymbol".into(), "DOT".into()); - properties.insert("tokenDecimals".into(), 10.into()); - - Ok(Box::new( - BridgeHubPolkadotChainSpec::builder( - bridge_hub_polkadot_runtime::WASM_BINARY - .expect("BridgeHubPolkadot wasm not available!"), - Extensions { relay_chain: "polkadot-local".into(), para_id: 1002 }, - ) - .with_name("Polkadot Bridge Hub Local") - .with_id("bridge-hub-polkadot-local") - .with_chain_type(ChainType::Local) - .with_genesis_config_patch(bridge_hub_polkadot_local_genesis(1002.into())) - .with_properties(properties) - .build(), - )) + let mut properties = sc_chain_spec::Properties::new(); + properties.insert("ss58Format".into(), 0.into()); + properties.insert("tokenSymbol".into(), "DOT".into()); + properties.insert("tokenDecimals".into(), 10.into()); + + Ok(Box::new( + BridgeHubPolkadotChainSpec::builder( + bridge_hub_polkadot_runtime::WASM_BINARY + .expect("BridgeHubPolkadot wasm not available!"), + Extensions { relay_chain: "polkadot-local".into(), para_id: 1002 }, + ) + .with_name("Polkadot Bridge Hub Local") + .with_id("bridge-hub-polkadot-local") + .with_chain_type(ChainType::Local) + .with_genesis_config_patch(bridge_hub_polkadot_local_genesis(1002.into())) + .with_properties(properties) + .build(), + )) } // BridgeHubKusama fn bridge_hub_kusama_genesis( - invulnerables: Vec<(AccountId, AuraId)>, - endowed_accounts: Vec, - id: ParaId, + invulnerables: Vec<(AccountId, AuraId)>, + endowed_accounts: Vec, + id: ParaId, ) -> serde_json::Value { - serde_json::json!({ + serde_json::json!({ "balances": bridge_hub_kusama_runtime::BalancesConfig { balances: endowed_accounts .iter() @@ -488,37 +488,37 @@ fn bridge_hub_kusama_genesis( } fn bridge_hub_kusama_local_genesis(para_id: ParaId) -> serde_json::Value { - bridge_hub_kusama_genesis( - // initial collators. - invulnerables(), - testnet_accounts(), - para_id, - ) + bridge_hub_kusama_genesis( + // initial collators. + invulnerables(), + testnet_accounts(), + para_id, + ) } pub fn bridge_hub_kusama_local_testnet_config() -> Result, String> { - let mut properties = sc_chain_spec::Properties::new(); - properties.insert("ss58Format".into(), 2.into()); - properties.insert("tokenSymbol".into(), "KSM".into()); - properties.insert("tokenDecimals".into(), 12.into()); - - Ok(Box::new( - BridgeHubKusamaChainSpec::builder( - bridge_hub_kusama_runtime::WASM_BINARY.expect("BridgeHubKusama wasm not available!"), - Extensions { relay_chain: "kusama-local".into(), para_id: 1002 }, - ) - .with_name("Kusama Bridge Hub Local") - .with_id("bridge-hub-kusama-local") - .with_chain_type(ChainType::Local) - .with_genesis_config_patch(bridge_hub_kusama_local_genesis(1002.into())) - .with_properties(properties) - .build(), - )) + let mut properties = sc_chain_spec::Properties::new(); + properties.insert("ss58Format".into(), 2.into()); + properties.insert("tokenSymbol".into(), "KSM".into()); + properties.insert("tokenDecimals".into(), 12.into()); + + Ok(Box::new( + BridgeHubKusamaChainSpec::builder( + bridge_hub_kusama_runtime::WASM_BINARY.expect("BridgeHubKusama wasm not available!"), + Extensions { relay_chain: "kusama-local".into(), para_id: 1002 }, + ) + .with_name("Kusama Bridge Hub Local") + .with_id("bridge-hub-kusama-local") + .with_chain_type(ChainType::Local) + .with_genesis_config_patch(bridge_hub_kusama_local_genesis(1002.into())) + .with_properties(properties) + .build(), + )) } // GluttonKusama fn glutton_kusama_genesis(id: ParaId) -> serde_json::Value { - serde_json::json!({ + serde_json::json!({ "parachainInfo": glutton_kusama_runtime::ParachainInfoConfig { parachain_id: id, ..Default::default() @@ -527,30 +527,30 @@ fn glutton_kusama_genesis(id: ParaId) -> serde_json::Value { } fn glutton_kusama_local_genesis(id: ParaId) -> serde_json::Value { - glutton_kusama_genesis(id) + glutton_kusama_genesis(id) } pub fn glutton_kusama_local_testnet_config() -> Result, String> { - let mut properties = sc_chain_spec::Properties::new(); - properties.insert("ss58Format".into(), 2.into()); - - Ok(Box::new( - GluttonKusamaChainSpec::builder( - glutton_kusama_runtime::WASM_BINARY.expect("GluttonKusama wasm not available!"), - Extensions { relay_chain: "kusama-local".into(), para_id: 1300 }, - ) - .with_name("Kusama Glutton Local") - .with_id("glutton-kusama-local") - .with_chain_type(ChainType::Local) - .with_genesis_config_patch(glutton_kusama_local_genesis(1300.into())) - .with_properties(properties) - .build(), - )) + let mut properties = sc_chain_spec::Properties::new(); + properties.insert("ss58Format".into(), 2.into()); + + Ok(Box::new( + GluttonKusamaChainSpec::builder( + glutton_kusama_runtime::WASM_BINARY.expect("GluttonKusama wasm not available!"), + Extensions { relay_chain: "kusama-local".into(), para_id: 1300 }, + ) + .with_name("Kusama Glutton Local") + .with_id("glutton-kusama-local") + .with_chain_type(ChainType::Local) + .with_genesis_config_patch(glutton_kusama_local_genesis(1300.into())) + .with_properties(properties) + .build(), + )) } // EncointerKusama fn encointer_kusama_genesis(endowed_accounts: Vec, id: u32) -> serde_json::Value { - serde_json::json!({ + serde_json::json!({ "balances": asset_hub_kusama_runtime::BalancesConfig { balances: endowed_accounts .iter() @@ -562,6 +562,11 @@ 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() + }, "polkadotXcm": { "safeXcmVersion": Some(SAFE_XCM_VERSION), }, @@ -570,40 +575,40 @@ fn encointer_kusama_genesis(endowed_accounts: Vec, id: u32) -> serde_ } fn encointer_kusama_local_genesis(para_id: u32) -> serde_json::Value { - encointer_kusama_genesis( - // initial collators. - testnet_accounts(), - para_id, - ) + encointer_kusama_genesis( + // initial collators. + testnet_accounts(), + para_id, + ) } pub fn encointer_kusama_local_testnet_config() -> Result, String> { - let mut properties = sc_chain_spec::Properties::new(); - properties.insert("ss58Format".into(), 2.into()); - properties.insert("tokenSymbol".into(), "KSM".into()); - properties.insert("tokenDecimals".into(), 12.into()); - - Ok(Box::new( - EncointerKusamaChainSpec::builder( - encointer_kusama_runtime::WASM_BINARY.expect("EncointerKusama wasm not available!"), - Extensions { relay_chain: "kusama-local".into(), para_id: 1001 }, - ) - .with_name("Kusama Encointer Local") - .with_id("encointer-kusama-local") - .with_chain_type(ChainType::Local) - .with_genesis_config_patch(encointer_kusama_local_genesis(1001)) - .with_properties(properties) - .build(), - )) + let mut properties = sc_chain_spec::Properties::new(); + properties.insert("ss58Format".into(), 2.into()); + properties.insert("tokenSymbol".into(), "KSM".into()); + properties.insert("tokenDecimals".into(), 12.into()); + + Ok(Box::new( + EncointerKusamaChainSpec::builder( + encointer_kusama_runtime::WASM_BINARY.expect("EncointerKusama wasm not available!"), + Extensions { relay_chain: "kusama-local".into(), para_id: 1001 }, + ) + .with_name("Kusama Encointer Local") + .with_id("encointer-kusama-local") + .with_chain_type(ChainType::Local) + .with_genesis_config_patch(encointer_kusama_local_genesis(1001)) + .with_properties(properties) + .build(), + )) } // CoretimeKusama fn coretime_kusama_genesis( - invulnerables: Vec<(AccountId, AuraId)>, - endowed_accounts: Vec, - id: ParaId, + invulnerables: Vec<(AccountId, AuraId)>, + endowed_accounts: Vec, + id: ParaId, ) -> serde_json::Value { - serde_json::json!({ + serde_json::json!({ "balances": coretime_kusama_runtime::BalancesConfig { balances: endowed_accounts .iter() @@ -641,41 +646,41 @@ fn coretime_kusama_genesis( } fn coretime_kusama_local_genesis(para_id: ParaId) -> serde_json::Value { - coretime_kusama_genesis( - // initial collators. - invulnerables(), - testnet_accounts(), - para_id, - ) + coretime_kusama_genesis( + // initial collators. + invulnerables(), + testnet_accounts(), + para_id, + ) } pub fn coretime_kusama_local_testnet_config() -> Result, String> { - let mut properties = sc_chain_spec::Properties::new(); - properties.insert("ss58Format".into(), 2.into()); - properties.insert("tokenSymbol".into(), "KSM".into()); - properties.insert("tokenDecimals".into(), 12.into()); - - Ok(Box::new( - CoretimeKusamaChainSpec::builder( - coretime_kusama_runtime::WASM_BINARY.expect("CoretimeKusama wasm not available!"), - Extensions { relay_chain: "kusama-local".into(), para_id: 1005 }, - ) - .with_name("Kusama Coretime Local") - .with_id("coretime-kusama-local") - .with_chain_type(ChainType::Local) - .with_genesis_config_patch(coretime_kusama_local_genesis(1005.into())) - .with_properties(properties) - .build(), - )) + let mut properties = sc_chain_spec::Properties::new(); + properties.insert("ss58Format".into(), 2.into()); + properties.insert("tokenSymbol".into(), "KSM".into()); + properties.insert("tokenDecimals".into(), 12.into()); + + Ok(Box::new( + CoretimeKusamaChainSpec::builder( + coretime_kusama_runtime::WASM_BINARY.expect("CoretimeKusama wasm not available!"), + Extensions { relay_chain: "kusama-local".into(), para_id: 1005 }, + ) + .with_name("Kusama Coretime Local") + .with_id("coretime-kusama-local") + .with_chain_type(ChainType::Local) + .with_genesis_config_patch(coretime_kusama_local_genesis(1005.into())) + .with_properties(properties) + .build(), + )) } // PeopleKusama fn people_kusama_genesis( - invulnerables: Vec<(AccountId, AuraId)>, - endowed_accounts: Vec, - id: ParaId, + invulnerables: Vec<(AccountId, AuraId)>, + endowed_accounts: Vec, + id: ParaId, ) -> serde_json::Value { - serde_json::json!({ + serde_json::json!({ "balances": people_kusama_runtime::BalancesConfig { balances: endowed_accounts .iter() @@ -713,30 +718,30 @@ fn people_kusama_genesis( } fn people_kusama_local_genesis(para_id: ParaId) -> serde_json::Value { - people_kusama_genesis( - // initial collators. - invulnerables(), - testnet_accounts(), - para_id, - ) + people_kusama_genesis( + // initial collators. + invulnerables(), + testnet_accounts(), + para_id, + ) } pub fn people_kusama_local_testnet_config() -> Result, String> { - let mut properties = sc_chain_spec::Properties::new(); - properties.insert("ss58Format".into(), 2.into()); - properties.insert("tokenSymbol".into(), "KSM".into()); - properties.insert("tokenDecimals".into(), 12.into()); - - Ok(Box::new( - PeopleKusamaChainSpec::builder( - people_kusama_runtime::WASM_BINARY.expect("PeopleKusama wasm not available!"), - Extensions { relay_chain: "kusama-local".into(), para_id: 1004 }, - ) - .with_name("Kusama People Local") - .with_id("people-kusama-local") - .with_chain_type(ChainType::Local) - .with_genesis_config_patch(people_kusama_local_genesis(1004.into())) - .with_properties(properties) - .build(), - )) + let mut properties = sc_chain_spec::Properties::new(); + properties.insert("ss58Format".into(), 2.into()); + properties.insert("tokenSymbol".into(), "KSM".into()); + properties.insert("tokenDecimals".into(), 12.into()); + + Ok(Box::new( + PeopleKusamaChainSpec::builder( + people_kusama_runtime::WASM_BINARY.expect("PeopleKusama wasm not available!"), + Extensions { relay_chain: "kusama-local".into(), para_id: 1004 }, + ) + .with_name("Kusama People Local") + .with_id("people-kusama-local") + .with_chain_type(ChainType::Local) + .with_genesis_config_patch(people_kusama_local_genesis(1004.into())) + .with_properties(properties) + .build(), + )) } From 5e81b719a46169edf85b62c7e14530a14b211cf6 Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Wed, 10 Apr 2024 09:08:10 +0200 Subject: [PATCH 04/29] remove treasury pallet and grant fees to collator pot instead --- Cargo.lock | 6 +- Cargo.toml | 80 ++--- system-parachains/encointer/Cargo.toml | 4 - .../encointer/src/deal_with_fees.rs | 45 --- system-parachains/encointer/src/lib.rs | 86 +----- .../encointer/src/weights/mod.rs | 1 - .../encointer/src/weights/pallet_treasury.rs | 211 ------------- system-parachains/encointer/src/xcm_config.rs | 281 +++++++++--------- 8 files changed, 188 insertions(+), 526 deletions(-) delete mode 100644 system-parachains/encointer/src/deal_with_fees.rs delete mode 100644 system-parachains/encointer/src/weights/pallet_treasury.rs diff --git a/Cargo.lock b/Cargo.lock index d425ea5b76..dc27cf2794 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3592,7 +3592,6 @@ dependencies = [ "pallet-timestamp", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", - "pallet-treasury", "pallet-utility", "pallet-xcm", "parachains-common", @@ -7557,9 +7556,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 +7568,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 8c9d50680a..493cec650d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -83,7 +83,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 } @@ -202,45 +202,45 @@ xcm-emulator = { version = "0.6.0" } resolver = "2" members = [ - "chain-spec-generator", - "relay/kusama", - "relay/kusama/constants", - "relay/polkadot", - "relay/polkadot/constants", - "system-parachains/asset-hubs/asset-hub-kusama", - "system-parachains/asset-hubs/asset-hub-kusama/primitives", - "system-parachains/asset-hubs/asset-hub-polkadot", - "system-parachains/asset-hubs/asset-hub-polkadot/primitives", - "system-parachains/bridge-hubs/bridge-hub-kusama", - "system-parachains/bridge-hubs/bridge-hub-kusama/primitives", - "system-parachains/bridge-hubs/bridge-hub-polkadot", - "system-parachains/bridge-hubs/bridge-hub-polkadot/primitives", - "system-parachains/collectives/collectives-polkadot", - "system-parachains/collectives/collectives-polkadot/constants", - "system-parachains/constants", - "system-parachains/coretime/coretime-kusama", - "system-parachains/encointer", - "system-parachains/gluttons/glutton-kusama", - "system-parachains/people/people-kusama", - "integration-tests/emulated/chains/relays/kusama", - "integration-tests/emulated/chains/relays/polkadot", - "integration-tests/emulated/chains/parachains/assets/asset-hub-kusama", - "integration-tests/emulated/chains/parachains/assets/asset-hub-polkadot", - "integration-tests/emulated/chains/parachains/bridges/bridge-hub-kusama", - "integration-tests/emulated/chains/parachains/bridges/bridge-hub-polkadot", - "integration-tests/emulated/chains/parachains/collectives/collectives-polkadot", - "integration-tests/emulated/chains/parachains/people/people-kusama", - "integration-tests/emulated/chains/parachains/testing/penpal", - "integration-tests/emulated/helpers", - "integration-tests/emulated/networks/kusama-system", - "integration-tests/emulated/networks/polkadot-system", - "integration-tests/emulated/networks/kusama-polkadot-system", - "integration-tests/emulated/tests/assets/asset-hub-kusama", - "integration-tests/emulated/tests/assets/asset-hub-polkadot", - "integration-tests/emulated/tests/bridges/bridge-hub-kusama", - "integration-tests/emulated/tests/bridges/bridge-hub-polkadot", - "integration-tests/emulated/tests/collectives/collectives-polkadot", - "integration-tests/emulated/tests/people/people-kusama", + "chain-spec-generator", + "relay/kusama", + "relay/kusama/constants", + "relay/polkadot", + "relay/polkadot/constants", + "system-parachains/asset-hubs/asset-hub-kusama", + "system-parachains/asset-hubs/asset-hub-kusama/primitives", + "system-parachains/asset-hubs/asset-hub-polkadot", + "system-parachains/asset-hubs/asset-hub-polkadot/primitives", + "system-parachains/bridge-hubs/bridge-hub-kusama", + "system-parachains/bridge-hubs/bridge-hub-kusama/primitives", + "system-parachains/bridge-hubs/bridge-hub-polkadot", + "system-parachains/bridge-hubs/bridge-hub-polkadot/primitives", + "system-parachains/collectives/collectives-polkadot", + "system-parachains/collectives/collectives-polkadot/constants", + "system-parachains/constants", + "system-parachains/coretime/coretime-kusama", + "system-parachains/encointer", + "system-parachains/gluttons/glutton-kusama", + "system-parachains/people/people-kusama", + "integration-tests/emulated/chains/relays/kusama", + "integration-tests/emulated/chains/relays/polkadot", + "integration-tests/emulated/chains/parachains/assets/asset-hub-kusama", + "integration-tests/emulated/chains/parachains/assets/asset-hub-polkadot", + "integration-tests/emulated/chains/parachains/bridges/bridge-hub-kusama", + "integration-tests/emulated/chains/parachains/bridges/bridge-hub-polkadot", + "integration-tests/emulated/chains/parachains/collectives/collectives-polkadot", + "integration-tests/emulated/chains/parachains/people/people-kusama", + "integration-tests/emulated/chains/parachains/testing/penpal", + "integration-tests/emulated/helpers", + "integration-tests/emulated/networks/kusama-system", + "integration-tests/emulated/networks/polkadot-system", + "integration-tests/emulated/networks/kusama-polkadot-system", + "integration-tests/emulated/tests/assets/asset-hub-kusama", + "integration-tests/emulated/tests/assets/asset-hub-polkadot", + "integration-tests/emulated/tests/bridges/bridge-hub-kusama", + "integration-tests/emulated/tests/bridges/bridge-hub-polkadot", + "integration-tests/emulated/tests/collectives/collectives-polkadot", + "integration-tests/emulated/tests/people/people-kusama", ] [profile.release] diff --git a/system-parachains/encointer/Cargo.toml b/system-parachains/encointer/Cargo.toml index 3215b63f20..949b4664cf 100644 --- a/system-parachains/encointer/Cargo.toml +++ b/system-parachains/encointer/Cargo.toml @@ -66,7 +66,6 @@ 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 } @@ -140,7 +139,6 @@ runtime-benchmarks = [ "pallet-membership/runtime-benchmarks", "pallet-proxy/runtime-benchmarks", "pallet-timestamp/runtime-benchmarks", - "pallet-treasury/runtime-benchmarks", "pallet-utility/runtime-benchmarks", "pallet-xcm/runtime-benchmarks", "polkadot-runtime-common/runtime-benchmarks", @@ -200,7 +198,6 @@ 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", @@ -261,7 +258,6 @@ 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 a029fe8b54..3f6cfd2560 100644 --- a/system-parachains/encointer/src/lib.rs +++ b/system-parachains/encointer/src/lib.rs @@ -31,7 +31,6 @@ #[cfg(feature = "std")] include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); -mod deal_with_fees; mod migrations_fix; mod weights; pub mod xcm_config; @@ -39,7 +38,6 @@ pub mod xcm_config; use codec::{Decode, Encode, MaxEncodedLen}; 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}; pub use encointer_primitives::{ balances::{BalanceEntry, BalanceType, Demurrage}, @@ -58,7 +56,7 @@ use frame_support::{ genesis_builder_helper::{build_config, create_default_config}, parameter_types, traits::{ - tokens::{pay::PayFromAccount, ConversionFromAssetBalance, ConversionToAssetBalance}, + tokens::{ConversionToAssetBalance}, ConstBool, ConstU64, Contains, EitherOfDiverse, EqualPrivilegeOnly, InstanceFilter, }, weights::{ConstantMultiplier, Weight}, @@ -87,9 +85,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")] @@ -321,74 +319,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 { - return 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; @@ -707,7 +645,6 @@ construct_runtime! { // Handy utilities. Utility: pallet_utility = 40, - Treasury: pallet_treasury = 43, Proxy: pallet_proxy = 44, Scheduler: pallet_scheduler = 48, @@ -790,8 +727,6 @@ mod benches { [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] @@ -1064,8 +999,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(); @@ -1102,17 +1035,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/weights/mod.rs b/system-parachains/encointer/src/weights/mod.rs index 1d36525972..321d486ed6 100644 --- a/system-parachains/encointer/src/weights/mod.rs +++ b/system-parachains/encointer/src/weights/mod.rs @@ -39,7 +39,6 @@ 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_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 c50c5c6b69..6d5f72cff6 100644 --- a/system-parachains/encointer/src/xcm_config.rs +++ b/system-parachains/encointer/src/xcm_config.rs @@ -16,16 +16,17 @@ //! 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, - traits::{Contains, Everything, Nothing}, - weights::Weight, + parameter_types, + traits::{Contains, Everything, Nothing}, + weights::Weight, }; use frame_system::EnsureRoot; use pallet_xcm::XcmPassthrough; +use parachains_common::impls::ToStakingPot; use parachains_common::xcm_config::{ConcreteAssetFromSystem, ParentRelayOrSiblingParachains}; use polkadot_parachain_primitives::primitives::Sibling; @@ -33,13 +34,13 @@ use sp_core::ConstU32; use xcm::latest::prelude::*; 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, + 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; @@ -57,52 +58,52 @@ parameter_types! { /// when determining ownership of accounts for asset transacting and when attempting to use XCM /// `Transact` in order to determine the dispatch Origin. pub type LocationToAccountId = ( - // The parent (Relay-chain) origin converts to the parent `AccountId`. - ParentIsPreset, - // Sibling parachain origins convert to AccountId via the `ParaId::into`. - SiblingParachainConvertsVia, - // Straight up local `AccountId32` origins just alias directly to `AccountId`. - AccountId32Aliases, - // Here/local root location to `AccountId`. - HashedDescription, + // The parent (Relay-chain) origin converts to the parent `AccountId`. + ParentIsPreset, + // Sibling parachain origins convert to AccountId via the `ParaId::into`. + SiblingParachainConvertsVia, + // Straight up local `AccountId32` origins just alias directly to `AccountId`. + AccountId32Aliases, + // Here/local root location to `AccountId`. + HashedDescription, ); /// Means for transacting the native currency on this chain. pub type FungibleTransactor = FungibleAdapter< - // Use this currency: - Balances, - // Use this currency when it is a fungible asset matching the given location or name: - IsConcrete, - // Convert an XCM `Location` into a local account ID: - LocationToAccountId, - // Our chain's account ID type (we can't get away without mentioning it explicitly): - AccountId, - // We don't track any teleports of `Balances`. - (), + // Use this currency: + Balances, + // Use this currency when it is a fungible asset matching the given location or name: + IsConcrete, + // Convert an XCM `Location` into a local account ID: + LocationToAccountId, + // Our chain's account ID type (we can't get away without mentioning it explicitly): + AccountId, + // We don't track any teleports of `Balances`. + (), >; /// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance, /// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can /// biases the kind of local `Origin` it will become. pub type XcmOriginToTransactDispatchOrigin = ( - // Sovereign account converter; this attempts to derive an `AccountId` from the origin location - // using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for - // foreign chains who want to have a local sovereign account on this chain which they control. - SovereignSignedViaLocation, - // Native converter for Relay-chain (Parent) location; will convert to a `Relay` origin when - // recognised. - RelayChainAsNative, - // Native converter for sibling Parachains; will convert to a `SiblingPara` origin when - // recognised. - SiblingParachainAsNative, - // Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a - // transaction from the Root origin. - ParentAsSuperuser, - // Native signed account converter; this just converts an `AccountId32` origin into a normal - // `RuntimeOrigin::Signed` origin of the same 32-byte value. - SignedAccountId32AsNative, - // Xcm origins can be represented natively under the Xcm pallet's Xcm origin. - XcmPassthrough, + // Sovereign account converter; this attempts to derive an `AccountId` from the origin location + // using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for + // foreign chains who want to have a local sovereign account on this chain which they control. + SovereignSignedViaLocation, + // Native converter for Relay-chain (Parent) location; will convert to a `Relay` origin when + // recognised. + RelayChainAsNative, + // Native converter for sibling Parachains; will convert to a `SiblingPara` origin when + // recognised. + SiblingParachainAsNative, + // Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a + // transaction from the Root origin. + ParentAsSuperuser, + // Native signed account converter; this just converts an `AccountId32` origin into a normal + // `RuntimeOrigin::Signed` origin of the same 32-byte value. + SignedAccountId32AsNative, + // Xcm origins can be represented natively under the Xcm pallet's Xcm origin. + XcmPassthrough, ); parameter_types! { @@ -112,45 +113,47 @@ parameter_types! { } pub struct ParentOrParentsPlurality; + impl Contains for ParentOrParentsPlurality { - fn contains(location: &Location) -> bool { - matches!(location.unpack(), (1, []) | (1, [Plurality { .. }])) - } + fn contains(location: &Location) -> bool { + matches!(location.unpack(), (1, []) | (1, [Plurality { .. }])) + } } pub type Barrier = TrailingSetTopicAsId< - DenyThenTry< - DenyReserveTransferToRelayChain, - ( - TakeWeightCredit, - // Expected responses are OK. - AllowKnownQueryResponses, - // 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>, - >, - ), - >, + DenyThenTry< + DenyReserveTransferToRelayChain, + ( + TakeWeightCredit, + // Expected responses are OK. + AllowKnownQueryResponses, + // 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 { - // This is safe, as we prevent arbitrary xcm-transact executions. - // For rationale, see:https://github.com/paritytech/polkadot/blob/19fdd197aff085f7f66e54942999fd536e7df475/runtime/kusama/src/xcm_config.rs#L171 - true - } + fn contains(_call: &RuntimeCall) -> bool { + // This is safe, as we prevent arbitrary xcm-transact executions. + // For rationale, see:https://github.com/paritytech/polkadot/blob/19fdd197aff085f7f66e54942999fd536e7df475/runtime/kusama/src/xcm_config.rs#L171 + true + } } parameter_types! { @@ -163,34 +166,34 @@ parameter_types! { pub type TrustedTeleporters = ConcreteAssetFromSystem; pub struct XcmConfig; + impl xcm_executor::Config for XcmConfig { - type RuntimeCall = RuntimeCall; - type XcmSender = XcmRouter; - type AssetTransactor = FungibleTransactor; - type OriginConverter = XcmOriginToTransactDispatchOrigin; - type IsReserve = NativeAsset; - type IsTeleporter = TrustedTeleporters; - type UniversalLocation = UniversalLocation; - type Barrier = Barrier; - type Weigher = FixedWeightBounds; - // `FeesToTreasury` is an encointer adaptation - type Trader = - UsingComponents>; - type ResponseHandler = PolkadotXcm; - type AssetTrap = PolkadotXcm; - type AssetClaims = PolkadotXcm; - type SubscriptionService = PolkadotXcm; - type PalletInstancesInfo = crate::AllPalletsWithSystem; - type MaxAssetsIntoHolding = MaxAssetsIntoHolding; - type AssetLocker = (); - type AssetExchanger = (); - type FeeManager = (); - type MessageExporter = (); - type UniversalAliases = Nothing; - type CallDispatcher = RuntimeCall; - type SafeCallFilter = SafeCallFilter; - type Aliasers = Nothing; - type TransactionalProcessor = FrameTransactionalProcessor; + type RuntimeCall = RuntimeCall; + type XcmSender = XcmRouter; + type AssetTransactor = FungibleTransactor; + type OriginConverter = XcmOriginToTransactDispatchOrigin; + type IsReserve = NativeAsset; + type IsTeleporter = TrustedTeleporters; + type UniversalLocation = UniversalLocation; + type Barrier = Barrier; + type Weigher = FixedWeightBounds; + type Trader = + UsingComponents>; + type ResponseHandler = PolkadotXcm; + type AssetTrap = PolkadotXcm; + type AssetClaims = PolkadotXcm; + type SubscriptionService = PolkadotXcm; + type PalletInstancesInfo = crate::AllPalletsWithSystem; + type MaxAssetsIntoHolding = MaxAssetsIntoHolding; + type AssetLocker = (); + type AssetExchanger = (); + type FeeManager = (); + type MessageExporter = (); + type UniversalAliases = Nothing; + type CallDispatcher = RuntimeCall; + type SafeCallFilter = SafeCallFilter; + type Aliasers = Nothing; + type TransactionalProcessor = FrameTransactionalProcessor; } /// Converts a local signed origin into an XCM location. @@ -200,10 +203,10 @@ pub type LocalOriginToLocation = SignedToAccountId32, - // ..and XCMP to communicate with the sibling chains. - XcmpQueue, + // Two routers - use UMP to communicate with the relay chain: + cumulus_primitives_utility::ParentAsUmp, + // ..and XCMP to communicate with the sibling chains. + XcmpQueue, ); #[cfg(feature = "runtime-benchmarks")] @@ -212,36 +215,36 @@ parameter_types! { } impl pallet_xcm::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - // We want to disallow users sending (arbitrary) XCMs from this chain. - type SendXcmOrigin = EnsureXcmOrigin; - type XcmRouter = XcmRouter; - // We support local origins dispatching XCM executions in principle... - type ExecuteXcmOrigin = EnsureXcmOrigin; - // ... but disallow generic XCM execution. As a result only teleports and reserve transfers are - // allowed. - type XcmExecuteFilter = Nothing; - type XcmExecutor = XcmExecutor; - type XcmTeleportFilter = Everything; - type XcmReserveTransferFilter = Everything; - type Weigher = FixedWeightBounds; - type RuntimeOrigin = RuntimeOrigin; - type RuntimeCall = RuntimeCall; - const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; - type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; - type Currency = Balances; - type CurrencyMatcher = (); - type TrustedLockers = (); - type SovereignAccountOf = LocationToAccountId; - type MaxLockers = ConstU32<8>; - type WeightInfo = pallet_xcm::TestWeightInfo; - type AdminOrigin = EnsureRoot; - type UniversalLocation = UniversalLocation; - type MaxRemoteLockConsumers = ConstU32<0>; - type RemoteLockConsumerIdentifier = (); + type RuntimeEvent = RuntimeEvent; + // We want to disallow users sending (arbitrary) XCMs from this chain. + type SendXcmOrigin = EnsureXcmOrigin; + type XcmRouter = XcmRouter; + // We support local origins dispatching XCM executions in principle... + type ExecuteXcmOrigin = EnsureXcmOrigin; + // ... but disallow generic XCM execution. As a result only teleports and reserve transfers are + // allowed. + type XcmExecuteFilter = Nothing; + type XcmExecutor = XcmExecutor; + type XcmTeleportFilter = Everything; + type XcmReserveTransferFilter = Everything; + type Weigher = FixedWeightBounds; + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; + const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; + type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; + type Currency = Balances; + type CurrencyMatcher = (); + type TrustedLockers = (); + type SovereignAccountOf = LocationToAccountId; + type MaxLockers = ConstU32<8>; + type WeightInfo = pallet_xcm::TestWeightInfo; + type AdminOrigin = EnsureRoot; + type UniversalLocation = UniversalLocation; + type MaxRemoteLockConsumers = ConstU32<0>; + type RemoteLockConsumerIdentifier = (); } impl cumulus_pallet_xcm::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type XcmExecutor = XcmExecutor; + type RuntimeEvent = RuntimeEvent; + type XcmExecutor = XcmExecutor; } From 0748d865f39368be03554456d4391b71a5b9a319 Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Wed, 10 Apr 2024 13:31:06 +0200 Subject: [PATCH 05/29] send fees in CC to block author --- .../src/system_parachains_specs.rs | 12 + system-parachains/encointer/src/lib.rs | 1174 +++++++++-------- 2 files changed, 610 insertions(+), 576 deletions(-) diff --git a/chain-spec-generator/src/system_parachains_specs.rs b/chain-spec-generator/src/system_parachains_specs.rs index 8d84e41ac4..c53ad7dccf 100644 --- a/chain-spec-generator/src/system_parachains_specs.rs +++ b/chain-spec-generator/src/system_parachains_specs.rs @@ -567,6 +567,18 @@ fn encointer_kusama_genesis(endowed_accounts: Vec, id: u32) -> serde_ 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/src/lib.rs b/system-parachains/encointer/src/lib.rs index 3f6cfd2560..2898a0ffdc 100644 --- a/system-parachains/encointer/src/lib.rs +++ b/system-parachains/encointer/src/lib.rs @@ -38,34 +38,36 @@ pub mod xcm_config; use codec::{Decode, Encode, MaxEncodedLen}; use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases; use cumulus_primitives_core::{AggregateMessageOrigin, ParaId}; -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}, - ceremonies::{AggregatedAccountData, CeremonyIndexType, CeremonyInfo, CommunityReputation}, - common::PalletString, - communities::{CommunityIdentifier, Location}, - scheduler::CeremonyPhaseType, + balances::{BalanceEntry, BalanceType, Demurrage}, + bazaar::{BusinessData, BusinessIdentifier, OfferingData}, + ceremonies::{AggregatedAccountData, CeremonyIndexType, CeremonyInfo, CommunityReputation}, + common::PalletString, + 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::{ConversionToAssetBalance}, - ConstBool, ConstU64, Contains, EitherOfDiverse, EqualPrivilegeOnly, InstanceFilter, - }, - weights::{ConstantMultiplier, Weight}, - PalletId, + construct_runtime, + dispatch::DispatchClass, + genesis_builder_helper::{build_config, create_default_config}, + parameter_types, + traits::{ + fungibles::{Balanced, Credit}, + tokens::ConversionToAssetBalance, + ConstBool, ConstU64, Contains, EitherOfDiverse, EqualPrivilegeOnly, InstanceFilter, + TransformOrigin, + }, + weights::{ConstantMultiplier, Weight}, + PalletId, }; use frame_system::{ - limits::{BlockLength, BlockWeights}, - EnsureRoot, + 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; @@ -74,9 +76,10 @@ 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, + impls::DealWithFees, AccountId, AssetIdForTrustBackedAssets, AuraId, Balance, BlockNumber, + Hash, Header, Nonce, Signature, }; use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate}; use sp_api::impl_runtime_apis; @@ -84,19 +87,20 @@ use sp_core::{crypto::KeyTypeId, ConstU32, OpaqueMetadata}; #[cfg(any(feature = "std", test))] pub use sp_runtime::BuildStorage; use sp_runtime::{ - create_runtime_str, generic, impl_opaque_keys, - traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, Verify}, - transaction_validity::{TransactionSource, TransactionValidity}, - ApplyExtrinsicResult, Perbill, RuntimeDebug, + create_runtime_str, generic, impl_opaque_keys, + traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, Verify}, + transaction_validity::{TransactionSource, TransactionValidity}, + ApplyExtrinsicResult, Perbill, RuntimeDebug, }; use sp_std::prelude::*; #[cfg(feature = "std")] use sp_version::NativeVersion; use sp_version::RuntimeVersion; +use std::marker::PhantomData; use system_parachains_constants::{ - kusama::{consensus::*, currency::*, fee::WeightToFee}, - AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, - SLOT_DURATION, + kusama::{consensus::*, currency::*, fee::WeightToFee}, + AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, + SLOT_DURATION, }; use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}; use xcm::latest::prelude::{AssetId as XcmAssetId, BodyId}; @@ -118,20 +122,20 @@ impl_opaque_keys! { /// This runtime version. #[sp_version::runtime_version] pub const VERSION: RuntimeVersion = RuntimeVersion { - spec_name: create_runtime_str!("encointer-parachain"), - impl_name: create_runtime_str!("encointer-parachain"), - authoring_version: 1, - spec_version: 1_002_010, - impl_version: 1, - apis: RUNTIME_API_VERSIONS, - transaction_version: 3, - state_version: 0, + spec_name: create_runtime_str!("encointer-parachain"), + impl_name: create_runtime_str!("encointer-parachain"), + authoring_version: 1, + spec_version: 1_002_010, + impl_version: 1, + apis: RUNTIME_API_VERSIONS, + transaction_version: 3, + state_version: 0, }; /// The version information used to identify this runtime when compiled natively. #[cfg(feature = "std")] pub fn native_version() -> NativeVersion { - NativeVersion { runtime_version: VERSION, can_author_with: Default::default() } + NativeVersion { runtime_version: VERSION, can_author_with: Default::default() } } parameter_types! { @@ -148,69 +152,69 @@ parameter_types! { /// The type used to represent the kinds of proxying allowed. #[derive( -Copy, -Clone, -Eq, -PartialEq, -Ord, -PartialOrd, -Encode, -Decode, -RuntimeDebug, -scale_info::TypeInfo, -MaxEncodedLen, + Copy, + Clone, + Eq, + PartialEq, + Ord, + PartialOrd, + Encode, + Decode, + RuntimeDebug, + scale_info::TypeInfo, + MaxEncodedLen, )] pub enum ProxyType { - Any, - NonTransfer, - BazaarEdit, + Any, + NonTransfer, + BazaarEdit, } impl Default for ProxyType { - fn default() -> Self { - Self::Any - } + fn default() -> Self { + Self::Any + } } impl InstanceFilter for ProxyType { - fn filter(&self, c: &RuntimeCall) -> bool { - match self { - ProxyType::Any => true, - ProxyType::NonTransfer => - !matches!(c, RuntimeCall::Balances { .. } | RuntimeCall::EncointerBalances { .. }), - ProxyType::BazaarEdit => matches!( + fn filter(&self, c: &RuntimeCall) -> bool { + match self { + ProxyType::Any => true, + ProxyType::NonTransfer => + !matches!(c, RuntimeCall::Balances { .. } | RuntimeCall::EncointerBalances { .. }), + ProxyType::BazaarEdit => matches!( c, RuntimeCall::EncointerBazaar(EncointerBazaarCall::create_offering { .. }) | RuntimeCall::EncointerBazaar(EncointerBazaarCall::update_offering { .. }) | RuntimeCall::EncointerBazaar(EncointerBazaarCall::delete_offering { .. }) ), - } - } - - fn is_superset(&self, o: &Self) -> bool { - match (self, o) { - (x, y) if x == y => true, - (ProxyType::Any, _) => true, - (_, ProxyType::Any) => false, - (ProxyType::NonTransfer, ProxyType::BazaarEdit) => true, - _ => false, - } - } + } + } + + fn is_superset(&self, o: &Self) -> bool { + match (self, o) { + (x, y) if x == y => true, + (ProxyType::Any, _) => true, + (_, ProxyType::Any) => false, + (ProxyType::NonTransfer, ProxyType::BazaarEdit) => true, + _ => false, + } + } } impl pallet_proxy::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type RuntimeCall = RuntimeCall; - type Currency = Balances; - type ProxyType = ProxyType; - type ProxyDepositBase = ProxyDepositBase; - type ProxyDepositFactor = ProxyDepositFactor; - type MaxProxies = MaxProxies; - type WeightInfo = weights::pallet_proxy::WeightInfo; - type MaxPending = MaxPending; - type CallHasher = BlakeTwo256; - type AnnouncementDepositBase = AnnouncementDepositBase; - type AnnouncementDepositFactor = AnnouncementDepositFactor; + type RuntimeEvent = RuntimeEvent; + type RuntimeCall = RuntimeCall; + type Currency = Balances; + type ProxyType = ProxyType; + type ProxyDepositBase = ProxyDepositBase; + type ProxyDepositFactor = ProxyDepositFactor; + type MaxProxies = MaxProxies; + type WeightInfo = weights::pallet_proxy::WeightInfo; + type MaxPending = MaxPending; + type CallHasher = BlakeTwo256; + type AnnouncementDepositBase = AnnouncementDepositBase; + type AnnouncementDepositFactor = AnnouncementDepositFactor; } parameter_types! { @@ -241,38 +245,38 @@ parameter_types! { pub struct BaseFilter; impl Contains for BaseFilter { - fn contains(_c: &RuntimeCall) -> bool { - true - } + fn contains(_c: &RuntimeCall) -> bool { + true + } } // Configure FRAME pallets to include in runtime. impl frame_system::Config for Runtime { - type BaseCallFilter = BaseFilter; - // The block type. - type Block = generic::Block; - type BlockWeights = RuntimeBlockWeights; - type BlockLength = RuntimeBlockLength; - type AccountId = AccountId; - type RuntimeCall = RuntimeCall; - type RuntimeTask = RuntimeTask; - type Lookup = AccountIdLookup; - type Nonce = Nonce; - type Hash = Hash; - type Hashing = BlakeTwo256; - type RuntimeEvent = RuntimeEvent; - type RuntimeOrigin = RuntimeOrigin; - type BlockHashCount = BlockHashCount; - type DbWeight = RocksDbWeight; - type Version = Version; - type PalletInfo = PalletInfo; - type OnNewAccount = (); - type OnKilledAccount = (); - type AccountData = pallet_balances::AccountData; - type SystemWeightInfo = weights::frame_system::WeightInfo; - type SS58Prefix = SS58Prefix; - type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode; - type MaxConsumers = frame_support::traits::ConstU32<16>; + type BaseCallFilter = BaseFilter; + // The block type. + type Block = generic::Block; + type BlockWeights = RuntimeBlockWeights; + type BlockLength = RuntimeBlockLength; + type AccountId = AccountId; + type RuntimeCall = RuntimeCall; + type RuntimeTask = RuntimeTask; + type Lookup = AccountIdLookup; + type Nonce = Nonce; + type Hash = Hash; + type Hashing = BlakeTwo256; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; + type BlockHashCount = BlockHashCount; + type DbWeight = RocksDbWeight; + type Version = Version; + type PalletInfo = PalletInfo; + type OnNewAccount = (); + type OnKilledAccount = (); + type AccountData = pallet_balances::AccountData; + type SystemWeightInfo = weights::frame_system::WeightInfo; + type SS58Prefix = SS58Prefix; + type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode; + type MaxConsumers = frame_support::traits::ConstU32<16>; } parameter_types! { @@ -280,11 +284,11 @@ parameter_types! { } impl pallet_timestamp::Config for Runtime { - /// A timestamp: milliseconds since the unix epoch. - type Moment = Moment; - type OnTimestampSet = EncointerScheduler; - type MinimumPeriod = MinimumPeriod; - type WeightInfo = weights::pallet_timestamp::WeightInfo; + /// A timestamp: milliseconds since the unix epoch. + type Moment = Moment; + type OnTimestampSet = EncointerScheduler; + type MinimumPeriod = MinimumPeriod; + type WeightInfo = weights::pallet_timestamp::WeightInfo; } parameter_types! { @@ -294,21 +298,21 @@ parameter_types! { } impl pallet_balances::Config for Runtime { - type MaxLocks = MaxLocks; - /// The type for recording an account's balance. - type Balance = Balance; - /// The ubiquitous event type. - type RuntimeEvent = RuntimeEvent; - type DustRemoval = (); - type ExistentialDeposit = ExistentialDeposit; - type AccountStore = System; - type WeightInfo = weights::pallet_balances::WeightInfo; - type MaxReserves = MaxReserves; - type ReserveIdentifier = [u8; 8]; - type RuntimeHoldReason = (); - type RuntimeFreezeReason = RuntimeFreezeReason; - type FreezeIdentifier = (); - type MaxFreezes = ConstU32<0>; + type MaxLocks = MaxLocks; + /// The type for recording an account's balance. + type Balance = Balance; + /// The ubiquitous event type. + type RuntimeEvent = RuntimeEvent; + type DustRemoval = (); + type ExistentialDeposit = ExistentialDeposit; + type AccountStore = System; + type WeightInfo = weights::pallet_balances::WeightInfo; + type MaxReserves = MaxReserves; + type ReserveIdentifier = [u8; 8]; + type RuntimeHoldReason = (); + type RuntimeFreezeReason = RuntimeFreezeReason; + type FreezeIdentifier = (); + type MaxFreezes = ConstU32<0>; } parameter_types! { @@ -318,20 +322,20 @@ parameter_types! { } impl pallet_transaction_payment::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type OnChargeTransaction = - pallet_transaction_payment::CurrencyAdapter>; - type WeightToFee = WeightToFee; - type LengthToFee = ConstantMultiplier; - type FeeMultiplierUpdate = SlowAdjustingFeeUpdate; - type OperationalFeeMultiplier = OperationalFeeMultiplier; + type RuntimeEvent = RuntimeEvent; + type OnChargeTransaction = + pallet_transaction_payment::CurrencyAdapter>; + type WeightToFee = WeightToFee; + type LengthToFee = ConstantMultiplier; + type FeeMultiplierUpdate = SlowAdjustingFeeUpdate; + type OperationalFeeMultiplier = OperationalFeeMultiplier; } impl pallet_utility::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type RuntimeCall = RuntimeCall; - type PalletsOrigin = OriginCaller; - type WeightInfo = weights::pallet_utility::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type RuntimeCall = RuntimeCall; + type PalletsOrigin = OriginCaller; + type WeightInfo = weights::pallet_utility::WeightInfo; } parameter_types! { @@ -341,16 +345,16 @@ parameter_types! { } impl pallet_scheduler::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type RuntimeOrigin = RuntimeOrigin; - type PalletsOrigin = OriginCaller; - type RuntimeCall = RuntimeCall; - type MaximumWeight = MaximumSchedulerWeight; - type ScheduleOrigin = MoreThanHalfCouncil; - type MaxScheduledPerBlock = MaxScheduledPerBlock; - type WeightInfo = pallet_scheduler::weights::SubstrateWeight; - type OriginPrivilegeCmp = EqualPrivilegeOnly; - type Preimages = (); + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; + type PalletsOrigin = OriginCaller; + type RuntimeCall = RuntimeCall; + type MaximumWeight = MaximumSchedulerWeight; + type ScheduleOrigin = MoreThanHalfCouncil; + type MaxScheduledPerBlock = MaxScheduledPerBlock; + type WeightInfo = pallet_scheduler::weights::SubstrateWeight; + type OriginPrivilegeCmp = EqualPrivilegeOnly; + type Preimages = (); } parameter_types! { @@ -360,24 +364,24 @@ parameter_types! { } impl cumulus_pallet_parachain_system::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type OnSystemEvent = (); - type SelfParaId = parachain_info::Pallet; - type DmpQueue = frame_support::traits::EnqueueWithOrigin; - type ReservedDmpWeight = ReservedDmpWeight; - type OutboundXcmpMessageSource = XcmpQueue; - type XcmpMessageHandler = XcmpQueue; - type ReservedXcmpWeight = ReservedXcmpWeight; - type CheckAssociatedRelayNumber = RelayNumberMonotonicallyIncreases; - type ConsensusHook = ConsensusHook; - type WeightInfo = weights::cumulus_pallet_parachain_system::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type OnSystemEvent = (); + type SelfParaId = parachain_info::Pallet; + type DmpQueue = frame_support::traits::EnqueueWithOrigin; + type ReservedDmpWeight = ReservedDmpWeight; + type OutboundXcmpMessageSource = XcmpQueue; + type XcmpMessageHandler = XcmpQueue; + type ReservedXcmpWeight = ReservedXcmpWeight; + type CheckAssociatedRelayNumber = RelayNumberMonotonicallyIncreases; + type ConsensusHook = ConsensusHook; + type WeightInfo = weights::cumulus_pallet_parachain_system::WeightInfo; } type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook< - Runtime, - RELAY_CHAIN_SLOT_DURATION_MILLIS, - BLOCK_PROCESSING_VELOCITY, - UNINCLUDED_SEGMENT_CAPACITY, + Runtime, + RELAY_CHAIN_SLOT_DURATION_MILLIS, + BLOCK_PROCESSING_VELOCITY, + UNINCLUDED_SEGMENT_CAPACITY, >; impl pallet_insecure_randomness_collective_flip::Config for Runtime {} @@ -396,25 +400,25 @@ parameter_types! { } pub type PriceForSiblingParachainDelivery = polkadot_runtime_common::xcm_sender::ExponentialPrice< - FeeAssetId, - ToSiblingBaseDeliveryFee, - TransactionByteFee, - XcmpQueue, + FeeAssetId, + ToSiblingBaseDeliveryFee, + TransactionByteFee, + XcmpQueue, >; impl cumulus_pallet_xcmp_queue::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type ChannelInfo = ParachainSystem; - type VersionWrapper = PolkadotXcm; - type XcmpQueue = TransformOrigin; - type MaxInboundSuspended = sp_core::ConstU32<1_000>; - type ControllerOrigin = EitherOfDiverse< - EnsureRoot, - EnsureXcm>, - >; - type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin; - type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo; - type PriceForSiblingDelivery = PriceForSiblingParachainDelivery; + type RuntimeEvent = RuntimeEvent; + type ChannelInfo = ParachainSystem; + type VersionWrapper = PolkadotXcm; + type XcmpQueue = TransformOrigin; + type MaxInboundSuspended = sp_core::ConstU32<1_000>; + type ControllerOrigin = EitherOfDiverse< + EnsureRoot, + EnsureXcm>, + >; + type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin; + type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo; + type PriceForSiblingDelivery = PriceForSiblingParachainDelivery; } parameter_types! { @@ -422,25 +426,25 @@ parameter_types! { } impl pallet_message_queue::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type WeightInfo = weights::pallet_message_queue::WeightInfo; - #[cfg(feature = "runtime-benchmarks")] - type MessageProcessor = pallet_message_queue::mock_helpers::NoopMessageProcessor< - cumulus_primitives_core::AggregateMessageOrigin, - >; - #[cfg(not(feature = "runtime-benchmarks"))] - type MessageProcessor = xcm_builder::ProcessXcmMessage< - AggregateMessageOrigin, - xcm_executor::XcmExecutor, - RuntimeCall, - >; - type Size = u32; - // The XCMP queue pallet is only ever able to handle the `Sibling(ParaId)` origin: - type QueueChangeHandler = NarrowOriginToSibling; - type QueuePausedQuery = NarrowOriginToSibling; - type HeapSize = sp_core::ConstU32<{ 64 * 1024 }>; - type MaxStale = sp_core::ConstU32<8>; - type ServiceWeight = MessageQueueServiceWeight; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = weights::pallet_message_queue::WeightInfo; + #[cfg(feature = "runtime-benchmarks")] + type MessageProcessor = pallet_message_queue::mock_helpers::NoopMessageProcessor< + cumulus_primitives_core::AggregateMessageOrigin, + >; + #[cfg(not(feature = "runtime-benchmarks"))] + type MessageProcessor = xcm_builder::ProcessXcmMessage< + AggregateMessageOrigin, + xcm_executor::XcmExecutor, + RuntimeCall, + >; + type Size = u32; + // The XCMP queue pallet is only ever able to handle the `Sibling(ParaId)` origin: + type QueueChangeHandler = NarrowOriginToSibling; + type QueuePausedQuery = NarrowOriginToSibling; + type HeapSize = sp_core::ConstU32<{ 64 * 1024 }>; + type MaxStale = sp_core::ConstU32<8>; + type ServiceWeight = MessageQueueServiceWeight; } parameter_types! { @@ -460,69 +464,69 @@ parameter_types! { } impl pallet_encointer_scheduler::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type OnCeremonyPhaseChange = EncointerCeremonies; - type MomentsPerDay = MomentsPerDay; - type CeremonyMaster = MoreThanHalfCouncil; - type WeightInfo = weights::pallet_encointer_scheduler::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type OnCeremonyPhaseChange = EncointerCeremonies; + type MomentsPerDay = MomentsPerDay; + type CeremonyMaster = MoreThanHalfCouncil; + type WeightInfo = weights::pallet_encointer_scheduler::WeightInfo; } impl pallet_encointer_ceremonies::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type Public = ::Signer; - type Signature = Signature; - type RandomnessSource = RandomnessCollectiveFlip; - type MeetupSizeTarget = MeetupSizeTarget; - type MeetupMinSize = MeetupMinSize; - type MeetupNewbieLimitDivider = MeetupNewbieLimitDivider; - type CeremonyMaster = MoreThanHalfCouncil; - type WeightInfo = weights::pallet_encointer_ceremonies::WeightInfo; - type MaxAttestations = ConstU32<100>; + type RuntimeEvent = RuntimeEvent; + type Public = ::Signer; + type Signature = Signature; + type RandomnessSource = RandomnessCollectiveFlip; + type MeetupSizeTarget = MeetupSizeTarget; + type MeetupMinSize = MeetupMinSize; + type MeetupNewbieLimitDivider = MeetupNewbieLimitDivider; + type CeremonyMaster = MoreThanHalfCouncil; + type WeightInfo = weights::pallet_encointer_ceremonies::WeightInfo; + type MaxAttestations = ConstU32<100>; } impl pallet_encointer_communities::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type CommunityMaster = MoreThanHalfCouncil; - type TrustableForNonDestructiveAction = MoreThanHalfCouncil; - type WeightInfo = weights::pallet_encointer_communities::WeightInfo; - type MaxCommunityIdentifiers = ConstU32<10000>; - type MaxBootstrappers = ConstU32<10000>; - type MaxLocationsPerGeohash = ConstU32<10000>; - type MaxCommunityIdentifiersPerGeohash = ConstU32<10000>; + type RuntimeEvent = RuntimeEvent; + type CommunityMaster = MoreThanHalfCouncil; + type TrustableForNonDestructiveAction = MoreThanHalfCouncil; + type WeightInfo = weights::pallet_encointer_communities::WeightInfo; + type MaxCommunityIdentifiers = ConstU32<10000>; + type MaxBootstrappers = ConstU32<10000>; + type MaxLocationsPerGeohash = ConstU32<10000>; + type MaxCommunityIdentifiersPerGeohash = ConstU32<10000>; } impl pallet_encointer_balances::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type DefaultDemurrage = DefaultDemurrage; - type ExistentialDeposit = EncointerExistentialDeposit; - type CeremonyMaster = MoreThanHalfCouncil; - type WeightInfo = weights::pallet_encointer_balances::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type DefaultDemurrage = DefaultDemurrage; + type ExistentialDeposit = EncointerExistentialDeposit; + type CeremonyMaster = MoreThanHalfCouncil; + type WeightInfo = weights::pallet_encointer_balances::WeightInfo; } impl pallet_encointer_bazaar::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type WeightInfo = weights::pallet_encointer_bazaar::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = weights::pallet_encointer_bazaar::WeightInfo; } impl pallet_encointer_reputation_commitments::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type WeightInfo = weights::pallet_encointer_reputation_commitments::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = weights::pallet_encointer_reputation_commitments::WeightInfo; } impl pallet_encointer_faucet::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type ControllerOrigin = EnsureRoot; - type Currency = Balances; - type PalletId = FaucetPalletId; - type WeightInfo = weights::pallet_encointer_faucet::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type ControllerOrigin = EnsureRoot; + type Currency = Balances; + type PalletId = FaucetPalletId; + type WeightInfo = weights::pallet_encointer_faucet::WeightInfo; } impl pallet_aura::Config for Runtime { - type AuthorityId = AuraId; - type DisabledValidators = (); - type MaxAuthorities = MaxAuthorities; - type AllowMultipleBlocksPerSlot = ConstBool; - type SlotDuration = ConstU64; + type AuthorityId = AuraId; + type DisabledValidators = (); + type MaxAuthorities = MaxAuthorities; + type AllowMultipleBlocksPerSlot = ConstBool; + type SlotDuration = ConstU64; } parameter_types! { @@ -533,66 +537,84 @@ parameter_types! { } type MoreThanHalfCouncil = EitherOfDiverse< - EnsureRoot, - pallet_collective::EnsureProportionMoreThan, + EnsureRoot, + pallet_collective::EnsureProportionMoreThan, >; pub type CouncilCollective = pallet_collective::Instance1; impl pallet_collective::Config for Runtime { - type RuntimeOrigin = RuntimeOrigin; - type Proposal = RuntimeCall; - type RuntimeEvent = RuntimeEvent; - type MotionDuration = CouncilMotionDuration; - type MaxProposals = CouncilMaxProposals; - type DefaultVote = pallet_collective::PrimeDefaultVote; - type MaxMembers = CouncilMaxMembers; - type WeightInfo = weights::pallet_collective::WeightInfo; - type SetMembersOrigin = MoreThanHalfCouncil; - type MaxProposalWeight = MaxProposalWeight; + type RuntimeOrigin = RuntimeOrigin; + type Proposal = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type MotionDuration = CouncilMotionDuration; + type MaxProposals = CouncilMaxProposals; + type DefaultVote = pallet_collective::PrimeDefaultVote; + type MaxMembers = CouncilMaxMembers; + type WeightInfo = weights::pallet_collective::WeightInfo; + type SetMembersOrigin = MoreThanHalfCouncil; + type MaxProposalWeight = MaxProposalWeight; } // support for collective pallet impl pallet_membership::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type AddOrigin = MoreThanHalfCouncil; - type RemoveOrigin = MoreThanHalfCouncil; - type SwapOrigin = MoreThanHalfCouncil; - type ResetOrigin = MoreThanHalfCouncil; - type PrimeOrigin = MoreThanHalfCouncil; - type MembershipInitialized = Collective; - type MembershipChanged = Collective; - type MaxMembers = CouncilMaxMembers; - type WeightInfo = weights::pallet_membership::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type AddOrigin = MoreThanHalfCouncil; + type RemoveOrigin = MoreThanHalfCouncil; + type SwapOrigin = MoreThanHalfCouncil; + type ResetOrigin = MoreThanHalfCouncil; + type PrimeOrigin = MoreThanHalfCouncil; + type MembershipInitialized = Collective; + type MembershipChanged = Collective; + type MaxMembers = CouncilMaxMembers; + 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, +{ + fn handle_credit(credit: Credit, pallet_encointer_balances::Pallet>) { + if let Some(author) = pallet_authorship::Pallet::::author() { + // In case of error: Will drop the result triggering the `OnDrop` of the imbalance. + let _ = pallet_encointer_balances::Pallet::::resolve(&author, 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, - >; + type RuntimeEvent = RuntimeEvent; + type Fungibles = pallet_encointer_balances::Pallet; + type OnChargeAssetTransaction = pallet_asset_tx_payment::FungiblesAdapter< + encointer_balances_tx_payment::BalanceToCommunityBalance, + AssetsToBlockAuthor, + >; } impl pallet_authorship::Config for Runtime { - type FindAuthor = pallet_session::FindAccountFromAuthorIndex; - type EventHandler = (CollatorSelection, ); + 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; + 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! { @@ -601,19 +623,19 @@ parameter_types! { } 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; + 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! { @@ -630,8 +652,8 @@ 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, + // 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, @@ -672,60 +694,60 @@ pub type SignedBlock = generic::SignedBlock; pub type BlockId = generic::BlockId; /// The SignedExtension to the basic transaction logic. pub type SignedExtra = ( - frame_system::CheckNonZeroSender, - frame_system::CheckSpecVersion, - frame_system::CheckTxVersion, - frame_system::CheckGenesis, - frame_system::CheckEra, - frame_system::CheckNonce, - frame_system::CheckWeight, - pallet_asset_tx_payment::ChargeAssetTxPayment, + frame_system::CheckNonZeroSender, + frame_system::CheckSpecVersion, + frame_system::CheckTxVersion, + frame_system::CheckGenesis, + frame_system::CheckEra, + frame_system::CheckNonce, + frame_system::CheckWeight, + pallet_asset_tx_payment::ChargeAssetTxPayment, ); /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = -generic::UncheckedExtrinsic; + generic::UncheckedExtrinsic; /// Extrinsic type that has already been checked. pub type CheckedExtrinsic = generic::CheckedExtrinsic; /// Migrations to apply on runtime upgrade. pub type Migrations = ( - // 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 - // 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, - cumulus_pallet_xcmp_queue::migration::v4::MigrationToV4, - pallet_encointer_ceremonies::migrations::v2::MigrateToV2, - // permanent - pallet_xcm::migration::MigrateToLatestXcmVersion, + // 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 + // 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, + cumulus_pallet_xcmp_queue::migration::v4::MigrationToV4, + pallet_encointer_ceremonies::migrations::v2::MigrateToV2, + // permanent + pallet_xcm::migration::MigrateToLatestXcmVersion, ); /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< - Runtime, - Block, - frame_system::ChainContext, - Runtime, - AllPalletsWithSystem, - Migrations, + Runtime, + Block, + frame_system::ChainContext, + Runtime, + AllPalletsWithSystem, + Migrations, >; #[cfg(feature = "runtime-benchmarks")] mod benches { - frame_benchmarking::define_benchmarks!( + frame_benchmarking::define_benchmarks!( [frame_system, SystemBench::] [pallet_balances, Balances] [pallet_collective, Collective] [pallet_message_queue, MessageQueue] [pallet_membership, Membership] - [pallet_session, SessionBench::] - [pallet_collator_selection, CollatorSelection] + [pallet_session, SessionBench::] + [pallet_collator_selection, CollatorSelection] [pallet_timestamp, Timestamp] [pallet_utility, Utility] [pallet_proxy, Proxy] @@ -975,7 +997,7 @@ impl_runtime_apis! { 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 {} + 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> { @@ -1020,273 +1042,273 @@ cumulus_pallet_parachain_system::register_validate_block! { /// but it avoids potential collisions caused by different versions of crates. #[cfg(feature = "std")] pub fn aura_config_for_chain_spec(seeds: &[&str]) -> AuraConfig { - use sp_core::{ - crypto::{Pair, Public}, - sr25519, - }; - fn get_from_seed(seed: &str) -> ::Public { - TPublic::Pair::from_string(&format!("//{}", seed), None) - .expect("static values are valid; qed") - .public() - } - - AuraConfig { - authorities: seeds.iter().map(|s| get_from_seed::(s).into()).collect(), - } + use sp_core::{ + crypto::{Pair, Public}, + sr25519, + }; + fn get_from_seed(seed: &str) -> ::Public { + TPublic::Pair::from_string(&format!("//{}", seed), None) + .expect("static values are valid; qed") + .public() + } + + AuraConfig { + authorities: seeds.iter().map(|s| get_from_seed::(s).into()).collect(), + } } #[test] fn test_ed_is_one_tenth_of_relay() { - let relay_ed = kusama_runtime_constants::currency::EXISTENTIAL_DEPOSIT; - let encointer_ed = ExistentialDeposit::get(); - assert_eq!(relay_ed / 10, encointer_ed); + let relay_ed = kusama_runtime_constants::currency::EXISTENTIAL_DEPOSIT; + let encointer_ed = ExistentialDeposit::get(); + assert_eq!(relay_ed / 10, encointer_ed); } #[test] fn test_constants_compatiblity() { - assert_eq!( - ::kusama_runtime_constants::currency::EXISTENTIAL_DEPOSIT, - system_parachains_constants::kusama_runtime_constants::currency::EXISTENTIAL_DEPOSIT - ); - assert_eq!( - ::kusama_runtime_constants::currency::deposit(5, 3), - system_parachains_constants::kusama_runtime_constants::currency::deposit(5, 3) - ); - assert_eq!( - ::system_parachains_constants::AVERAGE_ON_INITIALIZE_RATIO * 1u32, - system_parachains_constants::AVERAGE_ON_INITIALIZE_RATIO * 1u32 - ); - assert_eq!( - ::system_parachains_constants::NORMAL_DISPATCH_RATIO * 1u32, - system_parachains_constants::NORMAL_DISPATCH_RATIO * 1u32 - ); - assert_eq!( - ::system_parachains_constants::MAXIMUM_BLOCK_WEIGHT.encode(), - system_parachains_constants::MAXIMUM_BLOCK_WEIGHT.encode() - ); - assert_eq!(::system_parachains_constants::MINUTES, system_parachains_constants::MINUTES); - assert_eq!(::system_parachains_constants::HOURS, system_parachains_constants::HOURS); - assert_eq!(::system_parachains_constants::DAYS, system_parachains_constants::DAYS); - assert_eq!( - ::system_parachains_constants::kusama::currency::SYSTEM_PARA_EXISTENTIAL_DEPOSIT, - system_parachains_constants::kusama::currency::SYSTEM_PARA_EXISTENTIAL_DEPOSIT - ); - assert_eq!( - ::system_parachains_constants::kusama::currency::UNITS, - system_parachains_constants::kusama::currency::UNITS - ); - assert_eq!( - ::system_parachains_constants::kusama::currency::QUID, - system_parachains_constants::kusama::currency::QUID - ); - assert_eq!( - ::system_parachains_constants::kusama::currency::CENTS, - system_parachains_constants::kusama::currency::CENTS - ); - assert_eq!( - ::system_parachains_constants::kusama::currency::MILLICENTS, - system_parachains_constants::kusama::currency::MILLICENTS - ); - assert_eq!( - ::system_parachains_constants::kusama::currency::system_para_deposit(5, 3), - system_parachains_constants::kusama::currency::system_para_deposit(5, 3) - ); - assert_eq!( - ::system_parachains_constants::kusama::fee::TRANSACTION_BYTE_FEE, - system_parachains_constants::kusama::fee::TRANSACTION_BYTE_FEE - ); - assert_eq!( - ::system_parachains_constants::kusama::fee::calculate_weight_to_fee( - &::system_parachains_constants::MAXIMUM_BLOCK_WEIGHT - ), - system_parachains_constants::kusama::fee::calculate_weight_to_fee( - &system_parachains_constants::MAXIMUM_BLOCK_WEIGHT - ) - ); + assert_eq!( + ::kusama_runtime_constants::currency::EXISTENTIAL_DEPOSIT, + system_parachains_constants::kusama_runtime_constants::currency::EXISTENTIAL_DEPOSIT + ); + assert_eq!( + ::kusama_runtime_constants::currency::deposit(5, 3), + system_parachains_constants::kusama_runtime_constants::currency::deposit(5, 3) + ); + assert_eq!( + ::system_parachains_constants::AVERAGE_ON_INITIALIZE_RATIO * 1u32, + system_parachains_constants::AVERAGE_ON_INITIALIZE_RATIO * 1u32 + ); + assert_eq!( + ::system_parachains_constants::NORMAL_DISPATCH_RATIO * 1u32, + system_parachains_constants::NORMAL_DISPATCH_RATIO * 1u32 + ); + assert_eq!( + ::system_parachains_constants::MAXIMUM_BLOCK_WEIGHT.encode(), + system_parachains_constants::MAXIMUM_BLOCK_WEIGHT.encode() + ); + assert_eq!(::system_parachains_constants::MINUTES, system_parachains_constants::MINUTES); + assert_eq!(::system_parachains_constants::HOURS, system_parachains_constants::HOURS); + assert_eq!(::system_parachains_constants::DAYS, system_parachains_constants::DAYS); + assert_eq!( + ::system_parachains_constants::kusama::currency::SYSTEM_PARA_EXISTENTIAL_DEPOSIT, + system_parachains_constants::kusama::currency::SYSTEM_PARA_EXISTENTIAL_DEPOSIT + ); + assert_eq!( + ::system_parachains_constants::kusama::currency::UNITS, + system_parachains_constants::kusama::currency::UNITS + ); + assert_eq!( + ::system_parachains_constants::kusama::currency::QUID, + system_parachains_constants::kusama::currency::QUID + ); + assert_eq!( + ::system_parachains_constants::kusama::currency::CENTS, + system_parachains_constants::kusama::currency::CENTS + ); + assert_eq!( + ::system_parachains_constants::kusama::currency::MILLICENTS, + system_parachains_constants::kusama::currency::MILLICENTS + ); + assert_eq!( + ::system_parachains_constants::kusama::currency::system_para_deposit(5, 3), + system_parachains_constants::kusama::currency::system_para_deposit(5, 3) + ); + assert_eq!( + ::system_parachains_constants::kusama::fee::TRANSACTION_BYTE_FEE, + system_parachains_constants::kusama::fee::TRANSACTION_BYTE_FEE + ); + assert_eq!( + ::system_parachains_constants::kusama::fee::calculate_weight_to_fee( + &::system_parachains_constants::MAXIMUM_BLOCK_WEIGHT + ), + system_parachains_constants::kusama::fee::calculate_weight_to_fee( + &system_parachains_constants::MAXIMUM_BLOCK_WEIGHT + ) + ); } #[test] fn test_transasction_byte_fee_is_one_tenth_of_relay() { - let relay_tbf = ::kusama_runtime_constants::fee::TRANSACTION_BYTE_FEE; - let parachain_tbf = TransactionByteFee::get(); - assert_eq!(relay_tbf / 10, parachain_tbf); + let relay_tbf = ::kusama_runtime_constants::fee::TRANSACTION_BYTE_FEE; + let parachain_tbf = TransactionByteFee::get(); + assert_eq!(relay_tbf / 10, parachain_tbf); } // The Encointer pallets do not have compatible versions with `polkadot-sdk`, making it difficult // for us to reuse the `system-parachains-constants` module. Therefore, we have copies of it here // with `test_constants_compatiblity`. mod system_parachains_constants { - use super::*; - use frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND; - - /// This determines the average expected block time that we are targeting. Blocks will be - /// produced at a minimum duration defined by `SLOT_DURATION`. `SLOT_DURATION` is picked up by - /// `pallet_timestamp` which is in turn picked up by `pallet_aura` to implement `fn - /// slot_duration()`. - /// - /// Change this to adjust the block time. - pub const MILLISECS_PER_BLOCK: u64 = 12000; - pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK; - - // Time is measured by number of blocks. - pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber); - pub const HOURS: BlockNumber = MINUTES * 60; - pub const DAYS: BlockNumber = HOURS * 24; - - /// We assume that ~5% of the block weight is consumed by `on_initialize` handlers. This is - /// used to limit the maximal weight of a single extrinsic. - pub const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5); - /// We allow `Normal` extrinsics to fill up the block up to 75%, the rest can be used by - /// Operational extrinsics. - pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); - - /// We allow for 0.5 seconds of compute with a 6 second average block time. - pub const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts( - WEIGHT_REF_TIME_PER_SECOND.saturating_div(2), - polkadot_primitives::MAX_POV_SIZE as u64, - ); - - pub(crate) mod kusama { - /// Consensus-related. - pub mod consensus { - /// Maximum number of blocks simultaneously accepted by the Runtime, not yet included - /// into the relay chain. - pub const UNINCLUDED_SEGMENT_CAPACITY: u32 = 1; - /// How many parachain blocks are processed by the relay chain per parent. Limits the - /// number of blocks authored per slot. - pub const BLOCK_PROCESSING_VELOCITY: u32 = 1; - /// Relay chain slot duration, in milliseconds. - pub const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32 = 6000; - } - - /// Constants relating to KSM. - pub mod currency { - use super::super::kusama_runtime_constants; - use polkadot_core_primitives::Balance; - - /// The default existential deposit for system chains. 1/10th of the Relay Chain's - /// existential deposit. Individual system parachains may modify this in special cases. - pub const SYSTEM_PARA_EXISTENTIAL_DEPOSIT: Balance = - kusama_runtime_constants::currency::EXISTENTIAL_DEPOSIT / 10; - - /// One "KSM" that a UI would show a user. - pub const UNITS: Balance = 1_000_000_000_000; - pub const QUID: Balance = UNITS / 30; - pub const CENTS: Balance = QUID / 100; - pub const MILLICENTS: Balance = CENTS / 1_000; - - /// Deposit rate for stored data. 1/100th of the Relay Chain's deposit rate. `items` is - /// the number of keys in storage and `bytes` is the size of the value. - pub const fn system_para_deposit(items: u32, bytes: u32) -> Balance { - kusama_runtime_constants::currency::deposit(items, bytes) / 100 - } - } - - /// Constants related to Kusama fee payment. - pub mod fee { - use frame_support::{ - pallet_prelude::Weight, - weights::{ - constants::ExtrinsicBaseWeight, FeePolynomial, WeightToFeeCoefficient, - WeightToFeeCoefficients, WeightToFeePolynomial, - }, - }; - use polkadot_core_primitives::Balance; - use smallvec::smallvec; - pub use sp_runtime::Perbill; - - /// Cost of every transaction byte at Kusama system parachains. - /// - /// It is the Relay Chain (Kusama) `TransactionByteFee` / 10. - pub const TRANSACTION_BYTE_FEE: Balance = super::currency::MILLICENTS; - - /// Handles converting a weight scalar to a fee value, based on the scale and - /// granularity of the node's balance type. - /// - /// This should typically create a mapping between the following ranges: - /// - [0, MAXIMUM_BLOCK_WEIGHT] - /// - [Balance::min, Balance::max] - /// - /// Yet, it can be used for any other sort of change to weight-fee. Some examples being: - /// - Setting it to `0` will essentially disable the weight fee. - /// - Setting it to `1` will cause the literal `#[weight = x]` values to be charged. - pub struct WeightToFee; - - impl frame_support::weights::WeightToFee for WeightToFee { - type Balance = Balance; - - fn weight_to_fee(weight: &Weight) -> Self::Balance { - let time_poly: FeePolynomial = RefTimeToFee::polynomial().into(); - let proof_poly: FeePolynomial = ProofSizeToFee::polynomial().into(); - - // Take the maximum instead of the sum to charge by the more scarce resource. - time_poly.eval(weight.ref_time()).max(proof_poly.eval(weight.proof_size())) - } - } - - /// Maps the reference time component of `Weight` to a fee. - pub struct RefTimeToFee; - - impl WeightToFeePolynomial for RefTimeToFee { - type Balance = Balance; - fn polynomial() -> WeightToFeeCoefficients { - // In Kusama, extrinsic base weight (smallest non-zero weight) is mapped to 1/10 - // CENT: The standard system parachain configuration is 1/10 of that, as in - // 1/100 CENT. - let p = super::currency::CENTS; - let q = 100 * Balance::from(ExtrinsicBaseWeight::get().ref_time()); - - smallvec![WeightToFeeCoefficient { + use super::*; + use frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND; + + /// This determines the average expected block time that we are targeting. Blocks will be + /// produced at a minimum duration defined by `SLOT_DURATION`. `SLOT_DURATION` is picked up by + /// `pallet_timestamp` which is in turn picked up by `pallet_aura` to implement `fn + /// slot_duration()`. + /// + /// Change this to adjust the block time. + pub const MILLISECS_PER_BLOCK: u64 = 12000; + pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK; + + // Time is measured by number of blocks. + pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber); + pub const HOURS: BlockNumber = MINUTES * 60; + pub const DAYS: BlockNumber = HOURS * 24; + + /// We assume that ~5% of the block weight is consumed by `on_initialize` handlers. This is + /// used to limit the maximal weight of a single extrinsic. + pub const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5); + /// We allow `Normal` extrinsics to fill up the block up to 75%, the rest can be used by + /// Operational extrinsics. + pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); + + /// We allow for 0.5 seconds of compute with a 6 second average block time. + pub const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts( + WEIGHT_REF_TIME_PER_SECOND.saturating_div(2), + polkadot_primitives::MAX_POV_SIZE as u64, + ); + + pub(crate) mod kusama { + /// Consensus-related. + pub mod consensus { + /// Maximum number of blocks simultaneously accepted by the Runtime, not yet included + /// into the relay chain. + pub const UNINCLUDED_SEGMENT_CAPACITY: u32 = 1; + /// How many parachain blocks are processed by the relay chain per parent. Limits the + /// number of blocks authored per slot. + pub const BLOCK_PROCESSING_VELOCITY: u32 = 1; + /// Relay chain slot duration, in milliseconds. + pub const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32 = 6000; + } + + /// Constants relating to KSM. + pub mod currency { + use super::super::kusama_runtime_constants; + use polkadot_core_primitives::Balance; + + /// The default existential deposit for system chains. 1/10th of the Relay Chain's + /// existential deposit. Individual system parachains may modify this in special cases. + pub const SYSTEM_PARA_EXISTENTIAL_DEPOSIT: Balance = + kusama_runtime_constants::currency::EXISTENTIAL_DEPOSIT / 10; + + /// One "KSM" that a UI would show a user. + pub const UNITS: Balance = 1_000_000_000_000; + pub const QUID: Balance = UNITS / 30; + pub const CENTS: Balance = QUID / 100; + pub const MILLICENTS: Balance = CENTS / 1_000; + + /// Deposit rate for stored data. 1/100th of the Relay Chain's deposit rate. `items` is + /// the number of keys in storage and `bytes` is the size of the value. + pub const fn system_para_deposit(items: u32, bytes: u32) -> Balance { + kusama_runtime_constants::currency::deposit(items, bytes) / 100 + } + } + + /// Constants related to Kusama fee payment. + pub mod fee { + use frame_support::{ + pallet_prelude::Weight, + weights::{ + constants::ExtrinsicBaseWeight, FeePolynomial, WeightToFeeCoefficient, + WeightToFeeCoefficients, WeightToFeePolynomial, + }, + }; + use polkadot_core_primitives::Balance; + use smallvec::smallvec; + pub use sp_runtime::Perbill; + + /// Cost of every transaction byte at Kusama system parachains. + /// + /// It is the Relay Chain (Kusama) `TransactionByteFee` / 10. + pub const TRANSACTION_BYTE_FEE: Balance = super::currency::MILLICENTS; + + /// Handles converting a weight scalar to a fee value, based on the scale and + /// granularity of the node's balance type. + /// + /// This should typically create a mapping between the following ranges: + /// - [0, MAXIMUM_BLOCK_WEIGHT] + /// - [Balance::min, Balance::max] + /// + /// Yet, it can be used for any other sort of change to weight-fee. Some examples being: + /// - Setting it to `0` will essentially disable the weight fee. + /// - Setting it to `1` will cause the literal `#[weight = x]` values to be charged. + pub struct WeightToFee; + + impl frame_support::weights::WeightToFee for WeightToFee { + type Balance = Balance; + + fn weight_to_fee(weight: &Weight) -> Self::Balance { + let time_poly: FeePolynomial = RefTimeToFee::polynomial().into(); + let proof_poly: FeePolynomial = ProofSizeToFee::polynomial().into(); + + // Take the maximum instead of the sum to charge by the more scarce resource. + time_poly.eval(weight.ref_time()).max(proof_poly.eval(weight.proof_size())) + } + } + + /// Maps the reference time component of `Weight` to a fee. + pub struct RefTimeToFee; + + impl WeightToFeePolynomial for RefTimeToFee { + type Balance = Balance; + fn polynomial() -> WeightToFeeCoefficients { + // In Kusama, extrinsic base weight (smallest non-zero weight) is mapped to 1/10 + // CENT: The standard system parachain configuration is 1/10 of that, as in + // 1/100 CENT. + let p = super::currency::CENTS; + let q = 100 * Balance::from(ExtrinsicBaseWeight::get().ref_time()); + + smallvec![WeightToFeeCoefficient { degree: 1, negative: false, coeff_frac: Perbill::from_rational(p % q, q), coeff_integer: p / q, }] - } - } + } + } - /// Maps the proof size component of `Weight` to a fee. - pub struct ProofSizeToFee; + /// Maps the proof size component of `Weight` to a fee. + pub struct ProofSizeToFee; - impl WeightToFeePolynomial for ProofSizeToFee { - type Balance = Balance; - fn polynomial() -> WeightToFeeCoefficients { - // Map 10kb proof to 1 CENT. - let p = super::currency::CENTS; - let q = 10_000; + impl WeightToFeePolynomial for ProofSizeToFee { + type Balance = Balance; + fn polynomial() -> WeightToFeeCoefficients { + // Map 10kb proof to 1 CENT. + let p = super::currency::CENTS; + let q = 10_000; - smallvec![WeightToFeeCoefficient { + smallvec![WeightToFeeCoefficient { degree: 1, negative: false, coeff_frac: Perbill::from_rational(p % q, q), coeff_integer: p / q, }] - } - } - - #[cfg(test)] - pub fn calculate_weight_to_fee(weight: &Weight) -> Balance { - ::weight_to_fee(weight) - } - } - } - - pub(crate) mod kusama_runtime_constants { - /// Money matters. - pub mod currency { - use polkadot_primitives::Balance; - - /// The existential deposit. - pub const EXISTENTIAL_DEPOSIT: Balance = 1 * CENTS; - - pub const UNITS: Balance = 1_000_000_000_000; - pub const QUID: Balance = UNITS / 30; - pub const CENTS: Balance = QUID / 100; - pub const MILLICENTS: Balance = CENTS / 1_000; - - pub const fn deposit(items: u32, bytes: u32) -> Balance { - items as Balance * 2_000 * CENTS + (bytes as Balance) * 100 * MILLICENTS - } - } - } + } + } + + #[cfg(test)] + pub fn calculate_weight_to_fee(weight: &Weight) -> Balance { + ::weight_to_fee(weight) + } + } + } + + pub(crate) mod kusama_runtime_constants { + /// Money matters. + pub mod currency { + use polkadot_primitives::Balance; + + /// The existential deposit. + pub const EXISTENTIAL_DEPOSIT: Balance = 1 * CENTS; + + pub const UNITS: Balance = 1_000_000_000_000; + pub const QUID: Balance = UNITS / 30; + pub const CENTS: Balance = QUID / 100; + pub const MILLICENTS: Balance = CENTS / 1_000; + + pub const fn deposit(items: u32, bytes: u32) -> Balance { + items as Balance * 2_000 * CENTS + (bytes as Balance) * 100 * MILLICENTS + } + } + } } From d8f179c9c7bef80b2030f573c274772c99be2f18 Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Wed, 10 Apr 2024 13:42:35 +0200 Subject: [PATCH 06/29] fmt --- .../src/system_parachains_specs.rs | 516 +++++++++--------- system-parachains/encointer/src/xcm_config.rs | 282 +++++----- 2 files changed, 400 insertions(+), 398 deletions(-) diff --git a/chain-spec-generator/src/system_parachains_specs.rs b/chain-spec-generator/src/system_parachains_specs.rs index c53ad7dccf..2d6d6b9b3c 100644 --- a/chain-spec-generator/src/system_parachains_specs.rs +++ b/chain-spec-generator/src/system_parachains_specs.rs @@ -26,10 +26,10 @@ use sp_core::sr25519; #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, ChainSpecGroup, ChainSpecExtension)] #[serde(deny_unknown_fields)] pub struct Extensions { - /// The relay chain of the Parachain. - pub relay_chain: String, - /// The id of the Parachain. - pub para_id: u32, + /// The relay chain of the Parachain. + pub relay_chain: String, + /// The id of the Parachain. + pub para_id: u32, } pub type AssetHubPolkadotChainSpec = sc_chain_spec::GenericChainSpec<(), Extensions>; @@ -71,86 +71,86 @@ const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION; /// Invulnerable Collators pub fn invulnerables() -> Vec<(AccountId, AuraId)> { - vec![ - (get_account_id_from_seed::("Alice"), get_from_seed::("Alice")), - (get_account_id_from_seed::("Bob"), get_from_seed::("Bob")), - ] + vec![ + (get_account_id_from_seed::("Alice"), get_from_seed::("Alice")), + (get_account_id_from_seed::("Bob"), get_from_seed::("Bob")), + ] } /// Invulnerable Collators for the particular case of AssetHubPolkadot pub fn invulnerables_asset_hub_polkadot() -> Vec<(AccountId, AssetHubPolkadotAuraId)> { - vec![ - ( - get_account_id_from_seed::("Alice"), - get_from_seed::("Alice"), - ), - ( - get_account_id_from_seed::("Bob"), - get_from_seed::("Bob"), - ), - ] + vec![ + ( + get_account_id_from_seed::("Alice"), + get_from_seed::("Alice"), + ), + ( + get_account_id_from_seed::("Bob"), + get_from_seed::("Bob"), + ), + ] } /// Generate the session keys from individual elements. /// /// The input must be a tuple of individual keys (a single arg for now since we have just one key). pub fn coretime_kusama_session_keys(keys: AuraId) -> coretime_kusama_runtime::SessionKeys { - coretime_kusama_runtime::SessionKeys { aura: keys } + coretime_kusama_runtime::SessionKeys { aura: keys } } /// Generate the session keys from individual elements. /// /// The input must be a tuple of individual keys (a single arg for now since we have just one key). pub fn asset_hub_polkadot_session_keys( - keys: AssetHubPolkadotAuraId, + keys: AssetHubPolkadotAuraId, ) -> asset_hub_polkadot_runtime::SessionKeys { - asset_hub_polkadot_runtime::SessionKeys { aura: keys } + asset_hub_polkadot_runtime::SessionKeys { aura: keys } } /// Generate the session keys from individual elements. /// /// The input must be a tuple of individual keys (a single arg for now since we have just one key). pub fn asset_hub_kusama_session_keys(keys: AuraId) -> asset_hub_kusama_runtime::SessionKeys { - asset_hub_kusama_runtime::SessionKeys { aura: keys } + asset_hub_kusama_runtime::SessionKeys { aura: keys } } /// Generate the session keys from individual elements. /// /// The input must be a tuple of individual keys (a single arg for now since we have just one key). pub fn collectives_polkadot_session_keys( - keys: AuraId, + keys: AuraId, ) -> collectives_polkadot_runtime::SessionKeys { - collectives_polkadot_runtime::SessionKeys { aura: keys } + collectives_polkadot_runtime::SessionKeys { aura: keys } } /// Generate the session keys from individual elements. /// /// The input must be a tuple of individual keys (a single arg for now since we have just one key). pub fn bridge_hub_polkadot_session_keys(keys: AuraId) -> bridge_hub_polkadot_runtime::SessionKeys { - bridge_hub_polkadot_runtime::SessionKeys { aura: keys } + bridge_hub_polkadot_runtime::SessionKeys { aura: keys } } /// Generate the session keys from individual elements. /// /// The input must be a tuple of individual keys (a single arg for now since we have just one key). pub fn bridge_hub_kusama_session_keys(keys: AuraId) -> bridge_hub_kusama_runtime::SessionKeys { - bridge_hub_kusama_runtime::SessionKeys { aura: keys } + bridge_hub_kusama_runtime::SessionKeys { aura: keys } } /// Generate the session keys from individual elements. /// /// The input must be a tuple of individual keys (a single arg for now since we have just one key). pub fn people_kusama_session_keys(keys: AuraId) -> people_kusama_runtime::SessionKeys { - people_kusama_runtime::SessionKeys { aura: keys } + people_kusama_runtime::SessionKeys { aura: keys } } // AssetHubPolkadot fn asset_hub_polkadot_genesis( - invulnerables: Vec<(AccountId, AssetHubPolkadotAuraId)>, - endowed_accounts: Vec, - id: ParaId, + invulnerables: Vec<(AccountId, AssetHubPolkadotAuraId)>, + endowed_accounts: Vec, + id: ParaId, ) -> serde_json::Value { - serde_json::json!({ + serde_json::json!({ "balances": asset_hub_polkadot_runtime::BalancesConfig { balances: endowed_accounts .iter() @@ -188,41 +188,41 @@ fn asset_hub_polkadot_genesis( } fn asset_hub_polkadot_local_genesis(para_id: ParaId) -> serde_json::Value { - asset_hub_polkadot_genesis( - // initial collators. - invulnerables_asset_hub_polkadot(), - testnet_accounts(), - para_id, - ) + asset_hub_polkadot_genesis( + // initial collators. + invulnerables_asset_hub_polkadot(), + testnet_accounts(), + para_id, + ) } pub fn asset_hub_polkadot_local_testnet_config() -> Result, String> { - let mut properties = sc_chain_spec::Properties::new(); - properties.insert("ss58Format".into(), 0.into()); - properties.insert("tokenSymbol".into(), "DOT".into()); - properties.insert("tokenDecimals".into(), 10.into()); - - Ok(Box::new( - AssetHubPolkadotChainSpec::builder( - asset_hub_polkadot_runtime::WASM_BINARY.expect("AssetHubPolkadot wasm not available!"), - Extensions { relay_chain: "polkadot-local".into(), para_id: 1000 }, - ) - .with_name("Polkadot Asset Hub Local") - .with_id("asset-hub-polkadot-local") - .with_chain_type(ChainType::Local) - .with_genesis_config_patch(asset_hub_polkadot_local_genesis(1000.into())) - .with_properties(properties) - .build(), - )) + let mut properties = sc_chain_spec::Properties::new(); + properties.insert("ss58Format".into(), 0.into()); + properties.insert("tokenSymbol".into(), "DOT".into()); + properties.insert("tokenDecimals".into(), 10.into()); + + Ok(Box::new( + AssetHubPolkadotChainSpec::builder( + asset_hub_polkadot_runtime::WASM_BINARY.expect("AssetHubPolkadot wasm not available!"), + Extensions { relay_chain: "polkadot-local".into(), para_id: 1000 }, + ) + .with_name("Polkadot Asset Hub Local") + .with_id("asset-hub-polkadot-local") + .with_chain_type(ChainType::Local) + .with_genesis_config_patch(asset_hub_polkadot_local_genesis(1000.into())) + .with_properties(properties) + .build(), + )) } // AssetHubKusama fn asset_hub_kusama_genesis( - invulnerables: Vec<(AccountId, AuraId)>, - endowed_accounts: Vec, - id: ParaId, + invulnerables: Vec<(AccountId, AuraId)>, + endowed_accounts: Vec, + id: ParaId, ) -> serde_json::Value { - serde_json::json!({ + serde_json::json!({ "balances": asset_hub_kusama_runtime::BalancesConfig { balances: endowed_accounts .iter() @@ -260,41 +260,41 @@ fn asset_hub_kusama_genesis( } fn asset_hub_kusama_local_genesis(para_id: ParaId) -> serde_json::Value { - asset_hub_kusama_genesis( - // initial collators. - invulnerables(), - testnet_accounts(), - para_id, - ) + asset_hub_kusama_genesis( + // initial collators. + invulnerables(), + testnet_accounts(), + para_id, + ) } pub fn asset_hub_kusama_local_testnet_config() -> Result, String> { - let mut properties = sc_chain_spec::Properties::new(); - properties.insert("ss58Format".into(), 2.into()); - properties.insert("tokenSymbol".into(), "KSM".into()); - properties.insert("tokenDecimals".into(), 12.into()); - - Ok(Box::new( - AssetHubKusamaChainSpec::builder( - asset_hub_kusama_runtime::WASM_BINARY.expect("AssetHubKusama wasm not available!"), - Extensions { relay_chain: "kusama-local".into(), para_id: 1000 }, - ) - .with_name("Kusama Asset Hub Local") - .with_id("asset-hub-kusama-local") - .with_chain_type(ChainType::Local) - .with_genesis_config_patch(asset_hub_kusama_local_genesis(1000.into())) - .with_properties(properties) - .build(), - )) + let mut properties = sc_chain_spec::Properties::new(); + properties.insert("ss58Format".into(), 2.into()); + properties.insert("tokenSymbol".into(), "KSM".into()); + properties.insert("tokenDecimals".into(), 12.into()); + + Ok(Box::new( + AssetHubKusamaChainSpec::builder( + asset_hub_kusama_runtime::WASM_BINARY.expect("AssetHubKusama wasm not available!"), + Extensions { relay_chain: "kusama-local".into(), para_id: 1000 }, + ) + .with_name("Kusama Asset Hub Local") + .with_id("asset-hub-kusama-local") + .with_chain_type(ChainType::Local) + .with_genesis_config_patch(asset_hub_kusama_local_genesis(1000.into())) + .with_properties(properties) + .build(), + )) } // CollectivesPolkadot fn collectives_polkadot_genesis( - invulnerables: Vec<(AccountId, AuraId)>, - endowed_accounts: Vec, - id: ParaId, + invulnerables: Vec<(AccountId, AuraId)>, + endowed_accounts: Vec, + id: ParaId, ) -> serde_json::Value { - serde_json::json!({ + serde_json::json!({ "balances": collectives_polkadot_runtime::BalancesConfig { balances: endowed_accounts .iter() @@ -332,42 +332,42 @@ fn collectives_polkadot_genesis( } fn collectives_polkadot_local_genesis(para_id: ParaId) -> serde_json::Value { - collectives_polkadot_genesis( - // initial collators. - invulnerables(), - testnet_accounts(), - para_id, - ) + collectives_polkadot_genesis( + // initial collators. + invulnerables(), + testnet_accounts(), + para_id, + ) } pub fn collectives_polkadot_local_testnet_config() -> Result, String> { - let mut properties = sc_chain_spec::Properties::new(); - properties.insert("ss58Format".into(), 0.into()); - properties.insert("tokenSymbol".into(), "DOT".into()); - properties.insert("tokenDecimals".into(), 10.into()); - - Ok(Box::new( - CollectivesPolkadotChainSpec::builder( - collectives_polkadot_runtime::WASM_BINARY - .expect("CollectivesPolkadot wasm not available!"), - Extensions { relay_chain: "polkadot-local".into(), para_id: 1001 }, - ) - .with_name("Polkadot Collectives Local") - .with_id("collectives-polkadot-local") - .with_chain_type(ChainType::Local) - .with_genesis_config_patch(collectives_polkadot_local_genesis(1001.into())) - .with_properties(properties) - .build(), - )) + let mut properties = sc_chain_spec::Properties::new(); + properties.insert("ss58Format".into(), 0.into()); + properties.insert("tokenSymbol".into(), "DOT".into()); + properties.insert("tokenDecimals".into(), 10.into()); + + Ok(Box::new( + CollectivesPolkadotChainSpec::builder( + collectives_polkadot_runtime::WASM_BINARY + .expect("CollectivesPolkadot wasm not available!"), + Extensions { relay_chain: "polkadot-local".into(), para_id: 1001 }, + ) + .with_name("Polkadot Collectives Local") + .with_id("collectives-polkadot-local") + .with_chain_type(ChainType::Local) + .with_genesis_config_patch(collectives_polkadot_local_genesis(1001.into())) + .with_properties(properties) + .build(), + )) } // BridgeHubPolkadot fn bridge_hub_polkadot_genesis( - invulnerables: Vec<(AccountId, AuraId)>, - endowed_accounts: Vec, - id: ParaId, + invulnerables: Vec<(AccountId, AuraId)>, + endowed_accounts: Vec, + id: ParaId, ) -> serde_json::Value { - serde_json::json!({ + serde_json::json!({ "balances": bridge_hub_polkadot_runtime::BalancesConfig { balances: endowed_accounts .iter() @@ -410,42 +410,42 @@ fn bridge_hub_polkadot_genesis( } fn bridge_hub_polkadot_local_genesis(para_id: ParaId) -> serde_json::Value { - bridge_hub_polkadot_genesis( - // initial collators. - invulnerables(), - testnet_accounts(), - para_id, - ) + bridge_hub_polkadot_genesis( + // initial collators. + invulnerables(), + testnet_accounts(), + para_id, + ) } pub fn bridge_hub_polkadot_local_testnet_config() -> Result, String> { - let mut properties = sc_chain_spec::Properties::new(); - properties.insert("ss58Format".into(), 0.into()); - properties.insert("tokenSymbol".into(), "DOT".into()); - properties.insert("tokenDecimals".into(), 10.into()); - - Ok(Box::new( - BridgeHubPolkadotChainSpec::builder( - bridge_hub_polkadot_runtime::WASM_BINARY - .expect("BridgeHubPolkadot wasm not available!"), - Extensions { relay_chain: "polkadot-local".into(), para_id: 1002 }, - ) - .with_name("Polkadot Bridge Hub Local") - .with_id("bridge-hub-polkadot-local") - .with_chain_type(ChainType::Local) - .with_genesis_config_patch(bridge_hub_polkadot_local_genesis(1002.into())) - .with_properties(properties) - .build(), - )) + let mut properties = sc_chain_spec::Properties::new(); + properties.insert("ss58Format".into(), 0.into()); + properties.insert("tokenSymbol".into(), "DOT".into()); + properties.insert("tokenDecimals".into(), 10.into()); + + Ok(Box::new( + BridgeHubPolkadotChainSpec::builder( + bridge_hub_polkadot_runtime::WASM_BINARY + .expect("BridgeHubPolkadot wasm not available!"), + Extensions { relay_chain: "polkadot-local".into(), para_id: 1002 }, + ) + .with_name("Polkadot Bridge Hub Local") + .with_id("bridge-hub-polkadot-local") + .with_chain_type(ChainType::Local) + .with_genesis_config_patch(bridge_hub_polkadot_local_genesis(1002.into())) + .with_properties(properties) + .build(), + )) } // BridgeHubKusama fn bridge_hub_kusama_genesis( - invulnerables: Vec<(AccountId, AuraId)>, - endowed_accounts: Vec, - id: ParaId, + invulnerables: Vec<(AccountId, AuraId)>, + endowed_accounts: Vec, + id: ParaId, ) -> serde_json::Value { - serde_json::json!({ + serde_json::json!({ "balances": bridge_hub_kusama_runtime::BalancesConfig { balances: endowed_accounts .iter() @@ -488,37 +488,37 @@ fn bridge_hub_kusama_genesis( } fn bridge_hub_kusama_local_genesis(para_id: ParaId) -> serde_json::Value { - bridge_hub_kusama_genesis( - // initial collators. - invulnerables(), - testnet_accounts(), - para_id, - ) + bridge_hub_kusama_genesis( + // initial collators. + invulnerables(), + testnet_accounts(), + para_id, + ) } pub fn bridge_hub_kusama_local_testnet_config() -> Result, String> { - let mut properties = sc_chain_spec::Properties::new(); - properties.insert("ss58Format".into(), 2.into()); - properties.insert("tokenSymbol".into(), "KSM".into()); - properties.insert("tokenDecimals".into(), 12.into()); - - Ok(Box::new( - BridgeHubKusamaChainSpec::builder( - bridge_hub_kusama_runtime::WASM_BINARY.expect("BridgeHubKusama wasm not available!"), - Extensions { relay_chain: "kusama-local".into(), para_id: 1002 }, - ) - .with_name("Kusama Bridge Hub Local") - .with_id("bridge-hub-kusama-local") - .with_chain_type(ChainType::Local) - .with_genesis_config_patch(bridge_hub_kusama_local_genesis(1002.into())) - .with_properties(properties) - .build(), - )) + let mut properties = sc_chain_spec::Properties::new(); + properties.insert("ss58Format".into(), 2.into()); + properties.insert("tokenSymbol".into(), "KSM".into()); + properties.insert("tokenDecimals".into(), 12.into()); + + Ok(Box::new( + BridgeHubKusamaChainSpec::builder( + bridge_hub_kusama_runtime::WASM_BINARY.expect("BridgeHubKusama wasm not available!"), + Extensions { relay_chain: "kusama-local".into(), para_id: 1002 }, + ) + .with_name("Kusama Bridge Hub Local") + .with_id("bridge-hub-kusama-local") + .with_chain_type(ChainType::Local) + .with_genesis_config_patch(bridge_hub_kusama_local_genesis(1002.into())) + .with_properties(properties) + .build(), + )) } // GluttonKusama fn glutton_kusama_genesis(id: ParaId) -> serde_json::Value { - serde_json::json!({ + serde_json::json!({ "parachainInfo": glutton_kusama_runtime::ParachainInfoConfig { parachain_id: id, ..Default::default() @@ -527,30 +527,30 @@ fn glutton_kusama_genesis(id: ParaId) -> serde_json::Value { } fn glutton_kusama_local_genesis(id: ParaId) -> serde_json::Value { - glutton_kusama_genesis(id) + glutton_kusama_genesis(id) } pub fn glutton_kusama_local_testnet_config() -> Result, String> { - let mut properties = sc_chain_spec::Properties::new(); - properties.insert("ss58Format".into(), 2.into()); - - Ok(Box::new( - GluttonKusamaChainSpec::builder( - glutton_kusama_runtime::WASM_BINARY.expect("GluttonKusama wasm not available!"), - Extensions { relay_chain: "kusama-local".into(), para_id: 1300 }, - ) - .with_name("Kusama Glutton Local") - .with_id("glutton-kusama-local") - .with_chain_type(ChainType::Local) - .with_genesis_config_patch(glutton_kusama_local_genesis(1300.into())) - .with_properties(properties) - .build(), - )) + let mut properties = sc_chain_spec::Properties::new(); + properties.insert("ss58Format".into(), 2.into()); + + Ok(Box::new( + GluttonKusamaChainSpec::builder( + glutton_kusama_runtime::WASM_BINARY.expect("GluttonKusama wasm not available!"), + Extensions { relay_chain: "kusama-local".into(), para_id: 1300 }, + ) + .with_name("Kusama Glutton Local") + .with_id("glutton-kusama-local") + .with_chain_type(ChainType::Local) + .with_genesis_config_patch(glutton_kusama_local_genesis(1300.into())) + .with_properties(properties) + .build(), + )) } // EncointerKusama fn encointer_kusama_genesis(endowed_accounts: Vec, id: u32) -> serde_json::Value { - serde_json::json!({ + serde_json::json!({ "balances": asset_hub_kusama_runtime::BalancesConfig { balances: endowed_accounts .iter() @@ -587,40 +587,40 @@ fn encointer_kusama_genesis(endowed_accounts: Vec, id: u32) -> serde_ } fn encointer_kusama_local_genesis(para_id: u32) -> serde_json::Value { - encointer_kusama_genesis( - // initial collators. - testnet_accounts(), - para_id, - ) + encointer_kusama_genesis( + // initial collators. + testnet_accounts(), + para_id, + ) } pub fn encointer_kusama_local_testnet_config() -> Result, String> { - let mut properties = sc_chain_spec::Properties::new(); - properties.insert("ss58Format".into(), 2.into()); - properties.insert("tokenSymbol".into(), "KSM".into()); - properties.insert("tokenDecimals".into(), 12.into()); - - Ok(Box::new( - EncointerKusamaChainSpec::builder( - encointer_kusama_runtime::WASM_BINARY.expect("EncointerKusama wasm not available!"), - Extensions { relay_chain: "kusama-local".into(), para_id: 1001 }, - ) - .with_name("Kusama Encointer Local") - .with_id("encointer-kusama-local") - .with_chain_type(ChainType::Local) - .with_genesis_config_patch(encointer_kusama_local_genesis(1001)) - .with_properties(properties) - .build(), - )) + let mut properties = sc_chain_spec::Properties::new(); + properties.insert("ss58Format".into(), 2.into()); + properties.insert("tokenSymbol".into(), "KSM".into()); + properties.insert("tokenDecimals".into(), 12.into()); + + Ok(Box::new( + EncointerKusamaChainSpec::builder( + encointer_kusama_runtime::WASM_BINARY.expect("EncointerKusama wasm not available!"), + Extensions { relay_chain: "kusama-local".into(), para_id: 1001 }, + ) + .with_name("Kusama Encointer Local") + .with_id("encointer-kusama-local") + .with_chain_type(ChainType::Local) + .with_genesis_config_patch(encointer_kusama_local_genesis(1001)) + .with_properties(properties) + .build(), + )) } // CoretimeKusama fn coretime_kusama_genesis( - invulnerables: Vec<(AccountId, AuraId)>, - endowed_accounts: Vec, - id: ParaId, + invulnerables: Vec<(AccountId, AuraId)>, + endowed_accounts: Vec, + id: ParaId, ) -> serde_json::Value { - serde_json::json!({ + serde_json::json!({ "balances": coretime_kusama_runtime::BalancesConfig { balances: endowed_accounts .iter() @@ -658,41 +658,41 @@ fn coretime_kusama_genesis( } fn coretime_kusama_local_genesis(para_id: ParaId) -> serde_json::Value { - coretime_kusama_genesis( - // initial collators. - invulnerables(), - testnet_accounts(), - para_id, - ) + coretime_kusama_genesis( + // initial collators. + invulnerables(), + testnet_accounts(), + para_id, + ) } pub fn coretime_kusama_local_testnet_config() -> Result, String> { - let mut properties = sc_chain_spec::Properties::new(); - properties.insert("ss58Format".into(), 2.into()); - properties.insert("tokenSymbol".into(), "KSM".into()); - properties.insert("tokenDecimals".into(), 12.into()); - - Ok(Box::new( - CoretimeKusamaChainSpec::builder( - coretime_kusama_runtime::WASM_BINARY.expect("CoretimeKusama wasm not available!"), - Extensions { relay_chain: "kusama-local".into(), para_id: 1005 }, - ) - .with_name("Kusama Coretime Local") - .with_id("coretime-kusama-local") - .with_chain_type(ChainType::Local) - .with_genesis_config_patch(coretime_kusama_local_genesis(1005.into())) - .with_properties(properties) - .build(), - )) + let mut properties = sc_chain_spec::Properties::new(); + properties.insert("ss58Format".into(), 2.into()); + properties.insert("tokenSymbol".into(), "KSM".into()); + properties.insert("tokenDecimals".into(), 12.into()); + + Ok(Box::new( + CoretimeKusamaChainSpec::builder( + coretime_kusama_runtime::WASM_BINARY.expect("CoretimeKusama wasm not available!"), + Extensions { relay_chain: "kusama-local".into(), para_id: 1005 }, + ) + .with_name("Kusama Coretime Local") + .with_id("coretime-kusama-local") + .with_chain_type(ChainType::Local) + .with_genesis_config_patch(coretime_kusama_local_genesis(1005.into())) + .with_properties(properties) + .build(), + )) } // PeopleKusama fn people_kusama_genesis( - invulnerables: Vec<(AccountId, AuraId)>, - endowed_accounts: Vec, - id: ParaId, + invulnerables: Vec<(AccountId, AuraId)>, + endowed_accounts: Vec, + id: ParaId, ) -> serde_json::Value { - serde_json::json!({ + serde_json::json!({ "balances": people_kusama_runtime::BalancesConfig { balances: endowed_accounts .iter() @@ -730,30 +730,30 @@ fn people_kusama_genesis( } fn people_kusama_local_genesis(para_id: ParaId) -> serde_json::Value { - people_kusama_genesis( - // initial collators. - invulnerables(), - testnet_accounts(), - para_id, - ) + people_kusama_genesis( + // initial collators. + invulnerables(), + testnet_accounts(), + para_id, + ) } pub fn people_kusama_local_testnet_config() -> Result, String> { - let mut properties = sc_chain_spec::Properties::new(); - properties.insert("ss58Format".into(), 2.into()); - properties.insert("tokenSymbol".into(), "KSM".into()); - properties.insert("tokenDecimals".into(), 12.into()); - - Ok(Box::new( - PeopleKusamaChainSpec::builder( - people_kusama_runtime::WASM_BINARY.expect("PeopleKusama wasm not available!"), - Extensions { relay_chain: "kusama-local".into(), para_id: 1004 }, - ) - .with_name("Kusama People Local") - .with_id("people-kusama-local") - .with_chain_type(ChainType::Local) - .with_genesis_config_patch(people_kusama_local_genesis(1004.into())) - .with_properties(properties) - .build(), - )) + let mut properties = sc_chain_spec::Properties::new(); + properties.insert("ss58Format".into(), 2.into()); + properties.insert("tokenSymbol".into(), "KSM".into()); + properties.insert("tokenDecimals".into(), 12.into()); + + Ok(Box::new( + PeopleKusamaChainSpec::builder( + people_kusama_runtime::WASM_BINARY.expect("PeopleKusama wasm not available!"), + Extensions { relay_chain: "kusama-local".into(), para_id: 1004 }, + ) + .with_name("Kusama People Local") + .with_id("people-kusama-local") + .with_chain_type(ChainType::Local) + .with_genesis_config_patch(people_kusama_local_genesis(1004.into())) + .with_properties(properties) + .build(), + )) } diff --git a/system-parachains/encointer/src/xcm_config.rs b/system-parachains/encointer/src/xcm_config.rs index 6d5f72cff6..76b62b485d 100644 --- a/system-parachains/encointer/src/xcm_config.rs +++ b/system-parachains/encointer/src/xcm_config.rs @@ -16,31 +16,33 @@ //! Almost identical to ../asset-hubs/asset-hub-kusama use super::{ - AccountId, Balances, 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, - traits::{Contains, Everything, Nothing}, - weights::Weight, + parameter_types, + traits::{Contains, Everything, Nothing}, + weights::Weight, }; use frame_system::EnsureRoot; use pallet_xcm::XcmPassthrough; -use parachains_common::impls::ToStakingPot; -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; use xcm::latest::prelude::*; 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, + 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; @@ -58,52 +60,52 @@ parameter_types! { /// when determining ownership of accounts for asset transacting and when attempting to use XCM /// `Transact` in order to determine the dispatch Origin. pub type LocationToAccountId = ( - // The parent (Relay-chain) origin converts to the parent `AccountId`. - ParentIsPreset, - // Sibling parachain origins convert to AccountId via the `ParaId::into`. - SiblingParachainConvertsVia, - // Straight up local `AccountId32` origins just alias directly to `AccountId`. - AccountId32Aliases, - // Here/local root location to `AccountId`. - HashedDescription, + // The parent (Relay-chain) origin converts to the parent `AccountId`. + ParentIsPreset, + // Sibling parachain origins convert to AccountId via the `ParaId::into`. + SiblingParachainConvertsVia, + // Straight up local `AccountId32` origins just alias directly to `AccountId`. + AccountId32Aliases, + // Here/local root location to `AccountId`. + HashedDescription, ); /// Means for transacting the native currency on this chain. pub type FungibleTransactor = FungibleAdapter< - // Use this currency: - Balances, - // Use this currency when it is a fungible asset matching the given location or name: - IsConcrete, - // Convert an XCM `Location` into a local account ID: - LocationToAccountId, - // Our chain's account ID type (we can't get away without mentioning it explicitly): - AccountId, - // We don't track any teleports of `Balances`. - (), + // Use this currency: + Balances, + // Use this currency when it is a fungible asset matching the given location or name: + IsConcrete, + // Convert an XCM `Location` into a local account ID: + LocationToAccountId, + // Our chain's account ID type (we can't get away without mentioning it explicitly): + AccountId, + // We don't track any teleports of `Balances`. + (), >; /// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance, /// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can /// biases the kind of local `Origin` it will become. pub type XcmOriginToTransactDispatchOrigin = ( - // Sovereign account converter; this attempts to derive an `AccountId` from the origin location - // using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for - // foreign chains who want to have a local sovereign account on this chain which they control. - SovereignSignedViaLocation, - // Native converter for Relay-chain (Parent) location; will convert to a `Relay` origin when - // recognised. - RelayChainAsNative, - // Native converter for sibling Parachains; will convert to a `SiblingPara` origin when - // recognised. - SiblingParachainAsNative, - // Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a - // transaction from the Root origin. - ParentAsSuperuser, - // Native signed account converter; this just converts an `AccountId32` origin into a normal - // `RuntimeOrigin::Signed` origin of the same 32-byte value. - SignedAccountId32AsNative, - // Xcm origins can be represented natively under the Xcm pallet's Xcm origin. - XcmPassthrough, + // Sovereign account converter; this attempts to derive an `AccountId` from the origin location + // using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for + // foreign chains who want to have a local sovereign account on this chain which they control. + SovereignSignedViaLocation, + // Native converter for Relay-chain (Parent) location; will convert to a `Relay` origin when + // recognised. + RelayChainAsNative, + // Native converter for sibling Parachains; will convert to a `SiblingPara` origin when + // recognised. + SiblingParachainAsNative, + // Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a + // transaction from the Root origin. + ParentAsSuperuser, + // Native signed account converter; this just converts an `AccountId32` origin into a normal + // `RuntimeOrigin::Signed` origin of the same 32-byte value. + SignedAccountId32AsNative, + // Xcm origins can be represented natively under the Xcm pallet's Xcm origin. + XcmPassthrough, ); parameter_types! { @@ -115,45 +117,45 @@ parameter_types! { pub struct ParentOrParentsPlurality; impl Contains for ParentOrParentsPlurality { - fn contains(location: &Location) -> bool { - matches!(location.unpack(), (1, []) | (1, [Plurality { .. }])) - } + fn contains(location: &Location) -> bool { + matches!(location.unpack(), (1, []) | (1, [Plurality { .. }])) + } } pub type Barrier = TrailingSetTopicAsId< - DenyThenTry< - DenyReserveTransferToRelayChain, - ( - TakeWeightCredit, - // Expected responses are OK. - AllowKnownQueryResponses, - // 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>, - >, - ), - >, + DenyThenTry< + DenyReserveTransferToRelayChain, + ( + TakeWeightCredit, + // Expected responses are OK. + AllowKnownQueryResponses, + // 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 { - // This is safe, as we prevent arbitrary xcm-transact executions. - // For rationale, see:https://github.com/paritytech/polkadot/blob/19fdd197aff085f7f66e54942999fd536e7df475/runtime/kusama/src/xcm_config.rs#L171 - true - } + fn contains(_call: &RuntimeCall) -> bool { + // This is safe, as we prevent arbitrary xcm-transact executions. + // For rationale, see:https://github.com/paritytech/polkadot/blob/19fdd197aff085f7f66e54942999fd536e7df475/runtime/kusama/src/xcm_config.rs#L171 + true + } } parameter_types! { @@ -168,32 +170,32 @@ pub type TrustedTeleporters = ConcreteAssetFromSystem; pub struct XcmConfig; impl xcm_executor::Config for XcmConfig { - type RuntimeCall = RuntimeCall; - type XcmSender = XcmRouter; - type AssetTransactor = FungibleTransactor; - type OriginConverter = XcmOriginToTransactDispatchOrigin; - type IsReserve = NativeAsset; - type IsTeleporter = TrustedTeleporters; - type UniversalLocation = UniversalLocation; - type Barrier = Barrier; - type Weigher = FixedWeightBounds; - type Trader = - UsingComponents>; - type ResponseHandler = PolkadotXcm; - type AssetTrap = PolkadotXcm; - type AssetClaims = PolkadotXcm; - type SubscriptionService = PolkadotXcm; - type PalletInstancesInfo = crate::AllPalletsWithSystem; - type MaxAssetsIntoHolding = MaxAssetsIntoHolding; - type AssetLocker = (); - type AssetExchanger = (); - type FeeManager = (); - type MessageExporter = (); - type UniversalAliases = Nothing; - type CallDispatcher = RuntimeCall; - type SafeCallFilter = SafeCallFilter; - type Aliasers = Nothing; - type TransactionalProcessor = FrameTransactionalProcessor; + type RuntimeCall = RuntimeCall; + type XcmSender = XcmRouter; + type AssetTransactor = FungibleTransactor; + type OriginConverter = XcmOriginToTransactDispatchOrigin; + type IsReserve = NativeAsset; + type IsTeleporter = TrustedTeleporters; + type UniversalLocation = UniversalLocation; + type Barrier = Barrier; + type Weigher = FixedWeightBounds; + type Trader = + UsingComponents>; + type ResponseHandler = PolkadotXcm; + type AssetTrap = PolkadotXcm; + type AssetClaims = PolkadotXcm; + type SubscriptionService = PolkadotXcm; + type PalletInstancesInfo = crate::AllPalletsWithSystem; + type MaxAssetsIntoHolding = MaxAssetsIntoHolding; + type AssetLocker = (); + type AssetExchanger = (); + type FeeManager = (); + type MessageExporter = (); + type UniversalAliases = Nothing; + type CallDispatcher = RuntimeCall; + type SafeCallFilter = SafeCallFilter; + type Aliasers = Nothing; + type TransactionalProcessor = FrameTransactionalProcessor; } /// Converts a local signed origin into an XCM location. @@ -203,10 +205,10 @@ pub type LocalOriginToLocation = SignedToAccountId32, - // ..and XCMP to communicate with the sibling chains. - XcmpQueue, + // Two routers - use UMP to communicate with the relay chain: + cumulus_primitives_utility::ParentAsUmp, + // ..and XCMP to communicate with the sibling chains. + XcmpQueue, ); #[cfg(feature = "runtime-benchmarks")] @@ -215,36 +217,36 @@ parameter_types! { } impl pallet_xcm::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - // We want to disallow users sending (arbitrary) XCMs from this chain. - type SendXcmOrigin = EnsureXcmOrigin; - type XcmRouter = XcmRouter; - // We support local origins dispatching XCM executions in principle... - type ExecuteXcmOrigin = EnsureXcmOrigin; - // ... but disallow generic XCM execution. As a result only teleports and reserve transfers are - // allowed. - type XcmExecuteFilter = Nothing; - type XcmExecutor = XcmExecutor; - type XcmTeleportFilter = Everything; - type XcmReserveTransferFilter = Everything; - type Weigher = FixedWeightBounds; - type RuntimeOrigin = RuntimeOrigin; - type RuntimeCall = RuntimeCall; - const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; - type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; - type Currency = Balances; - type CurrencyMatcher = (); - type TrustedLockers = (); - type SovereignAccountOf = LocationToAccountId; - type MaxLockers = ConstU32<8>; - type WeightInfo = pallet_xcm::TestWeightInfo; - type AdminOrigin = EnsureRoot; - type UniversalLocation = UniversalLocation; - type MaxRemoteLockConsumers = ConstU32<0>; - type RemoteLockConsumerIdentifier = (); + type RuntimeEvent = RuntimeEvent; + // We want to disallow users sending (arbitrary) XCMs from this chain. + type SendXcmOrigin = EnsureXcmOrigin; + type XcmRouter = XcmRouter; + // We support local origins dispatching XCM executions in principle... + type ExecuteXcmOrigin = EnsureXcmOrigin; + // ... but disallow generic XCM execution. As a result only teleports and reserve transfers are + // allowed. + type XcmExecuteFilter = Nothing; + type XcmExecutor = XcmExecutor; + type XcmTeleportFilter = Everything; + type XcmReserveTransferFilter = Everything; + type Weigher = FixedWeightBounds; + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; + const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; + type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; + type Currency = Balances; + type CurrencyMatcher = (); + type TrustedLockers = (); + type SovereignAccountOf = LocationToAccountId; + type MaxLockers = ConstU32<8>; + type WeightInfo = pallet_xcm::TestWeightInfo; + type AdminOrigin = EnsureRoot; + type UniversalLocation = UniversalLocation; + type MaxRemoteLockConsumers = ConstU32<0>; + type RemoteLockConsumerIdentifier = (); } impl cumulus_pallet_xcm::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type XcmExecutor = XcmExecutor; + type RuntimeEvent = RuntimeEvent; + type XcmExecutor = XcmExecutor; } From 27b70e060b101e2bbe1ebce04ff759f37cc8627e Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Wed, 10 Apr 2024 13:45:52 +0200 Subject: [PATCH 07/29] add changelog --- CHANGELOG.md | 221 +++++++++++++++++++++++++++++++++++---------------- 1 file changed, 152 insertions(+), 69 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fd19d7b88f..8c0095a682 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,140 +4,223 @@ Changelog for the runtimes governed by the Polkadot Fellowship. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## [Unreleased] + +### Changed + +- 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.0] 28.03.2024 ### Added -- 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)) -- 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)) -- Refund any leases that are not migrated to Coretime (have holes in them/have not yet started) ([polkadot-fellows/runtimes#206](https://github.com/polkadot-fellows/runtimes/pull/206)) -- Enable Elastic Scaling node side feature for Kusama ([polkadot-fellows/runtimes#205](https://github.com/polkadot-fellows/runtimes/pull/205)) +- 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)) +- 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)) +- Refund any leases that are not migrated to Coretime (have holes in them/have not yet + started) ([polkadot-fellows/runtimes#206](https://github.com/polkadot-fellows/runtimes/pull/206)) +- Enable Elastic Scaling node side feature for + Kusama ([polkadot-fellows/runtimes#205](https://github.com/polkadot-fellows/runtimes/pull/205)) - Cancel Parachain Auctions ([polkadot-fellows/runtimes#215](https://github.com/polkadot-fellows/runtimes/pull/215)) -- Upgrade encointer protocol to 6.1.0 ([polkadot-fellows/runtimes#236](https://github.com/polkadot-fellows/runtimes/pull/236)) -- Update NFT deposits according to RFC-45 ([polkadot-fellows/runtimes#237](https://github.com/polkadot-fellows/runtimes/pull/237)) +- Upgrade encointer protocol to + 6.1.0 ([polkadot-fellows/runtimes#236](https://github.com/polkadot-fellows/runtimes/pull/236)) +- Update NFT deposits according to + RFC-45 ([polkadot-fellows/runtimes#237](https://github.com/polkadot-fellows/runtimes/pull/237)) - Add Kusama People Chain ([polkadot-fellows/runtimes#217](https://github.com/polkadot-fellows/runtimes/pull/217)) -- Asset Conversion setup for Polkadot Asset Hub, and XCM Swap Weight Trader for both Asset Hubs ([polkadot-fellows/runtimes#218](https://github.com/polkadot-fellows/runtimes/pull/218)) -- Adds Snowbridge to Kusama and Polkadot ([polkadot-fellows/runtimes#130](https://github.com/polkadot-fellows/runtimes/pull/130)) +- Asset Conversion setup for Polkadot Asset Hub, and XCM Swap Weight Trader for both Asset + Hubs ([polkadot-fellows/runtimes#218](https://github.com/polkadot-fellows/runtimes/pull/218)) +- Adds Snowbridge to Kusama and + Polkadot ([polkadot-fellows/runtimes#130](https://github.com/polkadot-fellows/runtimes/pull/130)) - Add the Kusama Coretime Chain ([polkadot-fellows/runtimes#212](https://github.com/polkadot-fellows/runtimes/pull/212)) ### Changed -- Upgrade parachains runtime API from v7 to v8 in Kusama ([context](https://paritytech.github.io/polkadot-sdk/book/protocol-validator-disabling.html), [polkadot-fellows/runtimes#148](https://github.com/polkadot-fellows/runtimes/pull/148)). +- Upgrade parachains runtime API from v7 to v8 in + Kusama ([context](https://paritytech.github.io/polkadot-sdk/book/protocol-validator-disabling.html), [polkadot-fellows/runtimes#148](https://github.com/polkadot-fellows/runtimes/pull/148)). - Fixed the lowering of Asset Hub existential deposits. -- MMR leaves generated by `pallet_mmr` point to the next-authority-set of the current block instead of the prior block [polkadot-fellows/runtimes#169](https://github.com/polkadot-fellows/runtimes/pull/169) -- Deprecate the `xcm::body::TREASURER_INDEX` constant and use the standard `Treasury` variant from the `xcm::BodyId` type instead ([polkadot-fellows/runtimes#149](https://github.com/polkadot-fellows/runtimes/pull/149)) -- Bump parachains runtime API to v9 in Kusama to enable the `node_features` function [polkadot-fellows/runtimes#194](https://github.com/polkadot-fellows/runtimes/pull/194) -- Bump parachains runtime API to v10 in Kusama to enable the `approval-voting-params` function [polkadot-fellows/runtimes#204](https://github.com/polkadot-fellows/runtimes/pull/204) -- Use Relay Chain's Treasury Pallet account as a destination for XCM fees on System Parachain ([polkadot-fellows/runtimes#191](https://github.com/polkadot-fellows/runtimes/pull/191)) -- Bump parachains runtime API to v10 in Polkadot to enable async-backing subsystems(still in backwards compatible mode) [polkadot-fellows/runtimes#222](https://github.com/polkadot-fellows/runtimes/pull/222) -- Prepared system parachain runtimes for async backing enabling ([polkadot-fellows/runtimes#228](https://github.com/polkadot-fellows/runtimes/pull/228)) +- MMR leaves generated by `pallet_mmr` point to the next-authority-set of the current block instead of the prior + block [polkadot-fellows/runtimes#169](https://github.com/polkadot-fellows/runtimes/pull/169) +- Deprecate the `xcm::body::TREASURER_INDEX` constant and use the standard `Treasury` variant from the `xcm::BodyId` + type instead ([polkadot-fellows/runtimes#149](https://github.com/polkadot-fellows/runtimes/pull/149)) +- Bump parachains runtime API to v9 in Kusama to enable the `node_features` + function [polkadot-fellows/runtimes#194](https://github.com/polkadot-fellows/runtimes/pull/194) +- Bump parachains runtime API to v10 in Kusama to enable the `approval-voting-params` + function [polkadot-fellows/runtimes#204](https://github.com/polkadot-fellows/runtimes/pull/204) +- Use Relay Chain's Treasury Pallet account as a destination for XCM fees on System + Parachain ([polkadot-fellows/runtimes#191](https://github.com/polkadot-fellows/runtimes/pull/191)) +- Bump parachains runtime API to v10 in Polkadot to enable async-backing subsystems(still in backwards compatible + mode) [polkadot-fellows/runtimes#222](https://github.com/polkadot-fellows/runtimes/pull/222) +- Prepared system parachain runtimes for async backing + enabling ([polkadot-fellows/runtimes#228](https://github.com/polkadot-fellows/runtimes/pull/228)) - Update runtime weights [polkadot-fellows/runtimes#223](https://github.com/polkadot-fellows/runtimes/pull/223) -- Treasury Spend detects relative locations of the native asset ([polkadot-fellows/runtimes#233](https://github.com/polkadot-fellows/runtimes/pull/233)) -- Increase consumer reference limits for Asset Hubs ([polkadot-fellows/runtimes#258](https://github.com/polkadot-fellows/runtimes/pull/258)) -- Updated Asset Hub asset class creation deposit to use `system_para_deposit()` ([polkadot-fellows/runtimes#259](https://github.com/polkadot-fellows/runtimes/pull/259)) +- Treasury Spend detects relative locations of the native + asset ([polkadot-fellows/runtimes#233](https://github.com/polkadot-fellows/runtimes/pull/233)) +- Increase consumer reference limits for Asset + Hubs ([polkadot-fellows/runtimes#258](https://github.com/polkadot-fellows/runtimes/pull/258)) +- Updated Asset Hub asset class creation deposit to + use `system_para_deposit()` ([polkadot-fellows/runtimes#259](https://github.com/polkadot-fellows/runtimes/pull/259)) ### Removed -- Removed the `SafeCallFilter` from the Relay Chain XCM config ([polkadot-fellows/runtimes#172](https://github.com/polkadot-fellows/runtimes/pull/172)). +- Removed the `SafeCallFilter` from the Relay Chain XCM + config ([polkadot-fellows/runtimes#172](https://github.com/polkadot-fellows/runtimes/pull/172)). - Removed the `ImOnline` pallet ([polkadot-fellows/runtimes#178](https://github.com/polkadot-fellows/runtimes/pull/178)) ### Fixed -- Fixed the cost of a single byte, sent over bridge to use the `TransactionByteFee` constant of the bridged chain [polkadot-fellows/runtimes#174](https://github.com/polkadot-fellows/runtimes/pull/174). +- Fixed the cost of a single byte, sent over bridge to use the `TransactionByteFee` constant of the bridged + chain [polkadot-fellows/runtimes#174](https://github.com/polkadot-fellows/runtimes/pull/174). ### Based on Polkadot-SDK -- Upgrade dependencies to the [polkadot-sdk@1.5.0](https://github.com/paritytech/polkadot-sdk/releases/tag/polkadot-v1.5.0) release ([polkadot-fellows/runtimes#137](https://github.com/polkadot-fellows/runtimes/pull/137)) -- Upgrade dependencies to the [polkadot-sdk@1.6.0](https://github.com/paritytech/polkadot-sdk/releases/tag/polkadot-v1.6.0) release ([polkadot-fellows/runtimes#159](https://github.com/polkadot-fellows/runtimes/pull/159)) -- Upgrade dependencies to the [polkadot-sdk@1.7.0](https://github.com/paritytech/polkadot-sdk/releases/tag/polkadot-v1.7.0) release ([polkadot-fellows/runtimes#187](https://github.com/polkadot-fellows/runtimes/pull/187)) +- Upgrade dependencies to + the [polkadot-sdk@1.5.0](https://github.com/paritytech/polkadot-sdk/releases/tag/polkadot-v1.5.0) + release ([polkadot-fellows/runtimes#137](https://github.com/polkadot-fellows/runtimes/pull/137)) +- Upgrade dependencies to + the [polkadot-sdk@1.6.0](https://github.com/paritytech/polkadot-sdk/releases/tag/polkadot-v1.6.0) + release ([polkadot-fellows/runtimes#159](https://github.com/polkadot-fellows/runtimes/pull/159)) +- Upgrade dependencies to + the [polkadot-sdk@1.7.0](https://github.com/paritytech/polkadot-sdk/releases/tag/polkadot-v1.7.0) + release ([polkadot-fellows/runtimes#187](https://github.com/polkadot-fellows/runtimes/pull/187)) ## [1.1.1] 25.01.2024 ### Fixed -- Fixed the lowering of Asset Hub existential deposits ([polkadot-fellows/runtimes#158](https://github.com/polkadot-fellows/runtimes/pull/158)). +- Fixed the lowering of Asset Hub existential + deposits ([polkadot-fellows/runtimes#158](https://github.com/polkadot-fellows/runtimes/pull/158)). ## [1.1.0] 10.01.2024 ### Changed -- Upgrade parachains runtime API from v5 to v7 in Polkadot and Kusama ([polkadot-fellows/runtimes#56](https://github.com/polkadot-fellows/runtimes/pull/56)) -- Upgrade Preimage pallet's config implementations to adapt the new `Consideration` API ([polkadot-fellows/runtimes#56](https://github.com/polkadot-fellows/runtimes/pull/56)) -- Remove `experimental` feature flag for `pallet-society`, `pallet-xcm`, and `runtime-common` crates imports ([polkadot-fellows/runtimes#56](https://github.com/polkadot-fellows/runtimes/pull/56)) -- Election provider: use a geometric deposit base calculation for EPM signed submissions in Polkadot and Kusama ([polkadot-fellows/runtimes#56](https://github.com/polkadot-fellows/runtimes/pull/56)) -- Make `IdentityInfo` generic in `pallet-identity` ([polkadot-fellows/runtimes#87](https://github.com/polkadot-fellows/runtimes/pull/87)). Context: https://github.com/paritytech/polkadot-sdk/pull/1661 -- Whitelist `force_default_xcm_version` in XCM call filter ([polkadot-fellows/runtimes#45](https://github.com/polkadot-fellows/runtimes/pull/45)) -- Update the fellowship salary budget amount in alignment with the Fellowship Salary [RFC](https://github.com/polkadot-fellows/RFCs/pull/50) ([polkadot-fellows/runtimes#121](https://github.com/polkadot-fellows/runtimes/pull/121)) -- Set up an account ID for the local root location on Polkadot Collectives ([polkadot-fellows/runtimes#125](https://github.com/polkadot-fellows/runtimes/pull/125)) -- Increase confirmation period for treasury spend tracks on Polkadot & Kusama ([polkadot-fellows/runtimes#119](https://github.com/polkadot-fellows/runtimes/pull/119)) +- Upgrade parachains runtime API from v5 to v7 in Polkadot and + Kusama ([polkadot-fellows/runtimes#56](https://github.com/polkadot-fellows/runtimes/pull/56)) +- Upgrade Preimage pallet's config implementations to adapt the new `Consideration` + API ([polkadot-fellows/runtimes#56](https://github.com/polkadot-fellows/runtimes/pull/56)) +- Remove `experimental` feature flag for `pallet-society`, `pallet-xcm`, and `runtime-common` crates + imports ([polkadot-fellows/runtimes#56](https://github.com/polkadot-fellows/runtimes/pull/56)) +- Election provider: use a geometric deposit base calculation for EPM signed submissions in Polkadot and + Kusama ([polkadot-fellows/runtimes#56](https://github.com/polkadot-fellows/runtimes/pull/56)) +- Make `IdentityInfo` generic + in `pallet-identity` ([polkadot-fellows/runtimes#87](https://github.com/polkadot-fellows/runtimes/pull/87)). + Context: https://github.com/paritytech/polkadot-sdk/pull/1661 +- Whitelist `force_default_xcm_version` in XCM call + filter ([polkadot-fellows/runtimes#45](https://github.com/polkadot-fellows/runtimes/pull/45)) +- Update the fellowship salary budget amount in alignment with the Fellowship + Salary [RFC](https://github.com/polkadot-fellows/RFCs/pull/50) ([polkadot-fellows/runtimes#121](https://github.com/polkadot-fellows/runtimes/pull/121)) +- Set up an account ID for the local root location on Polkadot + Collectives ([polkadot-fellows/runtimes#125](https://github.com/polkadot-fellows/runtimes/pull/125)) +- Increase confirmation period for treasury spend tracks on Polkadot & + Kusama ([polkadot-fellows/runtimes#119](https://github.com/polkadot-fellows/runtimes/pull/119)) ### Added -- Enable async backing on Kusama ([polkadot-fellows/runtimes#87](https://github.com/polkadot-fellows/runtimes/pull/87)). Context: https://github.com/paritytech/polkadot-sdk/pull/1543 -- Implemented GenesisBuilder API for all runtimes ([polkadot-fellows/runtimes#87](https://github.com/polkadot-fellows/runtimes/pull/87)). Context: https://github.com/paritytech/polkadot-sdk/pull/1492 -- XCM transport fees are now exponential and are sent to a treasury account ([polkadot-fellows/runtimes#87](https://github.com/polkadot-fellows/runtimes/pull/87)). Context: https://github.com/paritytech/polkadot-sdk/pull/1234 -- System parachains are now trusted teleporters of each other ([polkadot-fellows/runtimes#87](https://github.com/polkadot-fellows/runtimes/pull/87)). Context: https://github.com/paritytech/polkadot-sdk/pull/1368 -- Treasury is able to spend various asset kinds ([polkadot-fellows/runtimes#87](https://github.com/polkadot-fellows/runtimes/pull/87)) +- Enable async backing on Kusama ([polkadot-fellows/runtimes#87](https://github.com/polkadot-fellows/runtimes/pull/87)). + Context: https://github.com/paritytech/polkadot-sdk/pull/1543 +- Implemented GenesisBuilder API for all + runtimes ([polkadot-fellows/runtimes#87](https://github.com/polkadot-fellows/runtimes/pull/87)). + Context: https://github.com/paritytech/polkadot-sdk/pull/1492 +- XCM transport fees are now exponential and are sent to a treasury + account ([polkadot-fellows/runtimes#87](https://github.com/polkadot-fellows/runtimes/pull/87)). + Context: https://github.com/paritytech/polkadot-sdk/pull/1234 +- System parachains are now trusted teleporters of each + other ([polkadot-fellows/runtimes#87](https://github.com/polkadot-fellows/runtimes/pull/87)). + Context: https://github.com/paritytech/polkadot-sdk/pull/1368 +- Treasury is able to spend various asset + kinds ([polkadot-fellows/runtimes#87](https://github.com/polkadot-fellows/runtimes/pull/87)) - Add BEEFY to Polkadot ([polkadot-fellows/runtimes#65](https://github.com/polkadot-fellows/runtimes/pull/65)) -- Fellowship Treasury pallet on Polkadot Collectives ([polkadot-fellows/runtimes#109](https://github.com/polkadot-fellows/runtimes/pull/109)) -- Added Polkadot <> Kusama bridge to support asset transfers between Asset Hubs ([polkadot-fellows/runtimes#108](https://github.com/polkadot-fellows/runtimes/pull/108)) +- Fellowship Treasury pallet on Polkadot + Collectives ([polkadot-fellows/runtimes#109](https://github.com/polkadot-fellows/runtimes/pull/109)) +- Added Polkadot <> Kusama bridge to support asset transfers between Asset + Hubs ([polkadot-fellows/runtimes#108](https://github.com/polkadot-fellows/runtimes/pull/108)) ### Fixed -- Add missing weight functions for `runtime_parachains_hrmp` and `preimage` pallets ([polkadot-fellows/runtimes#56](https://github.com/polkadot-fellows/runtimes/pull/56)) -- Fix for Reward Deficit in the pool ([polkadot-fellows/runtimes#87](https://github.com/polkadot-fellows/runtimes/pull/87)). Context: https://github.com/paritytech/polkadot-sdk/pull/1255 +- Add missing weight functions for `runtime_parachains_hrmp` and `preimage` + pallets ([polkadot-fellows/runtimes#56](https://github.com/polkadot-fellows/runtimes/pull/56)) +- Fix for Reward Deficit in the + pool ([polkadot-fellows/runtimes#87](https://github.com/polkadot-fellows/runtimes/pull/87)). + Context: https://github.com/paritytech/polkadot-sdk/pull/1255 ## [1.0.1] 14.11.2023 ### Changed -- Restore governance lock periods to 7 days in Polkadot ([polkadot-fellows/runtimes#86](https://github.com/polkadot-fellows/runtimes/pull/86)) +- Restore governance lock periods to 7 days in + Polkadot ([polkadot-fellows/runtimes#86](https://github.com/polkadot-fellows/runtimes/pull/86)) ## [1.0.0] 22.10.2023 ### Changed -- Update Polkadot ideal staking rate ([polkadot-fellows/runtimes#26](https://github.com/polkadot-fellows/runtimes/pull/26)) -- Treasury deprecate `propose_spend` dispatchable ([paritytech/substrate#14538](https://github.com/paritytech/substrate/pull/14538)) +- Update Polkadot ideal staking + rate ([polkadot-fellows/runtimes#26](https://github.com/polkadot-fellows/runtimes/pull/26)) +- Treasury deprecate `propose_spend` + dispatchable ([paritytech/substrate#14538](https://github.com/paritytech/substrate/pull/14538)) - Use benchmarked weights for `XCM` ([paritytech/polkadot#7077](https://github.com/paritytech/polkadot/pull/7077)) -- Put HRMP Channel Management on General Admin Track ([paritytech/polkadot#7477](https://github.com/paritytech/polkadot/pull/7477)) -- Improve locking mechanism for parachains ([paritytech/polkadot-sdk#1290](https://github.com/paritytech/polkadot-sdk/pull/1290)) +- Put HRMP Channel Management on General Admin + Track ([paritytech/polkadot#7477](https://github.com/paritytech/polkadot/pull/7477)) +- Improve locking mechanism for + parachains ([paritytech/polkadot-sdk#1290](https://github.com/paritytech/polkadot-sdk/pull/1290)) - Allow Root to initiate auctions ([paritytech/polkadot#7449](https://github.com/paritytech/polkadot/pull/7449)) - Remark: Allow any kind of origin ([paritytech/substrate#14260](https://github.com/paritytech/substrate/pull/14260)) -- Im-Online: Remove network state from heartbeats ([paritytech/substrate#14251](https://github.com/paritytech/substrate/pull/14251)) -- Nomination pools: disallow setting above global max commission ([paritytech/substrate#14496](https://github.com/paritytech/substrate/pull/14496)) +- Im-Online: Remove network state from + heartbeats ([paritytech/substrate#14251](https://github.com/paritytech/substrate/pull/14251)) +- Nomination pools: disallow setting above global max + commission ([paritytech/substrate#14496](https://github.com/paritytech/substrate/pull/14496)) - Rename Statemint/Statemine to Asset Hub ([paritytech/cumulus#2633](https://github.com/paritytech/cumulus/pull/2633)) -- Fellowship: Voters can initiate proposals on their votable tracks ([paritytech/cumulus#2725](https://github.com/paritytech/cumulus/pull/2725)) +- Fellowship: Voters can initiate proposals on their votable + tracks ([paritytech/cumulus#2725](https://github.com/paritytech/cumulus/pull/2725)) - Root can promote on Polkadot Collectives ([paritytech/cumulus#2781](https://github.com/paritytech/cumulus/pull/2781)) -- Add New Assets Privileged Functions to Appropriate Proxy Types ([paritytech/cumulus#2839](https://github.com/paritytech/cumulus/pull/2839)) -- Better Handling of Candidates Who Become Invulnerable ([paritytech/cumulus#2801](https://github.com/paritytech/cumulus/pull/2801)) +- Add New Assets Privileged Functions to Appropriate Proxy + Types ([paritytech/cumulus#2839](https://github.com/paritytech/cumulus/pull/2839)) +- Better Handling of Candidates Who Become + Invulnerable ([paritytech/cumulus#2801](https://github.com/paritytech/cumulus/pull/2801)) ### Added -- Implement dynamic number of nominators ([paritytech/substrate#12970](https://github.com/paritytech/substrate/pull/12970) & [paritytech/polkadot#6807](https://github.com/paritytech/polkadot/pull/6807)) +- Implement dynamic number of + nominators ([paritytech/substrate#12970](https://github.com/paritytech/substrate/pull/12970) & [paritytech/polkadot#6807](https://github.com/paritytech/polkadot/pull/6807)) - Upgrade Kusama to Society V2 ([paritytech/polkadot#7356](https://github.com/paritytech/polkadot/pull/7356)) -- Kusama state version switch and migration ([paritytech/polkadot#7015](https://github.com/paritytech/polkadot/pull/7015)) -- Add Nomination Pools and Voters List to Staking Proxy ([paritytech/polkadot#7448](https://github.com/paritytech/polkadot/pull/7448)) -- Add minting price to the pre-signed mint object ([paritytech/substrate#14242](https://github.com/paritytech/substrate/pull/14242)) -- Add mint price to the witness object on mint and confirm it ([paritytech/substrate#14257](https://github.com/paritytech/substrate/pull/14257)) +- Kusama state version switch and + migration ([paritytech/polkadot#7015](https://github.com/paritytech/polkadot/pull/7015)) +- Add Nomination Pools and Voters List to Staking + Proxy ([paritytech/polkadot#7448](https://github.com/paritytech/polkadot/pull/7448)) +- Add minting price to the pre-signed mint + object ([paritytech/substrate#14242](https://github.com/paritytech/substrate/pull/14242)) +- Add mint price to the witness object on mint and confirm + it ([paritytech/substrate#14257](https://github.com/paritytech/substrate/pull/14257)) - Stabilize Metadata V15 ([paritytech/substrate#14481](https://github.com/paritytech/substrate/pull/14481)) -- Add Ability to Add/Remove Invulnerable Collators ([paritytech/cumulus#2596](https://github.com/paritytech/cumulus/pull/2596)) -- Polkadot Fellowship promotion/demotion periods, members activity and salaries ([paritytech/cumulus#2607](https://github.com/paritytech/cumulus/pull/2607)) +- Add Ability to Add/Remove Invulnerable + Collators ([paritytech/cumulus#2596](https://github.com/paritytech/cumulus/pull/2596)) +- Polkadot Fellowship promotion/demotion periods, members activity and + salaries ([paritytech/cumulus#2607](https://github.com/paritytech/cumulus/pull/2607)) - Add asset conversion to asset hub Kusama ([paritytech/cumulus#2935](https://github.com/paritytech/cumulus/pull/2935)) ### Fixed -- Unlock/unreserve Gov v1 balances and remove kvs ([paritytech/polkadot#7314](https://github.com/paritytech/polkadot/pull/7314)) -- Polkadot 28 days as conviction voting period ([paritytech/polkadot#7595](https://github.com/paritytech/polkadot/pull/7595)) +- Unlock/unreserve Gov v1 balances and remove + kvs ([paritytech/polkadot#7314](https://github.com/paritytech/polkadot/pull/7314)) +- Polkadot 28 days as conviction voting + period ([paritytech/polkadot#7595](https://github.com/paritytech/polkadot/pull/7595)) - XCM: Fix issue with RequestUnlock ([paritytech/polkadot#7278](https://github.com/paritytech/polkadot/pull/7278)) -- Clear Existing HRMP Channel Request When Force Opening ([paritytech/polkadot#7389](https://github.com/paritytech/polkadot/pull/7389)) +- Clear Existing HRMP Channel Request When Force + Opening ([paritytech/polkadot#7389](https://github.com/paritytech/polkadot/pull/7389)) - Prune upgrade cooldowns ([paritytech/polkadot#7470](https://github.com/paritytech/polkadot/pull/7470)) - Assets `destroy_accounts` releases the deposit ([paritytech/substrate#14443](https://github.com/paritytech/substrate/pull/14443)) - Update Polkadot Collectives to use `limited_teleport_assets` for automatic slash handling, as - `teleport_assets` is deprecated and caused a failing integration test. ([polkadot-fellows/runtimes#46](https://github.com/polkadot-fellows/runtimes/pull/46)) + `teleport_assets` is deprecated and caused a failing integration + test. ([polkadot-fellows/runtimes#46](https://github.com/polkadot-fellows/runtimes/pull/46)) From 034662adfef9d1b63bd45834cd609112bc176185 Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Wed, 10 Apr 2024 13:51:18 +0200 Subject: [PATCH 08/29] taplo fmt --- system-parachains/encointer/Cargo.toml | 293 ++++++++++++------------- 1 file changed, 145 insertions(+), 148 deletions(-) diff --git a/system-parachains/encointer/Cargo.toml b/system-parachains/encointer/Cargo.toml index 949b4664cf..d9b0290e59 100644 --- a/system-parachains/encointer/Cargo.toml +++ b/system-parachains/encointer/Cargo.toml @@ -10,13 +10,11 @@ version.workspace = true [dependencies] codec = { package = "parity-scale-codec", version = "3.6.9", default-features = false, features = [ - "derive", + "derive", ] } hex-literal = { optional = true, workspace = true } log = { workspace = true } -scale-info = { features = [ - "derive", -], workspace = true } +scale-info = { features = ["derive"], workspace = true } smallvec = { workspace = true } @@ -91,7 +89,7 @@ xcm-executor = { package = "staging-xcm-executor", default-features = false, ver # Cumulus dependencies cumulus-pallet-aura-ext = { workspace = true } cumulus-pallet-parachain-system = { features = [ - "parameterized-consensus-hook", + "parameterized-consensus-hook", ], workspace = true } cumulus-pallet-xcm = { workspace = true } cumulus-pallet-xcmp-queue = { workspace = true } @@ -118,158 +116,157 @@ system-parachains-constants = { path = "../constants" } [features] default = ["std"] runtime-benchmarks = [ - "cumulus-pallet-xcmp-queue/runtime-benchmarks", - "cumulus-pallet-parachain-system/runtime-benchmarks", - "frame-benchmarking/runtime-benchmarks", - "frame-support/runtime-benchmarks", - "frame-system-benchmarking/runtime-benchmarks", - "frame-system/runtime-benchmarks", - "hex-literal", - "pallet-balances/runtime-benchmarks", - "pallet-collator-selection/runtime-benchmarks", - "pallet-collective/runtime-benchmarks", - "pallet-encointer-balances/runtime-benchmarks", - "pallet-encointer-bazaar/runtime-benchmarks", - "pallet-encointer-ceremonies/runtime-benchmarks", - "pallet-encointer-communities/runtime-benchmarks", - "pallet-encointer-faucet/runtime-benchmarks", - "pallet-encointer-reputation-commitments/runtime-benchmarks", - "pallet-encointer-scheduler/runtime-benchmarks", - "pallet-message-queue/runtime-benchmarks", - "pallet-membership/runtime-benchmarks", - "pallet-proxy/runtime-benchmarks", - "pallet-timestamp/runtime-benchmarks", - "pallet-utility/runtime-benchmarks", - "pallet-xcm/runtime-benchmarks", - "polkadot-runtime-common/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", - "xcm-builder/runtime-benchmarks", - "xcm-executor/runtime-benchmarks", - "cumulus-primitives-core/runtime-benchmarks", - "cumulus-primitives-utility/runtime-benchmarks", - "encointer-balances-tx-payment/runtime-benchmarks", - "encointer-primitives/runtime-benchmarks", - "pallet-asset-tx-payment/runtime-benchmarks", - "pallet-scheduler/runtime-benchmarks", - "parachains-common/runtime-benchmarks", - "polkadot-parachain-primitives/runtime-benchmarks", - "polkadot-primitives/runtime-benchmarks" + "cumulus-pallet-xcmp-queue/runtime-benchmarks", + "cumulus-pallet-parachain-system/runtime-benchmarks", + "frame-benchmarking/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system-benchmarking/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "hex-literal", + "pallet-balances/runtime-benchmarks", + "pallet-collator-selection/runtime-benchmarks", + "pallet-collective/runtime-benchmarks", + "pallet-encointer-balances/runtime-benchmarks", + "pallet-encointer-bazaar/runtime-benchmarks", + "pallet-encointer-ceremonies/runtime-benchmarks", + "pallet-encointer-communities/runtime-benchmarks", + "pallet-encointer-faucet/runtime-benchmarks", + "pallet-encointer-reputation-commitments/runtime-benchmarks", + "pallet-encointer-scheduler/runtime-benchmarks", + "pallet-message-queue/runtime-benchmarks", + "pallet-membership/runtime-benchmarks", + "pallet-proxy/runtime-benchmarks", + "pallet-timestamp/runtime-benchmarks", + "pallet-utility/runtime-benchmarks", + "pallet-xcm/runtime-benchmarks", + "polkadot-runtime-common/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", + "xcm-builder/runtime-benchmarks", + "xcm-executor/runtime-benchmarks", + "cumulus-primitives-core/runtime-benchmarks", + "cumulus-primitives-utility/runtime-benchmarks", + "encointer-balances-tx-payment/runtime-benchmarks", + "encointer-primitives/runtime-benchmarks", + "pallet-asset-tx-payment/runtime-benchmarks", + "pallet-scheduler/runtime-benchmarks", + "parachains-common/runtime-benchmarks", + "polkadot-parachain-primitives/runtime-benchmarks", + "polkadot-primitives/runtime-benchmarks", ] std = [ - "codec/std", - "cumulus-pallet-aura-ext/std", - "cumulus-pallet-parachain-system/std", - "cumulus-pallet-xcm/std", - "cumulus-pallet-xcmp-queue/std", - "cumulus-primitives-aura/std", - "cumulus-primitives-core/std", - "cumulus-primitives-utility/std", - "encointer-balances-tx-payment-rpc-runtime-api/std", - "encointer-balances-tx-payment/std", - "encointer-primitives/serde_derive", - "encointer-primitives/std", - "frame-executive/std", - "frame-support/std", - "frame-system-rpc-runtime-api/std", - "frame-system/std", - "frame-try-runtime?/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", - "pallet-encointer-bazaar/std", - "pallet-encointer-ceremonies-rpc-runtime-api/std", - "pallet-encointer-ceremonies/std", - "pallet-encointer-communities-rpc-runtime-api/std", - "pallet-encointer-communities/std", - "pallet-encointer-faucet/std", - "pallet-encointer-reputation-commitments/std", - "pallet-encointer-scheduler/std", - "pallet-insecure-randomness-collective-flip/std", - "pallet-message-queue/std", - "pallet-membership/std", - "pallet-proxy/std", - "pallet-session/std", - "pallet-timestamp/std", - "pallet-transaction-payment-rpc-runtime-api/std", - "pallet-transaction-payment/std", - "pallet-utility/std", - "pallet-xcm/std", - "parachain-info/std", - "parachains-common/std", - "scale-info/std", - "sp-api/std", - "sp-block-builder/std", - "sp-consensus-aura/std", - "sp-core/std", - "sp-genesis-builder/std", - "sp-inherents/std", - "sp-offchain/std", - "sp-runtime/std", - "sp-session/std", - "sp-std/std", - "sp-transaction-pool/std", - "sp-version/std", - "substrate-wasm-builder", - "xcm-builder/std", - "xcm-executor/std", - "xcm/std", - "frame-benchmarking?/std", - "frame-system-benchmarking?/std", - "pallet-scheduler/std", - "polkadot-core-primitives/std", - "polkadot-parachain-primitives/std", - "polkadot-primitives/std", - "polkadot-runtime-common/std" + "codec/std", + "cumulus-pallet-aura-ext/std", + "cumulus-pallet-parachain-system/std", + "cumulus-pallet-xcm/std", + "cumulus-pallet-xcmp-queue/std", + "cumulus-primitives-aura/std", + "cumulus-primitives-core/std", + "cumulus-primitives-utility/std", + "encointer-balances-tx-payment-rpc-runtime-api/std", + "encointer-balances-tx-payment/std", + "encointer-primitives/serde_derive", + "encointer-primitives/std", + "frame-executive/std", + "frame-support/std", + "frame-system-rpc-runtime-api/std", + "frame-system/std", + "frame-try-runtime?/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", + "pallet-encointer-bazaar/std", + "pallet-encointer-ceremonies-rpc-runtime-api/std", + "pallet-encointer-ceremonies/std", + "pallet-encointer-communities-rpc-runtime-api/std", + "pallet-encointer-communities/std", + "pallet-encointer-faucet/std", + "pallet-encointer-reputation-commitments/std", + "pallet-encointer-scheduler/std", + "pallet-insecure-randomness-collective-flip/std", + "pallet-message-queue/std", + "pallet-membership/std", + "pallet-proxy/std", + "pallet-session/std", + "pallet-timestamp/std", + "pallet-transaction-payment-rpc-runtime-api/std", + "pallet-transaction-payment/std", + "pallet-utility/std", + "pallet-xcm/std", + "parachain-info/std", + "parachains-common/std", + "scale-info/std", + "sp-api/std", + "sp-block-builder/std", + "sp-consensus-aura/std", + "sp-core/std", + "sp-genesis-builder/std", + "sp-inherents/std", + "sp-offchain/std", + "sp-runtime/std", + "sp-session/std", + "sp-std/std", + "sp-transaction-pool/std", + "sp-version/std", + "substrate-wasm-builder", + "xcm-builder/std", + "xcm-executor/std", + "xcm/std", + "frame-benchmarking?/std", + "frame-system-benchmarking?/std", + "pallet-scheduler/std", + "polkadot-core-primitives/std", + "polkadot-parachain-primitives/std", + "polkadot-primitives/std", + "polkadot-runtime-common/std", ] try-runtime = [ - "cumulus-pallet-aura-ext/try-runtime", - "cumulus-pallet-parachain-system/try-runtime", - "cumulus-pallet-xcm/try-runtime", - "cumulus-pallet-xcmp-queue/try-runtime", - "frame-executive/try-runtime", - "frame-system/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", - "pallet-encointer-ceremonies/try-runtime", - "pallet-encointer-communities/try-runtime", - "pallet-encointer-faucet/try-runtime", - "pallet-encointer-reputation-commitments/try-runtime", - "pallet-encointer-scheduler/try-runtime", - "pallet-insecure-randomness-collective-flip/try-runtime", - "pallet-message-queue/try-runtime", - "pallet-membership/try-runtime", - "pallet-proxy/try-runtime", - "pallet-scheduler/try-runtime", - "pallet-session/try-runtime", - "pallet-timestamp/try-runtime", - "pallet-transaction-payment/try-runtime", - "pallet-utility/try-runtime", - "pallet-xcm/try-runtime", - "parachain-info/try-runtime", - "encointer-balances-tx-payment/try-runtime", - "encointer-primitives/try-runtime", - "frame-support/try-runtime", - "polkadot-runtime-common/try-runtime", - "sp-runtime/try-runtime" + "cumulus-pallet-aura-ext/try-runtime", + "cumulus-pallet-parachain-system/try-runtime", + "cumulus-pallet-xcm/try-runtime", + "cumulus-pallet-xcmp-queue/try-runtime", + "frame-executive/try-runtime", + "frame-system/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", + "pallet-encointer-ceremonies/try-runtime", + "pallet-encointer-communities/try-runtime", + "pallet-encointer-faucet/try-runtime", + "pallet-encointer-reputation-commitments/try-runtime", + "pallet-encointer-scheduler/try-runtime", + "pallet-insecure-randomness-collective-flip/try-runtime", + "pallet-message-queue/try-runtime", + "pallet-membership/try-runtime", + "pallet-proxy/try-runtime", + "pallet-scheduler/try-runtime", + "pallet-session/try-runtime", + "pallet-timestamp/try-runtime", + "pallet-transaction-payment/try-runtime", + "pallet-utility/try-runtime", + "pallet-xcm/try-runtime", + "parachain-info/try-runtime", + "encointer-balances-tx-payment/try-runtime", + "encointer-primitives/try-runtime", + "frame-support/try-runtime", + "polkadot-runtime-common/try-runtime", + "sp-runtime/try-runtime", ] # A feature that should be enabled when the runtime should be built for on-chain # 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"] - From d5a63627951aa075b4c545e2db0fd6daef22d9e2 Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Wed, 10 Apr 2024 13:53:14 +0200 Subject: [PATCH 09/29] taplo fmt --- Cargo.toml | 80 +++++++++++++++++++++++++++--------------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 493cec650d..246906aff8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ version = "1.0.0" authors = ["Polkadot Fellowship"] edition = "2021" repository = "https://github.com/polkadot-fellows/runtimes.git" -license = "GPL-3.0-only" # TODO +license = "GPL-3.0-only" # TODO [workspace.dependencies] assert_matches = { version = "1.5.0" } @@ -202,45 +202,45 @@ xcm-emulator = { version = "0.6.0" } resolver = "2" members = [ - "chain-spec-generator", - "relay/kusama", - "relay/kusama/constants", - "relay/polkadot", - "relay/polkadot/constants", - "system-parachains/asset-hubs/asset-hub-kusama", - "system-parachains/asset-hubs/asset-hub-kusama/primitives", - "system-parachains/asset-hubs/asset-hub-polkadot", - "system-parachains/asset-hubs/asset-hub-polkadot/primitives", - "system-parachains/bridge-hubs/bridge-hub-kusama", - "system-parachains/bridge-hubs/bridge-hub-kusama/primitives", - "system-parachains/bridge-hubs/bridge-hub-polkadot", - "system-parachains/bridge-hubs/bridge-hub-polkadot/primitives", - "system-parachains/collectives/collectives-polkadot", - "system-parachains/collectives/collectives-polkadot/constants", - "system-parachains/constants", - "system-parachains/coretime/coretime-kusama", - "system-parachains/encointer", - "system-parachains/gluttons/glutton-kusama", - "system-parachains/people/people-kusama", - "integration-tests/emulated/chains/relays/kusama", - "integration-tests/emulated/chains/relays/polkadot", - "integration-tests/emulated/chains/parachains/assets/asset-hub-kusama", - "integration-tests/emulated/chains/parachains/assets/asset-hub-polkadot", - "integration-tests/emulated/chains/parachains/bridges/bridge-hub-kusama", - "integration-tests/emulated/chains/parachains/bridges/bridge-hub-polkadot", - "integration-tests/emulated/chains/parachains/collectives/collectives-polkadot", - "integration-tests/emulated/chains/parachains/people/people-kusama", - "integration-tests/emulated/chains/parachains/testing/penpal", - "integration-tests/emulated/helpers", - "integration-tests/emulated/networks/kusama-system", - "integration-tests/emulated/networks/polkadot-system", - "integration-tests/emulated/networks/kusama-polkadot-system", - "integration-tests/emulated/tests/assets/asset-hub-kusama", - "integration-tests/emulated/tests/assets/asset-hub-polkadot", - "integration-tests/emulated/tests/bridges/bridge-hub-kusama", - "integration-tests/emulated/tests/bridges/bridge-hub-polkadot", - "integration-tests/emulated/tests/collectives/collectives-polkadot", - "integration-tests/emulated/tests/people/people-kusama", + "chain-spec-generator", + "relay/kusama", + "relay/kusama/constants", + "relay/polkadot", + "relay/polkadot/constants", + "system-parachains/asset-hubs/asset-hub-kusama", + "system-parachains/asset-hubs/asset-hub-kusama/primitives", + "system-parachains/asset-hubs/asset-hub-polkadot", + "system-parachains/asset-hubs/asset-hub-polkadot/primitives", + "system-parachains/bridge-hubs/bridge-hub-kusama", + "system-parachains/bridge-hubs/bridge-hub-kusama/primitives", + "system-parachains/bridge-hubs/bridge-hub-polkadot", + "system-parachains/bridge-hubs/bridge-hub-polkadot/primitives", + "system-parachains/collectives/collectives-polkadot", + "system-parachains/collectives/collectives-polkadot/constants", + "system-parachains/constants", + "system-parachains/coretime/coretime-kusama", + "system-parachains/encointer", + "system-parachains/gluttons/glutton-kusama", + "system-parachains/people/people-kusama", + "integration-tests/emulated/chains/relays/kusama", + "integration-tests/emulated/chains/relays/polkadot", + "integration-tests/emulated/chains/parachains/assets/asset-hub-kusama", + "integration-tests/emulated/chains/parachains/assets/asset-hub-polkadot", + "integration-tests/emulated/chains/parachains/bridges/bridge-hub-kusama", + "integration-tests/emulated/chains/parachains/bridges/bridge-hub-polkadot", + "integration-tests/emulated/chains/parachains/collectives/collectives-polkadot", + "integration-tests/emulated/chains/parachains/people/people-kusama", + "integration-tests/emulated/chains/parachains/testing/penpal", + "integration-tests/emulated/helpers", + "integration-tests/emulated/networks/kusama-system", + "integration-tests/emulated/networks/polkadot-system", + "integration-tests/emulated/networks/kusama-polkadot-system", + "integration-tests/emulated/tests/assets/asset-hub-kusama", + "integration-tests/emulated/tests/assets/asset-hub-polkadot", + "integration-tests/emulated/tests/bridges/bridge-hub-kusama", + "integration-tests/emulated/tests/bridges/bridge-hub-polkadot", + "integration-tests/emulated/tests/collectives/collectives-polkadot", + "integration-tests/emulated/tests/people/people-kusama", ] [profile.release] From 6a03ceb9687d74f0c726313557a526b955a7e05e Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Wed, 10 Apr 2024 13:58:25 +0200 Subject: [PATCH 10/29] revert formatting --- Cargo.toml | 80 +++++++++++++++++++++++++++--------------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 246906aff8..03b6aeda0a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ version = "1.0.0" authors = ["Polkadot Fellowship"] edition = "2021" repository = "https://github.com/polkadot-fellows/runtimes.git" -license = "GPL-3.0-only" # TODO +license = "GPL-3.0-only" # TODO [workspace.dependencies] assert_matches = { version = "1.5.0" } @@ -202,45 +202,45 @@ xcm-emulator = { version = "0.6.0" } resolver = "2" members = [ - "chain-spec-generator", - "relay/kusama", - "relay/kusama/constants", - "relay/polkadot", - "relay/polkadot/constants", - "system-parachains/asset-hubs/asset-hub-kusama", - "system-parachains/asset-hubs/asset-hub-kusama/primitives", - "system-parachains/asset-hubs/asset-hub-polkadot", - "system-parachains/asset-hubs/asset-hub-polkadot/primitives", - "system-parachains/bridge-hubs/bridge-hub-kusama", - "system-parachains/bridge-hubs/bridge-hub-kusama/primitives", - "system-parachains/bridge-hubs/bridge-hub-polkadot", - "system-parachains/bridge-hubs/bridge-hub-polkadot/primitives", - "system-parachains/collectives/collectives-polkadot", - "system-parachains/collectives/collectives-polkadot/constants", - "system-parachains/constants", - "system-parachains/coretime/coretime-kusama", - "system-parachains/encointer", - "system-parachains/gluttons/glutton-kusama", - "system-parachains/people/people-kusama", - "integration-tests/emulated/chains/relays/kusama", - "integration-tests/emulated/chains/relays/polkadot", - "integration-tests/emulated/chains/parachains/assets/asset-hub-kusama", - "integration-tests/emulated/chains/parachains/assets/asset-hub-polkadot", - "integration-tests/emulated/chains/parachains/bridges/bridge-hub-kusama", - "integration-tests/emulated/chains/parachains/bridges/bridge-hub-polkadot", - "integration-tests/emulated/chains/parachains/collectives/collectives-polkadot", - "integration-tests/emulated/chains/parachains/people/people-kusama", - "integration-tests/emulated/chains/parachains/testing/penpal", - "integration-tests/emulated/helpers", - "integration-tests/emulated/networks/kusama-system", - "integration-tests/emulated/networks/polkadot-system", - "integration-tests/emulated/networks/kusama-polkadot-system", - "integration-tests/emulated/tests/assets/asset-hub-kusama", - "integration-tests/emulated/tests/assets/asset-hub-polkadot", - "integration-tests/emulated/tests/bridges/bridge-hub-kusama", - "integration-tests/emulated/tests/bridges/bridge-hub-polkadot", - "integration-tests/emulated/tests/collectives/collectives-polkadot", - "integration-tests/emulated/tests/people/people-kusama", + "chain-spec-generator", + "relay/kusama", + "relay/kusama/constants", + "relay/polkadot", + "relay/polkadot/constants", + "system-parachains/asset-hubs/asset-hub-kusama", + "system-parachains/asset-hubs/asset-hub-kusama/primitives", + "system-parachains/asset-hubs/asset-hub-polkadot", + "system-parachains/asset-hubs/asset-hub-polkadot/primitives", + "system-parachains/bridge-hubs/bridge-hub-kusama", + "system-parachains/bridge-hubs/bridge-hub-kusama/primitives", + "system-parachains/bridge-hubs/bridge-hub-polkadot", + "system-parachains/bridge-hubs/bridge-hub-polkadot/primitives", + "system-parachains/collectives/collectives-polkadot", + "system-parachains/collectives/collectives-polkadot/constants", + "system-parachains/constants", + "system-parachains/coretime/coretime-kusama", + "system-parachains/encointer", + "system-parachains/gluttons/glutton-kusama", + "system-parachains/people/people-kusama", + "integration-tests/emulated/chains/relays/kusama", + "integration-tests/emulated/chains/relays/polkadot", + "integration-tests/emulated/chains/parachains/assets/asset-hub-kusama", + "integration-tests/emulated/chains/parachains/assets/asset-hub-polkadot", + "integration-tests/emulated/chains/parachains/bridges/bridge-hub-kusama", + "integration-tests/emulated/chains/parachains/bridges/bridge-hub-polkadot", + "integration-tests/emulated/chains/parachains/collectives/collectives-polkadot", + "integration-tests/emulated/chains/parachains/people/people-kusama", + "integration-tests/emulated/chains/parachains/testing/penpal", + "integration-tests/emulated/helpers", + "integration-tests/emulated/networks/kusama-system", + "integration-tests/emulated/networks/polkadot-system", + "integration-tests/emulated/networks/kusama-polkadot-system", + "integration-tests/emulated/tests/assets/asset-hub-kusama", + "integration-tests/emulated/tests/assets/asset-hub-polkadot", + "integration-tests/emulated/tests/bridges/bridge-hub-kusama", + "integration-tests/emulated/tests/bridges/bridge-hub-polkadot", + "integration-tests/emulated/tests/collectives/collectives-polkadot", + "integration-tests/emulated/tests/people/people-kusama", ] [profile.release] From 0ed6eaccc19a0239f8e7de340303abb2cf0cd861 Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Wed, 10 Apr 2024 14:08:11 +0200 Subject: [PATCH 11/29] cleanup changelog formatting --- CHANGELOG.md | 215 +++++++++++++++++---------------------------------- 1 file changed, 69 insertions(+), 146 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c0095a682..66312ec1b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,219 +8,142 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Changed -- 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)) +- 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.0] 28.03.2024 ### Added -- 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/ +- 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)) -- 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)) -- Refund any leases that are not migrated to Coretime (have holes in them/have not yet - started) ([polkadot-fellows/runtimes#206](https://github.com/polkadot-fellows/runtimes/pull/206)) -- Enable Elastic Scaling node side feature for - Kusama ([polkadot-fellows/runtimes#205](https://github.com/polkadot-fellows/runtimes/pull/205)) +- 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)) +- Refund any leases that are not migrated to Coretime (have holes in them/have not yet started) ([polkadot-fellows/runtimes#206](https://github.com/polkadot-fellows/runtimes/pull/206)) +- Enable Elastic Scaling node side feature for Kusama ([polkadot-fellows/runtimes#205](https://github.com/polkadot-fellows/runtimes/pull/205)) - Cancel Parachain Auctions ([polkadot-fellows/runtimes#215](https://github.com/polkadot-fellows/runtimes/pull/215)) -- Upgrade encointer protocol to - 6.1.0 ([polkadot-fellows/runtimes#236](https://github.com/polkadot-fellows/runtimes/pull/236)) -- Update NFT deposits according to - RFC-45 ([polkadot-fellows/runtimes#237](https://github.com/polkadot-fellows/runtimes/pull/237)) +- Upgrade encointer protocol to 6.1.0 ([polkadot-fellows/runtimes#236](https://github.com/polkadot-fellows/runtimes/pull/236)) +- Update NFT deposits according to RFC-45 ([polkadot-fellows/runtimes#237](https://github.com/polkadot-fellows/runtimes/pull/237)) - Add Kusama People Chain ([polkadot-fellows/runtimes#217](https://github.com/polkadot-fellows/runtimes/pull/217)) -- Asset Conversion setup for Polkadot Asset Hub, and XCM Swap Weight Trader for both Asset - Hubs ([polkadot-fellows/runtimes#218](https://github.com/polkadot-fellows/runtimes/pull/218)) -- Adds Snowbridge to Kusama and - Polkadot ([polkadot-fellows/runtimes#130](https://github.com/polkadot-fellows/runtimes/pull/130)) +- Asset Conversion setup for Polkadot Asset Hub, and XCM Swap Weight Trader for both Asset Hubs ([polkadot-fellows/runtimes#218](https://github.com/polkadot-fellows/runtimes/pull/218)) +- Adds Snowbridge to Kusama and Polkadot ([polkadot-fellows/runtimes#130](https://github.com/polkadot-fellows/runtimes/pull/130)) - Add the Kusama Coretime Chain ([polkadot-fellows/runtimes#212](https://github.com/polkadot-fellows/runtimes/pull/212)) ### Changed -- Upgrade parachains runtime API from v7 to v8 in - Kusama ([context](https://paritytech.github.io/polkadot-sdk/book/protocol-validator-disabling.html), [polkadot-fellows/runtimes#148](https://github.com/polkadot-fellows/runtimes/pull/148)). +- Upgrade parachains runtime API from v7 to v8 in Kusama ([context](https://paritytech.github.io/polkadot-sdk/book/protocol-validator-disabling.html), [polkadot-fellows/runtimes#148](https://github.com/polkadot-fellows/runtimes/pull/148)). - Fixed the lowering of Asset Hub existential deposits. -- MMR leaves generated by `pallet_mmr` point to the next-authority-set of the current block instead of the prior - block [polkadot-fellows/runtimes#169](https://github.com/polkadot-fellows/runtimes/pull/169) -- Deprecate the `xcm::body::TREASURER_INDEX` constant and use the standard `Treasury` variant from the `xcm::BodyId` - type instead ([polkadot-fellows/runtimes#149](https://github.com/polkadot-fellows/runtimes/pull/149)) -- Bump parachains runtime API to v9 in Kusama to enable the `node_features` - function [polkadot-fellows/runtimes#194](https://github.com/polkadot-fellows/runtimes/pull/194) -- Bump parachains runtime API to v10 in Kusama to enable the `approval-voting-params` - function [polkadot-fellows/runtimes#204](https://github.com/polkadot-fellows/runtimes/pull/204) -- Use Relay Chain's Treasury Pallet account as a destination for XCM fees on System - Parachain ([polkadot-fellows/runtimes#191](https://github.com/polkadot-fellows/runtimes/pull/191)) -- Bump parachains runtime API to v10 in Polkadot to enable async-backing subsystems(still in backwards compatible - mode) [polkadot-fellows/runtimes#222](https://github.com/polkadot-fellows/runtimes/pull/222) -- Prepared system parachain runtimes for async backing - enabling ([polkadot-fellows/runtimes#228](https://github.com/polkadot-fellows/runtimes/pull/228)) +- MMR leaves generated by `pallet_mmr` point to the next-authority-set of the current block instead of the prior block [polkadot-fellows/runtimes#169](https://github.com/polkadot-fellows/runtimes/pull/169) +- Deprecate the `xcm::body::TREASURER_INDEX` constant and use the standard `Treasury` variant from the `xcm::BodyId` type instead ([polkadot-fellows/runtimes#149](https://github.com/polkadot-fellows/runtimes/pull/149)) +- Bump parachains runtime API to v9 in Kusama to enable the `node_features` function [polkadot-fellows/runtimes#194](https://github.com/polkadot-fellows/runtimes/pull/194) +- Bump parachains runtime API to v10 in Kusama to enable the `approval-voting-params` function [polkadot-fellows/runtimes#204](https://github.com/polkadot-fellows/runtimes/pull/204) +- Use Relay Chain's Treasury Pallet account as a destination for XCM fees on System Parachain ([polkadot-fellows/runtimes#191](https://github.com/polkadot-fellows/runtimes/pull/191)) +- Bump parachains runtime API to v10 in Polkadot to enable async-backing subsystems(still in backwards compatible mode) [polkadot-fellows/runtimes#222](https://github.com/polkadot-fellows/runtimes/pull/222) +- Prepared system parachain runtimes for async backing enabling ([polkadot-fellows/runtimes#228](https://github.com/polkadot-fellows/runtimes/pull/228)) - Update runtime weights [polkadot-fellows/runtimes#223](https://github.com/polkadot-fellows/runtimes/pull/223) -- Treasury Spend detects relative locations of the native - asset ([polkadot-fellows/runtimes#233](https://github.com/polkadot-fellows/runtimes/pull/233)) -- Increase consumer reference limits for Asset - Hubs ([polkadot-fellows/runtimes#258](https://github.com/polkadot-fellows/runtimes/pull/258)) -- Updated Asset Hub asset class creation deposit to - use `system_para_deposit()` ([polkadot-fellows/runtimes#259](https://github.com/polkadot-fellows/runtimes/pull/259)) +- Treasury Spend detects relative locations of the native asset ([polkadot-fellows/runtimes#233](https://github.com/polkadot-fellows/runtimes/pull/233)) +- Increase consumer reference limits for Asset Hubs ([polkadot-fellows/runtimes#258](https://github.com/polkadot-fellows/runtimes/pull/258)) +- Updated Asset Hub asset class creation deposit to use `system_para_deposit()` ([polkadot-fellows/runtimes#259](https://github.com/polkadot-fellows/runtimes/pull/259)) ### Removed -- Removed the `SafeCallFilter` from the Relay Chain XCM - config ([polkadot-fellows/runtimes#172](https://github.com/polkadot-fellows/runtimes/pull/172)). +- Removed the `SafeCallFilter` from the Relay Chain XCM config ([polkadot-fellows/runtimes#172](https://github.com/polkadot-fellows/runtimes/pull/172)). - Removed the `ImOnline` pallet ([polkadot-fellows/runtimes#178](https://github.com/polkadot-fellows/runtimes/pull/178)) ### Fixed -- Fixed the cost of a single byte, sent over bridge to use the `TransactionByteFee` constant of the bridged - chain [polkadot-fellows/runtimes#174](https://github.com/polkadot-fellows/runtimes/pull/174). +- Fixed the cost of a single byte, sent over bridge to use the `TransactionByteFee` constant of the bridged chain [polkadot-fellows/runtimes#174](https://github.com/polkadot-fellows/runtimes/pull/174). ### Based on Polkadot-SDK -- Upgrade dependencies to - the [polkadot-sdk@1.5.0](https://github.com/paritytech/polkadot-sdk/releases/tag/polkadot-v1.5.0) - release ([polkadot-fellows/runtimes#137](https://github.com/polkadot-fellows/runtimes/pull/137)) -- Upgrade dependencies to - the [polkadot-sdk@1.6.0](https://github.com/paritytech/polkadot-sdk/releases/tag/polkadot-v1.6.0) - release ([polkadot-fellows/runtimes#159](https://github.com/polkadot-fellows/runtimes/pull/159)) -- Upgrade dependencies to - the [polkadot-sdk@1.7.0](https://github.com/paritytech/polkadot-sdk/releases/tag/polkadot-v1.7.0) - release ([polkadot-fellows/runtimes#187](https://github.com/polkadot-fellows/runtimes/pull/187)) +- Upgrade dependencies to the [polkadot-sdk@1.5.0](https://github.com/paritytech/polkadot-sdk/releases/tag/polkadot-v1.5.0) release ([polkadot-fellows/runtimes#137](https://github.com/polkadot-fellows/runtimes/pull/137)) +- Upgrade dependencies to the [polkadot-sdk@1.6.0](https://github.com/paritytech/polkadot-sdk/releases/tag/polkadot-v1.6.0) release ([polkadot-fellows/runtimes#159](https://github.com/polkadot-fellows/runtimes/pull/159)) +- Upgrade dependencies to the [polkadot-sdk@1.7.0](https://github.com/paritytech/polkadot-sdk/releases/tag/polkadot-v1.7.0) release ([polkadot-fellows/runtimes#187](https://github.com/polkadot-fellows/runtimes/pull/187)) ## [1.1.1] 25.01.2024 ### Fixed -- Fixed the lowering of Asset Hub existential - deposits ([polkadot-fellows/runtimes#158](https://github.com/polkadot-fellows/runtimes/pull/158)). +- Fixed the lowering of Asset Hub existential deposits ([polkadot-fellows/runtimes#158](https://github.com/polkadot-fellows/runtimes/pull/158)). ## [1.1.0] 10.01.2024 ### Changed -- Upgrade parachains runtime API from v5 to v7 in Polkadot and - Kusama ([polkadot-fellows/runtimes#56](https://github.com/polkadot-fellows/runtimes/pull/56)) -- Upgrade Preimage pallet's config implementations to adapt the new `Consideration` - API ([polkadot-fellows/runtimes#56](https://github.com/polkadot-fellows/runtimes/pull/56)) -- Remove `experimental` feature flag for `pallet-society`, `pallet-xcm`, and `runtime-common` crates - imports ([polkadot-fellows/runtimes#56](https://github.com/polkadot-fellows/runtimes/pull/56)) -- Election provider: use a geometric deposit base calculation for EPM signed submissions in Polkadot and - Kusama ([polkadot-fellows/runtimes#56](https://github.com/polkadot-fellows/runtimes/pull/56)) -- Make `IdentityInfo` generic - in `pallet-identity` ([polkadot-fellows/runtimes#87](https://github.com/polkadot-fellows/runtimes/pull/87)). - Context: https://github.com/paritytech/polkadot-sdk/pull/1661 -- Whitelist `force_default_xcm_version` in XCM call - filter ([polkadot-fellows/runtimes#45](https://github.com/polkadot-fellows/runtimes/pull/45)) -- Update the fellowship salary budget amount in alignment with the Fellowship - Salary [RFC](https://github.com/polkadot-fellows/RFCs/pull/50) ([polkadot-fellows/runtimes#121](https://github.com/polkadot-fellows/runtimes/pull/121)) -- Set up an account ID for the local root location on Polkadot - Collectives ([polkadot-fellows/runtimes#125](https://github.com/polkadot-fellows/runtimes/pull/125)) -- Increase confirmation period for treasury spend tracks on Polkadot & - Kusama ([polkadot-fellows/runtimes#119](https://github.com/polkadot-fellows/runtimes/pull/119)) +- Upgrade parachains runtime API from v5 to v7 in Polkadot and Kusama ([polkadot-fellows/runtimes#56](https://github.com/polkadot-fellows/runtimes/pull/56)) +- Upgrade Preimage pallet's config implementations to adapt the new `Consideration` API ([polkadot-fellows/runtimes#56](https://github.com/polkadot-fellows/runtimes/pull/56)) +- Remove `experimental` feature flag for `pallet-society`, `pallet-xcm`, and `runtime-common` crates imports ([polkadot-fellows/runtimes#56](https://github.com/polkadot-fellows/runtimes/pull/56)) +- Election provider: use a geometric deposit base calculation for EPM signed submissions in Polkadot and Kusama ([polkadot-fellows/runtimes#56](https://github.com/polkadot-fellows/runtimes/pull/56)) +- Make `IdentityInfo` generic in `pallet-identity` ([polkadot-fellows/runtimes#87](https://github.com/polkadot-fellows/runtimes/pull/87)). Context: https://github.com/paritytech/polkadot-sdk/pull/1661 +- Whitelist `force_default_xcm_version` in XCM call filter ([polkadot-fellows/runtimes#45](https://github.com/polkadot-fellows/runtimes/pull/45)) +- Update the fellowship salary budget amount in alignment with the Fellowship Salary [RFC](https://github.com/polkadot-fellows/RFCs/pull/50) ([polkadot-fellows/runtimes#121](https://github.com/polkadot-fellows/runtimes/pull/121)) +- Set up an account ID for the local root location on Polkadot Collectives ([polkadot-fellows/runtimes#125](https://github.com/polkadot-fellows/runtimes/pull/125)) +- Increase confirmation period for treasury spend tracks on Polkadot & Kusama ([polkadot-fellows/runtimes#119](https://github.com/polkadot-fellows/runtimes/pull/119)) ### Added -- Enable async backing on Kusama ([polkadot-fellows/runtimes#87](https://github.com/polkadot-fellows/runtimes/pull/87)). - Context: https://github.com/paritytech/polkadot-sdk/pull/1543 -- Implemented GenesisBuilder API for all - runtimes ([polkadot-fellows/runtimes#87](https://github.com/polkadot-fellows/runtimes/pull/87)). - Context: https://github.com/paritytech/polkadot-sdk/pull/1492 -- XCM transport fees are now exponential and are sent to a treasury - account ([polkadot-fellows/runtimes#87](https://github.com/polkadot-fellows/runtimes/pull/87)). - Context: https://github.com/paritytech/polkadot-sdk/pull/1234 -- System parachains are now trusted teleporters of each - other ([polkadot-fellows/runtimes#87](https://github.com/polkadot-fellows/runtimes/pull/87)). - Context: https://github.com/paritytech/polkadot-sdk/pull/1368 -- Treasury is able to spend various asset - kinds ([polkadot-fellows/runtimes#87](https://github.com/polkadot-fellows/runtimes/pull/87)) +- Enable async backing on Kusama ([polkadot-fellows/runtimes#87](https://github.com/polkadot-fellows/runtimes/pull/87)). Context: https://github.com/paritytech/polkadot-sdk/pull/1543 +- Implemented GenesisBuilder API for all runtimes ([polkadot-fellows/runtimes#87](https://github.com/polkadot-fellows/runtimes/pull/87)). Context: https://github.com/paritytech/polkadot-sdk/pull/1492 +- XCM transport fees are now exponential and are sent to a treasury account ([polkadot-fellows/runtimes#87](https://github.com/polkadot-fellows/runtimes/pull/87)). Context: https://github.com/paritytech/polkadot-sdk/pull/1234 +- System parachains are now trusted teleporters of each other ([polkadot-fellows/runtimes#87](https://github.com/polkadot-fellows/runtimes/pull/87)). Context: https://github.com/paritytech/polkadot-sdk/pull/1368 +- Treasury is able to spend various asset kinds ([polkadot-fellows/runtimes#87](https://github.com/polkadot-fellows/runtimes/pull/87)) - Add BEEFY to Polkadot ([polkadot-fellows/runtimes#65](https://github.com/polkadot-fellows/runtimes/pull/65)) -- Fellowship Treasury pallet on Polkadot - Collectives ([polkadot-fellows/runtimes#109](https://github.com/polkadot-fellows/runtimes/pull/109)) -- Added Polkadot <> Kusama bridge to support asset transfers between Asset - Hubs ([polkadot-fellows/runtimes#108](https://github.com/polkadot-fellows/runtimes/pull/108)) +- Fellowship Treasury pallet on Polkadot Collectives ([polkadot-fellows/runtimes#109](https://github.com/polkadot-fellows/runtimes/pull/109)) +- Added Polkadot <> Kusama bridge to support asset transfers between Asset Hubs ([polkadot-fellows/runtimes#108](https://github.com/polkadot-fellows/runtimes/pull/108)) ### Fixed -- Add missing weight functions for `runtime_parachains_hrmp` and `preimage` - pallets ([polkadot-fellows/runtimes#56](https://github.com/polkadot-fellows/runtimes/pull/56)) -- Fix for Reward Deficit in the - pool ([polkadot-fellows/runtimes#87](https://github.com/polkadot-fellows/runtimes/pull/87)). - Context: https://github.com/paritytech/polkadot-sdk/pull/1255 +- Add missing weight functions for `runtime_parachains_hrmp` and `preimage` pallets ([polkadot-fellows/runtimes#56](https://github.com/polkadot-fellows/runtimes/pull/56)) +- Fix for Reward Deficit in the pool ([polkadot-fellows/runtimes#87](https://github.com/polkadot-fellows/runtimes/pull/87)). Context: https://github.com/paritytech/polkadot-sdk/pull/1255 ## [1.0.1] 14.11.2023 ### Changed -- Restore governance lock periods to 7 days in - Polkadot ([polkadot-fellows/runtimes#86](https://github.com/polkadot-fellows/runtimes/pull/86)) +- Restore governance lock periods to 7 days in Polkadot ([polkadot-fellows/runtimes#86](https://github.com/polkadot-fellows/runtimes/pull/86)) ## [1.0.0] 22.10.2023 ### Changed -- Update Polkadot ideal staking - rate ([polkadot-fellows/runtimes#26](https://github.com/polkadot-fellows/runtimes/pull/26)) -- Treasury deprecate `propose_spend` - dispatchable ([paritytech/substrate#14538](https://github.com/paritytech/substrate/pull/14538)) +- Update Polkadot ideal staking rate ([polkadot-fellows/runtimes#26](https://github.com/polkadot-fellows/runtimes/pull/26)) +- Treasury deprecate `propose_spend` dispatchable ([paritytech/substrate#14538](https://github.com/paritytech/substrate/pull/14538)) - Use benchmarked weights for `XCM` ([paritytech/polkadot#7077](https://github.com/paritytech/polkadot/pull/7077)) -- Put HRMP Channel Management on General Admin - Track ([paritytech/polkadot#7477](https://github.com/paritytech/polkadot/pull/7477)) -- Improve locking mechanism for - parachains ([paritytech/polkadot-sdk#1290](https://github.com/paritytech/polkadot-sdk/pull/1290)) +- Put HRMP Channel Management on General Admin Track ([paritytech/polkadot#7477](https://github.com/paritytech/polkadot/pull/7477)) +- Improve locking mechanism for parachains ([paritytech/polkadot-sdk#1290](https://github.com/paritytech/polkadot-sdk/pull/1290)) - Allow Root to initiate auctions ([paritytech/polkadot#7449](https://github.com/paritytech/polkadot/pull/7449)) - Remark: Allow any kind of origin ([paritytech/substrate#14260](https://github.com/paritytech/substrate/pull/14260)) -- Im-Online: Remove network state from - heartbeats ([paritytech/substrate#14251](https://github.com/paritytech/substrate/pull/14251)) -- Nomination pools: disallow setting above global max - commission ([paritytech/substrate#14496](https://github.com/paritytech/substrate/pull/14496)) +- Im-Online: Remove network state from heartbeats ([paritytech/substrate#14251](https://github.com/paritytech/substrate/pull/14251)) +- Nomination pools: disallow setting above global max commission ([paritytech/substrate#14496](https://github.com/paritytech/substrate/pull/14496)) - Rename Statemint/Statemine to Asset Hub ([paritytech/cumulus#2633](https://github.com/paritytech/cumulus/pull/2633)) -- Fellowship: Voters can initiate proposals on their votable - tracks ([paritytech/cumulus#2725](https://github.com/paritytech/cumulus/pull/2725)) +- Fellowship: Voters can initiate proposals on their votable tracks ([paritytech/cumulus#2725](https://github.com/paritytech/cumulus/pull/2725)) - Root can promote on Polkadot Collectives ([paritytech/cumulus#2781](https://github.com/paritytech/cumulus/pull/2781)) -- Add New Assets Privileged Functions to Appropriate Proxy - Types ([paritytech/cumulus#2839](https://github.com/paritytech/cumulus/pull/2839)) -- Better Handling of Candidates Who Become - Invulnerable ([paritytech/cumulus#2801](https://github.com/paritytech/cumulus/pull/2801)) +- Add New Assets Privileged Functions to Appropriate Proxy Types ([paritytech/cumulus#2839](https://github.com/paritytech/cumulus/pull/2839)) +- Better Handling of Candidates Who Become Invulnerable ([paritytech/cumulus#2801](https://github.com/paritytech/cumulus/pull/2801)) ### Added -- Implement dynamic number of - nominators ([paritytech/substrate#12970](https://github.com/paritytech/substrate/pull/12970) & [paritytech/polkadot#6807](https://github.com/paritytech/polkadot/pull/6807)) +- Implement dynamic number of nominators ([paritytech/substrate#12970](https://github.com/paritytech/substrate/pull/12970) & [paritytech/polkadot#6807](https://github.com/paritytech/polkadot/pull/6807)) - Upgrade Kusama to Society V2 ([paritytech/polkadot#7356](https://github.com/paritytech/polkadot/pull/7356)) -- Kusama state version switch and - migration ([paritytech/polkadot#7015](https://github.com/paritytech/polkadot/pull/7015)) -- Add Nomination Pools and Voters List to Staking - Proxy ([paritytech/polkadot#7448](https://github.com/paritytech/polkadot/pull/7448)) -- Add minting price to the pre-signed mint - object ([paritytech/substrate#14242](https://github.com/paritytech/substrate/pull/14242)) -- Add mint price to the witness object on mint and confirm - it ([paritytech/substrate#14257](https://github.com/paritytech/substrate/pull/14257)) +- Kusama state version switch and migration ([paritytech/polkadot#7015](https://github.com/paritytech/polkadot/pull/7015)) +- Add Nomination Pools and Voters List to Staking Proxy ([paritytech/polkadot#7448](https://github.com/paritytech/polkadot/pull/7448)) +- Add minting price to the pre-signed mint object ([paritytech/substrate#14242](https://github.com/paritytech/substrate/pull/14242)) +- Add mint price to the witness object on mint and confirm it ([paritytech/substrate#14257](https://github.com/paritytech/substrate/pull/14257)) - Stabilize Metadata V15 ([paritytech/substrate#14481](https://github.com/paritytech/substrate/pull/14481)) -- Add Ability to Add/Remove Invulnerable - Collators ([paritytech/cumulus#2596](https://github.com/paritytech/cumulus/pull/2596)) -- Polkadot Fellowship promotion/demotion periods, members activity and - salaries ([paritytech/cumulus#2607](https://github.com/paritytech/cumulus/pull/2607)) +- Add Ability to Add/Remove Invulnerable Collators ([paritytech/cumulus#2596](https://github.com/paritytech/cumulus/pull/2596)) +- Polkadot Fellowship promotion/demotion periods, members activity and salaries ([paritytech/cumulus#2607](https://github.com/paritytech/cumulus/pull/2607)) - Add asset conversion to asset hub Kusama ([paritytech/cumulus#2935](https://github.com/paritytech/cumulus/pull/2935)) ### Fixed -- Unlock/unreserve Gov v1 balances and remove - kvs ([paritytech/polkadot#7314](https://github.com/paritytech/polkadot/pull/7314)) -- Polkadot 28 days as conviction voting - period ([paritytech/polkadot#7595](https://github.com/paritytech/polkadot/pull/7595)) +- Unlock/unreserve Gov v1 balances and remove kvs ([paritytech/polkadot#7314](https://github.com/paritytech/polkadot/pull/7314)) +- Polkadot 28 days as conviction voting period ([paritytech/polkadot#7595](https://github.com/paritytech/polkadot/pull/7595)) - XCM: Fix issue with RequestUnlock ([paritytech/polkadot#7278](https://github.com/paritytech/polkadot/pull/7278)) -- Clear Existing HRMP Channel Request When Force - Opening ([paritytech/polkadot#7389](https://github.com/paritytech/polkadot/pull/7389)) +- Clear Existing HRMP Channel Request When Force Opening ([paritytech/polkadot#7389](https://github.com/paritytech/polkadot/pull/7389)) - Prune upgrade cooldowns ([paritytech/polkadot#7470](https://github.com/paritytech/polkadot/pull/7470)) - Assets `destroy_accounts` releases the deposit ([paritytech/substrate#14443](https://github.com/paritytech/substrate/pull/14443)) - Update Polkadot Collectives to use `limited_teleport_assets` for automatic slash handling, as - `teleport_assets` is deprecated and caused a failing integration - test. ([polkadot-fellows/runtimes#46](https://github.com/polkadot-fellows/runtimes/pull/46)) + `teleport_assets` is deprecated and caused a failing integration test. ([polkadot-fellows/runtimes#46](https://github.com/polkadot-fellows/runtimes/pull/46)) From aa4a013d4a42eccc00b9213ec6437394087995d5 Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Wed, 10 Apr 2024 14:11:31 +0200 Subject: [PATCH 12/29] align taplo fmt --- system-parachains/encointer/Cargo.toml | 290 ++++++++++++------------- 1 file changed, 145 insertions(+), 145 deletions(-) diff --git a/system-parachains/encointer/Cargo.toml b/system-parachains/encointer/Cargo.toml index d9b0290e59..535477c315 100644 --- a/system-parachains/encointer/Cargo.toml +++ b/system-parachains/encointer/Cargo.toml @@ -10,7 +10,7 @@ version.workspace = true [dependencies] codec = { package = "parity-scale-codec", version = "3.6.9", default-features = false, features = [ - "derive", + "derive", ] } hex-literal = { optional = true, workspace = true } log = { workspace = true } @@ -69,6 +69,7 @@ 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 } @@ -76,7 +77,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 } @@ -89,7 +89,7 @@ xcm-executor = { package = "staging-xcm-executor", default-features = false, ver # Cumulus dependencies cumulus-pallet-aura-ext = { workspace = true } cumulus-pallet-parachain-system = { features = [ - "parameterized-consensus-hook", + "parameterized-consensus-hook", ], workspace = true } cumulus-pallet-xcm = { workspace = true } cumulus-pallet-xcmp-queue = { workspace = true } @@ -116,154 +116,154 @@ system-parachains-constants = { path = "../constants" } [features] default = ["std"] runtime-benchmarks = [ - "cumulus-pallet-xcmp-queue/runtime-benchmarks", - "cumulus-pallet-parachain-system/runtime-benchmarks", - "frame-benchmarking/runtime-benchmarks", - "frame-support/runtime-benchmarks", - "frame-system-benchmarking/runtime-benchmarks", - "frame-system/runtime-benchmarks", - "hex-literal", - "pallet-balances/runtime-benchmarks", - "pallet-collator-selection/runtime-benchmarks", - "pallet-collective/runtime-benchmarks", - "pallet-encointer-balances/runtime-benchmarks", - "pallet-encointer-bazaar/runtime-benchmarks", - "pallet-encointer-ceremonies/runtime-benchmarks", - "pallet-encointer-communities/runtime-benchmarks", - "pallet-encointer-faucet/runtime-benchmarks", - "pallet-encointer-reputation-commitments/runtime-benchmarks", - "pallet-encointer-scheduler/runtime-benchmarks", - "pallet-message-queue/runtime-benchmarks", - "pallet-membership/runtime-benchmarks", - "pallet-proxy/runtime-benchmarks", - "pallet-timestamp/runtime-benchmarks", - "pallet-utility/runtime-benchmarks", - "pallet-xcm/runtime-benchmarks", - "polkadot-runtime-common/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", - "xcm-builder/runtime-benchmarks", - "xcm-executor/runtime-benchmarks", - "cumulus-primitives-core/runtime-benchmarks", - "cumulus-primitives-utility/runtime-benchmarks", - "encointer-balances-tx-payment/runtime-benchmarks", - "encointer-primitives/runtime-benchmarks", - "pallet-asset-tx-payment/runtime-benchmarks", - "pallet-scheduler/runtime-benchmarks", - "parachains-common/runtime-benchmarks", - "polkadot-parachain-primitives/runtime-benchmarks", - "polkadot-primitives/runtime-benchmarks", + "cumulus-pallet-xcmp-queue/runtime-benchmarks", + "cumulus-pallet-parachain-system/runtime-benchmarks", + "frame-benchmarking/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system-benchmarking/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "hex-literal", + "pallet-balances/runtime-benchmarks", + "pallet-collator-selection/runtime-benchmarks", + "pallet-collective/runtime-benchmarks", + "pallet-encointer-balances/runtime-benchmarks", + "pallet-encointer-bazaar/runtime-benchmarks", + "pallet-encointer-ceremonies/runtime-benchmarks", + "pallet-encointer-communities/runtime-benchmarks", + "pallet-encointer-faucet/runtime-benchmarks", + "pallet-encointer-reputation-commitments/runtime-benchmarks", + "pallet-encointer-scheduler/runtime-benchmarks", + "pallet-message-queue/runtime-benchmarks", + "pallet-membership/runtime-benchmarks", + "pallet-proxy/runtime-benchmarks", + "pallet-timestamp/runtime-benchmarks", + "pallet-utility/runtime-benchmarks", + "pallet-xcm/runtime-benchmarks", + "polkadot-runtime-common/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", + "xcm-builder/runtime-benchmarks", + "xcm-executor/runtime-benchmarks", + "cumulus-primitives-core/runtime-benchmarks", + "cumulus-primitives-utility/runtime-benchmarks", + "encointer-balances-tx-payment/runtime-benchmarks", + "encointer-primitives/runtime-benchmarks", + "pallet-asset-tx-payment/runtime-benchmarks", + "pallet-scheduler/runtime-benchmarks", + "parachains-common/runtime-benchmarks", + "polkadot-parachain-primitives/runtime-benchmarks", + "polkadot-primitives/runtime-benchmarks", ] std = [ - "codec/std", - "cumulus-pallet-aura-ext/std", - "cumulus-pallet-parachain-system/std", - "cumulus-pallet-xcm/std", - "cumulus-pallet-xcmp-queue/std", - "cumulus-primitives-aura/std", - "cumulus-primitives-core/std", - "cumulus-primitives-utility/std", - "encointer-balances-tx-payment-rpc-runtime-api/std", - "encointer-balances-tx-payment/std", - "encointer-primitives/serde_derive", - "encointer-primitives/std", - "frame-executive/std", - "frame-support/std", - "frame-system-rpc-runtime-api/std", - "frame-system/std", - "frame-try-runtime?/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", - "pallet-encointer-bazaar/std", - "pallet-encointer-ceremonies-rpc-runtime-api/std", - "pallet-encointer-ceremonies/std", - "pallet-encointer-communities-rpc-runtime-api/std", - "pallet-encointer-communities/std", - "pallet-encointer-faucet/std", - "pallet-encointer-reputation-commitments/std", - "pallet-encointer-scheduler/std", - "pallet-insecure-randomness-collective-flip/std", - "pallet-message-queue/std", - "pallet-membership/std", - "pallet-proxy/std", - "pallet-session/std", - "pallet-timestamp/std", - "pallet-transaction-payment-rpc-runtime-api/std", - "pallet-transaction-payment/std", - "pallet-utility/std", - "pallet-xcm/std", - "parachain-info/std", - "parachains-common/std", - "scale-info/std", - "sp-api/std", - "sp-block-builder/std", - "sp-consensus-aura/std", - "sp-core/std", - "sp-genesis-builder/std", - "sp-inherents/std", - "sp-offchain/std", - "sp-runtime/std", - "sp-session/std", - "sp-std/std", - "sp-transaction-pool/std", - "sp-version/std", - "substrate-wasm-builder", - "xcm-builder/std", - "xcm-executor/std", - "xcm/std", - "frame-benchmarking?/std", - "frame-system-benchmarking?/std", - "pallet-scheduler/std", - "polkadot-core-primitives/std", - "polkadot-parachain-primitives/std", - "polkadot-primitives/std", - "polkadot-runtime-common/std", + "codec/std", + "cumulus-pallet-aura-ext/std", + "cumulus-pallet-parachain-system/std", + "cumulus-pallet-xcm/std", + "cumulus-pallet-xcmp-queue/std", + "cumulus-primitives-aura/std", + "cumulus-primitives-core/std", + "cumulus-primitives-utility/std", + "encointer-balances-tx-payment-rpc-runtime-api/std", + "encointer-balances-tx-payment/std", + "encointer-primitives/serde_derive", + "encointer-primitives/std", + "frame-executive/std", + "frame-support/std", + "frame-system-rpc-runtime-api/std", + "frame-system/std", + "frame-try-runtime?/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", + "pallet-encointer-bazaar/std", + "pallet-encointer-ceremonies-rpc-runtime-api/std", + "pallet-encointer-ceremonies/std", + "pallet-encointer-communities-rpc-runtime-api/std", + "pallet-encointer-communities/std", + "pallet-encointer-faucet/std", + "pallet-encointer-reputation-commitments/std", + "pallet-encointer-scheduler/std", + "pallet-insecure-randomness-collective-flip/std", + "pallet-message-queue/std", + "pallet-membership/std", + "pallet-proxy/std", + "pallet-session/std", + "pallet-timestamp/std", + "pallet-transaction-payment-rpc-runtime-api/std", + "pallet-transaction-payment/std", + "pallet-utility/std", + "pallet-xcm/std", + "parachain-info/std", + "parachains-common/std", + "scale-info/std", + "sp-api/std", + "sp-block-builder/std", + "sp-consensus-aura/std", + "sp-core/std", + "sp-genesis-builder/std", + "sp-inherents/std", + "sp-offchain/std", + "sp-runtime/std", + "sp-session/std", + "sp-std/std", + "sp-transaction-pool/std", + "sp-version/std", + "substrate-wasm-builder", + "xcm-builder/std", + "xcm-executor/std", + "xcm/std", + "frame-benchmarking?/std", + "frame-system-benchmarking?/std", + "pallet-scheduler/std", + "polkadot-core-primitives/std", + "polkadot-parachain-primitives/std", + "polkadot-primitives/std", + "polkadot-runtime-common/std", ] try-runtime = [ - "cumulus-pallet-aura-ext/try-runtime", - "cumulus-pallet-parachain-system/try-runtime", - "cumulus-pallet-xcm/try-runtime", - "cumulus-pallet-xcmp-queue/try-runtime", - "frame-executive/try-runtime", - "frame-system/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", - "pallet-encointer-ceremonies/try-runtime", - "pallet-encointer-communities/try-runtime", - "pallet-encointer-faucet/try-runtime", - "pallet-encointer-reputation-commitments/try-runtime", - "pallet-encointer-scheduler/try-runtime", - "pallet-insecure-randomness-collective-flip/try-runtime", - "pallet-message-queue/try-runtime", - "pallet-membership/try-runtime", - "pallet-proxy/try-runtime", - "pallet-scheduler/try-runtime", - "pallet-session/try-runtime", - "pallet-timestamp/try-runtime", - "pallet-transaction-payment/try-runtime", - "pallet-utility/try-runtime", - "pallet-xcm/try-runtime", - "parachain-info/try-runtime", - "encointer-balances-tx-payment/try-runtime", - "encointer-primitives/try-runtime", - "frame-support/try-runtime", - "polkadot-runtime-common/try-runtime", - "sp-runtime/try-runtime", + "cumulus-pallet-aura-ext/try-runtime", + "cumulus-pallet-parachain-system/try-runtime", + "cumulus-pallet-xcm/try-runtime", + "cumulus-pallet-xcmp-queue/try-runtime", + "frame-executive/try-runtime", + "frame-system/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", + "pallet-encointer-ceremonies/try-runtime", + "pallet-encointer-communities/try-runtime", + "pallet-encointer-faucet/try-runtime", + "pallet-encointer-reputation-commitments/try-runtime", + "pallet-encointer-scheduler/try-runtime", + "pallet-insecure-randomness-collective-flip/try-runtime", + "pallet-message-queue/try-runtime", + "pallet-membership/try-runtime", + "pallet-proxy/try-runtime", + "pallet-scheduler/try-runtime", + "pallet-session/try-runtime", + "pallet-timestamp/try-runtime", + "pallet-transaction-payment/try-runtime", + "pallet-utility/try-runtime", + "pallet-xcm/try-runtime", + "parachain-info/try-runtime", + "encointer-balances-tx-payment/try-runtime", + "encointer-primitives/try-runtime", + "frame-support/try-runtime", + "polkadot-runtime-common/try-runtime", + "sp-runtime/try-runtime", ] # A feature that should be enabled when the runtime should be built for on-chain From ff96d4dd72657da789baa9a0e8fcaaf5ffe9db0f Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Wed, 10 Apr 2024 14:15:08 +0200 Subject: [PATCH 13/29] align taplo fmt --- system-parachains/encointer/Cargo.toml | 288 ++++++++++++------------- 1 file changed, 144 insertions(+), 144 deletions(-) diff --git a/system-parachains/encointer/Cargo.toml b/system-parachains/encointer/Cargo.toml index 535477c315..dfd03266e6 100644 --- a/system-parachains/encointer/Cargo.toml +++ b/system-parachains/encointer/Cargo.toml @@ -10,7 +10,7 @@ version.workspace = true [dependencies] codec = { package = "parity-scale-codec", version = "3.6.9", default-features = false, features = [ - "derive", + "derive", ] } hex-literal = { optional = true, workspace = true } log = { workspace = true } @@ -89,7 +89,7 @@ xcm-executor = { package = "staging-xcm-executor", default-features = false, ver # Cumulus dependencies cumulus-pallet-aura-ext = { workspace = true } cumulus-pallet-parachain-system = { features = [ - "parameterized-consensus-hook", + "parameterized-consensus-hook", ], workspace = true } cumulus-pallet-xcm = { workspace = true } cumulus-pallet-xcmp-queue = { workspace = true } @@ -116,154 +116,154 @@ system-parachains-constants = { path = "../constants" } [features] default = ["std"] runtime-benchmarks = [ - "cumulus-pallet-xcmp-queue/runtime-benchmarks", - "cumulus-pallet-parachain-system/runtime-benchmarks", - "frame-benchmarking/runtime-benchmarks", - "frame-support/runtime-benchmarks", - "frame-system-benchmarking/runtime-benchmarks", - "frame-system/runtime-benchmarks", - "hex-literal", - "pallet-balances/runtime-benchmarks", - "pallet-collator-selection/runtime-benchmarks", - "pallet-collective/runtime-benchmarks", - "pallet-encointer-balances/runtime-benchmarks", - "pallet-encointer-bazaar/runtime-benchmarks", - "pallet-encointer-ceremonies/runtime-benchmarks", - "pallet-encointer-communities/runtime-benchmarks", - "pallet-encointer-faucet/runtime-benchmarks", - "pallet-encointer-reputation-commitments/runtime-benchmarks", - "pallet-encointer-scheduler/runtime-benchmarks", - "pallet-message-queue/runtime-benchmarks", - "pallet-membership/runtime-benchmarks", - "pallet-proxy/runtime-benchmarks", - "pallet-timestamp/runtime-benchmarks", - "pallet-utility/runtime-benchmarks", - "pallet-xcm/runtime-benchmarks", - "polkadot-runtime-common/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", - "xcm-builder/runtime-benchmarks", - "xcm-executor/runtime-benchmarks", - "cumulus-primitives-core/runtime-benchmarks", - "cumulus-primitives-utility/runtime-benchmarks", - "encointer-balances-tx-payment/runtime-benchmarks", - "encointer-primitives/runtime-benchmarks", - "pallet-asset-tx-payment/runtime-benchmarks", - "pallet-scheduler/runtime-benchmarks", - "parachains-common/runtime-benchmarks", - "polkadot-parachain-primitives/runtime-benchmarks", - "polkadot-primitives/runtime-benchmarks", + "cumulus-pallet-xcmp-queue/runtime-benchmarks", + "cumulus-pallet-parachain-system/runtime-benchmarks", + "frame-benchmarking/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system-benchmarking/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "hex-literal", + "pallet-balances/runtime-benchmarks", + "pallet-collator-selection/runtime-benchmarks", + "pallet-collective/runtime-benchmarks", + "pallet-encointer-balances/runtime-benchmarks", + "pallet-encointer-bazaar/runtime-benchmarks", + "pallet-encointer-ceremonies/runtime-benchmarks", + "pallet-encointer-communities/runtime-benchmarks", + "pallet-encointer-faucet/runtime-benchmarks", + "pallet-encointer-reputation-commitments/runtime-benchmarks", + "pallet-encointer-scheduler/runtime-benchmarks", + "pallet-message-queue/runtime-benchmarks", + "pallet-membership/runtime-benchmarks", + "pallet-proxy/runtime-benchmarks", + "pallet-timestamp/runtime-benchmarks", + "pallet-utility/runtime-benchmarks", + "pallet-xcm/runtime-benchmarks", + "polkadot-runtime-common/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", + "xcm-builder/runtime-benchmarks", + "xcm-executor/runtime-benchmarks", + "cumulus-primitives-core/runtime-benchmarks", + "cumulus-primitives-utility/runtime-benchmarks", + "encointer-balances-tx-payment/runtime-benchmarks", + "encointer-primitives/runtime-benchmarks", + "pallet-asset-tx-payment/runtime-benchmarks", + "pallet-scheduler/runtime-benchmarks", + "parachains-common/runtime-benchmarks", + "polkadot-parachain-primitives/runtime-benchmarks", + "polkadot-primitives/runtime-benchmarks", ] std = [ - "codec/std", - "cumulus-pallet-aura-ext/std", - "cumulus-pallet-parachain-system/std", - "cumulus-pallet-xcm/std", - "cumulus-pallet-xcmp-queue/std", - "cumulus-primitives-aura/std", - "cumulus-primitives-core/std", - "cumulus-primitives-utility/std", - "encointer-balances-tx-payment-rpc-runtime-api/std", - "encointer-balances-tx-payment/std", - "encointer-primitives/serde_derive", - "encointer-primitives/std", - "frame-executive/std", - "frame-support/std", - "frame-system-rpc-runtime-api/std", - "frame-system/std", - "frame-try-runtime?/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", - "pallet-encointer-bazaar/std", - "pallet-encointer-ceremonies-rpc-runtime-api/std", - "pallet-encointer-ceremonies/std", - "pallet-encointer-communities-rpc-runtime-api/std", - "pallet-encointer-communities/std", - "pallet-encointer-faucet/std", - "pallet-encointer-reputation-commitments/std", - "pallet-encointer-scheduler/std", - "pallet-insecure-randomness-collective-flip/std", - "pallet-message-queue/std", - "pallet-membership/std", - "pallet-proxy/std", - "pallet-session/std", - "pallet-timestamp/std", - "pallet-transaction-payment-rpc-runtime-api/std", - "pallet-transaction-payment/std", - "pallet-utility/std", - "pallet-xcm/std", - "parachain-info/std", - "parachains-common/std", - "scale-info/std", - "sp-api/std", - "sp-block-builder/std", - "sp-consensus-aura/std", - "sp-core/std", - "sp-genesis-builder/std", - "sp-inherents/std", - "sp-offchain/std", - "sp-runtime/std", - "sp-session/std", - "sp-std/std", - "sp-transaction-pool/std", - "sp-version/std", - "substrate-wasm-builder", - "xcm-builder/std", - "xcm-executor/std", - "xcm/std", - "frame-benchmarking?/std", - "frame-system-benchmarking?/std", - "pallet-scheduler/std", - "polkadot-core-primitives/std", - "polkadot-parachain-primitives/std", - "polkadot-primitives/std", - "polkadot-runtime-common/std", + "codec/std", + "cumulus-pallet-aura-ext/std", + "cumulus-pallet-parachain-system/std", + "cumulus-pallet-xcm/std", + "cumulus-pallet-xcmp-queue/std", + "cumulus-primitives-aura/std", + "cumulus-primitives-core/std", + "cumulus-primitives-utility/std", + "encointer-balances-tx-payment-rpc-runtime-api/std", + "encointer-balances-tx-payment/std", + "encointer-primitives/serde_derive", + "encointer-primitives/std", + "frame-executive/std", + "frame-support/std", + "frame-system-rpc-runtime-api/std", + "frame-system/std", + "frame-try-runtime?/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", + "pallet-encointer-bazaar/std", + "pallet-encointer-ceremonies-rpc-runtime-api/std", + "pallet-encointer-ceremonies/std", + "pallet-encointer-communities-rpc-runtime-api/std", + "pallet-encointer-communities/std", + "pallet-encointer-faucet/std", + "pallet-encointer-reputation-commitments/std", + "pallet-encointer-scheduler/std", + "pallet-insecure-randomness-collective-flip/std", + "pallet-message-queue/std", + "pallet-membership/std", + "pallet-proxy/std", + "pallet-session/std", + "pallet-timestamp/std", + "pallet-transaction-payment-rpc-runtime-api/std", + "pallet-transaction-payment/std", + "pallet-utility/std", + "pallet-xcm/std", + "parachain-info/std", + "parachains-common/std", + "scale-info/std", + "sp-api/std", + "sp-block-builder/std", + "sp-consensus-aura/std", + "sp-core/std", + "sp-genesis-builder/std", + "sp-inherents/std", + "sp-offchain/std", + "sp-runtime/std", + "sp-session/std", + "sp-std/std", + "sp-transaction-pool/std", + "sp-version/std", + "substrate-wasm-builder", + "xcm-builder/std", + "xcm-executor/std", + "xcm/std", + "frame-benchmarking?/std", + "frame-system-benchmarking?/std", + "pallet-scheduler/std", + "polkadot-core-primitives/std", + "polkadot-parachain-primitives/std", + "polkadot-primitives/std", + "polkadot-runtime-common/std", ] try-runtime = [ - "cumulus-pallet-aura-ext/try-runtime", - "cumulus-pallet-parachain-system/try-runtime", - "cumulus-pallet-xcm/try-runtime", - "cumulus-pallet-xcmp-queue/try-runtime", - "frame-executive/try-runtime", - "frame-system/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", - "pallet-encointer-ceremonies/try-runtime", - "pallet-encointer-communities/try-runtime", - "pallet-encointer-faucet/try-runtime", - "pallet-encointer-reputation-commitments/try-runtime", - "pallet-encointer-scheduler/try-runtime", - "pallet-insecure-randomness-collective-flip/try-runtime", - "pallet-message-queue/try-runtime", - "pallet-membership/try-runtime", - "pallet-proxy/try-runtime", - "pallet-scheduler/try-runtime", - "pallet-session/try-runtime", - "pallet-timestamp/try-runtime", - "pallet-transaction-payment/try-runtime", - "pallet-utility/try-runtime", - "pallet-xcm/try-runtime", - "parachain-info/try-runtime", - "encointer-balances-tx-payment/try-runtime", - "encointer-primitives/try-runtime", - "frame-support/try-runtime", - "polkadot-runtime-common/try-runtime", - "sp-runtime/try-runtime", + "cumulus-pallet-aura-ext/try-runtime", + "cumulus-pallet-parachain-system/try-runtime", + "cumulus-pallet-xcm/try-runtime", + "cumulus-pallet-xcmp-queue/try-runtime", + "frame-executive/try-runtime", + "frame-system/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", + "pallet-encointer-ceremonies/try-runtime", + "pallet-encointer-communities/try-runtime", + "pallet-encointer-faucet/try-runtime", + "pallet-encointer-reputation-commitments/try-runtime", + "pallet-encointer-scheduler/try-runtime", + "pallet-insecure-randomness-collective-flip/try-runtime", + "pallet-message-queue/try-runtime", + "pallet-membership/try-runtime", + "pallet-proxy/try-runtime", + "pallet-scheduler/try-runtime", + "pallet-session/try-runtime", + "pallet-timestamp/try-runtime", + "pallet-transaction-payment/try-runtime", + "pallet-utility/try-runtime", + "pallet-xcm/try-runtime", + "parachain-info/try-runtime", + "encointer-balances-tx-payment/try-runtime", + "encointer-primitives/try-runtime", + "frame-support/try-runtime", + "polkadot-runtime-common/try-runtime", + "sp-runtime/try-runtime", ] # A feature that should be enabled when the runtime should be built for on-chain From 20edb93408257393edc74a1556bd7941f767cbf5 Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Wed, 10 Apr 2024 17:15:40 +0200 Subject: [PATCH 14/29] add migration to initialize invulnerables --- system-parachains/encointer/Cargo.toml | 3 +- system-parachains/encointer/src/lib.rs | 14 +- .../encointer/src/migrations_fix.rs | 238 +++++++----------- 3 files changed, 92 insertions(+), 163 deletions(-) diff --git a/system-parachains/encointer/Cargo.toml b/system-parachains/encointer/Cargo.toml index dfd03266e6..93f8b6ddf1 100644 --- a/system-parachains/encointer/Cargo.toml +++ b/system-parachains/encointer/Cargo.toml @@ -12,7 +12,7 @@ version.workspace = true codec = { package = "parity-scale-codec", version = "3.6.9", default-features = false, features = [ "derive", ] } -hex-literal = { optional = true, workspace = true } +hex-literal = { workspace = true } log = { workspace = true } scale-info = { features = ["derive"], workspace = true } smallvec = { workspace = true } @@ -122,7 +122,6 @@ runtime-benchmarks = [ "frame-support/runtime-benchmarks", "frame-system-benchmarking/runtime-benchmarks", "frame-system/runtime-benchmarks", - "hex-literal", "pallet-balances/runtime-benchmarks", "pallet-collator-selection/runtime-benchmarks", "pallet-collective/runtime-benchmarks", diff --git a/system-parachains/encointer/src/lib.rs b/system-parachains/encointer/src/lib.rs index 2898a0ffdc..b788b8440c 100644 --- a/system-parachains/encointer/src/lib.rs +++ b/system-parachains/encointer/src/lib.rs @@ -711,19 +711,7 @@ pub type CheckedExtrinsic = generic::CheckedExtrinsic, - // 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, - cumulus_pallet_xcmp_queue::migration::v4::MigrationToV4, - pallet_encointer_ceremonies::migrations::v2::MigrateToV2, + migrations_fix::collator_selection_init::v0::InitInvulnerables, // permanent pallet_xcm::migration::MigrateToLatestXcmVersion, ); diff --git a/system-parachains/encointer/src/migrations_fix.rs b/system-parachains/encointer/src/migrations_fix.rs index 0493d57bb5..6b59cc5e0b 100644 --- a/system-parachains/encointer/src/migrations_fix.rs +++ b/system-parachains/encointer/src/migrations_fix.rs @@ -17,173 +17,115 @@ // 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: &'static str = "runtime::fix::balances::migration"; - pub mod v1 { + const TARGET: &'static 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 codec::EncodeLike; + + //crate::Pallet::ExistentialDeposit; + use crate::SessionKeys; + 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}; + + const INVULNERABLE_A: [u8; 32] = + hex!("5e962096da68302d5c47fce0178d72fab503c4f00a3f1df64856748f0d9dd51e"); + const INVULNERABLE_B: [u8; 32] = + hex!("0cecb8d1c2c744ca4c5cea57f5d6c40238f4dad17afa213672b8b7d43b80a659"); + const INVULNERABLE_C: [u8; 32] = + hex!("ca1951a3c4e100fb5a899e7bae3ea124491930a72000c5e4b2775fea27ecf05d"); + const INVULNERABLE_D: [u8; 32] = + hex!("484b443bd95068b860c92b0f66487b78f58234eca0f88e2adbe80bae4807b809"); + const INVULNERABLE_E: [u8; 32] = + hex!("6c642fb4b571a5685a869cd291fafd575be47a918b231ba28165e5c0cd0cfa15"); + + 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()) } 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." - ); - return T::DbWeight::get().reads(1) + info!(target: TARGET, "initializing the set of invulnerables"); + + let raw_keys: Vec<[u8; 32]> = vec![ + INVULNERABLE_A, + INVULNERABLE_B, + INVULNERABLE_C, + INVULNERABLE_D, + INVULNERABLE_E, + ]; + + let validatorids: Vec<::ValidatorId> = + raw_keys.iter().map(|&pk| pk.into()).collect(); + + pallet_session::Validators::::put(validatorids); + + let queued_keys: Vec<( + ::ValidatorId, + ::Keys, + )> = raw_keys + .iter() + .map(|&pk| { + ( + pk.into(), + SessionKeys { aura: sr25519::Public::from_raw(pk).into() }.into(), + ) + }) + .collect(); + + pallet_session::QueuedKeys::::put(queued_keys); + + for pk in raw_keys.clone() { + pallet_session::NextKeys::::insert::< + ::ValidatorId, + ::Keys, + >(pk.into(), SessionKeys { aura: sr25519::Public::from_raw(pk).into() }.into()); + pallet_session::KeyOwner::::insert::< + _, + ::ValidatorId, + >((AURA, pk.encode()), pk.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: &'static str = "runtime::fix::scheduler::migration"; + let invulnerables: Vec<::AccountId> = + raw_keys.iter().map(|&pk| pk.into()).collect(); + 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::>( + 533_333_328u128.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. - 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> { Ok(()) } } From e252e422372456de9a8dddf6e1d87672f1822917 Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Wed, 10 Apr 2024 17:42:59 +0200 Subject: [PATCH 15/29] fix no_std build --- system-parachains/encointer/src/lib.rs | 2 +- system-parachains/encointer/src/migrations_fix.rs | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/system-parachains/encointer/src/lib.rs b/system-parachains/encointer/src/lib.rs index b788b8440c..c2fd3aad70 100644 --- a/system-parachains/encointer/src/lib.rs +++ b/system-parachains/encointer/src/lib.rs @@ -36,6 +36,7 @@ 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 encointer_balances_tx_payment::{ @@ -96,7 +97,6 @@ use sp_std::prelude::*; #[cfg(feature = "std")] use sp_version::NativeVersion; use sp_version::RuntimeVersion; -use std::marker::PhantomData; use system_parachains_constants::{ kusama::{consensus::*, currency::*, fee::WeightToFee}, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, diff --git a/system-parachains/encointer/src/migrations_fix.rs b/system-parachains/encointer/src/migrations_fix.rs index 6b59cc5e0b..7feb80affc 100644 --- a/system-parachains/encointer/src/migrations_fix.rs +++ b/system-parachains/encointer/src/migrations_fix.rs @@ -26,15 +26,14 @@ pub mod collator_selection_init { const TARGET: &'static str = "runtime::fix::collator_selection_init"; pub mod v0 { use super::*; - use codec::EncodeLike; - - //crate::Pallet::ExistentialDeposit; 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_A: [u8; 32] = hex!("5e962096da68302d5c47fce0178d72fab503c4f00a3f1df64856748f0d9dd51e"); From 264d867610f6b9c8bb86598862a30bf92d12d62a Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Wed, 10 Apr 2024 18:15:36 +0200 Subject: [PATCH 16/29] fix chainspec-generator --- chain-spec-generator/src/system_parachains_specs.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chain-spec-generator/src/system_parachains_specs.rs b/chain-spec-generator/src/system_parachains_specs.rs index 2d6d6b9b3c..965b56f9de 100644 --- a/chain-spec-generator/src/system_parachains_specs.rs +++ b/chain-spec-generator/src/system_parachains_specs.rs @@ -563,12 +563,12 @@ fn encointer_kusama_genesis(endowed_accounts: Vec, id: u32) -> serde_ ..Default::default() }, "collatorSelection": encointer_kusama_runtime::CollatorSelectionConfig { - invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), + invulnerables: invulnerables().iter().cloned().map(|(acc, _)| acc).collect(), candidacy_bond: ENCOINTER_KUSAMA_ED * 16, ..Default::default() }, "session": asset_hub_kusama_runtime::SessionConfig { - keys: invulnerables + keys: invulnerables() .into_iter() .map(|(acc, aura)| { ( From ad8733e984c80709d7d7fc9f1f03b39c455d14f2 Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Wed, 10 Apr 2024 20:03:41 +0200 Subject: [PATCH 17/29] fix benchmarks build --- Cargo.lock | 1 + system-parachains/encointer/Cargo.toml | 2 ++ system-parachains/encointer/src/lib.rs | 1 - 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index dc27cf2794..f04661a2fd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3549,6 +3549,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", diff --git a/system-parachains/encointer/Cargo.toml b/system-parachains/encointer/Cargo.toml index 93f8b6ddf1..e272e4222e 100644 --- a/system-parachains/encointer/Cargo.toml +++ b/system-parachains/encointer/Cargo.toml @@ -91,6 +91,7 @@ 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 } @@ -118,6 +119,7 @@ default = ["std"] runtime-benchmarks = [ "cumulus-pallet-xcmp-queue/runtime-benchmarks", "cumulus-pallet-parachain-system/runtime-benchmarks", + "cumulus-pallet-session-benchmarking/runtime-benchmarks", "frame-benchmarking/runtime-benchmarks", "frame-support/runtime-benchmarks", "frame-system-benchmarking/runtime-benchmarks", diff --git a/system-parachains/encointer/src/lib.rs b/system-parachains/encointer/src/lib.rs index c2fd3aad70..3d61fe6128 100644 --- a/system-parachains/encointer/src/lib.rs +++ b/system-parachains/encointer/src/lib.rs @@ -746,7 +746,6 @@ mod benches { [pallet_encointer_faucet, EncointerFaucet] [pallet_encointer_reputation_commitments, EncointerReputationCommitments] [pallet_encointer_scheduler, EncointerScheduler] - [cumulus_pallet_dmp_queue, DmpQueue] [cumulus_pallet_parachain_system, ParachainSystem] [cumulus_pallet_xcmp_queue, XcmpQueue] ); From 8e5f948190d9f2a91d3f59365dd3387d687a5b53 Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Wed, 10 Apr 2024 20:14:15 +0200 Subject: [PATCH 18/29] zepter fix --- system-parachains/encointer/Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/system-parachains/encointer/Cargo.toml b/system-parachains/encointer/Cargo.toml index e272e4222e..1e257f9458 100644 --- a/system-parachains/encointer/Cargo.toml +++ b/system-parachains/encointer/Cargo.toml @@ -158,6 +158,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", From 4503c34f9c7a26a61a9b858efc94f18da872af8e Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Tue, 30 Apr 2024 14:15:37 +0200 Subject: [PATCH 19/29] revert spec version bump --- system-parachains/encointer/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-parachains/encointer/src/lib.rs b/system-parachains/encointer/src/lib.rs index c34415f257..d48c2847c4 100644 --- a/system-parachains/encointer/src/lib.rs +++ b/system-parachains/encointer/src/lib.rs @@ -125,7 +125,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("encointer-parachain"), impl_name: create_runtime_str!("encointer-parachain"), authoring_version: 1, - spec_version: 1_002_010, + spec_version: 1_002_000, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 3, From 4d582d2c31a1103a0804d7c5db52bab7ebc57d69 Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Tue, 30 Apr 2024 14:59:31 +0200 Subject: [PATCH 20/29] burn half of CC fees --- system-parachains/encointer/src/lib.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/system-parachains/encointer/src/lib.rs b/system-parachains/encointer/src/lib.rs index d48c2847c4..6755b1a9f8 100644 --- a/system-parachains/encointer/src/lib.rs +++ b/system-parachains/encointer/src/lib.rs @@ -582,8 +582,16 @@ where { fn handle_credit(credit: Credit, pallet_encointer_balances::Pallet>) { if let Some(author) = pallet_authorship::Pallet::::author() { + // We will burn 50% of community currency fees and send 50% to the 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 (https://forum.polkadot.network/t/towards-encointer-self-sustainability/4195) + let half_amount = credit.peek() / 2; + let (author_credit, _burnable) = 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, credit); + let _ = pallet_encointer_balances::Pallet::::resolve(&author, author_credit); } } } @@ -717,8 +725,8 @@ parameter_types! { /// Migrations to apply on runtime upgrade. pub type Migrations = ( frame_support::migrations::RemovePallet, - migrations_fix::collator_selection_init::v0::InitInvulnerables, - // permanent + migrations_fix::collator_selection_init::v0::InitInvulnerables, + // permanent pallet_xcm::migration::MigrateToLatestXcmVersion, ); From 25b40a1a3dad0241c5c3ff984ed047ea1edf531e Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Tue, 30 Apr 2024 15:05:19 +0200 Subject: [PATCH 21/29] init candidacy bond to 5 KSM --- system-parachains/encointer/src/migrations_fix.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-parachains/encointer/src/migrations_fix.rs b/system-parachains/encointer/src/migrations_fix.rs index 7feb80affc..b100a4f2db 100644 --- a/system-parachains/encointer/src/migrations_fix.rs +++ b/system-parachains/encointer/src/migrations_fix.rs @@ -117,7 +117,7 @@ pub mod collator_selection_init { pallet_collator_selection::Invulnerables::::put(invulnerables); pallet_collator_selection::CandidacyBond::::put::>( - 533_333_328u128.into(), + 5_000_000_000_000u128.into(), ); T::DbWeight::get().reads_writes(0, 4 + 5 * 2) From bbf92f696ad8b253ca9f8901ef65022d887fe451 Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Tue, 30 Apr 2024 15:37:05 +0200 Subject: [PATCH 22/29] add try-runtime checks --- system-parachains/encointer/src/migrations_fix.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/system-parachains/encointer/src/migrations_fix.rs b/system-parachains/encointer/src/migrations_fix.rs index b100a4f2db..7fcf0d3472 100644 --- a/system-parachains/encointer/src/migrations_fix.rs +++ b/system-parachains/encointer/src/migrations_fix.rs @@ -65,6 +65,11 @@ pub mod collator_selection_init { { #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result, TryRuntimeError> { + let invulnerables_len = pallet_collator_selection::Invulnerables::::get().len(); + ensure!( + invulnerables_len == 0, + "this migration has been executed previously. won't apply it again" + ); Ok(().encode()) } @@ -110,8 +115,9 @@ pub mod collator_selection_init { >((AURA, pk.encode()), pk.into()); } - let invulnerables: Vec<::AccountId> = + let mut invulnerables: Vec<::AccountId> = raw_keys.iter().map(|&pk| pk.into()).collect(); + invulnerables.sort(); let invulnerables: BoundedVec<_, T::MaxInvulnerables> = invulnerables.try_into().unwrap(); pallet_collator_selection::Invulnerables::::put(invulnerables); @@ -125,6 +131,11 @@ pub mod collator_selection_init { #[cfg(feature = "try-runtime")] fn post_upgrade(_state: sp_std::vec::Vec) -> Result<(), TryRuntimeError> { + let invulnerables_len = pallet_collator_selection::Invulnerables::::get().len(); + ensure!( + invulnerables_len > 0, + "invulnerables are empty after initialization. that should not happen" + ); Ok(()) } } From 3a8046dba31e0c50e6af3a9141afab40f81436af Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Tue, 30 Apr 2024 20:56:52 +0200 Subject: [PATCH 23/29] make migration idempotent --- .../encointer/src/migrations_fix.rs | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/system-parachains/encointer/src/migrations_fix.rs b/system-parachains/encointer/src/migrations_fix.rs index 7fcf0d3472..368e25b520 100644 --- a/system-parachains/encointer/src/migrations_fix.rs +++ b/system-parachains/encointer/src/migrations_fix.rs @@ -66,14 +66,15 @@ pub mod collator_selection_init { #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result, TryRuntimeError> { let invulnerables_len = pallet_collator_selection::Invulnerables::::get().len(); - ensure!( - invulnerables_len == 0, - "this migration has been executed previously. won't apply it again" - ); - Ok(().encode()) + Ok((invulnerables_len as u32).encode()) } fn on_runtime_upgrade() -> Weight { + 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(0, 0) + } info!(target: TARGET, "initializing the set of invulnerables"); let raw_keys: Vec<[u8; 32]> = vec![ @@ -130,12 +131,17 @@ pub mod collator_selection_init { } #[cfg(feature = "try-runtime")] - fn post_upgrade(_state: sp_std::vec::Vec) -> Result<(), TryRuntimeError> { - let invulnerables_len = pallet_collator_selection::Invulnerables::::get().len(); + 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(()) } } From 7a09130b91b8d511ff00ac30818f7e3dd7f38455 Mon Sep 17 00:00:00 2001 From: brenzi Date: Wed, 1 May 2024 11:56:57 +0200 Subject: [PATCH 24/29] Update system-parachains/encointer/src/migrations_fix.rs Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> --- system-parachains/encointer/src/migrations_fix.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-parachains/encointer/src/migrations_fix.rs b/system-parachains/encointer/src/migrations_fix.rs index 368e25b520..c6cd82f02d 100644 --- a/system-parachains/encointer/src/migrations_fix.rs +++ b/system-parachains/encointer/src/migrations_fix.rs @@ -73,7 +73,7 @@ pub mod collator_selection_init { 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(0, 0) + return T::DbWeight::get().reads_writes(1, 0) } info!(target: TARGET, "initializing the set of invulnerables"); From a9f4d16655a5132f05692acac2b9464474c637ae Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Wed, 1 May 2024 13:22:30 +0200 Subject: [PATCH 25/29] inject fresh invulnerable accounts. leave existing aura keys to become initial session keys --- .../encointer/src/migrations_fix.rs | 48 +++++++++++++------ 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/system-parachains/encointer/src/migrations_fix.rs b/system-parachains/encointer/src/migrations_fix.rs index c6cd82f02d..a72190d1cd 100644 --- a/system-parachains/encointer/src/migrations_fix.rs +++ b/system-parachains/encointer/src/migrations_fix.rs @@ -35,17 +35,28 @@ pub mod collator_selection_init { use sp_core::{crypto::key_types::AURA, sr25519}; use sp_std::{vec, vec::Vec}; - const INVULNERABLE_A: [u8; 32] = + const INVULNERABLE_AURA_A: [u8; 32] = hex!("5e962096da68302d5c47fce0178d72fab503c4f00a3f1df64856748f0d9dd51e"); - const INVULNERABLE_B: [u8; 32] = + const INVULNERABLE_AURA_B: [u8; 32] = hex!("0cecb8d1c2c744ca4c5cea57f5d6c40238f4dad17afa213672b8b7d43b80a659"); - const INVULNERABLE_C: [u8; 32] = + const INVULNERABLE_AURA_C: [u8; 32] = hex!("ca1951a3c4e100fb5a899e7bae3ea124491930a72000c5e4b2775fea27ecf05d"); - const INVULNERABLE_D: [u8; 32] = + const INVULNERABLE_AURA_D: [u8; 32] = hex!("484b443bd95068b860c92b0f66487b78f58234eca0f88e2adbe80bae4807b809"); - const INVULNERABLE_E: [u8; 32] = + 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 @@ -77,23 +88,23 @@ pub mod collator_selection_init { } info!(target: TARGET, "initializing the set of invulnerables"); - let raw_keys: Vec<[u8; 32]> = vec![ - INVULNERABLE_A, - INVULNERABLE_B, - INVULNERABLE_C, - INVULNERABLE_D, - INVULNERABLE_E, + let raw_aura_keys: Vec<[u8; 32]> = vec![ + INVULNERABLE_AURA_A, + INVULNERABLE_AURA_B, + INVULNERABLE_AURA_C, + INVULNERABLE_AURA_D, + INVULNERABLE_AURA_E, ]; let validatorids: Vec<::ValidatorId> = - raw_keys.iter().map(|&pk| pk.into()).collect(); + raw_aura_keys.iter().map(|&pk| pk.into()).collect(); pallet_session::Validators::::put(validatorids); let queued_keys: Vec<( ::ValidatorId, ::Keys, - )> = raw_keys + )> = raw_aura_keys .iter() .map(|&pk| { ( @@ -105,7 +116,7 @@ pub mod collator_selection_init { pallet_session::QueuedKeys::::put(queued_keys); - for pk in raw_keys.clone() { + for pk in raw_aura_keys.clone() { pallet_session::NextKeys::::insert::< ::ValidatorId, ::Keys, @@ -116,8 +127,15 @@ pub mod collator_selection_init { >((AURA, pk.encode()), pk.into()); } + let raw_account_keys: Vec<[u8; 32]> = vec![ + INVULNERABLE_ACCOUNT_A, + INVULNERABLE_ACCOUNT_B, + INVULNERABLE_ACCOUNT_C, + INVULNERABLE_ACCOUNT_D, + INVULNERABLE_ACCOUNT_E, + ]; let mut invulnerables: Vec<::AccountId> = - raw_keys.iter().map(|&pk| pk.into()).collect(); + raw_account_keys.iter().map(|&pk| pk.into()).collect(); invulnerables.sort(); let invulnerables: BoundedVec<_, T::MaxInvulnerables> = invulnerables.try_into().unwrap(); From 963b2a31f726d71e869127c28b8aa8f60fbe83d5 Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Wed, 1 May 2024 13:47:04 +0200 Subject: [PATCH 26/29] fix mappings between session and validator keys --- .../encointer/src/migrations_fix.rs | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/system-parachains/encointer/src/migrations_fix.rs b/system-parachains/encointer/src/migrations_fix.rs index a72190d1cd..5b9acfdf2f 100644 --- a/system-parachains/encointer/src/migrations_fix.rs +++ b/system-parachains/encointer/src/migrations_fix.rs @@ -95,45 +95,49 @@ pub mod collator_selection_init { 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_aura_keys.iter().map(|&pk| pk.into()).collect(); + raw_account_keys.iter().map(|&pk| pk.into()).collect(); pallet_session::Validators::::put(validatorids); let queued_keys: Vec<( ::ValidatorId, ::Keys, - )> = raw_aura_keys + )> = raw_account_keys .iter() - .map(|&pk| { + .zip(raw_aura_keys.iter()) + .map(|(&account, &aura)| { ( - pk.into(), - SessionKeys { aura: sr25519::Public::from_raw(pk).into() }.into(), + account.into(), + SessionKeys { aura: sr25519::Public::from_raw(aura).into() }.into(), ) }) .collect(); pallet_session::QueuedKeys::::put(queued_keys); - for pk in raw_aura_keys.clone() { + for (&account, &aura) in raw_account_keys.iter().zip(raw_aura_keys.iter()) { pallet_session::NextKeys::::insert::< ::ValidatorId, ::Keys, - >(pk.into(), SessionKeys { aura: sr25519::Public::from_raw(pk).into() }.into()); + >( + account.into(), + SessionKeys { aura: sr25519::Public::from_raw(aura).into() }.into(), + ); pallet_session::KeyOwner::::insert::< _, ::ValidatorId, - >((AURA, pk.encode()), pk.into()); + >((AURA, aura.encode()), account.into()); } - let raw_account_keys: Vec<[u8; 32]> = vec![ - INVULNERABLE_ACCOUNT_A, - INVULNERABLE_ACCOUNT_B, - INVULNERABLE_ACCOUNT_C, - INVULNERABLE_ACCOUNT_D, - INVULNERABLE_ACCOUNT_E, - ]; let mut invulnerables: Vec<::AccountId> = raw_account_keys.iter().map(|&pk| pk.into()).collect(); invulnerables.sort(); From 6a75792911a39da420e7fd69a75aeec245845067 Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Wed, 1 May 2024 15:29:17 +0200 Subject: [PATCH 27/29] split CC fees between author and a dead account (burn) --- system-parachains/encointer/src/lib.rs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/system-parachains/encointer/src/lib.rs b/system-parachains/encointer/src/lib.rs index 6755b1a9f8..264baa86d4 100644 --- a/system-parachains/encointer/src/lib.rs +++ b/system-parachains/encointer/src/lib.rs @@ -578,20 +578,30 @@ impl HandleCredit, pallet_encointer_balances::Pallet> for AssetsToBlockAuthor where R: pallet_authorship::Config + pallet_encointer_balances::Config, - AccountIdOf: From + Into, + AccountIdOf: From + + Into + + From<[u8; 32]>, { fn handle_credit(credit: Credit, pallet_encointer_balances::Pallet>) { if let Some(author) = pallet_authorship::Pallet::::author() { - // We will burn 50% of community currency fees and send 50% to the block 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 (https://forum.polkadot.network/t/towards-encointer-self-sustainability/4195) + // "burned" to dead account 0x00 = 5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUpnhM + // See: https://forum.polkadot.network/t/towards-encointer-self-sustainability/4195 + let half_amount = credit.peek() / 2; - let (author_credit, _burnable) = credit.split(half_amount); + 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); } } } From 782d5a9ce5c7c1f79714b2b9cd320b0be7b963cc Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Tue, 21 May 2024 09:37:52 +0200 Subject: [PATCH 28/29] clippy after merge --- system-parachains/encointer/src/lib.rs | 2 +- system-parachains/encointer/src/migrations_fix.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/system-parachains/encointer/src/lib.rs b/system-parachains/encointer/src/lib.rs index ec37592d73..ad12dc9882 100644 --- a/system-parachains/encointer/src/lib.rs +++ b/system-parachains/encointer/src/lib.rs @@ -1310,7 +1310,7 @@ mod system_parachains_constants { use polkadot_primitives::Balance; /// The existential deposit. - pub const EXISTENTIAL_DEPOSIT: Balance = 1 * CENTS; + pub const EXISTENTIAL_DEPOSIT: Balance = CENTS; pub const UNITS: Balance = 1_000_000_000_000; pub const QUID: Balance = UNITS / 30; diff --git a/system-parachains/encointer/src/migrations_fix.rs b/system-parachains/encointer/src/migrations_fix.rs index 5b9acfdf2f..472fbd5852 100644 --- a/system-parachains/encointer/src/migrations_fix.rs +++ b/system-parachains/encointer/src/migrations_fix.rs @@ -23,7 +23,7 @@ pub mod collator_selection_init { use sp_runtime::TryRuntimeError; /// The log target. - const TARGET: &'static str = "runtime::fix::collator_selection_init"; + const TARGET: &str = "runtime::fix::collator_selection_init"; pub mod v0 { use super::*; use crate::SessionKeys; From 343e93eb1e7f17d8bdf019871775f0d974462122 Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Tue, 21 May 2024 13:30:44 +0200 Subject: [PATCH 29/29] fix changelog --- CHANGELOG.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0447186cc0..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 @@ -20,7 +21,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Kusama chains: allow arbitrary XCM execution ([polkadot-fellows/runtimes#261](https://github.com/polkadot-fellows/runtimes/pull/261)) - Allow everything through XCM SafeCallFilter ([polkadot-fellows/runtimes#285](https://github.com/polkadot-fellows/runtimes/pull/285)) -- 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)) ### Added @@ -70,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))