diff options
author | Christoph Jentzsch <jentzsch.software@gmail.com> | 2014-11-07 20:42:44 +0800 |
---|---|---|
committer | Christoph Jentzsch <jentzsch.software@gmail.com> | 2014-11-07 20:42:44 +0800 |
commit | f88f5a7702e0ede7603332f4d31d701b7d0d715b (patch) | |
tree | 456a5633b674877a16a8b320f30e771322b921c1 /vm.cpp | |
parent | 8220213b21fb57a8449f14be478289069d62ed1c (diff) | |
parent | 8eb6675bc69258163a25a9518b76c3176e378121 (diff) | |
download | dexon-solidity-f88f5a7702e0ede7603332f4d31d701b7d0d715b.tar.gz dexon-solidity-f88f5a7702e0ede7603332f4d31d701b7d0d715b.tar.zst dexon-solidity-f88f5a7702e0ede7603332f4d31d701b7d0d715b.zip |
Merge remote-tracking branch 'upstream/develop' into StateBug
Diffstat (limited to 'vm.cpp')
-rw-r--r-- | vm.cpp | 50 |
1 files changed, 13 insertions, 37 deletions
@@ -35,25 +35,14 @@ h160 FakeExtVM::create(u256 _endowment, u256* _gas, bytesConstRef _init, OnOpFun { Address na = right160(sha3(rlpList(myAddress, get<1>(addresses[myAddress])))); - Transaction t; - t.value = _endowment; - t.gasPrice = gasPrice; - t.gas = *_gas; - t.data = _init.toBytes(); - t.type = eth::Transaction::ContractCreation; + Transaction t(_endowment, gasPrice, *_gas, _init.toBytes()); callcreates.push_back(t); return na; } bool FakeExtVM::call(Address _receiveAddress, u256 _value, bytesConstRef _data, u256* _gas, bytesRef _out, OnOpFunc const&, Address _myAddressOverride, Address _codeAddressOverride) { - Transaction t; - t.value = _value; - t.gasPrice = gasPrice; - t.gas = *_gas; - t.data = _data.toVector(); - t.type = eth::Transaction::MessageCall; - t.receiveAddress = _receiveAddress; + Transaction t(_value, gasPrice, *_gas, _receiveAddress, _data.toVector()); callcreates.push_back(t); (void)_out; (void)_myAddressOverride; @@ -224,10 +213,10 @@ mArray FakeExtVM::exportCallCreates() for (Transaction const& tx: callcreates) { mObject o; - o["destination"] = tx.type == Transaction::ContractCreation ? "" : toString(tx.receiveAddress); - push(o, "gasLimit", tx.gas); - push(o, "value", tx.value); - o["data"] = "0x" + toHex(tx.data); + o["destination"] = tx.isCreation() ? "" : toString(tx.receiveAddress()); + push(o, "gasLimit", tx.gas()); + push(o, "value", tx.value()); + o["data"] = "0x" + toHex(tx.data()); ret.push_back(o); } return ret; @@ -242,12 +231,9 @@ void FakeExtVM::importCallCreates(mArray& _callcreates) BOOST_REQUIRE(tx.count("value") > 0); BOOST_REQUIRE(tx.count("destination") > 0); BOOST_REQUIRE(tx.count("gasLimit") > 0); - Transaction t; - t.type = tx["destination"].get_str().empty() ? Transaction::ContractCreation : Transaction::MessageCall; - t.receiveAddress = Address(tx["destination"].get_str()); - t.value = toInt(tx["value"]); - t.gas = toInt(tx["gasLimit"]); - t.data = importData(tx); + Transaction t = tx["destination"].get_str().empty() ? + Transaction(toInt(tx["value"]), 0, toInt(tx["gasLimit"]), data.toBytes()) : + Transaction(toInt(tx["value"]), 0, toInt(tx["gasLimit"]), Address(tx["destination"].get_str()), data.toBytes()); callcreates.push_back(t); } } @@ -427,26 +413,16 @@ BOOST_AUTO_TEST_CASE(vmBlockInfoTest) dev::test::executeTests("vmBlockInfoTest", "/VMTests", dev::test::doVMTests); } -//BOOST_AUTO_TEST_CASE(vmIOandFlowOperationsTest) -//{ -// dev::test::executeTests("vmIOandFlowOperationsTest", "/VMTests", dev::test::doVMTests); -//} - -BOOST_AUTO_TEST_CASE(vmPushDupSwapTest) +BOOST_AUTO_TEST_CASE(vmIOandFlowOperationsTest) { - dev::test::executeTests("vmPushDupSwapTest", "/VMTests", dev::test::doVMTests); + dev::test::executeTests("vmIOandFlowOperationsTest", "/VMTests", dev::test::doVMTests); } -BOOST_AUTO_TEST_CASE(vmNamecoin) +BOOST_AUTO_TEST_CASE(vmPushDupSwapTest) { - dev::test::executeTests("vmNamecoin", "/VMTests", dev::test::doVMTests); + dev::test::executeTests("vmPushDupSwapTest", "/VMTests", dev::test::doVMTests); } -//BOOST_AUTO_TEST_CASE(vmSystemOperationsTest) -//{ -// dev::test::executeTests("vmSystemOperationsTest", "/VMTests", dev::test::doVMTests); -//} - BOOST_AUTO_TEST_CASE(userDefinedFile) { if (boost::unit_test::framework::master_test_suite().argc == 2) |