From 1053f3610cadbab4fcf9444bf6b1f6d22769e0dd Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Wed, 13 Jul 2016 21:10:20 +0200 Subject: [PATCH] fixed #1606 (#1615) --- ethcore/src/blooms/bloom.rs | 2 +- ethcore/src/blooms/bloom_group.rs | 2 +- ethcore/src/trace/db.rs | 11 ++++------- ethcore/src/types/trace_types/filter.rs | 4 ++-- rpc/src/v1/types/trace.rs | 4 ++-- 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/ethcore/src/blooms/bloom.rs b/ethcore/src/blooms/bloom.rs index 29f055c10..83d898ab5 100644 --- a/ethcore/src/blooms/bloom.rs +++ b/ethcore/src/blooms/bloom.rs @@ -20,7 +20,7 @@ use util::HeapSizeOf; use basic_types::LogBloom; /// Helper structure representing bloom of the trace. -#[derive(Clone)] +#[derive(Debug, Clone)] pub struct Bloom(LogBloom); impl From for Bloom { diff --git a/ethcore/src/blooms/bloom_group.rs b/ethcore/src/blooms/bloom_group.rs index 6fa1d0761..8e2b87189 100644 --- a/ethcore/src/blooms/bloom_group.rs +++ b/ethcore/src/blooms/bloom_group.rs @@ -20,7 +20,7 @@ use util::HeapSizeOf; use super::Bloom; /// Represents group of X consecutive blooms. -#[derive(Clone)] +#[derive(Debug, Clone)] pub struct BloomGroup { blooms: Vec, } diff --git a/ethcore/src/trace/db.rs b/ethcore/src/trace/db.rs index cac96bcbe..8c7d6c8c9 100644 --- a/ethcore/src/trace/db.rs +++ b/ethcore/src/trace/db.rs @@ -15,7 +15,6 @@ // along with Parity. If not, see . //! Trace database. -use std::ptr; use std::ops::{Deref, DerefMut}; use std::collections::HashMap; use std::sync::Arc; @@ -47,9 +46,7 @@ impl Key for H256 { fn key(&self) -> H264 { let mut result = H264::default(); result[0] = TraceDBIndex::BlockTraces as u8; - unsafe { - ptr::copy(self.as_ptr(), result.as_mut_ptr().offset(1), 32); - } + result[1..33].copy_from_slice(self); result } } @@ -84,9 +81,9 @@ impl Key for TraceGroupPosition { result[0] = TraceDBIndex::BloomGroups as u8; result[1] = self.0.level; result[2] = self.0.index as u8; - result[3] = (self.0.index << 8) as u8; - result[4] = (self.0.index << 16) as u8; - result[5] = (self.0.index << 24) as u8; + result[3] = (self.0.index >> 8) as u8; + result[4] = (self.0.index >> 16) as u8; + result[5] = (self.0.index >> 24) as u8; TraceGroupKey(result) } } diff --git a/ethcore/src/types/trace_types/filter.rs b/ethcore/src/types/trace_types/filter.rs index c02a15c03..d57efa5f3 100644 --- a/ethcore/src/types/trace_types/filter.rs +++ b/ethcore/src/types/trace_types/filter.rs @@ -30,7 +30,7 @@ use std::collections::VecDeque; /// Addresses filter. /// /// Used to create bloom possibilities and match filters. -#[derive(Binary)] +#[derive(Debug, Binary)] pub struct AddressesFilter { list: Vec
} @@ -76,7 +76,7 @@ impl AddressesFilter { } } -#[derive(Binary)] +#[derive(Debug, Binary)] /// Traces filter. pub struct Filter { /// Block range. diff --git a/rpc/src/v1/types/trace.rs b/rpc/src/v1/types/trace.rs index b9ce8a3ea..59da9be80 100644 --- a/rpc/src/v1/types/trace.rs +++ b/rpc/src/v1/types/trace.rs @@ -357,7 +357,7 @@ pub struct LocalizedTrace { /// Result result: Res, /// Trace address - #[serde(rename="traceH160")] + #[serde(rename="traceAddress")] trace_address: Vec, /// Subtraces subtraces: U256, @@ -443,7 +443,7 @@ mod tests { block_hash: H256::from(14), }; let serialized = serde_json::to_string(&t).unwrap(); - assert_eq!(serialized, r#"{"action":{"call":{"from":"0x0000000000000000000000000000000000000004","to":"0x0000000000000000000000000000000000000005","value":"0x06","gas":"0x07","input":"0x1234"}},"result":{"call":{"gasUsed":"0x08","output":"0x5678"}},"traceH160":["0x0a"],"subtraces":"0x01","transactionPosition":"0x0b","transactionHash":"0x000000000000000000000000000000000000000000000000000000000000000c","blockNumber":"0x0d","blockHash":"0x000000000000000000000000000000000000000000000000000000000000000e"}"#); + assert_eq!(serialized, r#"{"action":{"call":{"from":"0x0000000000000000000000000000000000000004","to":"0x0000000000000000000000000000000000000005","value":"0x06","gas":"0x07","input":"0x1234"}},"result":{"call":{"gasUsed":"0x08","output":"0x5678"}},"traceAddress":["0x0a"],"subtraces":"0x01","transactionPosition":"0x0b","transactionHash":"0x000000000000000000000000000000000000000000000000000000000000000c","blockNumber":"0x0d","blockHash":"0x000000000000000000000000000000000000000000000000000000000000000e"}"#); } #[test]