Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
d0540a7
Introduce sensible weight constants (#12868)
KiChjang Dec 8, 2022
02a9dea
Checkout to the branch HEAD explicitly in `build-linux-substrate` (#1…
rcny Dec 8, 2022
9a0644c
cli: Improve pruning documentation (#12819)
lexnv Dec 8, 2022
e6bbc53
Revert "Move LockableCurrency trait to fungibles::Lockable and deprec…
tonyalaribe Dec 9, 2022
90ab4fa
Don't indefinitely block on shutting down Tokio (#12885)
bkchr Dec 9, 2022
47bd959
General Message Queue Pallet (#12485)
gavofyork Dec 9, 2022
f0b6e79
zombienet timings adjusted (#12890)
michalkucharczyk Dec 9, 2022
9931220
Move import queue out of `sc-network` (#12764)
altonen Dec 9, 2022
15cfd9c
Trace response payload in default `jsonrpsee` middleware (#12886)
tgmichel Dec 9, 2022
33e6029
Ensure that we inform all tasks to stop before starting the 60 second…
bkchr Dec 10, 2022
2f0d59d
Safe desired targets call (#12826)
Ank4n Dec 10, 2022
0ba5206
Fix typo (#12900)
ltfschoen Dec 11, 2022
9772209
ValidateUnsigned: Improve docs. (#12870)
bkchr Dec 11, 2022
06090ab
rpc server with HTTP/WS on the same socket (#12663)
niklasad1 Dec 12, 2022
e5d5d88
`pallet-message-queue`: Fix license (#12895)
ggwpez Dec 12, 2022
b3d9f3c
Use explicit call indices (#12891)
ggwpez Dec 12, 2022
f3c95e6
Pin canonincalized block (#12902)
arkpar Dec 12, 2022
d4837cb
Remove implicit approval chilling upon slash. (#12420)
kianenigma Dec 12, 2022
2a0eeff
bounties calls docs fix (#12909)
muharem Dec 12, 2022
01efa85
pallet-contracts migration pre-upgrade fix for v8 (#12905)
Dinonard Dec 13, 2022
13664c3
use custom environment for publishing crates (#12912)
joao-paulo-parity Dec 13, 2022
93fa104
[contracts] Add debug buffer limit + enforcement (#12845)
agryaznov Dec 13, 2022
c4fbb12
Merge remote-tracking branch 'origin/master' into HEAD
lexnv Dec 13, 2022
dfd9af0
frame/remote-externalities: Fix clippy
lexnv Dec 13, 2022
1f40715
frame/rpc: Add previous export
lexnv Dec 13, 2022
89498c0
Fixup some wrong dependencies (#12899)
bkchr Dec 13, 2022
b65c9f0
add numerator and denominator to Rational128 Debug impl and increase …
apopiak Dec 14, 2022
59b5903
Fix state-db pinning (#12927)
arkpar Dec 14, 2022
2e21c35
[ci] add job switcher (#12922)
alvicsam Dec 14, 2022
4de625c
Merge remote-tracking branch 'origin/master' into lexnv/kiz-revamp-tr…
lexnv Dec 14, 2022
2f6105b
Use LOG_TARGET in consensus related crates (#12875)
davxy Dec 14, 2022
5efd759
Merge branch 'master' of github.com:paritytech/substrate into lexnv/k…
kianenigma Dec 14, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert "Move LockableCurrency trait to fungibles::Lockable and deprec…
…ate LockableCurrency (#12798)" (#12882)

This reverts commit ea3ca3f.
  • Loading branch information
tonyalaribe authored Dec 9, 2022
commit e6bbc53af99458c87b6fafe02314b4959b8da2b0
8 changes: 4 additions & 4 deletions bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ use frame_support::{
pallet_prelude::Get,
parameter_types,
traits::{
fungible::ItemOf, fungibles, AsEnsureOriginWithArg, ConstBool, ConstU128, ConstU16,
ConstU32, Currency, EitherOfDiverse, EqualPrivilegeOnly, Everything, Imbalance,
InstanceFilter, KeyOwnerProofSystem, Nothing, OnUnbalanced, U128CurrencyToVote,
fungible::ItemOf, AsEnsureOriginWithArg, ConstBool, ConstU128, ConstU16, ConstU32,
Currency, EitherOfDiverse, EqualPrivilegeOnly, Everything, Imbalance, InstanceFilter,
KeyOwnerProofSystem, LockIdentifier, Nothing, OnUnbalanced, U128CurrencyToVote,
WithdrawReasons,
},
weights::{
Expand Down Expand Up @@ -1006,7 +1006,7 @@ parameter_types! {
pub const DesiredRunnersUp: u32 = 7;
pub const MaxVoters: u32 = 10 * 1000;
pub const MaxCandidates: u32 = 1000;
pub const ElectionsPhragmenPalletId: fungibles::LockIdentifier = *b"phrelect";
pub const ElectionsPhragmenPalletId: LockIdentifier = *b"phrelect";
}

// Make sure that there are no more than `MaxMembers` members elected via elections-phragmen.
Expand Down
8 changes: 4 additions & 4 deletions frame/balances/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ that you need, then you can avoid coupling with the Balances module.
fungible assets system.
- [`ReservableCurrency`](https://docs.rs/frame-support/latest/frame_support/traits/trait.ReservableCurrency.html):
Functions for dealing with assets that can be reserved from an account.
- [`Lockable`](https://docs.rs/frame-support/latest/frame_support/traits/fungibles/trait.Lockable.html): Functions for
- [`LockableCurrency`](https://docs.rs/frame-support/latest/frame_support/traits/trait.LockableCurrency.html): Functions for
dealing with accounts that allow liquidity restrictions.
- [`Imbalance`](https://docs.rs/frame-support/latest/frame_support/traits/trait.Imbalance.html): Functions for handling
imbalances between total issuance in the system and account balances. Must be used when a function
Expand Down Expand Up @@ -88,13 +88,13 @@ pub type NegativeImbalanceOf<T> = <<T as Config>::Currency as Currency<<T as fra

```

The Staking module uses the `fungibles::Lockable` trait to lock a stash account's funds:
The Staking module uses the `LockableCurrency` trait to lock a stash account's funds:

```rust
use frame_support::traits::{WithdrawReasons, fungibles};
use frame_support::traits::{WithdrawReasons, LockableCurrency};
use sp_runtime::traits::Bounded;
pub trait Config: frame_system::Config {
type Currency: fungibles::Lockable<Self::AccountId, Moment=Self::BlockNumber>;
type Currency: LockableCurrency<Self::AccountId, Moment=Self::BlockNumber>;
}

fn update_ledger<T: Config>(
Expand Down
26 changes: 12 additions & 14 deletions frame/balances/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
//! - [`ReservableCurrency`](frame_support::traits::ReservableCurrency):
//! - [`NamedReservableCurrency`](frame_support::traits::NamedReservableCurrency):
//! Functions for dealing with assets that can be reserved from an account.
//! - [`Lockable`](frame_support::traits::fungibles::Lockable): Functions for
//! - [`LockableCurrency`](frame_support::traits::LockableCurrency): Functions for
//! dealing with accounts that allow liquidity restrictions.
//! - [`Imbalance`](frame_support::traits::Imbalance): Functions for handling
//! imbalances between total issuance in the system and account balances. Must be used when a
Expand Down Expand Up @@ -113,13 +113,13 @@
//! # fn main() {}
//! ```
//!
//! The Staking pallet uses the `fungibles::Lockable` trait to lock a stash account's funds:
//! The Staking pallet uses the `LockableCurrency` trait to lock a stash account's funds:
//!
//! ```
//! use frame_support::traits::{WithdrawReasons, fungibles, fungibles::Lockable};
//! use frame_support::traits::{WithdrawReasons, LockableCurrency};
//! use sp_runtime::traits::Bounded;
//! pub trait Config: frame_system::Config {
//! type Currency: fungibles::Lockable<Self::AccountId, Moment=Self::BlockNumber>;
//! type Currency: LockableCurrency<Self::AccountId, Moment=Self::BlockNumber>;
//! }
//! # struct StakingLedger<T: Config> {
//! # stash: <T as frame_system::Config>::AccountId,
Expand Down Expand Up @@ -171,13 +171,11 @@ use frame_support::{
ensure,
pallet_prelude::DispatchResult,
traits::{
tokens::{
fungible, fungibles, BalanceStatus as Status, DepositConsequence, WithdrawConsequence,
},
tokens::{fungible, BalanceStatus as Status, DepositConsequence, WithdrawConsequence},
Currency, DefensiveSaturating, ExistenceRequirement,
ExistenceRequirement::{AllowDeath, KeepAlive},
Get, Imbalance, NamedReservableCurrency, OnUnbalanced, ReservableCurrency, SignedImbalance,
StoredMap, TryDrop, WithdrawReasons,
Get, Imbalance, LockIdentifier, LockableCurrency, NamedReservableCurrency, OnUnbalanced,
ReservableCurrency, SignedImbalance, StoredMap, TryDrop, WithdrawReasons,
},
WeakBoundedVec,
};
Expand Down Expand Up @@ -664,7 +662,7 @@ impl BitOr for Reasons {
#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, MaxEncodedLen, TypeInfo)]
pub struct BalanceLock<Balance> {
/// An identifier for this lock. Only one lock may be in existence for each identifier.
pub id: fungibles::LockIdentifier,
pub id: LockIdentifier,
/// The amount which the free balance may not drop below when this lock is in effect.
pub amount: Balance,
/// If true, then the lock remains in effect even for payment of transaction fees.
Expand Down Expand Up @@ -2133,7 +2131,7 @@ where
}
}

impl<T: Config<I>, I: 'static> fungibles::Lockable<T::AccountId> for Pallet<T, I>
impl<T: Config<I>, I: 'static> LockableCurrency<T::AccountId> for Pallet<T, I>
where
T::Balance: MaybeSerializeDeserialize + Debug,
{
Expand All @@ -2144,7 +2142,7 @@ where
// Set a lock on the balance of `who`.
// Is a no-op if lock amount is zero or `reasons` `is_none()`.
fn set_lock(
id: fungibles::LockIdentifier,
id: LockIdentifier,
who: &T::AccountId,
amount: T::Balance,
reasons: WithdrawReasons,
Expand All @@ -2166,7 +2164,7 @@ where
// Extend a lock on the balance of `who`.
// Is a no-op if lock amount is zero or `reasons` `is_none()`.
fn extend_lock(
id: fungibles::LockIdentifier,
id: LockIdentifier,
who: &T::AccountId,
amount: T::Balance,
reasons: WithdrawReasons,
Expand Down Expand Up @@ -2195,7 +2193,7 @@ where
Self::update_locks(who, &locks[..]);
}

fn remove_lock(id: fungibles::LockIdentifier, who: &T::AccountId) {
fn remove_lock(id: LockIdentifier, who: &T::AccountId) {
let mut locks = Self::locks(who);
locks.retain(|l| l.id != id);
Self::update_locks(who, &locks[..]);
Expand Down
6 changes: 3 additions & 3 deletions frame/balances/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ macro_rules! decl_tests {
use frame_support::{
assert_noop, assert_storage_noop, assert_ok, assert_err,
traits::{
fungibles, fungibles::Lockable, WithdrawReasons,
LockableCurrency, LockIdentifier, WithdrawReasons,
Currency, ReservableCurrency, ExistenceRequirement::AllowDeath
}
};
use pallet_transaction_payment::{ChargeTransactionPayment, Multiplier};
use frame_system::RawOrigin;

const ID_1: fungibles::LockIdentifier = *b"1 ";
const ID_2: fungibles::LockIdentifier = *b"2 ";
const ID_1: LockIdentifier = *b"1 ";
const ID_2: LockIdentifier = *b"2 ";

pub const CALL: &<$test as frame_system::Config>::RuntimeCall =
&RuntimeCall::Balances(pallet_balances::Call::transfer { dest: 0, value: 0 });
Expand Down
2 changes: 1 addition & 1 deletion frame/contracts/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use frame_support::{
parameter_types,
storage::child,
traits::{
fungibles::Lockable, BalanceStatus, ConstU32, ConstU64, Contains, Currency, Get, OnIdle,
BalanceStatus, ConstU32, ConstU64, Contains, Currency, Get, LockableCurrency, OnIdle,
OnInitialize, ReservableCurrency, WithdrawReasons,
},
weights::{constants::WEIGHT_REF_TIME_PER_SECOND, Weight},
Expand Down
2 changes: 1 addition & 1 deletion frame/conviction-voting/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use assert_matches::assert_matches;
use frame_benchmarking::{account, benchmarks_instance_pallet, whitelist_account};
use frame_support::{
dispatch::RawOrigin,
traits::{Currency, Get},
traits::{fungible, Currency, Get},
};
use sp_runtime::traits::Bounded;
use sp_std::collections::btree_map::BTreeMap;
Expand Down
6 changes: 3 additions & 3 deletions frame/conviction-voting/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use frame_support::{
dispatch::{DispatchError, DispatchResult},
ensure,
traits::{
fungible, fungibles, fungibles::Lockable, Currency, Get, PollStatus, Polling,
fungible, Currency, Get, LockIdentifier, LockableCurrency, PollStatus, Polling,
ReservableCurrency, WithdrawReasons,
},
};
Expand Down Expand Up @@ -60,7 +60,7 @@ mod tests;
#[cfg(feature = "runtime-benchmarks")]
pub mod benchmarking;

const CONVICTION_VOTING_ID: fungibles::LockIdentifier = *b"pyconvot";
const CONVICTION_VOTING_ID: LockIdentifier = *b"pyconvot";

type AccountIdLookupOf<T> = <<T as frame_system::Config>::Lookup as StaticLookup>::Source;
type BalanceOf<T, I = ()> =
Expand Down Expand Up @@ -104,7 +104,7 @@ pub mod pallet {
type WeightInfo: WeightInfo;
/// Currency type with which voting happens.
type Currency: ReservableCurrency<Self::AccountId>
+ fungibles::Lockable<Self::AccountId, Moment = Self::BlockNumber>
+ LockableCurrency<Self::AccountId, Moment = Self::BlockNumber>
+ fungible::Inspect<Self::AccountId>;

/// The implementation of the logic which conducts polls.
Expand Down
10 changes: 4 additions & 6 deletions frame/democracy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,9 @@ use frame_support::{
ensure,
traits::{
defensive_prelude::*,
fungibles,
fungibles::Lockable,
schedule::{v3::Named as ScheduleNamed, DispatchTime},
Bounded, Currency, Get, OnUnbalanced, QueryPreimage, ReservableCurrency, StorePreimage,
WithdrawReasons,
Bounded, Currency, Get, LockIdentifier, LockableCurrency, OnUnbalanced, QueryPreimage,
ReservableCurrency, StorePreimage, WithdrawReasons,
},
weights::Weight,
};
Expand Down Expand Up @@ -191,7 +189,7 @@ pub mod benchmarking;

pub mod migrations;

const DEMOCRACY_ID: fungibles::LockIdentifier = *b"democrac";
const DEMOCRACY_ID: LockIdentifier = *b"democrac";

/// A proposal index.
pub type PropIndex = u32;
Expand Down Expand Up @@ -236,7 +234,7 @@ pub mod pallet {

/// Currency type for this pallet.
type Currency: ReservableCurrency<Self::AccountId>
+ fungibles::Lockable<Self::AccountId, Moment = Self::BlockNumber>;
+ LockableCurrency<Self::AccountId, Moment = Self::BlockNumber>;

/// The period between a proposal being approved and enacted.
///
Expand Down
10 changes: 5 additions & 5 deletions frame/elections-phragmen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@
use codec::{Decode, Encode};
use frame_support::{
traits::{
defensive_prelude::*, fungibles, fungibles::Lockable, ChangeMembers, Contains,
ContainsLengthBound, Currency, CurrencyToVote, Get, InitializeMembers, OnUnbalanced,
defensive_prelude::*, ChangeMembers, Contains, ContainsLengthBound, Currency,
CurrencyToVote, Get, InitializeMembers, LockIdentifier, LockableCurrency, OnUnbalanced,
ReservableCurrency, SortedMembers, WithdrawReasons,
},
weights::Weight,
Expand Down Expand Up @@ -199,10 +199,10 @@ pub mod pallet {

/// Identifier for the elections-phragmen pallet's lock
#[pallet::constant]
type PalletId: Get<fungibles::LockIdentifier>;
type PalletId: Get<LockIdentifier>;

/// The currency that people are electing with.
type Currency: fungibles::Lockable<Self::AccountId, Moment = Self::BlockNumber>
type Currency: LockableCurrency<Self::AccountId, Moment = Self::BlockNumber>
+ ReservableCurrency<Self::AccountId>;

/// What to do when the members change.
Expand Down Expand Up @@ -1274,7 +1274,7 @@ mod tests {
}

parameter_types! {
pub const ElectionsPhragmenPalletId: fungibles::LockIdentifier = *b"phrelect";
pub const ElectionsPhragmenPalletId: LockIdentifier = *b"phrelect";
pub const PhragmenMaxVoters: u32 = 1000;
pub const PhragmenMaxCandidates: u32 = 100;
}
Expand Down
9 changes: 6 additions & 3 deletions frame/executive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,10 @@ mod tests {

use frame_support::{
assert_err, parameter_types,
traits::{fungibles, ConstU32, ConstU64, ConstU8, Currency, WithdrawReasons},
traits::{
ConstU32, ConstU64, ConstU8, Currency, LockIdentifier, LockableCurrency,
WithdrawReasons,
},
weights::{ConstantMultiplier, IdentityFee, RuntimeDbWeight, Weight, WeightToFee},
};
use frame_system::{Call as SystemCall, ChainContext, LastRuntimeUpgradeInfo};
Expand Down Expand Up @@ -1182,11 +1185,11 @@ mod tests {

#[test]
fn can_pay_for_tx_fee_on_full_lock() {
let id: fungibles::LockIdentifier = *b"0 ";
let id: LockIdentifier = *b"0 ";
let execute_with_lock = |lock: WithdrawReasons| {
let mut t = new_test_ext(1);
t.execute_with(|| {
<pallet_balances::Pallet<Runtime> as fungibles::Lockable<Balance>>::set_lock(
<pallet_balances::Pallet<Runtime> as LockableCurrency<Balance>>::set_lock(
id, &1, 110, lock,
);
let xt = TestXt::new(
Expand Down
7 changes: 4 additions & 3 deletions frame/referenda/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// This file is part of Substrate.

// Copyright (C) 2017-2022 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0

Expand Down Expand Up @@ -66,12 +68,11 @@ use codec::{Codec, Encode};
use frame_support::{
ensure,
traits::{
fungibles,
schedule::{
v3::{Anon as ScheduleAnon, Named as ScheduleNamed},
DispatchTime,
},
Currency, OnUnbalanced, OriginTrait, PollStatus, Polling, QueryPreimage,
Currency, LockIdentifier, OnUnbalanced, OriginTrait, PollStatus, Polling, QueryPreimage,
ReservableCurrency, StorePreimage, VoteTally,
},
BoundedVec,
Expand Down Expand Up @@ -132,7 +133,7 @@ macro_rules! impl_tracksinfo_get {
};
}

const ASSEMBLY_ID: fungibles::LockIdentifier = *b"assembly";
const ASSEMBLY_ID: LockIdentifier = *b"assembly";

#[frame_support::pallet]
pub mod pallet {
Expand Down
5 changes: 2 additions & 3 deletions frame/staking/src/pallet/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ use frame_support::{
dispatch::WithPostDispatchInfo,
pallet_prelude::*,
traits::{
fungibles::Lockable, Currency, CurrencyToVote, Defensive, DefensiveResult,
EstimateNextNewSession, Get, Imbalance, OnUnbalanced, TryCollect, UnixTime,
WithdrawReasons,
Currency, CurrencyToVote, Defensive, DefensiveResult, EstimateNextNewSession, Get,
Imbalance, LockableCurrency, OnUnbalanced, TryCollect, UnixTime, WithdrawReasons,
},
weights::Weight,
};
Expand Down
8 changes: 4 additions & 4 deletions frame/staking/src/pallet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ use frame_support::{
dispatch::Codec,
pallet_prelude::*,
traits::{
fungibles, fungibles::Lockable, Currency, CurrencyToVote, Defensive, DefensiveResult,
DefensiveSaturating, EnsureOrigin, EstimateNextNewSession, Get, OnUnbalanced, TryCollect,
Currency, CurrencyToVote, Defensive, DefensiveResult, DefensiveSaturating, EnsureOrigin,
EstimateNextNewSession, Get, LockIdentifier, LockableCurrency, OnUnbalanced, TryCollect,
UnixTime,
},
weights::Weight,
Expand All @@ -50,7 +50,7 @@ use crate::{
ValidatorPrefs,
};

const STAKING_ID: fungibles::LockIdentifier = *b"staking ";
const STAKING_ID: LockIdentifier = *b"staking ";

#[frame_support::pallet]
pub mod pallet {
Expand Down Expand Up @@ -78,7 +78,7 @@ pub mod pallet {
#[pallet::config]
pub trait Config: frame_system::Config {
/// The staking balance.
type Currency: fungibles::Lockable<
type Currency: LockableCurrency<
Self::AccountId,
Moment = Self::BlockNumber,
Balance = Self::CurrencyBalance,
Expand Down
1 change: 0 additions & 1 deletion frame/support/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
//! NOTE: If you're looking for `parameter_types`, it has moved in to the top-level module.

pub mod tokens;
#[allow(deprecated)]
pub use tokens::{
currency::{
ActiveIssuanceOf, Currency, LockIdentifier, LockableCurrency, NamedReservableCurrency,
Expand Down
5 changes: 1 addition & 4 deletions frame/support/src/traits/tokens/currency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ use sp_std::fmt::Debug;
mod reservable;
pub use reservable::{NamedReservableCurrency, ReservableCurrency};
mod lockable;

#[deprecated(note = "Deprecated in favour of using fungibles::Lockable trait directly")]
pub use super::fungibles::{LockIdentifier, Lockable as LockableCurrency};
pub use lockable::VestingSchedule;
pub use lockable::{LockIdentifier, LockableCurrency, VestingSchedule};

/// Abstraction over a fungible assets system.
pub trait Currency<AccountId> {
Expand Down
Loading