Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
parity
Mirrored projects
polkadot
Commits
cbcb9a47
Unverified
Commit
cbcb9a47
authored
Oct 26, 2021
by
Squirrel
Browse files
Revert "make full-node feature mandatory?"
This reverts commit
c35eb4fa
.
parent
43376f00
Pipeline
#163608
passed with stages
in 44 minutes and 1 second
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
cli/Cargo.toml
View file @
cbcb9a47
...
...
@@ -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"
,
"trie-memory-tracker"
,
"polkadot-native"
]
default
=
[
"wasmtime"
,
"db"
,
"cli"
,
"full-node"
,
"trie-memory-tracker"
,
"polkadot-native"
]
wasmtime
=
[
"sc-cli/wasmtime"
]
db
=
[
"service/db"
]
cli
=
[
...
...
@@ -49,6 +49,7 @@ 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.
...
...
@@ -59,5 +60,5 @@ kusama-native = [ "service/kusama-native" ]
westend-native
=
[
"service/westend-native"
]
rococo-native
=
[
"service/rococo-native"
]
malus
=
[
"service/malus"
]
malus
=
[
"full-node"
,
"service/malus"
]
disputes
=
[
"service/disputes"
]
cli/src/lib.rs
View file @
cbcb9a47
...
...
@@ -23,6 +23,7 @@ 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
};
...
...
node/service/Cargo.toml
View file @
cbcb9a47
...
...
@@ -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"
}
kvdb-rocksdb
=
{
version
=
"0.14.0"
,
optional
=
true
}
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
}
polkadot-client
=
{
path
=
"../client"
,
default-features
=
false
,
optional
=
true
}
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"
}
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"
}
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
}
[dev-dependencies]
polkadot-test-client
=
{
path
=
"../test/client"
}
...
...
@@ -120,12 +120,38 @@ log = "0.4.14"
assert_matches
=
"1.5.0"
[features]
default
=
[
"db"
,
"polkadot-native"
]
default
=
[
"db"
,
"full-node"
,
"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
...
...
@@ -146,5 +172,5 @@ try-runtime = [
"westend-runtime/try-runtime"
,
"rococo-runtime/try-runtime"
,
]
malus
=
[]
malus
=
[
"full-node"
]
disputes
=
["polkadot-node-core-dispute-coordinator/disputes"]
node/service/src/grandpa_support.rs
View file @
cbcb9a47
...
...
@@ -22,6 +22,7 @@ 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
...
...
@@ -113,6 +114,7 @@ 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
),
...
...
node/service/src/lib.rs
View file @
cbcb9a47
...
...
@@ -23,13 +23,16 @@ 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
,
...
...
@@ -47,7 +50,7 @@ use {
};
pub
use
sp_core
::
traits
::
SpawnNamed
;
#[cfg(feature
=
"full-node"
)]
pub
use
{
polkadot_overseer
::{
Handle
,
Overseer
,
OverseerConnector
,
OverseerHandle
},
polkadot_primitives
::
v1
::
ParachainHost
,
...
...
@@ -58,14 +61,17 @@ 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"
)]
...
...
@@ -82,6 +88,7 @@ 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
,
...
...
@@ -115,6 +122,7 @@ 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.
...
...
@@ -213,15 +221,18 @@ 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
,
}
...
...
@@ -273,6 +284,7 @@ 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
,
...
...
@@ -289,8 +301,9 @@ 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
,
...
...
@@ -299,6 +312,7 @@ type FullGrandpaBlockImport<RuntimeApi, ExecutorDispatch, ChainSelection = FullS
ChainSelection
,
>
;
#[cfg(feature
=
"full-node"
)]
struct
Basics
<
RuntimeApi
,
ExecutorDispatch
>
where
RuntimeApi
:
ConstructRuntimeApi
<
Block
,
FullClient
<
RuntimeApi
,
ExecutorDispatch
>>
...
...
@@ -316,6 +330,7 @@ where
telemetry
:
Option
<
Telemetry
>
,
}
#[cfg(feature
=
"full-node"
)]
fn
new_partial_basics
<
RuntimeApi
,
ExecutorDispatch
>
(
config
:
&
mut
Configuration
,
jaeger_agent
:
Option
<
std
::
net
::
SocketAddr
>
,
...
...
@@ -375,6 +390,7 @@ 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
<
...
...
@@ -537,6 +553,7 @@ where
})
}
#[cfg(feature
=
"full-node"
)]
pub
struct
NewFull
<
C
>
{
pub
task_manager
:
TaskManager
,
pub
client
:
C
,
...
...
@@ -546,6 +563,7 @@ 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
>
{
...
...
@@ -561,6 +579,7 @@ impl<C> NewFull<C> {
}
/// Is this node a collator?
#[cfg(feature
=
"full-node"
)]
#[derive(Clone)]
pub
enum
IsCollator
{
/// This node is a collator.
...
...
@@ -569,6 +588,7 @@ 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
;
...
...
@@ -579,6 +599,7 @@ impl std::fmt::Debug for IsCollator {
}
}
#[cfg(feature
=
"full-node"
)]
impl
IsCollator
{
/// Is this a collator?
fn
is_collator
(
&
self
)
->
bool
{
...
...
@@ -587,6 +608,7 @@ 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
>
,
...
...
@@ -639,6 +661,7 @@ 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
,
...
...
@@ -1096,6 +1119,7 @@ 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
;
...
...
@@ -1122,6 +1146,7 @@ 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
>
,
...
...
@@ -1161,6 +1186,7 @@ pub fn new_chain_ops(
Err
(
Error
::
NoRuntime
)
}
#[cfg(feature
=
"full-node"
)]
pub
fn
build_full
(
config
:
Configuration
,
is_collator
:
IsCollator
,
...
...
node/service/src/parachains_db/mod.rs
View file @
cbcb9a47
...
...
@@ -13,10 +13,13 @@
//! 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
;
...
...
@@ -31,6 +34,7 @@ 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.
...
...
@@ -46,6 +50,7 @@ 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
,
...
...
@@ -71,11 +76,13 @@ 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
};
...
...
node/service/src/parachains_db/upgrade.rs
View file @
cbcb9a47
...
...
@@ -13,6 +13,8 @@
//! Migration code for the parachain's DB.
#![cfg(feature
=
"full-node"
)]
use
std
::{
fs
,
io
,
path
::{
Path
,
PathBuf
},
...
...
node/service/src/relay_chain_selection.rs
View file @
cbcb9a47
...
...
@@ -33,6 +33,8 @@
//!
//! [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
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment