Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Merge pull request #468 from ethcore/ethcore_compiling
Browse files Browse the repository at this point in the history
compiling ethcore on beta
  • Loading branch information
NikVolf committed Feb 18, 2016
2 parents 3c59983 + df3d177 commit d2349cd
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 20 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions ethcore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand All @@ -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 = []
2 changes: 1 addition & 1 deletion ethcore/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
4 changes: 2 additions & 2 deletions ethcore/src/evm/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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}",
Expand All @@ -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();
Expand Down
1 change: 0 additions & 1 deletion ethcore/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/receipt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}
Expand Down
13 changes: 6 additions & 7 deletions ethcore/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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))
Expand All @@ -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()) }
}
}

Expand Down
2 changes: 1 addition & 1 deletion util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down

0 comments on commit d2349cd

Please sign in to comment.