Unverified Commit af14ea54 authored by Peter Goodspeed-Niklaus's avatar Peter Goodspeed-Niklaus Committed by GitHub
Browse files

Remove service, migrate all to service-new (#1630)

* import rococo into chain-spec

* make a few stabs at moving forward

* wip: rococo readme

* remove /service crate

- Move the chain-spec files to node-service
- update sufficient cargo files that polkadot-service-new builds
- not everything else builds yet

* wip: chase down some build errors in polkadot-cli

There's a lot more to go, but some progress has happened.

* make more progress getting polkadot-cli to build

* don't ignore polkadot.json within the res directory

* don't recreate pathbufs

* Prepare Polkadot to be used by Cumulus

This begins to make Polkadot usable from Cumulus.

* Remove old test

* migrate new_chain_ops fix from /service

* partially remove node/test-service

* Reset some changes

* Revert "partially remove node/test-service"

This reverts commit 7b8f9ba5.

* WIP: replace v0 ParachainHost impl with v1 for test runtime

This is necessary because one of the current errors when building
the test service boils down to:

the trait bound `polkadot_test_runtime::RuntimeApiImpl<...>`:
  `polkadot_primitives::v1::ParachainHost<...>` is not satisfied

This is WIP because it appears to be causing some std leakage into
the wasm environment, or something; the compiler is currently
complaining about duplicate definitions of `panic_handler` and `oom`.
Presumably I have to identify all std types (Vec etc) and replace
them with sp_std equivalents.

* fix test runtime build

it wasn't std leakage, after all

* bump westend spec version

* use service-new as service within cli

* to revert: demo that forwarding the test runtime to the real impl blows up

* Revert "to revert: demo that forwarding the test runtime to the real impl blows up"

This reverts commit 68d2f385.

* Revert "Revert "to revert: demo that forwarding the test runtime to the real impl blows up""

This reverts commit 04cb1cbf.

Might have just forgotten to disable default features

* More reverts

* MOARE

* plug in the runtime as the generic instantiation

This feels closer to a solution, but it still has problems: in particular,
it's assumed that Runtime implements all appropriate Trait traits,
which this one apparently does not.

* implement necessary traits to get the test runtime compiling

This is almost certainly not correct in some way; it really
looks like I need to mess with the construct_runtime! macro
somehow, to inject the inclusion trait's event type as a Event
variant. Still, better lock down this changeset while it all
compiles.

* add inclusion::Event as variant into Event enum

* implement unimplemented bits in kusama

* implement unimplemented bits in polkadot runtime

* implement unimplemented bits in westend runtime

* migrate client upgrades from master

* update test service with new node changes

* package metadata--that wasn't intended to be removed

* add parachains v1 modules to each runtime

It's not clear what precisely this does, but it's probably the right
thing to do.

* enable cli to opt out of full node features

* adjust rococo chainspec per example

https://github.com/paritytech/polkadot/blob/26f1fa47f7836ab4bee5d4aad127ebce748320dd/service/src/chain_spec.rs#L362



* try to fix Cargo.lock

Co-authored-by: Bastian Köcher's avatarBastian Köcher <git@kchr.de>
Co-authored-by: Andronik Ordian's avatarAndronik Ordian <write@reusable.software>
parent 5ec559c0
......@@ -4643,7 +4643,7 @@ dependencies = [
"nix 0.17.0",
"parity-util-mem",
"polkadot-cli",
"polkadot-service",
"polkadot-service-new",
"tempfile",
]
......@@ -4707,7 +4707,6 @@ dependencies = [
"frame-benchmarking-cli",
"futures 0.3.5",
"log 0.4.11",
"polkadot-service",
"polkadot-service-new",
"sc-cli",
"sc-client-api",
......@@ -5339,65 +5338,6 @@ dependencies = [
"sp-version",
]
[[package]]
name = "polkadot-service"
version = "0.8.24"
dependencies = [
"env_logger",
"frame-benchmarking",
"frame-system-rpc-runtime-api",
"futures 0.3.5",
"hex-literal 0.2.1",
"kusama-runtime",
"lazy_static",
"log 0.4.11",
"pallet-babe",
"pallet-im-online",
"pallet-staking",
"pallet-transaction-payment-rpc-runtime-api",
"parity-scale-codec",
"parking_lot 0.9.0",
"polkadot-primitives",
"polkadot-rpc",
"polkadot-runtime",
"polkadot-test-runtime-client",
"polkadot-validation",
"sc-authority-discovery",
"sc-block-builder",
"sc-chain-spec",
"sc-client-api",
"sc-client-db",
"sc-consensus",
"sc-consensus-babe",
"sc-executor",
"sc-finality-grandpa",
"sc-keystore",
"sc-network",
"sc-service",
"sc-telemetry",
"sc-transaction-pool",
"serde",
"slog",
"sp-api",
"sp-authority-discovery",
"sp-block-builder",
"sp-blockchain",
"sp-consensus",
"sp-consensus-babe",
"sp-core",
"sp-finality-grandpa",
"sp-inherents",
"sp-io",
"sp-offchain",
"sp-runtime",
"sp-session",
"sp-storage",
"sp-transaction-pool",
"sp-trie",
"substrate-prometheus-endpoint",
"westend-runtime",
]
[[package]]
name = "polkadot-service-new"
version = "0.8.3"
......@@ -5419,10 +5359,12 @@ dependencies = [
"polkadot-node-core-proposer",
"polkadot-node-subsystem",
"polkadot-overseer",
"polkadot-parachain",
"polkadot-primitives",
"polkadot-rpc",
"polkadot-runtime",
"polkadot-test-runtime-client",
"rococo-v1-runtime",
"sc-authority-discovery",
"sc-block-builder",
"sc-chain-spec",
......@@ -5526,6 +5468,7 @@ dependencies = [
"polkadot-parachain",
"polkadot-primitives",
"polkadot-runtime-common",
"polkadot-runtime-parachains",
"rustc-hex",
"serde",
"serde_derive",
......@@ -5587,10 +5530,11 @@ dependencies = [
"pallet-balances",
"pallet-staking",
"pallet-transaction-payment",
"polkadot-overseer",
"polkadot-primitives",
"polkadot-rpc",
"polkadot-runtime-common",
"polkadot-service",
"polkadot-service-new",
"polkadot-test-runtime",
"rand 0.7.3",
"sc-authority-discovery",
......
......@@ -14,7 +14,7 @@ readme = "README.md"
[dependencies]
cli = { package = "polkadot-cli", path = "cli" }
futures = "0.3.4"
service = { package = "polkadot-service", path = "service" }
service = { package = "polkadot-service-new", path = "node/service" }
parity-util-mem = { version = "*", default-features = false, features = ["jemalloc-global"] }
[dev-dependencies]
......@@ -36,9 +36,7 @@ members = [
"runtime/westend",
"runtime/test-runtime",
"runtime/test-runtime/client",
"service",
"statement-table",
"service",
"validation",
"node/collation-generation",
......@@ -79,9 +77,6 @@ panic = "unwind"
[features]
runtime-benchmarks=["cli/runtime-benchmarks"]
service-rewr= [
"cli/service-rewr",
]
# Configuration for building a .deb package - for use with `cargo-deb`
[package.metadata.deb]
......
......@@ -24,8 +24,7 @@ sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "mas
sc-client-db = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "master" }
service = { package = "polkadot-service", path = "../service", default-features = false, optional = true }
service-new = { package = "polkadot-service-new", path = "../node/service", default-features = false, optional = true }
service = { package = "polkadot-service-new", path = "../node/service", default-features = false, optional = true }
tokio = { version = "0.2.13", features = ["rt-threaded"], optional = true }
frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true }
......@@ -43,7 +42,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", "service-old", "trie-memory-tracker" ]
default = [ "wasmtime", "db", "cli", "full-node", "trie-memory-tracker" ]
wasmtime = [ "sc-cli/wasmtime" ]
db = [ "service/db" ]
cli = [
......@@ -52,7 +51,6 @@ cli = [
"sc-service",
"frame-benchmarking-cli",
]
service-old = [ "service/full-node" ]
browser = [
"wasm-bindgen",
"wasm-bindgen-futures",
......@@ -60,5 +58,5 @@ browser = [
"service",
]
runtime-benchmarks = [ "service/runtime-benchmarks" ]
service-rewr = [ "service-new/full-node" ]
trie-memory-tracker = [ "sp-trie/memory-tracker" ]
full-node = [ "service/full-node" ]
......@@ -79,6 +79,10 @@ pub struct RunCmd {
#[structopt(long = "force-westend")]
pub force_westend: bool,
/// Force using Rococo native runtime.
#[structopt(long = "force-rococo")]
pub force_rococo: bool,
/// Enable the authority discovery module on validator or sentry nodes.
///
/// When enabled:
......
......@@ -15,10 +15,7 @@
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
use log::info;
#[cfg(not(feature = "service-rewr"))]
use service::{IdentifyVariant, self};
#[cfg(feature = "service-rewr")]
use service_new::{IdentifyVariant, self as service};
use sc_cli::{SubstrateCli, Result, RuntimeVersion, Role};
use crate::cli::{Cli, Subcommand};
use std::sync::Arc;
......@@ -48,7 +45,7 @@ impl SubstrateCli for Cli {
fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
let id = if id == "" {
let n = get_exec_name().unwrap_or_default();
["polkadot", "kusama", "westend"].iter()
["polkadot", "kusama", "westend", "rococo"].iter()
.cloned()
.find(|&chain| n.starts_with(chain))
.unwrap_or("polkadot")
......@@ -66,6 +63,9 @@ impl SubstrateCli for Cli {
"westend-dev" => Box::new(service::chain_spec::westend_development_config()?),
"westend-local" => Box::new(service::chain_spec::westend_local_testnet_config()?),
"westend-staging" => Box::new(service::chain_spec::westend_staging_testnet_config()?),
"rococo-staging" => Box::new(service::chain_spec::rococo_staging_testnet_config()?),
"rococo-local" => Box::new(service::chain_spec::rococo_local_testnet_config()?),
"rococo" => Box::new(service::chain_spec::rococo_config()?),
path => {
let path = std::path::PathBuf::from(path);
......@@ -75,7 +75,9 @@ impl SubstrateCli for Cli {
// When `force_*` is given or the file name starts with the name of one of the known chains,
// we use the chain spec for the specific chain.
if self.run.force_kusama || starts_with("kusama") {
if self.run.force_rococo || starts_with("rococo") {
Box::new(service::RococoChainSpec::from_json_file(path)?)
} else if self.run.force_kusama || starts_with("kusama") {
Box::new(service::KusamaChainSpec::from_json_file(path)?)
} else if self.run.force_westend || starts_with("westend") {
Box::new(service::WestendChainSpec::from_json_file(path)?)
......@@ -91,6 +93,8 @@ impl SubstrateCli for Cli {
&service::kusama_runtime::VERSION
} else if spec.is_westend() {
&service::westend_runtime::VERSION
} else if spec.is_rococo() {
&service::rococo_runtime::VERSION
} else {
&service::polkadot_runtime::VERSION
}
......@@ -147,7 +151,7 @@ pub fn run() -> Result<()> {
None,
authority_discovery_enabled,
grandpa_pause,
).map(|r| r.0),
).map(|full| full.task_manager),
}
})
},
......@@ -180,8 +184,8 @@ pub fn run() -> Result<()> {
let chain_spec = config.chain_spec.cloned_box();
let network_config = config.network.clone();
let service::NewFull { task_manager, client, network_status_sinks, .. }
= service::new_full_nongeneric(
config, None, authority_discovery_enabled, grandpa_pause, false,
= service::build_full(
config, None, authority_discovery_enabled, grandpa_pause,
)?;
let client = Arc::new(client);
......
......@@ -26,17 +26,10 @@ mod cli;
#[cfg(feature = "cli")]
mod command;
#[cfg(not(feature = "service-rewr"))]
pub use service::{
ProvideRuntimeApi, CoreApi, ParachainHost, IdentifyVariant,
Block, self, RuntimeApiCollection, TFullClient
};
#[cfg(feature = "service-rewr")]
pub use service_new::{
self as service,
ProvideRuntimeApi, CoreApi, ParachainHost, IdentifyVariant,
Block, self, RuntimeApiCollection, TFullClient
self,
ProvideRuntimeApi, CoreApi, IdentifyVariant,
Block, RuntimeApiCollection, TFullClient
};
#[cfg(feature = "cli")]
......
......@@ -5,59 +5,72 @@ authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
[dependencies]
parking_lot = "0.9.0"
serde = { version = "1.0.102", features = ["derive"] }
lazy_static = "1.4.0"
log = "0.4.8"
futures = "0.3.4"
slog = "2.5.2"
hex-literal = "0.2.1"
polkadot-primitives = { path = "../../primitives" }
polkadot-runtime = { path = "../../runtime/polkadot" }
polkadot-overseer = { path = "../overseer" }
polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../subsystem" }
kusama-runtime = { path = "../../runtime/kusama" }
westend-runtime = { path = "../../runtime/westend" }
polkadot-rpc = { path = "../../rpc" }
polkadot-node-core-proposer = { path = "../core/proposer" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
# Substrate Client
authority-discovery = { package = "sc-authority-discovery", git = "https://github.com/paritytech/substrate", branch = "master" }
babe = { package = "sc-consensus-babe", git = "https://github.com/paritytech/substrate", branch = "master" }
grandpa = { package = "sc-finality-grandpa", git = "https://github.com/paritytech/substrate", branch = "master" }
sc-block-builder = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-client-db = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-storage = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "master" }
service = { package = "sc-service", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
telemetry = { package = "sc-telemetry", git = "https://github.com/paritytech/substrate", branch = "master" }
# Substrate Primitives
authority-discovery-primitives = { package = "sp-authority-discovery", git = "https://github.com/paritytech/substrate", branch = "master" }
babe-primitives = { package = "sp-consensus-babe", git = "https://github.com/paritytech/substrate", branch = "master" }
consensus_common = { package = "sp-consensus", git = "https://github.com/paritytech/substrate", branch = "master" }
grandpa = { package = "sc-finality-grandpa", git = "https://github.com/paritytech/substrate", branch = "master" }
grandpa_primitives = { package = "sp-finality-grandpa", git = "https://github.com/paritytech/substrate", branch = "master" }
inherents = { package = "sp-inherents", git = "https://github.com/paritytech/substrate", branch = "master" }
service = { package = "sc-service", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
telemetry = { package = "sc-telemetry", git = "https://github.com/paritytech/substrate", branch = "master" }
sc-block-builder = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-offchain = { package = "sp-offchain", git = "https://github.com/paritytech/substrate", branch = "master" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-session = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-storage = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master" }
# Substrate Pallets
pallet-babe = { git = "https://github.com/paritytech/substrate", branch = "master" }
pallet-staking = { git = "https://github.com/paritytech/substrate", branch = "master" }
pallet-im-online = { git = "https://github.com/paritytech/substrate", branch = "master" }
authority-discovery = { package = "sc-authority-discovery", git = "https://github.com/paritytech/substrate", branch = "master" }
authority-discovery-primitives = { package = "sp-authority-discovery", git = "https://github.com/paritytech/substrate", branch = "master" }
babe = { package = "sc-consensus-babe", git = "https://github.com/paritytech/substrate", branch = "master" }
babe-primitives = { package = "sp-consensus-babe", git = "https://github.com/paritytech/substrate", branch = "master" }
sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "master" }
pallet-staking = { git = "https://github.com/paritytech/substrate", branch = "master" }
pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
# Substrate Other
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master" }
frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
codec = { package = "parity-scale-codec", version = "1.3.4" }
sp-session = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-offchain = { package = "sp-offchain", git = "https://github.com/paritytech/substrate", branch = "master" }
prometheus-endpoint = { package = "substrate-prometheus-endpoint", git = "https://github.com/paritytech/substrate", branch = "master" }
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master" }
# External Crates
codec = { package = "parity-scale-codec", version = "1.3.4" }
futures = "0.3.4"
hex-literal = "0.2.1"
lazy_static = "1.4.0"
log = "0.4.8"
parking_lot = "0.9.0"
serde = { version = "1.0.102", features = ["derive"] }
slog = "2.5.2"
# Polkadot
kusama-runtime = { path = "../../runtime/kusama" }
polkadot-node-core-proposer = { path = "../core/proposer" }
polkadot-overseer = { path = "../overseer" }
polkadot-parachain = { path = "../../parachain" }
polkadot-primitives = { path = "../../primitives" }
polkadot-rpc = { path = "../../rpc" }
polkadot-runtime = { path = "../../runtime/polkadot" }
polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../subsystem" }
rococo-runtime = { package = "rococo-v1-runtime", path = "../../runtime/rococo-v1" }
westend-runtime = { path = "../../runtime/westend" }
[dev-dependencies]
polkadot-test-runtime-client = { path = "../../runtime/test-runtime/client" }
......
This diff is collapsed.
This diff is collapsed.
......@@ -24,7 +24,7 @@ use sp_runtime::{
};
use sc_client_api::{Backend as BackendT, BlockchainEvents, KeyIterator};
use sp_storage::{StorageData, StorageKey, ChildInfo, PrefixedStorageKey};
use polkadot_primitives::v1::{Block, ParachainHost, AccountId, Nonce, Balance};
use polkadot_primitives::v1::{Block, ParachainHost, AccountId, Nonce, Balance, Header, BlockNumber, Hash};
use consensus_common::BlockStatus;
/// A set of APIs that polkadot-like runtimes must implement.
......@@ -142,6 +142,7 @@ pub enum Client {
Polkadot(Arc<crate::FullClient<polkadot_runtime::RuntimeApi, crate::PolkadotExecutor>>),
Westend(Arc<crate::FullClient<westend_runtime::RuntimeApi, crate::WestendExecutor>>),
Kusama(Arc<crate::FullClient<kusama_runtime::RuntimeApi, crate::KusamaExecutor>>),
Rococo(Arc<crate::FullClient<rococo_runtime::RuntimeApi, crate::RococoExecutor>>),
}
impl ClientHandle for Client {
......@@ -156,6 +157,9 @@ impl ClientHandle for Client {
Self::Kusama(client) => {
T::execute_with_client::<_, _, crate::FullBackend>(t, client.clone())
},
Self::Rococo(client) => {
T::execute_with_client::<_, _, crate::FullBackend>(t, client.clone())
}
}
}
}
......@@ -166,6 +170,7 @@ impl sc_client_api::UsageProvider<Block> for Client {
Self::Polkadot(client) => client.usage_info(),
Self::Westend(client) => client.usage_info(),
Self::Kusama(client) => client.usage_info(),
Self::Rococo(client) => client.usage_info(),
}
}
}
......@@ -179,6 +184,7 @@ impl sc_client_api::BlockBackend<Block> for Client {
Self::Polkadot(client) => client.block_body(id),
Self::Westend(client) => client.block_body(id),
Self::Kusama(client) => client.block_body(id),
Self::Rococo(client) => client.block_body(id),
}
}
......@@ -187,6 +193,7 @@ impl sc_client_api::BlockBackend<Block> for Client {
Self::Polkadot(client) => client.block(id),
Self::Westend(client) => client.block(id),
Self::Kusama(client) => client.block(id),
Self::Rococo(client) => client.block(id),
}
}
......@@ -195,6 +202,7 @@ impl sc_client_api::BlockBackend<Block> for Client {
Self::Polkadot(client) => client.block_status(id),
Self::Westend(client) => client.block_status(id),
Self::Kusama(client) => client.block_status(id),
Self::Rococo(client) => client.block_status(id),
}
}
......@@ -206,6 +214,7 @@ impl sc_client_api::BlockBackend<Block> for Client {
Self::Polkadot(client) => client.justification(id),
Self::Westend(client) => client.justification(id),
Self::Kusama(client) => client.justification(id),
Self::Rococo(client) => client.justification(id),
}
}
......@@ -217,6 +226,7 @@ impl sc_client_api::BlockBackend<Block> for Client {
Self::Polkadot(client) => client.block_hash(number),
Self::Westend(client) => client.block_hash(number),
Self::Kusama(client) => client.block_hash(number),
Self::Rococo(client) => client.block_hash(number),
}
}
}
......@@ -231,6 +241,7 @@ impl sc_client_api::StorageProvider<Block, crate::FullBackend> for Client {
Self::Polkadot(client) => client.storage(id, key),
Self::Westend(client) => client.storage(id, key),
Self::Kusama(client) => client.storage(id, key),
Self::Rococo(client) => client.storage(id, key),
}
}
......@@ -243,6 +254,7 @@ impl sc_client_api::StorageProvider<Block, crate::FullBackend> for Client {
Self::Polkadot(client) => client.storage_keys(id, key_prefix),
Self::Westend(client) => client.storage_keys(id, key_prefix),
Self::Kusama(client) => client.storage_keys(id, key_prefix),
Self::Rococo(client) => client.storage_keys(id, key_prefix),
}
}
......@@ -255,6 +267,7 @@ impl sc_client_api::StorageProvider<Block, crate::FullBackend> for Client {
Self::Polkadot(client) => client.storage_hash(id, key),
Self::Westend(client) => client.storage_hash(id, key),
Self::Kusama(client) => client.storage_hash(id, key),
Self::Rococo(client) => client.storage_hash(id, key),
}
}
......@@ -267,6 +280,7 @@ impl sc_client_api::StorageProvider<Block, crate::FullBackend> for Client {
Self::Polkadot(client) => client.storage_pairs(id, key_prefix),
Self::Westend(client) => client.storage_pairs(id, key_prefix),
Self::Kusama(client) => client.storage_pairs(id, key_prefix),
Self::Rococo(client) => client.storage_pairs(id, key_prefix),
}
}
......@@ -280,6 +294,7 @@ impl sc_client_api::StorageProvider<Block, crate::FullBackend> for Client {
Self::Polkadot(client) => client.storage_keys_iter(id, prefix, start_key),
Self::Westend(client) => client.storage_keys_iter(id, prefix, start_key),
Self::Kusama(client) => client.storage_keys_iter(id, prefix, start_key),
Self::Rococo(client) => client.storage_keys_iter(id, prefix, start_key),
}
}
......@@ -293,6 +308,7 @@ impl sc_client_api::StorageProvider<Block, crate::FullBackend> for Client {
Self::Polkadot(client) => client.child_storage(id, child_info, key),
Self::Westend(client) => client.child_storage(id, child_info, key),
Self::Kusama(client) => client.child_storage(id, child_info, key),
Self::Rococo(client) => client.child_storage(id, child_info, key),
}
}
......@@ -306,6 +322,7 @@ impl sc_client_api::StorageProvider<Block, crate::FullBackend> for Client {
Self::Polkadot(client) => client.child_storage_keys(id, child_info, key_prefix),
Self::Westend(client) => client.child_storage_keys(id, child_info, key_prefix),
Self::Kusama(client) => client.child_storage_keys(id, child_info, key_prefix),
Self::Rococo(client) => client.child_storage_keys(id, child_info, key_prefix),
}
}
......@@ -319,6 +336,7 @@ impl sc_client_api::StorageProvider<Block, crate::FullBackend> for Client {
Self::Polkadot(client) => client.child_storage_hash(id, child_info, key),
Self::Westend(client) => client.child_storage_hash(id, child_info, key),
Self::Kusama(client) => client.child_storage_hash(id, child_info, key),
Self::Rococo(client) => client.child_storage_hash(id, child_info, key),
}
}
......@@ -331,6 +349,7 @@ impl sc_client_api::StorageProvider<Block, crate::FullBackend> for Client {
Self::Polkadot(client) => client.max_key_changes_range(first, last),
Self::Westend(client) => client.max_key_changes_range(first, last),
Self::Kusama(client) => client.max_key_changes_range(first, last),
Self::Rococo(client) => client.max_key_changes_range(first, last),
}
}
......@@ -345,6 +364,54 @@ impl sc_client_api::StorageProvider<Block, crate::FullBackend> for Client {
Self::Polkadot(client) => client.key_changes(first, last, storage_key, key),
Self::Westend(client) => client.key_changes(first, last, storage_key, key),
Self::Kusama(client) => client.key_changes(first, last, storage_key, key),
Self::Rococo(client) => client.key_changes(first, last, storage_key, key),
}
}
}
impl sp_blockchain::HeaderBackend<Block> for Client {
fn header(&self, id: BlockId<Block>) -> sp_blockchain::Result<Option<Header>> {
match self {
Self::Polkadot(client) => client.header(&id),
Self::Westend(client) => client.header(&id),
Self::Kusama(client) => client.header(&id),
Self::Rococo(client) => client.header(&id),
}
}
fn info(&self) -> sp_blockchain::Info<Block> {
match self {
Self::Polkadot(client) => client.info(),
Self::Westend(client) => client.info(),
Self::Kusama(client) => client.info(),
Self::Rococo(client) => client.info(),
}
}
fn status(&self, id: BlockId<Block>) -> sp_blockchain::Result<sp_blockchain::BlockStatus> {
match self {
Self::Polkadot(client) => client.status(id),
Self::Westend(client) => client.status(id),
Self::Kusama(client) => client.status(id),
Self::Rococo(client) => client.status(id),
}
}
fn number(&self, hash: Hash) -> sp_blockchain::Result<Option<BlockNumber>> {
match self {
Self::Polkadot(client) => client.number(hash),
Self::Westend(client) => client.number(hash),
Self::Kusama(client) => client.number(hash),
Self::Rococo(client) => client.number(hash),
}
}
fn hash(&self, number: BlockNumber) -> sp_blockchain::Result<Option<Hash>> {
match self {
Self::Polkadot(client) => client.hash(number),
Self::Westend(client) => client.hash(number),
Self::Kusama(client) => client.hash(number),
Self::Rococo(client) => client.hash(number),
}
}
}
......@@ -25,7 +25,8 @@ use sp_runtime::traits::{Block as BlockT, NumberFor};
/// `N` + `M`, the voter will keep voting for block `N`.
pub(crate) struct PauseAfterBlockFor<N>(pub(crate) N, pub(crate) N);
impl<Block, B> grandpa::VotingRule<Block, B> for PauseAfterBlockFor<NumberFor<Block>> where