Remove unneeded Serde requirements (#1076)

* Remove superfluous serde requirements.

* Try to ensure hash is serde

* Fixups

* Building again

* Attempt to reenable Block (doesn't build)

* Fixes compilation for node cli

* Fixes test compilation

* Fix wasm

* Fix tests

* Remove unneeded changes

* Fix up comments

* Reenable some code

* Compile error when origin misused.

* Remove unnecessary includes of `serde_derive`

* Cleanups
This commit is contained in:
Gav Wood
2018-11-12 18:40:18 +01:00
committed by GitHub
parent b76ba06472
commit 57b2896332
62 changed files with 253 additions and 343 deletions
+7 -5
View File
@@ -18,7 +18,6 @@
use std::{self, io::{Read, Write}};
use futures::Future;
use serde_json;
use runtime_primitives::generic::{SignedBlock, BlockId};
use runtime_primitives::traits::{As, Block, Header};
@@ -34,7 +33,10 @@ use chain_spec::ChainSpec;
/// Export a range of blocks to a binary stream.
pub fn export_blocks<F, E, W>(config: FactoryFullConfiguration<F>, exit: E, mut output: W, from: FactoryBlockNumber<F>, to: Option<FactoryBlockNumber<F>>, json: bool) -> error::Result<()>
where F: ServiceFactory, E: Future<Item=(),Error=()> + Send + 'static, W: Write,
where
F: ServiceFactory,
E: Future<Item=(),Error=()> + Send + 'static,
W: Write,
{
let client = new_client::<F>(&config)?;
let mut block = from;
@@ -104,14 +106,14 @@ pub fn import_blocks<F, E, R>(config: FactoryFullConfiguration<F>, exit: E, mut
if exit_recv.try_recv().is_ok() {
break;
}
if let Some(signed) = SignedBlock::<<F::Block as Block>::Header, <F::Block as Block>::Extrinsic>::decode(&mut input) {
let header = signed.block.header;
if let Some(signed) = SignedBlock::<F::Block>::decode(&mut input) {
let (header, extrinsics) = signed.block.deconstruct();
let hash = header.hash();
let block = message::BlockData::<F::Block> {
hash: hash,
justification: Some(signed.justification),
header: Some(header),
body: Some(signed.block.extrinsics),
body: Some(extrinsics),
receipt: None,
message_queue: None
};
+3 -4
View File
@@ -69,7 +69,7 @@ use parking_lot::{Mutex, RwLock};
use keystore::Store as Keystore;
use client::BlockchainEvents;
use runtime_primitives::traits::{Header, As};
use runtime_primitives::generic::BlockId;
use runtime_primitives::generic::{BlockId, SignedBlock};
use exit_future::Signal;
#[doc(hidden)]
pub use tokio::runtime::TaskExecutor;
@@ -124,8 +124,7 @@ impl<Components> Service<Components>
where
Components: components::Components,
<Components as components::Components>::Executor: std::clone::Clone,
txpool::ExHash<Components::TransactionPoolApi>: serde::de::DeserializeOwned + serde::Serialize,
txpool::ExtrinsicFor<Components::TransactionPoolApi>: serde::de::DeserializeOwned + serde::Serialize,
for<'de> SignedBlock<ComponentBlock<Components>>: ::serde::Deserialize<'de>,
{
/// Creates a new service.
pub fn new(
@@ -247,7 +246,7 @@ impl<Components> Service<Components>
let chain = rpc::apis::chain::Chain::new(client.clone(), subscriptions.clone());
let state = rpc::apis::state::State::new(client.clone(), subscriptions.clone());
let author = rpc::apis::author::Author::new(client.clone(), transaction_pool.clone(), subscriptions.clone());
rpc::rpc_handler::<ComponentBlock<Components>, ComponentExHash<Components>, _, _, _, _, _>(
rpc::rpc_handler::<ComponentBlock<Components>, ComponentExHash<Components>, _, _, _, _>(
state,
chain,
author,