This commit is contained in:
Marek Kotewicz 2016-07-13 21:10:20 +02:00 committed by Gav Wood
parent a7511b6b02
commit 1053f3610c
5 changed files with 10 additions and 13 deletions

View File

@ -20,7 +20,7 @@ use util::HeapSizeOf;
use basic_types::LogBloom; use basic_types::LogBloom;
/// Helper structure representing bloom of the trace. /// Helper structure representing bloom of the trace.
#[derive(Clone)] #[derive(Debug, Clone)]
pub struct Bloom(LogBloom); pub struct Bloom(LogBloom);
impl From<LogBloom> for Bloom { impl From<LogBloom> for Bloom {

View File

@ -20,7 +20,7 @@ use util::HeapSizeOf;
use super::Bloom; use super::Bloom;
/// Represents group of X consecutive blooms. /// Represents group of X consecutive blooms.
#[derive(Clone)] #[derive(Debug, Clone)]
pub struct BloomGroup { pub struct BloomGroup {
blooms: Vec<Bloom>, blooms: Vec<Bloom>,
} }

View File

@ -15,7 +15,6 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
//! Trace database. //! Trace database.
use std::ptr;
use std::ops::{Deref, DerefMut}; use std::ops::{Deref, DerefMut};
use std::collections::HashMap; use std::collections::HashMap;
use std::sync::Arc; use std::sync::Arc;
@ -47,9 +46,7 @@ impl Key<BlockTraces> for H256 {
fn key(&self) -> H264 { fn key(&self) -> H264 {
let mut result = H264::default(); let mut result = H264::default();
result[0] = TraceDBIndex::BlockTraces as u8; result[0] = TraceDBIndex::BlockTraces as u8;
unsafe { result[1..33].copy_from_slice(self);
ptr::copy(self.as_ptr(), result.as_mut_ptr().offset(1), 32);
}
result result
} }
} }
@ -84,9 +81,9 @@ impl Key<blooms::BloomGroup> for TraceGroupPosition {
result[0] = TraceDBIndex::BloomGroups as u8; result[0] = TraceDBIndex::BloomGroups as u8;
result[1] = self.0.level; result[1] = self.0.level;
result[2] = self.0.index as u8; result[2] = self.0.index as u8;
result[3] = (self.0.index << 8) as u8; result[3] = (self.0.index >> 8) as u8;
result[4] = (self.0.index << 16) as u8; result[4] = (self.0.index >> 16) as u8;
result[5] = (self.0.index << 24) as u8; result[5] = (self.0.index >> 24) as u8;
TraceGroupKey(result) TraceGroupKey(result)
} }
} }

View File

@ -30,7 +30,7 @@ use std::collections::VecDeque;
/// Addresses filter. /// Addresses filter.
/// ///
/// Used to create bloom possibilities and match filters. /// Used to create bloom possibilities and match filters.
#[derive(Binary)] #[derive(Debug, Binary)]
pub struct AddressesFilter { pub struct AddressesFilter {
list: Vec<Address> list: Vec<Address>
} }
@ -76,7 +76,7 @@ impl AddressesFilter {
} }
} }
#[derive(Binary)] #[derive(Debug, Binary)]
/// Traces filter. /// Traces filter.
pub struct Filter { pub struct Filter {
/// Block range. /// Block range.

View File

@ -357,7 +357,7 @@ pub struct LocalizedTrace {
/// Result /// Result
result: Res, result: Res,
/// Trace address /// Trace address
#[serde(rename="traceH160")] #[serde(rename="traceAddress")]
trace_address: Vec<U256>, trace_address: Vec<U256>,
/// Subtraces /// Subtraces
subtraces: U256, subtraces: U256,
@ -443,7 +443,7 @@ mod tests {
block_hash: H256::from(14), block_hash: H256::from(14),
}; };
let serialized = serde_json::to_string(&t).unwrap(); 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] #[test]