polkadot_parachain/main.rs
1// Copyright (C) Parity Technologies (UK) Ltd.
2// This file is part of Cumulus.
3// SPDX-License-Identifier: Apache-2.0
4
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing, software
12// distributed under the License is distributed on an "AS IS" BASIS,
13// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14// See the License for the specific language governing permissions and
15// limitations under the License.
16
17//! Polkadot parachain node.
18
19#![warn(missing_docs)]
20#![warn(unused_extern_crates)]
21
22// Force the linker to keep the polkadot_jemalloc_shim crate (and its #[global_allocator]).
23#[cfg(target_os = "linux")]
24extern crate polkadot_jemalloc_shim;
25
26mod chain_spec;
27
28use polkadot_omni_node_lib::{
29 run, runtime::DefaultRuntimeResolver, CliConfig as CliConfigT, RunConfig, NODE_VERSION,
30};
31
32struct CliConfig;
33
34impl CliConfigT for CliConfig {
35 fn impl_version() -> String {
36 let commit_hash = env!("SUBSTRATE_CLI_COMMIT_HASH");
37 format!("{}-{commit_hash}", NODE_VERSION)
38 }
39
40 fn author() -> String {
41 env!("CARGO_PKG_AUTHORS").into()
42 }
43
44 fn support_url() -> String {
45 "https://github.com/paritytech/polkadot-sdk/issues/new".into()
46 }
47
48 fn copyright_start_year() -> u16 {
49 2017
50 }
51}
52
53fn main() -> color_eyre::eyre::Result<()> {
54 color_eyre::install()?;
55 let config =
56 RunConfig::new(Box::new(DefaultRuntimeResolver), Box::new(chain_spec::ChainSpecLoader));
57 // This enables polkadot-parachain to support additional subcommands like `export-chain-spec`.
58 // To add more, extend the `ExtraSubcommands` enum in
59 // `cumulus/polkadot-omni-node/lib/src/extra_subcommand` and handle them in
60 // `ExtraSubcommands::handle`.
61 Ok(run::<CliConfig>(config)?)
62}