Skip to content

Commit

Permalink
Omni-Node renamings (#5915)
Browse files Browse the repository at this point in the history
- moved the omni-node lib from
  `cumulus/polkadot-parachain/polkadot-parachain-lib` to
  `cumulus/polkadot-omni-node/lib`
- renamed `polkadot-parachain-lib` to `polkadot-omni-node-lib`
- added `polkadot-omni-node` binary

Related to #5566
  • Loading branch information
serban300 authored Oct 8, 2024
1 parent 4b40e76 commit a4dce86
Show file tree
Hide file tree
Showing 43 changed files with 232 additions and 100 deletions.
123 changes: 65 additions & 58 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,9 @@ members = [
"cumulus/parachains/runtimes/test-utils",
"cumulus/parachains/runtimes/testing/penpal",
"cumulus/parachains/runtimes/testing/rococo-parachain",
"cumulus/polkadot-omni-node",
"cumulus/polkadot-omni-node/lib",
"cumulus/polkadot-parachain",
"cumulus/polkadot-parachain/polkadot-parachain-lib",
"cumulus/primitives/aura",
"cumulus/primitives/core",
"cumulus/primitives/parachain-inherent",
Expand Down Expand Up @@ -541,6 +542,7 @@ members = [
]

default-members = [
"cumulus/polkadot-omni-node",
"cumulus/polkadot-parachain",
"polkadot",
"substrate/bin/node/cli",
Expand Down Expand Up @@ -1052,8 +1054,9 @@ polkadot-node-subsystem = { path = "polkadot/node/subsystem", default-features =
polkadot-node-subsystem-test-helpers = { path = "polkadot/node/subsystem-test-helpers" }
polkadot-node-subsystem-types = { path = "polkadot/node/subsystem-types", default-features = false }
polkadot-node-subsystem-util = { path = "polkadot/node/subsystem-util", default-features = false }
polkadot-omni-node = { path = "cumulus/polkadot-omni-node", default-features = false }
polkadot-omni-node-lib = { path = "cumulus/polkadot-omni-node/lib", default-features = false }
polkadot-overseer = { path = "polkadot/node/overseer", default-features = false }
polkadot-parachain-lib = { path = "cumulus/polkadot-parachain/polkadot-parachain-lib", default-features = false }
polkadot-parachain-primitives = { path = "polkadot/parachain", default-features = false }
polkadot-primitives = { path = "polkadot/primitives", default-features = false }
polkadot-primitives-test-helpers = { path = "polkadot/primitives/test-helpers" }
Expand Down
29 changes: 29 additions & 0 deletions cumulus/polkadot-omni-node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[package]
name = "polkadot-omni-node"
version = "0.1.0"
authors.workspace = true
edition.workspace = true
build = "build.rs"
description = "Generic binary that can run a parachain node with u32 block number and Aura consensus"
license = "Apache-2.0"

[lints]
workspace = true

[dependencies]
color-eyre = { workspace = true }

# Local
polkadot-omni-node-lib = { workspace = true }

[build-dependencies]
substrate-build-script-utils = { workspace = true, default-features = true }

[features]
default = []
runtime-benchmarks = [
"polkadot-omni-node-lib/runtime-benchmarks",
]
try-runtime = [
"polkadot-omni-node-lib/try-runtime",
]
22 changes: 22 additions & 0 deletions cumulus/polkadot-omni-node/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (C) 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 <http://www.gnu.org/licenses/>.

use substrate_build_script_utils::{generate_cargo_keys, rerun_if_git_head_changed};

fn main() {
generate_cargo_keys();
rerun_if_git_head_changed();
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "polkadot-parachain-lib"
name = "polkadot-omni-node-lib"
version = "0.1.0"
authors.workspace = true
edition.workspace = true
Expand Down
File renamed without changes.
File renamed without changes.
60 changes: 60 additions & 0 deletions cumulus/polkadot-omni-node/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// Copyright (C) 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 <http://www.gnu.org/licenses/>.

//! Basic polkadot omni-node.
//!
//! It can be used to start a parachain node from a provided chain spec file.
//! It is only compatible with runtimes that use block number `u32` and `Aura` consensus.
//!
//! Example: `polkadot-omni-node --chain [chain_spec.json]`

#![warn(missing_docs)]
#![warn(unused_extern_crates)]

use polkadot_omni_node_lib::{
chain_spec::DiskChainSpecLoader, run, runtime::DefaultRuntimeResolver, CliConfig as CliConfigT,
RunConfig,
};

struct CliConfig;

impl CliConfigT for CliConfig {
fn impl_version() -> String {
env!("SUBSTRATE_CLI_IMPL_VERSION").into()
}

fn author() -> String {
env!("CARGO_PKG_AUTHORS").into()
}

fn support_url() -> String {
"https://github.com/paritytech/polkadot-sdk/issues/new".into()
}

fn copyright_start_year() -> u16 {
2017
}
}

fn main() -> color_eyre::eyre::Result<()> {
color_eyre::install()?;

let config = RunConfig {
chain_spec_loader: Box::new(DiskChainSpecLoader),
runtime_resolver: Box::new(DefaultRuntimeResolver),
};
Ok(run::<CliConfig>(config)?)
}
13 changes: 3 additions & 10 deletions cumulus/polkadot-parachain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ serde = { features = ["derive"], workspace = true, default-features = true }
serde_json = { workspace = true, default-features = true }

# Local
polkadot-parachain-lib = { features = ["rococo-native", "westend-native"], workspace = true }
polkadot-omni-node-lib = { features = ["rococo-native", "westend-native"], workspace = true }
rococo-parachain-runtime = { workspace = true }
glutton-westend-runtime = { workspace = true }
asset-hub-rococo-runtime = { workspace = true, default-features = true }
Expand All @@ -37,10 +37,6 @@ penpal-runtime = { workspace = true }
people-rococo-runtime = { workspace = true }
people-westend-runtime = { workspace = true }
parachains-common = { workspace = true, default-features = true }
testnet-parachains-constants = { features = [
"rococo",
"westend",
], workspace = true }

# Substrate
sp-core = { workspace = true, default-features = true }
Expand All @@ -55,9 +51,6 @@ xcm = { workspace = true, default-features = true }
# Cumulus
cumulus-primitives-core = { workspace = true, default-features = true }

# Bridges
bp-messages = { workspace = true, default-features = true }

[build-dependencies]
substrate-build-script-utils = { workspace = true, default-features = true }

Expand All @@ -66,7 +59,7 @@ default = []
runtime-benchmarks = [
"cumulus-primitives-core/runtime-benchmarks",
"parachains-common/runtime-benchmarks",
"polkadot-parachain-lib/runtime-benchmarks",
"polkadot-omni-node-lib/runtime-benchmarks",
"sc-service/runtime-benchmarks",

"asset-hub-rococo-runtime/runtime-benchmarks",
Expand All @@ -84,7 +77,7 @@ runtime-benchmarks = [
"rococo-parachain-runtime/runtime-benchmarks",
]
try-runtime = [
"polkadot-parachain-lib/try-runtime",
"polkadot-omni-node-lib/try-runtime",

"asset-hub-rococo-runtime/try-runtime",
"asset-hub-westend-runtime/try-runtime",
Expand Down
2 changes: 1 addition & 1 deletion cumulus/polkadot-parachain/src/chain_spec/asset_hubs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.

use polkadot_parachain_lib::chain_spec::{Extensions, GenericChainSpec};
use polkadot_omni_node_lib::chain_spec::{Extensions, GenericChainSpec};
use sc_service::ChainType;

pub fn asset_hub_westend_development_config() -> GenericChainSpec {
Expand Down
6 changes: 3 additions & 3 deletions cumulus/polkadot-parachain/src/chain_spec/bridge_hubs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.

use cumulus_primitives_core::ParaId;
use polkadot_parachain_lib::chain_spec::GenericChainSpec;
use polkadot_omni_node_lib::chain_spec::GenericChainSpec;
use sc_chain_spec::{ChainSpec, ChainType};
use std::str::FromStr;

Expand Down Expand Up @@ -127,7 +127,7 @@ fn ensure_id(id: &str) -> Result<&str, String> {
/// Sub-module for Rococo setup
pub mod rococo {
use super::{ChainType, ParaId};
use polkadot_parachain_lib::chain_spec::{Extensions, GenericChainSpec};
use polkadot_omni_node_lib::chain_spec::{Extensions, GenericChainSpec};

pub(crate) const BRIDGE_HUB_ROCOCO: &str = "bridge-hub-rococo";
pub(crate) const BRIDGE_HUB_ROCOCO_LOCAL: &str = "bridge-hub-rococo-local";
Expand Down Expand Up @@ -175,7 +175,7 @@ pub mod kusama {
/// Sub-module for Westend setup.
pub mod westend {
use super::{ChainType, ParaId};
use polkadot_parachain_lib::chain_spec::{Extensions, GenericChainSpec};
use polkadot_omni_node_lib::chain_spec::{Extensions, GenericChainSpec};

pub(crate) const BRIDGE_HUB_WESTEND: &str = "bridge-hub-westend";
pub(crate) const BRIDGE_HUB_WESTEND_LOCAL: &str = "bridge-hub-westend-local";
Expand Down
2 changes: 1 addition & 1 deletion cumulus/polkadot-parachain/src/chain_spec/collectives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.

use polkadot_parachain_lib::chain_spec::{Extensions, GenericChainSpec};
use polkadot_omni_node_lib::chain_spec::{Extensions, GenericChainSpec};
use sc_service::ChainType;

/// Collectives Westend Development Config.
Expand Down
Loading

0 comments on commit a4dce86

Please sign in to comment.