diff --git a/test/tools/jsontests/vm.h b/test/tools/jsontests/vm.h index 294dd4478a5..92ad2b13224 100644 --- a/test/tools/jsontests/vm.h +++ b/test/tools/jsontests/vm.h @@ -56,10 +56,10 @@ class FakeExtVM: public eth::ExtVMFace virtual u256 store(u256 _n) override { return std::get<2>(addresses[myAddress])[_n]; } virtual void setStore(u256 _n, u256 _v) override { std::get<2>(addresses[myAddress])[_n] = _v; } virtual bool exists(Address _a) override { return !!addresses.count(_a); } - virtual u256 balance(Address _a) override { return std::get<0>(addresses[_a]); } - virtual void suicide(Address _a) override { std::get<0>(addresses[_a]) += std::get<0>(addresses[myAddress]); addresses.erase(myAddress); } - virtual bytes const& codeAt(Address _a) override { return std::get<3>(addresses[_a]); } - virtual size_t codeSizeAt(Address _a) override { return std::get<3>(addresses[_a]).size(); } + virtual u256 balance(Address _a) override { return exists(_a) ? std::get<0>(addresses[_a]) : u256(); } + virtual void suicide(Address _a) override { std::get<0>(addresses[_a]) += std::get<0>(addresses[myAddress]); } + virtual bytes const& codeAt(Address _a) override { return exists(_a) ? std::get<3>(addresses[_a]) : defaultCode; } + virtual size_t codeSizeAt(Address _a) override { return codeAt(_a).size(); } virtual std::pair create(u256 _endowment, u256& io_gas, bytesConstRef _init, eth::Instruction _op, u256 _salt, eth::OnOpFunc const&) override; virtual std::pair call(eth::CallParameters&) override; virtual h256 blockHash(u256 _number) override; @@ -81,6 +81,7 @@ class FakeExtVM: public eth::ExtVMFace std::map, bytes>> addresses; eth::Transactions callcreates; + bytes defaultCode; bytes thisTxData; bytes thisTxCode; u256 gas;