aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-04-20 20:55:58 +0800
committerchriseth <c@ethdev.com>2015-04-20 20:55:58 +0800
commit8caf1f723ffe9c8592e995f6e82571fbe2185fd0 (patch)
treebbcd407e41e4bfd4809e576ff355003f799eeb7c
parent6b08b99b5ef319837f9293cca6fd74803fe4688d (diff)
parent71012a83e86dac3a899780219a78f18acd1708c5 (diff)
downloaddexon-solidity-8caf1f723ffe9c8592e995f6e82571fbe2185fd0.tar
dexon-solidity-8caf1f723ffe9c8592e995f6e82571fbe2185fd0.tar.gz
dexon-solidity-8caf1f723ffe9c8592e995f6e82571fbe2185fd0.tar.bz2
dexon-solidity-8caf1f723ffe9c8592e995f6e82571fbe2185fd0.tar.lz
dexon-solidity-8caf1f723ffe9c8592e995f6e82571fbe2185fd0.tar.xz
dexon-solidity-8caf1f723ffe9c8592e995f6e82571fbe2185fd0.tar.zst
dexon-solidity-8caf1f723ffe9c8592e995f6e82571fbe2185fd0.zip
Merge remote-tracking branch 'ethereum/develop' into sol_overloadingFunctions
Conflicts: libsolidity/AST.cpp libsolidity/AST.h
-rw-r--r--SolidityNameAndTypeResolution.cpp37
-rw-r--r--TestHelper.cpp8
-rw-r--r--blockchain.cpp10
-rw-r--r--stateOriginal.cpp4
-rw-r--r--webthreestubclient.h3
5 files changed, 48 insertions, 14 deletions
diff --git a/SolidityNameAndTypeResolution.cpp b/SolidityNameAndTypeResolution.cpp
index fdbe46d0..6bb21005 100644
--- a/SolidityNameAndTypeResolution.cpp
+++ b/SolidityNameAndTypeResolution.cpp
@@ -407,6 +407,39 @@ BOOST_AUTO_TEST_CASE(create_abstract_contract)
BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError);
}
+BOOST_AUTO_TEST_CASE(abstract_contract_constructor_args_optional)
+{
+ ASTPointer<SourceUnit> sourceUnit;
+ char const* text = R"(
+ contract BaseBase { function BaseBase(uint j); }
+ contract base is BaseBase { function foo(); }
+ contract derived is base {
+ function derived(uint i) BaseBase(i){}
+ function foo() {}
+ }
+ )";
+ ETH_TEST_REQUIRE_NO_THROW(parseTextAndResolveNames(text), "Parsing and name resolving failed");
+}
+
+BOOST_AUTO_TEST_CASE(abstract_contract_constructor_args_not_provided)
+{
+ ASTPointer<SourceUnit> sourceUnit;
+ char const* text = R"(
+ contract BaseBase { function BaseBase(uint j); }
+ contract base is BaseBase { function foo(); }
+ contract derived is base {
+ function derived(uint i) {}
+ function foo() {}
+ }
+ )";
+ ETH_TEST_REQUIRE_NO_THROW(sourceUnit = parseTextAndResolveNames(text), "Parsing and name resolving failed");
+ std::vector<ASTPointer<ASTNode>> nodes = sourceUnit->getNodes();
+ BOOST_CHECK_EQUAL(nodes.size(), 3);
+ ContractDefinition* derived = dynamic_cast<ContractDefinition*>(nodes[2].get());
+ BOOST_CHECK(derived);
+ BOOST_CHECK(!derived->isFullyImplemented());
+}
+
BOOST_AUTO_TEST_CASE(redeclare_implemented_abstract_function_as_abstract)
{
ASTPointer<SourceUnit> sourceUnit;
@@ -665,7 +698,7 @@ BOOST_AUTO_TEST_CASE(missing_base_constructor_arguments)
contract A { function A(uint a) { } }
contract B is A { }
)";
- BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError);
+ ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed");
}
BOOST_AUTO_TEST_CASE(base_constructor_arguments_override)
@@ -674,7 +707,7 @@ BOOST_AUTO_TEST_CASE(base_constructor_arguments_override)
contract A { function A(uint a) { } }
contract B is A { }
)";
- BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError);
+ ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed");
}
BOOST_AUTO_TEST_CASE(implicit_derived_to_base_conversion)
diff --git a/TestHelper.cpp b/TestHelper.cpp
index 92a8258a..ed844e96 100644
--- a/TestHelper.cpp
+++ b/TestHelper.cpp
@@ -123,7 +123,7 @@ json_spirit::mObject& ImportTest::makeAllFieldsHex(json_spirit::mObject& _o)
{
static const set<string> hashes {"bloom" , "coinbase", "hash", "mixHash", "parentHash", "receiptTrie",
"stateRoot", "transactionsTrie", "uncleHash", "currentCoinbase",
- "previousHash", "to", "address", "caller", "origin", "secretKey"};
+ "previousHash", "to", "address", "caller", "origin", "secretKey", "data"};
for (auto& i: _o)
{
@@ -140,7 +140,7 @@ json_spirit::mObject& ImportTest::makeAllFieldsHex(json_spirit::mObject& _o)
str = value.get_str();
else continue;
- _o[key] = (str.substr(0, 2) == "0x") ? str : "0x" + toHex(toCompactBigEndian(toInt(str)));
+ _o[key] = (str.substr(0, 2) == "0x") ? str : "0x" + toHex(toCompactBigEndian(toInt(str), 1));
}
return _o;
}
@@ -363,8 +363,8 @@ json_spirit::mObject fillJsonWithState(State _state)
for (auto const& a: _state.addresses())
{
json_spirit::mObject o;
- o["balance"] = "0x" + toHex(toCompactBigEndian(_state.balance(a.first)));
- o["nonce"] = "0x" + toHex(toCompactBigEndian(_state.transactionsFrom(a.first)));
+ o["balance"] = "0x" + toHex(toCompactBigEndian(_state.balance(a.first), 1));
+ o["nonce"] = "0x" + toHex(toCompactBigEndian(_state.transactionsFrom(a.first), 1));
{
json_spirit::mObject store;
for (auto const& s: _state.storage(a.first))
diff --git a/blockchain.cpp b/blockchain.cpp
index b144abe6..ec8fb753 100644
--- a/blockchain.cpp
+++ b/blockchain.cpp
@@ -625,11 +625,11 @@ void writeBlockHeaderToJson(mObject& _o, BlockInfo const& _bi)
_o["transactionsTrie"] = toString(_bi.transactionsRoot);
_o["receiptTrie"] = toString(_bi.receiptsRoot);
_o["bloom"] = toString(_bi.logBloom);
- _o["difficulty"] = "0x" + toHex(toCompactBigEndian(_bi.difficulty));
- _o["number"] = "0x" + toHex(toCompactBigEndian(_bi.number));
- _o["gasLimit"] = "0x" + toHex(toCompactBigEndian(_bi.gasLimit));
- _o["gasUsed"] = "0x" + toHex(toCompactBigEndian(_bi.gasUsed));
- _o["timestamp"] = "0x" + toHex(toCompactBigEndian(_bi.timestamp));
+ _o["difficulty"] = "0x" + toHex(toCompactBigEndian(_bi.difficulty), 1);
+ _o["number"] = "0x" + toHex(toCompactBigEndian(_bi.number), 1);
+ _o["gasLimit"] = "0x" + toHex(toCompactBigEndian(_bi.gasLimit), 1);
+ _o["gasUsed"] = "0x" + toHex(toCompactBigEndian(_bi.gasUsed), 1);
+ _o["timestamp"] = "0x" + toHex(toCompactBigEndian(_bi.timestamp), 1);
_o["extraData"] ="0x" + toHex(_bi.extraData);
_o["mixHash"] = toString(_bi.mixHash);
_o["nonce"] = toString(_bi.nonce);
diff --git a/stateOriginal.cpp b/stateOriginal.cpp
index e1a3c7c4..7f337148 100644
--- a/stateOriginal.cpp
+++ b/stateOriginal.cpp
@@ -60,7 +60,7 @@ BOOST_AUTO_TEST_CASE(Complex)
CanonBlockChain bc;
cout << bc;
- State s(stateDB, BaseState::Empty, myMiner.address());
+ State s(stateDB, BaseState::CanonGenesis, myMiner.address());
cout << s;
// Sync up - this won't do much until we use the last state.
@@ -80,7 +80,7 @@ BOOST_AUTO_TEST_CASE(Complex)
cout << s;
// Inject a transaction to transfer funds from miner to me.
- Transaction t(1000, 10000, 10000, me.address(), bytes(), s.transactionsFrom(myMiner.address()), myMiner.secret());
+ Transaction t(1000, 10000, 100000, me.address(), bytes(), s.transactionsFrom(myMiner.address()), myMiner.secret());
assert(t.sender() == myMiner.address());
s.execute(bc.lastHashes(), t);
diff --git a/webthreestubclient.h b/webthreestubclient.h
index c1fdc341..fd71bfb5 100644
--- a/webthreestubclient.h
+++ b/webthreestubclient.h
@@ -434,11 +434,12 @@ class WebThreeStubClient : public jsonrpc::Client
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- bool eth_submitWork(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
+ bool eth_submitWork(const std::string& param1, const std::string& param2, const std::string& param3) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
p.append(param2);
+ p.append(param3);
Json::Value result = this->CallMethod("eth_submitWork",p);
if (result.isBool())
return result.asBool();