Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Migrate pallet-treasury to the new pallet attribute macro #9197

Merged
9 commits merged into from
Jul 13, 2021
Prev Previous commit
Next Next commit
Fix bounties/tips tests
Signed-off-by: koushiro <[email protected]>
koushiro committed Jun 24, 2021
commit c882531e626e5087a352dbdd981fc44b0de9a1ba
6 changes: 3 additions & 3 deletions bin/node/executor/tests/basic.rs
Original file line number Diff line number Diff line change
@@ -363,7 +363,7 @@ fn full_native_block_import_works() {
},
EventRecord {
phase: Phase::ApplyExtrinsic(1),
event: Event::Treasury(pallet_treasury::RawEvent::Deposit(fees * 8 / 10)),
event: Event::Treasury(pallet_treasury::Event::Deposit(fees * 8 / 10)),
topics: vec![],
},
EventRecord {
@@ -417,7 +417,7 @@ fn full_native_block_import_works() {
},
EventRecord {
phase: Phase::ApplyExtrinsic(1),
event: Event::Treasury(pallet_treasury::RawEvent::Deposit(fees * 8 / 10)),
event: Event::Treasury(pallet_treasury::Event::Deposit(fees * 8 / 10)),
topics: vec![],
},
EventRecord {
@@ -440,7 +440,7 @@ fn full_native_block_import_works() {
},
EventRecord {
phase: Phase::ApplyExtrinsic(2),
event: Event::Treasury(pallet_treasury::RawEvent::Deposit(fees * 8 / 10)),
event: Event::Treasury(pallet_treasury::Event::Deposit(fees * 8 / 10)),
topics: vec![],
},
EventRecord {
2 changes: 1 addition & 1 deletion frame/bounties/src/benchmarking.rs
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ use frame_benchmarking::{benchmarks, account, whitelisted_caller, impl_benchmark
use frame_support::traits::OnInitialize;

use crate::Module as Bounties;
use pallet_treasury::Module as Treasury;
use pallet_treasury::Pallet as Treasury;

const SEED: u32 = 0;

6 changes: 3 additions & 3 deletions frame/bounties/src/tests.rs
Original file line number Diff line number Diff line change
@@ -146,7 +146,7 @@ impl Config for Test {
type WeightInfo = ();
}

type TreasuryError = pallet_treasury::Error::<Test, pallet_treasury::DefaultInstance>;
type TreasuryError = pallet_treasury::Error::<Test>;

pub fn new_test_ext() -> sp_io::TestExternalities {
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
@@ -268,7 +268,7 @@ fn reject_already_rejected_spend_proposal_fails() {
fn reject_non_existent_spend_proposal_fails() {
new_test_ext().execute_with(|| {
assert_noop!(Treasury::reject_proposal(Origin::root(), 0),
pallet_treasury::Error::<Test, pallet_treasury::DefaultInstance>::InvalidIndex);
pallet_treasury::Error::<Test, _>::InvalidIndex);
});
}

@@ -457,7 +457,7 @@ fn close_bounty_works() {
assert_eq!(Balances::free_balance(0), 100 - deposit);

assert_eq!(Bounties::bounties(0), None);
assert!(!pallet_treasury::Proposals::<Test>::contains_key(0));
assert!(!pallet_treasury::Proposals::<Test, _>::contains_key(0));

assert_eq!(Bounties::bounty_descriptions(0), None);
});
2 changes: 1 addition & 1 deletion frame/tips/src/lib.rs
Original file line number Diff line number Diff line change
@@ -501,7 +501,7 @@ impl<T: Config> Module<T> {
tips.sort_by_key(|i| i.1);

let treasury = Self::account_id();
let max_payout = pallet_treasury::Module::<T>::pot();
let max_payout = pallet_treasury::Pallet::<T>::pot();

let mut payout = tips[tips.len() / 2].1.min(max_payout);
if !tip.deposit.is_zero() {
8 changes: 4 additions & 4 deletions frame/treasury/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Treasury Module
# Treasury Pallet

The Treasury module provides a "pot" of funds that can be managed by stakeholders in the system and
The Treasury pallet provides a "pot" of funds that can be managed by stakeholders in the system and
a structure for making spending proposals from this pot.

## Overview

The Treasury Module itself provides the pot to store funds, and a means for stakeholders to propose,
The Treasury Pallet itself provides the pot to store funds, and a means for stakeholders to propose,
approve, and deny expenditures. The chain will need to provide a method (e.g.inflation, fees) for
collecting funds.

@@ -19,7 +19,7 @@ and use the funds to pay developers.
approved.
- **Deposit:** Funds that a proposer must lock when making a proposal. The deposit will be returned
or slashed if the proposal is approved or rejected respectively.
- **Pot:** Unspent funds accumulated by the treasury module.
- **Pot:** Unspent funds accumulated by the treasury pallet.

## Interface

12 changes: 6 additions & 6 deletions frame/treasury/src/lib.rs
Original file line number Diff line number Diff line change
@@ -15,17 +15,17 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//! # Treasury Module
//! # Treasury Pallet
//!
//! The Treasury module provides a "pot" of funds that can be managed by stakeholders in the system
//! The Treasury pallet provides a "pot" of funds that can be managed by stakeholders in the system
//! and a structure for making spending proposals from this pot.
//!
//! - [`Config`]
//! - [`Call`]
//!
//! ## Overview
//!
//! The Treasury Module itself provides the pot to store funds, and a means for stakeholders to
//! The Treasury Pallet itself provides the pot to store funds, and a means for stakeholders to
//! propose, approve, and deny expenditures. The chain will need to provide a method (e.g.
//! inflation, fees) for collecting funds.
//!
@@ -40,7 +40,7 @@
//! approved.
//! - **Deposit:** Funds that a proposer must lock when making a proposal. The deposit will be
//! returned or slashed if the proposal is approved or rejected respectively.
//! - **Pot:** Unspent funds accumulated by the treasury module.
//! - **Pot:** Unspent funds accumulated by the treasury pallet.
//!
//! ## Interface
//!
@@ -53,7 +53,7 @@
//!
//! ## GenesisConfig
//!
//! The Treasury module depends on the [`GenesisConfig`].
//! The Treasury pallet depends on the [`GenesisConfig`].

#![cfg_attr(not(feature = "std"), no_std)]

@@ -140,7 +140,7 @@ pub mod pallet {

#[pallet::config]
pub trait Config<I: 'static = ()>: frame_system::Config {
/// The treasury's module id, used for deriving its sovereign account ID.
/// The treasury's pallet id, used for deriving its sovereign account ID.
#[pallet::constant]
type PalletId: Get<PalletId>;