mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge branch 'develop' into mk_jsonrpc
Conflicts: alethzero/MainWin.cpp alethzero/MainWin.h libqethereum/QEthereum.cpp libqethereum/QEthereum.h third/MainWin.cpp third/MainWin.h
This commit is contained in:
commit
f87714cf23
@ -437,12 +437,12 @@ MemTrie::~MemTrie()
|
||||
|
||||
h256 MemTrie::hash256() const
|
||||
{
|
||||
return m_root ? m_root->hash256() : h256();
|
||||
return m_root ? m_root->hash256() : sha3(dev::rlp(bytesConstRef()));
|
||||
}
|
||||
|
||||
bytes MemTrie::rlp() const
|
||||
{
|
||||
return m_root ? m_root->rlp() : bytes();
|
||||
return m_root ? m_root->rlp() : dev::rlp(bytesConstRef());
|
||||
}
|
||||
|
||||
void MemTrie::debugPrint()
|
||||
|
@ -162,7 +162,7 @@ h256 hash256(StringMap const& _s)
|
||||
{
|
||||
// build patricia tree.
|
||||
if (_s.empty())
|
||||
return h256();
|
||||
return sha3(rlp(""));
|
||||
HexMap hexMap;
|
||||
for (auto i = _s.rbegin(); i != _s.rend(); ++i)
|
||||
hexMap[asNibbles(i->first)] = i->second;
|
||||
@ -175,7 +175,7 @@ bytes rlp256(StringMap const& _s)
|
||||
{
|
||||
// build patricia tree.
|
||||
if (_s.empty())
|
||||
return bytes();
|
||||
return rlp("");
|
||||
HexMap hexMap;
|
||||
for (auto i = _s.rbegin(); i != _s.rend(); ++i)
|
||||
hexMap[asNibbles(i->first)] = i->second;
|
||||
@ -188,7 +188,7 @@ h256 hash256(u256Map const& _s)
|
||||
{
|
||||
// build patricia tree.
|
||||
if (_s.empty())
|
||||
return h256();
|
||||
return sha3(rlp(""));
|
||||
HexMap hexMap;
|
||||
for (auto i = _s.rbegin(); i != _s.rend(); ++i)
|
||||
hexMap[asNibbles(toBigEndianString(i->first))] = asString(rlp(i->second));
|
||||
|
@ -341,6 +341,7 @@ BOOST_AUTO_TEST_CASE(eth_keypairs)
|
||||
{
|
||||
eth::Transaction t;
|
||||
t.nonce = 0;
|
||||
t.type = eth::Transaction::MessageCall;
|
||||
t.receiveAddress = h160(fromHex("944400f4b88ac9589a0f17ed4671da26bddb668b"));
|
||||
t.value = 1000;
|
||||
auto rlp = t.rlp(false);
|
||||
@ -369,6 +370,7 @@ int cryptoTest()
|
||||
{
|
||||
eth::Transaction t;
|
||||
t.nonce = 0;
|
||||
t.type = eth::Transaction::MessageCall;
|
||||
t.receiveAddress = h160(fromHex("944400f4b88ac9589a0f17ed4671da26bddb668b"));
|
||||
t.value = 1000;
|
||||
auto rlp = t.rlp(false);
|
||||
@ -397,6 +399,7 @@ int cryptoTest()
|
||||
Transaction t;
|
||||
t.nonce = 0;
|
||||
t.value = 1; // 1 wei.
|
||||
t.type = eth::Transaction::MessageCall;
|
||||
t.receiveAddress = toAddress(sha3("123"));
|
||||
|
||||
bytes sig64 = toBigEndian(t.vrs.r) + toBigEndian(t.vrs.s);
|
||||
|
@ -68,6 +68,7 @@ int stateTest()
|
||||
Transaction t;
|
||||
t.nonce = s.transactionsFrom(myMiner.address());
|
||||
t.value = 1000; // 1e3 wei.
|
||||
t.type = eth::Transaction::MessageCall;
|
||||
t.receiveAddress = me.address();
|
||||
t.sign(myMiner.secret());
|
||||
assert(t.sender() == myMiner.address());
|
||||
|
7
vm.cpp
7
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"]);
|
||||
|
Loading…
Reference in New Issue
Block a user