Merge branch 'tapanito/lending-fix-amendment' into ximinez/assetsmaximum-wip

This commit is contained in:
Ed Hennis
2026-02-18 21:15:34 -04:00
committed by GitHub
443 changed files with 4440 additions and 3522 deletions

View File

@@ -773,7 +773,8 @@ Number::operator/=(Number const& y)
return *this;
}
Number::operator rep() const
Number::
operator rep() const
{
rep drops = mantissa();
int offset = exponent();

View File

@@ -1,6 +1,6 @@
#include <xrpld/conditions/Condition.h>
#include <xrpld/conditions/detail/PreimageSha256.h>
#include <xrpld/conditions/detail/utils.h>
#include <xrpl/conditions/Condition.h>
#include <xrpl/conditions/detail/PreimageSha256.h>
#include <xrpl/conditions/detail/utils.h>
namespace xrpl {
namespace cryptoconditions {

View File

@@ -1,9 +1,8 @@
#include <xrpld/conditions/Condition.h>
#include <xrpld/conditions/Fulfillment.h>
#include <xrpld/conditions/detail/PreimageSha256.h>
#include <xrpld/conditions/detail/utils.h>
#include <xrpl/basics/safe_cast.h>
#include <xrpl/conditions/Condition.h>
#include <xrpl/conditions/Fulfillment.h>
#include <xrpl/conditions/detail/PreimageSha256.h>
#include <xrpl/conditions/detail/utils.h>
namespace xrpl {
namespace cryptoconditions {

View File

@@ -1,6 +1,5 @@
#include <xrpld/conditions/detail/error.h>
#include <xrpl/basics/safe_cast.h>
#include <xrpl/conditions/detail/error.h>
#include <string>

View File

@@ -1,5 +1,4 @@
#include <xrpld/app/misc/HashRouter.h>
#include <xrpld/core/Config.h>
#include <xrpl/core/HashRouter.h>
namespace xrpl {
@@ -108,38 +107,4 @@ HashRouter::shouldRelay(uint256 const& key) -> std::optional<std::set<PeerShortI
return s.releasePeerSet();
}
HashRouter::Setup
setup_HashRouter(Config const& config)
{
using namespace std::chrono;
HashRouter::Setup setup;
auto const& section = config.section("hashrouter");
std::int32_t tmp;
if (set(tmp, "hold_time", section))
{
if (tmp < 12)
Throw<std::runtime_error>(
"HashRouter hold time must be at least 12 seconds (the "
"approximate validation time for three ledgers).");
setup.holdTime = seconds(tmp);
}
if (set(tmp, "relay_time", section))
{
if (tmp < 8)
Throw<std::runtime_error>(
"HashRouter relay time must be at least 8 seconds (the "
"approximate validation time for two ledgers).");
setup.relayTime = seconds(tmp);
}
if (setup.relayTime > setup.holdTime)
{
Throw<std::runtime_error>("HashRouter relay time must be less than or equal to hold time");
}
return setup;
}
} // namespace xrpl

View File

@@ -777,7 +777,8 @@ Value::size() const
return 0; // unreachable;
}
Value::operator bool() const
Value::
operator bool() const
{
if (isNull())
return false;

View File

@@ -1,7 +1,7 @@
#include <xrpld/app/ledger/AcceptedLedgerTx.h>
#include <xrpl/basics/Log.h>
#include <xrpl/basics/StringUtilities.h>
#include <xrpl/ledger/AcceptedLedgerTx.h>
#include <xrpl/ledger/View.h>
#include <xrpl/protocol/UintTypes.h>
#include <xrpl/protocol/jss.h>

View File

@@ -1,4 +1,4 @@
#include <xrpld/app/ledger/OrderBookDB.h>
#include <xrpl/ledger/BookListeners.h>
namespace xrpl {

View File

@@ -85,8 +85,7 @@ registerSSLCerts(boost::asio::ssl::context& ctx, boost::system::error_code& ec,
// There is a very unpleasant interaction between <wincrypt> and
// openssl x509 types (namely the former has macros that stomp
// on the latter), these undefs allow this TU to be safely used in
// unity builds without messing up subsequent TUs. Although we
// no longer use unity builds, leaving the undefs here does no harm.
// unity builds without messing up subsequent TUs.
#if BOOST_OS_WINDOWS
#undef X509_NAME
#undef X509_EXTENSIONS

View File

@@ -10,11 +10,6 @@ DatabaseNodeImp::store(NodeObjectType type, Blob&& data, uint256 const& hash, st
auto obj = NodeObject::createObject(type, std::move(data), hash);
backend_->store(obj);
if (cache_)
{
// After the store, replace a negative cache entry if there is one
cache_->canonicalize(hash, obj, [](std::shared_ptr<NodeObject> const& n) { return n->getType() == hotDUMMY; });
}
}
void
@@ -23,77 +18,36 @@ DatabaseNodeImp::asyncFetch(
std::uint32_t ledgerSeq,
std::function<void(std::shared_ptr<NodeObject> const&)>&& callback)
{
if (cache_)
{
std::shared_ptr<NodeObject> obj = cache_->fetch(hash);
if (obj)
{
callback(obj->getType() == hotDUMMY ? nullptr : obj);
return;
}
}
Database::asyncFetch(hash, ledgerSeq, std::move(callback));
}
void
DatabaseNodeImp::sweep()
{
if (cache_)
cache_->sweep();
}
std::shared_ptr<NodeObject>
DatabaseNodeImp::fetchNodeObject(uint256 const& hash, std::uint32_t, FetchReport& fetchReport, bool duplicate)
{
std::shared_ptr<NodeObject> nodeObject = cache_ ? cache_->fetch(hash) : nullptr;
std::shared_ptr<NodeObject> nodeObject = nullptr;
Status status;
if (!nodeObject)
try
{
JLOG(j_.trace()) << "fetchNodeObject " << hash << ": record not " << (cache_ ? "cached" : "found");
Status status;
try
{
status = backend_->fetch(hash.data(), &nodeObject);
}
catch (std::exception const& e)
{
JLOG(j_.fatal()) << "fetchNodeObject " << hash << ": Exception fetching from backend: " << e.what();
Rethrow();
}
switch (status)
{
case ok:
if (cache_)
{
if (nodeObject)
cache_->canonicalize_replace_client(hash, nodeObject);
else
{
auto notFound = NodeObject::createObject(hotDUMMY, {}, hash);
cache_->canonicalize_replace_client(hash, notFound);
if (notFound->getType() != hotDUMMY)
nodeObject = notFound;
}
}
break;
case notFound:
break;
case dataCorrupt:
JLOG(j_.fatal()) << "fetchNodeObject " << hash << ": nodestore data is corrupted";
break;
default:
JLOG(j_.warn()) << "fetchNodeObject " << hash << ": backend returns unknown result " << status;
break;
}
status = backend_->fetch(hash.data(), &nodeObject);
}
else
catch (std::exception const& e)
{
JLOG(j_.trace()) << "fetchNodeObject " << hash << ": record found in cache";
if (nodeObject->getType() == hotDUMMY)
nodeObject.reset();
JLOG(j_.fatal()) << "fetchNodeObject " << hash << ": Exception fetching from backend: " << e.what();
Rethrow();
}
switch (status)
{
case ok:
case notFound:
break;
case dataCorrupt:
JLOG(j_.fatal()) << "fetchNodeObject " << hash << ": nodestore data is corrupted";
break;
default:
JLOG(j_.warn()) << "fetchNodeObject " << hash << ": backend returns unknown result " << status;
break;
}
if (nodeObject)
@@ -105,66 +59,36 @@ DatabaseNodeImp::fetchNodeObject(uint256 const& hash, std::uint32_t, FetchReport
std::vector<std::shared_ptr<NodeObject>>
DatabaseNodeImp::fetchBatch(std::vector<uint256> const& hashes)
{
std::vector<std::shared_ptr<NodeObject>> results{hashes.size()};
using namespace std::chrono;
auto const before = steady_clock::now();
std::unordered_map<uint256 const*, size_t> indexMap;
std::vector<uint256 const*> cacheMisses;
uint64_t hits = 0;
uint64_t fetches = 0;
std::vector<uint256 const*> batch{};
batch.reserve(hashes.size());
for (size_t i = 0; i < hashes.size(); ++i)
{
auto const& hash = hashes[i];
// See if the object already exists in the cache
auto nObj = cache_ ? cache_->fetch(hash) : nullptr;
++fetches;
if (!nObj)
{
// Try the database
indexMap[&hash] = i;
cacheMisses.push_back(&hash);
}
else
{
results[i] = nObj->getType() == hotDUMMY ? nullptr : nObj;
// It was in the cache.
++hits;
}
batch.push_back(&hash);
}
JLOG(j_.debug()) << "fetchBatch - cache hits = " << (hashes.size() - cacheMisses.size())
<< " - cache misses = " << cacheMisses.size();
auto dbResults = backend_->fetchBatch(cacheMisses).first;
for (size_t i = 0; i < dbResults.size(); ++i)
// Get the node objects that match the hashes from the backend. To protect
// against the backends returning fewer or more results than expected, the
// container is resized to the number of hashes.
auto results = backend_->fetchBatch(batch).first;
XRPL_ASSERT(
results.size() == hashes.size() || results.empty(),
"number of output objects either matches number of input hashes or is empty");
results.resize(hashes.size());
for (size_t i = 0; i < results.size(); ++i)
{
auto nObj = std::move(dbResults[i]);
size_t index = indexMap[cacheMisses[i]];
auto const& hash = hashes[index];
if (nObj)
{
// Ensure all threads get the same object
if (cache_)
cache_->canonicalize_replace_client(hash, nObj);
}
else
if (!results[i])
{
JLOG(j_.error()) << "fetchBatch - "
<< "record not found in db or cache. hash = " << strHex(hash);
if (cache_)
{
auto notFound = NodeObject::createObject(hotDUMMY, {}, hash);
cache_->canonicalize_replace_client(hash, notFound);
if (notFound->getType() != hotDUMMY)
nObj = std::move(notFound);
}
<< "record not found in db. hash = " << strHex(hashes[i]);
}
results[index] = std::move(nObj);
}
auto fetchDurationUs = std::chrono::duration_cast<std::chrono::microseconds>(steady_clock::now() - before).count();
updateFetchMetrics(fetches, hits, fetchDurationUs);
updateFetchMetrics(hashes.size(), 0, fetchDurationUs);
return results;
}

View File

@@ -93,12 +93,6 @@ DatabaseRotatingImp::store(NodeObjectType type, Blob&& data, uint256 const& hash
storeStats(1, nObj->getData().size());
}
void
DatabaseRotatingImp::sweep()
{
// nothing to do
}
std::shared_ptr<NodeObject>
DatabaseRotatingImp::fetchNodeObject(uint256 const& hash, std::uint32_t, FetchReport& fetchReport, bool duplicate)
{

View File

@@ -89,7 +89,7 @@ class FeatureCollections
};
// Intermediate types to help with readability
template <class tag, typename Type, Type Feature::*PtrToMember>
template <class tag, typename Type, Type Feature::* PtrToMember>
using feature_hashed_unique = boost::multi_index::
hashed_unique<boost::multi_index::tag<tag>, boost::multi_index::member<Feature, Type, PtrToMember>>;

View File

@@ -0,0 +1,15 @@
#include <xrpl/protocol/Protocol.h>
namespace xrpl {
bool
isVotingLedger(LedgerIndex seq)
{
return seq % FLAG_LEDGER_INTERVAL == 0;
}
bool
isFlagLedger(LedgerIndex seq)
{
return seq % FLAG_LEDGER_INTERVAL == 0;
}
} // namespace xrpl

View File

@@ -21,7 +21,8 @@ openssl_ripemd160_hasher::operator()(void const* data, std::size_t size) noexcep
RIPEMD160_Update(ctx, data, size);
}
openssl_ripemd160_hasher::operator result_type() noexcept
openssl_ripemd160_hasher::
operator result_type() noexcept
{
auto const ctx = reinterpret_cast<RIPEMD160_CTX*>(ctx_);
result_type digest;
@@ -45,7 +46,8 @@ openssl_sha512_hasher::operator()(void const* data, std::size_t size) noexcept
SHA512_Update(ctx, data, size);
}
openssl_sha512_hasher::operator result_type() noexcept
openssl_sha512_hasher::
operator result_type() noexcept
{
auto const ctx = reinterpret_cast<SHA512_CTX*>(ctx_);
result_type digest;
@@ -69,7 +71,8 @@ openssl_sha256_hasher::operator()(void const* data, std::size_t size) noexcept
SHA256_Update(ctx, data, size);
}
openssl_sha256_hasher::operator result_type() noexcept
openssl_sha256_hasher::
operator result_type() noexcept
{
auto const ctx = reinterpret_cast<SHA256_CTX*>(ctx_);
result_type digest;

View File

@@ -0,0 +1,92 @@
#include <xrpl/basics/Log.h>
#include <xrpl/basics/contract.h>
#include <xrpl/rdb/DatabaseCon.h>
#include <xrpl/rdb/SociDB.h>
#include <boost/algorithm/string.hpp>
#include <boost/format.hpp>
#include <memory>
#include <unordered_map>
namespace xrpl {
class CheckpointersCollection
{
std::uintptr_t nextId_{0};
// Mutex protects the CheckpointersCollection
std::mutex mutex_;
// Each checkpointer is given a unique id. All the checkpointers that are
// part of a DatabaseCon are part of this collection. When the DatabaseCon
// is destroyed, its checkpointer is removed from the collection
std::unordered_map<std::uintptr_t, std::shared_ptr<Checkpointer>> checkpointers_;
public:
std::shared_ptr<Checkpointer>
fromId(std::uintptr_t id)
{
std::lock_guard l{mutex_};
auto it = checkpointers_.find(id);
if (it != checkpointers_.end())
return it->second;
return {};
}
void
erase(std::uintptr_t id)
{
std::lock_guard lock{mutex_};
checkpointers_.erase(id);
}
std::shared_ptr<Checkpointer>
create(std::shared_ptr<soci::session> const& session, JobQueue& jobQueue, Logs& logs)
{
std::lock_guard lock{mutex_};
auto const id = nextId_++;
auto const r = makeCheckpointer(id, session, jobQueue, logs);
checkpointers_[id] = r;
return r;
}
};
CheckpointersCollection checkpointers;
std::shared_ptr<Checkpointer>
checkpointerFromId(std::uintptr_t id)
{
return checkpointers.fromId(id);
}
DatabaseCon::~DatabaseCon()
{
if (checkpointer_)
{
checkpointers.erase(checkpointer_->id());
std::weak_ptr<Checkpointer> wk(checkpointer_);
checkpointer_.reset();
// The references to our Checkpointer held by 'checkpointer_' and
// 'checkpointers' have been removed, so if the use count is nonzero, a
// checkpoint is currently in progress. Wait for it to end, otherwise
// creating a new DatabaseCon to the same database may fail due to the
// database being locked by our (now old) Checkpointer.
while (wk.use_count())
{
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
}
}
std::unique_ptr<std::vector<std::string> const> DatabaseCon::Setup::globalPragma;
void
DatabaseCon::setupCheckpointing(JobQueue* q, Logs& l)
{
if (!q)
Throw<std::logic_error>("No JobQueue");
checkpointer_ = checkpointers.create(session_, *q, l);
}
} // namespace xrpl

View File

@@ -3,12 +3,10 @@
#pragma clang diagnostic ignored "-Wdeprecated"
#endif
#include <xrpld/core/Config.h>
#include <xrpld/core/DatabaseCon.h>
#include <xrpld/core/SociDB.h>
#include <xrpl/basics/ByteUtilities.h>
#include <xrpl/basics/contract.h>
#include <xrpl/rdb/DatabaseCon.h>
#include <xrpl/rdb/SociDB.h>
#include <boost/filesystem.hpp>

View File

@@ -1,4 +1,4 @@
#include <xrpld/rpc/InfoSub.h>
#include <xrpl/server/InfoSub.h>
namespace xrpl {

View File

@@ -19,9 +19,7 @@ getHTTPHeaderTimestamp()
char buffer[96];
time_t now;
time(&now);
struct tm now_gmt
{
};
struct tm now_gmt{};
#ifndef _MSC_VER
gmtime_r(&now, &now_gmt);
#else

View File

@@ -1,9 +1,8 @@
#include <xrpld/app/misc/LoadFeeTrack.h>
#include <xrpl/basics/Log.h>
#include <xrpl/basics/contract.h>
#include <xrpl/basics/safe_cast.h>
#include <xrpl/protocol/Units.h>
#include <xrpl/server/LoadFeeTrack.h>
#include <cstdint>

View File

@@ -1,4 +1,4 @@
#include <xrpld/app/rdb/State.h>
#include <xrpl/server/State.h>
namespace xrpl {

View File

@@ -1,7 +1,9 @@
#include <xrpld/app/rdb/Vacuum.h>
#include <xrpl/server/Vacuum.h>
#include <boost/format.hpp>
#include <iostream>
namespace xrpl {
bool

View File

@@ -1,4 +1,5 @@
#include <xrpld/app/rdb/Wallet.h>
#include <xrpl/rdb/DBInit.h>
#include <xrpl/server/Wallet.h>
#include <boost/format.hpp>
@@ -123,8 +124,9 @@ getNodeIdentity(soci::session& session)
auto [newpublicKey, newsecretKey] = randomKeyPair(KeyType::secp256k1);
session << str(
boost::format("INSERT INTO NodeIdentity (PublicKey,PrivateKey) "
"VALUES ('%s','%s');") %
boost::format(
"INSERT INTO NodeIdentity (PublicKey,PrivateKey) "
"VALUES ('%s','%s');") %
toBase58(TokenType::NodePublic, newpublicKey) % toBase58(TokenType::NodePrivate, newsecretKey));
return {newpublicKey, newsecretKey};

View File

@@ -276,45 +276,46 @@ SHAMap::walkMapParallel(std::vector<SHAMapMissingNode>& missingNodes, int maxMis
nodeStacks[rootChildIndex].push(intr_ptr::static_pointer_cast<SHAMapInnerNode>(child));
JLOG(journal_.debug()) << "starting worker " << rootChildIndex;
workers.push_back(std::thread(
[&m, &missingNodes, &maxMissing, &exceptions, this](
std::stack<StackEntry, std::vector<StackEntry>> nodeStack) {
try
{
while (!nodeStack.empty())
workers.push_back(
std::thread(
[&m, &missingNodes, &maxMissing, &exceptions, this](
std::stack<StackEntry, std::vector<StackEntry>> nodeStack) {
try
{
intr_ptr::SharedPtr<SHAMapInnerNode> node = std::move(nodeStack.top());
XRPL_ASSERT(node, "xrpl::SHAMap::walkMapParallel : non-null node");
nodeStack.pop();
for (int i = 0; i < 16; ++i)
while (!nodeStack.empty())
{
if (node->isEmptyBranch(i))
continue;
intr_ptr::SharedPtr<SHAMapTreeNode> nextNode = descendNoStore(*node, i);
intr_ptr::SharedPtr<SHAMapInnerNode> node = std::move(nodeStack.top());
XRPL_ASSERT(node, "xrpl::SHAMap::walkMapParallel : non-null node");
nodeStack.pop();
if (nextNode)
for (int i = 0; i < 16; ++i)
{
if (nextNode->isInner())
nodeStack.push(intr_ptr::static_pointer_cast<SHAMapInnerNode>(nextNode));
}
else
{
std::lock_guard l{m};
missingNodes.emplace_back(type_, node->getChildHash(i));
if (--maxMissing <= 0)
return;
if (node->isEmptyBranch(i))
continue;
intr_ptr::SharedPtr<SHAMapTreeNode> nextNode = descendNoStore(*node, i);
if (nextNode)
{
if (nextNode->isInner())
nodeStack.push(intr_ptr::static_pointer_cast<SHAMapInnerNode>(nextNode));
}
else
{
std::lock_guard l{m};
missingNodes.emplace_back(type_, node->getChildHash(i));
if (--maxMissing <= 0)
return;
}
}
}
}
}
catch (SHAMapMissingNode const& e)
{
std::lock_guard l(m);
exceptions.push_back(e);
}
},
std::move(nodeStacks[rootChildIndex])));
catch (SHAMapMissingNode const& e)
{
std::lock_guard l(m);
exceptions.push_back(e);
}
},
std::move(nodeStacks[rootChildIndex])));
}
for (std::thread& worker : workers)

View File

@@ -1,14 +1,13 @@
#include <xrpld/app/tx/detail/ApplyContext.h>
#include <xrpld/app/tx/detail/InvariantCheck.h>
#include <xrpl/basics/Log.h>
#include <xrpl/beast/utility/instrumentation.h>
#include <xrpl/json/to_string.h>
#include <xrpl/tx/ApplyContext.h>
#include <xrpl/tx/InvariantCheck.h>
namespace xrpl {
ApplyContext::ApplyContext(
Application& app_,
ServiceRegistry& registry_,
OpenView& base,
std::optional<uint256 const> const& parentBatchId,
STTx const& tx_,
@@ -16,7 +15,7 @@ ApplyContext::ApplyContext(
XRPAmount baseFee_,
ApplyFlags flags,
beast::Journal journal_)
: app(app_)
: registry(registry_)
, tx(tx_)
, preclaimResult(preclaimResult_)
, baseFee(baseFee_)

View File

@@ -1,9 +1,3 @@
#include <xrpld/app/misc/AMMHelpers.h>
#include <xrpld/app/misc/AMMUtils.h>
#include <xrpld/app/tx/detail/InvariantCheck.h>
#include <xrpld/app/tx/detail/NFTokenUtils.h>
#include <xrpld/app/tx/detail/PermissionedDomainSet.h>
#include <xrpl/basics/Log.h>
#include <xrpl/beast/utility/instrumentation.h>
#include <xrpl/ledger/CredentialHelpers.h>
@@ -21,6 +15,11 @@
#include <xrpl/protocol/TxFormats.h>
#include <xrpl/protocol/Units.h>
#include <xrpl/protocol/nftPageMask.h>
#include <xrpl/tx/InvariantCheck.h>
#include <xrpl/tx/transactors/AMM/AMMHelpers.h>
#include <xrpl/tx/transactors/AMM/AMMUtils.h>
#include <xrpl/tx/transactors/NFT/NFTokenUtils.h>
#include <xrpl/tx/transactors/PermissionedDomain/PermissionedDomainSet.h>
#include <cstdint>
#include <optional>
@@ -1507,7 +1506,7 @@ ValidMPTIssuance::finalize(
void
ValidPermissionedDomain::visitEntry(
bool,
bool isDel,
std::shared_ptr<SLE const> const& before,
std::shared_ptr<SLE const> const& after)
{
@@ -1516,39 +1515,29 @@ ValidPermissionedDomain::visitEntry(
if (after && after->getType() != ltPERMISSIONED_DOMAIN)
return;
auto check = [](SleStatus& sleStatus, std::shared_ptr<SLE const> const& sle) {
auto check = [isDel](std::vector<SleStatus>& sleStatus, std::shared_ptr<SLE const> const& sle) {
auto const& credentials = sle->getFieldArray(sfAcceptedCredentials);
sleStatus.credentialsSize_ = credentials.size();
auto const sorted = credentials::makeSorted(credentials);
sleStatus.isUnique_ = !sorted.empty();
SleStatus ss{credentials.size(), false, !sorted.empty(), isDel};
// If array have duplicates then all the other checks are invalid
sleStatus.isSorted_ = false;
if (sleStatus.isUnique_)
if (ss.isUnique_)
{
unsigned i = 0;
for (auto const& cred : sorted)
{
auto const& credTx = credentials[i++];
sleStatus.isSorted_ = (cred.first == credTx[sfIssuer]) && (cred.second == credTx[sfCredentialType]);
if (!sleStatus.isSorted_)
ss.isSorted_ = (cred.first == credTx[sfIssuer]) && (cred.second == credTx[sfCredentialType]);
if (!ss.isSorted_)
break;
}
}
sleStatus.emplace_back(std::move(ss));
};
if (before)
{
sleStatus_[0] = SleStatus();
check(*sleStatus_[0], after);
}
if (after)
{
sleStatus_[1] = SleStatus();
check(*sleStatus_[1], after);
}
check(sleStatus_, after);
}
bool
@@ -1559,9 +1548,6 @@ ValidPermissionedDomain::finalize(
ReadView const& view,
beast::Journal const& j)
{
if (tx.getTxnType() != ttPERMISSIONED_DOMAIN_SET || result != tesSUCCESS)
return true;
auto check = [](SleStatus const& sleStatus, beast::Journal const& j) {
if (!sleStatus.credentialsSize_)
{
@@ -1595,7 +1581,76 @@ ValidPermissionedDomain::finalize(
return true;
};
return (sleStatus_[0] ? check(*sleStatus_[0], j) : true) && (sleStatus_[1] ? check(*sleStatus_[1], j) : true);
if (view.rules().enabled(fixPermissionedDomainInvariant))
{
// No permissioned domains should be affected if the transaction failed
if (result != tesSUCCESS)
// If nothing changed, all is good. If there were changes, that's
// bad.
return sleStatus_.empty();
if (sleStatus_.size() > 1)
{
JLOG(j.fatal()) << "Invariant failed: transaction affected more "
"than 1 permissioned domain entry.";
return false;
}
switch (tx.getTxnType())
{
case ttPERMISSIONED_DOMAIN_SET: {
if (sleStatus_.empty())
{
JLOG(j.fatal()) << "Invariant failed: no domain objects affected by "
"PermissionedDomainSet";
return false;
}
auto const& sleStatus = sleStatus_[0];
if (sleStatus.isDelete_)
{
JLOG(j.fatal()) << "Invariant failed: domain object "
"deleted by PermissionedDomainSet";
return false;
}
return check(sleStatus, j);
}
case ttPERMISSIONED_DOMAIN_DELETE: {
if (sleStatus_.empty())
{
JLOG(j.fatal()) << "Invariant failed: no domain objects affected by "
"PermissionedDomainDelete";
return false;
}
if (!sleStatus_[0].isDelete_)
{
JLOG(j.fatal()) << "Invariant failed: domain object "
"modified, but not deleted by "
"PermissionedDomainDelete";
return false;
}
return true;
}
default: {
if (!sleStatus_.empty())
{
JLOG(j.fatal()) << "Invariant failed: " << sleStatus_.size()
<< " domain object(s) affected by an "
"unauthorized transaction. "
<< tx.getTxnType();
return false;
}
return true;
}
}
}
else
{
if (tx.getTxnType() != ttPERMISSIONED_DOMAIN_SET || result != tesSUCCESS || sleStatus_.empty())
return true;
return check(sleStatus_[0], j);
}
}
//------------------------------------------------------------------------------

View File

@@ -1,8 +1,8 @@
#include <xrpld/app/tx/detail/SignerEntries.h>
#include <xrpl/basics/Log.h>
#include <xrpl/protocol/STArray.h>
#include <xrpl/protocol/STObject.h>
#include <xrpl/protocol/STTx.h>
#include <xrpl/tx/SignerEntries.h>
#include <cstdint>
#include <optional>

View File

@@ -1,22 +1,21 @@
#include <xrpld/app/main/Application.h>
#include <xrpld/app/misc/DelegateUtils.h>
#include <xrpld/app/misc/LoadFeeTrack.h>
#include <xrpld/app/tx/apply.h>
#include <xrpld/app/tx/detail/NFTokenUtils.h>
#include <xrpld/app/tx/detail/SignerEntries.h>
#include <xrpld/app/tx/detail/Transactor.h>
#include <xrpld/core/Config.h>
#include <xrpl/basics/Log.h>
#include <xrpl/basics/contract.h>
#include <xrpl/core/NetworkIDService.h>
#include <xrpl/json/to_string.h>
#include <xrpl/ledger/CredentialHelpers.h>
#include <xrpl/ledger/View.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/Indexes.h>
#include <xrpl/protocol/Protocol.h>
#include <xrpl/protocol/SystemParameters.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/protocol/UintTypes.h>
#include <xrpl/server/LoadFeeTrack.h>
#include <xrpl/tx/SignerEntries.h>
#include <xrpl/tx/Transactor.h>
#include <xrpl/tx/apply.h>
#include <xrpl/tx/transactors/Delegate/DelegateUtils.h>
#include <xrpl/tx/transactors/NFT/NFTokenUtils.h>
namespace xrpl {
@@ -33,7 +32,7 @@ preflight0(PreflightContext const& ctx, std::uint32_t flagMask)
if (!isPseudoTx(ctx.tx) || ctx.tx.isFieldPresent(sfNetworkID))
{
uint32_t nodeNID = ctx.app.config().NETWORK_ID;
uint32_t nodeNID = ctx.registry.getNetworkIDService().getNetworkID();
std::optional<uint32_t> txNID = ctx.tx[~sfNetworkID];
if (nodeNID <= 1024)
@@ -205,7 +204,7 @@ Transactor::preflight2(PreflightContext const& ctx)
// Do not add any checks after this point that are relevant for
// batch inner transactions. They will be skipped.
auto const sigValid = checkValidity(ctx.app.getHashRouter(), ctx.tx, ctx.rules, ctx.app.config());
auto const sigValid = checkValidity(ctx.registry.getHashRouter(), ctx.tx, ctx.rules);
if (sigValid.first == Validity::SigBad)
{ // LCOV_EXCL_START
JLOG(ctx.j.debug()) << "preflight2: bad signature. " << sigValid.second;
@@ -304,9 +303,9 @@ Transactor::calculateOwnerReserveFee(ReadView const& view, STTx const& tx)
}
XRPAmount
Transactor::minimumFee(Application& app, XRPAmount baseFee, Fees const& fees, ApplyFlags flags)
Transactor::minimumFee(ServiceRegistry& registry, XRPAmount baseFee, Fees const& fees, ApplyFlags flags)
{
return scaleFeeLoad(baseFee, app.getFeeTrack(), fees, flags & tapUNLIMITED);
return scaleFeeLoad(baseFee, registry.getFeeTrack(), fees, flags & tapUNLIMITED);
}
TER
@@ -332,7 +331,7 @@ Transactor::checkFee(PreclaimContext const& ctx, XRPAmount baseFee)
// Only check fee is sufficient when the ledger is open.
if (ctx.view.open())
{
auto const feeDue = minimumFee(ctx.app, baseFee, ctx.view.fees(), ctx.flags);
auto const feeDue = minimumFee(ctx.registry, baseFee, ctx.view.fees(), ctx.flags);
if (feePaid < feeDue)
{
@@ -1072,7 +1071,7 @@ Transactor::operator()()
}
#endif
if (auto const& trap = ctx_.app.trapTxID(); trap && *trap == ctx_.tx.getTransactionID())
if (auto const& trap = ctx_.registry.trapTxID(); trap && *trap == ctx_.tx.getTransactionID())
{
trapTransaction(*trap);
}
@@ -1173,16 +1172,16 @@ Transactor::operator()()
// If necessary, remove any offers found unfunded during processing
if ((result == tecOVERSIZE) || (result == tecKILLED))
removeUnfundedOffers(view(), removedOffers, ctx_.app.journal("View"));
removeUnfundedOffers(view(), removedOffers, ctx_.registry.journal("View"));
if (result == tecEXPIRED)
removeExpiredNFTokenOffers(view(), expiredNFTokenOffers, ctx_.app.journal("View"));
removeExpiredNFTokenOffers(view(), expiredNFTokenOffers, ctx_.registry.journal("View"));
if (result == tecINCOMPLETE)
removeDeletedTrustLines(view(), removedTrustLines, ctx_.app.journal("View"));
removeDeletedTrustLines(view(), removedTrustLines, ctx_.registry.journal("View"));
if (result == tecEXPIRED)
removeExpiredCredentials(view(), expiredCredentials, ctx_.app.journal("View"));
removeExpiredCredentials(view(), expiredCredentials, ctx_.registry.journal("View"));
applied = isTecClaim(result);
}

View File

@@ -1,10 +1,10 @@
#include <xrpld/app/misc/HashRouter.h>
#include <xrpld/app/tx/apply.h>
#include <xrpld/app/tx/applySteps.h>
#include <xrpl/basics/Log.h>
#include <xrpl/core/HashRouter.h>
#include <xrpl/core/ServiceRegistry.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/tx/apply.h>
#include <xrpl/tx/applySteps.h>
namespace xrpl {
@@ -18,7 +18,7 @@ constexpr HashRouterFlags SF_LOCALGOOD = HashRouterFlags::PRIVATE4; // Local ch
//------------------------------------------------------------------------------
std::pair<Validity, std::string>
checkValidity(HashRouter& router, STTx const& tx, Rules const& rules, Config const& config)
checkValidity(HashRouter& router, STTx const& tx, Rules const& rules)
{
auto const id = tx.getTransactionID();
auto const flags = router.getFlags(id);
@@ -107,32 +107,33 @@ forceValidity(HashRouter& router, uint256 const& txid, Validity validity)
template <typename PreflightChecks>
ApplyResult
apply(Application& app, OpenView& view, PreflightChecks&& preflightChecks)
apply(ServiceRegistry& registry, OpenView& view, PreflightChecks&& preflightChecks)
{
NumberSO stNumberSO{view.rules().enabled(fixUniversalNumber)};
return doApply(preclaim(preflightChecks(), app, view), app, view);
return doApply(preclaim(preflightChecks(), registry, view), registry, view);
}
ApplyResult
apply(Application& app, OpenView& view, STTx const& tx, ApplyFlags flags, beast::Journal j)
apply(ServiceRegistry& registry, OpenView& view, STTx const& tx, ApplyFlags flags, beast::Journal j)
{
return apply(app, view, [&]() mutable { return preflight(app, view.rules(), tx, flags, j); });
return apply(registry, view, [&]() mutable { return preflight(registry, view.rules(), tx, flags, j); });
}
ApplyResult
apply(
Application& app,
ServiceRegistry& registry,
OpenView& view,
uint256 const& parentBatchId,
STTx const& tx,
ApplyFlags flags,
beast::Journal j)
{
return apply(app, view, [&]() mutable { return preflight(app, view.rules(), parentBatchId, tx, flags, j); });
return apply(
registry, view, [&]() mutable { return preflight(registry, view.rules(), parentBatchId, tx, flags, j); });
}
static bool
applyBatchTransactions(Application& app, OpenView& batchView, STTx const& batchTxn, beast::Journal j)
applyBatchTransactions(ServiceRegistry& registry, OpenView& batchView, STTx const& batchTxn, beast::Journal j)
{
XRPL_ASSERT(
batchTxn.getTxnType() == ttBATCH && batchTxn.getFieldArray(sfRawTransactions).size() != 0,
@@ -141,10 +142,10 @@ applyBatchTransactions(Application& app, OpenView& batchView, STTx const& batchT
auto const parentBatchId = batchTxn.getTransactionID();
auto const mode = batchTxn.getFlags();
auto applyOneTransaction = [&app, &j, &parentBatchId, &batchView](STTx&& tx) {
auto applyOneTransaction = [&registry, &j, &parentBatchId, &batchView](STTx&& tx) {
OpenView perTxBatchView(batch_view, batchView);
auto const ret = apply(app, perTxBatchView, parentBatchId, tx, tapBATCH, j);
auto const ret = apply(registry, perTxBatchView, parentBatchId, tx, tapBATCH, j);
XRPL_ASSERT(
ret.applied == (isTesSuccess(ret.ter) || isTecClaim(ret.ter)), "Inner transaction should not be applied");
@@ -188,7 +189,7 @@ applyBatchTransactions(Application& app, OpenView& batchView, STTx const& batchT
ApplyTransactionResult
applyTransaction(
Application& app,
ServiceRegistry& registry,
OpenView& view,
STTx const& txn,
bool retryAssured,
@@ -203,7 +204,7 @@ applyTransaction(
try
{
auto const result = apply(app, view, txn, flags, j);
auto const result = apply(registry, view, txn, flags, j);
if (result.applied)
{
@@ -215,7 +216,7 @@ applyTransaction(
{
OpenView wholeBatchView(batch_view, view);
if (applyBatchTransactions(app, wholeBatchView, txn, j))
if (applyBatchTransactions(registry, wholeBatchView, txn, j))
wholeBatchView.apply(view);
}

View File

@@ -1,4 +1,4 @@
#include <xrpld/app/tx/applySteps.h>
#include <xrpl/tx/applySteps.h>
#pragma push_macro("TRANSACTION")
#undef TRANSACTION
@@ -14,6 +14,7 @@
// DO NOT INCLUDE TRANSACTOR HEADER FILES HERE.
// See the instructions at the top of transactions.macro instead.
#include <xrpl/core/ServiceRegistry.h>
#include <xrpl/protocol/TxFormats.h>
#include <stdexcept>
@@ -292,9 +293,9 @@ invoke_apply(ApplyContext& ctx)
}
PreflightResult
preflight(Application& app, Rules const& rules, STTx const& tx, ApplyFlags flags, beast::Journal j)
preflight(ServiceRegistry& registry, Rules const& rules, STTx const& tx, ApplyFlags flags, beast::Journal j)
{
PreflightContext const pfCtx(app, tx, rules, flags, j);
PreflightContext const pfCtx(registry, tx, rules, flags, j);
try
{
return {pfCtx, invoke_preflight(pfCtx)};
@@ -308,14 +309,14 @@ preflight(Application& app, Rules const& rules, STTx const& tx, ApplyFlags flags
PreflightResult
preflight(
Application& app,
ServiceRegistry& registry,
Rules const& rules,
uint256 const& parentBatchId,
STTx const& tx,
ApplyFlags flags,
beast::Journal j)
{
PreflightContext const pfCtx(app, tx, parentBatchId, rules, flags, j);
PreflightContext const pfCtx(registry, tx, parentBatchId, rules, flags, j);
try
{
return {pfCtx, invoke_preflight(pfCtx)};
@@ -328,7 +329,7 @@ preflight(
}
PreclaimResult
preclaim(PreflightResult const& preflightResult, Application& app, OpenView const& view)
preclaim(PreflightResult const& preflightResult, ServiceRegistry& registry, OpenView const& view)
{
std::optional<PreclaimContext const> ctx;
if (preflightResult.rules != view.rules())
@@ -336,18 +337,18 @@ preclaim(PreflightResult const& preflightResult, Application& app, OpenView cons
auto secondFlight = [&]() {
if (preflightResult.parentBatchId)
return preflight(
app,
registry,
view.rules(),
preflightResult.parentBatchId.value(),
preflightResult.tx,
preflightResult.flags,
preflightResult.j);
return preflight(app, view.rules(), preflightResult.tx, preflightResult.flags, preflightResult.j);
return preflight(registry, view.rules(), preflightResult.tx, preflightResult.flags, preflightResult.j);
}();
ctx.emplace(
app,
registry,
view,
secondFlight.ter,
secondFlight.tx,
@@ -358,7 +359,7 @@ preclaim(PreflightResult const& preflightResult, Application& app, OpenView cons
else
{
ctx.emplace(
app,
registry,
view,
preflightResult.ter,
preflightResult.tx,
@@ -393,7 +394,7 @@ calculateDefaultBaseFee(ReadView const& view, STTx const& tx)
}
ApplyResult
doApply(PreclaimResult const& preclaimResult, Application& app, OpenView& view)
doApply(PreclaimResult const& preclaimResult, ServiceRegistry& registry, OpenView& view)
{
if (preclaimResult.view.seq() != view.seq())
{
@@ -406,7 +407,7 @@ doApply(PreclaimResult const& preclaimResult, Application& app, OpenView& view)
if (!preclaimResult.likelyToClaimFee)
return {preclaimResult.ter, false};
ApplyContext ctx(
app,
registry,
view,
preclaimResult.parentBatchId,
preclaimResult.tx,

View File

@@ -1,4 +1,4 @@
#include <xrpld/app/tx/detail/BookTip.h>
#include <xrpl/tx/paths/BookTip.h>
namespace xrpl {

View File

@@ -1,13 +1,12 @@
#include <xrpld/app/paths/AMMContext.h>
#include <xrpld/app/paths/Flow.h>
#include <xrpld/app/paths/detail/AmountSpec.h>
#include <xrpld/app/paths/detail/Steps.h>
#include <xrpld/app/paths/detail/StrandFlow.h>
#include <xrpl/basics/Log.h>
#include <xrpl/ledger/Credit.h>
#include <xrpl/protocol/IOUAmount.h>
#include <xrpl/protocol/XRPAmount.h>
#include <xrpl/tx/paths/Flow.h>
#include <xrpl/tx/paths/detail/AmountSpec.h>
#include <xrpl/tx/paths/detail/Steps.h>
#include <xrpl/tx/paths/detail/StrandFlow.h>
#include <xrpl/tx/transactors/AMM/AMMContext.h>
namespace xrpl {

View File

@@ -1,10 +1,9 @@
#include <xrpld/app/misc/PermissionedDEXHelpers.h>
#include <xrpld/app/tx/detail/OfferStream.h>
#include <xrpl/basics/Log.h>
#include <xrpl/ledger/View.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/LedgerFormats.h>
#include <xrpl/tx/paths/OfferStream.h>
#include <xrpl/tx/transactors/PermissionedDEXHelpers.h>
namespace xrpl {

View File

@@ -1,10 +1,9 @@
#include <xrpld/app/paths/Flow.h>
#include <xrpld/app/paths/RippleCalc.h>
#include <xrpld/app/paths/detail/FlowDebugInfo.h>
#include <xrpl/basics/Log.h>
#include <xrpl/ledger/View.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/tx/paths/Flow.h>
#include <xrpl/tx/paths/RippleCalc.h>
#include <xrpl/tx/paths/detail/FlowDebugInfo.h>
namespace xrpl {
namespace path {

View File

@@ -1,13 +1,12 @@
#include <xrpld/app/misc/AMMHelpers.h>
#include <xrpld/app/misc/AMMUtils.h>
#include <xrpld/app/tx/detail/AMMBid.h>
#include <xrpl/ledger/Sandbox.h>
#include <xrpl/ledger/View.h>
#include <xrpl/protocol/AMMCore.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/TER.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/tx/transactors/AMM/AMMBid.h>
#include <xrpl/tx/transactors/AMM/AMMHelpers.h>
#include <xrpl/tx/transactors/AMM/AMMUtils.h>
namespace xrpl {

View File

@@ -1,14 +1,13 @@
#include <xrpld/app/misc/AMMHelpers.h>
#include <xrpld/app/misc/AMMUtils.h>
#include <xrpld/app/tx/detail/AMMClawback.h>
#include <xrpld/app/tx/detail/AMMWithdraw.h>
#include <xrpl/ledger/Sandbox.h>
#include <xrpl/ledger/View.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/Indexes.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/protocol/st.h>
#include <xrpl/tx/transactors/AMM/AMMClawback.h>
#include <xrpl/tx/transactors/AMM/AMMHelpers.h>
#include <xrpl/tx/transactors/AMM/AMMUtils.h>
#include <xrpl/tx/transactors/AMM/AMMWithdraw.h>
#include <tuple>

View File

@@ -1,14 +1,13 @@
#include <xrpld/app/ledger/OrderBookDB.h>
#include <xrpld/app/misc/AMMHelpers.h>
#include <xrpld/app/misc/AMMUtils.h>
#include <xrpld/app/tx/detail/AMMCreate.h>
#include <xrpl/ledger/OrderBookDB.h>
#include <xrpl/ledger/Sandbox.h>
#include <xrpl/ledger/View.h>
#include <xrpl/protocol/AMMCore.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/STIssue.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/tx/transactors/AMM/AMMCreate.h>
#include <xrpl/tx/transactors/AMM/AMMHelpers.h>
#include <xrpl/tx/transactors/AMM/AMMUtils.h>
namespace xrpl {
@@ -272,7 +271,7 @@ applyCreate(ApplyContext& ctx_, Sandbox& sb, AccountID const& account_, beast::J
Book const book{issueIn, issueOut, std::nullopt};
auto const dir = keylet::quality(keylet::book(book), uRate);
if (auto const bookExisted = static_cast<bool>(sb.read(dir)); !bookExisted)
ctx_.app.getOrderBookDB().addOrderBook(book);
ctx_.registry.getOrderBookDB().addOrderBook(book);
};
addOrderBook(amount.issue(), amount2.issue(), getRate(amount2, amount));
addOrderBook(amount2.issue(), amount.issue(), getRate(amount, amount2));

View File

@@ -1,10 +1,9 @@
#include <xrpld/app/misc/AMMUtils.h>
#include <xrpld/app/tx/detail/AMMDelete.h>
#include <xrpl/ledger/Sandbox.h>
#include <xrpl/protocol/AMMCore.h>
#include <xrpl/protocol/TER.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/tx/transactors/AMM/AMMDelete.h>
#include <xrpl/tx/transactors/AMM/AMMUtils.h>
namespace xrpl {

View File

@@ -1,12 +1,11 @@
#include <xrpld/app/misc/AMMHelpers.h>
#include <xrpld/app/misc/AMMUtils.h>
#include <xrpld/app/tx/detail/AMMDeposit.h>
#include <xrpl/ledger/Sandbox.h>
#include <xrpl/ledger/View.h>
#include <xrpl/protocol/AMMCore.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/tx/transactors/AMM/AMMDeposit.h>
#include <xrpl/tx/transactors/AMM/AMMHelpers.h>
#include <xrpl/tx/transactors/AMM/AMMUtils.h>
namespace xrpl {

View File

@@ -1,4 +1,4 @@
#include <xrpld/app/misc/AMMHelpers.h>
#include <xrpl/tx/transactors/AMM/AMMHelpers.h>
namespace xrpl {

View File

@@ -1,10 +1,9 @@
#include <xrpld/app/misc/AMMHelpers.h>
#include <xrpld/app/misc/AMMUtils.h>
#include <xrpl/basics/Log.h>
#include <xrpl/ledger/Sandbox.h>
#include <xrpl/protocol/AMMCore.h>
#include <xrpl/protocol/STObject.h>
#include <xrpl/tx/transactors/AMM/AMMHelpers.h>
#include <xrpl/tx/transactors/AMM/AMMUtils.h>
namespace xrpl {

View File

@@ -1,10 +1,9 @@
#include <xrpld/app/misc/AMMUtils.h>
#include <xrpld/app/tx/detail/AMMVote.h>
#include <xrpl/ledger/Sandbox.h>
#include <xrpl/protocol/AMMCore.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/tx/transactors/AMM/AMMUtils.h>
#include <xrpl/tx/transactors/AMM/AMMVote.h>
namespace xrpl {

View File

@@ -1,11 +1,10 @@
#include <xrpld/app/misc/AMMHelpers.h>
#include <xrpld/app/misc/AMMUtils.h>
#include <xrpld/app/tx/detail/AMMWithdraw.h>
#include <xrpl/basics/Number.h>
#include <xrpl/ledger/Sandbox.h>
#include <xrpl/protocol/AMMCore.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/tx/transactors/AMM/AMMHelpers.h>
#include <xrpl/tx/transactors/AMM/AMMUtils.h>
#include <xrpl/tx/transactors/AMM/AMMWithdraw.h>
namespace xrpl {

View File

@@ -1,13 +1,13 @@
#include <xrpld/app/tx/apply.h>
#include <xrpld/app/tx/detail/Batch.h>
#include <xrpl/basics/Log.h>
#include <xrpl/ledger/Sandbox.h>
#include <xrpl/ledger/View.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/Indexes.h>
#include <xrpl/protocol/SystemParameters.h>
#include <xrpl/protocol/TER.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/tx/apply.h>
#include <xrpl/tx/transactors/Batch.h>
namespace xrpl {
@@ -295,7 +295,7 @@ Batch::preflight(PreflightContext const& ctx)
}
auto const innerAccount = stx.getAccountID(sfAccount);
if (auto const preflightResult = xrpl::preflight(ctx.app, ctx.rules, parentBatchId, stx, tapBATCH, ctx.j);
if (auto const preflightResult = xrpl::preflight(ctx.registry, ctx.rules, parentBatchId, stx, tapBATCH, ctx.j);
preflightResult.ter != tesSUCCESS)
{
JLOG(ctx.j.debug()) << "BatchTrace[" << parentBatchId << "]: "

View File

@@ -1,14 +1,11 @@
#include <xrpld/app/ledger/Ledger.h>
#include <xrpld/app/main/Application.h>
#include <xrpld/app/misc/AmendmentTable.h>
#include <xrpld/app/misc/NetworkOPs.h>
#include <xrpld/app/tx/detail/Change.h>
#include <xrpl/basics/Log.h>
#include <xrpl/ledger/AmendmentTable.h>
#include <xrpl/ledger/Sandbox.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/Indexes.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/server/NetworkOPs.h>
#include <xrpl/tx/transactors/Change.h>
#include <string_view>
@@ -195,7 +192,7 @@ Change::applyAmendment()
entry[sfAmendment] = amendment;
entry[sfCloseTime] = view().parentCloseTime().time_since_epoch().count();
if (!ctx_.app.getAmendmentTable().isSupported(amendment))
if (!ctx_.registry.getAmendmentTable().isSupported(amendment))
{
JLOG(j_.warn()) << "Unsupported amendment " << amendment << " received a majority.";
}
@@ -206,12 +203,12 @@ Change::applyAmendment()
amendments.push_back(amendment);
amendmentObject->setFieldV256(sfAmendments, amendments);
ctx_.app.getAmendmentTable().enable(amendment);
ctx_.registry.getAmendmentTable().enable(amendment);
if (!ctx_.app.getAmendmentTable().isSupported(amendment))
if (!ctx_.registry.getAmendmentTable().isSupported(amendment))
{
JLOG(j_.error()) << "Unsupported amendment " << amendment << " activated: server blocked.";
ctx_.app.getOPs().setAmendmentBlocked();
ctx_.registry.getOPs().setAmendmentBlocked();
}
}

View File

@@ -1,12 +1,11 @@
#include <xrpld/app/ledger/Ledger.h>
#include <xrpld/app/tx/detail/CancelCheck.h>
#include <xrpl/basics/Log.h>
#include <xrpl/ledger/ApplyView.h>
#include <xrpl/ledger/View.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/Indexes.h>
#include <xrpl/protocol/TER.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/tx/transactors/Check/CancelCheck.h>
namespace xrpl {
@@ -62,7 +61,7 @@ CancelCheck::doApply()
AccountID const srcId{sleCheck->getAccountID(sfAccount)};
AccountID const dstId{sleCheck->getAccountID(sfDestination)};
auto viewJ = ctx_.app.journal("View");
auto viewJ = ctx_.registry.journal("View");
// If the check is not written to self (and it shouldn't be), remove the
// check from the destination account root.

View File

@@ -1,13 +1,12 @@
#include <xrpld/app/ledger/Ledger.h>
#include <xrpld/app/paths/Flow.h>
#include <xrpld/app/tx/detail/CashCheck.h>
#include <xrpl/basics/Log.h>
#include <xrpl/basics/scope.h>
#include <xrpl/ledger/View.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/Indexes.h>
#include <xrpl/protocol/TER.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/tx/paths/Flow.h>
#include <xrpl/tx/transactors/Check/CashCheck.h>
#include <algorithm>
@@ -228,7 +227,7 @@ CashCheck::doApply()
//
// If it is not a check to self (as should be the case), then there's
// work to do...
auto viewJ = ctx_.app.journal("View");
auto viewJ = ctx_.registry.journal("View");
auto const optDeliverMin = ctx_.tx[~sfDeliverMin];
if (srcId != account_)

View File

@@ -1,11 +1,10 @@
#include <xrpld/app/tx/detail/CreateCheck.h>
#include <xrpl/basics/Log.h>
#include <xrpl/ledger/View.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/Indexes.h>
#include <xrpl/protocol/TER.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/tx/transactors/Check/CreateCheck.h>
namespace xrpl {
@@ -164,7 +163,7 @@ CreateCheck::doApply()
view().insert(sleCheck);
auto viewJ = ctx_.app.journal("View");
auto viewJ = ctx_.registry.journal("View");
// If it's not a self-send (and it shouldn't be), add Check to the
// destination's owner directory.
if (dstAccountId != account_)

View File

@@ -1,11 +1,10 @@
#include <xrpld/app/tx/detail/Clawback.h>
#include <xrpl/ledger/View.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/Indexes.h>
#include <xrpl/protocol/MPTAmount.h>
#include <xrpl/protocol/Protocol.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/tx/transactors/Clawback.h>
namespace xrpl {

View File

@@ -1,9 +1,9 @@
#include <xrpld/app/tx/detail/CreateTicket.h>
#include <xrpl/basics/Log.h>
#include <xrpl/ledger/View.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/Indexes.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/tx/transactors/CreateTicket.h>
namespace xrpl {
@@ -67,7 +67,7 @@ CreateTicket::doApply()
return tecINSUFFICIENT_RESERVE;
}
beast::Journal viewJ{ctx_.app.journal("View")};
beast::Journal viewJ{ctx_.registry.journal("View")};
// The starting ticket sequence is the same as the current account
// root sequence. Before we got here to doApply(), the transaction

View File

@@ -1,5 +1,3 @@
#include <xrpld/app/tx/detail/Credentials.h>
#include <xrpl/basics/Log.h>
#include <xrpl/ledger/ApplyView.h>
#include <xrpl/ledger/CredentialHelpers.h>
@@ -7,6 +5,7 @@
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/Indexes.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/tx/transactors/Credentials.h>
#include <chrono>

View File

@@ -1,11 +1,10 @@
#include <xrpld/app/tx/detail/DID.h>
#include <xrpl/basics/Log.h>
#include <xrpl/ledger/ApplyView.h>
#include <xrpl/ledger/View.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/Indexes.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/tx/transactors/DID.h>
namespace xrpl {

View File

@@ -1,10 +1,9 @@
#include <xrpld/app/tx/detail/DelegateSet.h>
#include <xrpl/basics/Log.h>
#include <xrpl/ledger/View.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/Indexes.h>
#include <xrpl/protocol/st.h>
#include <xrpl/tx/transactors/Delegate/DelegateSet.h>
namespace xrpl {

View File

@@ -1,6 +1,5 @@
#include <xrpld/app/misc/DelegateUtils.h>
#include <xrpl/protocol/STArray.h>
#include <xrpl/tx/transactors/Delegate/DelegateUtils.h>
namespace xrpl {
NotTEC

View File

@@ -1,11 +1,3 @@
#include <xrpld/app/tx/detail/DID.h>
#include <xrpld/app/tx/detail/DelegateSet.h>
#include <xrpld/app/tx/detail/DeleteAccount.h>
#include <xrpld/app/tx/detail/DeleteOracle.h>
#include <xrpld/app/tx/detail/DepositPreauth.h>
#include <xrpld/app/tx/detail/NFTokenUtils.h>
#include <xrpld/app/tx/detail/SetSignerList.h>
#include <xrpl/basics/Log.h>
#include <xrpl/basics/mulDiv.h>
#include <xrpl/beast/utility/instrumentation.h>
@@ -16,6 +8,13 @@
#include <xrpl/protocol/Protocol.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/protocol/Units.h>
#include <xrpl/tx/transactors/DID.h>
#include <xrpl/tx/transactors/Delegate/DelegateSet.h>
#include <xrpl/tx/transactors/DeleteAccount.h>
#include <xrpl/tx/transactors/DeleteOracle.h>
#include <xrpl/tx/transactors/DepositPreauth.h>
#include <xrpl/tx/transactors/NFT/NFTokenUtils.h>
#include <xrpl/tx/transactors/SetSignerList.h>
namespace xrpl {
@@ -51,7 +50,7 @@ DeleteAccount::calculateBaseFee(ReadView const& view, STTx const& tx)
namespace {
// Define a function pointer type that can be used to delete ledger node types.
using DeleterFuncPtr = TER (*)(
Application& app,
ServiceRegistry& registry,
ApplyView& view,
AccountID const& account,
uint256 const& delIndex,
@@ -61,7 +60,7 @@ using DeleterFuncPtr = TER (*)(
// Local function definitions that provides signature compatibility.
TER
offerDelete(
Application& app,
ServiceRegistry&,
ApplyView& view,
AccountID const& account,
uint256 const& delIndex,
@@ -73,19 +72,19 @@ offerDelete(
TER
removeSignersFromLedger(
Application& app,
ServiceRegistry& registry,
ApplyView& view,
AccountID const& account,
uint256 const& delIndex,
std::shared_ptr<SLE> const& sleDel,
beast::Journal j)
{
return SetSignerList::removeFromLedger(app, view, account, j);
return SetSignerList::removeFromLedger(registry, view, account, j);
}
TER
removeTicketFromLedger(
Application&,
ServiceRegistry&,
ApplyView& view,
AccountID const& account,
uint256 const& delIndex,
@@ -97,7 +96,7 @@ removeTicketFromLedger(
TER
removeDepositPreauthFromLedger(
Application&,
ServiceRegistry&,
ApplyView& view,
AccountID const&,
uint256 const& delIndex,
@@ -109,7 +108,7 @@ removeDepositPreauthFromLedger(
TER
removeNFTokenOfferFromLedger(
Application& app,
ServiceRegistry&,
ApplyView& view,
AccountID const& account,
uint256 const& delIndex,
@@ -124,7 +123,7 @@ removeNFTokenOfferFromLedger(
TER
removeDIDFromLedger(
Application& app,
ServiceRegistry&,
ApplyView& view,
AccountID const& account,
uint256 const& delIndex,
@@ -136,7 +135,7 @@ removeDIDFromLedger(
TER
removeOracleFromLedger(
Application&,
ServiceRegistry&,
ApplyView& view,
AccountID const& account,
uint256 const&,
@@ -148,7 +147,7 @@ removeOracleFromLedger(
TER
removeCredentialFromLedger(
Application&,
ServiceRegistry&,
ApplyView& view,
AccountID const&,
uint256 const&,
@@ -160,7 +159,7 @@ removeCredentialFromLedger(
TER
removeDelegateFromLedger(
Application& app,
ServiceRegistry&,
ApplyView& view,
AccountID const& account,
uint256 const& delIndex,
@@ -351,7 +350,7 @@ DeleteAccount::doApply()
std::shared_ptr<SLE>& sleItem) -> std::pair<TER, SkipEntry> {
if (auto deleter = nonObligationDeleter(nodeType))
{
TER const result{deleter(ctx_.app, view(), account_, dirEntry, sleItem, j_)};
TER const result{deleter(ctx_.registry, view(), account_, dirEntry, sleItem, j_)};
return {result, SkipEntry::No};
}

View File

@@ -1,9 +1,8 @@
#include <xrpld/app/tx/detail/DeleteOracle.h>
#include <xrpl/ledger/View.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/Rules.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/tx/transactors/DeleteOracle.h>
namespace xrpl {

View File

@@ -1,11 +1,10 @@
#include <xrpld/app/tx/detail/DepositPreauth.h>
#include <xrpl/basics/Log.h>
#include <xrpl/ledger/CredentialHelpers.h>
#include <xrpl/ledger/View.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/Indexes.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/tx/transactors/DepositPreauth.h>
#include <optional>
@@ -120,8 +119,9 @@ DepositPreauth::preclaim(PreclaimContext const& ctx)
else if (ctx.tx.isFieldPresent(sfUnauthorizeCredentials))
{
// Verify that the Preauth entry is in the ledger.
if (!ctx.view.exists(keylet::depositPreauth(
account, credentials::makeSorted(ctx.tx.getFieldArray(sfUnauthorizeCredentials)))))
if (!ctx.view.exists(
keylet::depositPreauth(
account, credentials::makeSorted(ctx.tx.getFieldArray(sfUnauthorizeCredentials)))))
return tecNO_ENTRY;
}
return tesSUCCESS;

View File

@@ -1,11 +1,8 @@
#include <xrpld/app/misc/HashRouter.h>
#include <xrpld/app/tx/detail/Escrow.h>
#include <xrpld/app/tx/detail/MPTokenAuthorize.h>
#include <xrpld/conditions/Condition.h>
#include <xrpld/conditions/Fulfillment.h>
#include <xrpl/basics/Log.h>
#include <xrpl/basics/chrono.h>
#include <xrpl/conditions/Condition.h>
#include <xrpl/conditions/Fulfillment.h>
#include <xrpl/core/HashRouter.h>
#include <xrpl/ledger/ApplyView.h>
#include <xrpl/ledger/CredentialHelpers.h>
#include <xrpl/ledger/View.h>
@@ -14,6 +11,8 @@
#include <xrpl/protocol/MPTAmount.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/protocol/XRPAmount.h>
#include <xrpl/tx/transactors/Escrow.h>
#include <xrpl/tx/transactors/MPT/MPTokenAuthorize.h>
namespace xrpl {
@@ -544,7 +543,7 @@ EscrowFinish::preflightSigValidated(PreflightContext const& ctx)
if (cb && fb)
{
auto& router = ctx.app.getHashRouter();
auto& router = ctx.registry.getHashRouter();
auto const id = ctx.tx.getTransactionID();
auto const flags = router.getFlags(id);
@@ -900,7 +899,7 @@ EscrowFinish::doApply()
// Check cryptocondition fulfillment
{
auto const id = ctx_.tx.getTransactionID();
auto flags = ctx_.app.getHashRouter().getFlags(id);
auto flags = ctx_.registry.getHashRouter().getFlags(id);
auto const cb = ctx_.tx[~sfCondition];
@@ -920,7 +919,7 @@ EscrowFinish::doApply()
else
flags = SF_CF_INVALID;
ctx_.app.getHashRouter().setFlags(id, flags);
ctx_.registry.getHashRouter().setFlags(id, flags);
// LCOV_EXCL_STOP
}

View File

@@ -1,10 +1,9 @@
#include <xrpld/app/tx/detail/LedgerStateFix.h>
#include <xrpld/app/tx/detail/NFTokenUtils.h>
#include <xrpl/ledger/View.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/Indexes.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/tx/transactors/LedgerStateFix.h>
#include <xrpl/tx/transactors/NFT/NFTokenUtils.h>
namespace xrpl {

View File

@@ -1,6 +1,6 @@
#include <xrpld/app/misc/LendingHelpers.h>
#include <xrpl/tx/transactors/Lending/LendingHelpers.h>
// DO NOT REMOVE forces header file include to sort first
#include <xrpld/app/tx/detail/VaultCreate.h>
#include <xrpl/tx/transactors/Vault/VaultCreate.h>
namespace xrpl {
@@ -328,23 +328,24 @@ doPayment(
"xrpl::detail::doPayment",
"fee outstanding stays valid");
return LoanPaymentParts{// Principal paid is straightforward - it's the tracked delta
.principalPaid = payment.trackedPrincipalDelta,
return LoanPaymentParts{
// Principal paid is straightforward - it's the tracked delta
.principalPaid = payment.trackedPrincipalDelta,
// Interest paid combines:
// 1. Tracked interest from the amortization schedule
// (derived from the tracked deltas)
// 2. Untracked interest (e.g., late payment penalties)
.interestPaid = payment.trackedInterestPart() + payment.untrackedInterest,
// Interest paid combines:
// 1. Tracked interest from the amortization schedule
// (derived from the tracked deltas)
// 2. Untracked interest (e.g., late payment penalties)
.interestPaid = payment.trackedInterestPart() + payment.untrackedInterest,
// Value change represents how the loan's total value changed beyond
// normal amortization.
.valueChange = payment.untrackedInterest,
// Value change represents how the loan's total value changed beyond
// normal amortization.
.valueChange = payment.untrackedInterest,
// Fee paid combines:
// 1. Tracked management fees from the amortization schedule
// 2. Untracked fees (e.g., late payment fees, service fees)
.feePaid = payment.trackedManagementFeeDelta + payment.untrackedManagementFee};
// Fee paid combines:
// 1. Tracked management fees from the amortization schedule
// 2. Untracked fees (e.g., late payment fees, service fees)
.feePaid = payment.trackedManagementFeeDelta + payment.untrackedManagementFee};
}
/* Simulates an overpayment to validate it won't break the loan's amortization.

View File

@@ -1,8 +1,7 @@
#include <xrpld/app/tx/detail/LoanBrokerCoverClawback.h>
#include <xrpl/tx/transactors/Lending/LoanBrokerCoverClawback.h>
//
#include <xrpld/app/misc/LendingHelpers.h>
#include <xrpl/protocol/STTakesAsset.h>
#include <xrpl/tx/transactors/Lending/LendingHelpers.h>
namespace xrpl {

View File

@@ -1,8 +1,7 @@
#include <xrpld/app/tx/detail/LoanBrokerCoverDeposit.h>
#include <xrpl/tx/transactors/Lending/LoanBrokerCoverDeposit.h>
//
#include <xrpld/app/misc/LendingHelpers.h>
#include <xrpl/protocol/STTakesAsset.h>
#include <xrpl/tx/transactors/Lending/LendingHelpers.h>
namespace xrpl {

View File

@@ -1,10 +1,9 @@
#include <xrpld/app/tx/detail/LoanBrokerCoverWithdraw.h>
#include <xrpl/tx/transactors/Lending/LoanBrokerCoverWithdraw.h>
//
#include <xrpld/app/misc/LendingHelpers.h>
#include <xrpld/app/tx/detail/Payment.h>
#include <xrpl/ledger/CredentialHelpers.h>
#include <xrpl/protocol/STTakesAsset.h>
#include <xrpl/tx/transactors/Lending/LendingHelpers.h>
#include <xrpl/tx/transactors/Payment.h>
namespace xrpl {

View File

@@ -1,8 +1,7 @@
#include <xrpld/app/tx/detail/LoanBrokerDelete.h>
#include <xrpl/tx/transactors/Lending/LoanBrokerDelete.h>
//
#include <xrpld/app/misc/LendingHelpers.h>
#include <xrpl/protocol/STTakesAsset.h>
#include <xrpl/tx/transactors/Lending/LendingHelpers.h>
namespace xrpl {

View File

@@ -1,8 +1,7 @@
#include <xrpld/app/tx/detail/LoanBrokerSet.h>
#include <xrpl/tx/transactors/Lending/LoanBrokerSet.h>
//
#include <xrpld/app/misc/LendingHelpers.h>
#include <xrpl/protocol/STTakesAsset.h>
#include <xrpl/tx/transactors/Lending/LendingHelpers.h>
namespace xrpl {

View File

@@ -1,8 +1,7 @@
#include <xrpld/app/tx/detail/LoanDelete.h>
#include <xrpl/tx/transactors/Lending/LoanDelete.h>
//
#include <xrpld/app/misc/LendingHelpers.h>
#include <xrpl/protocol/STTakesAsset.h>
#include <xrpl/tx/transactors/Lending/LendingHelpers.h>
namespace xrpl {

View File

@@ -1,9 +1,8 @@
#include <xrpld/app/tx/detail/LoanManage.h>
#include <xrpl/tx/transactors/Lending/LoanManage.h>
//
#include <xrpld/app/misc/LendingHelpers.h>
#include <xrpl/protocol/STTakesAsset.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/tx/transactors/Lending/LendingHelpers.h>
namespace xrpl {

View File

@@ -1,12 +1,11 @@
#include <xrpld/app/tx/detail/LoanPay.h>
#include <xrpl/tx/transactors/Lending/LoanPay.h>
//
#include <xrpld/app/misc/LendingHelpers.h>
#include <xrpld/app/tx/detail/LoanManage.h>
#include <xrpl/json/to_string.h>
#include <xrpl/protocol/Protocol.h>
#include <xrpl/protocol/STTakesAsset.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/tx/transactors/Lending/LendingHelpers.h>
#include <xrpl/tx/transactors/Lending/LoanManage.h>
#include <bit>

View File

@@ -1,9 +1,8 @@
#include <xrpld/app/tx/detail/LoanSet.h>
#include <xrpl/tx/transactors/Lending/LoanSet.h>
//
#include <xrpld/app/misc/LendingHelpers.h>
#include <xrpl/protocol/STTakesAsset.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/tx/transactors/Lending/LendingHelpers.h>
namespace xrpl {

View File

@@ -1,9 +1,8 @@
#include <xrpld/app/tx/detail/MPTokenAuthorize.h>
#include <xrpl/ledger/View.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/protocol/st.h>
#include <xrpl/tx/transactors/MPT/MPTokenAuthorize.h>
namespace xrpl {

View File

@@ -1,8 +1,7 @@
#include <xrpld/app/tx/detail/MPTokenIssuanceCreate.h>
#include <xrpl/ledger/View.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/tx/transactors/MPT/MPTokenIssuanceCreate.h>
namespace xrpl {

View File

@@ -1,8 +1,7 @@
#include <xrpld/app/tx/detail/MPTokenIssuanceDestroy.h>
#include <xrpl/ledger/View.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/tx/transactors/MPT/MPTokenIssuanceDestroy.h>
namespace xrpl {

View File

@@ -1,9 +1,8 @@
#include <xrpld/app/misc/DelegateUtils.h>
#include <xrpld/app/tx/detail/MPTokenIssuanceSet.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/LedgerFormats.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/tx/transactors/Delegate/DelegateUtils.h>
#include <xrpl/tx/transactors/MPT/MPTokenIssuanceSet.h>
namespace xrpl {

View File

@@ -1,10 +1,9 @@
#include <xrpld/app/tx/detail/NFTokenAcceptOffer.h>
#include <xrpld/app/tx/detail/NFTokenUtils.h>
#include <xrpl/ledger/View.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/Rate.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/tx/transactors/NFT/NFTokenAcceptOffer.h>
#include <xrpl/tx/transactors/NFT/NFTokenUtils.h>
namespace xrpl {

View File

@@ -1,9 +1,8 @@
#include <xrpld/app/tx/detail/NFTokenBurn.h>
#include <xrpld/app/tx/detail/NFTokenUtils.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/Protocol.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/tx/transactors/NFT/NFTokenBurn.h>
#include <xrpl/tx/transactors/NFT/NFTokenUtils.h>
namespace xrpl {

View File

@@ -1,9 +1,8 @@
#include <xrpld/app/tx/detail/NFTokenCancelOffer.h>
#include <xrpld/app/tx/detail/NFTokenUtils.h>
#include <xrpl/ledger/View.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/tx/transactors/NFT/NFTokenCancelOffer.h>
#include <xrpl/tx/transactors/NFT/NFTokenUtils.h>
#include <boost/endian/conversion.hpp>

View File

@@ -1,9 +1,8 @@
#include <xrpld/app/tx/detail/NFTokenCreateOffer.h>
#include <xrpld/app/tx/detail/NFTokenUtils.h>
#include <xrpl/ledger/View.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/tx/transactors/NFT/NFTokenCreateOffer.h>
#include <xrpl/tx/transactors/NFT/NFTokenUtils.h>
namespace xrpl {

View File

@@ -1,11 +1,10 @@
#include <xrpld/app/tx/detail/NFTokenMint.h>
#include <xrpl/basics/Expected.h>
#include <xrpl/ledger/View.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/InnerObjectFormats.h>
#include <xrpl/protocol/Rate.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/tx/transactors/NFT/NFTokenMint.h>
#include <boost/endian/conversion.hpp>

View File

@@ -1,8 +1,7 @@
#include <xrpld/app/tx/detail/NFTokenModify.h>
#include <xrpld/app/tx/detail/NFTokenUtils.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/tx/transactors/NFT/NFTokenModify.h>
#include <xrpl/tx/transactors/NFT/NFTokenUtils.h>
namespace xrpl {

View File

@@ -1,5 +1,3 @@
#include <xrpld/app/tx/detail/NFTokenUtils.h>
#include <xrpl/basics/algorithm.h>
#include <xrpl/ledger/Dir.h>
#include <xrpl/ledger/View.h>
@@ -7,6 +5,7 @@
#include <xrpl/protocol/STArray.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/protocol/nftPageMask.h>
#include <xrpl/tx/transactors/NFT/NFTokenUtils.h>
#include <functional>
#include <memory>

View File

@@ -1,8 +1,7 @@
#include <xrpld/app/tx/detail/CancelOffer.h>
#include <xrpl/basics/Log.h>
#include <xrpl/ledger/View.h>
#include <xrpl/protocol/st.h>
#include <xrpl/tx/transactors/Offer/CancelOffer.h>
namespace xrpl {
@@ -54,7 +53,7 @@ CancelOffer::doApply()
if (auto sleOffer = view().peek(keylet::offer(account_, offerSequence)))
{
JLOG(j_.debug()) << "Trying to cancel offer #" << offerSequence;
return offerDelete(view(), sleOffer, ctx_.app.journal("View"));
return offerDelete(view(), sleOffer, ctx_.registry.journal("View"));
}
JLOG(j_.debug()) << "Offer #" << offerSequence << " can't be found.";

View File

@@ -1,16 +1,15 @@
#include <xrpld/app/ledger/OrderBookDB.h>
#include <xrpld/app/misc/PermissionedDEXHelpers.h>
#include <xrpld/app/paths/Flow.h>
#include <xrpld/app/tx/detail/CreateOffer.h>
#include <xrpl/basics/base_uint.h>
#include <xrpl/beast/utility/WrappedSink.h>
#include <xrpl/ledger/OrderBookDB.h>
#include <xrpl/ledger/PaymentSandbox.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/STAmount.h>
#include <xrpl/protocol/TER.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/protocol/st.h>
#include <xrpl/tx/paths/Flow.h>
#include <xrpl/tx/transactors/Offer/CreateOffer.h>
#include <xrpl/tx/transactors/PermissionedDEXHelpers.h>
namespace xrpl {
TxConsequences
@@ -144,7 +143,7 @@ CreateOffer::preclaim(PreclaimContext const& ctx)
std::uint32_t const uAccountSequence = sleCreator->getFieldU32(sfSequence);
auto viewJ = ctx.app.journal("View");
auto viewJ = ctx.registry.journal("View");
if (isGlobalFrozen(ctx.view, uPaysIssuerID) || isGlobalFrozen(ctx.view, uGetsIssuerID))
{
@@ -489,7 +488,7 @@ CreateOffer::applyHybrid(
bookArr.push_back(std::move(bookInfo));
if (!bookExists)
ctx_.app.getOrderBookDB().addOrderBook(book);
ctx_.registry.getOrderBookDB().addOrderBook(book);
sleOffer->setFieldArray(sfAdditionalBooks, bookArr);
return tesSUCCESS;
@@ -523,7 +522,7 @@ CreateOffer::applyGuts(Sandbox& sb, Sandbox& sbCancel)
// end up on the books.
auto uRate = getRate(saTakerGets, saTakerPays);
auto viewJ = ctx_.app.journal("View");
auto viewJ = ctx_.registry.journal("View");
TER result = tesSUCCESS;
@@ -825,7 +824,7 @@ CreateOffer::applyGuts(Sandbox& sb, Sandbox& sbCancel)
sb.insert(sleOffer);
if (!bookExisted)
ctx_.app.getOrderBookDB().addOrderBook(book);
ctx_.registry.getOrderBookDB().addOrderBook(book);
JLOG(j_.debug()) << "final result: success";

View File

@@ -1,5 +1,3 @@
#include <xrpld/app/tx/detail/PayChan.h>
#include <xrpl/basics/Log.h>
#include <xrpl/basics/chrono.h>
#include <xrpl/ledger/ApplyView.h>
@@ -12,6 +10,7 @@
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/protocol/XRPAmount.h>
#include <xrpl/protocol/digest.h>
#include <xrpl/tx/transactors/PayChan.h>
namespace xrpl {
@@ -310,7 +309,7 @@ PayChanFund::doApply()
auto const cancelAfter = (*slep)[~sfCancelAfter];
auto const closeTime = ctx_.view().header().parentCloseTime.time_since_epoch().count();
if ((cancelAfter && closeTime >= *cancelAfter) || (expiration && closeTime >= *expiration))
return closeChannel(slep, ctx_.view(), k.key, ctx_.app.journal("View"));
return closeChannel(slep, ctx_.view(), k.key, ctx_.registry.journal("View"));
}
if (src != txAccount)
@@ -456,7 +455,7 @@ PayChanClaim::doApply()
auto const cancelAfter = (*slep)[~sfCancelAfter];
auto const closeTime = ctx_.view().header().parentCloseTime.time_since_epoch().count();
if ((cancelAfter && closeTime >= *cancelAfter) || (curExpiration && closeTime >= *curExpiration))
return closeChannel(slep, ctx_.view(), k.key, ctx_.app.journal("View"));
return closeChannel(slep, ctx_.view(), k.key, ctx_.registry.journal("View"));
}
if (txAccount != src && txAccount != dst)
@@ -513,7 +512,7 @@ PayChanClaim::doApply()
{
// Channel will close immediately if dry or the receiver closes
if (dst == txAccount || (*slep)[sfBalance] == (*slep)[sfAmount])
return closeChannel(slep, ctx_.view(), k.key, ctx_.app.journal("View"));
return closeChannel(slep, ctx_.view(), k.key, ctx_.registry.journal("View"));
auto const settleExpiration =
ctx_.view().header().parentCloseTime.time_since_epoch().count() + (*slep)[sfSettleDelay];

View File

@@ -1,8 +1,3 @@
#include <xrpld/app/misc/DelegateUtils.h>
#include <xrpld/app/misc/PermissionedDEXHelpers.h>
#include <xrpld/app/paths/RippleCalc.h>
#include <xrpld/app/tx/detail/Payment.h>
#include <xrpl/basics/Log.h>
#include <xrpl/ledger/CredentialHelpers.h>
#include <xrpl/ledger/View.h>
@@ -10,6 +5,10 @@
#include <xrpl/protocol/Quality.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/protocol/jss.h>
#include <xrpl/tx/paths/RippleCalc.h>
#include <xrpl/tx/transactors/Delegate/DelegateUtils.h>
#include <xrpl/tx/transactors/Payment.h>
#include <xrpl/tx/transactors/PermissionedDEXHelpers.h>
namespace xrpl {
@@ -414,7 +413,7 @@ Payment::doApply()
account_,
ctx_.tx.getFieldPathSet(sfPaths),
ctx_.tx[~sfDomainID],
ctx_.app.logs(),
ctx_.registry.logs(),
&rcInput);
// VFALCO NOTE We might not need to apply, depending
// on the TER. But always applying *should*

View File

@@ -1,6 +1,5 @@
#include <xrpld/app/misc/PermissionedDEXHelpers.h>
#include <xrpl/ledger/CredentialHelpers.h>
#include <xrpl/tx/transactors/PermissionedDEXHelpers.h>
namespace xrpl {
namespace permissioned_dex {

View File

@@ -1,7 +1,6 @@
#include <xrpld/app/tx/detail/PermissionedDomainDelete.h>
#include <xrpl/ledger/View.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/tx/transactors/PermissionedDomain/PermissionedDomainDelete.h>
namespace xrpl {

View File

@@ -1,9 +1,8 @@
#include <xrpld/app/tx/detail/PermissionedDomainSet.h>
#include <xrpl/ledger/CredentialHelpers.h>
#include <xrpl/ledger/View.h>
#include <xrpl/protocol/STObject.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/tx/transactors/PermissionedDomain/PermissionedDomainSet.h>
#include <optional>

View File

@@ -1,7 +1,3 @@
#include <xrpld/app/misc/DelegateUtils.h>
#include <xrpld/app/tx/detail/SetAccount.h>
#include <xrpld/core/Config.h>
#include <xrpl/basics/Log.h>
#include <xrpl/ledger/View.h>
#include <xrpl/protocol/Feature.h>
@@ -9,6 +5,8 @@
#include <xrpl/protocol/PublicKey.h>
#include <xrpl/protocol/Quality.h>
#include <xrpl/protocol/st.h>
#include <xrpl/tx/transactors/Delegate/DelegateUtils.h>
#include <xrpl/tx/transactors/SetAccount.h>
namespace xrpl {

View File

@@ -1,11 +1,10 @@
#include <xrpld/app/tx/detail/SetOracle.h>
#include <xrpl/ledger/Sandbox.h>
#include <xrpl/ledger/View.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/InnerObjectFormats.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/protocol/digest.h>
#include <xrpl/tx/transactors/SetOracle.h>
namespace xrpl {

View File

@@ -1,8 +1,7 @@
#include <xrpld/app/tx/detail/SetRegularKey.h>
#include <xrpl/basics/Log.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/tx/transactors/SetRegularKey.h>
namespace xrpl {
@@ -47,7 +46,7 @@ SetRegularKey::doApply()
if (!sle)
return tefINTERNAL; // LCOV_EXCL_LINE
if (!minimumFee(ctx_.app, ctx_.baseFee, view().fees(), view().flags()))
if (!minimumFee(ctx_.registry, ctx_.baseFee, view().fees(), view().flags()))
sle->setFlag(lsfPasswordSpent);
if (ctx_.tx.isFieldPresent(sfRegularKey))

View File

@@ -1,14 +1,13 @@
#include <xrpld/app/ledger/Ledger.h>
#include <xrpld/app/tx/detail/SetSignerList.h>
#include <xrpl/basics/Log.h>
#include <xrpl/ledger/ApplyView.h>
#include <xrpl/ledger/View.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/Indexes.h>
#include <xrpl/protocol/STArray.h>
#include <xrpl/protocol/STObject.h>
#include <xrpl/protocol/STTx.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/tx/transactors/SetSignerList.h>
#include <algorithm>
#include <cstdint>
@@ -151,7 +150,7 @@ signerCountBasedOwnerCountDelta(std::size_t entryCount, Rules const& rules)
static TER
removeSignersFromLedger(
Application& app,
ServiceRegistry& registry,
ApplyView& view,
Keylet const& accountKeylet,
Keylet const& ownerDirKeylet,
@@ -187,7 +186,7 @@ removeSignersFromLedger(
// LCOV_EXCL_STOP
}
adjustOwnerCount(view, view.peek(accountKeylet), removeFromOwnerCount, app.journal("View"));
adjustOwnerCount(view, view.peek(accountKeylet), removeFromOwnerCount, registry.journal("View"));
view.erase(signers);
@@ -195,13 +194,13 @@ removeSignersFromLedger(
}
TER
SetSignerList::removeFromLedger(Application& app, ApplyView& view, AccountID const& account, beast::Journal j)
SetSignerList::removeFromLedger(ServiceRegistry& registry, ApplyView& view, AccountID const& account, beast::Journal j)
{
auto const accountKeylet = keylet::account(account);
auto const ownerDirKeylet = keylet::ownerDir(account);
auto const signerListKeylet = keylet::signers(account);
return removeSignersFromLedger(app, view, accountKeylet, ownerDirKeylet, signerListKeylet, j);
return removeSignersFromLedger(registry, view, accountKeylet, ownerDirKeylet, signerListKeylet, j);
}
NotTEC
@@ -273,7 +272,8 @@ SetSignerList::replaceSignerList()
// This may be either a create or a replace. Preemptively remove any
// old signer list. May reduce the reserve, so this is done before
// checking the reserve.
if (TER const ter = removeSignersFromLedger(ctx_.app, view(), accountKeylet, ownerDirKeylet, signerListKeylet, j_))
if (TER const ter =
removeSignersFromLedger(ctx_.registry, view(), accountKeylet, ownerDirKeylet, signerListKeylet, j_))
return ter;
auto const sle = view().peek(accountKeylet);
@@ -299,7 +299,7 @@ SetSignerList::replaceSignerList()
view().insert(signerList);
writeSignersToSLE(signerList, flags);
auto viewJ = ctx_.app.journal("View");
auto viewJ = ctx_.registry.journal("View");
// Add the signer list to the account's directory.
auto const page = ctx_.view().dirInsert(ownerDirKeylet, signerListKeylet, describeOwnerDir(account_));
@@ -332,7 +332,7 @@ SetSignerList::destroySignerList()
auto const ownerDirKeylet = keylet::ownerDir(account_);
auto const signerListKeylet = keylet::signers(account_);
return removeSignersFromLedger(ctx_.app, view(), accountKeylet, ownerDirKeylet, signerListKeylet, j_);
return removeSignersFromLedger(ctx_.registry, view(), accountKeylet, ownerDirKeylet, signerListKeylet, j_);
}
void

View File

@@ -1,6 +1,3 @@
#include <xrpld/app/misc/DelegateUtils.h>
#include <xrpld/app/tx/detail/SetTrust.h>
#include <xrpl/basics/Log.h>
#include <xrpl/ledger/View.h>
#include <xrpl/protocol/AMMCore.h>
@@ -9,6 +6,8 @@
#include <xrpl/protocol/Quality.h>
#include <xrpl/protocol/SField.h>
#include <xrpl/protocol/TER.h>
#include <xrpl/tx/transactors/Delegate/DelegateUtils.h>
#include <xrpl/tx/transactors/SetTrust.h>
namespace {
@@ -352,7 +351,7 @@ SetTrust::doApply()
bool const bSetDeepFreeze = (uTxFlags & tfSetDeepFreeze);
bool const bClearDeepFreeze = (uTxFlags & tfClearDeepFreeze);
auto viewJ = ctx_.app.journal("View");
auto viewJ = ctx_.registry.journal("View");
SLE::pointer sleDst = view().peek(keylet::account(uDstAccountID));

View File

@@ -1,5 +1,3 @@
#include <xrpld/app/tx/detail/VaultClawback.h>
//
#include <xrpl/beast/utility/instrumentation.h>
#include <xrpl/ledger/View.h>
#include <xrpl/protocol/AccountID.h>
@@ -9,6 +7,8 @@
#include <xrpl/protocol/STNumber.h>
#include <xrpl/protocol/STTakesAsset.h>
#include <xrpl/protocol/TER.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/tx/transactors/Vault/VaultClawback.h>
#include <optional>

View File

@@ -1,7 +1,3 @@
#include <xrpld/app/tx/detail/MPTokenAuthorize.h>
#include <xrpld/app/tx/detail/MPTokenIssuanceCreate.h>
#include <xrpld/app/tx/detail/VaultCreate.h>
#include <xrpl/ledger/View.h>
#include <xrpl/protocol/Asset.h>
#include <xrpl/protocol/Feature.h>
@@ -14,6 +10,9 @@
#include <xrpl/protocol/STTakesAsset.h>
#include <xrpl/protocol/TER.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/tx/transactors/MPT/MPTokenAuthorize.h>
#include <xrpl/tx/transactors/MPT/MPTokenIssuanceCreate.h>
#include <xrpl/tx/transactors/Vault/VaultCreate.h>
namespace xrpl {

View File

@@ -1,5 +1,3 @@
#include <xrpld/app/tx/detail/VaultDelete.h>
#include <xrpl/ledger/View.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/MPTIssue.h>
@@ -7,6 +5,7 @@
#include <xrpl/protocol/STTakesAsset.h>
#include <xrpl/protocol/TER.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/tx/transactors/Vault/VaultDelete.h>
namespace xrpl {

View File

@@ -1,6 +1,3 @@
#include <xrpld/app/tx/detail/MPTokenAuthorize.h>
#include <xrpld/app/tx/detail/VaultDeposit.h>
#include <xrpl/ledger/CredentialHelpers.h>
#include <xrpl/ledger/View.h>
#include <xrpl/protocol/Feature.h>
@@ -12,6 +9,8 @@
#include <xrpl/protocol/STTakesAsset.h>
#include <xrpl/protocol/TER.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/tx/transactors/MPT/MPTokenAuthorize.h>
#include <xrpl/tx/transactors/Vault/VaultDeposit.h>
namespace xrpl {

View File

@@ -1,5 +1,3 @@
#include <xrpld/app/tx/detail/VaultSet.h>
#include <xrpl/ledger/View.h>
#include <xrpl/protocol/Asset.h>
#include <xrpl/protocol/Feature.h>
@@ -9,6 +7,7 @@
#include <xrpl/protocol/STTakesAsset.h>
#include <xrpl/protocol/TER.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/tx/transactors/Vault/VaultSet.h>
namespace xrpl {

View File

@@ -1,5 +1,3 @@
#include <xrpld/app/tx/detail/VaultWithdraw.h>
#include <xrpl/ledger/CredentialHelpers.h>
#include <xrpl/ledger/View.h>
#include <xrpl/protocol/AccountID.h>
@@ -9,6 +7,7 @@
#include <xrpl/protocol/STTakesAsset.h>
#include <xrpl/protocol/TER.h>
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/tx/transactors/Vault/VaultWithdraw.h>
namespace xrpl {

View File

@@ -1,8 +1,3 @@
#include <xrpld/app/paths/Flow.h>
#include <xrpld/app/tx/detail/SignerEntries.h>
#include <xrpld/app/tx/detail/Transactor.h>
#include <xrpld/app/tx/detail/XChainBridge.h>
#include <xrpl/basics/Log.h>
#include <xrpl/basics/Number.h>
#include <xrpl/basics/chrono.h>
@@ -23,6 +18,10 @@
#include <xrpl/protocol/TxFlags.h>
#include <xrpl/protocol/XChainAttestations.h>
#include <xrpl/protocol/XRPAmount.h>
#include <xrpl/tx/SignerEntries.h>
#include <xrpl/tx/Transactor.h>
#include <xrpl/tx/paths/Flow.h>
#include <xrpl/tx/transactors/XChainBridge.h>
#include <unordered_map>
#include <unordered_set>
@@ -556,7 +555,7 @@ struct FinalizeClaimHelperResult
the fields mean. The individual ters need to be returned instead of
an overall ter because the caller needs this information if the
attestation list changed or not.
*/
*/
FinalizeClaimHelperResult
finalizeClaimHelper(

View File

@@ -1,8 +1,7 @@
#include <test/jtx.h>
#include <xrpld/app/misc/AMMHelpers.h>
#include <xrpl/protocol/Quality.h>
#include <xrpl/tx/transactors/AMM/AMMHelpers.h>
#include <boost/regex.hpp>
@@ -23,8 +22,8 @@ class AMMCalc_test : public beast::unit_test::suite
{
using token_iter = boost::sregex_token_iterator;
using steps = std::vector<std::pair<Amounts, bool>>;
using trates = std::map<std::string, std::uint32_t>;
using swapargs = std::tuple<steps, STAmount, trates, std::uint32_t>;
using transfer_rates = std::map<std::string, std::uint32_t>;
using swapargs = std::tuple<steps, STAmount, transfer_rates, std::uint32_t>;
jtx::Account const gw{jtx::Account("gw")};
token_iter const end_;
@@ -101,10 +100,10 @@ class AMMCalc_test : public beast::unit_test::suite
return {{{*a1, *a2}, amm}};
}
std::optional<trates>
std::optional<transfer_rates>
getTransferRate(token_iter& p)
{
trates rates{};
transfer_rates rates{};
if (p == end_)
return rates;
std::string str = *p;
@@ -115,8 +114,8 @@ class AMMCalc_test : public beast::unit_test::suite
{
if (auto const rate = getRate(p++))
{
auto const [currency, trate, delimited] = *rate;
rates[currency] = trate;
auto const [currency, transferRate, delimited] = *rate;
rates[currency] = transferRate;
if (delimited)
break;
}
@@ -180,13 +179,13 @@ class AMMCalc_test : public beast::unit_test::suite
auto const vp = std::get<steps>(args);
STAmount sout = std::get<STAmount>(args);
auto const fee = std::get<std::uint32_t>(args);
auto const rates = std::get<trates>(args);
auto const rates = std::get<transfer_rates>(args);
STAmount resultOut = sout;
STAmount resultIn{};
STAmount sin{};
int limitingStep = vp.size();
STAmount limitStepOut{};
auto trate = [&](auto const& amt) {
auto transferRate = [&](auto const& amt) {
auto const currency = to_string(amt.issue().currency);
return rates.find(currency) != rates.end() ? rates.at(currency) : QUALITY_ONE;
};
@@ -194,7 +193,7 @@ class AMMCalc_test : public beast::unit_test::suite
sin = sout;
for (auto it = vp.rbegin(); it != vp.rend(); ++it)
{
sout = mulratio(sin, trate(sin), QUALITY_ONE, true);
sout = mulratio(sin, transferRate(sin), QUALITY_ONE, true);
auto const [amts, amm] = *it;
// assume no amm limit
if (amm)
@@ -221,7 +220,7 @@ class AMMCalc_test : public beast::unit_test::suite
for (int i = limitingStep + 1; i < vp.size(); ++i)
{
auto const [amts, amm] = vp[i];
sin = mulratio(sin, QUALITY_ONE, trate(sin), false);
sin = mulratio(sin, QUALITY_ONE, transferRate(sin), false);
if (amm)
{
sout = swapAssetIn(amts, sin, fee);
@@ -243,13 +242,13 @@ class AMMCalc_test : public beast::unit_test::suite
auto const vp = std::get<steps>(args);
STAmount sin = std::get<STAmount>(args);
auto const fee = std::get<std::uint32_t>(args);
auto const rates = std::get<trates>(args);
auto const rates = std::get<transfer_rates>(args);
STAmount resultIn = sin;
STAmount resultOut{};
STAmount sout{};
int limitingStep = 0;
STAmount limitStepIn{};
auto trate = [&](auto const& amt) {
auto transferRate = [&](auto const& amt) {
auto const currency = to_string(amt.issue().currency);
return rates.find(currency) != rates.end() ? rates.at(currency) : QUALITY_ONE;
};
@@ -257,7 +256,7 @@ class AMMCalc_test : public beast::unit_test::suite
for (auto it = vp.begin(); it != vp.end(); ++it)
{
auto const [amts, amm] = *it;
sin = mulratio(sin, QUALITY_ONE, trate(sin),
sin = mulratio(sin, QUALITY_ONE, transferRate(sin),
false); // out of the next step
// assume no amm limit
if (amm)
@@ -283,7 +282,7 @@ class AMMCalc_test : public beast::unit_test::suite
// swap out if limiting step
for (int i = limitingStep - 1; i >= 0; --i)
{
sout = mulratio(sin, trate(sin), QUALITY_ONE, false);
sout = mulratio(sin, transferRate(sin), QUALITY_ONE, false);
auto const [amts, amm] = vp[i];
if (amm)
{
@@ -296,7 +295,7 @@ class AMMCalc_test : public beast::unit_test::suite
}
resultIn = sin;
}
resultOut = mulratio(resultOut, QUALITY_ONE, trate(resultOut), true);
resultOut = mulratio(resultOut, QUALITY_ONE, transferRate(resultOut), true);
std::cout << "in: " << toString(resultIn) << " out: " << toString(resultOut) << std::endl;
}

View File

@@ -2,9 +2,8 @@
#include <test/jtx/AMM.h>
#include <test/jtx/CaptureLogs.h>
#include <xrpld/app/misc/AMMUtils.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/tx/transactors/AMM/AMMUtils.h>
namespace xrpl {
namespace test {

Some files were not shown because too many files have changed in this diff Show More