Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
36 changes: 18 additions & 18 deletions Cargo.dev.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ members = [
]

[patch.crates-io]
frame-benchmarking = { git = "https://github.com/paritytech/substrate.git", rev = "b7712fed2c58a898f7706e16861d7109c8f585a5" }
frame-support = { git = "https://github.com/paritytech/substrate.git", rev = "b7712fed2c58a898f7706e16861d7109c8f585a5" }
frame-system = { git = "https://github.com/paritytech/substrate.git", rev = "b7712fed2c58a898f7706e16861d7109c8f585a5" }
pallet-balances = { git = "https://github.com/paritytech/substrate.git", rev = "b7712fed2c58a898f7706e16861d7109c8f585a5" }
pallet-elections-phragmen = { git = "https://github.com/paritytech/substrate.git", rev = "b7712fed2c58a898f7706e16861d7109c8f585a5" }
pallet-scheduler = { git = "https://github.com/paritytech/substrate.git", rev = "b7712fed2c58a898f7706e16861d7109c8f585a5" }
pallet-treasury = { git = "https://github.com/paritytech/substrate.git", rev = "b7712fed2c58a898f7706e16861d7109c8f585a5" }
sp-api = { git = "https://github.com/paritytech/substrate.git", rev = "b7712fed2c58a898f7706e16861d7109c8f585a5" }
sp-application-crypto = { git = "https://github.com/paritytech/substrate.git", rev = "b7712fed2c58a898f7706e16861d7109c8f585a5" }
sp-arithmetic = { git = "https://github.com/paritytech/substrate.git", rev = "b7712fed2c58a898f7706e16861d7109c8f585a5" }
sp-core = { git = "https://github.com/paritytech/substrate.git", rev = "b7712fed2c58a898f7706e16861d7109c8f585a5" }
sp-inherents = { git = "https://github.com/paritytech/substrate.git", rev = "b7712fed2c58a898f7706e16861d7109c8f585a5" }
sp-io = { git = "https://github.com/paritytech/substrate.git", rev = "b7712fed2c58a898f7706e16861d7109c8f585a5" }
sp-runtime = { git = "https://github.com/paritytech/substrate.git", rev = "b7712fed2c58a898f7706e16861d7109c8f585a5" }
sp-runtime-interface = { git = "https://github.com/paritytech/substrate.git", rev = "b7712fed2c58a898f7706e16861d7109c8f585a5" }
sp-std = { git = "https://github.com/paritytech/substrate.git", rev = "b7712fed2c58a898f7706e16861d7109c8f585a5" }
sp-trie = { git = "https://github.com/paritytech/substrate.git", rev = "b7712fed2c58a898f7706e16861d7109c8f585a5" }
sp-version = { git = "https://github.com/paritytech/substrate.git", rev = "b7712fed2c58a898f7706e16861d7109c8f585a5" }
frame-benchmarking = { git = "https://github.com/paritytech/substrate.git", rev = "f884296f7436916909025f8b43c4bbf3e60e4c60" }
frame-support = { git = "https://github.com/paritytech/substrate.git", rev = "f884296f7436916909025f8b43c4bbf3e60e4c60" }
frame-system = { git = "https://github.com/paritytech/substrate.git", rev = "f884296f7436916909025f8b43c4bbf3e60e4c60" }
pallet-balances = { git = "https://github.com/paritytech/substrate.git", rev = "f884296f7436916909025f8b43c4bbf3e60e4c60" }
pallet-elections-phragmen = { git = "https://github.com/paritytech/substrate.git", rev = "f884296f7436916909025f8b43c4bbf3e60e4c60" }
pallet-scheduler = { git = "https://github.com/paritytech/substrate.git", rev = "f884296f7436916909025f8b43c4bbf3e60e4c60" }
pallet-treasury = { git = "https://github.com/paritytech/substrate.git", rev = "f884296f7436916909025f8b43c4bbf3e60e4c60" }
sp-api = { git = "https://github.com/paritytech/substrate.git", rev = "f884296f7436916909025f8b43c4bbf3e60e4c60" }
sp-application-crypto = { git = "https://github.com/paritytech/substrate.git", rev = "f884296f7436916909025f8b43c4bbf3e60e4c60" }
sp-arithmetic = { git = "https://github.com/paritytech/substrate.git", rev = "f884296f7436916909025f8b43c4bbf3e60e4c60" }
sp-core = { git = "https://github.com/paritytech/substrate.git", rev = "f884296f7436916909025f8b43c4bbf3e60e4c60" }
sp-inherents = { git = "https://github.com/paritytech/substrate.git", rev = "f884296f7436916909025f8b43c4bbf3e60e4c60" }
sp-io = { git = "https://github.com/paritytech/substrate.git", rev = "f884296f7436916909025f8b43c4bbf3e60e4c60" }
sp-runtime = { git = "https://github.com/paritytech/substrate.git", rev = "f884296f7436916909025f8b43c4bbf3e60e4c60" }
sp-runtime-interface = { git = "https://github.com/paritytech/substrate.git", rev = "f884296f7436916909025f8b43c4bbf3e60e4c60" }
sp-std = { git = "https://github.com/paritytech/substrate.git", rev = "f884296f7436916909025f8b43c4bbf3e60e4c60" }
sp-trie = { git = "https://github.com/paritytech/substrate.git", rev = "f884296f7436916909025f8b43c4bbf3e60e4c60" }
sp-version = { git = "https://github.com/paritytech/substrate.git", rev = "f884296f7436916909025f8b43c4bbf3e60e4c60" }
20 changes: 10 additions & 10 deletions auction/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ pub trait WeightInfo {
fn on_finalize(c: u32) -> Weight;
}

pub trait Trait: frame_system::Trait {
type Event: From<Event<Self>> + Into<<Self as frame_system::Trait>::Event>;
pub trait Config: frame_system::Config {
type Event: From<Event<Self>> + Into<<Self as frame_system::Config>::Event>;

/// The balance type for bidding
type Balance: Parameter + Member + AtLeast32BitUnsigned + Default + Copy + MaybeSerializeDeserialize;
Expand All @@ -53,17 +53,17 @@ pub trait Trait: frame_system::Trait {

decl_event!(
pub enum Event<T> where
<T as frame_system::Trait>::AccountId,
<T as Trait>::Balance,
<T as Trait>::AuctionId,
<T as frame_system::Config>::AccountId,
<T as Config>::Balance,
<T as Config>::AuctionId,
{
/// A bid is placed. [auction_id, bidder, bidding_amount]
Bid(AuctionId, AccountId, Balance),
}
);

decl_storage! {
trait Store for Module<T: Trait> as Auction {
trait Store for Module<T: Config> as Auction {
/// Stores on-going and future auctions. Closed auction are removed.
pub Auctions get(fn auctions): map hasher(twox_64_concat) T::AuctionId => Option<AuctionInfo<T::AccountId, T::Balance, T::BlockNumber>>;

Expand All @@ -76,7 +76,7 @@ decl_storage! {
}

decl_module! {
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
pub struct Module<T: Config> for enum Call where origin: T::Origin {
type Error = Error<T>;

fn deposit_event() = default;
Expand Down Expand Up @@ -180,7 +180,7 @@ decl_module! {

decl_error! {
/// Error for auction module.
pub enum Error for Module<T: Trait> {
pub enum Error for Module<T: Config> {
AuctionNotExist,
AuctionNotStarted,
BidNotAccepted,
Expand All @@ -189,7 +189,7 @@ decl_error! {
}
}

impl<T: Trait> Module<T> {
impl<T: Config> Module<T> {
fn _on_finalize(now: T::BlockNumber) {
for (auction_id, _) in <AuctionEndTime<T>>::drain_prefix(&now) {
if let Some(auction) = <Auctions<T>>::take(&auction_id) {
Expand All @@ -199,7 +199,7 @@ impl<T: Trait> Module<T> {
}
}

impl<T: Trait> Auction<T::AccountId, T::BlockNumber> for Module<T> {
impl<T: Config> Auction<T::AccountId, T::BlockNumber> for Module<T> {
type AuctionId = T::AuctionId;
type Balance = T::Balance;

Expand Down
4 changes: 2 additions & 2 deletions auction/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub type Balance = u64;
pub type BlockNumber = u64;
pub type AuctionId = u64;

impl frame_system::Trait for Runtime {
impl frame_system::Config for Runtime {
type Origin = Origin;
type Index = u64;
type BlockNumber = BlockNumber;
Expand Down Expand Up @@ -92,7 +92,7 @@ impl AuctionHandler<AccountId, Balance, BlockNumber, AuctionId> for Handler {
fn on_auction_ended(_id: AuctionId, _winner: Option<(AccountId, Balance)>) {}
}

impl Trait for Runtime {
impl Config for Runtime {
type Event = TestEvent;
type Balance = Balance;
type AuctionId = AuctionId;
Expand Down
44 changes: 24 additions & 20 deletions authority/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//! A module to provide features for governance including dispatch method on
//! behalf of other accounts and schedule dispatchables.
//!
//! - [`Trait`](./trait.Trait.html)
//! - [`Config`](./trait.Config.html)
//! - [`Call`](./enum.Call.html)
//! - [`Module`](./struct.Module.html)
//!
Expand Down Expand Up @@ -90,7 +90,7 @@ impl<
}

/// Origin for the authority module.
pub type Origin<T> = DelayedOrigin<<T as frame_system::Trait>::BlockNumber, <T as Trait>::PalletsOrigin>;
pub type Origin<T> = DelayedOrigin<<T as frame_system::Config>::BlockNumber, <T as Config>::PalletsOrigin>;

/// Config for orml-authority
pub trait AuthorityConfig<Origin, PalletsOrigin, BlockNumber> {
Expand Down Expand Up @@ -123,44 +123,48 @@ pub trait AsOriginId<Origin, PalletsOrigin> {
fn check_dispatch_from(&self, origin: Origin) -> DispatchResult;
}

type CallOf<T> = <T as Trait>::Call;
type CallOf<T> = <T as Config>::Call;

/// The schedule task index type.
pub type ScheduleTaskIndex = u32;

/// orml-authority configuration trait.
pub trait Trait: frame_system::Trait {
pub trait Config: frame_system::Config {
/// The overarching event type.
type Event: From<Event<Self>> + Into<<Self as frame_system::Trait>::Event>;
type Event: From<Event<Self>> + Into<<Self as frame_system::Config>::Event>;

/// The outer origin type.
type Origin: From<DelayedOrigin<Self::BlockNumber, <Self as Trait>::PalletsOrigin>>
+ IsType<<Self as frame_system::Trait>::Origin>
type Origin: From<DelayedOrigin<Self::BlockNumber, <Self as Config>::PalletsOrigin>>
+ IsType<<Self as frame_system::Config>::Origin>
+ OriginTrait<PalletsOrigin = Self::PalletsOrigin>;

/// The caller origin, overarching type of all pallets origins.
type PalletsOrigin: Parameter + Into<<Self as frame_system::Trait>::Origin>;
type PalletsOrigin: Parameter + Into<<Self as frame_system::Config>::Origin>;

/// The aggregated call type.
type Call: Parameter
+ Dispatchable<Origin = <Self as frame_system::Trait>::Origin, PostInfo = PostDispatchInfo>
+ Dispatchable<Origin = <Self as frame_system::Config>::Origin, PostInfo = PostDispatchInfo>
+ GetDispatchInfo;

/// The Scheduler.
type Scheduler: ScheduleNamed<Self::BlockNumber, <Self as Trait>::Call, Self::PalletsOrigin>;
type Scheduler: ScheduleNamed<Self::BlockNumber, <Self as Config>::Call, Self::PalletsOrigin>;

/// The type represent origin that can be dispatched by other origins.
type AsOriginId: Parameter + AsOriginId<<Self as frame_system::Trait>::Origin, Self::PalletsOrigin>;
type AsOriginId: Parameter + AsOriginId<<Self as frame_system::Config>::Origin, Self::PalletsOrigin>;

/// Additional permission config.
type AuthorityConfig: AuthorityConfig<<Self as frame_system::Trait>::Origin, Self::PalletsOrigin, Self::BlockNumber>;
type AuthorityConfig: AuthorityConfig<
<Self as frame_system::Config>::Origin,
Self::PalletsOrigin,
Self::BlockNumber,
>;

/// Weight information for extrinsics in this module.
type WeightInfo: WeightInfo;
}

decl_error! {
pub enum Error for Module<T: Trait> {
pub enum Error for Module<T: Config> {
/// Calculation overflow.
Overflow,
/// Failed to schedule a task.
Expand All @@ -175,16 +179,16 @@ decl_error! {
}

decl_storage! {
trait Store for Module<T: Trait> as Authority {
trait Store for Module<T: Config> as Authority {
/// Track the next task ID.
pub NextTaskIndex get(fn next_task_index): ScheduleTaskIndex;
}
}

decl_event! {
pub enum Event<T> where
<T as Trait>::PalletsOrigin,
<T as frame_system::Trait>::BlockNumber,
<T as Config>::PalletsOrigin,
<T as frame_system::Config>::BlockNumber,
{
/// A call is dispatched. [result]
Dispatched(DispatchResult),
Expand All @@ -200,7 +204,7 @@ decl_event! {
}

decl_module! {
pub struct Module<T: Trait> for enum Call where origin: <T as frame_system::Trait>::Origin {
pub struct Module<T: Config> for enum Call where origin: <T as frame_system::Config>::Origin {
type Error = Error<T>;

fn deposit_event() = default;
Expand Down Expand Up @@ -245,14 +249,14 @@ decl_module! {
};

let schedule_origin = if with_delayed_origin {
let origin: <T as Trait>::Origin = From::from(origin);
let origin: <T as Trait>::Origin = From::from(DelayedOrigin::<T::BlockNumber, T::PalletsOrigin> {
let origin: <T as Config>::Origin = From::from(origin);
let origin: <T as Config>::Origin = From::from(DelayedOrigin::<T::BlockNumber, T::PalletsOrigin> {
delay,
origin: Box::new(origin.caller().clone())
});
origin
} else {
<T as Trait>::Origin::from(origin)
<T as Config>::Origin::from(origin)
};

let pallets_origin = schedule_origin.caller().clone();
Expand Down
6 changes: 3 additions & 3 deletions authority/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ parameter_types! {
pub const AvailableBlockRatio: Perbill = Perbill::one();
}

impl frame_system::Trait for Runtime {
impl frame_system::Config for Runtime {
type Origin = Origin;
type Index = u64;
type BlockNumber = BlockNumber;
Expand Down Expand Up @@ -58,7 +58,7 @@ impl frame_system::Trait for Runtime {
parameter_types! {
pub MaximumSchedulerWeight: u32 = Perbill::from_percent(80) * MaximumBlockWeight::get();
}
impl pallet_scheduler::Trait for Runtime {
impl pallet_scheduler::Config for Runtime {
type Event = Event;
type Origin = Origin;
type PalletsOrigin = OriginCaller;
Expand Down Expand Up @@ -144,7 +144,7 @@ impl AsOriginId<Origin, OriginCaller> for MockAsOriginId {
}
}

impl Trait for Runtime {
impl Config for Runtime {
type Event = Event;
type Origin = Origin;
type PalletsOrigin = OriginCaller;
Expand Down
18 changes: 9 additions & 9 deletions authority/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,9 @@ fn fast_track_scheduled_dispatch_work() {
assert!(System::events().iter().any(|record| record.event == event));

let schedule_origin = {
let origin: <Runtime as Trait>::Origin = From::from(Origin::root());
let origin: <Runtime as Trait>::Origin =
From::from(DelayedOrigin::<BlockNumber, <Runtime as Trait>::PalletsOrigin> {
let origin: <Runtime as Config>::Origin = From::from(Origin::root());
let origin: <Runtime as Config>::Origin =
From::from(DelayedOrigin::<BlockNumber, <Runtime as Config>::PalletsOrigin> {
delay: 1,
origin: Box::new(origin.caller().clone()),
});
Expand Down Expand Up @@ -269,9 +269,9 @@ fn delay_scheduled_dispatch_work() {
assert!(System::events().iter().any(|record| record.event == event));

let schedule_origin = {
let origin: <Runtime as Trait>::Origin = From::from(Origin::root());
let origin: <Runtime as Trait>::Origin =
From::from(DelayedOrigin::<BlockNumber, <Runtime as Trait>::PalletsOrigin> {
let origin: <Runtime as Config>::Origin = From::from(Origin::root());
let origin: <Runtime as Config>::Origin =
From::from(DelayedOrigin::<BlockNumber, <Runtime as Config>::PalletsOrigin> {
delay: 1,
origin: Box::new(origin.caller().clone()),
});
Expand Down Expand Up @@ -342,9 +342,9 @@ fn cancel_scheduled_dispatch_work() {
assert!(System::events().iter().any(|record| record.event == event));

let schedule_origin = {
let origin: <Runtime as Trait>::Origin = From::from(Origin::root());
let origin: <Runtime as Trait>::Origin =
From::from(DelayedOrigin::<BlockNumber, <Runtime as Trait>::PalletsOrigin> {
let origin: <Runtime as Config>::Origin = From::from(Origin::root());
let origin: <Runtime as Config>::Origin =
From::from(DelayedOrigin::<BlockNumber, <Runtime as Config>::PalletsOrigin> {
delay: 1,
origin: Box::new(origin.caller().clone()),
});
Expand Down
4 changes: 2 additions & 2 deletions benchmarking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ pub use sp_runtime::traits::Zero;
/// Test functions are automatically generated for each benchmark and are
/// accessible to you when you run `cargo test`. All tests are named
/// `test_benchmark_<benchmark_name>`, expect you to pass them the Runtime
/// Trait, and run them in a test externalities environment. The test function
/// Config, and run them in a test externalities environment. The test function
/// runs your benchmark just like a regular benchmark, but only testing at the
/// lowest and highest values for each component. The function will return
/// `Ok(())` if the benchmarks return no errors.
Expand Down Expand Up @@ -813,7 +813,7 @@ macro_rules! impl_benchmark {
let mut whitelist = whitelist.to_vec();
let whitelisted_caller_key =
<frame_system::Account::<$runtime> as frame_support::storage::StorageMap<_,_>>::hashed_key_for(
$crate::whitelisted_caller::<<$runtime as frame_system::Trait>::AccountId>()
$crate::whitelisted_caller::<<$runtime as frame_system::Config>::AccountId>()
);
whitelist.push(whitelisted_caller_key.into());
$crate::benchmarking::set_whitelist(whitelist);
Expand Down
10 changes: 5 additions & 5 deletions benchmarking/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ use sp_runtime::{
use sp_std::prelude::*;

decl_storage! {
trait Store for Module<T: Trait> as Test {
trait Store for Module<T: Config> as Test {
Value get(fn value): Option<u32>;
}
}

decl_module! {
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
pub struct Module<T: Config> for enum Call where origin: T::Origin {
#[weight = 0]
fn set_value(origin, n: u32) -> DispatchResult {
let _sender = ensure_signed(origin)?;
Expand All @@ -41,7 +41,7 @@ impl_outer_origin! {
pub enum Origin for Test {}
}

pub trait Trait: frame_system::Trait {
pub trait Config: frame_system::Config {
type Event;
type BlockNumber;
}
Expand All @@ -51,7 +51,7 @@ type AccountId = u128;
#[derive(Clone, Eq, PartialEq)]
pub struct Test;

impl frame_system::Trait for Test {
impl frame_system::Config for Test {
type Origin = Origin;
type Index = u64;
type BlockNumber = u64;
Expand Down Expand Up @@ -79,7 +79,7 @@ impl frame_system::Trait for Test {
type SystemWeightInfo = ();
}

impl Trait for Test {
impl Config for Test {
type Event = ();
type BlockNumber = u32;
}
Expand Down
2 changes: 1 addition & 1 deletion currencies/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ The currencies module provides a mixed currencies system, by configuring a nativ

It also provides an adapter, to adapt `frame_support::traits::Currency` implementations into `BasicCurrencyExtended`.

The currencies module provides functionality of both `MultiCurrencyExtended` and `BasicCurrencyExtended`, via unified interfaces, and all calls would be delegated to the underlying multi-currency and base currency system. A native currency ID could be set by `Trait::GetNativeCurrencyId`, to identify the native currency.
The currencies module provides functionality of both `MultiCurrencyExtended` and `BasicCurrencyExtended`, via unified interfaces, and all calls would be delegated to the underlying multi-currency and base currency system. A native currency ID could be set by `Config::GetNativeCurrencyId`, to identify the native currency.
Loading