Skip to content

Commit

Permalink
Add v3 support and driveby clang-tidy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
godexsoft committed Nov 25, 2024
1 parent b5da619 commit e981aa8
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/data/CassandraBackend.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@ class BasicCassandraBackend : public BackendInterface {
std::vector<Statement> statements;
statements.reserve(data.size());
for (auto [mptId, holder] : data)
statements.push_back(schema_->insertMPTHolder.bind(std::move(mptId), std::move(holder)));
statements.push_back(schema_->insertMPTHolder.bind(mptId, holder));

executor_.write(std::move(statements));
}
Expand Down
3 changes: 2 additions & 1 deletion src/rpc/CredentialHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "rpc/Errors.hpp"
#include "rpc/JS.hpp"
#include "rpc/common/Types.hpp"
#include "util/AccountUtils.hpp"
#include "util/Assert.hpp"

#include <boost/asio/spawn.hpp>
Expand Down Expand Up @@ -83,7 +84,7 @@ parseAuthorizeCredentials(boost::json::array const& jv)
"issuer must be string, should already be checked in AuthorizeCredentialValidator"
);
auto const issuer =
ripple::parseBase58<ripple::AccountID>(static_cast<std::string>(jo.at(JS(issuer)).as_string()));
util::parseBase58Wrapper<ripple::AccountID>(static_cast<std::string>(jo.at(JS(issuer)).as_string()));
ASSERT(
issuer.has_value(), "issuer must be present, should already be checked in AuthorizeCredentialValidator."
);
Expand Down
5 changes: 1 addition & 4 deletions src/rpc/common/APIVersion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,13 @@ static constexpr uint32_t API_VERSION_DEFAULT = 1u;

/**
* @brief Minimum API version supported by this build
*
* Note: Clio does not natively support v1 and only supports v2 or newer.
* However, Clio will forward all v1 requests to rippled for backward compatibility.
*/
static constexpr uint32_t API_VERSION_MIN = 1u;

/**
* @brief Maximum API version supported by this build
*/
static constexpr uint32_t API_VERSION_MAX = 2u;
static constexpr uint32_t API_VERSION_MAX = 3u;

/**
* @brief A baseclass for API version helper
Expand Down
5 changes: 3 additions & 2 deletions src/rpc/handlers/LedgerEntry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,9 @@ LedgerEntryHandler::process(LedgerEntryHandler::Input input, Context const& ctx)
auto const mptIssuanceID = ripple::uint192{std::string_view(*(input.mptIssuance))};
key = ripple::keylet::mptIssuance(mptIssuanceID).key;
} else if (input.mptoken) {
auto const holder =
ripple::parseBase58<ripple::AccountID>(boost::json::value_to<std::string>(input.mptoken->at(JS(account))));
auto const holder = util::parseBase58Wrapper<ripple::AccountID>(
boost::json::value_to<std::string>(input.mptoken->at(JS(account)))
);
auto const mptIssuanceID =
ripple::uint192{std::string_view(boost::json::value_to<std::string>(input.mptoken->at(JS(mpt_issuance_id))))
};
Expand Down
3 changes: 1 addition & 2 deletions src/web/Resolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include <sstream>
#include <string>
#include <string_view>
#include <utility>
#include <vector>

namespace asio = boost::asio;
Expand Down Expand Up @@ -98,7 +97,7 @@ Resolver::doResolve(std::string_view hostname, std::string_view service)
{
std::vector<boost::asio::ip::tcp::endpoint> endpoints;
for (auto&& endpoint : resolver_.resolve(hostname, service))
endpoints.push_back(std::move(endpoint));
endpoints.push_back(endpoint);

return endpoints;
}
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/rpc/handlers/CredentialHelpersTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "rpc/CredentialHelpers.hpp"
#include "rpc/Errors.hpp"
#include "rpc/JS.hpp"
#include "util/AccountUtils.hpp"
#include "util/AsioContextTestFixture.hpp"
#include "util/MockBackendTestFixture.hpp"
#include "util/MockPrometheus.hpp"
Expand Down Expand Up @@ -96,7 +97,7 @@ TEST(ParseAuthorizeCredentialsTest, ValidCredentialsArray)
ASSERT_TRUE(cred.isFieldPresent(ripple::sfCredentialType));

auto const expectedIssuer =
*ripple::parseBase58<ripple::AccountID>(static_cast<std::string>(credential1[JS(issuer)].as_string()));
*util::parseBase58Wrapper<ripple::AccountID>(static_cast<std::string>(credential1[JS(issuer)].as_string()));
auto const expectedCredentialType =
ripple::strUnHex(static_cast<std::string>(credential1[JS(credential_type)].as_string())).value();

Expand Down

0 comments on commit e981aa8

Please sign in to comment.