Merge pull request #468 from ethcore/ethcore_compiling

compiling ethcore on beta
This commit is contained in:
Nikolay Volf 2016-02-19 02:12:23 +03:00
commit d2349cdd8e
9 changed files with 18 additions and 20 deletions

6
Cargo.lock generated
View File

@ -174,7 +174,7 @@ dependencies = [
"env_logger 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"ethash 0.9.99",
"ethcore-util 0.9.99",
"heapsize 0.3.2 (git+https://github.com/nikvolf/heapsize)",
"heapsize 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
@ -212,7 +212,7 @@ dependencies = [
"elastic-array 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"eth-secp256k1 0.5.4 (git+https://github.com/arkpar/rust-secp256k1.git)",
"heapsize 0.3.2 (git+https://github.com/nikvolf/heapsize)",
"heapsize 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"igd 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"itertools 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"json-tests 0.1.0",
@ -264,7 +264,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "heapsize"
version = "0.3.2"
source = "git+https://github.com/nikvolf/heapsize#a2d682fd4dcf11e2deeeb229ef2375354c15668b"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "hpack"

View File

@ -11,7 +11,7 @@ log = "0.3"
env_logger = "0.3"
rustc-serialize = "0.3"
rocksdb = "0.3"
heapsize = { git = "https://github.com/nikvolf/heapsize" }
heapsize = "0.3"
rust-crypto = "0.2.34"
time = "0.1"
ethcore-util = { path = "../util" }
@ -25,7 +25,7 @@ lazy_static = "0.1"
[features]
jit = ["evmjit"]
evm-debug = []
json-tests = [ "heapsize/nightly" ]
json-tests = []
test-heavy = []
dev = ["clippy"]
default = [ "heapsize/nightly" ]
default = []

View File

@ -267,7 +267,7 @@ impl<'x, 'y> OpenBlock<'x, 'y> {
s.block.base.header.uncles_hash = uncle_bytes.sha3();
s.block.base.header.state_root = s.block.state.root().clone();
s.block.base.header.receipts_root = ordered_trie_root(s.block.receipts.iter().map(|ref r| r.rlp_bytes().to_vec()).collect());
s.block.base.header.log_bloom = s.block.receipts.iter().fold(LogBloom::zero(), |mut b, r| {b |= &r.log_bloom; b});
s.block.base.header.log_bloom = s.block.receipts.iter().fold(LogBloom::zero(), |mut b, r| {b = &b | &r.log_bloom; b});
s.block.base.header.gas_used = s.block.receipts.last().map_or(U256::zero(), |r| r.gas_used);
s.block.base.header.note_dirty();

View File

@ -162,7 +162,7 @@ impl ClientReport {
pub fn accrue_block(&mut self, block: &PreVerifiedBlock) {
self.blocks_imported += 1;
self.transactions_applied += block.transactions.len();
self.gas_processed += block.header.gas_used;
self.gas_processed = self.gas_processed + block.header.gas_used;
}
}

View File

@ -299,7 +299,7 @@ impl evm::Evm for Interpreter {
let (gas_cost, mem_size) = try!(self.get_gas_cost_mem(ext, instruction, &mut mem, &stack));
try!(self.verify_gas(&current_gas, &gas_cost));
mem.expand(mem_size);
current_gas -= gas_cost;
current_gas = current_gas - gas_cost;
evm_debug!({
println!("[0x{:x}][{}(0x{:x}) Gas: {:x}\n Gas Before: {:x}",
@ -320,7 +320,7 @@ impl evm::Evm for Interpreter {
match result {
InstructionResult::Ok => {},
InstructionResult::UnusedGas(gas) => {
current_gas += gas;
current_gas = current_gas + gas;
},
InstructionResult::UseAllGas => {
current_gas = U256::zero();

View File

@ -24,7 +24,6 @@
// Keeps consistency (all lines with `.clone()`) and helpful when changing ref to non-ref.
#![allow(clone_on_copy)]
//! Ethcore library
//!
//! ### Rust version:

View File

@ -39,7 +39,7 @@ impl Receipt {
Receipt {
state_root: state_root,
gas_used: gas_used,
log_bloom: logs.iter().fold(LogBloom::new(), |mut b, l| { b |= &l.bloom(); b }),
log_bloom: logs.iter().fold(LogBloom::new(), |mut b, l| { b = b | l.bloom(); b }),
logs: logs,
}
}

View File

@ -282,7 +282,7 @@ impl State {
/// Pull account `a` in our cache from the trie DB and return it.
/// `require_code` requires that the code be cached, too.
fn get(&self, a: &Address, require_code: bool) -> Ref<Option<Account>> {
fn get<'a>(&'a self, a: &Address, require_code: bool) -> &'a Option<Account> {
let have_key = self.cache.borrow().contains_key(a);
if !have_key {
self.insert_cache(a, SecTrieDB::new(&self.db, &self.root).get(&a).map(Account::from_rlp))
@ -292,17 +292,17 @@ impl State {
account.cache_code(&AccountDB::new(&self.db, a));
}
}
Ref::map(self.cache.borrow(), |m| m.get(a).unwrap())
unsafe { ::std::mem::transmute(self.cache.borrow().get(a).unwrap()) }
}
/// Pull account `a` in our cache from the trie DB. `require_code` requires that the code be cached, too.
fn require(&self, a: &Address, require_code: bool) -> RefMut<Account> {
fn require<'a>(&'a self, a: &Address, require_code: bool) -> &'a mut Account {
self.require_or_from(a, require_code, || Account::new_basic(U256::from(0u8), self.account_start_nonce), |_|{})
}
/// Pull account `a` in our cache from the trie DB. `require_code` requires that the code be cached, too.
/// If it doesn't exist, make account equal the evaluation of `default`.
fn require_or_from<F: FnOnce() -> Account, G: FnOnce(&mut Account)>(&self, a: &Address, require_code: bool, default: F, not_default: G) -> RefMut<Account> {
fn require_or_from<'a, F: FnOnce() -> Account, G: FnOnce(&mut Account)>(&self, a: &Address, require_code: bool, default: F, not_default: G) -> &'a mut Account {
let have_key = self.cache.borrow().contains_key(a);
if !have_key {
self.insert_cache(a, SecTrieDB::new(&self.db, &self.root).get(&a).map(Account::from_rlp))
@ -316,13 +316,12 @@ impl State {
not_default(self.cache.borrow_mut().get_mut(a).unwrap().as_mut().unwrap());
}
let b = self.cache.borrow_mut();
RefMut::map(b, |m| m.get_mut(a).unwrap().as_mut().map(|account| {
unsafe { ::std::mem::transmute(self.cache.borrow_mut().get_mut(a).unwrap().as_mut().map(|account| {
if require_code {
account.cache_code(&AccountDB::new(&self.db, a));
}
account
}).unwrap())
}).unwrap()) }
}
}

View File

@ -20,7 +20,7 @@ lazy_static = "0.1"
eth-secp256k1 = { git = "https://github.com/arkpar/rust-secp256k1.git" }
rust-crypto = "0.2.34"
elastic-array = "0.4"
heapsize = { git = "https://github.com/nikvolf/heapsize" }
heapsize = "0.3"
itertools = "0.4"
crossbeam = "0.2"
slab = { git = "https://github.com/arkpar/slab.git" }