diff --git a/substrate/bin/node-template/pallets/template/src/mock.rs b/substrate/bin/node-template/pallets/template/src/mock.rs index 84af63a1c3..60d22aad7b 100644 --- a/substrate/bin/node-template/pallets/template/src/mock.rs +++ b/substrate/bin/node-template/pallets/template/src/mock.rs @@ -16,6 +16,7 @@ impl_outer_origin! { pub struct Test; parameter_types! { pub const BlockHashCount: u64 = 250; + pub const SS58Prefix: u8 = 42; } impl system::Config for Test { @@ -40,6 +41,7 @@ impl system::Config for Test { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = SS58Prefix; } impl Config for Test { diff --git a/substrate/bin/node-template/runtime/src/lib.rs b/substrate/bin/node-template/runtime/src/lib.rs index 51df3dd5a3..0812346779 100644 --- a/substrate/bin/node-template/runtime/src/lib.rs +++ b/substrate/bin/node-template/runtime/src/lib.rs @@ -136,6 +136,7 @@ parameter_types! { ::with_sensible_defaults(2 * WEIGHT_PER_SECOND, NORMAL_DISPATCH_RATIO); pub BlockLength: frame_system::limits::BlockLength = frame_system::limits::BlockLength ::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO); + pub const SS58Prefix: u8 = 42; } // Configure FRAME pallets to include in runtime. @@ -185,6 +186,8 @@ impl frame_system::Config for Runtime { type AccountData = pallet_balances::AccountData; /// Weight information for the extrinsics of this pallet. type SystemWeightInfo = (); + /// This is used as an identifier of the chain. 42 is the generic substrate prefix. + type SS58Prefix = SS58Prefix; } impl pallet_aura::Config for Runtime { diff --git a/substrate/bin/node/runtime/src/lib.rs b/substrate/bin/node/runtime/src/lib.rs index a86b015dbc..4eee9d83a5 100644 --- a/substrate/bin/node/runtime/src/lib.rs +++ b/substrate/bin/node/runtime/src/lib.rs @@ -176,6 +176,7 @@ parameter_types! { }) .avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO) .build_or_panic(); + pub const SS58Prefix: u8 = 42; } const_assert!(NORMAL_DISPATCH_RATIO.deconstruct() >= AVERAGE_ON_INITIALIZE_RATIO.deconstruct()); @@ -202,6 +203,7 @@ impl frame_system::Config for Runtime { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = frame_system::weights::SubstrateWeight; + type SS58Prefix = SS58Prefix; } impl pallet_utility::Config for Runtime { diff --git a/substrate/frame/assets/src/lib.rs b/substrate/frame/assets/src/lib.rs index df1cb87f75..137ba81f38 100644 --- a/substrate/frame/assets/src/lib.rs +++ b/substrate/frame/assets/src/lib.rs @@ -952,6 +952,7 @@ mod tests { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } parameter_types! { diff --git a/substrate/frame/atomic-swap/src/tests.rs b/substrate/frame/atomic-swap/src/tests.rs index 47b5102bc5..19f5fc1dff 100644 --- a/substrate/frame/atomic-swap/src/tests.rs +++ b/substrate/frame/atomic-swap/src/tests.rs @@ -42,6 +42,7 @@ impl frame_system::Config for Test { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } parameter_types! { pub const ExistentialDeposit: u64 = 1; diff --git a/substrate/frame/aura/src/mock.rs b/substrate/frame/aura/src/mock.rs index 1fcb1c2340..8d5cbcc9b7 100644 --- a/substrate/frame/aura/src/mock.rs +++ b/substrate/frame/aura/src/mock.rs @@ -66,6 +66,7 @@ impl frame_system::Config for Test { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } impl pallet_timestamp::Config for Test { diff --git a/substrate/frame/authority-discovery/src/lib.rs b/substrate/frame/authority-discovery/src/lib.rs index 2d275e01bb..5932142175 100644 --- a/substrate/frame/authority-discovery/src/lib.rs +++ b/substrate/frame/authority-discovery/src/lib.rs @@ -164,6 +164,7 @@ mod tests { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } impl_outer_origin! { diff --git a/substrate/frame/authorship/src/lib.rs b/substrate/frame/authorship/src/lib.rs index 693375e3c5..3672174e25 100644 --- a/substrate/frame/authorship/src/lib.rs +++ b/substrate/frame/authorship/src/lib.rs @@ -438,6 +438,7 @@ mod tests { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } parameter_types! { diff --git a/substrate/frame/babe/src/mock.rs b/substrate/frame/babe/src/mock.rs index 77b117db7f..f8805f7a10 100644 --- a/substrate/frame/babe/src/mock.rs +++ b/substrate/frame/babe/src/mock.rs @@ -86,6 +86,7 @@ impl frame_system::Config for Test { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } impl frame_system::offchain::SendTransactionTypes for Test diff --git a/substrate/frame/balances/src/tests_composite.rs b/substrate/frame/balances/src/tests_composite.rs index 81c2b89527..f98194c503 100644 --- a/substrate/frame/balances/src/tests_composite.rs +++ b/substrate/frame/balances/src/tests_composite.rs @@ -77,6 +77,7 @@ impl frame_system::Config for Test { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } parameter_types! { pub const TransactionByteFee: u64 = 1; diff --git a/substrate/frame/balances/src/tests_local.rs b/substrate/frame/balances/src/tests_local.rs index c168e1d8e5..e9d6fe2530 100644 --- a/substrate/frame/balances/src/tests_local.rs +++ b/substrate/frame/balances/src/tests_local.rs @@ -78,6 +78,7 @@ impl frame_system::Config for Test { type OnNewAccount = (); type OnKilledAccount = Module; type SystemWeightInfo = (); + type SS58Prefix = (); } parameter_types! { pub const TransactionByteFee: u64 = 1; diff --git a/substrate/frame/benchmarking/src/tests.rs b/substrate/frame/benchmarking/src/tests.rs index f86abebbb9..e31f5ec091 100644 --- a/substrate/frame/benchmarking/src/tests.rs +++ b/substrate/frame/benchmarking/src/tests.rs @@ -94,6 +94,7 @@ impl frame_system::Config for Test { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } impl Config for Test { diff --git a/substrate/frame/bounties/src/tests.rs b/substrate/frame/bounties/src/tests.rs index 4ebff64b4e..bcf371eae4 100644 --- a/substrate/frame/bounties/src/tests.rs +++ b/substrate/frame/bounties/src/tests.rs @@ -82,6 +82,7 @@ impl frame_system::Config for Test { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } parameter_types! { pub const ExistentialDeposit: u64 = 1; diff --git a/substrate/frame/collective/src/lib.rs b/substrate/frame/collective/src/lib.rs index efc8626d68..1448bd9bc3 100644 --- a/substrate/frame/collective/src/lib.rs +++ b/substrate/frame/collective/src/lib.rs @@ -996,6 +996,7 @@ mod tests { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } impl Config for Test { type Origin = Origin; diff --git a/substrate/frame/contracts/src/tests.rs b/substrate/frame/contracts/src/tests.rs index 6ac2fb0f97..991a89563e 100644 --- a/substrate/frame/contracts/src/tests.rs +++ b/substrate/frame/contracts/src/tests.rs @@ -130,6 +130,7 @@ impl frame_system::Config for Test { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } impl pallet_balances::Config for Test { type MaxLocks = (); diff --git a/substrate/frame/democracy/src/tests.rs b/substrate/frame/democracy/src/tests.rs index dae3a26220..0e369bf3bd 100644 --- a/substrate/frame/democracy/src/tests.rs +++ b/substrate/frame/democracy/src/tests.rs @@ -113,6 +113,7 @@ impl frame_system::Config for Test { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } parameter_types! { pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * BlockWeights::get().max_block; diff --git a/substrate/frame/elections-phragmen/src/lib.rs b/substrate/frame/elections-phragmen/src/lib.rs index b541303f65..9b7b9064fb 100644 --- a/substrate/frame/elections-phragmen/src/lib.rs +++ b/substrate/frame/elections-phragmen/src/lib.rs @@ -1099,6 +1099,7 @@ mod tests { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } parameter_types! { diff --git a/substrate/frame/elections/src/mock.rs b/substrate/frame/elections/src/mock.rs index 482c905f89..8a4111a38c 100644 --- a/substrate/frame/elections/src/mock.rs +++ b/substrate/frame/elections/src/mock.rs @@ -57,6 +57,7 @@ impl frame_system::Config for Test { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } parameter_types! { diff --git a/substrate/frame/example-offchain-worker/src/tests.rs b/substrate/frame/example-offchain-worker/src/tests.rs index 196d4cac4a..a94174a33b 100644 --- a/substrate/frame/example-offchain-worker/src/tests.rs +++ b/substrate/frame/example-offchain-worker/src/tests.rs @@ -76,6 +76,7 @@ impl frame_system::Config for Test { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } type Extrinsic = TestXt, ()>; diff --git a/substrate/frame/example-parallel/src/tests.rs b/substrate/frame/example-parallel/src/tests.rs index 24e846c3de..3da41b2218 100644 --- a/substrate/frame/example-parallel/src/tests.rs +++ b/substrate/frame/example-parallel/src/tests.rs @@ -59,6 +59,7 @@ impl frame_system::Config for Test { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } parameter_types! { diff --git a/substrate/frame/example/src/lib.rs b/substrate/frame/example/src/lib.rs index 3ddb2fd4c1..14c40778ba 100644 --- a/substrate/frame/example/src/lib.rs +++ b/substrate/frame/example/src/lib.rs @@ -764,6 +764,7 @@ mod tests { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } parameter_types! { pub const ExistentialDeposit: u64 = 1; diff --git a/substrate/frame/executive/src/lib.rs b/substrate/frame/executive/src/lib.rs index caba857254..cb45a49b23 100644 --- a/substrate/frame/executive/src/lib.rs +++ b/substrate/frame/executive/src/lib.rs @@ -618,6 +618,7 @@ mod tests { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } type Balance = u64; diff --git a/substrate/frame/grandpa/src/mock.rs b/substrate/frame/grandpa/src/mock.rs index ae13c94659..288ef47a8e 100644 --- a/substrate/frame/grandpa/src/mock.rs +++ b/substrate/frame/grandpa/src/mock.rs @@ -100,6 +100,7 @@ impl frame_system::Config for Test { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } impl frame_system::offchain::SendTransactionTypes for Test diff --git a/substrate/frame/identity/src/tests.rs b/substrate/frame/identity/src/tests.rs index 7f3a95dcd1..04e6bb7df3 100644 --- a/substrate/frame/identity/src/tests.rs +++ b/substrate/frame/identity/src/tests.rs @@ -63,6 +63,7 @@ impl frame_system::Config for Test { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } parameter_types! { pub const ExistentialDeposit: u64 = 1; diff --git a/substrate/frame/im-online/src/mock.rs b/substrate/frame/im-online/src/mock.rs index 0a6dc1f79c..71dc3d52ac 100644 --- a/substrate/frame/im-online/src/mock.rs +++ b/substrate/frame/im-online/src/mock.rs @@ -130,6 +130,7 @@ impl frame_system::Config for Runtime { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } parameter_types! { diff --git a/substrate/frame/indices/src/mock.rs b/substrate/frame/indices/src/mock.rs index 63f0277548..0e1e9c3d43 100644 --- a/substrate/frame/indices/src/mock.rs +++ b/substrate/frame/indices/src/mock.rs @@ -69,6 +69,7 @@ impl frame_system::Config for Test { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } parameter_types! { diff --git a/substrate/frame/membership/src/lib.rs b/substrate/frame/membership/src/lib.rs index cfdc38752b..943071c9a1 100644 --- a/substrate/frame/membership/src/lib.rs +++ b/substrate/frame/membership/src/lib.rs @@ -321,6 +321,7 @@ mod tests { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } ord_parameter_types! { pub const One: u64 = 1; diff --git a/substrate/frame/merkle-mountain-range/src/mock.rs b/substrate/frame/merkle-mountain-range/src/mock.rs index c311d53446..4865ea7e57 100644 --- a/substrate/frame/merkle-mountain-range/src/mock.rs +++ b/substrate/frame/merkle-mountain-range/src/mock.rs @@ -63,6 +63,7 @@ impl frame_system::Config for Test { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } impl Config for Test { diff --git a/substrate/frame/multisig/src/tests.rs b/substrate/frame/multisig/src/tests.rs index 7a959ec37f..4101b718bc 100644 --- a/substrate/frame/multisig/src/tests.rs +++ b/substrate/frame/multisig/src/tests.rs @@ -80,6 +80,7 @@ impl frame_system::Config for Test { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } parameter_types! { pub const ExistentialDeposit: u64 = 1; diff --git a/substrate/frame/nicks/src/lib.rs b/substrate/frame/nicks/src/lib.rs index 2b74f323d8..994e6996a1 100644 --- a/substrate/frame/nicks/src/lib.rs +++ b/substrate/frame/nicks/src/lib.rs @@ -283,6 +283,7 @@ mod tests { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } parameter_types! { pub const ExistentialDeposit: u64 = 1; diff --git a/substrate/frame/node-authorization/src/lib.rs b/substrate/frame/node-authorization/src/lib.rs index 9641bea116..e48faef128 100644 --- a/substrate/frame/node-authorization/src/lib.rs +++ b/substrate/frame/node-authorization/src/lib.rs @@ -472,6 +472,7 @@ mod tests { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } ord_parameter_types! { diff --git a/substrate/frame/offences/benchmarking/src/mock.rs b/substrate/frame/offences/benchmarking/src/mock.rs index e55d7ac8e3..2a93bfa2c8 100644 --- a/substrate/frame/offences/benchmarking/src/mock.rs +++ b/substrate/frame/offences/benchmarking/src/mock.rs @@ -63,6 +63,7 @@ impl frame_system::Config for Test { type OnNewAccount = (); type OnKilledAccount = (Balances,); type SystemWeightInfo = (); + type SS58Prefix = (); } parameter_types! { pub const ExistentialDeposit: Balance = 10; diff --git a/substrate/frame/offences/src/mock.rs b/substrate/frame/offences/src/mock.rs index 124b003029..7d23780b12 100644 --- a/substrate/frame/offences/src/mock.rs +++ b/substrate/frame/offences/src/mock.rs @@ -116,6 +116,7 @@ impl frame_system::Config for Runtime { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } parameter_types! { diff --git a/substrate/frame/proxy/src/tests.rs b/substrate/frame/proxy/src/tests.rs index b1dca43b6a..b3f9ebc75d 100644 --- a/substrate/frame/proxy/src/tests.rs +++ b/substrate/frame/proxy/src/tests.rs @@ -82,6 +82,7 @@ impl frame_system::Config for Test { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } parameter_types! { pub const ExistentialDeposit: u64 = 1; diff --git a/substrate/frame/randomness-collective-flip/src/lib.rs b/substrate/frame/randomness-collective-flip/src/lib.rs index 9332262d68..04db12d1df 100644 --- a/substrate/frame/randomness-collective-flip/src/lib.rs +++ b/substrate/frame/randomness-collective-flip/src/lib.rs @@ -180,6 +180,7 @@ mod tests { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } type System = frame_system::Module; diff --git a/substrate/frame/recovery/src/mock.rs b/substrate/frame/recovery/src/mock.rs index 9b991987ce..1303376784 100644 --- a/substrate/frame/recovery/src/mock.rs +++ b/substrate/frame/recovery/src/mock.rs @@ -78,6 +78,7 @@ impl frame_system::Config for Test { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } parameter_types! { diff --git a/substrate/frame/scheduler/src/lib.rs b/substrate/frame/scheduler/src/lib.rs index 9f0f806233..67b86fad82 100644 --- a/substrate/frame/scheduler/src/lib.rs +++ b/substrate/frame/scheduler/src/lib.rs @@ -837,6 +837,7 @@ mod tests { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } impl logger::Config for Test { type Event = (); diff --git a/substrate/frame/scored-pool/src/mock.rs b/substrate/frame/scored-pool/src/mock.rs index 7d49136cef..b96daf6ba3 100644 --- a/substrate/frame/scored-pool/src/mock.rs +++ b/substrate/frame/scored-pool/src/mock.rs @@ -68,6 +68,7 @@ impl frame_system::Config for Test { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } impl pallet_balances::Config for Test { diff --git a/substrate/frame/session/benchmarking/src/mock.rs b/substrate/frame/session/benchmarking/src/mock.rs index 9001dee879..db6c465854 100644 --- a/substrate/frame/session/benchmarking/src/mock.rs +++ b/substrate/frame/session/benchmarking/src/mock.rs @@ -67,6 +67,7 @@ impl frame_system::Config for Test { type OnNewAccount = (); type OnKilledAccount = Balances; type SystemWeightInfo = (); + type SS58Prefix = (); } parameter_types! { pub const ExistentialDeposit: Balance = 10; diff --git a/substrate/frame/session/src/mock.rs b/substrate/frame/session/src/mock.rs index fa71859feb..e69eec14b0 100644 --- a/substrate/frame/session/src/mock.rs +++ b/substrate/frame/session/src/mock.rs @@ -218,6 +218,7 @@ impl frame_system::Config for Test { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } impl pallet_timestamp::Config for Test { diff --git a/substrate/frame/society/src/mock.rs b/substrate/frame/society/src/mock.rs index 6a718c2185..c704008067 100644 --- a/substrate/frame/society/src/mock.rs +++ b/substrate/frame/society/src/mock.rs @@ -78,6 +78,7 @@ impl frame_system::Config for Test { type OnKilledAccount = (); type AccountData = pallet_balances::AccountData; type SystemWeightInfo = (); + type SS58Prefix = (); } impl pallet_balances::Config for Test { diff --git a/substrate/frame/staking/fuzzer/src/mock.rs b/substrate/frame/staking/fuzzer/src/mock.rs index 6f58d6a669..ca36bfb4c3 100644 --- a/substrate/frame/staking/fuzzer/src/mock.rs +++ b/substrate/frame/staking/fuzzer/src/mock.rs @@ -65,6 +65,7 @@ impl frame_system::Config for Test { type OnNewAccount = (); type OnKilledAccount = (Balances,); type SystemWeightInfo = (); + type SS58Prefix = (); } parameter_types! { pub const ExistentialDeposit: Balance = 10; diff --git a/substrate/frame/staking/src/mock.rs b/substrate/frame/staking/src/mock.rs index f3c6d50d4c..6f7842b6b5 100644 --- a/substrate/frame/staking/src/mock.rs +++ b/substrate/frame/staking/src/mock.rs @@ -166,6 +166,7 @@ impl frame_system::Config for Test { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } impl pallet_balances::Config for Test { type MaxLocks = MaxLocks; diff --git a/substrate/frame/sudo/src/mock.rs b/substrate/frame/sudo/src/mock.rs index 12707d3e9d..5a0919b8d7 100644 --- a/substrate/frame/sudo/src/mock.rs +++ b/substrate/frame/sudo/src/mock.rs @@ -139,6 +139,7 @@ impl frame_system::Config for Test { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } // Implement the logger module's `Config` on the Test runtime. diff --git a/substrate/frame/support/test/tests/pallet.rs b/substrate/frame/support/test/tests/pallet.rs index 5d2785ebf2..e05a0e9bdf 100644 --- a/substrate/frame/support/test/tests/pallet.rs +++ b/substrate/frame/support/test/tests/pallet.rs @@ -364,6 +364,7 @@ impl frame_system::Config for Runtime { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } impl pallet::Config for Runtime { type Event = Event; diff --git a/substrate/frame/support/test/tests/pallet_compatibility.rs b/substrate/frame/support/test/tests/pallet_compatibility.rs index 912d68baed..5711326300 100644 --- a/substrate/frame/support/test/tests/pallet_compatibility.rs +++ b/substrate/frame/support/test/tests/pallet_compatibility.rs @@ -226,6 +226,7 @@ impl frame_system::Config for Runtime { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } impl pallet::Config for Runtime { type Event = Event; diff --git a/substrate/frame/support/test/tests/pallet_compatibility_instance.rs b/substrate/frame/support/test/tests/pallet_compatibility_instance.rs index d2f7a6668c..cdcc6a99cf 100644 --- a/substrate/frame/support/test/tests/pallet_compatibility_instance.rs +++ b/substrate/frame/support/test/tests/pallet_compatibility_instance.rs @@ -218,6 +218,7 @@ impl frame_system::Config for Runtime { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } impl pallet::Config for Runtime { type Event = Event; diff --git a/substrate/frame/support/test/tests/pallet_instance.rs b/substrate/frame/support/test/tests/pallet_instance.rs index 82b058b7bd..caa9019edf 100644 --- a/substrate/frame/support/test/tests/pallet_instance.rs +++ b/substrate/frame/support/test/tests/pallet_instance.rs @@ -259,6 +259,7 @@ impl frame_system::Config for Runtime { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } impl pallet::Config for Runtime { type Event = Event; diff --git a/substrate/frame/support/test/tests/pallet_version.rs b/substrate/frame/support/test/tests/pallet_version.rs index 25320597ba..e70d752e40 100644 --- a/substrate/frame/support/test/tests/pallet_version.rs +++ b/substrate/frame/support/test/tests/pallet_version.rs @@ -165,6 +165,7 @@ impl frame_system::Config for Runtime { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } frame_support::construct_runtime!( diff --git a/substrate/frame/support/test/tests/pallet_with_name_trait_is_valid.rs b/substrate/frame/support/test/tests/pallet_with_name_trait_is_valid.rs index 01b965f3b5..fba1959489 100644 --- a/substrate/frame/support/test/tests/pallet_with_name_trait_is_valid.rs +++ b/substrate/frame/support/test/tests/pallet_with_name_trait_is_valid.rs @@ -141,6 +141,7 @@ mod tests { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } impl pallet_test::Trait for Runtime { diff --git a/substrate/frame/system/benches/bench.rs b/substrate/frame/system/benches/bench.rs index 4909317488..2e5d629218 100644 --- a/substrate/frame/system/benches/bench.rs +++ b/substrate/frame/system/benches/bench.rs @@ -87,6 +87,7 @@ impl system::Config for Runtime { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } impl module::Config for Runtime { diff --git a/substrate/frame/system/benchmarking/src/mock.rs b/substrate/frame/system/benchmarking/src/mock.rs index 8cfd70b2f0..686db8fb5a 100644 --- a/substrate/frame/system/benchmarking/src/mock.rs +++ b/substrate/frame/system/benchmarking/src/mock.rs @@ -72,6 +72,7 @@ impl frame_system::Config for Test { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } impl crate::Config for Test {} diff --git a/substrate/frame/system/src/lib.rs b/substrate/frame/system/src/lib.rs index a89577a478..a8ffd05bf6 100644 --- a/substrate/frame/system/src/lib.rs +++ b/substrate/frame/system/src/lib.rs @@ -257,6 +257,13 @@ pub trait Config: 'static + Eq + Clone { type OnKilledAccount: OnKilledAccount; type SystemWeightInfo: WeightInfo; + + /// The designated SS85 prefix of this chain. + /// + /// This replaces the "ss58Format" property declared in the chain spec. Reason is + /// that the runtime should know about the prefix in order to make use of it as + /// an identifier of the chain. + type SS58Prefix: Get; } pub type DigestOf = generic::Digest<::Hash>; @@ -516,6 +523,13 @@ decl_module! { /// The weight configuration (limits & base values) for each class of extrinsics and block. const BlockWeights: limits::BlockWeights = T::BlockWeights::get(); + /// The designated SS85 prefix of this chain. + /// + /// This replaces the "ss58Format" property declared in the chain spec. Reason is + /// that the runtime should know about the prefix in order to make use of it as + /// an identifier of the chain. + const SS58Prefix: u8 = T::SS58Prefix::get(); + fn on_runtime_upgrade() -> frame_support::weights::Weight { if !UpgradedToU32RefCount::get() { Account::::translate::<(T::Index, u8, T::AccountData), _>(|_key, (nonce, rc, data)| diff --git a/substrate/frame/system/src/mock.rs b/substrate/frame/system/src/mock.rs index 1558a5ed39..e22f5870ee 100644 --- a/substrate/frame/system/src/mock.rs +++ b/substrate/frame/system/src/mock.rs @@ -117,6 +117,7 @@ impl Config for Test { type OnNewAccount = (); type OnKilledAccount = RecordKilled; type SystemWeightInfo = (); + type SS58Prefix = (); } pub type System = Module; diff --git a/substrate/frame/timestamp/src/lib.rs b/substrate/frame/timestamp/src/lib.rs index b62777832a..423f7f5128 100644 --- a/substrate/frame/timestamp/src/lib.rs +++ b/substrate/frame/timestamp/src/lib.rs @@ -335,6 +335,7 @@ mod tests { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } parameter_types! { pub const MinimumPeriod: u64 = 5; diff --git a/substrate/frame/tips/src/tests.rs b/substrate/frame/tips/src/tests.rs index 3bfecafeaf..15f3481ba2 100644 --- a/substrate/frame/tips/src/tests.rs +++ b/substrate/frame/tips/src/tests.rs @@ -81,6 +81,7 @@ impl frame_system::Config for Test { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } parameter_types! { pub const ExistentialDeposit: u64 = 1; @@ -292,28 +293,28 @@ fn slash_tip_works() { System::set_block_number(1); Balances::make_free_balance_be(&Treasury::account_id(), 101); assert_eq!(Treasury::pot(), 100); - + assert_eq!(Balances::reserved_balance(0), 0); assert_eq!(Balances::free_balance(0), 100); - + assert_ok!(TipsModTestInst::report_awesome(Origin::signed(0), b"awesome.dot".to_vec(), 3)); - + assert_eq!(Balances::reserved_balance(0), 12); assert_eq!(Balances::free_balance(0), 88); - + let h = tip_hash(); assert_eq!(last_event(), RawEvent::NewTip(h)); - + // can't remove from any origin assert_noop!( TipsModTestInst::slash_tip(Origin::signed(0), h.clone()), BadOrigin, ); - + // can remove from root. assert_ok!(TipsModTestInst::slash_tip(Origin::root(), h.clone())); assert_eq!(last_event(), RawEvent::TipSlashed(h, 0, 12)); - + // tipper slashed assert_eq!(Balances::reserved_balance(0), 0); assert_eq!(Balances::free_balance(0), 88); diff --git a/substrate/frame/transaction-payment/src/lib.rs b/substrate/frame/transaction-payment/src/lib.rs index e530380dfb..a787836d24 100644 --- a/substrate/frame/transaction-payment/src/lib.rs +++ b/substrate/frame/transaction-payment/src/lib.rs @@ -662,6 +662,7 @@ mod tests { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } parameter_types! { diff --git a/substrate/frame/treasury/src/tests.rs b/substrate/frame/treasury/src/tests.rs index 8db303a426..4d0bdf32e4 100644 --- a/substrate/frame/treasury/src/tests.rs +++ b/substrate/frame/treasury/src/tests.rs @@ -80,6 +80,7 @@ impl frame_system::Config for Test { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } parameter_types! { pub const ExistentialDeposit: u64 = 1; diff --git a/substrate/frame/utility/src/tests.rs b/substrate/frame/utility/src/tests.rs index 95973a8823..4837be6952 100644 --- a/substrate/frame/utility/src/tests.rs +++ b/substrate/frame/utility/src/tests.rs @@ -118,6 +118,7 @@ impl frame_system::Config for Test { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } parameter_types! { pub const ExistentialDeposit: u64 = 1; diff --git a/substrate/frame/vesting/src/lib.rs b/substrate/frame/vesting/src/lib.rs index a7a8147a06..6a65e58d41 100644 --- a/substrate/frame/vesting/src/lib.rs +++ b/substrate/frame/vesting/src/lib.rs @@ -433,6 +433,7 @@ mod tests { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } parameter_types! { pub const MaxLocks: u32 = 10; diff --git a/substrate/primitives/externalities/src/lib.rs b/substrate/primitives/externalities/src/lib.rs index 6869969f4b..a6596a22d1 100644 --- a/substrate/primitives/externalities/src/lib.rs +++ b/substrate/primitives/externalities/src/lib.rs @@ -170,9 +170,6 @@ pub trait Externalities: ExtensionStore { value: Option>, ); - /// Get the identity of the chain. - fn chain_id(&self) -> u64; - /// Get the trie root of the current storage map. /// /// This will also update all child storage keys in the top-level storage map. diff --git a/substrate/primitives/io/src/lib.rs b/substrate/primitives/io/src/lib.rs index 023bf7dcb3..dba984f433 100644 --- a/substrate/primitives/io/src/lib.rs +++ b/substrate/primitives/io/src/lib.rs @@ -388,11 +388,6 @@ pub trait Trie { /// Interface that provides miscellaneous functions for communicating between the runtime and the node. #[runtime_interface] pub trait Misc { - /// The current relay chain identifier. - fn chain_id(&self) -> u64 { - sp_externalities::Externalities::chain_id(*self) - } - /// Print a number. fn print_num(val: u64) { log::debug!(target: "runtime", "{}", val); diff --git a/substrate/primitives/state-machine/src/basic.rs b/substrate/primitives/state-machine/src/basic.rs index 9de75785e4..def0eecf70 100644 --- a/substrate/primitives/state-machine/src/basic.rs +++ b/substrate/primitives/state-machine/src/basic.rs @@ -263,8 +263,6 @@ impl Externalities for BasicExternalities { crate::ext::StorageAppend::new(current).append(value); } - fn chain_id(&self) -> u64 { 42 } - fn storage_root(&mut self) -> Vec { let mut top = self.inner.top.clone(); let prefixed_keys: Vec<_> = self.inner.children_default.iter().map(|(_k, v)| { diff --git a/substrate/primitives/state-machine/src/ext.rs b/substrate/primitives/state-machine/src/ext.rs index 3c4d88f392..c46d0d56be 100644 --- a/substrate/primitives/state-machine/src/ext.rs +++ b/substrate/primitives/state-machine/src/ext.rs @@ -507,10 +507,6 @@ where StorageAppend::new(current_value).append(value); } - fn chain_id(&self) -> u64 { - 42 - } - fn storage_root(&mut self) -> Vec { let _guard = guard(); if let Some(ref root) = self.storage_transaction_cache.transaction_storage_root { diff --git a/substrate/primitives/state-machine/src/read_only.rs b/substrate/primitives/state-machine/src/read_only.rs index 2ab92f5fbb..ba9984a6c7 100644 --- a/substrate/primitives/state-machine/src/read_only.rs +++ b/substrate/primitives/state-machine/src/read_only.rs @@ -156,8 +156,6 @@ impl<'a, H: Hasher, B: 'a + Backend> Externalities for ReadOnlyExternalities< unimplemented!("storage_append is not supported in ReadOnlyExternalities") } - fn chain_id(&self) -> u64 { 42 } - fn storage_root(&mut self) -> Vec { unimplemented!("storage_root is not supported in ReadOnlyExternalities") } diff --git a/substrate/primitives/tasks/src/async_externalities.rs b/substrate/primitives/tasks/src/async_externalities.rs index efb4c498f7..e2afeee413 100644 --- a/substrate/primitives/tasks/src/async_externalities.rs +++ b/substrate/primitives/tasks/src/async_externalities.rs @@ -143,8 +143,6 @@ impl Externalities for AsyncExternalities { panic!("`storage_append`: should not be used in async externalities!") } - fn chain_id(&self) -> u64 { 42 } - fn storage_root(&mut self) -> Vec { panic!("`storage_root`: should not be used in async externalities!") } diff --git a/substrate/test-utils/runtime/src/lib.rs b/substrate/test-utils/runtime/src/lib.rs index 6bee4b704f..3e5ab8f697 100644 --- a/substrate/test-utils/runtime/src/lib.rs +++ b/substrate/test-utils/runtime/src/lib.rs @@ -462,6 +462,7 @@ impl frame_system::Config for Runtime { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } impl pallet_timestamp::Config for Runtime {