Skip to content

feat(devnet): devnet runtime based on mainnet #490

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
26 changes: 20 additions & 6 deletions runtime/devnet/src/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

use cumulus_primitives_core::ParaId;
use ismp_parachain::ParachainData;
use pallet_sudo::Call::sudo;

Check warning on line 5 in runtime/devnet/src/genesis.rs

View workflow job for this annotation

GitHub Actions / clippy

unused import: `pallet_sudo::Call::sudo`

warning: unused import: `pallet_sudo::Call::sudo` --> runtime/devnet/src/genesis.rs:5:5 | 5 | use pallet_sudo::Call::sudo; | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default
use parachains_common::{AccountId, AuraId, Balance};
use pop_runtime_common::genesis::*;
use sp_core::crypto::Ss58Codec;
use sp_genesis_builder::PresetId;

use crate::{
Expand All @@ -28,6 +30,15 @@
/// Initial balance for genesis endowed accounts.
const ENDOWMENT: Balance = 10_000_000 * UNIT;

/// SUDO account set at genesis.
const SUDO_ADDRESS: &str = "5FPL3ZLqUk6MyBoZrQZ1Co29WAteX6T6N68TZ6jitHvhpyuD";

// Returns the SUDO account's address as an `AccountId`.
// This function will return an error if the SS58 address is invalid.
fn sudo_account_id() -> AccountId {
AccountId::from_ss58check(SUDO_ADDRESS).expect("sudo address is valid SS58")
}

/// Returns a JSON blob representation of the built-in `RuntimeGenesisConfig` identified by `id`.
pub(crate) fn get_preset(id: &PresetId) -> Option<Vec<u8>> {
let patch = match id.as_str() {
Expand Down Expand Up @@ -80,18 +91,21 @@
)
}

/// Configures a live chain running on multiple nodes on private devnet, using the `devnet` runtime.
/// Configures a live chain running on one collator, using the `devnet` runtime.
fn live_config() -> Value {
let collator_0_account_id: AccountId =
AccountId::from_ss58check("5Gn9dVgCNUYtC5JVMBheQQv2x6Lpg5sAMcQVRupG1s3tP2gR").unwrap();
let collator_0_aura_id: AuraId =
AuraId::from_ss58check("5Gn9dVgCNUYtC5JVMBheQQv2x6Lpg5sAMcQVRupG1s3tP2gR").unwrap();

genesis(
// Initial collators.
Vec::from([
// Multiple collators for live development chain.
(Keyring::Alice.to_account_id(), Keyring::Alice.public().into()),
(Keyring::Bob.to_account_id(), Keyring::Bob.public().into()),
(Keyring::Charlie.to_account_id(), Keyring::Charlie.public().into()),
// POP COLLATOR 0
(collator_0_account_id, collator_0_aura_id),
]),
vec![],
Keyring::Alice.to_account_id(),
sudo_account_id(),
PARA_ID,
Vec::from([ParachainData { id: 1000, slot_duration: 6000 }]),
)
Expand Down
Loading