mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge remote-tracking branch 'upstream/develop' into stateTests
Conflicts: test/state.cpp test/vm.cpp
This commit is contained in:
commit
26f4637205
14
crypto.cpp
14
crypto.cpp
@ -339,16 +339,11 @@ BOOST_AUTO_TEST_CASE(eth_keypairs)
|
||||
BOOST_REQUIRE(p.pub() == Public(fromHex("97466f2b32bc3bb76d4741ae51cd1d8578b48d3f1e68da206d47321aec267ce78549b514e4453d74ef11b0cd5e4e4c364effddac8b51bcfc8de80682f952896f")));
|
||||
BOOST_REQUIRE(p.address() == Address(fromHex("8a40bfaa73256b60764c1bf40675a99083efb075")));
|
||||
{
|
||||
eth::Transaction t;
|
||||
t.nonce = 0;
|
||||
t.type = eth::Transaction::MessageCall;
|
||||
t.receiveAddress = h160(fromHex("944400f4b88ac9589a0f17ed4671da26bddb668b"));
|
||||
t.value = 1000;
|
||||
eth::Transaction t(1000, 0, 0, h160(fromHex("944400f4b88ac9589a0f17ed4671da26bddb668b")), bytes(), 0, p.secret());
|
||||
auto rlp = t.rlp(false);
|
||||
cnote << RLP(rlp);
|
||||
cnote << toHex(rlp);
|
||||
cnote << t.sha3(false);
|
||||
t.sign(p.secret());
|
||||
rlp = t.rlp(true);
|
||||
cnote << RLP(rlp);
|
||||
cnote << toHex(rlp);
|
||||
@ -368,16 +363,11 @@ int cryptoTest()
|
||||
assert(p.pub() == Public(fromHex("97466f2b32bc3bb76d4741ae51cd1d8578b48d3f1e68da206d47321aec267ce78549b514e4453d74ef11b0cd5e4e4c364effddac8b51bcfc8de80682f952896f")));
|
||||
assert(p.address() == Address(fromHex("8a40bfaa73256b60764c1bf40675a99083efb075")));
|
||||
{
|
||||
eth::Transaction t;
|
||||
t.nonce = 0;
|
||||
t.type = eth::Transaction::MessageCall;
|
||||
t.receiveAddress = h160(fromHex("944400f4b88ac9589a0f17ed4671da26bddb668b"));
|
||||
t.value = 1000;
|
||||
eth::Transaction t(1000, 0, 0, h160(fromHex("944400f4b88ac9589a0f17ed4671da26bddb668b")), bytes(), 0, p.secret());
|
||||
auto rlp = t.rlp(false);
|
||||
cnote << RLP(rlp);
|
||||
cnote << toHex(rlp);
|
||||
cnote << t.sha3(false);
|
||||
t.sign(p.secret());
|
||||
rlp = t.rlp(true);
|
||||
cnote << RLP(rlp);
|
||||
cnote << toHex(rlp);
|
||||
|
@ -211,7 +211,15 @@ BOOST_AUTO_TEST_CASE(else_if_statement)
|
||||
BOOST_CHECK_NO_THROW(parseText(text));
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(statement_starting_with_type_conversion)
|
||||
{
|
||||
char const* text = "contract test {\n"
|
||||
" function fun() {\n"
|
||||
" uint64(2);\n"
|
||||
" }\n"
|
||||
"}\n";
|
||||
BOOST_CHECK_NO_THROW(parseText(text));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
|
32
vm.cpp
32
vm.cpp
@ -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.type() == Transaction::ContractCreation ? "" : 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) :
|
||||
Transaction(toInt(tx["value"]), 0, toInt(tx["gasLimit"]), Address(tx["destination"].get_str()), data);
|
||||
callcreates.push_back(t);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user