diff --git a/src/block.rs b/src/block.rs index beb35fc41..d149d6132 100644 --- a/src/block.rs +++ b/src/block.rs @@ -268,7 +268,7 @@ pub fn enact<'x, 'y>(block_bytes: &[u8], engine: &'x Engine, db: OverlayDB, pare { let header = BlockView::new(block_bytes).header_view(); let s = State::from_existing(db.clone(), parent.state_root().clone(), engine.account_start_nonce()); -// flush(format!("enact(): root={}, author={}, author_balance={}\n", s.root(), header.author(), s.balance(&header.author()))); + trace!("enact(): root={}, author={}, author_balance={}\n", s.root(), header.author(), s.balance(&header.author())); } let block = BlockView::new(block_bytes); diff --git a/src/executive.rs b/src/executive.rs index 01bed3fd7..9c3a545a5 100644 --- a/src/executive.rs +++ b/src/executive.rs @@ -203,10 +203,10 @@ impl<'a> Executive<'a> { evm.exec(¶ms, &mut ext) }; -// flush(format!("exec: sstore-clears={}\n", unconfirmed_substate.refunds_count)); -// flush(format!("exec: substate={:?}; unconfirmed_substate={:?}\n", substate, unconfirmed_substate)); + trace!("exec: sstore-clears={}\n", unconfirmed_substate.refunds_count); + trace!("exec: substate={:?}; unconfirmed_substate={:?}\n", substate, unconfirmed_substate); self.enact_result(&res, substate, unconfirmed_substate, backup); -// flush(format!("exec: new substate={:?}\n", substate)); + trace!("exec: new substate={:?}\n", substate); res } else { // otherwise, nothing @@ -258,17 +258,17 @@ impl<'a> Executive<'a> { let refund_value = gas_left * t.gas_price; let fees_value = gas_used * t.gas_price; -// flush(format!("exec::finalize: t.gas={}, sstore_refunds={}, suicide_refunds={}, refunds_bound={}, gas_left_prerefund={}, refunded={}, gas_left={}, gas_used={}, refund_value={}, fees_value={}\n", -// t.gas, sstore_refunds, suicide_refunds, refunds_bound, gas_left_prerefund, refunded, gas_left, gas_used, refund_value, fees_value)); + trace!("exec::finalize: t.gas={}, sstore_refunds={}, suicide_refunds={}, refunds_bound={}, gas_left_prerefund={}, refunded={}, gas_left={}, gas_used={}, refund_value={}, fees_value={}\n", + t.gas, sstore_refunds, suicide_refunds, refunds_bound, gas_left_prerefund, refunded, gas_left, gas_used, refund_value, fees_value); -// flush(format!("exec::finalize: Refunding refund_value={}, sender={}\n", refund_value, t.sender().unwrap())); + trace!("exec::finalize: Refunding refund_value={}, sender={}\n", refund_value, t.sender().unwrap()); self.state.add_balance(&t.sender().unwrap(), &refund_value); -// flush(format!("exec::finalize: Compensating author: fees_value={}, author={}\n", fees_value, &self.info.author)); + trace!("exec::finalize: Compensating author: fees_value={}, author={}\n", fees_value, &self.info.author); self.state.add_balance(&self.info.author, &fees_value); // perform suicides for address in substate.suicides.iter() { -// trace!("Killing {}", address); + trace!("Killing {}", address); self.state.kill_account(address); } diff --git a/src/externalities.rs b/src/externalities.rs index 654a27a05..8c75a71f4 100644 --- a/src/externalities.rs +++ b/src/externalities.rs @@ -61,7 +61,7 @@ impl<'a> Externalities<'a> { impl<'a> Ext for Externalities<'a> { fn storage_at(&self, key: &H256) -> H256 { -// flush(format!("ext: storage_at({}, {}) == {}\n", self.params.address, key, U256::from(self.state.storage_at(&self.params.address, key).as_slice()))); + trace!("ext: storage_at({}, {}) == {}\n", self.params.address, key, U256::from(self.state.storage_at(&self.params.address, key).as_slice())); self.state.storage_at(&self.params.address, key) } @@ -69,10 +69,10 @@ impl<'a> Ext for Externalities<'a> { let old = self.state.storage_at(&self.params.address, &key); // if SSTORE nonzero -> zero, increment refund count if value.is_zero() && !old.is_zero() { -// flush(format!("ext: additional refund. {} -> {}\n", self.substate.refunds_count, self.substate.refunds_count + x!(1))); + trace!("ext: additional refund. {} -> {}\n", self.substate.refunds_count, self.substate.refunds_count + x!(1)); self.substate.refunds_count = self.substate.refunds_count + U256::one(); } -// flush(format!("ext: set_storage_at({}, {}): {} -> {}\n", self.params.address, key, U256::from(old.as_slice()), U256::from(value.as_slice()))); + trace!("ext: set_storage_at({}, {}): {} -> {}\n", self.params.address, key, U256::from(old.as_slice()), U256::from(value.as_slice())); self.state.set_storage(&self.params.address, key, value) } @@ -85,11 +85,11 @@ impl<'a> Ext for Externalities<'a> { true => { let index = self.info.number - number.low_u64() - 1; let r = self.info.last_hashes[index as usize].clone(); -// flush(format!("ext: blockhash({}) -> {} self.info.number={}\n", number, r, self.info.number)); + trace!("ext: blockhash({}) -> {} self.info.number={}\n", number, r, self.info.number); r }, false => { -// flush(format!("ext: blockhash({}) -> null self.info.number={}\n", number, self.info.number)); + trace!("ext: blockhash({}) -> null self.info.number={}\n", number, self.info.number); H256::from(&U256::zero()) }, } @@ -176,10 +176,10 @@ impl<'a> Ext for Externalities<'a> { }; -// flush(format!("Externalities::call: BEFORE: bal({})={}, bal({})={}\n", params.sender, self.state.balance(¶ms.sender), params.address, self.state.balance(¶ms.address))); -// flush(format!("Externalities::call: CALLING: params={:?}\n", params)); + trace!("Externalities::call: BEFORE: bal({})={}, bal({})={}\n", params.sender, self.state.balance(¶ms.sender), params.address, self.state.balance(¶ms.address)); + trace!("Externalities::call: CALLING: params={:?}\n", params); let r = Executive::from_parent(self.state, self.info, self.engine, self.depth).call(¶ms, self.substate, BytesRef::Fixed(output)); -// flush(format!("Externalities::call: AFTER: bal({})={}, bal({})={}\n", params.sender, self.state.balance(¶ms.sender), params.address, self.state.balance(¶ms.address))); + trace!("Externalities::call: AFTER: bal({})={}, bal({})={}\n", params.sender, self.state.balance(¶ms.sender), params.address, self.state.balance(¶ms.address)); match r { Ok(gas_left) => Ok((gas + gas_left, true)), diff --git a/src/state.rs b/src/state.rs index 98d1eacc3..88280c2da 100644 --- a/src/state.rs +++ b/src/state.rs @@ -107,16 +107,16 @@ impl State { /// Add `incr` to the balance of account `a`. pub fn add_balance(&mut self, a: &Address, incr: &U256) { -// let old = self.balance(a); + let old = self.balance(a); self.require(a, false).add_balance(incr); -// flush(format!("state: add_balance({}, {}): {} -> {}\n", a, incr, old, self.balance(a))); + trace!("state: add_balance({}, {}): {} -> {}\n", a, incr, old, self.balance(a)); } /// Subtract `decr` from the balance of account `a`. pub fn sub_balance(&mut self, a: &Address, decr: &U256) { -// let old = self.balance(a); + let old = self.balance(a); self.require(a, false).sub_balance(decr); -// flush(format!("state: sub_balance({}, {}): {} -> {}\n", a, decr, old, self.balance(a))); + trace!("state: sub_balance({}, {}): {} -> {}\n", a, decr, old, self.balance(a)); } /// Subtracts `by` from the balance of `from` and adds it to that of `to`. @@ -230,13 +230,6 @@ impl State { /// `require_code` requires that the code be cached, too. fn get(&self, a: &Address, require_code: bool) -> Ref> { self.cache.borrow_mut().entry(a.clone()).or_insert_with(|| { - /*{ - let orlp = SecTrieDB::new(&self.db, &self.root).get(&a).map(|rlp| rlp.to_vec()); - if let Some(rlp) = orlp { - let acc = Account::from_rlp(&rlp); - flush(format!("State::get({}) -> {} (bal={})\n", a, rlp.pretty(), acc.balance())); - } - }*/ SecTrieDB::new(&self.db, &self.root).get(&a).map(|rlp| Account::from_rlp(rlp)) }); if require_code {