remove account derivation functions (#1498)

This commit is contained in:
Svyatoslav Nikolsky
2022-07-12 11:07:38 +03:00
committed by Bastian Köcher
parent d327b25724
commit ceefd1b05d
22 changed files with 6 additions and 327 deletions
+1 -23
View File
@@ -29,7 +29,7 @@ use frame_support::{
use frame_system::limits;
use sp_core::Hasher as HasherT;
use sp_runtime::{
traits::{BlakeTwo256, Convert, IdentifyAccount, Verify},
traits::{BlakeTwo256, IdentifyAccount, Verify},
FixedU128, MultiSignature, MultiSigner, Perbill,
};
use sp_std::prelude::*;
@@ -181,28 +181,6 @@ impl Chain for Rialto {
}
}
/// Convert a 256-bit hash into an AccountId.
pub struct AccountIdConverter;
impl Convert<sp_core::H256, AccountId> for AccountIdConverter {
fn convert(hash: sp_core::H256) -> AccountId {
hash.to_fixed_bytes().into()
}
}
// We use this to get the account on Rialto (target) which is derived from Millau's (source)
// account. We do this so we can fund the derived account on Rialto at Genesis to it can pay
// transaction fees.
//
// The reason we can use the same `AccountId` type for both chains is because they share the same
// development seed phrase.
//
// Note that this should only be used for testing.
pub fn derive_account_from_millau_id(id: bp_runtime::SourceAccount<AccountId>) -> AccountId {
let encoded_id = bp_runtime::derive_account_id(bp_runtime::MILLAU_CHAIN_ID, id);
AccountIdConverter::convert(encoded_id)
}
frame_support::parameter_types! {
pub BlockLength: limits::BlockLength =
limits::BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);