Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
make full-node feature mandatory?
  • Loading branch information
gilescope committed Oct 25, 2021
commit c35eb4fa399e43d29a10c83187cc39b9c74f1feb
5 changes: 2 additions & 3 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master",
substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "master" }

[features]
default = [ "wasmtime", "db", "cli", "full-node", "trie-memory-tracker", "polkadot-native" ]
default = [ "wasmtime", "db", "cli", "trie-memory-tracker", "polkadot-native" ]
wasmtime = [ "sc-cli/wasmtime" ]
db = [ "service/db" ]
cli = [
Expand All @@ -49,7 +49,6 @@ cli = [
]
runtime-benchmarks = [ "service/runtime-benchmarks" ]
trie-memory-tracker = [ "sp-trie/memory-tracker" ]
full-node = [ "service/full-node" ]
try-runtime = [ "service/try-runtime" ]

# Configure the native runtimes to use. Polkadot is enabled by default.
Expand All @@ -60,5 +59,5 @@ kusama-native = [ "service/kusama-native" ]
westend-native = [ "service/westend-native" ]
rococo-native = [ "service/rococo-native" ]

malus = [ "full-node", "service/malus" ]
malus = [ "service/malus" ]
disputes = [ "service/disputes" ]
1 change: 0 additions & 1 deletion cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ mod cli;
#[cfg(feature = "cli")]
mod command;

#[cfg(feature = "full-node")]
pub use service::RuntimeApiCollection;
#[cfg(feature = "service")]
pub use service::{self, Block, CoreApi, IdentifyVariant, ProvideRuntimeApi, TFullClient};
Expand Down
76 changes: 25 additions & 51 deletions node/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ tracing = "0.1.29"
serde = { version = "1.0.130", features = ["derive"] }
thiserror = "1.0.30"
kvdb = "0.10.0"
kvdb-rocksdb = { version = "0.14.0", optional = true }
kvdb-rocksdb = { version = "0.14.0" }
async-trait = "0.1.51"
lru = "0.7"

# Polkadot
polkadot-node-core-parachains-inherent = { path = "../core/parachains-inherent" }
polkadot-overseer = { path = "../overseer" }
polkadot-client = { path = "../client", default-features = false, optional = true }
polkadot-client = { path = "../client", default-features = false }
polkadot-parachain = { path = "../../parachain" }
polkadot-primitives = { path = "../../primitives" }
polkadot-node-primitives = { path = "../primitives" }
Expand All @@ -90,27 +90,27 @@ westend-runtime = { path = "../../runtime/westend", optional = true }
rococo-runtime = { path = "../../runtime/rococo", optional = true }

# Polkadot Subsystems
polkadot-approval-distribution = { path = "../network/approval-distribution", optional = true }
polkadot-availability-bitfield-distribution = { path = "../network/bitfield-distribution", optional = true }
polkadot-availability-distribution = { path = "../network/availability-distribution", optional = true }
polkadot-availability-recovery = { path = "../network/availability-recovery", optional = true }
polkadot-collator-protocol = { path = "../network/collator-protocol", optional = true }
polkadot-dispute-distribution = { path = "../network/dispute-distribution", optional = true }
polkadot-gossip-support = { path = "../network/gossip-support", optional = true }
polkadot-network-bridge = { path = "../network/bridge", optional = true }
polkadot-node-collation-generation = { path = "../collation-generation", optional = true }
polkadot-node-core-approval-voting = { path = "../core/approval-voting", optional = true }
polkadot-node-core-av-store = { path = "../core/av-store", optional = true }
polkadot-node-core-backing = { path = "../core/backing", optional = true }
polkadot-node-core-bitfield-signing = { path = "../core/bitfield-signing", optional = true }
polkadot-node-core-candidate-validation = { path = "../core/candidate-validation", optional = true }
polkadot-node-core-chain-api = { path = "../core/chain-api", optional = true }
polkadot-node-core-chain-selection = { path = "../core/chain-selection", optional = true }
polkadot-node-core-dispute-coordinator = { path = "../core/dispute-coordinator", optional = true }
polkadot-node-core-dispute-participation = { path = "../core/dispute-participation", optional = true }
polkadot-node-core-provisioner = { path = "../core/provisioner", optional = true }
polkadot-node-core-runtime-api = { path = "../core/runtime-api", optional = true }
polkadot-statement-distribution = { path = "../network/statement-distribution", optional = true }
polkadot-approval-distribution = { path = "../network/approval-distribution" }
polkadot-availability-bitfield-distribution = { path = "../network/bitfield-distribution" }
polkadot-availability-distribution = { path = "../network/availability-distribution" }
polkadot-availability-recovery = { path = "../network/availability-recovery" }
polkadot-collator-protocol = { path = "../network/collator-protocol" }
polkadot-dispute-distribution = { path = "../network/dispute-distribution" }
polkadot-gossip-support = { path = "../network/gossip-support" }
polkadot-network-bridge = { path = "../network/bridge" }
polkadot-node-collation-generation = { path = "../collation-generation" }
polkadot-node-core-approval-voting = { path = "../core/approval-voting" }
polkadot-node-core-av-store = { path = "../core/av-store" }
polkadot-node-core-backing = { path = "../core/backing" }
polkadot-node-core-bitfield-signing = { path = "../core/bitfield-signing" }
polkadot-node-core-candidate-validation = { path = "../core/candidate-validation" }
polkadot-node-core-chain-api = { path = "../core/chain-api" }
polkadot-node-core-chain-selection = { path = "../core/chain-selection" }
polkadot-node-core-dispute-coordinator = { path = "../core/dispute-coordinator" }
polkadot-node-core-dispute-participation = { path = "../core/dispute-participation" }
polkadot-node-core-provisioner = { path = "../core/provisioner" }
polkadot-node-core-runtime-api = { path = "../core/runtime-api" }
polkadot-statement-distribution = { path = "../network/statement-distribution" }

[dev-dependencies]
polkadot-test-client = { path = "../test/client" }
Expand All @@ -120,38 +120,12 @@ log = "0.4.14"
assert_matches = "1.5.0"

[features]
default = ["db", "full-node", "polkadot-native"]
default = ["db", "polkadot-native"]

db = [
"service/db"
]

full-node = [
"polkadot-node-core-av-store",
"polkadot-node-core-approval-voting",
"polkadot-availability-bitfield-distribution",
"polkadot-availability-distribution",
"polkadot-availability-recovery",
"polkadot-client",
"polkadot-collator-protocol",
"polkadot-dispute-distribution",
"polkadot-gossip-support",
"polkadot-network-bridge",
"polkadot-node-collation-generation",
"polkadot-node-core-backing",
"polkadot-node-core-bitfield-signing",
"polkadot-node-core-candidate-validation",
"polkadot-node-core-chain-api",
"polkadot-node-core-chain-selection",
"polkadot-node-core-dispute-coordinator",
"polkadot-node-core-dispute-participation",
"polkadot-node-core-provisioner",
"polkadot-node-core-runtime-api",
"polkadot-statement-distribution",
"polkadot-approval-distribution",
"kvdb-rocksdb"
]

# Configure the native runtimes to use. Polkadot is enabled by default.
#
# Validators require the native runtime currently
Expand All @@ -172,5 +146,5 @@ try-runtime = [
"westend-runtime/try-runtime",
"rococo-runtime/try-runtime",
]
malus = ["full-node"]
malus = []
disputes = ["polkadot-node-core-dispute-coordinator/disputes"]
2 changes: 0 additions & 2 deletions node/service/src/grandpa_support.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ use sp_runtime::traits::{Block as BlockT, Header as _, NumberFor};

use crate::HeaderProvider;

#[cfg(feature = "full-node")]
use polkadot_primitives::v1::Hash;

/// Returns the block hash of the block at the given `target_number` by walking
Expand Down Expand Up @@ -114,7 +113,6 @@ where
/// intermediary pending changes are replaced with a static list comprised of
/// w3f validators and randomly selected validators from the latest session (at
/// #1500988).
#[cfg(feature = "full-node")]
pub(crate) fn kusama_hard_forks() -> Vec<(
grandpa_primitives::SetId,
(Hash, polkadot_primitives::v1::BlockNumber),
Expand Down
30 changes: 2 additions & 28 deletions node/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,13 @@ mod grandpa_support;
mod parachains_db;
mod relay_chain_selection;

#[cfg(feature = "full-node")]
pub mod overseer;

#[cfg(feature = "full-node")]
pub use self::overseer::{OverseerGen, OverseerGenArgs, RealOverseerGen};

#[cfg(all(test, feature = "disputes"))]
mod tests;

#[cfg(feature = "full-node")]
use {
grandpa::{self, FinalityProofProvider as GrandpaFinalityProofProvider},
polkadot_node_core_approval_voting::Config as ApprovalVotingConfig,
Expand All @@ -50,7 +47,7 @@ use {
};

pub use sp_core::traits::SpawnNamed;
#[cfg(feature = "full-node")]

pub use {
polkadot_overseer::{Handle, Overseer, OverseerConnector, OverseerHandle},
polkadot_primitives::v1::ParachainHost,
Expand All @@ -61,17 +58,14 @@ pub use {
sp_consensus_babe::BabeApi,
};

#[cfg(feature = "full-node")]
use polkadot_subsystem::jaeger;

use std::{sync::Arc, time::Duration};

use prometheus_endpoint::Registry;
#[cfg(feature = "full-node")]
use service::KeystoreContainer;
use service::RpcHandlers;
use telemetry::TelemetryWorker;
#[cfg(feature = "full-node")]
use telemetry::{Telemetry, TelemetryWorkerHandle};

#[cfg(feature = "rococo-native")]
Expand All @@ -88,7 +82,6 @@ pub use polkadot_client::PolkadotExecutorDispatch;

pub use chain_spec::{KusamaChainSpec, PolkadotChainSpec, RococoChainSpec, WestendChainSpec};
pub use consensus_common::{block_validation::Chain, Proposal, SelectChain};
#[cfg(feature = "full-node")]
pub use polkadot_client::{
AbstractClient, Client, ClientHandle, ExecuteWithClient, FullBackend, FullClient,
RuntimeApiCollection,
Expand Down Expand Up @@ -122,7 +115,6 @@ pub use rococo_runtime;
pub use westend_runtime;

/// The maximum number of active leaves we forward to the [`Overseer`] on startup.
#[cfg(any(test, feature = "full-node"))]
const MAX_ACTIVE_LEAVES: usize = 4;

/// Provides the header and block number for a hash.
Expand Down Expand Up @@ -221,18 +213,15 @@ pub enum Error {
#[error(transparent)]
Jaeger(#[from] polkadot_subsystem::jaeger::JaegerError),

#[cfg(feature = "full-node")]
#[error(transparent)]
Availability(#[from] AvailabilityError),

#[error("Authorities require the real overseer implementation")]
AuthoritiesRequireRealOverseer,

#[cfg(feature = "full-node")]
#[error("Creating a custom database is required for validators")]
DatabasePathRequired,

#[cfg(feature = "full-node")]
#[error("Expected at least one of polkadot, kusama, westend or rococo runtime feature")]
NoRuntime,
}
Expand Down Expand Up @@ -284,7 +273,6 @@ fn set_prometheus_registry(config: &mut Configuration) -> Result<(), Error> {

/// Initialize the `Jeager` collector. The destination must listen
/// on the given address and port for `UDP` packets.
#[cfg(any(test, feature = "full-node"))]
fn jaeger_launch_collector_with_agent(
spawner: impl SpawnNamed,
config: &Configuration,
Expand All @@ -301,9 +289,8 @@ fn jaeger_launch_collector_with_agent(
Ok(())
}

#[cfg(feature = "full-node")]
type FullSelectChain = relay_chain_selection::SelectRelayChain<FullBackend>;
#[cfg(feature = "full-node")]

type FullGrandpaBlockImport<RuntimeApi, ExecutorDispatch, ChainSelection = FullSelectChain> =
grandpa::GrandpaBlockImport<
FullBackend,
Expand All @@ -312,7 +299,6 @@ type FullGrandpaBlockImport<RuntimeApi, ExecutorDispatch, ChainSelection = FullS
ChainSelection,
>;

#[cfg(feature = "full-node")]
struct Basics<RuntimeApi, ExecutorDispatch>
where
RuntimeApi: ConstructRuntimeApi<Block, FullClient<RuntimeApi, ExecutorDispatch>>
Expand All @@ -330,7 +316,6 @@ where
telemetry: Option<Telemetry>,
}

#[cfg(feature = "full-node")]
fn new_partial_basics<RuntimeApi, ExecutorDispatch>(
config: &mut Configuration,
jaeger_agent: Option<std::net::SocketAddr>,
Expand Down Expand Up @@ -390,7 +375,6 @@ where
Ok(Basics { task_manager, client, backend, keystore_container, telemetry })
}

#[cfg(feature = "full-node")]
fn new_partial<RuntimeApi, ExecutorDispatch, ChainSelection>(
config: &mut Configuration,
Basics { task_manager, backend, client, keystore_container, telemetry }: Basics<
Expand Down Expand Up @@ -553,7 +537,6 @@ where
})
}

#[cfg(feature = "full-node")]
pub struct NewFull<C> {
pub task_manager: TaskManager,
pub client: C,
Expand All @@ -563,7 +546,6 @@ pub struct NewFull<C> {
pub backend: Arc<FullBackend>,
}

#[cfg(feature = "full-node")]
impl<C> NewFull<C> {
/// Convert the client type using the given `func`.
pub fn with_client<NC>(self, func: impl FnOnce(C) -> NC) -> NewFull<NC> {
Expand All @@ -579,7 +561,6 @@ impl<C> NewFull<C> {
}

/// Is this node a collator?
#[cfg(feature = "full-node")]
#[derive(Clone)]
pub enum IsCollator {
/// This node is a collator.
Expand All @@ -588,7 +569,6 @@ pub enum IsCollator {
No,
}

#[cfg(feature = "full-node")]
impl std::fmt::Debug for IsCollator {
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
use sp_core::Pair;
Expand All @@ -599,7 +579,6 @@ impl std::fmt::Debug for IsCollator {
}
}

#[cfg(feature = "full-node")]
impl IsCollator {
/// Is this a collator?
fn is_collator(&self) -> bool {
Expand All @@ -608,7 +587,6 @@ impl IsCollator {
}

/// Returns the active leaves the overseer should start with.
#[cfg(feature = "full-node")]
async fn active_leaves<RuntimeApi, ExecutorDispatch>(
select_chain: &impl SelectChain<Block>,
client: &FullClient<RuntimeApi, ExecutorDispatch>,
Expand Down Expand Up @@ -661,7 +639,6 @@ where
///
/// This is an advanced feature and not recommended for general use. Generally, `build_full` is
/// a better choice.
#[cfg(feature = "full-node")]
pub fn new_full<RuntimeApi, ExecutorDispatch, OverseerGenerator>(
mut config: Configuration,
is_collator: IsCollator,
Expand Down Expand Up @@ -1119,7 +1096,6 @@ where
Ok(NewFull { task_manager, client, overseer_handle, network, rpc_handlers, backend })
}

#[cfg(feature = "full-node")]
macro_rules! chain_ops {
($config:expr, $jaeger_agent:expr, $telemetry_worker_handle:expr; $scope:ident, $executor:ident, $variant:ident) => {{
let telemetry_worker_handle = $telemetry_worker_handle;
Expand All @@ -1146,7 +1122,6 @@ macro_rules! chain_ops {
}

/// Builds a new object suitable for chain operations.
#[cfg(feature = "full-node")]
pub fn new_chain_ops(
mut config: &mut Configuration,
jaeger_agent: Option<std::net::SocketAddr>,
Expand Down Expand Up @@ -1186,7 +1161,6 @@ pub fn new_chain_ops(
Err(Error::NoRuntime)
}

#[cfg(feature = "full-node")]
pub fn build_full(
config: Configuration,
is_collator: IsCollator,
Expand Down
Loading