Compare commits

..

40 Commits

Author SHA1 Message Date
Mayukha Vadari
e46b3468ae Merge branch 'develop' into mvadari/fix-bad-cast 2026-01-30 12:11:28 -05:00
Mayukha Vadari
e2a273dfa0 respond to comments 2026-01-30 12:11:24 -05:00
Mayukha Vadari
37e3f03764 Merge branch 'develop' into mvadari/fix-bad-cast 2026-01-28 15:52:10 -05:00
Mayukha Vadari
a227fe826f Merge commit '5f638f55536def0d88b970d1018a465a238e55f4' into mvadari/fix-bad-cast 2026-01-28 15:52:02 -05:00
Mayukha Vadari
840e4303e3 Merge commit '92046785d1fea5f9efe5a770d636792ea6cab78b' into mvadari/fix-bad-cast 2026-01-28 15:51:13 -05:00
Mayukha Vadari
949ba8e335 check int limit 2026-01-22 12:17:55 -05:00
Mayukha Vadari
bdc8dc3746 fix build 2026-01-22 12:08:10 -05:00
Mayukha Vadari
ff4125f7f8 Merge branch 'develop' into mvadari/fix-bad-cast 2026-01-22 12:07:02 -05:00
Mayukha Vadari
e42f243913 respond to comments 2026-01-22 12:02:53 -05:00
Mayukha Vadari
b4fcf80df3 Merge branch 'develop' into mvadari/fix-bad-cast 2026-01-22 10:35:39 -05:00
Mayukha Vadari
39dfcdfeb8 Merge branch 'develop' into mvadari/fix-bad-cast 2026-01-21 18:14:23 -05:00
Mayukha Vadari
d4c2154d6e Merge branch 'develop' into mvadari/fix-bad-cast 2026-01-13 17:51:17 -05:00
Mayukha Vadari
acd34177c8 Merge branch 'develop' into mvadari/fix-bad-cast 2026-01-07 16:55:29 -05:00
Mayukha Vadari
36c4060d65 Merge branch 'develop' into mvadari/fix-bad-cast 2026-01-05 15:39:32 -05:00
Mayukha Vadari
eb681adbd3 Merge branch 'develop' into mvadari/fix-bad-cast 2025-12-23 11:52:15 -08:00
Mayukha Vadari
d78bc9e780 Update src/xrpld/rpc/detail/RPCCall.cpp
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-23 11:52:07 -08:00
Mayukha Vadari
2b61b2257b Update API-CHANGELOG.md
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-23 11:51:16 -08:00
Mayukha Vadari
100ad8b531 Merge branch 'develop' into mvadari/fix-bad-cast 2025-12-02 17:57:07 -05:00
Mayukha Vadari
df5226692e fix tests 2025-11-20 18:35:22 +05:30
Mayukha Vadari
eca65c04ee respond to comments (mostly more consts) 2025-11-20 17:49:49 +05:30
Mayukha Vadari
2d53099539 update changelog 2025-11-20 17:45:56 +05:30
Mayukha Vadari
69dba2e36b Merge branch 'develop' into mvadari/fix-bad-cast 2025-11-20 17:45:48 +05:30
Mayukha Vadari
fd2f2b1095 Merge branch 'develop' into mvadari/fix-bad-cast 2025-11-20 15:35:22 +05:30
Mayukha Vadari
50f418f40b add consts 2025-11-20 15:34:44 +05:30
Mayukha Vadari
5154649ff0 remove now-unneeded comments 2025-11-20 15:34:44 +05:30
Mayukha Vadari
96287e20be remove jss::proof 2025-11-20 15:34:44 +05:30
Mayukha Vadari
3e07a64339 Merge branch 'develop' into mvadari/fix-bad-cast 2025-11-18 13:57:57 +05:30
Mayukha Vadari
c326a80abd re-remove debug lines 2025-11-17 18:16:14 +05:30
Mayukha Vadari
efa2a1b4e7 simplify tests 2025-11-17 18:13:13 +05:30
Mayukha Vadari
8852594a7b fix test 2025-11-17 18:13:03 +05:30
Mayukha Vadari
711d765a80 clean up book_offers 2025-11-17 18:05:01 +05:30
Mayukha Vadari
400cd02325 remove debug lines 2025-11-17 18:01:51 +05:30
Mayukha Vadari
2116ea6eae fix tx_history 2025-11-17 18:01:26 +05:30
Mayukha Vadari
f1f2cc70ab fix get_counts 2025-11-17 17:59:50 +05:30
Mayukha Vadari
9e23d50339 fix connect 2025-11-17 17:58:57 +05:30
Mayukha Vadari
fb5d878b86 fix can_delete 2025-11-17 17:58:22 +05:30
Mayukha Vadari
403bfaa636 fix account_tx 2025-11-17 17:48:20 +05:30
Mayukha Vadari
9fb088cb42 remove debug statements 2025-11-17 17:47:20 +05:30
Mayukha Vadari
e66cfab251 fix tests, more cleanup 2025-11-17 17:20:13 +05:30
Mayukha Vadari
17e4d38dde Fix index for iLimit in RPCCall.cpp 2025-11-17 16:11:35 +05:30
15 changed files with 280 additions and 477 deletions

View File

@@ -83,9 +83,15 @@ The [commandline](https://xrpl.org/docs/references/http-websocket-apis/api-conve
The `network_id` field was added in the `server_info` response in version 1.5.0 (2019), but it is not returned in [reporting mode](https://xrpl.org/rippled-server-modes.html#reporting-mode). However, use of reporting mode is now discouraged, in favor of using [Clio](https://github.com/XRPLF/clio) instead.
## Unreleased
### Additions and bugfixes
- `book_offers`: the `proof` parameter is removed from both the RPC and CLI versions. It did not do anything.
## XRP Ledger server version 2.5.0
As of 2025-04-04, version 2.5.0 is in development. You can use a pre-release version by building from source or [using the `nightly` package](https://xrpl.org/docs/infrastructure/installation/install-rippled-on-ubuntu).
[Version 2.5.0](https://github.com/XRPLF/rippled/releases/tag/2.5.0) was released on June 24, 2025.
### Additions and bugfixes in 2.5.0

View File

@@ -11,7 +11,6 @@
#include <cctype>
#include <iterator>
#include <string>
#include <string_view>
#include <vector>
namespace beast {
@@ -180,7 +179,7 @@ split_commas(FwdIt first, FwdIt last)
template <class Result = std::vector<std::string>>
Result
split_commas(std::string_view const& s)
split_commas(boost::beast::string_view const& s)
{
return split_commas(s.begin(), s.end());
}

View File

@@ -1,20 +1,21 @@
#ifndef XRPL_JSON_OUTPUT_H_INCLUDED
#define XRPL_JSON_OUTPUT_H_INCLUDED
#include <boost/beast/core/string.hpp>
#include <functional>
#include <string>
#include <string_view>
namespace Json {
class Value;
using Output = std::function<void(std::string_view const&)>;
using Output = std::function<void(boost::beast::string_view const&)>;
inline Output
stringOutput(std::string& s)
{
return [&](std::string_view const& b) { s.append(b.data(), b.size()); };
return [&](boost::beast::string_view const& b) { s.append(b.data(), b.size()); };
}
/** Writes a minimal representation of a Json value to an Output in O(n) time.

View File

@@ -484,7 +484,6 @@ JSS(ports); // out: NetworkOPs
JSS(previous); // out: Reservations
JSS(previous_ledger); // out: LedgerPropose
JSS(price); // out: amm_info, AuctionSlot
JSS(proof); // in: BookOffers
JSS(propose_seq); // out: LedgerPropose
JSS(proposers); // out: NetworkOPs, LedgerConsensus
JSS(protocol); // out: NetworkOPs, PeerImp

View File

@@ -18,7 +18,6 @@
#include <functional>
#include <list>
#include <string_view>
namespace xrpl {
@@ -50,7 +49,7 @@ private:
bool ping_active_ = false;
boost::beast::websocket::ping_data payload_;
error_code ec_;
std::function<void(boost::beast::websocket::frame_type, std::string_view)> control_callback_;
std::function<void(boost::beast::websocket::frame_type, boost::beast::string_view)> control_callback_;
public:
template <class Body, class Headers>
@@ -138,7 +137,7 @@ protected:
on_ping(error_code const& ec);
void
on_ping_pong(boost::beast::websocket::frame_type kind, std::string_view payload);
on_ping_pong(boost::beast::websocket::frame_type kind, boost::beast::string_view payload);
void
on_timer(error_code ec);
@@ -391,11 +390,11 @@ BaseWSPeer<Handler, Impl>::on_ping(error_code const& ec)
template <class Handler, class Impl>
void
BaseWSPeer<Handler, Impl>::on_ping_pong(boost::beast::websocket::frame_type kind, std::string_view payload)
BaseWSPeer<Handler, Impl>::on_ping_pong(boost::beast::websocket::frame_type kind, boost::beast::string_view payload)
{
if (kind == boost::beast::websocket::frame_type::pong)
{
std::string_view p(payload_.begin(), payload_.size());
boost::beast::string_view p(payload_.begin());
if (payload == p)
{
close_on_timer_ = false;

View File

@@ -8,7 +8,6 @@
#include <set>
#include <stack>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
@@ -88,14 +87,14 @@ public:
}
void
output(std::string_view const& bytes)
output(boost::beast::string_view const& bytes)
{
markStarted();
output_(bytes);
}
void
stringOutput(std::string_view const& bytes)
stringOutput(boost::beast::string_view const& bytes)
{
markStarted();
std::size_t position = 0, writtenUntil = 0;

File diff suppressed because it is too large Load Diff

View File

@@ -330,7 +330,6 @@ public:
std::shared_ptr<ReadView const>& lpLedger,
Book const&,
AccountID const& uTakerID,
bool const bProof,
unsigned int iLimit,
Json::Value const& jvMarker,
Json::Value& jvResult) override;
@@ -4032,7 +4031,6 @@ NetworkOPsImp::getBookPage(
std::shared_ptr<ReadView const>& lpLedger,
Book const& book,
AccountID const& uTakerID,
bool const bProof,
unsigned int iLimit,
Json::Value const& jvMarker,
Json::Value& jvResult)
@@ -4225,7 +4223,6 @@ NetworkOPsImp::getBookPage(
std::shared_ptr<ReadView const> lpLedger,
Book const& book,
AccountID const& uTakerID,
bool const bProof,
unsigned int iLimit,
Json::Value const& jvMarker,
Json::Value& jvResult)

View File

@@ -144,7 +144,6 @@ public:
std::shared_ptr<ReadView const>& lpLedger,
Book const& book,
AccountID const& uTakerID,
bool const bProof,
unsigned int iLimit,
Json::Value const& jvMarker,
Json::Value& jvResult) = 0;

View File

@@ -58,7 +58,7 @@ to_string(ProtocolVersion const& p)
}
std::vector<ProtocolVersion>
parseProtocolVersions(std::string_view const& value)
parseProtocolVersions(boost::beast::string_view const& value)
{
static boost::regex re(
"^" // start of line
@@ -127,7 +127,7 @@ negotiateProtocolVersion(std::vector<ProtocolVersion> const& versions)
}
std::optional<ProtocolVersion>
negotiateProtocolVersion(std::string_view const& versions)
negotiateProtocolVersion(boost::beast::string_view const& versions)
{
auto const them = parseProtocolVersions(versions);

View File

@@ -1,10 +1,11 @@
#ifndef XRPL_OVERLAY_PROTOCOLVERSION_H_INCLUDED
#define XRPL_OVERLAY_PROTOCOLVERSION_H_INCLUDED
#include <boost/beast/core/string.hpp>
#include <cstdint>
#include <optional>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
@@ -39,7 +40,7 @@ to_string(ProtocolVersion const& p);
no duplicates and will be sorted in ascending protocol order.
*/
std::vector<ProtocolVersion>
parseProtocolVersions(std::string_view const& s);
parseProtocolVersions(boost::beast::string_view const& s);
/** Given a list of supported protocol versions, choose the one we prefer. */
std::optional<ProtocolVersion>
@@ -47,7 +48,7 @@ negotiateProtocolVersion(std::vector<ProtocolVersion> const& versions);
/** Given a list of supported protocol versions, choose the one we prefer. */
std::optional<ProtocolVersion>
negotiateProtocolVersion(std::string_view const& versions);
negotiateProtocolVersion(boost::beast::string_view const& versions);
/** The list of all the protocol versions we support. */
std::string const&

View File

@@ -16,7 +16,6 @@
#include <xrpl/protocol/PublicKey.h>
#include <xrpl/protocol/RPCErr.h>
#include <xrpl/protocol/SystemParameters.h>
#include <xrpl/protocol/UintTypes.h>
#include <xrpl/protocol/jss.h>
#include <boost/algorithm/string/predicate.hpp>
@@ -25,7 +24,7 @@
#include <array>
#include <iostream>
#include <type_traits>
#include <limits>
#include <unordered_map>
namespace xrpl {
@@ -130,6 +129,41 @@ private:
}
}
static std::optional<std::int32_t>
jvParseInt(Json::Value const& param)
{
if (param.isInt())
return param.asInt();
if (param.isUInt() && param.asUInt() <= std::numeric_limits<std::int32_t>::max())
return param.asInt();
if (param.isString())
{
std::int32_t v;
if (beast::lexicalCastChecked(v, param.asString()))
return v;
}
return std::nullopt;
}
static std::optional<std::uint32_t>
jvParseUInt(Json::Value const& param)
{
if (param.isUInt() || (param.isInt() && param.asInt() >= 0))
return param.asUInt();
if (param.isString())
{
std::uint32_t v;
if (beast::lexicalCastChecked(v, param.asString()))
return v;
}
return std::nullopt;
}
static bool
validPublicKey(std::string const& strPk, TokenType type = TokenType::AccountPublic)
{
@@ -258,24 +292,54 @@ private:
}
else
{
std::int64_t uLedgerMin = jvParams[1u].asInt();
std::int64_t uLedgerMax = jvParams[2u].asInt();
std::int32_t ledgerMin = 0, ledgerMax = 0; // note: these are only used when properly set
if (auto const ledgerMinOpt = jvParseInt(jvParams[1u]))
{
// A value of -1 instructs the server to use the most recent
// validated ledger version available
ledgerMin = *ledgerMinOpt;
}
else
{
return rpcError(rpcINVALID_LGR_RANGE);
}
if (uLedgerMax != -1 && uLedgerMax < uLedgerMin)
if (auto const ledgerMaxOpt = jvParseInt(jvParams[2u]))
{
ledgerMax = *ledgerMaxOpt;
}
else
{
return rpcError(rpcINVALID_LGR_RANGE);
}
// `-1` means "most recent validated ledger version available"
static std::int32_t const USE_MOST_RECENT_LEDGER = -1;
if (ledgerMax != USE_MOST_RECENT_LEDGER && ledgerMax < ledgerMin)
{
if (apiVersion_ == 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();
jvRequest[jss::ledger_index_min] = ledgerMin;
jvRequest[jss::ledger_index_max] = ledgerMax;
if (iParams >= 4)
jvRequest[jss::limit] = jvParams[3u].asInt();
{
if (auto const limit = jvParseUInt(jvParams[3u]))
jvRequest[jss::limit] = *limit;
else
return RPC::invalid_field_error(jss::limit);
}
if (iParams >= 5)
jvRequest[jss::offset] = jvParams[4u].asInt();
{
if (auto const offset = jvParseInt(jvParams[4u]))
jvRequest[jss::offset] = *offset;
else
return RPC::invalid_field_error(jss::offset);
}
}
return jvRequest;
@@ -321,35 +385,16 @@ private:
if (jvParams.size() >= 5)
{
try
if (auto const limit = jvParseUInt(jvParams[4u]))
{
int iLimit = jvParams[4u].asInt();
if (iLimit > 0)
jvRequest[jss::limit] = iLimit;
jvRequest[jss::limit] = *limit;
}
catch (std::exception const&)
{
else
return RPC::invalid_field_error(jss::limit);
}
}
if (jvParams.size() >= 6)
{
try
{
int bProof = jvParams[5u].asInt();
if (bProof)
jvRequest[jss::proof] = true;
}
catch (std::exception const&)
{
return RPC::invalid_field_error(jss::proof);
}
}
if (jvParams.size() == 7)
jvRequest[jss::marker] = jvParams[6u];
if (jvParams.size() == 6)
jvRequest[jss::marker] = jvParams[5u];
return jvRequest;
}
@@ -365,7 +410,12 @@ private:
std::string input = jvParams[0u].asString();
if (input.find_first_not_of("0123456789") == std::string::npos)
jvRequest["can_delete"] = jvParams[0u].asUInt();
{
if (auto const seq = jvParseUInt(jvParams[0u]))
jvRequest["can_delete"] = *seq;
else
return RPC::invalid_field_error(jss::can_delete);
}
else
jvRequest["can_delete"] = input;
@@ -381,7 +431,10 @@ private:
if (jvParams.size() == 2)
{
jvRequest[jss::ip] = ip;
jvRequest[jss::port] = jvParams[1u].asUInt();
if (auto const port = jvParseUInt(jvParams[1u]))
jvRequest[jss::port] = *port;
else
return RPC::invalid_field_error(jss::port);
return jvRequest;
}
@@ -390,7 +443,12 @@ private:
{
std::size_t colon = ip.find_last_of(":");
jvRequest[jss::ip] = std::string{ip, 0, colon};
jvRequest[jss::port] = Json::Value{std::string{ip, colon + 1}}.asUInt();
if (auto const port = jvParseUInt(std::string{ip, colon + 1}))
jvRequest[jss::port] = *port;
else
return RPC::invalid_field_error(jss::port);
return jvRequest;
}
@@ -463,7 +521,12 @@ private:
Json::Value jvRequest(Json::objectValue);
if (jvParams.size())
jvRequest[jss::min_count] = jvParams[0u].asUInt();
{
if (auto const minCount = jvParseUInt(jvParams[0u]))
jvRequest[jss::min_count] = *minCount;
else
return RPC::invalid_field_error(jss::min_count);
}
return jvRequest;
}
@@ -1062,7 +1125,10 @@ private:
{
Json::Value jvRequest{Json::objectValue};
jvRequest[jss::start] = jvParams[0u].asUInt();
if (auto const start = jvParseUInt(jvParams[0u]))
jvRequest[jss::start] = *start;
else
return RPC::invalid_field_error(jss::start);
return jvRequest;
}
@@ -1206,7 +1272,7 @@ public:
{"amm_info", &RPCParser::parseAsIs, 1, 2},
{"vault_info", &RPCParser::parseVault, 1, 2},
{"book_changes", &RPCParser::parseLedgerId, 1, 1},
{"book_offers", &RPCParser::parseBookOffers, 2, 7},
{"book_offers", &RPCParser::parseBookOffers, 2, 6},
{"can_delete", &RPCParser::parseCanDelete, 0, 1},
{"channel_authorize", &RPCParser::parseChannelAuthorize, 3, 4},
{"channel_verify", &RPCParser::parseChannelVerify, 4, 4},

View File

@@ -34,7 +34,6 @@
#include <algorithm>
#include <memory>
#include <stdexcept>
#include <string_view>
namespace xrpl {
@@ -228,7 +227,7 @@ ServerHandler::onHandoff(
static inline Json::Output
makeOutput(Session& session)
{
return [&](std::string_view const& b) { session.write(b.data(), b.size()); };
return [&](boost::beast::string_view const& b) { session.write(b.data(), b.size()); };
}
static std::map<std::string, std::string>
@@ -512,14 +511,11 @@ ServerHandler::processSession(std::shared_ptr<Session> const& session, std::shar
makeOutput(*session),
coro,
forwardedFor(session->request()),
[&]() -> std::string_view {
[&] {
auto const iter = session->request().find("X-User");
if (iter != session->request().end())
{
auto const val = iter->value();
return std::string_view(val.data(), val.size());
}
return std::string_view{};
return iter->value();
return boost::beast::string_view{};
}());
if (beast::rfc2616::is_keep_alive(session->request()))

View File

@@ -162,8 +162,6 @@ doBookOffers(RPC::JsonContext& context)
if (auto err = readLimitField(limit, RPC::Tuning::bookOffers, context))
return *err;
bool const bProof(context.params.isMember(jss::proof));
Json::Value const jvMarker(
context.params.isMember(jss::marker) ? context.params[jss::marker] : Json::Value(Json::nullValue));
@@ -171,7 +169,6 @@ doBookOffers(RPC::JsonContext& context)
lpLedger,
{{pay_currency, pay_issuer}, {get_currency, get_issuer}, domain},
takerID ? *takerID : beast::zero,
bProof,
limit,
jvMarker,
jvResult);

View File

@@ -312,7 +312,6 @@ doSubscribe(RPC::JsonContext& context)
lpLedger,
field == jss::asks ? reversed(book) : book,
takerID ? *takerID : noAccount(),
false,
RPC::Tuning::bookOffers.rDefault,
jvMarker,
jvOffers);