more missing serializaers

This commit is contained in:
NikVolf 2016-06-29 20:59:13 +03:00
parent dec083a5ed
commit 562e591ed3
5 changed files with 29 additions and 11 deletions

View File

@ -477,7 +477,7 @@ impl Client {
}
}
#[derive(Ipc)]
//#[derive(Ipc)]
impl BlockChainClient for Client {
fn call(&self, t: &SignedTransaction, analytics: CallAnalytics) -> Result<Executed, ExecutionError> {
let header = self.block_header(BlockID::Latest).unwrap();
@ -577,8 +577,8 @@ impl BlockChainClient for Client {
}
fn uncle(&self, id: UncleID) -> Option<Header> {
let index = id.1;
self.block(id.0).and_then(|block| BlockView::new(&block).uncle_at(index))
let index = id.position;
self.block(id.block).and_then(|block| BlockView::new(&block).uncle_at(index))
}
fn transaction_receipt(&self, id: TransactionID) -> Option<LocalizedReceipt> {

View File

@ -16,8 +16,13 @@
//! Diff between two accounts.
use util::*;
use util::numbers::*;
use std::cmp::*;
use std::fmt;
use ipc::binary::{BinaryConvertError, BinaryConvertable};
use util::Bytes;
use std::collections::{VecDeque, BTreeMap};
use std::mem;
#[derive(Debug, PartialEq, Eq, Clone, Binary)]
/// Diff type for specifying a change (or not).
@ -95,6 +100,8 @@ impl AccountDiff {
// TODO: refactor into something nicer.
fn interpreted_hash(u: &H256) -> String {
use util::bytes::*;
if u <= &H256::from(0xffffffff) {
format!("{} = 0x{:x}", U256::from(u.as_slice()).low_u32(), U256::from(u.as_slice()).low_u32())
} else if u <= &H256::from(u64::max_value()) {
@ -108,6 +115,8 @@ fn interpreted_hash(u: &H256) -> String {
impl fmt::Display for AccountDiff {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
use util::bytes::*;
match self.nonce {
Diff::Born(ref x) => try!(write!(f, " non {}", x)),
Diff::Changed(ref pre, ref post) => try!(write!(f, "#{} ({} {} {})", post, pre, if pre > post {"-"} else {"+"}, *max(pre, post) - * min(pre, post))),

View File

@ -47,6 +47,7 @@ pub enum TransactionID {
}
/// Uniquely identifies Trace.
#[derive(Binary)]
pub struct TraceId {
/// Transaction
pub transaction: TransactionID,
@ -55,10 +56,10 @@ pub struct TraceId {
}
/// Uniquely identifies Uncle.
#[derive(Debug)]
pub struct UncleID (
#[derive(Debug, Binary)]
pub struct UncleID {
/// Block id.
pub BlockID,
pub block: BlockID,
/// Position in block.
pub usize
);
pub position: usize
}

View File

@ -16,8 +16,13 @@
//! State diff module.
use util::*;
use util::numbers::*;
use account_diff::*;
use ipc::binary::BinaryConvertError;
use std::mem;
use std::fmt;
use std::ops::*;
use std::collections::{VecDeque, BTreeMap};
#[derive(Debug, PartialEq, Eq, Clone, Binary)]
/// Expression for the delta between two system states. Encoded the

View File

@ -17,9 +17,12 @@
//! Tree route info type definition
use util::numbers::H256;
use ipc::BinaryConvertError;
use std::collections::VecDeque;
use std::mem;
/// Represents a tree route between `from` block and `to` block:
#[derive(Debug)]
#[derive(Debug, Binary)]
pub struct TreeRoute {
/// A vector of hashes of all blocks, ordered from `from` to `to`.
pub blocks: Vec<H256>,