Unverified Commit c35eb4fa authored by Squirrel's avatar Squirrel
Browse files

make full-node feature mandatory?

parent 6beeeddb
Pipeline #163532 failed with stages
in 13 minutes and 55 seconds
......@@ -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 = [
......@@ -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.
......@@ -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" ]
......@@ -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};
......
......@@ -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" }
......@@ -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" }
......@@ -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
......@@ -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"]
......@@ -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
......@@ -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),
......
......@@ -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,
......@@ -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,
......@@ -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")]
......@@ -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,
......@@ -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.
......@@ -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,
}
......@@ -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,
......@@ -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,
......@@ -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>>
......@@ -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>,
......@@ -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<
......@@ -553,7 +537,6 @@ where
})
}
#[cfg(feature = "full-node")]
pub struct NewFull<C> {
pub task_manager: TaskManager,
pub client: C,
......@@ -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> {
......@@ -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.
......@@ -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;
......@@ -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 {
......@@ -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>,
......@@ -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,
......@@ -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;
......@@ -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>,
......@@ -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,
......
......@@ -13,13 +13,10 @@
//! A `RocksDB` instance for storing parachain data; availability data, and approvals.
#[cfg(feature = "full-node")]
use {kvdb::KeyValueDB, std::io, std::path::PathBuf, std::sync::Arc};
#[cfg(feature = "full-node")]
mod upgrade;
#[cfg(any(test, feature = "full-node"))]
pub(crate) mod columns {
pub mod v0 {
pub const NUM_COLUMNS: u32 = 3;
......@@ -34,7 +31,6 @@ pub(crate) mod columns {
}
/// Columns used by different subsystems.
#[cfg(any(test, feature = "full-node"))]
#[derive(Debug, Clone)]
pub struct ColumnsConfig {
/// The column used by the av-store for data.
......@@ -50,7 +46,6 @@ pub struct ColumnsConfig {
}
/// The real columns used by the parachains DB.
#[cfg(any(test, feature = "full-node"))]
pub const REAL_COLUMNS: ColumnsConfig = ColumnsConfig {
col_availability_data: columns::COL_AVAILABILITY_DATA,
col_availability_meta: columns::COL_AVAILABILITY_META,
......@@ -76,13 +71,11 @@ impl Default for CacheSizes {
}
}
#[cfg(feature = "full-node")]
pub(crate) fn other_io_error(err: String) -> io::Error {
io::Error::new(io::ErrorKind::Other, err)
}
/// Open the database on disk, creating it if it doesn't exist.
#[cfg(feature = "full-node")]
pub fn open_creating(root: PathBuf, cache_sizes: CacheSizes) -> io::Result<Arc<dyn KeyValueDB>> {
use kvdb_rocksdb::{Database, DatabaseConfig};
......
......@@ -13,8 +13,6 @@
//! Migration code for the parachain's DB.
#![cfg(feature = "full-node")]
use std::{
fs, io,
path::{Path, PathBuf},
......
......@@ -33,8 +33,6 @@
//!
//! [chain-selection-guide]: https://w3f.github.io/parachain-implementers-guide/protocol-chain-selection.html
#![cfg(feature = "full-node")]
use super::{HeaderProvider, HeaderProviderProvider};
use consensus_common::{Error as ConsensusError, SelectChain};
use futures::channel::oneshot;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment