mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 20:11:09 +00:00
Enable runtime_api for Substrate service (#3709)
* added new_full_concrete for service * line width fix * Update node/cli/src/service.rs Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com> * Update node/cli/src/service.rs Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com> * Update node/cli/src/service.rs Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com> * replaced new_full * empty * added backticks to pass ci
This commit is contained in:
Generated
+2
@@ -2370,6 +2370,7 @@ dependencies = [
|
||||
"substrate-basic-authorship 2.0.0",
|
||||
"substrate-cli 2.0.0",
|
||||
"substrate-client 2.0.0",
|
||||
"substrate-client-db 2.0.0",
|
||||
"substrate-consensus-babe 2.0.0",
|
||||
"substrate-consensus-babe-primitives 2.0.0",
|
||||
"substrate-consensus-common 2.0.0",
|
||||
@@ -2379,6 +2380,7 @@ dependencies = [
|
||||
"substrate-keyring 2.0.0",
|
||||
"substrate-keystore 2.0.0",
|
||||
"substrate-network 2.0.0",
|
||||
"substrate-offchain 2.0.0",
|
||||
"substrate-primitives 2.0.0",
|
||||
"substrate-rpc 2.0.0",
|
||||
"substrate-service 2.0.0",
|
||||
|
||||
@@ -16,4 +16,4 @@ warning: unused import: `sr_primitives::traits::Block as BlockT`
|
||||
1 | use sr_primitives::traits::Block as BlockT;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[warn(unused_imports)] on by default
|
||||
= note: `#[warn(unused_imports)]` on by default
|
||||
|
||||
+1
-1
@@ -10,4 +10,4 @@ warning: unused import: `sr_primitives::traits::Block as BlockT`
|
||||
1 | use sr_primitives::traits::Block as BlockT;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[warn(unused_imports)] on by default
|
||||
= note: `#[warn(unused_imports)]` on by default
|
||||
|
||||
@@ -48,6 +48,9 @@ support = { package = "srml-support", path = "../../srml/support", default-featu
|
||||
im_online = { package = "srml-im-online", path = "../../srml/im-online", default-features = false }
|
||||
sr-authority-discovery = { package = "srml-authority-discovery", path = "../../srml/authority-discovery", default-features = false }
|
||||
authority-discovery = { package = "substrate-authority-discovery", path = "../../core/authority-discovery"}
|
||||
client_db = { package = "substrate-client-db", path = "../../core/client/db", features = ["kvdb-rocksdb"] }
|
||||
offchain = { package = "substrate-offchain", path = "../../core/offchain" }
|
||||
|
||||
|
||||
[dev-dependencies]
|
||||
keystore = { package = "substrate-keystore", path = "../../core/keystore" }
|
||||
|
||||
@@ -33,6 +33,16 @@ use transaction_pool::{self, txpool::{Pool as TransactionPool}};
|
||||
use inherents::InherentDataProviders;
|
||||
use network::construct_simple_protocol;
|
||||
|
||||
use substrate_service::{NewService, NetworkStatus};
|
||||
use client::{Client, LocalCallExecutor};
|
||||
use client_db::Backend;
|
||||
use sr_primitives::traits::Block as BlockT;
|
||||
use node_executor::NativeExecutor;
|
||||
use network::NetworkService;
|
||||
use offchain::OffchainWorkers;
|
||||
use transaction_pool::ChainApi;
|
||||
use primitives::Blake2Hasher;
|
||||
|
||||
construct_simple_protocol! {
|
||||
/// Demo protocol attachment for substrate.
|
||||
pub struct NodeProtocol where Block = Block { }
|
||||
@@ -215,9 +225,39 @@ macro_rules! new_full {
|
||||
}}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
type ConcreteBlock = node_primitives::Block;
|
||||
#[allow(dead_code)]
|
||||
type ConcreteClient =
|
||||
Client<
|
||||
Backend<ConcreteBlock>,
|
||||
LocalCallExecutor<Backend<ConcreteBlock>,
|
||||
NativeExecutor<node_executor::Executor>>,
|
||||
ConcreteBlock,
|
||||
node_runtime::RuntimeApi
|
||||
>;
|
||||
#[allow(dead_code)]
|
||||
type ConcreteBackend = Backend<ConcreteBlock>;
|
||||
|
||||
/// Builds a new service for a full client.
|
||||
pub fn new_full<C: Send + Default + 'static>(config: Configuration<C, GenesisConfig>)
|
||||
-> Result<impl AbstractService, ServiceError> {
|
||||
-> Result<
|
||||
NewService<
|
||||
ConcreteBlock,
|
||||
ConcreteClient,
|
||||
LongestChain<ConcreteBackend, ConcreteBlock>,
|
||||
NetworkStatus<ConcreteBlock>,
|
||||
NetworkService<ConcreteBlock, crate::service::NodeProtocol, <ConcreteBlock as BlockT>::Hash>,
|
||||
TransactionPool<ChainApi<ConcreteClient, ConcreteBlock>>,
|
||||
OffchainWorkers<
|
||||
ConcreteClient,
|
||||
<ConcreteBackend as client::backend::Backend<Block, Blake2Hasher>>::OffchainStorage,
|
||||
ConcreteBlock,
|
||||
>
|
||||
>,
|
||||
ServiceError,
|
||||
>
|
||||
{
|
||||
new_full!(config).map(|(service, _)| service)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user