Skip to content
This repository has been archived by the owner on Oct 28, 2021. It is now read-only.

Commit

Permalink
Merge pull request #5734 from ethereum/debug-account-range
Browse files Browse the repository at this point in the history
Rename debug_accountRangeAt into debug_accountRange
  • Loading branch information
gumb0 authored Sep 3, 2019
2 parents 8d31fd3 + 4c6a27f commit 2fd5c08
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
- Changed: [#5676](https://github.com/ethereum/aleth/pull/5676) When receiving large batches of new block hashes, process up to 1024 hashes instead of disabling the peer.
- Changed: [#5719](https://github.com/ethereum/aleth/pull/5719) Enable support for Visual Studio 2017 on Windows.
- Changed: [#5713](https://github.com/ethereum/aleth/pull/5713) Propagate new blocks after PoW check rather than after import into the blockchain.
- Changed: [#5734](https://github.com/ethereum/aleth/pull/5734) debug_accountRangeAt RPC method is renamed to debug_accountRange to conform with geth and retesteth requirements.
- Removed: [#5631](https://github.com/ethereum/aleth/pull/5631) Removed PARANOID build option.
- Fixed: [#5562](https://github.com/ethereum/aleth/pull/5562) Don't send header request messages to peers that haven't sent us Status yet.
- Fixed: [#5581](https://github.com/ethereum/aleth/pull/5581) Fixed finding neighbour nodes in Discovery.
Expand Down
2 changes: 1 addition & 1 deletion libweb3jsonrpc/Debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ Json::Value Debug::debug_traceBlockByNumber(int _blockNumber, Json::Value const&
return ret;
}

Json::Value Debug::debug_accountRangeAt(
Json::Value Debug::debug_accountRange(
string const& _blockHashOrNumber, int _txIndex, string const& _addressHash, int _maxResults)
{
Json::Value ret(Json::objectValue);
Expand Down
2 changes: 1 addition & 1 deletion libweb3jsonrpc/Debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Debug: public DebugFace
return RPCModules{RPCModule{"debug", "1.0"}};
}

virtual Json::Value debug_accountRangeAt(std::string const& _blockHashOrNumber, int _txIndex,
virtual Json::Value debug_accountRange(std::string const& _blockHashOrNumber, int _txIndex,
std::string const& _addressHash, int _maxResults) override;
virtual Json::Value debug_traceTransaction(std::string const& _txHash, Json::Value const& _json) override;
virtual Json::Value debug_traceCall(Json::Value const& _call, std::string const& _blockNumber, Json::Value const& _options) override;
Expand Down
8 changes: 4 additions & 4 deletions libweb3jsonrpc/DebugFace.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ namespace dev {
public:
DebugFace()
{
this->bindAndAddMethod(jsonrpc::Procedure("debug_accountRangeAt", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_INTEGER,"param3",jsonrpc::JSON_STRING,"param4",jsonrpc::JSON_INTEGER, NULL), &dev::rpc::DebugFace::debug_accountRangeAtI);
this->bindAndAddMethod(jsonrpc::Procedure("debug_accountRange", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_INTEGER,"param3",jsonrpc::JSON_STRING,"param4",jsonrpc::JSON_INTEGER, NULL), &dev::rpc::DebugFace::debug_accountRangeI);
this->bindAndAddMethod(jsonrpc::Procedure("debug_traceTransaction", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_OBJECT, NULL), &dev::rpc::DebugFace::debug_traceTransactionI);
this->bindAndAddMethod(jsonrpc::Procedure("debug_storageRangeAt", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_INTEGER,"param3",jsonrpc::JSON_STRING,"param4",jsonrpc::JSON_STRING,"param5",jsonrpc::JSON_INTEGER, NULL), &dev::rpc::DebugFace::debug_storageRangeAtI);
this->bindAndAddMethod(jsonrpc::Procedure("debug_preimage", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_STRING, NULL), &dev::rpc::DebugFace::debug_preimageI);
this->bindAndAddMethod(jsonrpc::Procedure("debug_traceBlockByNumber", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_INTEGER,"param2",jsonrpc::JSON_OBJECT, NULL), &dev::rpc::DebugFace::debug_traceBlockByNumberI);
this->bindAndAddMethod(jsonrpc::Procedure("debug_traceBlockByHash", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_OBJECT, NULL), &dev::rpc::DebugFace::debug_traceBlockByHashI);
this->bindAndAddMethod(jsonrpc::Procedure("debug_traceCall", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_OBJECT,"param2",jsonrpc::JSON_STRING,"param3",jsonrpc::JSON_OBJECT, NULL), &dev::rpc::DebugFace::debug_traceCallI);
}
inline virtual void debug_accountRangeAtI(const Json::Value &request, Json::Value &response)
inline virtual void debug_accountRangeI(const Json::Value &request, Json::Value &response)
{
response = this->debug_accountRangeAt(request[0u].asString(), request[1u].asInt(), request[2u].asString(), request[3u].asInt());
response = this->debug_accountRange(request[0u].asString(), request[1u].asInt(), request[2u].asString(), request[3u].asInt());
}
inline virtual void debug_traceTransactionI(const Json::Value &request, Json::Value &response)
{
Expand All @@ -50,7 +50,7 @@ namespace dev {
{
response = this->debug_traceCall(request[0u], request[1u].asString(), request[2u]);
}
virtual Json::Value debug_accountRangeAt(const std::string& param1, int param2, const std::string& param3, int param4) = 0;
virtual Json::Value debug_accountRange(const std::string& param1, int param2, const std::string& param3, int param4) = 0;
virtual Json::Value debug_traceTransaction(const std::string& param1, const Json::Value& param2) = 0;
virtual Json::Value debug_storageRangeAt(const std::string& param1, int param2, const std::string& param3, const std::string& param4, int param5) = 0;
virtual std::string debug_preimage(const std::string& param1) = 0;
Expand Down
2 changes: 1 addition & 1 deletion libweb3jsonrpc/debug.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[
{ "name": "debug_accountRangeAt", "params": ["", 0, "", 0], "returns": {}},
{ "name": "debug_accountRange", "params": ["", 0, "", 0], "returns": {}},
{ "name": "debug_traceTransaction", "params": ["", {}], "returns": {}},
{ "name": "debug_storageRangeAt", "params": ["", 0, "", "", 0], "returns": {}},
{ "name": "debug_preimage", "params": [""], "returns": ""},
Expand Down
4 changes: 2 additions & 2 deletions test/unittests/libweb3jsonrpc/WebThreeStubClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -959,14 +959,14 @@ class WebThreeStubClient : public jsonrpc::Client
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
Json::Value debug_accountRangeAt(const std::string& param1, int param2, const std::string& param3, int param4) throw (jsonrpc::JsonRpcException)
Json::Value debug_accountRange(const std::string& param1, int param2, const std::string& param3, int param4) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
p.append(param2);
p.append(param3);
p.append(param4);
Json::Value result = this->CallMethod("debug_accountRangeAt", p);
Json::Value result = this->CallMethod("debug_accountRange", p);
if (result.isObject())
return result;
else
Expand Down
6 changes: 3 additions & 3 deletions test/unittests/libweb3jsonrpc/jsonrpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ BOOST_AUTO_TEST_CASE(web3_sha3)
BOOST_CHECK_EQUAL("0xc6888fa159d67f77c2f3d7a402e199802766bd7e8d4d1ecd2274fc920265d56a", result);
}

BOOST_AUTO_TEST_CASE(debugAccountRangeAtFinalBlockState)
BOOST_AUTO_TEST_CASE(debugAccountRangeFinalBlockState)
{
// mine to get some balance at coinbase
dev::eth::mine(*(web3->ethereum()), 1);
Expand All @@ -617,11 +617,11 @@ BOOST_AUTO_TEST_CASE(debugAccountRangeAtFinalBlockState)
string receiverHash = toString(sha3(receiver));

// receiver doesn't exist in the beginning of the 2nd block
Json::Value result = rpcClient->debug_accountRangeAt("2", 0, "0", 100);
Json::Value result = rpcClient->debug_accountRange("2", 0, "0", 100);
BOOST_CHECK(!result["addressMap"].isMember(receiverHash));

// receiver exists in the end of the 2nd block
result = rpcClient->debug_accountRangeAt("2", 1, "0", 100);
result = rpcClient->debug_accountRange("2", 1, "0", 100);
BOOST_CHECK(result["addressMap"].isMember(receiverHash));
BOOST_CHECK_EQUAL(result["addressMap"][receiverHash], toString(receiver));
}
Expand Down

0 comments on commit 2fd5c08

Please sign in to comment.