// Copyright 2022 Parity Technologies (UK) Ltd. // This file is part of Cumulus. // Cumulus is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // Cumulus is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with Cumulus. If not, see . //! ChainSpecs dedicated to Rococo parachain setups (for testing and example purposes) use crate::chain_spec::{get_from_seed, Extensions, SAFE_XCM_VERSION}; use cumulus_primitives_core::ParaId; use hex_literal::hex; use parachains_common::AccountId; use polkadot_service::chain_spec::get_account_id_from_seed; use rococo_parachain_runtime::AuraId; use sc_chain_spec::ChainType; use sp_core::{crypto::UncheckedInto, sr25519}; pub type RococoParachainChainSpec = sc_service::GenericChainSpec; pub fn rococo_parachain_local_config() -> RococoParachainChainSpec { RococoParachainChainSpec::from_genesis( "Rococo Parachain Local", "local_testnet", ChainType::Local, move || { testnet_genesis( get_account_id_from_seed::("Alice"), vec![get_from_seed::("Alice"), get_from_seed::("Bob")], vec![ get_account_id_from_seed::("Alice"), get_account_id_from_seed::("Bob"), get_account_id_from_seed::("Charlie"), get_account_id_from_seed::("Dave"), get_account_id_from_seed::("Eve"), get_account_id_from_seed::("Ferdie"), get_account_id_from_seed::("Alice//stash"), get_account_id_from_seed::("Bob//stash"), get_account_id_from_seed::("Charlie//stash"), get_account_id_from_seed::("Dave//stash"), get_account_id_from_seed::("Eve//stash"), get_account_id_from_seed::("Ferdie//stash"), ], 1000.into(), ) }, Vec::new(), None, None, None, None, Extensions { relay_chain: "rococo-local".into(), para_id: 1000 }, ) } pub fn staging_rococo_parachain_local_config() -> RococoParachainChainSpec { RococoParachainChainSpec::from_genesis( "Staging Rococo Parachain Local", "staging_testnet", ChainType::Live, move || { testnet_genesis( hex!["9ed7705e3c7da027ba0583a22a3212042f7e715d3c168ba14f1424e2bc111d00"].into(), vec![ // $secret//one hex!["aad9fa2249f87a210a0f93400b7f90e47b810c6d65caa0ca3f5af982904c2a33"] .unchecked_into(), // $secret//two hex!["d47753f0cca9dd8da00c70e82ec4fc5501a69c49a5952a643d18802837c88212"] .unchecked_into(), ], vec![ hex!["9ed7705e3c7da027ba0583a22a3212042f7e715d3c168ba14f1424e2bc111d00"].into() ], 1000.into(), ) }, Vec::new(), None, None, None, None, Extensions { relay_chain: "rococo-local".into(), para_id: 1000 }, ) } pub(crate) fn testnet_genesis( root_key: AccountId, initial_authorities: Vec, endowed_accounts: Vec, id: ParaId, ) -> rococo_parachain_runtime::GenesisConfig { rococo_parachain_runtime::GenesisConfig { system: rococo_parachain_runtime::SystemConfig { code: rococo_parachain_runtime::WASM_BINARY .expect("WASM binary was not build, please build it!") .to_vec(), }, balances: rococo_parachain_runtime::BalancesConfig { balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 60)).collect(), }, sudo: rococo_parachain_runtime::SudoConfig { key: Some(root_key) }, parachain_info: rococo_parachain_runtime::ParachainInfoConfig { parachain_id: id }, aura: rococo_parachain_runtime::AuraConfig { authorities: initial_authorities }, aura_ext: Default::default(), parachain_system: Default::default(), polkadot_xcm: rococo_parachain_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), }, } }