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
@@ -23,6 +23,7 @@ use std::{
sync::Arc,
};
use serde::Serialize;
use sr_primitives::traits::Member;
use sr_primitives::transaction_validity::{
TransactionTag as Tag,
@@ -79,7 +80,7 @@ pub struct PruneStatus<Hash, Ex> {
/// Immutable transaction
#[cfg_attr(test, derive(Clone))]
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Debug, PartialEq, Eq)]
pub struct Transaction<Hash, Extrinsic> {
/// Raw extrinsic representing that transaction.
pub data: Extrinsic,
@@ -120,7 +121,7 @@ impl<Hash: hash::Hash + Eq, Ex> Default for BasePool<Hash, Ex> {
}
}
impl<Hash: hash::Hash + Member, Ex: ::std::fmt::Debug> BasePool<Hash, Ex> {
impl<Hash: hash::Hash + Member + Serialize, Ex: ::std::fmt::Debug> BasePool<Hash, Ex> {
/// Imports transaction to the pool.
///
/// The pool consists of two parts: Future and Ready.
@@ -33,6 +33,7 @@ extern crate futures;
extern crate parking_lot;
extern crate sr_primitives;
extern crate serde;
#[macro_use] extern crate error_chain;
#[macro_use] extern crate log;
#[macro_use] extern crate serde_derive;
@@ -19,6 +19,7 @@ use std::{
collections::HashMap,
hash,
};
use serde::Serialize;
use watcher;
use sr_primitives::traits;
@@ -35,7 +36,7 @@ impl<H: hash::Hash + Eq, H2> Default for Listener<H, H2> {
}
}
impl<H: hash::Hash + traits::Member, H2: Clone> Listener<H, H2> {
impl<H: hash::Hash + traits::Member + Serialize, H2: Clone> Listener<H, H2> {
fn fire<F>(&mut self, hash: &H, fun: F) where F: FnOnce(&mut watcher::Sender<H, H2>) {
let clean = if let Some(h) = self.watchers.get_mut(hash) {
fun(h);
@@ -26,6 +26,7 @@ use error;
use listener::Listener;
use rotator::PoolRotator;
use watcher::Watcher;
use serde::Serialize;
use futures::sync::mpsc;
use parking_lot::{Mutex, RwLock};
@@ -54,7 +55,7 @@ pub trait ChainApi: Send + Sync {
/// Block type.
type Block: traits::Block;
/// Hash type
type Hash: hash::Hash + Eq + traits::Member;
type Hash: hash::Hash + Eq + traits::Member + Serialize;
/// Error type.
type Error: From<error::Error> + error::IntoPoolError;
@@ -287,7 +288,7 @@ fn fire_events<H, H2, Ex>(
listener: &mut Listener<H, H2>,
imported: &base::Imported<H, Ex>,
) where
H: hash::Hash + Eq + traits::Member,
H: hash::Hash + Eq + traits::Member + Serialize,
H2: Clone,
{
match *imported {
@@ -21,6 +21,7 @@ use std::{
sync::Arc,
};
use serde::Serialize;
use parking_lot::RwLock;
use sr_primitives::traits::Member;
use sr_primitives::transaction_validity::{
@@ -120,7 +121,7 @@ impl<Hash: hash::Hash + Eq, Ex> Default for ReadyTransactions<Hash, Ex> {
}
}
impl<Hash: hash::Hash + Member, Ex> ReadyTransactions<Hash, Ex> {
impl<Hash: hash::Hash + Member + Serialize, Ex> ReadyTransactions<Hash, Ex> {
/// Borrows a map of tags that are provided by transactions in this queue.
pub fn provided_tags(&self) -> &HashMap<Tag, Hash> {
&self.provided_tags