Browse Source

compile code in accounts when importing state

cl-refactor
CJentzsch 10 years ago
parent
commit
eab54c8d1d
  1. 3
      libethereum/Account.cpp
  2. 17
      test/TestHelper.cpp
  3. 17
      test/libethereum/state.cpp

3
libethereum/Account.cpp

@ -21,6 +21,7 @@
#include "Account.h"
#include <test/JsonSpiritHeaders.h>
#include <test/TestHelper.h>
#include <libethcore/Common.h>
using namespace std;
using namespace dev;
@ -63,7 +64,7 @@ AccountMap dev::eth::jsonToAccountMap(std::string const& _json, AccountMaskMap*
if (haveCode)
{
ret[a] = Account(balance, Account::ContractConception);
ret[a].setCode(fromHex(o["code"].get_str()));
ret[a].setCode(test::importCode(o));
}
else
ret[a] = Account(balance, Account::NormalCreation);

17
test/TestHelper.cpp

@ -121,10 +121,21 @@ bytes ImportTest::executeTest()
{
ExecutionResult res;
eth::State tmpState = m_statePre;
try
{
std::pair<ExecutionResult, TransactionReceipt> execOut = m_statePre.execute(m_envInfo, m_transaction);
res = execOut.first;
m_logs = execOut.second.log();
}
catch (Exception const& _e)
{
cnote << "Exception: " << diagnostic_information(_e);
}
catch (std::exception const& _e)
{
cnote << "state execution exception: " << _e.what();
}
std::pair<ExecutionResult, TransactionReceipt> execOut = m_statePre.execute(m_envInfo, m_transaction);
res = execOut.first;
m_logs = execOut.second.log();
m_statePre.commit();
m_statePost = m_statePre;
m_statePre = tmpState;

17
test/libethereum/state.cpp

@ -59,20 +59,9 @@ void doStateTests(json_spirit::mValue& v, bool _fillin)
const State importedStatePost = importer.m_statePost;
bytes output;
try
{
Listener::ExecTimeGuard guard{i.first};
output = importer.executeTest();
}
catch (Exception const& _e)
{
cnote << "Exception: " << diagnostic_information(_e);
//theState.commit();
}
catch (std::exception const& _e)
{
cnote << "state execution exception: " << _e.what();
}
// execute transaction
Listener::ExecTimeGuard guard{i.first};
output = importer.executeTest();
if (_fillin)
{

Loading…
Cancel
Save