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
Show all changes
44 commits
Select commit Hold shift + click to select a range
869b70c
:)
expenses Jun 30, 2020
31c65a6
Slight tidy
expenses Jun 30, 2020
6ad0d79
Remove ServiceBuilderCommand
expenses Jun 30, 2020
b7399d6
Remove whitespace
expenses Jun 30, 2020
746186d
Merge remote-tracking branch 'parity/master' into ashley-chainops
expenses Jul 1, 2020
4db2f17
Merge branch 'ashley-chainops' of github.com:paritytech/substrate int…
expenses Jul 1, 2020
4020ff4
Keep task manager alive for check_block/import_blocks
expenses Jul 1, 2020
23c6f29
Pass task_manager to run_until_exit
expenses Jul 1, 2020
256ede8
Merge remote-tracking branch 'parity/master' into ashley-chainops
expenses Jul 1, 2020
66d0466
WIP
expenses Jul 1, 2020
8a5938c
Merge remote-tracking branch 'parity/master' into ashley-remove-servi…
expenses Jul 2, 2020
a8bdb37
Merge remote-tracking branch 'parity/master' into ashley-remove-servi…
expenses Jul 2, 2020
e44d988
WIP
expenses Jul 3, 2020
5185c16
Merge remote-tracking branch 'parity/master' into ashley-remove-servi…
expenses Jul 3, 2020
70e7fcd
Remove finality grandpa changes and fix transaction pool tests
expenses Jul 3, 2020
2d75728
Get rid of the macros
expenses Jul 3, 2020
d0f5ca2
Merge remote-tracking branch 'parity/master' into ashley-remove-servi…
expenses Jul 8, 2020
109b715
Merge remote-tracking branch 'parity/master' into ashley-remove-servi…
expenses Jul 8, 2020
2be524b
Simplify a few chain components creation APIs related to the service
expenses Jul 9, 2020
2bea18f
Merge remote-tracking branch 'parity/master' into ashley-txpool
expenses Jul 9, 2020
b452e17
Fix basic-authorship doc tests
expenses Jul 9, 2020
cf49f81
Remove DefaultQueue
expenses Jul 9, 2020
6c3b9ce
Update client/service/src/builder.rs
expenses Jul 9, 2020
fbb48b9
Move ExecutionExtensions comment around
expenses Jul 9, 2020
5abe000
Merge branch 'ashley-txpool' into ashley-remove-service-builder
expenses Jul 9, 2020
6f170f0
Remove unused BlakeTwo256
expenses Jul 9, 2020
37d1e10
Merge branch 'ashley-txpool' into ashley-remove-service-builder
expenses Jul 9, 2020
bca293d
Merge remote-tracking branch 'parity/master' into ashley-remove-servi…
expenses Jul 10, 2020
c0dc11d
Add sc-prelude
expenses Jul 10, 2020
fd699d9
Merge remote-tracking branch 'origin/master' into ashley-remove-servi…
expenses Jul 17, 2020
cce5562
Rename sc-prelude to sc-service-prelude
expenses Jul 17, 2020
03de1c7
Rename to sc-service-types
expenses Jul 17, 2020
eeb1c1d
Merge remote-tracking branch 'origin/master' into ashley-remove-servi…
expenses Jul 17, 2020
93ec9a3
Merge remote-tracking branch 'origin/master' into ashley-remove-servi…
expenses Jul 20, 2020
7744a9e
Improve service types
expenses Jul 20, 2020
5d52cd9
Merge remote-tracking branch 'origin/master' into ashley-remove-servi…
expenses Jul 20, 2020
3a1d2ec
Fix line widths
expenses Jul 20, 2020
472ce1a
Merge remote-tracking branch 'origin/master' into ashley-remove-servi…
expenses Jul 21, 2020
84022fe
Remove sc-service-types and move type definitions to crates
expenses Jul 21, 2020
a7ab615
Merge remote-tracking branch 'origin/master' into ashley-remove-servi…
expenses Jul 21, 2020
52f9c95
Update bin/node-template/node/src/service.rs
expenses Jul 21, 2020
bb1cb5a
Merge remote-tracking branch 'origin/master' into ashley-remove-servi…
expenses Jul 22, 2020
ed14ad1
Add TLightClientWithHash
expenses Jul 22, 2020
319ba0c
Rework types
expenses Jul 22, 2020
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
Add sc-prelude
  • Loading branch information
expenses committed Jul 10, 2020
commit c0dc11dd55b3f43988bccd56db4e0c3d7509adee
14 changes: 14 additions & 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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ members = [
"client/network-gossip",
"client/offchain",
"client/peerset",
"client/prelude",
"client/proposer-metrics",
"client/rpc-servers",
"client/rpc",
Expand Down
1 change: 1 addition & 0 deletions bin/node-template/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ sc-client-api = { version = "2.0.0-rc4", path = "../../../client/api" }
sp-runtime = { version = "2.0.0-rc4", path = "../../../primitives/runtime" }
sc-basic-authorship = { path = "../../../client/basic-authorship", version = "0.8.0-rc4"}
sp-api = { version = "2.0.0-rc4", path = "../../../primitives/api" }
sc-prelude = { version = "0.8.0-rc4", path = "../../../client/prelude" }

node-template-runtime = { version = "2.0.0-rc4", path = "../runtime" }

Expand Down
22 changes: 9 additions & 13 deletions bin/node-template/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,19 @@ native_executor_instance!(
node_template_runtime::native_version,
);

type FullClient = sc_service::TFullClient<Block, RuntimeApi, Executor>;
type FullBackend = sc_service::TFullBackend<Block>;
type GrandpaBlockImport = sc_finality_grandpa::GrandpaBlockImport<
FullBackend, Block, FullClient, SelectChain
>;
type SelectChain = sc_consensus::LongestChain<FullBackend, Block>;
type GrandpaLink = sc_finality_grandpa::LinkHalf<Block, FullClient, SelectChain>;
type FullPool = sc_transaction_pool::BasicPool<
sc_transaction_pool::FullChainApi<FullClient, Block>, Block
>;
type ImportQueue = sc_consensus_aura::AuraImportQueue<Block, sp_api::TransactionFor<FullClient, Block>>;
mod prelude {
use super::*;
sc_prelude::prelude!(Block, RuntimeApi, Executor);
}

use prelude::*;

pub fn new_full_params(config: Configuration) -> Result<(
sc_service::ServiceParams<
Block, FullClient, ImportQueue, FullPool, (), FullBackend,
Block, FullClient, FullAuraImportQueue, FullBasicPool, (), FullBackend,
>,
SelectChain, sp_inherents::InherentDataProviders, GrandpaBlockImport, GrandpaLink
FullLongestChain, sp_inherents::InherentDataProviders, FullGrandpaBlockImport<FullLongestChain>,
FullGrandpaLink<FullLongestChain>
), ServiceError> {
let inherent_data_providers = sp_inherents::InherentDataProviders::new();

Expand Down
1 change: 1 addition & 0 deletions bin/node/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ sc-service = { version = "0.8.0-rc4", default-features = false, path = "../../..
sc-tracing = { version = "2.0.0-rc4", path = "../../../client/tracing" }
sc-telemetry = { version = "2.0.0-rc4", path = "../../../client/telemetry" }
sc-authority-discovery = { version = "0.8.0-rc4", path = "../../../client/authority-discovery" }
sc-prelude = { version = "0.8.0-rc4", path = "../../../client/prelude" }

# frame dependencies
pallet-indices = { version = "2.0.0-rc4", path = "../../../frame/indices" }
Expand Down
25 changes: 11 additions & 14 deletions bin/node/cli/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ use sp_core::traits::BareCryptoStorePtr;

pub fn new_full_params(config: Configuration) -> Result<(
sc_service::ServiceParams<
Block, FullClient, ImportQueue, FullPool, node_rpc::IoHandler, FullBackend
Block, FullClient, FullBabeImportQueue, FullBasicPool, node_rpc::IoHandler, FullBackend
>,
(BabeBlockImport, GrandpaLink, BabeLink),
(FullBabeBlockImport<FullGrandpaBlockImport<FullLongestChain>>, FullGrandpaLink<FullLongestChain>, BabeLink),
grandpa::SharedVoterState,
sc_consensus::LongestChain<FullBackend, Block>,
FullLongestChain,
InherentDataProviders
), ServiceError> {
use node_executor::Executor;
Expand Down Expand Up @@ -149,23 +149,20 @@ pub fn new_full_params(config: Configuration) -> Result<(
Ok((params, import_setup, rpc_setup, select_chain, inherent_data_providers))
}

type FullClient = sc_service::TFullClient<Block, RuntimeApi, node_executor::Executor>;
type FullBackend = sc_service::TFullBackend<Block>;
type GrandpaBlockImport = grandpa::GrandpaBlockImport<FullBackend, Block, FullClient, SelectChain>;
type SelectChain = sc_consensus::LongestChain<FullBackend, Block>;
type GrandpaLink = grandpa::LinkHalf<Block, FullClient, SelectChain>;
type BabeLink = sc_consensus_babe::BabeLink<Block>;
type BabeBlockImport = sc_consensus_babe::BabeBlockImport<Block, FullClient, GrandpaBlockImport>;
type FullPool = sc_transaction_pool::BasicPool<sc_transaction_pool::FullChainApi<FullClient, Block>, Block>;
type ImportQueue = sc_consensus_babe::BabeImportQueue<Block, sp_api::TransactionFor<FullClient, Block>>;
mod prelude {
use super::*;
sc_prelude::prelude!(Block, RuntimeApi, node_executor::Executor);
}

use prelude::*;

/// Creates a full service from the configuration.
pub fn new_full_base(
config: Configuration,
with_startup_data: impl FnOnce(&BabeBlockImport, &BabeLink)
with_startup_data: impl FnOnce(&FullBabeBlockImport<FullGrandpaBlockImport<FullLongestChain>>, &BabeLink)
) -> Result<(
TaskManager, InherentDataProviders, Arc<FullClient>,
Arc<NetworkService<Block, <Block as BlockT>::Hash>>, Arc<FullPool>
Arc<NetworkService<Block, <Block as BlockT>::Hash>>, Arc<FullBasicPool>
), ServiceError> {
let (params, import_setup, rpc_setup, select_chain, inherent_data_providers)
= new_full_params(config)?;
Expand Down
20 changes: 20 additions & 0 deletions client/prelude/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[package]
name = "sc-prelude"
version = "0.8.0-rc4"
authors = ["Parity Technologies <[email protected]>"]
edition = "2018"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
homepage = "https://substrate.dev"
repository = "https://github.com/paritytech/substrate/"
description = "Easy to use type definitions"

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
sc-service = { path = "../service", version = "0.8.0-rc4"}
sc-finality-grandpa = { path = "../finality-grandpa", version = "0.8.0-rc4"}
sc-consensus = { path = "../consensus/common", version = "0.8.0-rc4"}
sc-consensus-aura = { path = "../consensus/aura", version = "0.8.0-rc4"}
sc-consensus-babe = { path = "../consensus/babe", version = "0.8.0-rc4"}
sc-transaction-pool = { path = "../transaction-pool", version = "2.0.0-rc4"}
64 changes: 64 additions & 0 deletions client/prelude/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Copyright 2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.

// Substrate is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Substrate is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.

pub use sc_service;
pub use sc_finality_grandpa;
pub use sc_consensus;
pub use sc_consensus_aura;
pub use sc_transaction_pool;
pub use sc_consensus_babe;

#[macro_export]
macro_rules! prelude {
($block:ty, $runtime_api:ty, $executor:ty) => {
pub type FullClient = $crate::sc_service::TFullClient<$block, $runtime_api, $executor>;
pub type FullBackend = $crate::sc_service::TFullBackend<$block>;
pub type FullGrandpaBlockImport<SelectChain> = $crate::sc_finality_grandpa::GrandpaBlockImport<
FullBackend, $block, FullClient, SelectChain
>;
pub type FullGrandpaLink<SelectChain> = $crate::sc_finality_grandpa::LinkHalf<
$block, FullClient, SelectChain
>;
pub type FullLongestChain = $crate::sc_consensus::LongestChain<FullBackend, $block>;

pub type FullBasicPool = $crate::sc_transaction_pool::BasicPool<
sc_transaction_pool::FullChainApi<FullClient, $block>, $block
>;

pub type FullAuraImportQueue = $crate::sc_consensus_aura::AuraImportQueue<
$block, sp_api::TransactionFor<FullClient, $block>
>;

pub type FullBabeImportQueue = $crate::sc_consensus_babe::BabeImportQueue<
$block, sp_api::TransactionFor<FullClient, $block>
>;

pub type FullBabeBlockImport<BlockImport> = $crate::sc_consensus_babe::BabeBlockImport<
$block, FullClient, BlockImport
>;

pub type BabeLink = $crate::sc_consensus_babe::BabeLink<$block>;

pub type LightClient = $crate::sc_service::TLightClient<$block, $runtime_api, $executor>;
}
}

#[cfg(test)]
mod tests {
mod prelude {
prelude!((), (), ());
}
}