diff --git a/node/service/src/chain_spec.rs b/node/service/src/chain_spec.rs index d4dfcdd59706..90b690d4bd93 100644 --- a/node/service/src/chain_spec.rs +++ b/node/service/src/chain_spec.rs @@ -245,6 +245,7 @@ fn polkadot_staging_testnet_config_genesis(wasm_binary: &[u8]) -> polkadot::Gene vesting: vec![], }), pallet_vesting: Some(polkadot::VestingConfig { vesting: vec![] }), + pallet_treasury: Some(Default::default()), } } @@ -627,6 +628,7 @@ fn kusama_staging_testnet_config_genesis(wasm_binary: &[u8]) -> kusama::GenesisC vesting: vec![], }), pallet_vesting: Some(kusama::VestingConfig { vesting: vec![] }), + pallet_treasury: Some(Default::default()), } } @@ -1083,6 +1085,7 @@ pub fn polkadot_testnet_genesis( vesting: vec![], }), pallet_vesting: Some(polkadot::VestingConfig { vesting: vec![] }), + pallet_treasury: Some(Default::default()), } } @@ -1177,6 +1180,7 @@ pub fn kusama_testnet_genesis( vesting: vec![], }), pallet_vesting: Some(kusama::VestingConfig { vesting: vec![] }), + pallet_treasury: Some(Default::default()), } } diff --git a/runtime/kusama/Cargo.toml b/runtime/kusama/Cargo.toml index 9a7e1028a832..d6bf2276adc0 100644 --- a/runtime/kusama/Cargo.toml +++ b/runtime/kusama/Cargo.toml @@ -34,6 +34,7 @@ pallet-authority-discovery = { git = "https://github.com/paritytech/substrate", 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-balances = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-bounties = { git = "https://github.com/shamb0/substrate.git", branch = "issue-7143-pallet-treasury-refactor", 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 } @@ -60,7 +61,8 @@ pallet-staking-reward-curve = { package = "pallet-staking-reward-curve", git = " 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-treasury = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-tips = { git = "https://github.com/shamb0/substrate.git", branch = "issue-7143-pallet-treasury-refactor", default-features = false } +pallet-treasury = { git = "https://github.com/shamb0/substrate.git", branch = "issue-7143-pallet-treasury-refactor", 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 } @@ -107,6 +109,7 @@ std = [ "frame-support/std", "pallet-authorship/std", "pallet-balances/std", + "pallet-bounties/std", "pallet-transaction-payment/std", "pallet-transaction-payment-rpc-runtime-api/std", "pallet-collective/std", @@ -132,6 +135,7 @@ std = [ "frame-system/std", "frame-system-rpc-runtime-api/std", "pallet-timestamp/std", + "pallet-tips/std", "pallet-treasury/std", "sp-version/std", "pallet-utility/std", @@ -153,6 +157,7 @@ runtime-benchmarks = [ "sp-runtime/runtime-benchmarks", "pallet-babe/runtime-benchmarks", "pallet-balances/runtime-benchmarks", + "pallet-bounties/runtime-benchmarks", "pallet-collective/runtime-benchmarks", "pallet-democracy/runtime-benchmarks", "pallet-elections-phragmen/runtime-benchmarks", @@ -166,6 +171,7 @@ runtime-benchmarks = [ "pallet-society/runtime-benchmarks", "pallet-staking/runtime-benchmarks", "pallet-timestamp/runtime-benchmarks", + "pallet-tips/runtime-benchmarks", "pallet-treasury/runtime-benchmarks", "pallet-utility/runtime-benchmarks", "pallet-vesting/runtime-benchmarks", diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index 31d92bd0195a..e5c56573b3bb 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -559,10 +559,6 @@ impl pallet_treasury::Config for Runtime { type Currency = Balances; type ApproveOrigin = ApproveOrigin; type RejectOrigin = MoreThanHalfCouncil; - type Tippers = ElectionsPhragmen; - type TipCountdown = TipCountdown; - type TipFindersFee = TipFindersFee; - type TipReportDepositBase = TipReportDepositBase; type DataDepositPerByte = DataDepositPerByte; type Event = Event; type OnSlash = Treasury; @@ -570,14 +566,30 @@ impl pallet_treasury::Config for Runtime { type ProposalBondMinimum = ProposalBondMinimum; type SpendPeriod = SpendPeriod; type Burn = Burn; + type MaximumReasonLength = MaximumReasonLength; + type BurnDestination = Society; + type SpendFunds = Bounties; + type WeightInfo = weights::pallet_treasury::WeightInfo; +} + +impl pallet_bounties::Config for Runtime { + type Event = Event; type BountyDepositBase = BountyDepositBase; type BountyDepositPayoutDelay = BountyDepositPayoutDelay; type BountyUpdatePeriod = BountyUpdatePeriod; - type MaximumReasonLength = MaximumReasonLength; type BountyCuratorDeposit = BountyCuratorDeposit; type BountyValueMinimum = BountyValueMinimum; - type BurnDestination = Society; - type WeightInfo = weights::pallet_treasury::WeightInfo; + type WeightInfo = weights::pallet_bounties::WeightInfo; + +} + +impl pallet_tips::Config for Runtime { + type Event = Event; + type Tippers = ElectionsPhragmen; + type TipCountdown = TipCountdown; + type TipFindersFee = TipFindersFee; + type TipReportDepositBase = TipReportDepositBase; + type WeightInfo = weights::pallet_tips::WeightInfo; } parameter_types! { @@ -1185,7 +1197,8 @@ construct_runtime! { TechnicalCommittee: pallet_collective::::{Module, Call, Storage, Origin, Event, Config} = 15, ElectionsPhragmen: pallet_elections_phragmen::{Module, Call, Storage, Event, Config} = 16, TechnicalMembership: pallet_membership::::{Module, Call, Storage, Event, Config} = 17, - Treasury: pallet_treasury::{Module, Call, Storage, Event} = 18, + // Treasury: pallet_treasury::{Module, Call, Storage, Event} = 18, + Treasury: pallet_treasury::{Module, Call, Storage, Config, Event} = 18, // Claims. Usable initially. Claims: claims::{Module, Call, Storage, Event, Config, ValidateUnsigned} = 19, @@ -1213,6 +1226,12 @@ construct_runtime! { // Multisig module. Late addition. Multisig: pallet_multisig::{Module, Call, Storage, Event} = 31, + + // Bounties module. + Bounties: pallet_bounties::{Module, Call, Storage, Event} = 35, + + // Tips module. + Tips: pallet_tips::{Module, Call, Storage, Event} = 36, } } @@ -1546,6 +1565,9 @@ sp_api::impl_runtime_apis! { add_benchmark!(params, batches, pallet_utility, Utility); add_benchmark!(params, batches, pallet_vesting, Vesting); + add_benchmark!(params, batches, pallet_bounties, Bounties); + add_benchmark!(params, batches, pallet_tips, Tips); + if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) } Ok(batches) } diff --git a/runtime/kusama/src/weights/mod.rs b/runtime/kusama/src/weights/mod.rs index 19269d02611e..0411000b1c3f 100644 --- a/runtime/kusama/src/weights/mod.rs +++ b/runtime/kusama/src/weights/mod.rs @@ -32,3 +32,5 @@ pub mod pallet_timestamp; pub mod pallet_treasury; pub mod pallet_utility; pub mod pallet_vesting; +pub mod pallet_bounties; +pub mod pallet_tips; diff --git a/runtime/kusama/src/weights/pallet_bounties.rs b/runtime/kusama/src/weights/pallet_bounties.rs new file mode 100644 index 000000000000..c89c5a9a18c2 --- /dev/null +++ b/runtime/kusama/src/weights/pallet_bounties.rs @@ -0,0 +1,106 @@ +// This file is part of Substrate. + +// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Autogenerated weights for pallet_bounties +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 +//! DATE: 2020-11-20, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 + +// Executed Command: +// target/release/substrate +// benchmark +// --chain=dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_bounties +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./frame/bounties/src/weights.rs +// --template=./.maintain/frame-weight-template.hbs + +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weights for pallet_bounties using the Substrate node and recommended hardware. +pub struct WeightInfo(PhantomData); +impl WeightInfo for WeightInfo { + fn propose_bounty(d: u32, ) -> Weight { + (59_931_000 as Weight) + .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)) + } + fn approve_bounty() -> Weight { + (17_226_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + fn propose_curator() -> Weight { + (13_314_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + fn unassign_curator() -> Weight { + (48_677_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + fn accept_curator() -> Weight { + (48_727_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + fn award_bounty() -> Weight { + (34_839_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + fn claim_bounty() -> Weight { + (64_883_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + fn close_bounty_proposed() -> Weight { + (48_003_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + fn close_bounty_active() -> Weight { + (62_215_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + fn extend_bounty_expiry() -> Weight { + (33_748_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + fn spend_funds(b: u32, ) -> Weight { + (3_688_000 as Weight) + .saturating_add((70_129_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/kusama/src/weights/pallet_tips.rs b/runtime/kusama/src/weights/pallet_tips.rs new file mode 100644 index 000000000000..e91744b139ad --- /dev/null +++ b/runtime/kusama/src/weights/pallet_tips.rs @@ -0,0 +1,77 @@ +// This file is part of Substrate. + +// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Autogenerated weights for pallet_tips +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 +//! DATE: 2020-11-20, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 + +// Executed Command: +// target/release/substrate +// benchmark +// --chain=dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_tips +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./frame/tips/src/weights.rs +// --template=./.maintain/frame-weight-template.hbs + +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weights for pallet_tips using the Substrate node and recommended hardware. +pub struct WeightInfo(PhantomData); +impl WeightInfo for WeightInfo { + fn report_awesome(r: u32, ) -> Weight { + (70_338_000 as Weight) + .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)) + } + fn retract_tip() -> Weight { + (59_051_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + fn tip_new(r: u32, t: u32, ) -> Weight { + (41_984_000 as Weight) + .saturating_add((2_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((180_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)) + } + fn tip(t: u32, ) -> Weight { + (33_313_000 as Weight) + .saturating_add((700_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)) + } + fn close_tip(t: u32, ) -> Weight { + (110_781_000 as Weight) + .saturating_add((364_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)) + } +} diff --git a/runtime/kusama/src/weights/pallet_treasury.rs b/runtime/kusama/src/weights/pallet_treasury.rs index 73e1b6a82a35..43ed53f898b0 100644 --- a/runtime/kusama/src/weights/pallet_treasury.rs +++ b/runtime/kusama/src/weights/pallet_treasury.rs @@ -44,123 +44,26 @@ use sp_std::marker::PhantomData; pub struct WeightInfo(PhantomData); impl pallet_treasury::WeightInfo for WeightInfo { fn propose_spend() -> Weight { - (53_899_000 as Weight) + (55_957_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } fn reject_proposal() -> Weight { - (84_208_000 as Weight) + (45_616_000 as Weight) .saturating_add(T::DbWeight::get().reads(2 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } fn approve_proposal() -> Weight { - (11_576_000 as Weight) + (13_362_000 as Weight) .saturating_add(T::DbWeight::get().reads(2 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } - fn report_awesome(r: u32, ) -> Weight { - (66_679_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)) - } - fn retract_tip() -> Weight { - (56_703_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn tip_new(r: u32, t: u32, ) -> Weight { - (42_139_000 as Weight) - // Standard Error: 0 - .saturating_add((2_000 as Weight).saturating_mul(r as Weight)) - // Standard Error: 0 - .saturating_add((144_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)) - } - fn tip(t: u32, ) -> Weight { - (27_980_000 as Weight) - // Standard Error: 1_000 - .saturating_add((691_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)) - } - fn close_tip(t: u32, ) -> Weight { - (105_039_000 as Weight) - // Standard Error: 0 - .saturating_add((360_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)) - } - fn propose_bounty(d: u32, ) -> Weight { - (57_452_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)) - } - fn approve_bounty() -> Weight { - (15_509_000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn propose_curator() -> Weight { - (12_403_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn unassign_curator() -> Weight { - (68_535_000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn accept_curator() -> Weight { - (48_001_000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn award_bounty() -> Weight { - (33_291_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn claim_bounty() -> Weight { - (159_266_000 as Weight) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().writes(5 as Weight)) - } - fn close_bounty_proposed() -> Weight { - (67_667_000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - } - fn close_bounty_active() -> Weight { - (105_482_000 as Weight) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(4 as Weight)) - } - fn extend_bounty_expiry() -> Weight { - (32_502_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } fn on_initialize_proposals(p: u32, ) -> Weight { - (108_437_000 as Weight) - // Standard Error: 16_000 - .saturating_add((70_932_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) + (74_689_000 as Weight) + .saturating_add((71_943_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(2 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(2 as Weight)) .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(p as Weight))) } - fn on_initialize_bounties(b: u32, ) -> Weight { - (105_767_000 as Weight) - // Standard Error: 17_000 - .saturating_add((70_197_000 as Weight).saturating_mul(b as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(b as Weight))) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(b as Weight))) - } } diff --git a/runtime/polkadot/Cargo.toml b/runtime/polkadot/Cargo.toml index 5a4a71a315ce..b3ef39dd6dfc 100644 --- a/runtime/polkadot/Cargo.toml +++ b/runtime/polkadot/Cargo.toml @@ -34,6 +34,7 @@ pallet-authority-discovery = { git = "https://github.com/paritytech/substrate", 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-balances = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-bounties = { git = "https://github.com/shamb0/substrate.git", branch = "issue-7143-pallet-treasury-refactor", 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 } @@ -58,7 +59,8 @@ pallet-staking-reward-curve = { git = "https://github.com/paritytech/substrate", 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-treasury = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-tips = { git = "https://github.com/shamb0/substrate.git", branch = "issue-7143-pallet-treasury-refactor", default-features = false } +pallet-treasury = { git = "https://github.com/shamb0/substrate.git", branch = "issue-7143-pallet-treasury-refactor", default-features = false } pallet-vesting = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-utility = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -104,6 +106,7 @@ std = [ "frame-support/std", "pallet-authorship/std", "pallet-balances/std", + "pallet-bounties/std", "pallet-transaction-payment/std", "pallet-transaction-payment-rpc-runtime-api/std", "pallet-collective/std", @@ -128,6 +131,7 @@ std = [ "frame-system-rpc-runtime-api/std", "pallet-timestamp/std", "pallet-treasury/std", + "pallet-tips/std", "sp-version/std", "serde_derive", "serde/std", diff --git a/runtime/polkadot/src/lib.rs b/runtime/polkadot/src/lib.rs index 5721ef40cc2f..551b326ab08a 100644 --- a/runtime/polkadot/src/lib.rs +++ b/runtime/polkadot/src/lib.rs @@ -123,7 +123,8 @@ impl Filter for BaseFilter { Call::Session(_) | Call::Grandpa(_) | Call::ImOnline(_) | Call::AuthorityDiscovery(_) | Call::Utility(_) | Call::Claims(_) | Call::Vesting(_) | - Call::Identity(_) | Call::Proxy(_) | Call::Multisig(_) + Call::Identity(_) | Call::Proxy(_) | Call::Multisig(_) | + Call::Bounties(_) | Call::Tips(_) => true, } } @@ -605,10 +606,6 @@ impl pallet_treasury::Config for Runtime { type Currency = Balances; type ApproveOrigin = ApproveOrigin; type RejectOrigin = MoreThanHalfCouncil; - type Tippers = ElectionsPhragmen; - type TipCountdown = TipCountdown; - type TipFindersFee = TipFindersFee; - type TipReportDepositBase = TipReportDepositBase; type DataDepositPerByte = DataDepositPerByte; type Event = Event; type OnSlash = Treasury; @@ -616,14 +613,29 @@ impl pallet_treasury::Config for Runtime { type ProposalBondMinimum = ProposalBondMinimum; type SpendPeriod = SpendPeriod; type Burn = Burn; + type MaximumReasonLength = MaximumReasonLength; + type BurnDestination = (); + type SpendFunds = Bounties; + type WeightInfo = weights::pallet_treasury::WeightInfo; +} + +impl pallet_bounties::Config for Runtime { + type Event = Event; type BountyDepositBase = BountyDepositBase; type BountyDepositPayoutDelay = BountyDepositPayoutDelay; type BountyUpdatePeriod = BountyUpdatePeriod; - type MaximumReasonLength = MaximumReasonLength; type BountyCuratorDeposit = BountyCuratorDeposit; type BountyValueMinimum = BountyValueMinimum; - type BurnDestination = (); - type WeightInfo = weights::pallet_treasury::WeightInfo; + type WeightInfo = weights::pallet_bounties::WeightInfo; +} + +impl pallet_tips::Config for Runtime { + type Event = Event; + type Tippers = ElectionsPhragmen; + type TipCountdown = TipCountdown; + type TipFindersFee = TipFindersFee; + type TipReportDepositBase = TipReportDepositBase; + type WeightInfo = weights::pallet_tips::WeightInfo; } parameter_types! { @@ -969,7 +981,8 @@ construct_runtime! { TechnicalCommittee: pallet_collective::::{Module, Call, Storage, Origin, Event, Config} = 16, ElectionsPhragmen: pallet_elections_phragmen::{Module, Call, Storage, Event, Config} = 17, TechnicalMembership: pallet_membership::::{Module, Call, Storage, Event, Config} = 18, - Treasury: pallet_treasury::{Module, Call, Storage, Event} = 19, + // Treasury: pallet_treasury::{Module, Call, Storage, Event} = 19, + Treasury: pallet_treasury::{Module, Call, Storage, Config, Event} = 19, // Claims. Usable initially. Claims: claims::{Module, Call, Storage, Event, Config, ValidateUnsigned} = 24, @@ -986,6 +999,13 @@ construct_runtime! { // Multisig dispatch. Late addition. Multisig: pallet_multisig::{Module, Call, Storage, Event} = 30, + + // Bounties module. + Bounties: pallet_bounties::{Module, Call, Storage, Event} = 34, + + // Tips module. + Tips: pallet_tips::{Module, Call, Storage, Event} = 35, + } } @@ -1319,6 +1339,9 @@ sp_api::impl_runtime_apis! { add_benchmark!(params, batches, pallet_utility, Utility); add_benchmark!(params, batches, pallet_vesting, Vesting); + add_benchmark!(params, batches, pallet_bounties, Bounties); + add_benchmark!(params, batches, pallet_tips, Tips); + if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) } Ok(batches) } diff --git a/runtime/polkadot/src/weights/mod.rs b/runtime/polkadot/src/weights/mod.rs index 19269d02611e..0411000b1c3f 100644 --- a/runtime/polkadot/src/weights/mod.rs +++ b/runtime/polkadot/src/weights/mod.rs @@ -32,3 +32,5 @@ pub mod pallet_timestamp; pub mod pallet_treasury; pub mod pallet_utility; pub mod pallet_vesting; +pub mod pallet_bounties; +pub mod pallet_tips; diff --git a/runtime/polkadot/src/weights/pallet_bounties.rs b/runtime/polkadot/src/weights/pallet_bounties.rs new file mode 100644 index 000000000000..68c20726efa6 --- /dev/null +++ b/runtime/polkadot/src/weights/pallet_bounties.rs @@ -0,0 +1,107 @@ +// This file is part of Substrate. + +// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Autogenerated weights for pallet_bounties +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 +//! DATE: 2020-11-20, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 + +// Executed Command: +// target/release/substrate +// benchmark +// --chain=dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_bounties +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./frame/bounties/src/weights.rs +// --template=./.maintain/frame-weight-template.hbs + + +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weights for pallet_bounties using the Substrate node and recommended hardware. +pub struct WeightInfo(PhantomData); +impl WeightInfo for WeightInfo { + fn propose_bounty(d: u32, ) -> Weight { + (59_931_000 as Weight) + .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)) + } + fn approve_bounty() -> Weight { + (17_226_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + fn propose_curator() -> Weight { + (13_314_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + fn unassign_curator() -> Weight { + (48_677_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + fn accept_curator() -> Weight { + (48_727_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + fn award_bounty() -> Weight { + (34_839_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + fn claim_bounty() -> Weight { + (64_883_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + fn close_bounty_proposed() -> Weight { + (48_003_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + fn close_bounty_active() -> Weight { + (62_215_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + fn extend_bounty_expiry() -> Weight { + (33_748_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + fn spend_funds(b: u32, ) -> Weight { + (3_688_000 as Weight) + .saturating_add((70_129_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/polkadot/src/weights/pallet_tips.rs b/runtime/polkadot/src/weights/pallet_tips.rs new file mode 100644 index 000000000000..0c9026e1abb0 --- /dev/null +++ b/runtime/polkadot/src/weights/pallet_tips.rs @@ -0,0 +1,78 @@ +// This file is part of Substrate. + +// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Autogenerated weights for pallet_tips +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 +//! DATE: 2020-11-20, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 + +// Executed Command: +// target/release/substrate +// benchmark +// --chain=dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_tips +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./frame/tips/src/weights.rs +// --template=./.maintain/frame-weight-template.hbs + + +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weights for pallet_tips using the Substrate node and recommended hardware. +pub struct WeightInfo(PhantomData); +impl WeightInfo for WeightInfo { + fn report_awesome(r: u32, ) -> Weight { + (70_338_000 as Weight) + .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)) + } + fn retract_tip() -> Weight { + (59_051_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + fn tip_new(r: u32, t: u32, ) -> Weight { + (41_984_000 as Weight) + .saturating_add((2_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((180_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)) + } + fn tip(t: u32, ) -> Weight { + (33_313_000 as Weight) + .saturating_add((700_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)) + } + fn close_tip(t: u32, ) -> Weight { + (110_781_000 as Weight) + .saturating_add((364_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)) + } +} diff --git a/runtime/polkadot/src/weights/pallet_treasury.rs b/runtime/polkadot/src/weights/pallet_treasury.rs index 1075855224af..ad82009e52ce 100644 --- a/runtime/polkadot/src/weights/pallet_treasury.rs +++ b/runtime/polkadot/src/weights/pallet_treasury.rs @@ -33,7 +33,6 @@ // --header=./file_header.txt // --output=./runtime/polkadot/src/weights/ - #![allow(unused_parens)] #![allow(unused_imports)] @@ -44,123 +43,26 @@ use sp_std::marker::PhantomData; pub struct WeightInfo(PhantomData); impl pallet_treasury::WeightInfo for WeightInfo { fn propose_spend() -> Weight { - (54_574_000 as Weight) + (55_957_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } fn reject_proposal() -> Weight { - (85_554_000 as Weight) + (45_616_000 as Weight) .saturating_add(T::DbWeight::get().reads(2 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } fn approve_proposal() -> Weight { - (11_791_000 as Weight) + (13_362_000 as Weight) .saturating_add(T::DbWeight::get().reads(2 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } - fn report_awesome(r: u32, ) -> Weight { - (67_174_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)) - } - fn retract_tip() -> Weight { - (56_466_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn tip_new(r: u32, t: u32, ) -> Weight { - (42_193_000 as Weight) - // Standard Error: 0 - .saturating_add((2_000 as Weight).saturating_mul(r as Weight)) - // Standard Error: 0 - .saturating_add((149_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)) - } - fn tip(t: u32, ) -> Weight { - (28_405_000 as Weight) - // Standard Error: 1_000 - .saturating_add((705_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)) - } - fn close_tip(t: u32, ) -> Weight { - (106_075_000 as Weight) - // Standard Error: 0 - .saturating_add((361_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)) - } - fn propose_bounty(d: u32, ) -> Weight { - (58_025_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)) - } - fn approve_bounty() -> Weight { - (15_338_000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn propose_curator() -> Weight { - (12_080_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn unassign_curator() -> Weight { - (69_557_000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn accept_curator() -> Weight { - (47_745_000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn award_bounty() -> Weight { - (33_468_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn claim_bounty() -> Weight { - (161_390_000 as Weight) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().writes(5 as Weight)) - } - fn close_bounty_proposed() -> Weight { - (68_016_000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - } - fn close_bounty_active() -> Weight { - (106_292_000 as Weight) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(4 as Weight)) - } - fn extend_bounty_expiry() -> Weight { - (32_515_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } fn on_initialize_proposals(p: u32, ) -> Weight { - (72_159_000 as Weight) - // Standard Error: 26_000 - .saturating_add((72_167_000 as Weight).saturating_mul(p as Weight)) + (74_689_000 as Weight) + .saturating_add((71_943_000 as Weight).saturating_mul(p as Weight)) .saturating_add(T::DbWeight::get().reads(2 as Weight)) .saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(p as Weight))) .saturating_add(T::DbWeight::get().writes(2 as Weight)) .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(p as Weight))) } - fn on_initialize_bounties(b: u32, ) -> Weight { - (66_526_000 as Weight) - // Standard Error: 18_000 - .saturating_add((71_398_000 as Weight).saturating_mul(b as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(b as Weight))) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(b as Weight))) - } }