diff --git a/Builds/CMake/RippledCompiler.cmake b/Builds/CMake/RippledCompiler.cmake index aa8f1d1eb76..43afc628bc3 100644 --- a/Builds/CMake/RippledCompiler.cmake +++ b/Builds/CMake/RippledCompiler.cmake @@ -131,7 +131,16 @@ else () >) endif () -if (use_gold AND is_gcc) +if (use_mold) + # use mold linker if available + execute_process ( + COMMAND ${CMAKE_CXX_COMPILER} -fuse-ld=mold -Wl,--version + ERROR_QUIET OUTPUT_VARIABLE LD_VERSION) + if ("${LD_VERSION}" MATCHES "mold") + target_link_libraries (common INTERFACE -fuse-ld=mold) + endif () + unset (LD_VERSION) +elseif (use_gold AND is_gcc) # use gold linker if available execute_process ( COMMAND ${CMAKE_CXX_COMPILER} -fuse-ld=gold -Wl,--version @@ -163,9 +172,7 @@ if (use_gold AND is_gcc) $<$>:-Wl,--disable-new-dtags>) endif () unset (LD_VERSION) -endif () - -if (use_lld) +elseif (use_lld) # use lld linker if available execute_process ( COMMAND ${CMAKE_CXX_COMPILER} -fuse-ld=lld -Wl,--version @@ -176,6 +183,7 @@ if (use_lld) unset (LD_VERSION) endif() + if (assert) foreach (var_ CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELEASE) STRING (REGEX REPLACE "[-/]DNDEBUG" "" ${var_} "${${var_}}") diff --git a/Builds/CMake/RippledSettings.cmake b/Builds/CMake/RippledSettings.cmake index 0cdfb8e84db..c8195c7b922 100644 --- a/Builds/CMake/RippledSettings.cmake +++ b/Builds/CMake/RippledSettings.cmake @@ -37,6 +37,7 @@ if (is_linux) option (static "link protobuf, openssl, libc++, and boost statically" ON) option (perf "Enables flags that assist with perf recording" OFF) option (use_gold "enables detection of gold (binutils) linker" ON) + option (use_mold "enables detection of mold (binutils) linker" ON) else () # we are not ready to allow shared-libs on windows because it would require # export declarations. On macos it's more feasible, but static openssl @@ -45,6 +46,7 @@ else () set (static ON CACHE BOOL "static link, linux only. ON for WIN/macos" FORCE) set (perf OFF CACHE BOOL "perf flags, linux only" FORCE) set (use_gold OFF CACHE BOOL "gold linker, linux only" FORCE) + set (use_mold OFF CACHE BOOL "mold linker, linux only" FORCE) endif () if (is_clang) option (use_lld "enables detection of lld linker" ON) diff --git a/Builds/containers/gitlab-ci/pkgbuild.yml b/Builds/containers/gitlab-ci/pkgbuild.yml index e2326852867..0aa46d1eecf 100644 --- a/Builds/containers/gitlab-ci/pkgbuild.yml +++ b/Builds/containers/gitlab-ci/pkgbuild.yml @@ -193,12 +193,30 @@ rocky_8_smoketest: name: artifactory.ops.ripple.com/rockylinux/rockylinux:8 <<: *run_local_smoketest -fedora_37_smoketest: +rocky_9_smoketest: stage: smoketest dependencies: - rpm_build image: - name: artifactory.ops.ripple.com/fedora:37 + name: artifactory.ops.ripple.com/rockylinux/rockylinux:9 + + <<: *run_local_smoketest + +alma_8_smoketest: + stage: smoketest + dependencies: + - rpm_build + image: + name: artifactory.ops.ripple.com/almalinux:8 + <<: *run_local_smoketest + +alma_9_smoketest: + stage: smoketest + dependencies: + - rpm_build + image: + name: artifactory.ops.ripple.com/almalinux:9 + <<: *run_local_smoketest fedora_38_smoketest: @@ -209,6 +227,14 @@ fedora_38_smoketest: name: artifactory.ops.ripple.com/fedora:38 <<: *run_local_smoketest +fedora_39_smoketest: + stage: smoketest + dependencies: + - rpm_build + image: + name: artifactory.ops.ripple.com/fedora:39 + <<: *run_local_smoketest + ubuntu_18_smoketest: stage: smoketest dependencies: @@ -249,6 +275,14 @@ debian_11_smoketest: name: artifactory.ops.ripple.com/debian:11 <<: *run_local_smoketest +debian_12_smoketest: + stage: smoketest + dependencies: + - dpkg_build + image: + name: artifactory.ops.ripple.com/debian:12 + <<: *run_local_smoketest + ######################################################################### ## ## ## stage: verify_sig ## @@ -345,7 +379,6 @@ centos_7_verify_repo_test: <<: *only_primary <<: *run_repo_smoketest - rocky_8_verify_repo_test: stage: verify_from_test variables: @@ -357,12 +390,34 @@ rocky_8_verify_repo_test: <<: *only_primary <<: *run_repo_smoketest -fedora_37_verify_repo_test: +rocky_9_verify_repo_test: stage: verify_from_test variables: RPM_REPO: "rippled-rpm-test-mirror" image: - name: artifactory.ops.ripple.com/fedora:37 + name: artifactory.ops.ripple.com/rockylinux/rockylinux:9 + dependencies: + - rpm_sign + <<: *only_primary + <<: *run_repo_smoketest + +almalinux_8_verify_repo_test: + stage: verify_from_test + variables: + RPM_REPO: "rippled-rpm-test-mirror" + image: + name: artifactory.ops.ripple.com/almalinux:8 + dependencies: + - rpm_sign + <<: *only_primary + <<: *run_repo_smoketest + +almalinux_9_verify_repo_test: + stage: verify_from_test + variables: + RPM_REPO: "rippled-rpm-test-mirror" + image: + name: artifactory.ops.ripple.com/almalinux:9 dependencies: - rpm_sign <<: *only_primary @@ -379,6 +434,18 @@ fedora_38_verify_repo_test: <<: *only_primary <<: *run_repo_smoketest +fedora_39_verify_repo_test: + stage: verify_from_test + variables: + RPM_REPO: "rippled-rpm-test-mirror" + image: + name: artifactory.ops.ripple.com/fedora:39 + + dependencies: + - rpm_sign + <<: *only_primary + <<: *run_repo_smoketest + ubuntu_18_verify_repo_test: stage: verify_from_test variables: @@ -439,6 +506,18 @@ debian_11_verify_repo_test: <<: *only_primary <<: *run_repo_smoketest +debian_12_verify_repo_test: + stage: verify_from_test + variables: + DISTRO: "bookworm" + DEB_REPO: "rippled-deb-test-mirror" + image: + name: artifactory.ops.ripple.com/debian:12 + dependencies: + - dpkg_sign + <<: *only_primary + <<: *run_repo_smoketest + ######################################################################### ## ## ## stage: wait_approval_prod ## @@ -515,6 +594,39 @@ rocky_8_verify_repo_prod: <<: *only_primary <<: *run_repo_smoketest +rocky_9_verify_repo_prod: + stage: verify_from_prod + variables: + RPM_REPO: "rippled-rpm" + image: + name: artifactory.ops.ripple.com/rockylinux/rockylinux:9 + dependencies: + - rpm_sign + <<: *only_primary + <<: *run_repo_smoketest + +alma_8_verify_repo_prod: + stage: verify_from_prod + variables: + RPM_REPO: "rippled-rpm" + image: + name: artifactory.ops.ripple.com/almalinux:8 + dependencies: + - rpm_sign + <<: *only_primary + <<: *run_repo_smoketest + +alma_9_verify_repo_prod: + stage: verify_from_prod + variables: + RPM_REPO: "rippled-rpm" + image: + name: artifactory.ops.ripple.com/almalinux:9 + dependencies: + - rpm_sign + <<: *only_primary + <<: *run_repo_smoketest + fedora_37_verify_repo_prod: stage: verify_from_prod variables: @@ -597,6 +709,19 @@ debian_11_verify_repo_prod: <<: *only_primary <<: *run_repo_smoketest +debian_12_verify_repo_prod: + stage: verify_from_prod + variables: + DISTRO: "bookworm" + DEB_REPO: "rippled-deb" + image: + name: artifactory.ops.ripple.com/debian:12 + dependencies: + - dpkg_sign + <<: *only_primary + <<: *run_repo_smoketest + + ######################################################################### ## ## ## stage: get_final_hashes ## diff --git a/Builds/containers/gitlab-ci/smoketest.sh b/Builds/containers/gitlab-ci/smoketest.sh index 32a8e3407f6..56bd38fac6a 100644 --- a/Builds/containers/gitlab-ci/smoketest.sh +++ b/Builds/containers/gitlab-ci/smoketest.sh @@ -16,7 +16,7 @@ case ${ID} in ubuntu|debian) pkgtype="dpkg" ;; - fedora|centos|rhel|scientific|rocky) + fedora|centos|rhel|scientific|rocky|almalinux) pkgtype="rpm" ;; *) @@ -79,16 +79,8 @@ else # yum --showduplicates list rippled yum -y install ${rpm_version_release} elif [ "${install_from}" = "local" ] ; then - # cached pkg install - pkgs=("yum-utils openssl-static zlib-static") - if [[ "$ID" =~ rocky|fedora ]]; then - if [[ "$ID" =~ "rocky" ]]; then - sed -i 's/enabled=0/enabled=1/g' /etc/yum.repos.d/Rocky-PowerTools.repo - fi - pkgs="${pkgs[@]/openssl-static}" - fi - yum install -y $pkgs rm -f build/rpm/packages/rippled-debug*.rpm + rm -f build/rpm/packages/rippled-devel*.rpm rm -f build/rpm/packages/*.src.rpm rpm -i build/rpm/packages/*.rpm else diff --git a/src/ripple/app/misc/impl/Transaction.cpp b/src/ripple/app/misc/impl/Transaction.cpp index c38a6b7438f..e3ec41a25d4 100644 --- a/src/ripple/app/misc/impl/Transaction.cpp +++ b/src/ripple/app/misc/impl/Transaction.cpp @@ -171,7 +171,8 @@ Transaction::getJson(JsonOptions options, bool binary) const Json::Value ret( mTransaction->getJson(options & ~JsonOptions::include_date, binary)); - if (mLedgerIndex) + // NOTE Binary STTx::getJson output might not be a JSON object + if (ret.isObject() && mLedgerIndex) { if (!(options & JsonOptions::disable_API_prior_V2)) { diff --git a/src/ripple/consensus/Consensus.h b/src/ripple/consensus/Consensus.h index 8115e88c9e1..98742e41fc0 100644 --- a/src/ripple/consensus/Consensus.h +++ b/src/ripple/consensus/Consensus.h @@ -1759,15 +1759,27 @@ Consensus::updateOurPositions(bool const share) else { int neededWeight; + // It's possible to be at a close time impasse (described below), so + // keep track of whether this round has taken a long time. + bool stuck = false; if (convergePercent_ < parms.avMID_CONSENSUS_TIME) + { neededWeight = parms.avINIT_CONSENSUS_PCT; + } else if (convergePercent_ < parms.avLATE_CONSENSUS_TIME) + { neededWeight = parms.avMID_CONSENSUS_PCT; + } else if (convergePercent_ < parms.avSTUCK_CONSENSUS_TIME) + { neededWeight = parms.avLATE_CONSENSUS_PCT; + } else + { neededWeight = parms.avSTUCK_CONSENSUS_PCT; + stuck = true; + } int participants = currPeerPositions_.size(); if (mode_.get() == ConsensusMode::proposing) @@ -1787,57 +1799,156 @@ Consensus::updateOurPositions(bool const share) << " nw:" << neededWeight << " thrV:" << threshVote << " thrC:" << threshConsensus; - // An impasse is possible unless a validator pretends to change - // its close time vote. Imagine 5 validators. 3 have positions - // for close time t1, and 2 with t2. That's an impasse because - // 75% will never be met. However, if one of the validators voting - // for t2 switches to t1, then that will be 80% and sufficient - // to break the impasse. It's also OK for those agreeing - // with the 3 to pretend to vote for the one with 2, because - // that will never exceed the threshold of 75%, even with as - // few as 3 validators. The most it can achieve is 2/3. - for (auto& [t, v] : closeTimeVotes) + // Choose a close time and decide whether there is consensus for it. + // + // Close time is chosen based on the threshVote threshold + // calculated above. If a close time has votes equal to or greater than + // that threshold, then that is the best close time. If multiple + // close times have an equal number of votes, then choose the greatest + // of them. Ensure that our close time then matches that which meets + // the criteria. But if no close time meet the criteria, make no + // changes. + // + // This is implemented slightly differently for validators vs + // non-validators. For non-validators, it is sufficient to merely + // count the close times from all peer positions to determine + // the best. Validators, however, risk putting the network into an + // impasse unless they are able to change their own position without + // first having counted it towards the close time totals. + // + // Here's how the impasse could occur: + // Imagine 5 validators. 3 have close time t1, and 2 have t2. + // As consensus time increases, the threshVote threshold also increases. + // Once threshVote exceeds 60%, no members of either set of validators + // will change their close times. + // + // Avoiding the impasse means that validators should identify + // whether they currently have the best close time. First, choose + // the close time with the most votes. However, if multiple close times + // have the same number of votes, pick the latest of them. + // If the validator does not currently have the best close time, + // switch to it and increase the local vote tally for that better + // close time. This will result in consensus in the next iteration + // assuming that the peer messages propagate successfully. + // In this case the validators in set t1 will remain the same but + // those in t2 switch to t1. + // + // Another wrinkle, however, is that too many position changes + // from validators also has a destabilizing affect. Consensus can + // take longer if peers have to keep re-calculating positions, + // and mistakes can be made if peers settle on the wrong position. + // Therefore, avoiding an impasse should also minimize the likelihood + // of gratuitous change of position. + // + // The solution for validators is to first track whether it's + // possible that the network is at an impasse based on how much + // time this current consensus round has taken. This is reflected + // in the "stuck" boolean. When stuck, validators perform the + // above-described position change based solely on whether or not + // they agree with the best position, and ignore the threshVote + // criteria used for the earlier part of the phase. + // + // Determining whether there is close time consensus is very simple + // in comparison: if votes for the best close time meet or exceed + // threshConsensus, then we have close time consensus. Otherwise, not. + + // First, find the best close time with which to agree: first criteria + // is the close time with the most votes. If a tie, the latest + // close time of those tied for the maximum number of votes. + std::multimap votesByCloseTime; + std::stringstream ss; + ss << "Close time calculation for ledger sequence " + << static_cast(previousLedger_.seq()) + 1 + << " Close times and vote count are as follows: "; + bool first = true; + for (auto const& [closeTime, voteCount] : closeTimeVotes) { - if (adaptor_.validating() && - t != asCloseTime(result_->position.closeTime())) - { - JLOG(j_.debug()) << "Others have voted for a close time " - "different than ours. Adding our vote " - "to this one in case it is necessary " - "to break an impasse."; - ++v; - } - JLOG(j_.debug()) - << "CCTime: seq " - << static_cast(previousLedger_.seq()) + 1 << ": " - << t.time_since_epoch().count() << " has " << v << ", " - << threshVote << " required"; - - if (v >= threshVote) + if (first) + first = false; + else + ss << ','; + votesByCloseTime.insert({voteCount, closeTime}); + ss << closeTime.time_since_epoch().count() << ':' << voteCount; + } + // These always gets populated because currPeerPositions_ is not + // empty to end up here, so at least 1 close time has at least 1 vote. + assert(!currPeerPositions_.empty()); + std::optional maxVote; + std::set maxCloseTimes; + // Highest vote getter is last. Track each close time that is tied + // with the highest. + for (auto rit = votesByCloseTime.crbegin(); + rit != votesByCloseTime.crend(); + ++rit) + { + int const voteCount = rit->first; + if (!maxVote.has_value()) + maxVote = voteCount; + else if (voteCount < *maxVote) + break; + maxCloseTimes.insert(rit->second); + } + // The best close time is the latest close time of those that have + // the maximum number of votes. + NetClock::time_point const bestCloseTime = *maxCloseTimes.crbegin(); + ss << ". The best close time has the most votes. If there is a tie, " + "choose the latest. This is " + << bestCloseTime.time_since_epoch().count() << "with " << *maxVote + << " votes. "; + + // If we are a validator potentially at an impasse and our own close + // time is not the best, change our close time to match it and + // tally another vote for it. + if (adaptor_.validating() && stuck && + consensusCloseTime != bestCloseTime) + { + consensusCloseTime = bestCloseTime; + ++*maxVote; + ss << " We are a validator. Consensus has taken " + << result_->roundTime.read().count() + << "ms. Previous round " + "took " + << prevRoundTime_.count() + << "ms. Now changing our " + "close time to " + << bestCloseTime.time_since_epoch().count() + << " that " + "now has " + << *maxVote << " votes."; + } + // If the close time with the most votes also meets or exceeds the + // threshold to change our position, then change our position. + // Then check if we have met or exceeded the threshold for close + // time consensus. + // + // The 2nd check has been nested within the first historically. + // It's possible that this can be optimized by doing the + // 2nd check independently--this may make consensus happen faster in + // some cases. Then again, the trade-offs have not been modelled. + if (*maxVote >= threshVote) + { + consensusCloseTime = bestCloseTime; + ss << "Close time " << bestCloseTime.time_since_epoch().count() + << " has " << *maxVote << " votes, which is >= the threshold (" + << threshVote + << " to make that our position if it isn't already."; + if (*maxVote >= threshConsensus) { - // A close time has enough votes for us to try to agree - consensusCloseTime = t; - threshVote = v; - - if (threshVote >= threshConsensus) - { - haveCloseTimeConsensus_ = true; - // Make sure that the winning close time is the one - // that propagates to the rest of the function. - break; - } + haveCloseTimeConsensus_ = true; + ss << " The maximum votes also >= the threshold (" + << threshConsensus << ") for consensus."; } } if (!haveCloseTimeConsensus_) { - JLOG(j_.debug()) - << "No CT consensus:" - << " Proposers:" << currPeerPositions_.size() - << " Mode:" << to_string(mode_.get()) - << " Thresh:" << threshConsensus - << " Pos:" << consensusCloseTime.time_since_epoch().count(); + ss << " No CT consensus:" + << " Proposers:" << currPeerPositions_.size() + << " Mode:" << to_string(mode_.get()) + << " Thresh:" << threshConsensus + << " Pos:" << consensusCloseTime.time_since_epoch().count(); } + JLOG(j_.debug()) << ss.str(); } if (!ourNewSet && diff --git a/src/ripple/net/impl/RPCCall.cpp b/src/ripple/net/impl/RPCCall.cpp index f4428a3f000..4e3e6c09fc4 100644 --- a/src/ripple/net/impl/RPCCall.cpp +++ b/src/ripple/net/impl/RPCCall.cpp @@ -91,6 +91,7 @@ createHTTPPost( class RPCParser { private: + unsigned const apiVersion_; beast::Journal const j_; // TODO New routine for parsing ledger parameters, other routines should @@ -321,8 +322,7 @@ class RPCParser if (uLedgerMax != -1 && uLedgerMax < uLedgerMin) { - // The command line always follows apiMaximumSupportedVersion - if (RPC::apiMaximumSupportedVersion == 1) + if (apiVersion_ == 1) return rpcError(rpcLGR_IDXS_INVALID); return rpcError(rpcNOT_SYNCED); } @@ -340,76 +340,6 @@ class RPCParser return jvRequest; } - // tx_account accountID [ledger_min [ledger_max [limit]]]] [binary] [count] - // [forward] - Json::Value - parseTxAccount(Json::Value const& jvParams) - { - Json::Value jvRequest(Json::objectValue); - unsigned int iParams = jvParams.size(); - - auto const account = parseBase58(jvParams[0u].asString()); - if (!account) - return rpcError(rpcACT_MALFORMED); - - jvRequest[jss::account] = toBase58(*account); - - bool bDone = false; - - while (!bDone && iParams >= 2) - { - if (jvParams[iParams - 1].asString() == jss::binary) - { - jvRequest[jss::binary] = true; - --iParams; - } - else if (jvParams[iParams - 1].asString() == jss::count) - { - jvRequest[jss::count] = true; - --iParams; - } - else if (jvParams[iParams - 1].asString() == jss::forward) - { - jvRequest[jss::forward] = true; - --iParams; - } - else - { - bDone = true; - } - } - - if (1 == iParams) - { - } - else if (2 == iParams) - { - if (!jvParseLedger(jvRequest, jvParams[1u].asString())) - return jvRequest; - } - else - { - std::int64_t uLedgerMin = jvParams[1u].asInt(); - std::int64_t uLedgerMax = jvParams[2u].asInt(); - - if (uLedgerMax != -1 && uLedgerMax < uLedgerMin) - { - // The command line always follows apiMaximumSupportedVersion - if (RPC::apiMaximumSupportedVersion == 1) - return rpcError(rpcLGR_IDXS_INVALID); - return rpcError(rpcNOT_SYNCED); - } - - jvRequest[jss::ledger_index_min] = jvParams[1u].asInt(); - jvRequest[jss::ledger_index_max] = jvParams[2u].asInt(); - - if (iParams >= 4) - jvRequest[jss::limit] = jvParams[3u].asInt(); - } - - return jvRequest; - } - // book_offers [ [ [ // [ []]]]] limit: 0 = no limit proof: 0 or 1 // @@ -1221,7 +1151,8 @@ class RPCParser public: //-------------------------------------------------------------------------- - explicit RPCParser(beast::Journal j) : j_(j) + explicit RPCParser(unsigned apiVersion, beast::Journal j) + : apiVersion_(apiVersion), j_(j) { } @@ -1317,7 +1248,6 @@ class RPCParser {"submit_multisigned", &RPCParser::parseSubmitMultiSigned, 1, 1}, {"transaction_entry", &RPCParser::parseTransactionEntry, 2, 2}, {"tx", &RPCParser::parseTx, 1, 4}, - {"tx_account", &RPCParser::parseTxAccount, 1, 7}, {"tx_history", &RPCParser::parseTxHistory, 1, 1}, {"unl_list", &RPCParser::parseAsIs, 0, 0}, {"validation_create", &RPCParser::parseValidationCreate, 0, 1}, @@ -1481,7 +1411,7 @@ rpcCmdToJson( { Json::Value jvRequest(Json::objectValue); - RPCParser rpParser(j); + RPCParser rpParser(apiVersion, j); Json::Value jvRpcParams(Json::arrayValue); for (int i = 1; i != args.size(); i++) @@ -1673,7 +1603,7 @@ fromCommandLine( Logs& logs) { auto const result = - rpcClient(vCmd, config, logs, RPC::apiMaximumSupportedVersion); + rpcClient(vCmd, config, logs, RPC::apiCommandLineVersion); std::cout << result.second.toStyledString(); diff --git a/src/ripple/protocol/impl/BuildInfo.cpp b/src/ripple/protocol/impl/BuildInfo.cpp index ec44eddbd42..ec56217b44d 100644 --- a/src/ripple/protocol/impl/BuildInfo.cpp +++ b/src/ripple/protocol/impl/BuildInfo.cpp @@ -33,7 +33,7 @@ namespace BuildInfo { // and follow the format described at http://semver.org/ //------------------------------------------------------------------------------ // clang-format off -char const* const versionString = "2.0.0-rc1" +char const* const versionString = "2.0.0-rc2" // clang-format on #if defined(DEBUG) || defined(SANITIZER) diff --git a/src/ripple/rpc/impl/RPCHelpers.h b/src/ripple/rpc/impl/RPCHelpers.h index 97015f1a35d..0c2a299d8ab 100644 --- a/src/ripple/rpc/impl/RPCHelpers.h +++ b/src/ripple/rpc/impl/RPCHelpers.h @@ -234,8 +234,9 @@ extern beast::SemanticVersion const lastVersion; constexpr unsigned int apiInvalidVersion = 0; constexpr unsigned int apiVersionIfUnspecified = 1; constexpr unsigned int apiMinimumSupportedVersion = 1; -constexpr unsigned int apiMaximumSupportedVersion = 1; -constexpr unsigned int apiBetaVersion = 2; +constexpr unsigned int apiMaximumSupportedVersion = 2; +constexpr unsigned int apiCommandLineVersion = 1; // TODO Bump to 2 later +constexpr unsigned int apiBetaVersion = 3; constexpr unsigned int apiMaximumValidVersion = apiBetaVersion; static_assert(apiMinimumSupportedVersion >= apiVersionIfUnspecified); diff --git a/src/test/jtx/Env.h b/src/test/jtx/Env.h index 08e7b22681d..6a55f2f9141 100644 --- a/src/test/jtx/Env.h +++ b/src/test/jtx/Env.h @@ -279,6 +279,17 @@ class Env The command is examined and used to build the correct JSON as per the arguments. */ + template + Json::Value + rpc(unsigned apiVersion, + std::unordered_map const& headers, + std::string const& cmd, + Args&&... args); + + template + Json::Value + rpc(unsigned apiVersion, std::string const& cmd, Args&&... args); + template Json::Value rpc(std::unordered_map const& headers, @@ -655,6 +666,7 @@ class Env Json::Value do_rpc( + unsigned apiVersion, std::vector const& args, std::unordered_map const& headers = {}); @@ -695,6 +707,31 @@ class Env std::unordered_map map_; }; +template +Json::Value +Env::rpc( + unsigned apiVersion, + std::unordered_map const& headers, + std::string const& cmd, + Args&&... args) +{ + return do_rpc( + apiVersion, + std::vector{cmd, std::forward(args)...}, + headers); +} + +template +Json::Value +Env::rpc(unsigned apiVersion, std::string const& cmd, Args&&... args) +{ + return rpc( + apiVersion, + std::unordered_map(), + cmd, + std::forward(args)...); +} + template Json::Value Env::rpc( @@ -703,7 +740,9 @@ Env::rpc( Args&&... args) { return do_rpc( - std::vector{cmd, std::forward(args)...}, headers); + RPC::apiCommandLineVersion, + std::vector{cmd, std::forward(args)...}, + headers); } template @@ -743,7 +782,7 @@ void forAllApiVersions(VersionedTestCallable auto... testCallable) { for (auto testVersion = RPC::apiMinimumSupportedVersion; - testVersion <= RPC::apiBetaVersion; + testVersion <= RPC::apiMaximumValidVersion; ++testVersion) { (..., testCallable(testVersion)); diff --git a/src/test/jtx/impl/Env.cpp b/src/test/jtx/impl/Env.cpp index 3467a42cbbb..e82183c0001 100644 --- a/src/test/jtx/impl/Env.cpp +++ b/src/test/jtx/impl/Env.cpp @@ -460,15 +460,11 @@ Env::st(JTx const& jt) Json::Value Env::do_rpc( + unsigned apiVersion, std::vector const& args, std::unordered_map const& headers) { - return rpcClient( - args, - app().config(), - app().logs(), - RPC::apiMaximumSupportedVersion, - headers) + return rpcClient(args, app().config(), app().logs(), apiVersion, headers) .second; } diff --git a/src/test/jtx/utility.h b/src/test/jtx/utility.h index 7bc9fbaa817..42a2180eed2 100644 --- a/src/test/jtx/utility.h +++ b/src/test/jtx/utility.h @@ -67,7 +67,7 @@ Json::Value cmdToJSONRPC( std::vector const& args, beast::Journal j, - unsigned int apiVersion = RPC::apiMaximumSupportedVersion); + unsigned int apiVersion); } // namespace jtx } // namespace test diff --git a/src/test/rpc/AccountTx_test.cpp b/src/test/rpc/AccountTx_test.cpp index 3834d623dca..640b774f525 100644 --- a/src/test/rpc/AccountTx_test.cpp +++ b/src/test/rpc/AccountTx_test.cpp @@ -137,6 +137,7 @@ class AccountTx_test : public beast::unit_test::suite j[jss::result][jss::transactions][1u][jss::tx] [jss::DeliverMax]); case 2: + case 3: if (j.isMember(jss::result) && (j[jss::result][jss::status] == "success") && (j[jss::result][jss::transactions].size() == 2) && @@ -198,20 +199,22 @@ class AccountTx_test : public beast::unit_test::suite rpcACT_MALFORMED)); jParms[jss::account] = A1.human(); - BEAST_EXPECT(hasTxs(env.rpc("json", "account_tx", to_string(jParms)))); + BEAST_EXPECT(hasTxs( + env.rpc(apiVersion, "json", "account_tx", to_string(jParms)))); // Ledger min/max index { Json::Value p{jParms}; p[jss::ledger_index_min] = -1; p[jss::ledger_index_max] = -1; - BEAST_EXPECT(hasTxs(env.rpc("json", "account_tx", to_string(p)))); + BEAST_EXPECT(hasTxs( + env.rpc(apiVersion, "json", "account_tx", to_string(p)))); p[jss::ledger_index_min] = 0; p[jss::ledger_index_max] = 100; if (apiVersion < 2u) - BEAST_EXPECT( - hasTxs(env.rpc("json", "account_tx", to_string(p)))); + BEAST_EXPECT(hasTxs( + env.rpc(apiVersion, "json", "account_tx", to_string(p)))); else BEAST_EXPECT(isErr( env.rpc("json", "account_tx", to_string(p)), @@ -238,12 +241,13 @@ class AccountTx_test : public beast::unit_test::suite { Json::Value p{jParms}; p[jss::ledger_index_min] = -1; - BEAST_EXPECT(hasTxs(env.rpc("json", "account_tx", to_string(p)))); + BEAST_EXPECT(hasTxs( + env.rpc(apiVersion, "json", "account_tx", to_string(p)))); p[jss::ledger_index_min] = 1; if (apiVersion < 2u) - BEAST_EXPECT( - hasTxs(env.rpc("json", "account_tx", to_string(p)))); + BEAST_EXPECT(hasTxs( + env.rpc(apiVersion, "json", "account_tx", to_string(p)))); else BEAST_EXPECT(isErr( env.rpc("json", "account_tx", to_string(p)), @@ -260,22 +264,25 @@ class AccountTx_test : public beast::unit_test::suite { Json::Value p{jParms}; p[jss::ledger_index_max] = -1; - BEAST_EXPECT(hasTxs(env.rpc("json", "account_tx", to_string(p)))); + BEAST_EXPECT(hasTxs( + env.rpc(apiVersion, "json", "account_tx", to_string(p)))); p[jss::ledger_index_max] = env.current()->info().seq; if (apiVersion < 2u) - BEAST_EXPECT( - hasTxs(env.rpc("json", "account_tx", to_string(p)))); + BEAST_EXPECT(hasTxs( + env.rpc(apiVersion, "json", "account_tx", to_string(p)))); else BEAST_EXPECT(isErr( env.rpc("json", "account_tx", to_string(p)), rpcLGR_IDX_MALFORMED)); p[jss::ledger_index_max] = 3; - BEAST_EXPECT(hasTxs(env.rpc("json", "account_tx", to_string(p)))); + BEAST_EXPECT(hasTxs( + env.rpc(apiVersion, "json", "account_tx", to_string(p)))); p[jss::ledger_index_max] = env.closed()->info().seq; - BEAST_EXPECT(hasTxs(env.rpc("json", "account_tx", to_string(p)))); + BEAST_EXPECT(hasTxs( + env.rpc(apiVersion, "json", "account_tx", to_string(p)))); p[jss::ledger_index_max] = env.closed()->info().seq - 1; BEAST_EXPECT(noTxs(env.rpc("json", "account_tx", to_string(p)))); @@ -286,7 +293,8 @@ class AccountTx_test : public beast::unit_test::suite Json::Value p{jParms}; p[jss::ledger_index] = env.closed()->info().seq; - BEAST_EXPECT(hasTxs(env.rpc("json", "account_tx", to_string(p)))); + BEAST_EXPECT(hasTxs( + env.rpc(apiVersion, "json", "account_tx", to_string(p)))); p[jss::ledger_index] = env.closed()->info().seq - 1; BEAST_EXPECT(noTxs(env.rpc("json", "account_tx", to_string(p)))); @@ -306,7 +314,8 @@ class AccountTx_test : public beast::unit_test::suite Json::Value p{jParms}; p[jss::ledger_hash] = to_string(env.closed()->info().hash); - BEAST_EXPECT(hasTxs(env.rpc("json", "account_tx", to_string(p)))); + BEAST_EXPECT(hasTxs( + env.rpc(apiVersion, "json", "account_tx", to_string(p)))); p[jss::ledger_hash] = to_string(env.closed()->info().parentHash); BEAST_EXPECT(noTxs(env.rpc("json", "account_tx", to_string(p)))); @@ -324,8 +333,8 @@ class AccountTx_test : public beast::unit_test::suite p[jss::ledger_index] = -1; if (apiVersion < 2u) - BEAST_EXPECT( - hasTxs(env.rpc("json", "account_tx", to_string(p)))); + BEAST_EXPECT(hasTxs( + env.rpc(apiVersion, "json", "account_tx", to_string(p)))); else BEAST_EXPECT(isErr( env.rpc("json", "account_tx", to_string(p)), @@ -337,8 +346,8 @@ class AccountTx_test : public beast::unit_test::suite Json::Value p{jParms}; p[jss::ledger_index_max] = env.current()->info().seq; if (apiVersion < 2u) - BEAST_EXPECT( - hasTxs(env.rpc("json", "account_tx", to_string(p)))); + BEAST_EXPECT(hasTxs( + env.rpc(apiVersion, "json", "account_tx", to_string(p)))); else BEAST_EXPECT(isErr( env.rpc("json", "account_tx", to_string(p)), diff --git a/src/test/rpc/LedgerRequestRPC_test.cpp b/src/test/rpc/LedgerRequestRPC_test.cpp index 14d06e9234b..a1f3daafb30 100644 --- a/src/test/rpc/LedgerRequestRPC_test.cpp +++ b/src/test/rpc/LedgerRequestRPC_test.cpp @@ -24,6 +24,8 @@ #include #include +#include + namespace ripple { namespace RPC { @@ -263,7 +265,7 @@ class LedgerRequestRPC_test : public beast::unit_test::suite } void - testBadInput() + testBadInput(unsigned apiVersion) { using namespace test::jtx; Env env{*this}; @@ -287,9 +289,9 @@ class LedgerRequestRPC_test : public beast::unit_test::suite // the purpose in this test is to force the ledger expiration/out of // date check to trigger env.timeKeeper().adjustCloseTime(weeks{3}); - result = env.rpc("ledger_request", "1")[jss::result]; + result = env.rpc(apiVersion, "ledger_request", "1")[jss::result]; BEAST_EXPECT(result[jss::status] == "error"); - if (RPC::apiMaximumSupportedVersion == 1) + if (apiVersion == 1) { BEAST_EXPECT(result[jss::error] == "noCurrent"); BEAST_EXPECT( @@ -357,7 +359,8 @@ class LedgerRequestRPC_test : public beast::unit_test::suite { testLedgerRequest(); testEvolution(); - testBadInput(); + test::jtx::forAllApiVersions( + std::bind_front(&LedgerRequestRPC_test::testBadInput, this)); testMoreThan256Closed(); testNonAdmin(); } diff --git a/src/test/rpc/RPCCall_test.cpp b/src/test/rpc/RPCCall_test.cpp index ce270184a26..5f66250b103 100644 --- a/src/test/rpc/RPCCall_test.cpp +++ b/src/test/rpc/RPCCall_test.cpp @@ -24,6 +24,8 @@ #include #include + +#include #include #include @@ -42,7 +44,7 @@ struct RPCCallTestData Exception const throwsWhat; // Expected JSON response. - char const* const exp; + std::vector exp; RPCCallTestData( char const* description_, @@ -54,6 +56,20 @@ struct RPCCallTestData , line(line_) , args(args_) , throwsWhat(throwsWhat_) + , exp(1, exp_) + { + } + + RPCCallTestData( + char const* description_, + int line_, + std::initializer_list const& args_, + Exception throwsWhat_, + std::initializer_list exp_) + : description(description_) + , line(line_) + , args(args_) + , throwsWhat(throwsWhat_) , exp(exp_) { } @@ -78,7 +94,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_channels", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh" } ] @@ -93,7 +109,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_channels", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "destination_account" : "rD5MbavGfiSC5m7mkxy1FANuT7s3HxqpoF" } @@ -109,7 +125,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_channels", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "destination_account" : "r9emE59aTWb85t64dAebKrxYMBTpzK5yR7" } @@ -125,7 +141,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_channels", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "destination_account" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA" } @@ -142,7 +158,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_channels", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "destination_account" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "ledger_hash" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" @@ -160,7 +176,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_channels", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "destination_account" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "ledger_index" : 90210 @@ -229,7 +245,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_currencies", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh" } ] @@ -242,7 +258,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_currencies", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "racb4o3DrdYxuCfyVa6vsLb7vgju9RFbBr" } ] @@ -255,7 +271,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_currencies", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 42 } @@ -269,7 +285,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_currencies", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : "validated" } @@ -284,7 +300,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "params" : [ { "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : "current" } ] @@ -331,7 +347,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_currencies", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 0 } @@ -367,7 +383,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_info", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh" } ] @@ -380,7 +396,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_info", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 77777 } @@ -394,7 +410,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_info", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : "closed" } @@ -410,7 +426,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_info", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_hash" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" } @@ -425,7 +441,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "params" : [ { "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : "validated" } ] @@ -494,7 +510,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_lines", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", } ] @@ -509,7 +525,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_lines", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "peer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA" } @@ -526,7 +542,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_lines", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 888888888, "peer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA" @@ -544,7 +560,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_lines", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : "closed", "peer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA" @@ -562,7 +578,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_lines", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_hash" : "FFFFEEEEDDDDCCCCBBBBAAAA9999888877776666555544443333222211110000", "peer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA" @@ -598,7 +614,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_lines", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 12345678, "peer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA" @@ -619,7 +635,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_lines", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 12345678, "peer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA" @@ -678,7 +694,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_lines", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh" } ] @@ -696,7 +712,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_lines", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 0, "peer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA" @@ -715,7 +731,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_objects", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh" } ] @@ -728,7 +744,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_objects", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 77777 } @@ -742,7 +758,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_objects", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : "closed" } @@ -758,7 +774,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_objects", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_hash" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" } @@ -772,7 +788,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_objects", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : "validated" } @@ -809,7 +825,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_objects", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh" } ] @@ -830,7 +846,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_objects", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh" } ] @@ -887,7 +903,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_objects", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 0 } @@ -905,7 +921,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_objects", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 0 } @@ -923,7 +939,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_offers", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh" } ] @@ -936,7 +952,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_offers", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 987654321 } @@ -950,7 +966,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_offers", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : "validated" } @@ -966,7 +982,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_offers", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_hash" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" } @@ -980,7 +996,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_offers", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : "validated" } @@ -1014,7 +1030,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_offers", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh" } ] @@ -1070,7 +1086,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_offers", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 0 } @@ -1088,7 +1104,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_offers", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 0 } @@ -1106,7 +1122,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_tx", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", } ] @@ -1119,7 +1135,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_tx", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 444 } @@ -1138,7 +1154,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_tx", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "count" : true, "binary" : true, @@ -1155,7 +1171,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_tx", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index_max" : -1, "ledger_index_min" : -1 @@ -1176,7 +1192,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_tx", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "binary" : true, "count" : true, @@ -1194,7 +1210,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_tx", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index_max" : -1, "ledger_index_min" : 247, @@ -1217,7 +1233,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_tx", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "binary" : true, "count" : true, @@ -1241,7 +1257,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_tx", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index_max" : 590, "ledger_index_min" : 589, @@ -1265,7 +1281,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_tx", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "count" : true, "descending" : true, @@ -1341,7 +1357,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "account_tx", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 0 } @@ -1353,8 +1369,8 @@ static RPCCallTestData const rpcCallTestArray[] = { __LINE__, {"account_tx", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "580", "579"}, RPCCallTestData::no_exception, - RPC::apiMaximumSupportedVersion == 1 ? - R"({ + { + R"({ "method" : "account_tx", "params" : [ { @@ -1363,9 +1379,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Ledger indexes invalid." } ] - })" - : - R"({ + })", + R"({ "method" : "account_tx", "params" : [ { @@ -1374,7 +1389,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Not synced to the network." } ] - })", + })"}, }, { // Note: this really shouldn't throw, but does at the moment. @@ -1445,7 +1460,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "book_offers", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "taker_gets" : { "currency" : "EUR" }, @@ -1467,7 +1482,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "book_offers", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "taker_gets" : { "currency" : "EUR", "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA" @@ -1489,7 +1504,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "book_offers", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "taker_gets" : { "currency" : "EUR" @@ -1512,7 +1527,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "book_offers", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "ledger_index" : 666, "taker_gets" : { @@ -1537,7 +1552,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "book_offers", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "ledger_index" : "current", "taker_gets" : { @@ -1562,7 +1577,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "book_offers", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789", "taker_gets" : { @@ -1593,7 +1608,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "book_offers", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789", "limit" : 200, @@ -1625,7 +1640,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "book_offers", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789", "limit" : 200, @@ -1725,7 +1740,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "book_offers", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "issuer" : "not_a_valid_issuer", "taker_gets" : { "currency" : "EUR" @@ -1748,7 +1763,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "book_offers", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "ledger_index" : 0, "taker_gets" : { @@ -1789,7 +1804,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "can_delete", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] })"}, @@ -1804,7 +1819,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "can_delete", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "can_delete" : 4294967295 } ] @@ -1820,7 +1835,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "can_delete", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "can_delete" : "FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210" } ] @@ -1836,7 +1851,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "can_delete", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "can_delete" : "always" } ] @@ -1852,7 +1867,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "can_delete", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "can_delete" : "never" } ] @@ -1868,7 +1883,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "can_delete", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "can_delete" : "now" } ] @@ -1895,7 +1910,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "can_delete", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "can_delete" : "invalid" } ] @@ -1932,7 +1947,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "channel_authorize", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "amount" : "18446744073709551615", "channel_id" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF", "secret" : "secret_can_be_anything" @@ -2094,7 +2109,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "channel_verify", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "amount" : "0", "channel_id" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF", "public_key" : "aB4BXXLuPu8DpVuyq1DBiu3SrPdtK9AYZisKhu8mvkoiUD8J9Gov", @@ -2114,7 +2129,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "channel_verify", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "amount" : "18446744073709551615", "channel_id" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF", "public_key" : "021D93E21C44160A1B3B66DA1F37B86BE39FFEA3FC4B95FAA2063F82EE823599F6", @@ -2277,7 +2292,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "channel_verify", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "amount" : "40000000", "channel_id" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF", "public_key" : "aB4BXXLuPu8DpVuyq1DBiu3SrPdtK9AYZisKhu8mvkoiUD8J9Gov", @@ -2299,7 +2314,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "connect", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ip" : "ThereIsNoCheckingOnTheIPFormat" } ] @@ -2312,7 +2327,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "connect", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ip" : "ThereIsNoCheckingOnTheIPFormat", "port" : 6561 } @@ -2381,7 +2396,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "consensus_info", "params" : [ { - "api_version" : %MAX_API_VER% + "api_version" : %API_VER% } ] })"}, @@ -2414,7 +2429,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "deposit_authorized", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "destination_account" : "destination_account_NotValidated", "source_account" : "source_account_NotValidated" } @@ -2431,7 +2446,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "deposit_authorized", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "destination_account" : "destination_account_NotValidated", "ledger_index" : "validated", "source_account" : "source_account_NotValidated" @@ -2449,7 +2464,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "deposit_authorized", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "destination_account" : "destination_account_NotValidated", "ledger_index" : 4294967295, "source_account" : "source_account_NotValidated" @@ -2467,7 +2482,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "deposit_authorized", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "destination_account" : "destination_account_NotValidated", "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789", "source_account" : "source_account_NotValidated" @@ -2522,7 +2537,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "deposit_authorized", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "destination_account" : "destination_account_NotValidated", "ledger_index" : 0, "source_account" : "source_account_NotValidated" @@ -2544,7 +2559,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "download_shard", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "shards" : [ { "index" : 20, @@ -2566,7 +2581,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "download_shard", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "shards" : [ { "index" : 20, @@ -2594,7 +2609,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "download_shard", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "shards" : [ { "index" : 200000000, @@ -2636,7 +2651,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "download_shard", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "shards" : [ { "index" : 2000000, @@ -2695,7 +2710,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "download_shard", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "shards" : [ { "index" : 20, @@ -2767,7 +2782,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "feature", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] })"}, @@ -2779,7 +2794,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "feature", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "feature" : "featureNameOrHexIsNotValidated" } ] @@ -2795,7 +2810,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "feature", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "feature" : "FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210", "vetoed" : false } @@ -2809,7 +2824,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "feature", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "feature" : "0", "vetoed" : true } @@ -2860,7 +2875,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "fetch_info", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] })"}, @@ -2872,7 +2887,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "fetch_info", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "clear" : true } ] @@ -2899,7 +2914,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "fetch_info", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "too" : true } ] @@ -2915,7 +2930,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "gateway_balances", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", } ] @@ -2928,7 +2943,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "gateway_balances", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : "890765" } @@ -2942,7 +2957,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "gateway_balances", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : "current" } @@ -2958,7 +2973,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "gateway_balances", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_hash" : "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV" } @@ -2974,7 +2989,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "gateway_balances", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "hotwallet" : [ "hotwallet_is_not_validated" ] } @@ -2995,7 +3010,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "gateway_balances", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "hotwallet" : [ "hotwallet_is_not_validated_1", @@ -3100,7 +3115,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "get_counts", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] })"}, @@ -3112,7 +3127,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "get_counts", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "min_count" : 100 } ] @@ -3159,7 +3174,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "command", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "json_argument" : true, "method" : "command" } @@ -3177,7 +3192,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "command", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "method" : "command" } ] @@ -3262,7 +3277,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "call_1", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "id" : "A1", "jsonrpc" : "2.0", "method" : "call_1", @@ -3290,7 +3305,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "call_1", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "0" : { "inner_arg" : "yup" }, @@ -3314,7 +3329,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "params" : [ [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "id" : "A1", "jsonrpc" : "2.0", "method" : "call_1", @@ -3341,7 +3356,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "params" : [ [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "0" : { "inner_arg" : "yup" }, @@ -3636,7 +3651,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "ledger", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] })"}, @@ -3648,7 +3663,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "ledger", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : 4294967295 } ] @@ -3661,7 +3676,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "ledger", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : "validated" } ] @@ -3675,7 +3690,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "ledger", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789" } ] @@ -3688,7 +3703,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "ledger", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "full" : true, "ledger_index" : "current" } @@ -3702,7 +3717,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "ledger", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "expand" : true, "ledger_index" : "closed", "transactions" : true @@ -3717,7 +3732,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "ledger", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : 4294967295 } ] @@ -3730,7 +3745,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "ledger", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : 0 } ] @@ -3743,7 +3758,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "ledger", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : 0 } ] @@ -3756,7 +3771,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "ledger", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : 0 } ] @@ -3769,7 +3784,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "ledger", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : "current" } ] @@ -3785,7 +3800,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "ledger_closed", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] })"}, @@ -3814,7 +3829,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "ledger_current", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] })"}, @@ -3843,7 +3858,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "ledger_header", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : 4294967295 } ] @@ -3857,7 +3872,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "ledger_header", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789" } ] @@ -3900,7 +3915,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "ledger_header", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : 0 } ] @@ -3913,7 +3928,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "ledger_header", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : 0 } ] @@ -3926,7 +3941,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "ledger_header", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : 0 } ] @@ -3942,7 +3957,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "ledger_request", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : 4294967295 } ] @@ -3956,7 +3971,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "ledger_request", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789" } ] @@ -3999,7 +4014,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "ledger_request", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : 0 } ] @@ -4012,7 +4027,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "ledger_request", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : 0 } ] @@ -4025,7 +4040,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "ledger_request", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : 0 } ] @@ -4043,7 +4058,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "log_level", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] })"}, @@ -4055,7 +4070,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "log_level", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "severity" : "fatal" } ] @@ -4068,7 +4083,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "log_level", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "severity" : "error" } ] @@ -4081,7 +4096,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "log_level", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "severity" : "warn" } ] @@ -4094,7 +4109,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "log_level", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "severity" : "debug" } ] @@ -4107,7 +4122,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "log_level", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "severity" : "trace" } ] @@ -4120,7 +4135,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "log_level", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "partition" : "base", "severity" : "trace" } @@ -4134,7 +4149,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "log_level", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "partition" : "partition_name", "severity" : "fatal" } @@ -4162,7 +4177,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "log_level", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "severity" : "err" } ] @@ -4179,7 +4194,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "log_level", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "partition" : "fatal", "severity" : "partition_name" } @@ -4198,7 +4213,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "logrotate", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] })"}, @@ -4227,7 +4242,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "node_to_shard", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "action" : "status" } ] @@ -4240,7 +4255,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "node_to_shard", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "action" : "start" } ] @@ -4253,7 +4268,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "node_to_shard", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "action" : "stop" } ] @@ -4280,7 +4295,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "node_to_shard", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "action" : "invalid" } ] @@ -4296,7 +4311,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "owner_info", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh" } ] @@ -4309,7 +4324,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "owner_info", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 987654321 } @@ -4323,7 +4338,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "owner_info", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : "validated" } @@ -4339,7 +4354,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "owner_info", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_hash" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" } @@ -4354,7 +4369,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "params" : [ { "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : "validated" } ] @@ -4425,7 +4440,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "owner_info", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 0 } @@ -4444,7 +4459,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "params" : [ { "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : 0 } ] @@ -4463,7 +4478,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "peers", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] })"}, @@ -4492,7 +4507,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "peer_reservations_add", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "public_key" : "public_key_string" } ] @@ -4505,7 +4520,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "peer_reservations_add", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "description" : "public_key_description", "public_key" : "public_key_string" } @@ -4553,7 +4568,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "peer_reservations_del", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "public_key" : "public_key_string" } ] @@ -4602,7 +4617,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "ping", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] })"}, @@ -4633,7 +4648,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "print", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] })"}, @@ -4646,7 +4661,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "print", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "params" : [ "extra" ] } ] @@ -4678,7 +4693,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "random", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] })"}, @@ -4710,7 +4725,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "ripple_path_find", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "json_argument" : true } ] @@ -4723,7 +4738,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "ripple_path_find", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "json_argument" : true, "ledger_index" : 4294967295 } @@ -4737,7 +4752,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "ripple_path_find", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "json_argument" : true, "ledger_index" : "closed" } @@ -4753,7 +4768,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "ripple_path_find", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "json_argument" : true, "ledger_hash" : "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV" } @@ -4815,7 +4830,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "ripple_path_find", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "json_argument" : true, "ledger_index" : 0 } @@ -4829,7 +4844,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "ripple_path_find", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "json_argument" : true, "ledger_index" : 0 } @@ -4843,7 +4858,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "ripple_path_find", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "json_argument" : true, "ledger_index" : 0 } @@ -4864,7 +4879,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "sign", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "secret" : "my_secret", "tx_json" : { "json_argument" : true @@ -4880,7 +4895,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "sign", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "offline" : true, "secret" : "my_secret", "tx_json" : { @@ -4965,7 +4980,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "sign_for", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret" : "my_secret", "tx_json" : { @@ -4986,7 +5001,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "sign_for", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "offline" : true, "secret" : "my_secret", @@ -5081,7 +5096,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "submit", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "tx_blob" : "the blob is unvalidated and may be any length..." } ] @@ -5098,7 +5113,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "submit", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "secret" : "my_secret", "tx_json" : { "json_argument" : true @@ -5131,7 +5146,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "submit", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "offline" : true, "secret" : "my_secret", "tx_json" : { @@ -5200,7 +5215,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "submit_multisigned", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "tx_json" : { "json_argument" : true } @@ -5268,7 +5283,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "server_info", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] })"}, @@ -5280,7 +5295,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "server_info", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "counters" : true } ] @@ -5307,7 +5322,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "server_info", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] })"}, @@ -5324,7 +5339,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "server_state", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] })"}, @@ -5336,7 +5351,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "server_state", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "counters" : true } ] @@ -5363,7 +5378,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "server_state", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] })"}, @@ -5380,7 +5395,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "stop", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] })"}, @@ -5411,7 +5426,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "transaction_entry", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : 4294967295, "tx_hash" : "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV" } @@ -5427,7 +5442,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "transaction_entry", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : "current", "tx_hash" : "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV" } @@ -5443,7 +5458,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "transaction_entry", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_hash" : "VUTSRQPONMLKJIHGFEDCBA9876543210VUTSRQPONMLKJIHGFEDCBA9876543210", "tx_hash" : "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV" } @@ -5602,7 +5617,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "tx", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ctid" : "FFFFFFFFFFFFFFFF", "max_ledger" : "2", "min_ledger" : "1" @@ -5617,7 +5632,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "tx", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "binary" : true, "ctid" : "FFFFFFFFFFFFFFFF", "max_ledger" : "2", @@ -5633,7 +5648,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "tx", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "transaction" : "transaction_hash_is_not_validated" } ] @@ -5646,7 +5661,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "tx", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "binary" : true, "transaction" : "transaction_hash_is_not_validated" } @@ -5690,313 +5705,12 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "tx", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "transaction" : "transaction_hash_is_not_validated" } ] })"}, - // tx_account - // ------------------------------------------------------------------ - {"tx_account: minimal.", - __LINE__, - {"tx_account", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"}, - RPCCallTestData::no_exception, - R"({ - "method" : "tx_account", - "params" : [ - { - "api_version" : %MAX_API_VER%, - "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", - } - ] - })"}, - {"tx_account: ledger_index .", - __LINE__, - {"tx_account", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "4294967295"}, - RPCCallTestData::no_exception, - R"({ - "method" : "tx_account", - "params" : [ - { - "api_version" : %MAX_API_VER%, - "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", - "ledger_index" : 4294967295 - } - ] - })"}, - {"tx_account: ledger_index plus trailing params.", - __LINE__, - {"tx_account", - "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", - "707", - "forward", - "binary", - "count"}, - RPCCallTestData::no_exception, - R"({ - "method" : "tx_account", - "params" : [ - { - "api_version" : %MAX_API_VER%, - "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", - "binary" : true, - "count" : true, - "forward" : true, - "ledger_index" : 707 - } - ] - })"}, - {"tx_account: ledger_index_min and _max.", - __LINE__, - {"tx_account", - "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", - "2147483647", - "2147483647"}, - RPCCallTestData::no_exception, - R"({ - "method" : "tx_account", - "params" : [ - { - "api_version" : %MAX_API_VER%, - "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", - "ledger_index_max" : 2147483647, - "ledger_index_min" : 2147483647 - } - ] - })"}, - {"tx_account: ledger_index_min and _max plus trailing params.", - __LINE__, - {"tx_account", - "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", - "33333", - "2147483647", - "binary", - "count", - "forward"}, - RPCCallTestData::no_exception, - R"({ - "method" : "tx_account", - "params" : [ - { - "api_version" : %MAX_API_VER%, - "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", - "binary" : true, - "count" : true, - "forward" : true, - "ledger_index_max" : 2147483647, - "ledger_index_min" : 33333 - } - ] - })"}, - {"tx_account: ledger_index_min and _max plus limit.", - __LINE__, - {"tx_account", - "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", - "-1", - "2147483647", - "2147483647"}, - RPCCallTestData::no_exception, - R"({ - "method" : "tx_account", - "params" : [ - { - "api_version" : %MAX_API_VER%, - "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", - "ledger_index_max" : 2147483647, - "ledger_index_min" : -1, - "limit" : 2147483647 - } - ] - })"}, - {"tx_account: ledger_index_min and _max, limit, trailing args.", - __LINE__, - {"tx_account", - "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", - "1", - "1", - "-1", - "count", - "forward", - "binary"}, - RPCCallTestData::no_exception, - R"({ - "method" : "tx_account", - "params" : [ - { - "api_version" : %MAX_API_VER%, - "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", - "binary" : true, - "count" : true, - "forward" : true, - "ledger_index_max" : 1, - "ledger_index_min" : 1, - "limit" : -1 - } - ] - })"}, - {"tx_account: too few arguments.", - __LINE__, - { - "tx_account", - }, - RPCCallTestData::no_exception, - R"({ - "method" : "tx_account", - "params" : [ - { - "error" : "badSyntax", - "error_code" : 1, - "error_message" : "Syntax error." - } - ] - })"}, - {"tx_account: too many arguments.", - __LINE__, - {"tx_account", - "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", - "589", - "590", - "67", - "extra", - "descending", - "count", - "binary"}, - RPCCallTestData::no_exception, - R"({ - "method" : "tx_account", - "params" : [ - { - "error" : "badSyntax", - "error_code" : 1, - "error_message" : "Syntax error." - } - ] - })"}, - { - "tx_account: invalid accountID.", - __LINE__, - {"tx_account", "rHb9CJAWyB4rj9!VRWn96DkukG4bwdtyTh"}, - RPCCallTestData::no_exception, - R"({ - "method" : "tx_account", - "params" : [ - { - "error" : "actMalformed", - "error_code" : 35, - "error_message" : "Account malformed." - } - ] - })", - }, - { - // Note: not currently detected as bad input. - "tx_account: invalid ledger.", - __LINE__, - {"tx_account", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "-478.7"}, - RPCCallTestData::no_exception, - R"({ - "method" : "tx_account", - "params" : [ - { - "api_version" : %MAX_API_VER%, - "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", - "ledger_index" : 0 - } - ] - })", - }, - { - "tx_account: max less than min.", - __LINE__, - {"tx_account", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "580", "579"}, - RPCCallTestData::no_exception, - RPC::apiMaximumSupportedVersion == 1 ? - R"({ - "method" : "tx_account", - "params" : [ - { - "error" : "lgrIdxsInvalid", - "error_code" : 55, - "error_message" : "Ledger indexes invalid." - } - ] - })" - : - R"({ - "method" : "tx_account", - "params" : [ - { - "error" : "notSynced", - "error_code" : 55, - "error_message" : "Not synced to the network." - } - ] - })", - }, - { - // Note: this really shouldn't throw, but does at the moment. - "tx_account: min large but still valid.", - __LINE__, - {"tx_account", - "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", - "2147483648", - "2147483648"}, - RPCCallTestData::bad_cast, - R"()", - }, - { - // Note: this really shouldn't throw, but does at the moment. - "tx_account: max large but still valid.", - __LINE__, - {"tx_account", - "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", - "2147483647", - "2147483648"}, - RPCCallTestData::bad_cast, - R"()", - }, - { - // Note: this really shouldn't throw, but does at the moment. - "tx_account: large limit.", - __LINE__, - {"tx_account", - "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", - "-1", - "-1", - "2147483648"}, - RPCCallTestData::bad_cast, - R"()", - }, - { - // Note: this really shouldn't throw, but does at the moment. - "tx_account: non-integer min.", - __LINE__, - {"tx_account", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "Binary", "-1"}, - RPCCallTestData::bad_cast, - R"()", - }, - { - // Note: this really shouldn't throw, but does at the moment. - "tx_account: non-integer max.", - __LINE__, - {"tx_account", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "-1", "counts"}, - RPCCallTestData::bad_cast, - R"()", - }, - { - // Note: this really shouldn't throw, but does at the moment. - "tx_account: non-integer limit.", - __LINE__, - {"tx_account", - "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", - "-1", - "-1", - "decending"}, - RPCCallTestData::bad_cast, - R"()", - }, - // tx_history // ------------------------------------------------------------------ {"tx_history: minimal.", @@ -6007,7 +5721,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "tx_history", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "start" : 0 } ] @@ -6079,7 +5793,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "unl_list", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] })"}, @@ -6110,7 +5824,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "validation_create", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] })"}, @@ -6122,7 +5836,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "validation_create", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "secret" : "the form of the secret is not validated" } ] @@ -6154,7 +5868,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "version", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] })"}, @@ -6185,7 +5899,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "wallet_propose", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] })"}, @@ -6197,7 +5911,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "wallet_propose", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "passphrase" : "the form of the passphrase is not validated" } ] @@ -6227,7 +5941,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "internal", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "internal_command" : "command_name", "params" : [] } @@ -6247,7 +5961,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "internal", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "internal_command" : "command_name", "params" : [ "string_arg", "1", "-1", "4294967296", "3.14159" ] } @@ -6381,7 +6095,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "unknown_command", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] })"}, @@ -6393,7 +6107,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "method" : "unknown_command", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "params" : [ "string_arg", "1", "-1", "4294967296", "3.14159" ] } ] @@ -6401,11 +6115,10 @@ static RPCCallTestData const rpcCallTestArray[] = { }; std::string -updateAPIVersionString(const char* const req) +updateAPIVersionString(const char* const req, unsigned apiVersion) { - static std::string version_str = - std::to_string(RPC::apiMaximumSupportedVersion); - static auto place_holder = "%MAX_API_VER%"; + std::string const version_str = std::to_string(apiVersion); + static auto const place_holder = "%API_VER%"; std::string jr(req); boost::replace_all(jr, place_holder, version_str); return jr; @@ -6425,9 +6138,13 @@ class RPCCall_test : public beast::unit_test::suite { public: void - testRPCCall() + testRPCCall(unsigned apiVersion) { - testcase << "RPCCall"; + testcase << "RPCCall API version " << apiVersion; + if (!BEAST_EXPECT( + apiVersion >= RPC::apiMinimumSupportedVersion && + apiVersion <= RPC::apiMaximumValidVersion)) + return; test::jtx::Env env( *this, makeNetworkConfig(11111)); // Used only for its Journal. @@ -6435,20 +6152,29 @@ class RPCCall_test : public beast::unit_test::suite // For each RPCCall test. for (RPCCallTestData const& rpcCallTest : rpcCallTestArray) { + if (!BEAST_EXPECT(!rpcCallTest.exp.empty())) + break; + std::vector const args{ rpcCallTest.args.begin(), rpcCallTest.args.end()}; + const char* const expVersioned = + (apiVersion - RPC::apiMinimumSupportedVersion) < + rpcCallTest.exp.size() + ? rpcCallTest.exp[apiVersion - RPC::apiMinimumSupportedVersion] + : rpcCallTest.exp.back(); + // Note that, over the long term, none of these tests should // throw. But, for the moment, some of them do. So handle it. Json::Value got; try { - got = jtx::cmdToJSONRPC(args, env.journal); + got = jtx::cmdToJSONRPC(args, env.journal, apiVersion); } catch (std::bad_cast const&) { if ((rpcCallTest.throwsWhat == RPCCallTestData::bad_cast) && - (std::strlen(rpcCallTest.exp) == 0)) + (std::strlen(expVersioned) == 0)) { pass(); } @@ -6461,7 +6187,8 @@ class RPCCall_test : public beast::unit_test::suite } Json::Value exp; - Json::Reader{}.parse(updateAPIVersionString(rpcCallTest.exp), exp); + Json::Reader{}.parse( + updateAPIVersionString(expVersioned, apiVersion), exp); // Lambda to remove the "params[0u]:error_code" field if present. // Error codes are not expected to be stable between releases. @@ -6492,7 +6219,8 @@ class RPCCall_test : public beast::unit_test::suite void run() override { - testRPCCall(); + test::jtx::forAllApiVersions( + std::bind_front(&RPCCall_test::testRPCCall, this)); } }; diff --git a/src/test/rpc/TransactionEntry_test.cpp b/src/test/rpc/TransactionEntry_test.cpp index da1d6de85f8..90c643700c4 100644 --- a/src/test/rpc/TransactionEntry_test.cpp +++ b/src/test/rpc/TransactionEntry_test.cpp @@ -230,22 +230,20 @@ class TransactionEntry_test : public beast::unit_test::suite } // Use the command line form with the index. - if (apiVersion == RPC::apiMaximumSupportedVersion) - { - Json::Value const clIndex{env.rpc( - "transaction_entry", txhash, std::to_string(index))}; - BEAST_EXPECT(clIndex["result"] == resIndex); - } + Json::Value const clIndex{env.rpc( + apiVersion, + "transaction_entry", + txhash, + std::to_string(index))}; + BEAST_EXPECT(clIndex["result"] == resIndex); // Use the command line form with the ledger_hash. - if (apiVersion == RPC::apiMaximumSupportedVersion) - { - Json::Value const clHash{env.rpc( - "transaction_entry", - txhash, - resIndex[jss::ledger_hash].asString())}; - BEAST_EXPECT(clHash["result"] == resIndex); - } + Json::Value const clHash{env.rpc( + apiVersion, + "transaction_entry", + txhash, + resIndex[jss::ledger_hash].asString())}; + BEAST_EXPECT(clHash["result"] == resIndex); }; Account A1{"A1"}; diff --git a/src/test/rpc/Transaction_test.cpp b/src/test/rpc/Transaction_test.cpp index 0b5ccf3c9d4..9fbda07c789 100644 --- a/src/test/rpc/Transaction_test.cpp +++ b/src/test/rpc/Transaction_test.cpp @@ -21,11 +21,13 @@ #include #include #include +#include #include -#include #include #include #include + +#include #include namespace ripple { @@ -774,11 +776,82 @@ class Transaction_test : public beast::unit_test::suite } } + void + testBinaryRequest(unsigned apiVersion) + { + testcase( + "Test binary request API version " + std::to_string(apiVersion)); + + using namespace test::jtx; + using std::to_string; + + Env env{*this}; + Account const alice{"alice"}; + Account const gw{"gw"}; + auto const USD{gw["USD"]}; + + env.fund(XRP(1000000), alice, gw); + std::shared_ptr const txn = env.tx(); + BEAST_EXPECT( + to_string(txn->getTransactionID()) == + "3F8BDE5A5F82C4F4708E5E9255B713E303E6E1A371FD5C7A704AFD1387C23981"); + env.close(); + std::shared_ptr meta = + env.closed()->txRead(txn->getTransactionID()).second; + + std::string const expected_tx_blob = serializeHex(*txn); + std::string const expected_meta_blob = serializeHex(*meta); + + Json::Value const result = [&env, txn, apiVersion]() { + Json::Value params{Json::objectValue}; + params[jss::transaction] = to_string(txn->getTransactionID()); + params[jss::binary] = true; + params[jss::api_version] = apiVersion; + return env.client().invoke("tx", params); + }(); + + if (BEAST_EXPECT(result[jss::status] == "success")) + { + BEAST_EXPECT(result[jss::result][jss::status] == "success"); + BEAST_EXPECT(result[jss::result][jss::validated] == true); + BEAST_EXPECT( + result[jss::result][jss::hash] == + to_string(txn->getTransactionID())); + BEAST_EXPECT(result[jss::result][jss::ledger_index] == 3); + BEAST_EXPECT(result[jss::result][jss::ctid] == "C000000300030000"); + + if (apiVersion > 1) + { + BEAST_EXPECT( + result[jss::result][jss::tx_blob] == expected_tx_blob); + BEAST_EXPECT( + result[jss::result][jss::meta_blob] == expected_meta_blob); + BEAST_EXPECT( + result[jss::result][jss::ledger_hash] == + "2D5150E5A5AA436736A732291E437ABF01BC9E206C2DF3C77C4F856915" + "7905AA"); + BEAST_EXPECT( + result[jss::result][jss::close_time_iso] == + "2000-01-01T00:00:10Z"); + } + else + { + BEAST_EXPECT(result[jss::result][jss::tx] == expected_tx_blob); + BEAST_EXPECT( + result[jss::result][jss::meta] == expected_meta_blob); + BEAST_EXPECT(result[jss::result][jss::date] == 10); + } + } + } + public: void run() override { using namespace test::jtx; + test::jtx::forAllApiVersions( + std::bind_front(&Transaction_test::testBinaryRequest, this)); + FeatureBitset const all{supported_amendments()}; testWithFeats(all); }