From d1193b03eb91e0246aa974e171937aff50596c9c Mon Sep 17 00:00:00 2001 From: Peng Wang Date: Mon, 11 Nov 2019 10:48:51 -0500 Subject: [PATCH 1/7] unit tests work --- CMakeLists.txt | 3 + src/ripple/app/main/Application.cpp | 4 +- src/ripple/app/main/Main.cpp | 17 ++ src/ripple/net/impl/RPCCall.cpp | 19 +- src/ripple/protocol/jss.h | 2 + src/ripple/rpc/Context.h | 1 + src/ripple/rpc/RPCHandler.h | 2 +- src/ripple/rpc/handlers/Version.h | 14 + src/ripple/rpc/impl/Handler.cpp | 83 ++++-- src/ripple/rpc/impl/Handler.h | 2 +- src/ripple/rpc/impl/RPCHandler.cpp | 6 +- src/ripple/rpc/impl/RPCHelpers.cpp | 18 ++ src/ripple/rpc/impl/RPCHelpers.h | 34 +++ src/ripple/rpc/impl/ServerHandlerImp.cpp | 77 ++++- src/test/app/Path_test.cpp | 7 +- src/test/rpc/RPCCall_test.cpp | 347 +++++++++++++++++++++-- 16 files changed, 580 insertions(+), 56 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 723d049e78e..999962d8fb1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,9 @@ cmake_minimum_required (VERSION 3.9.0) list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/Builds/CMake) +set (BOOST_ROOT /home/pwang/Install/boost_1_70_0) +set (BOOST_LIBRARYDIR /home/pwang/Install/boost_1_70_0) + set (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Builds/CMake ${CMAKE_MODULE_PATH}) include (CheckCXXCompilerFlag) if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.11) diff --git a/src/ripple/app/main/Application.cpp b/src/ripple/app/main/Application.cpp index 03daa5ba9a6..4fa147a4118 100644 --- a/src/ripple/app/main/Application.cpp +++ b/src/ripple/app/main/Application.cpp @@ -61,6 +61,7 @@ #include #include #include +#include #include #include @@ -1570,7 +1571,8 @@ bool ApplicationImp::setup() Resource::Charge loadType = Resource::feeReferenceRPC; Resource::Consumer c; RPC::Context context { journal ("RPCHandler"), jvCommand, *this, - loadType, getOPs (), getLedgerMaster (), c, Role::ADMIN}; + loadType, getOPs (), getLedgerMaster(), c, Role::ADMIN, + RPC::APIVersionRippledStartUp}; Json::Value jvResult; RPC::doCommand (context, jvResult); diff --git a/src/ripple/app/main/Main.cpp b/src/ripple/app/main/Main.cpp index 58827d22366..fb7016e5406 100644 --- a/src/ripple/app/main/Main.cpp +++ b/src/ripple/app/main/Main.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -629,6 +630,22 @@ int run (int argc, char** argv) config->rpc_ip = std::move(*endpoint); } +// auto rpc_version_number = RPC::APIVersionCommandLine; +// if (vm.count ("rpc_version")) +// { +// try +// { +// rpc_version_number = vm["rpc_version"].as(); +// if (rpc_version_number > RPC::APIVersionSupportedRangeHigh) +// throw std::domain_error(std::to_string(rpc_version_number)); +// } +// catch(std::exception const& e) +// { +// std::cerr << "Invalid rpc_version = " << e.what() << "\n"; +// return -1; +// } +// } + if (vm.count ("quorum")) { try diff --git a/src/ripple/net/impl/RPCCall.cpp b/src/ripple/net/impl/RPCCall.cpp index 0b27ae1b0d4..e0ee23968da 100644 --- a/src/ripple/net/impl/RPCCall.cpp +++ b/src/ripple/net/impl/RPCCall.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -1352,8 +1353,20 @@ rpcCmdLineToJson (std::vector const& args, retParams[jss::params] = jvRpcParams; jvRequest = rpParser.parseCommand (args[0], jvRpcParams, true); - + if(jvRequest.isObject()) + { + if(!jvRequest.isMember(jss::error)) + jvRequest["api_version"] = RPC::APIVersionCommandLine; + } + else if(jvRequest.isArray()) { + for (Json::UInt j = 0; j < jvRequest.size(); ++j) { + if (jvRequest[j].isObject()) + jvRequest[j]["api_version"] = RPC::APIVersionCommandLine; + } + } JLOG (j.trace()) << "RPC Request: " << jvRequest << std::endl; + //std::cout << "RPC Request: " << jvRequest << std::endl;//TODO Peng + return jvRequest; } @@ -1441,9 +1454,13 @@ rpcClient(std::vector const& args, jvRequest["admin_password"] = setup.client.admin_password; if (jvRequest.isObject()) + //{ + //jvRequest["api_version"] = RPC::APIVersionCommandLine; jvParams.append (jvRequest); + //} else if (jvRequest.isArray()) { + //jvParams.append(RPC::getAPIVersionString()); for (Json::UInt i = 0; i < jvRequest.size(); ++i) jvParams.append(jvRequest[i]); } diff --git a/src/ripple/protocol/jss.h b/src/ripple/protocol/jss.h index a6137027051..30e042f61b4 100644 --- a/src/ripple/protocol/jss.h +++ b/src/ripple/protocol/jss.h @@ -121,6 +121,8 @@ JSS ( alternatives ); // out: PathRequest, RipplePathFind JSS ( amendment_blocked ); // out: NetworkOPs JSS ( amendments ); // in: AccountObjects, out: NetworkOPs JSS ( amount ); // out: AccountChannels +JSS ( api_version); // in: many, out: Version +JSS ( api_version_low); // out: Version JSS ( asks ); // out: Subscribe JSS ( assets ); // out: GatewayBalances JSS ( authorized ); // out: AccountLines diff --git a/src/ripple/rpc/Context.h b/src/ripple/rpc/Context.h index 07e0da3f185..0590053a59c 100644 --- a/src/ripple/rpc/Context.h +++ b/src/ripple/rpc/Context.h @@ -55,6 +55,7 @@ struct Context LedgerMaster& ledgerMaster; Resource::Consumer& consumer; Role role; + unsigned apiVersion; std::shared_ptr coro {}; InfoSub::pointer infoSub {}; Headers headers {}; diff --git a/src/ripple/rpc/RPCHandler.h b/src/ripple/rpc/RPCHandler.h index 1dbcee49ff2..ffc6efc4ba2 100644 --- a/src/ripple/rpc/RPCHandler.h +++ b/src/ripple/rpc/RPCHandler.h @@ -33,7 +33,7 @@ struct Context; /** Execute an RPC command and store the results in a Json::Value. */ Status doCommand (RPC::Context&, Json::Value&); -Role roleRequired (std::string const& method ); +Role roleRequired (unsigned version, std::string const& method ); } // RPC } // ripple diff --git a/src/ripple/rpc/handlers/Version.h b/src/ripple/rpc/handlers/Version.h index 15916ec6d50..4a0e7aad7cd 100644 --- a/src/ripple/rpc/handlers/Version.h +++ b/src/ripple/rpc/handlers/Version.h @@ -57,6 +57,20 @@ class VersionHandler } }; +class VersionHandlerV2Plus: public VersionHandler +{ +public: + explicit VersionHandlerV2Plus (Context & c) + : VersionHandler(c) + {} + + template + void writeResult (Object& obj) + { + setVersionV2 (obj); + } +}; + } // RPC } // ripple diff --git a/src/ripple/rpc/impl/Handler.cpp b/src/ripple/rpc/impl/Handler.cpp index c0055957f38..a1a5f94acae 100644 --- a/src/ripple/rpc/impl/Handler.cpp +++ b/src/ripple/rpc/impl/Handler.cpp @@ -129,18 +129,26 @@ class HandlerTable { explicit HandlerTable (const Handler(&entries)[N]) { - for (std::size_t i = 0; i < N; ++i) + for(auto v = RPC::APIVersionSupportedRangeLow; v <= RPC::APIVersionSupportedRangeHigh; ++v) { - auto const& entry = entries[i]; - assert (table_.find(entry.name_) == table_.end()); - table_[entry.name_] = entry; + for (std::size_t i = 0; i < N; ++i) + { + auto & innerTable = table_[v - RPC::APIVersionSupportedRangeLow]; + auto const& entry = entries[i]; + assert (innerTable.find(entry.name_) == innerTable.end()); + innerTable[entry.name_] = entry; + } + + // This is where the new-style handlers are added. + addHandler(v); + + if(v == RPC::APIFirstVersion) + addHandler(v); + else + addHandler(v); } - - // This is where the new-style handlers are added. - addHandler(); - addHandler(); } - +//TODO remove RPC:: public: static HandlerTable const& instance() { @@ -148,29 +156,52 @@ class HandlerTable { return handlerTable; } - Handler const* getHandler(std::string name) const + Handler const* getHandler(unsigned version, std::string name) const { - auto i = table_.find(name); - return i == table_.end() ? nullptr : &i->second; + if(version > RPC::APIVersionSupportedRangeHigh || version < RPC::APIVersionSupportedRangeLow) + return nullptr; + auto & innerTable = table_[version - RPC::APIVersionSupportedRangeLow]; + auto i = innerTable.find(name); + return i == innerTable.end() ? nullptr : &i->second; } std::vector getHandlerNames() const { - std::vector ret; - ret.reserve(table_.size()); - for (auto const& i : table_) - ret.push_back(i.second.name_); - return ret; + std::unordered_set name_set; + for ( int index = 0; index < table_.size(); ++index) + { + for(auto const& h : table_[index]) + { + name_set.insert(h.second.name_); + } + } + return std::vector(name_set.begin(), name_set.end()); } + std::array, APINumberVersionSupported> + getVersionedHandlerNames() const + { + std::array, APINumberVersionSupported> ret; + for ( int index = 0; index < table_.size(); ++index) + { + ret[index].reserve(table_[index].size()); + for (auto const& i : table_[index]) + { + ret[index].push_back(i.second.name_); + } + } + return ret; + } private: - std::map table_; + std::array, APINumberVersionSupported> table_; template - void addHandler() + void addHandler(unsigned version) { - assert (table_.find(HandlerImpl::name()) == table_.end()); + assert (version >= RPC::APIVersionSupportedRangeLow && version <= RPC::APIVersionSupportedRangeHigh); + auto & innerTable = table_[version - RPC::APIVersionSupportedRangeLow]; + assert (innerTable.find(HandlerImpl::name()) == innerTable.end()); Handler h; h.name_ = HandlerImpl::name(); @@ -178,15 +209,15 @@ class HandlerTable { h.role_ = HandlerImpl::role(); h.condition_ = HandlerImpl::condition(); - table_[HandlerImpl::name()] = h; + innerTable[HandlerImpl::name()] = h; } }; } // namespace -Handler const* getHandler(std::string const& name) +Handler const* getHandler(unsigned version, std::string const& name) { - return HandlerTable::instance().getHandler(name); + return HandlerTable::instance().getHandler(version, name); } std::vector @@ -195,5 +226,11 @@ getHandlerNames() return HandlerTable::instance().getHandlerNames(); }; +std::array, APINumberVersionSupported> +getVersionedHandlerNames() +{ + return HandlerTable::instance().getVersionedHandlerNames(); +}; + } // RPC } // ripple diff --git a/src/ripple/rpc/impl/Handler.h b/src/ripple/rpc/impl/Handler.h index dcc6a8a19a2..59fede84d17 100644 --- a/src/ripple/rpc/impl/Handler.h +++ b/src/ripple/rpc/impl/Handler.h @@ -51,7 +51,7 @@ struct Handler RPC::Condition condition_; }; -Handler const* getHandler (std::string const&); +Handler const* getHandler (unsigned version, std::string const&); /** Return a Json::objectValue with a single entry. */ template diff --git a/src/ripple/rpc/impl/RPCHandler.cpp b/src/ripple/rpc/impl/RPCHandler.cpp index 5d686906aed..5b95c649eae 100644 --- a/src/ripple/rpc/impl/RPCHandler.cpp +++ b/src/ripple/rpc/impl/RPCHandler.cpp @@ -141,7 +141,7 @@ error_code_i fillHandler (Context& context, JLOG (context.j.trace()) << "COMMAND:" << strCommand; JLOG (context.j.trace()) << "REQUEST:" << context.params; - auto handler = getHandler(strCommand); + auto handler = getHandler(context.apiVersion, strCommand); if (!handler) return rpcUNKNOWN_COMMAND; @@ -296,9 +296,9 @@ Status doCommand ( return rpcUNKNOWN_COMMAND; } -Role roleRequired (std::string const& method) +Role roleRequired (unsigned version, std::string const& method) { - auto handler = RPC::getHandler(method); + auto handler = RPC::getHandler(version, method); if (!handler) return Role::FORBID; diff --git a/src/ripple/rpc/impl/RPCHelpers.cpp b/src/ripple/rpc/impl/RPCHelpers.cpp index b1b83d6f062..4a95bc41eb5 100644 --- a/src/ripple/rpc/impl/RPCHelpers.cpp +++ b/src/ripple/rpc/impl/RPCHelpers.cpp @@ -716,5 +716,23 @@ beast::SemanticVersion const firstVersion("1.0.0"); beast::SemanticVersion const goodVersion("1.0.0"); beast::SemanticVersion const lastVersion("1.0.0"); +unsigned getAPIVersionNumber(const Json::Value & jv) +{ + if (jv.isMember(jss::api_version)) + { + if(jv[jss::api_version].isInt()) + { + unsigned apiVersion = jv[jss::api_version].asInt(); + if(apiVersion >= RPC::APIVersionSupportedRangeLow && + apiVersion <= RPC::APIVersionSupportedRangeHigh) + { + return apiVersion; + } + } + return RPC::APIInvalidVersion; + } else + return RPC::APIVersionIfUnspecified; +} + } // RPC } // ripple diff --git a/src/ripple/rpc/impl/RPCHelpers.h b/src/ripple/rpc/impl/RPCHelpers.h index 63d09d15eaa..534d4d4c9fb 100644 --- a/src/ripple/rpc/impl/RPCHelpers.h +++ b/src/ripple/rpc/impl/RPCHelpers.h @@ -114,10 +114,33 @@ parseRippleLibSeed(Json::Value const& params); std::pair keypairForSignature(Json::Value const& params, Json::Value& error); +/** + * API version numbers used in API version 1 + */ extern beast::SemanticVersion const firstVersion; extern beast::SemanticVersion const goodVersion; extern beast::SemanticVersion const lastVersion; +/** + * API version numbers used in later API versions + * Requests with a version number in the range + * [APIVersionRangeLow, APIVersionRangeHigh] are supported. + * + * Network Requests without explicit version number use APIFirstVersion. + * Command line Requests without explicit version number use + * APIVersionCommandLine. + */ + +constexpr unsigned APIInvalidVersion = 0; +constexpr unsigned APIFirstVersion = 1; +constexpr unsigned APIVersionSupportedRangeLow = 1; +constexpr unsigned APIVersionSupportedRangeHigh = 1; +constexpr unsigned APIVersionIfUnspecified = APIFirstVersion; +constexpr unsigned APIVersionCommandLine = APIVersionSupportedRangeHigh; +constexpr unsigned APIVersionRippledStartUp = APIVersionSupportedRangeHigh; +constexpr unsigned APINumberVersionSupported = APIVersionSupportedRangeHigh - + APIVersionSupportedRangeLow + 1; + template void setVersion(Object& parent) @@ -131,6 +154,17 @@ setVersion(Object& parent) std::pair chooseLedgerEntryType(Json::Value const& params); +template +void +setVersionV2(Object& parent) +{ + auto&& object = addObject (parent, jss::version); + object[jss::api_version_low] = APIVersionSupportedRangeLow; + object[jss::api_version] = APIVersionSupportedRangeHigh; +} + +unsigned getAPIVersionNumber(const Json::Value & value); + } // RPC } // ripple diff --git a/src/ripple/rpc/impl/ServerHandlerImp.cpp b/src/ripple/rpc/impl/ServerHandlerImp.cpp index c764bf7fa40..cc6f3b4b510 100644 --- a/src/ripple/rpc/impl/ServerHandlerImp.cpp +++ b/src/ripple/rpc/impl/ServerHandlerImp.cpp @@ -399,7 +399,9 @@ ServerHandlerImp::processSession( Resource::Charge loadType = Resource::feeReferenceRPC; try { - if ((!jv.isMember(jss::command) && !jv.isMember(jss::method)) || + auto apiVersion = RPC::getAPIVersionNumber(jv); + if (apiVersion == RPC::APIInvalidVersion || + (!jv.isMember(jss::command) && !jv.isMember(jss::method)) || (jv.isMember(jss::command) && !jv[jss::command].isString()) || (jv.isMember(jss::method) && !jv[jss::method].isString()) || (jv.isMember(jss::command) && jv.isMember(jss::method) && @@ -415,14 +417,17 @@ ServerHandlerImp::processSession( jr[jss::jsonrpc] = jv[jss::jsonrpc]; if (jv.isMember(jss::ripplerpc)) jr[jss::ripplerpc] = jv[jss::ripplerpc]; + if (jv.isMember(jss::api_version)) + jr[jss::api_version] = jv[jss::api_version]; is->getConsumer().charge(Resource::feeInvalidRPC); return jr; } - auto required = RPC::roleRequired(jv.isMember(jss::command) ? - jv[jss::command].asString() : - jv[jss::method].asString()); + auto required = RPC::roleRequired(apiVersion, + jv.isMember(jss::command) ? + jv[jss::command].asString() : + jv[jss::method].asString()); auto role = requestRole( required, session->port(), @@ -445,6 +450,7 @@ ServerHandlerImp::processSession( app_.getLedgerMaster(), is->getConsumer(), role, + apiVersion, coro, is, {is->user(), is->forwarded_for()} @@ -501,6 +507,9 @@ ServerHandlerImp::processSession( jr[jss::jsonrpc] = jv[jss::jsonrpc]; if (jv.isMember(jss::ripplerpc)) jr[jss::ripplerpc] = jv[jss::ripplerpc]; + if (jv.isMember(jss::api_version)) + jr[jss::api_version] = jv[jss::api_version]; + jr[jss::type] = jss::response; return jr; } @@ -546,6 +555,7 @@ make_json_error(Json::Int code, Json::Value&& message) Json::Int constexpr method_not_found = -32601; Json::Int constexpr server_overloaded = -32604; Json::Int constexpr forbidden = -32605; +Json::Int constexpr wrong_version = -32606;//TODO Peng void ServerHandlerImp::processRequest (Port const& port, @@ -586,6 +596,41 @@ ServerHandlerImp::processRequest (Port const& port, auto const start (std::chrono::high_resolution_clock::now ()); for (unsigned i = 0; i < size; ++i) { +// auto apiVersion = RPC::APIVersionIfUnspecified; +// if(batch && i == 0) +// { +// Json::Value const& jsonRPC = jsonOrig[jss::params][i]; +// if(jsonRPC.isString()) +// { +// std::string s = jsonRPC.asString(); +// // the version field's format is "api_version=x" where x is the version number +// // sizeof(jss::api_version) is the same as the number of chars in "api_version=" +// auto pos = s.find('='); +// if(pos != std::string::npos && +// 0 == s.compare(0, pos, jss::api_version)) +// { +// bool goodApiVersion = false; +// try { +// std::stringstream version_stream(s.substr(pos)); +// version_stream >> apiVersion; +// if(apiVersion >= RPC::APIFirstVersion) +// goodApiVersion = true; +// } catch (...) { +// +// } +// //merge below +// if(!goodApiVersion) +// { +// Json::Value r(Json::objectValue); +// r[jss::request] = jsonRPC; +// r[jss::error] = make_json_error(wrong_version, "Wrong version number format"); +// reply.append(r); +// continue; +// } +// } +// } +// } + Json::Value const& jsonRPC = batch ? jsonOrig[jss::params][i] : jsonOrig; @@ -598,11 +643,31 @@ ServerHandlerImp::processRequest (Port const& port, continue; } +// std::cout << "rpc request received: " << jsonRPC << std::endl; + + auto apiVersion = RPC::APIVersionIfUnspecified; + if (jsonRPC.isMember(jss::params) && + jsonRPC[jss::params].isArray() && + jsonRPC[jss::params].size() > 0 && + jsonRPC[jss::params][Json::UInt(0)].isObject()) + { + apiVersion = RPC::getAPIVersionNumber(jsonRPC[jss::params][Json::UInt(0)]); +// std::cout << "rpc request received: after version " << apiVersion << std::endl; + if(apiVersion == RPC::APIInvalidVersion) + { + Json::Value r(Json::objectValue); + r[jss::request] = jsonRPC; + r[jss::error] = make_json_error(wrong_version, "Wrong version number format"); + reply.append(r); + continue; + } + } + /* ------------------------------------------------------------------ */ auto role = Role::FORBID; auto required = Role::FORBID; if (jsonRPC.isMember(jss::method) && jsonRPC[jss::method].isString()) - required = RPC::roleRequired(jsonRPC[jss::method].asString()); + required = RPC::roleRequired(apiVersion, jsonRPC[jss::method].asString()); if (jsonRPC.isMember(jss::params) && jsonRPC[jss::params].isArray() && @@ -779,7 +844,7 @@ ServerHandlerImp::processRequest (Port const& port, Resource::Charge loadType = Resource::feeReferenceRPC; RPC::Context context {m_journal, params, app_, loadType, m_networkOPs, - app_.getLedgerMaster(), usage, role, coro, InfoSub::pointer(), + app_.getLedgerMaster(), usage, role, apiVersion, coro, InfoSub::pointer(), {user, forwardedFor}}; Json::Value result; RPC::doCommand (context, result); diff --git a/src/test/app/Path_test.cpp b/src/test/app/Path_test.cpp index 1d38d54e2af..589ced35c28 100644 --- a/src/test/app/Path_test.cpp +++ b/src/test/app/Path_test.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -221,7 +222,8 @@ class Path_test : public beast::unit_test::suite Resource::Charge loadType = Resource::feeReferenceRPC; Resource::Consumer c; RPC::Context context { env.journal, {}, app, loadType, - app.getOPs(), app.getLedgerMaster(), c, Role::USER}; + app.getOPs(), app.getLedgerMaster(), c, Role::USER, + RPC::APIVersionIfUnspecified}; Json::Value params = Json::objectValue; params[jss::command] = "ripple_path_find"; @@ -320,7 +322,8 @@ class Path_test : public beast::unit_test::suite Resource::Charge loadType = Resource::feeReferenceRPC; Resource::Consumer c; RPC::Context context {env.journal, {}, app, loadType, - app.getOPs(), app.getLedgerMaster(), c, Role::USER}; + app.getOPs(), app.getLedgerMaster(), c, Role::USER, + RPC::APIVersionIfUnspecified}; Json::Value result; gate g; // Test RPC::Tuning::max_src_cur source currencies. diff --git a/src/test/rpc/RPCCall_test.cpp b/src/test/rpc/RPCCall_test.cpp index 05c9a23bb88..a90e4ed6b71 100644 --- a/src/test/rpc/RPCCall_test.cpp +++ b/src/test/rpc/RPCCall_test.cpp @@ -24,6 +24,7 @@ #include #include +#include namespace ripple { namespace test { @@ -77,6 +78,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_channels", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh" } ] @@ -94,6 +96,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_channels", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "destination_account" : "FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210" } @@ -112,6 +115,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_channels", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "destination_account" : "closed" } @@ -130,6 +134,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_channels", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "destination_account" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA" } @@ -149,6 +154,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_channels", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "destination_account" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "ledger_hash" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" @@ -169,6 +175,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_channels", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "destination_account" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "ledger_index" : 90210 @@ -245,6 +252,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_currencies", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh" } ] @@ -262,6 +270,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_currencies", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "strict" : 1 } @@ -280,6 +289,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_currencies", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 42 } @@ -298,6 +308,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_currencies", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : "validated" } @@ -353,6 +364,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_currencies", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 0 } @@ -389,6 +401,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_currencies", "params" : [ { + "api_version" : 1, "account" : "3.14159", "strict" : 1 } @@ -408,6 +421,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_info", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh" } ] @@ -425,6 +439,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_info", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 77777 } @@ -443,6 +458,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_info", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : "closed" } @@ -461,6 +477,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_info", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_hash" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" } @@ -480,6 +497,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_info", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "strict" : 1 } @@ -576,6 +594,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_lines", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", } ] @@ -593,6 +612,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_lines", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "peer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA" } @@ -612,6 +632,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_lines", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 888888888, "peer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA" @@ -632,6 +653,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_lines", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : "closed", "peer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA" @@ -652,6 +674,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_lines", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_hash" : "FFFFEEEEDDDDCCCCBBBBAAAA9999888877776666555544443333222211110000", "peer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA" @@ -691,6 +714,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_lines", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 12345678, "peer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA" @@ -714,6 +738,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_lines", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 12345678, "peer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA" @@ -774,6 +799,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_lines", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh" } ] @@ -792,6 +818,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_lines", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 0, "peer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA" @@ -812,6 +839,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_objects", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh" } ] @@ -829,6 +857,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_objects", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 77777 } @@ -847,6 +876,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_objects", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : "closed" } @@ -865,6 +895,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_objects", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_hash" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" } @@ -884,6 +915,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_objects", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "strict" : 1 } @@ -903,6 +935,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_objects", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : "validated", "strict" : 1 @@ -942,6 +975,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_objects", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "strict" : 1 } @@ -964,6 +998,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_objects", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "strict" : 1 } @@ -1025,6 +1060,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_objects", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 0 } @@ -1046,6 +1082,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_objects", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 0, "strict" : 1 @@ -1066,6 +1103,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_offers", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh" } ] @@ -1083,6 +1121,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_offers", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 987654321 } @@ -1101,6 +1140,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_offers", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : "validated" } @@ -1119,6 +1159,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_offers", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_hash" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" } @@ -1138,6 +1179,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_offers", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "strict" : 1 } @@ -1158,6 +1200,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_offers", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : "validated", "strict" : 1 @@ -1197,6 +1240,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_offers", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "strict" : 1 } @@ -1257,6 +1301,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_offers", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 0 } @@ -1278,6 +1323,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_offers", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 0, "strict" : 1 @@ -1298,6 +1344,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_tx", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", } ] @@ -1315,6 +1362,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_tx", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 444 } @@ -1336,6 +1384,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_tx", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "count" : true, "binary" : true, @@ -1358,6 +1407,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_tx", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index_max" : -1, "ledger_index_min" : -1 @@ -1381,6 +1431,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_tx", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "binary" : true, "count" : true, @@ -1405,6 +1456,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_tx", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index_max" : -1, "ledger_index_min" : 247, @@ -1430,6 +1482,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_tx", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "binary" : true, "count" : true, @@ -1456,6 +1509,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_tx", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index_max" : 590, "ledger_index_min" : 589, @@ -1482,6 +1536,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_tx", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "count" : true, "descending" : true, @@ -1567,6 +1622,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_tx", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 0 } @@ -1674,6 +1730,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "book_offers", "params" : [ { + "api_version" : 1, "taker_gets" : { "currency" : "EUR" }, @@ -1696,6 +1753,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "book_offers", "params" : [ { + "api_version" : 1, "taker_gets" : { "currency" : "EUR", "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA" @@ -1723,6 +1781,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "book_offers", "params" : [ { + "api_version" : 1, "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "taker_gets" : { "currency" : "EUR" @@ -1748,6 +1807,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "book_offers", "params" : [ { + "api_version" : 1, "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "ledger_index" : 666, "taker_gets" : { @@ -1775,6 +1835,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "book_offers", "params" : [ { + "api_version" : 1, "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "ledger_index" : "current", "taker_gets" : { @@ -1802,6 +1863,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "book_offers", "params" : [ { + "api_version" : 1, "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789", "taker_gets" : { @@ -1832,6 +1894,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "book_offers", "params" : [ { + "api_version" : 1, "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789", "limit" : 200, @@ -1866,6 +1929,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "book_offers", "params" : [ { + "api_version" : 1, "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789", "limit" : 200, @@ -1977,6 +2041,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "book_offers", "params" : [ { + "api_version" : 1, "issuer" : "not_a_valid_issuer", "taker_gets" : { "currency" : "EUR" @@ -2002,6 +2067,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "book_offers", "params" : [ { + "api_version" : 1, "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "ledger_index" : 0, "taker_gets" : { @@ -2039,7 +2105,12 @@ static RPCCallTestData const rpcCallTestArray [] = }, RPCCallTestData::no_exception, R"({ - "method" : "can_delete" + "method" : "can_delete", + "params" : [ + { + "api_version" : 1, + } + ] })" }, { @@ -2053,6 +2124,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "can_delete", "params" : [ { + "api_version" : 1, "can_delete" : 4294967295 } ] @@ -2069,6 +2141,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "can_delete", "params" : [ { + "api_version" : 1, "can_delete" : "FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210" } ] @@ -2085,6 +2158,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "can_delete", "params" : [ { + "api_version" : 1, "can_delete" : "always" } ] @@ -2101,6 +2175,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "can_delete", "params" : [ { + "api_version" : 1, "can_delete" : "never" } ] @@ -2117,6 +2192,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "can_delete", "params" : [ { + "api_version" : 1, "can_delete" : "now" } ] @@ -2152,6 +2228,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "can_delete", "params" : [ { + "api_version" : 1, "can_delete" : "invalid" } ] @@ -2192,6 +2269,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "channel_authorize", "params" : [ { + "api_version" : 1, "amount" : "18446744073709551615", "channel_id" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF", "secret" : "secret_can_be_anything" @@ -2377,6 +2455,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "channel_verify", "params" : [ { + "api_version" : 1, "amount" : "0", "channel_id" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF", "public_key" : "aB4BXXLuPu8DpVuyq1DBiu3SrPdtK9AYZisKhu8mvkoiUD8J9Gov", @@ -2399,6 +2478,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "channel_verify", "params" : [ { + "api_version" : 1, "amount" : "18446744073709551615", "channel_id" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF", "public_key" : "021D93E21C44160A1B3B66DA1F37B86BE39FFEA3FC4B95FAA2063F82EE823599F6", @@ -2588,6 +2668,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "channel_verify", "params" : [ { + "api_version" : 1, "amount" : "40000000", "channel_id" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF", "public_key" : "aB4BXXLuPu8DpVuyq1DBiu3SrPdtK9AYZisKhu8mvkoiUD8J9Gov", @@ -2609,6 +2690,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "connect", "params" : [ { + "api_version" : 1, "ip" : "ThereIsNoCheckingOnTheIPFormat" } ] @@ -2626,6 +2708,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "connect", "params" : [ { + "api_version" : 1, "ip" : "ThereIsNoCheckingOnTheIPFormat", "port" : 6561 } @@ -2701,6 +2784,11 @@ static RPCCallTestData const rpcCallTestArray [] = RPCCallTestData::no_exception, R"({ "method" : "consensus_info", + "params" : [ + { + "api_version" : 1 + } + ] })" }, { @@ -2735,6 +2823,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "deposit_authorized", "params" : [ { + "api_version" : 1, "destination_account" : "destination_account_NotValidated", "source_account" : "source_account_NotValidated" } @@ -2754,6 +2843,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "deposit_authorized", "params" : [ { + "api_version" : 1, "destination_account" : "destination_account_NotValidated", "ledger_index" : "validated", "source_account" : "source_account_NotValidated" @@ -2774,6 +2864,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "deposit_authorized", "params" : [ { + "api_version" : 1, "destination_account" : "destination_account_NotValidated", "ledger_index" : 4294967295, "source_account" : "source_account_NotValidated" @@ -2794,6 +2885,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "deposit_authorized", "params" : [ { + "api_version" : 1, "destination_account" : "destination_account_NotValidated", "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789", "source_account" : "source_account_NotValidated" @@ -2853,6 +2945,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "deposit_authorized", "params" : [ { + "api_version" : 1, "destination_account" : "destination_account_NotValidated", "ledger_index" : 0, "source_account" : "source_account_NotValidated" @@ -2874,6 +2967,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "download_shard", "params" : [ { + "api_version" : 1, "shards" : [ { "index" : 20, @@ -2897,6 +2991,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "download_shard", "params" : [ { + "api_version" : 1, "shards" : [ { "index" : 20, @@ -2926,6 +3021,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "download_shard", "params" : [ { + "api_version" : 1, "shards" : [ { "index" : 200000000, @@ -2969,6 +3065,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "download_shard", "params" : [ { + "api_version" : 1, "shards" : [ { "index" : 2000000, @@ -3038,6 +3135,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "download_shard", "params" : [ { + "api_version" : 1, "shards" : [ { "index" : 20, @@ -3112,6 +3210,11 @@ static RPCCallTestData const rpcCallTestArray [] = RPCCallTestData::no_exception, R"({ "method" : "feature", + "params" : [ + { + "api_version" : 1, + } + ] })" }, { @@ -3125,6 +3228,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "feature", "params" : [ { + "api_version" : 1, "feature" : "featureNameOrHexIsNotValidated" } ] @@ -3142,6 +3246,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "feature", "params" : [ { + "api_version" : 1, "feature" : "FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210", "vetoed" : false } @@ -3160,6 +3265,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "feature", "params" : [ { + "api_version" : 1, "feature" : "0", "vetoed" : true } @@ -3215,6 +3321,11 @@ static RPCCallTestData const rpcCallTestArray [] = RPCCallTestData::no_exception, R"({ "method" : "fetch_info", + "params" : [ + { + "api_version" : 1, + } + ] })" }, { @@ -3228,6 +3339,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "fetch_info", "params" : [ { + "api_version" : 1, "clear" : true } ] @@ -3263,6 +3375,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "fetch_info", "params" : [ { + "api_version" : 1, "too" : true } ] @@ -3281,6 +3394,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "gateway_balances", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", } ] @@ -3298,6 +3412,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "gateway_balances", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : "890765" } @@ -3316,6 +3431,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "gateway_balances", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : "current" } @@ -3334,6 +3450,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "gateway_balances", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_hash" : "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV" } @@ -3352,6 +3469,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "gateway_balances", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "hotwallet" : [ "hotwallet_is_not_validated" ] } @@ -3373,6 +3491,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "gateway_balances", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "hotwallet" : [ "hotwallet_is_not_validated_1", @@ -3482,7 +3601,12 @@ static RPCCallTestData const rpcCallTestArray [] = }, RPCCallTestData::no_exception, R"({ - "method" : "get_counts" + "method" : "get_counts", + "params" : [ + { + "api_version" : 1, + } + ] })" }, { @@ -3496,6 +3620,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "get_counts", "params" : [ { + "api_version" : 1, "min_count" : 100 } ] @@ -3552,6 +3677,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "command", "params" : [ { + "api_version" : 1, "json_argument" : true, "method" : "command" } @@ -3570,6 +3696,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "command", "params" : [ { + "api_version" : 1, "method" : "command" } ] @@ -3666,6 +3793,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "call_1", "params" : [ { + "api_version" : 1, "id" : "A1", "jsonrpc" : "2.0", "method" : "call_1", @@ -3694,6 +3822,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "call_1", "params" : [ { + "api_version" : 1, "0" : { "inner_arg" : "yup" }, @@ -3718,6 +3847,7 @@ static RPCCallTestData const rpcCallTestArray [] = "params" : [ [ { + "api_version" : 1, "id" : "A1", "jsonrpc" : "2.0", "method" : "call_1", @@ -3745,6 +3875,7 @@ static RPCCallTestData const rpcCallTestArray [] = "params" : [ [ { + "api_version" : 1, "0" : { "inner_arg" : "yup" }, @@ -4053,7 +4184,12 @@ static RPCCallTestData const rpcCallTestArray [] = }, RPCCallTestData::no_exception, R"({ - "method" : "ledger" + "method" : "ledger", + "params" : [ + { + "api_version" : 1, + } + ] })" }, { @@ -4067,6 +4203,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger", "params" : [ { + "api_version" : 1, "ledger_index" : 4294967295 } ] @@ -4083,6 +4220,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger", "params" : [ { + "api_version" : 1, "ledger_index" : "validated" } ] @@ -4099,6 +4237,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger", "params" : [ { + "api_version" : 1, "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789" } ] @@ -4116,6 +4255,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger", "params" : [ { + "api_version" : 1, "full" : true, "ledger_index" : "current" } @@ -4134,6 +4274,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger", "params" : [ { + "api_version" : 1, "expand" : true, "ledger_index" : "closed", "transactions" : true @@ -4153,6 +4294,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger", "params" : [ { + "api_version" : 1, "ledger_index" : 4294967295 } ] @@ -4169,6 +4311,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger", "params" : [ { + "api_version" : 1, "ledger_index" : 0 } ] @@ -4185,6 +4328,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger", "params" : [ { + "api_version" : 1, "ledger_index" : 0 } ] @@ -4201,6 +4345,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger", "params" : [ { + "api_version" : 1, "ledger_index" : 0 } ] @@ -4218,6 +4363,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger", "params" : [ { + "api_version" : 1, "ledger_index" : "current" } ] @@ -4232,7 +4378,12 @@ static RPCCallTestData const rpcCallTestArray [] = }, RPCCallTestData::no_exception, R"({ - "method" : "ledger_closed" + "method" : "ledger_closed", + "params" : [ + { + "api_version" : 1, + } + ] })" }, { @@ -4262,7 +4413,12 @@ static RPCCallTestData const rpcCallTestArray [] = }, RPCCallTestData::no_exception, R"({ - "method" : "ledger_current" + "method" : "ledger_current", + "params" : [ + { + "api_version" : 1, + } + ] })" }, { @@ -4296,6 +4452,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger_header", "params" : [ { + "api_version" : 1, "ledger_index" : 4294967295 } ] @@ -4312,6 +4469,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger_header", "params" : [ { + "api_version" : 1, "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789" } ] @@ -4364,6 +4522,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger_header", "params" : [ { + "api_version" : 1, "ledger_index" : 0 } ] @@ -4380,6 +4539,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger_header", "params" : [ { + "api_version" : 1, "ledger_index" : 0 } ] @@ -4396,6 +4556,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger_header", "params" : [ { + "api_version" : 1, "ledger_index" : 0 } ] @@ -4414,6 +4575,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger_request", "params" : [ { + "api_version" : 1, "ledger_index" : 4294967295 } ] @@ -4430,6 +4592,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger_request", "params" : [ { + "api_version" : 1, "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789" } ] @@ -4482,6 +4645,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger_request", "params" : [ { + "api_version" : 1, "ledger_index" : 0 } ] @@ -4498,6 +4662,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger_request", "params" : [ { + "api_version" : 1, "ledger_index" : 0 } ] @@ -4514,6 +4679,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger_request", "params" : [ { + "api_version" : 1, "ledger_index" : 0 } ] @@ -4528,7 +4694,12 @@ static RPCCallTestData const rpcCallTestArray [] = }, RPCCallTestData::no_exception, R"({ - "method" : "log_level" + "method" : "log_level", + "params" : [ + { + "api_version" : 1, + } + ] })" }, { @@ -4542,6 +4713,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "log_level", "params" : [ { + "api_version" : 1, "severity" : "fatal" } ] @@ -4558,6 +4730,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "log_level", "params" : [ { + "api_version" : 1, "severity" : "error" } ] @@ -4574,6 +4747,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "log_level", "params" : [ { + "api_version" : 1, "severity" : "warn" } ] @@ -4590,6 +4764,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "log_level", "params" : [ { + "api_version" : 1, "severity" : "debug" } ] @@ -4606,6 +4781,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "log_level", "params" : [ { + "api_version" : 1, "severity" : "trace" } ] @@ -4623,6 +4799,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "log_level", "params" : [ { + "api_version" : 1, "partition" : "base", "severity" : "trace" } @@ -4641,6 +4818,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "log_level", "params" : [ { + "api_version" : 1, "partition" : "partition_name", "severity" : "fatal" } @@ -4678,6 +4856,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "log_level", "params" : [ { + "api_version" : 1, "severity" : "err" } ] @@ -4695,6 +4874,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "log_level", "params" : [ { + "api_version" : 1, "partition" : "fatal", "severity" : "partition_name" } @@ -4710,7 +4890,12 @@ static RPCCallTestData const rpcCallTestArray [] = }, RPCCallTestData::no_exception, R"({ - "method" : "logrotate" + "method" : "logrotate", + "params" : [ + { + "api_version" : 1, + } + ] })" }, { @@ -4744,6 +4929,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "owner_info", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh" } ] @@ -4761,6 +4947,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "owner_info", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 987654321 } @@ -4779,6 +4966,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "owner_info", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : "validated" } @@ -4797,6 +4985,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "owner_info", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_hash" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" } @@ -4816,6 +5005,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "owner_info", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "strict" : 1 } @@ -4912,6 +5102,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "owner_info", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 0 } @@ -4949,7 +5140,12 @@ static RPCCallTestData const rpcCallTestArray [] = }, RPCCallTestData::no_exception, R"({ - "method" : "peers" + "method" : "peers", + "params" : [ + { + "api_version" : 1, + } + ] })" }, { @@ -4979,7 +5175,12 @@ static RPCCallTestData const rpcCallTestArray [] = }, RPCCallTestData::no_exception, R"({ - "method" : "ping" + "method" : "ping", + "params" : [ + { + "api_version" : 1, + } + ] })" }, { @@ -5009,7 +5210,12 @@ static RPCCallTestData const rpcCallTestArray [] = }, RPCCallTestData::no_exception, R"({ - "method" : "print" + "method" : "print", + "params" : [ + { + "api_version" : 1, + } + ] })" }, { @@ -5024,6 +5230,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "print", "params" : [ { + "api_version" : 1, "params" : [ "extra" ] } ] @@ -5057,7 +5264,12 @@ static RPCCallTestData const rpcCallTestArray [] = }, RPCCallTestData::no_exception, R"({ - "method" : "random" + "method" : "random", + "params" : [ + { + "api_version" : 1, + } + ] })" }, { @@ -5091,6 +5303,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ripple_path_find", "params" : [ { + "api_version" : 1, "json_argument" : true } ] @@ -5108,6 +5321,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ripple_path_find", "params" : [ { + "api_version" : 1, "json_argument" : true, "ledger_index" : 4294967295 } @@ -5126,6 +5340,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ripple_path_find", "params" : [ { + "api_version" : 1, "json_argument" : true, "ledger_index" : "closed" } @@ -5144,6 +5359,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ripple_path_find", "params" : [ { + "api_version" : 1, "json_argument" : true, "ledger_hash" : "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV" } @@ -5218,7 +5434,8 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ripple_path_find", "params" : [ { - "json_argument" : true, + "api_version" : 1, + "json_argument" : true, "ledger_index" : 0 } ] @@ -5236,6 +5453,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ripple_path_find", "params" : [ { + "api_version" : 1, "json_argument" : true, "ledger_index" : 0 } @@ -5254,6 +5472,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ripple_path_find", "params" : [ { + "api_version" : 1, "json_argument" : true, "ledger_index" : 0 } @@ -5274,6 +5493,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "sign", "params" : [ { + "api_version" : 1, "secret" : "my_secret", "tx_json" : { "json_argument" : true @@ -5295,6 +5515,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "sign", "params" : [ { + "api_version" : 1, "offline" : true, "secret" : "my_secret", "tx_json" : { @@ -5397,6 +5618,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "sign_for", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret" : "my_secret", "tx_json" : { @@ -5420,6 +5642,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "sign_for", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "offline" : true, "secret" : "my_secret", @@ -5525,6 +5748,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "submit", "params" : [ { + "api_version" : 1, "tx_blob" : "the blob is unvalidated and may be any length..." } ] @@ -5542,6 +5766,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "submit", "params" : [ { + "api_version" : 1, "secret" : "my_secret", "tx_json" : { "json_argument" : true @@ -5581,6 +5806,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "submit", "params" : [ { + "api_version" : 1, "offline" : true, "secret" : "my_secret", "tx_json" : { @@ -5663,6 +5889,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "submit_multisigned", "params" : [ { + "api_version" : 1, "tx_json" : { "json_argument" : true } @@ -5735,6 +5962,11 @@ static RPCCallTestData const rpcCallTestArray [] = RPCCallTestData::no_exception, R"({ "method" : "server_info", + "params" : [ + { + "api_version" : 1, + } + ] })" }, { @@ -5748,6 +5980,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "server_info", "params" : [ { + "api_version" : 1, "counters" : true } ] @@ -5781,6 +6014,11 @@ static RPCCallTestData const rpcCallTestArray [] = RPCCallTestData::no_exception, R"({ "method" : "server_info", + "params" : [ + { + "api_version" : 1, + } + ] })" }, @@ -5793,6 +6031,11 @@ static RPCCallTestData const rpcCallTestArray [] = RPCCallTestData::no_exception, R"({ "method" : "server_state", + "params" : [ + { + "api_version" : 1, + } + ] })" }, { @@ -5806,6 +6049,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "server_state", "params" : [ { + "api_version" : 1, "counters" : true } ] @@ -5839,6 +6083,11 @@ static RPCCallTestData const rpcCallTestArray [] = RPCCallTestData::no_exception, R"({ "method" : "server_state", + "params" : [ + { + "api_version" : 1, + } + ] })" }, @@ -5851,6 +6100,11 @@ static RPCCallTestData const rpcCallTestArray [] = RPCCallTestData::no_exception, R"({ "method" : "stop", + "params" : [ + { + "api_version" : 1, + } + ] })" }, { @@ -5885,6 +6139,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "transaction_entry", "params" : [ { + "api_version" : 1, "ledger_index" : 4294967295, "tx_hash" : "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV" } @@ -5903,6 +6158,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "transaction_entry", "params" : [ { + "api_version" : 1, "ledger_index" : "current", "tx_hash" : "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV" } @@ -5921,6 +6177,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "transaction_entry", "params" : [ { + "api_version" : 1, "ledger_hash" : "VUTSRQPONMLKJIHGFEDCBA9876543210VUTSRQPONMLKJIHGFEDCBA9876543210", "tx_hash" : "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV" } @@ -6092,6 +6349,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "tx", "params" : [ { + "api_version" : 1, "transaction" : "transaction_hash_is_not_validated" } ] @@ -6109,6 +6367,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "tx", "params" : [ { + "api_version" : 1, "binary" : true, "transaction" : "transaction_hash_is_not_validated" } @@ -6164,6 +6423,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "tx", "params" : [ { + "api_version" : 1, "transaction" : "transaction_hash_is_not_validated" } ] @@ -6182,6 +6442,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "tx_account", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", } ] @@ -6199,6 +6460,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "tx_account", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 4294967295 } @@ -6220,6 +6482,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "tx_account", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "binary" : true, "count" : true, @@ -6242,6 +6505,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "tx_account", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index_max" : 2147483647, "ledger_index_min" : 2147483647 @@ -6265,6 +6529,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "tx_account", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "binary" : true, "count" : true, @@ -6289,6 +6554,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "tx_account", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index_max" : 2147483647, "ledger_index_min" : -1, @@ -6314,6 +6580,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "tx_account", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "binary" : true, "count" : true, @@ -6398,6 +6665,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "tx_account", "params" : [ { + "api_version" : 1, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 0 } @@ -6511,7 +6779,8 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "tx_history", "params" : [ { - "start" : 0 + "api_version" : 1, + "start" : 0 } ] })" @@ -6592,6 +6861,11 @@ static RPCCallTestData const rpcCallTestArray [] = RPCCallTestData::no_exception, R"({ "method" : "unl_list", + "params" : [ + { + "api_version" : 1, + } + ] })" }, { @@ -6621,7 +6895,12 @@ static RPCCallTestData const rpcCallTestArray [] = }, RPCCallTestData::no_exception, R"({ - "method" : "validation_create" + "method" : "validation_create", + "params" : [ + { + "api_version" : 1, + } + ] })" }, { @@ -6635,6 +6914,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "validation_create", "params" : [ { + "api_version" : 1, "secret" : "the form of the secret is not validated" } ] @@ -6669,6 +6949,11 @@ static RPCCallTestData const rpcCallTestArray [] = RPCCallTestData::no_exception, R"({ "method" : "version", + "params" : [ + { + "api_version" : 1, + } + ] })" }, { @@ -6698,7 +6983,12 @@ static RPCCallTestData const rpcCallTestArray [] = }, RPCCallTestData::no_exception, R"({ - "method" : "wallet_propose" + "method" : "wallet_propose", + "params" : [ + { + "api_version" : 1, + } + ] })" }, { @@ -6712,6 +7002,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "wallet_propose", "params" : [ { + "api_version" : 1, "passphrase" : "the form of the passphrase is not validated" } ] @@ -6749,6 +7040,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "internal", "params" : [ { + "api_version" : 1, "internal_command" : "command_name", "params" : [] } @@ -6771,6 +7063,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "internal", "params" : [ { + "api_version" : 1, "internal_command" : "command_name", "params" : [ "string_arg", "1", "-1", "4294967296", "3.14159" ] } @@ -6926,7 +7219,12 @@ static RPCCallTestData const rpcCallTestArray [] = }, RPCCallTestData::no_exception, R"({ - "method" : "unknown_command" + "method" : "unknown_command", + "params" : [ + { + "api_version" : 1, + } + ] })" }, { @@ -6944,14 +7242,24 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "unknown_command", "params" : [ { + "api_version" : 1, "params" : [ "string_arg", "1", "-1", "4294967296", "3.14159" ] } ] })" }, - }; +std::string updateAPIVersionString(const char * const req) +{ + static std::string version_str = "\"" + std::string(jss::api_version) + "\" : " + + std::to_string(RPC::APIVersionCommandLine); + static auto place_holder = "\"api_version\" : 1"; + std::string jr(req); + boost::replace_all(jr, place_holder, version_str); + return jr; +} + class RPCCall_test : public beast::unit_test::suite { public: @@ -6990,7 +7298,7 @@ class RPCCall_test : public beast::unit_test::suite } Json::Value exp; - Json::Reader{}.parse (rpcCallTest.exp, exp); + Json::Reader{}.parse (updateAPIVersionString(rpcCallTest.exp), exp); // Lambda to remove the "params[0u]:error_code" field if present. // Error codes are not expected to be stable between releases. @@ -7007,6 +7315,9 @@ class RPCCall_test : public beast::unit_test::suite rmErrorCode (got); rmErrorCode (exp); +// std::cout << "got " << got << std::endl; +// std::cout << "exp " << exp << std::endl; + // Pass if we didn't expect a throw and we got what we expected. if ((rpcCallTest.throwsWhat == RPCCallTestData::no_exception) && (got == exp)) From da69178d33b507ef5f3b3bd74303dd11a25bd758 Mon Sep 17 00:00:00 2001 From: Peng Wang Date: Tue, 12 Nov 2019 13:53:48 -0500 Subject: [PATCH 2/7] unit tested, tested command line, websocket, and json-rpc --- Builds/CMake/RippledCore.cmake | 1 + src/ripple/app/main/Main.cpp | 17 --- src/ripple/net/impl/RPCCall.cpp | 21 +-- src/ripple/rpc/handlers/Version.h | 14 -- src/ripple/rpc/impl/Handler.cpp | 40 ++---- src/ripple/rpc/impl/RPCHelpers.h | 16 +-- src/ripple/rpc/impl/ServerHandlerImp.cpp | 71 ++++------ src/test/rpc/RPCCall_test.cpp | 3 - src/test/rpc/Version_test.cpp | 166 +++++++++++++++++++++++ src/test/unity/rpc_test_unity.cpp | 1 + 10 files changed, 216 insertions(+), 134 deletions(-) create mode 100644 src/test/rpc/Version_test.cpp diff --git a/Builds/CMake/RippledCore.cmake b/Builds/CMake/RippledCore.cmake index e4d087255b2..f1cda2ed7b9 100644 --- a/Builds/CMake/RippledCore.cmake +++ b/Builds/CMake/RippledCore.cmake @@ -993,6 +993,7 @@ else () src/test/rpc/TransactionEntry_test.cpp src/test/rpc/TransactionHistory_test.cpp src/test/rpc/ValidatorRPC_test.cpp + src/test/rpc/Version_test.cpp #[===============================[ nounity, test sources: subdir: server diff --git a/src/ripple/app/main/Main.cpp b/src/ripple/app/main/Main.cpp index fb7016e5406..58827d22366 100644 --- a/src/ripple/app/main/Main.cpp +++ b/src/ripple/app/main/Main.cpp @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include @@ -630,22 +629,6 @@ int run (int argc, char** argv) config->rpc_ip = std::move(*endpoint); } -// auto rpc_version_number = RPC::APIVersionCommandLine; -// if (vm.count ("rpc_version")) -// { -// try -// { -// rpc_version_number = vm["rpc_version"].as(); -// if (rpc_version_number > RPC::APIVersionSupportedRangeHigh) -// throw std::domain_error(std::to_string(rpc_version_number)); -// } -// catch(std::exception const& e) -// { -// std::cerr << "Invalid rpc_version = " << e.what() << "\n"; -// return -1; -// } -// } - if (vm.count ("quorum")) { try diff --git a/src/ripple/net/impl/RPCCall.cpp b/src/ripple/net/impl/RPCCall.cpp index e0ee23968da..b779fef8f59 100644 --- a/src/ripple/net/impl/RPCCall.cpp +++ b/src/ripple/net/impl/RPCCall.cpp @@ -1353,19 +1353,22 @@ rpcCmdLineToJson (std::vector const& args, retParams[jss::params] = jvRpcParams; jvRequest = rpParser.parseCommand (args[0], jvRpcParams, true); + + auto insert_api_version = [](Json::Value & jr){ + if(!jr.isMember(jss::error) && !jr.isMember(jss::api_version)) + jr[jss::api_version] = RPC::APIVersionCommandLine; + }; + if(jvRequest.isObject()) - { - if(!jvRequest.isMember(jss::error)) - jvRequest["api_version"] = RPC::APIVersionCommandLine; - } + insert_api_version(jvRequest); else if(jvRequest.isArray()) { for (Json::UInt j = 0; j < jvRequest.size(); ++j) { if (jvRequest[j].isObject()) - jvRequest[j]["api_version"] = RPC::APIVersionCommandLine; + insert_api_version(jvRequest[j]); } } + JLOG (j.trace()) << "RPC Request: " << jvRequest << std::endl; - //std::cout << "RPC Request: " << jvRequest << std::endl;//TODO Peng return jvRequest; } @@ -1454,13 +1457,11 @@ rpcClient(std::vector const& args, jvRequest["admin_password"] = setup.client.admin_password; if (jvRequest.isObject()) - //{ - //jvRequest["api_version"] = RPC::APIVersionCommandLine; + { jvParams.append (jvRequest); - //} + } else if (jvRequest.isArray()) { - //jvParams.append(RPC::getAPIVersionString()); for (Json::UInt i = 0; i < jvRequest.size(); ++i) jvParams.append(jvRequest[i]); } diff --git a/src/ripple/rpc/handlers/Version.h b/src/ripple/rpc/handlers/Version.h index 4a0e7aad7cd..15916ec6d50 100644 --- a/src/ripple/rpc/handlers/Version.h +++ b/src/ripple/rpc/handlers/Version.h @@ -57,20 +57,6 @@ class VersionHandler } }; -class VersionHandlerV2Plus: public VersionHandler -{ -public: - explicit VersionHandlerV2Plus (Context & c) - : VersionHandler(c) - {} - - template - void writeResult (Object& obj) - { - setVersionV2 (obj); - } -}; - } // RPC } // ripple diff --git a/src/ripple/rpc/impl/Handler.cpp b/src/ripple/rpc/impl/Handler.cpp index a1a5f94acae..e443e3d7cab 100644 --- a/src/ripple/rpc/impl/Handler.cpp +++ b/src/ripple/rpc/impl/Handler.cpp @@ -133,22 +133,19 @@ class HandlerTable { { for (std::size_t i = 0; i < N; ++i) { - auto & innerTable = table_[v - RPC::APIVersionSupportedRangeLow]; + auto & innerTable = table_[versionToIndex(v)]; auto const& entry = entries[i]; assert (innerTable.find(entry.name_) == innerTable.end()); innerTable[entry.name_] = entry; } // This is where the new-style handlers are added. + // This is also where different versions of handlers are added. addHandler(v); - - if(v == RPC::APIFirstVersion) - addHandler(v); - else - addHandler(v); + addHandler(v); } } -//TODO remove RPC:: + public: static HandlerTable const& instance() { @@ -160,7 +157,7 @@ class HandlerTable { { if(version > RPC::APIVersionSupportedRangeHigh || version < RPC::APIVersionSupportedRangeLow) return nullptr; - auto & innerTable = table_[version - RPC::APIVersionSupportedRangeLow]; + auto & innerTable = table_[versionToIndex(version)]; auto i = innerTable.find(name); return i == innerTable.end() ? nullptr : &i->second; } @@ -179,20 +176,6 @@ class HandlerTable { return std::vector(name_set.begin(), name_set.end()); } - std::array, APINumberVersionSupported> - getVersionedHandlerNames() const - { - std::array, APINumberVersionSupported> ret; - for ( int index = 0; index < table_.size(); ++index) - { - ret[index].reserve(table_[index].size()); - for (auto const& i : table_[index]) - { - ret[index].push_back(i.second.name_); - } - } - return ret; - } private: std::array, APINumberVersionSupported> table_; @@ -200,7 +183,7 @@ class HandlerTable { void addHandler(unsigned version) { assert (version >= RPC::APIVersionSupportedRangeLow && version <= RPC::APIVersionSupportedRangeHigh); - auto & innerTable = table_[version - RPC::APIVersionSupportedRangeLow]; + auto & innerTable = table_[versionToIndex(version)]; assert (innerTable.find(HandlerImpl::name()) == innerTable.end()); Handler h; @@ -211,6 +194,11 @@ class HandlerTable { innerTable[HandlerImpl::name()] = h; } + + inline unsigned versionToIndex(unsigned version) const + { + return version - RPC::APIVersionSupportedRangeLow; + } }; } // namespace @@ -226,11 +214,5 @@ getHandlerNames() return HandlerTable::instance().getHandlerNames(); }; -std::array, APINumberVersionSupported> -getVersionedHandlerNames() -{ - return HandlerTable::instance().getVersionedHandlerNames(); -}; - } // RPC } // ripple diff --git a/src/ripple/rpc/impl/RPCHelpers.h b/src/ripple/rpc/impl/RPCHelpers.h index 534d4d4c9fb..26ff70fcccf 100644 --- a/src/ripple/rpc/impl/RPCHelpers.h +++ b/src/ripple/rpc/impl/RPCHelpers.h @@ -126,9 +126,9 @@ extern beast::SemanticVersion const lastVersion; * Requests with a version number in the range * [APIVersionRangeLow, APIVersionRangeHigh] are supported. * - * Network Requests without explicit version number use APIFirstVersion. - * Command line Requests without explicit version number use - * APIVersionCommandLine. + * Network Requests without explicit version number use + * APIVersionIfUnspecified. + * Command line Requests use APIVersionCommandLine. */ constexpr unsigned APIInvalidVersion = 0; @@ -154,17 +154,7 @@ setVersion(Object& parent) std::pair chooseLedgerEntryType(Json::Value const& params); -template -void -setVersionV2(Object& parent) -{ - auto&& object = addObject (parent, jss::version); - object[jss::api_version_low] = APIVersionSupportedRangeLow; - object[jss::api_version] = APIVersionSupportedRangeHigh; -} - unsigned getAPIVersionNumber(const Json::Value & value); - } // RPC } // ripple diff --git a/src/ripple/rpc/impl/ServerHandlerImp.cpp b/src/ripple/rpc/impl/ServerHandlerImp.cpp index cc6f3b4b510..48c28947af9 100644 --- a/src/ripple/rpc/impl/ServerHandlerImp.cpp +++ b/src/ripple/rpc/impl/ServerHandlerImp.cpp @@ -425,9 +425,9 @@ ServerHandlerImp::processSession( } auto required = RPC::roleRequired(apiVersion, - jv.isMember(jss::command) ? - jv[jss::command].asString() : - jv[jss::method].asString()); + jv.isMember(jss::command) ? + jv[jss::command].asString() : + jv[jss::method].asString()); auto role = requestRole( required, session->port(), @@ -555,7 +555,7 @@ make_json_error(Json::Int code, Json::Value&& message) Json::Int constexpr method_not_found = -32601; Json::Int constexpr server_overloaded = -32604; Json::Int constexpr forbidden = -32605; -Json::Int constexpr wrong_version = -32606;//TODO Peng +Json::Int constexpr wrong_version = -32606; void ServerHandlerImp::processRequest (Port const& port, @@ -596,41 +596,6 @@ ServerHandlerImp::processRequest (Port const& port, auto const start (std::chrono::high_resolution_clock::now ()); for (unsigned i = 0; i < size; ++i) { -// auto apiVersion = RPC::APIVersionIfUnspecified; -// if(batch && i == 0) -// { -// Json::Value const& jsonRPC = jsonOrig[jss::params][i]; -// if(jsonRPC.isString()) -// { -// std::string s = jsonRPC.asString(); -// // the version field's format is "api_version=x" where x is the version number -// // sizeof(jss::api_version) is the same as the number of chars in "api_version=" -// auto pos = s.find('='); -// if(pos != std::string::npos && -// 0 == s.compare(0, pos, jss::api_version)) -// { -// bool goodApiVersion = false; -// try { -// std::stringstream version_stream(s.substr(pos)); -// version_stream >> apiVersion; -// if(apiVersion >= RPC::APIFirstVersion) -// goodApiVersion = true; -// } catch (...) { -// -// } -// //merge below -// if(!goodApiVersion) -// { -// Json::Value r(Json::objectValue); -// r[jss::request] = jsonRPC; -// r[jss::error] = make_json_error(wrong_version, "Wrong version number format"); -// reply.append(r); -// continue; -// } -// } -// } -// } - Json::Value const& jsonRPC = batch ? jsonOrig[jss::params][i] : jsonOrig; @@ -643,8 +608,6 @@ ServerHandlerImp::processRequest (Port const& port, continue; } -// std::cout << "rpc request received: " << jsonRPC << std::endl; - auto apiVersion = RPC::APIVersionIfUnspecified; if (jsonRPC.isMember(jss::params) && jsonRPC[jss::params].isArray() && @@ -652,15 +615,27 @@ ServerHandlerImp::processRequest (Port const& port, jsonRPC[jss::params][Json::UInt(0)].isObject()) { apiVersion = RPC::getAPIVersionNumber(jsonRPC[jss::params][Json::UInt(0)]); -// std::cout << "rpc request received: after version " << apiVersion << std::endl; - if(apiVersion == RPC::APIInvalidVersion) + } + + if ( apiVersion == RPC::APIVersionIfUnspecified && batch) + { + // for batch request, api_version may be at a different level + apiVersion = RPC::getAPIVersionNumber(jsonRPC); + } + + if(apiVersion == RPC::APIInvalidVersion) + { + if (!batch) { - Json::Value r(Json::objectValue); - r[jss::request] = jsonRPC; - r[jss::error] = make_json_error(wrong_version, "Wrong version number format"); - reply.append(r); - continue; + HTTPReply (400, "Unable to parse request: " + "invalid version", output, rpcJ); + return; } + Json::Value r(Json::objectValue); + r[jss::request] = jsonRPC; + r[jss::error] = make_json_error(wrong_version, "invalid version"); + reply.append(r); + continue; } /* ------------------------------------------------------------------ */ diff --git a/src/test/rpc/RPCCall_test.cpp b/src/test/rpc/RPCCall_test.cpp index a90e4ed6b71..4b263476b09 100644 --- a/src/test/rpc/RPCCall_test.cpp +++ b/src/test/rpc/RPCCall_test.cpp @@ -7315,9 +7315,6 @@ class RPCCall_test : public beast::unit_test::suite rmErrorCode (got); rmErrorCode (exp); -// std::cout << "got " << got << std::endl; -// std::cout << "exp " << exp << std::endl; - // Pass if we didn't expect a throw and we got what we expected. if ((rpcCallTest.throwsWhat == RPCCallTestData::no_exception) && (got == exp)) diff --git a/src/test/rpc/Version_test.cpp b/src/test/rpc/Version_test.cpp new file mode 100644 index 00000000000..e1c5c6d4069 --- /dev/null +++ b/src/test/rpc/Version_test.cpp @@ -0,0 +1,166 @@ +//------------------------------------------------------------------------------ +/* + This file is part of rippled: https://github.com/ripple/rippled + Copyright (c) 2012-2017 Ripple Labs Inc. + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ +//============================================================================== + +#include +#include + +namespace ripple { + +class Version_test : public beast::unit_test::suite +{ + void + testCorrectVersionNumber() + { + testcase ("right api_version: explicitly specified or filled by parser"); + + using namespace test::jtx; + Env env {*this}; + + auto isCorrectReply = [](Json::Value const & re) -> bool + { + if(re.isMember(jss::error)) + return false; + return re.isMember(jss::version); + }; + + auto jrr = env.rpc("json", "version", "{\"api_version\": " + + std::to_string(RPC::APIVersionSupportedRangeHigh) + + "}") [jss::result]; + BEAST_EXPECT(isCorrectReply(jrr)); + + jrr = env.rpc("version") [jss::result]; + BEAST_EXPECT(isCorrectReply(jrr)); + } + + void + testWrongVersionNumber() + { + testcase ("wrong api_version: too low, too high, or wrong format"); + + using namespace test::jtx; + Env env {*this}; + + auto get_error_what = [](Json::Value const & re) -> std::string + { + if(re.isMember("error_what")) + if(re["error_what"].isString()) + return re["error_what"].asString(); + return {}; + }; + + auto re = env.rpc("json", "version", "{\"api_version\": " + + std::to_string(RPC::APIVersionSupportedRangeLow - 1) + + "}"); + BEAST_EXPECT(get_error_what(re).find("invalid version")); + + re = env.rpc("json", "version", "{\"api_version\": " + + std::to_string(RPC::APIVersionSupportedRangeHigh + 1) + + "}"); + BEAST_EXPECT(get_error_what(re).find("invalid version")); + + re = env.rpc("json", "version", "{\"api_version\": \"deadbeef\"}"); + BEAST_EXPECT(get_error_what(re).find("invalid version")); + } + + void + testBatch() + { + testcase ("batch, all good request"); + + using namespace test::jtx; + Env env {*this}; + + auto const without_api_verion = std::string ("{ ") + + "\"jsonrpc\": \"2.0\", " + "\"ripplerpc\": \"2.0\", " + "\"id\": 5, " + "\"method\": \"version\", " + "\"params\": {}}"; + auto const with_api_verion = std::string ("{ ") + + "\"jsonrpc\": \"2.0\", " + "\"ripplerpc\": \"2.0\", " + "\"id\": 6, " + "\"method\": \"version\", " + "\"params\": { " + "\"api_version\": " + std::to_string(RPC::APIVersionSupportedRangeHigh) + + "}}"; + auto re = env.rpc("json2", '[' + without_api_verion + ", " + + with_api_verion + ']'); + + if( !BEAST_EXPECT( re.isArray() )) + return; + if( !BEAST_EXPECT( re.size() == 2 )) + return; + BEAST_EXPECT(re[0u].isMember(jss::result) && + re[0u][jss::result].isMember(jss::version)); + BEAST_EXPECT(re[1u].isMember(jss::result) && + re[1u][jss::result].isMember(jss::version)); + } + + void + testBatchFail() + { + testcase ("batch, with a bad request"); + + using namespace test::jtx; + Env env {*this}; + + auto const without_api_verion = std::string ("{ ") + + "\"jsonrpc\": \"2.0\", " + "\"ripplerpc\": \"2.0\", " + "\"id\": 5, " + "\"method\": \"version\", " + "\"params\": {}}"; + auto const with_wrong_api_verion = std::string ("{ ") + + "\"jsonrpc\": \"2.0\", " + "\"ripplerpc\": \"2.0\", " + "\"id\": 6, " + "\"method\": \"version\", " + "\"params\": { " + "\"api_version\": " + + std::to_string(RPC::APIVersionSupportedRangeHigh+1) + + "}}"; + auto re = env.rpc("json2", '[' + without_api_verion + ", " + + with_wrong_api_verion + ']'); + + std::cout << re << std::endl; + + if( !BEAST_EXPECT( re.isArray() )) + return; + if( !BEAST_EXPECT( re.size() == 2 )) + return; + BEAST_EXPECT(re[0u].isMember(jss::result) && + re[0u][jss::result].isMember(jss::version)); + BEAST_EXPECT(re[1u].isMember(jss::error)); + } + +public: + + void run() override + { + testCorrectVersionNumber(); + testWrongVersionNumber(); + testBatch(); + testBatchFail(); + } +}; + +BEAST_DEFINE_TESTSUITE(Version,rpc,ripple); + +} // ripple diff --git a/src/test/unity/rpc_test_unity.cpp b/src/test/unity/rpc_test_unity.cpp index a3bc197c613..e2ff3b9e161 100644 --- a/src/test/unity/rpc_test_unity.cpp +++ b/src/test/unity/rpc_test_unity.cpp @@ -52,3 +52,4 @@ #include #include #include +#include From 9da25552a64913c75aea4f78c3698b02c5e4b800 Mon Sep 17 00:00:00 2001 From: Peng Wang Date: Tue, 12 Nov 2019 15:09:07 -0500 Subject: [PATCH 3/7] code clean --- CMakeLists.txt | 3 --- src/ripple/net/impl/RPCCall.cpp | 3 --- src/ripple/rpc/impl/RPCHelpers.h | 3 ++- src/test/rpc/Version_test.cpp | 2 -- 4 files changed, 2 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 999962d8fb1..723d049e78e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required (VERSION 3.9.0) list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/Builds/CMake) -set (BOOST_ROOT /home/pwang/Install/boost_1_70_0) -set (BOOST_LIBRARYDIR /home/pwang/Install/boost_1_70_0) - set (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Builds/CMake ${CMAKE_MODULE_PATH}) include (CheckCXXCompilerFlag) if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.11) diff --git a/src/ripple/net/impl/RPCCall.cpp b/src/ripple/net/impl/RPCCall.cpp index b779fef8f59..d024266e54e 100644 --- a/src/ripple/net/impl/RPCCall.cpp +++ b/src/ripple/net/impl/RPCCall.cpp @@ -1369,7 +1369,6 @@ rpcCmdLineToJson (std::vector const& args, } JLOG (j.trace()) << "RPC Request: " << jvRequest << std::endl; - return jvRequest; } @@ -1457,9 +1456,7 @@ rpcClient(std::vector const& args, jvRequest["admin_password"] = setup.client.admin_password; if (jvRequest.isObject()) - { jvParams.append (jvRequest); - } else if (jvRequest.isArray()) { for (Json::UInt i = 0; i < jvRequest.size(); ++i) diff --git a/src/ripple/rpc/impl/RPCHelpers.h b/src/ripple/rpc/impl/RPCHelpers.h index 26ff70fcccf..b4c08454e49 100644 --- a/src/ripple/rpc/impl/RPCHelpers.h +++ b/src/ripple/rpc/impl/RPCHelpers.h @@ -123,10 +123,11 @@ extern beast::SemanticVersion const lastVersion; /** * API version numbers used in later API versions + * * Requests with a version number in the range * [APIVersionRangeLow, APIVersionRangeHigh] are supported. * - * Network Requests without explicit version number use + * Network Requests without explicit version numbers use * APIVersionIfUnspecified. * Command line Requests use APIVersionCommandLine. */ diff --git a/src/test/rpc/Version_test.cpp b/src/test/rpc/Version_test.cpp index e1c5c6d4069..d0005f7a8eb 100644 --- a/src/test/rpc/Version_test.cpp +++ b/src/test/rpc/Version_test.cpp @@ -139,8 +139,6 @@ class Version_test : public beast::unit_test::suite auto re = env.rpc("json2", '[' + without_api_verion + ", " + with_wrong_api_verion + ']'); - std::cout << re << std::endl; - if( !BEAST_EXPECT( re.isArray() )) return; if( !BEAST_EXPECT( re.size() == 2 )) From a122f4f99ad13d8a5e9696b39de26a05eff47fca Mon Sep 17 00:00:00 2001 From: Peng Wang Date: Wed, 13 Nov 2019 00:38:07 -0500 Subject: [PATCH 4/7] add RPCHelpers.h to ServerHandlerImp.cpp --- src/ripple/rpc/impl/ServerHandlerImp.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ripple/rpc/impl/ServerHandlerImp.cpp b/src/ripple/rpc/impl/ServerHandlerImp.cpp index 48c28947af9..ca568eae2c2 100644 --- a/src/ripple/rpc/impl/ServerHandlerImp.cpp +++ b/src/ripple/rpc/impl/ServerHandlerImp.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include From f51bc3a4cc9075ed30142ee5cc8c029d78fc4045 Mon Sep 17 00:00:00 2001 From: Peng Wang Date: Wed, 13 Nov 2019 11:37:24 -0500 Subject: [PATCH 5/7] RPCHelpers.h to test files --- src/ripple/rpc/impl/Handler.cpp | 1 + src/test/rpc/RPCCall_test.cpp | 1 + src/test/rpc/Version_test.cpp | 1 + 3 files changed, 3 insertions(+) diff --git a/src/ripple/rpc/impl/Handler.cpp b/src/ripple/rpc/impl/Handler.cpp index e443e3d7cab..293189f3bcc 100644 --- a/src/ripple/rpc/impl/Handler.cpp +++ b/src/ripple/rpc/impl/Handler.cpp @@ -20,6 +20,7 @@ #include #include #include +#include namespace ripple { namespace RPC { diff --git a/src/test/rpc/RPCCall_test.cpp b/src/test/rpc/RPCCall_test.cpp index 4b263476b09..c5f7922a90c 100644 --- a/src/test/rpc/RPCCall_test.cpp +++ b/src/test/rpc/RPCCall_test.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include diff --git a/src/test/rpc/Version_test.cpp b/src/test/rpc/Version_test.cpp index d0005f7a8eb..12fcac8f4a0 100644 --- a/src/test/rpc/Version_test.cpp +++ b/src/test/rpc/Version_test.cpp @@ -19,6 +19,7 @@ #include #include +#include namespace ripple { From e3deece7f284070bca2ff07575b3f24a4cf4ddf5 Mon Sep 17 00:00:00 2001 From: Peng Wang Date: Thu, 21 Nov 2019 17:22:55 -0500 Subject: [PATCH 6/7] requested changes for PR comments --- src/ripple/app/main/Application.cpp | 2 +- src/ripple/net/impl/RPCCall.cpp | 2 +- src/ripple/protocol/jss.h | 2 + src/ripple/rpc/Context.h | 2 +- src/ripple/rpc/RPCHandler.h | 2 +- src/ripple/rpc/impl/Handler.cpp | 8 +-- src/ripple/rpc/impl/Handler.h | 2 +- src/ripple/rpc/impl/RPCHandler.cpp | 2 +- src/ripple/rpc/impl/RPCHelpers.cpp | 29 ++++++----- src/ripple/rpc/impl/RPCHelpers.h | 47 ++++++++++++----- src/ripple/rpc/impl/ServerHandlerImp.cpp | 8 +-- src/test/rpc/RPCCall_test.cpp | 4 +- src/test/rpc/Version_test.cpp | 65 ++++++++++++++++++------ 13 files changed, 117 insertions(+), 58 deletions(-) diff --git a/src/ripple/app/main/Application.cpp b/src/ripple/app/main/Application.cpp index 4fa147a4118..c37e52299bb 100644 --- a/src/ripple/app/main/Application.cpp +++ b/src/ripple/app/main/Application.cpp @@ -1572,7 +1572,7 @@ bool ApplicationImp::setup() Resource::Consumer c; RPC::Context context { journal ("RPCHandler"), jvCommand, *this, loadType, getOPs (), getLedgerMaster(), c, Role::ADMIN, - RPC::APIVersionRippledStartUp}; + RPC::ApiMaximumSupportedVersion}; Json::Value jvResult; RPC::doCommand (context, jvResult); diff --git a/src/ripple/net/impl/RPCCall.cpp b/src/ripple/net/impl/RPCCall.cpp index d024266e54e..9ea017ee65a 100644 --- a/src/ripple/net/impl/RPCCall.cpp +++ b/src/ripple/net/impl/RPCCall.cpp @@ -1356,7 +1356,7 @@ rpcCmdLineToJson (std::vector const& args, auto insert_api_version = [](Json::Value & jr){ if(!jr.isMember(jss::error) && !jr.isMember(jss::api_version)) - jr[jss::api_version] = RPC::APIVersionCommandLine; + jr[jss::api_version] = RPC::ApiMaximumSupportedVersion; }; if(jvRequest.isObject()) diff --git a/src/ripple/protocol/jss.h b/src/ripple/protocol/jss.h index 30e042f61b4..9cf34b19a95 100644 --- a/src/ripple/protocol/jss.h +++ b/src/ripple/protocol/jss.h @@ -263,6 +263,8 @@ JSS ( index ); // in: LedgerEntry, DownloadShard // field JSS ( info ); // out: ServerInfo, ConsensusInfo, FetchInfo JSS ( internal_command ); // in: Internal +JSS ( invalid_API_version ); // out: Many, when a request has an invalid + // version JSS ( io_latency_ms ); // out: NetworkOPs JSS ( ip ); // in: Connect, out: OverlayImpl JSS ( issuer ); // in: RipplePathFind, Subscribe, diff --git a/src/ripple/rpc/Context.h b/src/ripple/rpc/Context.h index 0590053a59c..404b60237d3 100644 --- a/src/ripple/rpc/Context.h +++ b/src/ripple/rpc/Context.h @@ -55,7 +55,7 @@ struct Context LedgerMaster& ledgerMaster; Resource::Consumer& consumer; Role role; - unsigned apiVersion; + unsigned int apiVersion; std::shared_ptr coro {}; InfoSub::pointer infoSub {}; Headers headers {}; diff --git a/src/ripple/rpc/RPCHandler.h b/src/ripple/rpc/RPCHandler.h index ffc6efc4ba2..13cd521f95b 100644 --- a/src/ripple/rpc/RPCHandler.h +++ b/src/ripple/rpc/RPCHandler.h @@ -33,7 +33,7 @@ struct Context; /** Execute an RPC command and store the results in a Json::Value. */ Status doCommand (RPC::Context&, Json::Value&); -Role roleRequired (unsigned version, std::string const& method ); +Role roleRequired (unsigned int version, std::string const& method ); } // RPC } // ripple diff --git a/src/ripple/rpc/impl/Handler.cpp b/src/ripple/rpc/impl/Handler.cpp index 293189f3bcc..c34795470ca 100644 --- a/src/ripple/rpc/impl/Handler.cpp +++ b/src/ripple/rpc/impl/Handler.cpp @@ -130,7 +130,7 @@ class HandlerTable { explicit HandlerTable (const Handler(&entries)[N]) { - for(auto v = RPC::APIVersionSupportedRangeLow; v <= RPC::APIVersionSupportedRangeHigh; ++v) + for(auto v = RPC::ApiMinimumSupportedVersion; v <= RPC::ApiMaximumSupportedVersion; ++v) { for (std::size_t i = 0; i < N; ++i) { @@ -156,7 +156,7 @@ class HandlerTable { Handler const* getHandler(unsigned version, std::string name) const { - if(version > RPC::APIVersionSupportedRangeHigh || version < RPC::APIVersionSupportedRangeLow) + if(version > RPC::ApiMaximumSupportedVersion || version < RPC::ApiMinimumSupportedVersion) return nullptr; auto & innerTable = table_[versionToIndex(version)]; auto i = innerTable.find(name); @@ -183,7 +183,7 @@ class HandlerTable { template void addHandler(unsigned version) { - assert (version >= RPC::APIVersionSupportedRangeLow && version <= RPC::APIVersionSupportedRangeHigh); + assert (version >= RPC::ApiMinimumSupportedVersion && version <= RPC::ApiMaximumSupportedVersion); auto & innerTable = table_[versionToIndex(version)]; assert (innerTable.find(HandlerImpl::name()) == innerTable.end()); @@ -198,7 +198,7 @@ class HandlerTable { inline unsigned versionToIndex(unsigned version) const { - return version - RPC::APIVersionSupportedRangeLow; + return version - RPC::ApiMinimumSupportedVersion; } }; diff --git a/src/ripple/rpc/impl/Handler.h b/src/ripple/rpc/impl/Handler.h index 59fede84d17..15014c8fa83 100644 --- a/src/ripple/rpc/impl/Handler.h +++ b/src/ripple/rpc/impl/Handler.h @@ -51,7 +51,7 @@ struct Handler RPC::Condition condition_; }; -Handler const* getHandler (unsigned version, std::string const&); +Handler const* getHandler (unsigned int version, std::string const&); /** Return a Json::objectValue with a single entry. */ template diff --git a/src/ripple/rpc/impl/RPCHandler.cpp b/src/ripple/rpc/impl/RPCHandler.cpp index 5b95c649eae..1b6d81a7efc 100644 --- a/src/ripple/rpc/impl/RPCHandler.cpp +++ b/src/ripple/rpc/impl/RPCHandler.cpp @@ -296,7 +296,7 @@ Status doCommand ( return rpcUNKNOWN_COMMAND; } -Role roleRequired (unsigned version, std::string const& method) +Role roleRequired (unsigned int version, std::string const& method) { auto handler = RPC::getHandler(version, method); diff --git a/src/ripple/rpc/impl/RPCHelpers.cpp b/src/ripple/rpc/impl/RPCHelpers.cpp index 4a95bc41eb5..5409e73bc0d 100644 --- a/src/ripple/rpc/impl/RPCHelpers.cpp +++ b/src/ripple/rpc/impl/RPCHelpers.cpp @@ -716,22 +716,23 @@ beast::SemanticVersion const firstVersion("1.0.0"); beast::SemanticVersion const goodVersion("1.0.0"); beast::SemanticVersion const lastVersion("1.0.0"); -unsigned getAPIVersionNumber(const Json::Value & jv) +unsigned int getAPIVersionNumber(Json::Value const& jv) { - if (jv.isMember(jss::api_version)) + static Json::Value const minVersion (RPC::ApiMinimumSupportedVersion); + static Json::Value const maxVersion (RPC::ApiMaximumSupportedVersion); + static Json::Value const invalidVersion (RPC::APIInvalidVersion); + + Json::Value requestedVersion(RPC::APIVersionIfUnspecified); + if(jv.isObject()) { - if(jv[jss::api_version].isInt()) - { - unsigned apiVersion = jv[jss::api_version].asInt(); - if(apiVersion >= RPC::APIVersionSupportedRangeLow && - apiVersion <= RPC::APIVersionSupportedRangeHigh) - { - return apiVersion; - } - } - return RPC::APIInvalidVersion; - } else - return RPC::APIVersionIfUnspecified; + requestedVersion = jv.get (jss::api_version, requestedVersion); + } + if( !(requestedVersion.isInt() || requestedVersion.isUInt()) || + requestedVersion < minVersion || requestedVersion > maxVersion) + { + requestedVersion = invalidVersion; + } + return requestedVersion.asUInt(); } } // RPC diff --git a/src/ripple/rpc/impl/RPCHelpers.h b/src/ripple/rpc/impl/RPCHelpers.h index b4c08454e49..981f352dbbc 100644 --- a/src/ripple/rpc/impl/RPCHelpers.h +++ b/src/ripple/rpc/impl/RPCHelpers.h @@ -125,22 +125,30 @@ extern beast::SemanticVersion const lastVersion; * API version numbers used in later API versions * * Requests with a version number in the range - * [APIVersionRangeLow, APIVersionRangeHigh] are supported. + * [ApiMinimumSupportedVersion, ApiMaximumSupportedVersion] + * are supported. * * Network Requests without explicit version numbers use - * APIVersionIfUnspecified. - * Command line Requests use APIVersionCommandLine. + * APIVersionIfUnspecified. APIVersionIfUnspecified is 1, + * because all the RPC requests with a version >= 2 must + * explicitly specify the version in the requests. + * Note that APIVersionIfUnspecified will be lower than + * ApiMinimumSupportedVersion when we stop supporting API + * version 1. + * + * Command line Requests use ApiMaximumSupportedVersion. */ -constexpr unsigned APIInvalidVersion = 0; -constexpr unsigned APIFirstVersion = 1; -constexpr unsigned APIVersionSupportedRangeLow = 1; -constexpr unsigned APIVersionSupportedRangeHigh = 1; -constexpr unsigned APIVersionIfUnspecified = APIFirstVersion; -constexpr unsigned APIVersionCommandLine = APIVersionSupportedRangeHigh; -constexpr unsigned APIVersionRippledStartUp = APIVersionSupportedRangeHigh; -constexpr unsigned APINumberVersionSupported = APIVersionSupportedRangeHigh - - APIVersionSupportedRangeLow + 1; +constexpr unsigned int APIInvalidVersion = 0; +constexpr unsigned int APIVersionIfUnspecified = 1; +constexpr unsigned int ApiMinimumSupportedVersion = 1; +constexpr unsigned int ApiMaximumSupportedVersion = 1; +constexpr unsigned int APINumberVersionSupported = ApiMaximumSupportedVersion - + ApiMinimumSupportedVersion + 1; + +static_assert (ApiMinimumSupportedVersion >= APIVersionIfUnspecified); +static_assert (ApiMaximumSupportedVersion >= ApiMinimumSupportedVersion); + template void @@ -155,7 +163,20 @@ setVersion(Object& parent) std::pair chooseLedgerEntryType(Json::Value const& params); -unsigned getAPIVersionNumber(const Json::Value & value); +/** + * Retrieve the api version number from the json value + * + * Note that APIInvalidVersion will be returned if + * 1) the version number field has a wrong format + * 2) the version number retrieved is out of the supported range + * 3) the version number is unspecified and + * APIVersionIfUnspecified is out of the supported range + * + * @param value a Json value that may or may not specifies + * the api version number + * @return the api version number + */ +unsigned int getAPIVersionNumber(const Json::Value & value); } // RPC } // ripple diff --git a/src/ripple/rpc/impl/ServerHandlerImp.cpp b/src/ripple/rpc/impl/ServerHandlerImp.cpp index ca568eae2c2..c625ec9f0ac 100644 --- a/src/ripple/rpc/impl/ServerHandlerImp.cpp +++ b/src/ripple/rpc/impl/ServerHandlerImp.cpp @@ -410,7 +410,8 @@ ServerHandlerImp::processSession( { jr[jss::type] = jss::response; jr[jss::status] = jss::error; - jr[jss::error] = jss::missingCommand; + jr[jss::error] = apiVersion == RPC::APIInvalidVersion ? + jss::invalid_API_version : jss::missingCommand; jr[jss::request] = jv; if (jv.isMember (jss::id)) jr[jss::id] = jv[jss::id]; @@ -628,13 +629,12 @@ ServerHandlerImp::processRequest (Port const& port, { if (!batch) { - HTTPReply (400, "Unable to parse request: " - "invalid version", output, rpcJ); + HTTPReply (400, jss::invalid_API_version.c_str(), output, rpcJ); return; } Json::Value r(Json::objectValue); r[jss::request] = jsonRPC; - r[jss::error] = make_json_error(wrong_version, "invalid version"); + r[jss::error] = make_json_error(wrong_version, jss::invalid_API_version.c_str()); reply.append(r); continue; } diff --git a/src/test/rpc/RPCCall_test.cpp b/src/test/rpc/RPCCall_test.cpp index c5f7922a90c..21eb3cec73d 100644 --- a/src/test/rpc/RPCCall_test.cpp +++ b/src/test/rpc/RPCCall_test.cpp @@ -7253,8 +7253,8 @@ static RPCCallTestData const rpcCallTestArray [] = std::string updateAPIVersionString(const char * const req) { - static std::string version_str = "\"" + std::string(jss::api_version) + "\" : " - + std::to_string(RPC::APIVersionCommandLine); + static std::string version_str = "\"" + std::string(jss::api_version) + "\" : " + + std::to_string(RPC::ApiMaximumSupportedVersion); static auto place_holder = "\"api_version\" : 1"; std::string jr(req); boost::replace_all(jr, place_holder, version_str); diff --git a/src/test/rpc/Version_test.cpp b/src/test/rpc/Version_test.cpp index 12fcac8f4a0..2d5e7f04348 100644 --- a/src/test/rpc/Version_test.cpp +++ b/src/test/rpc/Version_test.cpp @@ -41,7 +41,7 @@ class Version_test : public beast::unit_test::suite }; auto jrr = env.rpc("json", "version", "{\"api_version\": " + - std::to_string(RPC::APIVersionSupportedRangeHigh) + std::to_string(RPC::ApiMaximumSupportedVersion) + "}") [jss::result]; BEAST_EXPECT(isCorrectReply(jrr)); @@ -57,26 +57,60 @@ class Version_test : public beast::unit_test::suite using namespace test::jtx; Env env {*this}; - auto get_error_what = [](Json::Value const & re) -> std::string + auto get_error_what = [](Json::Value const &re) -> std::string { - if(re.isMember("error_what")) - if(re["error_what"].isString()) + if (re.isMember("error_what")) + if (re["error_what"].isString()) return re["error_what"].asString(); return {}; }; auto re = env.rpc("json", "version", "{\"api_version\": " + - std::to_string(RPC::APIVersionSupportedRangeLow - 1) - + "}"); - BEAST_EXPECT(get_error_what(re).find("invalid version")); + std::to_string(RPC::ApiMinimumSupportedVersion - 1) + + "}"); + BEAST_EXPECT(get_error_what(re).find(jss::invalid_API_version.c_str())); re = env.rpc("json", "version", "{\"api_version\": " + - std::to_string(RPC::APIVersionSupportedRangeHigh + 1) - + "}"); - BEAST_EXPECT(get_error_what(re).find("invalid version")); + std::to_string(RPC::ApiMaximumSupportedVersion + 1) + + "}"); + BEAST_EXPECT(get_error_what(re).find(jss::invalid_API_version.c_str())); - re = env.rpc("json", "version", "{\"api_version\": \"deadbeef\"}"); - BEAST_EXPECT(get_error_what(re).find("invalid version")); + re = env.rpc("json", "version", "{\"api_version\": \"a\"}"); + BEAST_EXPECT(get_error_what(re).find(jss::invalid_API_version.c_str())); + } + + void testGetAPIVersionNumber() + { + testcase ("test getAPIVersionNumber function"); + + unsigned int versionIfUnspecified = + RPC::APIVersionIfUnspecified < RPC::ApiMinimumSupportedVersion ? + RPC::APIInvalidVersion : RPC::APIVersionIfUnspecified; + + Json::Value j_array = Json::Value (Json::arrayValue); + Json::Value j_null = Json::Value (Json::nullValue); + BEAST_EXPECT(RPC::getAPIVersionNumber(j_array) == versionIfUnspecified); + BEAST_EXPECT(RPC::getAPIVersionNumber(j_null) == versionIfUnspecified); + + Json::Value j_object = Json::Value (Json::objectValue); + BEAST_EXPECT(RPC::getAPIVersionNumber(j_object) == versionIfUnspecified); + j_object[jss::api_version] = RPC::APIVersionIfUnspecified; + BEAST_EXPECT(RPC::getAPIVersionNumber(j_object) == versionIfUnspecified); + + j_object[jss::api_version] = RPC::ApiMinimumSupportedVersion; + BEAST_EXPECT(RPC::getAPIVersionNumber(j_object) == RPC::ApiMinimumSupportedVersion); + j_object[jss::api_version] = RPC::ApiMaximumSupportedVersion; + BEAST_EXPECT(RPC::getAPIVersionNumber(j_object) == RPC::ApiMaximumSupportedVersion); + + j_object[jss::api_version] = RPC::ApiMinimumSupportedVersion - 1; + BEAST_EXPECT(RPC::getAPIVersionNumber(j_object) == RPC::APIInvalidVersion); + j_object[jss::api_version] = RPC::ApiMaximumSupportedVersion + 1; + BEAST_EXPECT(RPC::getAPIVersionNumber(j_object) == RPC::APIInvalidVersion); + + j_object[jss::api_version] = RPC::APIInvalidVersion; + BEAST_EXPECT(RPC::getAPIVersionNumber(j_object) == RPC::APIInvalidVersion); + j_object[jss::api_version] = "a"; + BEAST_EXPECT(RPC::getAPIVersionNumber(j_object) == RPC::APIInvalidVersion); } void @@ -99,8 +133,8 @@ class Version_test : public beast::unit_test::suite "\"id\": 6, " "\"method\": \"version\", " "\"params\": { " - "\"api_version\": " + std::to_string(RPC::APIVersionSupportedRangeHigh) + - "}}"; + "\"api_version\": " + std::to_string(RPC::ApiMaximumSupportedVersion) + + "}}"; auto re = env.rpc("json2", '[' + without_api_verion + ", " + with_api_verion + ']'); @@ -135,7 +169,7 @@ class Version_test : public beast::unit_test::suite "\"method\": \"version\", " "\"params\": { " "\"api_version\": " + - std::to_string(RPC::APIVersionSupportedRangeHigh+1) + + std::to_string(RPC::ApiMaximumSupportedVersion + 1) + "}}"; auto re = env.rpc("json2", '[' + without_api_verion + ", " + with_wrong_api_verion + ']'); @@ -155,6 +189,7 @@ class Version_test : public beast::unit_test::suite { testCorrectVersionNumber(); testWrongVersionNumber(); + testGetAPIVersionNumber(); testBatch(); testBatchFail(); } From f4661e0eab2281ff6136aa88be4b653e23066880 Mon Sep 17 00:00:00 2001 From: Peng Wang Date: Fri, 22 Nov 2019 13:13:28 -0500 Subject: [PATCH 7/7] requested changes for PR comments 2 --- src/ripple/net/impl/RPCCall.cpp | 14 +- src/ripple/rpc/impl/ServerHandlerImp.cpp | 2 +- src/test/rpc/RPCCall_test.cpp | 409 +++++++++++------------ 3 files changed, 212 insertions(+), 213 deletions(-) diff --git a/src/ripple/net/impl/RPCCall.cpp b/src/ripple/net/impl/RPCCall.cpp index 9ea017ee65a..d0eab389998 100644 --- a/src/ripple/net/impl/RPCCall.cpp +++ b/src/ripple/net/impl/RPCCall.cpp @@ -1355,18 +1355,18 @@ rpcCmdLineToJson (std::vector const& args, jvRequest = rpParser.parseCommand (args[0], jvRpcParams, true); auto insert_api_version = [](Json::Value & jr){ - if(!jr.isMember(jss::error) && !jr.isMember(jss::api_version)) + if( jr.isObject() && + !jr.isMember(jss::error) && + !jr.isMember(jss::api_version)) + { jr[jss::api_version] = RPC::ApiMaximumSupportedVersion; + } }; if(jvRequest.isObject()) insert_api_version(jvRequest); - else if(jvRequest.isArray()) { - for (Json::UInt j = 0; j < jvRequest.size(); ++j) { - if (jvRequest[j].isObject()) - insert_api_version(jvRequest[j]); - } - } + else if(jvRequest.isArray()) + std::for_each(jvRequest.begin(), jvRequest.end(), insert_api_version); JLOG (j.trace()) << "RPC Request: " << jvRequest << std::endl; return jvRequest; diff --git a/src/ripple/rpc/impl/ServerHandlerImp.cpp b/src/ripple/rpc/impl/ServerHandlerImp.cpp index c625ec9f0ac..7bc4a0110e9 100644 --- a/src/ripple/rpc/impl/ServerHandlerImp.cpp +++ b/src/ripple/rpc/impl/ServerHandlerImp.cpp @@ -614,7 +614,7 @@ ServerHandlerImp::processRequest (Port const& port, if (jsonRPC.isMember(jss::params) && jsonRPC[jss::params].isArray() && jsonRPC[jss::params].size() > 0 && - jsonRPC[jss::params][Json::UInt(0)].isObject()) + jsonRPC[jss::params][0u].isObject()) { apiVersion = RPC::getAPIVersionNumber(jsonRPC[jss::params][Json::UInt(0)]); } diff --git a/src/test/rpc/RPCCall_test.cpp b/src/test/rpc/RPCCall_test.cpp index 21eb3cec73d..534ef4f64ad 100644 --- a/src/test/rpc/RPCCall_test.cpp +++ b/src/test/rpc/RPCCall_test.cpp @@ -79,7 +79,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_channels", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh" } ] @@ -97,7 +97,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_channels", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "destination_account" : "FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210" } @@ -116,7 +116,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_channels", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "destination_account" : "closed" } @@ -135,7 +135,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_channels", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "destination_account" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA" } @@ -155,7 +155,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_channels", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "destination_account" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "ledger_hash" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" @@ -176,7 +176,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_channels", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "destination_account" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "ledger_index" : 90210 @@ -253,7 +253,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_currencies", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh" } ] @@ -271,7 +271,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_currencies", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "strict" : 1 } @@ -290,7 +290,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_currencies", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 42 } @@ -309,7 +309,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_currencies", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : "validated" } @@ -365,7 +365,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_currencies", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 0 } @@ -402,7 +402,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_currencies", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "3.14159", "strict" : 1 } @@ -422,7 +422,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_info", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh" } ] @@ -440,7 +440,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_info", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 77777 } @@ -459,7 +459,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_info", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : "closed" } @@ -478,7 +478,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_info", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_hash" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" } @@ -498,7 +498,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_info", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "strict" : 1 } @@ -595,7 +595,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_lines", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", } ] @@ -613,7 +613,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_lines", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "peer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA" } @@ -633,7 +633,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_lines", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 888888888, "peer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA" @@ -654,7 +654,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_lines", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : "closed", "peer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA" @@ -675,7 +675,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_lines", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_hash" : "FFFFEEEEDDDDCCCCBBBBAAAA9999888877776666555544443333222211110000", "peer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA" @@ -715,7 +715,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_lines", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 12345678, "peer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA" @@ -739,7 +739,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_lines", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 12345678, "peer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA" @@ -800,7 +800,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_lines", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh" } ] @@ -819,7 +819,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_lines", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 0, "peer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA" @@ -840,7 +840,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_objects", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh" } ] @@ -858,7 +858,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_objects", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 77777 } @@ -877,7 +877,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_objects", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : "closed" } @@ -896,7 +896,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_objects", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_hash" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" } @@ -916,7 +916,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_objects", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "strict" : 1 } @@ -936,7 +936,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_objects", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : "validated", "strict" : 1 @@ -976,7 +976,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_objects", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "strict" : 1 } @@ -999,7 +999,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_objects", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "strict" : 1 } @@ -1061,7 +1061,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_objects", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 0 } @@ -1083,7 +1083,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_objects", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 0, "strict" : 1 @@ -1104,7 +1104,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_offers", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh" } ] @@ -1122,7 +1122,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_offers", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 987654321 } @@ -1141,7 +1141,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_offers", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : "validated" } @@ -1160,7 +1160,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_offers", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_hash" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" } @@ -1180,7 +1180,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_offers", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "strict" : 1 } @@ -1201,7 +1201,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_offers", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : "validated", "strict" : 1 @@ -1241,7 +1241,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_offers", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "strict" : 1 } @@ -1302,7 +1302,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_offers", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 0 } @@ -1324,7 +1324,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_offers", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 0, "strict" : 1 @@ -1345,7 +1345,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_tx", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", } ] @@ -1363,7 +1363,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_tx", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 444 } @@ -1385,7 +1385,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_tx", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "count" : true, "binary" : true, @@ -1408,7 +1408,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_tx", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index_max" : -1, "ledger_index_min" : -1 @@ -1432,7 +1432,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_tx", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "binary" : true, "count" : true, @@ -1457,7 +1457,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_tx", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index_max" : -1, "ledger_index_min" : 247, @@ -1483,7 +1483,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_tx", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "binary" : true, "count" : true, @@ -1510,7 +1510,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_tx", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index_max" : 590, "ledger_index_min" : 589, @@ -1537,7 +1537,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_tx", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "count" : true, "descending" : true, @@ -1623,7 +1623,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "account_tx", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 0 } @@ -1731,7 +1731,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "book_offers", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "taker_gets" : { "currency" : "EUR" }, @@ -1754,7 +1754,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "book_offers", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "taker_gets" : { "currency" : "EUR", "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA" @@ -1782,7 +1782,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "book_offers", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "taker_gets" : { "currency" : "EUR" @@ -1808,7 +1808,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "book_offers", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "ledger_index" : 666, "taker_gets" : { @@ -1836,7 +1836,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "book_offers", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "ledger_index" : "current", "taker_gets" : { @@ -1864,7 +1864,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "book_offers", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789", "taker_gets" : { @@ -1895,7 +1895,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "book_offers", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789", "limit" : 200, @@ -1930,7 +1930,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "book_offers", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789", "limit" : 200, @@ -2042,7 +2042,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "book_offers", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "issuer" : "not_a_valid_issuer", "taker_gets" : { "currency" : "EUR" @@ -2068,7 +2068,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "book_offers", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "ledger_index" : 0, "taker_gets" : { @@ -2109,7 +2109,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "can_delete", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, } ] })" @@ -2125,7 +2125,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "can_delete", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "can_delete" : 4294967295 } ] @@ -2142,7 +2142,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "can_delete", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "can_delete" : "FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210" } ] @@ -2159,7 +2159,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "can_delete", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "can_delete" : "always" } ] @@ -2176,7 +2176,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "can_delete", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "can_delete" : "never" } ] @@ -2193,7 +2193,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "can_delete", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "can_delete" : "now" } ] @@ -2229,7 +2229,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "can_delete", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "can_delete" : "invalid" } ] @@ -2270,7 +2270,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "channel_authorize", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "amount" : "18446744073709551615", "channel_id" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF", "secret" : "secret_can_be_anything" @@ -2456,7 +2456,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "channel_verify", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "amount" : "0", "channel_id" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF", "public_key" : "aB4BXXLuPu8DpVuyq1DBiu3SrPdtK9AYZisKhu8mvkoiUD8J9Gov", @@ -2479,7 +2479,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "channel_verify", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "amount" : "18446744073709551615", "channel_id" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF", "public_key" : "021D93E21C44160A1B3B66DA1F37B86BE39FFEA3FC4B95FAA2063F82EE823599F6", @@ -2669,7 +2669,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "channel_verify", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "amount" : "40000000", "channel_id" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF", "public_key" : "aB4BXXLuPu8DpVuyq1DBiu3SrPdtK9AYZisKhu8mvkoiUD8J9Gov", @@ -2691,7 +2691,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "connect", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "ip" : "ThereIsNoCheckingOnTheIPFormat" } ] @@ -2709,7 +2709,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "connect", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "ip" : "ThereIsNoCheckingOnTheIPFormat", "port" : 6561 } @@ -2787,7 +2787,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "consensus_info", "params" : [ { - "api_version" : 1 + "api_version" : %MAX_API_VER% } ] })" @@ -2824,7 +2824,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "deposit_authorized", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "destination_account" : "destination_account_NotValidated", "source_account" : "source_account_NotValidated" } @@ -2844,7 +2844,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "deposit_authorized", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "destination_account" : "destination_account_NotValidated", "ledger_index" : "validated", "source_account" : "source_account_NotValidated" @@ -2865,7 +2865,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "deposit_authorized", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "destination_account" : "destination_account_NotValidated", "ledger_index" : 4294967295, "source_account" : "source_account_NotValidated" @@ -2886,7 +2886,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "deposit_authorized", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "destination_account" : "destination_account_NotValidated", "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789", "source_account" : "source_account_NotValidated" @@ -2946,7 +2946,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "deposit_authorized", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "destination_account" : "destination_account_NotValidated", "ledger_index" : 0, "source_account" : "source_account_NotValidated" @@ -2968,7 +2968,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "download_shard", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "shards" : [ { "index" : 20, @@ -2992,7 +2992,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "download_shard", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "shards" : [ { "index" : 20, @@ -3022,7 +3022,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "download_shard", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "shards" : [ { "index" : 200000000, @@ -3066,7 +3066,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "download_shard", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "shards" : [ { "index" : 2000000, @@ -3136,7 +3136,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "download_shard", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "shards" : [ { "index" : 20, @@ -3213,7 +3213,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "feature", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, } ] })" @@ -3229,7 +3229,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "feature", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "feature" : "featureNameOrHexIsNotValidated" } ] @@ -3247,7 +3247,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "feature", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "feature" : "FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210", "vetoed" : false } @@ -3266,7 +3266,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "feature", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "feature" : "0", "vetoed" : true } @@ -3324,7 +3324,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "fetch_info", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, } ] })" @@ -3340,7 +3340,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "fetch_info", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "clear" : true } ] @@ -3376,7 +3376,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "fetch_info", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "too" : true } ] @@ -3395,7 +3395,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "gateway_balances", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", } ] @@ -3413,7 +3413,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "gateway_balances", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : "890765" } @@ -3432,7 +3432,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "gateway_balances", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : "current" } @@ -3451,7 +3451,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "gateway_balances", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_hash" : "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV" } @@ -3470,7 +3470,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "gateway_balances", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "hotwallet" : [ "hotwallet_is_not_validated" ] } @@ -3492,7 +3492,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "gateway_balances", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "hotwallet" : [ "hotwallet_is_not_validated_1", @@ -3605,7 +3605,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "get_counts", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, } ] })" @@ -3621,7 +3621,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "get_counts", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "min_count" : 100 } ] @@ -3678,7 +3678,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "command", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "json_argument" : true, "method" : "command" } @@ -3697,7 +3697,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "command", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "method" : "command" } ] @@ -3794,7 +3794,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "call_1", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "id" : "A1", "jsonrpc" : "2.0", "method" : "call_1", @@ -3823,7 +3823,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "call_1", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "0" : { "inner_arg" : "yup" }, @@ -3848,7 +3848,7 @@ static RPCCallTestData const rpcCallTestArray [] = "params" : [ [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "id" : "A1", "jsonrpc" : "2.0", "method" : "call_1", @@ -3876,7 +3876,7 @@ static RPCCallTestData const rpcCallTestArray [] = "params" : [ [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "0" : { "inner_arg" : "yup" }, @@ -4188,7 +4188,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, } ] })" @@ -4204,7 +4204,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "ledger_index" : 4294967295 } ] @@ -4221,7 +4221,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "ledger_index" : "validated" } ] @@ -4238,7 +4238,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789" } ] @@ -4256,7 +4256,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "full" : true, "ledger_index" : "current" } @@ -4275,7 +4275,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "expand" : true, "ledger_index" : "closed", "transactions" : true @@ -4295,7 +4295,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "ledger_index" : 4294967295 } ] @@ -4312,7 +4312,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "ledger_index" : 0 } ] @@ -4329,7 +4329,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "ledger_index" : 0 } ] @@ -4346,7 +4346,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "ledger_index" : 0 } ] @@ -4364,7 +4364,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "ledger_index" : "current" } ] @@ -4382,7 +4382,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger_closed", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, } ] })" @@ -4417,7 +4417,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger_current", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, } ] })" @@ -4453,7 +4453,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger_header", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "ledger_index" : 4294967295 } ] @@ -4470,7 +4470,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger_header", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789" } ] @@ -4523,7 +4523,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger_header", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "ledger_index" : 0 } ] @@ -4540,7 +4540,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger_header", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "ledger_index" : 0 } ] @@ -4557,7 +4557,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger_header", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "ledger_index" : 0 } ] @@ -4576,7 +4576,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger_request", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "ledger_index" : 4294967295 } ] @@ -4593,7 +4593,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger_request", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789" } ] @@ -4646,7 +4646,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger_request", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "ledger_index" : 0 } ] @@ -4663,7 +4663,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger_request", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "ledger_index" : 0 } ] @@ -4680,7 +4680,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ledger_request", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "ledger_index" : 0 } ] @@ -4698,7 +4698,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "log_level", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, } ] })" @@ -4714,7 +4714,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "log_level", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "severity" : "fatal" } ] @@ -4731,7 +4731,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "log_level", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "severity" : "error" } ] @@ -4748,7 +4748,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "log_level", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "severity" : "warn" } ] @@ -4765,7 +4765,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "log_level", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "severity" : "debug" } ] @@ -4782,7 +4782,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "log_level", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "severity" : "trace" } ] @@ -4800,7 +4800,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "log_level", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "partition" : "base", "severity" : "trace" } @@ -4819,7 +4819,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "log_level", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "partition" : "partition_name", "severity" : "fatal" } @@ -4857,7 +4857,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "log_level", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "severity" : "err" } ] @@ -4875,7 +4875,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "log_level", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "partition" : "fatal", "severity" : "partition_name" } @@ -4894,7 +4894,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "logrotate", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, } ] })" @@ -4930,7 +4930,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "owner_info", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh" } ] @@ -4948,7 +4948,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "owner_info", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 987654321 } @@ -4967,7 +4967,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "owner_info", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : "validated" } @@ -4986,7 +4986,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "owner_info", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_hash" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" } @@ -5006,7 +5006,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "owner_info", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "strict" : 1 } @@ -5103,7 +5103,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "owner_info", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 0 } @@ -5144,7 +5144,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "peers", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, } ] })" @@ -5179,7 +5179,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ping", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, } ] })" @@ -5214,7 +5214,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "print", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, } ] })" @@ -5231,7 +5231,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "print", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "params" : [ "extra" ] } ] @@ -5268,7 +5268,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "random", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, } ] })" @@ -5304,7 +5304,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ripple_path_find", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "json_argument" : true } ] @@ -5322,7 +5322,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ripple_path_find", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "json_argument" : true, "ledger_index" : 4294967295 } @@ -5341,7 +5341,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ripple_path_find", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "json_argument" : true, "ledger_index" : "closed" } @@ -5360,7 +5360,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ripple_path_find", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "json_argument" : true, "ledger_hash" : "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV" } @@ -5435,7 +5435,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ripple_path_find", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "json_argument" : true, "ledger_index" : 0 } @@ -5454,7 +5454,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ripple_path_find", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "json_argument" : true, "ledger_index" : 0 } @@ -5473,7 +5473,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "ripple_path_find", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "json_argument" : true, "ledger_index" : 0 } @@ -5494,7 +5494,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "sign", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "secret" : "my_secret", "tx_json" : { "json_argument" : true @@ -5516,7 +5516,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "sign", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "offline" : true, "secret" : "my_secret", "tx_json" : { @@ -5619,7 +5619,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "sign_for", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret" : "my_secret", "tx_json" : { @@ -5643,7 +5643,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "sign_for", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "offline" : true, "secret" : "my_secret", @@ -5749,7 +5749,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "submit", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "tx_blob" : "the blob is unvalidated and may be any length..." } ] @@ -5767,7 +5767,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "submit", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "secret" : "my_secret", "tx_json" : { "json_argument" : true @@ -5807,7 +5807,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "submit", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "offline" : true, "secret" : "my_secret", "tx_json" : { @@ -5890,7 +5890,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "submit_multisigned", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "tx_json" : { "json_argument" : true } @@ -5965,7 +5965,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "server_info", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, } ] })" @@ -5981,7 +5981,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "server_info", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "counters" : true } ] @@ -6017,7 +6017,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "server_info", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, } ] })" @@ -6034,7 +6034,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "server_state", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, } ] })" @@ -6050,7 +6050,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "server_state", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "counters" : true } ] @@ -6086,7 +6086,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "server_state", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, } ] })" @@ -6103,7 +6103,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "stop", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, } ] })" @@ -6140,7 +6140,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "transaction_entry", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "ledger_index" : 4294967295, "tx_hash" : "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV" } @@ -6159,7 +6159,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "transaction_entry", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "ledger_index" : "current", "tx_hash" : "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV" } @@ -6178,7 +6178,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "transaction_entry", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "ledger_hash" : "VUTSRQPONMLKJIHGFEDCBA9876543210VUTSRQPONMLKJIHGFEDCBA9876543210", "tx_hash" : "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV" } @@ -6350,7 +6350,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "tx", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "transaction" : "transaction_hash_is_not_validated" } ] @@ -6368,7 +6368,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "tx", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "binary" : true, "transaction" : "transaction_hash_is_not_validated" } @@ -6424,7 +6424,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "tx", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "transaction" : "transaction_hash_is_not_validated" } ] @@ -6443,7 +6443,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "tx_account", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", } ] @@ -6461,7 +6461,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "tx_account", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 4294967295 } @@ -6483,7 +6483,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "tx_account", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "binary" : true, "count" : true, @@ -6506,7 +6506,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "tx_account", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index_max" : 2147483647, "ledger_index_min" : 2147483647 @@ -6530,7 +6530,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "tx_account", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "binary" : true, "count" : true, @@ -6555,7 +6555,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "tx_account", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index_max" : 2147483647, "ledger_index_min" : -1, @@ -6581,7 +6581,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "tx_account", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "binary" : true, "count" : true, @@ -6666,7 +6666,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "tx_account", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 0 } @@ -6780,7 +6780,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "tx_history", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "start" : 0 } ] @@ -6864,7 +6864,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "unl_list", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, } ] })" @@ -6899,7 +6899,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "validation_create", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, } ] })" @@ -6915,7 +6915,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "validation_create", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "secret" : "the form of the secret is not validated" } ] @@ -6952,7 +6952,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "version", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, } ] })" @@ -6987,7 +6987,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "wallet_propose", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, } ] })" @@ -7003,7 +7003,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "wallet_propose", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "passphrase" : "the form of the passphrase is not validated" } ] @@ -7041,7 +7041,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "internal", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "internal_command" : "command_name", "params" : [] } @@ -7064,7 +7064,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "internal", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "internal_command" : "command_name", "params" : [ "string_arg", "1", "-1", "4294967296", "3.14159" ] } @@ -7223,7 +7223,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "unknown_command", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, } ] })" @@ -7243,7 +7243,7 @@ static RPCCallTestData const rpcCallTestArray [] = "method" : "unknown_command", "params" : [ { - "api_version" : 1, + "api_version" : %MAX_API_VER%, "params" : [ "string_arg", "1", "-1", "4294967296", "3.14159" ] } ] @@ -7253,9 +7253,8 @@ static RPCCallTestData const rpcCallTestArray [] = std::string updateAPIVersionString(const char * const req) { - static std::string version_str = "\"" + std::string(jss::api_version) + "\" : " + - std::to_string(RPC::ApiMaximumSupportedVersion); - static auto place_holder = "\"api_version\" : 1"; + static std::string version_str = std::to_string(RPC::ApiMaximumSupportedVersion); + static auto place_holder = "%MAX_API_VER%"; std::string jr(req); boost::replace_all(jr, place_holder, version_str); return jr;