Skip to content
This repository was archived by the owner on Jul 4, 2022. It is now read-only.

Commit 0fc8329

Browse files
authored
Define ss58 prefix inside the runtime (#7810)
* Add SS58Prefix type to the frame_system config trait * Remove unused chain_id runtime interface
1 parent b442214 commit 0fc8329

File tree

67 files changed

+85
-25
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+85
-25
lines changed

bin/node-template/pallets/template/src/mock.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ impl_outer_origin! {
1616
pub struct Test;
1717
parameter_types! {
1818
pub const BlockHashCount: u64 = 250;
19+
pub const SS58Prefix: u8 = 42;
1920
}
2021

2122
impl system::Config for Test {
@@ -40,6 +41,7 @@ impl system::Config for Test {
4041
type OnNewAccount = ();
4142
type OnKilledAccount = ();
4243
type SystemWeightInfo = ();
44+
type SS58Prefix = SS58Prefix;
4345
}
4446

4547
impl Config for Test {

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ parameter_types! {
136136
::with_sensible_defaults(2 * WEIGHT_PER_SECOND, NORMAL_DISPATCH_RATIO);
137137
pub BlockLength: frame_system::limits::BlockLength = frame_system::limits::BlockLength
138138
::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
139+
pub const SS58Prefix: u8 = 42;
139140
}
140141

141142
// Configure FRAME pallets to include in runtime.
@@ -185,6 +186,8 @@ impl frame_system::Config for Runtime {
185186
type AccountData = pallet_balances::AccountData<Balance>;
186187
/// Weight information for the extrinsics of this pallet.
187188
type SystemWeightInfo = ();
189+
/// This is used as an identifier of the chain. 42 is the generic substrate prefix.
190+
type SS58Prefix = SS58Prefix;
188191
}
189192

190193
impl pallet_aura::Config for Runtime {

bin/node/runtime/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ parameter_types! {
176176
})
177177
.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)
178178
.build_or_panic();
179+
pub const SS58Prefix: u8 = 42;
179180
}
180181

181182
const_assert!(NORMAL_DISPATCH_RATIO.deconstruct() >= AVERAGE_ON_INITIALIZE_RATIO.deconstruct());
@@ -202,6 +203,7 @@ impl frame_system::Config for Runtime {
202203
type OnNewAccount = ();
203204
type OnKilledAccount = ();
204205
type SystemWeightInfo = frame_system::weights::SubstrateWeight<Runtime>;
206+
type SS58Prefix = SS58Prefix;
205207
}
206208

207209
impl pallet_utility::Config for Runtime {

frame/assets/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -952,6 +952,7 @@ mod tests {
952952
type OnNewAccount = ();
953953
type OnKilledAccount = ();
954954
type SystemWeightInfo = ();
955+
type SS58Prefix = ();
955956
}
956957

957958
parameter_types! {

frame/atomic-swap/src/tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ impl frame_system::Config for Test {
4242
type OnNewAccount = ();
4343
type OnKilledAccount = ();
4444
type SystemWeightInfo = ();
45+
type SS58Prefix = ();
4546
}
4647
parameter_types! {
4748
pub const ExistentialDeposit: u64 = 1;

frame/aura/src/mock.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ impl frame_system::Config for Test {
6666
type OnNewAccount = ();
6767
type OnKilledAccount = ();
6868
type SystemWeightInfo = ();
69+
type SS58Prefix = ();
6970
}
7071

7172
impl pallet_timestamp::Config for Test {

frame/authority-discovery/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ mod tests {
164164
type OnNewAccount = ();
165165
type OnKilledAccount = ();
166166
type SystemWeightInfo = ();
167+
type SS58Prefix = ();
167168
}
168169

169170
impl_outer_origin! {

frame/authorship/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ mod tests {
438438
type OnNewAccount = ();
439439
type OnKilledAccount = ();
440440
type SystemWeightInfo = ();
441+
type SS58Prefix = ();
441442
}
442443

443444
parameter_types! {

frame/babe/src/mock.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ impl frame_system::Config for Test {
8686
type OnNewAccount = ();
8787
type OnKilledAccount = ();
8888
type SystemWeightInfo = ();
89+
type SS58Prefix = ();
8990
}
9091

9192
impl<C> frame_system::offchain::SendTransactionTypes<C> for Test

frame/balances/src/tests_composite.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ impl frame_system::Config for Test {
7777
type OnNewAccount = ();
7878
type OnKilledAccount = ();
7979
type SystemWeightInfo = ();
80+
type SS58Prefix = ();
8081
}
8182
parameter_types! {
8283
pub const TransactionByteFee: u64 = 1;

0 commit comments

Comments
 (0)