From d952833c1b86ce45c6da826ce2a9877ffa795d9e Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Mon, 1 Dec 2014 22:04:09 +0100 Subject: added logs to state tests --- vm.cpp | 39 ++------------------------------------- 1 file changed, 2 insertions(+), 37 deletions(-) (limited to 'vm.cpp') 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); -- cgit v1.2.3 From fb7c3bb302e5d309b500e2929a565b427de23a8b Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Mon, 1 Dec 2014 22:44:31 +0100 Subject: style Conflicts: libevm/VM.h --- vm.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'vm.cpp') diff --git a/vm.cpp b/vm.cpp index 0d61bf6b..8c9810a2 100644 --- a/vm.cpp +++ b/vm.cpp @@ -349,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(exportLog(fev.sub.logs)); + o["logs"] = mValue(exportLog(fev.sub.logs)); } } else @@ -367,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.sub.logs = importLog(o["logs"].get_obj()); + test.sub.logs = importLog(o["logs"].get_obj()); checkOutput(output, o); -- cgit v1.2.3 From 8d0a6647401123fcab7b1b5f38a5fd46b94331c2 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Tue, 2 Dec 2014 17:13:17 +0100 Subject: PV46. Minor protocol alterations. --- vm.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vm.cpp') diff --git a/vm.cpp b/vm.cpp index edb98371..1286df42 100644 --- a/vm.cpp +++ b/vm.cpp @@ -149,7 +149,7 @@ void FakeExtVM::importLog(mObject& _o) 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.topics.push_back(h256(t.get_str())); log.data = importData(o); sub.logs.push_back(log); } -- cgit v1.2.3