From 49f9eb7198655897eecf99d8ec7c6bb334c377a3 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Mon, 30 May 2022 20:06:44 +0200 Subject: [PATCH 01/35] upgrade to kusama base --- runtime/kusama/src/lib.rs | 26 +- runtime/kusama/src/xcm_config.rs | 3 +- runtime/rococo/constants/src/lib.rs | 10 +- runtime/rococo/src/lib.rs | 2333 ++++++++++++----- runtime/rococo/src/weights/mod.rs | 1 + runtime/rococo/src/weights/xcm/mod.rs | 195 ++ .../xcm/pallet_xcm_benchmarks_fungible.rs | 112 + .../xcm/pallet_xcm_benchmarks_generic.rs | 136 + runtime/rococo/src/xcm_config.rs | 120 +- 9 files changed, 2261 insertions(+), 675 deletions(-) create mode 100644 runtime/rococo/src/weights/xcm/mod.rs create mode 100644 runtime/rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs create mode 100644 runtime/rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index 905e2d1cdc39..acf166a9187f 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -20,7 +20,6 @@ // `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256. #![recursion_limit = "256"] -use pallet_transaction_payment::CurrencyAdapter; use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; use primitives::v2::{ AccountId, AccountIndex, Balance, BlockNumber, CandidateEvent, CandidateHash, @@ -62,7 +61,7 @@ use frame_system::EnsureRoot; use pallet_grandpa::{fg_primitives, AuthorityId as GrandpaId}; use pallet_im_online::sr25519::AuthorityId as ImOnlineId; use pallet_session::historical as session_historical; -use pallet_transaction_payment::{FeeDetails, RuntimeDispatchInfo}; +use pallet_transaction_payment::{CurrencyAdapter, FeeDetails, RuntimeDispatchInfo}; use sp_core::OpaqueMetadata; use sp_mmr_primitives as mmr; use sp_runtime::{ @@ -81,13 +80,13 @@ use sp_version::RuntimeVersion; use static_assertions::const_assert; pub use frame_system::Call as SystemCall; -pub use pallet_balances::Call as BalancesCall; +// pub use pallet_balances::Call as BalancesCall; pub use pallet_election_provider_multi_phase::Call as EPMCall; #[cfg(feature = "std")] pub use pallet_staking::StakerStatus; -pub use pallet_timestamp::Call as TimestampCall; -#[cfg(any(feature = "std", test))] -pub use sp_runtime::BuildStorage; +// pub use pallet_timestamp::Call as TimestampCall; +// #[cfg(any(feature = "std", test))] +// pub use sp_runtime::BuildStorage; /// Constant values used within the runtime. use kusama_runtime_constants::{currency::*, fee::*, time::*}; @@ -355,10 +354,10 @@ impl pallet_authorship::Config for Runtime { type EventHandler = (Staking, ImOnline); } -parameter_types! { - pub const Period: BlockNumber = 10 * MINUTES; - pub const Offset: BlockNumber = 0; -} +// parameter_types! { +// pub const Period: BlockNumber = 10 * MINUTES; +// pub const Offset: BlockNumber = 0; +// } impl_opaque_keys! { pub struct SessionKeys { @@ -419,6 +418,8 @@ parameter_types! { /// ... and all of the validators as electable targets. Whilst this is the case, we cannot and /// shall not increase the size of the validator intentions. pub const MaxElectableTargets: u16 = u16::MAX; + pub NposSolutionPriority: TransactionPriority = + Perbill::from_percent(90) * TransactionPriority::max_value(); } generate_solution_type!( @@ -871,8 +872,6 @@ impl pallet_authority_discovery::Config for Runtime { } parameter_types! { - pub NposSolutionPriority: TransactionPriority = - Perbill::from_percent(90) * TransactionPriority::max_value(); pub const ImOnlineUnsignedPriority: TransactionPriority = TransactionPriority::max_value(); } @@ -1296,7 +1295,7 @@ impl parachains_hrmp::Config for Runtime { type Event = Event; type Origin = Origin; type Currency = Balances; - type WeightInfo = weights::runtime_parachains_hrmp::WeightInfo; + type WeightInfo = weights::runtime_parachains_hrmp::WeightInfo; } impl parachains_paras_inherent::Config for Runtime { @@ -1518,7 +1517,6 @@ construct_runtime! { TechnicalMembership: pallet_membership::::{Pallet, Call, Storage, Event, Config} = 17, Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event} = 18, - // Claims. Usable initially. Claims: claims::{Pallet, Call, Storage, Event, Config, ValidateUnsigned} = 19, diff --git a/runtime/kusama/src/xcm_config.rs b/runtime/kusama/src/xcm_config.rs index 5363541e31c1..9bddcbba09f3 100644 --- a/runtime/kusama/src/xcm_config.rs +++ b/runtime/kusama/src/xcm_config.rs @@ -102,8 +102,9 @@ pub type XcmRouter = ( parameter_types! { pub const Kusama: MultiAssetFilter = Wild(AllOf { fun: WildFungible, id: Concrete(KsmLocation::get()) }); pub const Statemine: MultiLocation = Parachain(1000).into(); + pub const Encointer: MultiLocation = Parachain(1001).into(); pub const KusamaForStatemine: (MultiAssetFilter, MultiLocation) = (Kusama::get(), Statemine::get()); - pub const KusamaForEncointer: (MultiAssetFilter, MultiLocation) = (Kusama::get(), Parachain(1001).into()); + pub const KusamaForEncointer: (MultiAssetFilter, MultiLocation) = (Kusama::get(), Encointer::get()); } pub type TrustedTeleporters = (xcm_builder::Case, xcm_builder::Case); diff --git a/runtime/rococo/constants/src/lib.rs b/runtime/rococo/constants/src/lib.rs index 180b2c726a48..e7913fb37c3b 100644 --- a/runtime/rococo/constants/src/lib.rs +++ b/runtime/rococo/constants/src/lib.rs @@ -22,9 +22,12 @@ pub mod weights; pub mod currency { use primitives::v2::Balance; + /// The existential deposit. + pub const EXISTENTIAL_DEPOSIT: Balance = 1 * CENTS; + pub const UNITS: Balance = 1_000_000_000_000; - pub const DOLLARS: Balance = UNITS; pub const CENTS: Balance = DOLLARS / 100; + pub const DOLLARS: Balance = UNITS; pub const MILLICENTS: Balance = CENTS / 1_000; pub const fn deposit(items: u32, bytes: u32) -> Balance { @@ -36,12 +39,11 @@ pub mod currency { pub mod time { use primitives::v2::{BlockNumber, Moment}; use runtime_common::prod_or_fast; - pub const MILLISECS_PER_BLOCK: Moment = 6000; pub const SLOT_DURATION: Moment = MILLISECS_PER_BLOCK; - pub const DEFAULT_EPOCH_DURATION: BlockNumber = prod_or_fast!(1 * HOURS, 1 * MINUTES); + pub const EPOCH_DURATION_IN_SLOTS: BlockNumber = prod_or_fast!(1 * HOURS, 1 * MINUTES); frame_support::parameter_types! { - pub storage EpochDurationInBlocks: BlockNumber = DEFAULT_EPOCH_DURATION; + pub storage EpochDurationInBlocks: BlockNumber = EPOCH_DURATION_IN_SLOTS; } // These time units are defined in number of blocks. diff --git a/runtime/rococo/src/lib.rs b/runtime/rococo/src/lib.rs index 2b98e31dd497..230f216b462b 100644 --- a/runtime/rococo/src/lib.rs +++ b/runtime/rococo/src/lib.rs @@ -20,14 +20,42 @@ // `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256. #![recursion_limit = "256"] +use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; +use primitives::v2::{ + AccountId, AccountIndex, Balance, BlockNumber, CandidateEvent, CandidateHash, + CommittedCandidateReceipt, CoreState, DisputeState, GroupRotationInfo, Hash, Id as ParaId, + InboundDownwardMessage, InboundHrmpMessage, Moment, Nonce, OccupiedCoreAssumption, + PersistedValidationData, ScrapedOnChainVotes, SessionInfo, Signature, + ValidationCode, ValidationCodeHash, ValidatorId, ValidatorIndex, +}; +use runtime_common::{ + assigned_slots, auctions, crowdloan, impl_runtime_weights, impls::ToAuthor, paras_registrar, + prod_or_fast, paras_sudo_wrapper, slots, BlockHashCount, BlockLength, SlowAdjustingFeeUpdate, +}; +use sp_std::{collections::btree_map::BTreeMap, prelude::*}; + +use runtime_parachains::{ + configuration as parachains_configuration, disputes as parachains_disputes, + dmp as parachains_dmp, hrmp as parachains_hrmp, inclusion as parachains_inclusion, + initializer as parachains_initializer, origin as parachains_origin, paras as parachains_paras, + paras_inherent as parachains_paras_inherent, runtime_api_impl::v2 as parachains_runtime_api_impl, + scheduler as parachains_scheduler, session_info as parachains_session_info, + shared as parachains_shared, ump as parachains_ump, +}; + use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId; use beefy_primitives::{ crypto::AuthorityId as BeefyId, mmr::{BeefyDataProvider, MmrLeafVersion}, }; +// TODO: Rococo +// use frame_election_provider_support::{ +// generate_solution_type, onchain, NposSolution, SequentialPhragmen, +// }; use frame_support::{ construct_runtime, parameter_types, traits::{Contains, InstanceFilter, KeyOwnerProofSystem}, + weights::ConstantMultiplier, PalletId, }; use frame_system::EnsureRoot; @@ -35,20 +63,6 @@ use pallet_grandpa::{fg_primitives, AuthorityId as GrandpaId}; use pallet_im_online::sr25519::AuthorityId as ImOnlineId; use pallet_session::historical as session_historical; use pallet_transaction_payment::{CurrencyAdapter, FeeDetails, RuntimeDispatchInfo}; -use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; -use primitives::v2::{ - AccountId, AccountIndex, Balance, BlockNumber, CandidateEvent, CandidateHash, - CommittedCandidateReceipt, CoreState, DisputeState, GroupRotationInfo, Hash, Id as ParaId, - InboundDownwardMessage, InboundHrmpMessage, Moment, Nonce, OccupiedCoreAssumption, - PersistedValidationData, PvfCheckStatement, ScrapedOnChainVotes, SessionInfo, Signature, - ValidationCode, ValidationCodeHash, ValidatorId, ValidatorIndex, ValidatorSignature, -}; -use runtime_common::{ - assigned_slots, auctions, crowdloan, impl_runtime_weights, impls::ToAuthor, paras_registrar, - paras_sudo_wrapper, slots, BlockHashCount, BlockLength, SlowAdjustingFeeUpdate, -}; -use runtime_parachains::{self, runtime_api_impl::v2 as runtime_api_impl}; -use scale_info::TypeInfo; use sp_core::{OpaqueMetadata, RuntimeDebug, H256}; use sp_mmr_primitives as mmr; use sp_runtime::{ @@ -61,33 +75,48 @@ use sp_runtime::{ ApplyExtrinsicResult, FixedU128, KeyTypeId, }; use sp_staking::SessionIndex; -use sp_std::{collections::btree_map::BTreeMap, prelude::*}; #[cfg(any(feature = "std", test))] use sp_version::NativeVersion; use sp_version::RuntimeVersion; - -use runtime_parachains::{ - configuration as parachains_configuration, disputes as parachains_disputes, - dmp as parachains_dmp, hrmp as parachains_hrmp, inclusion as parachains_inclusion, - initializer as parachains_initializer, origin as parachains_origin, paras as parachains_paras, - paras_inherent as parachains_paras_inherent, scheduler as parachains_scheduler, - session_info as parachains_session_info, shared as parachains_shared, ump as parachains_ump, -}; - -use bridge_runtime_common::messages::{ - source::estimate_message_dispatch_and_delivery_fee, MessageBridge, -}; +// TODO: Rococo +// use static_assertions::const_assert; pub use frame_system::Call as SystemCall; +// TODO: Election +// pub use pallet_election_provider_multi_phase::Call as EPMCall; +// TODO: Staking +// #[cfg(feature = "std")] +// pub use pallet_staking::StakerStatus; /// Constant values used within the runtime. use rococo_runtime_constants::{currency::*, fee::*, time::*}; -mod bridge_messages; -mod validator_manager; + + +// Weights used in the runtime. mod weights; + +// TODO: Rococo +//// Voter bag threshold definitions. +// mod bag_thresholds; + +// XCM configurations. pub mod xcm_config; +// TODO: Rococo | not in Kusama +mod validator_manager; + +// TODO: Rococo | not in Kusama +mod bridge_messages; +// TODO: Rococo | not in Kusama +use bridge_runtime_common::messages::{ + source::estimate_message_dispatch_and_delivery_fee, MessageBridge, +}; + +// TODO: Rococo +// #[cfg(test)] +// mod tests; + impl_runtime_weights!(rococo_runtime_constants); // Make the WASM binary available. @@ -106,7 +135,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { apis: RUNTIME_API_VERSIONS, #[cfg(feature = "disable-runtime-api")] apis: sp_version::create_apis_vec![[]], - transaction_version: 0, + transaction_version: 11, state_version: 0, }; @@ -123,141 +152,6 @@ pub fn native_version() -> NativeVersion { NativeVersion { runtime_version: VERSION, can_author_with: Default::default() } } -/// The address format for describing accounts. -pub type Address = sp_runtime::MultiAddress; -/// Block header type as expected by this runtime. -pub type Header = generic::Header; -/// Block type as expected by this runtime. -pub type Block = generic::Block; -/// A Block signed with a Justification -pub type SignedBlock = generic::SignedBlock; -/// `BlockId` type as expected by this runtime. -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::CheckMortality, - frame_system::CheckNonce, - frame_system::CheckWeight, - pallet_transaction_payment::ChargeTransactionPayment, -); - -/// Unchecked extrinsic type as expected by this runtime. -pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; -/// Executive: handles dispatch to the various modules. -pub type Executive = frame_executive::Executive< - Runtime, - Block, - frame_system::ChainContext, - Runtime, - AllPalletsWithSystem, ->; -/// The payload being signed in transactions. -pub type SignedPayload = generic::SignedPayload; - -impl_opaque_keys! { - pub struct SessionKeys { - pub grandpa: Grandpa, - pub babe: Babe, - pub im_online: ImOnline, - pub para_validator: Initializer, - pub para_assignment: ParaSessionInfo, - pub authority_discovery: AuthorityDiscovery, - pub beefy: Beefy, - } -} - -construct_runtime! { - pub enum Runtime where - Block = Block, - NodeBlock = primitives::v2::Block, - UncheckedExtrinsic = UncheckedExtrinsic - { - System: frame_system, - - // Babe must be before session. - Babe: pallet_babe, - - Timestamp: pallet_timestamp, - Indices: pallet_indices, - Balances: pallet_balances, - TransactionPayment: pallet_transaction_payment, - - // Consensus support. - // Authorship must be before session in order to note author in the correct session for - // im-online. - Authorship: pallet_authorship, - Offences: pallet_offences, - Historical: session_historical, - Session: pallet_session, - Grandpa: pallet_grandpa, - ImOnline: pallet_im_online, - AuthorityDiscovery: pallet_authority_discovery, - - // Parachains modules. - ParachainsOrigin: parachains_origin, - Configuration: parachains_configuration, - ParasShared: parachains_shared, - ParaInclusion: parachains_inclusion, - ParaInherent: parachains_paras_inherent, - ParaScheduler: parachains_scheduler, - Paras: parachains_paras, - Initializer: parachains_initializer, - Dmp: parachains_dmp, - Ump: parachains_ump, - Hrmp: parachains_hrmp, - ParaSessionInfo: parachains_session_info, - ParasDisputes: parachains_disputes, - - // Parachain Onboarding Pallets - Registrar: paras_registrar::{Pallet, Call, Storage, Event, Config}, - Auctions: auctions::{Pallet, Call, Storage, Event}, - Crowdloan: crowdloan::{Pallet, Call, Storage, Event}, - Slots: slots::{Pallet, Call, Storage, Event}, - ParasSudoWrapper: paras_sudo_wrapper::{Pallet, Call}, - AssignedSlots: assigned_slots::{Pallet, Call, Storage, Event}, - - // Sudo - Sudo: pallet_sudo, - - // Bridges support. - Mmr: pallet_mmr, - Beefy: pallet_beefy, - MmrLeaf: pallet_beefy_mmr, - - // Validator Manager pallet. - ValidatorManager: validator_manager, - - // It might seem strange that we add both sides of the bridge to the same runtime. We do this because this - // runtime as shared by both the Rococo and Wococo chains. When running as Rococo we only use - // `BridgeWococoGrandpa`, and vice versa. - BridgeRococoGrandpa: pallet_bridge_grandpa::{Pallet, Call, Storage, Config} = 40, - BridgeWococoGrandpa: pallet_bridge_grandpa::::{Pallet, Call, Storage, Config} = 41, - - // Bridge messages support. The same story as with the bridge grandpa pallet above ^^^ - when we're - // running as Rococo we only use `BridgeWococoMessages`/`BridgeWococoMessagesDispatch`, and vice versa. - BridgeRococoMessages: pallet_bridge_messages::{Pallet, Call, Storage, Event, Config} = 43, - BridgeWococoMessages: pallet_bridge_messages::::{Pallet, Call, Storage, Event, Config} = 44, - BridgeRococoMessagesDispatch: pallet_bridge_dispatch::{Pallet, Event} = 45, - BridgeWococoMessagesDispatch: pallet_bridge_dispatch::::{Pallet, Event} = 46, - - // A "council" - Collective: pallet_collective = 80, - Membership: pallet_membership = 81, - - Utility: pallet_utility = 90, - Proxy: pallet_proxy = 91, - Multisig: pallet_multisig, - - // Pallet for sending XCM. - XcmPallet: pallet_xcm = 99, - - } -} - pub struct BaseFilter; impl Contains for BaseFilter { fn contains(_call: &Call) -> bool { @@ -265,6 +159,13 @@ impl Contains for BaseFilter { } } +// TODO: Rococo +// type MoreThanHalfCouncil = EnsureOneOf< +// EnsureRoot, +// pallet_collective::EnsureProportionMoreThan, +// >; + +// TODO: Questions parameter_types! { pub const Version: RuntimeVersion = VERSION; pub const SS58Prefix: u8 = 42; @@ -297,111 +198,135 @@ impl frame_system::Config for Runtime { type MaxConsumers = frame_support::traits::ConstU32<16>; } +// TODO: Scheduler +// parameter_types! { +// pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * +// BlockWeights::get().max_block; +// pub const MaxScheduledPerBlock: u32 = 50; +// pub const NoPreimagePostponement: Option = Some(10); +// } + +// TODO: Scheduler +// type ScheduleOrigin = EnsureOneOf< +// EnsureRoot, +// pallet_collective::EnsureProportionAtLeast, +// >; + +// TODO: Scheduler +///// Used the compare the privilege of an origin inside the scheduler. +// pub struct OriginPrivilegeCmp; + +// TODO: Scheduler +// impl PrivilegeCmp for OriginPrivilegeCmp { +// fn cmp_privilege(left: &OriginCaller, right: &OriginCaller) -> Option { +// if left == right { +// return Some(Ordering::Equal) +// } + +// match (left, right) { +// // Root is greater than anything. +// (OriginCaller::system(frame_system::RawOrigin::Root), _) => Some(Ordering::Greater), +// // Check which one has more yes votes. +// ( +// OriginCaller::Council(pallet_collective::RawOrigin::Members(l_yes_votes, l_count)), +// OriginCaller::Council(pallet_collective::RawOrigin::Members(r_yes_votes, r_count)), +// ) => Some((l_yes_votes * r_count).cmp(&(r_yes_votes * l_count))), +// // For every other origin we don't care, as they are not used for `ScheduleOrigin`. +// _ => None, +// } +// } +// } + +// TODO: Scheduler +// impl pallet_scheduler::Config for Runtime { +// type Event = Event; +// type Origin = Origin; +// type PalletsOrigin = OriginCaller; +// type Call = Call; +// type MaximumWeight = MaximumSchedulerWeight; +// type ScheduleOrigin = ScheduleOrigin; +// type MaxScheduledPerBlock = MaxScheduledPerBlock; +// type WeightInfo = weights::pallet_scheduler::WeightInfo; +// type OriginPrivilegeCmp = OriginPrivilegeCmp; +// type PreimageProvider = Preimage; +// type NoPreimagePostponement = NoPreimagePostponement; +// } + +// TODO: Preimage +// parameter_types! { +// pub const PreimageMaxSize: u32 = 4096 * 1024; +// pub const PreimageBaseDeposit: Balance = deposit(2, 64); +// pub const PreimageByteDeposit: Balance = deposit(0, 1); +// } + +// TODO: Preimage +// impl pallet_preimage::Config for Runtime { +// type WeightInfo = weights::pallet_preimage::WeightInfo; +// type Event = Event; +// type Currency = Balances; +// type ManagerOrigin = EnsureRoot; +// type MaxSize = PreimageMaxSize; +// type BaseDeposit = PreimageBaseDeposit; +// type ByteDeposit = PreimageByteDeposit; +// } + parameter_types! { - pub const ValidationUpgradeFrequency: BlockNumber = 2 * DAYS; - pub const ValidationUpgradeDelay: BlockNumber = 8 * HOURS; - pub const SlashPeriod: BlockNumber = 7 * DAYS; + pub EpochDuration: u64 = prod_or_fast!( + EPOCH_DURATION_IN_SLOTS as u64, + 2 * MINUTES as u64, + "ROC_EPOCH_DURATION" + ); + pub const ExpectedBlockTime: Moment = MILLISECS_PER_BLOCK; + // TODO: Staking + // pub ReportLongevity: u64 = + // BondingDuration::get() as u64 * SessionsPerEra::get() as u64 * EpochDuration::get(); + pub ReportLongevity: u64 = EpochDurationInBlocks::get() as u64 * 10; } -/// Submits a transaction with the node's public and signature type. Adheres to the signed extension -/// format of the chain. -impl frame_system::offchain::CreateSignedTransaction for Runtime -where - Call: From, -{ - fn create_transaction>( - call: Call, - public: ::Signer, - account: AccountId, - nonce: ::Index, - ) -> Option<(Call, ::SignaturePayload)> { - use sp_runtime::traits::StaticLookup; - // take the biggest period possible. - let period = - BlockHashCount::get().checked_next_power_of_two().map(|c| c / 2).unwrap_or(2) as u64; +impl pallet_babe::Config for Runtime { + type EpochDuration = EpochDuration; + type ExpectedBlockTime = ExpectedBlockTime; - let current_block = System::block_number() - .saturated_into::() - // The `System::block_number` is initialized with `n+1`, - // so the actual block number is `n`. - .saturating_sub(1); - let tip = 0; - let extra: SignedExtra = ( - frame_system::CheckNonZeroSender::::new(), - frame_system::CheckSpecVersion::::new(), - frame_system::CheckTxVersion::::new(), - frame_system::CheckGenesis::::new(), - frame_system::CheckMortality::::from(generic::Era::mortal( - period, - current_block, - )), - frame_system::CheckNonce::::from(nonce), - frame_system::CheckWeight::::new(), - pallet_transaction_payment::ChargeTransactionPayment::::from(tip), - ); - let raw_payload = SignedPayload::new(call, extra) - .map_err(|e| { - log::warn!("Unable to create signed payload: {:?}", e); - }) - .ok()?; - let signature = raw_payload.using_encoded(|payload| C::sign(payload, public))?; - let (call, extra, _) = raw_payload.deconstruct(); - let address = ::Lookup::unlookup(account); - Some((call, (address, signature, extra))) - } -} + // session module is the trigger + type EpochChangeTrigger = pallet_babe::ExternalTrigger; -impl frame_system::offchain::SigningTypes for Runtime { - type Public = ::Signer; - type Signature = Signature; -} + type DisabledValidators = Session; -/// Special `FullIdentificationOf` implementation that is returning for every input `Some(Default::default())`. -pub struct FullIdentificationOf; -impl sp_runtime::traits::Convert> for FullIdentificationOf { - fn convert(_: AccountId) -> Option<()> { - Some(Default::default()) - } -} + type KeyOwnerProof = >::Proof; -impl pallet_session::historical::Config for Runtime { - type FullIdentification = (); - type FullIdentificationOf = FullIdentificationOf; -} + type KeyOwnerIdentification = >::IdentificationTuple; -impl parachains_disputes::Config for Runtime { - type Event = Event; - type RewardValidators = (); - type PunishValidators = (); - type WeightInfo = weights::runtime_parachains_disputes::WeightInfo; -} + type KeyOwnerProofSystem = Historical; -parameter_types! { - pub SessionDuration: BlockNumber = EpochDurationInBlocks::get() as _; + type HandleEquivocation = + pallet_babe::EquivocationHandler; + + type WeightInfo = (); + + type MaxAuthorities = MaxAuthorities; } +// TODO: Questions parameter_types! { - pub const ImOnlineUnsignedPriority: TransactionPriority = TransactionPriority::max_value(); - pub const MaxKeys: u32 = 10_000; - pub const MaxPeerInHeartbeats: u32 = 10_000; - pub const MaxPeerDataEncodingSize: u32 = 1_000; + pub const IndexDeposit: Balance = 1 * DOLLARS; } -impl pallet_im_online::Config for Runtime { - type AuthorityId = ImOnlineId; +impl pallet_indices::Config for Runtime { + type AccountIndex = AccountIndex; + type Currency = Balances; + type Deposit = IndexDeposit; type Event = Event; - type ValidatorSet = Historical; - type NextSessionRotation = Babe; - type ReportUnresponsiveness = Offences; - type UnsignedPriority = ImOnlineUnsignedPriority; - type WeightInfo = weights::pallet_im_online::WeightInfo; - type MaxKeys = MaxKeys; - type MaxPeerInHeartbeats = MaxPeerInHeartbeats; - type MaxPeerDataEncodingSize = MaxPeerDataEncodingSize; + type WeightInfo = weights::pallet_indices::WeightInfo; } parameter_types! { - pub const ExistentialDeposit: Balance = 1 * CENTS; + pub const ExistentialDeposit: Balance = EXISTENTIAL_DEPOSIT; pub const MaxLocks: u32 = 50; pub const MaxReserves: u32 = 50; } @@ -418,27 +343,19 @@ impl pallet_balances::Config for Runtime { type WeightInfo = weights::pallet_balances::WeightInfo; } -impl frame_system::offchain::SendTransactionTypes for Runtime -where - Call: From, -{ - type OverarchingCall = Call; - type Extrinsic = UncheckedExtrinsic; -} - parameter_types! { - pub const MaxRetries: u32 = 3; - pub const MaxAuthorities: u32 = 100_000; -} - -impl pallet_offences::Config for Runtime { - type Event = Event; - type IdentificationTuple = pallet_session::historical::IdentificationTuple; - type OnOffenceHandler = (); + pub const TransactionByteFee: Balance = 10 * MILLICENTS; + /// This value increases the priority of `Operational` transactions by adding + /// a "virtual tip" that's equal to the `OperationalFeeMultiplier * final_fee`. + pub const OperationalFeeMultiplier: u8 = 5; } -impl pallet_authority_discovery::Config for Runtime { - type MaxAuthorities = MaxAuthorities; +impl pallet_transaction_payment::Config for Runtime { + type OnChargeTransaction = CurrencyAdapter>; + type OperationalFeeMultiplier = OperationalFeeMultiplier; + type WeightToFee = WeightToFee; + type LengthToFee = ConstantMultiplier; + type FeeMultiplierUpdate = SlowAdjustingFeeUpdate; } parameter_types! { @@ -452,18 +369,26 @@ impl pallet_timestamp::Config for Runtime { } parameter_types! { - pub const TransactionByteFee: Balance = 10 * MILLICENTS; - /// This value increases the priority of `Operational` transactions by adding - /// a "virtual tip" that's equal to the `OperationalFeeMultiplier * final_fee`. - pub const OperationalFeeMultiplier: u8 = 5; + pub const UncleGenerations: u32 = 0; } -impl pallet_transaction_payment::Config for Runtime { - type OnChargeTransaction = CurrencyAdapter>; - type OperationalFeeMultiplier = OperationalFeeMultiplier; - type WeightToFee = WeightToFee; - type LengthToFee = frame_support::weights::ConstantMultiplier; - type FeeMultiplierUpdate = SlowAdjustingFeeUpdate; +impl pallet_authorship::Config for Runtime { + type FindAuthor = pallet_session::FindAccountFromAuthorIndex; + type UncleGenerations = UncleGenerations; + type FilterUncle = (); + type EventHandler = ImOnline; // TODO: Staking -> type EventHandler = (Staking, ImOnline); +} + +impl_opaque_keys! { + pub struct SessionKeys { + pub grandpa: Grandpa, + pub babe: Babe, + pub im_online: ImOnline, + pub para_validator: Initializer, + pub para_assignment: ParaSessionInfo, + pub authority_discovery: AuthorityDiscovery, + pub beefy: Beefy, // TODO: Rococo | not in Kusama + } } /// Special `ValidatorIdOf` implementation that is just returning the input as result. @@ -477,71 +402,551 @@ impl sp_runtime::traits::Convert> for ValidatorIdOf impl pallet_session::Config for Runtime { type Event = Event; type ValidatorId = AccountId; - type ValidatorIdOf = ValidatorIdOf; + type ValidatorIdOf = ValidatorIdOf; // TODO: Staking -> pallet_staking::StashOf; type ShouldEndSession = Babe; type NextSessionRotation = Babe; - type SessionManager = pallet_session::historical::NoteHistoricalRoot; + type SessionManager = pallet_session::historical::NoteHistoricalRoot; // TODO: Staking -> pallet_session::historical::NoteHistoricalRoot; type SessionHandler = ::KeyTypeIdProviders; type Keys = SessionKeys; - type WeightInfo = (); + type WeightInfo = weights::pallet_session::WeightInfo; } -parameter_types! { - pub const ExpectedBlockTime: Moment = MILLISECS_PER_BLOCK; - pub ReportLongevity: u64 = EpochDurationInBlocks::get() as u64 * 10; +/// Special `FullIdentificationOf` implementation that is returning for every input `Some(Default::default())`. +pub struct FullIdentificationOf; +impl sp_runtime::traits::Convert> for FullIdentificationOf { + fn convert(_: AccountId) -> Option<()> { + Some(Default::default()) + } } -impl pallet_babe::Config for Runtime { - type EpochDuration = EpochDurationInBlocks; - type ExpectedBlockTime = ExpectedBlockTime; - - // session module is the trigger - type EpochChangeTrigger = pallet_babe::ExternalTrigger; +impl pallet_session::historical::Config for Runtime { + type FullIdentification = (); // TODO: Staking -> pallet_staking::Exposure; + type FullIdentificationOf = FullIdentificationOf; // TODO: Staking -> pallet_staking::ExposureOf; +} + +// TODO: Election +// parameter_types! { +// // phase durations. 1/4 of the last session for each. +// // in testing: 1min or half of the session for each +// pub SignedPhase: u32 = prod_or_fast!( +// EPOCH_DURATION_IN_SLOTS / 4, +// (1 * MINUTES).min(EpochDuration::get().saturated_into::() / 2), +// "KSM_SIGNED_PHASE" +// ); +// pub UnsignedPhase: u32 = prod_or_fast!( +// EPOCH_DURATION_IN_SLOTS / 4, +// (1 * MINUTES).min(EpochDuration::get().saturated_into::() / 2), +// "KSM_UNSIGNED_PHASE" +// ); + +// TODO: Election +// // signed config +// pub const SignedMaxSubmissions: u32 = 16; +// pub const SignedMaxRefunds: u32 = 16 / 4; +// pub const SignedDepositBase: Balance = deposit(2, 0); +// pub const SignedDepositByte: Balance = deposit(0, 10) / 1024; +// // Each good submission will get 1/10 KSM as reward +// pub SignedRewardBase: Balance = UNITS / 10; +// pub BetterUnsignedThreshold: Perbill = Perbill::from_rational(5u32, 10_000); + +// // 1 hour session, 15 minutes unsigned phase, 8 offchain executions. +// pub OffchainRepeat: BlockNumber = UnsignedPhase::get() / 8; + +// /// We take the top 12500 nominators as electing voters.. +// pub const MaxElectingVoters: u32 = 12_500; +// /// ... and all of the validators as electable targets. Whilst this is the case, we cannot and +// /// shall not increase the size of the validator intentions. +// pub const MaxElectableTargets: u16 = u16::MAX; +// pub NposSolutionPriority: TransactionPriority = +// Perbill::from_percent(90) * TransactionPriority::max_value(); +// } + +// TODO: Election +// generate_solution_type!( +// #[compact] +// pub struct NposCompactSolution24::< +// VoterIndex = u32, +// TargetIndex = u16, +// Accuracy = sp_runtime::PerU16, +// MaxVoters = MaxElectingVoters, +// >(24) +// ); + +// TODO: Election +// pub struct OnChainSeqPhragmen; +// impl onchain::Config for OnChainSeqPhragmen { +// type System = Runtime; +// type Solver = SequentialPhragmen; +// type DataProvider = Staking; +// type WeightInfo = weights::frame_election_provider_support::WeightInfo; +// } + +// TODO: Election +// impl pallet_election_provider_multi_phase::Config for Runtime { +// type Event = Event; +// type Currency = Balances; +// type EstimateCallFee = TransactionPayment; +// type UnsignedPhase = UnsignedPhase; +// type SignedMaxSubmissions = SignedMaxSubmissions; +// type SignedMaxRefunds = SignedMaxRefunds; +// type SignedRewardBase = SignedRewardBase; +// type SignedDepositBase = SignedDepositBase; +// type SignedDepositByte = SignedDepositByte; +// type SignedDepositWeight = (); +// type SignedMaxWeight = +// ::MaxWeight; +// type MinerConfig = Self; +// type SlashHandler = (); // burn slashes +// type RewardHandler = (); // nothing to do upon rewards +// type SignedPhase = SignedPhase; +// type BetterUnsignedThreshold = BetterUnsignedThreshold; +// type BetterSignedThreshold = (); +// type OffchainRepeat = OffchainRepeat; +// type MinerTxPriority = NposSolutionPriority; +// type DataProvider = Staking; +// type Fallback = pallet_election_provider_multi_phase::NoFallback; +// type GovernanceFallback = onchain::UnboundedExecution; +// type Solver = SequentialPhragmen< +// AccountId, +// pallet_election_provider_multi_phase::SolutionAccuracyOf, +// (), +// >; +// type BenchmarkingConfig = runtime_common::elections::BenchmarkConfig; +// type ForceOrigin = EnsureOneOf< +// EnsureRoot, +// pallet_collective::EnsureProportionAtLeast, +// >; +// type WeightInfo = weights::pallet_election_provider_multi_phase::WeightInfo; +// type MaxElectingVoters = MaxElectingVoters; +// type MaxElectableTargets = MaxElectableTargets; +// } + +// TODO: Bags List +// parameter_types! { +// pub const BagThresholds: &'static [u64] = &bag_thresholds::THRESHOLDS; +// } + +// TODO: Bags List +// impl pallet_bags_list::Config for Runtime { +// type Event = Event; +// type ScoreProvider = Staking; +// type WeightInfo = weights::pallet_bags_list::WeightInfo; +// type BagThresholds = BagThresholds; +// type Score = sp_npos_elections::VoteWeight; +// } + +// TODO: Staking +// fn era_payout( +// total_staked: Balance, +// non_gilt_issuance: Balance, +// max_annual_inflation: Perquintill, +// period_fraction: Perquintill, +// auctioned_slots: u64, +// ) -> (Balance, Balance) { +// use pallet_staking_reward_fn::compute_inflation; +// use sp_arithmetic::traits::Saturating; + +// let min_annual_inflation = Perquintill::from_rational(25u64, 1000u64); +// let delta_annual_inflation = max_annual_inflation.saturating_sub(min_annual_inflation); + +// // 30% reserved for up to 60 slots. +// let auction_proportion = Perquintill::from_rational(auctioned_slots.min(60), 200u64); + +// // Therefore the ideal amount at stake (as a percentage of total issuance) is 75% less the amount that we expect +// // to be taken up with auctions. +// let ideal_stake = Perquintill::from_percent(75).saturating_sub(auction_proportion); + +// let stake = Perquintill::from_rational(total_staked, non_gilt_issuance); +// let falloff = Perquintill::from_percent(5); +// let adjustment = compute_inflation(stake, ideal_stake, falloff); +// let staking_inflation = +// min_annual_inflation.saturating_add(delta_annual_inflation * adjustment); + +// let max_payout = period_fraction * max_annual_inflation * non_gilt_issuance; +// let staking_payout = (period_fraction * staking_inflation) * non_gilt_issuance; +// let rest = max_payout.saturating_sub(staking_payout); + +// let other_issuance = non_gilt_issuance.saturating_sub(total_staked); +// if total_staked > other_issuance { +// let _cap_rest = Perquintill::from_rational(other_issuance, total_staked) * staking_payout; +// // We don't do anything with this, but if we wanted to, we could introduce a cap on the treasury amount +// // with: `rest = rest.min(cap_rest);` +// } +// (staking_payout, rest) +// } + +// TODO: Staking +// pub struct EraPayout; +// impl pallet_staking::EraPayout for EraPayout { +// fn era_payout( +// total_staked: Balance, +// _total_issuance: Balance, +// era_duration_millis: u64, +// ) -> (Balance, Balance) { +// // TODO: #3011 Update with proper auctioned slots tracking. +// // This should be fine for the first year of parachains. +// let auctioned_slots: u64 = auctions::Pallet::::auction_counter().into(); +// const MAX_ANNUAL_INFLATION: Perquintill = Perquintill::from_percent(10); +// const MILLISECONDS_PER_YEAR: u64 = 1000 * 3600 * 24 * 36525 / 100; + +// era_payout( +// total_staked, +// Gilt::issuance().non_gilt, +// MAX_ANNUAL_INFLATION, +// Perquintill::from_rational(era_duration_millis, MILLISECONDS_PER_YEAR), +// auctioned_slots, +// ) +// } +// } + +// TODO: Stacking +// parameter_types! { +// // Six sessions in an era (6 hours). +// pub const SessionsPerEra: SessionIndex = 6; +// // 28 eras for unbonding (7 days). +// pub const BondingDuration: sp_staking::EraIndex = 28; +// // 27 eras in which slashes can be cancelled (slightly less than 7 days). +// pub const SlashDeferDuration: sp_staking::EraIndex = 27; +// pub const MaxNominatorRewardedPerValidator: u32 = 256; +// pub const OffendingValidatorsThreshold: Perbill = Perbill::from_percent(17); +// // 24 +// pub const MaxNominations: u32 = ::LIMIT as u32; +// } + +// TODO: Stacking +// type SlashCancelOrigin = EnsureOneOf< +// EnsureRoot, +// pallet_collective::EnsureProportionAtLeast, +// >; + +// TODO: Stacking +// impl pallet_staking::Config for Runtime { +// type MaxNominations = MaxNominations; +// type Currency = Balances; +// type CurrencyBalance = Balance; +// type UnixTime = Timestamp; +// type CurrencyToVote = CurrencyToVote; +// type ElectionProvider = ElectionProviderMultiPhase; +// type GenesisElectionProvider = onchain::UnboundedExecution; +// type RewardRemainder = Treasury; +// type Event = Event; +// type Slash = Treasury; +// type Reward = (); +// type SessionsPerEra = SessionsPerEra; +// type BondingDuration = BondingDuration; +// type SlashDeferDuration = SlashDeferDuration; +// // A majority of the council or root can cancel the slash. +// type SlashCancelOrigin = SlashCancelOrigin; +// type SessionInterface = Self; +// type EraPayout = EraPayout; +// type NextNewSession = Session; +// type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator; +// type OffendingValidatorsThreshold = OffendingValidatorsThreshold; +// type VoterList = VoterList; +// type MaxUnlockingChunks = frame_support::traits::ConstU32<32>; +// type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig; +// type OnStakerSlash = (); +// type WeightInfo = weights::pallet_staking::WeightInfo; +// } + +// TODO: Democracy +// parameter_types! { +// pub LaunchPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1, "KSM_LAUNCH_PERIOD"); +// pub VotingPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1 * MINUTES, "KSM_VOTING_PERIOD"); +// pub FastTrackVotingPeriod: BlockNumber = prod_or_fast!(3 * HOURS, 1 * MINUTES, "KSM_FAST_TRACK_VOTING_PERIOD"); +// pub const MinimumDeposit: Balance = 100 * CENTS; +// pub EnactmentPeriod: BlockNumber = prod_or_fast!(8 * DAYS, 1, "KSM_ENACTMENT_PERIOD"); +// pub CooloffPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1 * MINUTES, "KSM_COOLOFF_PERIOD"); +// pub const InstantAllowed: bool = true; +// pub const MaxVotes: u32 = 100; +// pub const MaxProposals: u32 = 100; +// } + +// TODO: Democracy +// impl pallet_democracy::Config for Runtime { +// type Proposal = Call; +// type Event = Event; +// type Currency = Balances; +// type EnactmentPeriod = EnactmentPeriod; +// type VoteLockingPeriod = EnactmentPeriod; +// type LaunchPeriod = LaunchPeriod; +// type VotingPeriod = VotingPeriod; +// type MinimumDeposit = MinimumDeposit; +// /// A straight majority of the council can decide what their next motion is. +// type ExternalOrigin = +// pallet_collective::EnsureProportionAtLeast; +// /// A majority can have the next scheduled referendum be a straight majority-carries vote. +// type ExternalMajorityOrigin = +// pallet_collective::EnsureProportionAtLeast; +// /// A unanimous council can have the next scheduled referendum be a straight default-carries +// /// (NTB) vote. +// type ExternalDefaultOrigin = +// pallet_collective::EnsureProportionAtLeast; +// /// Two thirds of the technical committee can have an `ExternalMajority/ExternalDefault` vote +// /// be tabled immediately and with a shorter voting/enactment period. +// type FastTrackOrigin = +// pallet_collective::EnsureProportionAtLeast; +// type InstantOrigin = +// pallet_collective::EnsureProportionAtLeast; +// type InstantAllowed = InstantAllowed; +// type FastTrackVotingPeriod = FastTrackVotingPeriod; +// // To cancel a proposal which has been passed, 2/3 of the council must agree to it. +// type CancellationOrigin = EnsureOneOf< +// EnsureRoot, +// pallet_collective::EnsureProportionAtLeast, +// >; +// type BlacklistOrigin = EnsureRoot; +// // To cancel a proposal before it has been passed, the technical committee must be unanimous or +// // Root must agree. +// type CancelProposalOrigin = EnsureOneOf< +// EnsureRoot, +// pallet_collective::EnsureProportionAtLeast, +// >; +// // Any single technical committee member may veto a coming council proposal, however they can +// // only do it once and it lasts only for the cooloff period. +// type VetoOrigin = pallet_collective::EnsureMember; +// type CooloffPeriod = CooloffPeriod; +// type PreimageByteDeposit = PreimageByteDeposit; +// type OperationalPreimageOrigin = pallet_collective::EnsureMember; +// type Slash = Treasury; +// type Scheduler = Scheduler; +// type PalletsOrigin = OriginCaller; +// type MaxVotes = MaxVotes; +// type WeightInfo = weights::pallet_democracy::WeightInfo; +// type MaxProposals = MaxProposals; +// } - type DisabledValidators = Session; +parameter_types! { + pub const MotionDuration: BlockNumber = 5; + pub const MaxProposals: u32 = 100; + pub const MaxMembers: u32 = 100; +} - type KeyOwnerProofSystem = Historical; +// TODO: Collective +// type CouncilCollective = pallet_collective::Instance1; +impl pallet_collective::Config for Runtime { // TODO: Collective -> impl pallet_collective::Config for Runtime { + type Origin = Origin; + type Proposal = Call; + type Event = Event; + type MotionDuration = MotionDuration; // TODO: Collective -> type MotionDuration = CouncilMotionDuration; + type MaxProposals = MaxProposals; // TODO: Collective -> type MaxProposals = CouncilMaxProposals; + type MaxMembers = MaxMembers; // TODO: Collective -> type MaxMembers = CouncilMaxMembers; + type DefaultVote = pallet_collective::PrimeDefaultVote; // TODO: Collective -> type DefaultVote = pallet_collective::PrimeDefaultVote; + type WeightInfo = weights::pallet_collective::WeightInfo; // TODO: Collective -> type WeightInfo = weights::pallet_collective_council::WeightInfo; +} + +// TODO: Elections Phragmen +// parameter_types! { +// pub const CandidacyBond: Balance = 100 * CENTS; +// // 1 storage item created, key size is 32 bytes, value size is 16+16. +// pub const VotingBondBase: Balance = deposit(1, 64); +// // additional data per vote is 32 bytes (account id). +// pub const VotingBondFactor: Balance = deposit(0, 32); +// /// Daily council elections +// pub TermDuration: BlockNumber = prod_or_fast!(24 * HOURS, 2 * MINUTES, "KSM_TERM_DURATION"); +// pub const DesiredMembers: u32 = 19; +// pub const DesiredRunnersUp: u32 = 19; +// pub const PhragmenElectionPalletId: LockIdentifier = *b"phrelect"; +// } + +// TODO: Elections Phragmen +//// Make sure that there are no more than MaxMembers members elected via phragmen. +// const_assert!(DesiredMembers::get() <= CouncilMaxMembers::get()); + +// TODO: Elections Phragmen +// impl pallet_elections_phragmen::Config for Runtime { +// type Event = Event; +// type Currency = Balances; +// type ChangeMembers = Council; +// type InitializeMembers = Council; +// type CurrencyToVote = frame_support::traits::U128CurrencyToVote; +// type CandidacyBond = CandidacyBond; +// type VotingBondBase = VotingBondBase; +// type VotingBondFactor = VotingBondFactor; +// type LoserCandidate = Treasury; +// type KickedMember = Treasury; +// type DesiredMembers = DesiredMembers; +// type DesiredRunnersUp = DesiredRunnersUp; +// type TermDuration = TermDuration; +// type PalletId = PhragmenElectionPalletId; +// type WeightInfo = weights::pallet_elections_phragmen::WeightInfo; +// } + +// TODO: Collective +// parameter_types! { +// pub TechnicalMotionDuration: BlockNumber = prod_or_fast!(3 * DAYS, 2 * MINUTES, "KSM_MOTION_DURATION"); +// pub const TechnicalMaxProposals: u32 = 100; +// pub const TechnicalMaxMembers: u32 = 100; +// } + +// TODO: Collective +// type TechnicalCollective = pallet_collective::Instance2; +// impl pallet_collective::Config for Runtime { +// type Origin = Origin; +// type Proposal = Call; +// type Event = Event; +// type MotionDuration = TechnicalMotionDuration; +// type MaxProposals = TechnicalMaxProposals; +// type MaxMembers = TechnicalMaxMembers; +// type DefaultVote = pallet_collective::PrimeDefaultVote; +// type WeightInfo = weights::pallet_collective_technical_committee::WeightInfo; +// } - type KeyOwnerProof = >::Proof; +impl pallet_membership::Config for Runtime { + type Event = Event; + type AddOrigin = EnsureRoot; // TODO: Membership -> type AddOrigin = MoreThanHalfCouncil; + type RemoveOrigin = EnsureRoot; // TODO: Membership -> type AddOrigin = MoreThanHalfCouncil; + type SwapOrigin = EnsureRoot; // TODO: Membership -> type AddOrigin = MoreThanHalfCouncil; + type ResetOrigin = EnsureRoot; // TODO: Membership -> type AddOrigin = MoreThanHalfCouncil; + type PrimeOrigin = EnsureRoot; // TODO: Membership -> type AddOrigin = MoreThanHalfCouncil; + type MembershipInitialized = Collective; // TODO: Membership -> type AddOrigin = TechnicalCommittee; + type MembershipChanged = Collective; // TODO: Membership -> type AddOrigin = TechnicalCommittee; + type MaxMembers = MaxMembers; // TODO: Membership -> type AddOrigin = TechnicalMaxMembers; + type WeightInfo = weights::pallet_membership::WeightInfo; +} - type KeyOwnerIdentification = >::IdentificationTuple; +// TODO: Treasury +// parameter_types! { +// pub const ProposalBond: Permill = Permill::from_percent(5); +// pub const ProposalBondMinimum: Balance = 2000 * CENTS; +// pub const ProposalBondMaximum: Balance = 1 * GRAND; +// pub const SpendPeriod: BlockNumber = 6 * DAYS; +// pub const Burn: Permill = Permill::from_perthousand(2); +// pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry"); + +// pub const TipCountdown: BlockNumber = 1 * DAYS; +// pub const TipFindersFee: Percent = Percent::from_percent(20); +// pub const TipReportDepositBase: Balance = 100 * CENTS; +// pub const DataDepositPerByte: Balance = 1 * CENTS; +// pub const MaxApprovals: u32 = 100; +// pub const MaxAuthorities: u32 = 100_000; +// pub const MaxKeys: u32 = 10_000; +// pub const MaxPeerInHeartbeats: u32 = 10_000; +// pub const MaxPeerDataEncodingSize: u32 = 1_000; +// } + +// TODO: Treasury +// type ApproveOrigin = EnsureOneOf< +// EnsureRoot, +// pallet_collective::EnsureProportionAtLeast, +// >; + +// TODO: Treasury +// impl pallet_treasury::Config for Runtime { +// type PalletId = TreasuryPalletId; +// type Currency = Balances; +// type ApproveOrigin = ApproveOrigin; +// type RejectOrigin = MoreThanHalfCouncil; +// type Event = Event; +// type OnSlash = Treasury; +// type ProposalBond = ProposalBond; +// type ProposalBondMinimum = ProposalBondMinimum; +// type ProposalBondMaximum = ProposalBondMaximum; +// type SpendPeriod = SpendPeriod; +// type Burn = Burn; +// type BurnDestination = Society; +// type MaxApprovals = MaxApprovals; +// type WeightInfo = weights::pallet_treasury::WeightInfo; +// type SpendFunds = Bounties; +// } + +// TODO: Bounties +// parameter_types! { +// pub const BountyDepositBase: Balance = 100 * CENTS; +// pub const BountyDepositPayoutDelay: BlockNumber = 4 * DAYS; +// pub const BountyUpdatePeriod: BlockNumber = 90 * DAYS; +// pub const MaximumReasonLength: u32 = 16384; +// pub const CuratorDepositMultiplier: Permill = Permill::from_percent(50); +// pub const CuratorDepositMin: Balance = 10 * CENTS; +// pub const CuratorDepositMax: Balance = 500 * CENTS; +// pub const BountyValueMinimum: Balance = 200 * CENTS; +// } + +// TODO: Bounties +// impl pallet_bounties::Config for Runtime { +// type BountyDepositBase = BountyDepositBase; +// type BountyDepositPayoutDelay = BountyDepositPayoutDelay; +// type BountyUpdatePeriod = BountyUpdatePeriod; +// type CuratorDepositMultiplier = CuratorDepositMultiplier; +// type CuratorDepositMin = CuratorDepositMin; +// type CuratorDepositMax = CuratorDepositMax; +// type BountyValueMinimum = BountyValueMinimum; +// type ChildBountyManager = ChildBounties; +// type DataDepositPerByte = DataDepositPerByte; +// type Event = Event; +// type MaximumReasonLength = MaximumReasonLength; +// type WeightInfo = weights::pallet_bounties::WeightInfo; +// } + +// TODO: Child Bounties +// parameter_types! { +// pub const MaxActiveChildBountyCount: u32 = 100; +// pub const ChildBountyValueMinimum: Balance = BountyValueMinimum::get() / 10; +// } + +// TODO: Child Bounties +// impl pallet_child_bounties::Config for Runtime { +// type Event = Event; +// type MaxActiveChildBountyCount = MaxActiveChildBountyCount; +// type ChildBountyValueMinimum = ChildBountyValueMinimum; +// type WeightInfo = weights::pallet_child_bounties::WeightInfo; +// } + +// TODO: Tips +// impl pallet_tips::Config for Runtime { +// type MaximumReasonLength = MaximumReasonLength; +// type DataDepositPerByte = DataDepositPerByte; +// type Tippers = PhragmenElection; +// type TipCountdown = TipCountdown; +// type TipFindersFee = TipFindersFee; +// type TipReportDepositBase = TipReportDepositBase; +// type Event = Event; +// type WeightInfo = weights::pallet_tips::WeightInfo; +// } - type HandleEquivocation = - pallet_babe::EquivocationHandler; +impl pallet_offences::Config for Runtime { + type Event = Event; + type IdentificationTuple = pallet_session::historical::IdentificationTuple; + type OnOffenceHandler = (); // TODO: Offences -> type OnOffenceHandler = Staking; +} - type WeightInfo = (); +parameter_types! { + // pub const MaxRetries: u32 = 3; + pub const MaxAuthorities: u32 = 100_000; // TODO: Authority Discovery -> The value is defined in Treasury params +} +impl pallet_authority_discovery::Config for Runtime { type MaxAuthorities = MaxAuthorities; } parameter_types! { - pub const IndexDeposit: Balance = 1 * DOLLARS; + pub const ImOnlineUnsignedPriority: TransactionPriority = TransactionPriority::max_value(); + pub const MaxKeys: u32 = 10_000; // TODO: I am Online -> The value is defined in Treasury params + pub const MaxPeerInHeartbeats: u32 = 10_000; // TODO: I am Online -> The value is defined in Treasury params + pub const MaxPeerDataEncodingSize: u32 = 1_000; // TODO: I am Online -> The value is defined in Treasury params } -impl pallet_indices::Config for Runtime { - type AccountIndex = AccountIndex; - type Currency = Balances; - type Deposit = IndexDeposit; +impl pallet_im_online::Config for Runtime { + type AuthorityId = ImOnlineId; type Event = Event; - type WeightInfo = weights::pallet_indices::WeightInfo; + type ValidatorSet = Historical; + type NextSessionRotation = Babe; + type ReportUnresponsiveness = Offences; + type UnsignedPriority = ImOnlineUnsignedPriority; + type WeightInfo = weights::pallet_im_online::WeightInfo; + type MaxKeys = MaxKeys; + type MaxPeerInHeartbeats = MaxPeerInHeartbeats; + type MaxPeerDataEncodingSize = MaxPeerDataEncodingSize; } -parameter_types! { - pub const AttestationPeriod: BlockNumber = 50; -} +// parameter_types! { +// pub const AttestationPeriod: BlockNumber = 50; +// } impl pallet_grandpa::Config for Runtime { type Event = Event; type Call = Call; - type KeyOwnerProofSystem = Historical; - type KeyOwnerProof = >::Proof; @@ -550,6 +955,8 @@ impl pallet_grandpa::Config for Runtime { GrandpaId, )>>::IdentificationTuple; + type KeyOwnerProofSystem = Historical; + type HandleEquivocation = pallet_grandpa::EquivocationHandler< Self::KeyOwnerIdentification, Offences, @@ -560,15 +967,357 @@ impl pallet_grandpa::Config for Runtime { type MaxAuthorities = MaxAuthorities; } +/// Submits a transaction with the node's public and signature type. Adheres to the signed extension +/// format of the chain. +impl frame_system::offchain::CreateSignedTransaction for Runtime +where + Call: From, +{ + fn create_transaction>( + call: Call, + public: ::Signer, + account: AccountId, + nonce: ::Index, + ) -> Option<(Call, ::SignaturePayload)> { + use sp_runtime::traits::StaticLookup; + // take the biggest period possible. + let period = + BlockHashCount::get().checked_next_power_of_two().map(|c| c / 2).unwrap_or(2) as u64; + + let current_block = System::block_number() + .saturated_into::() + // The `System::block_number` is initialized with `n+1`, + // so the actual block number is `n`. + .saturating_sub(1); + let tip = 0; + let extra: SignedExtra = ( + frame_system::CheckNonZeroSender::::new(), + frame_system::CheckSpecVersion::::new(), + frame_system::CheckTxVersion::::new(), + frame_system::CheckGenesis::::new(), + frame_system::CheckMortality::::from(generic::Era::mortal( + period, + current_block, + )), + frame_system::CheckNonce::::from(nonce), + frame_system::CheckWeight::::new(), + pallet_transaction_payment::ChargeTransactionPayment::::from(tip), + ); + let raw_payload = SignedPayload::new(call, extra) + .map_err(|e| { + log::warn!("Unable to create signed payload: {:?}", e); + }) + .ok()?; + let signature = raw_payload.using_encoded(|payload| C::sign(payload, public))?; + let (call, extra, _) = raw_payload.deconstruct(); + let address = ::Lookup::unlookup(account); + Some((call, (address, signature, extra))) + } +} + +impl frame_system::offchain::SigningTypes for Runtime { + type Public = ::Signer; + type Signature = Signature; +} + +impl frame_system::offchain::SendTransactionTypes for Runtime +where + Call: From, +{ + type OverarchingCall = Call; + type Extrinsic = UncheckedExtrinsic; +} + +// TODO: Claims +// parameter_types! { +// pub Prefix: &'static [u8] = b"Pay KSMs to the Kusama account:"; +// } + +// TODO: Claims +// impl claims::Config for Runtime { +// type Event = Event; +// type VestingSchedule = Vesting; +// type Prefix = Prefix; +// type MoveClaimOrigin = +// pallet_collective::EnsureProportionMoreThan; +// type WeightInfo = weights::runtime_common_claims::WeightInfo; +// } + +// TODO: Identity +// parameter_types! { +// // Minimum 100 bytes/KSM deposited (1 CENT/byte) +// pub const BasicDeposit: Balance = 1000 * CENTS; // 258 bytes on-chain +// pub const FieldDeposit: Balance = 250 * CENTS; // 66 bytes on-chain +// pub const SubAccountDeposit: Balance = 200 * CENTS; // 53 bytes on-chain +// pub const MaxSubAccounts: u32 = 100; +// pub const MaxAdditionalFields: u32 = 100; +// pub const MaxRegistrars: u32 = 20; +// } + +// TODO: Identity +// impl pallet_identity::Config for Runtime { +// type Event = Event; +// type Currency = Balances; +// type BasicDeposit = BasicDeposit; +// type FieldDeposit = FieldDeposit; +// type SubAccountDeposit = SubAccountDeposit; +// type MaxSubAccounts = MaxSubAccounts; +// type MaxAdditionalFields = MaxAdditionalFields; +// type MaxRegistrars = MaxRegistrars; +// type Slashed = Treasury; +// type ForceOrigin = MoreThanHalfCouncil; +// type RegistrarOrigin = MoreThanHalfCouncil; +// type WeightInfo = weights::pallet_identity::WeightInfo; +// } + +impl pallet_utility::Config for Runtime { + type Event = Event; + type Call = Call; + type PalletsOrigin = OriginCaller; + type WeightInfo = weights::pallet_utility::WeightInfo; +} + parameter_types! { - pub const UncleGenerations: u32 = 0; + // One storage item; key size is 32; value is size 4+4+16+32 bytes = 56 bytes. + pub const DepositBase: Balance = deposit(1, 88); + // Additional storage item size of 32 bytes. + pub const DepositFactor: Balance = deposit(0, 32); + pub const MaxSignatories: u16 = 100; +} + +impl pallet_multisig::Config for Runtime { + type Event = Event; + type Call = Call; + type Currency = Balances; + type DepositBase = DepositBase; + type DepositFactor = DepositFactor; + type MaxSignatories = MaxSignatories; + type WeightInfo = weights::pallet_multisig::WeightInfo; +} + +// TODO: Recovery +// parameter_types! { +// pub const ConfigDepositBase: Balance = 500 * CENTS; +// pub const FriendDepositFactor: Balance = 50 * CENTS; +// pub const MaxFriends: u16 = 9; +// pub const RecoveryDeposit: Balance = 500 * CENTS; +// } + +// TODO: Recovery +// impl pallet_recovery::Config for Runtime { +// type Event = Event; +// type WeightInfo = (); +// type Call = Call; +// type Currency = Balances; +// type ConfigDepositBase = ConfigDepositBase; +// type FriendDepositFactor = FriendDepositFactor; +// type MaxFriends = MaxFriends; +// type RecoveryDeposit = RecoveryDeposit; +// } + +// TODO: Society +// parameter_types! { +// pub const CandidateDeposit: Balance = 1000 * CENTS; +// pub const WrongSideDeduction: Balance = 200 * CENTS; +// pub const MaxStrikes: u32 = 10; +// pub const RotationPeriod: BlockNumber = 7 * DAYS; +// pub const PeriodSpend: Balance = 50000 * CENTS; +// pub const MaxLockDuration: BlockNumber = 36 * 30 * DAYS; +// pub const ChallengePeriod: BlockNumber = 7 * DAYS; +// pub const MaxCandidateIntake: u32 = 1; +// pub const SocietyPalletId: PalletId = PalletId(*b"py/socie"); +// } + +// TODO: Society +// impl pallet_society::Config for Runtime { +// type Event = Event; +// type Currency = Balances; +// type Randomness = pallet_babe::RandomnessFromOneEpochAgo; +// type CandidateDeposit = CandidateDeposit; +// type WrongSideDeduction = WrongSideDeduction; +// type MaxStrikes = MaxStrikes; +// type PeriodSpend = PeriodSpend; +// type MembershipChanged = (); +// type RotationPeriod = RotationPeriod; +// type MaxLockDuration = MaxLockDuration; +// type FounderSetOrigin = +// pallet_collective::EnsureProportionMoreThan; +// type SuspensionJudgementOrigin = pallet_society::EnsureFounder; +// type ChallengePeriod = ChallengePeriod; +// type MaxCandidateIntake = MaxCandidateIntake; +// type PalletId = SocietyPalletId; +// } + +// TODO: Vesting +// parameter_types! { +// pub const MinVestedTransfer: Balance = 100 * CENTS; +// } + +// TODO: Vesting +// impl pallet_vesting::Config for Runtime { +// type Event = Event; +// type Currency = Balances; +// type BlockNumberToBalance = ConvertInto; +// type MinVestedTransfer = MinVestedTransfer; +// type WeightInfo = weights::pallet_vesting::WeightInfo; +// const MAX_VESTING_SCHEDULES: u32 = 28; +// } + +parameter_types! { + // One storage item; key size 32, value size 8; . + pub const ProxyDepositBase: Balance = 10; // TODO: Proxy -> pub const ProxyDepositBase: Balance = deposit(1, 8); + // Additional storage item size of 33 bytes. + pub const ProxyDepositFactor: Balance = 10; // TODO: Proxy -> pub const ProxyDepositFactor: Balance = deposit(0, 33); + pub const MaxProxies: u16 = 32; + pub const AnnouncementDepositBase: Balance = 10; // TODO: Proxy -> pub const AnnouncementDepositBase: Balance = deposit(1, 8); + pub const AnnouncementDepositFactor: Balance = 10; // TODO: Proxy -> pub const AnnouncementDepositFactor: Balance = deposit(0, 66); + pub const MaxPending: u16 = 32; +} + +/// The type used to represent the kinds of proxying allowed. +#[derive( + Copy, + Clone, + Eq, + PartialEq, + Ord, + PartialOrd, + Encode, + Decode, + RuntimeDebug, + MaxEncodedLen, + scale_info::TypeInfo, +)] +pub enum ProxyType { + Any, + // TODO: Proxy -> NonTransfer, + // TODO: Proxy -> Governance, + // TODO: Proxy -> Staking, + // TODO: Proxy -> IdentityJudgement, + CancelProxy, + Auction, + // TODO: Proxy -> Society, +} +impl Default for ProxyType { + fn default() -> Self { + Self::Any + } +} +impl InstanceFilter for ProxyType { + fn filter(&self, c: &Call) -> bool { + match self { + ProxyType::Any => true, + // TODO: Proxy + // ProxyType::NonTransfer => matches!( + // c, + // Call::System(..) | + // Call::Babe(..) | + // Call::Timestamp(..) | + // Call::Indices(pallet_indices::Call::claim {..}) | + // Call::Indices(pallet_indices::Call::free {..}) | + // Call::Indices(pallet_indices::Call::freeze {..}) | + // // Specifically omitting Indices `transfer`, `force_transfer` + // // Specifically omitting the entire Balances pallet + // Call::Authorship(..) | + // Call::Staking(..) | + // Call::Session(..) | + // Call::Grandpa(..) | + // Call::ImOnline(..) | + // Call::Democracy(..) | + // Call::Council(..) | + // Call::TechnicalCommittee(..) | + // Call::PhragmenElection(..) | + // Call::TechnicalMembership(..) | + // Call::Treasury(..) | + // Call::Bounties(..) | + // Call::ChildBounties(..) | + // Call::Tips(..) | + // Call::Claims(..) | + // Call::Utility(..) | + // Call::Identity(..) | + // Call::Society(..) | + // Call::Recovery(pallet_recovery::Call::as_recovered {..}) | + // Call::Recovery(pallet_recovery::Call::vouch_recovery {..}) | + // Call::Recovery(pallet_recovery::Call::claim_recovery {..}) | + // Call::Recovery(pallet_recovery::Call::close_recovery {..}) | + // Call::Recovery(pallet_recovery::Call::remove_recovery {..}) | + // Call::Recovery(pallet_recovery::Call::cancel_recovered {..}) | + // // Specifically omitting Recovery `create_recovery`, `initiate_recovery` + // Call::Vesting(pallet_vesting::Call::vest {..}) | + // Call::Vesting(pallet_vesting::Call::vest_other {..}) | + // // Specifically omitting Vesting `vested_transfer`, and `force_vested_transfer` + // Call::Scheduler(..) | + // Call::Proxy(..) | + // Call::Multisig(..) | + // Call::Gilt(..) | + // Call::Registrar(paras_registrar::Call::register {..}) | + // Call::Registrar(paras_registrar::Call::deregister {..}) | + // // Specifically omitting Registrar `swap` + // Call::Registrar(paras_registrar::Call::reserve {..}) | + // Call::Crowdloan(..) | + // Call::Slots(..) | + // Call::Auctions(..) | // Specifically omitting the entire XCM Pallet + // Call::VoterList(..) + // ), + // TODO: Proxy + // ProxyType::Governance => matches!( + // c, + // Call::Democracy(..) | + // Call::Council(..) | Call::TechnicalCommittee(..) | + // Call::PhragmenElection(..) | + // Call::Treasury(..) | Call::Bounties(..) | + // Call::Tips(..) | Call::Utility(..) | + // Call::ChildBounties(..) + // ), + // TODO: Proxy + // ProxyType::Staking => { + // matches!(c, Call::Staking(..) | Call::Session(..) | Call::Utility(..)) + // }, + // TODO: Proxy + // ProxyType::IdentityJudgement => matches!( + // c, + // Call::Identity(pallet_identity::Call::provide_judgement { .. }) | Call::Utility(..) + // ), + ProxyType::CancelProxy => { + matches!(c, Call::Proxy(pallet_proxy::Call::reject_announcement { .. })) + }, + ProxyType::Auction => matches!( + c, + Call::Auctions { .. } | + Call::Crowdloan { .. } | + Call::Registrar { .. } | + Call::Multisig(..) | Call::Slots { .. } + ), + // TODO: Proxy + // ProxyType::Society => matches!(c, Call::Society(..)), + } + } + fn is_superset(&self, o: &Self) -> bool { + match (self, o) { + // TODO: Proxy + // (x, y) if x == y => true, + (ProxyType::Any, _) => true, + // TODO: Proxy + // (_, ProxyType::Any) => false, + // (ProxyType::NonTransfer, _) => true, + _ => false, + } + } } -impl pallet_authorship::Config for Runtime { - type FindAuthor = pallet_session::FindAccountFromAuthorIndex; - type UncleGenerations = UncleGenerations; - type FilterUncle = (); - type EventHandler = ImOnline; +impl pallet_proxy::Config for Runtime { + type Event = Event; + type Call = Call; + 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; } impl parachains_origin::Config for Runtime {} @@ -579,6 +1328,10 @@ impl parachains_configuration::Config for Runtime { impl parachains_shared::Config for Runtime {} +impl parachains_session_info::Config for Runtime { + type ValidatorSet = Historical; +} + /// Special `RewardValidators` that does nothing ;) pub struct RewardValidators; impl runtime_parachains::inclusion::RewardValidators for RewardValidators { @@ -589,7 +1342,7 @@ impl runtime_parachains::inclusion::RewardValidators for RewardValidators { impl parachains_inclusion::Config for Runtime { type Event = Event; type DisputesHandler = ParasDisputes; - type RewardValidators = RewardValidators; + type RewardValidators = RewardValidators; // TODO: Inclusion -> type RewardValidators = parachains_reward_points::RewardValidatorsWithEraPoints; } parameter_types! { @@ -603,10 +1356,6 @@ impl parachains_paras::Config for Runtime { type NextSessionRotation = Babe; } -impl parachains_session_info::Config for Runtime { - type ValidatorSet = Historical; -} - parameter_types! { pub const FirstMessageFactorPercent: u64 = 100; } @@ -641,30 +1390,16 @@ impl parachains_initializer::Config for Runtime { type WeightInfo = weights::runtime_parachains_initializer::WeightInfo; } -impl paras_sudo_wrapper::Config for Runtime {} - -parameter_types! { - pub const PermanentSlotLeasePeriodLength: u32 = 365; - pub const TemporarySlotLeasePeriodLength: u32 = 3; - pub const MaxPermanentSlots: u32 = 25; - pub const MaxTemporarySlots: u32 = 20; - pub const MaxTemporarySlotPerLeasePeriod: u32 = 5; -} - -impl assigned_slots::Config for Runtime { +impl parachains_disputes::Config for Runtime { type Event = Event; - type AssignSlotOrigin = EnsureRoot; - type Leaser = Slots; - type PermanentSlotLeasePeriodLength = PermanentSlotLeasePeriodLength; - type TemporarySlotLeasePeriodLength = TemporarySlotLeasePeriodLength; - type MaxPermanentSlots = MaxPermanentSlots; - type MaxTemporarySlots = MaxTemporarySlots; - type MaxTemporarySlotPerLeasePeriod = MaxTemporarySlotPerLeasePeriod; + type RewardValidators = (); + type PunishValidators = (); + type WeightInfo = weights::runtime_parachains_disputes::WeightInfo; } parameter_types! { pub const ParaDeposit: Balance = 5 * DOLLARS; - pub const DataDepositPerByte: Balance = deposit(0, 1); + pub const DataDepositPerByte: Balance = deposit(0, 1); // TODO: Registar -> The value is defined in Treasury params } impl paras_registrar::Config for Runtime { @@ -677,6 +1412,158 @@ impl paras_registrar::Config for Runtime { type WeightInfo = weights::runtime_common_paras_registrar::WeightInfo; } +parameter_types! { + pub const LeasePeriod: BlockNumber = 1 * DAYS; // TODO: Slots -> pub LeasePeriod: BlockNumber = prod_or_fast!(6 * WEEKS, 6 * WEEKS, "KSM_LEASE_PERIOD"); +} + +impl slots::Config for Runtime { + type Event = Event; + type Currency = Balances; + type Registrar = Registrar; + type LeasePeriod = LeasePeriod; + type LeaseOffset = (); + type ForceOrigin = EnsureRoot; + type WeightInfo = weights::runtime_common_slots::WeightInfo; +} + +parameter_types! { + pub const CrowdloanId: PalletId = PalletId(*b"py/cfund"); + pub const SubmissionDeposit: Balance = 100 * DOLLARS; // TODO: Crowdloan -> pub const SubmissionDeposit: Balance = 3 * GRAND; + pub const MinContribution: Balance = 1 * DOLLARS; // TODO: Crowdloan -> pub const MinContribution: Balance = 3_000 * CENTS; + pub const RemoveKeysLimit: u32 = 500; // TODO: Crowdloan -> pub const RemoveKeysLimit: u32 = 1000; + // Allow 32 bytes for an additional memo to a crowdloan. + pub const MaxMemoLength: u8 = 32; +} + +impl crowdloan::Config for Runtime { + type Event = Event; + type PalletId = CrowdloanId; + type SubmissionDeposit = SubmissionDeposit; + type MinContribution = MinContribution; + type RemoveKeysLimit = RemoveKeysLimit; + type Registrar = Registrar; + type Auctioneer = Auctions; + type MaxMemoLength = MaxMemoLength; + type WeightInfo = weights::runtime_common_crowdloan::WeightInfo; +} + +parameter_types! { + pub const EndingPeriod: BlockNumber = 1 * HOURS; // TODO: Auctions -> pub const EndingPeriod: BlockNumber = 5 * DAYS; + pub const SampleLength: BlockNumber = 1; // TODO: Auctions -> pub const SampleLength: BlockNumber = 2 * MINUTES; +} + +// TODO: Auctions +// type AuctionInitiate = EnsureOneOf< +// EnsureRoot, +// pallet_collective::EnsureProportionAtLeast, +// >; + +impl auctions::Config for Runtime { + type Event = Event; + type Leaser = Slots; + type Registrar = Registrar; + type EndingPeriod = EndingPeriod; + type SampleLength = SampleLength; + type Randomness = pallet_babe::RandomnessFromOneEpochAgo; + type InitiateOrigin = EnsureRoot; // TODO: Auctions -> type InitiateOrigin = AuctionInitiate; + type WeightInfo = weights::runtime_common_auctions::WeightInfo; +} + +// TODO: Gilt +// parameter_types! { +// pub IgnoredIssuance: Balance = Treasury::pot(); +// pub const QueueCount: u32 = 300; +// pub const MaxQueueLen: u32 = 1000; +// pub const FifoQueueLen: u32 = 250; +// pub const GiltPeriod: BlockNumber = 30 * DAYS; +// pub const MinFreeze: Balance = 10_000 * CENTS; +// pub const IntakePeriod: BlockNumber = 5 * MINUTES; +// pub const MaxIntakeBids: u32 = 100; +// } + +// TODO: Gilt +// impl pallet_gilt::Config for Runtime { +// type Event = Event; +// type Currency = Balances; +// type CurrencyBalance = Balance; +// type AdminOrigin = MoreThanHalfCouncil; +// type Deficit = (); // Mint +// type Surplus = (); // Burn +// type IgnoredIssuance = IgnoredIssuance; +// type QueueCount = QueueCount; +// type MaxQueueLen = MaxQueueLen; +// type FifoQueueLen = FifoQueueLen; +// type Period = GiltPeriod; +// type MinFreeze = MinFreeze; +// type IntakePeriod = IntakePeriod; +// type MaxIntakeBids = MaxIntakeBids; +// type WeightInfo = weights::pallet_gilt::WeightInfo; +// } + +// TODO: Nominations +// pub struct BalanceToU256; +// impl sp_runtime::traits::Convert for BalanceToU256 { +// fn convert(n: Balance) -> sp_core::U256 { +// n.into() +// } +// } +// pub struct U256ToBalance; +// impl sp_runtime::traits::Convert for U256ToBalance { +// fn convert(n: sp_core::U256) -> Balance { +// use frame_support::traits::Defensive; +// n.try_into().defensive_unwrap_or(Balance::MAX) +// } +// } + +// TODO: Nominations +// parameter_types! { +// pub const PoolsPalletId: PalletId = PalletId(*b"py/nopls"); +// pub const MinPointsToBalance: u32 = 10; +// } + +// TODO: Nominations +// impl pallet_nomination_pools::Config for Runtime { +// type Event = Event; +// type WeightInfo = weights::pallet_nomination_pools::WeightInfo; +// type Currency = Balances; +// type BalanceToU256 = BalanceToU256; +// type U256ToBalance = U256ToBalance; +// type StakingInterface = Staking; +// type PostUnbondingPoolsWindow = ConstU32<4>; +// type MaxMetadataLen = ConstU32<256>; +// // we use the same number of allowed unlocking chunks as with staking. +// type MaxUnbonding = ::MaxUnlockingChunks; +// type PalletId = PoolsPalletId; +// type MinPointsToBalance = MinPointsToBalance; +// } + +// TODO: Nominations +// pub struct InitiatePoolConfigs; +// impl OnRuntimeUpgrade for InitiatePoolConfigs { +// fn on_runtime_upgrade() -> frame_support::weights::Weight { +// // we use one as an indicator if this has already been set. +// if pallet_nomination_pools::MaxPools::::get().is_none() { +// // 1/600 KSM to join a pool. +// pallet_nomination_pools::MinJoinBond::::put(50 * CENTS); +// // 1 KSM to create a pool. +// pallet_nomination_pools::MinCreateBond::::put(UNITS); + +// // 128 initial pools: only for initial safety: can be set to infinity when needed. +// pallet_nomination_pools::MaxPools::::put(128); +// // 64k total pool members: only for initial safety: can be set to infinity when needed. +// pallet_nomination_pools::MaxPoolMembers::::put(64 * 1024); +// // 1024 members per pool: only for initial safety: can be set to infinity when needed. +// pallet_nomination_pools::MaxPoolMembersPerPool::::put(1024); + +// log::info!(target: "runtime::kusama", "pools config initiated 🎉"); +// ::DbWeight::get().reads_writes(1, 5) +// } else { +// log::info!(target: "runtime::kusama", "pools config already initiated 😏"); +// ::DbWeight::get().reads(1) +// } +// } +// } + impl pallet_beefy::Config for Runtime { type BeefyId = BeefyId; } @@ -876,55 +1763,30 @@ impl pallet_bridge_messages::Config for Runt type MessageDispatch = crate::bridge_messages::FromWococoMessageDispatch; } -parameter_types! { - pub const EndingPeriod: BlockNumber = 1 * HOURS; - pub const SampleLength: BlockNumber = 1; -} - -impl auctions::Config for Runtime { - type Event = Event; - type Leaser = Slots; - type Registrar = Registrar; - type EndingPeriod = EndingPeriod; - type SampleLength = SampleLength; - type Randomness = pallet_babe::RandomnessFromOneEpochAgo; - type InitiateOrigin = EnsureRoot; - type WeightInfo = weights::runtime_common_auctions::WeightInfo; -} +impl paras_sudo_wrapper::Config for Runtime {} parameter_types! { - pub const LeasePeriod: BlockNumber = 1 * DAYS; + pub const PermanentSlotLeasePeriodLength: u32 = 365; + pub const TemporarySlotLeasePeriodLength: u32 = 3; + pub const MaxPermanentSlots: u32 = 25; + pub const MaxTemporarySlots: u32 = 20; + pub const MaxTemporarySlotPerLeasePeriod: u32 = 5; } -impl slots::Config for Runtime { +impl assigned_slots::Config for Runtime { type Event = Event; - type Currency = Balances; - type Registrar = Registrar; - type LeasePeriod = LeasePeriod; - type LeaseOffset = (); - type ForceOrigin = EnsureRoot; - type WeightInfo = weights::runtime_common_slots::WeightInfo; -} - -parameter_types! { - pub const CrowdloanId: PalletId = PalletId(*b"py/cfund"); - pub const SubmissionDeposit: Balance = 100 * DOLLARS; - pub const MinContribution: Balance = 1 * DOLLARS; - pub const RemoveKeysLimit: u32 = 500; - // Allow 32 bytes for an additional memo to a crowdloan. - pub const MaxMemoLength: u8 = 32; + type AssignSlotOrigin = EnsureRoot; + type Leaser = Slots; + type PermanentSlotLeasePeriodLength = PermanentSlotLeasePeriodLength; + type TemporarySlotLeasePeriodLength = TemporarySlotLeasePeriodLength; + type MaxPermanentSlots = MaxPermanentSlots; + type MaxTemporarySlots = MaxTemporarySlots; + type MaxTemporarySlotPerLeasePeriod = MaxTemporarySlotPerLeasePeriod; } -impl crowdloan::Config for Runtime { +impl validator_manager::Config for Runtime { type Event = Event; - type PalletId = CrowdloanId; - type SubmissionDeposit = SubmissionDeposit; - type MinContribution = MinContribution; - type RemoveKeysLimit = RemoveKeysLimit; - type Registrar = Registrar; - type Auctioneer = Auctions; - type MaxMemoLength = MaxMemoLength; - type WeightInfo = weights::runtime_common_crowdloan::WeightInfo; + type PrivilegedOrigin = EnsureRoot; } impl pallet_sudo::Config for Runtime { @@ -932,139 +1794,214 @@ impl pallet_sudo::Config for Runtime { type Call = Call; } -impl validator_manager::Config for Runtime { - type Event = Event; - type PrivilegedOrigin = EnsureRoot; -} +construct_runtime! { + pub enum Runtime where + Block = Block, + NodeBlock = primitives::v2::Block, + UncheckedExtrinsic = UncheckedExtrinsic + { + // Basic stuff; balances is uncallable initially. + System: frame_system::{Pallet, Call, Storage, Config, Event} = 0, -impl pallet_utility::Config for Runtime { - type Event = Event; - type Call = Call; - type PalletsOrigin = OriginCaller; - type WeightInfo = weights::pallet_utility::WeightInfo; -} + // Babe must be before session. + Babe: pallet_babe::{Pallet, Call, Storage, Config, ValidateUnsigned} = 1, -parameter_types! { - // One storage item; key size 32, value size 8; . - pub const ProxyDepositBase: Balance = 10; - // Additional storage item size of 33 bytes. - pub const ProxyDepositFactor: Balance = 10; - pub const MaxProxies: u16 = 32; - pub const AnnouncementDepositBase: Balance = 10; - pub const AnnouncementDepositFactor: Balance = 10; - pub const MaxPending: u16 = 32; -} + Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 2, + Indices: pallet_indices::{Pallet, Call, Storage, Config, Event} = 3, + Balances: pallet_balances::{Pallet, Call, Storage, Config, Event} = 4, + TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Config} = 33, -/// The type used to represent the kinds of proxying allowed. -#[derive( - Copy, - Clone, - Eq, - PartialEq, - Ord, - PartialOrd, - Encode, - Decode, - RuntimeDebug, - MaxEncodedLen, - TypeInfo, -)] -pub enum ProxyType { - Any, - CancelProxy, - Auction, -} -impl Default for ProxyType { - fn default() -> Self { - Self::Any - } -} -impl InstanceFilter for ProxyType { - fn filter(&self, c: &Call) -> bool { - match self { - ProxyType::Any => true, - ProxyType::CancelProxy => { - matches!(c, Call::Proxy(pallet_proxy::Call::reject_announcement { .. })) - }, - ProxyType::Auction => matches!( - c, - Call::Auctions { .. } | - Call::Crowdloan { .. } | - Call::Registrar { .. } | - Call::Multisig(..) | Call::Slots { .. } - ), - } - } - fn is_superset(&self, o: &Self) -> bool { - match (self, o) { - (ProxyType::Any, _) => true, - _ => false, - } - } -} + // Consensus support. + // Authorship must be before session in order to note author in the correct session and era + // for im-online. // TODO -> Staking -> and staking. + Authorship: pallet_authorship::{Pallet, Call, Storage} = 5, + // TODO: Staking + // Staking: pallet_staking::{Pallet, Call, Storage, Config, Event} = 6, + Offences: pallet_offences::{Pallet, Storage, Event} = 7, + Historical: session_historical::{Pallet} = 34, + Session: pallet_session::{Pallet, Call, Storage, Event, Config} = 8, + Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event, ValidateUnsigned} = 10, + ImOnline: pallet_im_online::{Pallet, Call, Storage, Event, ValidateUnsigned, Config} = 11, + AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config} = 12, + + // Governance stuff; uncallable initially. + // TODO: Democracy + // Democracy: pallet_democracy::{Pallet, Call, Storage, Config, Event} = 13, + // TODO: Collective -> Council: pallet_collective::::{Pallet, Call, Storage, Origin, Event, Config} = 14, + Collective: pallet_collective::{Pallet, Call, Storage, Origin, Event, Config} = 14, + // Council: pallet_collective::::{Pallet, Call, Storage, Origin, Event, Config} = 14, + // TODO: Collective + // TechnicalCommittee: pallet_collective::::{Pallet, Call, Storage, Origin, Event, Config} = 15, + // TODO: Elections Prhargmen + // PhragmenElection: pallet_elections_phragmen::{Pallet, Call, Storage, Event, Config} = 16, + // Membership: pallet_membership = 80, // TODO: Membership + // TODO: Membership -> pallet_membership::::{Pallet, Call, Storage, Event, Config} = 17, + Membership: pallet_membership::{Pallet, Call, Storage, Event, Config} = 17, + // TODO: Treasury + // Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event} = 18, + + // TODO: Claims + //// Claims. Usable initially. + // Claims: claims::{Pallet, Call, Storage, Event, Config, ValidateUnsigned} = 19, + + // Utility module. + Utility: pallet_utility::{Pallet, Call, Event} = 24, + + // TODO: Identity + //// Less simple identity module. + // Identity: pallet_identity::{Pallet, Call, Storage, Event} = 25, + + // TODO: Society + //// Society module. + // Society: pallet_society::{Pallet, Call, Storage, Event} = 26, + + // TODO: Recovery + //// Social recovery module. + // Recovery: pallet_recovery::{Pallet, Call, Storage, Event} = 27, + + // TODO: Vesting + //// Vesting. Usable initially, but removed once all vesting is finished. + // Vesting: pallet_vesting::{Pallet, Call, Storage, Event, Config} = 28, + + // TODO: Scheduler + //// System scheduler. + // Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event} = 29, + + // Proxy module. Late addition. + Proxy: pallet_proxy::{Pallet, Call, Storage, Event} = 30, + + // Multisig module. Late addition. + Multisig: pallet_multisig::{Pallet, Call, Storage, Event} = 31, + + // TODO: Preimage + //// Preimage registrar. + // Preimage: pallet_preimage::{Pallet, Call, Storage, Event} = 32, + + // TODO: Bounties + //// Bounties modules. + // Bounties: pallet_bounties::{Pallet, Call, Storage, Event} = 35, + // TODO: Child Bounties + // ChildBounties: pallet_child_bounties = 40, + + // TODO: Tips + //// Tips module. + // Tips: pallet_tips::{Pallet, Call, Storage, Event} = 36, + + // TODO: Election + //// Election pallet. Only works with staking, but placed here to maintain indices. + // ElectionProviderMultiPhase: pallet_election_provider_multi_phase::{Pallet, Call, Storage, Event, ValidateUnsigned} = 37, + + // TODO: Gilt + //// Gilts pallet. + // Gilt: pallet_gilt::{Pallet, Call, Storage, Event, Config} = 38, + + // TODO: Bags List + //// Provides a semi-sorted list of nominators for staking. + // VoterList: pallet_bags_list::{Pallet, Call, Storage, Event} = 39, + + // TODO: Nomination + //// nomination pools: extension to staking. + // NominationPools: pallet_nomination_pools::{Pallet, Call, Storage, Event, Config} = 41, + + // Parachains pallets. Start indices at 50 to leave room. + ParachainsOrigin: parachains_origin::{Pallet, Origin} = 50, + Configuration: parachains_configuration::{Pallet, Call, Storage, Config} = 51, + ParasShared: parachains_shared::{Pallet, Call, Storage} = 52, + ParaInclusion: parachains_inclusion::{Pallet, Call, Storage, Event} = 53, + ParaInherent: parachains_paras_inherent::{Pallet, Call, Storage, Inherent} = 54, + ParaScheduler: parachains_scheduler::{Pallet, Storage} = 55, + Paras: parachains_paras::{Pallet, Call, Storage, Event, Config} = 56, + Initializer: parachains_initializer::{Pallet, Call, Storage} = 57, + Dmp: parachains_dmp::{Pallet, Call, Storage} = 58, + Ump: parachains_ump::{Pallet, Call, Storage, Event} = 59, + Hrmp: parachains_hrmp::{Pallet, Call, Storage, Event, Config} = 60, + ParaSessionInfo: parachains_session_info::{Pallet, Storage} = 61, + ParasDisputes: parachains_disputes::{Pallet, Call, Storage, Event} = 62, + + // Parachain Onboarding Pallets. Start indices at 70 to leave room. + Registrar: paras_registrar::{Pallet, Call, Storage, Event, Config} = 70, + Slots: slots::{Pallet, Call, Storage, Event} = 71, + Auctions: auctions::{Pallet, Call, Storage, Event} = 72, + Crowdloan: crowdloan::{Pallet, Call, Storage, Event} = 73, -impl pallet_proxy::Config for Runtime { - type Event = Event; - type Call = Call; - 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; -} + // Pallet for sending XCM. + XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event, Origin, Config} = 99, -parameter_types! { - pub const MotionDuration: BlockNumber = 5; - pub const MaxProposals: u32 = 100; - pub const MaxMembers: u32 = 100; -} + // Rococo specific pallets (not included in Kusama). Start indices at 240 + + // BEEFY Bridges support. + Beefy: pallet_beefy::{Pallet, Storage, Config} = 240, + Mmr: pallet_mmr::{Pallet, Storage} = 241, + MmrLeaf: pallet_beefy_mmr::{Pallet, Storage} = 242, + + // It might seem strange that we add both sides of the bridge to the same runtime. We do this because this + // runtime as shared by both the Rococo and Wococo chains. When running as Rococo we only use + // `BridgeWococoGrandpa`, and vice versa. + BridgeRococoGrandpa: pallet_bridge_grandpa::{Pallet, Call, Storage, Config} = 243, + BridgeWococoGrandpa: pallet_bridge_grandpa::::{Pallet, Call, Storage, Config} = 244, + + // Bridge messages support. The same story as with the bridge grandpa pallet above ^^^ - when we're + // running as Rococo we only use `BridgeWococoMessages`/`BridgeWococoMessagesDispatch`, and vice versa. + BridgeRococoMessages: pallet_bridge_messages::{Pallet, Call, Storage, Event, Config} = 245, + BridgeWococoMessages: pallet_bridge_messages::::{Pallet, Call, Storage, Event, Config} = 246, + BridgeRococoMessagesDispatch: pallet_bridge_dispatch::{Pallet, Event} = 247, + BridgeWococoMessagesDispatch: pallet_bridge_dispatch::::{Pallet, Event} = 248, + + ParasSudoWrapper: paras_sudo_wrapper::{Pallet, Call} = 250, + AssignedSlots: assigned_slots::{Pallet, Call, Storage, Event} = 251, -impl pallet_collective::Config for Runtime { - type Origin = Origin; - type Proposal = Call; - type Event = Event; - type MotionDuration = MotionDuration; - type MaxProposals = MaxProposals; - type DefaultVote = pallet_collective::PrimeDefaultVote; - type MaxMembers = MaxMembers; - type WeightInfo = weights::pallet_collective::WeightInfo; -} + // Validator Manager pallet. + ValidatorManager: validator_manager::{Pallet, Call, Storage, Event} = 252, -impl pallet_membership::Config for Runtime { - type Event = Event; - type AddOrigin = EnsureRoot; - type RemoveOrigin = EnsureRoot; - type SwapOrigin = EnsureRoot; - type ResetOrigin = EnsureRoot; - type PrimeOrigin = EnsureRoot; - type MembershipInitialized = Collective; - type MembershipChanged = Collective; - type MaxMembers = MaxMembers; - type WeightInfo = weights::pallet_membership::WeightInfo; + // Sudo. + Sudo: pallet_sudo::{Pallet, Call, Storage, Event, Config} = 255, + } } +/// The address format for describing accounts. +pub type Address = sp_runtime::MultiAddress; +/// Block header type as expected by this runtime. +pub type Header = generic::Header; +/// Block type as expected by this runtime. +pub type Block = generic::Block; +/// A Block signed with a Justification +pub type SignedBlock = generic::SignedBlock; +/// `BlockId` type as expected by this runtime. +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::CheckMortality, + frame_system::CheckNonce, + frame_system::CheckWeight, + pallet_transaction_payment::ChargeTransactionPayment, +); + +/// Unchecked extrinsic type as expected by this runtime. +pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; +/// Executive: handles dispatch to the various modules. +pub type Executive = frame_executive::Executive< + Runtime, + Block, + frame_system::ChainContext, + Runtime, + AllPalletsWithSystem, +>; +/// The payload being signed in transactions. +pub type SignedPayload = generic::SignedPayload; + parameter_types! { - // One storage item; key size is 32; value is size 4+4+16+32 bytes = 56 bytes. - pub const DepositBase: Balance = deposit(1, 88); - // Additional storage item size of 32 bytes. - pub const DepositFactor: Balance = deposit(0, 32); - pub const MaxSignatories: u16 = 100; + pub const ValidationUpgradeFrequency: BlockNumber = 2 * DAYS; + pub const ValidationUpgradeDelay: BlockNumber = 8 * HOURS; + pub const SlashPeriod: BlockNumber = 7 * DAYS; } -impl pallet_multisig::Config for Runtime { - type Event = Event; - type Call = Call; - type Currency = Balances; - type DepositBase = DepositBase; - type DepositFactor = DepositFactor; - type MaxSignatories = MaxSignatories; - type WeightInfo = weights::pallet_multisig::WeightInfo; -} +// parameter_types! { +// pub SessionDuration: BlockNumber = EpochDurationInBlocks::get() as _; +// } #[cfg(feature = "runtime-benchmarks")] #[macro_use] @@ -1078,27 +2015,70 @@ mod benches { // the that path resolves correctly in the generated file. [runtime_common::auctions, Auctions] [runtime_common::crowdloan, Crowdloan] - [runtime_common::paras_registrar, Registrar] + // TODO: Claims + // [runtime_common::claims, Claims] [runtime_common::slots, Slots] + [runtime_common::paras_registrar, Registrar] [runtime_parachains::configuration, Configuration] [runtime_parachains::hrmp, Hrmp] - [runtime_parachains::initializer, Initializer] - [runtime_parachains::paras, Paras] [runtime_parachains::disputes, ParasDisputes] + [runtime_parachains::initializer, Initializer] [runtime_parachains::paras_inherent, ParaInherent] + [runtime_parachains::paras, Paras] [runtime_parachains::ump, Ump] // Substrate - [frame_benchmarking::baseline, Baseline::] [pallet_balances, Balances] - [pallet_collective, Collective] + // TODO: Bags List + // [pallet_bags_list, VoterList] + [frame_benchmarking::baseline, Baseline::] + // TODO: Bounties + // [pallet_bounties, Bounties] + // TODO: Vhild Bounties + // [pallet_child_bounties, ChildBounties] + [pallet_collective, Collective] // TODO: Collective -> [pallet_collective, Council] + // TODO: Collective + // [pallet_collective, TechnicalCommittee] + // TODO: Democracy + // [pallet_democracy, Democracy] + // TODO: Elections Phragmen + // [pallet_elections_phragmen, PhragmenElection] + // TODO: Election + // [pallet_election_provider_multi_phase, ElectionProviderMultiPhase] + // [frame_election_provider_support, ElectionProviderBench::] + // TODO: Gilt + // [pallet_gilt, Gilt] + // TODO: Identity + // [pallet_identity, Identity] [pallet_im_online, ImOnline] [pallet_indices, Indices] - [pallet_membership, Membership] + [pallet_membership, Membership] // TODO: Membership -> [pallet_membership, TechnicalMembership [pallet_multisig, Multisig] + // TODO: Nomination + // [pallet_nomination_pools, NominationPoolsBench::] + [pallet_offences, OffencesBench::] + // TODO: Preimage + // [pallet_preimage, Preimage] [pallet_proxy, Proxy] + // TODO: Recovery + // [pallet_recovery, Recovery] + // TODO: Scheduler + // [pallet_scheduler, Scheduler] + // TODO: Session + // [pallet_session, SessionBench::] + // TODO: Staking + // [pallet_staking, Staking] [frame_system, SystemBench::] [pallet_timestamp, Timestamp] + // TODO: Tips + // [pallet_tips, Tips] + // TODO: Treasury + // [pallet_treasury, Treasury] [pallet_utility, Utility] + // TODO: Vesting + // [pallet_vesting, Vesting] + // XCM + [pallet_xcm_benchmarks::fungible, pallet_xcm_benchmarks::fungible::Pallet::] + [pallet_xcm_benchmarks::generic, pallet_xcm_benchmarks::generic::Pallet::] ); } @@ -1165,27 +2145,27 @@ sp_api::impl_runtime_apis! { impl primitives::runtime_api::ParachainHost for Runtime { fn validators() -> Vec { - runtime_api_impl::validators::() + parachains_runtime_api_impl::validators::() } fn validator_groups() -> (Vec>, GroupRotationInfo) { - runtime_api_impl::validator_groups::() + parachains_runtime_api_impl::validator_groups::() } fn availability_cores() -> Vec> { - runtime_api_impl::availability_cores::() + parachains_runtime_api_impl::availability_cores::() } fn persisted_validation_data(para_id: ParaId, assumption: OccupiedCoreAssumption) -> Option> { - runtime_api_impl::persisted_validation_data::(para_id, assumption) + parachains_runtime_api_impl::persisted_validation_data::(para_id, assumption) } fn assumed_validation_data( para_id: ParaId, expected_persisted_validation_data_hash: Hash, ) -> Option<(PersistedValidationData, ValidationCodeHash)> { - runtime_api_impl::assumed_validation_data::( + parachains_runtime_api_impl::assumed_validation_data::( para_id, expected_persisted_validation_data_hash, ) @@ -1195,24 +2175,24 @@ sp_api::impl_runtime_apis! { para_id: ParaId, outputs: primitives::v2::CandidateCommitments, ) -> bool { - runtime_api_impl::check_validation_outputs::(para_id, outputs) + parachains_runtime_api_impl::check_validation_outputs::(para_id, outputs) } fn session_index_for_child() -> SessionIndex { - runtime_api_impl::session_index_for_child::() + parachains_runtime_api_impl::session_index_for_child::() } fn validation_code(para_id: ParaId, assumption: OccupiedCoreAssumption) -> Option { - runtime_api_impl::validation_code::(para_id, assumption) + parachains_runtime_api_impl::validation_code::(para_id, assumption) } fn candidate_pending_availability(para_id: ParaId) -> Option> { - runtime_api_impl::candidate_pending_availability::(para_id) + parachains_runtime_api_impl::candidate_pending_availability::(para_id) } fn candidate_events() -> Vec> { - runtime_api_impl::candidate_events::(|ev| { + parachains_runtime_api_impl::candidate_events::(|ev| { match ev { Event::ParaInclusion(ev) => { Some(ev) @@ -1223,39 +2203,42 @@ sp_api::impl_runtime_apis! { } fn session_info(index: SessionIndex) -> Option { - runtime_api_impl::session_info::(index) + parachains_runtime_api_impl::session_info::(index) } fn dmq_contents(recipient: ParaId) -> Vec> { - runtime_api_impl::dmq_contents::(recipient) + parachains_runtime_api_impl::dmq_contents::(recipient) } fn inbound_hrmp_channels_contents( recipient: ParaId ) -> BTreeMap>> { - runtime_api_impl::inbound_hrmp_channels_contents::(recipient) + parachains_runtime_api_impl::inbound_hrmp_channels_contents::(recipient) } fn validation_code_by_hash(hash: ValidationCodeHash) -> Option { - runtime_api_impl::validation_code_by_hash::(hash) + parachains_runtime_api_impl::validation_code_by_hash::(hash) } fn on_chain_votes() -> Option> { - runtime_api_impl::on_chain_votes::() + parachains_runtime_api_impl::on_chain_votes::() } - fn submit_pvf_check_statement(stmt: PvfCheckStatement, signature: ValidatorSignature) { - runtime_api_impl::submit_pvf_check_statement::(stmt, signature) + fn submit_pvf_check_statement( + stmt: primitives::v2::PvfCheckStatement, + signature: primitives::v2::ValidatorSignature + ) { + parachains_runtime_api_impl::submit_pvf_check_statement::(stmt, signature) } fn pvfs_require_precheck() -> Vec { - runtime_api_impl::pvfs_require_precheck::() + parachains_runtime_api_impl::pvfs_require_precheck::() } fn validation_code_hash(para_id: ParaId, assumption: OccupiedCoreAssumption) -> Option { - runtime_api_impl::validation_code_hash::(para_id, assumption) + parachains_runtime_api_impl::validation_code_hash::(para_id, assumption) } fn staging_get_disputes() -> Vec<(SessionIndex, CandidateHash, DisputeState)> { @@ -1263,6 +2246,75 @@ sp_api::impl_runtime_apis! { } } + impl beefy_primitives::BeefyApi for Runtime { + fn validator_set() -> Option> { + Beefy::validator_set() + } + } + + impl mmr::MmrApi for Runtime { + fn generate_proof(leaf_index: u64) + -> Result<(mmr::EncodableOpaqueLeaf, mmr::Proof), mmr::Error> + { + Mmr::generate_batch_proof(vec![leaf_index]) + .and_then(|(leaves, proof)| Ok(( + mmr::EncodableOpaqueLeaf::from_leaf(&leaves[0]), + mmr::BatchProof::into_single_leaf_proof(proof)? + ))) + } + + fn verify_proof(leaf: mmr::EncodableOpaqueLeaf, proof: mmr::Proof) + -> Result<(), mmr::Error> + { + pub type MmrLeaf = <::LeafData as mmr::LeafDataProvider>::LeafData; + let leaf: MmrLeaf = leaf + .into_opaque_leaf() + .try_decode() + .ok_or(mmr::Error::Verify)?; + Mmr::verify_leaves(vec![leaf], mmr::Proof::into_batch_proof(proof)) + } + + fn verify_proof_stateless( + root: Hash, + leaf: mmr::EncodableOpaqueLeaf, + proof: mmr::Proof + ) -> Result<(), mmr::Error> { + let node = mmr::DataOrHash::Data(leaf.into_opaque_leaf()); + pallet_mmr::verify_leaves_proof::(root, vec![node], mmr::Proof::into_batch_proof(proof)) + } + + fn mmr_root() -> Result { + Ok(Mmr::mmr_root()) + } + + fn generate_batch_proof(leaf_indices: Vec) + -> Result<(Vec, mmr::BatchProof), mmr::Error> + { + Mmr::generate_batch_proof(leaf_indices) + .map(|(leaves, proof)| (leaves.into_iter().map(|leaf| mmr::EncodableOpaqueLeaf::from_leaf(&leaf)).collect(), proof)) + } + + fn verify_batch_proof(leaves: Vec, proof: mmr::BatchProof) + -> Result<(), mmr::Error> + { + pub type MmrLeaf = <::LeafData as mmr::LeafDataProvider>::LeafData; + let leaves = leaves.into_iter().map(|leaf| + leaf.into_opaque_leaf() + .try_decode() + .ok_or(mmr::Error::Verify)).collect::, mmr::Error>>()?; + Mmr::verify_leaves(leaves, proof) + } + + fn verify_batch_proof_stateless( + root: Hash, + leaves: Vec, + proof: mmr::BatchProof + ) -> Result<(), mmr::Error> { + let nodes = leaves.into_iter().map(|leaf|mmr::DataOrHash::Data(leaf.into_opaque_leaf())).collect(); + pallet_mmr::verify_leaves_proof::(root, nodes, proof) + } + } + impl fg_primitives::GrandpaApi for Runtime { fn grandpa_authorities() -> Vec<(GrandpaId, u64)> { Grandpa::grandpa_authorities() @@ -1308,7 +2360,7 @@ sp_api::impl_runtime_apis! { // babe_primitives::BabeGenesisConfiguration { slot_duration: Babe::slot_duration(), - epoch_length: EpochDurationInBlocks::get().into(), + epoch_length: EpochDuration::get().into(), c: BABE_GENESIS_EPOCH_CONFIG.c, genesis_authorities: Babe::authorities().to_vec(), randomness: Babe::randomness(), @@ -1354,7 +2406,7 @@ sp_api::impl_runtime_apis! { impl authority_discovery_primitives::AuthorityDiscoveryApi for Runtime { fn authorities() -> Vec { - runtime_api_impl::relevant_authority_ids::() + parachains_runtime_api_impl::relevant_authority_ids::() } } @@ -1370,72 +2422,21 @@ sp_api::impl_runtime_apis! { } } - impl beefy_primitives::BeefyApi for Runtime { - fn validator_set() -> Option> { - Beefy::validator_set() + impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { + fn account_nonce(account: AccountId) -> Nonce { + System::account_nonce(account) } } - impl mmr::MmrApi for Runtime { - fn generate_proof(leaf_index: u64) - -> Result<(mmr::EncodableOpaqueLeaf, mmr::Proof), mmr::Error> - { - Mmr::generate_batch_proof(vec![leaf_index]) - .and_then(|(leaves, proof)| Ok(( - mmr::EncodableOpaqueLeaf::from_leaf(&leaves[0]), - mmr::BatchProof::into_single_leaf_proof(proof)? - ))) - } - - fn verify_proof(leaf: mmr::EncodableOpaqueLeaf, proof: mmr::Proof) - -> Result<(), mmr::Error> - { - pub type MmrLeaf = <::LeafData as mmr::LeafDataProvider>::LeafData; - let leaf: MmrLeaf = leaf - .into_opaque_leaf() - .try_decode() - .ok_or(mmr::Error::Verify)?; - Mmr::verify_leaves(vec![leaf], mmr::Proof::into_batch_proof(proof)) - } - - fn verify_proof_stateless( - root: Hash, - leaf: mmr::EncodableOpaqueLeaf, - proof: mmr::Proof - ) -> Result<(), mmr::Error> { - let node = mmr::DataOrHash::Data(leaf.into_opaque_leaf()); - pallet_mmr::verify_leaves_proof::(root, vec![node], mmr::Proof::into_batch_proof(proof)) - } - - fn mmr_root() -> Result { - Ok(Mmr::mmr_root()) - } - - fn generate_batch_proof(leaf_indices: Vec) - -> Result<(Vec, mmr::BatchProof), mmr::Error> - { - Mmr::generate_batch_proof(leaf_indices) - .map(|(leaves, proof)| (leaves.into_iter().map(|leaf| mmr::EncodableOpaqueLeaf::from_leaf(&leaf)).collect(), proof)) - } - - fn verify_batch_proof(leaves: Vec, proof: mmr::BatchProof) - -> Result<(), mmr::Error> - { - pub type MmrLeaf = <::LeafData as mmr::LeafDataProvider>::LeafData; - let leaves = leaves.into_iter().map(|leaf| - leaf.into_opaque_leaf() - .try_decode() - .ok_or(mmr::Error::Verify)).collect::, mmr::Error>>()?; - Mmr::verify_leaves(leaves, proof) + impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi< + Block, + Balance, + > for Runtime { + fn query_info(uxt: ::Extrinsic, len: u32) -> RuntimeDispatchInfo { + TransactionPayment::query_info(uxt, len) } - - fn verify_batch_proof_stateless( - root: Hash, - leaves: Vec, - proof: mmr::BatchProof - ) -> Result<(), mmr::Error> { - let nodes = leaves.into_iter().map(|leaf|mmr::DataOrHash::Data(leaf.into_opaque_leaf())).collect(); - pallet_mmr::verify_leaves_proof::(root, nodes, proof) + fn query_fee_details(uxt: ::Extrinsic, len: u32) -> FeeDetails { + TransactionPayment::query_fee_details(uxt, len) } } @@ -1523,23 +2524,7 @@ sp_api::impl_runtime_apis! { } } - impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { - fn account_nonce(account: AccountId) -> Nonce { - System::account_nonce(account) - } - } - - impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi< - Block, - Balance, - > for Runtime { - fn query_info(uxt: ::Extrinsic, len: u32) -> RuntimeDispatchInfo { - TransactionPayment::query_info(uxt, len) - } - fn query_fee_details(uxt: ::Extrinsic, len: u32) -> FeeDetails { - TransactionPayment::query_fee_details(uxt, len) - } - } + // I AM HERE #[cfg(feature = "runtime-benchmarks")] impl frame_benchmarking::Benchmark for Runtime { @@ -1550,6 +2535,12 @@ sp_api::impl_runtime_apis! { use frame_benchmarking::{Benchmarking, BenchmarkList}; use frame_support::traits::StorageInfoTrait; + // TODO: Session (added) + use pallet_session_benchmarking::Pallet as SessionBench; + // TODO: Election + // use pallet_offences_benchmarking::Pallet as OffencesBench; + // TODO: Election + // use pallet_election_provider_support_benchmarking::Pallet as ElectionProviderBench; use frame_system_benchmarking::Pallet as SystemBench; use frame_benchmarking::baseline::Pallet as Baseline; @@ -1567,13 +2558,96 @@ sp_api::impl_runtime_apis! { sp_runtime::RuntimeString, > { use frame_benchmarking::{Benchmarking, BenchmarkBatch, TrackedStorageKey}; + // Trying to add benchmarks directly to some pallets caused cyclic dependency issues. + // To get around that, we separated the benchmarks into its own crate. + // TODO: Session (added) + use pallet_session_benchmarking::Pallet as SessionBench; + // TODO: Offences + // use pallet_offences_benchmarking::Pallet as OffencesBench; + // TODO: Election + // use pallet_election_provider_support_benchmarking::Pallet as ElectionProviderBench; use frame_system_benchmarking::Pallet as SystemBench; + // TODO: Nomination + use pallet_nomination_pools_benchmarking::Pallet as NominationPoolsBench; use frame_benchmarking::baseline::Pallet as Baseline; - + use xcm::latest::prelude::*; + use xcm_config::{CheckAccount, KsmLocation, SovereignAccountOf, Statemine, XcmConfig}; + + // TODO: Session (added) + impl pallet_session_benchmarking::Config for Runtime {} + // TODO: Offences + // impl pallet_offences_benchmarking::Config for Runtime {} + // TODO: Election Provider + // impl pallet_election_provider_support_benchmarking::Config for Runtime {} impl frame_system_benchmarking::Config for Runtime {} impl frame_benchmarking::baseline::Config for Runtime {} + // TODO: Nomination + // impl pallet_nomination_pools_benchmarking::Config for Runtime {} + + impl pallet_xcm_benchmarks::Config for Runtime { + type XcmConfig = XcmConfig; + type AccountIdConverter = SovereignAccountOf; + fn valid_destination() -> Result { + Ok(Statemine::get()) + } + fn worst_case_holding() -> MultiAssets { + // Kusama only knows about KSM. + vec![MultiAsset{ + id: Concrete(KsmLocation::get()), + fun: Fungible(1_000_000 * UNITS), + }].into() + } + } + + parameter_types! { + pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some(( + Statemine::get(), + MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(KsmLocation::get()) }, + )); + pub const TrustedReserve: Option<(MultiLocation, MultiAsset)> = Some(( + Statemine::get(), + MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(KsmLocation::get()) }, + )); + } + + impl pallet_xcm_benchmarks::fungible::Config for Runtime { + type TransactAsset = Balances; + + type CheckedAccount = CheckAccount; + type TrustedTeleporter = TrustedTeleporter; + type TrustedReserve = TrustedReserve; + + fn get_multi_asset() -> MultiAsset { + MultiAsset { + id: Concrete(KsmLocation::get()), + fun: Fungible(1 * UNITS), + } + } + } + + impl pallet_xcm_benchmarks::generic::Config for Runtime { + type Call = Call; + + fn worst_case_response() -> (u64, Response) { + (0u64, Response::Version(Default::default())) + } + + fn transact_origin() -> Result { + Ok(Statemine::get()) + } + + fn subscribe_origin() -> Result { + Ok(Statemine::get()) + } + + fn claimable_asset() -> Result<(MultiLocation, MultiLocation, MultiAssets), BenchmarkError> { + let origin = Statemine::get(); + let assets: MultiAssets = (Concrete(KsmLocation::get()), 1_000 * UNITS).into(); + let ticket = MultiLocation { parents: 0, interior: Here }; + Ok((origin, ticket, assets)) + } + } - let mut batches = Vec::::new(); let whitelist: Vec = vec![ // Block Number hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(), @@ -1585,11 +2659,38 @@ sp_api::impl_runtime_apis! { hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(), // System Events hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(), + // TODO: Treasury + //// Treasury Account + // hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da95ecffd7b6c0f78751baa9d281e0bfa3a6d6f646c70792f74727372790000000000000000000000000000000000000000").to_vec().into(), + // TODO: Rococo + //// Configuration ActiveConfig + //hex_literal::hex!("06de3d8a54d27e44a9d5ce189618f22db4b49d95320d9021994c850f25b8e385").to_vec().into(), + // TODO: Rococo + //// The transactional storage limit. + // hex_literal::hex!("3a7472616e73616374696f6e5f6c6576656c3a").to_vec().into(), ]; + + let mut batches = Vec::::new(); let params = (&config, &whitelist); + add_benchmarks!(params, batches); Ok(batches) } } } + +// TODO: Rococo +// #[cfg(test)] +// mod tests_fess { +// use super::*; +// use sp_runtime::assert_eq_error_rate; + +// #[test] +// fn signed_deposit_is_sensible() { +// // ensure this number does not change, or that it is checked after each change. +// // a 1 MB solution should need around 0.16 KSM deposit +// let deposit = SignedDepositBase::get() + (SignedDepositByte::get() * 1024 * 1024); +// assert_eq_error_rate!(deposit, UNITS * 16 / 100, UNITS / 100); +// } +// } diff --git a/runtime/rococo/src/weights/mod.rs b/runtime/rococo/src/weights/mod.rs index ca5a5673e375..04f860bb36da 100644 --- a/runtime/rococo/src/weights/mod.rs +++ b/runtime/rococo/src/weights/mod.rs @@ -37,3 +37,4 @@ pub mod runtime_parachains_initializer; pub mod runtime_parachains_paras; pub mod runtime_parachains_paras_inherent; pub mod runtime_parachains_ump; +pub mod xcm; diff --git a/runtime/rococo/src/weights/xcm/mod.rs b/runtime/rococo/src/weights/xcm/mod.rs new file mode 100644 index 000000000000..f266e076636f --- /dev/null +++ b/runtime/rococo/src/weights/xcm/mod.rs @@ -0,0 +1,195 @@ +mod pallet_xcm_benchmarks_fungible; +mod pallet_xcm_benchmarks_generic; + +use crate::Runtime; +use frame_support::weights::Weight; +use sp_std::prelude::*; +use xcm::{latest::prelude::*, DoubleEncoded}; + +use pallet_xcm_benchmarks_fungible::WeightInfo as XcmBalancesWeight; +use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric; + +/// Types of asset supported by the Kusama runtime. +pub enum AssetTypes { + /// An asset backed by `pallet-balances`. + Balances, + /// Unknown asset. + Unknown, +} + +impl From<&MultiAsset> for AssetTypes { + fn from(asset: &MultiAsset) -> Self { + match asset { + MultiAsset { id: Concrete(MultiLocation { parents: 0, interior: Here }), .. } => + AssetTypes::Balances, + _ => AssetTypes::Unknown, + } + } +} + +trait WeighMultiAssets { + fn weigh_multi_assets(&self, balances_weight: Weight) -> Weight; +} + +// Kusama only knows about one asset, the balances pallet. +const MAX_ASSETS: u32 = 1; + +impl WeighMultiAssets for MultiAssetFilter { + fn weigh_multi_assets(&self, balances_weight: Weight) -> Weight { + match self { + Self::Definite(assets) => assets + .inner() + .into_iter() + .map(From::from) + .map(|t| match t { + AssetTypes::Balances => balances_weight, + AssetTypes::Unknown => Weight::MAX, + }) + .fold(0, |acc, x| acc.saturating_add(x)), + Self::Wild(_) => (MAX_ASSETS as Weight).saturating_mul(balances_weight), + } + } +} + +impl WeighMultiAssets for MultiAssets { + fn weigh_multi_assets(&self, balances_weight: Weight) -> Weight { + self.inner() + .into_iter() + .map(|m| >::from(m)) + .map(|t| match t { + AssetTypes::Balances => balances_weight, + AssetTypes::Unknown => Weight::MAX, + }) + .fold(0, |acc, x| acc.saturating_add(x)) + } +} + +pub struct KusamaXcmWeight(core::marker::PhantomData); +impl XcmWeightInfo for KusamaXcmWeight { + fn withdraw_asset(assets: &MultiAssets) -> Weight { + assets.weigh_multi_assets(XcmBalancesWeight::::withdraw_asset()) + } + fn reserve_asset_deposited(assets: &MultiAssets) -> Weight { + assets.weigh_multi_assets(XcmBalancesWeight::::reserve_asset_deposited()) + } + fn receive_teleported_asset(assets: &MultiAssets) -> Weight { + assets.weigh_multi_assets(XcmBalancesWeight::::receive_teleported_asset()) + } + fn query_response(_query_id: &u64, _response: &Response, _max_weight: &u64) -> Weight { + XcmGeneric::::query_response() + } + fn transfer_asset(assets: &MultiAssets, _dest: &MultiLocation) -> Weight { + assets.weigh_multi_assets(XcmBalancesWeight::::transfer_asset()) + } + fn transfer_reserve_asset( + assets: &MultiAssets, + _dest: &MultiLocation, + _xcm: &Xcm<()>, + ) -> Weight { + assets.weigh_multi_assets(XcmBalancesWeight::::transfer_reserve_asset()) + } + fn transact( + _origin_type: &OriginKind, + _require_weight_at_most: &u64, + _call: &DoubleEncoded, + ) -> Weight { + XcmGeneric::::transact() + } + fn hrmp_new_channel_open_request( + _sender: &u32, + _max_message_size: &u32, + _max_capacity: &u32, + ) -> Weight { + // XCM Executor does not currently support HRMP channel operations + Weight::MAX + } + fn hrmp_channel_accepted(_recipient: &u32) -> Weight { + // XCM Executor does not currently support HRMP channel operations + Weight::MAX + } + fn hrmp_channel_closing(_initiator: &u32, _sender: &u32, _recipient: &u32) -> Weight { + // XCM Executor does not currently support HRMP channel operations + Weight::MAX + } + fn clear_origin() -> Weight { + XcmGeneric::::clear_origin() + } + fn descend_origin(_who: &InteriorMultiLocation) -> Weight { + XcmGeneric::::descend_origin() + } + fn report_error( + _query_id: &QueryId, + _dest: &MultiLocation, + _max_response_weight: &u64, + ) -> Weight { + XcmGeneric::::report_error() + } + + fn deposit_asset( + assets: &MultiAssetFilter, + _max_assets: &u32, // TODO use max assets? + _dest: &MultiLocation, + ) -> Weight { + assets.weigh_multi_assets(XcmBalancesWeight::::deposit_asset()) + } + fn deposit_reserve_asset( + assets: &MultiAssetFilter, + _max_assets: &u32, // TODO use max assets? + _dest: &MultiLocation, + _xcm: &Xcm<()>, + ) -> Weight { + assets.weigh_multi_assets(XcmBalancesWeight::::deposit_reserve_asset()) + } + fn exchange_asset(_give: &MultiAssetFilter, _receive: &MultiAssets) -> Weight { + Weight::MAX // todo fix + } + fn initiate_reserve_withdraw( + assets: &MultiAssetFilter, + _reserve: &MultiLocation, + _xcm: &Xcm<()>, + ) -> Weight { + assets.weigh_multi_assets(XcmGeneric::::initiate_reserve_withdraw()) + } + fn initiate_teleport( + assets: &MultiAssetFilter, + _dest: &MultiLocation, + _xcm: &Xcm<()>, + ) -> Weight { + assets.weigh_multi_assets(XcmBalancesWeight::::initiate_teleport()) + } + fn query_holding( + _query_id: &u64, + _dest: &MultiLocation, + _assets: &MultiAssetFilter, + _max_response_weight: &u64, + ) -> Weight { + XcmGeneric::::query_holding() + } + fn buy_execution(_fees: &MultiAsset, _weight_limit: &WeightLimit) -> Weight { + XcmGeneric::::buy_execution() + } + fn refund_surplus() -> Weight { + XcmGeneric::::refund_surplus() + } + fn set_error_handler(_xcm: &Xcm) -> Weight { + XcmGeneric::::set_error_handler() + } + fn set_appendix(_xcm: &Xcm) -> Weight { + XcmGeneric::::set_appendix() + } + fn clear_error() -> Weight { + XcmGeneric::::clear_error() + } + fn claim_asset(_assets: &MultiAssets, _ticket: &MultiLocation) -> Weight { + XcmGeneric::::claim_asset() + } + fn trap(_code: &u64) -> Weight { + XcmGeneric::::trap() + } + fn subscribe_version(_query_id: &QueryId, _max_response_weight: &u64) -> Weight { + XcmGeneric::::subscribe_version() + } + fn unsubscribe_version() -> Weight { + XcmGeneric::::unsubscribe_version() + } +} diff --git a/runtime/rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs b/runtime/rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs new file mode 100644 index 000000000000..2528c0a491dc --- /dev/null +++ b/runtime/rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs @@ -0,0 +1,112 @@ +// Copyright 2022 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_xcm_benchmarks::fungible` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-03-08, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 1024 + +// Executed Command: +// target/production/polkadot +// benchmark +// --chain=kusama-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_xcm_benchmarks::fungible +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --template=./xcm/pallet-xcm-benchmarks/template.hbs +// --output=./runtime/kusama/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weights for `pallet_xcm_benchmarks::fungible`. +pub struct WeightInfo(PhantomData); +impl WeightInfo { + // Storage: System Account (r:1 w:1) + pub(crate) fn withdraw_asset() -> Weight { + (20_385_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: System Account (r:2 w:2) + pub(crate) fn transfer_asset() -> Weight { + (32_756_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: System Account (r:2 w:2) + // Storage: XcmPallet SupportedVersion (r:1 w:0) + // Storage: XcmPallet VersionDiscoveryQueue (r:1 w:1) + // Storage: XcmPallet SafeXcmVersion (r:1 w:0) + // Storage: Configuration ActiveConfig (r:1 w:0) + // Storage: Dmp DownwardMessageQueueHeads (r:1 w:1) + // Storage: Dmp DownwardMessageQueues (r:1 w:1) + pub(crate) fn transfer_reserve_asset() -> Weight { + (50_645_000 as Weight) + .saturating_add(T::DbWeight::get().reads(8 as Weight)) + .saturating_add(T::DbWeight::get().writes(5 as Weight)) + } + // Storage: Benchmark Override (r:0 w:0) + pub(crate) fn reserve_asset_deposited() -> Weight { + (2_000_000_000_000 as Weight) + } + // Storage: System Account (r:1 w:1) + pub(crate) fn receive_teleported_asset() -> Weight { + (19_595_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: System Account (r:1 w:1) + pub(crate) fn deposit_asset() -> Weight { + (21_763_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: System Account (r:1 w:1) + // Storage: XcmPallet SupportedVersion (r:1 w:0) + // Storage: XcmPallet VersionDiscoveryQueue (r:1 w:1) + // Storage: XcmPallet SafeXcmVersion (r:1 w:0) + // Storage: Configuration ActiveConfig (r:1 w:0) + // Storage: Dmp DownwardMessageQueueHeads (r:1 w:1) + // Storage: Dmp DownwardMessageQueues (r:1 w:1) + pub(crate) fn deposit_reserve_asset() -> Weight { + (40_930_000 as Weight) + .saturating_add(T::DbWeight::get().reads(7 as Weight)) + .saturating_add(T::DbWeight::get().writes(4 as Weight)) + } + // Storage: System Account (r:1 w:1) + // Storage: XcmPallet SupportedVersion (r:1 w:0) + // Storage: XcmPallet VersionDiscoveryQueue (r:1 w:1) + // Storage: XcmPallet SafeXcmVersion (r:1 w:0) + // Storage: Configuration ActiveConfig (r:1 w:0) + // Storage: Dmp DownwardMessageQueueHeads (r:1 w:1) + // Storage: Dmp DownwardMessageQueues (r:1 w:1) + pub(crate) fn initiate_teleport() -> Weight { + (40_788_000 as Weight) + .saturating_add(T::DbWeight::get().reads(7 as Weight)) + .saturating_add(T::DbWeight::get().writes(4 as Weight)) + } +} diff --git a/runtime/rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs b/runtime/rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs new file mode 100644 index 000000000000..b3d256cbd880 --- /dev/null +++ b/runtime/rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs @@ -0,0 +1,136 @@ +// Copyright 2022 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_xcm_benchmarks::generic` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-03-08, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 1024 + +// Executed Command: +// target/production/polkadot +// benchmark +// --chain=kusama-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_xcm_benchmarks::generic +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --template=./xcm/pallet-xcm-benchmarks/template.hbs +// --output=./runtime/kusama/src/weights/xcm/pallet_xcm_benchmarks_generic.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weights for `pallet_xcm_benchmarks::generic`. +pub struct WeightInfo(PhantomData); +impl WeightInfo { + // Storage: XcmPallet SupportedVersion (r:1 w:0) + // Storage: XcmPallet VersionDiscoveryQueue (r:1 w:1) + // Storage: XcmPallet SafeXcmVersion (r:1 w:0) + // Storage: Configuration ActiveConfig (r:1 w:0) + // Storage: Dmp DownwardMessageQueueHeads (r:1 w:1) + // Storage: Dmp DownwardMessageQueues (r:1 w:1) + pub(crate) fn query_holding() -> Weight { + (21_822_000 as Weight) + .saturating_add(T::DbWeight::get().reads(6 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + pub(crate) fn buy_execution() -> Weight { + (3_109_000 as Weight) + } + // Storage: XcmPallet Queries (r:1 w:0) + pub(crate) fn query_response() -> Weight { + (12_087_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + } + pub(crate) fn transact() -> Weight { + (12_398_000 as Weight) + } + pub(crate) fn refund_surplus() -> Weight { + (3_247_000 as Weight) + } + pub(crate) fn set_error_handler() -> Weight { + (3_086_000 as Weight) + } + pub(crate) fn set_appendix() -> Weight { + (3_112_000 as Weight) + } + pub(crate) fn clear_error() -> Weight { + (3_118_000 as Weight) + } + pub(crate) fn descend_origin() -> Weight { + (4_054_000 as Weight) + } + pub(crate) fn clear_origin() -> Weight { + (3_111_000 as Weight) + } + // Storage: XcmPallet SupportedVersion (r:1 w:0) + // Storage: XcmPallet VersionDiscoveryQueue (r:1 w:1) + // Storage: XcmPallet SafeXcmVersion (r:1 w:0) + // Storage: Configuration ActiveConfig (r:1 w:0) + // Storage: Dmp DownwardMessageQueueHeads (r:1 w:1) + // Storage: Dmp DownwardMessageQueues (r:1 w:1) + pub(crate) fn report_error() -> Weight { + (18_425_000 as Weight) + .saturating_add(T::DbWeight::get().reads(6 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + // Storage: XcmPallet AssetTraps (r:1 w:1) + pub(crate) fn claim_asset() -> Weight { + (7_144_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + pub(crate) fn trap() -> Weight { + (3_060_000 as Weight) + } + // Storage: XcmPallet VersionNotifyTargets (r:1 w:1) + // Storage: XcmPallet SupportedVersion (r:1 w:0) + // Storage: XcmPallet VersionDiscoveryQueue (r:1 w:1) + // Storage: XcmPallet SafeXcmVersion (r:1 w:0) + // Storage: Configuration ActiveConfig (r:1 w:0) + // Storage: Dmp DownwardMessageQueueHeads (r:1 w:1) + // Storage: Dmp DownwardMessageQueues (r:1 w:1) + pub(crate) fn subscribe_version() -> Weight { + (21_642_000 as Weight) + .saturating_add(T::DbWeight::get().reads(7 as Weight)) + .saturating_add(T::DbWeight::get().writes(4 as Weight)) + } + // Storage: XcmPallet VersionNotifyTargets (r:0 w:1) + pub(crate) fn unsubscribe_version() -> Weight { + (4_873_000 as Weight) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: XcmPallet SupportedVersion (r:1 w:0) + // Storage: XcmPallet VersionDiscoveryQueue (r:1 w:1) + // Storage: XcmPallet SafeXcmVersion (r:1 w:0) + // Storage: Configuration ActiveConfig (r:1 w:0) + // Storage: Dmp DownwardMessageQueueHeads (r:1 w:1) + // Storage: Dmp DownwardMessageQueues (r:1 w:1) + pub(crate) fn initiate_reserve_withdraw() -> Weight { + (22_809_000 as Weight) + .saturating_add(T::DbWeight::get().reads(6 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } +} diff --git a/runtime/rococo/src/xcm_config.rs b/runtime/rococo/src/xcm_config.rs index 1512ef9e6ccd..19333d79ad27 100644 --- a/runtime/rococo/src/xcm_config.rs +++ b/runtime/rococo/src/xcm_config.rs @@ -20,31 +20,45 @@ use super::{ parachains_origin, AccountId, Balances, Call, Event, Origin, ParaId, Runtime, WeightToFee, XcmPallet, }; -use frame_support::{ - parameter_types, - traits::{Everything, IsInVec, Nothing}, - weights::Weight, -}; +use frame_support::{match_types, parameter_types, traits::Everything, weights::Weight}; use runtime_common::{xcm_sender, ToAuthor}; -use sp_std::prelude::*; use xcm::latest::prelude::*; use xcm_builder::{ - AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, BackingToPlurality, + AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, + AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, BackingToPlurality, ChildParachainAsNative, ChildParachainConvertsVia, ChildSystemParachainAsSuperuser, - CurrencyAdapter as XcmCurrencyAdapter, FixedWeightBounds, IsConcrete, LocationInverter, - SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, UsingComponents, + CurrencyAdapter as XcmCurrencyAdapter, FixedWeightBounds, IsChildSystemParachain, IsConcrete, + LocationInverter, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, + TakeWeightCredit, UsingComponents, WeightInfoBounds, }; parameter_types! { + /// The location of the ROC token, from the context of this chain. Since this token is native to this + /// chain, we make it synonymous with it and thus it is the `Here` location, which means "equivalent to + /// the context". pub const RocLocation: MultiLocation = Here.into(); + /// The Rococo network ID. This is named. pub const RococoNetwork: NetworkId = NetworkId::Polkadot; + /// Our XCM location ancestry - i.e. what, if anything, `Parent` means evaluated in our context. Since + /// Rococo is a top-level relay-chain, there is no ancestry. pub const Ancestry: MultiLocation = Here.into(); + /// The check account, which holds any native assets that have been teleported out and not back in (yet). pub CheckAccount: AccountId = XcmPallet::check_account(); } -pub type SovereignAccountOf = - (ChildParachainConvertsVia, AccountId32Aliases); +/// The canonical means of converting a `MultiLocation` into an `AccountId`, used when we want to determine +/// the sovereign account controlled by a location. +pub type SovereignAccountOf = ( + // We can convert a child parachain using the standard `AccountId` conversion. + ChildParachainConvertsVia, + // We can directly alias an `AccountId32` into a local account. + AccountId32Aliases, +); +/// Our asset transactor. This is what allows us to interest with the runtime facilities from the point of +/// view of XCM-only concepts like `MultiLocation` and `MultiAsset`. +/// +/// Ours is only aware of the Balances pallet, which is mapped to `RocLocation`. pub type LocalAssetTransactor = XcmCurrencyAdapter< // Use this currency: Balances, @@ -54,21 +68,29 @@ pub type LocalAssetTransactor = XcmCurrencyAdapter< SovereignAccountOf, // Our chain's account ID type (we can't get away without mentioning it explicitly): AccountId, - // It's a native asset so we keep track of the teleports to maintain total issuance. + // We track our teleports in/out to keep total issuance correct. CheckAccount, >; +/// The means that we convert an the XCM message origin location into a local dispatch origin. type LocalOriginConverter = ( + // A `Signed` origin of the sovereign account that the original location controls. SovereignSignedViaLocation, + // A child parachain, natively expressed, has the `Parachain` origin. ChildParachainAsNative, + // The AccountId32 location type can be expressed natively as a `Signed` origin. SignedAccountId32AsNative, + // A system child parachain, expressed as a Superuser, converts to the `Root` origin. ChildSystemParachainAsSuperuser, ); parameter_types! { + /// The amount of weight an XCM operation takes. This is a safe overestimate. pub const BaseXcmWeight: Weight = 1_000_000_000; + /// Maximum number of instructions in a single XCM fragment. A sanity check against weight + /// calculations getting too crazy. + pub const MaxInstructions: u32 = 100; } - /// The XCM router. When we want to send an XCM message, we use this type. It amalgamates all of our /// individual routers. pub type XcmRouter = ( @@ -78,13 +100,18 @@ pub type XcmRouter = ( parameter_types! { pub const Rococo: MultiAssetFilter = Wild(AllOf { fun: WildFungible, id: Concrete(RocLocation::get()) }); - pub const RococoForTick: (MultiAssetFilter, MultiLocation) = (Rococo::get(), Parachain(100).into()); - pub const RococoForTrick: (MultiAssetFilter, MultiLocation) = (Rococo::get(), Parachain(110).into()); - pub const RococoForTrack: (MultiAssetFilter, MultiLocation) = (Rococo::get(), Parachain(120).into()); - pub const RococoForStatemine: (MultiAssetFilter, MultiLocation) = (Rococo::get(), Parachain(1000).into()); - pub const RococoForCanvas: (MultiAssetFilter, MultiLocation) = (Rococo::get(), Parachain(1002).into()); - pub const RococoForEncointer: (MultiAssetFilter, MultiLocation) = (Rococo::get(), Parachain(1003).into()); - pub const MaxInstructions: u32 = 100; + pub const Statemine: MultiLocation = Parachain(1000).into(); + pub const Canvas: MultiLocation = Parachain(1002).into(); + pub const Encointer: MultiLocation = Parachain(1003).into(); + pub const Tick: MultiLocation = Parachain(100).into(); + pub const Trick: MultiLocation = Parachain(110).into(); + pub const Track: MultiLocation = Parachain(120).into(); + pub const RococoForTick: (MultiAssetFilter, MultiLocation) = (Rococo::get(), Tick::get()); + pub const RococoForTrick: (MultiAssetFilter, MultiLocation) = (Rococo::get(), Trick::get()); + pub const RococoForTrack: (MultiAssetFilter, MultiLocation) = (Rococo::get(), Track::get()); + pub const RococoForStatemine: (MultiAssetFilter, MultiLocation) = (Rococo::get(), Statemine::get()); + pub const RococoForCanvas: (MultiAssetFilter, MultiLocation) = (Rococo::get(), Canvas::get()); + pub const RococoForEncointer: (MultiAssetFilter, MultiLocation) = (Rococo::get(), Encointer::get()); } pub type TrustedTeleporters = ( xcm_builder::Case, @@ -95,27 +122,24 @@ pub type TrustedTeleporters = ( xcm_builder::Case, ); -parameter_types! { - pub AllowUnpaidFrom: Vec = - vec![ - Parachain(100).into(), - Parachain(110).into(), - Parachain(120).into(), - Parachain(1000).into(), - Parachain(1002).into(), - Parachain(1003).into(), - ]; +match_types! { + pub type OnlyParachains: impl Contains = { + MultiLocation { parents: 0, interior: X1(Parachain(_)) } + }; } -use xcm_builder::{AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, TakeWeightCredit}; +/// The barriers one of which must be passed for an XCM message to be executed. pub type Barrier = ( + // Weight that is paid for may be consumed. TakeWeightCredit, + // If the message is one that immediately attemps to pay for execution, then allow it. AllowTopLevelPaidExecutionFrom, - AllowUnpaidExecutionFrom>, // <- Trusted parachains get free execution + // Messages coming from system parachains need not pay for execution. + AllowUnpaidExecutionFrom>, // Expected responses are OK. AllowKnownQueryResponses, // Subscriptions for version tracking are OK. - AllowSubscriptionsFrom, + AllowSubscriptionsFrom, ); pub struct XcmConfig; @@ -128,7 +152,9 @@ impl xcm_executor::Config for XcmConfig { type IsTeleporter = TrustedTeleporters; type LocationInverter = LocationInverter; type Barrier = Barrier; - type Weigher = FixedWeightBounds; + type Weigher = + WeightInfoBounds, Call, MaxInstructions>; + // The weight trader piggybacks on the existing transaction-fee conversion logic. type Trader = UsingComponents>; type ResponseHandler = XcmPallet; type AssetTrap = XcmPallet; @@ -140,26 +166,40 @@ parameter_types! { pub const CollectiveBodyId: BodyId = BodyId::Unit; } +// TODO: Collective +// parameter_types! { +// pub const CouncilBodyId: BodyId = BodyId::Executive; +// } + /// Type to convert an `Origin` type value into a `MultiLocation` value which represents an interior location /// of this chain. pub type LocalOriginToLocation = ( // We allow an origin from the Collective pallet to be used in XCM as a corresponding Plurality of the // `Unit` body. - BackingToPlurality, CollectiveBodyId>, + BackingToPlurality< + Origin, + pallet_collective::Origin, + CollectiveBodyId // TODO: Collective -> CouncilBodyId + >, // And a usual Signed origin to be used in XCM as a corresponding AccountId32 SignedToAccountId32, ); - impl pallet_xcm::Config for Runtime { type Event = Event; - type SendXcmOrigin = xcm_builder::EnsureXcmOrigin; + // We don't allow any messages to be sent via the transaction yet. This is basically safe to + // enable, (safe the possibility of someone spamming the parachain if they're willing to pay + // the DOT to send from the Relay-chain). But it's useless until we bring in XCM v3 which will + // make `DescendOrigin` a bit more useful. + type SendXcmOrigin = xcm_builder::EnsureXcmOrigin; type XcmRouter = XcmRouter; - // Anyone can execute XCM messages locally... + // Anyone can execute XCM messages locally. type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin; - // ...but they must match our filter, which right now rejects everything. - type XcmExecuteFilter = Nothing; + type XcmExecuteFilter = Everything; type XcmExecutor = xcm_executor::XcmExecutor; + // Anyone is able to use teleportation regardless of who they are and what they want to teleport. type XcmTeleportFilter = Everything; + // Anyone is able to use reserve transfers regardless of who they are and what they want to + // transfer. type XcmReserveTransferFilter = Everything; type Weigher = FixedWeightBounds; type LocationInverter = LocationInverter; From c9c86e2d5e66f4b620d75c5ab5751d66aaab19bb Mon Sep 17 00:00:00 2001 From: NachoPal Date: Tue, 31 May 2022 15:51:53 +0200 Subject: [PATCH 02/35] rollback epoch and clean up --- node/service/src/chain_spec.rs | 2 - runtime/kusama/src/lib.rs | 18 +++--- runtime/rococo/constants/src/lib.rs | 4 +- runtime/rococo/src/lib.rs | 86 ++++++++++++++--------------- 4 files changed, 56 insertions(+), 54 deletions(-) diff --git a/node/service/src/chain_spec.rs b/node/service/src/chain_spec.rs index 86da5b082414..f2e1c75bd20b 100644 --- a/node/service/src/chain_spec.rs +++ b/node/service/src/chain_spec.rs @@ -1065,7 +1065,6 @@ fn rococo_staging_testnet_config_genesis(wasm_binary: &[u8]) -> rococo_runtime:: next_free_para_id: polkadot_primitives::v2::LOWEST_PUBLIC_ID, }, xcm_pallet: Default::default(), - transaction_payment: Default::default(), bridge_rococo_grandpa: rococo_runtime::BridgeRococoGrandpaConfig { owner: Some(endowed_accounts[0].clone()), ..Default::default() @@ -1628,7 +1627,6 @@ pub fn rococo_testnet_genesis( next_free_para_id: polkadot_primitives::v2::LOWEST_PUBLIC_ID, }, xcm_pallet: Default::default(), - transaction_payment: Default::default(), bridge_rococo_grandpa: rococo_runtime::BridgeRococoGrandpaConfig { owner: Some(root_key.clone()), ..Default::default() diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index acf166a9187f..be7ef05646bd 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -146,11 +146,6 @@ impl Contains for BaseFilter { } } -type MoreThanHalfCouncil = EnsureOneOf< - EnsureRoot, - pallet_collective::EnsureProportionMoreThan, ->; - parameter_types! { pub const Version: RuntimeVersion = VERSION; pub const SS58Prefix: u8 = 2; @@ -757,6 +752,11 @@ impl pallet_collective::Config for Runtime { type WeightInfo = weights::pallet_collective_technical_committee::WeightInfo; } +type MoreThanHalfCouncil = EnsureOneOf< + EnsureRoot, + pallet_collective::EnsureProportionMoreThan, +>; + impl pallet_membership::Config for Runtime { type Event = Event; type AddOrigin = MoreThanHalfCouncil; @@ -1495,7 +1495,6 @@ construct_runtime! { Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 2, Indices: pallet_indices::{Pallet, Call, Storage, Config, Event} = 3, Balances: pallet_balances::{Pallet, Call, Storage, Config, Event} = 4, - TransactionPayment: pallet_transaction_payment::{Pallet, Storage} = 33, // Consensus support. // Authorship must be before session in order to note author in the correct session and era @@ -1503,7 +1502,6 @@ construct_runtime! { Authorship: pallet_authorship::{Pallet, Call, Storage} = 5, Staking: pallet_staking::{Pallet, Call, Storage, Config, Event} = 6, Offences: pallet_offences::{Pallet, Storage, Event} = 7, - Historical: session_historical::{Pallet} = 34, Session: pallet_session::{Pallet, Call, Storage, Event, Config} = 8, Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event, ValidateUnsigned} = 10, ImOnline: pallet_im_online::{Pallet, Call, Storage, Event, ValidateUnsigned, Config} = 11, @@ -1547,6 +1545,12 @@ construct_runtime! { // Preimage registrar. Preimage: pallet_preimage::{Pallet, Call, Storage, Event} = 32, + // Trasaction Payment module + TransactionPayment: pallet_transaction_payment::{Pallet, Storage} = 33, + + // Historical module + Historical: session_historical::{Pallet} = 34, + // Bounties modules. Bounties: pallet_bounties::{Pallet, Call, Storage, Event} = 35, ChildBounties: pallet_child_bounties = 40, diff --git a/runtime/rococo/constants/src/lib.rs b/runtime/rococo/constants/src/lib.rs index e7913fb37c3b..dd9727cea506 100644 --- a/runtime/rococo/constants/src/lib.rs +++ b/runtime/rococo/constants/src/lib.rs @@ -41,9 +41,9 @@ pub mod time { use runtime_common::prod_or_fast; pub const MILLISECS_PER_BLOCK: Moment = 6000; pub const SLOT_DURATION: Moment = MILLISECS_PER_BLOCK; - pub const EPOCH_DURATION_IN_SLOTS: BlockNumber = prod_or_fast!(1 * HOURS, 1 * MINUTES); + pub const DEFAULT_EPOCH_DURATION: BlockNumber = prod_or_fast!(1 * HOURS, 1 * MINUTES); frame_support::parameter_types! { - pub storage EpochDurationInBlocks: BlockNumber = EPOCH_DURATION_IN_SLOTS; + pub storage EpochDurationInBlocks: BlockNumber = DEFAULT_EPOCH_DURATION; } // These time units are defined in number of blocks. diff --git a/runtime/rococo/src/lib.rs b/runtime/rococo/src/lib.rs index 230f216b462b..932dd78d420b 100644 --- a/runtime/rococo/src/lib.rs +++ b/runtime/rococo/src/lib.rs @@ -48,7 +48,7 @@ use beefy_primitives::{ crypto::AuthorityId as BeefyId, mmr::{BeefyDataProvider, MmrLeafVersion}, }; -// TODO: Rococo +// TODO: Election // use frame_election_provider_support::{ // generate_solution_type, onchain, NposSolution, SequentialPhragmen, // }; @@ -56,14 +56,14 @@ use frame_support::{ construct_runtime, parameter_types, traits::{Contains, InstanceFilter, KeyOwnerProofSystem}, weights::ConstantMultiplier, - PalletId, + PalletId, RuntimeDebug }; use frame_system::EnsureRoot; use pallet_grandpa::{fg_primitives, AuthorityId as GrandpaId}; use pallet_im_online::sr25519::AuthorityId as ImOnlineId; use pallet_session::historical as session_historical; use pallet_transaction_payment::{CurrencyAdapter, FeeDetails, RuntimeDispatchInfo}; -use sp_core::{OpaqueMetadata, RuntimeDebug, H256}; +use sp_core::{OpaqueMetadata, H256}; use sp_mmr_primitives as mmr; use sp_runtime::{ create_runtime_str, generic, impl_opaque_keys, @@ -78,7 +78,7 @@ use sp_staking::SessionIndex; #[cfg(any(feature = "std", test))] use sp_version::NativeVersion; use sp_version::RuntimeVersion; -// TODO: Rococo +// TODO: Elections Phragmen // use static_assertions::const_assert; pub use frame_system::Call as SystemCall; @@ -91,24 +91,20 @@ pub use frame_system::Call as SystemCall; /// Constant values used within the runtime. use rococo_runtime_constants::{currency::*, fee::*, time::*}; - - // Weights used in the runtime. mod weights; -// TODO: Rococo +// TODO: Bags List //// Voter bag threshold definitions. // mod bag_thresholds; // XCM configurations. pub mod xcm_config; -// TODO: Rococo | not in Kusama mod validator_manager; -// TODO: Rococo | not in Kusama mod bridge_messages; -// TODO: Rococo | not in Kusama + use bridge_runtime_common::messages::{ source::estimate_message_dispatch_and_delivery_fee, MessageBridge, }; @@ -128,7 +124,7 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("rococo"), impl_name: create_runtime_str!("parity-rococo-v2.0"), - authoring_version: 0, + authoring_version: 0, // TODO: Params -> authoring_version: 2 spec_version: 9220, impl_version: 0, #[cfg(not(feature = "disable-runtime-api"))] @@ -152,6 +148,7 @@ pub fn native_version() -> NativeVersion { NativeVersion { runtime_version: VERSION, can_author_with: Default::default() } } +/// We currently allow all calls. pub struct BaseFilter; impl Contains for BaseFilter { fn contains(_call: &Call) -> bool { @@ -159,16 +156,9 @@ impl Contains for BaseFilter { } } -// TODO: Rococo -// type MoreThanHalfCouncil = EnsureOneOf< -// EnsureRoot, -// pallet_collective::EnsureProportionMoreThan, -// >; - -// TODO: Questions parameter_types! { pub const Version: RuntimeVersion = VERSION; - pub const SS58Prefix: u8 = 42; + pub const SS58Prefix: u8 = 42; // TODO: Params -> pub const SS58Prefix: u8 = 2; } impl frame_system::Config for Runtime { @@ -271,11 +261,12 @@ impl frame_system::Config for Runtime { // } parameter_types! { - pub EpochDuration: u64 = prod_or_fast!( - EPOCH_DURATION_IN_SLOTS as u64, - 2 * MINUTES as u64, - "ROC_EPOCH_DURATION" - ); + // TODO: Babe + // pub EpochDuration: u64 = prod_or_fast!( + // EPOCH_DURATION_IN_SLOTS as u64, + // 2 * MINUTES as u64, + // "ROC_EPOCH_DURATION" + // ); pub const ExpectedBlockTime: Moment = MILLISECS_PER_BLOCK; // TODO: Staking // pub ReportLongevity: u64 = @@ -284,7 +275,7 @@ parameter_types! { } impl pallet_babe::Config for Runtime { - type EpochDuration = EpochDuration; + type EpochDuration = EpochDurationInBlocks; // TODO: Babe -> type EpochDuration = EpochDuration; type ExpectedBlockTime = ExpectedBlockTime; // session module is the trigger @@ -312,7 +303,7 @@ impl pallet_babe::Config for Runtime { type MaxAuthorities = MaxAuthorities; } -// TODO: Questions +// TODO: Indices parameter_types! { pub const IndexDeposit: Balance = 1 * DOLLARS; } @@ -387,7 +378,7 @@ impl_opaque_keys! { pub para_validator: Initializer, pub para_assignment: ParaSessionInfo, pub authority_discovery: AuthorityDiscovery, - pub beefy: Beefy, // TODO: Rococo | not in Kusama + pub beefy: Beefy, } } @@ -731,8 +722,8 @@ impl pallet_collective::Config for Runtime { // TODO: Collective -> impl pallet_ type MotionDuration = MotionDuration; // TODO: Collective -> type MotionDuration = CouncilMotionDuration; type MaxProposals = MaxProposals; // TODO: Collective -> type MaxProposals = CouncilMaxProposals; type MaxMembers = MaxMembers; // TODO: Collective -> type MaxMembers = CouncilMaxMembers; - type DefaultVote = pallet_collective::PrimeDefaultVote; // TODO: Collective -> type DefaultVote = pallet_collective::PrimeDefaultVote; - type WeightInfo = weights::pallet_collective::WeightInfo; // TODO: Collective -> type WeightInfo = weights::pallet_collective_council::WeightInfo; + type DefaultVote = pallet_collective::PrimeDefaultVote; + type WeightInfo = weights::pallet_collective::WeightInfo; } // TODO: Elections Phragmen @@ -792,16 +783,22 @@ impl pallet_collective::Config for Runtime { // TODO: Collective -> impl pallet_ // type WeightInfo = weights::pallet_collective_technical_committee::WeightInfo; // } +// TODO: Membership +// type MoreThanHalfCouncil = EnsureOneOf< +// EnsureRoot, +// pallet_collective::EnsureProportionMoreThan, +// >; + impl pallet_membership::Config for Runtime { type Event = Event; type AddOrigin = EnsureRoot; // TODO: Membership -> type AddOrigin = MoreThanHalfCouncil; - type RemoveOrigin = EnsureRoot; // TODO: Membership -> type AddOrigin = MoreThanHalfCouncil; - type SwapOrigin = EnsureRoot; // TODO: Membership -> type AddOrigin = MoreThanHalfCouncil; - type ResetOrigin = EnsureRoot; // TODO: Membership -> type AddOrigin = MoreThanHalfCouncil; - type PrimeOrigin = EnsureRoot; // TODO: Membership -> type AddOrigin = MoreThanHalfCouncil; - type MembershipInitialized = Collective; // TODO: Membership -> type AddOrigin = TechnicalCommittee; - type MembershipChanged = Collective; // TODO: Membership -> type AddOrigin = TechnicalCommittee; - type MaxMembers = MaxMembers; // TODO: Membership -> type AddOrigin = TechnicalMaxMembers; + type RemoveOrigin = EnsureRoot; // TODO: Membership -> type RemoveOrigin = MoreThanHalfCouncil; + type SwapOrigin = EnsureRoot; // TODO: Membership -> type SwapOrigin = MoreThanHalfCouncil; + type ResetOrigin = EnsureRoot; // TODO: Membership -> type ResetOrigin = MoreThanHalfCouncil; + type PrimeOrigin = EnsureRoot; // TODO: Membership -> type PrimeOrigin = MoreThanHalfCouncil; + type MembershipInitialized = Collective; // TODO: Membership -> type MembershipInitialized = TechnicalCommittee; + type MembershipChanged = Collective; // TODO: Membership -> type MembershipChanged = TechnicalCommittee; + type MaxMembers = MaxMembers; // TODO: Membership -> type MaxMembers = TechnicalMaxMembers; type WeightInfo = weights::pallet_membership::WeightInfo; } @@ -1024,8 +1021,8 @@ impl frame_system::offchain::SendTransactionTypes for Runtime where Call: From, { - type OverarchingCall = Call; type Extrinsic = UncheckedExtrinsic; + type OverarchingCall = Call; } // TODO: Claims @@ -1422,7 +1419,7 @@ impl slots::Config for Runtime { type Registrar = Registrar; type LeasePeriod = LeasePeriod; type LeaseOffset = (); - type ForceOrigin = EnsureRoot; + type ForceOrigin = EnsureRoot; // TODO: Slots -> type ForceOrigin = MoreThanHalfCouncil; type WeightInfo = weights::runtime_common_slots::WeightInfo; } @@ -1809,7 +1806,6 @@ construct_runtime! { Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 2, Indices: pallet_indices::{Pallet, Call, Storage, Config, Event} = 3, Balances: pallet_balances::{Pallet, Call, Storage, Config, Event} = 4, - TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Config} = 33, // Consensus support. // Authorship must be before session in order to note author in the correct session and era @@ -1818,7 +1814,6 @@ construct_runtime! { // TODO: Staking // Staking: pallet_staking::{Pallet, Call, Storage, Config, Event} = 6, Offences: pallet_offences::{Pallet, Storage, Event} = 7, - Historical: session_historical::{Pallet} = 34, Session: pallet_session::{Pallet, Call, Storage, Event, Config} = 8, Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event, ValidateUnsigned} = 10, ImOnline: pallet_im_online::{Pallet, Call, Storage, Event, ValidateUnsigned, Config} = 11, @@ -1829,7 +1824,6 @@ construct_runtime! { // Democracy: pallet_democracy::{Pallet, Call, Storage, Config, Event} = 13, // TODO: Collective -> Council: pallet_collective::::{Pallet, Call, Storage, Origin, Event, Config} = 14, Collective: pallet_collective::{Pallet, Call, Storage, Origin, Event, Config} = 14, - // Council: pallet_collective::::{Pallet, Call, Storage, Origin, Event, Config} = 14, // TODO: Collective // TechnicalCommittee: pallet_collective::::{Pallet, Call, Storage, Origin, Event, Config} = 15, // TODO: Elections Prhargmen @@ -1877,6 +1871,12 @@ construct_runtime! { //// Preimage registrar. // Preimage: pallet_preimage::{Pallet, Call, Storage, Event} = 32, + // Trasaction Payment module + TransactionPayment: pallet_transaction_payment::{Pallet, Storage} = 33, + + // Historical module + Historical: session_historical::{Pallet} = 34, + // TODO: Bounties //// Bounties modules. // Bounties: pallet_bounties::{Pallet, Call, Storage, Event} = 35, @@ -1928,7 +1928,7 @@ construct_runtime! { XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event, Origin, Config} = 99, // Rococo specific pallets (not included in Kusama). Start indices at 240 - + // // BEEFY Bridges support. Beefy: pallet_beefy::{Pallet, Storage, Config} = 240, Mmr: pallet_mmr::{Pallet, Storage} = 241, @@ -2360,7 +2360,7 @@ sp_api::impl_runtime_apis! { // babe_primitives::BabeGenesisConfiguration { slot_duration: Babe::slot_duration(), - epoch_length: EpochDuration::get().into(), + epoch_length: EpochDurationInBlocks::get().into(), // TODO: Babe -> epoch_length: EpochDuration::get().into() c: BABE_GENESIS_EPOCH_CONFIG.c, genesis_authorities: Babe::authorities().to_vec(), randomness: Babe::randomness(), From db8b128bd3875d3c0d0dbbcb7b91744df9ec6486 Mon Sep 17 00:00:00 2001 From: al3mart Date: Thu, 16 Jun 2022 19:04:00 +0200 Subject: [PATCH 03/35] Substitue DOLLARS with UNITS --- runtime/rococo/constants/src/lib.rs | 13 ++++++------- runtime/rococo/src/lib.rs | 8 ++++---- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/runtime/rococo/constants/src/lib.rs b/runtime/rococo/constants/src/lib.rs index dd9727cea506..cb2dc15fade3 100644 --- a/runtime/rococo/constants/src/lib.rs +++ b/runtime/rococo/constants/src/lib.rs @@ -26,12 +26,11 @@ pub mod currency { pub const EXISTENTIAL_DEPOSIT: Balance = 1 * CENTS; pub const UNITS: Balance = 1_000_000_000_000; - pub const CENTS: Balance = DOLLARS / 100; - pub const DOLLARS: Balance = UNITS; + pub const CENTS: Balance = UNITS / 100; pub const MILLICENTS: Balance = CENTS / 1_000; pub const fn deposit(items: u32, bytes: u32) -> Balance { - items as Balance * 1 * DOLLARS + (bytes as Balance) * 5 * MILLICENTS + items as Balance * 1 * UNITS + (bytes as Balance) * 5 * MILLICENTS } } @@ -98,7 +97,7 @@ pub mod fee { #[cfg(test)] mod tests { use super::{ - currency::{CENTS, DOLLARS, MILLICENTS}, + currency::{CENTS, UNITRS, MILLICENTS}, fee::WeightToFee, }; use crate::weights::ExtrinsicBaseWeight; @@ -108,10 +107,10 @@ mod tests { #[test] // Test that the fee for `MAXIMUM_BLOCK_WEIGHT` of weight has sane bounds. fn full_block_fee_is_correct() { - // A full block should cost between 10 and 100 DOLLARS. + // A full block should cost between 10 and 100 UNITS. let full_block = WeightToFee::calc(&MAXIMUM_BLOCK_WEIGHT); - assert!(full_block >= 10 * DOLLARS); - assert!(full_block <= 100 * DOLLARS); + assert!(full_block >= 10 * UNITS); + assert!(full_block <= 100 * UNITS); } #[test] diff --git a/runtime/rococo/src/lib.rs b/runtime/rococo/src/lib.rs index 932dd78d420b..60eb764a473d 100644 --- a/runtime/rococo/src/lib.rs +++ b/runtime/rococo/src/lib.rs @@ -305,7 +305,7 @@ impl pallet_babe::Config for Runtime { // TODO: Indices parameter_types! { - pub const IndexDeposit: Balance = 1 * DOLLARS; + pub const IndexDeposit: Balance = 1 * UNITS; } impl pallet_indices::Config for Runtime { @@ -1395,7 +1395,7 @@ impl parachains_disputes::Config for Runtime { } parameter_types! { - pub const ParaDeposit: Balance = 5 * DOLLARS; + pub const ParaDeposit: Balance = 5 * UNITS; pub const DataDepositPerByte: Balance = deposit(0, 1); // TODO: Registar -> The value is defined in Treasury params } @@ -1425,8 +1425,8 @@ impl slots::Config for Runtime { parameter_types! { pub const CrowdloanId: PalletId = PalletId(*b"py/cfund"); - pub const SubmissionDeposit: Balance = 100 * DOLLARS; // TODO: Crowdloan -> pub const SubmissionDeposit: Balance = 3 * GRAND; - pub const MinContribution: Balance = 1 * DOLLARS; // TODO: Crowdloan -> pub const MinContribution: Balance = 3_000 * CENTS; + pub const SubmissionDeposit: Balance = 100 * UNITS; // TODO: Crowdloan -> pub const SubmissionDeposit: Balance = 3 * GRAND; + pub const MinContribution: Balance = 1 * UNITS; // TODO: Crowdloan -> pub const MinContribution: Balance = 3_000 * CENTS; pub const RemoveKeysLimit: u32 = 500; // TODO: Crowdloan -> pub const RemoveKeysLimit: u32 = 1000; // Allow 32 bytes for an additional memo to a crowdloan. pub const MaxMemoLength: u8 = 32; From e074eb0d592341ce4e3d1aa45bd2cb74404a16f3 Mon Sep 17 00:00:00 2001 From: al3mart Date: Thu, 16 Jun 2022 19:07:00 +0200 Subject: [PATCH 04/35] money constatns to mirror Kusama --- runtime/rococo/constants/src/lib.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/runtime/rococo/constants/src/lib.rs b/runtime/rococo/constants/src/lib.rs index cb2dc15fade3..7e541e3a4d9b 100644 --- a/runtime/rococo/constants/src/lib.rs +++ b/runtime/rococo/constants/src/lib.rs @@ -26,12 +26,13 @@ pub mod currency { pub const EXISTENTIAL_DEPOSIT: Balance = 1 * CENTS; pub const UNITS: Balance = 1_000_000_000_000; - pub const CENTS: Balance = UNITS / 100; + pub const CENTS: Balance = UNITS / 30_000; pub const MILLICENTS: Balance = CENTS / 1_000; + pub const GRAND: Balance = CENTS * 100_000; pub const fn deposit(items: u32, bytes: u32) -> Balance { - items as Balance * 1 * UNITS + (bytes as Balance) * 5 * MILLICENTS - } + items as Balance * 2_000 * CENTS + (bytes as Balance) * 100 * MILLICENTS +} } /// Time and blocks. From 1aa6ac02e2cb545a6f467556dc4b42992d8fa146 Mon Sep 17 00:00:00 2001 From: al3mart Date: Thu, 16 Jun 2022 19:13:18 +0200 Subject: [PATCH 05/35] fixing typo in test --- runtime/rococo/constants/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/rococo/constants/src/lib.rs b/runtime/rococo/constants/src/lib.rs index 7e541e3a4d9b..b9826045351b 100644 --- a/runtime/rococo/constants/src/lib.rs +++ b/runtime/rococo/constants/src/lib.rs @@ -98,7 +98,7 @@ pub mod fee { #[cfg(test)] mod tests { use super::{ - currency::{CENTS, UNITRS, MILLICENTS}, + currency::{CENTS, UNITS, MILLICENTS}, fee::WeightToFee, }; use crate::weights::ExtrinsicBaseWeight; From 8aac79d1cabeca7d11fdd4570b4a8b70db66e08c Mon Sep 17 00:00:00 2001 From: NachoPal Date: Mon, 20 Jun 2022 18:56:58 +0200 Subject: [PATCH 06/35] scheduler+collective+membership+preimage --- Cargo.lock | 2 + node/service/src/chain_spec.rs | 16 +- runtime/rococo/Cargo.toml | 10 + runtime/rococo/src/lib.rs | 242 ++++++++---------- runtime/rococo/src/weights/mod.rs | 3 + .../pallet_collective_technical_committee.rs | 176 +++++++++++++ runtime/rococo/src/weights/pallet_preimage.rs | 132 ++++++++++ .../rococo/src/weights/pallet_scheduler.rs | 193 ++++++++++++++ runtime/rococo/src/weights/xcm/mod.rs | 4 +- .../xcm/pallet_xcm_benchmarks_fungible.rs | 6 +- .../xcm/pallet_xcm_benchmarks_generic.rs | 6 +- runtime/rococo/src/xcm_config.rs | 8 +- 12 files changed, 649 insertions(+), 149 deletions(-) create mode 100644 runtime/rococo/src/weights/pallet_collective_technical_committee.rs create mode 100644 runtime/rococo/src/weights/pallet_preimage.rs create mode 100644 runtime/rococo/src/weights/pallet_scheduler.rs diff --git a/Cargo.lock b/Cargo.lock index c0fd790cdff1..259190f4ca1a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8392,7 +8392,9 @@ dependencies = [ "pallet-mmr", "pallet-multisig", "pallet-offences", + "pallet-preimage", "pallet-proxy", + "pallet-scheduler", "pallet-session", "pallet-staking", "pallet-sudo", diff --git a/node/service/src/chain_spec.rs b/node/service/src/chain_spec.rs index f2e1c75bd20b..90413b6dfe08 100644 --- a/node/service/src/chain_spec.rs +++ b/node/service/src/chain_spec.rs @@ -1052,8 +1052,12 @@ fn rococo_staging_testnet_config_genesis(wasm_binary: &[u8]) -> rococo_runtime:: }, grandpa: Default::default(), im_online: Default::default(), - collective: Default::default(), - membership: Default::default(), + council: rococo::CouncilConfig { members: vec![], phantom: Default::default() }, + technical_committee: rococo::TechnicalCommitteeConfig { + members: vec![], + phantom: Default::default(), + }, + technical_membership: Default::default(), authority_discovery: rococo_runtime::AuthorityDiscoveryConfig { keys: vec![] }, sudo: rococo_runtime::SudoConfig { key: Some(endowed_accounts[0].clone()) }, paras: rococo_runtime::ParasConfig { paras: vec![] }, @@ -1611,8 +1615,12 @@ pub fn rococo_testnet_genesis( }, grandpa: Default::default(), im_online: Default::default(), - collective: Default::default(), - membership: Default::default(), + council: rococo::CouncilConfig { members: vec![], phantom: Default::default() }, + technical_committee: rococo::TechnicalCommitteeConfig { + members: vec![], + phantom: Default::default(), + }, + technical_membership: Default::default(), authority_discovery: rococo_runtime::AuthorityDiscoveryConfig { keys: vec![] }, sudo: rococo_runtime::SudoConfig { key: Some(root_key.clone()) }, hrmp: Default::default(), diff --git a/runtime/rococo/Cargo.toml b/runtime/rococo/Cargo.toml index c8b1d16a75a1..95c294490780 100644 --- a/runtime/rococo/Cargo.toml +++ b/runtime/rococo/Cargo.toml @@ -54,6 +54,8 @@ pallet-sudo = { git = "https://github.com/paritytech/substrate", branch = "maste pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-offences = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-proxy = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-scheduler = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-preimage = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-utility = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } authority-discovery-primitives = { package = "sp-authority-discovery", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -127,6 +129,9 @@ std = [ "pallet-timestamp/std", "pallet-transaction-payment/std", "pallet-transaction-payment-rpc-runtime-api/std", + "pallet-collective/std", + "pallet-scheduler/std", + "pallet-preimage/std", "inherents/std", "frame-support/std", "polkadot-parachain/std", @@ -171,6 +176,8 @@ runtime-benchmarks = [ "pallet-babe/runtime-benchmarks", "pallet-balances/runtime-benchmarks", "pallet-collective/runtime-benchmarks", + "pallet-collective/std", + "pallet-preimage/runtime-benchmarks", "pallet-grandpa/runtime-benchmarks", "pallet-im-online/runtime-benchmarks", "pallet-indices/runtime-benchmarks", @@ -186,6 +193,7 @@ runtime-benchmarks = [ "hex-literal", "frame-system-benchmarking", "runtime-parachains/runtime-benchmarks", + "pallet-scheduler/runtime-benchmarks", ] try-runtime = [ "frame-executive/try-runtime", @@ -207,8 +215,10 @@ try-runtime = [ "pallet-offences/try-runtime", "pallet-timestamp/try-runtime", "pallet-transaction-payment/try-runtime", + "pallet-collective/try-runtime", "runtime-common/try-runtime", "pallet-multisig/try-runtime", + "pallet-scheduler/try-runtime", ] # Set timing constants (e.g. session period) to faster versions to speed up testing. diff --git a/runtime/rococo/src/lib.rs b/runtime/rococo/src/lib.rs index 932dd78d420b..918fad16226d 100644 --- a/runtime/rococo/src/lib.rs +++ b/runtime/rococo/src/lib.rs @@ -32,7 +32,7 @@ use runtime_common::{ assigned_slots, auctions, crowdloan, impl_runtime_weights, impls::ToAuthor, paras_registrar, prod_or_fast, paras_sudo_wrapper, slots, BlockHashCount, BlockLength, SlowAdjustingFeeUpdate, }; -use sp_std::{collections::btree_map::BTreeMap, prelude::*}; +use sp_std::{cmp::Ordering, collections::btree_map::BTreeMap, prelude::*}; use runtime_parachains::{ configuration as parachains_configuration, disputes as parachains_disputes, @@ -54,7 +54,7 @@ use beefy_primitives::{ // }; use frame_support::{ construct_runtime, parameter_types, - traits::{Contains, InstanceFilter, KeyOwnerProofSystem}, + traits::{Contains, EnsureOneOf, InstanceFilter, KeyOwnerProofSystem, PrivilegeCmp}, weights::ConstantMultiplier, PalletId, RuntimeDebug }; @@ -94,10 +94,6 @@ use rococo_runtime_constants::{currency::*, fee::*, time::*}; // Weights used in the runtime. mod weights; -// TODO: Bags List -//// Voter bag threshold definitions. -// mod bag_thresholds; - // XCM configurations. pub mod xcm_config; @@ -188,77 +184,70 @@ impl frame_system::Config for Runtime { type MaxConsumers = frame_support::traits::ConstU32<16>; } -// TODO: Scheduler -// parameter_types! { -// pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * -// BlockWeights::get().max_block; -// pub const MaxScheduledPerBlock: u32 = 50; -// pub const NoPreimagePostponement: Option = Some(10); -// } +parameter_types! { + pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * + BlockWeights::get().max_block; + pub const MaxScheduledPerBlock: u32 = 50; + pub const NoPreimagePostponement: Option = Some(10); +} -// TODO: Scheduler -// type ScheduleOrigin = EnsureOneOf< -// EnsureRoot, -// pallet_collective::EnsureProportionAtLeast, -// >; +type ScheduleOrigin = EnsureOneOf< + EnsureRoot, + pallet_collective::EnsureProportionAtLeast, +>; -// TODO: Scheduler -///// Used the compare the privilege of an origin inside the scheduler. -// pub struct OriginPrivilegeCmp; +/// Used the compare the privilege of an origin inside the scheduler. +pub struct OriginPrivilegeCmp; -// TODO: Scheduler -// impl PrivilegeCmp for OriginPrivilegeCmp { -// fn cmp_privilege(left: &OriginCaller, right: &OriginCaller) -> Option { -// if left == right { -// return Some(Ordering::Equal) -// } +impl PrivilegeCmp for OriginPrivilegeCmp { + fn cmp_privilege(left: &OriginCaller, right: &OriginCaller) -> Option { + if left == right { + return Some(Ordering::Equal) + } -// match (left, right) { -// // Root is greater than anything. -// (OriginCaller::system(frame_system::RawOrigin::Root), _) => Some(Ordering::Greater), -// // Check which one has more yes votes. -// ( -// OriginCaller::Council(pallet_collective::RawOrigin::Members(l_yes_votes, l_count)), -// OriginCaller::Council(pallet_collective::RawOrigin::Members(r_yes_votes, r_count)), -// ) => Some((l_yes_votes * r_count).cmp(&(r_yes_votes * l_count))), -// // For every other origin we don't care, as they are not used for `ScheduleOrigin`. -// _ => None, -// } -// } -// } + match (left, right) { + // Root is greater than anything. + (OriginCaller::system(frame_system::RawOrigin::Root), _) => Some(Ordering::Greater), + // Check which one has more yes votes. + ( + OriginCaller::Council(pallet_collective::RawOrigin::Members(l_yes_votes, l_count)), + OriginCaller::Council(pallet_collective::RawOrigin::Members(r_yes_votes, r_count)), + ) => Some((l_yes_votes * r_count).cmp(&(r_yes_votes * l_count))), + // For every other origin we don't care, as they are not used for `ScheduleOrigin`. + _ => None, + } + } +} -// TODO: Scheduler -// impl pallet_scheduler::Config for Runtime { -// type Event = Event; -// type Origin = Origin; -// type PalletsOrigin = OriginCaller; -// type Call = Call; -// type MaximumWeight = MaximumSchedulerWeight; -// type ScheduleOrigin = ScheduleOrigin; -// type MaxScheduledPerBlock = MaxScheduledPerBlock; -// type WeightInfo = weights::pallet_scheduler::WeightInfo; -// type OriginPrivilegeCmp = OriginPrivilegeCmp; -// type PreimageProvider = Preimage; -// type NoPreimagePostponement = NoPreimagePostponement; -// } +impl pallet_scheduler::Config for Runtime { + type Event = Event; + type Origin = Origin; + type PalletsOrigin = OriginCaller; + type Call = Call; + type MaximumWeight = MaximumSchedulerWeight; + type ScheduleOrigin = ScheduleOrigin; + type MaxScheduledPerBlock = MaxScheduledPerBlock; + type WeightInfo = weights::pallet_scheduler::WeightInfo; + type OriginPrivilegeCmp = OriginPrivilegeCmp; + type PreimageProvider = Preimage; + type NoPreimagePostponement = NoPreimagePostponement; +} -// TODO: Preimage -// parameter_types! { -// pub const PreimageMaxSize: u32 = 4096 * 1024; -// pub const PreimageBaseDeposit: Balance = deposit(2, 64); -// pub const PreimageByteDeposit: Balance = deposit(0, 1); -// } +parameter_types! { + pub const PreimageMaxSize: u32 = 4096 * 1024; + pub const PreimageBaseDeposit: Balance = deposit(2, 64); + pub const PreimageByteDeposit: Balance = deposit(0, 1); +} -// TODO: Preimage -// impl pallet_preimage::Config for Runtime { -// type WeightInfo = weights::pallet_preimage::WeightInfo; -// type Event = Event; -// type Currency = Balances; -// type ManagerOrigin = EnsureRoot; -// type MaxSize = PreimageMaxSize; -// type BaseDeposit = PreimageBaseDeposit; -// type ByteDeposit = PreimageByteDeposit; -// } +impl pallet_preimage::Config for Runtime { + type WeightInfo = weights::pallet_preimage::WeightInfo; + type Event = Event; + type Currency = Balances; + type ManagerOrigin = EnsureRoot; + type MaxSize = PreimageMaxSize; + type BaseDeposit = PreimageBaseDeposit; + type ByteDeposit = PreimageByteDeposit; +} parameter_types! { // TODO: Babe @@ -708,20 +697,19 @@ impl pallet_session::historical::Config for Runtime { // } parameter_types! { - pub const MotionDuration: BlockNumber = 5; - pub const MaxProposals: u32 = 100; - pub const MaxMembers: u32 = 100; + pub CouncilMotionDuration: BlockNumber = prod_or_fast!(3 * DAYS, 2 * MINUTES, "ROC_MOTION_DURATION"); + pub const CouncilMaxProposals: u32 = 100; + pub const CouncilMaxMembers: u32 = 100; } -// TODO: Collective -// type CouncilCollective = pallet_collective::Instance1; -impl pallet_collective::Config for Runtime { // TODO: Collective -> impl pallet_collective::Config for Runtime { +type CouncilCollective = pallet_collective::Instance1; +impl pallet_collective::Config for Runtime { type Origin = Origin; type Proposal = Call; type Event = Event; - type MotionDuration = MotionDuration; // TODO: Collective -> type MotionDuration = CouncilMotionDuration; - type MaxProposals = MaxProposals; // TODO: Collective -> type MaxProposals = CouncilMaxProposals; - type MaxMembers = MaxMembers; // TODO: Collective -> type MaxMembers = CouncilMaxMembers; + type MotionDuration = CouncilMotionDuration; + type MaxProposals = CouncilMaxProposals; + type MaxMembers = CouncilMaxMembers; type DefaultVote = pallet_collective::PrimeDefaultVote; type WeightInfo = weights::pallet_collective::WeightInfo; } @@ -763,42 +751,39 @@ impl pallet_collective::Config for Runtime { // TODO: Collective -> impl pallet_ // type WeightInfo = weights::pallet_elections_phragmen::WeightInfo; // } -// TODO: Collective -// parameter_types! { -// pub TechnicalMotionDuration: BlockNumber = prod_or_fast!(3 * DAYS, 2 * MINUTES, "KSM_MOTION_DURATION"); -// pub const TechnicalMaxProposals: u32 = 100; -// pub const TechnicalMaxMembers: u32 = 100; -// } +parameter_types! { + pub TechnicalMotionDuration: BlockNumber = prod_or_fast!(3 * DAYS, 2 * MINUTES, "KSM_MOTION_DURATION"); + pub const TechnicalMaxProposals: u32 = 100; + pub const TechnicalMaxMembers: u32 = 100; +} -// TODO: Collective -// type TechnicalCollective = pallet_collective::Instance2; -// impl pallet_collective::Config for Runtime { -// type Origin = Origin; -// type Proposal = Call; -// type Event = Event; -// type MotionDuration = TechnicalMotionDuration; -// type MaxProposals = TechnicalMaxProposals; -// type MaxMembers = TechnicalMaxMembers; -// type DefaultVote = pallet_collective::PrimeDefaultVote; -// type WeightInfo = weights::pallet_collective_technical_committee::WeightInfo; -// } +type TechnicalCollective = pallet_collective::Instance2; +impl pallet_collective::Config for Runtime { + type Origin = Origin; + type Proposal = Call; + type Event = Event; + type MotionDuration = TechnicalMotionDuration; + type MaxProposals = TechnicalMaxProposals; + type MaxMembers = TechnicalMaxMembers; + type DefaultVote = pallet_collective::PrimeDefaultVote; + type WeightInfo = weights::pallet_collective_technical_committee::WeightInfo; +} -// TODO: Membership -// type MoreThanHalfCouncil = EnsureOneOf< -// EnsureRoot, -// pallet_collective::EnsureProportionMoreThan, -// >; +type MoreThanHalfCouncil = EnsureOneOf< + EnsureRoot, + pallet_collective::EnsureProportionMoreThan, +>; -impl pallet_membership::Config for Runtime { +impl pallet_membership::Config for Runtime { type Event = Event; - type AddOrigin = EnsureRoot; // TODO: Membership -> type AddOrigin = MoreThanHalfCouncil; - type RemoveOrigin = EnsureRoot; // TODO: Membership -> type RemoveOrigin = MoreThanHalfCouncil; - type SwapOrigin = EnsureRoot; // TODO: Membership -> type SwapOrigin = MoreThanHalfCouncil; - type ResetOrigin = EnsureRoot; // TODO: Membership -> type ResetOrigin = MoreThanHalfCouncil; - type PrimeOrigin = EnsureRoot; // TODO: Membership -> type PrimeOrigin = MoreThanHalfCouncil; - type MembershipInitialized = Collective; // TODO: Membership -> type MembershipInitialized = TechnicalCommittee; - type MembershipChanged = Collective; // TODO: Membership -> type MembershipChanged = TechnicalCommittee; - type MaxMembers = MaxMembers; // TODO: Membership -> type MaxMembers = TechnicalMaxMembers; + type AddOrigin = MoreThanHalfCouncil; + type RemoveOrigin = MoreThanHalfCouncil; + type SwapOrigin = MoreThanHalfCouncil; + type ResetOrigin = MoreThanHalfCouncil; + type PrimeOrigin = MoreThanHalfCouncil; + type MembershipInitialized = TechnicalCommittee; + type MembershipChanged = TechnicalCommittee; + type MaxMembers = TechnicalMaxMembers; type WeightInfo = weights::pallet_membership::WeightInfo; } @@ -1822,15 +1807,11 @@ construct_runtime! { // Governance stuff; uncallable initially. // TODO: Democracy // Democracy: pallet_democracy::{Pallet, Call, Storage, Config, Event} = 13, - // TODO: Collective -> Council: pallet_collective::::{Pallet, Call, Storage, Origin, Event, Config} = 14, - Collective: pallet_collective::{Pallet, Call, Storage, Origin, Event, Config} = 14, - // TODO: Collective - // TechnicalCommittee: pallet_collective::::{Pallet, Call, Storage, Origin, Event, Config} = 15, + Council: pallet_collective::::{Pallet, Call, Storage, Origin, Event, Config} = 14, + TechnicalCommittee: pallet_collective::::{Pallet, Call, Storage, Origin, Event, Config} = 15, // TODO: Elections Prhargmen // PhragmenElection: pallet_elections_phragmen::{Pallet, Call, Storage, Event, Config} = 16, - // Membership: pallet_membership = 80, // TODO: Membership - // TODO: Membership -> pallet_membership::::{Pallet, Call, Storage, Event, Config} = 17, - Membership: pallet_membership::{Pallet, Call, Storage, Event, Config} = 17, + TechnicalMembership: pallet_membership::::{Pallet, Call, Storage, Event, Config} = 17, // TODO: Treasury // Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event} = 18, @@ -1857,9 +1838,8 @@ construct_runtime! { //// Vesting. Usable initially, but removed once all vesting is finished. // Vesting: pallet_vesting::{Pallet, Call, Storage, Event, Config} = 28, - // TODO: Scheduler - //// System scheduler. - // Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event} = 29, + // System scheduler. + Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event} = 29, // Proxy module. Late addition. Proxy: pallet_proxy::{Pallet, Call, Storage, Event} = 30, @@ -1867,9 +1847,8 @@ construct_runtime! { // Multisig module. Late addition. Multisig: pallet_multisig::{Pallet, Call, Storage, Event} = 31, - // TODO: Preimage - //// Preimage registrar. - // Preimage: pallet_preimage::{Pallet, Call, Storage, Event} = 32, + // Preimage registrar. + Preimage: pallet_preimage::{Pallet, Call, Storage, Event} = 32, // Trasaction Payment module TransactionPayment: pallet_transaction_payment::{Pallet, Storage} = 33, @@ -2035,9 +2014,8 @@ mod benches { // [pallet_bounties, Bounties] // TODO: Vhild Bounties // [pallet_child_bounties, ChildBounties] - [pallet_collective, Collective] // TODO: Collective -> [pallet_collective, Council] - // TODO: Collective - // [pallet_collective, TechnicalCommittee] + [pallet_collective, Council] + [pallet_collective, TechnicalCommittee] // TODO: Democracy // [pallet_democracy, Democracy] // TODO: Elections Phragmen @@ -2051,18 +2029,16 @@ mod benches { // [pallet_identity, Identity] [pallet_im_online, ImOnline] [pallet_indices, Indices] - [pallet_membership, Membership] // TODO: Membership -> [pallet_membership, TechnicalMembership + [pallet_membership, TechnicalMembership] [pallet_multisig, Multisig] // TODO: Nomination // [pallet_nomination_pools, NominationPoolsBench::] [pallet_offences, OffencesBench::] - // TODO: Preimage - // [pallet_preimage, Preimage] + [pallet_preimage, Preimage] [pallet_proxy, Proxy] // TODO: Recovery // [pallet_recovery, Recovery] - // TODO: Scheduler - // [pallet_scheduler, Scheduler] + [pallet_scheduler, Scheduler] // TODO: Session // [pallet_session, SessionBench::] // TODO: Staking @@ -2591,7 +2567,7 @@ sp_api::impl_runtime_apis! { Ok(Statemine::get()) } fn worst_case_holding() -> MultiAssets { - // Kusama only knows about KSM. + // Rococo only knows about ROC vec![MultiAsset{ id: Concrete(KsmLocation::get()), fun: Fungible(1_000_000 * UNITS), diff --git a/runtime/rococo/src/weights/mod.rs b/runtime/rococo/src/weights/mod.rs index 04f860bb36da..af1a1f2d7fdc 100644 --- a/runtime/rococo/src/weights/mod.rs +++ b/runtime/rococo/src/weights/mod.rs @@ -26,6 +26,9 @@ pub mod pallet_proxy; pub mod pallet_session; pub mod pallet_timestamp; pub mod pallet_utility; +pub mod pallet_scheduler; +pub mod pallet_preimage; +pub mod pallet_collective_technical_committee; pub mod runtime_common_auctions; pub mod runtime_common_crowdloan; pub mod runtime_common_paras_registrar; diff --git a/runtime/rococo/src/weights/pallet_collective_technical_committee.rs b/runtime/rococo/src/weights/pallet_collective_technical_committee.rs new file mode 100644 index 000000000000..1cf3f29ff5cd --- /dev/null +++ b/runtime/rococo/src/weights/pallet_collective_technical_committee.rs @@ -0,0 +1,176 @@ +// Copyright 2017-2021 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_collective` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2021-08-27, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 128 + +// Executed Command: +// target/release/polkadot +// benchmark +// --chain=rococo-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_collective +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/rococo/src/weights/ + + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_collective`. +pub struct WeightInfo(PhantomData); +impl pallet_collective::WeightInfo for WeightInfo { + // Storage: Instance2Collective Members (r:1 w:1) + // Storage: Instance2Collective Proposals (r:1 w:0) + // Storage: Instance2Collective Voting (r:100 w:100) + // Storage: Instance2Collective Prime (r:0 w:1) + fn set_members(m: u32, n: u32, p: u32, ) -> Weight { + (0 as Weight) + // Standard Error: 6_000 + .saturating_add((14_473_000 as Weight).saturating_mul(m as Weight)) + // Standard Error: 6_000 + .saturating_add((73_000 as Weight).saturating_mul(n as Weight)) + // Standard Error: 6_000 + .saturating_add((19_551_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(p as Weight))) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(p as Weight))) + } + // Storage: Instance2Collective Members (r:1 w:0) + fn execute(b: u32, m: u32, ) -> Weight { + (22_690_000 as Weight) + // Standard Error: 0 + .saturating_add((3_000 as Weight).saturating_mul(b as Weight)) + // Standard Error: 0 + .saturating_add((80_000 as Weight).saturating_mul(m as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + } + // Storage: Instance2Collective Members (r:1 w:0) + // Storage: Instance2Collective ProposalOf (r:1 w:0) + fn propose_execute(b: u32, m: u32, ) -> Weight { + (27_473_000 as Weight) + // Standard Error: 0 + .saturating_add((3_000 as Weight).saturating_mul(b as Weight)) + // Standard Error: 0 + .saturating_add((159_000 as Weight).saturating_mul(m as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + } + // Storage: Instance2Collective Members (r:1 w:0) + // Storage: Instance2Collective ProposalOf (r:1 w:1) + // Storage: Instance2Collective Proposals (r:1 w:1) + // Storage: Instance2Collective ProposalCount (r:1 w:1) + // Storage: Instance2Collective Voting (r:0 w:1) + fn propose_proposed(b: u32, m: u32, p: u32, ) -> Weight { + (42_047_000 as Weight) + // Standard Error: 0 + .saturating_add((4_000 as Weight).saturating_mul(b as Weight)) + // Standard Error: 0 + .saturating_add((85_000 as Weight).saturating_mul(m as Weight)) + // Standard Error: 0 + .saturating_add((360_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(4 as Weight)) + .saturating_add(T::DbWeight::get().writes(4 as Weight)) + } + // Storage: Instance2Collective Members (r:1 w:0) + // Storage: Instance2Collective Voting (r:1 w:1) + fn vote(m: u32, ) -> Weight { + (32_023_000 as Weight) + // Standard Error: 0 + .saturating_add((199_000 as Weight).saturating_mul(m as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Instance2Collective Voting (r:1 w:1) + // Storage: Instance2Collective Members (r:1 w:0) + // Storage: Instance2Collective Proposals (r:1 w:1) + // Storage: Instance2Collective ProposalOf (r:0 w:1) + fn close_early_disapproved(m: u32, p: u32, ) -> Weight { + (41_107_000 as Weight) + // Standard Error: 0 + .saturating_add((171_000 as Weight).saturating_mul(m as Weight)) + // Standard Error: 0 + .saturating_add((332_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + // Storage: Instance2Collective Voting (r:1 w:1) + // Storage: Instance2Collective Members (r:1 w:0) + // Storage: Instance2Collective ProposalOf (r:1 w:1) + // Storage: Instance2Collective Proposals (r:1 w:1) + fn close_early_approved(b: u32, m: u32, p: u32, ) -> Weight { + (57_783_000 as Weight) + // Standard Error: 0 + .saturating_add((2_000 as Weight).saturating_mul(b as Weight)) + // Standard Error: 0 + .saturating_add((167_000 as Weight).saturating_mul(m as Weight)) + // Standard Error: 0 + .saturating_add((336_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(4 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + // Storage: Instance2Collective Voting (r:1 w:1) + // Storage: Instance2Collective Members (r:1 w:0) + // Storage: Instance2Collective Prime (r:1 w:0) + // Storage: Instance2Collective Proposals (r:1 w:1) + // Storage: Instance2Collective ProposalOf (r:0 w:1) + fn close_disapproved(m: u32, p: u32, ) -> Weight { + (45_646_000 as Weight) + // Standard Error: 0 + .saturating_add((170_000 as Weight).saturating_mul(m as Weight)) + // Standard Error: 0 + .saturating_add((335_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(4 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + // Storage: Instance2Collective Voting (r:1 w:1) + // Storage: Instance2Collective Members (r:1 w:0) + // Storage: Instance2Collective Prime (r:1 w:0) + // Storage: Instance2Collective ProposalOf (r:1 w:1) + // Storage: Instance2Collective Proposals (r:1 w:1) + fn close_approved(b: u32, m: u32, p: u32, ) -> Weight { + (61_376_000 as Weight) + // Standard Error: 0 + .saturating_add((2_000 as Weight).saturating_mul(b as Weight)) + // Standard Error: 0 + .saturating_add((172_000 as Weight).saturating_mul(m as Weight)) + // Standard Error: 0 + .saturating_add((339_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(5 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + // Storage: Instance2Collective Proposals (r:1 w:1) + // Storage: Instance2Collective Voting (r:0 w:1) + // Storage: Instance2Collective ProposalOf (r:0 w:1) + fn disapprove_proposal(p: u32, ) -> Weight { + (25_286_000 as Weight) + // Standard Error: 0 + .saturating_add((336_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } +} diff --git a/runtime/rococo/src/weights/pallet_preimage.rs b/runtime/rococo/src/weights/pallet_preimage.rs new file mode 100644 index 000000000000..da6060592084 --- /dev/null +++ b/runtime/rococo/src/weights/pallet_preimage.rs @@ -0,0 +1,132 @@ +// Copyright 2017-2022 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_preimage` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-05-11, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/production/polkadot +// benchmark +// pallet +// --chain=rococo-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_preimage +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/rococo/src/weights/pallet_preimage.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_preimage`. +pub struct WeightInfo(PhantomData); +impl pallet_preimage::WeightInfo for WeightInfo { + // Storage: Preimage PreimageFor (r:1 w:1) + // Storage: Preimage StatusFor (r:1 w:1) + fn note_preimage(s: u32, ) -> Weight { + (0 as Weight) + // Standard Error: 0 + .saturating_add((3_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Preimage PreimageFor (r:1 w:1) + // Storage: Preimage StatusFor (r:1 w:0) + fn note_requested_preimage(s: u32, ) -> Weight { + (0 as Weight) + // Standard Error: 0 + .saturating_add((3_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Preimage PreimageFor (r:1 w:1) + // Storage: Preimage StatusFor (r:1 w:0) + fn note_no_deposit_preimage(s: u32, ) -> Weight { + (0 as Weight) + // Standard Error: 0 + .saturating_add((3_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + fn unnote_preimage() -> Weight { + (38_165_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + fn unnote_no_deposit_preimage() -> Weight { + (25_192_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn request_preimage() -> Weight { + (36_385_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn request_no_deposit_preimage() -> Weight { + (23_791_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn request_unnoted_preimage() -> Weight { + (13_857_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn request_requested_preimage() -> Weight { + (4_599_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + fn unrequest_preimage() -> Weight { + (25_208_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + fn unrequest_unnoted_preimage() -> Weight { + (13_875_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn unrequest_multi_referenced_preimage() -> Weight { + (4_610_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } +} diff --git a/runtime/rococo/src/weights/pallet_scheduler.rs b/runtime/rococo/src/weights/pallet_scheduler.rs new file mode 100644 index 000000000000..6acd76cba4db --- /dev/null +++ b/runtime/rococo/src/weights/pallet_scheduler.rs @@ -0,0 +1,193 @@ +// Copyright 2017-2022 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_scheduler` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-05-11, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/production/polkadot +// benchmark +// pallet +// --chain=rococo-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_scheduler +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/rococo/src/weights/pallet_scheduler.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_scheduler`. +pub struct WeightInfo(PhantomData); +impl pallet_scheduler::WeightInfo for WeightInfo { + // Storage: Scheduler Agenda (r:2 w:2) + // Storage: Preimage PreimageFor (r:1 w:1) + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Scheduler Lookup (r:0 w:1) + fn on_initialize_periodic_named_resolved(s: u32, ) -> Weight { + (1_014_000 as Weight) + // Standard Error: 33_000 + .saturating_add((25_640_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(s as Weight))) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + .saturating_add(T::DbWeight::get().writes((4 as Weight).saturating_mul(s as Weight))) + } + // Storage: Scheduler Agenda (r:1 w:1) + // Storage: Preimage PreimageFor (r:1 w:1) + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Scheduler Lookup (r:0 w:1) + fn on_initialize_named_resolved(s: u32, ) -> Weight { + (0 as Weight) + // Standard Error: 29_000 + .saturating_add((20_816_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().reads((2 as Weight).saturating_mul(s as Weight))) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(s as Weight))) + } + // Storage: Scheduler Agenda (r:2 w:2) + // Storage: Preimage PreimageFor (r:1 w:1) + // Storage: Preimage StatusFor (r:1 w:1) + fn on_initialize_periodic_resolved(s: u32, ) -> Weight { + (315_000 as Weight) + // Standard Error: 33_000 + .saturating_add((23_338_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(s as Weight))) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(s as Weight))) + } + // Storage: Scheduler Agenda (r:1 w:1) + // Storage: Preimage PreimageFor (r:1 w:1) + // Storage: Preimage StatusFor (r:1 w:1) + fn on_initialize_resolved(s: u32, ) -> Weight { + (94_000 as Weight) + // Standard Error: 31_000 + .saturating_add((19_898_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().reads((2 as Weight).saturating_mul(s as Weight))) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + .saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(s as Weight))) + } + // Storage: Scheduler Agenda (r:2 w:2) + // Storage: Preimage PreimageFor (r:1 w:0) + // Storage: Scheduler Lookup (r:0 w:1) + fn on_initialize_named_aborted(s: u32, ) -> Weight { + (2_095_000 as Weight) + // Standard Error: 16_000 + .saturating_add((9_978_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight))) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) + } + // Storage: Scheduler Agenda (r:2 w:2) + // Storage: Preimage PreimageFor (r:1 w:0) + fn on_initialize_aborted(s: u32, ) -> Weight { + (5_435_000 as Weight) + // Standard Error: 15_000 + .saturating_add((7_878_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight))) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Scheduler Agenda (r:2 w:2) + // Storage: Scheduler Lookup (r:0 w:1) + fn on_initialize_periodic_named(s: u32, ) -> Weight { + (6_842_000 as Weight) + // Standard Error: 21_000 + .saturating_add((16_006_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight))) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + .saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(s as Weight))) + } + // Storage: Scheduler Agenda (r:2 w:2) + fn on_initialize_periodic(s: u32, ) -> Weight { + (9_527_000 as Weight) + // Standard Error: 16_000 + .saturating_add((13_652_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight))) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) + } + // Storage: Scheduler Agenda (r:1 w:1) + // Storage: Scheduler Lookup (r:0 w:1) + fn on_initialize_named(s: u32, ) -> Weight { + (9_416_000 as Weight) + // Standard Error: 16_000 + .saturating_add((11_422_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) + } + // Storage: Scheduler Agenda (r:1 w:1) + fn on_initialize(s: u32, ) -> Weight { + (9_432_000 as Weight) + // Standard Error: 15_000 + .saturating_add((10_651_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Scheduler Agenda (r:1 w:1) + fn schedule(s: u32, ) -> Weight { + (16_045_000 as Weight) + // Standard Error: 1_000 + .saturating_add((42_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Scheduler Agenda (r:1 w:1) + // Storage: Scheduler Lookup (r:0 w:1) + fn cancel(s: u32, ) -> Weight { + (15_177_000 as Weight) + // Standard Error: 7_000 + .saturating_add((2_394_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Scheduler Lookup (r:1 w:1) + // Storage: Scheduler Agenda (r:1 w:1) + fn schedule_named(s: u32, ) -> Weight { + (18_430_000 as Weight) + // Standard Error: 1_000 + .saturating_add((59_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Scheduler Lookup (r:1 w:1) + // Storage: Scheduler Agenda (r:1 w:1) + fn cancel_named(s: u32, ) -> Weight { + (15_731_000 as Weight) + // Standard Error: 6_000 + .saturating_add((2_405_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } +} diff --git a/runtime/rococo/src/weights/xcm/mod.rs b/runtime/rococo/src/weights/xcm/mod.rs index f266e076636f..717c633707e4 100644 --- a/runtime/rococo/src/weights/xcm/mod.rs +++ b/runtime/rococo/src/weights/xcm/mod.rs @@ -64,8 +64,8 @@ impl WeighMultiAssets for MultiAssets { } } -pub struct KusamaXcmWeight(core::marker::PhantomData); -impl XcmWeightInfo for KusamaXcmWeight { +pub struct RococoXcmWeight(core::marker::PhantomData); +impl XcmWeightInfo for RococoXcmWeight { fn withdraw_asset(assets: &MultiAssets) -> Weight { assets.weigh_multi_assets(XcmBalancesWeight::::withdraw_asset()) } diff --git a/runtime/rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs b/runtime/rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs index 2528c0a491dc..4eb7e568bf5d 100644 --- a/runtime/rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs +++ b/runtime/rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs @@ -18,12 +18,12 @@ //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev //! DATE: 2022-03-08, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 1024 +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 // Executed Command: // target/production/polkadot // benchmark -// --chain=kusama-dev +// --chain=rococo-dev // --steps=50 // --repeat=20 // --pallet=pallet_xcm_benchmarks::fungible @@ -33,7 +33,7 @@ // --heap-pages=4096 // --header=./file_header.txt // --template=./xcm/pallet-xcm-benchmarks/template.hbs -// --output=./runtime/kusama/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs +// --output=./runtime/rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] diff --git a/runtime/rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs b/runtime/rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs index b3d256cbd880..fa202546f9cd 100644 --- a/runtime/rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs +++ b/runtime/rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs @@ -18,12 +18,12 @@ //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev //! DATE: 2022-03-08, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 1024 +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 // Executed Command: // target/production/polkadot // benchmark -// --chain=kusama-dev +// --chain=rococo-dev // --steps=50 // --repeat=20 // --pallet=pallet_xcm_benchmarks::generic @@ -33,7 +33,7 @@ // --heap-pages=4096 // --header=./file_header.txt // --template=./xcm/pallet-xcm-benchmarks/template.hbs -// --output=./runtime/kusama/src/weights/xcm/pallet_xcm_benchmarks_generic.rs +// --output=./runtime/rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] diff --git a/runtime/rococo/src/xcm_config.rs b/runtime/rococo/src/xcm_config.rs index 19333d79ad27..2e8f934f7270 100644 --- a/runtime/rococo/src/xcm_config.rs +++ b/runtime/rococo/src/xcm_config.rs @@ -17,8 +17,8 @@ //! XCM configuration for Rococo. use super::{ - parachains_origin, AccountId, Balances, Call, Event, Origin, ParaId, Runtime, WeightToFee, - XcmPallet, + parachains_origin, AccountId, Balances, Call, CouncilCollective, Event, Origin, ParaId, + Runtime, WeightToFee, XcmPallet, }; use frame_support::{match_types, parameter_types, traits::Everything, weights::Weight}; use runtime_common::{xcm_sender, ToAuthor}; @@ -153,7 +153,7 @@ impl xcm_executor::Config for XcmConfig { type LocationInverter = LocationInverter; type Barrier = Barrier; type Weigher = - WeightInfoBounds, Call, MaxInstructions>; + WeightInfoBounds, Call, MaxInstructions>; // The weight trader piggybacks on the existing transaction-fee conversion logic. type Trader = UsingComponents>; type ResponseHandler = XcmPallet; @@ -178,7 +178,7 @@ pub type LocalOriginToLocation = ( // `Unit` body. BackingToPlurality< Origin, - pallet_collective::Origin, + pallet_collective::Origin, CollectiveBodyId // TODO: Collective -> CouncilBodyId >, // And a usual Signed origin to be used in XCM as a corresponding AccountId32 From f70dc72cc8c8025b7c8c212bdffb22cec0452b15 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Mon, 20 Jun 2022 20:00:56 +0200 Subject: [PATCH 07/35] treasury+democracy+bounties+child_bounties+society --- Cargo.lock | 5 + node/service/src/chain_spec.rs | 4 + runtime/rococo/Cargo.toml | 19 + runtime/rococo/src/lib.rs | 393 ++++++++---------- runtime/rococo/src/weights/mod.rs | 4 + runtime/rococo/src/weights/pallet_bounties.rs | 137 ++++++ .../src/weights/pallet_child_bounties.rs | 122 ++++++ .../rococo/src/weights/pallet_democracy.rs | 280 +++++++++++++ runtime/rococo/src/weights/pallet_treasury.rs | 89 ++++ 9 files changed, 842 insertions(+), 211 deletions(-) create mode 100644 runtime/rococo/src/weights/pallet_bounties.rs create mode 100644 runtime/rococo/src/weights/pallet_child_bounties.rs create mode 100644 runtime/rococo/src/weights/pallet_democracy.rs create mode 100644 runtime/rococo/src/weights/pallet_treasury.rs diff --git a/Cargo.lock b/Cargo.lock index 259190f4ca1a..475d5d05e8ea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8381,10 +8381,13 @@ dependencies = [ "pallet-balances", "pallet-beefy", "pallet-beefy-mmr", + "pallet-bounties", "pallet-bridge-dispatch", "pallet-bridge-grandpa", "pallet-bridge-messages", + "pallet-child-bounties", "pallet-collective", + "pallet-democracy", "pallet-grandpa", "pallet-im-online", "pallet-indices", @@ -8396,11 +8399,13 @@ dependencies = [ "pallet-proxy", "pallet-scheduler", "pallet-session", + "pallet-society", "pallet-staking", "pallet-sudo", "pallet-timestamp", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", + "pallet-treasury", "pallet-utility", "pallet-xcm", "parity-scale-codec", diff --git a/node/service/src/chain_spec.rs b/node/service/src/chain_spec.rs index 90413b6dfe08..49d8ca4bae41 100644 --- a/node/service/src/chain_spec.rs +++ b/node/service/src/chain_spec.rs @@ -1052,12 +1052,14 @@ fn rococo_staging_testnet_config_genesis(wasm_binary: &[u8]) -> rococo_runtime:: }, grandpa: Default::default(), im_online: Default::default(), + democracy: rococo_runtime::DemocracyConfig::default(), council: rococo::CouncilConfig { members: vec![], phantom: Default::default() }, technical_committee: rococo::TechnicalCommitteeConfig { members: vec![], phantom: Default::default(), }, technical_membership: Default::default(), + treasury: Default::default(), authority_discovery: rococo_runtime::AuthorityDiscoveryConfig { keys: vec![] }, sudo: rococo_runtime::SudoConfig { key: Some(endowed_accounts[0].clone()) }, paras: rococo_runtime::ParasConfig { paras: vec![] }, @@ -1615,12 +1617,14 @@ pub fn rococo_testnet_genesis( }, grandpa: Default::default(), im_online: Default::default(), + democracy: rococo::DemocracyConfig::default(), council: rococo::CouncilConfig { members: vec![], phantom: Default::default() }, technical_committee: rococo::TechnicalCommitteeConfig { members: vec![], phantom: Default::default(), }, technical_membership: Default::default(), + treasury: Default::default(), authority_discovery: rococo_runtime::AuthorityDiscoveryConfig { keys: vec![] }, sudo: rococo_runtime::SudoConfig { key: Some(root_key.clone()) }, hrmp: Default::default(), diff --git a/runtime/rococo/Cargo.toml b/runtime/rococo/Cargo.toml index 95c294490780..9f2c73e5e6fc 100644 --- a/runtime/rococo/Cargo.toml +++ b/runtime/rococo/Cargo.toml @@ -39,6 +39,9 @@ pallet-babe = { git = "https://github.com/paritytech/substrate", branch = "maste pallet-beefy = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-beefy-mmr = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-bounties = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-child-bounties = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-democracy = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-collective = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-im-online = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -48,8 +51,10 @@ pallet-mmr = { git = "https://github.com/paritytech/substrate", branch = "master pallet-multisig = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-treasury = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-staking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-society = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-sudo = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-offences = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -110,12 +115,15 @@ std = [ "pallet-babe/std", "beefy-primitives/std", "pallet-balances/std", + "pallet-bounties/std", + "pallet-child-bounties/std", "pallet-bridge-dispatch/std", "pallet-bridge-grandpa/std", "pallet-bridge-messages/std", "pallet-collective/std", "pallet-beefy/std", "pallet-beefy-mmr/std", + "pallet-democracy/std", "pallet-grandpa/std", "pallet-sudo/std", "pallet-membership/std", @@ -123,12 +131,14 @@ std = [ "pallet-indices/std", "pallet-im-online/std", "pallet-session/std", + "pallet-society/std", "pallet-staking/std", "pallet-offences/std", "pallet-proxy/std", "pallet-timestamp/std", "pallet-transaction-payment/std", "pallet-transaction-payment-rpc-runtime-api/std", + "pallet-treasury/std", "pallet-collective/std", "pallet-scheduler/std", "pallet-preimage/std", @@ -175,8 +185,11 @@ runtime-benchmarks = [ "sp-runtime/runtime-benchmarks", "pallet-babe/runtime-benchmarks", "pallet-balances/runtime-benchmarks", + "pallet-bounties/runtime-benchmarks", + "pallet-child-bounties/runtime-benchmarks", "pallet-collective/runtime-benchmarks", "pallet-collective/std", + "pallet-democracy/runtime-benchmarks", "pallet-preimage/runtime-benchmarks", "pallet-grandpa/runtime-benchmarks", "pallet-im-online/runtime-benchmarks", @@ -184,6 +197,7 @@ runtime-benchmarks = [ "pallet-membership/runtime-benchmarks", "pallet-proxy/runtime-benchmarks", "pallet-staking/runtime-benchmarks", + "pallet-society/runtime-benchmarks", "pallet-timestamp/runtime-benchmarks", "pallet-utility/runtime-benchmarks", "pallet-xcm/runtime-benchmarks", @@ -203,7 +217,10 @@ try-runtime = [ "pallet-authorship/try-runtime", "pallet-babe/try-runtime", "pallet-balances/try-runtime", + "pallet-bounties/try-runtime", + "pallet-child-bounties/try-runtime", "pallet-collective/try-runtime", + "pallet-democracy/try-runtime", "pallet-grandpa/try-runtime", "pallet-sudo/try-runtime", "pallet-indices/try-runtime", @@ -211,10 +228,12 @@ try-runtime = [ "pallet-membership/try-runtime", "pallet-session/try-runtime", "pallet-proxy/try-runtime", + "pallet-society/try-runtime", "pallet-staking/try-runtime", "pallet-offences/try-runtime", "pallet-timestamp/try-runtime", "pallet-transaction-payment/try-runtime", + "pallet-treasury/runtime-benchmarks", "pallet-collective/try-runtime", "runtime-common/try-runtime", "pallet-multisig/try-runtime", diff --git a/runtime/rococo/src/lib.rs b/runtime/rococo/src/lib.rs index 1b4c4194d283..43a69a03dfc1 100644 --- a/runtime/rococo/src/lib.rs +++ b/runtime/rococo/src/lib.rs @@ -72,7 +72,7 @@ use sp_runtime::{ OpaqueKeys, SaturatedConversion, Verify, }, transaction_validity::{TransactionPriority, TransactionSource, TransactionValidity}, - ApplyExtrinsicResult, FixedU128, KeyTypeId, + ApplyExtrinsicResult, FixedU128, KeyTypeId, Perbill, Percent, Permill, }; use sp_staking::SessionIndex; #[cfg(any(feature = "std", test))] @@ -629,72 +629,70 @@ impl pallet_session::historical::Config for Runtime { // type WeightInfo = weights::pallet_staking::WeightInfo; // } -// TODO: Democracy -// parameter_types! { -// pub LaunchPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1, "KSM_LAUNCH_PERIOD"); -// pub VotingPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1 * MINUTES, "KSM_VOTING_PERIOD"); -// pub FastTrackVotingPeriod: BlockNumber = prod_or_fast!(3 * HOURS, 1 * MINUTES, "KSM_FAST_TRACK_VOTING_PERIOD"); -// pub const MinimumDeposit: Balance = 100 * CENTS; -// pub EnactmentPeriod: BlockNumber = prod_or_fast!(8 * DAYS, 1, "KSM_ENACTMENT_PERIOD"); -// pub CooloffPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1 * MINUTES, "KSM_COOLOFF_PERIOD"); -// pub const InstantAllowed: bool = true; -// pub const MaxVotes: u32 = 100; -// pub const MaxProposals: u32 = 100; -// } - -// TODO: Democracy -// impl pallet_democracy::Config for Runtime { -// type Proposal = Call; -// type Event = Event; -// type Currency = Balances; -// type EnactmentPeriod = EnactmentPeriod; -// type VoteLockingPeriod = EnactmentPeriod; -// type LaunchPeriod = LaunchPeriod; -// type VotingPeriod = VotingPeriod; -// type MinimumDeposit = MinimumDeposit; -// /// A straight majority of the council can decide what their next motion is. -// type ExternalOrigin = -// pallet_collective::EnsureProportionAtLeast; -// /// A majority can have the next scheduled referendum be a straight majority-carries vote. -// type ExternalMajorityOrigin = -// pallet_collective::EnsureProportionAtLeast; -// /// A unanimous council can have the next scheduled referendum be a straight default-carries -// /// (NTB) vote. -// type ExternalDefaultOrigin = -// pallet_collective::EnsureProportionAtLeast; -// /// Two thirds of the technical committee can have an `ExternalMajority/ExternalDefault` vote -// /// be tabled immediately and with a shorter voting/enactment period. -// type FastTrackOrigin = -// pallet_collective::EnsureProportionAtLeast; -// type InstantOrigin = -// pallet_collective::EnsureProportionAtLeast; -// type InstantAllowed = InstantAllowed; -// type FastTrackVotingPeriod = FastTrackVotingPeriod; -// // To cancel a proposal which has been passed, 2/3 of the council must agree to it. -// type CancellationOrigin = EnsureOneOf< -// EnsureRoot, -// pallet_collective::EnsureProportionAtLeast, -// >; -// type BlacklistOrigin = EnsureRoot; -// // To cancel a proposal before it has been passed, the technical committee must be unanimous or -// // Root must agree. -// type CancelProposalOrigin = EnsureOneOf< -// EnsureRoot, -// pallet_collective::EnsureProportionAtLeast, -// >; -// // Any single technical committee member may veto a coming council proposal, however they can -// // only do it once and it lasts only for the cooloff period. -// type VetoOrigin = pallet_collective::EnsureMember; -// type CooloffPeriod = CooloffPeriod; -// type PreimageByteDeposit = PreimageByteDeposit; -// type OperationalPreimageOrigin = pallet_collective::EnsureMember; -// type Slash = Treasury; -// type Scheduler = Scheduler; -// type PalletsOrigin = OriginCaller; -// type MaxVotes = MaxVotes; -// type WeightInfo = weights::pallet_democracy::WeightInfo; -// type MaxProposals = MaxProposals; -// } +parameter_types! { + pub LaunchPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1, "KSM_LAUNCH_PERIOD"); + pub VotingPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1 * MINUTES, "KSM_VOTING_PERIOD"); + pub FastTrackVotingPeriod: BlockNumber = prod_or_fast!(3 * HOURS, 1 * MINUTES, "KSM_FAST_TRACK_VOTING_PERIOD"); + pub const MinimumDeposit: Balance = 100 * CENTS; + pub EnactmentPeriod: BlockNumber = prod_or_fast!(8 * DAYS, 1, "KSM_ENACTMENT_PERIOD"); + pub CooloffPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1 * MINUTES, "KSM_COOLOFF_PERIOD"); + pub const InstantAllowed: bool = true; + pub const MaxVotes: u32 = 100; + pub const MaxProposals: u32 = 100; +} + +impl pallet_democracy::Config for Runtime { + type Proposal = Call; + type Event = Event; + type Currency = Balances; + type EnactmentPeriod = EnactmentPeriod; + type VoteLockingPeriod = EnactmentPeriod; + type LaunchPeriod = LaunchPeriod; + type VotingPeriod = VotingPeriod; + type MinimumDeposit = MinimumDeposit; + /// A straight majority of the council can decide what their next motion is. + type ExternalOrigin = + pallet_collective::EnsureProportionAtLeast; + /// A majority can have the next scheduled referendum be a straight majority-carries vote. + type ExternalMajorityOrigin = + pallet_collective::EnsureProportionAtLeast; + /// A unanimous council can have the next scheduled referendum be a straight default-carries + /// (NTB) vote. + type ExternalDefaultOrigin = + pallet_collective::EnsureProportionAtLeast; + /// Two thirds of the technical committee can have an `ExternalMajority/ExternalDefault` vote + /// be tabled immediately and with a shorter voting/enactment period. + type FastTrackOrigin = + pallet_collective::EnsureProportionAtLeast; + type InstantOrigin = + pallet_collective::EnsureProportionAtLeast; + type InstantAllowed = InstantAllowed; + type FastTrackVotingPeriod = FastTrackVotingPeriod; + // To cancel a proposal which has been passed, 2/3 of the council must agree to it. + type CancellationOrigin = EnsureOneOf< + EnsureRoot, + pallet_collective::EnsureProportionAtLeast, + >; + type BlacklistOrigin = EnsureRoot; + // To cancel a proposal before it has been passed, the technical committee must be unanimous or + // Root must agree. + type CancelProposalOrigin = EnsureOneOf< + EnsureRoot, + pallet_collective::EnsureProportionAtLeast, + >; + // Any single technical committee member may veto a coming council proposal, however they can + // only do it once and it lasts only for the cooloff period. + type VetoOrigin = pallet_collective::EnsureMember; + type CooloffPeriod = CooloffPeriod; + type PreimageByteDeposit = PreimageByteDeposit; + type OperationalPreimageOrigin = pallet_collective::EnsureMember; + type Slash = Treasury; + type Scheduler = Scheduler; + type PalletsOrigin = OriginCaller; + type MaxVotes = MaxVotes; + type WeightInfo = weights::pallet_democracy::WeightInfo; + type MaxProposals = MaxProposals; +} parameter_types! { pub CouncilMotionDuration: BlockNumber = prod_or_fast!(3 * DAYS, 2 * MINUTES, "ROC_MOTION_DURATION"); @@ -787,92 +785,85 @@ impl pallet_membership::Config for Runtime { type WeightInfo = weights::pallet_membership::WeightInfo; } -// TODO: Treasury -// parameter_types! { -// pub const ProposalBond: Permill = Permill::from_percent(5); -// pub const ProposalBondMinimum: Balance = 2000 * CENTS; -// pub const ProposalBondMaximum: Balance = 1 * GRAND; -// pub const SpendPeriod: BlockNumber = 6 * DAYS; -// pub const Burn: Permill = Permill::from_perthousand(2); -// pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry"); - -// pub const TipCountdown: BlockNumber = 1 * DAYS; -// pub const TipFindersFee: Percent = Percent::from_percent(20); -// pub const TipReportDepositBase: Balance = 100 * CENTS; -// pub const DataDepositPerByte: Balance = 1 * CENTS; -// pub const MaxApprovals: u32 = 100; -// pub const MaxAuthorities: u32 = 100_000; -// pub const MaxKeys: u32 = 10_000; -// pub const MaxPeerInHeartbeats: u32 = 10_000; -// pub const MaxPeerDataEncodingSize: u32 = 1_000; -// } - -// TODO: Treasury -// type ApproveOrigin = EnsureOneOf< -// EnsureRoot, -// pallet_collective::EnsureProportionAtLeast, -// >; - -// TODO: Treasury -// impl pallet_treasury::Config for Runtime { -// type PalletId = TreasuryPalletId; -// type Currency = Balances; -// type ApproveOrigin = ApproveOrigin; -// type RejectOrigin = MoreThanHalfCouncil; -// type Event = Event; -// type OnSlash = Treasury; -// type ProposalBond = ProposalBond; -// type ProposalBondMinimum = ProposalBondMinimum; -// type ProposalBondMaximum = ProposalBondMaximum; -// type SpendPeriod = SpendPeriod; -// type Burn = Burn; -// type BurnDestination = Society; -// type MaxApprovals = MaxApprovals; -// type WeightInfo = weights::pallet_treasury::WeightInfo; -// type SpendFunds = Bounties; -// } +parameter_types! { + pub const ProposalBond: Permill = Permill::from_percent(5); + pub const ProposalBondMinimum: Balance = 2000 * CENTS; + pub const ProposalBondMaximum: Balance = 1 * GRAND; + pub const SpendPeriod: BlockNumber = 6 * DAYS; + pub const Burn: Permill = Permill::from_perthousand(2); + pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry"); + + pub const TipCountdown: BlockNumber = 1 * DAYS; + pub const TipFindersFee: Percent = Percent::from_percent(20); + pub const TipReportDepositBase: Balance = 100 * CENTS; + pub const DataDepositPerByte: Balance = 1 * CENTS; + pub const MaxApprovals: u32 = 100; + pub const MaxAuthorities: u32 = 100_000; + pub const MaxKeys: u32 = 10_000; + pub const MaxPeerInHeartbeats: u32 = 10_000; + pub const MaxPeerDataEncodingSize: u32 = 1_000; +} + +type ApproveOrigin = EnsureOneOf< + EnsureRoot, + pallet_collective::EnsureProportionAtLeast, +>; -// TODO: Bounties -// parameter_types! { -// pub const BountyDepositBase: Balance = 100 * CENTS; -// pub const BountyDepositPayoutDelay: BlockNumber = 4 * DAYS; -// pub const BountyUpdatePeriod: BlockNumber = 90 * DAYS; -// pub const MaximumReasonLength: u32 = 16384; -// pub const CuratorDepositMultiplier: Permill = Permill::from_percent(50); -// pub const CuratorDepositMin: Balance = 10 * CENTS; -// pub const CuratorDepositMax: Balance = 500 * CENTS; -// pub const BountyValueMinimum: Balance = 200 * CENTS; -// } +impl pallet_treasury::Config for Runtime { + type PalletId = TreasuryPalletId; + type Currency = Balances; + type ApproveOrigin = ApproveOrigin; + type RejectOrigin = MoreThanHalfCouncil; + type Event = Event; + type OnSlash = Treasury; + type ProposalBond = ProposalBond; + type ProposalBondMinimum = ProposalBondMinimum; + type ProposalBondMaximum = ProposalBondMaximum; + type SpendPeriod = SpendPeriod; + type Burn = Burn; + type BurnDestination = Society; + type MaxApprovals = MaxApprovals; + type WeightInfo = weights::pallet_treasury::WeightInfo; + type SpendFunds = Bounties; +} -// TODO: Bounties -// impl pallet_bounties::Config for Runtime { -// type BountyDepositBase = BountyDepositBase; -// type BountyDepositPayoutDelay = BountyDepositPayoutDelay; -// type BountyUpdatePeriod = BountyUpdatePeriod; -// type CuratorDepositMultiplier = CuratorDepositMultiplier; -// type CuratorDepositMin = CuratorDepositMin; -// type CuratorDepositMax = CuratorDepositMax; -// type BountyValueMinimum = BountyValueMinimum; -// type ChildBountyManager = ChildBounties; -// type DataDepositPerByte = DataDepositPerByte; -// type Event = Event; -// type MaximumReasonLength = MaximumReasonLength; -// type WeightInfo = weights::pallet_bounties::WeightInfo; -// } +parameter_types! { + pub const BountyDepositBase: Balance = 100 * CENTS; + pub const BountyDepositPayoutDelay: BlockNumber = 4 * DAYS; + pub const BountyUpdatePeriod: BlockNumber = 90 * DAYS; + pub const MaximumReasonLength: u32 = 16384; + pub const CuratorDepositMultiplier: Permill = Permill::from_percent(50); + pub const CuratorDepositMin: Balance = 10 * CENTS; + pub const CuratorDepositMax: Balance = 500 * CENTS; + pub const BountyValueMinimum: Balance = 200 * CENTS; +} + +impl pallet_bounties::Config for Runtime { + type BountyDepositBase = BountyDepositBase; + type BountyDepositPayoutDelay = BountyDepositPayoutDelay; + type BountyUpdatePeriod = BountyUpdatePeriod; + type CuratorDepositMultiplier = CuratorDepositMultiplier; + type CuratorDepositMin = CuratorDepositMin; + type CuratorDepositMax = CuratorDepositMax; + type BountyValueMinimum = BountyValueMinimum; + type ChildBountyManager = ChildBounties; + type DataDepositPerByte = DataDepositPerByte; + type Event = Event; + type MaximumReasonLength = MaximumReasonLength; + type WeightInfo = weights::pallet_bounties::WeightInfo; +} -// TODO: Child Bounties -// parameter_types! { -// pub const MaxActiveChildBountyCount: u32 = 100; -// pub const ChildBountyValueMinimum: Balance = BountyValueMinimum::get() / 10; -// } +parameter_types! { + pub const MaxActiveChildBountyCount: u32 = 100; + pub const ChildBountyValueMinimum: Balance = BountyValueMinimum::get() / 10; +} -// TODO: Child Bounties -// impl pallet_child_bounties::Config for Runtime { -// type Event = Event; -// type MaxActiveChildBountyCount = MaxActiveChildBountyCount; -// type ChildBountyValueMinimum = ChildBountyValueMinimum; -// type WeightInfo = weights::pallet_child_bounties::WeightInfo; -// } +impl pallet_child_bounties::Config for Runtime { + type Event = Event; + type MaxActiveChildBountyCount = MaxActiveChildBountyCount; + type ChildBountyValueMinimum = ChildBountyValueMinimum; + type WeightInfo = weights::pallet_child_bounties::WeightInfo; +} // TODO: Tips // impl pallet_tips::Config for Runtime { @@ -892,20 +883,12 @@ impl pallet_offences::Config for Runtime { type OnOffenceHandler = (); // TODO: Offences -> type OnOffenceHandler = Staking; } -parameter_types! { - // pub const MaxRetries: u32 = 3; - pub const MaxAuthorities: u32 = 100_000; // TODO: Authority Discovery -> The value is defined in Treasury params -} - impl pallet_authority_discovery::Config for Runtime { type MaxAuthorities = MaxAuthorities; } parameter_types! { pub const ImOnlineUnsignedPriority: TransactionPriority = TransactionPriority::max_value(); - pub const MaxKeys: u32 = 10_000; // TODO: I am Online -> The value is defined in Treasury params - pub const MaxPeerInHeartbeats: u32 = 10_000; // TODO: I am Online -> The value is defined in Treasury params - pub const MaxPeerDataEncodingSize: u32 = 1_000; // TODO: I am Online -> The value is defined in Treasury params } impl pallet_im_online::Config for Runtime { @@ -1097,38 +1080,36 @@ impl pallet_multisig::Config for Runtime { // type RecoveryDeposit = RecoveryDeposit; // } -// TODO: Society -// parameter_types! { -// pub const CandidateDeposit: Balance = 1000 * CENTS; -// pub const WrongSideDeduction: Balance = 200 * CENTS; -// pub const MaxStrikes: u32 = 10; -// pub const RotationPeriod: BlockNumber = 7 * DAYS; -// pub const PeriodSpend: Balance = 50000 * CENTS; -// pub const MaxLockDuration: BlockNumber = 36 * 30 * DAYS; -// pub const ChallengePeriod: BlockNumber = 7 * DAYS; -// pub const MaxCandidateIntake: u32 = 1; -// pub const SocietyPalletId: PalletId = PalletId(*b"py/socie"); -// } - -// TODO: Society -// impl pallet_society::Config for Runtime { -// type Event = Event; -// type Currency = Balances; -// type Randomness = pallet_babe::RandomnessFromOneEpochAgo; -// type CandidateDeposit = CandidateDeposit; -// type WrongSideDeduction = WrongSideDeduction; -// type MaxStrikes = MaxStrikes; -// type PeriodSpend = PeriodSpend; -// type MembershipChanged = (); -// type RotationPeriod = RotationPeriod; -// type MaxLockDuration = MaxLockDuration; -// type FounderSetOrigin = -// pallet_collective::EnsureProportionMoreThan; -// type SuspensionJudgementOrigin = pallet_society::EnsureFounder; -// type ChallengePeriod = ChallengePeriod; -// type MaxCandidateIntake = MaxCandidateIntake; -// type PalletId = SocietyPalletId; -// } +parameter_types! { + pub const CandidateDeposit: Balance = 1000 * CENTS; + pub const WrongSideDeduction: Balance = 200 * CENTS; + pub const MaxStrikes: u32 = 10; + pub const RotationPeriod: BlockNumber = 7 * DAYS; + pub const PeriodSpend: Balance = 50000 * CENTS; + pub const MaxLockDuration: BlockNumber = 36 * 30 * DAYS; + pub const ChallengePeriod: BlockNumber = 7 * DAYS; + pub const MaxCandidateIntake: u32 = 1; + pub const SocietyPalletId: PalletId = PalletId(*b"py/socie"); +} + +impl pallet_society::Config for Runtime { + type Event = Event; + type Currency = Balances; + type Randomness = pallet_babe::RandomnessFromOneEpochAgo; + type CandidateDeposit = CandidateDeposit; + type WrongSideDeduction = WrongSideDeduction; + type MaxStrikes = MaxStrikes; + type PeriodSpend = PeriodSpend; + type MembershipChanged = (); + type RotationPeriod = RotationPeriod; + type MaxLockDuration = MaxLockDuration; + type FounderSetOrigin = + pallet_collective::EnsureProportionMoreThan; + type SuspensionJudgementOrigin = pallet_society::EnsureFounder; + type ChallengePeriod = ChallengePeriod; + type MaxCandidateIntake = MaxCandidateIntake; + type PalletId = SocietyPalletId; +} // TODO: Vesting // parameter_types! { @@ -1381,7 +1362,6 @@ impl parachains_disputes::Config for Runtime { parameter_types! { pub const ParaDeposit: Balance = 5 * UNITS; - pub const DataDepositPerByte: Balance = deposit(0, 1); // TODO: Registar -> The value is defined in Treasury params } impl paras_registrar::Config for Runtime { @@ -1805,15 +1785,13 @@ construct_runtime! { AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config} = 12, // Governance stuff; uncallable initially. - // TODO: Democracy - // Democracy: pallet_democracy::{Pallet, Call, Storage, Config, Event} = 13, + Democracy: pallet_democracy::{Pallet, Call, Storage, Config, Event} = 13, Council: pallet_collective::::{Pallet, Call, Storage, Origin, Event, Config} = 14, TechnicalCommittee: pallet_collective::::{Pallet, Call, Storage, Origin, Event, Config} = 15, // TODO: Elections Prhargmen // PhragmenElection: pallet_elections_phragmen::{Pallet, Call, Storage, Event, Config} = 16, TechnicalMembership: pallet_membership::::{Pallet, Call, Storage, Event, Config} = 17, - // TODO: Treasury - // Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event} = 18, + Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event} = 18, // TODO: Claims //// Claims. Usable initially. @@ -1826,9 +1804,8 @@ construct_runtime! { //// Less simple identity module. // Identity: pallet_identity::{Pallet, Call, Storage, Event} = 25, - // TODO: Society - //// Society module. - // Society: pallet_society::{Pallet, Call, Storage, Event} = 26, + // Society module. + Society: pallet_society::{Pallet, Call, Storage, Event} = 26, // TODO: Recovery //// Social recovery module. @@ -1856,11 +1833,9 @@ construct_runtime! { // Historical module Historical: session_historical::{Pallet} = 34, - // TODO: Bounties - //// Bounties modules. - // Bounties: pallet_bounties::{Pallet, Call, Storage, Event} = 35, - // TODO: Child Bounties - // ChildBounties: pallet_child_bounties = 40, + // Bounties modules. + Bounties: pallet_bounties::{Pallet, Call, Storage, Event} = 35, + ChildBounties: pallet_child_bounties = 40, // TODO: Tips //// Tips module. @@ -2010,14 +1985,12 @@ mod benches { // TODO: Bags List // [pallet_bags_list, VoterList] [frame_benchmarking::baseline, Baseline::] - // TODO: Bounties - // [pallet_bounties, Bounties] + [pallet_bounties, Bounties] // TODO: Vhild Bounties // [pallet_child_bounties, ChildBounties] [pallet_collective, Council] [pallet_collective, TechnicalCommittee] - // TODO: Democracy - // [pallet_democracy, Democracy] + [pallet_democracy, Democracy] // TODO: Elections Phragmen // [pallet_elections_phragmen, PhragmenElection] // TODO: Election @@ -2047,8 +2020,7 @@ mod benches { [pallet_timestamp, Timestamp] // TODO: Tips // [pallet_tips, Tips] - // TODO: Treasury - // [pallet_treasury, Treasury] + [pallet_treasury, Treasury] [pallet_utility, Utility] // TODO: Vesting // [pallet_vesting, Vesting] @@ -2635,9 +2607,8 @@ sp_api::impl_runtime_apis! { hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(), // System Events hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(), - // TODO: Treasury - //// Treasury Account - // hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da95ecffd7b6c0f78751baa9d281e0bfa3a6d6f646c70792f74727372790000000000000000000000000000000000000000").to_vec().into(), + // Treasury Account + hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da95ecffd7b6c0f78751baa9d281e0bfa3a6d6f646c70792f74727372790000000000000000000000000000000000000000").to_vec().into(), // TODO: Rococo //// Configuration ActiveConfig //hex_literal::hex!("06de3d8a54d27e44a9d5ce189618f22db4b49d95320d9021994c850f25b8e385").to_vec().into(), diff --git a/runtime/rococo/src/weights/mod.rs b/runtime/rococo/src/weights/mod.rs index af1a1f2d7fdc..085986268cc4 100644 --- a/runtime/rococo/src/weights/mod.rs +++ b/runtime/rococo/src/weights/mod.rs @@ -17,7 +17,10 @@ pub mod frame_system; pub mod pallet_balances; +pub mod pallet_bounties; +pub mod pallet_child_bounties; pub mod pallet_collective; +pub mod pallet_democracy; pub mod pallet_im_online; pub mod pallet_indices; pub mod pallet_membership; @@ -25,6 +28,7 @@ pub mod pallet_multisig; pub mod pallet_proxy; pub mod pallet_session; pub mod pallet_timestamp; +pub mod pallet_treasury; pub mod pallet_utility; pub mod pallet_scheduler; pub mod pallet_preimage; diff --git a/runtime/rococo/src/weights/pallet_bounties.rs b/runtime/rococo/src/weights/pallet_bounties.rs new file mode 100644 index 000000000000..0157e1dea5dc --- /dev/null +++ b/runtime/rococo/src/weights/pallet_bounties.rs @@ -0,0 +1,137 @@ +// Copyright 2017-2022 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_bounties` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-05-11, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/production/polkadot +// benchmark +// pallet +// --chain=rococo-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_bounties +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/rococo/src/weights/pallet_bounties.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_bounties`. +pub struct WeightInfo(PhantomData); +impl pallet_bounties::WeightInfo for WeightInfo { + // Storage: Bounties BountyCount (r:1 w:1) + // Storage: System Account (r:1 w:1) + // Storage: Bounties BountyDescriptions (r:0 w:1) + // Storage: Bounties Bounties (r:0 w:1) + fn propose_bounty(d: u32, ) -> Weight { + (23_871_000 as Weight) + // Standard Error: 0 + .saturating_add((1_000 as Weight).saturating_mul(d as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(4 as Weight)) + } + // Storage: Bounties Bounties (r:1 w:1) + // Storage: Bounties BountyApprovals (r:1 w:1) + fn approve_bounty() -> Weight { + (6_968_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Bounties Bounties (r:1 w:1) + fn propose_curator() -> Weight { + (4_724_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Bounties Bounties (r:1 w:1) + // Storage: System Account (r:1 w:1) + fn unassign_curator() -> Weight { + (31_342_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Bounties Bounties (r:1 w:1) + // Storage: System Account (r:1 w:1) + fn accept_curator() -> Weight { + (18_849_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Bounties Bounties (r:1 w:1) + // Storage: ChildBounties ParentChildBounties (r:1 w:0) + fn award_bounty() -> Weight { + (16_324_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Bounties Bounties (r:1 w:1) + // Storage: System Account (r:3 w:3) + // Storage: ChildBounties ChildrenCuratorFees (r:1 w:1) + // Storage: Bounties BountyDescriptions (r:0 w:1) + fn claim_bounty() -> Weight { + (58_803_000 as Weight) + .saturating_add(T::DbWeight::get().reads(5 as Weight)) + .saturating_add(T::DbWeight::get().writes(6 as Weight)) + } + // Storage: Bounties Bounties (r:1 w:1) + // Storage: ChildBounties ParentChildBounties (r:1 w:0) + // Storage: System Account (r:1 w:1) + // Storage: Bounties BountyDescriptions (r:0 w:1) + fn close_bounty_proposed() -> Weight { + (35_730_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + // Storage: Bounties Bounties (r:1 w:1) + // Storage: ChildBounties ParentChildBounties (r:1 w:0) + // Storage: System Account (r:2 w:2) + // Storage: Bounties BountyDescriptions (r:0 w:1) + fn close_bounty_active() -> Weight { + (42_922_000 as Weight) + .saturating_add(T::DbWeight::get().reads(4 as Weight)) + .saturating_add(T::DbWeight::get().writes(4 as Weight)) + } + // Storage: Bounties Bounties (r:1 w:1) + fn extend_bounty_expiry() -> Weight { + (13_378_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Bounties BountyApprovals (r:1 w:1) + // Storage: Bounties Bounties (r:1 w:1) + // Storage: System Account (r:2 w:2) + fn spend_funds(b: u32, ) -> Weight { + (0 as Weight) + // Standard Error: 16_000 + .saturating_add((30_225_000 as Weight).saturating_mul(b as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(b as Weight))) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(b as Weight))) + } +} diff --git a/runtime/rococo/src/weights/pallet_child_bounties.rs b/runtime/rococo/src/weights/pallet_child_bounties.rs new file mode 100644 index 000000000000..a49fce7a4047 --- /dev/null +++ b/runtime/rococo/src/weights/pallet_child_bounties.rs @@ -0,0 +1,122 @@ +// Copyright 2017-2022 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_child_bounties` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-05-11, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/production/polkadot +// benchmark +// pallet +// --chain=rococo-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_child_bounties +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/rococo/src/weights/pallet_child_bounties.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_child_bounties`. +pub struct WeightInfo(PhantomData); +impl pallet_child_bounties::WeightInfo for WeightInfo { + // Storage: ChildBounties ParentChildBounties (r:1 w:1) + // Storage: Bounties Bounties (r:1 w:0) + // Storage: System Account (r:2 w:2) + // Storage: ChildBounties ChildBountyCount (r:1 w:1) + // Storage: ChildBounties ChildBountyDescriptions (r:0 w:1) + // Storage: ChildBounties ChildBounties (r:0 w:1) + fn add_child_bounty(d: u32, ) -> Weight { + (44_398_000 as Weight) + // Standard Error: 0 + .saturating_add((1_000 as Weight).saturating_mul(d as Weight)) + .saturating_add(T::DbWeight::get().reads(5 as Weight)) + .saturating_add(T::DbWeight::get().writes(6 as Weight)) + } + // Storage: Bounties Bounties (r:1 w:0) + // Storage: ChildBounties ChildBounties (r:1 w:1) + // Storage: ChildBounties ChildrenCuratorFees (r:1 w:1) + fn propose_curator() -> Weight { + (11_084_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Bounties Bounties (r:1 w:0) + // Storage: ChildBounties ChildBounties (r:1 w:1) + // Storage: System Account (r:1 w:1) + fn accept_curator() -> Weight { + (22_833_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: ChildBounties ChildBounties (r:1 w:1) + // Storage: Bounties Bounties (r:1 w:0) + // Storage: System Account (r:1 w:1) + fn unassign_curator() -> Weight { + (35_316_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Bounties Bounties (r:1 w:0) + // Storage: ChildBounties ChildBounties (r:1 w:1) + fn award_child_bounty() -> Weight { + (17_734_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: ChildBounties ChildBounties (r:1 w:1) + // Storage: System Account (r:3 w:3) + // Storage: ChildBounties ParentChildBounties (r:1 w:1) + // Storage: ChildBounties ChildBountyDescriptions (r:0 w:1) + fn claim_child_bounty() -> Weight { + (61_853_000 as Weight) + .saturating_add(T::DbWeight::get().reads(5 as Weight)) + .saturating_add(T::DbWeight::get().writes(6 as Weight)) + } + // Storage: Bounties Bounties (r:1 w:0) + // Storage: ChildBounties ChildBounties (r:1 w:1) + // Storage: ChildBounties ChildrenCuratorFees (r:1 w:1) + // Storage: ChildBounties ParentChildBounties (r:1 w:1) + // Storage: System Account (r:2 w:2) + // Storage: ChildBounties ChildBountyDescriptions (r:0 w:1) + fn close_child_bounty_added() -> Weight { + (42_697_000 as Weight) + .saturating_add(T::DbWeight::get().reads(6 as Weight)) + .saturating_add(T::DbWeight::get().writes(6 as Weight)) + } + // Storage: Bounties Bounties (r:1 w:0) + // Storage: ChildBounties ChildBounties (r:1 w:1) + // Storage: System Account (r:3 w:3) + // Storage: ChildBounties ChildrenCuratorFees (r:1 w:1) + // Storage: ChildBounties ParentChildBounties (r:1 w:1) + // Storage: ChildBounties ChildBountyDescriptions (r:0 w:1) + fn close_child_bounty_active() -> Weight { + (51_585_000 as Weight) + .saturating_add(T::DbWeight::get().reads(7 as Weight)) + .saturating_add(T::DbWeight::get().writes(7 as Weight)) + } +} diff --git a/runtime/rococo/src/weights/pallet_democracy.rs b/runtime/rococo/src/weights/pallet_democracy.rs new file mode 100644 index 000000000000..3fefe21301d2 --- /dev/null +++ b/runtime/rococo/src/weights/pallet_democracy.rs @@ -0,0 +1,280 @@ +// Copyright 2017-2022 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_democracy` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-05-11, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/production/polkadot +// benchmark +// pallet +// --chain=rococo-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_democracy +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/rococo/src/weights/pallet_democracy.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_democracy`. +pub struct WeightInfo(PhantomData); +impl pallet_democracy::WeightInfo for WeightInfo { + // Storage: Democracy PublicPropCount (r:1 w:1) + // Storage: Democracy PublicProps (r:1 w:1) + // Storage: Democracy Blacklist (r:1 w:0) + // Storage: Democracy DepositOf (r:0 w:1) + fn propose() -> Weight { + (33_014_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + // Storage: Democracy DepositOf (r:1 w:1) + fn second(s: u32, ) -> Weight { + (23_956_000 as Weight) + // Standard Error: 0 + .saturating_add((91_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Democracy ReferendumInfoOf (r:1 w:1) + // Storage: Democracy VotingOf (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + fn vote_new(r: u32, ) -> Weight { + (31_400_000 as Weight) + // Standard Error: 0 + .saturating_add((138_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + // Storage: Democracy ReferendumInfoOf (r:1 w:1) + // Storage: Democracy VotingOf (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + fn vote_existing(r: u32, ) -> Weight { + (31_439_000 as Weight) + // Standard Error: 1_000 + .saturating_add((135_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + // Storage: Democracy ReferendumInfoOf (r:1 w:1) + // Storage: Democracy Cancellations (r:1 w:1) + fn emergency_cancel() -> Weight { + (14_815_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Democracy PublicProps (r:1 w:1) + // Storage: Democracy NextExternal (r:1 w:1) + // Storage: Democracy ReferendumInfoOf (r:1 w:1) + // Storage: Democracy Blacklist (r:0 w:1) + // Storage: Democracy DepositOf (r:1 w:1) + // Storage: System Account (r:1 w:1) + fn blacklist(p: u32, ) -> Weight { + (48_030_000 as Weight) + // Standard Error: 3_000 + .saturating_add((202_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(5 as Weight)) + .saturating_add(T::DbWeight::get().writes(6 as Weight)) + } + // Storage: Democracy NextExternal (r:1 w:1) + // Storage: Democracy Blacklist (r:1 w:0) + fn external_propose(v: u32, ) -> Weight { + (7_547_000 as Weight) + // Standard Error: 0 + .saturating_add((33_000 as Weight).saturating_mul(v as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Democracy NextExternal (r:0 w:1) + fn external_propose_majority() -> Weight { + (1_656_000 as Weight) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Democracy NextExternal (r:0 w:1) + fn external_propose_default() -> Weight { + (1_383_000 as Weight) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Democracy NextExternal (r:1 w:1) + // Storage: Democracy ReferendumCount (r:1 w:1) + // Storage: Democracy ReferendumInfoOf (r:0 w:1) + fn fast_track() -> Weight { + (14_624_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + // Storage: Democracy NextExternal (r:1 w:1) + // Storage: Democracy Blacklist (r:1 w:1) + fn veto_external(v: u32, ) -> Weight { + (15_246_000 as Weight) + // Standard Error: 0 + .saturating_add((65_000 as Weight).saturating_mul(v as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Democracy PublicProps (r:1 w:1) + // Storage: Democracy DepositOf (r:1 w:1) + // Storage: System Account (r:1 w:1) + fn cancel_proposal(p: u32, ) -> Weight { + (35_279_000 as Weight) + // Standard Error: 1_000 + .saturating_add((195_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + // Storage: Democracy ReferendumInfoOf (r:0 w:1) + fn cancel_referendum() -> Weight { + (9_279_000 as Weight) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Scheduler Lookup (r:1 w:1) + // Storage: Scheduler Agenda (r:1 w:1) + fn cancel_queued(r: u32, ) -> Weight { + (20_572_000 as Weight) + // Standard Error: 5_000 + .saturating_add((2_298_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Democracy LowestUnbaked (r:1 w:1) + // Storage: Democracy ReferendumCount (r:1 w:0) + // Storage: Democracy ReferendumInfoOf (r:1 w:0) + fn on_initialize_base(r: u32, ) -> Weight { + (1_835_000 as Weight) + // Standard Error: 2_000 + .saturating_add((2_925_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(r as Weight))) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Democracy LowestUnbaked (r:1 w:1) + // Storage: Democracy ReferendumCount (r:1 w:0) + // Storage: Democracy LastTabledWasExternal (r:1 w:0) + // Storage: Democracy NextExternal (r:1 w:0) + // Storage: Democracy PublicProps (r:1 w:0) + // Storage: Democracy ReferendumInfoOf (r:1 w:0) + fn on_initialize_base_with_launch_period(r: u32, ) -> Weight { + (6_633_000 as Weight) + // Standard Error: 3_000 + .saturating_add((2_929_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(T::DbWeight::get().reads(5 as Weight)) + .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(r as Weight))) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Democracy VotingOf (r:3 w:3) + // Storage: Democracy ReferendumInfoOf (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + fn delegate(r: u32, ) -> Weight { + (30_560_000 as Weight) + // Standard Error: 2_000 + .saturating_add((3_654_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(T::DbWeight::get().reads(4 as Weight)) + .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(r as Weight))) + .saturating_add(T::DbWeight::get().writes(4 as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(r as Weight))) + } + // Storage: Democracy VotingOf (r:2 w:2) + // Storage: Democracy ReferendumInfoOf (r:1 w:1) + fn undelegate(r: u32, ) -> Weight { + (14_988_000 as Weight) + // Standard Error: 2_000 + .saturating_add((3_600_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(r as Weight))) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(r as Weight))) + } + // Storage: Democracy PublicProps (r:0 w:1) + fn clear_public_proposals() -> Weight { + (1_212_000 as Weight) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Democracy Preimages (r:1 w:1) + fn note_preimage(b: u32, ) -> Weight { + (21_356_000 as Weight) + // Standard Error: 0 + .saturating_add((3_000 as Weight).saturating_mul(b as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Democracy Preimages (r:1 w:1) + fn note_imminent_preimage(b: u32, ) -> Weight { + (14_006_000 as Weight) + // Standard Error: 0 + .saturating_add((3_000 as Weight).saturating_mul(b as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Democracy Preimages (r:1 w:1) + // Storage: System Account (r:1 w:0) + fn reap_preimage(b: u32, ) -> Weight { + (21_293_000 as Weight) + // Standard Error: 0 + .saturating_add((2_000 as Weight).saturating_mul(b as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Democracy VotingOf (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + fn unlock_remove(r: u32, ) -> Weight { + (19_105_000 as Weight) + // Standard Error: 0 + .saturating_add((30_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + // Storage: Democracy VotingOf (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + fn unlock_set(r: u32, ) -> Weight { + (18_244_000 as Weight) + // Standard Error: 0 + .saturating_add((126_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + // Storage: Democracy ReferendumInfoOf (r:1 w:1) + // Storage: Democracy VotingOf (r:1 w:1) + fn remove_vote(r: u32, ) -> Weight { + (10_046_000 as Weight) + // Standard Error: 0 + .saturating_add((119_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Democracy ReferendumInfoOf (r:1 w:1) + // Storage: Democracy VotingOf (r:1 w:1) + fn remove_other_vote(r: u32, ) -> Weight { + (10_094_000 as Weight) + // Standard Error: 0 + .saturating_add((120_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } +} diff --git a/runtime/rococo/src/weights/pallet_treasury.rs b/runtime/rococo/src/weights/pallet_treasury.rs new file mode 100644 index 000000000000..0186ce1349be --- /dev/null +++ b/runtime/rococo/src/weights/pallet_treasury.rs @@ -0,0 +1,89 @@ +// Copyright 2017-2022 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: 2022-05-11, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/production/polkadot +// benchmark +// pallet +// --chain=rococo-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_treasury +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/rococo/src/weights/pallet_treasury.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_treasury`. +pub struct WeightInfo(PhantomData); +impl pallet_treasury::WeightInfo for WeightInfo { + // Storage: Treasury ProposalCount (r:1 w:1) + // Storage: Treasury Proposals (r:0 w:1) + fn propose_spend() -> Weight { + (20_053_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Treasury Proposals (r:1 w:1) + // Storage: System Account (r:1 w:1) + fn reject_proposal() -> Weight { + (31_437_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Treasury Proposals (r:1 w:0) + // Storage: Treasury Approvals (r:1 w:1) + fn approve_proposal(p: u32, ) -> Weight { + (6_947_000 as Weight) + // Standard Error: 0 + .saturating_add((28_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Treasury Approvals (r:1 w:1) + fn remove_approval() -> Weight { + (3_187_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Treasury Approvals (r:1 w:1) + // Storage: Bounties BountyApprovals (r:1 w:1) + // Storage: System Account (r:1 w:1) + // Storage: Treasury Proposals (r:2 w:2) + fn on_initialize_proposals(p: u32, ) -> Weight { + (33_520_000 as Weight) + // Standard Error: 26_000 + .saturating_add((29_886_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(p as Weight))) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(p as Weight))) + } +} From d110c565839a5e1951962055ffbd0956ca7e79a3 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Mon, 20 Jun 2022 20:49:18 +0200 Subject: [PATCH 08/35] tips+claim+identity+elections_phragmen+vesting --- Cargo.lock | 5 + node/service/src/chain_spec.rs | 6 + runtime/rococo/Cargo.toml | 17 ++ runtime/rococo/src/lib.rs | 230 ++++++++---------- runtime/rococo/src/weights/mod.rs | 5 + .../src/weights/pallet_elections_phragmen.rs | 181 ++++++++++++++ runtime/rococo/src/weights/pallet_identity.rs | 211 ++++++++++++++++ runtime/rococo/src/weights/pallet_tips.rs | 104 ++++++++ runtime/rococo/src/weights/pallet_vesting.rs | 141 +++++++++++ .../src/weights/runtime_common_claims.rs | 102 ++++++++ 10 files changed, 877 insertions(+), 125 deletions(-) create mode 100644 runtime/rococo/src/weights/pallet_elections_phragmen.rs create mode 100644 runtime/rococo/src/weights/pallet_identity.rs create mode 100644 runtime/rococo/src/weights/pallet_tips.rs create mode 100644 runtime/rococo/src/weights/pallet_vesting.rs create mode 100644 runtime/rococo/src/weights/runtime_common_claims.rs diff --git a/Cargo.lock b/Cargo.lock index 475d5d05e8ea..e9f069e56b4c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8388,7 +8388,9 @@ dependencies = [ "pallet-child-bounties", "pallet-collective", "pallet-democracy", + "pallet-elections-phragmen", "pallet-grandpa", + "pallet-identity", "pallet-im-online", "pallet-indices", "pallet-membership", @@ -8403,10 +8405,12 @@ dependencies = [ "pallet-staking", "pallet-sudo", "pallet-timestamp", + "pallet-tips", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", "pallet-treasury", "pallet-utility", + "pallet-vesting", "pallet-xcm", "parity-scale-codec", "polkadot-parachain", @@ -8433,6 +8437,7 @@ dependencies = [ "sp-std", "sp-transaction-pool", "sp-version", + "static_assertions", "substrate-wasm-builder", "xcm", "xcm-builder", diff --git a/node/service/src/chain_spec.rs b/node/service/src/chain_spec.rs index 49d8ca4bae41..f80b26c777cc 100644 --- a/node/service/src/chain_spec.rs +++ b/node/service/src/chain_spec.rs @@ -1046,6 +1046,7 @@ fn rococo_staging_testnet_config_genesis(wasm_binary: &[u8]) -> rococo_runtime:: }) .collect::>(), }, + phragmen_election: Default::default(), babe: rococo_runtime::BabeConfig { authorities: Default::default(), epoch_config: Some(rococo_runtime::BABE_GENESIS_EPOCH_CONFIG), @@ -1061,6 +1062,8 @@ fn rococo_staging_testnet_config_genesis(wasm_binary: &[u8]) -> rococo_runtime:: technical_membership: Default::default(), treasury: Default::default(), authority_discovery: rococo_runtime::AuthorityDiscoveryConfig { keys: vec![] }, + claims: rococo::ClaimsConfig { claims: vec![], vesting: vec![] }, + vesting: rococo::VestingConfig { vesting: vec![] }, sudo: rococo_runtime::SudoConfig { key: Some(endowed_accounts[0].clone()) }, paras: rococo_runtime::ParasConfig { paras: vec![] }, hrmp: Default::default(), @@ -1617,6 +1620,7 @@ pub fn rococo_testnet_genesis( }, grandpa: Default::default(), im_online: Default::default(), + phragmen_election: Default::default(), democracy: rococo::DemocracyConfig::default(), council: rococo::CouncilConfig { members: vec![], phantom: Default::default() }, technical_committee: rococo::TechnicalCommitteeConfig { @@ -1625,6 +1629,8 @@ pub fn rococo_testnet_genesis( }, technical_membership: Default::default(), treasury: Default::default(), + claims: rococo::ClaimsConfig { claims: vec![], vesting: vec![] }, + vesting: rococo::VestingConfig { vesting: vec![] }, authority_discovery: rococo_runtime::AuthorityDiscoveryConfig { keys: vec![] }, sudo: rococo_runtime::SudoConfig { key: Some(root_key.clone()) }, hrmp: Default::default(), diff --git a/runtime/rococo/Cargo.toml b/runtime/rococo/Cargo.toml index 9f2c73e5e6fc..f479d32ff177 100644 --- a/runtime/rococo/Cargo.toml +++ b/runtime/rococo/Cargo.toml @@ -10,6 +10,7 @@ parity-scale-codec = { version = "3.1.2", default-features = false, features = [ scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } serde = { version = "1.0.137", default-features = false } serde_derive = { version = "1.0.117", optional = true } +static_assertions = "1.1.0" smallvec = "1.8.0" log = { version = "0.4.17", default-features = false } @@ -42,13 +43,16 @@ pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "m pallet-bounties = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-child-bounties = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-democracy = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-elections-phragmen = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-collective = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-identity = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-im-online = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-indices = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-membership = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-mmr = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-multisig = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-tips = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-treasury = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -62,6 +66,7 @@ pallet-proxy = { git = "https://github.com/paritytech/substrate", branch = "mast pallet-scheduler = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-preimage = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-utility = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-vesting = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } authority-discovery-primitives = { package = "sp-authority-discovery", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } frame-system = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -121,10 +126,12 @@ std = [ "pallet-bridge-grandpa/std", "pallet-bridge-messages/std", "pallet-collective/std", + "pallet-elections-phragmen/std", "pallet-beefy/std", "pallet-beefy-mmr/std", "pallet-democracy/std", "pallet-grandpa/std", + "pallet-identity/std", "pallet-sudo/std", "pallet-membership/std", "pallet-mmr/std", @@ -136,12 +143,14 @@ std = [ "pallet-offences/std", "pallet-proxy/std", "pallet-timestamp/std", + "pallet-tips/std", "pallet-transaction-payment/std", "pallet-transaction-payment-rpc-runtime-api/std", "pallet-treasury/std", "pallet-collective/std", "pallet-scheduler/std", "pallet-preimage/std", + "pallet-vesting/std", "inherents/std", "frame-support/std", "polkadot-parachain/std", @@ -189,9 +198,11 @@ runtime-benchmarks = [ "pallet-child-bounties/runtime-benchmarks", "pallet-collective/runtime-benchmarks", "pallet-collective/std", + "pallet-elections-phragmen/runtime-benchmarks", "pallet-democracy/runtime-benchmarks", "pallet-preimage/runtime-benchmarks", "pallet-grandpa/runtime-benchmarks", + "pallet-identity/runtime-benchmarks", "pallet-im-online/runtime-benchmarks", "pallet-indices/runtime-benchmarks", "pallet-membership/runtime-benchmarks", @@ -199,8 +210,10 @@ runtime-benchmarks = [ "pallet-staking/runtime-benchmarks", "pallet-society/runtime-benchmarks", "pallet-timestamp/runtime-benchmarks", + "pallet-tips/runtime-benchmarks", "pallet-utility/runtime-benchmarks", "pallet-xcm/runtime-benchmarks", + "pallet-vesting/runtime-benchmarks", "xcm-builder/runtime-benchmarks", "pallet-multisig/runtime-benchmarks", "frame-benchmarking/runtime-benchmarks", @@ -221,7 +234,9 @@ try-runtime = [ "pallet-child-bounties/try-runtime", "pallet-collective/try-runtime", "pallet-democracy/try-runtime", + "pallet-elections-phragmen/try-runtime", "pallet-grandpa/try-runtime", + "pallet-identity/try-runtime", "pallet-sudo/try-runtime", "pallet-indices/try-runtime", "pallet-im-online/try-runtime", @@ -232,9 +247,11 @@ try-runtime = [ "pallet-staking/try-runtime", "pallet-offences/try-runtime", "pallet-timestamp/try-runtime", + "pallet-tips/try-runtime", "pallet-transaction-payment/try-runtime", "pallet-treasury/runtime-benchmarks", "pallet-collective/try-runtime", + "pallet-vesting/try-runtime", "runtime-common/try-runtime", "pallet-multisig/try-runtime", "pallet-scheduler/try-runtime", diff --git a/runtime/rococo/src/lib.rs b/runtime/rococo/src/lib.rs index 43a69a03dfc1..7cadf928ca0c 100644 --- a/runtime/rococo/src/lib.rs +++ b/runtime/rococo/src/lib.rs @@ -29,7 +29,7 @@ use primitives::v2::{ ValidationCode, ValidationCodeHash, ValidatorId, ValidatorIndex, }; use runtime_common::{ - assigned_slots, auctions, crowdloan, impl_runtime_weights, impls::ToAuthor, paras_registrar, + assigned_slots, auctions, claims, crowdloan, impl_runtime_weights, impls::ToAuthor, paras_registrar, prod_or_fast, paras_sudo_wrapper, slots, BlockHashCount, BlockLength, SlowAdjustingFeeUpdate, }; use sp_std::{cmp::Ordering, collections::btree_map::BTreeMap, prelude::*}; @@ -54,7 +54,7 @@ use beefy_primitives::{ // }; use frame_support::{ construct_runtime, parameter_types, - traits::{Contains, EnsureOneOf, InstanceFilter, KeyOwnerProofSystem, PrivilegeCmp}, + traits::{Contains, EnsureOneOf, InstanceFilter, KeyOwnerProofSystem, PrivilegeCmp, LockIdentifier}, weights::ConstantMultiplier, PalletId, RuntimeDebug }; @@ -68,7 +68,7 @@ use sp_mmr_primitives as mmr; use sp_runtime::{ create_runtime_str, generic, impl_opaque_keys, traits::{ - AccountIdLookup, BlakeTwo256, Block as BlockT, Extrinsic as ExtrinsicT, Keccak256, + AccountIdLookup, BlakeTwo256, Block as BlockT, ConvertInto, Extrinsic as ExtrinsicT, Keccak256, OpaqueKeys, SaturatedConversion, Verify, }, transaction_validity::{TransactionPriority, TransactionSource, TransactionValidity}, @@ -78,8 +78,7 @@ use sp_staking::SessionIndex; #[cfg(any(feature = "std", test))] use sp_version::NativeVersion; use sp_version::RuntimeVersion; -// TODO: Elections Phragmen -// use static_assertions::const_assert; +use static_assertions::const_assert; pub use frame_system::Call as SystemCall; // TODO: Election @@ -712,42 +711,39 @@ impl pallet_collective::Config for Runtime { type WeightInfo = weights::pallet_collective::WeightInfo; } -// TODO: Elections Phragmen -// parameter_types! { -// pub const CandidacyBond: Balance = 100 * CENTS; -// // 1 storage item created, key size is 32 bytes, value size is 16+16. -// pub const VotingBondBase: Balance = deposit(1, 64); -// // additional data per vote is 32 bytes (account id). -// pub const VotingBondFactor: Balance = deposit(0, 32); -// /// Daily council elections -// pub TermDuration: BlockNumber = prod_or_fast!(24 * HOURS, 2 * MINUTES, "KSM_TERM_DURATION"); -// pub const DesiredMembers: u32 = 19; -// pub const DesiredRunnersUp: u32 = 19; -// pub const PhragmenElectionPalletId: LockIdentifier = *b"phrelect"; -// } - -// TODO: Elections Phragmen -//// Make sure that there are no more than MaxMembers members elected via phragmen. -// const_assert!(DesiredMembers::get() <= CouncilMaxMembers::get()); - -// TODO: Elections Phragmen -// impl pallet_elections_phragmen::Config for Runtime { -// type Event = Event; -// type Currency = Balances; -// type ChangeMembers = Council; -// type InitializeMembers = Council; -// type CurrencyToVote = frame_support::traits::U128CurrencyToVote; -// type CandidacyBond = CandidacyBond; -// type VotingBondBase = VotingBondBase; -// type VotingBondFactor = VotingBondFactor; -// type LoserCandidate = Treasury; -// type KickedMember = Treasury; -// type DesiredMembers = DesiredMembers; -// type DesiredRunnersUp = DesiredRunnersUp; -// type TermDuration = TermDuration; -// type PalletId = PhragmenElectionPalletId; -// type WeightInfo = weights::pallet_elections_phragmen::WeightInfo; -// } +parameter_types! { + pub const CandidacyBond: Balance = 100 * CENTS; + // 1 storage item created, key size is 32 bytes, value size is 16+16. + pub const VotingBondBase: Balance = deposit(1, 64); + // additional data per vote is 32 bytes (account id). + pub const VotingBondFactor: Balance = deposit(0, 32); + /// Daily council elections + pub TermDuration: BlockNumber = prod_or_fast!(24 * HOURS, 2 * MINUTES, "ROC_TERM_DURATION"); + pub const DesiredMembers: u32 = 19; + pub const DesiredRunnersUp: u32 = 19; + pub const PhragmenElectionPalletId: LockIdentifier = *b"phrelect"; +} + +// Make sure that there are no more than MaxMembers members elected via phragmen. +const_assert!(DesiredMembers::get() <= CouncilMaxMembers::get()); + +impl pallet_elections_phragmen::Config for Runtime { + type Event = Event; + type Currency = Balances; + type ChangeMembers = Council; + type InitializeMembers = Council; + type CurrencyToVote = frame_support::traits::U128CurrencyToVote; + type CandidacyBond = CandidacyBond; + type VotingBondBase = VotingBondBase; + type VotingBondFactor = VotingBondFactor; + type LoserCandidate = Treasury; + type KickedMember = Treasury; + type DesiredMembers = DesiredMembers; + type DesiredRunnersUp = DesiredRunnersUp; + type TermDuration = TermDuration; + type PalletId = PhragmenElectionPalletId; + type WeightInfo = weights::pallet_elections_phragmen::WeightInfo; +} parameter_types! { pub TechnicalMotionDuration: BlockNumber = prod_or_fast!(3 * DAYS, 2 * MINUTES, "KSM_MOTION_DURATION"); @@ -865,17 +861,16 @@ impl pallet_child_bounties::Config for Runtime { type WeightInfo = weights::pallet_child_bounties::WeightInfo; } -// TODO: Tips -// impl pallet_tips::Config for Runtime { -// type MaximumReasonLength = MaximumReasonLength; -// type DataDepositPerByte = DataDepositPerByte; -// type Tippers = PhragmenElection; -// type TipCountdown = TipCountdown; -// type TipFindersFee = TipFindersFee; -// type TipReportDepositBase = TipReportDepositBase; -// type Event = Event; -// type WeightInfo = weights::pallet_tips::WeightInfo; -// } +impl pallet_tips::Config for Runtime { + type MaximumReasonLength = MaximumReasonLength; + type DataDepositPerByte = DataDepositPerByte; + type Tippers = PhragmenElection; + type TipCountdown = TipCountdown; + type TipFindersFee = TipFindersFee; + type TipReportDepositBase = TipReportDepositBase; + type Event = Event; + type WeightInfo = weights::pallet_tips::WeightInfo; +} impl pallet_offences::Config for Runtime { type Event = Event; @@ -993,47 +988,43 @@ where type OverarchingCall = Call; } -// TODO: Claims -// parameter_types! { -// pub Prefix: &'static [u8] = b"Pay KSMs to the Kusama account:"; -// } +parameter_types! { + pub Prefix: &'static [u8] = b"Pay ROCs to the Rococo account:"; +} -// TODO: Claims -// impl claims::Config for Runtime { -// type Event = Event; -// type VestingSchedule = Vesting; -// type Prefix = Prefix; -// type MoveClaimOrigin = -// pallet_collective::EnsureProportionMoreThan; -// type WeightInfo = weights::runtime_common_claims::WeightInfo; -// } +impl claims::Config for Runtime { + type Event = Event; + type VestingSchedule = Vesting; + type Prefix = Prefix; + type MoveClaimOrigin = + pallet_collective::EnsureProportionMoreThan; + type WeightInfo = weights::runtime_common_claims::WeightInfo; +} -// TODO: Identity -// parameter_types! { -// // Minimum 100 bytes/KSM deposited (1 CENT/byte) -// pub const BasicDeposit: Balance = 1000 * CENTS; // 258 bytes on-chain -// pub const FieldDeposit: Balance = 250 * CENTS; // 66 bytes on-chain -// pub const SubAccountDeposit: Balance = 200 * CENTS; // 53 bytes on-chain -// pub const MaxSubAccounts: u32 = 100; -// pub const MaxAdditionalFields: u32 = 100; -// pub const MaxRegistrars: u32 = 20; -// } +parameter_types! { + // Minimum 100 bytes/KSM deposited (1 CENT/byte) + pub const BasicDeposit: Balance = 1000 * CENTS; // 258 bytes on-chain + pub const FieldDeposit: Balance = 250 * CENTS; // 66 bytes on-chain + pub const SubAccountDeposit: Balance = 200 * CENTS; // 53 bytes on-chain + pub const MaxSubAccounts: u32 = 100; + pub const MaxAdditionalFields: u32 = 100; + pub const MaxRegistrars: u32 = 20; +} -// TODO: Identity -// impl pallet_identity::Config for Runtime { -// type Event = Event; -// type Currency = Balances; -// type BasicDeposit = BasicDeposit; -// type FieldDeposit = FieldDeposit; -// type SubAccountDeposit = SubAccountDeposit; -// type MaxSubAccounts = MaxSubAccounts; -// type MaxAdditionalFields = MaxAdditionalFields; -// type MaxRegistrars = MaxRegistrars; -// type Slashed = Treasury; -// type ForceOrigin = MoreThanHalfCouncil; -// type RegistrarOrigin = MoreThanHalfCouncil; -// type WeightInfo = weights::pallet_identity::WeightInfo; -// } +impl pallet_identity::Config for Runtime { + type Event = Event; + type Currency = Balances; + type BasicDeposit = BasicDeposit; + type FieldDeposit = FieldDeposit; + type SubAccountDeposit = SubAccountDeposit; + type MaxSubAccounts = MaxSubAccounts; + type MaxAdditionalFields = MaxAdditionalFields; + type MaxRegistrars = MaxRegistrars; + type Slashed = Treasury; + type ForceOrigin = MoreThanHalfCouncil; + type RegistrarOrigin = MoreThanHalfCouncil; + type WeightInfo = weights::pallet_identity::WeightInfo; +} impl pallet_utility::Config for Runtime { type Event = Event; @@ -1111,20 +1102,18 @@ impl pallet_society::Config for Runtime { type PalletId = SocietyPalletId; } -// TODO: Vesting -// parameter_types! { -// pub const MinVestedTransfer: Balance = 100 * CENTS; -// } +parameter_types! { + pub const MinVestedTransfer: Balance = 100 * CENTS; +} -// TODO: Vesting -// impl pallet_vesting::Config for Runtime { -// type Event = Event; -// type Currency = Balances; -// type BlockNumberToBalance = ConvertInto; -// type MinVestedTransfer = MinVestedTransfer; -// type WeightInfo = weights::pallet_vesting::WeightInfo; -// const MAX_VESTING_SCHEDULES: u32 = 28; -// } +impl pallet_vesting::Config for Runtime { + type Event = Event; + type Currency = Balances; + type BlockNumberToBalance = ConvertInto; + type MinVestedTransfer = MinVestedTransfer; + type WeightInfo = weights::pallet_vesting::WeightInfo; + const MAX_VESTING_SCHEDULES: u32 = 28; +} parameter_types! { // One storage item; key size 32, value size 8; . @@ -1788,21 +1777,18 @@ construct_runtime! { Democracy: pallet_democracy::{Pallet, Call, Storage, Config, Event} = 13, Council: pallet_collective::::{Pallet, Call, Storage, Origin, Event, Config} = 14, TechnicalCommittee: pallet_collective::::{Pallet, Call, Storage, Origin, Event, Config} = 15, - // TODO: Elections Prhargmen - // PhragmenElection: pallet_elections_phragmen::{Pallet, Call, Storage, Event, Config} = 16, + PhragmenElection: pallet_elections_phragmen::{Pallet, Call, Storage, Event, Config} = 16, TechnicalMembership: pallet_membership::::{Pallet, Call, Storage, Event, Config} = 17, Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event} = 18, - // TODO: Claims - //// Claims. Usable initially. - // Claims: claims::{Pallet, Call, Storage, Event, Config, ValidateUnsigned} = 19, + // Claims. Usable initially. + Claims: claims::{Pallet, Call, Storage, Event, Config, ValidateUnsigned} = 19, // Utility module. Utility: pallet_utility::{Pallet, Call, Event} = 24, - // TODO: Identity - //// Less simple identity module. - // Identity: pallet_identity::{Pallet, Call, Storage, Event} = 25, + // Less simple identity module. + Identity: pallet_identity::{Pallet, Call, Storage, Event} = 25, // Society module. Society: pallet_society::{Pallet, Call, Storage, Event} = 26, @@ -1811,9 +1797,8 @@ construct_runtime! { //// Social recovery module. // Recovery: pallet_recovery::{Pallet, Call, Storage, Event} = 27, - // TODO: Vesting - //// Vesting. Usable initially, but removed once all vesting is finished. - // Vesting: pallet_vesting::{Pallet, Call, Storage, Event, Config} = 28, + // Vesting. Usable initially, but removed once all vesting is finished. + Vesting: pallet_vesting::{Pallet, Call, Storage, Event, Config} = 28, // System scheduler. Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event} = 29, @@ -1837,9 +1822,8 @@ construct_runtime! { Bounties: pallet_bounties::{Pallet, Call, Storage, Event} = 35, ChildBounties: pallet_child_bounties = 40, - // TODO: Tips - //// Tips module. - // Tips: pallet_tips::{Pallet, Call, Storage, Event} = 36, + // Tips module. + Tips: pallet_tips::{Pallet, Call, Storage, Event} = 36, // TODO: Election //// Election pallet. Only works with staking, but placed here to maintain indices. @@ -1969,8 +1953,7 @@ mod benches { // the that path resolves correctly in the generated file. [runtime_common::auctions, Auctions] [runtime_common::crowdloan, Crowdloan] - // TODO: Claims - // [runtime_common::claims, Claims] + [runtime_common::claims, Claims] [runtime_common::slots, Slots] [runtime_common::paras_registrar, Registrar] [runtime_parachains::configuration, Configuration] @@ -1991,15 +1974,13 @@ mod benches { [pallet_collective, Council] [pallet_collective, TechnicalCommittee] [pallet_democracy, Democracy] - // TODO: Elections Phragmen - // [pallet_elections_phragmen, PhragmenElection] + [pallet_elections_phragmen, PhragmenElection] // TODO: Election // [pallet_election_provider_multi_phase, ElectionProviderMultiPhase] // [frame_election_provider_support, ElectionProviderBench::] // TODO: Gilt // [pallet_gilt, Gilt] - // TODO: Identity - // [pallet_identity, Identity] + [pallet_identity, Identity] [pallet_im_online, ImOnline] [pallet_indices, Indices] [pallet_membership, TechnicalMembership] @@ -2018,8 +1999,7 @@ mod benches { // [pallet_staking, Staking] [frame_system, SystemBench::] [pallet_timestamp, Timestamp] - // TODO: Tips - // [pallet_tips, Tips] + [pallet_tips, Tips] [pallet_treasury, Treasury] [pallet_utility, Utility] // TODO: Vesting diff --git a/runtime/rococo/src/weights/mod.rs b/runtime/rococo/src/weights/mod.rs index 085986268cc4..62c2e13e9250 100644 --- a/runtime/rococo/src/weights/mod.rs +++ b/runtime/rococo/src/weights/mod.rs @@ -21,19 +21,24 @@ pub mod pallet_bounties; pub mod pallet_child_bounties; pub mod pallet_collective; pub mod pallet_democracy; +pub mod pallet_elections_phragmen; pub mod pallet_im_online; +pub mod pallet_identity; pub mod pallet_indices; pub mod pallet_membership; pub mod pallet_multisig; pub mod pallet_proxy; pub mod pallet_session; pub mod pallet_timestamp; +pub mod pallet_tips; pub mod pallet_treasury; pub mod pallet_utility; pub mod pallet_scheduler; pub mod pallet_preimage; pub mod pallet_collective_technical_committee; +pub mod pallet_vesting; pub mod runtime_common_auctions; +pub mod runtime_common_claims; pub mod runtime_common_crowdloan; pub mod runtime_common_paras_registrar; pub mod runtime_common_slots; diff --git a/runtime/rococo/src/weights/pallet_elections_phragmen.rs b/runtime/rococo/src/weights/pallet_elections_phragmen.rs new file mode 100644 index 000000000000..e67f3f6d3c6c --- /dev/null +++ b/runtime/rococo/src/weights/pallet_elections_phragmen.rs @@ -0,0 +1,181 @@ +// Copyright 2017-2022 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_elections_phragmen` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-05-11, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/production/polkadot +// benchmark +// pallet +// --chain=kusama-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_elections_phragmen +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/kusama/src/weights/pallet_elections_phragmen.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_elections_phragmen`. +pub struct WeightInfo(PhantomData); +impl pallet_elections_phragmen::WeightInfo for WeightInfo { + // Storage: PhragmenElection Candidates (r:1 w:0) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: PhragmenElection RunnersUp (r:1 w:0) + // Storage: PhragmenElection Voting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + fn vote_equal(v: u32, ) -> Weight { + (21_240_000 as Weight) + // Standard Error: 9_000 + .saturating_add((190_000 as Weight).saturating_mul(v as Weight)) + .saturating_add(T::DbWeight::get().reads(5 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: PhragmenElection Candidates (r:1 w:0) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: PhragmenElection RunnersUp (r:1 w:0) + // Storage: PhragmenElection Voting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + fn vote_more(v: u32, ) -> Weight { + (33_409_000 as Weight) + // Standard Error: 12_000 + .saturating_add((152_000 as Weight).saturating_mul(v as Weight)) + .saturating_add(T::DbWeight::get().reads(5 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: PhragmenElection Candidates (r:1 w:0) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: PhragmenElection RunnersUp (r:1 w:0) + // Storage: PhragmenElection Voting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + fn vote_less(v: u32, ) -> Weight { + (32_961_000 as Weight) + // Standard Error: 9_000 + .saturating_add((180_000 as Weight).saturating_mul(v as Weight)) + .saturating_add(T::DbWeight::get().reads(5 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: PhragmenElection Voting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + fn remove_voter() -> Weight { + (29_515_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: PhragmenElection Candidates (r:1 w:1) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: PhragmenElection RunnersUp (r:1 w:0) + fn submit_candidacy(c: u32, ) -> Weight { + (30_999_000 as Weight) + // Standard Error: 0 + .saturating_add((135_000 as Weight).saturating_mul(c as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: PhragmenElection Candidates (r:1 w:1) + fn renounce_candidacy_candidate(c: u32, ) -> Weight { + (25_741_000 as Weight) + // Standard Error: 0 + .saturating_add((70_000 as Weight).saturating_mul(c as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: PhragmenElection Members (r:1 w:1) + // Storage: PhragmenElection RunnersUp (r:1 w:1) + // Storage: Council Prime (r:1 w:1) + // Storage: Council Proposals (r:1 w:0) + // Storage: Council Members (r:0 w:1) + fn renounce_candidacy_members() -> Weight { + (39_440_000 as Weight) + .saturating_add(T::DbWeight::get().reads(4 as Weight)) + .saturating_add(T::DbWeight::get().writes(4 as Weight)) + } + // Storage: PhragmenElection RunnersUp (r:1 w:1) + fn renounce_candidacy_runners_up() -> Weight { + (27_483_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Benchmark Override (r:0 w:0) + fn remove_member_without_replacement() -> Weight { + (2_000_000_000_000 as Weight) + } + // Storage: PhragmenElection RunnersUp (r:1 w:1) + // Storage: PhragmenElection Members (r:1 w:1) + // Storage: System Account (r:1 w:1) + // Storage: Council Prime (r:1 w:1) + // Storage: Council Proposals (r:1 w:0) + // Storage: Council Members (r:0 w:1) + fn remove_member_with_replacement() -> Weight { + (54_903_000 as Weight) + .saturating_add(T::DbWeight::get().reads(5 as Weight)) + .saturating_add(T::DbWeight::get().writes(5 as Weight)) + } + // Storage: PhragmenElection RunnersUp (r:1 w:0) + fn remove_member_wrong_refund() -> Weight { + (5_203_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + } + // Storage: PhragmenElection Voting (r:251 w:250) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: PhragmenElection RunnersUp (r:1 w:0) + // Storage: PhragmenElection Candidates (r:1 w:0) + // Storage: Balances Locks (r:250 w:250) + // Storage: System Account (r:250 w:250) + fn clean_defunct_voters(v: u32, d: u32, ) -> Weight { + (0 as Weight) + // Standard Error: 42_000 + .saturating_add((47_366_000 as Weight).saturating_mul(v as Weight)) + // Standard Error: 40_000 + .saturating_add((240_000 as Weight).saturating_mul(d as Weight)) + .saturating_add(T::DbWeight::get().reads(4 as Weight)) + .saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(v as Weight))) + .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(v as Weight))) + } + // Storage: PhragmenElection Candidates (r:1 w:1) + // Storage: PhragmenElection Members (r:1 w:1) + // Storage: PhragmenElection RunnersUp (r:1 w:1) + // Storage: PhragmenElection Voting (r:502 w:0) + // Storage: Council Proposals (r:1 w:0) + // Storage: PhragmenElection ElectionRounds (r:1 w:1) + // Storage: Council Members (r:0 w:1) + // Storage: Council Prime (r:0 w:1) + // Storage: System Account (r:2 w:2) + fn election_phragmen(c: u32, v: u32, e: u32, ) -> Weight { + (0 as Weight) + // Standard Error: 2_735_000 + .saturating_add((135_428_000 as Weight).saturating_mul(c as Weight)) + // Standard Error: 1_137_000 + .saturating_add((103_462_000 as Weight).saturating_mul(v as Weight)) + // Standard Error: 77_000 + .saturating_add((7_116_000 as Weight).saturating_mul(e as Weight)) + .saturating_add(T::DbWeight::get().reads((2 as Weight).saturating_mul(c as Weight))) + .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(v as Weight))) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(c as Weight))) + } +} diff --git a/runtime/rococo/src/weights/pallet_identity.rs b/runtime/rococo/src/weights/pallet_identity.rs new file mode 100644 index 000000000000..d23069043549 --- /dev/null +++ b/runtime/rococo/src/weights/pallet_identity.rs @@ -0,0 +1,211 @@ +// Copyright 2017-2022 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_identity` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-05-11, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/production/polkadot +// benchmark +// pallet +// --chain=rococo-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_identity +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/rococo/src/weights/pallet_identity.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_identity`. +pub struct WeightInfo(PhantomData); +impl pallet_identity::WeightInfo for WeightInfo { + // Storage: Identity Registrars (r:1 w:1) + fn add_registrar(r: u32, ) -> Weight { + (12_429_000 as Weight) + // Standard Error: 4_000 + .saturating_add((200_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Identity IdentityOf (r:1 w:1) + fn set_identity(r: u32, x: u32, ) -> Weight { + (26_281_000 as Weight) + // Standard Error: 8_000 + .saturating_add((157_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 1_000 + .saturating_add((367_000 as Weight).saturating_mul(x as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Identity IdentityOf (r:1 w:0) + // Storage: Identity SubsOf (r:1 w:1) + // Storage: Identity SuperOf (r:1 w:1) + fn set_subs_new(s: u32, ) -> Weight { + (22_123_000 as Weight) + // Standard Error: 1_000 + .saturating_add((2_656_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight))) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) + } + // Storage: Identity IdentityOf (r:1 w:0) + // Storage: Identity SubsOf (r:1 w:1) + // Storage: Identity SuperOf (r:0 w:1) + fn set_subs_old(p: u32, ) -> Weight { + (22_181_000 as Weight) + // Standard Error: 0 + .saturating_add((739_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(p as Weight))) + } + // Storage: Identity SubsOf (r:1 w:1) + // Storage: Identity IdentityOf (r:1 w:1) + // Storage: Identity SuperOf (r:0 w:100) + fn clear_identity(r: u32, s: u32, x: u32, ) -> Weight { + (27_995_000 as Weight) + // Standard Error: 6_000 + .saturating_add((86_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 0 + .saturating_add((723_000 as Weight).saturating_mul(s as Weight)) + // Standard Error: 0 + .saturating_add((229_000 as Weight).saturating_mul(x as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) + } + // Storage: Identity Registrars (r:1 w:0) + // Storage: Identity IdentityOf (r:1 w:1) + fn request_judgement(r: u32, x: u32, ) -> Weight { + (27_627_000 as Weight) + // Standard Error: 5_000 + .saturating_add((166_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 0 + .saturating_add((427_000 as Weight).saturating_mul(x as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Identity IdentityOf (r:1 w:1) + fn cancel_request(r: u32, x: u32, ) -> Weight { + (23_894_000 as Weight) + // Standard Error: 7_000 + .saturating_add((153_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 0 + .saturating_add((422_000 as Weight).saturating_mul(x as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Identity Registrars (r:1 w:1) + fn set_fee(r: u32, ) -> Weight { + (4_504_000 as Weight) + // Standard Error: 2_000 + .saturating_add((163_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Identity Registrars (r:1 w:1) + fn set_account_id(r: u32, ) -> Weight { + (4_320_000 as Weight) + // Standard Error: 1_000 + .saturating_add((159_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Identity Registrars (r:1 w:1) + fn set_fields(r: u32, ) -> Weight { + (4_498_000 as Weight) + // Standard Error: 2_000 + .saturating_add((165_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Identity Registrars (r:1 w:0) + // Storage: Identity IdentityOf (r:1 w:1) + fn provide_judgement(r: u32, x: u32, ) -> Weight { + (18_213_000 as Weight) + // Standard Error: 5_000 + .saturating_add((158_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 0 + .saturating_add((427_000 as Weight).saturating_mul(x as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Identity SubsOf (r:1 w:1) + // Storage: Identity IdentityOf (r:1 w:1) + // Storage: System Account (r:1 w:1) + // Storage: Identity SuperOf (r:0 w:100) + fn kill_identity(r: u32, s: u32, _x: u32, ) -> Weight { + (42_006_000 as Weight) + // Standard Error: 11_000 + .saturating_add((72_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 1_000 + .saturating_add((722_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) + } + // Storage: Identity IdentityOf (r:1 w:0) + // Storage: Identity SuperOf (r:1 w:1) + // Storage: Identity SubsOf (r:1 w:1) + fn add_sub(s: u32, ) -> Weight { + (29_352_000 as Weight) + // Standard Error: 0 + .saturating_add((113_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Identity IdentityOf (r:1 w:0) + // Storage: Identity SuperOf (r:1 w:1) + fn rename_sub(s: u32, ) -> Weight { + (8_911_000 as Weight) + // Standard Error: 0 + .saturating_add((20_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Identity IdentityOf (r:1 w:0) + // Storage: Identity SuperOf (r:1 w:1) + // Storage: Identity SubsOf (r:1 w:1) + fn remove_sub(s: u32, ) -> Weight { + (30_027_000 as Weight) + // Standard Error: 0 + .saturating_add((102_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Identity SuperOf (r:1 w:1) + // Storage: Identity SubsOf (r:1 w:1) + fn quit_sub(s: u32, ) -> Weight { + (19_939_000 as Weight) + // Standard Error: 0 + .saturating_add((96_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } +} diff --git a/runtime/rococo/src/weights/pallet_tips.rs b/runtime/rococo/src/weights/pallet_tips.rs new file mode 100644 index 000000000000..bffdbab64516 --- /dev/null +++ b/runtime/rococo/src/weights/pallet_tips.rs @@ -0,0 +1,104 @@ +// Copyright 2017-2022 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_tips` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-05-11, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/production/polkadot +// benchmark +// pallet +// --chain=rococo-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_tips +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/rococo/src/weights/pallet_tips.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_tips`. +pub struct WeightInfo(PhantomData); +impl pallet_tips::WeightInfo for WeightInfo { + // Storage: Tips Reasons (r:1 w:1) + // Storage: Tips Tips (r:1 w:1) + fn report_awesome(r: u32, ) -> Weight { + (24_012_000 as Weight) + // Standard Error: 0 + .saturating_add((2_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Tips Tips (r:1 w:1) + // Storage: Tips Reasons (r:0 w:1) + fn retract_tip() -> Weight { + (22_820_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: Tips Reasons (r:1 w:1) + // Storage: Tips Tips (r:0 w:1) + fn tip_new(r: u32, t: u32, ) -> Weight { + (15_944_000 as Weight) + // Standard Error: 0 + .saturating_add((2_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 3_000 + .saturating_add((65_000 as Weight).saturating_mul(t as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: Tips Tips (r:1 w:1) + fn tip(t: u32, ) -> Weight { + (8_400_000 as Weight) + // Standard Error: 2_000 + .saturating_add((341_000 as Weight).saturating_mul(t as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Tips Tips (r:1 w:1) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: System Account (r:1 w:1) + // Storage: Tips Reasons (r:0 w:1) + fn close_tip(t: u32, ) -> Weight { + (39_172_000 as Weight) + // Standard Error: 6_000 + .saturating_add((190_000 as Weight).saturating_mul(t as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + // Storage: Tips Tips (r:1 w:1) + // Storage: Tips Reasons (r:0 w:1) + fn slash_tip(t: u32, ) -> Weight { + (13_435_000 as Weight) + // Standard Error: 2_000 + .saturating_add((22_000 as Weight).saturating_mul(t as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } +} diff --git a/runtime/rococo/src/weights/pallet_vesting.rs b/runtime/rococo/src/weights/pallet_vesting.rs new file mode 100644 index 000000000000..3d1063ffb533 --- /dev/null +++ b/runtime/rococo/src/weights/pallet_vesting.rs @@ -0,0 +1,141 @@ +// Copyright 2017-2022 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_vesting` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-05-11, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/production/polkadot +// benchmark +// pallet +// --chain=rococo-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_vesting +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/rococo/src/weights/pallet_vesting.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_vesting`. +pub struct WeightInfo(PhantomData); +impl pallet_vesting::WeightInfo for WeightInfo { + // Storage: Vesting Vesting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + fn vest_locked(l: u32, s: u32, ) -> Weight { + (24_521_000 as Weight) + // Standard Error: 0 + .saturating_add((88_000 as Weight).saturating_mul(l as Weight)) + // Standard Error: 1_000 + .saturating_add((179_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + fn vest_unlocked(l: u32, s: u32, ) -> Weight { + (24_314_000 as Weight) + // Standard Error: 0 + .saturating_add((87_000 as Weight).saturating_mul(l as Weight)) + // Standard Error: 1_000 + .saturating_add((145_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + fn vest_other_locked(l: u32, s: u32, ) -> Weight { + (23_625_000 as Weight) + // Standard Error: 1_000 + .saturating_add((99_000 as Weight).saturating_mul(l as Weight)) + // Standard Error: 2_000 + .saturating_add((198_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + fn vest_other_unlocked(l: u32, s: u32, ) -> Weight { + (24_100_000 as Weight) + // Standard Error: 0 + .saturating_add((85_000 as Weight).saturating_mul(l as Weight)) + // Standard Error: 1_000 + .saturating_add((149_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: System Account (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + fn vested_transfer(l: u32, s: u32, ) -> Weight { + (39_750_000 as Weight) + // Standard Error: 2_000 + .saturating_add((90_000 as Weight).saturating_mul(l as Weight)) + // Standard Error: 4_000 + .saturating_add((142_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: System Account (r:2 w:2) + // Storage: Balances Locks (r:1 w:1) + fn force_vested_transfer(l: u32, s: u32, ) -> Weight { + (38_890_000 as Weight) + // Standard Error: 1_000 + .saturating_add((89_000 as Weight).saturating_mul(l as Weight)) + // Standard Error: 3_000 + .saturating_add((161_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(4 as Weight)) + .saturating_add(T::DbWeight::get().writes(4 as Weight)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + fn not_unlocking_merge_schedules(l: u32, s: u32, ) -> Weight { + (24_945_000 as Weight) + // Standard Error: 0 + .saturating_add((93_000 as Weight).saturating_mul(l as Weight)) + // Standard Error: 1_000 + .saturating_add((189_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + fn unlocking_merge_schedules(l: u32, s: u32, ) -> Weight { + (25_402_000 as Weight) + // Standard Error: 0 + .saturating_add((85_000 as Weight).saturating_mul(l as Weight)) + // Standard Error: 1_000 + .saturating_add((178_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } +} diff --git a/runtime/rococo/src/weights/runtime_common_claims.rs b/runtime/rococo/src/weights/runtime_common_claims.rs new file mode 100644 index 000000000000..89481d32ccf0 --- /dev/null +++ b/runtime/rococo/src/weights/runtime_common_claims.rs @@ -0,0 +1,102 @@ +// Copyright 2017-2022 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 `runtime_common::claims` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-05-11, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/production/polkadot +// benchmark +// pallet +// --chain=rococo-dev +// --steps=50 +// --repeat=20 +// --pallet=runtime_common::claims +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/rococo/src/weights/runtime_common_claims.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `runtime_common::claims`. +pub struct WeightInfo(PhantomData); +impl runtime_common::claims::WeightInfo for WeightInfo { + // Storage: Claims Claims (r:1 w:1) + // Storage: Claims Signing (r:1 w:1) + // Storage: Claims Total (r:1 w:1) + // Storage: Claims Vesting (r:1 w:1) + // Storage: Vesting Vesting (r:1 w:1) + // Storage: System Account (r:1 w:0) + // Storage: Balances Locks (r:1 w:1) + fn claim() -> Weight { + (136_684_000 as Weight) + .saturating_add(T::DbWeight::get().reads(7 as Weight)) + .saturating_add(T::DbWeight::get().writes(6 as Weight)) + } + // Storage: Claims Total (r:1 w:1) + // Storage: Claims Vesting (r:0 w:1) + // Storage: Claims Claims (r:0 w:1) + // Storage: Claims Signing (r:0 w:1) + fn mint_claim() -> Weight { + (6_261_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(4 as Weight)) + } + // Storage: Claims Claims (r:1 w:1) + // Storage: Claims Signing (r:1 w:1) + // Storage: Claims Total (r:1 w:1) + // Storage: Claims Vesting (r:1 w:1) + // Storage: Vesting Vesting (r:1 w:1) + // Storage: System Account (r:1 w:0) + // Storage: Balances Locks (r:1 w:1) + fn claim_attest() -> Weight { + (140_914_000 as Weight) + .saturating_add(T::DbWeight::get().reads(7 as Weight)) + .saturating_add(T::DbWeight::get().writes(6 as Weight)) + } + // Storage: Claims Preclaims (r:1 w:1) + // Storage: Claims Signing (r:1 w:1) + // Storage: Claims Claims (r:1 w:1) + // Storage: Claims Total (r:1 w:1) + // Storage: Claims Vesting (r:1 w:1) + // Storage: Vesting Vesting (r:1 w:1) + // Storage: System Account (r:1 w:0) + // Storage: Balances Locks (r:1 w:1) + fn attest() -> Weight { + (57_479_000 as Weight) + .saturating_add(T::DbWeight::get().reads(8 as Weight)) + .saturating_add(T::DbWeight::get().writes(7 as Weight)) + } + // Storage: Claims Claims (r:1 w:2) + // Storage: Claims Vesting (r:1 w:2) + // Storage: Claims Signing (r:1 w:2) + // Storage: Claims Preclaims (r:1 w:1) + fn move_claim() -> Weight { + (15_201_000 as Weight) + .saturating_add(T::DbWeight::get().reads(4 as Weight)) + .saturating_add(T::DbWeight::get().writes(7 as Weight)) + } +} From 58498df3902b9a79a2f18d8d202f111f315fb2bd Mon Sep 17 00:00:00 2001 From: NachoPal Date: Mon, 20 Jun 2022 21:10:24 +0200 Subject: [PATCH 09/35] recovery+gilt --- Cargo.lock | 2 + node/service/src/chain_spec.rs | 2 + runtime/rococo/Cargo.toml | 7 ++ runtime/rococo/src/lib.rs | 108 +++++++++----------- runtime/rococo/src/weights/mod.rs | 1 + runtime/rococo/src/weights/pallet_gilt.rs | 115 ++++++++++++++++++++++ 6 files changed, 176 insertions(+), 59 deletions(-) create mode 100644 runtime/rococo/src/weights/pallet_gilt.rs diff --git a/Cargo.lock b/Cargo.lock index e9f069e56b4c..28d4d504af4a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8389,6 +8389,7 @@ dependencies = [ "pallet-collective", "pallet-democracy", "pallet-elections-phragmen", + "pallet-gilt", "pallet-grandpa", "pallet-identity", "pallet-im-online", @@ -8399,6 +8400,7 @@ dependencies = [ "pallet-offences", "pallet-preimage", "pallet-proxy", + "pallet-recovery", "pallet-scheduler", "pallet-session", "pallet-society", diff --git a/node/service/src/chain_spec.rs b/node/service/src/chain_spec.rs index f80b26c777cc..f6743399f54d 100644 --- a/node/service/src/chain_spec.rs +++ b/node/service/src/chain_spec.rs @@ -1070,6 +1070,7 @@ fn rococo_staging_testnet_config_genesis(wasm_binary: &[u8]) -> rococo_runtime:: configuration: rococo_runtime::ConfigurationConfig { config: default_parachains_host_configuration(), }, + gilt: Default::default(), registrar: rococo_runtime::RegistrarConfig { next_free_para_id: polkadot_primitives::v2::LOWEST_PUBLIC_ID, }, @@ -1640,6 +1641,7 @@ pub fn rococo_testnet_genesis( ..default_parachains_host_configuration() }, }, + gilt: Default::default(), paras: rococo_runtime::ParasConfig { paras: vec![] }, registrar: rococo_runtime::RegistrarConfig { next_free_para_id: polkadot_primitives::v2::LOWEST_PUBLIC_ID, diff --git a/runtime/rococo/Cargo.toml b/runtime/rococo/Cargo.toml index f479d32ff177..9e9f0f23febd 100644 --- a/runtime/rococo/Cargo.toml +++ b/runtime/rococo/Cargo.toml @@ -45,6 +45,7 @@ pallet-child-bounties = { git = "https://github.com/paritytech/substrate", branc pallet-democracy = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-elections-phragmen = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-collective = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-gilt = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-identity = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-im-online = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -52,6 +53,7 @@ pallet-indices = { git = "https://github.com/paritytech/substrate", branch = "ma pallet-membership = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-mmr = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-multisig = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-recovery = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-tips = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -135,6 +137,7 @@ std = [ "pallet-sudo/std", "pallet-membership/std", "pallet-mmr/std", + "pallet-gilt/std", "pallet-indices/std", "pallet-im-online/std", "pallet-session/std", @@ -142,6 +145,7 @@ std = [ "pallet-staking/std", "pallet-offences/std", "pallet-proxy/std", + "pallet-recovery/std", "pallet-timestamp/std", "pallet-tips/std", "pallet-transaction-payment/std", @@ -201,12 +205,14 @@ runtime-benchmarks = [ "pallet-elections-phragmen/runtime-benchmarks", "pallet-democracy/runtime-benchmarks", "pallet-preimage/runtime-benchmarks", + "pallet-gilt/runtime-benchmarks", "pallet-grandpa/runtime-benchmarks", "pallet-identity/runtime-benchmarks", "pallet-im-online/runtime-benchmarks", "pallet-indices/runtime-benchmarks", "pallet-membership/runtime-benchmarks", "pallet-proxy/runtime-benchmarks", + "pallet-recovery/runtime-benchmarks", "pallet-staking/runtime-benchmarks", "pallet-society/runtime-benchmarks", "pallet-timestamp/runtime-benchmarks", @@ -237,6 +243,7 @@ try-runtime = [ "pallet-elections-phragmen/try-runtime", "pallet-grandpa/try-runtime", "pallet-identity/try-runtime", + "pallet-recovery/try-runtime", "pallet-sudo/try-runtime", "pallet-indices/try-runtime", "pallet-im-online/try-runtime", diff --git a/runtime/rococo/src/lib.rs b/runtime/rococo/src/lib.rs index 7cadf928ca0c..4f27daf70e02 100644 --- a/runtime/rococo/src/lib.rs +++ b/runtime/rococo/src/lib.rs @@ -1051,25 +1051,23 @@ impl pallet_multisig::Config for Runtime { type WeightInfo = weights::pallet_multisig::WeightInfo; } -// TODO: Recovery -// parameter_types! { -// pub const ConfigDepositBase: Balance = 500 * CENTS; -// pub const FriendDepositFactor: Balance = 50 * CENTS; -// pub const MaxFriends: u16 = 9; -// pub const RecoveryDeposit: Balance = 500 * CENTS; -// } +parameter_types! { + pub const ConfigDepositBase: Balance = 500 * CENTS; + pub const FriendDepositFactor: Balance = 50 * CENTS; + pub const MaxFriends: u16 = 9; + pub const RecoveryDeposit: Balance = 500 * CENTS; +} -// TODO: Recovery -// impl pallet_recovery::Config for Runtime { -// type Event = Event; -// type WeightInfo = (); -// type Call = Call; -// type Currency = Balances; -// type ConfigDepositBase = ConfigDepositBase; -// type FriendDepositFactor = FriendDepositFactor; -// type MaxFriends = MaxFriends; -// type RecoveryDeposit = RecoveryDeposit; -// } +impl pallet_recovery::Config for Runtime { + type Event = Event; + type WeightInfo = (); + type Call = Call; + type Currency = Balances; + type ConfigDepositBase = ConfigDepositBase; + type FriendDepositFactor = FriendDepositFactor; + type MaxFriends = MaxFriends; + type RecoveryDeposit = RecoveryDeposit; +} parameter_types! { pub const CandidateDeposit: Balance = 1000 * CENTS; @@ -1420,36 +1418,34 @@ impl auctions::Config for Runtime { type WeightInfo = weights::runtime_common_auctions::WeightInfo; } -// TODO: Gilt -// parameter_types! { -// pub IgnoredIssuance: Balance = Treasury::pot(); -// pub const QueueCount: u32 = 300; -// pub const MaxQueueLen: u32 = 1000; -// pub const FifoQueueLen: u32 = 250; -// pub const GiltPeriod: BlockNumber = 30 * DAYS; -// pub const MinFreeze: Balance = 10_000 * CENTS; -// pub const IntakePeriod: BlockNumber = 5 * MINUTES; -// pub const MaxIntakeBids: u32 = 100; -// } +parameter_types! { + pub IgnoredIssuance: Balance = Treasury::pot(); + pub const QueueCount: u32 = 300; + pub const MaxQueueLen: u32 = 1000; + pub const FifoQueueLen: u32 = 250; + pub const GiltPeriod: BlockNumber = 30 * DAYS; + pub const MinFreeze: Balance = 10_000 * CENTS; + pub const IntakePeriod: BlockNumber = 5 * MINUTES; + pub const MaxIntakeBids: u32 = 100; +} -// TODO: Gilt -// impl pallet_gilt::Config for Runtime { -// type Event = Event; -// type Currency = Balances; -// type CurrencyBalance = Balance; -// type AdminOrigin = MoreThanHalfCouncil; -// type Deficit = (); // Mint -// type Surplus = (); // Burn -// type IgnoredIssuance = IgnoredIssuance; -// type QueueCount = QueueCount; -// type MaxQueueLen = MaxQueueLen; -// type FifoQueueLen = FifoQueueLen; -// type Period = GiltPeriod; -// type MinFreeze = MinFreeze; -// type IntakePeriod = IntakePeriod; -// type MaxIntakeBids = MaxIntakeBids; -// type WeightInfo = weights::pallet_gilt::WeightInfo; -// } +impl pallet_gilt::Config for Runtime { + type Event = Event; + type Currency = Balances; + type CurrencyBalance = Balance; + type AdminOrigin = MoreThanHalfCouncil; + type Deficit = (); // Mint + type Surplus = (); // Burn + type IgnoredIssuance = IgnoredIssuance; + type QueueCount = QueueCount; + type MaxQueueLen = MaxQueueLen; + type FifoQueueLen = FifoQueueLen; + type Period = GiltPeriod; + type MinFreeze = MinFreeze; + type IntakePeriod = IntakePeriod; + type MaxIntakeBids = MaxIntakeBids; + type WeightInfo = weights::pallet_gilt::WeightInfo; +} // TODO: Nominations // pub struct BalanceToU256; @@ -1793,9 +1789,8 @@ construct_runtime! { // Society module. Society: pallet_society::{Pallet, Call, Storage, Event} = 26, - // TODO: Recovery - //// Social recovery module. - // Recovery: pallet_recovery::{Pallet, Call, Storage, Event} = 27, + // Social recovery module. + Recovery: pallet_recovery::{Pallet, Call, Storage, Event} = 27, // Vesting. Usable initially, but removed once all vesting is finished. Vesting: pallet_vesting::{Pallet, Call, Storage, Event, Config} = 28, @@ -1829,9 +1824,8 @@ construct_runtime! { //// Election pallet. Only works with staking, but placed here to maintain indices. // ElectionProviderMultiPhase: pallet_election_provider_multi_phase::{Pallet, Call, Storage, Event, ValidateUnsigned} = 37, - // TODO: Gilt - //// Gilts pallet. - // Gilt: pallet_gilt::{Pallet, Call, Storage, Event, Config} = 38, + // Gilts pallet. + Gilt: pallet_gilt::{Pallet, Call, Storage, Event, Config} = 38, // TODO: Bags List //// Provides a semi-sorted list of nominators for staking. @@ -1978,8 +1972,7 @@ mod benches { // TODO: Election // [pallet_election_provider_multi_phase, ElectionProviderMultiPhase] // [frame_election_provider_support, ElectionProviderBench::] - // TODO: Gilt - // [pallet_gilt, Gilt] + [pallet_gilt, Gilt] [pallet_identity, Identity] [pallet_im_online, ImOnline] [pallet_indices, Indices] @@ -1990,8 +1983,7 @@ mod benches { [pallet_offences, OffencesBench::] [pallet_preimage, Preimage] [pallet_proxy, Proxy] - // TODO: Recovery - // [pallet_recovery, Recovery] + [pallet_recovery, Recovery] [pallet_scheduler, Scheduler] // TODO: Session // [pallet_session, SessionBench::] @@ -2452,8 +2444,6 @@ sp_api::impl_runtime_apis! { } } - // I AM HERE - #[cfg(feature = "runtime-benchmarks")] impl frame_benchmarking::Benchmark for Runtime { fn benchmark_metadata(extra: bool) -> ( diff --git a/runtime/rococo/src/weights/mod.rs b/runtime/rococo/src/weights/mod.rs index 62c2e13e9250..f1c8f0145685 100644 --- a/runtime/rococo/src/weights/mod.rs +++ b/runtime/rococo/src/weights/mod.rs @@ -24,6 +24,7 @@ pub mod pallet_democracy; pub mod pallet_elections_phragmen; pub mod pallet_im_online; pub mod pallet_identity; +pub mod pallet_gilt; pub mod pallet_indices; pub mod pallet_membership; pub mod pallet_multisig; diff --git a/runtime/rococo/src/weights/pallet_gilt.rs b/runtime/rococo/src/weights/pallet_gilt.rs new file mode 100644 index 000000000000..e25f62d8f8cc --- /dev/null +++ b/runtime/rococo/src/weights/pallet_gilt.rs @@ -0,0 +1,115 @@ +// Copyright 2017-2022 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_gilt` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-05-11, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/production/polkadot +// benchmark +// pallet +// --chain=rococo-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_gilt +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/rococo/src/weights/pallet_gilt.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_gilt`. +pub struct WeightInfo(PhantomData); +impl pallet_gilt::WeightInfo for WeightInfo { + // Storage: Gilt Queues (r:1 w:1) + // Storage: Gilt QueueTotals (r:1 w:1) + fn place_bid(l: u32, ) -> Weight { + (38_024_000 as Weight) + // Standard Error: 0 + .saturating_add((152_000 as Weight).saturating_mul(l as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Gilt Queues (r:1 w:1) + // Storage: Gilt QueueTotals (r:1 w:1) + fn place_bid_max() -> Weight { + (154_433_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Gilt Queues (r:1 w:1) + // Storage: Gilt QueueTotals (r:1 w:1) + fn retract_bid(l: u32, ) -> Weight { + (37_541_000 as Weight) + // Standard Error: 0 + .saturating_add((125_000 as Weight).saturating_mul(l as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Gilt ActiveTotal (r:1 w:1) + fn set_target() -> Weight { + (3_062_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Gilt Active (r:1 w:1) + // Storage: Gilt ActiveTotal (r:1 w:1) + fn thaw() -> Weight { + (39_496_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Gilt ActiveTotal (r:1 w:0) + fn pursue_target_noop() -> Weight { + (1_598_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + } + // Storage: Gilt ActiveTotal (r:1 w:1) + // Storage: Gilt QueueTotals (r:1 w:1) + // Storage: Gilt Queues (r:1 w:1) + // Storage: Gilt Active (r:0 w:1) + fn pursue_target_per_item(b: u32, ) -> Weight { + (39_340_000 as Weight) + // Standard Error: 2_000 + .saturating_add((4_415_000 as Weight).saturating_mul(b as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(b as Weight))) + } + // Storage: Gilt ActiveTotal (r:1 w:1) + // Storage: Gilt QueueTotals (r:1 w:1) + // Storage: Gilt Queues (r:1 w:1) + // Storage: Gilt Active (r:0 w:1) + fn pursue_target_per_queue(q: u32, ) -> Weight { + (16_092_000 as Weight) + // Standard Error: 6_000 + .saturating_add((8_070_000 as Weight).saturating_mul(q as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(q as Weight))) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + .saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(q as Weight))) + } +} From 0d8a06fa4e84d5cc7efbbbc68a953e313de8265b Mon Sep 17 00:00:00 2001 From: NachoPal Date: Mon, 20 Jun 2022 23:36:05 +0200 Subject: [PATCH 10/35] proxy+slot+auction+registar+crowdloan --- runtime/rococo/constants/src/lib.rs | 1 + runtime/rococo/src/lib.rs | 212 ++++++++++++++-------------- runtime/rococo/src/xcm_config.rs | 6 +- 3 files changed, 110 insertions(+), 109 deletions(-) diff --git a/runtime/rococo/constants/src/lib.rs b/runtime/rococo/constants/src/lib.rs index b9826045351b..7aec525fed33 100644 --- a/runtime/rococo/constants/src/lib.rs +++ b/runtime/rococo/constants/src/lib.rs @@ -50,6 +50,7 @@ pub mod time { pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber); pub const HOURS: BlockNumber = MINUTES * 60; pub const DAYS: BlockNumber = HOURS * 24; + pub const WEEKS: BlockNumber = DAYS * 7; // 1 in 4 blocks (on average, not counting collisions) will be primary babe blocks. pub const PRIMARY_PROBABILITY: (u64, u64) = (1, 4); diff --git a/runtime/rococo/src/lib.rs b/runtime/rococo/src/lib.rs index 4f27daf70e02..159acb01620f 100644 --- a/runtime/rococo/src/lib.rs +++ b/runtime/rococo/src/lib.rs @@ -249,7 +249,6 @@ impl pallet_preimage::Config for Runtime { } parameter_types! { - // TODO: Babe // pub EpochDuration: u64 = prod_or_fast!( // EPOCH_DURATION_IN_SLOTS as u64, // 2 * MINUTES as u64, @@ -291,9 +290,8 @@ impl pallet_babe::Config for Runtime { type MaxAuthorities = MaxAuthorities; } -// TODO: Indices parameter_types! { - pub const IndexDeposit: Balance = 1 * UNITS; + pub const IndexDeposit: Balance = 100 * CENTS; } impl pallet_indices::Config for Runtime { @@ -578,6 +576,11 @@ impl pallet_session::historical::Config for Runtime { // } // } +// TODO: Stacking -> remove when stacking added +parameter_types! { + pub const SessionsPerEra: SessionIndex = 6; + pub const BondingDuration: sp_staking::EraIndex = 28; +} // TODO: Stacking // parameter_types! { // // Six sessions in an era (6 hours). @@ -1115,12 +1118,12 @@ impl pallet_vesting::Config for Runtime { parameter_types! { // One storage item; key size 32, value size 8; . - pub const ProxyDepositBase: Balance = 10; // TODO: Proxy -> pub const ProxyDepositBase: Balance = deposit(1, 8); + pub const ProxyDepositBase: Balance = deposit(1, 8); // Additional storage item size of 33 bytes. - pub const ProxyDepositFactor: Balance = 10; // TODO: Proxy -> pub const ProxyDepositFactor: Balance = deposit(0, 33); + pub const ProxyDepositFactor: Balance = deposit(0, 33); pub const MaxProxies: u16 = 32; - pub const AnnouncementDepositBase: Balance = 10; // TODO: Proxy -> pub const AnnouncementDepositBase: Balance = deposit(1, 8); - pub const AnnouncementDepositFactor: Balance = 10; // TODO: Proxy -> pub const AnnouncementDepositFactor: Balance = deposit(0, 66); + pub const AnnouncementDepositBase: Balance = deposit(1, 8); + pub const AnnouncementDepositFactor: Balance = deposit(0, 66); pub const MaxPending: u16 = 32; } @@ -1140,13 +1143,13 @@ parameter_types! { )] pub enum ProxyType { Any, - // TODO: Proxy -> NonTransfer, - // TODO: Proxy -> Governance, - // TODO: Proxy -> Staking, - // TODO: Proxy -> IdentityJudgement, + NonTransfer, + Governance, + // TODO: Proxy & TODO: Staking -> Staking, + IdentityJudgement, CancelProxy, Auction, - // TODO: Proxy -> Society, + Society, } impl Default for ProxyType { fn default() -> Self { @@ -1157,77 +1160,76 @@ impl InstanceFilter for ProxyType { fn filter(&self, c: &Call) -> bool { match self { ProxyType::Any => true, - // TODO: Proxy - // ProxyType::NonTransfer => matches!( - // c, - // Call::System(..) | - // Call::Babe(..) | - // Call::Timestamp(..) | - // Call::Indices(pallet_indices::Call::claim {..}) | - // Call::Indices(pallet_indices::Call::free {..}) | - // Call::Indices(pallet_indices::Call::freeze {..}) | - // // Specifically omitting Indices `transfer`, `force_transfer` - // // Specifically omitting the entire Balances pallet - // Call::Authorship(..) | - // Call::Staking(..) | - // Call::Session(..) | - // Call::Grandpa(..) | - // Call::ImOnline(..) | - // Call::Democracy(..) | - // Call::Council(..) | - // Call::TechnicalCommittee(..) | - // Call::PhragmenElection(..) | - // Call::TechnicalMembership(..) | - // Call::Treasury(..) | - // Call::Bounties(..) | - // Call::ChildBounties(..) | - // Call::Tips(..) | - // Call::Claims(..) | - // Call::Utility(..) | - // Call::Identity(..) | - // Call::Society(..) | - // Call::Recovery(pallet_recovery::Call::as_recovered {..}) | - // Call::Recovery(pallet_recovery::Call::vouch_recovery {..}) | - // Call::Recovery(pallet_recovery::Call::claim_recovery {..}) | - // Call::Recovery(pallet_recovery::Call::close_recovery {..}) | - // Call::Recovery(pallet_recovery::Call::remove_recovery {..}) | - // Call::Recovery(pallet_recovery::Call::cancel_recovered {..}) | - // // Specifically omitting Recovery `create_recovery`, `initiate_recovery` - // Call::Vesting(pallet_vesting::Call::vest {..}) | - // Call::Vesting(pallet_vesting::Call::vest_other {..}) | - // // Specifically omitting Vesting `vested_transfer`, and `force_vested_transfer` - // Call::Scheduler(..) | - // Call::Proxy(..) | - // Call::Multisig(..) | - // Call::Gilt(..) | - // Call::Registrar(paras_registrar::Call::register {..}) | - // Call::Registrar(paras_registrar::Call::deregister {..}) | - // // Specifically omitting Registrar `swap` - // Call::Registrar(paras_registrar::Call::reserve {..}) | - // Call::Crowdloan(..) | - // Call::Slots(..) | - // Call::Auctions(..) | // Specifically omitting the entire XCM Pallet - // Call::VoterList(..) - // ), - // TODO: Proxy - // ProxyType::Governance => matches!( - // c, - // Call::Democracy(..) | - // Call::Council(..) | Call::TechnicalCommittee(..) | - // Call::PhragmenElection(..) | - // Call::Treasury(..) | Call::Bounties(..) | - // Call::Tips(..) | Call::Utility(..) | - // Call::ChildBounties(..) - // ), - // TODO: Proxy + ProxyType::NonTransfer => matches!( + c, + Call::System(..) | + Call::Babe(..) | + Call::Timestamp(..) | + Call::Indices(pallet_indices::Call::claim {..}) | + Call::Indices(pallet_indices::Call::free {..}) | + Call::Indices(pallet_indices::Call::freeze {..}) | + // Specifically omitting Indices `transfer`, `force_transfer` + // Specifically omitting the entire Balances pallet + Call::Authorship(..) | + // TODO: Staking + // Call::Staking(..) | + Call::Session(..) | + Call::Grandpa(..) | + Call::ImOnline(..) | + Call::Democracy(..) | + Call::Council(..) | + Call::TechnicalCommittee(..) | + Call::PhragmenElection(..) | + Call::TechnicalMembership(..) | + Call::Treasury(..) | + Call::Bounties(..) | + Call::ChildBounties(..) | + Call::Tips(..) | + Call::Claims(..) | + Call::Utility(..) | + Call::Identity(..) | + Call::Society(..) | + Call::Recovery(pallet_recovery::Call::as_recovered {..}) | + Call::Recovery(pallet_recovery::Call::vouch_recovery {..}) | + Call::Recovery(pallet_recovery::Call::claim_recovery {..}) | + Call::Recovery(pallet_recovery::Call::close_recovery {..}) | + Call::Recovery(pallet_recovery::Call::remove_recovery {..}) | + Call::Recovery(pallet_recovery::Call::cancel_recovered {..}) | + // Specifically omitting Recovery `create_recovery`, `initiate_recovery` + Call::Vesting(pallet_vesting::Call::vest {..}) | + Call::Vesting(pallet_vesting::Call::vest_other {..}) | + // Specifically omitting Vesting `vested_transfer`, and `force_vested_transfer` + Call::Scheduler(..) | + Call::Proxy(..) | + Call::Multisig(..) | + Call::Gilt(..) | + Call::Registrar(paras_registrar::Call::register {..}) | + Call::Registrar(paras_registrar::Call::deregister {..}) | + // Specifically omitting Registrar `swap` + Call::Registrar(paras_registrar::Call::reserve {..}) | + Call::Crowdloan(..) | + Call::Slots(..) | + Call::Auctions(..) // Specifically omitting the entire XCM Pallet + // TODO: Proxy & TODO: Bags List + // Call::VoterList(..) + ), + ProxyType::Governance => matches!( + c, + Call::Democracy(..) | + Call::Council(..) | Call::TechnicalCommittee(..) | + Call::PhragmenElection(..) | + Call::Treasury(..) | Call::Bounties(..) | + Call::Tips(..) | Call::Utility(..) | + Call::ChildBounties(..) + ), + // TODO: Proxy & TODO: Staking // ProxyType::Staking => { // matches!(c, Call::Staking(..) | Call::Session(..) | Call::Utility(..)) // }, - // TODO: Proxy - // ProxyType::IdentityJudgement => matches!( - // c, - // Call::Identity(pallet_identity::Call::provide_judgement { .. }) | Call::Utility(..) - // ), + ProxyType::IdentityJudgement => matches!( + c, + Call::Identity(pallet_identity::Call::provide_judgement { .. }) | Call::Utility(..) + ), ProxyType::CancelProxy => { matches!(c, Call::Proxy(pallet_proxy::Call::reject_announcement { .. })) }, @@ -1238,18 +1240,15 @@ impl InstanceFilter for ProxyType { Call::Registrar { .. } | Call::Multisig(..) | Call::Slots { .. } ), - // TODO: Proxy - // ProxyType::Society => matches!(c, Call::Society(..)), + ProxyType::Society => matches!(c, Call::Society(..)), } } fn is_superset(&self, o: &Self) -> bool { match (self, o) { - // TODO: Proxy - // (x, y) if x == y => true, + (x, y) if x == y => true, (ProxyType::Any, _) => true, - // TODO: Proxy - // (_, ProxyType::Any) => false, - // (ProxyType::NonTransfer, _) => true, + (_, ProxyType::Any) => false, + (ProxyType::NonTransfer, _) => true, _ => false, } } @@ -1292,7 +1291,9 @@ impl runtime_parachains::inclusion::RewardValidators for RewardValidators { impl parachains_inclusion::Config for Runtime { type Event = Event; type DisputesHandler = ParasDisputes; - type RewardValidators = RewardValidators; // TODO: Inclusion -> type RewardValidators = parachains_reward_points::RewardValidatorsWithEraPoints; + // TODO: Inclusion + // type RewardValidators = parachains_reward_points::RewardValidatorsWithEraPoints; + type RewardValidators = RewardValidators; } parameter_types! { @@ -1348,7 +1349,7 @@ impl parachains_disputes::Config for Runtime { } parameter_types! { - pub const ParaDeposit: Balance = 5 * UNITS; + pub const ParaDeposit: Balance = 40 * UNITS; } impl paras_registrar::Config for Runtime { @@ -1362,7 +1363,7 @@ impl paras_registrar::Config for Runtime { } parameter_types! { - pub const LeasePeriod: BlockNumber = 1 * DAYS; // TODO: Slots -> pub LeasePeriod: BlockNumber = prod_or_fast!(6 * WEEKS, 6 * WEEKS, "KSM_LEASE_PERIOD"); + pub LeasePeriod: BlockNumber = prod_or_fast!(6 * WEEKS, 6 * WEEKS, "ROC_LEASE_PERIOD"); } impl slots::Config for Runtime { @@ -1371,15 +1372,15 @@ impl slots::Config for Runtime { type Registrar = Registrar; type LeasePeriod = LeasePeriod; type LeaseOffset = (); - type ForceOrigin = EnsureRoot; // TODO: Slots -> type ForceOrigin = MoreThanHalfCouncil; + type ForceOrigin = MoreThanHalfCouncil; type WeightInfo = weights::runtime_common_slots::WeightInfo; } parameter_types! { pub const CrowdloanId: PalletId = PalletId(*b"py/cfund"); - pub const SubmissionDeposit: Balance = 100 * UNITS; // TODO: Crowdloan -> pub const SubmissionDeposit: Balance = 3 * GRAND; - pub const MinContribution: Balance = 1 * UNITS; // TODO: Crowdloan -> pub const MinContribution: Balance = 3_000 * CENTS; - pub const RemoveKeysLimit: u32 = 500; // TODO: Crowdloan -> pub const RemoveKeysLimit: u32 = 1000; + pub const SubmissionDeposit: Balance = 3 * GRAND; + pub const MinContribution: Balance = 3_000 * CENTS; + pub const RemoveKeysLimit: u32 = 1000; // Allow 32 bytes for an additional memo to a crowdloan. pub const MaxMemoLength: u8 = 32; } @@ -1397,15 +1398,14 @@ impl crowdloan::Config for Runtime { } parameter_types! { - pub const EndingPeriod: BlockNumber = 1 * HOURS; // TODO: Auctions -> pub const EndingPeriod: BlockNumber = 5 * DAYS; - pub const SampleLength: BlockNumber = 1; // TODO: Auctions -> pub const SampleLength: BlockNumber = 2 * MINUTES; + pub const EndingPeriod: BlockNumber = 5 * DAYS; + pub const SampleLength: BlockNumber = 2 * MINUTES; } -// TODO: Auctions -// type AuctionInitiate = EnsureOneOf< -// EnsureRoot, -// pallet_collective::EnsureProportionAtLeast, -// >; +type AuctionInitiate = EnsureOneOf< + EnsureRoot, + pallet_collective::EnsureProportionAtLeast, +>; impl auctions::Config for Runtime { type Event = Event; @@ -1414,7 +1414,7 @@ impl auctions::Config for Runtime { type EndingPeriod = EndingPeriod; type SampleLength = SampleLength; type Randomness = pallet_babe::RandomnessFromOneEpochAgo; - type InitiateOrigin = EnsureRoot; // TODO: Auctions -> type InitiateOrigin = AuctionInitiate; + type InitiateOrigin = AuctionInitiate; type WeightInfo = weights::runtime_common_auctions::WeightInfo; } @@ -2454,8 +2454,8 @@ sp_api::impl_runtime_apis! { use frame_support::traits::StorageInfoTrait; // TODO: Session (added) - use pallet_session_benchmarking::Pallet as SessionBench; - // TODO: Election + // use pallet_session_benchmarking::Pallet as SessionBench; + // TODO: Offences // use pallet_offences_benchmarking::Pallet as OffencesBench; // TODO: Election // use pallet_election_provider_support_benchmarking::Pallet as ElectionProviderBench; @@ -2479,7 +2479,7 @@ sp_api::impl_runtime_apis! { // Trying to add benchmarks directly to some pallets caused cyclic dependency issues. // To get around that, we separated the benchmarks into its own crate. // TODO: Session (added) - use pallet_session_benchmarking::Pallet as SessionBench; + // use pallet_session_benchmarking::Pallet as SessionBench; // TODO: Offences // use pallet_offences_benchmarking::Pallet as OffencesBench; // TODO: Election @@ -2492,7 +2492,7 @@ sp_api::impl_runtime_apis! { use xcm_config::{CheckAccount, KsmLocation, SovereignAccountOf, Statemine, XcmConfig}; // TODO: Session (added) - impl pallet_session_benchmarking::Config for Runtime {} + // impl pallet_session_benchmarking::Config for Runtime {} // TODO: Offences // impl pallet_offences_benchmarking::Config for Runtime {} // TODO: Election Provider diff --git a/runtime/rococo/src/xcm_config.rs b/runtime/rococo/src/xcm_config.rs index 2e8f934f7270..63f76d70f15d 100644 --- a/runtime/rococo/src/xcm_config.rs +++ b/runtime/rococo/src/xcm_config.rs @@ -101,7 +101,7 @@ pub type XcmRouter = ( parameter_types! { pub const Rococo: MultiAssetFilter = Wild(AllOf { fun: WildFungible, id: Concrete(RocLocation::get()) }); pub const Statemine: MultiLocation = Parachain(1000).into(); - pub const Canvas: MultiLocation = Parachain(1002).into(); + pub const Contracts: MultiLocation = Parachain(1002).into(); pub const Encointer: MultiLocation = Parachain(1003).into(); pub const Tick: MultiLocation = Parachain(100).into(); pub const Trick: MultiLocation = Parachain(110).into(); @@ -110,7 +110,7 @@ parameter_types! { pub const RococoForTrick: (MultiAssetFilter, MultiLocation) = (Rococo::get(), Trick::get()); pub const RococoForTrack: (MultiAssetFilter, MultiLocation) = (Rococo::get(), Track::get()); pub const RococoForStatemine: (MultiAssetFilter, MultiLocation) = (Rococo::get(), Statemine::get()); - pub const RococoForCanvas: (MultiAssetFilter, MultiLocation) = (Rococo::get(), Canvas::get()); + pub const RococoForContracts: (MultiAssetFilter, MultiLocation) = (Rococo::get(), Contracts::get()); pub const RococoForEncointer: (MultiAssetFilter, MultiLocation) = (Rococo::get(), Encointer::get()); } pub type TrustedTeleporters = ( @@ -118,7 +118,7 @@ pub type TrustedTeleporters = ( xcm_builder::Case, xcm_builder::Case, xcm_builder::Case, - xcm_builder::Case, + xcm_builder::Case, xcm_builder::Case, ); From 982d220917d9b497d84124e2a40857aa1f1ebbec Mon Sep 17 00:00:00 2001 From: NachoPal Date: Tue, 21 Jun 2022 12:55:46 +0200 Subject: [PATCH 11/35] babe+epoch_time modificaction --- node/service/src/chain_spec.rs | 72 ++++------------------------- runtime/rococo/constants/src/lib.rs | 5 +- runtime/rococo/src/lib.rs | 20 ++++---- 3 files changed, 19 insertions(+), 78 deletions(-) diff --git a/node/service/src/chain_spec.rs b/node/service/src/chain_spec.rs index f6743399f54d..d5b867997b23 100644 --- a/node/service/src/chain_spec.rs +++ b/node/service/src/chain_spec.rs @@ -106,7 +106,7 @@ pub type WestendChainSpec = DummyChainSpec; /// The `ChainSpec` parameterized for the rococo runtime. #[cfg(feature = "rococo-native")] -pub type RococoChainSpec = service::GenericChainSpec; +pub type RococoChainSpec = service::GenericChainSpec; /// The `ChainSpec` parameterized for the `versi` runtime. /// @@ -118,30 +118,6 @@ pub type VersiChainSpec = RococoChainSpec; #[cfg(not(feature = "rococo-native"))] pub type RococoChainSpec = DummyChainSpec; -/// Extension for the Rococo genesis config to support a custom changes to the genesis state. -#[derive(serde::Serialize, serde::Deserialize)] -#[cfg(feature = "rococo-native")] -pub struct RococoGenesisExt { - /// The runtime genesis config. - runtime_genesis_config: rococo::GenesisConfig, - /// The session length in blocks. - /// - /// If `None` is supplied, the default value is used. - session_length_in_blocks: Option, -} - -#[cfg(feature = "rococo-native")] -impl sp_runtime::BuildStorage for RococoGenesisExt { - fn assimilate_storage(&self, storage: &mut sp_core::storage::Storage) -> Result<(), String> { - sp_state_machine::BasicExternalities::execute_with_storage(storage, || { - if let Some(length) = self.session_length_in_blocks.as_ref() { - rococo_runtime_constants::time::EpochDurationInBlocks::set(length); - } - }); - self.runtime_genesis_config.assimilate_storage(storage) - } -} - pub fn polkadot_config() -> Result { PolkadotChainSpec::from_json_bytes(&include_bytes!("../res/polkadot.json")[..]) } @@ -1183,10 +1159,7 @@ pub fn rococo_staging_testnet_config() -> Result { "Rococo Staging Testnet", "rococo_staging_testnet", ChainType::Live, - move || RococoGenesisExt { - runtime_genesis_config: rococo_staging_testnet_config_genesis(wasm_binary), - session_length_in_blocks: None, - }, + move || rococo_staging_testnet_config_genesis(wasm_binary), boot_nodes, Some( TelemetryEndpoints::new(vec![(ROCOCO_STAGING_TELEMETRY_URL.to_string(), 0)]) @@ -1220,10 +1193,7 @@ pub fn versi_staging_testnet_config() -> Result { "Versi Staging Testnet", "versi_staging_testnet", ChainType::Live, - move || RococoGenesisExt { - runtime_genesis_config: rococo_staging_testnet_config_genesis(wasm_binary), - session_length_in_blocks: Some(100), - }, + move || rococo_staging_testnet_config_genesis(wasm_binary), boot_nodes, Some( TelemetryEndpoints::new(vec![(VERSI_STAGING_TELEMETRY_URL.to_string(), 0)]) @@ -1772,11 +1742,7 @@ pub fn rococo_development_config() -> Result { "Development", "rococo_dev", ChainType::Development, - move || RococoGenesisExt { - runtime_genesis_config: rococo_development_config_genesis(wasm_binary), - // Use 1 minute session length. - session_length_in_blocks: Some(10), - }, + move || rococo_development_config_genesis(wasm_binary), vec![], None, Some(DEFAULT_PROTOCOL_ID), @@ -1795,11 +1761,7 @@ pub fn versi_development_config() -> Result { "Development", "versi_dev", ChainType::Development, - move || RococoGenesisExt { - runtime_genesis_config: rococo_development_config_genesis(wasm_binary), - // Use 1 minute session length. - session_length_in_blocks: Some(10), - }, + move || rococo_development_config_genesis(wasm_binary), vec![], None, Some("versi"), @@ -1819,11 +1781,7 @@ pub fn wococo_development_config() -> Result { "Development", "wococo_dev", ChainType::Development, - move || RococoGenesisExt { - runtime_genesis_config: rococo_development_config_genesis(wasm_binary), - // Use 1 minute session length. - session_length_in_blocks: Some(10), - }, + move || rococo_development_config_genesis(wasm_binary), vec![], None, Some(WOCOCO_DEV_PROTOCOL_ID), @@ -1948,11 +1906,7 @@ pub fn rococo_local_testnet_config() -> Result { "Rococo Local Testnet", "rococo_local_testnet", ChainType::Local, - move || RococoGenesisExt { - runtime_genesis_config: rococo_local_testnet_genesis(wasm_binary), - // Use 1 minute session length. - session_length_in_blocks: Some(10), - }, + move || rococo_local_testnet_genesis(wasm_binary), vec![], None, Some(DEFAULT_PROTOCOL_ID), @@ -1987,11 +1941,7 @@ pub fn wococo_local_testnet_config() -> Result { "Wococo Local Testnet", "wococo_local_testnet", ChainType::Local, - move || RococoGenesisExt { - runtime_genesis_config: wococo_local_testnet_genesis(wasm_binary), - // Use 1 minute session length. - session_length_in_blocks: Some(10), - }, + move || wococo_local_testnet_genesis(wasm_binary), vec![], None, Some(DEFAULT_PROTOCOL_ID), @@ -2026,11 +1976,7 @@ pub fn versi_local_testnet_config() -> Result { "Versi Local Testnet", "versi_local_testnet", ChainType::Local, - move || RococoGenesisExt { - runtime_genesis_config: versi_local_testnet_genesis(wasm_binary), - // Use 1 minute session length. - session_length_in_blocks: Some(10), - }, + move || versi_local_testnet_genesis(wasm_binary), vec![], None, Some("versi"), diff --git a/runtime/rococo/constants/src/lib.rs b/runtime/rococo/constants/src/lib.rs index 7aec525fed33..c652ead72cb4 100644 --- a/runtime/rococo/constants/src/lib.rs +++ b/runtime/rococo/constants/src/lib.rs @@ -41,10 +41,7 @@ pub mod time { use runtime_common::prod_or_fast; pub const MILLISECS_PER_BLOCK: Moment = 6000; pub const SLOT_DURATION: Moment = MILLISECS_PER_BLOCK; - pub const DEFAULT_EPOCH_DURATION: BlockNumber = prod_or_fast!(1 * HOURS, 1 * MINUTES); - frame_support::parameter_types! { - pub storage EpochDurationInBlocks: BlockNumber = DEFAULT_EPOCH_DURATION; - } + pub const EPOCH_DURATION_IN_SLOTS: BlockNumber = prod_or_fast!(1 * HOURS, 1 * MINUTES); // These time units are defined in number of blocks. pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber); diff --git a/runtime/rococo/src/lib.rs b/runtime/rococo/src/lib.rs index 159acb01620f..48ce748e93d2 100644 --- a/runtime/rococo/src/lib.rs +++ b/runtime/rococo/src/lib.rs @@ -249,20 +249,18 @@ impl pallet_preimage::Config for Runtime { } parameter_types! { - // pub EpochDuration: u64 = prod_or_fast!( - // EPOCH_DURATION_IN_SLOTS as u64, - // 2 * MINUTES as u64, - // "ROC_EPOCH_DURATION" - // ); + pub EpochDuration: u64 = prod_or_fast!( + EPOCH_DURATION_IN_SLOTS as u64, + 2 * MINUTES as u64, + "ROC_EPOCH_DURATION" + ); pub const ExpectedBlockTime: Moment = MILLISECS_PER_BLOCK; - // TODO: Staking - // pub ReportLongevity: u64 = - // BondingDuration::get() as u64 * SessionsPerEra::get() as u64 * EpochDuration::get(); - pub ReportLongevity: u64 = EpochDurationInBlocks::get() as u64 * 10; + pub ReportLongevity: u64 = + BondingDuration::get() as u64 * SessionsPerEra::get() as u64 * EpochDuration::get(); } impl pallet_babe::Config for Runtime { - type EpochDuration = EpochDurationInBlocks; // TODO: Babe -> type EpochDuration = EpochDuration; + type EpochDuration = EpochDuration; type ExpectedBlockTime = ExpectedBlockTime; // session module is the trigger @@ -2280,7 +2278,7 @@ sp_api::impl_runtime_apis! { // babe_primitives::BabeGenesisConfiguration { slot_duration: Babe::slot_duration(), - epoch_length: EpochDurationInBlocks::get().into(), // TODO: Babe -> epoch_length: EpochDuration::get().into() + epoch_length: EpochDuration::get().into(), c: BABE_GENESIS_EPOCH_CONFIG.c, genesis_authorities: Babe::authorities().to_vec(), randomness: Babe::randomness(), From f1ef966a8b2c8da28f738a927bc3b50fc4a8faa4 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Tue, 21 Jun 2022 13:48:53 +0200 Subject: [PATCH 12/35] xcm_config --- runtime/rococo/src/xcm_config.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/runtime/rococo/src/xcm_config.rs b/runtime/rococo/src/xcm_config.rs index 63f76d70f15d..7fb3e48cedb1 100644 --- a/runtime/rococo/src/xcm_config.rs +++ b/runtime/rococo/src/xcm_config.rs @@ -38,7 +38,7 @@ parameter_types! { /// the context". pub const RocLocation: MultiLocation = Here.into(); /// The Rococo network ID. This is named. - pub const RococoNetwork: NetworkId = NetworkId::Polkadot; + pub const RococoNetwork: NetworkId = NetworkId::Named(b"Rococo".to_vec()); /// Our XCM location ancestry - i.e. what, if anything, `Parent` means evaluated in our context. Since /// Rococo is a top-level relay-chain, there is no ancestry. pub const Ancestry: MultiLocation = Here.into(); @@ -166,10 +166,9 @@ parameter_types! { pub const CollectiveBodyId: BodyId = BodyId::Unit; } -// TODO: Collective -// parameter_types! { -// pub const CouncilBodyId: BodyId = BodyId::Executive; -// } +parameter_types! { + pub const CouncilBodyId: BodyId = BodyId::Executive; +} /// Type to convert an `Origin` type value into a `MultiLocation` value which represents an interior location /// of this chain. @@ -179,7 +178,7 @@ pub type LocalOriginToLocation = ( BackingToPlurality< Origin, pallet_collective::Origin, - CollectiveBodyId // TODO: Collective -> CouncilBodyId + CouncilBodyId, >, // And a usual Signed origin to be used in XCM as a corresponding AccountId32 SignedToAccountId32, From a202cf4da01522c91e216a9ff964d6bf5a3a82d4 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Tue, 21 Jun 2022 17:21:28 +0200 Subject: [PATCH 13/35] xcm_config fix --- runtime/rococo/src/xcm_config.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/rococo/src/xcm_config.rs b/runtime/rococo/src/xcm_config.rs index 7fb3e48cedb1..746e3ca5198d 100644 --- a/runtime/rococo/src/xcm_config.rs +++ b/runtime/rococo/src/xcm_config.rs @@ -38,7 +38,7 @@ parameter_types! { /// the context". pub const RocLocation: MultiLocation = Here.into(); /// The Rococo network ID. This is named. - pub const RococoNetwork: NetworkId = NetworkId::Named(b"Rococo".to_vec()); + pub RococoNetwork: NetworkId = NetworkId::Named(b"Rococo".to_vec()); /// Our XCM location ancestry - i.e. what, if anything, `Parent` means evaluated in our context. Since /// Rococo is a top-level relay-chain, there is no ancestry. pub const Ancestry: MultiLocation = Here.into(); From d565aa24fc7bf6154d39e7075950d2bc32773eba Mon Sep 17 00:00:00 2001 From: NachoPal Date: Tue, 21 Jun 2022 19:05:57 +0200 Subject: [PATCH 14/35] constants --- runtime/rococo/constants/src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/runtime/rococo/constants/src/lib.rs b/runtime/rococo/constants/src/lib.rs index c652ead72cb4..4d2347026f27 100644 --- a/runtime/rococo/constants/src/lib.rs +++ b/runtime/rococo/constants/src/lib.rs @@ -27,8 +27,8 @@ pub mod currency { pub const UNITS: Balance = 1_000_000_000_000; pub const CENTS: Balance = UNITS / 30_000; - pub const MILLICENTS: Balance = CENTS / 1_000; pub const GRAND: Balance = CENTS * 100_000; + 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 @@ -80,7 +80,7 @@ pub mod fee { impl WeightToFeePolynomial for WeightToFee { type Balance = Balance; fn polynomial() -> WeightToFeeCoefficients { - // in Westend, extrinsic base weight (smallest non-zero weight) is mapped to 1/10 CENT: + // in Rococo, extrinsic base weight (smallest non-zero weight) is mapped to 1/10 CENT: let p = super::currency::CENTS; let q = 10 * Balance::from(ExtrinsicBaseWeight::get()); smallvec![WeightToFeeCoefficient { @@ -108,8 +108,8 @@ mod tests { fn full_block_fee_is_correct() { // A full block should cost between 10 and 100 UNITS. let full_block = WeightToFee::calc(&MAXIMUM_BLOCK_WEIGHT); - assert!(full_block >= 10 * UNITS); - assert!(full_block <= 100 * UNITS); + assert!(full_block >= 1_000 * UNITS); + assert!(full_block <= 10_000 * UNITS); } #[test] From 20e75c71a592cb39537137647392a8c9e708622a Mon Sep 17 00:00:00 2001 From: NachoPal Date: Mon, 11 Jul 2022 14:43:25 +0200 Subject: [PATCH 15/35] fix conflicts 2 --- node/service/src/chain_spec.rs | 2 - runtime/rococo/src/lib.rs | 54 ++++++------------- runtime/rococo/src/weights/pallet_treasury.rs | 3 ++ runtime/rococo/src/xcm_config.rs | 3 +- 4 files changed, 20 insertions(+), 42 deletions(-) diff --git a/node/service/src/chain_spec.rs b/node/service/src/chain_spec.rs index 7a51ad444d92..dd19b5f7237e 100644 --- a/node/service/src/chain_spec.rs +++ b/node/service/src/chain_spec.rs @@ -1051,7 +1051,6 @@ fn rococo_staging_testnet_config_genesis(wasm_binary: &[u8]) -> rococo_runtime:: next_free_para_id: polkadot_primitives::v2::LOWEST_PUBLIC_ID, }, xcm_pallet: Default::default(), - transaction_payment: Default::default(), } } @@ -1602,7 +1601,6 @@ pub fn rococo_testnet_genesis( next_free_para_id: polkadot_primitives::v2::LOWEST_PUBLIC_ID, }, xcm_pallet: Default::default(), - transaction_payment: Default::default(), } } diff --git a/runtime/rococo/src/lib.rs b/runtime/rococo/src/lib.rs index cc33e9afc910..f2265b056e81 100644 --- a/runtime/rococo/src/lib.rs +++ b/runtime/rococo/src/lib.rs @@ -54,7 +54,7 @@ use beefy_primitives::{ // }; use frame_support::{ construct_runtime, parameter_types, - traits::{Contains, EnsureOneOf, InstanceFilter, KeyOwnerProofSystem, PrivilegeCmp, LockIdentifier}, + traits::{Contains, EitherOfDiverse, InstanceFilter, KeyOwnerProofSystem, PrivilegeCmp, LockIdentifier}, weights::ConstantMultiplier, PalletId, RuntimeDebug }; @@ -120,7 +120,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { apis: RUNTIME_API_VERSIONS, #[cfg(feature = "disable-runtime-api")] apis: sp_version::create_apis_vec![[]], - transaction_version: 11, + transaction_version: 12, state_version: 0, }; @@ -147,7 +147,7 @@ impl Contains for BaseFilter { parameter_types! { pub const Version: RuntimeVersion = VERSION; - pub const SS58Prefix: u8 = 42; // TODO: Params -> pub const SS58Prefix: u8 = 2; + pub const SS58Prefix: u8 = 42; } impl frame_system::Config for Runtime { @@ -184,7 +184,7 @@ parameter_types! { pub const NoPreimagePostponement: Option = Some(10); } -type ScheduleOrigin = EnsureOneOf< +type ScheduleOrigin = EitherOfDiverse< EnsureRoot, pallet_collective::EnsureProportionAtLeast, >; @@ -482,7 +482,7 @@ impl pallet_session::historical::Config for Runtime { // (), // >; // type BenchmarkingConfig = runtime_common::elections::BenchmarkConfig; -// type ForceOrigin = EnsureOneOf< +// type ForceOrigin = EitherOfDiverse< // EnsureRoot, // pallet_collective::EnsureProportionAtLeast, // >; @@ -589,7 +589,7 @@ parameter_types! { // } // TODO: Stacking -// type SlashCancelOrigin = EnsureOneOf< +// type SlashCancelOrigin = EitherOfDiverse< // EnsureRoot, // pallet_collective::EnsureProportionAtLeast, // >; @@ -620,7 +620,7 @@ parameter_types! { // type VoterList = VoterList; // type MaxUnlockingChunks = frame_support::traits::ConstU32<32>; // type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig; -// type OnStakerSlash = (); +// type OnStakerSlash = NominationPools; // type WeightInfo = weights::pallet_staking::WeightInfo; // } @@ -664,14 +664,14 @@ impl pallet_democracy::Config for Runtime { type InstantAllowed = InstantAllowed; type FastTrackVotingPeriod = FastTrackVotingPeriod; // To cancel a proposal which has been passed, 2/3 of the council must agree to it. - type CancellationOrigin = EnsureOneOf< + type CancellationOrigin = EitherOfDiverse< EnsureRoot, pallet_collective::EnsureProportionAtLeast, >; type BlacklistOrigin = EnsureRoot; // To cancel a proposal before it has been passed, the technical committee must be unanimous or // Root must agree. - type CancelProposalOrigin = EnsureOneOf< + type CancelProposalOrigin = EitherOfDiverse< EnsureRoot, pallet_collective::EnsureProportionAtLeast, >; @@ -759,7 +759,7 @@ impl pallet_collective::Config for Runtime { type WeightInfo = weights::pallet_collective_technical_committee::WeightInfo; } -type MoreThanHalfCouncil = EnsureOneOf< +type MoreThanHalfCouncil = EitherOfDiverse< EnsureRoot, pallet_collective::EnsureProportionMoreThan, >; @@ -796,7 +796,7 @@ parameter_types! { pub const MaxPeerDataEncodingSize: u32 = 1_000; } -type ApproveOrigin = EnsureOneOf< +type ApproveOrigin = EitherOfDiverse< EnsureRoot, pallet_collective::EnsureProportionAtLeast, >; @@ -817,6 +817,7 @@ impl pallet_treasury::Config for Runtime { type MaxApprovals = MaxApprovals; type WeightInfo = weights::pallet_treasury::WeightInfo; type SpendFunds = Bounties; + type SpendOrigin = frame_support::traits::NeverEnsureOrigin; } parameter_types! { @@ -1395,7 +1396,7 @@ parameter_types! { pub const SampleLength: BlockNumber = 2 * MINUTES; } -type AuctionInitiate = EnsureOneOf< +type AuctionInitiate = EitherOfDiverse< EnsureRoot, pallet_collective::EnsureProportionAtLeast, >; @@ -1477,33 +1478,6 @@ impl pallet_gilt::Config for Runtime { // type MinPointsToBalance = MinPointsToBalance; // } -// TODO: Nominations -// pub struct InitiatePoolConfigs; -// impl OnRuntimeUpgrade for InitiatePoolConfigs { -// fn on_runtime_upgrade() -> frame_support::weights::Weight { -// // we use one as an indicator if this has already been set. -// if pallet_nomination_pools::MaxPools::::get().is_none() { -// // 1/600 KSM to join a pool. -// pallet_nomination_pools::MinJoinBond::::put(50 * CENTS); -// // 1 KSM to create a pool. -// pallet_nomination_pools::MinCreateBond::::put(UNITS); - -// // 128 initial pools: only for initial safety: can be set to infinity when needed. -// pallet_nomination_pools::MaxPools::::put(128); -// // 64k total pool members: only for initial safety: can be set to infinity when needed. -// pallet_nomination_pools::MaxPoolMembers::::put(64 * 1024); -// // 1024 members per pool: only for initial safety: can be set to infinity when needed. -// pallet_nomination_pools::MaxPoolMembersPerPool::::put(1024); - -// log::info!(target: "runtime::kusama", "pools config initiated 🎉"); -// ::DbWeight::get().reads_writes(1, 5) -// } else { -// log::info!(target: "runtime::kusama", "pools config already initiated 😏"); -// ::DbWeight::get().reads(1) -// } -// } -// } - impl pallet_beefy::Config for Runtime { type BeefyId = BeefyId; type MaxAuthorities = MaxAuthorities; @@ -1574,6 +1548,8 @@ parameter_types! { pub const HeadersToKeep: u32 = 7 * DAYS as u32; } +impl paras_sudo_wrapper::Config for Runtime {} + parameter_types! { pub const PermanentSlotLeasePeriodLength: u32 = 365; pub const TemporarySlotLeasePeriodLength: u32 = 3; diff --git a/runtime/rococo/src/weights/pallet_treasury.rs b/runtime/rococo/src/weights/pallet_treasury.rs index 0186ce1349be..583c8e8d1e65 100644 --- a/runtime/rococo/src/weights/pallet_treasury.rs +++ b/runtime/rococo/src/weights/pallet_treasury.rs @@ -44,6 +44,9 @@ use sp_std::marker::PhantomData; /// Weight functions for `pallet_treasury`. pub struct WeightInfo(PhantomData); impl pallet_treasury::WeightInfo for WeightInfo { + fn spend() -> Weight { + (151_000 as Weight) + } // Storage: Treasury ProposalCount (r:1 w:1) // Storage: Treasury Proposals (r:0 w:1) fn propose_spend() -> Weight { diff --git a/runtime/rococo/src/xcm_config.rs b/runtime/rococo/src/xcm_config.rs index 746e3ca5198d..c71378a9c86d 100644 --- a/runtime/rococo/src/xcm_config.rs +++ b/runtime/rococo/src/xcm_config.rs @@ -38,7 +38,8 @@ parameter_types! { /// the context". pub const RocLocation: MultiLocation = Here.into(); /// The Rococo network ID. This is named. - pub RococoNetwork: NetworkId = NetworkId::Named(b"Rococo".to_vec()); + pub RococoNetwork: NetworkId = + NetworkId::Named(b"Rococo".to_vec().try_into().expect("shorter than length limit; qed")); /// Our XCM location ancestry - i.e. what, if anything, `Parent` means evaluated in our context. Since /// Rococo is a top-level relay-chain, there is no ancestry. pub const Ancestry: MultiLocation = Here.into(); From 78c5e0c63255c6b659b4dbe142f11218e8f23f25 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Mon, 11 Jul 2022 14:45:51 +0200 Subject: [PATCH 16/35] fmt --- runtime/rococo/constants/src/lib.rs | 4 ++-- runtime/rococo/src/lib.rs | 32 ++++++++++++++++------------- runtime/rococo/src/weights/mod.rs | 10 ++++----- 3 files changed, 25 insertions(+), 21 deletions(-) diff --git a/runtime/rococo/constants/src/lib.rs b/runtime/rococo/constants/src/lib.rs index edc827cdd523..e11a064197ac 100644 --- a/runtime/rococo/constants/src/lib.rs +++ b/runtime/rococo/constants/src/lib.rs @@ -32,7 +32,7 @@ pub mod currency { pub const fn deposit(items: u32, bytes: u32) -> Balance { items as Balance * 2_000 * CENTS + (bytes as Balance) * 100 * MILLICENTS -} + } } /// Time and blocks. @@ -96,7 +96,7 @@ pub mod fee { #[cfg(test)] mod tests { use super::{ - currency::{CENTS, UNITS, MILLICENTS}, + currency::{CENTS, MILLICENTS, UNITS}, fee::WeightToFee, }; use crate::weights::ExtrinsicBaseWeight; diff --git a/runtime/rococo/src/lib.rs b/runtime/rococo/src/lib.rs index f2265b056e81..2c1af1143002 100644 --- a/runtime/rococo/src/lib.rs +++ b/runtime/rococo/src/lib.rs @@ -25,12 +25,13 @@ use primitives::v2::{ AccountId, AccountIndex, Balance, BlockNumber, CandidateEvent, CandidateHash, CommittedCandidateReceipt, CoreState, DisputeState, GroupRotationInfo, Hash, Id as ParaId, InboundDownwardMessage, InboundHrmpMessage, Moment, Nonce, OccupiedCoreAssumption, - PersistedValidationData, ScrapedOnChainVotes, SessionInfo, Signature, - ValidationCode, ValidationCodeHash, ValidatorId, ValidatorIndex, + PersistedValidationData, ScrapedOnChainVotes, SessionInfo, Signature, ValidationCode, + ValidationCodeHash, ValidatorId, ValidatorIndex, }; use runtime_common::{ - assigned_slots, auctions, claims, crowdloan, impl_runtime_weights, impls::ToAuthor, paras_registrar, - prod_or_fast, paras_sudo_wrapper, slots, BlockHashCount, BlockLength, SlowAdjustingFeeUpdate, + assigned_slots, auctions, claims, crowdloan, impl_runtime_weights, impls::ToAuthor, + paras_registrar, paras_sudo_wrapper, prod_or_fast, slots, BlockHashCount, BlockLength, + SlowAdjustingFeeUpdate, }; use sp_std::{cmp::Ordering, collections::btree_map::BTreeMap, prelude::*}; @@ -38,9 +39,9 @@ use runtime_parachains::{ configuration as parachains_configuration, disputes as parachains_disputes, dmp as parachains_dmp, hrmp as parachains_hrmp, inclusion as parachains_inclusion, initializer as parachains_initializer, origin as parachains_origin, paras as parachains_paras, - paras_inherent as parachains_paras_inherent, runtime_api_impl::v2 as parachains_runtime_api_impl, - scheduler as parachains_scheduler, session_info as parachains_session_info, - shared as parachains_shared, ump as parachains_ump, + paras_inherent as parachains_paras_inherent, + runtime_api_impl::v2 as parachains_runtime_api_impl, scheduler as parachains_scheduler, + session_info as parachains_session_info, shared as parachains_shared, ump as parachains_ump, }; use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId; @@ -54,9 +55,12 @@ use beefy_primitives::{ // }; use frame_support::{ construct_runtime, parameter_types, - traits::{Contains, EitherOfDiverse, InstanceFilter, KeyOwnerProofSystem, PrivilegeCmp, LockIdentifier}, + traits::{ + Contains, EitherOfDiverse, InstanceFilter, KeyOwnerProofSystem, LockIdentifier, + PrivilegeCmp, + }, weights::ConstantMultiplier, - PalletId, RuntimeDebug + PalletId, RuntimeDebug, }; use frame_system::EnsureRoot; use pallet_grandpa::{fg_primitives, AuthorityId as GrandpaId}; @@ -68,8 +72,8 @@ use sp_mmr_primitives as mmr; use sp_runtime::{ create_runtime_str, generic, impl_opaque_keys, traits::{ - AccountIdLookup, BlakeTwo256, Block as BlockT, ConvertInto, Extrinsic as ExtrinsicT, Keccak256, - OpaqueKeys, SaturatedConversion, Verify, + AccountIdLookup, BlakeTwo256, Block as BlockT, ConvertInto, Extrinsic as ExtrinsicT, + Keccak256, OpaqueKeys, SaturatedConversion, Verify, }, transaction_validity::{TransactionPriority, TransactionSource, TransactionValidity}, ApplyExtrinsicResult, KeyTypeId, Perbill, Percent, Permill, @@ -346,7 +350,7 @@ impl pallet_authorship::Config for Runtime { type FindAuthor = pallet_session::FindAccountFromAuthorIndex; type UncleGenerations = UncleGenerations; type FilterUncle = (); - type EventHandler = ImOnline; // TODO: Staking -> type EventHandler = (Staking, ImOnline); + type EventHandler = ImOnline; // TODO: Staking -> type EventHandler = (Staking, ImOnline); } impl_opaque_keys! { @@ -1204,8 +1208,8 @@ impl InstanceFilter for ProxyType { Call::Crowdloan(..) | Call::Slots(..) | Call::Auctions(..) // Specifically omitting the entire XCM Pallet - // TODO: Proxy & TODO: Bags List - // Call::VoterList(..) + // TODO: Proxy & TODO: Bags List + // Call::VoterList(..) ), ProxyType::Governance => matches!( c, diff --git a/runtime/rococo/src/weights/mod.rs b/runtime/rococo/src/weights/mod.rs index f1c8f0145685..7e9abd620fbc 100644 --- a/runtime/rococo/src/weights/mod.rs +++ b/runtime/rococo/src/weights/mod.rs @@ -20,23 +20,23 @@ pub mod pallet_balances; pub mod pallet_bounties; pub mod pallet_child_bounties; pub mod pallet_collective; +pub mod pallet_collective_technical_committee; pub mod pallet_democracy; pub mod pallet_elections_phragmen; -pub mod pallet_im_online; -pub mod pallet_identity; pub mod pallet_gilt; +pub mod pallet_identity; +pub mod pallet_im_online; pub mod pallet_indices; pub mod pallet_membership; pub mod pallet_multisig; +pub mod pallet_preimage; pub mod pallet_proxy; +pub mod pallet_scheduler; pub mod pallet_session; pub mod pallet_timestamp; pub mod pallet_tips; pub mod pallet_treasury; pub mod pallet_utility; -pub mod pallet_scheduler; -pub mod pallet_preimage; -pub mod pallet_collective_technical_committee; pub mod pallet_vesting; pub mod runtime_common_auctions; pub mod runtime_common_claims; From 8c5ccb5e6e4b2338d27cccbeebfb1bdde785ac38 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Mon, 11 Jul 2022 15:15:58 +0200 Subject: [PATCH 17/35] update xcm_config --- runtime/rococo/src/xcm_config.rs | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/runtime/rococo/src/xcm_config.rs b/runtime/rococo/src/xcm_config.rs index c71378a9c86d..aa04fef48f69 100644 --- a/runtime/rococo/src/xcm_config.rs +++ b/runtime/rococo/src/xcm_config.rs @@ -171,26 +171,29 @@ parameter_types! { pub const CouncilBodyId: BodyId = BodyId::Executive; } +/// Type to convert the council origin to a Plurality `MultiLocation` value. +pub type CouncilToPlurality = BackingToPlurality< + Origin, + pallet_collective::Origin, + CouncilBodyId, +>; + /// Type to convert an `Origin` type value into a `MultiLocation` value which represents an interior location /// of this chain. pub type LocalOriginToLocation = ( // We allow an origin from the Collective pallet to be used in XCM as a corresponding Plurality of the // `Unit` body. - BackingToPlurality< - Origin, - pallet_collective::Origin, - CouncilBodyId, - >, + CouncilToPlurality, // And a usual Signed origin to be used in XCM as a corresponding AccountId32 SignedToAccountId32, ); impl pallet_xcm::Config for Runtime { type Event = Event; - // We don't allow any messages to be sent via the transaction yet. This is basically safe to - // enable, (safe the possibility of someone spamming the parachain if they're willing to pay - // the DOT to send from the Relay-chain). But it's useless until we bring in XCM v3 which will - // make `DescendOrigin` a bit more useful. - type SendXcmOrigin = xcm_builder::EnsureXcmOrigin; + // We only allow the council to send messages. This is basically safe to enable for everyone + // (safe the possibility of someone spamming the parachain if they're willing to pay the KSM to + // send from the Relay-chain), but it's useless until we bring in XCM v3 which will make + // `DescendOrigin` a bit more useful. + type SendXcmOrigin = xcm_builder::EnsureXcmOrigin; type XcmRouter = XcmRouter; // Anyone can execute XCM messages locally. type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin; From 761133aee4c38919dfe5701c4c9644191b773c68 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Mon, 11 Jul 2022 15:38:42 +0200 Subject: [PATCH 18/35] revert xcm_config change --- runtime/rococo/src/xcm_config.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/runtime/rococo/src/xcm_config.rs b/runtime/rococo/src/xcm_config.rs index aa04fef48f69..15a900ced09e 100644 --- a/runtime/rococo/src/xcm_config.rs +++ b/runtime/rococo/src/xcm_config.rs @@ -189,11 +189,7 @@ pub type LocalOriginToLocation = ( ); impl pallet_xcm::Config for Runtime { type Event = Event; - // We only allow the council to send messages. This is basically safe to enable for everyone - // (safe the possibility of someone spamming the parachain if they're willing to pay the KSM to - // send from the Relay-chain), but it's useless until we bring in XCM v3 which will make - // `DescendOrigin` a bit more useful. - type SendXcmOrigin = xcm_builder::EnsureXcmOrigin; + type SendXcmOrigin = xcm_builder::EnsureXcmOrigin; // TODO: XCM type XcmRouter = XcmRouter; // Anyone can execute XCM messages locally. type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin; From a40f68ff25d914c9bd3c4dd4978f0d84314ad9bd Mon Sep 17 00:00:00 2001 From: NachoPal Date: Thu, 14 Jul 2022 16:29:46 +0200 Subject: [PATCH 19/35] fixing benchmarks --- runtime/rococo/Cargo.toml | 34 ++-- runtime/rococo/src/lib.rs | 29 +-- .../weights/frame_benchmarking_baseline.rs | 91 +++++++++ runtime/rococo/src/weights/mod.rs | 2 +- .../src/weights/pallet_collective_council.rs | 176 ++++++++++++++++++ runtime/rococo/src/weights/pallet_recovery.rs | 120 ++++++++++++ 6 files changed, 421 insertions(+), 31 deletions(-) create mode 100644 runtime/rococo/src/weights/frame_benchmarking_baseline.rs create mode 100644 runtime/rococo/src/weights/pallet_collective_council.rs create mode 100644 runtime/rococo/src/weights/pallet_recovery.rs diff --git a/runtime/rococo/Cargo.toml b/runtime/rococo/Cargo.toml index 649b64903373..b3a390dd6d7f 100644 --- a/runtime/rococo/Cargo.toml +++ b/runtime/rococo/Cargo.toml @@ -84,6 +84,7 @@ xcm = { package = "xcm", path = "../../xcm", default-features = false } xcm-executor = { package = "xcm-executor", path = "../../xcm/xcm-executor", default-features = false } xcm-builder = { package = "xcm-builder", path = "../../xcm/xcm-builder", default-features = false } pallet-xcm = { path = "../../xcm/pallet-xcm", default-features = false } +pallet-xcm-benchmarks = { path = "../../xcm/pallet-xcm-benchmarks", default-features = false, optional = true } # Benchmarking Dependencies frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } @@ -175,40 +176,41 @@ std = [ disable-runtime-api = [] runtime-benchmarks = [ "runtime-common/runtime-benchmarks", + "frame-benchmarking/runtime-benchmarks", "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", "sp-runtime/runtime-benchmarks", "pallet-babe/runtime-benchmarks", "pallet-balances/runtime-benchmarks", - "pallet-bounties/runtime-benchmarks", + "pallet-bounties/runtime-benchmarks", "pallet-child-bounties/runtime-benchmarks", "pallet-collective/runtime-benchmarks", - "pallet-collective/std", - "pallet-elections-phragmen/runtime-benchmarks", - "pallet-democracy/runtime-benchmarks", - "pallet-preimage/runtime-benchmarks", - "pallet-gilt/runtime-benchmarks", + "pallet-democracy/runtime-benchmarks", + "pallet-elections-phragmen/runtime-benchmarks", + "pallet-gilt/runtime-benchmarks", "pallet-grandpa/runtime-benchmarks", - "pallet-identity/runtime-benchmarks", + "pallet-identity/runtime-benchmarks", "pallet-im-online/runtime-benchmarks", "pallet-indices/runtime-benchmarks", "pallet-membership/runtime-benchmarks", + "pallet-multisig/runtime-benchmarks", + "pallet-preimage/runtime-benchmarks", "pallet-proxy/runtime-benchmarks", - "pallet-recovery/runtime-benchmarks", + "pallet-scheduler/runtime-benchmarks", + "pallet-society/runtime-benchmarks", + "pallet-recovery/runtime-benchmarks", "pallet-staking/runtime-benchmarks", - "pallet-society/runtime-benchmarks", "pallet-timestamp/runtime-benchmarks", - "pallet-tips/runtime-benchmarks", + "pallet-tips/runtime-benchmarks", + "pallet-treasury/runtime-benchmarks", "pallet-utility/runtime-benchmarks", + "pallet-vesting/runtime-benchmarks", "pallet-xcm/runtime-benchmarks", - "pallet-vesting/runtime-benchmarks", - "xcm-builder/runtime-benchmarks", - "pallet-multisig/runtime-benchmarks", - "frame-benchmarking/runtime-benchmarks", - "hex-literal", "frame-system-benchmarking", + "hex-literal", + "xcm-builder/runtime-benchmarks", "runtime-parachains/runtime-benchmarks", - "pallet-scheduler/runtime-benchmarks", + "pallet-xcm-benchmarks", ] try-runtime = [ "frame-executive/try-runtime", diff --git a/runtime/rococo/src/lib.rs b/runtime/rococo/src/lib.rs index 2c1af1143002..f719265b7170 100644 --- a/runtime/rococo/src/lib.rs +++ b/runtime/rococo/src/lib.rs @@ -708,7 +708,7 @@ impl pallet_collective::Config for Runtime { type MaxProposals = CouncilMaxProposals; type MaxMembers = CouncilMaxMembers; type DefaultVote = pallet_collective::PrimeDefaultVote; - type WeightInfo = weights::pallet_collective::WeightInfo; + type WeightInfo = weights::pallet_collective_council::WeightInfo; } parameter_types! { @@ -1792,8 +1792,7 @@ mod benches { // [pallet_bags_list, VoterList] [frame_benchmarking::baseline, Baseline::] [pallet_bounties, Bounties] - // TODO: Vhild Bounties - // [pallet_child_bounties, ChildBounties] + [pallet_child_bounties, ChildBounties] [pallet_collective, Council] [pallet_collective, TechnicalCommittee] [pallet_democracy, Democracy] @@ -1809,7 +1808,8 @@ mod benches { [pallet_multisig, Multisig] // TODO: Nomination // [pallet_nomination_pools, NominationPoolsBench::] - [pallet_offences, OffencesBench::] + // TODO: Offences + // [pallet_offences, OffencesBench::] [pallet_preimage, Preimage] [pallet_proxy, Proxy] [pallet_recovery, Recovery] @@ -1823,8 +1823,7 @@ mod benches { [pallet_tips, Tips] [pallet_treasury, Treasury] [pallet_utility, Utility] - // TODO: Vesting - // [pallet_vesting, Vesting] + [pallet_vesting, Vesting] // XCM [pallet_xcm_benchmarks::fungible, pallet_xcm_benchmarks::fungible::Pallet::] [pallet_xcm_benchmarks::generic, pallet_xcm_benchmarks::generic::Pallet::] @@ -2215,6 +2214,8 @@ sp_api::impl_runtime_apis! { // TODO: Election // use pallet_election_provider_support_benchmarking::Pallet as ElectionProviderBench; use frame_system_benchmarking::Pallet as SystemBench; + // TODO: Nomination + //use pallet_nomination_pools_benchmarking::Pallet as NominationPoolsBench; use frame_benchmarking::baseline::Pallet as Baseline; let mut list = Vec::::new(); @@ -2230,7 +2231,7 @@ sp_api::impl_runtime_apis! { Vec, sp_runtime::RuntimeString, > { - use frame_benchmarking::{Benchmarking, BenchmarkBatch, TrackedStorageKey}; + use frame_benchmarking::{Benchmarking, BenchmarkBatch, TrackedStorageKey, BenchmarkError}; // Trying to add benchmarks directly to some pallets caused cyclic dependency issues. // To get around that, we separated the benchmarks into its own crate. // TODO: Session (added) @@ -2241,10 +2242,10 @@ sp_api::impl_runtime_apis! { // use pallet_election_provider_support_benchmarking::Pallet as ElectionProviderBench; use frame_system_benchmarking::Pallet as SystemBench; // TODO: Nomination - use pallet_nomination_pools_benchmarking::Pallet as NominationPoolsBench; + // use pallet_nomination_pools_benchmarking::Pallet as NominationPoolsBench; use frame_benchmarking::baseline::Pallet as Baseline; use xcm::latest::prelude::*; - use xcm_config::{CheckAccount, KsmLocation, SovereignAccountOf, Statemine, XcmConfig}; + use xcm_config::{CheckAccount, RocLocation, SovereignAccountOf, Statemine, XcmConfig}; // TODO: Session (added) // impl pallet_session_benchmarking::Config for Runtime {} @@ -2266,7 +2267,7 @@ sp_api::impl_runtime_apis! { fn worst_case_holding() -> MultiAssets { // Rococo only knows about ROC vec![MultiAsset{ - id: Concrete(KsmLocation::get()), + id: Concrete(RocLocation::get()), fun: Fungible(1_000_000 * UNITS), }].into() } @@ -2275,11 +2276,11 @@ sp_api::impl_runtime_apis! { parameter_types! { pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some(( Statemine::get(), - MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(KsmLocation::get()) }, + MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(RocLocation::get()) }, )); pub const TrustedReserve: Option<(MultiLocation, MultiAsset)> = Some(( Statemine::get(), - MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(KsmLocation::get()) }, + MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(RocLocation::get()) }, )); } @@ -2292,7 +2293,7 @@ sp_api::impl_runtime_apis! { fn get_multi_asset() -> MultiAsset { MultiAsset { - id: Concrete(KsmLocation::get()), + id: Concrete(RocLocation::get()), fun: Fungible(1 * UNITS), } } @@ -2315,7 +2316,7 @@ sp_api::impl_runtime_apis! { fn claimable_asset() -> Result<(MultiLocation, MultiLocation, MultiAssets), BenchmarkError> { let origin = Statemine::get(); - let assets: MultiAssets = (Concrete(KsmLocation::get()), 1_000 * UNITS).into(); + let assets: MultiAssets = (Concrete(RocLocation::get()), 1_000 * UNITS).into(); let ticket = MultiLocation { parents: 0, interior: Here }; Ok((origin, ticket, assets)) } diff --git a/runtime/rococo/src/weights/frame_benchmarking_baseline.rs b/runtime/rococo/src/weights/frame_benchmarking_baseline.rs new file mode 100644 index 000000000000..eba26bf590b1 --- /dev/null +++ b/runtime/rococo/src/weights/frame_benchmarking_baseline.rs @@ -0,0 +1,91 @@ +// Copyright 2017-2022 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 `frame_benchmarking::baseline` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-07-12, STEPS: `2`, REPEAT: 4, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `MacBook-Pro.local`, CPU: `` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/polkadot +// benchmark +// pallet +// --chain=rococo-dev +// --steps=2 +// --repeat=4 +// --pallet=frame_benchmarking::baseline +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --header=./file_header.txt +// --output=./runtime/rococo/src/weights/frame_benchmarking_baseline.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `frame_benchmarking::baseline`. +pub struct WeightInfo(PhantomData); +impl frame_benchmarking::baseline::WeightInfo for WeightInfo { + /// The range of component `i` is `[0, 1000000]`. + fn addition(_i: u32, ) -> Weight { + (83_000 as Weight) + } + /// The range of component `i` is `[0, 1000000]`. + fn subtraction(_i: u32, ) -> Weight { + (167_000 as Weight) + } + /// The range of component `i` is `[0, 1000000]`. + fn multiplication(_i: u32, ) -> Weight { + (83_000 as Weight) + } + /// The range of component `i` is `[0, 1000000]`. + fn division(_i: u32, ) -> Weight { + (500_000 as Weight) + } + /// The range of component `i` is `[0, 100]`. + fn hashing(i: u32, ) -> Weight { + (31_317_000_000 as Weight) + // Standard Error: 14_063_000 + .saturating_add((5_040_000 as Weight).saturating_mul(i as Weight)) + } + /// The range of component `i` is `[1, 100]`. + fn sr25519_verification(i: u32, ) -> Weight { + (0 as Weight) + // Standard Error: 3_190_000 + .saturating_add((59_959_000 as Weight).saturating_mul(i as Weight)) + } + // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `i` is `[0, 1000]`. + fn storage_read(i: u32, ) -> Weight { + (0 as Weight) + // Standard Error: 253_000 + .saturating_add((3_906_000 as Weight).saturating_mul(i as Weight)) + .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(i as Weight))) + } + // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `i` is `[0, 1000]`. + fn storage_write(i: u32, ) -> Weight { + (0 as Weight) + // Standard Error: 5_000 + .saturating_add((700_000 as Weight).saturating_mul(i as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight))) + } +} diff --git a/runtime/rococo/src/weights/mod.rs b/runtime/rococo/src/weights/mod.rs index 7e9abd620fbc..712783bc3e6c 100644 --- a/runtime/rococo/src/weights/mod.rs +++ b/runtime/rococo/src/weights/mod.rs @@ -19,7 +19,7 @@ pub mod frame_system; pub mod pallet_balances; pub mod pallet_bounties; pub mod pallet_child_bounties; -pub mod pallet_collective; +pub mod pallet_collective_council; pub mod pallet_collective_technical_committee; pub mod pallet_democracy; pub mod pallet_elections_phragmen; diff --git a/runtime/rococo/src/weights/pallet_collective_council.rs b/runtime/rococo/src/weights/pallet_collective_council.rs new file mode 100644 index 000000000000..0e2ea3587e7f --- /dev/null +++ b/runtime/rococo/src/weights/pallet_collective_council.rs @@ -0,0 +1,176 @@ +// Copyright 2017-2021 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_collective` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2021-08-27, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 128 + +// Executed Command: +// target/release/polkadot +// benchmark +// --chain=rococo-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_collective +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/rococo/src/weights/ + + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_collective`. +pub struct WeightInfo(PhantomData); +impl pallet_collective::WeightInfo for WeightInfo { + // Storage: Instance1Collective Members (r:1 w:1) + // Storage: Instance1Collective Proposals (r:1 w:0) + // Storage: Instance1Collective Voting (r:100 w:100) + // Storage: Instance1Collective Prime (r:0 w:1) + fn set_members(m: u32, n: u32, p: u32, ) -> Weight { + (0 as Weight) + // Standard Error: 6_000 + .saturating_add((14_448_000 as Weight).saturating_mul(m as Weight)) + // Standard Error: 6_000 + .saturating_add((85_000 as Weight).saturating_mul(n as Weight)) + // Standard Error: 6_000 + .saturating_add((19_620_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(p as Weight))) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(p as Weight))) + } + // Storage: Instance1Collective Members (r:1 w:0) + fn execute(b: u32, m: u32, ) -> Weight { + (22_536_000 as Weight) + // Standard Error: 0 + .saturating_add((3_000 as Weight).saturating_mul(b as Weight)) + // Standard Error: 0 + .saturating_add((84_000 as Weight).saturating_mul(m as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + } + // Storage: Instance1Collective Members (r:1 w:0) + // Storage: Instance1Collective ProposalOf (r:1 w:0) + fn propose_execute(b: u32, m: u32, ) -> Weight { + (27_600_000 as Weight) + // Standard Error: 0 + .saturating_add((3_000 as Weight).saturating_mul(b as Weight)) + // Standard Error: 0 + .saturating_add((161_000 as Weight).saturating_mul(m as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + } + // Storage: Instance1Collective Members (r:1 w:0) + // Storage: Instance1Collective ProposalOf (r:1 w:1) + // Storage: Instance1Collective Proposals (r:1 w:1) + // Storage: Instance1Collective ProposalCount (r:1 w:1) + // Storage: Instance1Collective Voting (r:0 w:1) + fn propose_proposed(b: u32, m: u32, p: u32, ) -> Weight { + (42_192_000 as Weight) + // Standard Error: 0 + .saturating_add((4_000 as Weight).saturating_mul(b as Weight)) + // Standard Error: 0 + .saturating_add((87_000 as Weight).saturating_mul(m as Weight)) + // Standard Error: 0 + .saturating_add((361_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(4 as Weight)) + .saturating_add(T::DbWeight::get().writes(4 as Weight)) + } + // Storage: Instance1Collective Members (r:1 w:0) + // Storage: Instance1Collective Voting (r:1 w:1) + fn vote(m: u32, ) -> Weight { + (32_307_000 as Weight) + // Standard Error: 0 + .saturating_add((199_000 as Weight).saturating_mul(m as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Instance1Collective Voting (r:1 w:1) + // Storage: Instance1Collective Members (r:1 w:0) + // Storage: Instance1Collective Proposals (r:1 w:1) + // Storage: Instance1Collective ProposalOf (r:0 w:1) + fn close_early_disapproved(m: u32, p: u32, ) -> Weight { + (41_436_000 as Weight) + // Standard Error: 0 + .saturating_add((170_000 as Weight).saturating_mul(m as Weight)) + // Standard Error: 0 + .saturating_add((333_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + // Storage: Instance1Collective Voting (r:1 w:1) + // Storage: Instance1Collective Members (r:1 w:0) + // Storage: Instance1Collective ProposalOf (r:1 w:1) + // Storage: Instance1Collective Proposals (r:1 w:1) + fn close_early_approved(b: u32, m: u32, p: u32, ) -> Weight { + (57_836_000 as Weight) + // Standard Error: 0 + .saturating_add((2_000 as Weight).saturating_mul(b as Weight)) + // Standard Error: 0 + .saturating_add((170_000 as Weight).saturating_mul(m as Weight)) + // Standard Error: 0 + .saturating_add((339_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(4 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + // Storage: Instance1Collective Voting (r:1 w:1) + // Storage: Instance1Collective Members (r:1 w:0) + // Storage: Instance1Collective Prime (r:1 w:0) + // Storage: Instance1Collective Proposals (r:1 w:1) + // Storage: Instance1Collective ProposalOf (r:0 w:1) + fn close_disapproved(m: u32, p: u32, ) -> Weight { + (45_551_000 as Weight) + // Standard Error: 0 + .saturating_add((172_000 as Weight).saturating_mul(m as Weight)) + // Standard Error: 0 + .saturating_add((338_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(4 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + // Storage: Instance1Collective Voting (r:1 w:1) + // Storage: Instance1Collective Members (r:1 w:0) + // Storage: Instance1Collective Prime (r:1 w:0) + // Storage: Instance1Collective ProposalOf (r:1 w:1) + // Storage: Instance1Collective Proposals (r:1 w:1) + fn close_approved(b: u32, m: u32, p: u32, ) -> Weight { + (61_497_000 as Weight) + // Standard Error: 0 + .saturating_add((2_000 as Weight).saturating_mul(b as Weight)) + // Standard Error: 0 + .saturating_add((171_000 as Weight).saturating_mul(m as Weight)) + // Standard Error: 0 + .saturating_add((343_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(5 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + // Storage: Instance1Collective Proposals (r:1 w:1) + // Storage: Instance1Collective Voting (r:0 w:1) + // Storage: Instance1Collective ProposalOf (r:0 w:1) + fn disapprove_proposal(p: u32, ) -> Weight { + (25_573_000 as Weight) + // Standard Error: 0 + .saturating_add((335_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } +} diff --git a/runtime/rococo/src/weights/pallet_recovery.rs b/runtime/rococo/src/weights/pallet_recovery.rs new file mode 100644 index 000000000000..1236714fd2bd --- /dev/null +++ b/runtime/rococo/src/weights/pallet_recovery.rs @@ -0,0 +1,120 @@ +// Copyright 2017-2022 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_recovery` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-07-12, STEPS: `2`, REPEAT: 4, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `MacBook-Pro.local`, CPU: `` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/polkadot +// benchmark +// pallet +// --chain=rococo-dev +// --steps=2 +// --repeat=4 +// --pallet=pallet_recovery +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --header=./file_header.txt +// --output=./runtime/rococo/src/weights/pallet_recovery.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_recovery`. +pub struct WeightInfo(PhantomData); +impl pallet_recovery::WeightInfo for WeightInfo { + // Storage: Recovery Proxy (r:1 w:0) + fn as_recovered() -> Weight { + (20_000_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + } + // Storage: Recovery Proxy (r:0 w:1) + fn set_recovered() -> Weight { + (34_000_000 as Weight) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Recovery Recoverable (r:1 w:1) + /// The range of component `n` is `[1, 9]`. + fn create_recovery(n: u32, ) -> Weight { + (55_271_000 as Weight) + // Standard Error: 1_335_000 + .saturating_add((6_313_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Recovery Recoverable (r:1 w:0) + // Storage: Recovery ActiveRecoveries (r:1 w:1) + fn initiate_recovery() -> Weight { + (71_000_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Recovery Recoverable (r:1 w:0) + // Storage: Recovery ActiveRecoveries (r:1 w:1) + /// The range of component `n` is `[1, 9]`. + fn vouch_recovery(n: u32, ) -> Weight { + (47_604_000 as Weight) + // Standard Error: 380_000 + .saturating_add((812_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Recovery Recoverable (r:1 w:0) + // Storage: Recovery ActiveRecoveries (r:1 w:0) + // Storage: Recovery Proxy (r:1 w:1) + /// The range of component `n` is `[1, 9]`. + fn claim_recovery(n: u32, ) -> Weight { + (57_625_000 as Weight) + // Standard Error: 1_000_000 + .saturating_add((6_375_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Recovery ActiveRecoveries (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `n` is `[1, 9]`. + fn close_recovery(n: u32, ) -> Weight { + (79_292_000 as Weight) + // Standard Error: 1_972_000 + .saturating_add((1_875_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Recovery ActiveRecoveries (r:1 w:0) + // Storage: Recovery Recoverable (r:1 w:1) + /// The range of component `n` is `[1, 9]`. + fn remove_recovery(n: u32, ) -> Weight { + (107_292_000 as Weight) + // Standard Error: 4_017_000 + .saturating_add((1_875_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Recovery Proxy (r:1 w:1) + fn cancel_recovered() -> Weight { + (29_000_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } +} From 098b63fe38108d98cefbfce29988cbf04228eedf Mon Sep 17 00:00:00 2001 From: NachoPal Date: Thu, 14 Jul 2022 16:48:28 +0200 Subject: [PATCH 20/35] cargo.lock --- Cargo.lock | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.lock b/Cargo.lock index c56e227e5eee..7bd1066fd70a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8316,6 +8316,7 @@ dependencies = [ "pallet-utility", "pallet-vesting", "pallet-xcm", + "pallet-xcm-benchmarks", "parity-scale-codec", "polkadot-parachain", "polkadot-primitives", From e9382cf0101d0de5ed29624c392b66322e6110f2 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Thu, 14 Jul 2022 17:44:59 +0200 Subject: [PATCH 21/35] Revert "babe+epoch_time modificaction" This reverts commit 982d220917d9b497d84124e2a40857aa1f1ebbec. --- node/service/src/chain_spec.rs | 72 +++++++++++++++++++++++++---- runtime/rococo/constants/src/lib.rs | 5 +- runtime/rococo/src/lib.rs | 20 ++++---- 3 files changed, 78 insertions(+), 19 deletions(-) diff --git a/node/service/src/chain_spec.rs b/node/service/src/chain_spec.rs index dd19b5f7237e..80115920c2b0 100644 --- a/node/service/src/chain_spec.rs +++ b/node/service/src/chain_spec.rs @@ -106,7 +106,7 @@ pub type WestendChainSpec = DummyChainSpec; /// The `ChainSpec` parameterized for the rococo runtime. #[cfg(feature = "rococo-native")] -pub type RococoChainSpec = service::GenericChainSpec; +pub type RococoChainSpec = service::GenericChainSpec; /// The `ChainSpec` parameterized for the `versi` runtime. /// @@ -118,6 +118,30 @@ pub type VersiChainSpec = RococoChainSpec; #[cfg(not(feature = "rococo-native"))] pub type RococoChainSpec = DummyChainSpec; +/// Extension for the Rococo genesis config to support a custom changes to the genesis state. +#[derive(serde::Serialize, serde::Deserialize)] +#[cfg(feature = "rococo-native")] +pub struct RococoGenesisExt { + /// The runtime genesis config. + runtime_genesis_config: rococo::GenesisConfig, + /// The session length in blocks. + /// + /// If `None` is supplied, the default value is used. + session_length_in_blocks: Option, +} + +#[cfg(feature = "rococo-native")] +impl sp_runtime::BuildStorage for RococoGenesisExt { + fn assimilate_storage(&self, storage: &mut sp_core::storage::Storage) -> Result<(), String> { + sp_state_machine::BasicExternalities::execute_with_storage(storage, || { + if let Some(length) = self.session_length_in_blocks.as_ref() { + rococo_runtime_constants::time::EpochDurationInBlocks::set(length); + } + }); + self.runtime_genesis_config.assimilate_storage(storage) + } +} + pub fn polkadot_config() -> Result { PolkadotChainSpec::from_json_bytes(&include_bytes!("../chain-specs/polkadot.json")[..]) } @@ -1143,7 +1167,10 @@ pub fn rococo_staging_testnet_config() -> Result { "Rococo Staging Testnet", "rococo_staging_testnet", ChainType::Live, - move || rococo_staging_testnet_config_genesis(wasm_binary), + move || RococoGenesisExt { + runtime_genesis_config: rococo_staging_testnet_config_genesis(wasm_binary), + session_length_in_blocks: None, + }, boot_nodes, Some( TelemetryEndpoints::new(vec![(ROCOCO_STAGING_TELEMETRY_URL.to_string(), 0)]) @@ -1177,7 +1204,10 @@ pub fn versi_staging_testnet_config() -> Result { "Versi Staging Testnet", "versi_staging_testnet", ChainType::Live, - move || rococo_staging_testnet_config_genesis(wasm_binary), + move || RococoGenesisExt { + runtime_genesis_config: rococo_staging_testnet_config_genesis(wasm_binary), + session_length_in_blocks: Some(100), + }, boot_nodes, Some( TelemetryEndpoints::new(vec![(VERSI_STAGING_TELEMETRY_URL.to_string(), 0)]) @@ -1710,7 +1740,11 @@ pub fn rococo_development_config() -> Result { "Development", "rococo_dev", ChainType::Development, - move || rococo_development_config_genesis(wasm_binary), + move || RococoGenesisExt { + runtime_genesis_config: rococo_development_config_genesis(wasm_binary), + // Use 1 minute session length. + session_length_in_blocks: Some(10), + }, vec![], None, Some(DEFAULT_PROTOCOL_ID), @@ -1729,7 +1763,11 @@ pub fn versi_development_config() -> Result { "Development", "versi_dev", ChainType::Development, - move || rococo_development_config_genesis(wasm_binary), + move || RococoGenesisExt { + runtime_genesis_config: rococo_development_config_genesis(wasm_binary), + // Use 1 minute session length. + session_length_in_blocks: Some(10), + }, vec![], None, Some("versi"), @@ -1749,7 +1787,11 @@ pub fn wococo_development_config() -> Result { "Development", "wococo_dev", ChainType::Development, - move || rococo_development_config_genesis(wasm_binary), + move || RococoGenesisExt { + runtime_genesis_config: rococo_development_config_genesis(wasm_binary), + // Use 1 minute session length. + session_length_in_blocks: Some(10), + }, vec![], None, Some(WOCOCO_DEV_PROTOCOL_ID), @@ -1874,7 +1916,11 @@ pub fn rococo_local_testnet_config() -> Result { "Rococo Local Testnet", "rococo_local_testnet", ChainType::Local, - move || rococo_local_testnet_genesis(wasm_binary), + move || RococoGenesisExt { + runtime_genesis_config: rococo_local_testnet_genesis(wasm_binary), + // Use 1 minute session length. + session_length_in_blocks: Some(10), + }, vec![], None, Some(DEFAULT_PROTOCOL_ID), @@ -1909,7 +1955,11 @@ pub fn wococo_local_testnet_config() -> Result { "Wococo Local Testnet", "wococo_local_testnet", ChainType::Local, - move || wococo_local_testnet_genesis(wasm_binary), + move || RococoGenesisExt { + runtime_genesis_config: wococo_local_testnet_genesis(wasm_binary), + // Use 1 minute session length. + session_length_in_blocks: Some(10), + }, vec![], None, Some(DEFAULT_PROTOCOL_ID), @@ -1944,7 +1994,11 @@ pub fn versi_local_testnet_config() -> Result { "Versi Local Testnet", "versi_local_testnet", ChainType::Local, - move || versi_local_testnet_genesis(wasm_binary), + move || RococoGenesisExt { + runtime_genesis_config: versi_local_testnet_genesis(wasm_binary), + // Use 1 minute session length. + session_length_in_blocks: Some(10), + }, vec![], None, Some("versi"), diff --git a/runtime/rococo/constants/src/lib.rs b/runtime/rococo/constants/src/lib.rs index e11a064197ac..214ef58e37e1 100644 --- a/runtime/rococo/constants/src/lib.rs +++ b/runtime/rococo/constants/src/lib.rs @@ -41,7 +41,10 @@ pub mod time { use runtime_common::prod_or_fast; pub const MILLISECS_PER_BLOCK: Moment = 6000; pub const SLOT_DURATION: Moment = MILLISECS_PER_BLOCK; - pub const EPOCH_DURATION_IN_SLOTS: BlockNumber = prod_or_fast!(1 * HOURS, 1 * MINUTES); + pub const DEFAULT_EPOCH_DURATION: BlockNumber = prod_or_fast!(1 * HOURS, 1 * MINUTES); + frame_support::parameter_types! { + pub storage EpochDurationInBlocks: BlockNumber = DEFAULT_EPOCH_DURATION; + } // These time units are defined in number of blocks. pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber); diff --git a/runtime/rococo/src/lib.rs b/runtime/rococo/src/lib.rs index f719265b7170..bf4e9f75c6c4 100644 --- a/runtime/rococo/src/lib.rs +++ b/runtime/rococo/src/lib.rs @@ -247,18 +247,20 @@ impl pallet_preimage::Config for Runtime { } parameter_types! { - pub EpochDuration: u64 = prod_or_fast!( - EPOCH_DURATION_IN_SLOTS as u64, - 2 * MINUTES as u64, - "ROC_EPOCH_DURATION" - ); + // pub EpochDuration: u64 = prod_or_fast!( + // EPOCH_DURATION_IN_SLOTS as u64, + // 2 * MINUTES as u64, + // "ROC_EPOCH_DURATION" + // ); pub const ExpectedBlockTime: Moment = MILLISECS_PER_BLOCK; - pub ReportLongevity: u64 = - BondingDuration::get() as u64 * SessionsPerEra::get() as u64 * EpochDuration::get(); + // TODO: Staking + // pub ReportLongevity: u64 = + // BondingDuration::get() as u64 * SessionsPerEra::get() as u64 * EpochDuration::get(); + pub ReportLongevity: u64 = EpochDurationInBlocks::get() as u64 * 10; } impl pallet_babe::Config for Runtime { - type EpochDuration = EpochDuration; + type EpochDuration = EpochDurationInBlocks; // TODO: Babe -> type EpochDuration = EpochDuration; type ExpectedBlockTime = ExpectedBlockTime; // session module is the trigger @@ -2108,7 +2110,7 @@ sp_api::impl_runtime_apis! { // babe_primitives::BabeGenesisConfiguration { slot_duration: Babe::slot_duration(), - epoch_length: EpochDuration::get().into(), + epoch_length: EpochDurationInBlocks::get().into(), // TODO: Babe -> epoch_length: EpochDuration::get().into() c: BABE_GENESIS_EPOCH_CONFIG.c, genesis_authorities: Babe::authorities().to_vec(), randomness: Babe::randomness(), From 7ffd2d947de5e7dd1f8af91c0c05633a9bdf472c Mon Sep 17 00:00:00 2001 From: NachoPal Date: Wed, 20 Jul 2022 11:32:37 +0200 Subject: [PATCH 22/35] fix benchamrks 2 --- .../weights/frame_benchmarking_baseline.rs | 36 +++++++++---------- .../src/weights/pallet_elections_phragmen.rs | 6 ++-- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/runtime/rococo/src/weights/frame_benchmarking_baseline.rs b/runtime/rococo/src/weights/frame_benchmarking_baseline.rs index eba26bf590b1..93b1cf101dec 100644 --- a/runtime/rococo/src/weights/frame_benchmarking_baseline.rs +++ b/runtime/rococo/src/weights/frame_benchmarking_baseline.rs @@ -16,17 +16,17 @@ //! Autogenerated weights for `frame_benchmarking::baseline` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-07-12, STEPS: `2`, REPEAT: 4, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `MacBook-Pro.local`, CPU: `` +//! DATE: 2022-06-20, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 // Executed Command: -// ./target/release/polkadot +// ./target/production/polkadot // benchmark // pallet // --chain=rococo-dev -// --steps=2 -// --repeat=4 +// --steps=50 +// --repeat=20 // --pallet=frame_benchmarking::baseline // --extrinsic=* // --execution=wasm @@ -46,46 +46,46 @@ pub struct WeightInfo(PhantomData); impl frame_benchmarking::baseline::WeightInfo for WeightInfo { /// The range of component `i` is `[0, 1000000]`. fn addition(_i: u32, ) -> Weight { - (83_000 as Weight) + (126_000 as Weight) } /// The range of component `i` is `[0, 1000000]`. fn subtraction(_i: u32, ) -> Weight { - (167_000 as Weight) + (117_000 as Weight) } /// The range of component `i` is `[0, 1000000]`. fn multiplication(_i: u32, ) -> Weight { - (83_000 as Weight) + (132_000 as Weight) } /// The range of component `i` is `[0, 1000000]`. fn division(_i: u32, ) -> Weight { - (500_000 as Weight) + (132_000 as Weight) } /// The range of component `i` is `[0, 100]`. fn hashing(i: u32, ) -> Weight { - (31_317_000_000 as Weight) - // Standard Error: 14_063_000 - .saturating_add((5_040_000 as Weight).saturating_mul(i as Weight)) + (19_331_786_000 as Weight) + // Standard Error: 113_000 + .saturating_add((410_000 as Weight).saturating_mul(i as Weight)) } /// The range of component `i` is `[1, 100]`. fn sr25519_verification(i: u32, ) -> Weight { (0 as Weight) - // Standard Error: 3_190_000 - .saturating_add((59_959_000 as Weight).saturating_mul(i as Weight)) + // Standard Error: 15_000 + .saturating_add((47_597_000 as Weight).saturating_mul(i as Weight)) } // Storage: Skipped Metadata (r:0 w:0) /// The range of component `i` is `[0, 1000]`. fn storage_read(i: u32, ) -> Weight { (0 as Weight) - // Standard Error: 253_000 - .saturating_add((3_906_000 as Weight).saturating_mul(i as Weight)) + // Standard Error: 3_000 + .saturating_add((2_126_000 as Weight).saturating_mul(i as Weight)) .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(i as Weight))) } // Storage: Skipped Metadata (r:0 w:0) /// The range of component `i` is `[0, 1000]`. fn storage_write(i: u32, ) -> Weight { (0 as Weight) - // Standard Error: 5_000 - .saturating_add((700_000 as Weight).saturating_mul(i as Weight)) + // Standard Error: 0 + .saturating_add((328_000 as Weight).saturating_mul(i as Weight)) .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight))) } } diff --git a/runtime/rococo/src/weights/pallet_elections_phragmen.rs b/runtime/rococo/src/weights/pallet_elections_phragmen.rs index e67f3f6d3c6c..f4097ba7b517 100644 --- a/runtime/rococo/src/weights/pallet_elections_phragmen.rs +++ b/runtime/rococo/src/weights/pallet_elections_phragmen.rs @@ -17,13 +17,13 @@ //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev //! DATE: 2022-05-11, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 1024 +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 // Executed Command: // ./target/production/polkadot // benchmark // pallet -// --chain=kusama-dev +// --chain=rococo-dev // --steps=50 // --repeat=20 // --pallet=pallet_elections_phragmen @@ -32,7 +32,7 @@ // --wasm-execution=compiled // --heap-pages=4096 // --header=./file_header.txt -// --output=./runtime/kusama/src/weights/pallet_elections_phragmen.rs +// --output=./runtime/rococo/src/weights/pallet_elections_phragmen.rs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] From 128f8300673a2a060c044429f84c5495f1ad160b Mon Sep 17 00:00:00 2001 From: NachoPal Date: Wed, 20 Jul 2022 11:51:58 +0200 Subject: [PATCH 23/35] fix benchmarks 3 --- .../rococo/src/weights/pallet_collective.rs | 198 ------------------ 1 file changed, 198 deletions(-) delete mode 100644 runtime/rococo/src/weights/pallet_collective.rs diff --git a/runtime/rococo/src/weights/pallet_collective.rs b/runtime/rococo/src/weights/pallet_collective.rs deleted file mode 100644 index e2c77e70f0be..000000000000 --- a/runtime/rococo/src/weights/pallet_collective.rs +++ /dev/null @@ -1,198 +0,0 @@ -// Copyright 2017-2022 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_collective` -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-06-20, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 - -// Executed Command: -// ./target/production/polkadot -// benchmark -// pallet -// --chain=rococo-dev -// --steps=50 -// --repeat=20 -// --pallet=pallet_collective -// --extrinsic=* -// --execution=wasm -// --wasm-execution=compiled -// --header=./file_header.txt -// --output=./runtime/rococo/src/weights/pallet_collective.rs - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; - -/// Weight functions for `pallet_collective`. -pub struct WeightInfo(PhantomData); -impl pallet_collective::WeightInfo for WeightInfo { - // Storage: Collective Members (r:1 w:1) - // Storage: Collective Proposals (r:1 w:0) - // Storage: Collective Voting (r:100 w:100) - // Storage: Collective Prime (r:0 w:1) - /// The range of component `m` is `[1, 100]`. - /// The range of component `n` is `[1, 100]`. - /// The range of component `p` is `[1, 100]`. - fn set_members(m: u32, n: u32, p: u32, ) -> Weight { - (0 as Weight) - // Standard Error: 13_000 - .saturating_add((12_171_000 as Weight).saturating_mul(m as Weight)) - // Standard Error: 13_000 - .saturating_add((21_000 as Weight).saturating_mul(n as Weight)) - // Standard Error: 13_000 - .saturating_add((14_949_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(p as Weight))) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(p as Weight))) - } - // Storage: Collective Members (r:1 w:0) - /// The range of component `b` is `[1, 1024]`. - /// The range of component `m` is `[1, 100]`. - fn execute(b: u32, m: u32, ) -> Weight { - (16_747_000 as Weight) - // Standard Error: 0 - .saturating_add((2_000 as Weight).saturating_mul(b as Weight)) - // Standard Error: 0 - .saturating_add((38_000 as Weight).saturating_mul(m as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - } - // Storage: Collective Members (r:1 w:0) - // Storage: Collective ProposalOf (r:1 w:0) - /// The range of component `b` is `[1, 1024]`. - /// The range of component `m` is `[1, 100]`. - fn propose_execute(b: u32, m: u32, ) -> Weight { - (19_211_000 as Weight) - // Standard Error: 0 - .saturating_add((2_000 as Weight).saturating_mul(b as Weight)) - // Standard Error: 0 - .saturating_add((66_000 as Weight).saturating_mul(m as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - } - // Storage: Collective Members (r:1 w:0) - // Storage: Collective ProposalOf (r:1 w:1) - // Storage: Collective Proposals (r:1 w:1) - // Storage: Collective ProposalCount (r:1 w:1) - // Storage: Collective Voting (r:0 w:1) - /// The range of component `b` is `[1, 1024]`. - /// The range of component `m` is `[2, 100]`. - /// The range of component `p` is `[1, 100]`. - fn propose_proposed(b: u32, m: u32, p: u32, ) -> Weight { - (26_174_000 as Weight) - // Standard Error: 0 - .saturating_add((3_000 as Weight).saturating_mul(b as Weight)) - // Standard Error: 0 - .saturating_add((39_000 as Weight).saturating_mul(m as Weight)) - // Standard Error: 0 - .saturating_add((142_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().writes(4 as Weight)) - } - // Storage: Collective Members (r:1 w:0) - // Storage: Collective Voting (r:1 w:1) - /// The range of component `m` is `[5, 100]`. - fn vote(m: u32, ) -> Weight { - (24_215_000 as Weight) - // Standard Error: 0 - .saturating_add((92_000 as Weight).saturating_mul(m as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - // Storage: Collective Voting (r:1 w:1) - // Storage: Collective Members (r:1 w:0) - // Storage: Collective Proposals (r:1 w:1) - // Storage: Collective ProposalOf (r:0 w:1) - /// The range of component `m` is `[4, 100]`. - /// The range of component `p` is `[1, 100]`. - fn close_early_disapproved(m: u32, p: u32, ) -> Weight { - (27_539_000 as Weight) - // Standard Error: 0 - .saturating_add((71_000 as Weight).saturating_mul(m as Weight)) - // Standard Error: 0 - .saturating_add((118_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - } - // Storage: Collective Voting (r:1 w:1) - // Storage: Collective Members (r:1 w:0) - // Storage: Collective ProposalOf (r:1 w:1) - // Storage: Collective Proposals (r:1 w:1) - /// The range of component `b` is `[1, 1024]`. - /// The range of component `m` is `[4, 100]`. - /// The range of component `p` is `[1, 100]`. - fn close_early_approved(b: u32, m: u32, p: u32, ) -> Weight { - (37_477_000 as Weight) - // Standard Error: 0 - .saturating_add((2_000 as Weight).saturating_mul(b as Weight)) - // Standard Error: 0 - .saturating_add((69_000 as Weight).saturating_mul(m as Weight)) - // Standard Error: 0 - .saturating_add((120_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - } - // Storage: Collective Voting (r:1 w:1) - // Storage: Collective Members (r:1 w:0) - // Storage: Collective Prime (r:1 w:0) - // Storage: Collective Proposals (r:1 w:1) - // Storage: Collective ProposalOf (r:0 w:1) - /// The range of component `m` is `[4, 100]`. - /// The range of component `p` is `[1, 100]`. - fn close_disapproved(m: u32, p: u32, ) -> Weight { - (29_699_000 as Weight) - // Standard Error: 0 - .saturating_add((73_000 as Weight).saturating_mul(m as Weight)) - // Standard Error: 0 - .saturating_add((122_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - } - // Storage: Collective Voting (r:1 w:1) - // Storage: Collective Members (r:1 w:0) - // Storage: Collective Prime (r:1 w:0) - // Storage: Collective ProposalOf (r:1 w:1) - // Storage: Collective Proposals (r:1 w:1) - /// The range of component `b` is `[1, 1024]`. - /// The range of component `m` is `[4, 100]`. - /// The range of component `p` is `[1, 100]`. - fn close_approved(b: u32, m: u32, p: u32, ) -> Weight { - (39_441_000 as Weight) - // Standard Error: 0 - .saturating_add((2_000 as Weight).saturating_mul(b as Weight)) - // Standard Error: 0 - .saturating_add((70_000 as Weight).saturating_mul(m as Weight)) - // Standard Error: 0 - .saturating_add((127_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(5 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - } - // Storage: Collective Proposals (r:1 w:1) - // Storage: Collective Voting (r:0 w:1) - // Storage: Collective ProposalOf (r:0 w:1) - /// The range of component `p` is `[1, 100]`. - fn disapprove_proposal(p: u32, ) -> Weight { - (18_354_000 as Weight) - // Standard Error: 0 - .saturating_add((123_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - } -} From 2d3ce2d23c95df168c9f97fe3082e18ae88bd9cb Mon Sep 17 00:00:00 2001 From: NachoPal Date: Tue, 26 Jul 2022 12:39:31 +0200 Subject: [PATCH 24/35] typos --- runtime/rococo/src/lib.rs | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/runtime/rococo/src/lib.rs b/runtime/rococo/src/lib.rs index bf4e9f75c6c4..59a02022ccab 100644 --- a/runtime/rococo/src/lib.rs +++ b/runtime/rococo/src/lib.rs @@ -407,12 +407,12 @@ impl pallet_session::historical::Config for Runtime { // pub SignedPhase: u32 = prod_or_fast!( // EPOCH_DURATION_IN_SLOTS / 4, // (1 * MINUTES).min(EpochDuration::get().saturated_into::() / 2), -// "KSM_SIGNED_PHASE" +// "ROC_SIGNED_PHASE" // ); // pub UnsignedPhase: u32 = prod_or_fast!( // EPOCH_DURATION_IN_SLOTS / 4, // (1 * MINUTES).min(EpochDuration::get().saturated_into::() / 2), -// "KSM_UNSIGNED_PHASE" +// "ROC_UNSIGNED_PHASE" // ); // TODO: Election @@ -421,7 +421,7 @@ impl pallet_session::historical::Config for Runtime { // pub const SignedMaxRefunds: u32 = 16 / 4; // pub const SignedDepositBase: Balance = deposit(2, 0); // pub const SignedDepositByte: Balance = deposit(0, 10) / 1024; -// // Each good submission will get 1/10 KSM as reward +// // Each good submission will get 1/10 ROC as reward // pub SignedRewardBase: Balance = UNITS / 10; // pub BetterUnsignedThreshold: Perbill = Perbill::from_rational(5u32, 10_000); @@ -575,12 +575,12 @@ impl pallet_session::historical::Config for Runtime { // } // } -// TODO: Stacking -> remove when stacking added +// TODO: Staking -> remove when staking added parameter_types! { pub const SessionsPerEra: SessionIndex = 6; pub const BondingDuration: sp_staking::EraIndex = 28; } -// TODO: Stacking +// TODO: Staking // parameter_types! { // // Six sessions in an era (6 hours). // pub const SessionsPerEra: SessionIndex = 6; @@ -594,13 +594,13 @@ parameter_types! { // pub const MaxNominations: u32 = ::LIMIT as u32; // } -// TODO: Stacking +// TODO: Staking // type SlashCancelOrigin = EitherOfDiverse< // EnsureRoot, // pallet_collective::EnsureProportionAtLeast, // >; -// TODO: Stacking +// TODO: Staking // impl pallet_staking::Config for Runtime { // type MaxNominations = MaxNominations; // type Currency = Balances; @@ -631,12 +631,12 @@ parameter_types! { // } parameter_types! { - pub LaunchPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1, "KSM_LAUNCH_PERIOD"); - pub VotingPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1 * MINUTES, "KSM_VOTING_PERIOD"); - pub FastTrackVotingPeriod: BlockNumber = prod_or_fast!(3 * HOURS, 1 * MINUTES, "KSM_FAST_TRACK_VOTING_PERIOD"); + pub LaunchPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1, "ROC_LAUNCH_PERIOD"); + pub VotingPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1 * MINUTES, "ROC_VOTING_PERIOD"); + pub FastTrackVotingPeriod: BlockNumber = prod_or_fast!(3 * HOURS, 1 * MINUTES, "ROC_FAST_TRACK_VOTING_PERIOD"); pub const MinimumDeposit: Balance = 100 * CENTS; - pub EnactmentPeriod: BlockNumber = prod_or_fast!(8 * DAYS, 1, "KSM_ENACTMENT_PERIOD"); - pub CooloffPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1 * MINUTES, "KSM_COOLOFF_PERIOD"); + pub EnactmentPeriod: BlockNumber = prod_or_fast!(8 * DAYS, 1, "ROC_ENACTMENT_PERIOD"); + pub CooloffPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1 * MINUTES, "ROC_COOLOFF_PERIOD"); pub const InstantAllowed: bool = true; pub const MaxVotes: u32 = 100; pub const MaxProposals: u32 = 100; @@ -748,7 +748,7 @@ impl pallet_elections_phragmen::Config for Runtime { } parameter_types! { - pub TechnicalMotionDuration: BlockNumber = prod_or_fast!(3 * DAYS, 2 * MINUTES, "KSM_MOTION_DURATION"); + pub TechnicalMotionDuration: BlockNumber = prod_or_fast!(3 * DAYS, 2 * MINUTES, "ROC_MOTION_DURATION"); pub const TechnicalMaxProposals: u32 = 100; pub const TechnicalMaxMembers: u32 = 100; } @@ -1005,7 +1005,7 @@ impl claims::Config for Runtime { } parameter_types! { - // Minimum 100 bytes/KSM deposited (1 CENT/byte) + // Minimum 100 bytes/ROC deposited (1 CENT/byte) pub const BasicDeposit: Balance = 1000 * CENTS; // 258 bytes on-chain pub const FieldDeposit: Balance = 250 * CENTS; // 66 bytes on-chain pub const SubAccountDeposit: Balance = 200 * CENTS; // 53 bytes on-chain @@ -2364,7 +2364,7 @@ sp_api::impl_runtime_apis! { // #[test] // fn signed_deposit_is_sensible() { // // ensure this number does not change, or that it is checked after each change. -// // a 1 MB solution should need around 0.16 KSM deposit +// // a 1 MB solution should need around 0.16 ROC deposit // let deposit = SignedDepositBase::get() + (SignedDepositByte::get() * 1024 * 1024); // assert_eq_error_rate!(deposit, UNITS * 16 / 100, UNITS / 100); // } From 4b666a78aa89e4182d1c2dbe844f36ee6e269feb Mon Sep 17 00:00:00 2001 From: NachoPal Date: Tue, 26 Jul 2022 13:16:35 +0200 Subject: [PATCH 25/35] miscelaneous --- runtime/rococo/src/lib.rs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/runtime/rococo/src/lib.rs b/runtime/rococo/src/lib.rs index 59a02022ccab..f87ad6ef2863 100644 --- a/runtime/rococo/src/lib.rs +++ b/runtime/rococo/src/lib.rs @@ -1398,7 +1398,10 @@ impl crowdloan::Config for Runtime { } parameter_types! { + // The average auction is 7 days long, so this will be 70% for ending period. + // 5 Days = 72000 Blocks @ 6 sec per block pub const EndingPeriod: BlockNumber = 5 * DAYS; + // ~ 1000 samples per day -> ~ 20 blocks per sample -> 2 minute samples pub const SampleLength: BlockNumber = 2 * MINUTES; } @@ -1756,16 +1759,6 @@ pub type Executive = frame_executive::Executive< /// The payload being signed in transactions. pub type SignedPayload = generic::SignedPayload; -parameter_types! { - pub const ValidationUpgradeFrequency: BlockNumber = 2 * DAYS; - pub const ValidationUpgradeDelay: BlockNumber = 8 * HOURS; - pub const SlashPeriod: BlockNumber = 7 * DAYS; -} - -// parameter_types! { -// pub SessionDuration: BlockNumber = EpochDurationInBlocks::get() as _; -// } - #[cfg(feature = "runtime-benchmarks")] #[macro_use] extern crate frame_benchmarking; From ee144d40ba987d404cff77ac3ab6f4fa55a3ea82 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Tue, 26 Jul 2022 13:42:26 +0200 Subject: [PATCH 26/35] fix constants test --- runtime/rococo/constants/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/rococo/constants/src/lib.rs b/runtime/rococo/constants/src/lib.rs index 214ef58e37e1..ec12a59c0e8d 100644 --- a/runtime/rococo/constants/src/lib.rs +++ b/runtime/rococo/constants/src/lib.rs @@ -109,10 +109,10 @@ mod tests { #[test] // Test that the fee for `MAXIMUM_BLOCK_WEIGHT` of weight has sane bounds. fn full_block_fee_is_correct() { - // A full block should cost between 10 and 100 UNITS. + // A full block should cost between 1,000 and 10,000 CENTS. let full_block = WeightToFee::weight_to_fee(&MAXIMUM_BLOCK_WEIGHT); - assert!(full_block >= 1_000 * UNITS); - assert!(full_block <= 10_000 * UNITS); + assert!(full_block >= 1_000 * CENTS); + assert!(full_block <= 10_000 * CENTS); } #[test] From e9d7f18b6a6594d440eb9d2431a87bbeff129b16 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Tue, 26 Jul 2022 14:44:03 +0200 Subject: [PATCH 27/35] rollback comments --- runtime/kusama/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index 2deb31982399..c89dc730dccd 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -80,13 +80,13 @@ use sp_version::RuntimeVersion; use static_assertions::const_assert; pub use frame_system::Call as SystemCall; -// pub use pallet_balances::Call as BalancesCall; +pub use pallet_balances::Call as BalancesCall; pub use pallet_election_provider_multi_phase::Call as EPMCall; #[cfg(feature = "std")] pub use pallet_staking::StakerStatus; // pub use pallet_timestamp::Call as TimestampCall; -// #[cfg(any(feature = "std", test))] -// pub use sp_runtime::BuildStorage; +#[cfg(any(feature = "std", test))] +pub use sp_runtime::BuildStorage; /// Constant values used within the runtime. use kusama_runtime_constants::{currency::*, fee::*, time::*}; From 43a7372e7b8a5bee3a82fb700164a289fa781eb0 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Tue, 26 Jul 2022 15:58:08 +0200 Subject: [PATCH 28/35] rollback lease period --- runtime/rococo/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/rococo/src/lib.rs b/runtime/rococo/src/lib.rs index d630fc92aeee..4af765698f01 100644 --- a/runtime/rococo/src/lib.rs +++ b/runtime/rococo/src/lib.rs @@ -1365,7 +1365,7 @@ impl paras_registrar::Config for Runtime { } parameter_types! { - pub LeasePeriod: BlockNumber = prod_or_fast!(6 * WEEKS, 6 * WEEKS, "ROC_LEASE_PERIOD"); + pub LeasePeriod: BlockNumber = prod_or_fast!(1 * DAYS, 1 * DAYS, "ROC_LEASE_PERIOD"); } impl slots::Config for Runtime { From 0e1a2d0168ec36f85b2f2eadd3d1feca6ac0916f Mon Sep 17 00:00:00 2001 From: NachoPal Date: Tue, 26 Jul 2022 17:05:13 +0200 Subject: [PATCH 29/35] fmt --- runtime/rococo/constants/src/lib.rs | 2 +- runtime/rococo/src/lib.rs | 1 - runtime/rococo/src/xcm_config.rs | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/runtime/rococo/constants/src/lib.rs b/runtime/rococo/constants/src/lib.rs index ec12a59c0e8d..a182ba017ae5 100644 --- a/runtime/rococo/constants/src/lib.rs +++ b/runtime/rococo/constants/src/lib.rs @@ -99,7 +99,7 @@ pub mod fee { #[cfg(test)] mod tests { use super::{ - currency::{CENTS, MILLICENTS, UNITS}, + currency::{CENTS, MILLICENTS}, fee::WeightToFee, }; use crate::weights::ExtrinsicBaseWeight; diff --git a/runtime/rococo/src/lib.rs b/runtime/rococo/src/lib.rs index 4af765698f01..ff70ff983569 100644 --- a/runtime/rococo/src/lib.rs +++ b/runtime/rococo/src/lib.rs @@ -92,7 +92,6 @@ pub use pallet_balances::Call as BalancesCall; // #[cfg(feature = "std")] // pub use pallet_staking::StakerStatus; - /// Constant values used within the runtime. use rococo_runtime_constants::{currency::*, fee::*, time::*}; diff --git a/runtime/rococo/src/xcm_config.rs b/runtime/rococo/src/xcm_config.rs index 15a900ced09e..1f537a57a1dc 100644 --- a/runtime/rococo/src/xcm_config.rs +++ b/runtime/rococo/src/xcm_config.rs @@ -189,7 +189,7 @@ pub type LocalOriginToLocation = ( ); impl pallet_xcm::Config for Runtime { type Event = Event; - type SendXcmOrigin = xcm_builder::EnsureXcmOrigin; // TODO: XCM + type SendXcmOrigin = xcm_builder::EnsureXcmOrigin; // TODO: XCM type XcmRouter = XcmRouter; // Anyone can execute XCM messages locally. type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin; From f09d5eee736fcd477b1fcc9087df1c4710845ae7 Mon Sep 17 00:00:00 2001 From: alvicsam Date: Tue, 26 Jul 2022 17:59:25 +0200 Subject: [PATCH 30/35] add ROC to spellcheck dictionary --- scripts/ci/gitlab/lingua.dic | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/ci/gitlab/lingua.dic b/scripts/ci/gitlab/lingua.dic index 8be00d55c494..6e6d0acea6ad 100644 --- a/scripts/ci/gitlab/lingua.dic +++ b/scripts/ci/gitlab/lingua.dic @@ -225,6 +225,7 @@ reservable responder/SM retriability reverify +ROC roundtrip/MS routable rpc From 288f3dc874c3b04388cf9d71eb8aad668f95cecf Mon Sep 17 00:00:00 2001 From: NachoPal Date: Thu, 11 Aug 2022 17:40:58 +0200 Subject: [PATCH 31/35] fix cargo.toml + fixes --- Cargo.lock | 5 + runtime/rococo/Cargo.toml | 246 +++++++++++------- runtime/rococo/src/lib.rs | 4 - .../src/weights/pallet_elections_phragmen.rs | 5 - runtime/rococo/src/weights/pallet_session.rs | 2 +- 5 files changed, 153 insertions(+), 109 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a2954640bda6..e571e708e272 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8246,8 +8246,10 @@ dependencies = [ "polkadot-runtime-parachains", "rococo-runtime-constants", "scale-info", + "separator", "serde", "serde_derive", + "serde_json", "smallvec", "sp-api", "sp-authority-discovery", @@ -8256,6 +8258,7 @@ dependencies = [ "sp-core", "sp-inherents", "sp-io", + "sp-keyring", "sp-mmr-primitives", "sp-offchain", "sp-runtime", @@ -8263,9 +8266,11 @@ dependencies = [ "sp-staking", "sp-std", "sp-transaction-pool", + "sp-trie", "sp-version", "static_assertions", "substrate-wasm-builder", + "tiny-keccak", "xcm", "xcm-builder", "xcm-executor", diff --git a/runtime/rococo/Cargo.toml b/runtime/rococo/Cargo.toml index 1aba97f76ff7..e0970f23e145 100644 --- a/runtime/rococo/Cargo.toml +++ b/runtime/rococo/Cargo.toml @@ -6,90 +6,109 @@ edition = "2021" build = "build.rs" [dependencies] +#bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] } parity-scale-codec = { version = "3.1.5", default-features = false, features = ["derive", "max-encoded-len"] } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } +log = { version = "0.4.17", default-features = false } +#rustc-hex = { version = "2.1.0", default-features = false } serde = { version = "1.0.137", default-features = false } serde_derive = { version = "1.0.117", optional = true } static_assertions = "1.1.0" smallvec = "1.8.0" -log = { version = "0.4.17", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +authority-discovery-primitives = { package = "sp-authority-discovery", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +babe-primitives = { package = "sp-consensus-babe", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +beefy-primitives = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +beefy-merkle-tree = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +rococo-runtime-constants = { package = "rococo-runtime-constants", path = "./constants", default-features = false } sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +inherents = { package = "sp-inherents", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +offchain-primitives = { package = "sp-offchain", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-std = { package = "sp-std", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +#sp-arithmetic = { package = "sp-arithmetic", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-mmr-primitives = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -sp-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-staking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +sp-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-version = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } - tx-pool-api = { package = "sp-transaction-pool", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } block-builder-api = { package = "sp-block-builder", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -inherents = { package = "sp-inherents", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -offchain-primitives = { package = "sp-offchain", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +#sp-npos-elections = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -babe-primitives = { package = "sp-consensus-babe", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -beefy-primitives = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -beefy-merkle-tree = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -frame-executive = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-authorship = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-babe = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +#pallet-bags-list = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-beefy = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-beefy-mmr = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-bounties = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-child-bounties = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-collective = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-democracy = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-elections-phragmen = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -pallet-collective = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -pallet-gilt = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +#pallet-election-provider-multi-phase = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +frame-executive = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-gilt = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-identity = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-im-online = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-indices = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-membership = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-mmr = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-multisig = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +#pallet-nomination-pools = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-offences = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-preimage = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-proxy = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-recovery = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -pallet-tips = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -pallet-treasury = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-scheduler = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -pallet-staking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-society = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-sudo = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-staking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +#pallet-staking-reward-fn = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +frame-system = {git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -pallet-offences = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -pallet-proxy = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -pallet-scheduler = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -pallet-preimage = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-tips = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-treasury = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-utility = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-vesting = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -authority-discovery-primitives = { package = "sp-authority-discovery", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-xcm = { path = "../../xcm/pallet-xcm", default-features = false } +pallet-xcm-benchmarks = { path = "../../xcm/pallet-xcm-benchmarks", default-features = false, optional = true } +#frame-election-provider-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -rococo-runtime-constants = { package = "rococo-runtime-constants", path = "./constants", default-features = false } +frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } +#frame-try-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } +#pallet-offences-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } +#pallet-session-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } +#pallet-nomination-pools-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } +frame-system-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } +#pallet-election-provider-support-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } +hex-literal = { version = "0.3.4", optional = true } runtime-common = { package = "polkadot-runtime-common", path = "../common", default-features = false } +runtime-parachains = { package = "polkadot-runtime-parachains", path = "../parachains", default-features = false } primitives = { package = "polkadot-primitives", path = "../../primitives", default-features = false } polkadot-parachain = { path = "../../parachain", default-features = false } -runtime-parachains = { package = "polkadot-runtime-parachains", path = "../parachains", default-features = false } xcm = { package = "xcm", path = "../../xcm", default-features = false } xcm-executor = { package = "xcm-executor", path = "../../xcm/xcm-executor", default-features = false } xcm-builder = { package = "xcm-builder", path = "../../xcm/xcm-builder", default-features = false } -pallet-xcm = { path = "../../xcm/pallet-xcm", default-features = false } -pallet-xcm-benchmarks = { path = "../../xcm/pallet-xcm-benchmarks", default-features = false, optional = true } -# Benchmarking Dependencies -frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } -hex-literal = { version = "0.3.4", optional = true } -frame-system-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } +[dev-dependencies] +hex-literal = "0.3.4" +tiny-keccak = { version = "2.0.2", features = ["keccak"] } +keyring = { package = "sp-keyring", git = "https://github.com/paritytech/substrate", branch = "master" } +sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master" } +separator = "0.4.1" +serde_json = "1.0.81" [build-dependencies] substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master" } @@ -97,83 +116,87 @@ substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", bran [features] default = ["std"] no_std = [] +#only-staking = [] std = [ "authority-discovery-primitives/std", - "babe-primitives/std", +# "bitvec/std", + "primitives/std", +# "rustc-hex/std", "parity-scale-codec/std", "scale-info/std", + "inherents/std", + "sp-core/std", + "sp-api/std", + "tx-pool-api/std", + "block-builder-api/std", + "offchain-primitives/std", + "sp-std/std", + "sp-io/std", + "frame-support/std", "frame-executive/std", "pallet-authority-discovery/std", "pallet-authorship/std", - "pallet-babe/std", - "beefy-primitives/std", +# "pallet-bags-list/std", "pallet-balances/std", - "pallet-bounties/std", - "pallet-child-bounties/std", - "pallet-collective/std", - "pallet-elections-phragmen/std", "pallet-beefy/std", "pallet-beefy-mmr/std", - "pallet-democracy/std", + "pallet-bounties/std", + "pallet-child-bounties/std", + "pallet-transaction-payment/std", + "pallet-transaction-payment-rpc-runtime-api/std", + "pallet-collective/std", + "pallet-elections-phragmen/std", +# "pallet-election-provider-multi-phase/std", + "pallet-democracy/std", + "pallet-gilt/std", "pallet-grandpa/std", - "pallet-identity/std", - "pallet-sudo/std", + "pallet-identity/std", + "pallet-im-online/std", + "pallet-indices/std", "pallet-membership/std", "pallet-mmr/std", - "pallet-gilt/std", - "pallet-indices/std", - "pallet-im-online/std", + "pallet-multisig/std", +# "pallet-nomination-pools/std", + "pallet-offences/std", + "pallet-preimage/std", + "pallet-proxy/std", + "pallet-recovery/std", + "pallet-scheduler/std", "pallet-session/std", "pallet-society/std", + "pallet-sudo/std", "pallet-staking/std", - "pallet-offences/std", - "pallet-proxy/std", - "pallet-recovery/std", +# "pallet-staking-reward-fn/std", "pallet-timestamp/std", "pallet-tips/std", - "pallet-transaction-payment/std", - "pallet-transaction-payment-rpc-runtime-api/std", - "pallet-treasury/std", - "pallet-collective/std", - "pallet-scheduler/std", - "pallet-preimage/std", - "pallet-vesting/std", - "inherents/std", - "frame-support/std", + "pallet-treasury/std", + "pallet-utility/std", + "pallet-vesting/std", + "pallet-babe/std", + "pallet-xcm/std", "polkadot-parachain/std", - "primitives/std", - "runtime-common/std", - "runtime-parachains/std", - "sp-api/std", - "sp-core/std", - "sp-io/std", "sp-mmr-primitives/std", "sp-runtime/std", - "sp-session/std", "sp-staking/std", - "sp-std/std", "frame-system/std", "frame-system-rpc-runtime-api/std", - "offchain-primitives/std", - "block-builder-api/std", - "tx-pool-api/std", "sp-version/std", "serde_derive", "serde/std", + "log/std", + "babe-primitives/std", + "sp-session/std", + "runtime-common/std", + "runtime-parachains/std", +# "frame-try-runtime/std", +# "sp-npos-elections/std", + "beefy-primitives/std", + "rococo-runtime-constants/std", "xcm/std", "xcm-executor/std", "xcm-builder/std", - "pallet-xcm/std", - "pallet-utility/std", - "log/std", - "pallet-multisig/std", +# "frame-election-provider-support/std", ] -# When enabled, the runtime API will not be build. -# -# This is required by Cumulus to access certain types of the -# runtime without clashing with the runtime API exported functions -# in WASM. -disable-runtime-api = [] runtime-benchmarks = [ "runtime-common/runtime-benchmarks", "frame-benchmarking/runtime-benchmarks", @@ -187,6 +210,8 @@ runtime-benchmarks = [ "pallet-collective/runtime-benchmarks", "pallet-democracy/runtime-benchmarks", "pallet-elections-phragmen/runtime-benchmarks", +# "pallet-election-provider-multi-phase/runtime-benchmarks", +# "pallet-election-provider-support-benchmarking/runtime-benchmarks", "pallet-gilt/runtime-benchmarks", "pallet-grandpa/runtime-benchmarks", "pallet-identity/runtime-benchmarks", @@ -194,6 +219,8 @@ runtime-benchmarks = [ "pallet-indices/runtime-benchmarks", "pallet-membership/runtime-benchmarks", "pallet-multisig/runtime-benchmarks", +# "pallet-nomination-pools/runtime-benchmarks", +# "pallet-nomination-pools-benchmarking", "pallet-preimage/runtime-benchmarks", "pallet-proxy/runtime-benchmarks", "pallet-scheduler/runtime-benchmarks", @@ -205,48 +232,69 @@ runtime-benchmarks = [ "pallet-treasury/runtime-benchmarks", "pallet-utility/runtime-benchmarks", "pallet-vesting/runtime-benchmarks", +# "pallet-offences-benchmarking", +# "pallet-session-benchmarking", "pallet-xcm/runtime-benchmarks", "frame-system-benchmarking", "hex-literal", "xcm-builder/runtime-benchmarks", +# "frame-election-provider-support/runtime-benchmarks", +# "pallet-bags-list/runtime-benchmarks", "runtime-parachains/runtime-benchmarks", "pallet-xcm-benchmarks", ] try-runtime = [ "frame-executive/try-runtime", - "frame-support/try-runtime", +# "frame-try-runtime", "frame-system/try-runtime", "pallet-authority-discovery/try-runtime", "pallet-authorship/try-runtime", - "pallet-babe/try-runtime", "pallet-balances/try-runtime", - "pallet-bounties/try-runtime", +# "pallet-bags-list/try-runtime", + "pallet-bounties/try-runtime", "pallet-child-bounties/try-runtime", + "pallet-transaction-payment/try-runtime", "pallet-collective/try-runtime", - "pallet-democracy/try-runtime", - "pallet-elections-phragmen/try-runtime", + "pallet-elections-phragmen/try-runtime", +# "pallet-election-provider-multi-phase/try-runtime", + "pallet-democracy/try-runtime", "pallet-grandpa/try-runtime", - "pallet-identity/try-runtime", - "pallet-recovery/try-runtime", - "pallet-sudo/try-runtime", - "pallet-indices/try-runtime", + "pallet-identity/try-runtime", "pallet-im-online/try-runtime", + "pallet-indices/try-runtime", "pallet-membership/try-runtime", - "pallet-session/try-runtime", + "pallet-multisig/try-runtime", +# "pallet-nomination-pools/try-runtime", + "pallet-offences/try-runtime", + "pallet-preimage/try-runtime", "pallet-proxy/try-runtime", - "pallet-society/try-runtime", + "pallet-recovery/try-runtime", + "pallet-scheduler/try-runtime", + "pallet-session/try-runtime", + "pallet-society/try-runtime", + "pallet-sudo/try-runtime", "pallet-staking/try-runtime", - "pallet-offences/try-runtime", "pallet-timestamp/try-runtime", - "pallet-tips/try-runtime", - "pallet-transaction-payment/try-runtime", - "pallet-treasury/runtime-benchmarks", - "pallet-collective/try-runtime", - "pallet-vesting/try-runtime", + "pallet-tips/try-runtime", + "pallet-treasury/try-runtime", + "pallet-utility/try-runtime", + "pallet-vesting/try-runtime", + "pallet-babe/try-runtime", "runtime-common/try-runtime", - "pallet-multisig/try-runtime", - "pallet-scheduler/try-runtime", ] +# When enabled, the runtime API will not be build. +# +# This is required by Cumulus to access certain types of the +# runtime without clashing with the runtime API exported functions +# in WASM. +disable-runtime-api = [] + +## A feature that should be enabled when the runtime should be build 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", +#] # Set timing constants (e.g. session period) to faster versions to speed up testing. fast-runtime = [] diff --git a/runtime/rococo/src/lib.rs b/runtime/rococo/src/lib.rs index ff70ff983569..cb8e9a8e2569 100644 --- a/runtime/rococo/src/lib.rs +++ b/runtime/rococo/src/lib.rs @@ -903,10 +903,6 @@ impl pallet_im_online::Config for Runtime { type MaxPeerDataEncodingSize = MaxPeerDataEncodingSize; } -// parameter_types! { -// pub const AttestationPeriod: BlockNumber = 50; -// } - impl pallet_grandpa::Config for Runtime { type Event = Event; type Call = Call; diff --git a/runtime/rococo/src/weights/pallet_elections_phragmen.rs b/runtime/rococo/src/weights/pallet_elections_phragmen.rs index f4097ba7b517..3198b38ef649 100644 --- a/runtime/rococo/src/weights/pallet_elections_phragmen.rs +++ b/runtime/rococo/src/weights/pallet_elections_phragmen.rs @@ -136,11 +136,6 @@ impl pallet_elections_phragmen::WeightInfo for WeightIn .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(5 as Weight)) } - // Storage: PhragmenElection RunnersUp (r:1 w:0) - fn remove_member_wrong_refund() -> Weight { - (5_203_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - } // Storage: PhragmenElection Voting (r:251 w:250) // Storage: PhragmenElection Members (r:1 w:0) // Storage: PhragmenElection RunnersUp (r:1 w:0) diff --git a/runtime/rococo/src/weights/pallet_session.rs b/runtime/rococo/src/weights/pallet_session.rs index 5583fde83fae..c09dd9ffd14b 100644 --- a/runtime/rococo/src/weights/pallet_session.rs +++ b/runtime/rococo/src/weights/pallet_session.rs @@ -22,7 +22,7 @@ // Executed Command: // ./target/production/polkadot // benchmark -// --chain=polkadot-dev +// --chain=rococo-dev // --steps=50 // --repeat=20 // --pallet=pallet_session From ac9093e913f565f03b377473234636c7fbc1e70a Mon Sep 17 00:00:00 2001 From: NachoPal Date: Fri, 12 Aug 2022 12:01:34 +0200 Subject: [PATCH 32/35] remove TODOs --- runtime/rococo/Cargo.toml | 43 ---- runtime/rococo/src/lib.rs | 393 +------------------------------ runtime/rococo/src/xcm_config.rs | 2 +- 3 files changed, 13 insertions(+), 425 deletions(-) diff --git a/runtime/rococo/Cargo.toml b/runtime/rococo/Cargo.toml index e0970f23e145..d2ecac9cc8cf 100644 --- a/runtime/rococo/Cargo.toml +++ b/runtime/rococo/Cargo.toml @@ -6,11 +6,9 @@ edition = "2021" build = "build.rs" [dependencies] -#bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] } parity-scale-codec = { version = "3.1.5", default-features = false, features = ["derive", "max-encoded-len"] } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } log = { version = "0.4.17", default-features = false } -#rustc-hex = { version = "2.1.0", default-features = false } serde = { version = "1.0.137", default-features = false } serde_derive = { version = "1.0.117", optional = true } static_assertions = "1.1.0" @@ -25,7 +23,6 @@ sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", d inherents = { package = "sp-inherents", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } offchain-primitives = { package = "sp-offchain", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-std = { package = "sp-std", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -#sp-arithmetic = { package = "sp-arithmetic", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-io = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-mmr-primitives = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -35,12 +32,10 @@ sp-session = { git = "https://github.com/paritytech/substrate", branch = "master sp-version = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } tx-pool-api = { package = "sp-transaction-pool", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } block-builder-api = { package = "sp-block-builder", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -#sp-npos-elections = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-authorship = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-babe = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -#pallet-bags-list = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-beefy = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-beefy-mmr = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -51,7 +46,6 @@ pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/parityt pallet-collective = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-democracy = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-elections-phragmen = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -#pallet-election-provider-multi-phase = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } frame-executive = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-gilt = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -61,7 +55,6 @@ pallet-indices = { git = "https://github.com/paritytech/substrate", branch = "ma pallet-membership = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-mmr = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-multisig = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -#pallet-nomination-pools = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-offences = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-preimage = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-proxy = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -72,7 +65,6 @@ pallet-society = { git = "https://github.com/paritytech/substrate", branch = "ma pallet-sudo = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-staking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -#pallet-staking-reward-fn = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } frame-system = {git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -82,15 +74,9 @@ pallet-utility = { git = "https://github.com/paritytech/substrate", branch = "ma pallet-vesting = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-xcm = { path = "../../xcm/pallet-xcm", default-features = false } pallet-xcm-benchmarks = { path = "../../xcm/pallet-xcm-benchmarks", default-features = false, optional = true } -#frame-election-provider-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } -#frame-try-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } -#pallet-offences-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } -#pallet-session-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } -#pallet-nomination-pools-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } frame-system-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } -#pallet-election-provider-support-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } hex-literal = { version = "0.3.4", optional = true } runtime-common = { package = "polkadot-runtime-common", path = "../common", default-features = false } @@ -116,12 +102,9 @@ substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", bran [features] default = ["std"] no_std = [] -#only-staking = [] std = [ "authority-discovery-primitives/std", -# "bitvec/std", "primitives/std", -# "rustc-hex/std", "parity-scale-codec/std", "scale-info/std", "inherents/std", @@ -136,7 +119,6 @@ std = [ "frame-executive/std", "pallet-authority-discovery/std", "pallet-authorship/std", -# "pallet-bags-list/std", "pallet-balances/std", "pallet-beefy/std", "pallet-beefy-mmr/std", @@ -146,7 +128,6 @@ std = [ "pallet-transaction-payment-rpc-runtime-api/std", "pallet-collective/std", "pallet-elections-phragmen/std", -# "pallet-election-provider-multi-phase/std", "pallet-democracy/std", "pallet-gilt/std", "pallet-grandpa/std", @@ -156,7 +137,6 @@ std = [ "pallet-membership/std", "pallet-mmr/std", "pallet-multisig/std", -# "pallet-nomination-pools/std", "pallet-offences/std", "pallet-preimage/std", "pallet-proxy/std", @@ -166,7 +146,6 @@ std = [ "pallet-society/std", "pallet-sudo/std", "pallet-staking/std", -# "pallet-staking-reward-fn/std", "pallet-timestamp/std", "pallet-tips/std", "pallet-treasury/std", @@ -188,14 +167,11 @@ std = [ "sp-session/std", "runtime-common/std", "runtime-parachains/std", -# "frame-try-runtime/std", -# "sp-npos-elections/std", "beefy-primitives/std", "rococo-runtime-constants/std", "xcm/std", "xcm-executor/std", "xcm-builder/std", -# "frame-election-provider-support/std", ] runtime-benchmarks = [ "runtime-common/runtime-benchmarks", @@ -210,8 +186,6 @@ runtime-benchmarks = [ "pallet-collective/runtime-benchmarks", "pallet-democracy/runtime-benchmarks", "pallet-elections-phragmen/runtime-benchmarks", -# "pallet-election-provider-multi-phase/runtime-benchmarks", -# "pallet-election-provider-support-benchmarking/runtime-benchmarks", "pallet-gilt/runtime-benchmarks", "pallet-grandpa/runtime-benchmarks", "pallet-identity/runtime-benchmarks", @@ -219,8 +193,6 @@ runtime-benchmarks = [ "pallet-indices/runtime-benchmarks", "pallet-membership/runtime-benchmarks", "pallet-multisig/runtime-benchmarks", -# "pallet-nomination-pools/runtime-benchmarks", -# "pallet-nomination-pools-benchmarking", "pallet-preimage/runtime-benchmarks", "pallet-proxy/runtime-benchmarks", "pallet-scheduler/runtime-benchmarks", @@ -232,31 +204,24 @@ runtime-benchmarks = [ "pallet-treasury/runtime-benchmarks", "pallet-utility/runtime-benchmarks", "pallet-vesting/runtime-benchmarks", -# "pallet-offences-benchmarking", -# "pallet-session-benchmarking", "pallet-xcm/runtime-benchmarks", "frame-system-benchmarking", "hex-literal", "xcm-builder/runtime-benchmarks", -# "frame-election-provider-support/runtime-benchmarks", -# "pallet-bags-list/runtime-benchmarks", "runtime-parachains/runtime-benchmarks", "pallet-xcm-benchmarks", ] try-runtime = [ "frame-executive/try-runtime", -# "frame-try-runtime", "frame-system/try-runtime", "pallet-authority-discovery/try-runtime", "pallet-authorship/try-runtime", "pallet-balances/try-runtime", -# "pallet-bags-list/try-runtime", "pallet-bounties/try-runtime", "pallet-child-bounties/try-runtime", "pallet-transaction-payment/try-runtime", "pallet-collective/try-runtime", "pallet-elections-phragmen/try-runtime", -# "pallet-election-provider-multi-phase/try-runtime", "pallet-democracy/try-runtime", "pallet-grandpa/try-runtime", "pallet-identity/try-runtime", @@ -264,7 +229,6 @@ try-runtime = [ "pallet-indices/try-runtime", "pallet-membership/try-runtime", "pallet-multisig/try-runtime", -# "pallet-nomination-pools/try-runtime", "pallet-offences/try-runtime", "pallet-preimage/try-runtime", "pallet-proxy/try-runtime", @@ -289,13 +253,6 @@ try-runtime = [ # in WASM. disable-runtime-api = [] -## A feature that should be enabled when the runtime should be build 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", -#] - # Set timing constants (e.g. session period) to faster versions to speed up testing. fast-runtime = [] diff --git a/runtime/rococo/src/lib.rs b/runtime/rococo/src/lib.rs index cb8e9a8e2569..f4928dd4e588 100644 --- a/runtime/rococo/src/lib.rs +++ b/runtime/rococo/src/lib.rs @@ -49,10 +49,7 @@ use beefy_primitives::{ crypto::AuthorityId as BeefyId, mmr::{BeefyDataProvider, MmrLeafVersion}, }; -// TODO: Election -// use frame_election_provider_support::{ -// generate_solution_type, onchain, NposSolution, SequentialPhragmen, -// }; + use frame_support::{ construct_runtime, parameter_types, traits::{ @@ -86,11 +83,6 @@ use static_assertions::const_assert; pub use frame_system::Call as SystemCall; pub use pallet_balances::Call as BalancesCall; -// TODO: Election -// pub use pallet_election_provider_multi_phase::Call as EPMCall; -// TODO: Staking -// #[cfg(feature = "std")] -// pub use pallet_staking::StakerStatus; /// Constant values used within the runtime. use rococo_runtime_constants::{currency::*, fee::*, time::*}; @@ -103,10 +95,6 @@ pub mod xcm_config; mod validator_manager; -// TODO: Rococo -// #[cfg(test)] -// mod tests; - impl_runtime_weights!(rococo_runtime_constants); // Make the WASM binary available. @@ -248,20 +236,12 @@ impl pallet_preimage::Config for Runtime { } parameter_types! { - // pub EpochDuration: u64 = prod_or_fast!( - // EPOCH_DURATION_IN_SLOTS as u64, - // 2 * MINUTES as u64, - // "ROC_EPOCH_DURATION" - // ); pub const ExpectedBlockTime: Moment = MILLISECS_PER_BLOCK; - // TODO: Staking - // pub ReportLongevity: u64 = - // BondingDuration::get() as u64 * SessionsPerEra::get() as u64 * EpochDuration::get(); pub ReportLongevity: u64 = EpochDurationInBlocks::get() as u64 * 10; } impl pallet_babe::Config for Runtime { - type EpochDuration = EpochDurationInBlocks; // TODO: Babe -> type EpochDuration = EpochDuration; + type EpochDuration = EpochDurationInBlocks; type ExpectedBlockTime = ExpectedBlockTime; // session module is the trigger @@ -353,7 +333,7 @@ impl pallet_authorship::Config for Runtime { type FindAuthor = pallet_session::FindAccountFromAuthorIndex; type UncleGenerations = UncleGenerations; type FilterUncle = (); - type EventHandler = ImOnline; // TODO: Staking -> type EventHandler = (Staking, ImOnline); + type EventHandler = ImOnline; } impl_opaque_keys! { @@ -379,16 +359,15 @@ impl sp_runtime::traits::Convert> for ValidatorIdOf impl pallet_session::Config for Runtime { type Event = Event; type ValidatorId = AccountId; - type ValidatorIdOf = ValidatorIdOf; // TODO: Staking -> pallet_staking::StashOf; + type ValidatorIdOf = ValidatorIdOf; type ShouldEndSession = Babe; type NextSessionRotation = Babe; - type SessionManager = pallet_session::historical::NoteHistoricalRoot; // TODO: Staking -> pallet_session::historical::NoteHistoricalRoot; + type SessionManager = pallet_session::historical::NoteHistoricalRoot; type SessionHandler = ::KeyTypeIdProviders; type Keys = SessionKeys; type WeightInfo = weights::pallet_session::WeightInfo; } -/// Special `FullIdentificationOf` implementation that is returning for every input `Some(Default::default())`. pub struct FullIdentificationOf; impl sp_runtime::traits::Convert> for FullIdentificationOf { fn convert(_: AccountId) -> Option<()> { @@ -397,239 +376,14 @@ impl sp_runtime::traits::Convert> for FullIdentificationOf } impl pallet_session::historical::Config for Runtime { - type FullIdentification = (); // TODO: Staking -> pallet_staking::Exposure; - type FullIdentificationOf = FullIdentificationOf; // TODO: Staking -> pallet_staking::ExposureOf; -} - -// TODO: Election -// parameter_types! { -// // phase durations. 1/4 of the last session for each. -// // in testing: 1min or half of the session for each -// pub SignedPhase: u32 = prod_or_fast!( -// EPOCH_DURATION_IN_SLOTS / 4, -// (1 * MINUTES).min(EpochDuration::get().saturated_into::() / 2), -// "ROC_SIGNED_PHASE" -// ); -// pub UnsignedPhase: u32 = prod_or_fast!( -// EPOCH_DURATION_IN_SLOTS / 4, -// (1 * MINUTES).min(EpochDuration::get().saturated_into::() / 2), -// "ROC_UNSIGNED_PHASE" -// ); - -// TODO: Election -// // signed config -// pub const SignedMaxSubmissions: u32 = 16; -// pub const SignedMaxRefunds: u32 = 16 / 4; -// pub const SignedDepositBase: Balance = deposit(2, 0); -// pub const SignedDepositByte: Balance = deposit(0, 10) / 1024; -// // Each good submission will get 1/10 ROC as reward -// pub SignedRewardBase: Balance = UNITS / 10; -// pub BetterUnsignedThreshold: Perbill = Perbill::from_rational(5u32, 10_000); - -// // 1 hour session, 15 minutes unsigned phase, 8 offchain executions. -// pub OffchainRepeat: BlockNumber = UnsignedPhase::get() / 8; - -// /// We take the top 12500 nominators as electing voters.. -// pub const MaxElectingVoters: u32 = 12_500; -// /// ... and all of the validators as electable targets. Whilst this is the case, we cannot and -// /// shall not increase the size of the validator intentions. -// pub const MaxElectableTargets: u16 = u16::MAX; -// pub NposSolutionPriority: TransactionPriority = -// Perbill::from_percent(90) * TransactionPriority::max_value(); -// } - -// TODO: Election -// generate_solution_type!( -// #[compact] -// pub struct NposCompactSolution24::< -// VoterIndex = u32, -// TargetIndex = u16, -// Accuracy = sp_runtime::PerU16, -// MaxVoters = MaxElectingVoters, -// >(24) -// ); - -// TODO: Election -// pub struct OnChainSeqPhragmen; -// impl onchain::Config for OnChainSeqPhragmen { -// type System = Runtime; -// type Solver = SequentialPhragmen; -// type DataProvider = Staking; -// type WeightInfo = weights::frame_election_provider_support::WeightInfo; -// } - -// TODO: Election -// impl pallet_election_provider_multi_phase::Config for Runtime { -// type Event = Event; -// type Currency = Balances; -// type EstimateCallFee = TransactionPayment; -// type UnsignedPhase = UnsignedPhase; -// type SignedMaxSubmissions = SignedMaxSubmissions; -// type SignedMaxRefunds = SignedMaxRefunds; -// type SignedRewardBase = SignedRewardBase; -// type SignedDepositBase = SignedDepositBase; -// type SignedDepositByte = SignedDepositByte; -// type SignedDepositWeight = (); -// type SignedMaxWeight = -// ::MaxWeight; -// type MinerConfig = Self; -// type SlashHandler = (); // burn slashes -// type RewardHandler = (); // nothing to do upon rewards -// type SignedPhase = SignedPhase; -// type BetterUnsignedThreshold = BetterUnsignedThreshold; -// type BetterSignedThreshold = (); -// type OffchainRepeat = OffchainRepeat; -// type MinerTxPriority = NposSolutionPriority; -// type DataProvider = Staking; -// type Fallback = pallet_election_provider_multi_phase::NoFallback; -// type GovernanceFallback = onchain::UnboundedExecution; -// type Solver = SequentialPhragmen< -// AccountId, -// pallet_election_provider_multi_phase::SolutionAccuracyOf, -// (), -// >; -// type BenchmarkingConfig = runtime_common::elections::BenchmarkConfig; -// type ForceOrigin = EitherOfDiverse< -// EnsureRoot, -// pallet_collective::EnsureProportionAtLeast, -// >; -// type WeightInfo = weights::pallet_election_provider_multi_phase::WeightInfo; -// type MaxElectingVoters = MaxElectingVoters; -// type MaxElectableTargets = MaxElectableTargets; -// } - -// TODO: Bags List -// parameter_types! { -// pub const BagThresholds: &'static [u64] = &bag_thresholds::THRESHOLDS; -// } - -// TODO: Bags List -// impl pallet_bags_list::Config for Runtime { -// type Event = Event; -// type ScoreProvider = Staking; -// type WeightInfo = weights::pallet_bags_list::WeightInfo; -// type BagThresholds = BagThresholds; -// type Score = sp_npos_elections::VoteWeight; -// } - -// TODO: Staking -// fn era_payout( -// total_staked: Balance, -// non_gilt_issuance: Balance, -// max_annual_inflation: Perquintill, -// period_fraction: Perquintill, -// auctioned_slots: u64, -// ) -> (Balance, Balance) { -// use pallet_staking_reward_fn::compute_inflation; -// use sp_arithmetic::traits::Saturating; - -// let min_annual_inflation = Perquintill::from_rational(25u64, 1000u64); -// let delta_annual_inflation = max_annual_inflation.saturating_sub(min_annual_inflation); - -// // 30% reserved for up to 60 slots. -// let auction_proportion = Perquintill::from_rational(auctioned_slots.min(60), 200u64); - -// // Therefore the ideal amount at stake (as a percentage of total issuance) is 75% less the amount that we expect -// // to be taken up with auctions. -// let ideal_stake = Perquintill::from_percent(75).saturating_sub(auction_proportion); - -// let stake = Perquintill::from_rational(total_staked, non_gilt_issuance); -// let falloff = Perquintill::from_percent(5); -// let adjustment = compute_inflation(stake, ideal_stake, falloff); -// let staking_inflation = -// min_annual_inflation.saturating_add(delta_annual_inflation * adjustment); - -// let max_payout = period_fraction * max_annual_inflation * non_gilt_issuance; -// let staking_payout = (period_fraction * staking_inflation) * non_gilt_issuance; -// let rest = max_payout.saturating_sub(staking_payout); - -// let other_issuance = non_gilt_issuance.saturating_sub(total_staked); -// if total_staked > other_issuance { -// let _cap_rest = Perquintill::from_rational(other_issuance, total_staked) * staking_payout; -// // We don't do anything with this, but if we wanted to, we could introduce a cap on the treasury amount -// // with: `rest = rest.min(cap_rest);` -// } -// (staking_payout, rest) -// } - -// TODO: Staking -// pub struct EraPayout; -// impl pallet_staking::EraPayout for EraPayout { -// fn era_payout( -// total_staked: Balance, -// _total_issuance: Balance, -// era_duration_millis: u64, -// ) -> (Balance, Balance) { -// // TODO: #3011 Update with proper auctioned slots tracking. -// // This should be fine for the first year of parachains. -// let auctioned_slots: u64 = auctions::Pallet::::auction_counter().into(); -// const MAX_ANNUAL_INFLATION: Perquintill = Perquintill::from_percent(10); -// const MILLISECONDS_PER_YEAR: u64 = 1000 * 3600 * 24 * 36525 / 100; - -// era_payout( -// total_staked, -// Gilt::issuance().non_gilt, -// MAX_ANNUAL_INFLATION, -// Perquintill::from_rational(era_duration_millis, MILLISECONDS_PER_YEAR), -// auctioned_slots, -// ) -// } -// } - -// TODO: Staking -> remove when staking added + type FullIdentification = (); + type FullIdentificationOf = FullIdentificationOf; +} + parameter_types! { pub const SessionsPerEra: SessionIndex = 6; pub const BondingDuration: sp_staking::EraIndex = 28; } -// TODO: Staking -// parameter_types! { -// // Six sessions in an era (6 hours). -// pub const SessionsPerEra: SessionIndex = 6; -// // 28 eras for unbonding (7 days). -// pub const BondingDuration: sp_staking::EraIndex = 28; -// // 27 eras in which slashes can be cancelled (slightly less than 7 days). -// pub const SlashDeferDuration: sp_staking::EraIndex = 27; -// pub const MaxNominatorRewardedPerValidator: u32 = 256; -// pub const OffendingValidatorsThreshold: Perbill = Perbill::from_percent(17); -// // 24 -// pub const MaxNominations: u32 = ::LIMIT as u32; -// } - -// TODO: Staking -// type SlashCancelOrigin = EitherOfDiverse< -// EnsureRoot, -// pallet_collective::EnsureProportionAtLeast, -// >; - -// TODO: Staking -// impl pallet_staking::Config for Runtime { -// type MaxNominations = MaxNominations; -// type Currency = Balances; -// type CurrencyBalance = Balance; -// type UnixTime = Timestamp; -// type CurrencyToVote = CurrencyToVote; -// type ElectionProvider = ElectionProviderMultiPhase; -// type GenesisElectionProvider = onchain::UnboundedExecution; -// type RewardRemainder = Treasury; -// type Event = Event; -// type Slash = Treasury; -// type Reward = (); -// type SessionsPerEra = SessionsPerEra; -// type BondingDuration = BondingDuration; -// type SlashDeferDuration = SlashDeferDuration; -// // A majority of the council or root can cancel the slash. -// type SlashCancelOrigin = SlashCancelOrigin; -// type SessionInterface = Self; -// type EraPayout = EraPayout; -// type NextNewSession = Session; -// type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator; -// type OffendingValidatorsThreshold = OffendingValidatorsThreshold; -// type VoterList = VoterList; -// type MaxUnlockingChunks = frame_support::traits::ConstU32<32>; -// type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig; -// type OnStakerSlash = NominationPools; -// type WeightInfo = weights::pallet_staking::WeightInfo; -// } parameter_types! { pub LaunchPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1, "ROC_LAUNCH_PERIOD"); @@ -879,7 +633,7 @@ impl pallet_tips::Config for Runtime { impl pallet_offences::Config for Runtime { type Event = Event; type IdentificationTuple = pallet_session::historical::IdentificationTuple; - type OnOffenceHandler = (); // TODO: Offences -> type OnOffenceHandler = Staking; + type OnOffenceHandler = (); } impl pallet_authority_discovery::Config for Runtime { @@ -1142,7 +896,6 @@ pub enum ProxyType { Any, NonTransfer, Governance, - // TODO: Proxy & TODO: Staking -> Staking, IdentityJudgement, CancelProxy, Auction, @@ -1168,8 +921,6 @@ impl InstanceFilter for ProxyType { // Specifically omitting Indices `transfer`, `force_transfer` // Specifically omitting the entire Balances pallet Call::Authorship(..) | - // TODO: Staking - // Call::Staking(..) | Call::Session(..) | Call::Grandpa(..) | Call::ImOnline(..) | @@ -1207,8 +958,6 @@ impl InstanceFilter for ProxyType { Call::Crowdloan(..) | Call::Slots(..) | Call::Auctions(..) // Specifically omitting the entire XCM Pallet - // TODO: Proxy & TODO: Bags List - // Call::VoterList(..) ), ProxyType::Governance => matches!( c, @@ -1219,10 +968,6 @@ impl InstanceFilter for ProxyType { Call::Tips(..) | Call::Utility(..) | Call::ChildBounties(..) ), - // TODO: Proxy & TODO: Staking - // ProxyType::Staking => { - // matches!(c, Call::Staking(..) | Call::Session(..) | Call::Utility(..)) - // }, ProxyType::IdentityJudgement => matches!( c, Call::Identity(pallet_identity::Call::provide_judgement { .. }) | Call::Utility(..) @@ -1288,8 +1033,6 @@ impl runtime_parachains::inclusion::RewardValidators for RewardValidators { impl parachains_inclusion::Config for Runtime { type Event = Event; type DisputesHandler = ParasDisputes; - // TODO: Inclusion - // type RewardValidators = parachains_reward_points::RewardValidatorsWithEraPoints; type RewardValidators = RewardValidators; } @@ -1447,43 +1190,6 @@ impl pallet_gilt::Config for Runtime { type WeightInfo = weights::pallet_gilt::WeightInfo; } -// TODO: Nominations -// pub struct BalanceToU256; -// impl sp_runtime::traits::Convert for BalanceToU256 { -// fn convert(n: Balance) -> sp_core::U256 { -// n.into() -// } -// } -// pub struct U256ToBalance; -// impl sp_runtime::traits::Convert for U256ToBalance { -// fn convert(n: sp_core::U256) -> Balance { -// use frame_support::traits::Defensive; -// n.try_into().defensive_unwrap_or(Balance::MAX) -// } -// } - -// TODO: Nominations -// parameter_types! { -// pub const PoolsPalletId: PalletId = PalletId(*b"py/nopls"); -// pub const MinPointsToBalance: u32 = 10; -// } - -// TODO: Nominations -// impl pallet_nomination_pools::Config for Runtime { -// type Event = Event; -// type WeightInfo = weights::pallet_nomination_pools::WeightInfo; -// type Currency = Balances; -// type BalanceToU256 = BalanceToU256; -// type U256ToBalance = U256ToBalance; -// type StakingInterface = Staking; -// type PostUnbondingPoolsWindow = ConstU32<4>; -// type MaxMetadataLen = ConstU32<256>; -// // we use the same number of allowed unlocking chunks as with staking. -// type MaxUnbonding = ::MaxUnlockingChunks; -// type PalletId = PoolsPalletId; -// type MinPointsToBalance = MinPointsToBalance; -// } - impl pallet_beefy::Config for Runtime { type BeefyId = BeefyId; type MaxAuthorities = MaxAuthorities; @@ -1603,10 +1309,8 @@ construct_runtime! { // Consensus support. // Authorship must be before session in order to note author in the correct session and era - // for im-online. // TODO -> Staking -> and staking. + // for im-online. Authorship: pallet_authorship::{Pallet, Call, Storage} = 5, - // TODO: Staking - // Staking: pallet_staking::{Pallet, Call, Storage, Config, Event} = 6, Offences: pallet_offences::{Pallet, Storage, Event} = 7, Session: pallet_session::{Pallet, Call, Storage, Event, Config} = 8, Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event, ValidateUnsigned} = 10, @@ -1664,21 +1368,9 @@ construct_runtime! { // Tips module. Tips: pallet_tips::{Pallet, Call, Storage, Event} = 36, - // TODO: Election - //// Election pallet. Only works with staking, but placed here to maintain indices. - // ElectionProviderMultiPhase: pallet_election_provider_multi_phase::{Pallet, Call, Storage, Event, ValidateUnsigned} = 37, - // Gilts pallet. Gilt: pallet_gilt::{Pallet, Call, Storage, Event, Config} = 38, - // TODO: Bags List - //// Provides a semi-sorted list of nominators for staking. - // VoterList: pallet_bags_list::{Pallet, Call, Storage, Event} = 39, - - // TODO: Nomination - //// nomination pools: extension to staking. - // NominationPools: pallet_nomination_pools::{Pallet, Call, Storage, Event, Config} = 41, - // Parachains pallets. Start indices at 50 to leave room. ParachainsOrigin: parachains_origin::{Pallet, Origin} = 50, Configuration: parachains_configuration::{Pallet, Call, Storage, Config} = 51, @@ -1780,8 +1472,6 @@ mod benches { [runtime_parachains::ump, Ump] // Substrate [pallet_balances, Balances] - // TODO: Bags List - // [pallet_bags_list, VoterList] [frame_benchmarking::baseline, Baseline::] [pallet_bounties, Bounties] [pallet_child_bounties, ChildBounties] @@ -1789,27 +1479,16 @@ mod benches { [pallet_collective, TechnicalCommittee] [pallet_democracy, Democracy] [pallet_elections_phragmen, PhragmenElection] - // TODO: Election - // [pallet_election_provider_multi_phase, ElectionProviderMultiPhase] - // [frame_election_provider_support, ElectionProviderBench::] [pallet_gilt, Gilt] [pallet_identity, Identity] [pallet_im_online, ImOnline] [pallet_indices, Indices] [pallet_membership, TechnicalMembership] [pallet_multisig, Multisig] - // TODO: Nomination - // [pallet_nomination_pools, NominationPoolsBench::] - // TODO: Offences - // [pallet_offences, OffencesBench::] [pallet_preimage, Preimage] [pallet_proxy, Proxy] [pallet_recovery, Recovery] [pallet_scheduler, Scheduler] - // TODO: Session - // [pallet_session, SessionBench::] - // TODO: Staking - // [pallet_staking, Staking] [frame_system, SystemBench::] [pallet_timestamp, Timestamp] [pallet_tips, Tips] @@ -2100,7 +1779,7 @@ sp_api::impl_runtime_apis! { // babe_primitives::BabeGenesisConfiguration { slot_duration: Babe::slot_duration(), - epoch_length: EpochDurationInBlocks::get().into(), // TODO: Babe -> epoch_length: EpochDuration::get().into() + epoch_length: EpochDurationInBlocks::get().into(), c: BABE_GENESIS_EPOCH_CONFIG.c, genesis_authorities: Babe::authorities().to_vec(), randomness: Babe::randomness(), @@ -2199,15 +1878,7 @@ sp_api::impl_runtime_apis! { use frame_benchmarking::{Benchmarking, BenchmarkList}; use frame_support::traits::StorageInfoTrait; - // TODO: Session (added) - // use pallet_session_benchmarking::Pallet as SessionBench; - // TODO: Offences - // use pallet_offences_benchmarking::Pallet as OffencesBench; - // TODO: Election - // use pallet_election_provider_support_benchmarking::Pallet as ElectionProviderBench; use frame_system_benchmarking::Pallet as SystemBench; - // TODO: Nomination - //use pallet_nomination_pools_benchmarking::Pallet as NominationPoolsBench; use frame_benchmarking::baseline::Pallet as Baseline; let mut list = Vec::::new(); @@ -2224,32 +1895,13 @@ sp_api::impl_runtime_apis! { sp_runtime::RuntimeString, > { use frame_benchmarking::{Benchmarking, BenchmarkBatch, TrackedStorageKey, BenchmarkError}; - // Trying to add benchmarks directly to some pallets caused cyclic dependency issues. - // To get around that, we separated the benchmarks into its own crate. - // TODO: Session (added) - // use pallet_session_benchmarking::Pallet as SessionBench; - // TODO: Offences - // use pallet_offences_benchmarking::Pallet as OffencesBench; - // TODO: Election - // use pallet_election_provider_support_benchmarking::Pallet as ElectionProviderBench; use frame_system_benchmarking::Pallet as SystemBench; - // TODO: Nomination - // use pallet_nomination_pools_benchmarking::Pallet as NominationPoolsBench; use frame_benchmarking::baseline::Pallet as Baseline; use xcm::latest::prelude::*; use xcm_config::{CheckAccount, RocLocation, SovereignAccountOf, Statemine, XcmConfig}; - // TODO: Session (added) - // impl pallet_session_benchmarking::Config for Runtime {} - // TODO: Offences - // impl pallet_offences_benchmarking::Config for Runtime {} - // TODO: Election Provider - // impl pallet_election_provider_support_benchmarking::Config for Runtime {} impl frame_system_benchmarking::Config for Runtime {} impl frame_benchmarking::baseline::Config for Runtime {} - // TODO: Nomination - // impl pallet_nomination_pools_benchmarking::Config for Runtime {} - impl pallet_xcm_benchmarks::Config for Runtime { type XcmConfig = XcmConfig; type AccountIdConverter = SovereignAccountOf; @@ -2327,12 +1979,6 @@ sp_api::impl_runtime_apis! { hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(), // Treasury Account hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da95ecffd7b6c0f78751baa9d281e0bfa3a6d6f646c70792f74727372790000000000000000000000000000000000000000").to_vec().into(), - // TODO: Rococo - //// Configuration ActiveConfig - //hex_literal::hex!("06de3d8a54d27e44a9d5ce189618f22db4b49d95320d9021994c850f25b8e385").to_vec().into(), - // TODO: Rococo - //// The transactional storage limit. - // hex_literal::hex!("3a7472616e73616374696f6e5f6c6576656c3a").to_vec().into(), ]; let mut batches = Vec::::new(); @@ -2344,18 +1990,3 @@ sp_api::impl_runtime_apis! { } } } - -// TODO: Rococo -// #[cfg(test)] -// mod tests_fess { -// use super::*; -// use sp_runtime::assert_eq_error_rate; - -// #[test] -// fn signed_deposit_is_sensible() { -// // ensure this number does not change, or that it is checked after each change. -// // a 1 MB solution should need around 0.16 ROC deposit -// let deposit = SignedDepositBase::get() + (SignedDepositByte::get() * 1024 * 1024); -// assert_eq_error_rate!(deposit, UNITS * 16 / 100, UNITS / 100); -// } -// } diff --git a/runtime/rococo/src/xcm_config.rs b/runtime/rococo/src/xcm_config.rs index 1f537a57a1dc..ccf6b7a29b19 100644 --- a/runtime/rococo/src/xcm_config.rs +++ b/runtime/rococo/src/xcm_config.rs @@ -189,7 +189,7 @@ pub type LocalOriginToLocation = ( ); impl pallet_xcm::Config for Runtime { type Event = Event; - type SendXcmOrigin = xcm_builder::EnsureXcmOrigin; // TODO: XCM + type SendXcmOrigin = xcm_builder::EnsureXcmOrigin; type XcmRouter = XcmRouter; // Anyone can execute XCM messages locally. type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin; From 6688c34d978751b79e4aad02ee1eee2ec72f2ea5 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Fri, 12 Aug 2022 14:30:13 +0200 Subject: [PATCH 33/35] nit fix --- runtime/kusama/src/lib.rs | 14 ++------------ runtime/rococo/src/lib.rs | 8 ++------ 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index 232b4c2afcca..7b4c129b2194 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -84,7 +84,6 @@ pub use pallet_balances::Call as BalancesCall; pub use pallet_election_provider_multi_phase::Call as EPMCall; #[cfg(feature = "std")] pub use pallet_staking::StakerStatus; -// pub use pallet_timestamp::Call as TimestampCall; #[cfg(any(feature = "std", test))] pub use sp_runtime::BuildStorage; @@ -350,11 +349,6 @@ impl pallet_authorship::Config for Runtime { type EventHandler = (Staking, ImOnline); } -// parameter_types! { -// pub const Period: BlockNumber = 10 * MINUTES; -// pub const Offset: BlockNumber = 0; -// } - impl_opaque_keys! { pub struct SessionKeys { pub grandpa: Grandpa, @@ -1473,6 +1467,7 @@ construct_runtime! { Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 2, Indices: pallet_indices::{Pallet, Call, Storage, Config, Event} = 3, Balances: pallet_balances::{Pallet, Call, Storage, Config, Event} = 4, + TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Event} = 33, // Consensus support. // Authorship must be before session in order to note author in the correct session and era @@ -1480,6 +1475,7 @@ construct_runtime! { Authorship: pallet_authorship::{Pallet, Call, Storage} = 5, Staking: pallet_staking::{Pallet, Call, Storage, Config, Event} = 6, Offences: pallet_offences::{Pallet, Storage, Event} = 7, + Historical: session_historical::{Pallet} = 34, Session: pallet_session::{Pallet, Call, Storage, Event, Config} = 8, Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event, ValidateUnsigned} = 10, ImOnline: pallet_im_online::{Pallet, Call, Storage, Event, ValidateUnsigned, Config} = 11, @@ -1523,12 +1519,6 @@ construct_runtime! { // Preimage registrar. Preimage: pallet_preimage::{Pallet, Call, Storage, Event} = 32, - // Trasaction Payment module - TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Event} = 33, - - // Historical module - Historical: session_historical::{Pallet} = 34, - // Bounties modules. Bounties: pallet_bounties::{Pallet, Call, Storage, Event} = 35, ChildBounties: pallet_child_bounties = 40, diff --git a/runtime/rococo/src/lib.rs b/runtime/rococo/src/lib.rs index f4928dd4e588..28c1b58d780f 100644 --- a/runtime/rococo/src/lib.rs +++ b/runtime/rococo/src/lib.rs @@ -1306,12 +1306,14 @@ construct_runtime! { Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 2, Indices: pallet_indices::{Pallet, Call, Storage, Config, Event} = 3, Balances: pallet_balances::{Pallet, Call, Storage, Config, Event} = 4, + TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Event} = 33, // Consensus support. // Authorship must be before session in order to note author in the correct session and era // for im-online. Authorship: pallet_authorship::{Pallet, Call, Storage} = 5, Offences: pallet_offences::{Pallet, Storage, Event} = 7, + Historical: session_historical::{Pallet} = 34, Session: pallet_session::{Pallet, Call, Storage, Event, Config} = 8, Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event, ValidateUnsigned} = 10, ImOnline: pallet_im_online::{Pallet, Call, Storage, Event, ValidateUnsigned, Config} = 11, @@ -1355,12 +1357,6 @@ construct_runtime! { // Preimage registrar. Preimage: pallet_preimage::{Pallet, Call, Storage, Event} = 32, - // Trasaction Payment module - TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Event} = 33, - - // Historical module - Historical: session_historical::{Pallet} = 34, - // Bounties modules. Bounties: pallet_bounties::{Pallet, Call, Storage, Event} = 35, ChildBounties: pallet_child_bounties = 40, From 07e6aa9c655a43e912b1bb8f4ae4ab86e46f0ab0 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Wed, 7 Sep 2022 13:03:16 +0200 Subject: [PATCH 34/35] weights 1.5 --- runtime/kusama/src/lib.rs | 5 + runtime/rococo/src/lib.rs | 4 + runtime/rococo/src/weights/pallet_bounties.rs | 82 ++++--- .../src/weights/pallet_child_bounties.rs | 55 +++-- .../src/weights/pallet_collective_council.rs | 104 ++++---- .../pallet_collective_technical_committee.rs | 104 ++++---- .../rococo/src/weights/pallet_democracy.rs | 231 ++++++++++-------- .../src/weights/pallet_elections_phragmen.rs | 133 +++++----- runtime/rococo/src/weights/pallet_gilt.rs | 70 +++--- runtime/rococo/src/weights/pallet_identity.rs | 210 +++++++++------- runtime/rococo/src/weights/pallet_preimage.rs | 85 +++---- runtime/rococo/src/weights/pallet_recovery.rs | 120 --------- .../rococo/src/weights/pallet_scheduler.rs | 182 +++++++------- runtime/rococo/src/weights/pallet_tips.rs | 66 ++--- runtime/rococo/src/weights/pallet_treasury.rs | 48 ++-- runtime/rococo/src/weights/pallet_vesting.rs | 112 +++++---- .../src/weights/runtime_common_claims.rs | 34 +-- runtime/rococo/src/weights/xcm/mod.rs | 126 +++++----- .../xcm/pallet_xcm_benchmarks_fungible.rs | 44 ++-- .../xcm/pallet_xcm_benchmarks_generic.rs | 56 ++--- runtime/rococo/src/xcm_config.rs | 8 +- 21 files changed, 934 insertions(+), 945 deletions(-) delete mode 100644 runtime/rococo/src/weights/pallet_recovery.rs diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index 154f58d70474..5461bee0ee2f 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -150,6 +150,11 @@ impl Contains for BaseFilter { } } +type MoreThanHalfCouncil = EitherOfDiverse< + EnsureRoot, + pallet_collective::EnsureProportionMoreThan, +>; + parameter_types! { pub const Version: RuntimeVersion = VERSION; pub const SS58Prefix: u8 = 2; diff --git a/runtime/rococo/src/lib.rs b/runtime/rococo/src/lib.rs index 9a25c6daa82c..01ad5617a8fb 100644 --- a/runtime/rococo/src/lib.rs +++ b/runtime/rococo/src/lib.rs @@ -478,6 +478,8 @@ parameter_types! { pub TermDuration: BlockNumber = prod_or_fast!(24 * HOURS, 2 * MINUTES, "ROC_TERM_DURATION"); pub const DesiredMembers: u32 = 19; pub const DesiredRunnersUp: u32 = 19; + pub const MaxVoters: u32 = 10 * 1000; + pub const MaxCandidates: u32 = 1000; pub const PhragmenElectionPalletId: LockIdentifier = *b"phrelect"; } @@ -498,6 +500,8 @@ impl pallet_elections_phragmen::Config for Runtime { type DesiredMembers = DesiredMembers; type DesiredRunnersUp = DesiredRunnersUp; type TermDuration = TermDuration; + type MaxVoters = MaxVoters; + type MaxCandidates = MaxCandidates; type PalletId = PhragmenElectionPalletId; type WeightInfo = weights::pallet_elections_phragmen::WeightInfo; } diff --git a/runtime/rococo/src/weights/pallet_bounties.rs b/runtime/rococo/src/weights/pallet_bounties.rs index 0157e1dea5dc..b8d21b4291ab 100644 --- a/runtime/rococo/src/weights/pallet_bounties.rs +++ b/runtime/rococo/src/weights/pallet_bounties.rs @@ -16,7 +16,8 @@ //! Autogenerated weights for `pallet_bounties` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-05-11, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2022-08-19, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 // Executed Command: @@ -30,7 +31,6 @@ // --extrinsic=* // --execution=wasm // --wasm-execution=compiled -// --heap-pages=4096 // --header=./file_header.txt // --output=./runtime/rococo/src/weights/pallet_bounties.rs @@ -48,90 +48,92 @@ impl pallet_bounties::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) // Storage: Bounties BountyDescriptions (r:0 w:1) // Storage: Bounties Bounties (r:0 w:1) + /// The range of component `d` is `[0, 16384]`. fn propose_bounty(d: u32, ) -> Weight { - (23_871_000 as Weight) + Weight::from_ref_time(26_654_000 as u64) // Standard Error: 0 - .saturating_add((1_000 as Weight).saturating_mul(d as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(4 as Weight)) + .saturating_add(Weight::from_ref_time(1_000 as u64).saturating_mul(d as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(4 as u64)) } // Storage: Bounties Bounties (r:1 w:1) // Storage: Bounties BountyApprovals (r:1 w:1) fn approve_bounty() -> Weight { - (6_968_000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(9_776_000 as u64) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Bounties Bounties (r:1 w:1) fn propose_curator() -> Weight { - (4_724_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(8_350_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Bounties Bounties (r:1 w:1) // Storage: System Account (r:1 w:1) fn unassign_curator() -> Weight { - (31_342_000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(34_804_000 as u64) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Bounties Bounties (r:1 w:1) // Storage: System Account (r:1 w:1) fn accept_curator() -> Weight { - (18_849_000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(23_414_000 as u64) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Bounties Bounties (r:1 w:1) // Storage: ChildBounties ParentChildBounties (r:1 w:0) fn award_bounty() -> Weight { - (16_324_000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(20_148_000 as u64) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Bounties Bounties (r:1 w:1) // Storage: System Account (r:3 w:3) // Storage: ChildBounties ChildrenCuratorFees (r:1 w:1) // Storage: Bounties BountyDescriptions (r:0 w:1) fn claim_bounty() -> Weight { - (58_803_000 as Weight) - .saturating_add(T::DbWeight::get().reads(5 as Weight)) - .saturating_add(T::DbWeight::get().writes(6 as Weight)) + Weight::from_ref_time(64_115_000 as u64) + .saturating_add(T::DbWeight::get().reads(5 as u64)) + .saturating_add(T::DbWeight::get().writes(6 as u64)) } // Storage: Bounties Bounties (r:1 w:1) // Storage: ChildBounties ParentChildBounties (r:1 w:0) // Storage: System Account (r:1 w:1) // Storage: Bounties BountyDescriptions (r:0 w:1) fn close_bounty_proposed() -> Weight { - (35_730_000 as Weight) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) + Weight::from_ref_time(39_628_000 as u64) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) } // Storage: Bounties Bounties (r:1 w:1) // Storage: ChildBounties ParentChildBounties (r:1 w:0) // Storage: System Account (r:2 w:2) // Storage: Bounties BountyDescriptions (r:0 w:1) fn close_bounty_active() -> Weight { - (42_922_000 as Weight) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().writes(4 as Weight)) + Weight::from_ref_time(47_429_000 as u64) + .saturating_add(T::DbWeight::get().reads(4 as u64)) + .saturating_add(T::DbWeight::get().writes(4 as u64)) } // Storage: Bounties Bounties (r:1 w:1) fn extend_bounty_expiry() -> Weight { - (13_378_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(17_322_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Bounties BountyApprovals (r:1 w:1) // Storage: Bounties Bounties (r:1 w:1) // Storage: System Account (r:2 w:2) + /// The range of component `b` is `[1, 100]`. fn spend_funds(b: u32, ) -> Weight { - (0 as Weight) - // Standard Error: 16_000 - .saturating_add((30_225_000 as Weight).saturating_mul(b as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(b as Weight))) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(b as Weight))) + Weight::from_ref_time(0 as u64) + // Standard Error: 30_000 + .saturating_add(Weight::from_ref_time(30_775_000 as u64).saturating_mul(b as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().reads((3 as u64).saturating_mul(b as u64))) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + .saturating_add(T::DbWeight::get().writes((3 as u64).saturating_mul(b as u64))) } } diff --git a/runtime/rococo/src/weights/pallet_child_bounties.rs b/runtime/rococo/src/weights/pallet_child_bounties.rs index a49fce7a4047..dd6dc2b1fd2b 100644 --- a/runtime/rococo/src/weights/pallet_child_bounties.rs +++ b/runtime/rococo/src/weights/pallet_child_bounties.rs @@ -16,7 +16,8 @@ //! Autogenerated weights for `pallet_child_bounties` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-05-11, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2022-08-19, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 // Executed Command: @@ -30,7 +31,6 @@ // --extrinsic=* // --execution=wasm // --wasm-execution=compiled -// --heap-pages=4096 // --header=./file_header.txt // --output=./runtime/rococo/src/weights/pallet_child_bounties.rs @@ -50,52 +50,53 @@ impl pallet_child_bounties::WeightInfo for WeightInfo Weight { - (44_398_000 as Weight) + Weight::from_ref_time(48_890_000 as u64) // Standard Error: 0 - .saturating_add((1_000 as Weight).saturating_mul(d as Weight)) - .saturating_add(T::DbWeight::get().reads(5 as Weight)) - .saturating_add(T::DbWeight::get().writes(6 as Weight)) + .saturating_add(Weight::from_ref_time(1_000 as u64).saturating_mul(d as u64)) + .saturating_add(T::DbWeight::get().reads(5 as u64)) + .saturating_add(T::DbWeight::get().writes(6 as u64)) } // Storage: Bounties Bounties (r:1 w:0) // Storage: ChildBounties ChildBounties (r:1 w:1) // Storage: ChildBounties ChildrenCuratorFees (r:1 w:1) fn propose_curator() -> Weight { - (11_084_000 as Weight) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(14_114_000 as u64) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Bounties Bounties (r:1 w:0) // Storage: ChildBounties ChildBounties (r:1 w:1) // Storage: System Account (r:1 w:1) fn accept_curator() -> Weight { - (22_833_000 as Weight) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(26_807_000 as u64) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: ChildBounties ChildBounties (r:1 w:1) // Storage: Bounties Bounties (r:1 w:0) // Storage: System Account (r:1 w:1) fn unassign_curator() -> Weight { - (35_316_000 as Weight) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(39_640_000 as u64) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Bounties Bounties (r:1 w:0) // Storage: ChildBounties ChildBounties (r:1 w:1) fn award_child_bounty() -> Weight { - (17_734_000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(21_445_000 as u64) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: ChildBounties ChildBounties (r:1 w:1) // Storage: System Account (r:3 w:3) // Storage: ChildBounties ParentChildBounties (r:1 w:1) // Storage: ChildBounties ChildBountyDescriptions (r:0 w:1) fn claim_child_bounty() -> Weight { - (61_853_000 as Weight) - .saturating_add(T::DbWeight::get().reads(5 as Weight)) - .saturating_add(T::DbWeight::get().writes(6 as Weight)) + Weight::from_ref_time(65_771_000 as u64) + .saturating_add(T::DbWeight::get().reads(5 as u64)) + .saturating_add(T::DbWeight::get().writes(6 as u64)) } // Storage: Bounties Bounties (r:1 w:0) // Storage: ChildBounties ChildBounties (r:1 w:1) @@ -104,9 +105,9 @@ impl pallet_child_bounties::WeightInfo for WeightInfo Weight { - (42_697_000 as Weight) - .saturating_add(T::DbWeight::get().reads(6 as Weight)) - .saturating_add(T::DbWeight::get().writes(6 as Weight)) + Weight::from_ref_time(46_230_000 as u64) + .saturating_add(T::DbWeight::get().reads(6 as u64)) + .saturating_add(T::DbWeight::get().writes(6 as u64)) } // Storage: Bounties Bounties (r:1 w:0) // Storage: ChildBounties ChildBounties (r:1 w:1) @@ -115,8 +116,8 @@ impl pallet_child_bounties::WeightInfo for WeightInfo Weight { - (51_585_000 as Weight) - .saturating_add(T::DbWeight::get().reads(7 as Weight)) - .saturating_add(T::DbWeight::get().writes(7 as Weight)) + Weight::from_ref_time(56_148_000 as u64) + .saturating_add(T::DbWeight::get().reads(7 as u64)) + .saturating_add(T::DbWeight::get().writes(7 as u64)) } } diff --git a/runtime/rococo/src/weights/pallet_collective_council.rs b/runtime/rococo/src/weights/pallet_collective_council.rs index 0e2ea3587e7f..f50dce94e01f 100644 --- a/runtime/rococo/src/weights/pallet_collective_council.rs +++ b/runtime/rococo/src/weights/pallet_collective_council.rs @@ -49,36 +49,36 @@ impl pallet_collective::WeightInfo for WeightInfo { // Storage: Instance1Collective Voting (r:100 w:100) // Storage: Instance1Collective Prime (r:0 w:1) fn set_members(m: u32, n: u32, p: u32, ) -> Weight { - (0 as Weight) + Weight::from_ref_time(0 as u64) // Standard Error: 6_000 - .saturating_add((14_448_000 as Weight).saturating_mul(m as Weight)) + .saturating_add(Weight::from_ref_time(14_448_000 as u64).saturating_mul(m as u64)) // Standard Error: 6_000 - .saturating_add((85_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(Weight::from_ref_time(85_000 as u64).saturating_mul(n as u64)) // Standard Error: 6_000 - .saturating_add((19_620_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(p as Weight))) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(p as Weight))) + .saturating_add(Weight::from_ref_time(19_620_000 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(p as u64))) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(p as u64))) } // Storage: Instance1Collective Members (r:1 w:0) fn execute(b: u32, m: u32, ) -> Weight { - (22_536_000 as Weight) + Weight::from_ref_time(22_536_000 as u64) // Standard Error: 0 - .saturating_add((3_000 as Weight).saturating_mul(b as Weight)) + .saturating_add(Weight::from_ref_time(3_000 as u64).saturating_mul(b as u64)) // Standard Error: 0 - .saturating_add((84_000 as Weight).saturating_mul(m as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(Weight::from_ref_time(84_000 as u64).saturating_mul(m as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) } // Storage: Instance1Collective Members (r:1 w:0) // Storage: Instance1Collective ProposalOf (r:1 w:0) fn propose_execute(b: u32, m: u32, ) -> Weight { - (27_600_000 as Weight) + Weight::from_ref_time(27_600_000 as u64) // Standard Error: 0 - .saturating_add((3_000 as Weight).saturating_mul(b as Weight)) + .saturating_add(Weight::from_ref_time(3_000 as u64).saturating_mul(b as u64)) // Standard Error: 0 - .saturating_add((161_000 as Weight).saturating_mul(m as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(Weight::from_ref_time(161_000 as u64).saturating_mul(m as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) } // Storage: Instance1Collective Members (r:1 w:0) // Storage: Instance1Collective ProposalOf (r:1 w:1) @@ -86,52 +86,52 @@ impl pallet_collective::WeightInfo for WeightInfo { // Storage: Instance1Collective ProposalCount (r:1 w:1) // Storage: Instance1Collective Voting (r:0 w:1) fn propose_proposed(b: u32, m: u32, p: u32, ) -> Weight { - (42_192_000 as Weight) + Weight::from_ref_time(42_192_000 as u64) // Standard Error: 0 - .saturating_add((4_000 as Weight).saturating_mul(b as Weight)) + .saturating_add(Weight::from_ref_time(4_000 as u64).saturating_mul(b as u64)) // Standard Error: 0 - .saturating_add((87_000 as Weight).saturating_mul(m as Weight)) + .saturating_add(Weight::from_ref_time(87_000 as u64).saturating_mul(m as u64)) // Standard Error: 0 - .saturating_add((361_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().writes(4 as Weight)) + .saturating_add(Weight::from_ref_time(361_000 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(4 as u64)) + .saturating_add(T::DbWeight::get().writes(4 as u64)) } // Storage: Instance1Collective Members (r:1 w:0) // Storage: Instance1Collective Voting (r:1 w:1) fn vote(m: u32, ) -> Weight { - (32_307_000 as Weight) + Weight::from_ref_time(32_307_000 as u64) // Standard Error: 0 - .saturating_add((199_000 as Weight).saturating_mul(m as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + .saturating_add(Weight::from_ref_time(199_000 as u64).saturating_mul(m as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Instance1Collective Voting (r:1 w:1) // Storage: Instance1Collective Members (r:1 w:0) // Storage: Instance1Collective Proposals (r:1 w:1) // Storage: Instance1Collective ProposalOf (r:0 w:1) fn close_early_disapproved(m: u32, p: u32, ) -> Weight { - (41_436_000 as Weight) + Weight::from_ref_time(41_436_000 as u64) // Standard Error: 0 - .saturating_add((170_000 as Weight).saturating_mul(m as Weight)) + .saturating_add(Weight::from_ref_time(170_000 as u64).saturating_mul(m as u64)) // Standard Error: 0 - .saturating_add((333_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) + .saturating_add(Weight::from_ref_time(333_000 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) } // Storage: Instance1Collective Voting (r:1 w:1) // Storage: Instance1Collective Members (r:1 w:0) // Storage: Instance1Collective ProposalOf (r:1 w:1) // Storage: Instance1Collective Proposals (r:1 w:1) fn close_early_approved(b: u32, m: u32, p: u32, ) -> Weight { - (57_836_000 as Weight) + Weight::from_ref_time(57_836_000 as u64) // Standard Error: 0 - .saturating_add((2_000 as Weight).saturating_mul(b as Weight)) + .saturating_add(Weight::from_ref_time(2_000 as u64).saturating_mul(b as u64)) // Standard Error: 0 - .saturating_add((170_000 as Weight).saturating_mul(m as Weight)) + .saturating_add(Weight::from_ref_time(170_000 as u64).saturating_mul(m as u64)) // Standard Error: 0 - .saturating_add((339_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) + .saturating_add(Weight::from_ref_time(339_000 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(4 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) } // Storage: Instance1Collective Voting (r:1 w:1) // Storage: Instance1Collective Members (r:1 w:0) @@ -139,13 +139,13 @@ impl pallet_collective::WeightInfo for WeightInfo { // Storage: Instance1Collective Proposals (r:1 w:1) // Storage: Instance1Collective ProposalOf (r:0 w:1) fn close_disapproved(m: u32, p: u32, ) -> Weight { - (45_551_000 as Weight) + Weight::from_ref_time(45_551_000 as u64) // Standard Error: 0 - .saturating_add((172_000 as Weight).saturating_mul(m as Weight)) + .saturating_add(Weight::from_ref_time(172_000 as u64).saturating_mul(m as u64)) // Standard Error: 0 - .saturating_add((338_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) + .saturating_add(Weight::from_ref_time(338_000 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(4 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) } // Storage: Instance1Collective Voting (r:1 w:1) // Storage: Instance1Collective Members (r:1 w:0) @@ -153,24 +153,24 @@ impl pallet_collective::WeightInfo for WeightInfo { // Storage: Instance1Collective ProposalOf (r:1 w:1) // Storage: Instance1Collective Proposals (r:1 w:1) fn close_approved(b: u32, m: u32, p: u32, ) -> Weight { - (61_497_000 as Weight) + Weight::from_ref_time(61_497_000 as u64) // Standard Error: 0 - .saturating_add((2_000 as Weight).saturating_mul(b as Weight)) + .saturating_add(Weight::from_ref_time(2_000 as u64).saturating_mul(b as u64)) // Standard Error: 0 - .saturating_add((171_000 as Weight).saturating_mul(m as Weight)) + .saturating_add(Weight::from_ref_time(171_000 as u64).saturating_mul(m as u64)) // Standard Error: 0 - .saturating_add((343_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(5 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) + .saturating_add(Weight::from_ref_time(343_000 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(5 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) } // Storage: Instance1Collective Proposals (r:1 w:1) // Storage: Instance1Collective Voting (r:0 w:1) // Storage: Instance1Collective ProposalOf (r:0 w:1) fn disapprove_proposal(p: u32, ) -> Weight { - (25_573_000 as Weight) + Weight::from_ref_time(25_573_000 as u64) // Standard Error: 0 - .saturating_add((335_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) + .saturating_add(Weight::from_ref_time(335_000 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) } } diff --git a/runtime/rococo/src/weights/pallet_collective_technical_committee.rs b/runtime/rococo/src/weights/pallet_collective_technical_committee.rs index 1cf3f29ff5cd..acdced982d94 100644 --- a/runtime/rococo/src/weights/pallet_collective_technical_committee.rs +++ b/runtime/rococo/src/weights/pallet_collective_technical_committee.rs @@ -49,36 +49,36 @@ impl pallet_collective::WeightInfo for WeightInfo { // Storage: Instance2Collective Voting (r:100 w:100) // Storage: Instance2Collective Prime (r:0 w:1) fn set_members(m: u32, n: u32, p: u32, ) -> Weight { - (0 as Weight) + Weight::from_ref_time(0 as u64) // Standard Error: 6_000 - .saturating_add((14_473_000 as Weight).saturating_mul(m as Weight)) + .saturating_add(Weight::from_ref_time(14_473_000 as u64).saturating_mul(m as u64)) // Standard Error: 6_000 - .saturating_add((73_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(Weight::from_ref_time(73_000 as u64).saturating_mul(n as u64)) // Standard Error: 6_000 - .saturating_add((19_551_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(p as Weight))) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(p as Weight))) + .saturating_add(Weight::from_ref_time(19_551_000 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(p as u64))) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(p as u64))) } // Storage: Instance2Collective Members (r:1 w:0) fn execute(b: u32, m: u32, ) -> Weight { - (22_690_000 as Weight) + Weight::from_ref_time(22_690_000 as u64) // Standard Error: 0 - .saturating_add((3_000 as Weight).saturating_mul(b as Weight)) + .saturating_add(Weight::from_ref_time(3_000 as u64).saturating_mul(b as u64)) // Standard Error: 0 - .saturating_add((80_000 as Weight).saturating_mul(m as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(Weight::from_ref_time(80_000 as u64).saturating_mul(m as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) } // Storage: Instance2Collective Members (r:1 w:0) // Storage: Instance2Collective ProposalOf (r:1 w:0) fn propose_execute(b: u32, m: u32, ) -> Weight { - (27_473_000 as Weight) + Weight::from_ref_time(27_473_000 as u64) // Standard Error: 0 - .saturating_add((3_000 as Weight).saturating_mul(b as Weight)) + .saturating_add(Weight::from_ref_time(3_000 as u64).saturating_mul(b as u64)) // Standard Error: 0 - .saturating_add((159_000 as Weight).saturating_mul(m as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(Weight::from_ref_time(159_000 as u64).saturating_mul(m as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) } // Storage: Instance2Collective Members (r:1 w:0) // Storage: Instance2Collective ProposalOf (r:1 w:1) @@ -86,52 +86,52 @@ impl pallet_collective::WeightInfo for WeightInfo { // Storage: Instance2Collective ProposalCount (r:1 w:1) // Storage: Instance2Collective Voting (r:0 w:1) fn propose_proposed(b: u32, m: u32, p: u32, ) -> Weight { - (42_047_000 as Weight) + Weight::from_ref_time(42_047_000 as u64) // Standard Error: 0 - .saturating_add((4_000 as Weight).saturating_mul(b as Weight)) + .saturating_add(Weight::from_ref_time(4_000 as u64).saturating_mul(b as u64)) // Standard Error: 0 - .saturating_add((85_000 as Weight).saturating_mul(m as Weight)) + .saturating_add(Weight::from_ref_time(85_000 as u64).saturating_mul(m as u64)) // Standard Error: 0 - .saturating_add((360_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().writes(4 as Weight)) + .saturating_add(Weight::from_ref_time(360_000 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(4 as u64)) + .saturating_add(T::DbWeight::get().writes(4 as u64)) } // Storage: Instance2Collective Members (r:1 w:0) // Storage: Instance2Collective Voting (r:1 w:1) fn vote(m: u32, ) -> Weight { - (32_023_000 as Weight) + Weight::from_ref_time(32_023_000 as u64) // Standard Error: 0 - .saturating_add((199_000 as Weight).saturating_mul(m as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + .saturating_add(Weight::from_ref_time(199_000 as u64).saturating_mul(m as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Instance2Collective Voting (r:1 w:1) // Storage: Instance2Collective Members (r:1 w:0) // Storage: Instance2Collective Proposals (r:1 w:1) // Storage: Instance2Collective ProposalOf (r:0 w:1) fn close_early_disapproved(m: u32, p: u32, ) -> Weight { - (41_107_000 as Weight) + Weight::from_ref_time(41_107_000 as u64) // Standard Error: 0 - .saturating_add((171_000 as Weight).saturating_mul(m as Weight)) + .saturating_add(Weight::from_ref_time(171_000 as u64).saturating_mul(m as u64)) // Standard Error: 0 - .saturating_add((332_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) + .saturating_add(Weight::from_ref_time(332_000 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) } // Storage: Instance2Collective Voting (r:1 w:1) // Storage: Instance2Collective Members (r:1 w:0) // Storage: Instance2Collective ProposalOf (r:1 w:1) // Storage: Instance2Collective Proposals (r:1 w:1) fn close_early_approved(b: u32, m: u32, p: u32, ) -> Weight { - (57_783_000 as Weight) + Weight::from_ref_time(57_783_000 as u64) // Standard Error: 0 - .saturating_add((2_000 as Weight).saturating_mul(b as Weight)) + .saturating_add(Weight::from_ref_time(2_000 as u64).saturating_mul(b as u64)) // Standard Error: 0 - .saturating_add((167_000 as Weight).saturating_mul(m as Weight)) + .saturating_add(Weight::from_ref_time(167_000 as u64).saturating_mul(m as u64)) // Standard Error: 0 - .saturating_add((336_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) + .saturating_add(Weight::from_ref_time(336_000 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(4 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) } // Storage: Instance2Collective Voting (r:1 w:1) // Storage: Instance2Collective Members (r:1 w:0) @@ -139,13 +139,13 @@ impl pallet_collective::WeightInfo for WeightInfo { // Storage: Instance2Collective Proposals (r:1 w:1) // Storage: Instance2Collective ProposalOf (r:0 w:1) fn close_disapproved(m: u32, p: u32, ) -> Weight { - (45_646_000 as Weight) + Weight::from_ref_time(45_646_000 as u64) // Standard Error: 0 - .saturating_add((170_000 as Weight).saturating_mul(m as Weight)) + .saturating_add(Weight::from_ref_time(170_000 as u64).saturating_mul(m as u64)) // Standard Error: 0 - .saturating_add((335_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) + .saturating_add(Weight::from_ref_time(335_000 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(4 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) } // Storage: Instance2Collective Voting (r:1 w:1) // Storage: Instance2Collective Members (r:1 w:0) @@ -153,24 +153,24 @@ impl pallet_collective::WeightInfo for WeightInfo { // Storage: Instance2Collective ProposalOf (r:1 w:1) // Storage: Instance2Collective Proposals (r:1 w:1) fn close_approved(b: u32, m: u32, p: u32, ) -> Weight { - (61_376_000 as Weight) + Weight::from_ref_time(61_376_000 as u64) // Standard Error: 0 - .saturating_add((2_000 as Weight).saturating_mul(b as Weight)) + .saturating_add(Weight::from_ref_time(2_000 as u64).saturating_mul(b as u64)) // Standard Error: 0 - .saturating_add((172_000 as Weight).saturating_mul(m as Weight)) + .saturating_add(Weight::from_ref_time(172_000 as u64).saturating_mul(m as u64)) // Standard Error: 0 - .saturating_add((339_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(5 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) + .saturating_add(Weight::from_ref_time(339_000 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(5 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) } // Storage: Instance2Collective Proposals (r:1 w:1) // Storage: Instance2Collective Voting (r:0 w:1) // Storage: Instance2Collective ProposalOf (r:0 w:1) fn disapprove_proposal(p: u32, ) -> Weight { - (25_286_000 as Weight) + Weight::from_ref_time(25_286_000 as u64) // Standard Error: 0 - .saturating_add((336_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) + .saturating_add(Weight::from_ref_time(336_000 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) } } diff --git a/runtime/rococo/src/weights/pallet_democracy.rs b/runtime/rococo/src/weights/pallet_democracy.rs index 3fefe21301d2..317b0d4bb0a1 100644 --- a/runtime/rococo/src/weights/pallet_democracy.rs +++ b/runtime/rococo/src/weights/pallet_democracy.rs @@ -16,7 +16,8 @@ //! Autogenerated weights for `pallet_democracy` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-05-11, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2022-08-19, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 // Executed Command: @@ -30,7 +31,6 @@ // --extrinsic=* // --execution=wasm // --wasm-execution=compiled -// --heap-pages=4096 // --header=./file_header.txt // --output=./runtime/rococo/src/weights/pallet_democracy.rs @@ -49,44 +49,47 @@ impl pallet_democracy::WeightInfo for WeightInfo { // Storage: Democracy Blacklist (r:1 w:0) // Storage: Democracy DepositOf (r:0 w:1) fn propose() -> Weight { - (33_014_000 as Weight) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) + Weight::from_ref_time(37_453_000 as u64) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) } // Storage: Democracy DepositOf (r:1 w:1) + /// The range of component `s` is `[0, 100]`. fn second(s: u32, ) -> Weight { - (23_956_000 as Weight) + Weight::from_ref_time(27_807_000 as u64) // Standard Error: 0 - .saturating_add((91_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + .saturating_add(Weight::from_ref_time(69_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Democracy ReferendumInfoOf (r:1 w:1) // Storage: Democracy VotingOf (r:1 w:1) // Storage: Balances Locks (r:1 w:1) + /// The range of component `r` is `[1, 99]`. fn vote_new(r: u32, ) -> Weight { - (31_400_000 as Weight) - // Standard Error: 0 - .saturating_add((138_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) + Weight::from_ref_time(35_336_000 as u64) + // Standard Error: 1_000 + .saturating_add(Weight::from_ref_time(120_000 as u64).saturating_mul(r as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) } // Storage: Democracy ReferendumInfoOf (r:1 w:1) // Storage: Democracy VotingOf (r:1 w:1) // Storage: Balances Locks (r:1 w:1) + /// The range of component `r` is `[1, 99]`. fn vote_existing(r: u32, ) -> Weight { - (31_439_000 as Weight) + Weight::from_ref_time(35_107_000 as u64) // Standard Error: 1_000 - .saturating_add((135_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) + .saturating_add(Weight::from_ref_time(123_000 as u64).saturating_mul(r as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) } // Storage: Democracy ReferendumInfoOf (r:1 w:1) // Storage: Democracy Cancellations (r:1 w:1) fn emergency_cancel() -> Weight { - (14_815_000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(17_752_000 as u64) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Democracy PublicProps (r:1 w:1) // Storage: Democracy NextExternal (r:1 w:1) @@ -94,83 +97,89 @@ impl pallet_democracy::WeightInfo for WeightInfo { // Storage: Democracy Blacklist (r:0 w:1) // Storage: Democracy DepositOf (r:1 w:1) // Storage: System Account (r:1 w:1) + /// The range of component `p` is `[1, 100]`. fn blacklist(p: u32, ) -> Weight { - (48_030_000 as Weight) - // Standard Error: 3_000 - .saturating_add((202_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(5 as Weight)) - .saturating_add(T::DbWeight::get().writes(6 as Weight)) + Weight::from_ref_time(52_116_000 as u64) + // Standard Error: 6_000 + .saturating_add(Weight::from_ref_time(194_000 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(5 as u64)) + .saturating_add(T::DbWeight::get().writes(6 as u64)) } // Storage: Democracy NextExternal (r:1 w:1) // Storage: Democracy Blacklist (r:1 w:0) + /// The range of component `v` is `[1, 100]`. fn external_propose(v: u32, ) -> Weight { - (7_547_000 as Weight) + Weight::from_ref_time(10_194_000 as u64) // Standard Error: 0 - .saturating_add((33_000 as Weight).saturating_mul(v as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + .saturating_add(Weight::from_ref_time(10_000 as u64).saturating_mul(v as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Democracy NextExternal (r:0 w:1) fn external_propose_majority() -> Weight { - (1_656_000 as Weight) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(3_700_000 as u64) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Democracy NextExternal (r:0 w:1) fn external_propose_default() -> Weight { - (1_383_000 as Weight) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(3_713_000 as u64) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Democracy NextExternal (r:1 w:1) // Storage: Democracy ReferendumCount (r:1 w:1) // Storage: Democracy ReferendumInfoOf (r:0 w:1) fn fast_track() -> Weight { - (14_624_000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) + Weight::from_ref_time(17_441_000 as u64) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) } // Storage: Democracy NextExternal (r:1 w:1) // Storage: Democracy Blacklist (r:1 w:1) + /// The range of component `v` is `[0, 100]`. fn veto_external(v: u32, ) -> Weight { - (15_246_000 as Weight) + Weight::from_ref_time(18_536_000 as u64) // Standard Error: 0 - .saturating_add((65_000 as Weight).saturating_mul(v as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + .saturating_add(Weight::from_ref_time(42_000 as u64).saturating_mul(v as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Democracy PublicProps (r:1 w:1) // Storage: Democracy DepositOf (r:1 w:1) // Storage: System Account (r:1 w:1) + /// The range of component `p` is `[1, 100]`. fn cancel_proposal(p: u32, ) -> Weight { - (35_279_000 as Weight) + Weight::from_ref_time(42_174_000 as u64) // Standard Error: 1_000 - .saturating_add((195_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) + .saturating_add(Weight::from_ref_time(164_000 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) } // Storage: Democracy ReferendumInfoOf (r:0 w:1) fn cancel_referendum() -> Weight { - (9_279_000 as Weight) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(11_892_000 as u64) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Scheduler Lookup (r:1 w:1) // Storage: Scheduler Agenda (r:1 w:1) + /// The range of component `r` is `[1, 99]`. fn cancel_queued(r: u32, ) -> Weight { - (20_572_000 as Weight) + Weight::from_ref_time(23_252_000 as u64) // Standard Error: 5_000 - .saturating_add((2_298_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + .saturating_add(Weight::from_ref_time(2_242_000 as u64).saturating_mul(r as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Democracy LowestUnbaked (r:1 w:1) // Storage: Democracy ReferendumCount (r:1 w:0) // Storage: Democracy ReferendumInfoOf (r:1 w:0) + /// The range of component `r` is `[1, 99]`. fn on_initialize_base(r: u32, ) -> Weight { - (1_835_000 as Weight) - // Standard Error: 2_000 - .saturating_add((2_925_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(r as Weight))) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(1_457_000 as u64) + // Standard Error: 3_000 + .saturating_add(Weight::from_ref_time(2_956_000 as u64).saturating_mul(r as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(r as u64))) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Democracy LowestUnbaked (r:1 w:1) // Storage: Democracy ReferendumCount (r:1 w:0) @@ -178,103 +187,113 @@ impl pallet_democracy::WeightInfo for WeightInfo { // Storage: Democracy NextExternal (r:1 w:0) // Storage: Democracy PublicProps (r:1 w:0) // Storage: Democracy ReferendumInfoOf (r:1 w:0) + /// The range of component `r` is `[1, 99]`. fn on_initialize_base_with_launch_period(r: u32, ) -> Weight { - (6_633_000 as Weight) + Weight::from_ref_time(6_240_000 as u64) // Standard Error: 3_000 - .saturating_add((2_929_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(T::DbWeight::get().reads(5 as Weight)) - .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(r as Weight))) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + .saturating_add(Weight::from_ref_time(2_963_000 as u64).saturating_mul(r as u64)) + .saturating_add(T::DbWeight::get().reads(5 as u64)) + .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(r as u64))) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Democracy VotingOf (r:3 w:3) // Storage: Democracy ReferendumInfoOf (r:1 w:1) // Storage: Balances Locks (r:1 w:1) + /// The range of component `r` is `[1, 99]`. fn delegate(r: u32, ) -> Weight { - (30_560_000 as Weight) - // Standard Error: 2_000 - .saturating_add((3_654_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(r as Weight))) - .saturating_add(T::DbWeight::get().writes(4 as Weight)) - .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(r as Weight))) + Weight::from_ref_time(34_480_000 as u64) + // Standard Error: 5_000 + .saturating_add(Weight::from_ref_time(3_908_000 as u64).saturating_mul(r as u64)) + .saturating_add(T::DbWeight::get().reads(4 as u64)) + .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(r as u64))) + .saturating_add(T::DbWeight::get().writes(4 as u64)) + .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(r as u64))) } // Storage: Democracy VotingOf (r:2 w:2) // Storage: Democracy ReferendumInfoOf (r:1 w:1) + /// The range of component `r` is `[1, 99]`. fn undelegate(r: u32, ) -> Weight { - (14_988_000 as Weight) - // Standard Error: 2_000 - .saturating_add((3_600_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(r as Weight))) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(r as Weight))) + Weight::from_ref_time(17_446_000 as u64) + // Standard Error: 6_000 + .saturating_add(Weight::from_ref_time(3_917_000 as u64).saturating_mul(r as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(r as u64))) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(r as u64))) } // Storage: Democracy PublicProps (r:0 w:1) fn clear_public_proposals() -> Weight { - (1_212_000 as Weight) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(3_727_000 as u64) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Democracy Preimages (r:1 w:1) + /// The range of component `b` is `[0, 16384]`. fn note_preimage(b: u32, ) -> Weight { - (21_356_000 as Weight) + Weight::from_ref_time(25_720_000 as u64) // Standard Error: 0 - .saturating_add((3_000 as Weight).saturating_mul(b as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + .saturating_add(Weight::from_ref_time(3_000 as u64).saturating_mul(b as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Democracy Preimages (r:1 w:1) + /// The range of component `b` is `[0, 16384]`. fn note_imminent_preimage(b: u32, ) -> Weight { - (14_006_000 as Weight) + Weight::from_ref_time(17_884_000 as u64) // Standard Error: 0 - .saturating_add((3_000 as Weight).saturating_mul(b as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + .saturating_add(Weight::from_ref_time(3_000 as u64).saturating_mul(b as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Democracy Preimages (r:1 w:1) // Storage: System Account (r:1 w:0) + /// The range of component `b` is `[0, 16384]`. fn reap_preimage(b: u32, ) -> Weight { - (21_293_000 as Weight) + Weight::from_ref_time(24_695_000 as u64) // Standard Error: 0 - .saturating_add((2_000 as Weight).saturating_mul(b as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + .saturating_add(Weight::from_ref_time(1_000 as u64).saturating_mul(b as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Democracy VotingOf (r:1 w:1) // Storage: Balances Locks (r:1 w:1) // Storage: System Account (r:1 w:1) + /// The range of component `r` is `[1, 99]`. fn unlock_remove(r: u32, ) -> Weight { - (19_105_000 as Weight) + Weight::from_ref_time(22_207_000 as u64) // Standard Error: 0 - .saturating_add((30_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) + .saturating_add(Weight::from_ref_time(36_000 as u64).saturating_mul(r as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) } // Storage: Democracy VotingOf (r:1 w:1) // Storage: Balances Locks (r:1 w:1) // Storage: System Account (r:1 w:1) + /// The range of component `r` is `[1, 99]`. fn unlock_set(r: u32, ) -> Weight { - (18_244_000 as Weight) + Weight::from_ref_time(21_561_000 as u64) // Standard Error: 0 - .saturating_add((126_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) + .saturating_add(Weight::from_ref_time(110_000 as u64).saturating_mul(r as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) } // Storage: Democracy ReferendumInfoOf (r:1 w:1) // Storage: Democracy VotingOf (r:1 w:1) + /// The range of component `r` is `[1, 99]`. fn remove_vote(r: u32, ) -> Weight { - (10_046_000 as Weight) + Weight::from_ref_time(13_204_000 as u64) // Standard Error: 0 - .saturating_add((119_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + .saturating_add(Weight::from_ref_time(105_000 as u64).saturating_mul(r as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Democracy ReferendumInfoOf (r:1 w:1) // Storage: Democracy VotingOf (r:1 w:1) + /// The range of component `r` is `[1, 99]`. fn remove_other_vote(r: u32, ) -> Weight { - (10_094_000 as Weight) + Weight::from_ref_time(12_994_000 as u64) // Standard Error: 0 - .saturating_add((120_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + .saturating_add(Weight::from_ref_time(106_000 as u64).saturating_mul(r as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } } diff --git a/runtime/rococo/src/weights/pallet_elections_phragmen.rs b/runtime/rococo/src/weights/pallet_elections_phragmen.rs index 3198b38ef649..c4c015fe4412 100644 --- a/runtime/rococo/src/weights/pallet_elections_phragmen.rs +++ b/runtime/rococo/src/weights/pallet_elections_phragmen.rs @@ -16,7 +16,8 @@ //! Autogenerated weights for `pallet_elections_phragmen` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-05-11, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2022-08-19, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 // Executed Command: @@ -30,7 +31,6 @@ // --extrinsic=* // --execution=wasm // --wasm-execution=compiled -// --heap-pages=4096 // --header=./file_header.txt // --output=./runtime/rococo/src/weights/pallet_elections_phragmen.rs @@ -49,61 +49,66 @@ impl pallet_elections_phragmen::WeightInfo for WeightIn // Storage: PhragmenElection RunnersUp (r:1 w:0) // Storage: PhragmenElection Voting (r:1 w:1) // Storage: Balances Locks (r:1 w:1) + /// The range of component `v` is `[1, 16]`. fn vote_equal(v: u32, ) -> Weight { - (21_240_000 as Weight) - // Standard Error: 9_000 - .saturating_add((190_000 as Weight).saturating_mul(v as Weight)) - .saturating_add(T::DbWeight::get().reads(5 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(24_107_000 as u64) + // Standard Error: 2_000 + .saturating_add(Weight::from_ref_time(184_000 as u64).saturating_mul(v as u64)) + .saturating_add(T::DbWeight::get().reads(5 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: PhragmenElection Candidates (r:1 w:0) // Storage: PhragmenElection Members (r:1 w:0) // Storage: PhragmenElection RunnersUp (r:1 w:0) // Storage: PhragmenElection Voting (r:1 w:1) // Storage: Balances Locks (r:1 w:1) + /// The range of component `v` is `[2, 16]`. fn vote_more(v: u32, ) -> Weight { - (33_409_000 as Weight) - // Standard Error: 12_000 - .saturating_add((152_000 as Weight).saturating_mul(v as Weight)) - .saturating_add(T::DbWeight::get().reads(5 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(36_869_000 as u64) + // Standard Error: 5_000 + .saturating_add(Weight::from_ref_time(165_000 as u64).saturating_mul(v as u64)) + .saturating_add(T::DbWeight::get().reads(5 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: PhragmenElection Candidates (r:1 w:0) // Storage: PhragmenElection Members (r:1 w:0) // Storage: PhragmenElection RunnersUp (r:1 w:0) // Storage: PhragmenElection Voting (r:1 w:1) // Storage: Balances Locks (r:1 w:1) + /// The range of component `v` is `[2, 16]`. fn vote_less(v: u32, ) -> Weight { - (32_961_000 as Weight) - // Standard Error: 9_000 - .saturating_add((180_000 as Weight).saturating_mul(v as Weight)) - .saturating_add(T::DbWeight::get().reads(5 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(36_445_000 as u64) + // Standard Error: 4_000 + .saturating_add(Weight::from_ref_time(199_000 as u64).saturating_mul(v as u64)) + .saturating_add(T::DbWeight::get().reads(5 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: PhragmenElection Voting (r:1 w:1) // Storage: Balances Locks (r:1 w:1) fn remove_voter() -> Weight { - (29_515_000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(33_035_000 as u64) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: PhragmenElection Candidates (r:1 w:1) // Storage: PhragmenElection Members (r:1 w:0) // Storage: PhragmenElection RunnersUp (r:1 w:0) + /// The range of component `c` is `[1, 1000]`. fn submit_candidacy(c: u32, ) -> Weight { - (30_999_000 as Weight) + Weight::from_ref_time(25_946_000 as u64) // Standard Error: 0 - .saturating_add((135_000 as Weight).saturating_mul(c as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + .saturating_add(Weight::from_ref_time(101_000 as u64).saturating_mul(c as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: PhragmenElection Candidates (r:1 w:1) + /// The range of component `c` is `[1, 1000]`. fn renounce_candidacy_candidate(c: u32, ) -> Weight { - (25_741_000 as Weight) + Weight::from_ref_time(22_945_000 as u64) // Standard Error: 0 - .saturating_add((70_000 as Weight).saturating_mul(c as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + .saturating_add(Weight::from_ref_time(69_000 as u64).saturating_mul(c as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: PhragmenElection Members (r:1 w:1) // Storage: PhragmenElection RunnersUp (r:1 w:1) @@ -111,66 +116,68 @@ impl pallet_elections_phragmen::WeightInfo for WeightIn // Storage: Council Proposals (r:1 w:0) // Storage: Council Members (r:0 w:1) fn renounce_candidacy_members() -> Weight { - (39_440_000 as Weight) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().writes(4 as Weight)) + Weight::from_ref_time(41_502_000 as u64) + .saturating_add(T::DbWeight::get().reads(4 as u64)) + .saturating_add(T::DbWeight::get().writes(4 as u64)) } // Storage: PhragmenElection RunnersUp (r:1 w:1) fn renounce_candidacy_runners_up() -> Weight { - (27_483_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(30_791_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Benchmark Override (r:0 w:0) fn remove_member_without_replacement() -> Weight { - (2_000_000_000_000 as Weight) + Weight::from_ref_time(2_000_000_000_000 as u64) } - // Storage: PhragmenElection RunnersUp (r:1 w:1) // Storage: PhragmenElection Members (r:1 w:1) // Storage: System Account (r:1 w:1) + // Storage: PhragmenElection RunnersUp (r:1 w:1) // Storage: Council Prime (r:1 w:1) // Storage: Council Proposals (r:1 w:0) // Storage: Council Members (r:0 w:1) fn remove_member_with_replacement() -> Weight { - (54_903_000 as Weight) - .saturating_add(T::DbWeight::get().reads(5 as Weight)) - .saturating_add(T::DbWeight::get().writes(5 as Weight)) + Weight::from_ref_time(57_184_000 as u64) + .saturating_add(T::DbWeight::get().reads(5 as u64)) + .saturating_add(T::DbWeight::get().writes(5 as u64)) } - // Storage: PhragmenElection Voting (r:251 w:250) + // Storage: PhragmenElection Voting (r:5001 w:5000) // Storage: PhragmenElection Members (r:1 w:0) // Storage: PhragmenElection RunnersUp (r:1 w:0) // Storage: PhragmenElection Candidates (r:1 w:0) - // Storage: Balances Locks (r:250 w:250) - // Storage: System Account (r:250 w:250) - fn clean_defunct_voters(v: u32, d: u32, ) -> Weight { - (0 as Weight) - // Standard Error: 42_000 - .saturating_add((47_366_000 as Weight).saturating_mul(v as Weight)) - // Standard Error: 40_000 - .saturating_add((240_000 as Weight).saturating_mul(d as Weight)) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(v as Weight))) - .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(v as Weight))) + // Storage: Balances Locks (r:5000 w:5000) + // Storage: System Account (r:5000 w:5000) + /// The range of component `v` is `[5000, 10000]`. + /// The range of component `d` is `[1, 5000]`. + fn clean_defunct_voters(v: u32, _d: u32, ) -> Weight { + Weight::from_ref_time(0 as u64) + // Standard Error: 85_000 + .saturating_add(Weight::from_ref_time(61_507_000 as u64).saturating_mul(v as u64)) + .saturating_add(T::DbWeight::get().reads(4 as u64)) + .saturating_add(T::DbWeight::get().reads((3 as u64).saturating_mul(v as u64))) + .saturating_add(T::DbWeight::get().writes((3 as u64).saturating_mul(v as u64))) } // Storage: PhragmenElection Candidates (r:1 w:1) // Storage: PhragmenElection Members (r:1 w:1) // Storage: PhragmenElection RunnersUp (r:1 w:1) - // Storage: PhragmenElection Voting (r:502 w:0) + // Storage: PhragmenElection Voting (r:10001 w:0) // Storage: Council Proposals (r:1 w:0) // Storage: PhragmenElection ElectionRounds (r:1 w:1) // Storage: Council Members (r:0 w:1) // Storage: Council Prime (r:0 w:1) - // Storage: System Account (r:2 w:2) + // Storage: System Account (r:3 w:3) + /// The range of component `c` is `[1, 1000]`. + /// The range of component `v` is `[1, 10000]`. + /// The range of component `e` is `[10000, 160000]`. fn election_phragmen(c: u32, v: u32, e: u32, ) -> Weight { - (0 as Weight) - // Standard Error: 2_735_000 - .saturating_add((135_428_000 as Weight).saturating_mul(c as Weight)) - // Standard Error: 1_137_000 - .saturating_add((103_462_000 as Weight).saturating_mul(v as Weight)) - // Standard Error: 77_000 - .saturating_add((7_116_000 as Weight).saturating_mul(e as Weight)) - .saturating_add(T::DbWeight::get().reads((2 as Weight).saturating_mul(c as Weight))) - .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(v as Weight))) - .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(c as Weight))) + Weight::from_ref_time(0 as u64) + // Standard Error: 1_864_000 + .saturating_add(Weight::from_ref_time(167_385_000 as u64).saturating_mul(v as u64)) + // Standard Error: 124_000 + .saturating_add(Weight::from_ref_time(9_721_000 as u64).saturating_mul(e as u64)) + .saturating_add(T::DbWeight::get().reads(265 as u64)) + .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(c as u64))) + .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(v as u64))) + .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(c as u64))) } } diff --git a/runtime/rococo/src/weights/pallet_gilt.rs b/runtime/rococo/src/weights/pallet_gilt.rs index e25f62d8f8cc..b873684e2311 100644 --- a/runtime/rococo/src/weights/pallet_gilt.rs +++ b/runtime/rococo/src/weights/pallet_gilt.rs @@ -16,7 +16,8 @@ //! Autogenerated weights for `pallet_gilt` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-05-11, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2022-08-19, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 // Executed Command: @@ -30,7 +31,6 @@ // --extrinsic=* // --execution=wasm // --wasm-execution=compiled -// --heap-pages=4096 // --header=./file_header.txt // --output=./runtime/rococo/src/weights/pallet_gilt.rs @@ -46,70 +46,74 @@ pub struct WeightInfo(PhantomData); impl pallet_gilt::WeightInfo for WeightInfo { // Storage: Gilt Queues (r:1 w:1) // Storage: Gilt QueueTotals (r:1 w:1) + /// The range of component `l` is `[0, 999]`. fn place_bid(l: u32, ) -> Weight { - (38_024_000 as Weight) + Weight::from_ref_time(36_767_000 as u64) // Standard Error: 0 - .saturating_add((152_000 as Weight).saturating_mul(l as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + .saturating_add(Weight::from_ref_time(115_000 as u64).saturating_mul(l as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Gilt Queues (r:1 w:1) // Storage: Gilt QueueTotals (r:1 w:1) fn place_bid_max() -> Weight { - (154_433_000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(119_333_000 as u64) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Gilt Queues (r:1 w:1) // Storage: Gilt QueueTotals (r:1 w:1) + /// The range of component `l` is `[1, 1000]`. fn retract_bid(l: u32, ) -> Weight { - (37_541_000 as Weight) + Weight::from_ref_time(37_108_000 as u64) // Standard Error: 0 - .saturating_add((125_000 as Weight).saturating_mul(l as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + .saturating_add(Weight::from_ref_time(94_000 as u64).saturating_mul(l as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Gilt ActiveTotal (r:1 w:1) fn set_target() -> Weight { - (3_062_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(5_188_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Gilt Active (r:1 w:1) // Storage: Gilt ActiveTotal (r:1 w:1) fn thaw() -> Weight { - (39_496_000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(43_654_000 as u64) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Gilt ActiveTotal (r:1 w:0) fn pursue_target_noop() -> Weight { - (1_598_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) + Weight::from_ref_time(1_584_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) } // Storage: Gilt ActiveTotal (r:1 w:1) // Storage: Gilt QueueTotals (r:1 w:1) // Storage: Gilt Queues (r:1 w:1) // Storage: Gilt Active (r:0 w:1) + /// The range of component `b` is `[1, 1000]`. fn pursue_target_per_item(b: u32, ) -> Weight { - (39_340_000 as Weight) + Weight::from_ref_time(21_464_000 as u64) // Standard Error: 2_000 - .saturating_add((4_415_000 as Weight).saturating_mul(b as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(b as Weight))) + .saturating_add(Weight::from_ref_time(4_387_000 as u64).saturating_mul(b as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(b as u64))) } // Storage: Gilt ActiveTotal (r:1 w:1) // Storage: Gilt QueueTotals (r:1 w:1) // Storage: Gilt Queues (r:1 w:1) // Storage: Gilt Active (r:0 w:1) + /// The range of component `q` is `[1, 300]`. fn pursue_target_per_queue(q: u32, ) -> Weight { - (16_092_000 as Weight) - // Standard Error: 6_000 - .saturating_add((8_070_000 as Weight).saturating_mul(q as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(q as Weight))) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - .saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(q as Weight))) + Weight::from_ref_time(12_881_000 as u64) + // Standard Error: 8_000 + .saturating_add(Weight::from_ref_time(8_285_000 as u64).saturating_mul(q as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(q as u64))) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + .saturating_add(T::DbWeight::get().writes((2 as u64).saturating_mul(q as u64))) } } diff --git a/runtime/rococo/src/weights/pallet_identity.rs b/runtime/rococo/src/weights/pallet_identity.rs index d23069043549..57c18f391f4b 100644 --- a/runtime/rococo/src/weights/pallet_identity.rs +++ b/runtime/rococo/src/weights/pallet_identity.rs @@ -16,7 +16,8 @@ //! Autogenerated weights for `pallet_identity` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-05-11, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2022-08-19, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 // Executed Command: @@ -30,7 +31,6 @@ // --extrinsic=* // --execution=wasm // --wasm-execution=compiled -// --heap-pages=4096 // --header=./file_header.txt // --output=./runtime/rococo/src/weights/pallet_identity.rs @@ -45,167 +45,189 @@ use sp_std::marker::PhantomData; pub struct WeightInfo(PhantomData); impl pallet_identity::WeightInfo for WeightInfo { // Storage: Identity Registrars (r:1 w:1) + /// The range of component `r` is `[1, 19]`. fn add_registrar(r: u32, ) -> Weight { - (12_429_000 as Weight) - // Standard Error: 4_000 - .saturating_add((200_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(16_146_000 as u64) + // Standard Error: 2_000 + .saturating_add(Weight::from_ref_time(164_000 as u64).saturating_mul(r as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Identity IdentityOf (r:1 w:1) + /// The range of component `r` is `[1, 20]`. + /// The range of component `x` is `[1, 100]`. fn set_identity(r: u32, x: u32, ) -> Weight { - (26_281_000 as Weight) - // Standard Error: 8_000 - .saturating_add((157_000 as Weight).saturating_mul(r as Weight)) + Weight::from_ref_time(28_556_000 as u64) + // Standard Error: 7_000 + .saturating_add(Weight::from_ref_time(208_000 as u64).saturating_mul(r as u64)) // Standard Error: 1_000 - .saturating_add((367_000 as Weight).saturating_mul(x as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + .saturating_add(Weight::from_ref_time(371_000 as u64).saturating_mul(x as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Identity IdentityOf (r:1 w:0) // Storage: Identity SubsOf (r:1 w:1) // Storage: Identity SuperOf (r:1 w:1) + /// The range of component `s` is `[1, 100]`. fn set_subs_new(s: u32, ) -> Weight { - (22_123_000 as Weight) - // Standard Error: 1_000 - .saturating_add((2_656_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight))) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) + Weight::from_ref_time(25_214_000 as u64) + // Standard Error: 6_000 + .saturating_add(Weight::from_ref_time(3_032_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(s as u64))) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(s as u64))) } // Storage: Identity IdentityOf (r:1 w:0) // Storage: Identity SubsOf (r:1 w:1) // Storage: Identity SuperOf (r:0 w:1) + /// The range of component `p` is `[1, 100]`. fn set_subs_old(p: u32, ) -> Weight { - (22_181_000 as Weight) - // Standard Error: 0 - .saturating_add((739_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(p as Weight))) + Weight::from_ref_time(26_402_000 as u64) + // Standard Error: 1_000 + .saturating_add(Weight::from_ref_time(916_000 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(p as u64))) } // Storage: Identity SubsOf (r:1 w:1) // Storage: Identity IdentityOf (r:1 w:1) // Storage: Identity SuperOf (r:0 w:100) + /// The range of component `r` is `[1, 20]`. + /// The range of component `s` is `[1, 100]`. + /// The range of component `x` is `[1, 100]`. fn clear_identity(r: u32, s: u32, x: u32, ) -> Weight { - (27_995_000 as Weight) - // Standard Error: 6_000 - .saturating_add((86_000 as Weight).saturating_mul(r as Weight)) - // Standard Error: 0 - .saturating_add((723_000 as Weight).saturating_mul(s as Weight)) - // Standard Error: 0 - .saturating_add((229_000 as Weight).saturating_mul(x as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) + Weight::from_ref_time(32_822_000 as u64) + // Standard Error: 5_000 + .saturating_add(Weight::from_ref_time(74_000 as u64).saturating_mul(r as u64)) + // Standard Error: 1_000 + .saturating_add(Weight::from_ref_time(909_000 as u64).saturating_mul(s as u64)) + // Standard Error: 1_000 + .saturating_add(Weight::from_ref_time(166_000 as u64).saturating_mul(x as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(s as u64))) } // Storage: Identity Registrars (r:1 w:0) // Storage: Identity IdentityOf (r:1 w:1) + /// The range of component `r` is `[1, 20]`. + /// The range of component `x` is `[1, 100]`. fn request_judgement(r: u32, x: u32, ) -> Weight { - (27_627_000 as Weight) - // Standard Error: 5_000 - .saturating_add((166_000 as Weight).saturating_mul(r as Weight)) + Weight::from_ref_time(30_696_000 as u64) + // Standard Error: 4_000 + .saturating_add(Weight::from_ref_time(163_000 as u64).saturating_mul(r as u64)) // Standard Error: 0 - .saturating_add((427_000 as Weight).saturating_mul(x as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + .saturating_add(Weight::from_ref_time(377_000 as u64).saturating_mul(x as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Identity IdentityOf (r:1 w:1) + /// The range of component `r` is `[1, 20]`. + /// The range of component `x` is `[1, 100]`. fn cancel_request(r: u32, x: u32, ) -> Weight { - (23_894_000 as Weight) - // Standard Error: 7_000 - .saturating_add((153_000 as Weight).saturating_mul(r as Weight)) + Weight::from_ref_time(28_144_000 as u64) + // Standard Error: 4_000 + .saturating_add(Weight::from_ref_time(144_000 as u64).saturating_mul(r as u64)) // Standard Error: 0 - .saturating_add((422_000 as Weight).saturating_mul(x as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + .saturating_add(Weight::from_ref_time(363_000 as u64).saturating_mul(x as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Identity Registrars (r:1 w:1) + /// The range of component `r` is `[1, 19]`. fn set_fee(r: u32, ) -> Weight { - (4_504_000 as Weight) - // Standard Error: 2_000 - .saturating_add((163_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(7_135_000 as u64) + // Standard Error: 1_000 + .saturating_add(Weight::from_ref_time(135_000 as u64).saturating_mul(r as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Identity Registrars (r:1 w:1) + /// The range of component `r` is `[1, 19]`. fn set_account_id(r: u32, ) -> Weight { - (4_320_000 as Weight) + Weight::from_ref_time(6_861_000 as u64) // Standard Error: 1_000 - .saturating_add((159_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + .saturating_add(Weight::from_ref_time(140_000 as u64).saturating_mul(r as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Identity Registrars (r:1 w:1) + /// The range of component `r` is `[1, 19]`. fn set_fields(r: u32, ) -> Weight { - (4_498_000 as Weight) - // Standard Error: 2_000 - .saturating_add((165_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(7_143_000 as u64) + // Standard Error: 1_000 + .saturating_add(Weight::from_ref_time(133_000 as u64).saturating_mul(r as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Identity Registrars (r:1 w:0) // Storage: Identity IdentityOf (r:1 w:1) + /// The range of component `r` is `[1, 19]`. + /// The range of component `x` is `[1, 100]`. fn provide_judgement(r: u32, x: u32, ) -> Weight { - (18_213_000 as Weight) - // Standard Error: 5_000 - .saturating_add((158_000 as Weight).saturating_mul(r as Weight)) - // Standard Error: 0 - .saturating_add((427_000 as Weight).saturating_mul(x as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(21_902_000 as u64) + // Standard Error: 6_000 + .saturating_add(Weight::from_ref_time(109_000 as u64).saturating_mul(r as u64)) + // Standard Error: 1_000 + .saturating_add(Weight::from_ref_time(378_000 as u64).saturating_mul(x as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Identity SubsOf (r:1 w:1) // Storage: Identity IdentityOf (r:1 w:1) // Storage: System Account (r:1 w:1) // Storage: Identity SuperOf (r:0 w:100) - fn kill_identity(r: u32, s: u32, _x: u32, ) -> Weight { - (42_006_000 as Weight) - // Standard Error: 11_000 - .saturating_add((72_000 as Weight).saturating_mul(r as Weight)) - // Standard Error: 1_000 - .saturating_add((722_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) + /// The range of component `r` is `[1, 20]`. + /// The range of component `s` is `[1, 100]`. + /// The range of component `x` is `[1, 100]`. + fn kill_identity(_r: u32, s: u32, _x: u32, ) -> Weight { + Weight::from_ref_time(48_712_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(903_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(s as u64))) } // Storage: Identity IdentityOf (r:1 w:0) // Storage: Identity SuperOf (r:1 w:1) // Storage: Identity SubsOf (r:1 w:1) + /// The range of component `s` is `[1, 99]`. fn add_sub(s: u32, ) -> Weight { - (29_352_000 as Weight) + Weight::from_ref_time(33_860_000 as u64) // Standard Error: 0 - .saturating_add((113_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + .saturating_add(Weight::from_ref_time(97_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Identity IdentityOf (r:1 w:0) // Storage: Identity SuperOf (r:1 w:1) + /// The range of component `s` is `[1, 100]`. fn rename_sub(s: u32, ) -> Weight { - (8_911_000 as Weight) + Weight::from_ref_time(12_063_000 as u64) // Standard Error: 0 - .saturating_add((20_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + .saturating_add(Weight::from_ref_time(27_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Identity IdentityOf (r:1 w:0) // Storage: Identity SuperOf (r:1 w:1) // Storage: Identity SubsOf (r:1 w:1) + /// The range of component `s` is `[1, 100]`. fn remove_sub(s: u32, ) -> Weight { - (30_027_000 as Weight) + Weight::from_ref_time(34_418_000 as u64) // Standard Error: 0 - .saturating_add((102_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + .saturating_add(Weight::from_ref_time(84_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Identity SuperOf (r:1 w:1) // Storage: Identity SubsOf (r:1 w:1) + /// The range of component `s` is `[1, 99]`. fn quit_sub(s: u32, ) -> Weight { - (19_939_000 as Weight) + Weight::from_ref_time(24_186_000 as u64) // Standard Error: 0 - .saturating_add((96_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + .saturating_add(Weight::from_ref_time(77_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } } diff --git a/runtime/rococo/src/weights/pallet_preimage.rs b/runtime/rococo/src/weights/pallet_preimage.rs index da6060592084..5268e8054a13 100644 --- a/runtime/rococo/src/weights/pallet_preimage.rs +++ b/runtime/rococo/src/weights/pallet_preimage.rs @@ -16,7 +16,8 @@ //! Autogenerated weights for `pallet_preimage` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-05-11, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2022-08-19, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 // Executed Command: @@ -30,7 +31,6 @@ // --extrinsic=* // --execution=wasm // --wasm-execution=compiled -// --heap-pages=4096 // --header=./file_header.txt // --output=./runtime/rococo/src/weights/pallet_preimage.rs @@ -46,87 +46,90 @@ pub struct WeightInfo(PhantomData); impl pallet_preimage::WeightInfo for WeightInfo { // Storage: Preimage PreimageFor (r:1 w:1) // Storage: Preimage StatusFor (r:1 w:1) + /// The range of component `s` is `[0, 4194304]`. fn note_preimage(s: u32, ) -> Weight { - (0 as Weight) + Weight::from_ref_time(0 as u64) // Standard Error: 0 - .saturating_add((3_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + .saturating_add(Weight::from_ref_time(3_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Preimage PreimageFor (r:1 w:1) // Storage: Preimage StatusFor (r:1 w:0) + /// The range of component `s` is `[0, 4194304]`. fn note_requested_preimage(s: u32, ) -> Weight { - (0 as Weight) + Weight::from_ref_time(0 as u64) // Standard Error: 0 - .saturating_add((3_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + .saturating_add(Weight::from_ref_time(3_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Preimage PreimageFor (r:1 w:1) // Storage: Preimage StatusFor (r:1 w:0) + /// The range of component `s` is `[0, 4194304]`. fn note_no_deposit_preimage(s: u32, ) -> Weight { - (0 as Weight) + Weight::from_ref_time(0 as u64) // Standard Error: 0 - .saturating_add((3_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + .saturating_add(Weight::from_ref_time(3_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Preimage StatusFor (r:1 w:1) // Storage: Preimage PreimageFor (r:0 w:1) fn unnote_preimage() -> Weight { - (38_165_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(35_236_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Preimage StatusFor (r:1 w:1) // Storage: Preimage PreimageFor (r:0 w:1) fn unnote_no_deposit_preimage() -> Weight { - (25_192_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(23_396_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Preimage StatusFor (r:1 w:1) fn request_preimage() -> Weight { - (36_385_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(33_944_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Preimage StatusFor (r:1 w:1) fn request_no_deposit_preimage() -> Weight { - (23_791_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(22_151_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Preimage StatusFor (r:1 w:1) fn request_unnoted_preimage() -> Weight { - (13_857_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(16_617_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Preimage StatusFor (r:1 w:1) fn request_requested_preimage() -> Weight { - (4_599_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(6_552_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Preimage StatusFor (r:1 w:1) // Storage: Preimage PreimageFor (r:0 w:1) fn unrequest_preimage() -> Weight { - (25_208_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(23_787_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Preimage StatusFor (r:1 w:1) // Storage: Preimage PreimageFor (r:0 w:1) fn unrequest_unnoted_preimage() -> Weight { - (13_875_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(16_327_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Preimage StatusFor (r:1 w:1) fn unrequest_multi_referenced_preimage() -> Weight { - (4_610_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(6_289_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } } diff --git a/runtime/rococo/src/weights/pallet_recovery.rs b/runtime/rococo/src/weights/pallet_recovery.rs deleted file mode 100644 index 1236714fd2bd..000000000000 --- a/runtime/rococo/src/weights/pallet_recovery.rs +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright 2017-2022 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_recovery` -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-07-12, STEPS: `2`, REPEAT: 4, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `MacBook-Pro.local`, CPU: `` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 - -// Executed Command: -// ./target/release/polkadot -// benchmark -// pallet -// --chain=rococo-dev -// --steps=2 -// --repeat=4 -// --pallet=pallet_recovery -// --extrinsic=* -// --execution=wasm -// --wasm-execution=compiled -// --header=./file_header.txt -// --output=./runtime/rococo/src/weights/pallet_recovery.rs - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; - -/// Weight functions for `pallet_recovery`. -pub struct WeightInfo(PhantomData); -impl pallet_recovery::WeightInfo for WeightInfo { - // Storage: Recovery Proxy (r:1 w:0) - fn as_recovered() -> Weight { - (20_000_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - } - // Storage: Recovery Proxy (r:0 w:1) - fn set_recovered() -> Weight { - (34_000_000 as Weight) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - // Storage: Recovery Recoverable (r:1 w:1) - /// The range of component `n` is `[1, 9]`. - fn create_recovery(n: u32, ) -> Weight { - (55_271_000 as Weight) - // Standard Error: 1_335_000 - .saturating_add((6_313_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - // Storage: Recovery Recoverable (r:1 w:0) - // Storage: Recovery ActiveRecoveries (r:1 w:1) - fn initiate_recovery() -> Weight { - (71_000_000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - // Storage: Recovery Recoverable (r:1 w:0) - // Storage: Recovery ActiveRecoveries (r:1 w:1) - /// The range of component `n` is `[1, 9]`. - fn vouch_recovery(n: u32, ) -> Weight { - (47_604_000 as Weight) - // Standard Error: 380_000 - .saturating_add((812_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - // Storage: Recovery Recoverable (r:1 w:0) - // Storage: Recovery ActiveRecoveries (r:1 w:0) - // Storage: Recovery Proxy (r:1 w:1) - /// The range of component `n` is `[1, 9]`. - fn claim_recovery(n: u32, ) -> Weight { - (57_625_000 as Weight) - // Standard Error: 1_000_000 - .saturating_add((6_375_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - // Storage: Recovery ActiveRecoveries (r:1 w:1) - // Storage: System Account (r:1 w:1) - /// The range of component `n` is `[1, 9]`. - fn close_recovery(n: u32, ) -> Weight { - (79_292_000 as Weight) - // Standard Error: 1_972_000 - .saturating_add((1_875_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - // Storage: Recovery ActiveRecoveries (r:1 w:0) - // Storage: Recovery Recoverable (r:1 w:1) - /// The range of component `n` is `[1, 9]`. - fn remove_recovery(n: u32, ) -> Weight { - (107_292_000 as Weight) - // Standard Error: 4_017_000 - .saturating_add((1_875_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - // Storage: Recovery Proxy (r:1 w:1) - fn cancel_recovered() -> Weight { - (29_000_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } -} diff --git a/runtime/rococo/src/weights/pallet_scheduler.rs b/runtime/rococo/src/weights/pallet_scheduler.rs index 6acd76cba4db..06a77fcee9cb 100644 --- a/runtime/rococo/src/weights/pallet_scheduler.rs +++ b/runtime/rococo/src/weights/pallet_scheduler.rs @@ -16,7 +16,8 @@ //! Autogenerated weights for `pallet_scheduler` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-05-11, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2022-08-19, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 // Executed Command: @@ -30,7 +31,6 @@ // --extrinsic=* // --execution=wasm // --wasm-execution=compiled -// --heap-pages=4096 // --header=./file_header.txt // --output=./runtime/rococo/src/weights/pallet_scheduler.rs @@ -48,146 +48,160 @@ impl pallet_scheduler::WeightInfo for WeightInfo { // Storage: Preimage PreimageFor (r:1 w:1) // Storage: Preimage StatusFor (r:1 w:1) // Storage: Scheduler Lookup (r:0 w:1) + /// The range of component `s` is `[1, 50]`. fn on_initialize_periodic_named_resolved(s: u32, ) -> Weight { - (1_014_000 as Weight) - // Standard Error: 33_000 - .saturating_add((25_640_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(s as Weight))) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - .saturating_add(T::DbWeight::get().writes((4 as Weight).saturating_mul(s as Weight))) + Weight::from_ref_time(1_256_000 as u64) + // Standard Error: 42_000 + .saturating_add(Weight::from_ref_time(26_925_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().reads((3 as u64).saturating_mul(s as u64))) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + .saturating_add(T::DbWeight::get().writes((4 as u64).saturating_mul(s as u64))) } // Storage: Scheduler Agenda (r:1 w:1) // Storage: Preimage PreimageFor (r:1 w:1) // Storage: Preimage StatusFor (r:1 w:1) // Storage: Scheduler Lookup (r:0 w:1) + /// The range of component `s` is `[1, 50]`. fn on_initialize_named_resolved(s: u32, ) -> Weight { - (0 as Weight) - // Standard Error: 29_000 - .saturating_add((20_816_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().reads((2 as Weight).saturating_mul(s as Weight))) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(s as Weight))) + Weight::from_ref_time(921_000 as u64) + // Standard Error: 35_000 + .saturating_add(Weight::from_ref_time(21_922_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().reads((2 as u64).saturating_mul(s as u64))) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + .saturating_add(T::DbWeight::get().writes((3 as u64).saturating_mul(s as u64))) } // Storage: Scheduler Agenda (r:2 w:2) // Storage: Preimage PreimageFor (r:1 w:1) // Storage: Preimage StatusFor (r:1 w:1) + /// The range of component `s` is `[1, 50]`. fn on_initialize_periodic_resolved(s: u32, ) -> Weight { - (315_000 as Weight) - // Standard Error: 33_000 - .saturating_add((23_338_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(s as Weight))) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(s as Weight))) + Weight::from_ref_time(0 as u64) + // Standard Error: 62_000 + .saturating_add(Weight::from_ref_time(24_926_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().reads((3 as u64).saturating_mul(s as u64))) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + .saturating_add(T::DbWeight::get().writes((3 as u64).saturating_mul(s as u64))) } // Storage: Scheduler Agenda (r:1 w:1) // Storage: Preimage PreimageFor (r:1 w:1) // Storage: Preimage StatusFor (r:1 w:1) + /// The range of component `s` is `[1, 50]`. fn on_initialize_resolved(s: u32, ) -> Weight { - (94_000 as Weight) + Weight::from_ref_time(10_674_000 as u64) // Standard Error: 31_000 - .saturating_add((19_898_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().reads((2 as Weight).saturating_mul(s as Weight))) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - .saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(s as Weight))) + .saturating_add(Weight::from_ref_time(20_631_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().reads((2 as u64).saturating_mul(s as u64))) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + .saturating_add(T::DbWeight::get().writes((2 as u64).saturating_mul(s as u64))) } // Storage: Scheduler Agenda (r:2 w:2) // Storage: Preimage PreimageFor (r:1 w:0) // Storage: Scheduler Lookup (r:0 w:1) + /// The range of component `s` is `[1, 50]`. fn on_initialize_named_aborted(s: u32, ) -> Weight { - (2_095_000 as Weight) - // Standard Error: 16_000 - .saturating_add((9_978_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight))) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) + Weight::from_ref_time(2_607_000 as u64) + // Standard Error: 20_000 + .saturating_add(Weight::from_ref_time(10_009_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(s as u64))) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(s as u64))) } // Storage: Scheduler Agenda (r:2 w:2) // Storage: Preimage PreimageFor (r:1 w:0) + /// The range of component `s` is `[1, 50]`. fn on_initialize_aborted(s: u32, ) -> Weight { - (5_435_000 as Weight) - // Standard Error: 15_000 - .saturating_add((7_878_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight))) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(3_381_000 as u64) + // Standard Error: 17_000 + .saturating_add(Weight::from_ref_time(7_945_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(s as u64))) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Scheduler Agenda (r:2 w:2) // Storage: Scheduler Lookup (r:0 w:1) + /// The range of component `s` is `[1, 50]`. fn on_initialize_periodic_named(s: u32, ) -> Weight { - (6_842_000 as Weight) - // Standard Error: 21_000 - .saturating_add((16_006_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight))) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - .saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(s as Weight))) + Weight::from_ref_time(6_676_000 as u64) + // Standard Error: 25_000 + .saturating_add(Weight::from_ref_time(16_966_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(s as u64))) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + .saturating_add(T::DbWeight::get().writes((2 as u64).saturating_mul(s as u64))) } // Storage: Scheduler Agenda (r:2 w:2) + /// The range of component `s` is `[1, 50]`. fn on_initialize_periodic(s: u32, ) -> Weight { - (9_527_000 as Weight) - // Standard Error: 16_000 - .saturating_add((13_652_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight))) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) + Weight::from_ref_time(8_899_000 as u64) + // Standard Error: 24_000 + .saturating_add(Weight::from_ref_time(14_630_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(s as u64))) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(s as u64))) } // Storage: Scheduler Agenda (r:1 w:1) // Storage: Scheduler Lookup (r:0 w:1) + /// The range of component `s` is `[1, 50]`. fn on_initialize_named(s: u32, ) -> Weight { - (9_416_000 as Weight) - // Standard Error: 16_000 - .saturating_add((11_422_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) + Weight::from_ref_time(8_583_000 as u64) + // Standard Error: 19_000 + .saturating_add(Weight::from_ref_time(12_228_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(s as u64))) } // Storage: Scheduler Agenda (r:1 w:1) + /// The range of component `s` is `[1, 50]`. fn on_initialize(s: u32, ) -> Weight { - (9_432_000 as Weight) - // Standard Error: 15_000 - .saturating_add((10_651_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(8_544_000 as u64) + // Standard Error: 19_000 + .saturating_add(Weight::from_ref_time(11_364_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Scheduler Agenda (r:1 w:1) + /// The range of component `s` is `[0, 50]`. fn schedule(s: u32, ) -> Weight { - (16_045_000 as Weight) + Weight::from_ref_time(19_060_000 as u64) // Standard Error: 1_000 - .saturating_add((42_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + .saturating_add(Weight::from_ref_time(46_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Scheduler Agenda (r:1 w:1) // Storage: Scheduler Lookup (r:0 w:1) + /// The range of component `s` is `[1, 50]`. fn cancel(s: u32, ) -> Weight { - (15_177_000 as Weight) + Weight::from_ref_time(17_694_000 as u64) // Standard Error: 7_000 - .saturating_add((2_394_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + .saturating_add(Weight::from_ref_time(2_368_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Scheduler Lookup (r:1 w:1) // Storage: Scheduler Agenda (r:1 w:1) + /// The range of component `s` is `[0, 50]`. fn schedule_named(s: u32, ) -> Weight { - (18_430_000 as Weight) + Weight::from_ref_time(22_258_000 as u64) // Standard Error: 1_000 - .saturating_add((59_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + .saturating_add(Weight::from_ref_time(60_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Scheduler Lookup (r:1 w:1) // Storage: Scheduler Agenda (r:1 w:1) + /// The range of component `s` is `[1, 50]`. fn cancel_named(s: u32, ) -> Weight { - (15_731_000 as Weight) - // Standard Error: 6_000 - .saturating_add((2_405_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(18_882_000 as u64) + // Standard Error: 7_000 + .saturating_add(Weight::from_ref_time(2_379_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } } diff --git a/runtime/rococo/src/weights/pallet_tips.rs b/runtime/rococo/src/weights/pallet_tips.rs index bffdbab64516..9d737bfa5a1b 100644 --- a/runtime/rococo/src/weights/pallet_tips.rs +++ b/runtime/rococo/src/weights/pallet_tips.rs @@ -16,7 +16,8 @@ //! Autogenerated weights for `pallet_tips` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-05-11, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2022-08-19, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 // Executed Command: @@ -30,7 +31,6 @@ // --extrinsic=* // --execution=wasm // --wasm-execution=compiled -// --heap-pages=4096 // --header=./file_header.txt // --output=./runtime/rococo/src/weights/pallet_tips.rs @@ -46,59 +46,65 @@ pub struct WeightInfo(PhantomData); impl pallet_tips::WeightInfo for WeightInfo { // Storage: Tips Reasons (r:1 w:1) // Storage: Tips Tips (r:1 w:1) + /// The range of component `r` is `[0, 16384]`. fn report_awesome(r: u32, ) -> Weight { - (24_012_000 as Weight) + Weight::from_ref_time(28_045_000 as u64) // Standard Error: 0 - .saturating_add((2_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + .saturating_add(Weight::from_ref_time(2_000 as u64).saturating_mul(r as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Tips Tips (r:1 w:1) // Storage: Tips Reasons (r:0 w:1) fn retract_tip() -> Weight { - (22_820_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(26_017_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: PhragmenElection Members (r:1 w:0) // Storage: Tips Reasons (r:1 w:1) // Storage: Tips Tips (r:0 w:1) + /// The range of component `r` is `[0, 16384]`. + /// The range of component `t` is `[1, 19]`. fn tip_new(r: u32, t: u32, ) -> Weight { - (15_944_000 as Weight) + Weight::from_ref_time(19_125_000 as u64) // Standard Error: 0 - .saturating_add((2_000 as Weight).saturating_mul(r as Weight)) - // Standard Error: 3_000 - .saturating_add((65_000 as Weight).saturating_mul(t as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + .saturating_add(Weight::from_ref_time(2_000 as u64).saturating_mul(r as u64)) + // Standard Error: 2_000 + .saturating_add(Weight::from_ref_time(41_000 as u64).saturating_mul(t as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: PhragmenElection Members (r:1 w:0) // Storage: Tips Tips (r:1 w:1) + /// The range of component `t` is `[1, 19]`. fn tip(t: u32, ) -> Weight { - (8_400_000 as Weight) - // Standard Error: 2_000 - .saturating_add((341_000 as Weight).saturating_mul(t as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(10_895_000 as u64) + // Standard Error: 1_000 + .saturating_add(Weight::from_ref_time(158_000 as u64).saturating_mul(t as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Tips Tips (r:1 w:1) // Storage: PhragmenElection Members (r:1 w:0) // Storage: System Account (r:1 w:1) // Storage: Tips Reasons (r:0 w:1) + /// The range of component `t` is `[1, 19]`. fn close_tip(t: u32, ) -> Weight { - (39_172_000 as Weight) - // Standard Error: 6_000 - .saturating_add((190_000 as Weight).saturating_mul(t as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) + Weight::from_ref_time(42_301_000 as u64) + // Standard Error: 4_000 + .saturating_add(Weight::from_ref_time(154_000 as u64).saturating_mul(t as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) } // Storage: Tips Tips (r:1 w:1) // Storage: Tips Reasons (r:0 w:1) + /// The range of component `t` is `[1, 19]`. fn slash_tip(t: u32, ) -> Weight { - (13_435_000 as Weight) - // Standard Error: 2_000 - .saturating_add((22_000 as Weight).saturating_mul(t as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(16_548_000 as u64) + // Standard Error: 1_000 + .saturating_add(Weight::from_ref_time(21_000 as u64).saturating_mul(t as u64)) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } } diff --git a/runtime/rococo/src/weights/pallet_treasury.rs b/runtime/rococo/src/weights/pallet_treasury.rs index 583c8e8d1e65..09a0d3c819cb 100644 --- a/runtime/rococo/src/weights/pallet_treasury.rs +++ b/runtime/rococo/src/weights/pallet_treasury.rs @@ -16,7 +16,8 @@ //! Autogenerated weights for `pallet_treasury` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-05-11, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2022-08-19, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 // Executed Command: @@ -30,7 +31,6 @@ // --extrinsic=* // --execution=wasm // --wasm-execution=compiled -// --heap-pages=4096 // --header=./file_header.txt // --output=./runtime/rococo/src/weights/pallet_treasury.rs @@ -45,48 +45,50 @@ use sp_std::marker::PhantomData; pub struct WeightInfo(PhantomData); impl pallet_treasury::WeightInfo for WeightInfo { fn spend() -> Weight { - (151_000 as Weight) + Weight::from_ref_time(153_000 as u64) } // Storage: Treasury ProposalCount (r:1 w:1) // Storage: Treasury Proposals (r:0 w:1) fn propose_spend() -> Weight { - (20_053_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(25_149_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Treasury Proposals (r:1 w:1) // Storage: System Account (r:1 w:1) fn reject_proposal() -> Weight { - (31_437_000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(35_748_000 as u64) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Treasury Proposals (r:1 w:0) // Storage: Treasury Approvals (r:1 w:1) + /// The range of component `p` is `[0, 99]`. fn approve_proposal(p: u32, ) -> Weight { - (6_947_000 as Weight) + Weight::from_ref_time(10_082_000 as u64) // Standard Error: 0 - .saturating_add((28_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + .saturating_add(Weight::from_ref_time(36_000 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Treasury Approvals (r:1 w:1) fn remove_approval() -> Weight { - (3_187_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(5_612_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: Treasury Approvals (r:1 w:1) // Storage: Bounties BountyApprovals (r:1 w:1) // Storage: System Account (r:1 w:1) // Storage: Treasury Proposals (r:2 w:2) + /// The range of component `p` is `[0, 100]`. fn on_initialize_proposals(p: u32, ) -> Weight { - (33_520_000 as Weight) - // Standard Error: 26_000 - .saturating_add((29_886_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(p as Weight))) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(p as Weight))) + Weight::from_ref_time(36_270_000 as u64) + // Standard Error: 32_000 + .saturating_add(Weight::from_ref_time(30_142_000 as u64).saturating_mul(p as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().reads((3 as u64).saturating_mul(p as u64))) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + .saturating_add(T::DbWeight::get().writes((3 as u64).saturating_mul(p as u64))) } } diff --git a/runtime/rococo/src/weights/pallet_vesting.rs b/runtime/rococo/src/weights/pallet_vesting.rs index 3d1063ffb533..32f07f0bc98b 100644 --- a/runtime/rococo/src/weights/pallet_vesting.rs +++ b/runtime/rococo/src/weights/pallet_vesting.rs @@ -16,7 +16,8 @@ //! Autogenerated weights for `pallet_vesting` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-05-11, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2022-08-19, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 // Executed Command: @@ -30,7 +31,6 @@ // --extrinsic=* // --execution=wasm // --wasm-execution=compiled -// --heap-pages=4096 // --header=./file_header.txt // --output=./runtime/rococo/src/weights/pallet_vesting.rs @@ -46,96 +46,112 @@ pub struct WeightInfo(PhantomData); impl pallet_vesting::WeightInfo for WeightInfo { // Storage: Vesting Vesting (r:1 w:1) // Storage: Balances Locks (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[1, 28]`. fn vest_locked(l: u32, s: u32, ) -> Weight { - (24_521_000 as Weight) + Weight::from_ref_time(29_030_000 as u64) // Standard Error: 0 - .saturating_add((88_000 as Weight).saturating_mul(l as Weight)) + .saturating_add(Weight::from_ref_time(75_000 as u64).saturating_mul(l as u64)) // Standard Error: 1_000 - .saturating_add((179_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + .saturating_add(Weight::from_ref_time(162_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Vesting Vesting (r:1 w:1) // Storage: Balances Locks (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[1, 28]`. fn vest_unlocked(l: u32, s: u32, ) -> Weight { - (24_314_000 as Weight) - // Standard Error: 0 - .saturating_add((87_000 as Weight).saturating_mul(l as Weight)) + Weight::from_ref_time(29_535_000 as u64) // Standard Error: 1_000 - .saturating_add((145_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + .saturating_add(Weight::from_ref_time(69_000 as u64).saturating_mul(l as u64)) + // Standard Error: 2_000 + .saturating_add(Weight::from_ref_time(113_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: Vesting Vesting (r:1 w:1) // Storage: Balances Locks (r:1 w:1) // Storage: System Account (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[1, 28]`. fn vest_other_locked(l: u32, s: u32, ) -> Weight { - (23_625_000 as Weight) + Weight::from_ref_time(29_237_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(75_000 as u64).saturating_mul(l as u64)) // Standard Error: 1_000 - .saturating_add((99_000 as Weight).saturating_mul(l as Weight)) - // Standard Error: 2_000 - .saturating_add((198_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) + .saturating_add(Weight::from_ref_time(160_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) } // Storage: Vesting Vesting (r:1 w:1) // Storage: Balances Locks (r:1 w:1) // Storage: System Account (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[1, 28]`. fn vest_other_unlocked(l: u32, s: u32, ) -> Weight { - (24_100_000 as Weight) - // Standard Error: 0 - .saturating_add((85_000 as Weight).saturating_mul(l as Weight)) - // Standard Error: 1_000 - .saturating_add((149_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) + Weight::from_ref_time(29_750_000 as u64) + // Standard Error: 3_000 + .saturating_add(Weight::from_ref_time(84_000 as u64).saturating_mul(l as u64)) + // Standard Error: 5_000 + .saturating_add(Weight::from_ref_time(109_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) } // Storage: Vesting Vesting (r:1 w:1) // Storage: System Account (r:1 w:1) // Storage: Balances Locks (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[0, 27]`. fn vested_transfer(l: u32, s: u32, ) -> Weight { - (39_750_000 as Weight) + Weight::from_ref_time(44_092_000 as u64) // Standard Error: 2_000 - .saturating_add((90_000 as Weight).saturating_mul(l as Weight)) + .saturating_add(Weight::from_ref_time(71_000 as u64).saturating_mul(l as u64)) // Standard Error: 4_000 - .saturating_add((142_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) + .saturating_add(Weight::from_ref_time(134_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) } // Storage: Vesting Vesting (r:1 w:1) // Storage: System Account (r:2 w:2) // Storage: Balances Locks (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[0, 27]`. fn force_vested_transfer(l: u32, s: u32, ) -> Weight { - (38_890_000 as Weight) - // Standard Error: 1_000 - .saturating_add((89_000 as Weight).saturating_mul(l as Weight)) - // Standard Error: 3_000 - .saturating_add((161_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().writes(4 as Weight)) + Weight::from_ref_time(44_003_000 as u64) + // Standard Error: 2_000 + .saturating_add(Weight::from_ref_time(72_000 as u64).saturating_mul(l as u64)) + // Standard Error: 4_000 + .saturating_add(Weight::from_ref_time(119_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(4 as u64)) + .saturating_add(T::DbWeight::get().writes(4 as u64)) } // Storage: Vesting Vesting (r:1 w:1) // Storage: Balances Locks (r:1 w:1) // Storage: System Account (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[2, 28]`. fn not_unlocking_merge_schedules(l: u32, s: u32, ) -> Weight { - (24_945_000 as Weight) + Weight::from_ref_time(29_853_000 as u64) // Standard Error: 0 - .saturating_add((93_000 as Weight).saturating_mul(l as Weight)) + .saturating_add(Weight::from_ref_time(77_000 as u64).saturating_mul(l as u64)) // Standard Error: 1_000 - .saturating_add((189_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) + .saturating_add(Weight::from_ref_time(153_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) } // Storage: Vesting Vesting (r:1 w:1) // Storage: Balances Locks (r:1 w:1) // Storage: System Account (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[2, 28]`. fn unlocking_merge_schedules(l: u32, s: u32, ) -> Weight { - (25_402_000 as Weight) + Weight::from_ref_time(29_466_000 as u64) // Standard Error: 0 - .saturating_add((85_000 as Weight).saturating_mul(l as Weight)) + .saturating_add(Weight::from_ref_time(81_000 as u64).saturating_mul(l as u64)) // Standard Error: 1_000 - .saturating_add((178_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) + .saturating_add(Weight::from_ref_time(158_000 as u64).saturating_mul(s as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) } } diff --git a/runtime/rococo/src/weights/runtime_common_claims.rs b/runtime/rococo/src/weights/runtime_common_claims.rs index 89481d32ccf0..510592b2ed09 100644 --- a/runtime/rococo/src/weights/runtime_common_claims.rs +++ b/runtime/rococo/src/weights/runtime_common_claims.rs @@ -16,7 +16,8 @@ //! Autogenerated weights for `runtime_common::claims` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-05-11, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2022-08-19, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 // Executed Command: @@ -30,7 +31,6 @@ // --extrinsic=* // --execution=wasm // --wasm-execution=compiled -// --heap-pages=4096 // --header=./file_header.txt // --output=./runtime/rococo/src/weights/runtime_common_claims.rs @@ -52,18 +52,18 @@ impl runtime_common::claims::WeightInfo for WeightInfo< // Storage: System Account (r:1 w:0) // Storage: Balances Locks (r:1 w:1) fn claim() -> Weight { - (136_684_000 as Weight) - .saturating_add(T::DbWeight::get().reads(7 as Weight)) - .saturating_add(T::DbWeight::get().writes(6 as Weight)) + Weight::from_ref_time(139_399_000 as u64) + .saturating_add(T::DbWeight::get().reads(7 as u64)) + .saturating_add(T::DbWeight::get().writes(6 as u64)) } // Storage: Claims Total (r:1 w:1) // Storage: Claims Vesting (r:0 w:1) // Storage: Claims Claims (r:0 w:1) // Storage: Claims Signing (r:0 w:1) fn mint_claim() -> Weight { - (6_261_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(4 as Weight)) + Weight::from_ref_time(9_284_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(4 as u64)) } // Storage: Claims Claims (r:1 w:1) // Storage: Claims Signing (r:1 w:1) @@ -73,9 +73,9 @@ impl runtime_common::claims::WeightInfo for WeightInfo< // Storage: System Account (r:1 w:0) // Storage: Balances Locks (r:1 w:1) fn claim_attest() -> Weight { - (140_914_000 as Weight) - .saturating_add(T::DbWeight::get().reads(7 as Weight)) - .saturating_add(T::DbWeight::get().writes(6 as Weight)) + Weight::from_ref_time(143_329_000 as u64) + .saturating_add(T::DbWeight::get().reads(7 as u64)) + .saturating_add(T::DbWeight::get().writes(6 as u64)) } // Storage: Claims Preclaims (r:1 w:1) // Storage: Claims Signing (r:1 w:1) @@ -86,17 +86,17 @@ impl runtime_common::claims::WeightInfo for WeightInfo< // Storage: System Account (r:1 w:0) // Storage: Balances Locks (r:1 w:1) fn attest() -> Weight { - (57_479_000 as Weight) - .saturating_add(T::DbWeight::get().reads(8 as Weight)) - .saturating_add(T::DbWeight::get().writes(7 as Weight)) + Weight::from_ref_time(63_456_000 as u64) + .saturating_add(T::DbWeight::get().reads(8 as u64)) + .saturating_add(T::DbWeight::get().writes(7 as u64)) } // Storage: Claims Claims (r:1 w:2) // Storage: Claims Vesting (r:1 w:2) // Storage: Claims Signing (r:1 w:2) // Storage: Claims Preclaims (r:1 w:1) fn move_claim() -> Weight { - (15_201_000 as Weight) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().writes(7 as Weight)) + Weight::from_ref_time(19_434_000 as u64) + .saturating_add(T::DbWeight::get().reads(4 as u64)) + .saturating_add(T::DbWeight::get().writes(7 as u64)) } } diff --git a/runtime/rococo/src/weights/xcm/mod.rs b/runtime/rococo/src/weights/xcm/mod.rs index 717c633707e4..2c5d4d6f05f9 100644 --- a/runtime/rococo/src/weights/xcm/mod.rs +++ b/runtime/rococo/src/weights/xcm/mod.rs @@ -4,12 +4,15 @@ mod pallet_xcm_benchmarks_generic; use crate::Runtime; use frame_support::weights::Weight; use sp_std::prelude::*; -use xcm::{latest::prelude::*, DoubleEncoded}; +use xcm::{ + latest::{prelude::*, Weight as XCMWeight}, + DoubleEncoded, +}; use pallet_xcm_benchmarks_fungible::WeightInfo as XcmBalancesWeight; use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric; -/// Types of asset supported by the Kusama runtime. +/// Types of asset supported by the Rococo runtime. pub enum AssetTypes { /// An asset backed by `pallet-balances`. Balances, @@ -28,15 +31,15 @@ impl From<&MultiAsset> for AssetTypes { } trait WeighMultiAssets { - fn weigh_multi_assets(&self, balances_weight: Weight) -> Weight; + fn weigh_multi_assets(&self, balances_weight: Weight) -> XCMWeight; } -// Kusama only knows about one asset, the balances pallet. +// Rococo only knows about one asset, the balances pallet. const MAX_ASSETS: u32 = 1; impl WeighMultiAssets for MultiAssetFilter { - fn weigh_multi_assets(&self, balances_weight: Weight) -> Weight { - match self { + fn weigh_multi_assets(&self, balances_weight: Weight) -> XCMWeight { + let weight = match self { Self::Definite(assets) => assets .inner() .into_iter() @@ -45,91 +48,96 @@ impl WeighMultiAssets for MultiAssetFilter { AssetTypes::Balances => balances_weight, AssetTypes::Unknown => Weight::MAX, }) - .fold(0, |acc, x| acc.saturating_add(x)), - Self::Wild(_) => (MAX_ASSETS as Weight).saturating_mul(balances_weight), - } + .fold(Weight::zero(), |acc, x| acc.saturating_add(x)), + Self::Wild(_) => balances_weight.saturating_mul(MAX_ASSETS as u64), + }; + + weight.ref_time() } } impl WeighMultiAssets for MultiAssets { - fn weigh_multi_assets(&self, balances_weight: Weight) -> Weight { - self.inner() + fn weigh_multi_assets(&self, balances_weight: Weight) -> XCMWeight { + let weight = self + .inner() .into_iter() .map(|m| >::from(m)) .map(|t| match t { AssetTypes::Balances => balances_weight, AssetTypes::Unknown => Weight::MAX, }) - .fold(0, |acc, x| acc.saturating_add(x)) + .fold(Weight::zero(), |acc, x| acc.saturating_add(x)); + + weight.ref_time() } } pub struct RococoXcmWeight(core::marker::PhantomData); impl XcmWeightInfo for RococoXcmWeight { - fn withdraw_asset(assets: &MultiAssets) -> Weight { + fn withdraw_asset(assets: &MultiAssets) -> XCMWeight { assets.weigh_multi_assets(XcmBalancesWeight::::withdraw_asset()) } - fn reserve_asset_deposited(assets: &MultiAssets) -> Weight { + fn reserve_asset_deposited(assets: &MultiAssets) -> XCMWeight { assets.weigh_multi_assets(XcmBalancesWeight::::reserve_asset_deposited()) } - fn receive_teleported_asset(assets: &MultiAssets) -> Weight { + fn receive_teleported_asset(assets: &MultiAssets) -> XCMWeight { assets.weigh_multi_assets(XcmBalancesWeight::::receive_teleported_asset()) } - fn query_response(_query_id: &u64, _response: &Response, _max_weight: &u64) -> Weight { - XcmGeneric::::query_response() + fn query_response(_query_id: &u64, _response: &Response, _max_weight: &u64) -> XCMWeight { + XcmGeneric::::query_response().ref_time() } - fn transfer_asset(assets: &MultiAssets, _dest: &MultiLocation) -> Weight { + fn transfer_asset(assets: &MultiAssets, _dest: &MultiLocation) -> XCMWeight { assets.weigh_multi_assets(XcmBalancesWeight::::transfer_asset()) } fn transfer_reserve_asset( assets: &MultiAssets, _dest: &MultiLocation, _xcm: &Xcm<()>, - ) -> Weight { + ) -> XCMWeight { assets.weigh_multi_assets(XcmBalancesWeight::::transfer_reserve_asset()) } fn transact( _origin_type: &OriginKind, _require_weight_at_most: &u64, _call: &DoubleEncoded, - ) -> Weight { - XcmGeneric::::transact() + ) -> XCMWeight { + XcmGeneric::::transact().ref_time() } fn hrmp_new_channel_open_request( _sender: &u32, _max_message_size: &u32, _max_capacity: &u32, - ) -> Weight { + ) -> XCMWeight { // XCM Executor does not currently support HRMP channel operations - Weight::MAX + Weight::MAX.ref_time() } - fn hrmp_channel_accepted(_recipient: &u32) -> Weight { + fn hrmp_channel_accepted(_recipient: &u32) -> XCMWeight { // XCM Executor does not currently support HRMP channel operations - Weight::MAX + Weight::MAX.ref_time() } - fn hrmp_channel_closing(_initiator: &u32, _sender: &u32, _recipient: &u32) -> Weight { + fn hrmp_channel_closing(_initiator: &u32, _sender: &u32, _recipient: &u32) -> XCMWeight { // XCM Executor does not currently support HRMP channel operations - Weight::MAX + Weight::MAX.ref_time() } - fn clear_origin() -> Weight { - XcmGeneric::::clear_origin() + fn clear_origin() -> XCMWeight { + XcmGeneric::::clear_origin().ref_time() } - fn descend_origin(_who: &InteriorMultiLocation) -> Weight { - XcmGeneric::::descend_origin() + fn descend_origin(_who: &InteriorMultiLocation) -> XCMWeight { + XcmGeneric::::descend_origin().ref_time() } fn report_error( _query_id: &QueryId, _dest: &MultiLocation, _max_response_weight: &u64, - ) -> Weight { - XcmGeneric::::report_error() + ) -> XCMWeight { + XcmGeneric::::report_error().ref_time() } fn deposit_asset( assets: &MultiAssetFilter, _max_assets: &u32, // TODO use max assets? _dest: &MultiLocation, - ) -> Weight { + ) -> XCMWeight { assets.weigh_multi_assets(XcmBalancesWeight::::deposit_asset()) } fn deposit_reserve_asset( @@ -137,24 +145,24 @@ impl XcmWeightInfo for RococoXcmWeight { _max_assets: &u32, // TODO use max assets? _dest: &MultiLocation, _xcm: &Xcm<()>, - ) -> Weight { + ) -> XCMWeight { assets.weigh_multi_assets(XcmBalancesWeight::::deposit_reserve_asset()) } - fn exchange_asset(_give: &MultiAssetFilter, _receive: &MultiAssets) -> Weight { - Weight::MAX // todo fix + fn exchange_asset(_give: &MultiAssetFilter, _receive: &MultiAssets) -> XCMWeight { + Weight::MAX.ref_time() // todo fix } fn initiate_reserve_withdraw( assets: &MultiAssetFilter, _reserve: &MultiLocation, _xcm: &Xcm<()>, - ) -> Weight { + ) -> XCMWeight { assets.weigh_multi_assets(XcmGeneric::::initiate_reserve_withdraw()) } fn initiate_teleport( assets: &MultiAssetFilter, _dest: &MultiLocation, _xcm: &Xcm<()>, - ) -> Weight { + ) -> XCMWeight { assets.weigh_multi_assets(XcmBalancesWeight::::initiate_teleport()) } fn query_holding( @@ -162,34 +170,34 @@ impl XcmWeightInfo for RococoXcmWeight { _dest: &MultiLocation, _assets: &MultiAssetFilter, _max_response_weight: &u64, - ) -> Weight { - XcmGeneric::::query_holding() + ) -> XCMWeight { + XcmGeneric::::query_holding().ref_time() } - fn buy_execution(_fees: &MultiAsset, _weight_limit: &WeightLimit) -> Weight { - XcmGeneric::::buy_execution() + fn buy_execution(_fees: &MultiAsset, _weight_limit: &WeightLimit) -> XCMWeight { + XcmGeneric::::buy_execution().ref_time() } - fn refund_surplus() -> Weight { - XcmGeneric::::refund_surplus() + fn refund_surplus() -> XCMWeight { + XcmGeneric::::refund_surplus().ref_time() } - fn set_error_handler(_xcm: &Xcm) -> Weight { - XcmGeneric::::set_error_handler() + fn set_error_handler(_xcm: &Xcm) -> XCMWeight { + XcmGeneric::::set_error_handler().ref_time() } - fn set_appendix(_xcm: &Xcm) -> Weight { - XcmGeneric::::set_appendix() + fn set_appendix(_xcm: &Xcm) -> XCMWeight { + XcmGeneric::::set_appendix().ref_time() } - fn clear_error() -> Weight { - XcmGeneric::::clear_error() + fn clear_error() -> XCMWeight { + XcmGeneric::::clear_error().ref_time() } - fn claim_asset(_assets: &MultiAssets, _ticket: &MultiLocation) -> Weight { - XcmGeneric::::claim_asset() + fn claim_asset(_assets: &MultiAssets, _ticket: &MultiLocation) -> XCMWeight { + XcmGeneric::::claim_asset().ref_time() } - fn trap(_code: &u64) -> Weight { - XcmGeneric::::trap() + fn trap(_code: &u64) -> XCMWeight { + XcmGeneric::::trap().ref_time() } - fn subscribe_version(_query_id: &QueryId, _max_response_weight: &u64) -> Weight { - XcmGeneric::::subscribe_version() + fn subscribe_version(_query_id: &QueryId, _max_response_weight: &u64) -> XCMWeight { + XcmGeneric::::subscribe_version().ref_time() } - fn unsubscribe_version() -> Weight { - XcmGeneric::::unsubscribe_version() + fn unsubscribe_version() -> XCMWeight { + XcmGeneric::::unsubscribe_version().ref_time() } } diff --git a/runtime/rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs b/runtime/rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs index 4eb7e568bf5d..99eee16135ba 100644 --- a/runtime/rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs +++ b/runtime/rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs @@ -47,15 +47,15 @@ pub struct WeightInfo(PhantomData); impl WeightInfo { // Storage: System Account (r:1 w:1) pub(crate) fn withdraw_asset() -> Weight { - (20_385_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(20_385_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: System Account (r:2 w:2) pub(crate) fn transfer_asset() -> Weight { - (32_756_000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(32_756_000 as u64) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: System Account (r:2 w:2) // Storage: XcmPallet SupportedVersion (r:1 w:0) @@ -65,25 +65,25 @@ impl WeightInfo { // Storage: Dmp DownwardMessageQueueHeads (r:1 w:1) // Storage: Dmp DownwardMessageQueues (r:1 w:1) pub(crate) fn transfer_reserve_asset() -> Weight { - (50_645_000 as Weight) - .saturating_add(T::DbWeight::get().reads(8 as Weight)) - .saturating_add(T::DbWeight::get().writes(5 as Weight)) + Weight::from_ref_time(50_645_000 as u64) + .saturating_add(T::DbWeight::get().reads(8 as u64)) + .saturating_add(T::DbWeight::get().writes(5 as u64)) } // Storage: Benchmark Override (r:0 w:0) pub(crate) fn reserve_asset_deposited() -> Weight { - (2_000_000_000_000 as Weight) + Weight::from_ref_time(2_000_000_000_000 as u64) } // Storage: System Account (r:1 w:1) pub(crate) fn receive_teleported_asset() -> Weight { - (19_595_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(19_595_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: System Account (r:1 w:1) pub(crate) fn deposit_asset() -> Weight { - (21_763_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(21_763_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: System Account (r:1 w:1) // Storage: XcmPallet SupportedVersion (r:1 w:0) @@ -93,9 +93,9 @@ impl WeightInfo { // Storage: Dmp DownwardMessageQueueHeads (r:1 w:1) // Storage: Dmp DownwardMessageQueues (r:1 w:1) pub(crate) fn deposit_reserve_asset() -> Weight { - (40_930_000 as Weight) - .saturating_add(T::DbWeight::get().reads(7 as Weight)) - .saturating_add(T::DbWeight::get().writes(4 as Weight)) + Weight::from_ref_time(40_930_000 as u64) + .saturating_add(T::DbWeight::get().reads(7 as u64)) + .saturating_add(T::DbWeight::get().writes(4 as u64)) } // Storage: System Account (r:1 w:1) // Storage: XcmPallet SupportedVersion (r:1 w:0) @@ -105,8 +105,8 @@ impl WeightInfo { // Storage: Dmp DownwardMessageQueueHeads (r:1 w:1) // Storage: Dmp DownwardMessageQueues (r:1 w:1) pub(crate) fn initiate_teleport() -> Weight { - (40_788_000 as Weight) - .saturating_add(T::DbWeight::get().reads(7 as Weight)) - .saturating_add(T::DbWeight::get().writes(4 as Weight)) + Weight::from_ref_time(40_788_000 as u64) + .saturating_add(T::DbWeight::get().reads(7 as u64)) + .saturating_add(T::DbWeight::get().writes(4 as u64)) } } diff --git a/runtime/rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs b/runtime/rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs index fa202546f9cd..551ddc5903be 100644 --- a/runtime/rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs +++ b/runtime/rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs @@ -52,38 +52,38 @@ impl WeightInfo { // Storage: Dmp DownwardMessageQueueHeads (r:1 w:1) // Storage: Dmp DownwardMessageQueues (r:1 w:1) pub(crate) fn query_holding() -> Weight { - (21_822_000 as Weight) - .saturating_add(T::DbWeight::get().reads(6 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) + Weight::from_ref_time(21_822_000 as u64) + .saturating_add(T::DbWeight::get().reads(6 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) } pub(crate) fn buy_execution() -> Weight { - (3_109_000 as Weight) + Weight::from_ref_time(3_109_000 as u64) } // Storage: XcmPallet Queries (r:1 w:0) pub(crate) fn query_response() -> Weight { - (12_087_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) + Weight::from_ref_time(12_087_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) } pub(crate) fn transact() -> Weight { - (12_398_000 as Weight) + Weight::from_ref_time(12_398_000 as u64) } pub(crate) fn refund_surplus() -> Weight { - (3_247_000 as Weight) + Weight::from_ref_time(3_247_000 as u64) } pub(crate) fn set_error_handler() -> Weight { - (3_086_000 as Weight) + Weight::from_ref_time(3_086_000 as u64) } pub(crate) fn set_appendix() -> Weight { - (3_112_000 as Weight) + Weight::from_ref_time(3_112_000 as u64) } pub(crate) fn clear_error() -> Weight { - (3_118_000 as Weight) + Weight::from_ref_time(3_118_000 as u64) } pub(crate) fn descend_origin() -> Weight { - (4_054_000 as Weight) + Weight::from_ref_time(4_054_000 as u64) } pub(crate) fn clear_origin() -> Weight { - (3_111_000 as Weight) + Weight::from_ref_time(3_111_000 as u64) } // Storage: XcmPallet SupportedVersion (r:1 w:0) // Storage: XcmPallet VersionDiscoveryQueue (r:1 w:1) @@ -92,18 +92,18 @@ impl WeightInfo { // Storage: Dmp DownwardMessageQueueHeads (r:1 w:1) // Storage: Dmp DownwardMessageQueues (r:1 w:1) pub(crate) fn report_error() -> Weight { - (18_425_000 as Weight) - .saturating_add(T::DbWeight::get().reads(6 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) + Weight::from_ref_time(18_425_000 as u64) + .saturating_add(T::DbWeight::get().reads(6 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) } // Storage: XcmPallet AssetTraps (r:1 w:1) pub(crate) fn claim_asset() -> Weight { - (7_144_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(7_144_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } pub(crate) fn trap() -> Weight { - (3_060_000 as Weight) + Weight::from_ref_time(3_060_000 as u64) } // Storage: XcmPallet VersionNotifyTargets (r:1 w:1) // Storage: XcmPallet SupportedVersion (r:1 w:0) @@ -113,14 +113,14 @@ impl WeightInfo { // Storage: Dmp DownwardMessageQueueHeads (r:1 w:1) // Storage: Dmp DownwardMessageQueues (r:1 w:1) pub(crate) fn subscribe_version() -> Weight { - (21_642_000 as Weight) - .saturating_add(T::DbWeight::get().reads(7 as Weight)) - .saturating_add(T::DbWeight::get().writes(4 as Weight)) + Weight::from_ref_time(21_642_000 as u64) + .saturating_add(T::DbWeight::get().reads(7 as u64)) + .saturating_add(T::DbWeight::get().writes(4 as u64)) } // Storage: XcmPallet VersionNotifyTargets (r:0 w:1) pub(crate) fn unsubscribe_version() -> Weight { - (4_873_000 as Weight) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(4_873_000 as u64) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: XcmPallet SupportedVersion (r:1 w:0) // Storage: XcmPallet VersionDiscoveryQueue (r:1 w:1) @@ -129,8 +129,8 @@ impl WeightInfo { // Storage: Dmp DownwardMessageQueueHeads (r:1 w:1) // Storage: Dmp DownwardMessageQueues (r:1 w:1) pub(crate) fn initiate_reserve_withdraw() -> Weight { - (22_809_000 as Weight) - .saturating_add(T::DbWeight::get().reads(6 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) + Weight::from_ref_time(22_809_000 as u64) + .saturating_add(T::DbWeight::get().reads(6 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) } } diff --git a/runtime/rococo/src/xcm_config.rs b/runtime/rococo/src/xcm_config.rs index ac5ebc2668bb..083ddb1bf081 100644 --- a/runtime/rococo/src/xcm_config.rs +++ b/runtime/rococo/src/xcm_config.rs @@ -20,7 +20,7 @@ use super::{ parachains_origin, AccountId, Balances, Call, CouncilCollective, Event, Origin, ParaId, Runtime, WeightToFee, XcmPallet, }; -use frame_support::{match_types, parameter_types, traits::Everything, weights::Weight}; +use frame_support::{match_types, parameter_types, traits::Everything}; use runtime_common::{xcm_sender, ToAuthor}; use xcm::latest::prelude::*; use xcm_builder::{ @@ -86,15 +86,11 @@ type LocalOriginConverter = ( ); parameter_types! { -<<<<<<< HEAD /// The amount of weight an XCM operation takes. This is a safe overestimate. - pub const BaseXcmWeight: Weight = 1_000_000_000; + pub const BaseXcmWeight: u64 = 1_000_000_000; /// Maximum number of instructions in a single XCM fragment. A sanity check against weight /// calculations getting too crazy. pub const MaxInstructions: u32 = 100; -======= - pub const BaseXcmWeight: u64 = 1_000_000_000; ->>>>>>> b2ff4c05ab3b299c1601952c1b1233ef62f0a7fd } /// The XCM router. When we want to send an XCM message, we use this type. It amalgamates all of our /// individual routers. From b497f49ebc7b7307cd29c5e2fdd9b520345f34e0 Mon Sep 17 00:00:00 2001 From: al3mart Date: Wed, 7 Sep 2022 15:49:32 +0200 Subject: [PATCH 35/35] Bumping number of perm/temp slots available --- runtime/rococo/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/rococo/src/lib.rs b/runtime/rococo/src/lib.rs index 01ad5617a8fb..8c7d02196cf8 100644 --- a/runtime/rococo/src/lib.rs +++ b/runtime/rococo/src/lib.rs @@ -1255,8 +1255,8 @@ impl paras_sudo_wrapper::Config for Runtime {} parameter_types! { pub const PermanentSlotLeasePeriodLength: u32 = 365; pub const TemporarySlotLeasePeriodLength: u32 = 3; - pub const MaxPermanentSlots: u32 = 25; - pub const MaxTemporarySlots: u32 = 20; + pub const MaxPermanentSlots: u32 = 40; + pub const MaxTemporarySlots: u32 = 40; pub const MaxTemporarySlotPerLeasePeriod: u32 = 5; }