diff --git a/ethcore/src/types/trace_types/filter.rs b/ethcore/src/types/trace_types/filter.rs
index 25ee5954a..c1d237ed7 100644
--- a/ethcore/src/types/trace_types/filter.rs
+++ b/ethcore/src/types/trace_types/filter.rs
@@ -21,34 +21,40 @@ use util::sha3::Hashable;
use basic_types::LogBloom;
use trace::flat::FlatTrace;
use types::trace_types::trace::Action;
+use ipc::binary::BinaryConvertError;
+use std::mem;
+use std::collections::VecDeque;
/// Addresses filter.
///
/// Used to create bloom possibilities and match filters.
-pub struct AddressesFilter(Vec
);
+#[derive(Binary)]
+pub struct AddressesFilter {
+ list: Vec
+}
impl From> for AddressesFilter {
fn from(addresses: Vec) -> Self {
- AddressesFilter(addresses)
+ AddressesFilter { list: addresses }
}
}
impl AddressesFilter {
/// Returns true if address matches one of the searched addresses.
pub fn matches(&self, address: &Address) -> bool {
- self.matches_all() || self.0.contains(address)
+ self.matches_all() || self.list.contains(address)
}
/// Returns true if this address filter matches everything.
pub fn matches_all(&self) -> bool {
- self.0.is_empty()
+ self.list.is_empty()
}
/// Returns blooms of this addresses filter.
pub fn blooms(&self) -> Vec {
- match self.0.is_empty() {
+ match self.list.is_empty() {
true => vec![LogBloom::new()],
- false => self.0.iter()
+ false => self.list.iter()
.map(|address| LogBloom::from_bloomed(&address.sha3()))
.collect()
}
@@ -56,11 +62,11 @@ impl AddressesFilter {
/// Returns vector of blooms zipped with blooms of this addresses filter.
pub fn with_blooms(&self, blooms: Vec) -> Vec {
- match self.0.is_empty() {
+ match self.list.is_empty() {
true => blooms,
false => blooms
.into_iter()
- .flat_map(|bloom| self.0.iter()
+ .flat_map(|bloom| self.list.iter()
.map(|address| bloom.with_bloomed(&address.sha3()))
.collect::>())
.collect()
@@ -68,6 +74,7 @@ impl AddressesFilter {
}
}
+#[derive(Binary)]
/// Traces filter.
pub struct Filter {
/// Block range.
diff --git a/ethcore/src/types/trace_types/localized.rs b/ethcore/src/types/trace_types/localized.rs
index ef18d6898..db4d05426 100644
--- a/ethcore/src/types/trace_types/localized.rs
+++ b/ethcore/src/types/trace_types/localized.rs
@@ -17,9 +17,12 @@
use util::H256;
use super::trace::{Action, Res};
use header::BlockNumber;
+use ipc::binary::BinaryConvertError;
+use std::mem;
+use std::collections::VecDeque;
/// Localized trace.
-#[derive(Debug, PartialEq)]
+#[derive(Debug, PartialEq, Binary)]
pub struct LocalizedTrace {
/// Type of action performed by a transaction.
pub action: Action,
diff --git a/ipc/rpc/src/binary.rs b/ipc/rpc/src/binary.rs
index 3ba172c6e..67a3d37e2 100644
--- a/ipc/rpc/src/binary.rs
+++ b/ipc/rpc/src/binary.rs
@@ -20,6 +20,7 @@ use util::bytes::Populatable;
use util::numbers::{U256, H256, H2048, Address};
use std::mem;
use std::collections::VecDeque;
+use std::ops::Range;
#[derive(Debug)]
pub struct BinaryConvertError;
@@ -366,7 +367,7 @@ pub fn serialize(t: &T) -> Result, BinaryConvertEr
}
macro_rules! binary_fixed_size {
- ($target_ty: ident) => {
+ ($target_ty: ty) => {
impl BinaryConvertable for $target_ty {
fn from_bytes(bytes: &[u8], _length_stack: &mut VecDeque) -> Result {
match bytes.len().cmp(&::std::mem::size_of::<$target_ty>()) {
@@ -401,6 +402,8 @@ binary_fixed_size!(U256);
binary_fixed_size!(H256);
binary_fixed_size!(H2048);
binary_fixed_size!(Address);
+binary_fixed_size!(Range);
+binary_fixed_size!(Range);
#[test]
fn vec_serialize() {