aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGav Wood <g@ethdev.com>2014-11-09 02:11:46 +0800
committerGav Wood <g@ethdev.com>2014-11-09 02:11:46 +0800
commitc447914a0b1a707578f3ab78dc167678728a4864 (patch)
treeb86b0faeaa8cb41a00a38c1061007808029fc218
parent6c6cf8d01c30dd7b92854446767245d6393db3ef (diff)
parenta6ba0f7908627b65d3b115e342746819a2186d10 (diff)
downloaddexon-solidity-c447914a0b1a707578f3ab78dc167678728a4864.tar.gz
dexon-solidity-c447914a0b1a707578f3ab78dc167678728a4864.tar.zst
dexon-solidity-c447914a0b1a707578f3ab78dc167678728a4864.zip
Merge pull request #490 from CJentzsch/StateBug
Quick fix for OOG in deep calls
-rw-r--r--TestHelper.h1
-rw-r--r--createRandomTest.cpp4
-rw-r--r--state.cpp14
-rw-r--r--tmpFiller.json44
-rw-r--r--vm.cpp10
5 files changed, 7 insertions, 66 deletions
diff --git a/TestHelper.h b/TestHelper.h
index 622b83ac..a4eb64d8 100644
--- a/TestHelper.h
+++ b/TestHelper.h
@@ -57,7 +57,6 @@ public:
eth::State m_statePost;
eth::ExtVMFace m_environment;
eth::Transaction m_transaction;
- bytes code;
private:
json_spirit::mObject& m_TestObject;
diff --git a/createRandomTest.cpp b/createRandomTest.cpp
index 321e515d..f74be930 100644
--- a/createRandomTest.cpp
+++ b/createRandomTest.cpp
@@ -134,10 +134,10 @@ void doMyTests(json_spirit::mValue& v)
o["pre"] = mValue(fev.exportState());
fev.importExec(o["exec"].get_obj());
- if (!fev.code)
+ if (fev.code.empty())
{
fev.thisTxCode = get<3>(fev.addresses.at(fev.myAddress));
- fev.code = &fev.thisTxCode;
+ fev.code = fev.thisTxCode;
}
vm.reset(fev.gas);
diff --git a/state.cpp b/state.cpp
index 9c0a7188..93586905 100644
--- a/state.cpp
+++ b/state.cpp
@@ -55,12 +55,6 @@ void doStateTests(json_spirit::mValue& v, bool _fillin)
ImportTest importer(o, _fillin);
- if (_fillin)
- {
- importer.code = importer.m_statePre.code(importer.m_environment.myAddress);
- importer.m_environment.code = &importer.code;
- }
-
State theState = importer.m_statePre;
bytes tx = importer.m_transaction.rlp();
bytes output;
@@ -124,12 +118,4 @@ BOOST_AUTO_TEST_CASE(stSystemOperationsTest)
dev::test::executeTests("stSystemOperationsTest", "/StateTests", dev::test::doStateTests);
}
-BOOST_AUTO_TEST_CASE(tmp)
-{
- int currentVerbosity = g_logVerbosity;
- g_logVerbosity = 12;
- dev::test::executeTests("tmp", "/StateTests", dev::test::doStateTests);
- g_logVerbosity = currentVerbosity;
-}
-
BOOST_AUTO_TEST_SUITE_END()
diff --git a/tmpFiller.json b/tmpFiller.json
deleted file mode 100644
index bd27b890..00000000
--- a/tmpFiller.json
+++ /dev/null
@@ -1,44 +0,0 @@
-{
- "ABAcalls0": {
- "env" : {
- "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
- "currentNumber" : "0",
- "currentGasLimit" : "10000000",
- "currentDifficulty" : "256",
- "currentTimestamp" : 1,
- "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
- },
- "pre" : {
- "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
- "balance" : "1000000000000000000",
- "nonce" : 0,
- "code" : "{ [[ (PC) ]] (CALL 1000 0x945304eb96065b2a98b57a48a06ae28d285a71b5 24 0 0 0 0) }",
- "storage": {}
- },
- "945304eb96065b2a98b57a48a06ae28d285a71b5" : {
- "balance" : "23",
- "code" : " { [[ (PC) ]] (ADD 1 (CALL 500 0x095e7baea6a6c7c4c2dfeb977efac326af552d87 23 0 0 0 0)) } ",
- "nonce" : "0",
- "storage" : {
- }
- },
- "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
- "balance" : "1000000000000000000",
- "nonce" : 0,
- "code" : "",
- "storage": {}
- }
-
- },
- "transaction" : {
- "nonce" : "0",
- "gasPrice" : "1",
- "gasLimit" : "10000",
- "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
- "value" : "100000",
- "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
- "data" : ""
- }
- }
-
-}
diff --git a/vm.cpp b/vm.cpp
index c6799daa..93cf121d 100644
--- a/vm.cpp
+++ b/vm.cpp
@@ -29,7 +29,7 @@ using namespace dev::eth;
using namespace dev::test;
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&)
{
@@ -195,11 +195,11 @@ void FakeExtVM::importExec(mObject& _o)
gas = toInt(_o["gas"]);
thisTxCode.clear();
- code = &thisTxCode;
+ code = thisTxCode;
thisTxCode = importCode(_o);
if (_o["code"].type() != str_type && _o["code"].type() != array_type)
- code.reset();
+ code.clear();
thisTxData.clear();
thisTxData = importData(_o);
@@ -289,10 +289,10 @@ void doVMTests(json_spirit::mValue& v, bool _fillin)
o["pre"] = mValue(fev.exportState());
fev.importExec(o["exec"].get_obj());
- if (!fev.code)
+ if (fev.code.empty())
{
fev.thisTxCode = get<3>(fev.addresses.at(fev.myAddress));
- fev.code = &fev.thisTxCode;
+ fev.code = fev.thisTxCode;
}
bytes output;