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 -38
View File
@@ -32,7 +32,7 @@ use frame_system::limits;
use scale_info::TypeInfo;
use sp_core::{storage::StateVersion, Hasher as HasherT};
use sp_runtime::{
traits::{Convert, IdentifyAccount, Verify},
traits::{IdentifyAccount, Verify},
FixedU128, MultiSignature, MultiSigner, Perbill,
};
use sp_std::prelude::*;
@@ -218,43 +218,6 @@ impl sp_runtime::traits::Hash for BlakeTwoAndKeccak256 {
}
}
/// Convert a 256-bit hash into an AccountId.
pub struct AccountIdConverter;
impl sp_runtime::traits::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 Millau (target) which is derived from Rialto's (source)
/// account. We do this so we can fund the derived account on Millau 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_rialto_id(id: bp_runtime::SourceAccount<AccountId>) -> AccountId {
let encoded_id = bp_runtime::derive_account_id(bp_runtime::RIALTO_CHAIN_ID, id);
AccountIdConverter::convert(encoded_id)
}
/// We use this to get the account on Millau (target) which is derived from RialtoParachain's
/// (source) account. We do this so we can fund the derived account on Millau 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_rialto_parachain_id(
id: bp_runtime::SourceAccount<AccountId>,
) -> AccountId {
let encoded_id = bp_runtime::derive_account_id(bp_runtime::RIALTO_PARACHAIN_CHAIN_ID, id);
AccountIdConverter::convert(encoded_id)
}
frame_support::parameter_types! {
pub BlockLength: limits::BlockLength =
limits::BlockLength::max_with_normal_ratio(2 * 1024 * 1024, NORMAL_DISPATCH_RATIO);