Merge branch 'master' into ethminer_crate

Conflicts:
	Cargo.toml
	rpc/Cargo.toml
	sync/Cargo.toml
This commit is contained in:
Tomasz Drwięga
2016-03-12 09:48:17 +01:00
28 changed files with 197 additions and 58 deletions

View File

@@ -17,7 +17,7 @@ ethcore-util = { path = "../util" }
evmjit = { path = "../evmjit", optional = true }
ethash = { path = "../ethash" }
num_cpus = "0.2"
clippy = { version = "0.0.44", optional = true }
clippy = { version = "0.0.49", optional = true }
crossbeam = "0.1.5"
lazy_static = "0.1"
ethcore-devtools = { path = "../devtools" }

View File

@@ -35,13 +35,13 @@ pub enum ExtrasIndex {
BlocksBlooms = 4,
/// Block receipts index
BlockReceipts = 5,
}
}
/// trait used to write Extras data to db
pub trait ExtrasWritable {
/// Write extra data to db
fn put_extras<K, T>(&self, hash: &K, value: &T) where
T: ExtrasIndexable + Encodable,
T: ExtrasIndexable + Encodable,
K: ExtrasSliceConvertable;
}
@@ -60,9 +60,9 @@ pub trait ExtrasReadable {
impl ExtrasWritable for DBTransaction {
fn put_extras<K, T>(&self, hash: &K, value: &T) where
T: ExtrasIndexable + Encodable,
T: ExtrasIndexable + Encodable,
K: ExtrasSliceConvertable {
self.put(&hash.to_extras_slice(T::extras_index()), &encode(value)).unwrap()
}
}
@@ -215,6 +215,12 @@ pub struct BlocksBlooms {
pub blooms: [H2048; 16],
}
impl Default for BlocksBlooms {
fn default() -> Self {
BlocksBlooms::new()
}
}
impl BlocksBlooms {
pub fn new() -> Self {
BlocksBlooms { blooms: unsafe { ::std::mem::zeroed() }}

View File

@@ -25,6 +25,8 @@
#![cfg_attr(feature="dev", allow(match_bool))]
// Keeps consistency (all lines with `.clone()`) and helpful when changing ref to non-ref.
#![cfg_attr(feature="dev", allow(clone_on_copy))]
// In most cases it expresses function flow better
#![cfg_attr(feature="dev", allow(if_not_else))]
//! Ethcore library
//!

View File

@@ -31,6 +31,12 @@ pub struct Substate {
pub contracts_created: Vec<Address>
}
impl Default for Substate {
fn default() -> Self {
Substate::new()
}
}
impl Substate {
/// Creates new substate.
pub fn new() -> Self {
@@ -67,8 +73,8 @@ mod tests {
let mut sub_state = Substate::new();
sub_state.contracts_created.push(address_from_u64(1u64));
sub_state.logs.push(LogEntry {
address: address_from_u64(1u64),
topics: vec![],
address: address_from_u64(1u64),
topics: vec![],
data: vec![]
});
sub_state.sstore_clears_count = x!(5);
@@ -77,8 +83,8 @@ mod tests {
let mut sub_state_2 = Substate::new();
sub_state_2.contracts_created.push(address_from_u64(2u64));
sub_state_2.logs.push(LogEntry {
address: address_from_u64(1u64),
topics: vec![],
address: address_from_u64(1u64),
topics: vec![],
data: vec![]
});
sub_state_2.sstore_clears_count = x!(7);