diff --git a/bin/node-template/pallets/template/src/mock.rs b/bin/node-template/pallets/template/src/mock.rs index 84af63a1c3bb8..60d22aad7bc66 100644 --- a/bin/node-template/pallets/template/src/mock.rs +++ b/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/bin/node-template/runtime/src/lib.rs b/bin/node-template/runtime/src/lib.rs index 51df3dd5a3e45..0812346779646 100644 --- a/bin/node-template/runtime/src/lib.rs +++ b/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/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index a86b015dbcf94..4eee9d83a58ec 100644 --- a/bin/node/runtime/src/lib.rs +++ b/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/frame/assets/src/lib.rs b/frame/assets/src/lib.rs index df1cb87f75b2d..137ba81f389a3 100644 --- a/frame/assets/src/lib.rs +++ b/frame/assets/src/lib.rs @@ -952,6 +952,7 @@ mod tests { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } parameter_types! { diff --git a/frame/atomic-swap/src/tests.rs b/frame/atomic-swap/src/tests.rs index 47b5102bc568c..19f5fc1dff58f 100644 --- a/frame/atomic-swap/src/tests.rs +++ b/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/frame/aura/src/mock.rs b/frame/aura/src/mock.rs index 1fcb1c2340d13..8d5cbcc9b7b05 100644 --- a/frame/aura/src/mock.rs +++ b/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/frame/authority-discovery/src/lib.rs b/frame/authority-discovery/src/lib.rs index 2d275e01bba24..59321421755d5 100644 --- a/frame/authority-discovery/src/lib.rs +++ b/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/frame/authorship/src/lib.rs b/frame/authorship/src/lib.rs index 693375e3c50e6..3672174e25749 100644 --- a/frame/authorship/src/lib.rs +++ b/frame/authorship/src/lib.rs @@ -438,6 +438,7 @@ mod tests { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type SS58Prefix = (); } parameter_types! { diff --git a/frame/babe/src/mock.rs b/frame/babe/src/mock.rs index 77b117db7f36b..f8805f7a1091f 100644 --- a/frame/babe/src/mock.rs +++ b/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/frame/balances/src/tests_composite.rs b/frame/balances/src/tests_composite.rs index 81c2b895273b5..f98194c503e2c 100644 --- a/frame/balances/src/tests_composite.rs +++ b/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/frame/balances/src/tests_local.rs b/frame/balances/src/tests_local.rs index c168e1d8e59e1..e9d6fe2530a73 100644 --- a/frame/balances/src/tests_local.rs +++ b/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/frame/benchmarking/src/tests.rs b/frame/benchmarking/src/tests.rs index f86abebbb9287..e31f5ec0916e6 100644 --- a/frame/benchmarking/src/tests.rs +++ b/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/frame/bounties/src/tests.rs b/frame/bounties/src/tests.rs index 4ebff64b4e482..bcf371eae492e 100644 --- a/frame/bounties/src/tests.rs +++ b/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/frame/collective/src/lib.rs b/frame/collective/src/lib.rs index efc8626d6892a..1448bd9bc3a8d 100644 --- a/frame/collective/src/lib.rs +++ b/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/frame/contracts/src/tests.rs b/frame/contracts/src/tests.rs index 6ac2fb0f976b3..991a89563eb95 100644 --- a/frame/contracts/src/tests.rs +++ b/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/frame/democracy/src/tests.rs b/frame/democracy/src/tests.rs index dae3a262209ea..0e369bf3bd552 100644 --- a/frame/democracy/src/tests.rs +++ b/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/frame/elections-phragmen/src/lib.rs b/frame/elections-phragmen/src/lib.rs index b541303f651f2..9b7b9064fbf2e 100644 --- a/frame/elections-phragmen/src/lib.rs +++ b/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/frame/elections/src/mock.rs b/frame/elections/src/mock.rs index 482c905f89c14..8a4111a38c4c7 100644 --- a/frame/elections/src/mock.rs +++ b/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/frame/example-offchain-worker/src/tests.rs b/frame/example-offchain-worker/src/tests.rs index 196d4cac4adcc..a94174a33bb66 100644 --- a/frame/example-offchain-worker/src/tests.rs +++ b/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/frame/example-parallel/src/tests.rs b/frame/example-parallel/src/tests.rs index 24e846c3de42c..3da41b22185e7 100644 --- a/frame/example-parallel/src/tests.rs +++ b/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/frame/example/src/lib.rs b/frame/example/src/lib.rs index 3ddb2fd4c1d3c..14c40778bab1b 100644 --- a/frame/example/src/lib.rs +++ b/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/frame/executive/src/lib.rs b/frame/executive/src/lib.rs index caba857254d68..cb45a49b233d9 100644 --- a/frame/executive/src/lib.rs +++ b/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/frame/grandpa/src/mock.rs b/frame/grandpa/src/mock.rs index ae13c946597e4..288ef47a8ef91 100644 --- a/frame/grandpa/src/mock.rs +++ b/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/frame/identity/src/tests.rs b/frame/identity/src/tests.rs index 7f3a95dcd124a..04e6bb7df3947 100644 --- a/frame/identity/src/tests.rs +++ b/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/frame/im-online/src/mock.rs b/frame/im-online/src/mock.rs index 0a6dc1f79c07a..71dc3d52acdb1 100644 --- a/frame/im-online/src/mock.rs +++ b/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/frame/indices/src/mock.rs b/frame/indices/src/mock.rs index 63f0277548f92..0e1e9c3d43647 100644 --- a/frame/indices/src/mock.rs +++ b/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/frame/membership/src/lib.rs b/frame/membership/src/lib.rs index cfdc38752b5e0..943071c9a1d2a 100644 --- a/frame/membership/src/lib.rs +++ b/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/frame/merkle-mountain-range/src/mock.rs b/frame/merkle-mountain-range/src/mock.rs index c311d53446bb0..4865ea7e57234 100644 --- a/frame/merkle-mountain-range/src/mock.rs +++ b/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/frame/multisig/src/tests.rs b/frame/multisig/src/tests.rs index 7a959ec37f283..4101b718bce6a 100644 --- a/frame/multisig/src/tests.rs +++ b/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/frame/nicks/src/lib.rs b/frame/nicks/src/lib.rs index 2b74f323d872c..994e6996a1481 100644 --- a/frame/nicks/src/lib.rs +++ b/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/frame/node-authorization/src/lib.rs b/frame/node-authorization/src/lib.rs index 9641bea116a02..e48faef128d64 100644 --- a/frame/node-authorization/src/lib.rs +++ b/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/frame/offences/benchmarking/src/mock.rs b/frame/offences/benchmarking/src/mock.rs index e55d7ac8e3a76..2a93bfa2c8fe7 100644 --- a/frame/offences/benchmarking/src/mock.rs +++ b/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/frame/offences/src/mock.rs b/frame/offences/src/mock.rs index 124b003029404..7d23780b12e4f 100644 --- a/frame/offences/src/mock.rs +++ b/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/frame/proxy/src/tests.rs b/frame/proxy/src/tests.rs index b1dca43b6a707..b3f9ebc75dd04 100644 --- a/frame/proxy/src/tests.rs +++ b/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/frame/randomness-collective-flip/src/lib.rs b/frame/randomness-collective-flip/src/lib.rs index 9332262d68764..04db12d1df65a 100644 --- a/frame/randomness-collective-flip/src/lib.rs +++ b/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/frame/recovery/src/mock.rs b/frame/recovery/src/mock.rs index 9b991987ceeba..130337678410b 100644 --- a/frame/recovery/src/mock.rs +++ b/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/frame/scheduler/src/lib.rs b/frame/scheduler/src/lib.rs index 9f0f806233d82..67b86fad826fd 100644 --- a/frame/scheduler/src/lib.rs +++ b/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/frame/scored-pool/src/mock.rs b/frame/scored-pool/src/mock.rs index 7d49136cef4f2..b96daf6ba3242 100644 --- a/frame/scored-pool/src/mock.rs +++ b/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/frame/session/benchmarking/src/mock.rs b/frame/session/benchmarking/src/mock.rs index 9001dee879018..db6c465854b6e 100644 --- a/frame/session/benchmarking/src/mock.rs +++ b/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/frame/session/src/mock.rs b/frame/session/src/mock.rs index fa71859feb401..e69eec14b09fb 100644 --- a/frame/session/src/mock.rs +++ b/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/frame/society/src/mock.rs b/frame/society/src/mock.rs index 6a718c2185073..c704008067119 100644 --- a/frame/society/src/mock.rs +++ b/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/frame/staking/fuzzer/src/mock.rs b/frame/staking/fuzzer/src/mock.rs index 6f58d6a669d7c..ca36bfb4c3bc7 100644 --- a/frame/staking/fuzzer/src/mock.rs +++ b/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/frame/staking/src/mock.rs b/frame/staking/src/mock.rs index f3c6d50d4cf56..6f7842b6b5a9b 100644 --- a/frame/staking/src/mock.rs +++ b/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/frame/sudo/src/mock.rs b/frame/sudo/src/mock.rs index 12707d3e9da67..5a0919b8d73a6 100644 --- a/frame/sudo/src/mock.rs +++ b/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/frame/support/test/tests/pallet.rs b/frame/support/test/tests/pallet.rs index 5d2785ebf2609..e05a0e9bdfee0 100644 --- a/frame/support/test/tests/pallet.rs +++ b/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/frame/support/test/tests/pallet_compatibility.rs b/frame/support/test/tests/pallet_compatibility.rs index 912d68baed167..5711326300c20 100644 --- a/frame/support/test/tests/pallet_compatibility.rs +++ b/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/frame/support/test/tests/pallet_compatibility_instance.rs b/frame/support/test/tests/pallet_compatibility_instance.rs index d2f7a6668ca6f..cdcc6a99cf13d 100644 --- a/frame/support/test/tests/pallet_compatibility_instance.rs +++ b/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/frame/support/test/tests/pallet_instance.rs b/frame/support/test/tests/pallet_instance.rs index 82b058b7bdddd..caa9019edf6b8 100644 --- a/frame/support/test/tests/pallet_instance.rs +++ b/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/frame/support/test/tests/pallet_version.rs b/frame/support/test/tests/pallet_version.rs index 25320597ba49e..e70d752e40f4f 100644 --- a/frame/support/test/tests/pallet_version.rs +++ b/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/frame/support/test/tests/pallet_with_name_trait_is_valid.rs b/frame/support/test/tests/pallet_with_name_trait_is_valid.rs index 01b965f3b5147..fba19594897a2 100644 --- a/frame/support/test/tests/pallet_with_name_trait_is_valid.rs +++ b/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/frame/system/benches/bench.rs b/frame/system/benches/bench.rs index 490931748863d..2e5d6292180be 100644 --- a/frame/system/benches/bench.rs +++ b/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/frame/system/benchmarking/src/mock.rs b/frame/system/benchmarking/src/mock.rs index 8cfd70b2f0950..686db8fb5a92a 100644 --- a/frame/system/benchmarking/src/mock.rs +++ b/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/frame/system/src/lib.rs b/frame/system/src/lib.rs index a89577a478b72..a8ffd05bf6155 100644 --- a/frame/system/src/lib.rs +++ b/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/frame/system/src/mock.rs b/frame/system/src/mock.rs index 1558a5ed39708..e22f5870eef8d 100644 --- a/frame/system/src/mock.rs +++ b/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/frame/timestamp/src/lib.rs b/frame/timestamp/src/lib.rs index b62777832ab78..423f7f5128e83 100644 --- a/frame/timestamp/src/lib.rs +++ b/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/frame/tips/src/tests.rs b/frame/tips/src/tests.rs index 3bfecafeaf970..15f3481ba2556 100644 --- a/frame/tips/src/tests.rs +++ b/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/frame/transaction-payment/src/lib.rs b/frame/transaction-payment/src/lib.rs index e530380dfbb48..a787836d24c04 100644 --- a/frame/transaction-payment/src/lib.rs +++ b/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/frame/treasury/src/tests.rs b/frame/treasury/src/tests.rs index 8db303a426d01..4d0bdf32e45f9 100644 --- a/frame/treasury/src/tests.rs +++ b/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/frame/utility/src/tests.rs b/frame/utility/src/tests.rs index 95973a8823f5c..4837be695265e 100644 --- a/frame/utility/src/tests.rs +++ b/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/frame/vesting/src/lib.rs b/frame/vesting/src/lib.rs index a7a8147a062f5..6a65e58d4107d 100644 --- a/frame/vesting/src/lib.rs +++ b/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/primitives/externalities/src/lib.rs b/primitives/externalities/src/lib.rs index 6869969f4ba13..a6596a22d106b 100644 --- a/primitives/externalities/src/lib.rs +++ b/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/primitives/io/src/lib.rs b/primitives/io/src/lib.rs index 023bf7dcb3083..dba984f43335e 100644 --- a/primitives/io/src/lib.rs +++ b/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/primitives/state-machine/src/basic.rs b/primitives/state-machine/src/basic.rs index 9de75785e4598..def0eecf709fe 100644 --- a/primitives/state-machine/src/basic.rs +++ b/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/primitives/state-machine/src/ext.rs b/primitives/state-machine/src/ext.rs index 3c4d88f3920b0..c46d0d56be4b8 100644 --- a/primitives/state-machine/src/ext.rs +++ b/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/primitives/state-machine/src/read_only.rs b/primitives/state-machine/src/read_only.rs index 2ab92f5fbb6c8..ba9984a6c7d5d 100644 --- a/primitives/state-machine/src/read_only.rs +++ b/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/primitives/tasks/src/async_externalities.rs b/primitives/tasks/src/async_externalities.rs index efb4c498f75fb..e2afeee413cdd 100644 --- a/primitives/tasks/src/async_externalities.rs +++ b/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/test-utils/runtime/src/lib.rs b/test-utils/runtime/src/lib.rs index 6bee4b704fc46..3e5ab8f697546 100644 --- a/test-utils/runtime/src/lib.rs +++ b/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 {