chore: Update libxrpl to 3.2.0 (#3114)

This commit is contained in:
Sergey Kuznetsov
2026-06-25 11:19:12 +01:00
committed by GitHub
parent 3673586be3
commit 9b04d64a0e
257 changed files with 6174 additions and 6312 deletions

View File

@@ -40,7 +40,7 @@ supportedAmendments()
bool
lookupAmendment(
auto const& allAmendments,
std::vector<ripple::uint256> const& ledgerAmendments,
std::vector<xrpl::uint256> const& ledgerAmendments,
std::string_view name
)
{
@@ -80,7 +80,7 @@ operator std::string_view() const
}
AmendmentKey::
operator ripple::uint256() const
operator xrpl::uint256() const
{
return Amendment::getAmendmentId(name);
}
@@ -92,14 +92,14 @@ AmendmentCenter::AmendmentCenter(std::shared_ptr<data::BackendInterface> const&
namespace vs = std::views;
rg::copy(
ripple::allAmendments() | vs::transform([&](auto const& p) {
xrpl::allAmendments() | vs::transform([&](auto const& p) {
auto const& [name, support] = p;
return Amendment{
.name = name,
.feature = Amendment::getAmendmentId(name),
.isSupportedByXRPL = support != ripple::AmendmentSupport::Unsupported,
.isSupportedByXRPL = support != xrpl::AmendmentSupport::Unsupported,
.isSupportedByClio = rg::contains(supportedAmendments(), name),
.isRetired = support == ripple::AmendmentSupport::Retired
.isRetired = support == xrpl::AmendmentSupport::Retired
};
}),
std::back_inserter(all_)
@@ -207,26 +207,25 @@ AmendmentCenter::operator[](AmendmentKey const& key) const
return getAmendment(key);
}
ripple::uint256
xrpl::uint256
Amendment::getAmendmentId(std::string_view name)
{
return ripple::sha512Half(ripple::Slice(name.data(), name.size()));
return xrpl::sha512Half(xrpl::Slice(name.data(), name.size()));
}
std::optional<std::vector<ripple::uint256>>
std::optional<std::vector<xrpl::uint256>>
AmendmentCenter::fetchAmendmentsList(boost::asio::yield_context yield, uint32_t seq) const
{
// the amendments should always be present on the ledger
auto const amendments =
backend_->fetchLedgerObject(ripple::keylet::amendments().key, seq, yield);
auto const amendments = backend_->fetchLedgerObject(xrpl::keylet::amendments().key, seq, yield);
if (not amendments.has_value())
throw std::runtime_error("Amendments ledger object must be present in the database");
ripple::SLE const amendmentsSLE{
ripple::SerialIter{amendments->data(), amendments->size()}, ripple::keylet::amendments().key
xrpl::SLE const amendmentsSLE{
xrpl::SerialIter{amendments->data(), amendments->size()}, xrpl::keylet::amendments().key
};
return amendmentsSLE[~ripple::sfAmendments];
return amendmentsSLE[~xrpl::sfAmendments];
}
} // namespace data

View File

@@ -134,6 +134,11 @@ struct Amendments {
REGISTER(fixIncludeKeyletFields);
REGISTER(fixTokenEscrowV1);
REGISTER(LendingProtocol);
REGISTER(MPTokensV2);
REGISTER(PermissionDelegationV1_1);
REGISTER(fixBatchInnerSigs);
REGISTER(fixCleanup3_1_3);
REGISTER(fixCleanup3_2_0);
// Obsolete but supported by libxrpl
REGISTER(CryptoConditionsSuite);
@@ -158,8 +163,6 @@ struct Amendments {
REGISTER(fix1512);
REGISTER(fix1523);
REGISTER(fix1528);
REGISTER(fixBatchInnerSigs);
REGISTER(fixCleanup3_1_3);
// NOLINTEND(readability-identifier-naming)
/** @endcond */
};
@@ -263,7 +266,7 @@ public:
operator[](AmendmentKey const& key) const final;
private:
[[nodiscard]] std::optional<std::vector<ripple::uint256>>
[[nodiscard]] std::optional<std::vector<xrpl::uint256>>
fetchAmendmentsList(boost::asio::yield_context yield, uint32_t seq) const;
};

View File

@@ -45,7 +45,7 @@ BackendInterface::finishWrites(std::uint32_t const ledgerSequence)
void
BackendInterface::writeLedgerObject(std::string&& key, std::uint32_t const seq, std::string&& blob)
{
ASSERT(key.size() == sizeof(ripple::uint256), "Key must be 256 bits");
ASSERT(key.size() == sizeof(xrpl::uint256), "Key must be 256 bits");
doWriteLedgerObject(std::move(key), seq, std::move(blob));
}
@@ -58,14 +58,14 @@ BackendInterface::hardFetchLedgerRangeNoThrow() const
// *** state data methods
std::optional<Blob>
BackendInterface::fetchLedgerObject(
ripple::uint256 const& key,
xrpl::uint256 const& key,
std::uint32_t const sequence,
boost::asio::yield_context yield
) const
{
auto obj = cache_.get().get(key, sequence);
if (obj) {
LOG(log_.trace()) << "Cache hit - " << ripple::strHex(key);
LOG(log_.trace()) << "Cache hit - " << xrpl::strHex(key);
return obj;
}
@@ -80,7 +80,7 @@ BackendInterface::fetchLedgerObject(
std::optional<std::uint32_t>
BackendInterface::fetchLedgerObjectSeq(
ripple::uint256 const& key,
xrpl::uint256 const& key,
std::uint32_t const sequence,
boost::asio::yield_context yield
) const
@@ -93,14 +93,14 @@ BackendInterface::fetchLedgerObjectSeq(
std::vector<Blob>
BackendInterface::fetchLedgerObjects(
std::vector<ripple::uint256> const& keys,
std::vector<xrpl::uint256> const& keys,
std::uint32_t const sequence,
boost::asio::yield_context yield
) const
{
std::vector<Blob> results;
results.resize(keys.size());
std::vector<ripple::uint256> misses;
std::vector<xrpl::uint256> misses;
for (size_t i = 0; i < keys.size(); ++i) {
auto obj = cache_.get().get(keys[i], sequence);
if (obj) {
@@ -126,25 +126,25 @@ BackendInterface::fetchLedgerObjects(
}
// Fetches the successor to key/index
std::optional<ripple::uint256>
std::optional<xrpl::uint256>
BackendInterface::fetchSuccessorKey(
ripple::uint256 key,
xrpl::uint256 key,
std::uint32_t const ledgerSequence,
boost::asio::yield_context yield
) const
{
auto succ = cache_.get().getSuccessor(key, ledgerSequence);
if (succ) {
LOG(log_.trace()) << "Cache hit - " << ripple::strHex(key);
LOG(log_.trace()) << "Cache hit - " << xrpl::strHex(key);
} else {
LOG(log_.trace()) << "Cache miss - " << ripple::strHex(key);
LOG(log_.trace()) << "Cache miss - " << xrpl::strHex(key);
}
return succ ? succ->key : doFetchSuccessorKey(key, ledgerSequence, yield);
}
std::optional<LedgerObject>
BackendInterface::fetchSuccessorObject(
ripple::uint256 key,
xrpl::uint256 key,
std::uint32_t const ledgerSequence,
boost::asio::yield_context yield
) const
@@ -162,7 +162,7 @@ BackendInterface::fetchSuccessorObject(
BookOffersPage
BackendInterface::fetchBookOffers(
ripple::uint256 const& book,
xrpl::uint256 const& book,
std::uint32_t const ledgerSequence,
std::uint32_t const limit,
boost::asio::yield_context yield
@@ -171,9 +171,9 @@ BackendInterface::fetchBookOffers(
// TODO try to speed this up. This can take a few seconds. The goal is
// to get it down to a few hundred milliseconds.
BookOffersPage page;
ripple::uint256 const bookEnd = ripple::getQualityNext(book);
ripple::uint256 uTipIndex = book;
std::vector<ripple::uint256> keys;
xrpl::uint256 const bookEnd = xrpl::getQualityNext(book);
xrpl::uint256 uTipIndex = book;
std::vector<xrpl::uint256> keys;
auto getMillis = [](auto diff) {
return std::chrono::duration_cast<std::chrono::milliseconds>(diff).count();
};
@@ -195,17 +195,17 @@ BackendInterface::fetchBookOffers(
uTipIndex = offerDir->key;
while (keys.size() < limit) {
++numPages;
ripple::STLedgerEntry const sle{
ripple::SerialIter{offerDir->blob.data(), offerDir->blob.size()}, offerDir->key
xrpl::STLedgerEntry const sle{
xrpl::SerialIter{offerDir->blob.data(), offerDir->blob.size()}, offerDir->key
};
auto indexes = sle.getFieldV256(ripple::sfIndexes);
auto indexes = sle.getFieldV256(xrpl::sfIndexes);
keys.insert(keys.end(), indexes.begin(), indexes.end());
auto next = sle.getFieldU64(ripple::sfIndexNext);
auto next = sle.getFieldU64(xrpl::sfIndexNext);
if (next == 0u) {
LOG(log_.trace()) << "Next is empty. breaking";
break;
}
auto nextKey = ripple::keylet::page(uTipIndex, next);
auto nextKey = xrpl::keylet::page(uTipIndex, next);
auto nextDir = fetchLedgerObject(nextKey.key, ledgerSequence, yield);
ASSERT(nextDir.has_value(), "Next dir must exist");
// NOLINTBEGIN(bugprone-unchecked-optional-access)
@@ -219,8 +219,8 @@ BackendInterface::fetchBookOffers(
auto mid = std::chrono::system_clock::now();
auto objs = fetchLedgerObjects(keys, ledgerSequence, yield);
for (size_t i = 0; i < keys.size() && i < limit; ++i) {
LOG(log_.trace()) << "Key = " << ripple::strHex(keys[i])
<< " blob = " << ripple::strHex(objs[i])
LOG(log_.trace()) << "Key = " << xrpl::strHex(keys[i])
<< " blob = " << xrpl::strHex(objs[i])
<< " ledgerSequence = " << ledgerSequence;
ASSERT(!objs[i].empty(), "Ledger object can't be empty");
page.offers.push_back({.key = keys[i], .blob = objs[i]});
@@ -236,7 +236,7 @@ BackendInterface::fetchBookOffers(
<< ". Fetching all objects took " << std::to_string(getMillis(end - mid))
<< " milliseconds. total time = " << std::to_string(getMillis(end - begin))
<< " milliseconds"
<< " book = " << ripple::strHex(book);
<< " book = " << xrpl::strHex(book);
return page;
}
@@ -295,7 +295,7 @@ BackendInterface::setRange(uint32_t min, uint32_t max, bool force)
LedgerPage
BackendInterface::fetchLedgerPage(
std::optional<ripple::uint256> const& cursor,
std::optional<xrpl::uint256> const& cursor,
std::uint32_t const ledgerSequence,
std::uint32_t const limit,
bool outOfOrder,
@@ -304,11 +304,11 @@ BackendInterface::fetchLedgerPage(
{
LedgerPage page;
std::vector<ripple::uint256> keys;
std::vector<xrpl::uint256> keys;
bool reachedEnd = false;
while (keys.size() < limit && !reachedEnd) {
ripple::uint256 const& curCursor = [&]() {
xrpl::uint256 const& curCursor = [&]() {
if (!keys.empty())
return keys.back();
return (cursor ? *cursor : kFirstKey);
@@ -331,10 +331,10 @@ BackendInterface::fetchLedgerPage(
page.objects.push_back({.key = keys[i], .blob = std::move(objects[i])});
} else if (!outOfOrder) {
LOG(log_.error()) << "Deleted or non-existent object in successor table. key = "
<< ripple::strHex(keys[i]) << " - seq = " << ledgerSequence;
<< xrpl::strHex(keys[i]) << " - seq = " << ledgerSequence;
std::stringstream msg;
for (size_t j = 0; j < objects.size(); ++j) {
msg << " - " << ripple::strHex(keys[j]);
msg << " - " << xrpl::strHex(keys[j]);
}
LOG(log_.error()) << msg.str();
@@ -348,12 +348,12 @@ BackendInterface::fetchLedgerPage(
return page;
}
std::optional<ripple::Fees>
std::optional<xrpl::Fees>
BackendInterface::fetchFees(std::uint32_t const seq, boost::asio::yield_context yield) const
{
ripple::Fees fees;
xrpl::Fees fees;
auto key = ripple::keylet::fees().key;
auto key = xrpl::keylet::fees().key;
auto bytes = fetchLedgerObject(key, seq, yield);
if (!bytes) {
@@ -361,17 +361,17 @@ BackendInterface::fetchFees(std::uint32_t const seq, boost::asio::yield_context
return {};
}
ripple::SerialIter it(bytes->data(), bytes->size());
ripple::SLE const sle{it, key};
xrpl::SerialIter it(bytes->data(), bytes->size());
xrpl::SLE const sle{it, key};
// XRPFees amendment introduced new fields for fees calculations.
// New fields are set and the old fields are removed via `set_fees` tx.
// Fallback to old fields if `set_fees` was not yet used to update the fields on this tx.
auto hasNewFields = false;
{
auto const baseFeeXRP = sle.at(~ripple::sfBaseFeeDrops);
auto const reserveBaseXRP = sle.at(~ripple::sfReserveBaseDrops);
auto const reserveIncrementXRP = sle.at(~ripple::sfReserveIncrementDrops);
auto const baseFeeXRP = sle.at(~xrpl::sfBaseFeeDrops);
auto const reserveBaseXRP = sle.at(~xrpl::sfReserveBaseDrops);
auto const reserveIncrementXRP = sle.at(~xrpl::sfReserveIncrementDrops);
if (baseFeeXRP)
fees.base = baseFeeXRP->xrp();
@@ -387,9 +387,9 @@ BackendInterface::fetchFees(std::uint32_t const seq, boost::asio::yield_context
if (not hasNewFields) {
// Fallback to old fields
auto const baseFee = sle.at(~ripple::sfBaseFee);
auto const reserveBase = sle.at(~ripple::sfReserveBase);
auto const reserveIncrement = sle.at(~ripple::sfReserveIncrement);
auto const baseFee = sle.at(~xrpl::sfBaseFee);
auto const reserveBase = sle.at(~xrpl::sfReserveBase);
auto const reserveIncrement = sle.at(~xrpl::sfReserveIncrement);
if (baseFee)
fees.base = baseFee.value();

View File

@@ -178,9 +178,9 @@ public:
*
* @param sequence The sequence number to fetch for
* @param yield The coroutine context
* @return The ripple::LedgerHeader if found; nullopt otherwise
* @return The xrpl::LedgerHeader if found; nullopt otherwise
*/
virtual std::optional<ripple::LedgerHeader>
virtual std::optional<xrpl::LedgerHeader>
fetchLedgerBySequence(std::uint32_t sequence, boost::asio::yield_context yield) const = 0;
/**
@@ -188,10 +188,10 @@ public:
*
* @param hash The hash to fetch for
* @param yield The coroutine context
* @return The ripple::LedgerHeader if found; nullopt otherwise
* @return The xrpl::LedgerHeader if found; nullopt otherwise
*/
virtual std::optional<ripple::LedgerHeader>
fetchLedgerByHash(ripple::uint256 const& hash, boost::asio::yield_context yield) const = 0;
virtual std::optional<xrpl::LedgerHeader>
fetchLedgerByHash(xrpl::uint256 const& hash, boost::asio::yield_context yield) const = 0;
/**
* @brief Fetches the latest ledger sequence.
@@ -218,9 +218,9 @@ public:
* @param pageSize The maximum number of accounts per page
* @param seq The accounts need to exist for this sequence
* @param yield The coroutine context
* @return A vector of ripple::uint256 representing the account roots
* @return A vector of xrpl::uint256 representing the account roots
*/
virtual std::vector<ripple::uint256>
virtual std::vector<xrpl::uint256>
fetchAccountRoots(
std::uint32_t number,
std::uint32_t pageSize,
@@ -262,7 +262,7 @@ public:
* @param yield The coroutine context
* @return Fees if fees are found; nullopt otherwise
*/
std::optional<ripple::Fees>
std::optional<xrpl::Fees>
fetchFees(std::uint32_t seq, boost::asio::yield_context yield) const;
/**
@@ -273,7 +273,7 @@ public:
* @return TransactionAndMetadata if transaction is found; nullopt otherwise
*/
virtual std::optional<TransactionAndMetadata>
fetchTransaction(ripple::uint256 const& hash, boost::asio::yield_context yield) const = 0;
fetchTransaction(xrpl::uint256 const& hash, boost::asio::yield_context yield) const = 0;
/**
* @brief Fetches multiple transactions.
@@ -284,7 +284,7 @@ public:
*/
virtual std::vector<TransactionAndMetadata>
fetchTransactions(
std::vector<ripple::uint256> const& hashes,
std::vector<xrpl::uint256> const& hashes,
boost::asio::yield_context yield
) const = 0;
@@ -300,7 +300,7 @@ public:
*/
virtual TransactionsAndCursor
fetchAccountTransactions(
ripple::AccountID const& account,
xrpl::AccountID const& account,
std::uint32_t limit,
bool forward,
std::optional<TransactionsCursor> const& txnCursor,
@@ -325,9 +325,9 @@ public:
*
* @param ledgerSequence The ledger sequence to fetch for
* @param yield The coroutine context
* @return Hashes as ripple::uint256 in a vector
* @return Hashes as xrpl::uint256 in a vector
*/
virtual std::vector<ripple::uint256>
virtual std::vector<xrpl::uint256>
fetchAllTransactionHashesInLedger(
std::uint32_t ledgerSequence,
boost::asio::yield_context yield
@@ -343,7 +343,7 @@ public:
*/
virtual std::optional<NFT>
fetchNFT(
ripple::uint256 const& tokenID,
xrpl::uint256 const& tokenID,
std::uint32_t ledgerSequence,
boost::asio::yield_context yield
) const = 0;
@@ -360,7 +360,7 @@ public:
*/
virtual TransactionsAndCursor
fetchNFTTransactions(
ripple::uint256 const& tokenID,
xrpl::uint256 const& tokenID,
std::uint32_t limit,
bool forward,
std::optional<TransactionsCursor> const& cursorIn,
@@ -381,11 +381,11 @@ public:
*/
virtual NFTsAndCursor
fetchNFTsByIssuer(
ripple::AccountID const& issuer,
xrpl::AccountID const& issuer,
std::optional<std::uint32_t> const& taxon,
std::uint32_t ledgerSequence,
std::uint32_t limit,
std::optional<ripple::uint256> const& cursorIn,
std::optional<xrpl::uint256> const& cursorIn,
boost::asio::yield_context yield
) const = 0;
@@ -401,9 +401,9 @@ public:
*/
virtual MPTHoldersAndCursor
fetchMPTHolders(
ripple::uint192 const& mptID,
xrpl::uint192 const& mptID,
std::uint32_t const limit,
std::optional<ripple::AccountID> const& cursorIn,
std::optional<xrpl::AccountID> const& cursorIn,
std::uint32_t const ledgerSequence,
boost::asio::yield_context yield
) const = 0;
@@ -426,7 +426,7 @@ public:
*/
virtual TransactionsAndCursor
fetchMPTokenIssuanceTransactions(
ripple::uint192 const& mptIssuanceID,
xrpl::uint192 const& mptIssuanceID,
std::uint32_t limit,
bool forward,
std::optional<TransactionsCursor> const& cursorIn,
@@ -454,8 +454,8 @@ public:
*/
virtual TransactionsAndCursor
fetchAccountMPTokenIssuanceTransactions(
ripple::uint192 const& mptIssuanceID,
ripple::AccountID const& account,
xrpl::uint192 const& mptIssuanceID,
xrpl::AccountID const& account,
std::uint32_t limit,
bool forward,
std::optional<TransactionsCursor> const& cursorIn,
@@ -475,7 +475,7 @@ public:
*/
std::optional<Blob>
fetchLedgerObject(
ripple::uint256 const& key,
xrpl::uint256 const& key,
std::uint32_t sequence,
boost::asio::yield_context yield
) const;
@@ -492,7 +492,7 @@ public:
*/
std::optional<std::uint32_t>
fetchLedgerObjectSeq(
ripple::uint256 const& key,
xrpl::uint256 const& key,
std::uint32_t sequence,
boost::asio::yield_context yield
) const;
@@ -511,7 +511,7 @@ public:
*/
std::vector<Blob>
fetchLedgerObjects(
std::vector<ripple::uint256> const& keys,
std::vector<xrpl::uint256> const& keys,
std::uint32_t sequence,
boost::asio::yield_context yield
) const;
@@ -526,7 +526,7 @@ public:
*/
virtual std::optional<Blob>
doFetchLedgerObject(
ripple::uint256 const& key,
xrpl::uint256 const& key,
std::uint32_t sequence,
boost::asio::yield_context yield
) const = 0;
@@ -541,7 +541,7 @@ public:
*/
virtual std::optional<std::uint32_t>
doFetchLedgerObjectSeq(
ripple::uint256 const& key,
xrpl::uint256 const& key,
std::uint32_t sequence,
boost::asio::yield_context yield
) const = 0;
@@ -556,7 +556,7 @@ public:
*/
virtual std::vector<Blob>
doFetchLedgerObjects(
std::vector<ripple::uint256> const& keys,
std::vector<xrpl::uint256> const& keys,
std::uint32_t sequence,
boost::asio::yield_context yield
) const = 0;
@@ -583,7 +583,7 @@ public:
*/
LedgerPage
fetchLedgerPage(
std::optional<ripple::uint256> const& cursor,
std::optional<xrpl::uint256> const& cursor,
std::uint32_t ledgerSequence,
std::uint32_t limit,
bool outOfOrder,
@@ -600,7 +600,7 @@ public:
*/
std::optional<LedgerObject>
fetchSuccessorObject(
ripple::uint256 key,
xrpl::uint256 key,
std::uint32_t ledgerSequence,
boost::asio::yield_context yield
) const;
@@ -617,9 +617,9 @@ public:
* @param yield The coroutine context
* @return The successor key on success; nullopt otherwise
*/
std::optional<ripple::uint256>
std::optional<xrpl::uint256>
fetchSuccessorKey(
ripple::uint256 key,
xrpl::uint256 key,
std::uint32_t ledgerSequence,
boost::asio::yield_context yield
) const;
@@ -632,9 +632,9 @@ public:
* @param yield The coroutine context
* @return The successor on success; nullopt otherwise
*/
virtual std::optional<ripple::uint256>
virtual std::optional<xrpl::uint256>
doFetchSuccessorKey(
ripple::uint256 key,
xrpl::uint256 key,
std::uint32_t ledgerSequence,
boost::asio::yield_context yield
) const = 0;
@@ -650,7 +650,7 @@ public:
*/
BookOffersPage
fetchBookOffers(
ripple::uint256 const& book,
xrpl::uint256 const& book,
std::uint32_t ledgerSequence,
std::uint32_t limit,
boost::asio::yield_context yield
@@ -717,7 +717,7 @@ public:
* @param blob r-value string serialization of ledger header.
*/
virtual void
writeLedger(ripple::LedgerHeader const& ledgerHeader, std::string&& blob) = 0;
writeLedger(xrpl::LedgerHeader const& ledgerHeader, std::string&& blob) = 0;
/**
* @brief Writes a new ledger object.

View File

@@ -101,11 +101,11 @@ public:
[[nodiscard]] NFTsAndCursor
fetchNFTsByIssuer(
ripple::AccountID const& issuer,
xrpl::AccountID const& issuer,
std::optional<std::uint32_t> const& taxon,
std::uint32_t const ledgerSequence,
std::uint32_t const limit,
std::optional<ripple::uint256> const& cursorIn,
std::optional<xrpl::uint256> const& cursorIn,
boost::asio::yield_context yield
) const override
{
@@ -115,7 +115,7 @@ public:
if (taxon.has_value()) {
auto r = schema_->selectNFTIDsByIssuerTaxon.bind(issuer);
r.bindAt(1, *taxon);
r.bindAt(2, cursorIn.value_or(ripple::uint256(0)));
r.bindAt(2, cursorIn.value_or(xrpl::uint256(0)));
r.bindAt(3, Limit{limit});
return r;
}
@@ -124,9 +124,8 @@ public:
r.bindAt(
1,
std::make_tuple(
cursorIn.has_value() ? ripple::nft::toUInt32(ripple::nft::getTaxon(*cursorIn))
: 0,
cursorIn.value_or(ripple::uint256(0))
cursorIn.has_value() ? xrpl::nft::toUInt32(xrpl::nft::getTaxon(*cursorIn)) : 0,
cursorIn.value_or(xrpl::uint256(0))
)
);
r.bindAt(2, Limit{limit});
@@ -142,8 +141,8 @@ public:
return {};
}
std::vector<ripple::uint256> nftIDs;
for (auto const [nftID] : extract<ripple::uint256>(idQueryResults))
std::vector<xrpl::uint256> nftIDs;
for (auto const [nftID] : extract<xrpl::uint256>(idQueryResults))
nftIDs.push_back(nftID);
if (nftIDs.empty())
@@ -177,11 +176,11 @@ public:
auto const nftUris = executor_.readEach(yield, selectNFTURIStatements);
for (auto i = 0u; i < nftIDs.size(); i++) {
if (auto const maybeRow = nftInfos[i].template get<uint32_t, ripple::AccountID, bool>();
if (auto const maybeRow = nftInfos[i].template get<uint32_t, xrpl::AccountID, bool>();
maybeRow.has_value()) {
auto [seq, owner, isBurned] = *maybeRow;
NFT nft(nftIDs[i], seq, owner, isBurned);
if (auto const maybeUri = nftUris[i].template get<ripple::Blob>();
if (auto const maybeUri = nftUris[i].template get<xrpl::Blob>();
maybeUri.has_value())
nft.uri = *maybeUri;
ret.nfts.push_back(nft);
@@ -190,7 +189,7 @@ public:
return ret;
}
[[nodiscard]] std::vector<ripple::uint256>
[[nodiscard]] std::vector<xrpl::uint256>
fetchAccountRoots(
std::uint32_t number,
std::uint32_t pageSize,
@@ -198,8 +197,8 @@ public:
boost::asio::yield_context yield
) const override
{
std::vector<ripple::uint256> liveAccounts;
std::optional<ripple::AccountID> lastItem;
std::vector<xrpl::uint256> liveAccounts;
std::optional<xrpl::AccountID> lastItem;
while (liveAccounts.size() < number) {
Statement const statement = lastItem
@@ -214,9 +213,9 @@ public:
break;
}
// The results should not contain duplicates, we just filter out deleted accounts
std::vector<ripple::uint256> fullAccounts;
for (auto [account] : extract<ripple::AccountID>(results)) {
fullAccounts.push_back(ripple::keylet::account(account).key);
std::vector<xrpl::uint256> fullAccounts;
for (auto [account] : extract<xrpl::AccountID>(results)) {
fullAccounts.push_back(xrpl::keylet::account(account).key);
lastItem = account;
}
auto const objs = this->doFetchLedgerObjects(fullAccounts, seq, yield);

View File

@@ -24,10 +24,10 @@
* @brief Struct used to keep track of what to write to account_transactions/account_tx tables.
*/
struct AccountTransactionsData {
boost::container::flat_set<ripple::AccountID> accounts;
boost::container::flat_set<xrpl::AccountID> accounts;
std::uint32_t ledgerSequence{};
std::uint32_t transactionIndex{};
ripple::uint256 txHash;
xrpl::uint256 txHash;
/**
* @brief Construct a new AccountTransactionsData object
@@ -35,7 +35,7 @@ struct AccountTransactionsData {
* @param meta The transaction metadata
* @param txHash The transaction hash
*/
AccountTransactionsData(ripple::TxMeta const& meta, ripple::uint256 const& txHash)
AccountTransactionsData(xrpl::TxMeta const& meta, xrpl::uint256 const& txHash)
: accounts(meta.getAffectedAccounts())
, ledgerSequence(meta.getLgrSeq())
, transactionIndex(meta.getIndex())
@@ -52,10 +52,10 @@ struct AccountTransactionsData {
* Gets written to nf_token_transactions table and the like.
*/
struct NFTTransactionsData {
ripple::uint256 tokenID;
xrpl::uint256 tokenID;
std::uint32_t ledgerSequence;
std::uint32_t transactionIndex;
ripple::uint256 txHash;
xrpl::uint256 txHash;
/**
* @brief Construct a new NFTTransactionsData object
@@ -65,9 +65,9 @@ struct NFTTransactionsData {
* @param txHash The transaction hash
*/
NFTTransactionsData(
ripple::uint256 const& tokenID,
ripple::TxMeta const& meta,
ripple::uint256 const& txHash
xrpl::uint256 const& tokenID,
xrpl::TxMeta const& meta,
xrpl::uint256 const& txHash
)
: tokenID(tokenID)
, ledgerSequence(meta.getLgrSeq())
@@ -91,11 +91,11 @@ struct NFTTransactionsData {
* objects.
*/
struct NFTsData {
ripple::uint256 tokenID;
xrpl::uint256 tokenID;
std::uint32_t ledgerSequence;
std::optional<std::uint32_t> transactionIndex;
ripple::AccountID owner;
std::optional<ripple::Blob> uri;
xrpl::AccountID owner;
std::optional<xrpl::Blob> uri;
bool isBurned = false;
bool onlyUriChanged = false; // Whether only the URI was changed
@@ -113,10 +113,10 @@ struct NFTsData {
* @param meta The transaction metadata
*/
NFTsData(
ripple::uint256 const& tokenID,
ripple::AccountID const& owner,
ripple::Blob const& uri,
ripple::TxMeta const& meta
xrpl::uint256 const& tokenID,
xrpl::AccountID const& owner,
xrpl::Blob const& uri,
xrpl::TxMeta const& meta
)
: tokenID(tokenID)
, ledgerSequence(meta.getLgrSeq())
@@ -137,9 +137,9 @@ struct NFTsData {
* @param isBurned Whether the NFT is burned
*/
NFTsData(
ripple::uint256 const& tokenID,
ripple::AccountID const& owner,
ripple::TxMeta const& meta,
xrpl::uint256 const& tokenID,
xrpl::AccountID const& owner,
xrpl::TxMeta const& meta,
bool isBurned
)
: tokenID(tokenID)
@@ -164,10 +164,10 @@ struct NFTsData {
* @param uri The URI
*/
NFTsData(
ripple::uint256 const& tokenID,
xrpl::uint256 const& tokenID,
std::uint32_t const ledgerSequence,
ripple::AccountID const& owner,
ripple::Blob const& uri
xrpl::AccountID const& owner,
xrpl::Blob const& uri
)
: tokenID(tokenID), ledgerSequence(ledgerSequence), owner(owner), uri(uri)
{
@@ -181,7 +181,7 @@ struct NFTsData {
* @param uri The new URI
*
*/
NFTsData(ripple::uint256 const& tokenID, ripple::TxMeta const& meta, ripple::Blob const& uri)
NFTsData(xrpl::uint256 const& tokenID, xrpl::TxMeta const& meta, xrpl::Blob const& uri)
: tokenID(tokenID)
, ledgerSequence(meta.getLgrSeq())
, transactionIndex(meta.getIndex())
@@ -195,8 +195,8 @@ struct NFTsData {
* @brief Represents an MPT and holder pair
*/
struct MPTHolderData {
ripple::uint192 mptID;
ripple::AccountID holder;
xrpl::uint192 mptID;
xrpl::AccountID holder;
};
/**
@@ -206,11 +206,11 @@ struct MPTHolderData {
* mptoken_issuance_transactions and account_mptoken_issuance_transactions.
*/
struct MPTokenIssuanceTransactionsData {
ripple::uint192 mptIssuanceID;
boost::container::flat_set<ripple::AccountID> accounts;
xrpl::uint192 mptIssuanceID;
boost::container::flat_set<xrpl::AccountID> accounts;
std::uint32_t ledgerSequence{};
std::uint32_t transactionIndex{};
ripple::uint256 txHash;
xrpl::uint256 txHash;
};
/**
@@ -246,25 +246,25 @@ isBookDir(T const& key, R const& object)
if (!isDirNode(object))
return false;
ripple::STLedgerEntry const sle{ripple::SerialIter{object.data(), object.size()}, key};
return !sle[~ripple::sfOwner].has_value();
xrpl::STLedgerEntry const sle{xrpl::SerialIter{object.data(), object.size()}, key};
return !sle[~xrpl::sfOwner].has_value();
}
/**
* @brief Get the book base.
*
* @param key The key to get the book base out of
* @return Book base as ripple::uint256
* @return Book base as xrpl::uint256
*/
template <typename T>
inline ripple::uint256
inline xrpl::uint256
getBookBase(T const& key)
{
static constexpr size_t kEySize = 24;
ASSERT(key.size() == ripple::uint256::size(), "Invalid key size {}", key.size());
ASSERT(key.size() == xrpl::uint256::size(), "Invalid key size {}", key.size());
ripple::uint256 ret;
xrpl::uint256 ret;
for (size_t i = 0; i < kEySize; ++i)
ret.data()[i] = key.data()[i];
@@ -272,15 +272,15 @@ getBookBase(T const& key)
}
/**
* @brief Stringify a ripple::uint256.
* @brief Stringify a xrpl::uint256.
*
* @param input The input value
* @return The input value as a string
*/
inline std::string
uint256ToString(ripple::uint256 const& input)
uint256ToString(xrpl::uint256 const& input)
{
return {reinterpret_cast<char const*>(input.data()), ripple::uint256::size()};
return {reinterpret_cast<char const*>(input.data()), xrpl::uint256::size()};
}
/** @brief The ripple epoch start timestamp. Midnight on 1st January 2000. */

View File

@@ -104,23 +104,23 @@ public:
[[nodiscard]] NFTsAndCursor
fetchNFTsByIssuer(
ripple::AccountID const& issuer,
xrpl::AccountID const& issuer,
std::optional<std::uint32_t> const& taxon,
std::uint32_t const ledgerSequence,
std::uint32_t const limit,
std::optional<ripple::uint256> const& cursorIn,
std::optional<xrpl::uint256> const& cursorIn,
boost::asio::yield_context yield
) const override
{
std::vector<ripple::uint256> nftIDs;
std::vector<xrpl::uint256> nftIDs;
if (taxon.has_value()) {
// Keyspace and ScyllaDB uses the same logic for taxon-filtered queries
nftIDs = fetchNFTIDsByTaxon(issuer, *taxon, limit, cursorIn, yield);
} else {
// Amazon Keyspaces Workflow for non-taxon queries
auto const startTaxon =
cursorIn.has_value() ? ripple::nft::toUInt32(ripple::nft::getTaxon(*cursorIn)) : 0;
auto const startTokenID = cursorIn.value_or(ripple::uint256(0));
cursorIn.has_value() ? xrpl::nft::toUInt32(xrpl::nft::getTaxon(*cursorIn)) : 0;
auto const startTokenID = cursorIn.value_or(xrpl::uint256(0));
Statement const firstQuery = schema_->selectNFTIDsByIssuerTaxon.bind(issuer);
firstQuery.bindAt(1, startTaxon);
@@ -129,7 +129,7 @@ public:
auto const firstRes = executor_.read(yield, firstQuery);
if (firstRes.has_value()) {
for (auto const [nftID] : extract<ripple::uint256>(*firstRes))
for (auto const [nftID] : extract<xrpl::uint256>(*firstRes))
nftIDs.push_back(nftID);
}
@@ -141,7 +141,7 @@ public:
auto const secondRes = executor_.read(yield, secondQuery);
if (secondRes.has_value()) {
for (auto const [nftID] : extract<ripple::uint256>(*secondRes))
for (auto const [nftID] : extract<xrpl::uint256>(*secondRes))
nftIDs.push_back(nftID);
}
}
@@ -160,9 +160,9 @@ public:
* @param pageSize The maximum number of accounts per page.
* @param seq The accounts need to exist at this ledger sequence.
* @param yield The coroutine context.
* @return A vector of ripple::uint256 representing the account root hashes.
* @return A vector of xrpl::uint256 representing the account root hashes.
*/
[[nodiscard]] std::vector<ripple::uint256>
[[nodiscard]] std::vector<xrpl::uint256>
fetchAccountRoots(
[[maybe_unused]] std::uint32_t number,
[[maybe_unused]] std::uint32_t pageSize,
@@ -175,42 +175,42 @@ public:
}
private:
[[nodiscard]] std::vector<ripple::uint256>
[[nodiscard]] std::vector<xrpl::uint256>
fetchNFTIDsByTaxon(
ripple::AccountID const& issuer,
xrpl::AccountID const& issuer,
std::uint32_t const taxon,
std::uint32_t const limit,
std::optional<ripple::uint256> const& cursorIn,
std::optional<xrpl::uint256> const& cursorIn,
boost::asio::yield_context yield
) const
{
std::vector<ripple::uint256> nftIDs;
std::vector<xrpl::uint256> nftIDs;
Statement const statement = schema_->selectNFTIDsByIssuerTaxon.bind(issuer);
statement.bindAt(1, taxon);
statement.bindAt(2, cursorIn.value_or(ripple::uint256(0)));
statement.bindAt(2, cursorIn.value_or(xrpl::uint256(0)));
statement.bindAt(3, Limit{limit});
auto const res = executor_.read(yield, statement);
if (res.has_value() && res->hasRows()) {
for (auto const [nftID] : extract<ripple::uint256>(*res))
for (auto const [nftID] : extract<xrpl::uint256>(*res))
nftIDs.push_back(nftID);
}
return nftIDs;
}
[[nodiscard]] std::vector<ripple::uint256>
[[nodiscard]] std::vector<xrpl::uint256>
fetchNFTIDsWithoutTaxon(
ripple::AccountID const& issuer,
xrpl::AccountID const& issuer,
std::uint32_t const limit,
std::optional<ripple::uint256> const& cursorIn,
std::optional<xrpl::uint256> const& cursorIn,
boost::asio::yield_context yield
) const
{
std::vector<ripple::uint256> nftIDs;
std::vector<xrpl::uint256> nftIDs;
auto const startTaxon =
cursorIn.has_value() ? ripple::nft::toUInt32(ripple::nft::getTaxon(*cursorIn)) : 0;
auto const startTokenID = cursorIn.value_or(ripple::uint256(0));
cursorIn.has_value() ? xrpl::nft::toUInt32(xrpl::nft::getTaxon(*cursorIn)) : 0;
auto const startTokenID = cursorIn.value_or(xrpl::uint256(0));
Statement firstQuery = schema_->selectNFTIDsByIssuerTaxon.bind(issuer);
firstQuery.bindAt(1, startTaxon);
@@ -219,7 +219,7 @@ private:
auto const firstRes = executor_.read(yield, firstQuery);
if (firstRes.has_value()) {
for (auto const [nftID] : extract<ripple::uint256>(*firstRes))
for (auto const [nftID] : extract<xrpl::uint256>(*firstRes))
nftIDs.push_back(nftID);
}
@@ -231,7 +231,7 @@ private:
auto const secondRes = executor_.read(yield, secondQuery);
if (secondRes.has_value()) {
for (auto const [nftID] : extract<ripple::uint256>(*secondRes))
for (auto const [nftID] : extract<xrpl::uint256>(*secondRes))
nftIDs.push_back(nftID);
}
}
@@ -244,7 +244,7 @@ private:
*/
[[nodiscard]] NFTsAndCursor
populateNFTsAndCreateCursor(
std::vector<ripple::uint256> const& nftIDs,
std::vector<xrpl::uint256> const& nftIDs,
std::uint32_t const ledgerSequence,
std::uint32_t const limit,
boost::asio::yield_context yield
@@ -283,11 +283,11 @@ private:
// Combine the results into final NFT objects.
for (auto i = 0u; i < nftIDs.size(); ++i) {
if (auto const maybeRow = nftInfos[i].template get<uint32_t, ripple::AccountID, bool>();
if (auto const maybeRow = nftInfos[i].template get<uint32_t, xrpl::AccountID, bool>();
maybeRow.has_value()) {
auto [seq, owner, isBurned] = *maybeRow;
NFT nft(nftIDs[i], seq, owner, isBurned);
if (auto const maybeUri = nftUris[i].template get<ripple::Blob>();
if (auto const maybeUri = nftUris[i].template get<xrpl::Blob>();
maybeUri.has_value())
nft.uri = *maybeUri;
ret.nfts.push_back(nft);

View File

@@ -112,7 +112,7 @@ LedgerCache::update(std::vector<etl::model::Object> const& objs, uint32_t seq)
}
std::optional<LedgerObject>
LedgerCache::getSuccessor(ripple::uint256 const& key, uint32_t seq) const
LedgerCache::getSuccessor(xrpl::uint256 const& key, uint32_t seq) const
{
if (disabled_ or not full_)
return {};
@@ -129,7 +129,7 @@ LedgerCache::getSuccessor(ripple::uint256 const& key, uint32_t seq) const
}
std::optional<LedgerObject>
LedgerCache::getPredecessor(ripple::uint256 const& key, uint32_t seq) const
LedgerCache::getPredecessor(xrpl::uint256 const& key, uint32_t seq) const
{
if (disabled_ or not full_)
return {};
@@ -145,7 +145,7 @@ LedgerCache::getPredecessor(ripple::uint256 const& key, uint32_t seq) const
}
std::optional<Blob>
LedgerCache::get(ripple::uint256 const& key, uint32_t seq) const
LedgerCache::get(xrpl::uint256 const& key, uint32_t seq) const
{
if (disabled_)
return {};
@@ -164,7 +164,7 @@ LedgerCache::get(ripple::uint256 const& key, uint32_t seq) const
}
std::optional<Blob>
LedgerCache::getDeleted(ripple::uint256 const& key, uint32_t seq) const
LedgerCache::getDeleted(xrpl::uint256 const& key, uint32_t seq) const
{
if (disabled_)
return std::nullopt;

View File

@@ -35,7 +35,7 @@ public:
Blob blob;
};
using CacheMap = std::map<ripple::uint256, CacheEntry>;
using CacheMap = std::map<xrpl::uint256, CacheEntry>;
private:
// counters for fetchLedgerObject(s) hit rate
@@ -95,7 +95,7 @@ private:
// temporary set to prevent background thread from writing already deleted data. not used when
// cache is full
std::unordered_set<ripple::uint256, ripple::hardened_hash<>> deletes_;
std::unordered_set<xrpl::uint256, xrpl::HardenedHash<>> deletes_;
public:
void
@@ -105,16 +105,16 @@ public:
update(std::vector<etl::model::Object> const& objs, uint32_t seq) override;
std::optional<Blob>
get(ripple::uint256 const& key, uint32_t seq) const override;
get(xrpl::uint256 const& key, uint32_t seq) const override;
std::optional<Blob>
getDeleted(ripple::uint256 const& key, uint32_t seq) const override;
getDeleted(xrpl::uint256 const& key, uint32_t seq) const override;
std::optional<LedgerObject>
getSuccessor(ripple::uint256 const& key, uint32_t seq) const override;
getSuccessor(xrpl::uint256 const& key, uint32_t seq) const override;
std::optional<LedgerObject>
getPredecessor(ripple::uint256 const& key, uint32_t seq) const override;
getPredecessor(xrpl::uint256 const& key, uint32_t seq) const override;
void
setDisabled() override;

View File

@@ -56,7 +56,7 @@ public:
* @return If found in cache, will return the cached Blob; otherwise nullopt is returned
*/
[[nodiscard]] virtual std::optional<Blob>
get(ripple::uint256 const& key, uint32_t seq) const = 0;
get(xrpl::uint256 const& key, uint32_t seq) const = 0;
/**
* @brief Fetch a recently deleted object by its key and sequence number.
@@ -66,7 +66,7 @@ public:
* @return If found in deleted cache, will return the cached Blob; otherwise nullopt is returned
*/
[[nodiscard]] virtual std::optional<Blob>
getDeleted(ripple::uint256 const& key, uint32_t seq) const = 0;
getDeleted(xrpl::uint256 const& key, uint32_t seq) const = 0;
/**
* @brief Gets a cached successor.
@@ -78,7 +78,7 @@ public:
* @return If found in cache, will return the cached successor; otherwise nullopt is returned
*/
[[nodiscard]] virtual std::optional<LedgerObject>
getSuccessor(ripple::uint256 const& key, uint32_t seq) const = 0;
getSuccessor(xrpl::uint256 const& key, uint32_t seq) const = 0;
/**
* @brief Gets a cached predcessor.
@@ -90,7 +90,7 @@ public:
* @return If found in cache, will return the cached predcessor; otherwise nullopt is returned
*/
[[nodiscard]] virtual std::optional<LedgerObject>
getPredecessor(ripple::uint256 const& key, uint32_t seq) const = 0;
getPredecessor(xrpl::uint256 const& key, uint32_t seq) const = 0;
/**
* @brief Disables the cache.

View File

@@ -11,7 +11,7 @@
namespace data {
/**
* @brief A simple cache holding one `ripple::LedgerHeader` to reduce DB lookups.
* @brief A simple cache holding one `xrpl::LedgerHeader` to reduce DB lookups.
*
* Used internally by backend implementations. When a ledger header is
* fetched via `FetchLedgerBySeq` (often triggered by RPC commands),
@@ -27,7 +27,7 @@ public:
* @brief Struct to store ledger header cache entry and the sequence it belongs to
*/
struct CacheEntry {
ripple::LedgerHeader ledger;
xrpl::LedgerHeader ledger;
uint32_t seq{};
/**

View File

@@ -20,7 +20,7 @@ using Blob = std::vector<unsigned char>;
* @brief Represents an object in the ledger.
*/
struct LedgerObject {
ripple::uint256 key;
xrpl::uint256 key;
Blob blob;
bool
@@ -32,7 +32,7 @@ struct LedgerObject {
*/
struct LedgerPage {
std::vector<LedgerObject> objects;
std::optional<ripple::uint256> cursor;
std::optional<xrpl::uint256> cursor;
};
/**
@@ -40,7 +40,7 @@ struct LedgerPage {
*/
struct BookOffersPage {
std::vector<LedgerObject> offers;
std::optional<ripple::uint256> cursor;
std::optional<xrpl::uint256> cursor;
};
/**
@@ -159,9 +159,9 @@ struct TransactionsAndCursor {
* @brief Represents a NFToken.
*/
struct NFT {
ripple::uint256 tokenID;
xrpl::uint256 tokenID;
std::uint32_t ledgerSequence{};
ripple::AccountID owner;
xrpl::AccountID owner;
Blob uri;
bool isBurned{};
@@ -176,9 +176,9 @@ struct NFT {
* @param uri The URI
* @param isBurned Whether the token is burned
*/
NFT(ripple::uint256 const& tokenID,
NFT(xrpl::uint256 const& tokenID,
std::uint32_t ledgerSequence,
ripple::AccountID const& owner,
xrpl::AccountID const& owner,
Blob uri,
bool isBurned)
: tokenID{tokenID}
@@ -197,9 +197,9 @@ struct NFT {
* @param owner The owner
* @param isBurned Whether the token is burned
*/
NFT(ripple::uint256 const& tokenID,
NFT(xrpl::uint256 const& tokenID,
std::uint32_t ledgerSequence,
ripple::AccountID const& owner,
xrpl::AccountID const& owner,
bool isBurned)
: NFT(tokenID, ledgerSequence, owner, {}, isBurned)
{
@@ -226,7 +226,7 @@ struct NFT {
*/
struct NFTsAndCursor {
std::vector<NFT> nfts;
std::optional<ripple::uint256> cursor;
std::optional<xrpl::uint256> cursor;
};
/**
@@ -234,7 +234,7 @@ struct NFTsAndCursor {
*/
struct MPTHoldersAndCursor {
std::vector<Blob> mptokens;
std::optional<ripple::AccountID> cursor;
std::optional<xrpl::AccountID> cursor;
};
/**
@@ -253,7 +253,7 @@ struct LedgerRange {
*/
struct Amendment {
std::string name;
ripple::uint256 feature;
xrpl::uint256 feature;
bool isSupportedByXRPL = false;
bool isSupportedByClio = false;
bool isRetired = false;
@@ -264,7 +264,7 @@ struct Amendment {
* @param name The name of the amendment
* @return The amendment Id as uint256
*/
static ripple::uint256
static xrpl::uint256
getAmendmentId(std::string_view const name);
/**
@@ -301,7 +301,7 @@ struct AmendmentKey {
operator std::string_view() const;
/** @brief Conversion to uint256 */
operator ripple::uint256() const;
operator xrpl::uint256() const;
/**
* @brief Comparison operators
@@ -312,14 +312,12 @@ struct AmendmentKey {
operator<=>(AmendmentKey const& other) const = default;
};
constexpr ripple::uint256 kFirstKey{
constexpr xrpl::uint256 kFirstKey{
"0000000000000000000000000000000000000000000000000000000000000000"
};
constexpr ripple::uint256 kLastKey{
constexpr xrpl::uint256 kLastKey{
"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
};
constexpr ripple::uint256 kHi192{
"0000000000000000000000000000000000000000000000001111111111111111"
};
constexpr xrpl::uint256 kHi192{"0000000000000000000000000000000000000000000000001111111111111111"};
} // namespace data

View File

@@ -141,7 +141,7 @@ public:
TransactionsAndCursor
fetchAccountTransactions(
ripple::AccountID const& account,
xrpl::AccountID const& account,
std::uint32_t const limit,
bool forward,
std::optional<TransactionsCursor> const& txnCursor,
@@ -162,7 +162,7 @@ public:
auto cursor = txnCursor;
if (cursor) {
statement.bindAt(kTransactionCursorBindIndex, cursor->asTuple());
LOG(log_.debug()) << "account = " << ripple::strHex(account)
LOG(log_.debug()) << "account = " << xrpl::strHex(account)
<< " tuple = " << cursor->ledgerSequence << cursor->transactionIndex;
} else {
auto const seq = forward ? rng->minSequence : rng->maxSequence;
@@ -171,7 +171,7 @@ public:
statement.bindAt(
kTransactionCursorBindIndex, std::make_tuple(placeHolder, placeHolder)
);
LOG(log_.debug()) << "account = " << ripple::strHex(account) << " idx = " << seq
LOG(log_.debug()) << "account = " << xrpl::strHex(account) << " idx = " << seq
<< " tuple = " << placeHolder;
}
@@ -186,12 +186,11 @@ public:
return {};
}
std::vector<ripple::uint256> hashes = {};
std::vector<xrpl::uint256> hashes = {};
auto numRows = results.numRows();
LOG(log_.info()) << "num_rows = " << numRows;
for (auto [hash, data] :
extract<ripple::uint256, std::tuple<uint32_t, uint32_t>>(results)) {
for (auto [hash, data] : extract<xrpl::uint256, std::tuple<uint32_t, uint32_t>>(results)) {
hashes.push_back(hash);
if (--numRows == 0) {
LOG(log_.debug()) << "Setting cursor";
@@ -217,7 +216,7 @@ public:
}
void
writeLedger(ripple::LedgerHeader const& ledgerHeader, std::string&& blob) override
writeLedger(xrpl::LedgerHeader const& ledgerHeader, std::string&& blob) override
{
executor_.write(schema_->insertLedgerHeader, ledgerHeader.seq, std::move(blob));
@@ -246,7 +245,7 @@ public:
return std::nullopt;
}
std::optional<ripple::LedgerHeader>
std::optional<xrpl::LedgerHeader>
fetchLedgerBySequence(
std::uint32_t const sequence,
boost::asio::yield_context yield
@@ -260,7 +259,7 @@ public:
if (auto const& result = res.value(); result) {
if (auto const maybeValue = result.template get<std::vector<unsigned char>>();
maybeValue) {
auto const header = util::deserializeHeader(ripple::makeSlice(*maybeValue));
auto const header = util::deserializeHeader(xrpl::makeSlice(*maybeValue));
ledgerCache_.put(FetchLedgerCache::CacheEntry{header, sequence});
return header;
}
@@ -277,8 +276,8 @@ public:
return std::nullopt;
}
std::optional<ripple::LedgerHeader>
fetchLedgerByHash(ripple::uint256 const& hash, boost::asio::yield_context yield) const override
std::optional<xrpl::LedgerHeader>
fetchLedgerByHash(xrpl::uint256 const& hash, boost::asio::yield_context yield) const override
{
if (auto const res = executor_.read(yield, schema_->selectLedgerByHash, hash); res) {
if (auto const& result = res.value(); result) {
@@ -345,7 +344,7 @@ public:
return fetchTransactions(hashes, yield);
}
std::vector<ripple::uint256>
std::vector<xrpl::uint256>
fetchAllTransactionHashesInLedger(
std::uint32_t const ledgerSequence,
boost::asio::yield_context yield
@@ -367,8 +366,8 @@ public:
return {};
}
std::vector<ripple::uint256> hashes;
for (auto [hash] : extract<ripple::uint256>(result))
std::vector<xrpl::uint256> hashes;
for (auto [hash] : extract<xrpl::uint256>(result))
hashes.push_back(std::move(hash));
auto end = std::chrono::system_clock::now();
@@ -384,7 +383,7 @@ public:
std::optional<NFT>
fetchNFT(
ripple::uint256 const& tokenID,
xrpl::uint256 const& tokenID,
std::uint32_t const ledgerSequence,
boost::asio::yield_context yield
) const override
@@ -393,8 +392,7 @@ public:
if (not res)
return std::nullopt;
if (auto const maybeRow = res->template get<uint32_t, ripple::AccountID, bool>();
maybeRow) {
if (auto const maybeRow = res->template get<uint32_t, xrpl::AccountID, bool>(); maybeRow) {
auto [seq, owner, isBurned] = *maybeRow;
auto result = std::make_optional<NFT>(tokenID, seq, owner, isBurned);
@@ -411,7 +409,7 @@ public:
// one.
auto uriRes = executor_.read(yield, schema_->selectNFTURI, tokenID, ledgerSequence);
if (uriRes) {
if (auto const maybeUri = uriRes->template get<ripple::Blob>(); maybeUri)
if (auto const maybeUri = uriRes->template get<xrpl::Blob>(); maybeUri)
result->uri = *maybeUri;
}
@@ -424,7 +422,7 @@ public:
TransactionsAndCursor
fetchNFTTransactions(
ripple::uint256 const& tokenID,
xrpl::uint256 const& tokenID,
std::uint32_t const limit,
bool const forward,
std::optional<TransactionsCursor> const& cursorIn,
@@ -445,7 +443,7 @@ public:
auto cursor = cursorIn;
if (cursor) {
statement.bindAt(kTransactionCursorBindIndex, cursor->asTuple());
LOG(log_.debug()) << "token_id = " << ripple::strHex(tokenID)
LOG(log_.debug()) << "token_id = " << xrpl::strHex(tokenID)
<< " tuple = " << cursor->ledgerSequence << cursor->transactionIndex;
} else {
auto const seq = forward ? rng->minSequence : rng->maxSequence;
@@ -454,7 +452,7 @@ public:
statement.bindAt(
kTransactionCursorBindIndex, std::make_tuple(placeHolder, placeHolder)
);
LOG(log_.debug()) << "token_id = " << ripple::strHex(tokenID) << " idx = " << seq
LOG(log_.debug()) << "token_id = " << xrpl::strHex(tokenID) << " idx = " << seq
<< " tuple = " << placeHolder;
}
@@ -467,12 +465,11 @@ public:
return {};
}
std::vector<ripple::uint256> hashes = {};
std::vector<xrpl::uint256> hashes = {};
auto numRows = results.numRows();
LOG(log_.info()) << "num_rows = " << numRows;
for (auto [hash, data] :
extract<ripple::uint256, std::tuple<uint32_t, uint32_t>>(results)) {
for (auto [hash, data] : extract<xrpl::uint256, std::tuple<uint32_t, uint32_t>>(results)) {
hashes.push_back(hash);
if (--numRows == 0) {
LOG(log_.debug()) << "Setting cursor";
@@ -498,7 +495,7 @@ public:
TransactionsAndCursor
fetchMPTokenIssuanceTransactions(
ripple::uint192 const& mptIssuanceID,
xrpl::uint192 const& mptIssuanceID,
std::uint32_t const limit,
bool const forward,
std::optional<TransactionsCursor> const& cursorIn,
@@ -524,8 +521,8 @@ public:
TransactionsAndCursor
fetchAccountMPTokenIssuanceTransactions(
ripple::uint192 const& mptIssuanceID,
ripple::AccountID const& account,
xrpl::uint192 const& mptIssuanceID,
xrpl::AccountID const& account,
std::uint32_t const limit,
bool const forward,
std::optional<TransactionsCursor> const& cursorIn,
@@ -551,9 +548,9 @@ public:
MPTHoldersAndCursor
fetchMPTHolders(
ripple::uint192 const& mptID,
xrpl::uint192 const& mptID,
std::uint32_t const limit,
std::optional<ripple::AccountID> const& cursorIn,
std::optional<xrpl::AccountID> const& cursorIn,
std::uint32_t const ledgerSequence,
boost::asio::yield_context yield
) const override
@@ -562,7 +559,7 @@ public:
yield,
schema_->selectMPTHolders,
mptID,
cursorIn.value_or(ripple::AccountID(0)),
cursorIn.value_or(xrpl::AccountID(0)),
Limit{limit}
);
@@ -572,10 +569,10 @@ public:
return {};
}
std::vector<ripple::uint256> mptKeys;
std::optional<ripple::AccountID> cursor;
for (auto const [holder] : extract<ripple::AccountID>(holderResults)) {
mptKeys.push_back(ripple::keylet::mptoken(mptID, holder).key);
std::vector<xrpl::uint256> mptKeys;
std::optional<xrpl::AccountID> cursor;
for (auto const [holder] : extract<xrpl::AccountID>(holderResults)) {
mptKeys.push_back(xrpl::keylet::mptoken(mptID, holder).key);
cursor = holder;
}
@@ -596,13 +593,13 @@ public:
std::optional<Blob>
doFetchLedgerObject(
ripple::uint256 const& key,
xrpl::uint256 const& key,
std::uint32_t const sequence,
boost::asio::yield_context yield
) const override
{
LOG(log_.debug()) << "Fetching ledger object for seq " << sequence
<< ", key = " << ripple::to_string(key);
<< ", key = " << xrpl::to_string(key);
if (auto const res = executor_.read(yield, schema_->selectObject, key, sequence); res) {
if (auto const result = res->template get<Blob>(); result) {
if (result->size())
@@ -619,13 +616,13 @@ public:
std::optional<std::uint32_t>
doFetchLedgerObjectSeq(
ripple::uint256 const& key,
xrpl::uint256 const& key,
std::uint32_t const sequence,
boost::asio::yield_context yield
) const override
{
LOG(log_.debug()) << "Fetching ledger object for seq " << sequence
<< ", key = " << ripple::to_string(key);
<< ", key = " << xrpl::to_string(key);
if (auto const res = executor_.read(yield, schema_->selectObject, key, sequence); res) {
if (auto const result = res->template get<Blob, std::uint32_t>(); result) {
auto [_, seq] = *result;
@@ -640,7 +637,7 @@ public:
}
std::optional<TransactionAndMetadata>
fetchTransaction(ripple::uint256 const& hash, boost::asio::yield_context yield) const override
fetchTransaction(xrpl::uint256 const& hash, boost::asio::yield_context yield) const override
{
if (auto const res = executor_.read(yield, schema_->selectTransaction, hash); res) {
if (auto const maybeValue = res->template get<Blob, Blob, uint32_t, uint32_t>();
@@ -657,16 +654,16 @@ public:
return std::nullopt;
}
std::optional<ripple::uint256>
std::optional<xrpl::uint256>
doFetchSuccessorKey(
ripple::uint256 key,
xrpl::uint256 key,
std::uint32_t const ledgerSequence,
boost::asio::yield_context yield
) const override
{
if (auto const res = executor_.read(yield, schema_->selectSuccessor, key, ledgerSequence);
res) {
if (auto const result = res->template get<ripple::uint256>(); result) {
if (auto const result = res->template get<xrpl::uint256>(); result) {
if (*result == kLastKey)
return std::nullopt;
return result;
@@ -682,7 +679,7 @@ public:
std::vector<TransactionAndMetadata>
fetchTransactions(
std::vector<ripple::uint256> const& hashes,
std::vector<xrpl::uint256> const& hashes,
boost::asio::yield_context yield
) const override
{
@@ -728,7 +725,7 @@ public:
std::vector<Blob>
doFetchLedgerObjects(
std::vector<ripple::uint256> const& keys,
std::vector<xrpl::uint256> const& keys,
std::uint32_t const sequence,
boost::asio::yield_context yield
) const override
@@ -777,7 +774,7 @@ public:
) const override
{
auto const [keys, timeDiff] =
util::timed([this, &ledgerSequence, yield]() -> std::vector<ripple::uint256> {
util::timed([this, &ledgerSequence, yield]() -> std::vector<xrpl::uint256> {
auto const res = executor_.read(yield, schema_->selectDiff, ledgerSequence);
if (not res) {
LOG(log_.error()) << "Could not fetch ledger diff: " << res.error()
@@ -792,8 +789,8 @@ public:
return {};
}
std::vector<ripple::uint256> resultKeys;
for (auto [key] : extract<ripple::uint256>(results))
std::vector<xrpl::uint256> resultKeys;
for (auto [key] : extract<xrpl::uint256>(results))
resultKeys.push_back(key);
return resultKeys;
@@ -1031,8 +1028,8 @@ public:
// to record the URI and link to the issuer_nf_tokens table.
if (record.uri) {
statements.push_back(schema_->insertIssuerNFT.bind(
ripple::nft::getIssuer(record.tokenID),
static_cast<uint32_t>(ripple::nft::getTaxon(record.tokenID)),
xrpl::nft::getIssuer(record.tokenID),
static_cast<uint32_t>(xrpl::nft::getTaxon(record.tokenID)),
record.tokenID
));
statements.push_back(schema_->insertNFTURI.bind(
@@ -1181,11 +1178,11 @@ protected:
return {};
}
std::vector<ripple::uint256> hashes = {};
std::vector<xrpl::uint256> hashes = {};
auto numRows = results.numRows();
for (auto const& [hash, data] :
extract<ripple::uint256, std::tuple<uint32_t, uint32_t>>(results)) {
extract<xrpl::uint256, std::tuple<uint32_t, uint32_t>>(results)) {
hashes.push_back(hash);
if (--numRows == 0) {

View File

@@ -58,14 +58,14 @@ public:
}
void
append(ripple::uint256 const& value) const
append(xrpl::uint256 const& value) const
{
auto const rc = cass_collection_append_bytes(
*this,
static_cast<cass_byte_t const*>(static_cast<unsigned char const*>(value.data())),
ripple::uint256::size()
xrpl::uint256::size()
);
throwErrorIfNeeded(rc, "Bind ripple::uint256");
throwErrorIfNeeded(rc, "Bind xrpl::uint256");
}
};
} // namespace data::cassandra::impl

View File

@@ -43,18 +43,18 @@ extractColumn(CassRow const* row, std::size_t idx)
using UintTupleType = std::tuple<uint32_t, uint32_t>;
using UCharVectorType = std::vector<unsigned char>;
if constexpr (std::is_same_v<DecayedType, ripple::uint256>) {
if constexpr (std::is_same_v<DecayedType, xrpl::uint256>) {
cass_byte_t const* buf = nullptr;
std::size_t bufSize = 0;
auto const rc = cass_value_get_bytes(cass_row_get_column(row, idx), &buf, &bufSize);
throwErrorIfNeeded(rc, "Extract ripple::uint256");
output = ripple::uint256::fromVoid(buf);
} else if constexpr (std::is_same_v<DecayedType, ripple::AccountID>) {
throwErrorIfNeeded(rc, "Extract xrpl::uint256");
output = xrpl::uint256::fromVoid(buf);
} else if constexpr (std::is_same_v<DecayedType, xrpl::AccountID>) {
cass_byte_t const* buf = nullptr;
std::size_t bufSize = 0;
auto const rc = cass_value_get_bytes(cass_row_get_column(row, idx), &buf, &bufSize);
throwErrorIfNeeded(rc, "Extract ripple::AccountID");
output = ripple::AccountID::fromVoid(buf);
throwErrorIfNeeded(rc, "Extract xrpl::AccountID");
output = xrpl::AccountID::fromVoid(buf);
} else if constexpr (std::is_same_v<DecayedType, UCharVectorType>) {
cass_byte_t const* buf = nullptr;
std::size_t bufSize = 0;

View File

@@ -93,18 +93,17 @@ public:
using DecayedType = std::decay_t<Type>;
using UCharVectorType = std::vector<unsigned char>;
using UintTupleType = std::tuple<uint32_t, uint32_t>;
using UintByteTupleType = std::tuple<uint32_t, ripple::uint256>;
using ByteVectorType = std::vector<ripple::uint256>;
using UintByteTupleType = std::tuple<uint32_t, xrpl::uint256>;
using ByteVectorType = std::vector<xrpl::uint256>;
if constexpr (
std::is_same_v<DecayedType, ripple::uint256> ||
std::is_same_v<DecayedType, ripple::uint192>
std::is_same_v<DecayedType, xrpl::uint256> || std::is_same_v<DecayedType, xrpl::uint192>
) {
auto const rc = bindBytes(value.data(), value.size());
throwErrorIfNeeded(rc, "Bind ripple::base_uint");
} else if constexpr (std::is_same_v<DecayedType, ripple::AccountID>) {
throwErrorIfNeeded(rc, "Bind xrpl::base_uint");
} else if constexpr (std::is_same_v<DecayedType, xrpl::AccountID>) {
auto const rc = bindBytes(value.data(), value.size());
throwErrorIfNeeded(rc, "Bind ripple::AccountID");
throwErrorIfNeeded(rc, "Bind xrpl::AccountID");
} else if constexpr (std::is_same_v<DecayedType, UCharVectorType>) {
auto const rc = bindBytes(value.data(), value.size());
throwErrorIfNeeded(rc, "Bind vector<unsigned char>");
@@ -122,7 +121,7 @@ public:
std::is_same_v<DecayedType, UintByteTupleType>
) {
auto const rc = cass_statement_bind_tuple(*this, idx, Tuple{std::forward<Type>(value)});
throwErrorIfNeeded(rc, "Bind tuple<uint32, uint32> or <uint32_t, ripple::uint256>");
throwErrorIfNeeded(rc, "Bind tuple<uint32, uint32> or <uint32_t, xrpl::uint256>");
} else if constexpr (std::is_same_v<DecayedType, ByteVectorType>) {
auto const rc =
cass_statement_bind_collection(*this, idx, Collection{std::forward<Type>(value)});

View File

@@ -62,14 +62,14 @@ public:
else if constexpr (std::is_convertible_v<DecayedType, int64_t>) {
auto const rc = cass_tuple_set_int64(*this, idx, std::forward<Type>(value));
throwErrorIfNeeded(rc, "Bind int64");
} else if constexpr (std::is_same_v<DecayedType, ripple::uint256>) {
} else if constexpr (std::is_same_v<DecayedType, xrpl::uint256>) {
auto const rc = cass_tuple_set_bytes(
*this,
idx,
static_cast<cass_byte_t const*>(static_cast<unsigned char const*>(value.data())),
value.size()
);
throwErrorIfNeeded(rc, "Bind ripple::uint256");
throwErrorIfNeeded(rc, "Bind xrpl::uint256");
} else {
// type not supported for binding
static_assert(util::Unsupported<DecayedType>);

View File

@@ -29,7 +29,7 @@ InputFile::readRaw(char* data, size_t size)
return not file_.fail();
}
ripple::uint256
xrpl::uint256
InputFile::hash() const
{
auto sum = shasum_;

View File

@@ -32,7 +32,7 @@ public:
bool
readRaw(char* data, size_t size);
ripple::uint256
xrpl::uint256
hash() const;
};
} // namespace data::impl

View File

@@ -17,17 +17,17 @@
namespace data::impl {
using Hash = ripple::uint256;
using Hash = xrpl::uint256;
using Separator = std::array<char, 16>;
static constexpr Separator kSeparator = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
namespace {
std::expected<std::pair<ripple::uint256, LedgerCache::CacheEntry>, std::string>
std::expected<std::pair<xrpl::uint256, LedgerCache::CacheEntry>, std::string>
readCacheEntry(InputFile& file, size_t i)
{
ripple::uint256 key;
if (not file.readRaw(reinterpret_cast<char*>(key.data()), ripple::base_uint<256>::bytes)) {
xrpl::uint256 key;
if (not file.readRaw(reinterpret_cast<char*>(key.data()), xrpl::BaseUInt<256>::kBytes)) {
return std::unexpected(fmt::format("Failed to read key at index {}", i));
}
@@ -81,7 +81,7 @@ LedgerCacheFile::write(DataView dataView)
file.write(kSeparator);
for (auto const& [k, v] : dataView.map) {
file.write(k.data(), decltype(k)::bytes);
file.write(k.data(), decltype(k)::kBytes);
file.write(v.seq);
file.write(v.blob.size());
file.writeRaw(reinterpret_cast<char const*>(v.blob.data()), v.blob.size());
@@ -89,14 +89,14 @@ LedgerCacheFile::write(DataView dataView)
file.write(kSeparator);
for (auto const& [k, v] : dataView.deleted) {
file.write(k.data(), decltype(k)::bytes);
file.write(k.data(), decltype(k)::kBytes);
file.write(v.seq);
file.write(v.blob.size());
file.writeRaw(reinterpret_cast<char const*>(v.blob.data()), v.blob.size());
}
file.write(kSeparator);
auto const hash = file.hash();
file.write(hash.data(), decltype(hash)::bytes);
file.write(hash.data(), decltype(hash)::kBytes);
// flush internal buffer explicitly before renaming
if (auto const expectedSuccess = file.close(); not expectedSuccess.has_value()) {
@@ -185,9 +185,9 @@ LedgerCacheFile::read(uint32_t minLatestSequence)
}
auto const dataHash = file.hash();
ripple::uint256 hashFromFile{};
xrpl::uint256 hashFromFile{};
if (not file.readRaw(
reinterpret_cast<char*>(hashFromFile.data()), decltype(hashFromFile)::bytes
reinterpret_cast<char*>(hashFromFile.data()), decltype(hashFromFile)::kBytes
)) {
return std::unexpected{"Error reading hash"};
}

View File

@@ -34,7 +34,7 @@ OutputFile::writeToFile(char const* data, size_t size)
shasum_.update(data, size);
}
ripple::uint256
xrpl::uint256
OutputFile::hash() const
{
auto sum = shasum_;

View File

@@ -39,7 +39,7 @@ public:
void
writeRaw(char const* data, size_t size);
ripple::uint256
xrpl::uint256
hash() const;
std::expected<void, std::string>