Skip to content
Snippets Groups Projects
Commit f68c46ef authored by Bastian Köcher's avatar Bastian Köcher Committed by GitHub
Browse files

Test-runtime: Support changing the `ParaId`. (#858)

Adds support for changing the para id relative easily. While this is currently not needed, we may
need it at some later point.
parent f175a257
No related merge requests found
......@@ -32,12 +32,15 @@ pub type ChainSpec = sc_service::GenericChainSpec<GenesisExt, Extensions>;
pub struct GenesisExt {
/// The runtime genesis config.
runtime_genesis_config: cumulus_test_runtime::GenesisConfig,
/// The parachain id.
para_id: ParaId,
}
impl sp_runtime::BuildStorage for GenesisExt {
fn assimilate_storage(&self, storage: &mut sp_core::storage::Storage) -> Result<(), String> {
sp_state_machine::BasicExternalities::execute_with_storage(storage, || {
sp_io::storage::set(cumulus_test_runtime::TEST_RUNTIME_UPGRADE_KEY, &vec![1, 2, 3, 4]);
cumulus_test_runtime::ParachainId::set(&self.para_id);
});
self.runtime_genesis_config.assimilate_storage(storage)
......@@ -82,7 +85,7 @@ pub fn get_chain_spec(id: ParaId) -> ChainSpec {
"Local Testnet",
"local_testnet",
ChainType::Local,
move || GenesisExt { runtime_genesis_config: local_testnet_genesis() },
move || GenesisExt { runtime_genesis_config: local_testnet_genesis(), para_id: id },
Vec::new(),
None,
None,
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment