From f16cb2e23e309b36846e82de20e35e1dc18ef5d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Tue, 28 Jul 2015 14:34:55 +0200 Subject: [PATCH] Force Interpreter VM when VM tracing requested. Fixes https://github.com/ethereum/cpp-ethereum/issues/2585. --- libethereum/State.cpp | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/libethereum/State.cpp b/libethereum/State.cpp index 5639b8bb6..27263caf8 100644 --- a/libethereum/State.cpp +++ b/libethereum/State.cpp @@ -1137,6 +1137,12 @@ bool State::isTrieGood(bool _enforceRefs, bool _requireNoLeftOvers) const ExecutionResult State::execute(LastHashes const& _lh, Transaction const& _t, Permanence _p, OnOpFunc const& _onOp) { + auto onOp = _onOp; +#if ETH_VMTRACE + if (isChannelVisible()) + onOp = Executive::simpleTrace(); // override tracer +#endif + #if ETH_PARANOIA paranoia("start of execution.", true); State old(*this); @@ -1161,16 +1167,11 @@ ExecutionResult State::execute(LastHashes const& _lh, Transaction const& _t, Per ctrace << toHex(e.t().rlp()); #endif if (!e.execute()) -#if ETH_VMTRACE { - if (isChannelVisible()) - e.go(e.simpleTrace()); - else - e.go(_onOp); + if (onOp) + VMFactory::setKind(VMKind::Interpreter); // force interpreter if a trace is wanted + e.go(onOp); } -#else - e.go(_onOp); -#endif e.finalize(); #if ETH_PARANOIA @@ -1183,13 +1184,13 @@ ExecutionResult State::execute(LastHashes const& _lh, Transaction const& _t, Per else { commit(); - + #if ETH_PARANOIA && !ETH_FATDB ctrace << "Executed; now" << rootHash(); ctrace << old.diff(*this); - + paranoia("after execution commit.", true); - + if (e.t().receiveAddress()) { EnforceRefs r(m_db, true); @@ -1200,9 +1201,9 @@ ExecutionResult State::execute(LastHashes const& _lh, Transaction const& _t, Per } } #endif - + // TODO: CHECK TRIE after level DB flush to make sure exactly the same. - + // Add to the user-originated transactions that we've executed. m_transactions.push_back(e.t()); m_receipts.push_back(TransactionReceipt(rootHash(), startGasUsed + e.gasUsed(), e.logs()));