diff --git a/Cargo.lock b/Cargo.lock index cc573b18cc..c577bd663a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6684,6 +6684,7 @@ dependencies = [ "pallet-session", "pallet-sudo", "pallet-timestamp", + "pallet-tips", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", "pallet-treasury", @@ -8566,6 +8567,7 @@ dependencies = [ "frame-system", "pallet-authorship", "pallet-balances", + "pallet-membership", "pallet-transaction-payment", "parachain-staking", "parity-scale-codec", @@ -10859,6 +10861,7 @@ dependencies = [ "pallet-scheduler", "pallet-session", "pallet-timestamp", + "pallet-tips", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", "pallet-treasury", diff --git a/nodes/parachain/src/chain_spec/peregrine.rs b/nodes/parachain/src/chain_spec/peregrine.rs index 78e455f3e3..0c0485ac31 100644 --- a/nodes/parachain/src/chain_spec/peregrine.rs +++ b/nodes/parachain/src/chain_spec/peregrine.rs @@ -207,6 +207,7 @@ fn testnet_genesis( phantom: Default::default(), }, treasury: Default::default(), + tips_membership: Default::default(), technical_membership: Default::default(), democracy: Default::default(), parachain_staking: ParachainStakingConfig { diff --git a/nodes/parachain/src/chain_spec/spiritnet.rs b/nodes/parachain/src/chain_spec/spiritnet.rs index e024250b8e..eb07c4ad06 100644 --- a/nodes/parachain/src/chain_spec/spiritnet.rs +++ b/nodes/parachain/src/chain_spec/spiritnet.rs @@ -337,6 +337,7 @@ fn testnet_genesis( }, treasury: Default::default(), technical_membership: Default::default(), + tips_membership: Default::default(), democracy: Default::default(), } } diff --git a/runtimes/common/Cargo.toml b/runtimes/common/Cargo.toml index ea8cc529e7..f7fc578145 100644 --- a/runtimes/common/Cargo.toml +++ b/runtimes/common/Cargo.toml @@ -20,6 +20,7 @@ frame-support = {git = "https://github.com/paritytech/substrate", default-featur frame-system = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.17"} pallet-authorship = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.17"} pallet-balances = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.17"} +pallet-membership = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.17"} pallet-transaction-payment = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.17"} sp-consensus-aura = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.17"} sp-core = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.17"} @@ -43,6 +44,7 @@ std = [ "frame-system/std", "pallet-transaction-payment/std", "pallet-balances/std", + "pallet-membership/std", "pallet-authorship/std", "scale-info/std", "serde", diff --git a/runtimes/common/src/constants.rs b/runtimes/common/src/constants.rs index aecde66dea..fb449cceec 100644 --- a/runtimes/common/src/constants.rs +++ b/runtimes/common/src/constants.rs @@ -20,7 +20,7 @@ use frame_support::{ parameter_types, weights::{constants::WEIGHT_PER_SECOND, Weight}, }; -use sp_runtime::{Perbill, Perquintill}; +use sp_runtime::{Perbill, Percent, Perquintill}; use parachain_staking::InflationInfo; @@ -408,6 +408,17 @@ pub mod preimage { } } +pub mod tips { + use super::*; + + parameter_types! { + pub const MaximumReasonLength: u32 = 16384; + pub const TipCountdown: BlockNumber = DAYS; + pub const TipFindersFee: Percent = Percent::from_percent(20); + pub const TipReportDepositBase: Balance = deposit(1, 1); + } +} + #[cfg(test)] mod tests { use super::*; diff --git a/runtimes/common/src/lib.rs b/runtimes/common/src/lib.rs index 9ff9a63900..c05f191df8 100644 --- a/runtimes/common/src/lib.rs +++ b/runtimes/common/src/lib.rs @@ -28,14 +28,19 @@ pub use sp_consensus_aura::sr25519::AuthorityId; pub use opaque::*; pub use frame_support::weights::constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}; -use frame_support::{parameter_types, traits::Currency, weights::DispatchClass}; +use frame_support::{ + parameter_types, + traits::{Contains, ContainsLengthBound, Currency, Get, SortedMembers}, + weights::DispatchClass, +}; use frame_system::limits; use pallet_transaction_payment::{Multiplier, TargetedFeeAdjustment}; use sp_runtime::{ generic, traits::{IdentifyAccount, Verify}, - FixedPointNumber, MultiSignature, Perquintill, + FixedPointNumber, MultiSignature, Perquintill, SaturatedConversion, }; +use sp_std::marker::PhantomData; pub mod authorization; pub mod constants; @@ -153,3 +158,35 @@ pub type FeeSplit = SplitFeesByRatio; /// https://w3f-research.readthedocs.io/en/latest/polkadot/Token%20Economics.html#-2.-slow-adjusting-mechanism pub type SlowAdjustingFeeUpdate = TargetedFeeAdjustment; + +pub struct Tippers(PhantomData, PhantomData); +impl ContainsLengthBound for Tippers +where + R: pallet_membership::Config, +{ + fn max_len() -> usize { + >::MaxMembers::get().saturated_into() + } + + fn min_len() -> usize { + 0 + } +} + +impl SortedMembers for Tippers +where + R: pallet_membership::Config, + pallet_membership::Pallet: SortedMembers + Contains, +{ + fn sorted_members() -> sp_std::vec::Vec { + pallet_membership::Pallet::::sorted_members() + } + + #[cfg(feature = "runtime-benchmarks")] + fn add(who: &R::AccountId) { + pallet_membership::Members::::mutate(|members| match members.binary_search_by(|m| m.cmp(who)) { + Ok(_) => (), + Err(pos) => members.insert(pos, who.clone()), + }) + } +} diff --git a/runtimes/peregrine/Cargo.toml b/runtimes/peregrine/Cargo.toml index 6682e4c3c2..10dd488b98 100644 --- a/runtimes/peregrine/Cargo.toml +++ b/runtimes/peregrine/Cargo.toml @@ -67,6 +67,7 @@ pallet-scheduler = {git = "https://github.com/paritytech/substrate", default-fea pallet-session = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.17"} pallet-sudo = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.17"} pallet-timestamp = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.17"} +pallet-tips = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.17"} pallet-transaction-payment = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.17"} pallet-treasury = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.17"} pallet-utility = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.17"} @@ -122,6 +123,7 @@ runtime-benchmarks = [ "pallet-preimage/runtime-benchmarks", "pallet-scheduler/runtime-benchmarks", "pallet-timestamp/runtime-benchmarks", + "pallet-tips/runtime-benchmarks", "pallet-treasury/runtime-benchmarks", "pallet-vesting/runtime-benchmarks", "pallet-web3-names/runtime-benchmarks", @@ -166,6 +168,7 @@ std = [ "pallet-session/std", "pallet-sudo/std", "pallet-timestamp/std", + "pallet-tips/std", "pallet-transaction-payment-rpc-runtime-api/std", "pallet-transaction-payment/std", "pallet-treasury/std", @@ -220,6 +223,7 @@ try-runtime = [ "pallet-session/try-runtime", "pallet-sudo/try-runtime", "pallet-timestamp/try-runtime", + "pallet-tips/try-runtime", "pallet-transaction-payment/try-runtime", "pallet-treasury/try-runtime", "pallet-web3-names/try-runtime", diff --git a/runtimes/peregrine/src/lib.rs b/runtimes/peregrine/src/lib.rs index 9e149f293c..8308f48b06 100644 --- a/runtimes/peregrine/src/lib.rs +++ b/runtimes/peregrine/src/lib.rs @@ -462,7 +462,8 @@ impl pallet_collective::Config for Runtime { type WeightInfo = weights::pallet_collective::WeightInfo; } -impl pallet_membership::Config for Runtime { +type TechnicalMembershipProvider = pallet_membership::Instance1; +impl pallet_membership::Config for Runtime { type Event = Event; type AddOrigin = MoreThanHalfCouncil; type RemoveOrigin = MoreThanHalfCouncil; @@ -475,6 +476,31 @@ impl pallet_membership::Config for Runtime { type WeightInfo = weights::pallet_membership::WeightInfo; } +type TipsMembershipProvider = pallet_membership::Instance2; +impl pallet_membership::Config for Runtime { + type Event = Event; + type AddOrigin = MoreThanHalfCouncil; + type RemoveOrigin = MoreThanHalfCouncil; + type SwapOrigin = MoreThanHalfCouncil; + type ResetOrigin = MoreThanHalfCouncil; + type PrimeOrigin = MoreThanHalfCouncil; + type MembershipInitialized = (); + type MembershipChanged = (); + type MaxMembers = constants::governance::TechnicalMaxMembers; + type WeightInfo = weights::pallet_membership::WeightInfo; +} + +impl pallet_tips::Config for Runtime { + type MaximumReasonLength = constants::tips::MaximumReasonLength; + type DataDepositPerByte = constants::ByteDeposit; + type Tippers = runtime_common::Tippers; + type TipCountdown = constants::tips::TipCountdown; + type TipFindersFee = constants::tips::TipFindersFee; + type TipReportDepositBase = constants::tips::TipReportDepositBase; + type Event = Event; + type WeightInfo = weights::pallet_tips::WeightInfo; +} + impl attestation::Config for Runtime { type EnsureOrigin = did::EnsureDidOrigin; type OriginSuccess = did::DidRawOrigin; @@ -700,6 +726,7 @@ impl InstanceFilter for ProxyType { | Call::System(..) | Call::TechnicalCommittee(..) | Call::TechnicalMembership(..) + | Call::TipsMembership(..) | Call::Timestamp(..) | Call::Treasury(..) | Call::Utility(..) @@ -780,6 +807,7 @@ impl InstanceFilter for ProxyType { | Call::Democracy(..) | Call::TechnicalCommittee(..) | Call::TechnicalMembership(..) + | Call::TipsMembership(..) | Call::Treasury(..) | Call::Utility(..) ), ProxyType::ParachainStaking => { @@ -850,7 +878,7 @@ construct_runtime! { Council: pallet_collective:: = 31, TechnicalCommittee: pallet_collective:: = 32, // placeholder: parachain council election = 33, - TechnicalMembership: pallet_membership = 34, + TechnicalMembership: pallet_membership:: = 34, Treasury: pallet_treasury = 35, // Utility module. @@ -868,6 +896,10 @@ construct_runtime! { // Preimage registrar Preimage: pallet_preimage::{Pallet, Call, Storage, Event} = 44, + // Tips module to reward contributions to the ecosystem with small amount of KILTs. + TipsMembership: pallet_membership:: = 45, + Tips: pallet_tips::{Pallet, Call, Storage, Event} = 46, + // KILT Pallets. Start indices 60 to leave room KiltLaunch: kilt_launch = 60, Ctype: ctype = 61, @@ -1098,6 +1130,7 @@ impl_runtime_apis! { list_benchmark!(list, extra, pallet_preimage, Preimage); list_benchmark!(list, extra, pallet_scheduler, Scheduler); list_benchmark!(list, extra, pallet_timestamp, Timestamp); + list_benchmark!(list, extra, pallet_tips, Tips); list_benchmark!(list, extra, pallet_treasury, Treasury); list_benchmark!(list, extra, pallet_utility, Utility); list_benchmark!(list, extra, pallet_vesting, Vesting); @@ -1166,6 +1199,7 @@ impl_runtime_apis! { add_benchmark!(params, batches, pallet_session, SessionBench::); add_benchmark!(params, batches, frame_system, SystemBench::); add_benchmark!(params, batches, pallet_timestamp, Timestamp); + add_benchmark!(params, batches, pallet_tips, Tips); add_benchmark!(params, batches, pallet_treasury, Treasury); add_benchmark!(params, batches, pallet_utility, Utility); add_benchmark!(params, batches, pallet_vesting, Vesting); diff --git a/runtimes/peregrine/src/weights/mod.rs b/runtimes/peregrine/src/weights/mod.rs index 112cd38e0f..a135ba0de6 100644 --- a/runtimes/peregrine/src/weights/mod.rs +++ b/runtimes/peregrine/src/weights/mod.rs @@ -34,6 +34,7 @@ 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_vesting; diff --git a/runtimes/peregrine/src/weights/pallet_tips.rs b/runtimes/peregrine/src/weights/pallet_tips.rs new file mode 100644 index 0000000000..0eb673cc5b --- /dev/null +++ b/runtimes/peregrine/src/weights/pallet_tips.rs @@ -0,0 +1,107 @@ +// KILT Blockchain – https://botlabs.org +// Copyright (C) 2019-2022 BOTLabs GmbH + +// The KILT Blockchain 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. + +// The KILT Blockchain 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 this program. If not, see . + +// If you feel like getting in touch with us, you can do so at info@botlabs.org + +//! Autogenerated weights for pallet_tips +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-04-07, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 + +// Executed Command: +// target/release/kilt-parachain +// benchmark +// --chain=dev +// --steps=50 +// --repeat=20 +// --pallet=pallet-tips +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./runtimes/peregrine/src/weights/pallet_tips.rs +// --template=.maintain/runtime-weight-template.hbs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(clippy::unnecessary_cast)] + +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 { + (40_320_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 { + (36_908_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: TipsMembership 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 { + (26_418_000 as Weight) + // Standard Error: 0 + .saturating_add((2_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 0 + .saturating_add((102_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: TipsMembership Members (r:1 w:0) + // Storage: Tips Tips (r:1 w:1) + fn tip(t: u32, ) -> Weight { + (15_519_000 as Weight) + // Standard Error: 0 + .saturating_add((457_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: TipsMembership Members (r:1 w:0) + // Storage: System Account (r:2 w:2) + // Storage: Tips Reasons (r:0 w:1) + fn close_tip(t: u32, ) -> Weight { + (64_426_000 as Weight) + // Standard Error: 0 + .saturating_add((300_000 as Weight).saturating_mul(t as Weight)) + .saturating_add(T::DbWeight::get().reads(4 as Weight)) + .saturating_add(T::DbWeight::get().writes(4 as Weight)) + } + // Storage: Tips Tips (r:1 w:1) + // Storage: Tips Reasons (r:0 w:1) + fn slash_tip(t: u32, ) -> Weight { + (22_294_000 as Weight) + // Standard Error: 0 + .saturating_add((6_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/runtimes/spiritnet/Cargo.toml b/runtimes/spiritnet/Cargo.toml index d0278bb7be..0a263a98d2 100644 --- a/runtimes/spiritnet/Cargo.toml +++ b/runtimes/spiritnet/Cargo.toml @@ -66,6 +66,7 @@ pallet-randomness-collective-flip = {git = "https://github.com/paritytech/substr pallet-scheduler = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.17"} pallet-session = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.17"} pallet-timestamp = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.17"} +pallet-tips = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.17"} pallet-transaction-payment = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.17"} pallet-treasury = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.17"} pallet-utility = {git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.17"} @@ -123,6 +124,7 @@ runtime-benchmarks = [ "pallet-proxy/runtime-benchmarks", "pallet-scheduler/runtime-benchmarks", "pallet-timestamp/runtime-benchmarks", + "pallet-tips/runtime-benchmarks", "pallet-treasury/runtime-benchmarks", "pallet-web3-names/runtime-benchmarks", "pallet-utility/runtime-benchmarks", @@ -166,6 +168,7 @@ std = [ "pallet-scheduler/std", "pallet-session/std", "pallet-timestamp/std", + "pallet-tips/std", "pallet-transaction-payment-rpc-runtime-api/std", "pallet-transaction-payment/std", "pallet-treasury/std", @@ -220,6 +223,7 @@ try-runtime = [ "pallet-scheduler/try-runtime", "pallet-session/try-runtime", "pallet-timestamp/try-runtime", + "pallet-tips/try-runtime", "pallet-transaction-payment/try-runtime", "pallet-treasury/try-runtime", "pallet-web3-names/try-runtime", diff --git a/runtimes/spiritnet/src/lib.rs b/runtimes/spiritnet/src/lib.rs index 51ee5764f8..ed539990e8 100644 --- a/runtimes/spiritnet/src/lib.rs +++ b/runtimes/spiritnet/src/lib.rs @@ -467,7 +467,8 @@ impl pallet_collective::Config for Runtime { type WeightInfo = weights::pallet_collective::WeightInfo; } -impl pallet_membership::Config for Runtime { +type TechnicalMembershipProvider = pallet_membership::Instance1; +impl pallet_membership::Config for Runtime { type Event = Event; type AddOrigin = MoreThanHalfCouncil; type RemoveOrigin = MoreThanHalfCouncil; @@ -480,6 +481,31 @@ impl pallet_membership::Config for Runtime { type WeightInfo = weights::pallet_membership::WeightInfo; } +type TipsMembershipProvider = pallet_membership::Instance2; +impl pallet_membership::Config for Runtime { + type Event = Event; + type AddOrigin = MoreThanHalfCouncil; + type RemoveOrigin = MoreThanHalfCouncil; + type SwapOrigin = MoreThanHalfCouncil; + type ResetOrigin = MoreThanHalfCouncil; + type PrimeOrigin = MoreThanHalfCouncil; + type MembershipInitialized = (); + type MembershipChanged = (); + type MaxMembers = constants::governance::TechnicalMaxMembers; + type WeightInfo = weights::pallet_membership::WeightInfo; +} + +impl pallet_tips::Config for Runtime { + type MaximumReasonLength = constants::tips::MaximumReasonLength; + type DataDepositPerByte = constants::ByteDeposit; + type Tippers = runtime_common::Tippers; + type TipCountdown = constants::tips::TipCountdown; + type TipFindersFee = constants::tips::TipFindersFee; + type TipReportDepositBase = constants::tips::TipReportDepositBase; + type Event = Event; + type WeightInfo = weights::pallet_tips::WeightInfo; +} + impl attestation::Config for Runtime { type EnsureOrigin = did::EnsureDidOrigin; type OriginSuccess = did::DidRawOrigin; @@ -704,6 +730,7 @@ impl InstanceFilter for ProxyType { | Call::System(..) | Call::TechnicalCommittee(..) | Call::TechnicalMembership(..) + | Call::TipsMembership(..) | Call::Timestamp(..) | Call::Treasury(..) | Call::Utility(..) @@ -766,6 +793,7 @@ impl InstanceFilter for ProxyType { | Call::System(..) | Call::TechnicalCommittee(..) | Call::TechnicalMembership(..) + | Call::TipsMembership(..) | Call::Timestamp(..) | Call::Treasury(..) | Call::Utility(..) @@ -783,6 +811,7 @@ impl InstanceFilter for ProxyType { | Call::Democracy(..) | Call::TechnicalCommittee(..) | Call::TechnicalMembership(..) + | Call::TipsMembership(..) | Call::Treasury(..) | Call::Utility(..) ), ProxyType::ParachainStaking => { @@ -852,7 +881,7 @@ construct_runtime! { Council: pallet_collective:: = 31, TechnicalCommittee: pallet_collective:: = 32, // placeholder: parachain council election = 33, - TechnicalMembership: pallet_membership = 34, + TechnicalMembership: pallet_membership:: = 34, Treasury: pallet_treasury = 35, // Utility module. @@ -870,6 +899,10 @@ construct_runtime! { // Preimage registrar Preimage: pallet_preimage::{Pallet, Call, Storage, Event} = 44, + // Tips module to reward contributions to the ecosystem with small amount of KILTs. + TipsMembership: pallet_membership:: = 45, + Tips: pallet_tips::{Pallet, Call, Storage, Event} = 46, + // KILT Pallets. Start indices 60 to leave room KiltLaunch: kilt_launch = 60, Ctype: ctype = 61, @@ -1100,6 +1133,7 @@ impl_runtime_apis! { list_benchmark!(list, extra, pallet_preimage, Preimage); list_benchmark!(list, extra, pallet_scheduler, Scheduler); list_benchmark!(list, extra, pallet_timestamp, Timestamp); + list_benchmark!(list, extra, pallet_tips, Tips); list_benchmark!(list, extra, pallet_treasury, Treasury); list_benchmark!(list, extra, pallet_utility, Utility); list_benchmark!(list, extra, pallet_vesting, Vesting); @@ -1168,6 +1202,7 @@ impl_runtime_apis! { add_benchmark!(params, batches, pallet_session, SessionBench::); add_benchmark!(params, batches, frame_system, SystemBench::); add_benchmark!(params, batches, pallet_timestamp, Timestamp); + add_benchmark!(params, batches, pallet_tips, Tips); add_benchmark!(params, batches, pallet_treasury, Treasury); add_benchmark!(params, batches, pallet_utility, Utility); add_benchmark!(params, batches, pallet_vesting, Vesting); diff --git a/runtimes/spiritnet/src/weights/mod.rs b/runtimes/spiritnet/src/weights/mod.rs index 112cd38e0f..a135ba0de6 100644 --- a/runtimes/spiritnet/src/weights/mod.rs +++ b/runtimes/spiritnet/src/weights/mod.rs @@ -34,6 +34,7 @@ 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_vesting; diff --git a/runtimes/spiritnet/src/weights/pallet_tips.rs b/runtimes/spiritnet/src/weights/pallet_tips.rs new file mode 100644 index 0000000000..14a1d3b8f2 --- /dev/null +++ b/runtimes/spiritnet/src/weights/pallet_tips.rs @@ -0,0 +1,107 @@ +// KILT Blockchain – https://botlabs.org +// Copyright (C) 2019-2022 BOTLabs GmbH + +// The KILT Blockchain 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. + +// The KILT Blockchain 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 this program. If not, see . + +// If you feel like getting in touch with us, you can do so at info@botlabs.org + +//! Autogenerated weights for pallet_tips +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-04-07, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("spiritnet-dev"), DB CACHE: 1024 + +// Executed Command: +// target/release/kilt-parachain +// benchmark +// --chain=spiritnet-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet-tips +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./runtimes/spiritnet/src/weights/pallet_tips.rs +// --template=.maintain/runtime-weight-template.hbs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(clippy::unnecessary_cast)] + +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 { + (39_849_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 { + (37_338_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: TipsMembership 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 { + (25_363_000 as Weight) + // Standard Error: 0 + .saturating_add((2_000 as Weight).saturating_mul(r as Weight)) + // Standard Error: 0 + .saturating_add((109_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: TipsMembership Members (r:1 w:0) + // Storage: Tips Tips (r:1 w:1) + fn tip(t: u32, ) -> Weight { + (15_884_000 as Weight) + // Standard Error: 0 + .saturating_add((450_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: TipsMembership Members (r:1 w:0) + // Storage: System Account (r:2 w:2) + // Storage: Tips Reasons (r:0 w:1) + fn close_tip(t: u32, ) -> Weight { + (64_138_000 as Weight) + // Standard Error: 0 + .saturating_add((283_000 as Weight).saturating_mul(t as Weight)) + .saturating_add(T::DbWeight::get().reads(4 as Weight)) + .saturating_add(T::DbWeight::get().writes(4 as Weight)) + } + // Storage: Tips Tips (r:1 w:1) + // Storage: Tips Reasons (r:0 w:1) + fn slash_tip(t: u32, ) -> Weight { + (22_105_000 as Weight) + // Standard Error: 0 + .saturating_add((6_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)) + } +}