Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(asset-hub): amend ah genesis config #168

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 11 additions & 18 deletions system-parachains/asset-hub-paseo/src/genesis_config_presets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@
// You should have received a copy of the GNU General Public License
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.

//! Genesis configs presets for the AssetHubPolkadot runtime
//! Genesis configs presets for the AssetHubPaseo runtime

use crate::*;
use parachains_common::AssetHubPolkadotAuraId;
use sp_core::sr25519;
use sp_genesis_builder::PresetId;
use sp_std::vec::Vec;
Expand All @@ -29,19 +28,13 @@ const ASSET_HUB_PASEO_ED: Balance = ExistentialDeposit::get();
/// Invulnerable Collators for the particular case of AssetHubPaseo
pub fn invulnerables_asset_hub_paseo() -> Vec<(AccountId, AuraId)> {
vec![
(
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_from_seed::<AssetHubPolkadotAuraId>("Alice"),
),
(
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_from_seed::<AssetHubPolkadotAuraId>("Bob"),
),
(get_account_id_from_seed::<sr25519::Public>("Alice"), get_from_seed::<AuraId>("Alice")),
(get_account_id_from_seed::<sr25519::Public>("Bob"), get_from_seed::<AuraId>("Bob")),
]
}

fn asset_hub_polkadot_genesis(
invulnerables: Vec<(AccountId, AssetHubPolkadotAuraId)>,
fn asset_hub_paseo_genesis(
invulnerables: Vec<(AccountId, AuraId)>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JulianToledano this change is important. Let's take it into account for the translation script.

endowed_accounts: Vec<AccountId>,
id: ParaId,
) -> serde_json::Value {
Expand Down Expand Up @@ -86,12 +79,12 @@ fn asset_hub_polkadot_genesis(
})
}

pub fn asset_hub_polkadot_local_testnet_genesis(para_id: ParaId) -> serde_json::Value {
asset_hub_polkadot_genesis(invulnerables_asset_hub_paseo(), testnet_accounts(), para_id)
pub fn asset_hub_paseo_local_testnet_genesis(para_id: ParaId) -> serde_json::Value {
asset_hub_paseo_genesis(invulnerables_asset_hub_paseo(), testnet_accounts(), para_id)
}

fn asset_hub_polkadot_development_genesis(para_id: ParaId) -> serde_json::Value {
asset_hub_polkadot_local_testnet_genesis(para_id)
fn asset_hub_paseo_development_genesis(para_id: ParaId) -> serde_json::Value {
asset_hub_paseo_local_testnet_genesis(para_id)
}

/// Provides the names of the predefined genesis configs for this runtime.
Expand All @@ -102,8 +95,8 @@ pub fn preset_names() -> Vec<PresetId> {
/// Provides the JSON representation of predefined genesis config for given `id`.
pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option<sp_std::vec::Vec<u8>> {
let patch = match id.try_into() {
Ok("development") => asset_hub_polkadot_development_genesis(1000.into()),
Ok("local_testnet") => asset_hub_polkadot_local_testnet_genesis(1000.into()),
Ok("development") => asset_hub_paseo_development_genesis(1000.into()),
Ok("local_testnet") => asset_hub_paseo_local_testnet_genesis(1000.into()),
_ => return None,
};
Some(
Expand Down