Skip to content

Commit

Permalink
Refactor get_account_id_from_seed / get_from_seed to one common place (
Browse files Browse the repository at this point in the history
…#5804)

Closes #5705

---------

Co-authored-by: Iulian Barbu <14218860+iulianbarbu@users.noreply.github.com>
Co-authored-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com>
  • Loading branch information
3 people authored Oct 17, 2024
1 parent 9714796 commit a2c7575
Show file tree
Hide file tree
Showing 63 changed files with 536 additions and 892 deletions.
14 changes: 13 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 0 additions & 46 deletions cumulus/parachains/common/src/genesis_config_helpers.rs

This file was deleted.

1 change: 0 additions & 1 deletion cumulus/parachains/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

extern crate alloc;

pub mod genesis_config_helpers;
pub mod impls;
pub mod message_queue;
pub mod xcm_config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ workspace = true

# Substrate
sp-core = { workspace = true }
sp-keyring = { workspace = true }
frame-support = { workspace = true }

# Cumulus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@

// Substrate
use frame_support::parameter_types;
use sp_core::{sr25519, storage::Storage};
use sp_core::storage::Storage;
use sp_keyring::Sr25519Keyring as Keyring;

// Cumulus
use emulated_integration_tests_common::{
accounts, build_genesis_storage, collators, get_account_id_from_seed,
PenpalSiblingSovereignAccount, PenpalTeleportableAssetLocation, RESERVABLE_ASSET_ID,
SAFE_XCM_VERSION, USDT_ID,
accounts, build_genesis_storage, collators, PenpalSiblingSovereignAccount,
PenpalTeleportableAssetLocation, RESERVABLE_ASSET_ID, SAFE_XCM_VERSION, USDT_ID,
};
use parachains_common::{AccountId, Balance};

pub const PARA_ID: u32 = 1000;
pub const ED: Balance = testnet_parachains_constants::rococo::currency::EXISTENTIAL_DEPOSIT;

parameter_types! {
pub AssetHubRococoAssetOwner: AccountId = get_account_id_from_seed::<sr25519::Public>("Alice");
pub AssetHubRococoAssetOwner: AccountId = Keyring::Alice.to_account_id();
}

pub fn genesis() -> Storage {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ workspace = true

# Substrate
sp-core = { workspace = true }
sp-keyring = { workspace = true }
frame-support = { workspace = true }

# Cumulus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@

// Substrate
use frame_support::parameter_types;
use sp_core::{sr25519, storage::Storage};
use sp_core::storage::Storage;
use sp_keyring::Sr25519Keyring as Keyring;

// Cumulus
use emulated_integration_tests_common::{
accounts, build_genesis_storage, collators, get_account_id_from_seed,
PenpalBSiblingSovereignAccount, PenpalBTeleportableAssetLocation,
PenpalSiblingSovereignAccount, PenpalTeleportableAssetLocation, RESERVABLE_ASSET_ID,
SAFE_XCM_VERSION, USDT_ID,
accounts, build_genesis_storage, collators, PenpalBSiblingSovereignAccount,
PenpalBTeleportableAssetLocation, PenpalSiblingSovereignAccount,
PenpalTeleportableAssetLocation, RESERVABLE_ASSET_ID, SAFE_XCM_VERSION, USDT_ID,
};
use parachains_common::{AccountId, Balance};

Expand All @@ -31,7 +31,7 @@ pub const ED: Balance = testnet_parachains_constants::westend::currency::EXISTEN
pub const USDT_ED: Balance = 70_000;

parameter_types! {
pub AssetHubWestendAssetOwner: AccountId = get_account_id_from_seed::<sr25519::Public>("Alice");
pub AssetHubWestendAssetOwner: AccountId = Keyring::Alice.to_account_id();
}

pub fn genesis() -> Storage {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ workspace = true

# Substrate
sp-core = { workspace = true }
sp-keyring = { workspace = true }
frame-support = { workspace = true }

# Polkadot Dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
// limitations under the License.

// Substrate
use sp_core::{sr25519, storage::Storage};
use sp_core::storage::Storage;
use sp_keyring::Sr25519Keyring as Keyring;

// Cumulus
use emulated_integration_tests_common::{
accounts, build_genesis_storage, collators, get_account_id_from_seed, SAFE_XCM_VERSION,
accounts, build_genesis_storage, collators, SAFE_XCM_VERSION,
};
use parachains_common::Balance;
use xcm::latest::prelude::*;
Expand Down Expand Up @@ -60,11 +61,11 @@ pub fn genesis() -> Storage {
..Default::default()
},
bridge_westend_grandpa: bridge_hub_rococo_runtime::BridgeWestendGrandpaConfig {
owner: Some(get_account_id_from_seed::<sr25519::Public>(accounts::BOB)),
owner: Some(Keyring::Bob.to_account_id()),
..Default::default()
},
bridge_westend_messages: bridge_hub_rococo_runtime::BridgeWestendMessagesConfig {
owner: Some(get_account_id_from_seed::<sr25519::Public>(accounts::BOB)),
owner: Some(Keyring::Bob.to_account_id()),
..Default::default()
},
xcm_over_bridge_hub_westend: bridge_hub_rococo_runtime::XcmOverBridgeHubWestendConfig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ workspace = true

# Substrate
sp-core = { workspace = true }
sp-keyring = { workspace = true }
frame-support = { workspace = true }

# Polkadot Dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
// limitations under the License.

// Substrate
use sp_core::{sr25519, storage::Storage};
use sp_core::storage::Storage;
use sp_keyring::Sr25519Keyring as Keyring;

// Cumulus
use emulated_integration_tests_common::{
accounts, build_genesis_storage, collators, get_account_id_from_seed, SAFE_XCM_VERSION,
accounts, build_genesis_storage, collators, SAFE_XCM_VERSION,
};
use parachains_common::Balance;
use xcm::latest::prelude::*;
Expand Down Expand Up @@ -60,11 +61,11 @@ pub fn genesis() -> Storage {
..Default::default()
},
bridge_rococo_grandpa: bridge_hub_westend_runtime::BridgeRococoGrandpaConfig {
owner: Some(get_account_id_from_seed::<sr25519::Public>(accounts::BOB)),
owner: Some(Keyring::Bob.to_account_id()),
..Default::default()
},
bridge_rococo_messages: bridge_hub_westend_runtime::BridgeRococoMessagesConfig {
owner: Some(get_account_id_from_seed::<sr25519::Public>(accounts::BOB)),
owner: Some(Keyring::Bob.to_account_id()),
..Default::default()
},
xcm_over_bridge_hub_rococo: bridge_hub_westend_runtime::XcmOverBridgeHubRococoConfig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ workspace = true

# Substrate
sp-core = { workspace = true }
sp-keyring = { workspace = true }
frame-support = { workspace = true }

# Polkadot
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@

// Substrate
use frame_support::parameter_types;
use sp_core::{sr25519, storage::Storage};
use sp_core::storage::Storage;
use sp_keyring::Sr25519Keyring as Keyring;

// Cumulus
use emulated_integration_tests_common::{
accounts, build_genesis_storage, collators, get_account_id_from_seed, SAFE_XCM_VERSION,
accounts, build_genesis_storage, collators, SAFE_XCM_VERSION,
};
use parachains_common::{AccountId, Balance};
use penpal_runtime::xcm_config::{LocalReservableFromAssetHub, RelayLocation, UsdtFromAssetHub};
Expand All @@ -30,7 +31,7 @@ pub const ED: Balance = penpal_runtime::EXISTENTIAL_DEPOSIT;
pub const USDT_ED: Balance = 70_000;

parameter_types! {
pub PenpalSudoAccount: AccountId = get_account_id_from_seed::<sr25519::Public>("Alice");
pub PenpalSudoAccount: AccountId = Keyring::Alice.to_account_id();
pub PenpalAssetOwner: AccountId = PenpalSudoAccount::get();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ workspace = true

# Substrate
sp-core = { workspace = true }
sp-keyring = { workspace = true }
sp-authority-discovery = { workspace = true }
sp-consensus-babe = { workspace = true }
sp-consensus-beefy = { workspace = true, default-features = true }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ use sc_consensus_grandpa::AuthorityId as GrandpaId;
use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId;
use sp_consensus_babe::AuthorityId as BabeId;
use sp_consensus_beefy::ecdsa_crypto::AuthorityId as BeefyId;
use sp_core::{sr25519, storage::Storage};
use sp_core::storage::Storage;
use sp_keyring::Sr25519Keyring as Keyring;

// Polkadot
use polkadot_primitives::{AssignmentId, ValidatorId};

// Cumulus
use emulated_integration_tests_common::{
accounts, build_genesis_storage, get_account_id_from_seed, get_host_config, validators,
accounts, build_genesis_storage, get_host_config, validators,
};
use parachains_common::Balance;
use rococo_runtime_constants::currency::UNITS as ROC;
Expand Down Expand Up @@ -82,9 +83,7 @@ pub fn genesis() -> Storage {
epoch_config: rococo_runtime::BABE_GENESIS_EPOCH_CONFIG,
..Default::default()
},
sudo: rococo_runtime::SudoConfig {
key: Some(get_account_id_from_seed::<sr25519::Public>("Alice")),
},
sudo: rococo_runtime::SudoConfig { key: Some(Keyring::Alice.to_account_id()) },
configuration: rococo_runtime::ConfigurationConfig { config: get_host_config() },
registrar: rococo_runtime::RegistrarConfig {
next_free_para_id: polkadot_primitives::LOWEST_PUBLIC_ID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ sp-runtime = { workspace = true, default-features = true }
frame-support = { workspace = true, default-features = true }
sp-core = { workspace = true, default-features = true }
sp-consensus-babe = { workspace = true, default-features = true }
sp-keyring = { workspace = true, default-features = true }
pallet-assets = { workspace = true, default-features = true }
pallet-balances = { workspace = true, default-features = true }
pallet-message-queue = { workspace = true, default-features = true }
Expand Down
Loading

0 comments on commit a2c7575

Please sign in to comment.