Move stuff to bottom layer.

This commit is contained in:
Gav Wood 2015-11-27 13:18:35 +01:00
parent 7bb4561c16
commit f596c5819b
1 changed files with 16 additions and 18 deletions

View File

@ -2,22 +2,20 @@
extern crate ethcore_util; extern crate ethcore_util;
use ethcore_util::hash::*; use ethcore_util::hash::*;
use ethcore_util::uint::*;
pub type Bytes = Vec<u8>; pub type Bytes = Vec<u8>;
pub type Uint256 = Hash256;
pub type LogBloom = Hash4096; pub type LogBloom = Hash4096;
pub const ZERO_UINT256: Uint256 = Hash256([0x00; 32]); pub static ZERO_ADDRESS: Address = Address([0x00; 20]);
pub const ZERO_ADDRESS: Address = Address([0x00; 20]); pub static ZERO_HASH256: Hash256 = Hash256([0x00; 32]);
pub const BAD_UINT256: Uint256 = Hash256([0xff; 32]); pub static ZERO_LOGBLOOM: LogBloom = Hash4096([0x00; 512]);
pub const ZERO_HASH256: Hash256 = Hash256([0x00; 32]);
pub const ZERO_LOGBLOOM: LogBloom = Hash4096([0x00; 512]);
#[derive(Debug)] #[derive(Debug)]
pub struct Header { pub struct Header {
parent_hash: Hash256, parent_hash: Hash256,
timestamp: Uint256, timestamp: U256,
number: Uint256, number: U256,
author: Address, author: Address,
transactions_root: Hash256, transactions_root: Hash256,
@ -27,19 +25,19 @@ pub struct Header {
state_root: Hash256, state_root: Hash256,
receipts_root: Hash256, receipts_root: Hash256,
log_bloom: LogBloom, log_bloom: LogBloom,
gas_used: Uint256, gas_used: U256,
gas_limit: Uint256, gas_limit: U256,
difficulty: Uint256, difficulty: U256,
seal: Vec<Bytes>, seal: Vec<Bytes>,
} }
impl Header { impl Header {
pub fn new() -> Header { pub fn new() -> Header {
Header { Header {
parent_hash: ZERO_UINT256, parent_hash: ZERO_HASH256,
timestamp: BAD_UINT256, timestamp: BAD_U256,
number: ZERO_UINT256, number: ZERO_U256,
author: ZERO_ADDRESS, author: ZERO_ADDRESS,
transactions_root: ZERO_HASH256, transactions_root: ZERO_HASH256,
@ -49,10 +47,10 @@ impl Header {
state_root: ZERO_HASH256, state_root: ZERO_HASH256,
receipts_root: ZERO_HASH256, receipts_root: ZERO_HASH256,
log_bloom: ZERO_LOGBLOOM, log_bloom: ZERO_LOGBLOOM,
gas_used: ZERO_UINT256, gas_used: ZERO_U256,
gas_limit: ZERO_UINT256, gas_limit: ZERO_U256,
difficulty: ZERO_UINT256, difficulty: ZERO_U256,
seal: vec![], seal: vec![],
} }
} }
@ -60,7 +58,7 @@ impl Header {
pub struct Transaction { pub struct Transaction {
pub to: Address, pub to: Address,
pub gas: Uint256, pub gas: U256,
pub data: Bytes, pub data: Bytes,
pub code: Bytes, pub code: Bytes,
} }