Skip to content

Commit

Permalink
support tr data "" == "0x"
Browse files Browse the repository at this point in the history
support int and "int" in eth_getTransactionCount
  • Loading branch information
winsvega committed Feb 4, 2020
1 parent 6d37c10 commit 453e1b7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion retesteth/RPCSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,8 @@ int RPCSession::eth_getTransactionCount(
std::string const& _address, std::string const& _blockNumber)
{
DataObject res = rpcCall("eth_getTransactionCount", {quote(_address), quote(_blockNumber)});
return (res.type() == DataType::String) ? (int)u256(dev::fromHex(res.asString())) : res.asInt();
return (res.type() == DataType::String) ? test::hexOrDecStringToInt(res.asString()) :
res.asInt();
}

string RPCSession::eth_getBalance(string const& _address, string const& _blockNumber)
Expand Down
6 changes: 6 additions & 0 deletions retesteth/testSuites/blockchain/BlockchainTestLogic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,13 @@ void RunTest(DataObject const& _testObject, TestSuite::TestSuiteOptions const& _
string const& aField, string const& bField, size_t length = 1) {
bool condition = true;
if (length == 0) // skip conversion
{
condition = tr.atKey(aField).asString() == testTr.atKey(bField).asString();
// transaction data returned by aleth is "" instead of "0x" in blockchain
// tests
condition = condition || "0x" + tr.atKey(aField).asString() ==
testTr.atKey(bField).asString();
}
else
condition =
dev::toCompactHexPrefixed(dev::u256(tr.atKey(aField).asString()),
Expand Down

0 comments on commit 453e1b7

Please sign in to comment.