Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions cumulus/polkadot-omni-node/lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ cumulus-primitives-aura = { workspace = true, default-features = true }
cumulus-primitives-core = { workspace = true, default-features = true }
cumulus-relay-chain-interface = { workspace = true, default-features = true }
futures-timer = { workspace = true }
sc-consensus-aura = { workspace = true }

[dev-dependencies]
assert_cmd = { workspace = true }
Expand Down
10 changes: 4 additions & 6 deletions cumulus/polkadot-omni-node/lib/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ use crate::{
AuraConsensusId, Consensus, Runtime, RuntimeResolver as RuntimeResolverT,
RuntimeResolver,
},
spec::DynNodeSpec,
types::Block,
NodeBlock, NodeExtraArgs,
},
extra_subcommand::DefaultExtraSubcommands,
fake_runtime_api,
nodes::DynNodeSpecExt,
runtime::BlockNumber,
};
use clap::{CommandFactory, FromArgMatches};
Expand Down Expand Up @@ -63,7 +63,7 @@ impl RunConfig {
pub fn new_aura_node_spec<Block>(
aura_id: AuraConsensusId,
extra_args: &NodeExtraArgs,
) -> Box<dyn DynNodeSpecExt>
) -> Box<dyn DynNodeSpec>
where
Block: NodeBlock,
{
Expand All @@ -85,7 +85,7 @@ fn new_node_spec(
config: &sc_service::Configuration,
runtime_resolver: &Box<dyn RuntimeResolverT>,
extra_args: &NodeExtraArgs,
) -> std::result::Result<Box<dyn DynNodeSpecExt>, sc_cli::Error> {
) -> std::result::Result<Box<dyn DynNodeSpec>, sc_cli::Error> {
let runtime = runtime_resolver.runtime(config.chain_spec.as_ref())?;

Ok(match runtime {
Expand Down Expand Up @@ -136,7 +136,7 @@ where
// Handle the extra, and return - subcommands are self contained,
// no need to handle the rest of the CLI or node running.
extra.handle(&cmd_config)?;
return Ok(())
return Ok(());
}

// If matching on the extra subcommands fails, match on the rest of the node CLI as usual.
Expand Down Expand Up @@ -304,8 +304,6 @@ where
new_node_spec(&config, &cmd_config.runtime_resolver, &cli.node_extra_args())?;

if cli.run.base.is_dev()? {
// Set default dev block time to 3000ms if not set.
// TODO: take block time from AURA config if set.
let dev_block_time = cli.dev_block_time.unwrap_or(DEFAULT_DEV_BLOCK_TIME_MS);
return node_spec
.start_manual_seal_node(config, dev_block_time)
Expand Down
23 changes: 23 additions & 0 deletions cumulus/polkadot-omni-node/lib/src/common/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,13 @@ pub(crate) trait NodeSpec: BaseNodeSpec {

const SYBIL_RESISTANCE: CollatorSybilResistance;

fn start_manual_seal_node(
_config: Configuration,
_block_time: u64,
) -> sc_service::error::Result<TaskManager> {
Err(sc_service::Error::Other("Manual seal not supported for this node type".into()))
}

/// Start a node with the given parachain spec.
///
/// This is the actual implementation that is abstract over the executor and the runtime api.
Expand Down Expand Up @@ -546,6 +553,14 @@ pub(crate) trait NodeSpec: BaseNodeSpec {
}

pub(crate) trait DynNodeSpec: NodeCommandRunner {
/// Start node with manual-seal consensus.
fn start_manual_seal_node(
self: Box<Self>,
config: Configuration,
block_time: u64,
) -> sc_service::error::Result<TaskManager>;

/// Start the node.
fn start_node(
self: Box<Self>,
parachain_config: Configuration,
Expand All @@ -560,6 +575,14 @@ impl<T> DynNodeSpec for T
where
T: NodeSpec + NodeCommandRunner,
{
fn start_manual_seal_node(
self: Box<Self>,
config: Configuration,
block_time: u64,
) -> sc_service::error::Result<TaskManager> {
<Self as NodeSpec>::start_manual_seal_node(config, block_time)
}

fn start_node(
self: Box<Self>,
parachain_config: Configuration,
Expand Down
Loading
Loading