aboutsummaryrefslogtreecommitdiffstats
path: root/vm.cpp
diff options
context:
space:
mode:
authorGav Wood <i@gavwood.com>2014-10-27 21:13:16 +0800
committerGav Wood <i@gavwood.com>2014-10-27 21:13:16 +0800
commited7a56cc16ad28601d2d6546615a1d1feb5ce527 (patch)
tree08c190587c8203de0a33004ab9f916c72989d080 /vm.cpp
parent08c45c85b49edad8451a03df4a31363f216db97c (diff)
downloaddexon-solidity-ed7a56cc16ad28601d2d6546615a1d1feb5ce527.tar.gz
dexon-solidity-ed7a56cc16ad28601d2d6546615a1d1feb5ce527.tar.zst
dexon-solidity-ed7a56cc16ad28601d2d6546615a1d1feb5ce527.zip
PoC-7: Reversion of 0-hashes, empty-list hashes and sha3('') -> ''
Diffstat (limited to 'vm.cpp')
-rw-r--r--vm.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/vm.cpp b/vm.cpp
index 2e4571be..b49c5cd2 100644
--- a/vm.cpp
+++ b/vm.cpp
@@ -56,14 +56,13 @@ h160 FakeExtVM::create(u256 _endowment, u256* _gas, bytesConstRef _init, OnOpFun
get<3>(addresses[ret]) = m_s.code(ret);
}
- t.receiveAddress = ret;
+ t.type = eth::Transaction::ContractCreation;
callcreates.push_back(t);
return ret;
}
bool FakeExtVM::call(Address _receiveAddress, u256 _value, bytesConstRef _data, u256* _gas, bytesRef _out, OnOpFunc const&, Address _myAddressOverride, Address _codeAddressOverride)
{
-
u256 contractgas = 0xffff;
Transaction t;
@@ -71,6 +70,7 @@ bool FakeExtVM::call(Address _receiveAddress, u256 _value, bytesConstRef _data,
t.gasPrice = gasPrice;
t.gas = *_gas;
t.data = _data.toVector();
+ t.type = eth::Transaction::MessageCall;
t.receiveAddress = _receiveAddress;
callcreates.push_back(t);
@@ -384,7 +384,7 @@ mArray FakeExtVM::exportCallCreates()
for (Transaction const& tx: callcreates)
{
mObject o;
- o["destination"] = toString(tx.receiveAddress);
+ 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);
@@ -403,6 +403,7 @@ void FakeExtVM::importCallCreates(mArray& _callcreates)
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"]);