From df3d17789a0c835e994ea69b53cb04eba979637e Mon Sep 17 00:00:00 2001 From: debris Date: Fri, 19 Feb 2016 00:06:06 +0100 Subject: [PATCH] compiling ethcore on beta --- Cargo.lock | 6 +++--- ethcore/Cargo.toml | 6 +++--- ethcore/src/block.rs | 2 +- ethcore/src/client.rs | 2 +- ethcore/src/evm/interpreter.rs | 4 ++-- ethcore/src/lib.rs | 1 - ethcore/src/receipt.rs | 2 +- ethcore/src/state.rs | 13 ++++++------- util/Cargo.toml | 2 +- 9 files changed, 18 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 236969732..b21fb1d63 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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" diff --git a/ethcore/Cargo.toml b/ethcore/Cargo.toml index dee169c7e..090280cae 100644 --- a/ethcore/Cargo.toml +++ b/ethcore/Cargo.toml @@ -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 = [] diff --git a/ethcore/src/block.rs b/ethcore/src/block.rs index c03417dc1..b646c4cde 100644 --- a/ethcore/src/block.rs +++ b/ethcore/src/block.rs @@ -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(); diff --git a/ethcore/src/client.rs b/ethcore/src/client.rs index 09f7417e8..72e520ad7 100644 --- a/ethcore/src/client.rs +++ b/ethcore/src/client.rs @@ -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; } } diff --git a/ethcore/src/evm/interpreter.rs b/ethcore/src/evm/interpreter.rs index 50c0377ac..c04b7e1a9 100644 --- a/ethcore/src/evm/interpreter.rs +++ b/ethcore/src/evm/interpreter.rs @@ -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(¤t_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(); diff --git a/ethcore/src/lib.rs b/ethcore/src/lib.rs index 8c9fcaff1..11d129f61 100644 --- a/ethcore/src/lib.rs +++ b/ethcore/src/lib.rs @@ -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: diff --git a/ethcore/src/receipt.rs b/ethcore/src/receipt.rs index 5fc1a318b..cd1897535 100644 --- a/ethcore/src/receipt.rs +++ b/ethcore/src/receipt.rs @@ -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, } } diff --git a/ethcore/src/state.rs b/ethcore/src/state.rs index 00886b89c..3eaedb9bf 100644 --- a/ethcore/src/state.rs +++ b/ethcore/src/state.rs @@ -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> { + fn get<'a>(&'a self, a: &Address, require_code: bool) -> &'a Option { 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 { + 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 Account, G: FnOnce(&mut Account)>(&self, a: &Address, require_code: bool, default: F, not_default: G) -> RefMut { + 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()) } } } diff --git a/util/Cargo.toml b/util/Cargo.toml index ff3fbc5dc..18e9a0a75 100644 --- a/util/Cargo.toml +++ b/util/Cargo.toml @@ -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" }