Skip to content

Commit f17569f

Browse files
authored
De-alias pallets in node template runtime (paritytech#6836)
* dealias pallets * Restore accidentally deleted code blocks
1 parent bd1a16c commit f17569f

File tree

3 files changed

+41
-40
lines changed

3 files changed

+41
-40
lines changed

bin/node-template/node/src/chain_spec.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,17 +139,17 @@ fn testnet_genesis(
139139
code: wasm_binary.to_vec(),
140140
changes_trie_config: Default::default(),
141141
}),
142-
balances: Some(BalancesConfig {
142+
pallet_balances: Some(BalancesConfig {
143143
// Configure endowed accounts with initial balance of 1 << 60.
144144
balances: endowed_accounts.iter().cloned().map(|k|(k, 1 << 60)).collect(),
145145
}),
146-
aura: Some(AuraConfig {
146+
pallet_aura: Some(AuraConfig {
147147
authorities: initial_authorities.iter().map(|x| (x.0.clone())).collect(),
148148
}),
149-
grandpa: Some(GrandpaConfig {
149+
pallet_grandpa: Some(GrandpaConfig {
150150
authorities: initial_authorities.iter().map(|x| (x.1.clone(), 1)).collect(),
151151
}),
152-
sudo: Some(SudoConfig {
152+
pallet_sudo: Some(SudoConfig {
153153
// Assign network admin rights.
154154
key: root_key,
155155
}),

bin/node-template/runtime/Cargo.toml

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,16 @@ targets = ["x86_64-unknown-linux-gnu"]
1212

1313
[dependencies]
1414
codec = { package = "parity-scale-codec", version = "1.3.4", default-features = false, features = ["derive"] }
15-
aura = { version = "2.0.0-rc5", default-features = false, package = "pallet-aura", path = "../../../frame/aura" }
16-
balances = { version = "2.0.0-rc5", default-features = false, package = "pallet-balances", path = "../../../frame/balances" }
15+
16+
pallet-aura = { version = "2.0.0-rc5", default-features = false, path = "../../../frame/aura" }
17+
pallet-balances = { version = "2.0.0-rc5", default-features = false, path = "../../../frame/balances" }
1718
frame-support = { version = "2.0.0-rc5", default-features = false, path = "../../../frame/support" }
18-
grandpa = { version = "2.0.0-rc5", default-features = false, package = "pallet-grandpa", path = "../../../frame/grandpa" }
19-
randomness-collective-flip = { version = "2.0.0-rc5", default-features = false, package = "pallet-randomness-collective-flip", path = "../../../frame/randomness-collective-flip" }
20-
sudo = { version = "2.0.0-rc5", default-features = false, package = "pallet-sudo", path = "../../../frame/sudo" }
19+
pallet-grandpa = { version = "2.0.0-rc5", default-features = false, path = "../../../frame/grandpa" }
20+
pallet-randomness-collective-flip = { version = "2.0.0-rc5", default-features = false, path = "../../../frame/randomness-collective-flip" }
21+
pallet-sudo = { version = "2.0.0-rc5", default-features = false, path = "../../../frame/sudo" }
2122
frame-system = { version = "2.0.0-rc5", default-features = false, path = "../../../frame/system" }
22-
timestamp = { version = "2.0.0-rc5", default-features = false, package = "pallet-timestamp", path = "../../../frame/timestamp" }
23-
transaction-payment = { version = "2.0.0-rc5", default-features = false, package = "pallet-transaction-payment", path = "../../../frame/transaction-payment" }
23+
pallet-timestamp = { version = "2.0.0-rc5", default-features = false, path = "../../../frame/timestamp" }
24+
pallet-transaction-payment = { version = "2.0.0-rc5", default-features = false, path = "../../../frame/transaction-payment" }
2425
frame-executive = { version = "2.0.0-rc5", default-features = false, path = "../../../frame/executive" }
2526
serde = { version = "1.0.101", optional = true, features = ["derive"] }
2627
sp-api = { version = "2.0.0-rc5", default-features = false, path = "../../../primitives/api" }
@@ -47,13 +48,17 @@ wasm-builder-runner = { version = "1.0.5", package = "substrate-wasm-builder-run
4748
[features]
4849
default = ["std"]
4950
std = [
50-
"aura/std",
51-
"balances/std",
5251
"codec/std",
5352
"frame-executive/std",
5453
"frame-support/std",
55-
"grandpa/std",
56-
"randomness-collective-flip/std",
54+
"pallet-aura/std",
55+
"pallet-balances/std",
56+
"pallet-grandpa/std",
57+
"pallet-randomness-collective-flip/std",
58+
"pallet-sudo/std",
59+
"pallet-timestamp/std",
60+
"pallet-transaction-payment/std",
61+
"pallet-transaction-payment-rpc-runtime-api/std",
5762
"serde",
5863
"sp-api/std",
5964
"sp-block-builder/std",
@@ -66,11 +71,7 @@ std = [
6671
"sp-std/std",
6772
"sp-transaction-pool/std",
6873
"sp-version/std",
69-
"sudo/std",
7074
"frame-system/std",
71-
"timestamp/std",
72-
"transaction-payment/std",
7375
"frame-system-rpc-runtime-api/std",
74-
"pallet-transaction-payment-rpc-runtime-api/std",
7576
"template/std",
7677
]

bin/node-template/runtime/src/lib.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ use sp_runtime::traits::{
1717
};
1818
use sp_api::impl_runtime_apis;
1919
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
20-
use grandpa::{AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList};
21-
use grandpa::fg_primitives;
20+
use pallet_grandpa::{AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList};
21+
use pallet_grandpa::fg_primitives;
2222
use sp_version::RuntimeVersion;
2323
#[cfg(feature = "std")]
2424
use sp_version::NativeVersion;
2525

2626
// A few exports that help ease life for downstream crates.
2727
#[cfg(any(feature = "std", test))]
2828
pub use sp_runtime::BuildStorage;
29-
pub use timestamp::Call as TimestampCall;
30-
pub use balances::Call as BalancesCall;
29+
pub use pallet_timestamp::Call as TimestampCall;
30+
pub use pallet_balances::Call as BalancesCall;
3131
pub use sp_runtime::{Permill, Perbill};
3232
pub use frame_support::{
3333
construct_runtime, parameter_types, StorageValue,
@@ -187,16 +187,16 @@ impl frame_system::Trait for Runtime {
187187
/// What to do if an account is fully reaped from the system.
188188
type OnKilledAccount = ();
189189
/// The data to be stored in an account.
190-
type AccountData = balances::AccountData<Balance>;
190+
type AccountData = pallet_balances::AccountData<Balance>;
191191
/// Weight information for the extrinsics of this pallet.
192192
type SystemWeightInfo = ();
193193
}
194194

195-
impl aura::Trait for Runtime {
195+
impl pallet_aura::Trait for Runtime {
196196
type AuthorityId = AuraId;
197197
}
198198

199-
impl grandpa::Trait for Runtime {
199+
impl pallet_grandpa::Trait for Runtime {
200200
type Event = Event;
201201
type Call = Call;
202202

@@ -217,7 +217,7 @@ parameter_types! {
217217
pub const MinimumPeriod: u64 = SLOT_DURATION / 2;
218218
}
219219

220-
impl timestamp::Trait for Runtime {
220+
impl pallet_timestamp::Trait for Runtime {
221221
/// A timestamp: milliseconds since the unix epoch.
222222
type Moment = u64;
223223
type OnTimestampSet = Aura;
@@ -229,7 +229,7 @@ parameter_types! {
229229
pub const ExistentialDeposit: u128 = 500;
230230
}
231231

232-
impl balances::Trait for Runtime {
232+
impl pallet_balances::Trait for Runtime {
233233
/// The type for recording an account's balance.
234234
type Balance = Balance;
235235
/// The ubiquitous event type.
@@ -244,15 +244,15 @@ parameter_types! {
244244
pub const TransactionByteFee: Balance = 1;
245245
}
246246

247-
impl transaction_payment::Trait for Runtime {
248-
type Currency = balances::Module<Runtime>;
247+
impl pallet_transaction_payment::Trait for Runtime {
248+
type Currency = Balances;
249249
type OnTransactionPayment = ();
250250
type TransactionByteFee = TransactionByteFee;
251251
type WeightToFee = IdentityFee<Balance>;
252252
type FeeMultiplierUpdate = ();
253253
}
254254

255-
impl sudo::Trait for Runtime {
255+
impl pallet_sudo::Trait for Runtime {
256256
type Event = Event;
257257
type Call = Call;
258258
}
@@ -270,13 +270,13 @@ construct_runtime!(
270270
UncheckedExtrinsic = UncheckedExtrinsic
271271
{
272272
System: frame_system::{Module, Call, Config, Storage, Event<T>},
273-
RandomnessCollectiveFlip: randomness_collective_flip::{Module, Call, Storage},
274-
Timestamp: timestamp::{Module, Call, Storage, Inherent},
275-
Aura: aura::{Module, Config<T>, Inherent},
276-
Grandpa: grandpa::{Module, Call, Storage, Config, Event},
277-
Balances: balances::{Module, Call, Storage, Config<T>, Event<T>},
278-
TransactionPayment: transaction_payment::{Module, Storage},
279-
Sudo: sudo::{Module, Call, Config<T>, Storage, Event<T>},
273+
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Module, Call, Storage},
274+
Timestamp: pallet_timestamp::{Module, Call, Storage, Inherent},
275+
Aura: pallet_aura::{Module, Config<T>, Inherent},
276+
Grandpa: pallet_grandpa::{Module, Call, Storage, Config, Event},
277+
Balances: pallet_balances::{Module, Call, Storage, Config<T>, Event<T>},
278+
TransactionPayment: pallet_transaction_payment::{Module, Storage},
279+
Sudo: pallet_sudo::{Module, Call, Config<T>, Storage, Event<T>},
280280
// Include the custom logic from the template pallet in the runtime.
281281
TemplateModule: template::{Module, Call, Storage, Event<T>},
282282
}
@@ -300,7 +300,7 @@ pub type SignedExtra = (
300300
frame_system::CheckEra<Runtime>,
301301
frame_system::CheckNonce<Runtime>,
302302
frame_system::CheckWeight<Runtime>,
303-
transaction_payment::ChargeTransactionPayment<Runtime>
303+
pallet_transaction_payment::ChargeTransactionPayment<Runtime>
304304
);
305305
/// Unchecked extrinsic type as expected by this runtime.
306306
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;
@@ -423,7 +423,7 @@ impl_runtime_apis! {
423423
None
424424
}
425425
}
426-
426+
427427
impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {
428428
fn account_nonce(account: AccountId) -> Index {
429429
System::account_nonce(account)

0 commit comments

Comments
 (0)