Define ss58 prefix inside the runtime (#7810)

* Add SS58Prefix type to the frame_system config trait

* Remove unused chain_id runtime interface
This commit is contained in:
Alexander Theißen
2020-12-30 23:07:37 +01:00
committed by GitHub
parent bd48ff310d
commit ec2c70396e
67 changed files with 85 additions and 25 deletions
+14
View File
@@ -257,6 +257,13 @@ pub trait Config: 'static + Eq + Clone {
type OnKilledAccount: OnKilledAccount<Self::AccountId>;
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<u8>;
}
pub type DigestOf<T> = generic::Digest<<T as Config>::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::<T>::translate::<(T::Index, u8, T::AccountData), _>(|_key, (nonce, rc, data)|
+1
View File
@@ -117,6 +117,7 @@ impl Config for Test {
type OnNewAccount = ();
type OnKilledAccount = RecordKilled;
type SystemWeightInfo = ();
type SS58Prefix = ();
}
pub type System = Module<Test>;