aboutsummaryrefslogtreecommitdiffstats
path: root/vm.cpp
diff options
context:
space:
mode:
authorCJentzsch <jentzsch.software@gmail.com>2014-12-02 05:04:09 +0800
committerCJentzsch <jentzsch.software@gmail.com>2014-12-02 05:41:16 +0800
commitd952833c1b86ce45c6da826ce2a9877ffa795d9e (patch)
tree2704cf263e3f005fedf3d106c040eb6a89261248 /vm.cpp
parent366514a72577d9e9b1c58fc768d084e73ef4f3a5 (diff)
downloaddexon-solidity-d952833c1b86ce45c6da826ce2a9877ffa795d9e.tar
dexon-solidity-d952833c1b86ce45c6da826ce2a9877ffa795d9e.tar.gz
dexon-solidity-d952833c1b86ce45c6da826ce2a9877ffa795d9e.tar.bz2
dexon-solidity-d952833c1b86ce45c6da826ce2a9877ffa795d9e.tar.lz
dexon-solidity-d952833c1b86ce45c6da826ce2a9877ffa795d9e.tar.xz
dexon-solidity-d952833c1b86ce45c6da826ce2a9877ffa795d9e.tar.zst
dexon-solidity-d952833c1b86ce45c6da826ce2a9877ffa795d9e.zip
added logs to state tests
Diffstat (limited to 'vm.cpp')
-rw-r--r--vm.cpp39
1 files changed, 2 insertions, 37 deletions
diff --git a/vm.cpp b/vm.cpp
index edb98371..0d61bf6b 100644
--- a/vm.cpp
+++ b/vm.cpp
@@ -120,41 +120,6 @@ void FakeExtVM::importEnv(mObject& _o)
currentBlock.coinbaseAddress = Address(_o["currentCoinbase"].get_str());
}
-mObject FakeExtVM::exportLog()
-{
- mObject ret;
- for (LogEntry const& l: sub.logs)
- {
- mObject o;
- o["address"] = toString(l.address);
- mArray topics;
- for (auto const& t: l.topics)
- topics.push_back(toString(t));
- o["topics"] = topics;
- o["data"] = "0x" + toHex(l.data);
- ret[toString(l.bloom())] = o;
- }
- return ret;
-}
-
-void FakeExtVM::importLog(mObject& _o)
-{
- for (auto const& l: _o)
- {
- mObject o = l.second.get_obj();
- // cant use BOOST_REQUIRE, because this function is used outside boost test (createRandomTest)
- assert(o.count("address") > 0);
- assert(o.count("topics") > 0);
- assert(o.count("data") > 0);
- LogEntry log;
- log.address = Address(o["address"].get_str());
- for (auto const& t: o["topics"].get_array())
- log.topics.insert(h256(t.get_str()));
- log.data = importData(o);
- sub.logs.push_back(log);
- }
-}
-
mObject FakeExtVM::exportState()
{
mObject ret;
@@ -384,7 +349,7 @@ void doVMTests(json_spirit::mValue& v, bool _fillin)
o["callcreates"] = fev.exportCallCreates();
o["out"] = "0x" + toHex(output);
fev.push(o, "gas", gas);
- o["logs"] = mValue(fev.exportLog());
+ o["logs"] = mValue(exportLog(fev.sub.logs));
}
}
else
@@ -402,7 +367,7 @@ void doVMTests(json_spirit::mValue& v, bool _fillin)
dev::test::FakeExtVM test;
test.importState(o["post"].get_obj());
test.importCallCreates(o["callcreates"].get_array());
- test.importLog(o["logs"].get_obj());
+ test.sub.logs = importLog(o["logs"].get_obj());
checkOutput(output, o);