diff options
author | Christoph Jentzsch <jentzsch.software@gmail.com> | 2014-11-06 16:43:33 +0800 |
---|---|---|
committer | Christoph Jentzsch <jentzsch.software@gmail.com> | 2014-11-06 16:43:33 +0800 |
commit | 85ded720149de0ba977c89e9711eeb2da19dd763 (patch) | |
tree | d00c09e9c63c4bb896ea113dcb2a709ec8c4b0f8 /vm.cpp | |
parent | 74f4b33d6a98efccb71a01eb8f0aa049c5e882d5 (diff) | |
parent | 988ca7b6fcaf12c988f9ec489b9037efdc1fb4d4 (diff) | |
download | dexon-solidity-85ded720149de0ba977c89e9711eeb2da19dd763.tar.gz dexon-solidity-85ded720149de0ba977c89e9711eeb2da19dd763.tar.zst dexon-solidity-85ded720149de0ba977c89e9711eeb2da19dd763.zip |
Merge branch 'stateTests' into NewStateTests
Conflicts:
test/TestHelper.cpp
test/vm.cpp
Diffstat (limited to 'vm.cpp')
-rw-r--r-- | vm.cpp | 42 |
1 files changed, 9 insertions, 33 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); } } @@ -437,16 +423,6 @@ BOOST_AUTO_TEST_CASE(vmPushDupSwapTest) dev::test::executeTests("vmPushDupSwapTest", "/VMTests", dev::test::doVMTests); } -BOOST_AUTO_TEST_CASE(vmNamecoin) -{ - dev::test::executeTests("vmNamecoin", "/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) |