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 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
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions bin/node-template/pallets/template/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ mod mock;
mod tests;

/// Configure the pallet by specifying the parameters and types on which it depends.
pub trait Trait: frame_system::Trait {
pub trait Config: frame_system::Config {
/// Because this pallet emits events, it depends on the runtime's definition of an event.
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 pallet's runtime storage items.
Expand All @@ -25,7 +25,7 @@ decl_storage! {
// A unique name is used to ensure that the pallet's storage items are isolated.
// This name may be updated, but each pallet in the runtime must use a unique name.
// ---------------------------------vvvvvvvvvvvvvv
trait Store for Module<T: Trait> as TemplateModule {
trait Store for Module<T: Config> as TemplateModule {
// Learn more about declaring storage items:
// https://substrate.dev/docs/en/knowledgebase/runtime/storage#declaring-storage-items
Something get(fn something): Option<u32>;
Expand All @@ -35,7 +35,7 @@ decl_storage! {
// Pallets use events to inform users when important changes are made.
// https://substrate.dev/docs/en/knowledgebase/runtime/events
decl_event!(
pub enum Event<T> where AccountId = <T as frame_system::Trait>::AccountId {
pub enum Event<T> where AccountId = <T as frame_system::Config>::AccountId {
/// Event documentation should end with an array that provides descriptive names for event
/// parameters. [something, who]
SomethingStored(u32, AccountId),
Expand All @@ -44,7 +44,7 @@ decl_event!(

// Errors inform users that something went wrong.
decl_error! {
pub enum Error for Module<T: Trait> {
pub enum Error for Module<T: Config> {
/// Error names should be descriptive.
NoneValue,
/// Errors should have helpful documentation associated with them.
Expand All @@ -56,7 +56,7 @@ decl_error! {
// These functions materialize as "extrinsics", which are often compared to transactions.
// Dispatchable functions must be annotated with a weight and must return a DispatchResult.
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 {
// Errors must be initialized if they are used by the pallet.
type Error = Error<T>;

Expand Down
6 changes: 3 additions & 3 deletions bin/node-template/pallets/template/src/mock.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{Module, Trait};
use crate::{Module, Config};
use sp_core::H256;
use frame_support::{impl_outer_origin, parameter_types, weights::Weight};
use sp_runtime::{
Expand All @@ -21,7 +21,7 @@ parameter_types! {
pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);
}

impl system::Trait for Test {
impl system::Config for Test {
type BaseCallFilter = ();
type Origin = Origin;
type Call = ();
Expand Down Expand Up @@ -49,7 +49,7 @@ impl system::Trait for Test {
type SystemWeightInfo = ();
}

impl Trait for Test {
impl Config for Test {
type Event = ();
}

Expand Down
18 changes: 9 additions & 9 deletions bin/node-template/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ parameter_types! {

// Configure FRAME pallets to include in runtime.

impl frame_system::Trait for Runtime {
impl frame_system::Config for Runtime {
/// The basic call filter to use in dispatchable.
type BaseCallFilter = ();
/// The identifier used to distinguish between accounts.
Expand Down Expand Up @@ -199,11 +199,11 @@ impl frame_system::Trait for Runtime {
type SystemWeightInfo = ();
}

impl pallet_aura::Trait for Runtime {
impl pallet_aura::Config for Runtime {
type AuthorityId = AuraId;
}

impl pallet_grandpa::Trait for Runtime {
impl pallet_grandpa::Config for Runtime {
type Event = Event;
type Call = Call;

Expand All @@ -226,7 +226,7 @@ parameter_types! {
pub const MinimumPeriod: u64 = SLOT_DURATION / 2;
}

impl pallet_timestamp::Trait for Runtime {
impl pallet_timestamp::Config for Runtime {
/// A timestamp: milliseconds since the unix epoch.
type Moment = u64;
type OnTimestampSet = Aura;
Expand All @@ -239,7 +239,7 @@ parameter_types! {
pub const MaxLocks: u32 = 50;
}

impl pallet_balances::Trait for Runtime {
impl pallet_balances::Config for Runtime {
type MaxLocks = MaxLocks;
/// The type for recording an account's balance.
type Balance = Balance;
Expand All @@ -255,20 +255,20 @@ parameter_types! {
pub const TransactionByteFee: Balance = 1;
}

impl pallet_transaction_payment::Trait for Runtime {
impl pallet_transaction_payment::Config for Runtime {
type OnChargeTransaction = CurrencyAdapter<Balances, ()>;
type TransactionByteFee = TransactionByteFee;
type WeightToFee = IdentityFee<Balance>;
type FeeMultiplierUpdate = ();
}

impl pallet_sudo::Trait for Runtime {
impl pallet_sudo::Config for Runtime {
type Event = Event;
type Call = Call;
}

/// Configure the pallet template in pallets/template.
impl template::Trait for Runtime {
impl template::Config for Runtime {
type Event = Event;
}

Expand Down Expand Up @@ -457,7 +457,7 @@ impl_runtime_apis! {
use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};

use frame_system_benchmarking::Module as SystemBench;
impl frame_system_benchmarking::Trait for Runtime {}
impl frame_system_benchmarking::Config for Runtime {}

let whitelist: Vec<TrackedStorageKey> = vec![
// Block Number
Expand Down
4 changes: 2 additions & 2 deletions bin/node/executor/tests/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -580,15 +580,15 @@ const CODE_TRANSFER: &str = r#"
#[test]
fn deploying_wasm_contract_should_work() {
let transfer_code = wat::parse_str(CODE_TRANSFER).unwrap();
let transfer_ch = <Runtime as frame_system::Trait>::Hashing::hash(&transfer_code);
let transfer_ch = <Runtime as frame_system::Config>::Hashing::hash(&transfer_code);

let addr = pallet_contracts::Module::<Runtime>::contract_address(
&charlie(),
&transfer_ch,
&[],
);

let subsistence = pallet_contracts::Config::<Runtime>::subsistence_threshold_uncached();
let subsistence = pallet_contracts::ConfigCache::<Runtime>::subsistence_threshold_uncached();

let b = construct_block(
&mut new_test_ext(compact_code_unwrap(), false),
Expand Down
2 changes: 1 addition & 1 deletion bin/node/runtime/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ mod multiplier_tests {
fm = next;
iterations += 1;
let fee =
<Runtime as pallet_transaction_payment::Trait>::WeightToFee::calc(&tx_weight);
<Runtime as pallet_transaction_payment::Config>::WeightToFee::calc(&tx_weight);
let adjusted_fee = fm.saturating_mul_acc_int(fee);
println!(
"iteration {}, new fm = {:?}. Fee at this point is: {} units / {} millicents, \
Expand Down
Loading