b6d35f6faf
Updated 4763 files with dual copyright: - Parity Technologies (UK) Ltd. - Dijital Kurdistan Tech Institute
64 lines
2.5 KiB
Rust
64 lines
2.5 KiB
Rust
// Copyright (C) Parity Technologies (UK) Ltd. and Dijital Kurdistan Tech Institute
|
|
// This file is part of Pezcumulus.
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
use pezcumulus_primitives_core::ParaId;
|
|
use pezkuwi_omni_node_lib::chain_spec::{Extensions, GenericChainSpec};
|
|
use pezsc_service::ChainType;
|
|
|
|
/// Generic Glutton Zagros Config for all currently used setups.
|
|
pub fn glutton_zagros_config(
|
|
para_id: ParaId,
|
|
chain_type: ChainType,
|
|
relay_chain: &str,
|
|
) -> GenericChainSpec {
|
|
let mut properties = pezsc_chain_spec::Properties::new();
|
|
properties.insert("ss58Format".into(), 42.into());
|
|
|
|
GenericChainSpec::builder(
|
|
glutton_zagros_runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"),
|
|
Extensions::new_with_relay_chain(relay_chain.into()),
|
|
)
|
|
.with_name(&chain_type_name(para_id, &chain_type))
|
|
.with_id(&chain_id(para_id, &chain_type))
|
|
.with_chain_type(chain_type.clone())
|
|
.with_genesis_config_preset_name(match chain_type {
|
|
ChainType::Development => pezsp_genesis_builder::DEV_RUNTIME_PRESET,
|
|
ChainType::Local => pezsp_genesis_builder::LOCAL_TESTNET_RUNTIME_PRESET,
|
|
_ => panic!("chain_type: {chain_type:?} not supported here!"),
|
|
})
|
|
.build()
|
|
}
|
|
|
|
/// Generate the name directly from the ChainType
|
|
fn chain_type_name(para_id: ParaId, chain_type: &ChainType) -> String {
|
|
match chain_type {
|
|
ChainType::Development => format!("Glutton Development {}", para_id),
|
|
ChainType::Local => format!("Glutton Local {}", para_id),
|
|
ChainType::Live => format!("Glutton {}", para_id),
|
|
ChainType::Custom(name) => name.clone(),
|
|
}
|
|
}
|
|
|
|
/// Generate the name directly from the ChainType
|
|
pub fn chain_id(para_id: ParaId, chain_type: &ChainType) -> String {
|
|
match chain_type {
|
|
ChainType::Development => format!("glutton-zagros-dev-{}", para_id),
|
|
ChainType::Local => format!("glutton-zagros-local-{}", para_id),
|
|
ChainType::Live => format!("glutton-zagros-{}", para_id),
|
|
ChainType::Custom(_) => format!("glutton-zagros-custom-{}", para_id),
|
|
}
|
|
}
|