Fix ABAcalls OOG bug

This commit is contained in:
Christoph Jentzsch 2014-11-03 23:49:05 +01:00
parent c931e3ceec
commit 1310011f77
3 changed files with 8 additions and 10 deletions

View File

@ -134,10 +134,10 @@ void doMyTests(json_spirit::mValue& v)
o["pre"] = mValue(fev.exportState()); o["pre"] = mValue(fev.exportState());
fev.importExec(o["exec"].get_obj()); fev.importExec(o["exec"].get_obj());
if (!fev.code) if (!fev.code.size())
{ {
fev.thisTxCode = get<3>(fev.addresses.at(fev.myAddress)); fev.thisTxCode = get<3>(fev.addresses.at(fev.myAddress));
fev.code = &fev.thisTxCode; fev.code = fev.thisTxCode;
} }
vm.reset(fev.gas); vm.reset(fev.gas);

View File

@ -20,8 +20,6 @@
* State test functions. * State test functions.
*/ */
#define FILL_TESTS
#include <boost/filesystem/operations.hpp> #include <boost/filesystem/operations.hpp>
#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
#include "JsonSpiritHeaders.h" #include "JsonSpiritHeaders.h"
@ -60,7 +58,7 @@ void doStateTests(json_spirit::mValue& v, bool _fillin)
if (_fillin) if (_fillin)
{ {
importer.code = importer.m_statePre.code(importer.m_environment.myAddress); importer.code = importer.m_statePre.code(importer.m_environment.myAddress);
importer.m_environment.code = &importer.code; importer.m_environment.code = importer.code;
} }
State theState = importer.m_statePre; State theState = importer.m_statePre;

10
vm.cpp
View File

@ -29,7 +29,7 @@ using namespace dev::eth;
using namespace dev::test; using namespace dev::test;
FakeExtVM::FakeExtVM(eth::BlockInfo const& _previousBlock, eth::BlockInfo const& _currentBlock, unsigned _depth): /// TODO: XXX: remove the default argument & fix. FakeExtVM::FakeExtVM(eth::BlockInfo const& _previousBlock, eth::BlockInfo const& _currentBlock, unsigned _depth): /// TODO: XXX: remove the default argument & fix.
ExtVMFace(Address(), Address(), Address(), 0, 1, bytesConstRef(), bytesConstRef(), _previousBlock, _currentBlock, _depth) {} ExtVMFace(Address(), Address(), Address(), 0, 1, bytesConstRef(), bytes(), _previousBlock, _currentBlock, _depth) {}
h160 FakeExtVM::create(u256 _endowment, u256* _gas, bytesConstRef _init, OnOpFunc const&) h160 FakeExtVM::create(u256 _endowment, u256* _gas, bytesConstRef _init, OnOpFunc const&)
{ {
@ -206,11 +206,11 @@ void FakeExtVM::importExec(mObject& _o)
gas = toInt(_o["gas"]); gas = toInt(_o["gas"]);
thisTxCode.clear(); thisTxCode.clear();
code = &thisTxCode; code = thisTxCode;
thisTxCode = importCode(_o); thisTxCode = importCode(_o);
if (_o["code"].type() != str_type && _o["code"].type() != array_type) if (_o["code"].type() != str_type && _o["code"].type() != array_type)
code.reset(); code.clear();
thisTxData.clear(); thisTxData.clear();
thisTxData = importData(_o); thisTxData = importData(_o);
@ -303,10 +303,10 @@ void doVMTests(json_spirit::mValue& v, bool _fillin)
o["pre"] = mValue(fev.exportState()); o["pre"] = mValue(fev.exportState());
fev.importExec(o["exec"].get_obj()); fev.importExec(o["exec"].get_obj());
if (!fev.code) if (!fev.code.size())
{ {
fev.thisTxCode = get<3>(fev.addresses.at(fev.myAddress)); fev.thisTxCode = get<3>(fev.addresses.at(fev.myAddress));
fev.code = &fev.thisTxCode; fev.code = fev.thisTxCode;
} }
bytes output; bytes output;