From b978001a89f4c0aba0d3bfef05cbf9986f42b116 Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Thu, 30 Apr 2026 15:21:42 -0400 Subject: [PATCH] rename keylet::line -> keylet::rippleState --- include/xrpl/ledger/helpers/EscrowHelpers.h | 2 +- include/xrpl/protocol/Indexes.h | 4 +- .../xrpl/protocol/detail/ledger_entries.macro | 2 +- include/xrpl/tx/paths/detail/StepChecks.h | 6 +- src/libxrpl/ledger/helpers/AMMHelpers.cpp | 4 +- src/libxrpl/ledger/helpers/NFTokenHelpers.cpp | 9 +-- .../ledger/helpers/RippleStateHelpers.cpp | 22 +++---- src/libxrpl/ledger/helpers/TokenHelpers.cpp | 4 +- src/libxrpl/protocol/Indexes.cpp | 4 +- src/libxrpl/tx/invariants/VaultInvariant.cpp | 3 +- src/libxrpl/tx/paths/BookStep.cpp | 2 +- src/libxrpl/tx/paths/DirectStep.cpp | 4 +- src/libxrpl/tx/paths/XRPEndpointStep.cpp | 2 +- .../tx/transactors/check/CheckCash.cpp | 4 +- .../tx/transactors/check/CheckCreate.cpp | 4 +- src/libxrpl/tx/transactors/dex/AMMCreate.cpp | 5 +- src/libxrpl/tx/transactors/dex/AMMDeposit.cpp | 5 +- .../tx/transactors/dex/AMMWithdraw.cpp | 2 +- .../tx/transactors/dex/OfferCreate.cpp | 5 +- .../tx/transactors/escrow/EscrowCreate.cpp | 2 +- .../tx/transactors/nft/NFTokenAcceptOffer.cpp | 2 +- src/libxrpl/tx/transactors/token/Clawback.cpp | 2 +- src/libxrpl/tx/transactors/token/TrustSet.cpp | 14 ++-- src/test/app/Check_test.cpp | 64 +++++++++---------- src/test/app/Clawback_test.cpp | 2 +- src/test/app/Flow_test.cpp | 2 +- src/test/app/Invariants_test.cpp | 27 ++++---- src/test/app/Loan_test.cpp | 9 +-- src/test/app/NFTokenAuth_test.cpp | 12 ++-- src/test/app/Offer_test.cpp | 10 +-- src/test/app/Path_test.cpp | 12 ++-- src/test/app/PayStrand_test.cpp | 4 +- src/test/app/SetAuth_test.cpp | 2 +- src/test/app/Vault_test.cpp | 4 +- src/test/jtx/impl/Env.cpp | 4 +- src/test/jtx/impl/TestHelpers.cpp | 4 +- src/test/jtx/impl/balance.cpp | 2 +- src/tests/libxrpl/helpers/TxTest.cpp | 2 +- src/xrpld/rpc/detail/Pathfinder.cpp | 2 +- src/xrpld/rpc/handlers/ledger/LedgerEntry.cpp | 2 +- 40 files changed, 147 insertions(+), 130 deletions(-) diff --git a/include/xrpl/ledger/helpers/EscrowHelpers.h b/include/xrpl/ledger/helpers/EscrowHelpers.h index b44601594d..06a2ee0a90 100644 --- a/include/xrpl/ledger/helpers/EscrowHelpers.h +++ b/include/xrpl/ledger/helpers/EscrowHelpers.h @@ -42,7 +42,7 @@ escrowUnlockApplyHelper( beast::Journal journal) { Issue const& issue = amount.get(); - Keylet const trustLineKey = keylet::line(receiver, issue); + Keylet const trustLineKey = keylet::rippleState(receiver, issue); bool const recvLow = issuer > receiver; bool const senderIssuer = issuer == sender; bool const receiverIssuer = issuer == receiver; diff --git a/include/xrpl/protocol/Indexes.h b/include/xrpl/protocol/Indexes.h index f4dd5e6816..681faab7a3 100644 --- a/include/xrpl/protocol/Indexes.h +++ b/include/xrpl/protocol/Indexes.h @@ -93,10 +93,10 @@ static book_t const book{}; */ /** @{ */ Keylet -line(AccountID const& id0, AccountID const& id1, Currency const& currency) noexcept; +rippleState(AccountID const& id0, AccountID const& id1, Currency const& currency) noexcept; inline Keylet -line(AccountID const& id, Issue const& issue) noexcept +rippleState(AccountID const& id, Issue const& issue) noexcept { return line(id, issue.account, issue.currency); } diff --git a/include/xrpl/protocol/detail/ledger_entries.macro b/include/xrpl/protocol/detail/ledger_entries.macro index 93cef79ef7..20289a42aa 100644 --- a/include/xrpl/protocol/detail/ledger_entries.macro +++ b/include/xrpl/protocol/detail/ledger_entries.macro @@ -272,7 +272,7 @@ LEDGER_ENTRY(ltXCHAIN_OWNED_CLAIM_ID, 0x0071, XChainOwnedClaimID, xchain_owned_c @note Per Vinnie Falco this should be renamed to ltTRUST_LINE - \sa keylet::line + \sa keylet::rippleState */ LEDGER_ENTRY(ltRIPPLE_STATE, 0x0072, RippleState, state, ({ {sfBalance, soeREQUIRED}, diff --git a/include/xrpl/tx/paths/detail/StepChecks.h b/include/xrpl/tx/paths/detail/StepChecks.h index a1e6490781..9cb19f4071 100644 --- a/include/xrpl/tx/paths/detail/StepChecks.h +++ b/include/xrpl/tx/paths/detail/StepChecks.h @@ -27,7 +27,7 @@ checkFreeze( } } - if (auto sle = view.read(keylet::line(src, dst, currency))) + if (auto sle = view.read(keylet::rippleState(src, dst, currency))) { if (sle->isFlag((dst > src) ? lsfHighFreeze : lsfLowFreeze)) { @@ -71,8 +71,8 @@ checkNoRipple( beast::Journal j) { // fetch the ripple lines into and out of this node - auto sleIn = view.read(keylet::line(prev, cur, currency)); - auto sleOut = view.read(keylet::line(cur, next, currency)); + auto sleIn = view.read(keylet::rippleState(prev, cur, currency)); + auto sleOut = view.read(keylet::rippleState(cur, next, currency)); if (!sleIn || !sleOut) return terNO_LINE; diff --git a/src/libxrpl/ledger/helpers/AMMHelpers.cpp b/src/libxrpl/ledger/helpers/AMMHelpers.cpp index cc91dcaaf4..87e9fe3325 100644 --- a/src/libxrpl/ledger/helpers/AMMHelpers.cpp +++ b/src/libxrpl/ledger/helpers/AMMHelpers.cpp @@ -519,7 +519,7 @@ ammLPHolds( auto const currency = ammLPTCurrency(asset1, asset2); STAmount amount; - auto const sle = view.read(keylet::line(lpAccount, ammAccount, currency)); + auto const sle = view.read(keylet::rippleState(lpAccount, ammAccount, currency)); if (!sle) { amount.clear(Issue{currency, ammAccount}); @@ -611,7 +611,7 @@ ammAccountHolds(ReadView const& view, AccountID const& ammAccountID, Asset const } else if ( auto const sle = - view.read(keylet::line(ammAccountID, issue.account, issue.currency)); + view.read(keylet::rippleState(ammAccountID, issue.account, issue.currency)); sle && !isFrozen(view, ammAccountID, issue.currency, issue.account)) { STAmount amount = (*sle)[sfBalance]; diff --git a/src/libxrpl/ledger/helpers/NFTokenHelpers.cpp b/src/libxrpl/ledger/helpers/NFTokenHelpers.cpp index f57294a855..ea2d025b00 100644 --- a/src/libxrpl/ledger/helpers/NFTokenHelpers.cpp +++ b/src/libxrpl/ledger/helpers/NFTokenHelpers.cpp @@ -842,10 +842,10 @@ tokenOfferCreatePreclaim( if (view.rules().enabled(featureNFTokenMintOffer)) { if (nftIssuer != amount.getIssuer() && - !view.read(keylet::line(nftIssuer, amount.get()))) + !view.read(keylet::rippleState(nftIssuer, amount.get()))) return tecNO_LINE; } - else if (!view.exists(keylet::line(nftIssuer, amount.get()))) + else if (!view.exists(keylet::rippleState(nftIssuer, amount.get()))) { return tecNO_LINE; } @@ -1023,7 +1023,8 @@ checkTrustlineAuthorized( if (issuerAccount->isFlag(lsfRequireAuth)) { - auto const trustLine = view.read(keylet::line(id, issue.account, issue.currency)); + auto const trustLine = + view.read(keylet::rippleState(id, issue.account, issue.currency)); if (!trustLine) { @@ -1073,7 +1074,7 @@ checkTrustlineDeepFrozen( return tesSUCCESS; } - auto const trustLine = view.read(keylet::line(id, issue.account, issue.currency)); + auto const trustLine = view.read(keylet::rippleState(id, issue.account, issue.currency)); if (!trustLine) { diff --git a/src/libxrpl/ledger/helpers/RippleStateHelpers.cpp b/src/libxrpl/ledger/helpers/RippleStateHelpers.cpp index f5a5c01060..97c04d766b 100644 --- a/src/libxrpl/ledger/helpers/RippleStateHelpers.cpp +++ b/src/libxrpl/ledger/helpers/RippleStateHelpers.cpp @@ -47,7 +47,7 @@ creditLimit( { STAmount result(Issue{currency, account}); - auto sleRippleState = view.read(keylet::line(account, issuer, currency)); + auto sleRippleState = view.read(keylet::rippleState(account, issuer, currency)); if (sleRippleState) { @@ -78,7 +78,7 @@ creditBalance( { STAmount result(Issue{currency, account}); - auto sleRippleState = view.read(keylet::line(account, issuer, currency)); + auto sleRippleState = view.read(keylet::rippleState(account, issuer, currency)); if (sleRippleState) { @@ -114,7 +114,7 @@ isIndividualFrozen( if (issuer != account) { // Check if the issuer froze the line - auto const sle = view.read(keylet::line(account, issuer, currency)); + auto const sle = view.read(keylet::rippleState(account, issuer, currency)); if (sle && sle->isFlag((issuer > account) ? lsfHighFreeze : lsfLowFreeze)) return true; } @@ -138,7 +138,7 @@ isFrozen( if (issuer != account) { // Check if the issuer froze the line - sle = view.read(keylet::line(account, issuer, currency)); + sle = view.read(keylet::rippleState(account, issuer, currency)); if (sle && sle->isFlag((issuer > account) ? lsfHighFreeze : lsfLowFreeze)) return true; } @@ -162,7 +162,7 @@ isDeepFrozen( return false; } - auto const sle = view.read(keylet::line(account, issuer, currency)); + auto const sle = view.read(keylet::rippleState(account, issuer, currency)); if (!sle) { return false; @@ -401,7 +401,7 @@ issueIOU( bool const bSenderHigh = issue.account > account; - auto const index = keylet::line(issue.account, account, issue.currency); + auto const index = keylet::rippleState(issue.account, account, issue.currency); if (auto state = view.peek(index)) { @@ -495,7 +495,7 @@ redeemIOU( bool const bSenderHigh = account > issue.account; - if (auto state = view.peek(keylet::line(account, issue.account, issue.currency))) + if (auto state = view.peek(keylet::rippleState(account, issue.account, issue.currency))) { STAmount final_balance = state->getFieldAmount(sfBalance); @@ -556,7 +556,7 @@ requireAuth(ReadView const& view, Issue const& issue, AccountID const& account, if (isXRP(issue) || issue.account == account) return tesSUCCESS; - auto const trustLine = view.read(keylet::line(account, issue.account, issue.currency)); + auto const trustLine = view.read(keylet::rippleState(account, issue.account, issue.currency)); // If account has no line, and this is a strong check, fail if (!trustLine && authType == AuthType::StrongAuth) return tecNO_LINE; @@ -595,7 +595,7 @@ canTransfer(ReadView const& view, Issue const& issue, AccountID const& from, Acc auto const isRippleDisabled = [&](AccountID account) -> bool { // Line might not exist, but some transfers can create it. If this // is the case, just check the default ripple on the issuer account. - auto const line = view.read(keylet::line(account, issue)); + auto const line = view.read(keylet::rippleState(account, issue)); if (line) { bool const issuerHigh = issuerId > account; @@ -637,7 +637,7 @@ addEmptyHolding( auto const& srcId = issuerId; auto const& dstId = accountID; auto const high = srcId > dstId; - auto const index = keylet::line(srcId, dstId, currency); + auto const index = keylet::rippleState(srcId, dstId, currency); auto const sleSrc = view.peek(keylet::account(srcId)); auto const sleDst = view.peek(keylet::account(dstId)); if (!sleDst || !sleSrc) @@ -695,7 +695,7 @@ removeEmptyHolding( // If the account is the issuer, then no line should exist. Check anyway. // If a line does exist, it will get deleted. If not, return success. bool const accountIsIssuer = accountID == issue.account; - auto const line = view.peek(keylet::line(accountID, issue)); + auto const line = view.peek(keylet::rippleState(accountID, issue)); if (!line) return accountIsIssuer ? (TER)tesSUCCESS : (TER)tecOBJECT_NOT_FOUND; if (!accountIsIssuer && line->at(sfBalance)->iou() != beast::zero) diff --git a/src/libxrpl/ledger/helpers/TokenHelpers.cpp b/src/libxrpl/ledger/helpers/TokenHelpers.cpp index 15b3dc0953..309d86507a 100644 --- a/src/libxrpl/ledger/helpers/TokenHelpers.cpp +++ b/src/libxrpl/ledger/helpers/TokenHelpers.cpp @@ -158,7 +158,7 @@ getLineIfUsable( FreezeHandling zeroIfFrozen, beast::Journal j) { - auto sle = view.read(keylet::line(account, issuer, currency)); + auto sle = view.read(keylet::rippleState(account, issuer, currency)); if (!sle) { @@ -541,7 +541,7 @@ directSendNoFeeIOU( XRPL_ASSERT(uSenderID != uReceiverID, "xrpl::directSendNoFeeIOU : sender is not receiver"); bool const bSenderHigh = uSenderID > uReceiverID; - auto const index = keylet::line(uSenderID, uReceiverID, currency); + auto const index = keylet::rippleState(uSenderID, uReceiverID, currency); XRPL_ASSERT( !isXRP(uSenderID) && uSenderID != noAccount(), diff --git a/src/libxrpl/protocol/Indexes.cpp b/src/libxrpl/protocol/Indexes.cpp index 4bbf2d6f1f..093fd4cd18 100644 --- a/src/libxrpl/protocol/Indexes.cpp +++ b/src/libxrpl/protocol/Indexes.cpp @@ -239,12 +239,12 @@ book_t::operator()(Book const& b) const } Keylet -line(AccountID const& id0, AccountID const& id1, Currency const& currency) noexcept +rippleState(AccountID const& id0, AccountID const& id1, Currency const& currency) noexcept { // There is code in TrustSet that calls us with id0 == id1, to allow users // to locate and delete such "weird" trustlines. If we remove that code, we // could enable this assert: - // XRPL_ASSERT(id0 != id1, "xrpl::keylet::line : accounts must be + // XRPL_ASSERT(id0 != id1, "xrpl::keylet::rippleState : accounts must be // different"); // A trust line is shared between two accounts; while we typically think diff --git a/src/libxrpl/tx/invariants/VaultInvariant.cpp b/src/libxrpl/tx/invariants/VaultInvariant.cpp index c0d082e14e..1281cdd58a 100644 --- a/src/libxrpl/tx/invariants/VaultInvariant.cpp +++ b/src/libxrpl/tx/invariants/VaultInvariant.cpp @@ -461,7 +461,8 @@ ValidVault::finalize( if (isXRP(issue)) return get(deltas_.find(keylet::account(id).key)); return get( - deltas_.find(keylet::line(id, issue).key), id > issue.getIssuer() ? -1 : 1); + deltas_.find(keylet::rippleState(id, issue).key), + id > issue.getIssuer() ? -1 : 1); } else if constexpr (std::is_same_v) { diff --git a/src/libxrpl/tx/paths/BookStep.cpp b/src/libxrpl/tx/paths/BookStep.cpp index 480a702dc9..98cf7c42fe 100644 --- a/src/libxrpl/tx/paths/BookStep.cpp +++ b/src/libxrpl/tx/paths/BookStep.cpp @@ -1354,7 +1354,7 @@ BookStep::check(StrandContext const& ctx) const auto const err = book_.in.visit( [&](Issue const& issue) -> std::optional { - auto sle = view.read(keylet::line(*prev, cur, issue.currency)); + auto sle = view.read(keylet::rippleState(*prev, cur, issue.currency)); if (!sle) return terNO_LINE; if (((*sle)[sfFlags] & ((cur > *prev) ? lsfHighNoRipple : lsfLowNoRipple)) != diff --git a/src/libxrpl/tx/paths/DirectStep.cpp b/src/libxrpl/tx/paths/DirectStep.cpp index c2ad818b73..56c404e6c2 100644 --- a/src/libxrpl/tx/paths/DirectStep.cpp +++ b/src/libxrpl/tx/paths/DirectStep.cpp @@ -344,7 +344,7 @@ DirectIPaymentStep::quality(ReadView const& sb, QualityDirection qDir) const if (src_ == dst_) return QUALITY_ONE; - auto const sle = sb.read(keylet::line(dst_, src_, currency_)); + auto const sle = sb.read(keylet::rippleState(dst_, src_, currency_)); if (!sle) return QUALITY_ONE; @@ -420,7 +420,7 @@ DirectIPaymentStep::check(StrandContext const& ctx, std::shared_ptr c // Since this is a payment a trust line must be present. Perform all // trust line related checks. { - auto const sleLine = ctx.view.read(keylet::line(src_, dst_, currency_)); + auto const sleLine = ctx.view.read(keylet::rippleState(src_, dst_, currency_)); if (!sleLine) { JLOG(j_.trace()) << "DirectStepI: No credit line. " << *this; diff --git a/src/libxrpl/tx/paths/XRPEndpointStep.cpp b/src/libxrpl/tx/paths/XRPEndpointStep.cpp index 2310f72f34..7f361c1fc2 100644 --- a/src/libxrpl/tx/paths/XRPEndpointStep.cpp +++ b/src/libxrpl/tx/paths/XRPEndpointStep.cpp @@ -204,7 +204,7 @@ private: { return ctx.strandDeliver.visit( [&](Issue const& issue) { - if (!ctx.view.exists(keylet::line(acc, issue))) + if (!ctx.view.exists(keylet::rippleState(acc, issue))) return -1; return 0; }, diff --git a/src/libxrpl/tx/transactors/check/CheckCash.cpp b/src/libxrpl/tx/transactors/check/CheckCash.cpp index 31bca0aa32..aae727c8e8 100644 --- a/src/libxrpl/tx/transactors/check/CheckCash.cpp +++ b/src/libxrpl/tx/transactors/check/CheckCash.cpp @@ -189,7 +189,7 @@ CheckCash::preclaim(PreclaimContext const& ctx) [&](Issue const& issue) -> TER { Currency const currency{issue.currency}; auto const sleTrustLine = - ctx.view.read(keylet::line(dstId, issuerId, currency)); + ctx.view.read(keylet::rippleState(dstId, issuerId, currency)); auto const sleIssuer = ctx.view.read(keylet::account(issuerId)); if (!sleIssuer) @@ -407,7 +407,7 @@ CheckCash::doApply() // If a trust line does not exist yet create one. Issue const& trustLineIssue = issue; AccountID const truster = deliverIssuer == account_ ? srcId : account_; - trustLineKey = keylet::line(truster, trustLineIssue); + trustLineKey = keylet::rippleState(truster, trustLineIssue); destLow = deliverIssuer > account_; if (!psb.exists(*trustLineKey)) diff --git a/src/libxrpl/tx/transactors/check/CheckCreate.cpp b/src/libxrpl/tx/transactors/check/CheckCreate.cpp index 6a13819615..db968bfc42 100644 --- a/src/libxrpl/tx/transactors/check/CheckCreate.cpp +++ b/src/libxrpl/tx/transactors/check/CheckCreate.cpp @@ -129,7 +129,7 @@ CheckCreate::preclaim(PreclaimContext const& ctx) { // Check if the issuer froze the line auto const sleTrust = - ctx.view.read(keylet::line(srcId, issuerId, issue.currency)); + ctx.view.read(keylet::rippleState(srcId, issuerId, issue.currency)); if (sleTrust && sleTrust->isFlag((issuerId > srcId) ? lsfHighFreeze : lsfLowFreeze)) { @@ -141,7 +141,7 @@ CheckCreate::preclaim(PreclaimContext const& ctx) { // Check if dst froze the line. auto const sleTrust = - ctx.view.read(keylet::line(issuerId, dstId, issue.currency)); + ctx.view.read(keylet::rippleState(issuerId, dstId, issue.currency)); if (sleTrust && sleTrust->isFlag((dstId > issuerId) ? lsfHighFreeze : lsfLowFreeze)) { diff --git a/src/libxrpl/tx/transactors/dex/AMMCreate.cpp b/src/libxrpl/tx/transactors/dex/AMMCreate.cpp index 47363531d4..20b224a774 100644 --- a/src/libxrpl/tx/transactors/dex/AMMCreate.cpp +++ b/src/libxrpl/tx/transactors/dex/AMMCreate.cpp @@ -256,7 +256,7 @@ applyCreate(ApplyContext& ctx_, Sandbox& sb, AccountID const& account_, beast::J // LP Token already exists. (should not happen) auto const lptIss = ammLPTIssue(amount.asset(), amount2.asset(), accountId); - if (sb.read(keylet::line(accountId, lptIss))) + if (sb.read(keylet::rippleState(accountId, lptIss))) { JLOG(j_.error()) << "AMM Instance: LP Token already exists."; return {tecDUPLICATE, false}; @@ -334,7 +334,8 @@ applyCreate(ApplyContext& ctx_, Sandbox& sb, AccountID const& account_, beast::J // Set AMM flag on AMM trustline if (!isXRP(amount)) { - SLE::pointer const sleRippleState = sb.peek(keylet::line(accountId, issue)); + SLE::pointer const sleRippleState = + sb.peek(keylet::rippleState(accountId, issue)); if (!sleRippleState) { return tecINTERNAL; // LCOV_EXCL_LINE diff --git a/src/libxrpl/tx/transactors/dex/AMMDeposit.cpp b/src/libxrpl/tx/transactors/dex/AMMDeposit.cpp index 344e3535da..c206932258 100644 --- a/src/libxrpl/tx/transactors/dex/AMMDeposit.cpp +++ b/src/libxrpl/tx/transactors/dex/AMMDeposit.cpp @@ -235,7 +235,7 @@ AMMDeposit::preclaim(PreclaimContext const& ctx) auto const lpIssue = (*ammSle)[sfLPTokenBalance].get(); // Adjust the reserve if LP doesn't have LPToken trustline auto const sle = - ctx.view.read(keylet::line(accountID, lpIssue.account, lpIssue.currency)); + ctx.view.read(keylet::rippleState(accountID, lpIssue.account, lpIssue.currency)); if (xrpLiquid(ctx.view, accountID, !sle, ctx.j) >= deposit) return TER(tesSUCCESS); if (sle) @@ -519,7 +519,8 @@ AMMDeposit::deposit( { auto const& lpIssue = lpTokensDeposit.get(); // Adjust the reserve if LP doesn't have LPToken trustline - auto const sle = view.read(keylet::line(account_, lpIssue.account, lpIssue.currency)); + auto const sle = + view.read(keylet::rippleState(account_, lpIssue.account, lpIssue.currency)); if (xrpLiquid(view, account_, !sle, j_) >= depositAmount) return tesSUCCESS; } diff --git a/src/libxrpl/tx/transactors/dex/AMMWithdraw.cpp b/src/libxrpl/tx/transactors/dex/AMMWithdraw.cpp index 6ab78f9cb9..bcf5fddea1 100644 --- a/src/libxrpl/tx/transactors/dex/AMMWithdraw.cpp +++ b/src/libxrpl/tx/transactors/dex/AMMWithdraw.cpp @@ -611,7 +611,7 @@ AMMWithdraw::withdraw( bool const isIssue = asset.holds(); bool const assetNotExists = [&] { if (isIssue) - return !view.exists(keylet::line(account, asset.get())); + return !view.exists(keylet::rippleState(account, asset.get())); auto const issuanceKey = keylet::mptIssuance(asset.get()); mptokenKey = keylet::mptoken(issuanceKey.key, account); if (!view.exists(*mptokenKey)) diff --git a/src/libxrpl/tx/transactors/dex/OfferCreate.cpp b/src/libxrpl/tx/transactors/dex/OfferCreate.cpp index 1ce48145f3..63bc8f87b9 100644 --- a/src/libxrpl/tx/transactors/dex/OfferCreate.cpp +++ b/src/libxrpl/tx/transactors/dex/OfferCreate.cpp @@ -276,7 +276,7 @@ OfferCreate::checkAcceptAsset( auto const& issuer = issue.getIssuer(); if (((*issuerAccount)[sfFlags] & lsfRequireAuth) != 0u) { - auto const trustLine = view.read(keylet::line(id, issuer, issue.currency)); + auto const trustLine = view.read(keylet::rippleState(id, issuer, issue.currency)); if (!trustLine) { @@ -301,7 +301,8 @@ OfferCreate::checkAcceptAsset( } } - auto const trustLine = view.read(keylet::line(id, issue.account, issue.currency)); + auto const trustLine = + view.read(keylet::rippleState(id, issue.account, issue.currency)); if (!trustLine) { diff --git a/src/libxrpl/tx/transactors/escrow/EscrowCreate.cpp b/src/libxrpl/tx/transactors/escrow/EscrowCreate.cpp index c112d3b349..395ae089ae 100644 --- a/src/libxrpl/tx/transactors/escrow/EscrowCreate.cpp +++ b/src/libxrpl/tx/transactors/escrow/EscrowCreate.cpp @@ -198,7 +198,7 @@ escrowCreatePreclaimHelper( return tecNO_PERMISSION; // If the account does not have a trustline to the issuer, return tecNO_LINE - auto const sleRippleState = ctx.view.read(keylet::line(account, issuer, issue.currency)); + auto const sleRippleState = ctx.view.read(keylet::rippleState(account, issuer, issue.currency)); if (!sleRippleState) return tecNO_LINE; diff --git a/src/libxrpl/tx/transactors/nft/NFTokenAcceptOffer.cpp b/src/libxrpl/tx/transactors/nft/NFTokenAcceptOffer.cpp index 099b174778..da25f76f86 100644 --- a/src/libxrpl/tx/transactors/nft/NFTokenAcceptOffer.cpp +++ b/src/libxrpl/tx/transactors/nft/NFTokenAcceptOffer.cpp @@ -308,7 +308,7 @@ NFTokenAcceptOffer::preclaim(PreclaimContext const& ctx) if (ctx.view.rules().enabled(fixEnforceNFTokenTrustline) && (nft::getFlags(tokenID) & nft::flagCreateTrustLines) == 0 && nftMinter != amount.getIssuer() && - !ctx.view.read(keylet::line(nftMinter, amount.get()))) + !ctx.view.read(keylet::rippleState(nftMinter, amount.get()))) return tecNO_LINE; // Check that the issuer is allowed to receive IOUs. diff --git a/src/libxrpl/tx/transactors/token/Clawback.cpp b/src/libxrpl/tx/transactors/token/Clawback.cpp index ff20bd82c3..99323d1b8a 100644 --- a/src/libxrpl/tx/transactors/token/Clawback.cpp +++ b/src/libxrpl/tx/transactors/token/Clawback.cpp @@ -114,7 +114,7 @@ preclaimHelper( return tecNO_PERMISSION; auto const sleRippleState = - ctx.view.read(keylet::line(holder, issuer, clawAmount.get().currency)); + ctx.view.read(keylet::rippleState(holder, issuer, clawAmount.get().currency)); if (!sleRippleState) return tecNO_LINE; diff --git a/src/libxrpl/tx/transactors/token/TrustSet.cpp b/src/libxrpl/tx/transactors/token/TrustSet.cpp index 1610b2e5b9..54a5a5c406 100644 --- a/src/libxrpl/tx/transactors/token/TrustSet.cpp +++ b/src/libxrpl/tx/transactors/token/TrustSet.cpp @@ -155,7 +155,7 @@ TrustSet::checkPermission(ReadView const& view, STTx const& tx) auto const saLimitAmount = tx.getFieldAmount(sfLimitAmount); auto const sleRippleState = view.read( - keylet::line( + keylet::rippleState( tx[sfAccount], saLimitAmount.getIssuer(), saLimitAmount.get().currency)); // if the trustline does not exist, granular permissions are @@ -231,7 +231,7 @@ TrustSet::preclaim(PreclaimContext const& ctx) // o The trust line already exists // Then allow the TrustSet. if (ctx.view.rules().enabled(fixDisallowIncomingV1) && - ctx.view.exists(keylet::line(id, uDstAccountID, currency))) + ctx.view.exists(keylet::rippleState(id, uDstAccountID, currency))) { // pass } @@ -251,7 +251,7 @@ TrustSet::preclaim(PreclaimContext const& ctx) // TrustSet if the asset is AMM LP token and AMM is not in empty state. if (sleDst->isFieldPresent(sfAMMID)) { - if (ctx.view.exists(keylet::line(id, uDstAccountID, currency))) + if (ctx.view.exists(keylet::rippleState(id, uDstAccountID, currency))) { // pass } @@ -274,7 +274,7 @@ TrustSet::preclaim(PreclaimContext const& ctx) } else if (sleDst->isFieldPresent(sfVaultID) || sleDst->isFieldPresent(sfLoanBrokerID)) { - if (!ctx.view.exists(keylet::line(id, uDstAccountID, currency))) + if (!ctx.view.exists(keylet::rippleState(id, uDstAccountID, currency))) return tecNO_PERMISSION; // else pass } @@ -308,7 +308,7 @@ TrustSet::preclaim(PreclaimContext const& ctx) bool const bHigh = id > uDstAccountID; // Fetching current state of trust line - auto const sleRippleState = ctx.view.read(keylet::line(id, uDstAccountID, currency)); + auto const sleRippleState = ctx.view.read(keylet::rippleState(id, uDstAccountID, currency)); std::uint32_t uFlags = sleRippleState ? sleRippleState->getFieldU32(sfFlags) : 0u; // Computing expected trust line state uFlags = computeFreezeFlags( @@ -401,7 +401,7 @@ TrustSet::doApply() saLimitAllow.get().account = account_; SLE::pointer const sleRippleState = - view().peek(keylet::line(account_, uDstAccountID, currency)); + view().peek(keylet::rippleState(account_, uDstAccountID, currency)); if (sleRippleState) { @@ -649,7 +649,7 @@ TrustSet::doApply() // Zero balance in currency. STAmount const saBalance(Issue{currency, noAccount()}); - auto const k = keylet::line(account_, uDstAccountID, currency); + auto const k = keylet::rippleState(account_, uDstAccountID, currency); JLOG(j_.trace()) << "doTrustSet: Creating ripple line: " << to_string(k.key); diff --git a/src/test/app/Check_test.cpp b/src/test/app/Check_test.cpp index f2c7ab3a38..2559579eee 100644 --- a/src/test/app/Check_test.cpp +++ b/src/test/app/Check_test.cpp @@ -1949,8 +1949,8 @@ class Check_test : public beast::unit_test::suite Account const& acct2, IOU const& offerIou, IOU const& checkIou) { - auto const offerLine = env.le(keylet::line(acct1, acct2, offerIou.currency)); - auto const checkLine = env.le(keylet::line(acct1, acct2, checkIou.currency)); + auto const offerLine = env.le(keylet::rippleState(acct1, acct2, offerIou.currency)); + auto const checkLine = env.le(keylet::rippleState(acct1, acct2, checkIou.currency)); if (offerLine == nullptr || checkLine == nullptr) { BEAST_EXPECT(offerLine == nullptr && checkLine == nullptr); @@ -2021,7 +2021,7 @@ class Check_test : public beast::unit_test::suite IOU const OF1 = gw1["OF1"]; env(offer(gw1, XRP(98), OF1(98))); env.close(); - BEAST_EXPECT(env.le(keylet::line(gw1, alice, OF1.currency)) == nullptr); + BEAST_EXPECT(env.le(keylet::rippleState(gw1, alice, OF1.currency)) == nullptr); env(offer(alice, OF1(98), XRP(98))); ++alice.owners; env.close(); @@ -2039,7 +2039,7 @@ class Check_test : public beast::unit_test::suite uint256 const chkId{getCheckIndex(gw1, env.seq(gw1))}; env(check::create(gw1, alice, CK1(98))); env.close(); - BEAST_EXPECT(env.le(keylet::line(gw1, alice, CK1.currency)) == nullptr); + BEAST_EXPECT(env.le(keylet::rippleState(gw1, alice, CK1.currency)) == nullptr); env(check::cash(alice, chkId, CK1(98))); ++alice.owners; verifyDeliveredAmount(env, CK1(98)); @@ -2068,7 +2068,7 @@ class Check_test : public beast::unit_test::suite IOU const OF1 = gw1["OF1"]; env(offer(alice, XRP(97), OF1(97))); env.close(); - BEAST_EXPECT(env.le(keylet::line(alice, bob, OF1.currency)) == nullptr); + BEAST_EXPECT(env.le(keylet::rippleState(alice, bob, OF1.currency)) == nullptr); env(offer(bob, OF1(97), XRP(97))); ++bob.owners; env.close(); @@ -2092,12 +2092,12 @@ class Check_test : public beast::unit_test::suite uint256 const chkId{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, CK1(97))); env.close(); - BEAST_EXPECT(env.le(keylet::line(alice, bob, CK1.currency)) == nullptr); + BEAST_EXPECT(env.le(keylet::rippleState(alice, bob, CK1.currency)) == nullptr); env(check::cash(bob, chkId, CK1(97)), ter(terNO_RIPPLE)); env.close(); - BEAST_EXPECT(env.le(keylet::line(gw1, bob, OF1.currency)) != nullptr); - BEAST_EXPECT(env.le(keylet::line(gw1, bob, CK1.currency)) == nullptr); + BEAST_EXPECT(env.le(keylet::rippleState(gw1, bob, OF1.currency)) != nullptr); + BEAST_EXPECT(env.le(keylet::rippleState(gw1, bob, CK1.currency)) == nullptr); // Delete alice's check since it is no longer needed. env(check::cancel(alice, chkId)); @@ -2121,7 +2121,7 @@ class Check_test : public beast::unit_test::suite IOU const OF2 = gw1["OF2"]; env(offer(gw1, XRP(96), OF2(96))); env.close(); - BEAST_EXPECT(env.le(keylet::line(gw1, alice, OF2.currency)) == nullptr); + BEAST_EXPECT(env.le(keylet::rippleState(gw1, alice, OF2.currency)) == nullptr); env(offer(alice, OF2(96), XRP(96))); ++alice.owners; env.close(); @@ -2139,7 +2139,7 @@ class Check_test : public beast::unit_test::suite uint256 const chkId{getCheckIndex(gw1, env.seq(gw1))}; env(check::create(gw1, alice, CK2(96))); env.close(); - BEAST_EXPECT(env.le(keylet::line(gw1, alice, CK2.currency)) == nullptr); + BEAST_EXPECT(env.le(keylet::rippleState(gw1, alice, CK2.currency)) == nullptr); env(check::cash(alice, chkId, CK2(96))); ++alice.owners; verifyDeliveredAmount(env, CK2(96)); @@ -2165,7 +2165,7 @@ class Check_test : public beast::unit_test::suite IOU const OF2 = gw1["OF2"]; env(offer(alice, XRP(95), OF2(95))); env.close(); - BEAST_EXPECT(env.le(keylet::line(alice, bob, OF2.currency)) == nullptr); + BEAST_EXPECT(env.le(keylet::rippleState(alice, bob, OF2.currency)) == nullptr); env(offer(bob, OF2(95), XRP(95))); ++bob.owners; env.close(); @@ -2180,7 +2180,7 @@ class Check_test : public beast::unit_test::suite uint256 const chkId{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, CK2(95))); env.close(); - BEAST_EXPECT(env.le(keylet::line(alice, bob, CK2.currency)) == nullptr); + BEAST_EXPECT(env.le(keylet::rippleState(alice, bob, CK2.currency)) == nullptr); env(check::cash(bob, chkId, CK2(95))); ++bob.owners; verifyDeliveredAmount(env, CK2(95)); @@ -2212,7 +2212,7 @@ class Check_test : public beast::unit_test::suite IOU const OF3 = gw1["OF3"]; env(offer(gw1, XRP(94), OF3(94))); env.close(); - BEAST_EXPECT(env.le(keylet::line(gw1, alice, OF3.currency)) == nullptr); + BEAST_EXPECT(env.le(keylet::rippleState(gw1, alice, OF3.currency)) == nullptr); env(offer(alice, OF3(94), XRP(94))); ++alice.owners; env.close(); @@ -2230,7 +2230,7 @@ class Check_test : public beast::unit_test::suite uint256 const chkId{getCheckIndex(gw1, env.seq(gw1))}; env(check::create(gw1, alice, CK3(94))); env.close(); - BEAST_EXPECT(env.le(keylet::line(gw1, alice, CK3.currency)) == nullptr); + BEAST_EXPECT(env.le(keylet::rippleState(gw1, alice, CK3.currency)) == nullptr); env(check::cash(alice, chkId, CK3(94))); ++alice.owners; verifyDeliveredAmount(env, CK3(94)); @@ -2256,7 +2256,7 @@ class Check_test : public beast::unit_test::suite IOU const OF3 = gw1["OF3"]; env(offer(alice, XRP(93), OF3(93))); env.close(); - BEAST_EXPECT(env.le(keylet::line(alice, bob, OF3.currency)) == nullptr); + BEAST_EXPECT(env.le(keylet::rippleState(alice, bob, OF3.currency)) == nullptr); env(offer(bob, OF3(93), XRP(93))); ++bob.owners; env.close(); @@ -2271,7 +2271,7 @@ class Check_test : public beast::unit_test::suite uint256 const chkId{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, CK3(93))); env.close(); - BEAST_EXPECT(env.le(keylet::line(alice, bob, CK3.currency)) == nullptr); + BEAST_EXPECT(env.le(keylet::rippleState(alice, bob, CK3.currency)) == nullptr); env(check::cash(bob, chkId, CK3(93))); ++bob.owners; verifyDeliveredAmount(env, CK3(93)); @@ -2297,7 +2297,7 @@ class Check_test : public beast::unit_test::suite IOU const OF4 = gw1["OF4"]; env(offer(gw1, XRP(92), OF4(92)), ter(tecFROZEN)); env.close(); - BEAST_EXPECT(env.le(keylet::line(gw1, alice, OF4.currency)) == nullptr); + BEAST_EXPECT(env.le(keylet::rippleState(gw1, alice, OF4.currency)) == nullptr); env(offer(alice, OF4(92), XRP(92)), ter(tecFROZEN)); env.close(); @@ -2311,7 +2311,7 @@ class Check_test : public beast::unit_test::suite uint256 const chkId{getCheckIndex(gw1, env.seq(gw1))}; env(check::create(gw1, alice, CK4(92)), ter(tecFROZEN)); env.close(); - BEAST_EXPECT(env.le(keylet::line(gw1, alice, CK4.currency)) == nullptr); + BEAST_EXPECT(env.le(keylet::rippleState(gw1, alice, CK4.currency)) == nullptr); env(check::cash(alice, chkId, CK4(92)), ter(tecNO_ENTRY)); env.close(); @@ -2322,8 +2322,8 @@ class Check_test : public beast::unit_test::suite // Because gw1 has set lsfGlobalFreeze, neither trust line // is created. - BEAST_EXPECT(env.le(keylet::line(gw1, alice, OF4.currency)) == nullptr); - BEAST_EXPECT(env.le(keylet::line(gw1, alice, CK4.currency)) == nullptr); + BEAST_EXPECT(env.le(keylet::rippleState(gw1, alice, OF4.currency)) == nullptr); + BEAST_EXPECT(env.le(keylet::rippleState(gw1, alice, CK4.currency)) == nullptr); } //------------ lsfGlobalFreeze, check written by non-issuer ------------ { @@ -2335,7 +2335,7 @@ class Check_test : public beast::unit_test::suite IOU const OF4 = gw1["OF4"]; env(offer(alice, XRP(91), OF4(91)), ter(tecFROZEN)); env.close(); - BEAST_EXPECT(env.le(keylet::line(alice, bob, OF4.currency)) == nullptr); + BEAST_EXPECT(env.le(keylet::rippleState(alice, bob, OF4.currency)) == nullptr); env(offer(bob, OF4(91), XRP(91)), ter(tecFROZEN)); env.close(); @@ -2349,7 +2349,7 @@ class Check_test : public beast::unit_test::suite uint256 const chkId{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, CK4(91)), ter(tecFROZEN)); env.close(); - BEAST_EXPECT(env.le(keylet::line(alice, bob, CK4.currency)) == nullptr); + BEAST_EXPECT(env.le(keylet::rippleState(alice, bob, CK4.currency)) == nullptr); env(check::cash(bob, chkId, CK4(91)), ter(tecNO_ENTRY)); env.close(); @@ -2360,8 +2360,8 @@ class Check_test : public beast::unit_test::suite // Because gw1 has set lsfGlobalFreeze, neither trust line // is created. - BEAST_EXPECT(env.le(keylet::line(gw1, bob, OF4.currency)) == nullptr); - BEAST_EXPECT(env.le(keylet::line(gw1, bob, CK4.currency)) == nullptr); + BEAST_EXPECT(env.le(keylet::rippleState(gw1, bob, OF4.currency)) == nullptr); + BEAST_EXPECT(env.le(keylet::rippleState(gw1, bob, CK4.currency)) == nullptr); } //-------------- lsfRequireAuth, check written by issuer --------------- @@ -2385,7 +2385,7 @@ class Check_test : public beast::unit_test::suite env(offer(gw2, XRP(92), OF5(92))); ++gw2.owners; env.close(); - BEAST_EXPECT(env.le(keylet::line(gw2, alice, OF5.currency)) == nullptr); + BEAST_EXPECT(env.le(keylet::rippleState(gw2, alice, OF5.currency)) == nullptr); env(offer(alice, OF5(92), XRP(92)), ter(tecNO_LINE)); env.close(); @@ -2407,7 +2407,7 @@ class Check_test : public beast::unit_test::suite env(check::create(gw2, alice, CK5(92))); ++gw2.owners; env.close(); - BEAST_EXPECT(env.le(keylet::line(gw2, alice, CK5.currency)) == nullptr); + BEAST_EXPECT(env.le(keylet::rippleState(gw2, alice, CK5.currency)) == nullptr); env(check::cash(alice, chkId, CK5(92)), ter(tecNO_AUTH)); env.close(); @@ -2419,8 +2419,8 @@ class Check_test : public beast::unit_test::suite // Because gw2 has set lsfRequireAuth, neither trust line // is created. - BEAST_EXPECT(env.le(keylet::line(gw2, alice, OF5.currency)) == nullptr); - BEAST_EXPECT(env.le(keylet::line(gw2, alice, CK5.currency)) == nullptr); + BEAST_EXPECT(env.le(keylet::rippleState(gw2, alice, OF5.currency)) == nullptr); + BEAST_EXPECT(env.le(keylet::rippleState(gw2, alice, CK5.currency)) == nullptr); // Since we don't need it any more, remove gw2's check. env(check::cancel(gw2, chkId)); @@ -2439,7 +2439,7 @@ class Check_test : public beast::unit_test::suite env(offer(alice, XRP(91), OF5(91)), ter(tecUNFUNDED_OFFER)); env.close(); env(offer(bob, OF5(91), XRP(91)), ter(tecNO_LINE)); - BEAST_EXPECT(env.le(keylet::line(gw2, bob, OF5.currency)) == nullptr); + BEAST_EXPECT(env.le(keylet::rippleState(gw2, bob, OF5.currency)) == nullptr); env.close(); gw2.verifyOwners(__LINE__); @@ -2451,7 +2451,7 @@ class Check_test : public beast::unit_test::suite uint256 const chkId{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, CK5(91))); env.close(); - BEAST_EXPECT(env.le(keylet::line(alice, bob, CK5.currency)) == nullptr); + BEAST_EXPECT(env.le(keylet::rippleState(alice, bob, CK5.currency)) == nullptr); env(check::cash(bob, chkId, CK5(91)), ter(tecPATH_PARTIAL)); env.close(); @@ -2466,8 +2466,8 @@ class Check_test : public beast::unit_test::suite // Because gw2 has set lsfRequireAuth, neither trust line // is created. - BEAST_EXPECT(env.le(keylet::line(gw2, bob, OF5.currency)) == nullptr); - BEAST_EXPECT(env.le(keylet::line(gw2, bob, CK5.currency)) == nullptr); + BEAST_EXPECT(env.le(keylet::rippleState(gw2, bob, OF5.currency)) == nullptr); + BEAST_EXPECT(env.le(keylet::rippleState(gw2, bob, CK5.currency)) == nullptr); } } diff --git a/src/test/app/Clawback_test.cpp b/src/test/app/Clawback_test.cpp index 8efcece295..a45878acd4 100644 --- a/src/test/app/Clawback_test.cpp +++ b/src/test/app/Clawback_test.cpp @@ -53,7 +53,7 @@ class Clawback_test : public beast::unit_test::suite test::jtx::Account const& dst, Currency const& cur) { - if (auto sle = env.le(keylet::line(src, dst, cur))) + if (auto sle = env.le(keylet::rippleState(src, dst, cur))) { auto const useHigh = src.id() > dst.id(); return sle->isFlag(useHigh ? lsfHighFreeze : lsfLowFreeze); diff --git a/src/test/app/Flow_test.cpp b/src/test/app/Flow_test.cpp index 8f096a970f..140f153a65 100644 --- a/src/test/app/Flow_test.cpp +++ b/src/test/app/Flow_test.cpp @@ -58,7 +58,7 @@ getNoRippleFlag( jtx::Account const& dst, Currency const& cur) { - if (auto sle = env.le(keylet::line(src, dst, cur))) + if (auto sle = env.le(keylet::rippleState(src, dst, cur))) { auto const flag = (src.id() > dst.id()) ? lsfHighNoRipple : lsfLowNoRipple; return sle->isFlag(flag); diff --git a/src/test/app/Invariants_test.cpp b/src/test/app/Invariants_test.cpp index 36ba3e98ec..ed2ed59b20 100644 --- a/src/test/app/Invariants_test.cpp +++ b/src/test/app/Invariants_test.cpp @@ -456,7 +456,7 @@ class Invariants_test : public beast::unit_test::suite BEAST_EXPECT(sle->at(~sfAMMID) == ammKey); for (auto const& trustKeylet : - {keylet::line(ammAcctID, A1["USD"]), keylet::line(A1, ammIssue)}) + {keylet::rippleState(ammAcctID, A1["USD"]), keylet::rippleState(A1, ammIssue)}) { auto const line = ac.view().peek(trustKeylet); if (!line) @@ -557,7 +557,7 @@ class Invariants_test : public beast::unit_test::suite [](Account const& A1, Account const& A2, ApplyContext& ac) { // create simple trust SLE with xrp currency auto const sleNew = - std::make_shared(keylet::line(A1, A2, xrpIssue().currency)); + std::make_shared(keylet::rippleState(A1, A2, xrpIssue().currency)); ac.view().insert(sleNew); return true; }); @@ -573,7 +573,8 @@ class Invariants_test : public beast::unit_test::suite {{"a trust line with deep freeze flag without normal freeze was " "created"}}, [](Account const& A1, Account const& A2, ApplyContext& ac) { - auto const sleNew = std::make_shared(keylet::line(A1, A2, A1["USD"].currency)); + auto const sleNew = + std::make_shared(keylet::rippleState(A1, A2, A1["USD"].currency)); sleNew->setFieldAmount(sfLowLimit, A1["USD"](0)); sleNew->setFieldAmount(sfHighLimit, A1["USD"](0)); @@ -588,7 +589,8 @@ class Invariants_test : public beast::unit_test::suite {{"a trust line with deep freeze flag without normal freeze was " "created"}}, [](Account const& A1, Account const& A2, ApplyContext& ac) { - auto const sleNew = std::make_shared(keylet::line(A1, A2, A1["USD"].currency)); + auto const sleNew = + std::make_shared(keylet::rippleState(A1, A2, A1["USD"].currency)); sleNew->setFieldAmount(sfLowLimit, A1["USD"](0)); sleNew->setFieldAmount(sfHighLimit, A1["USD"](0)); std::uint32_t uFlags = 0u; @@ -602,7 +604,8 @@ class Invariants_test : public beast::unit_test::suite {{"a trust line with deep freeze flag without normal freeze was " "created"}}, [](Account const& A1, Account const& A2, ApplyContext& ac) { - auto const sleNew = std::make_shared(keylet::line(A1, A2, A1["USD"].currency)); + auto const sleNew = + std::make_shared(keylet::rippleState(A1, A2, A1["USD"].currency)); sleNew->setFieldAmount(sfLowLimit, A1["USD"](0)); sleNew->setFieldAmount(sfHighLimit, A1["USD"](0)); std::uint32_t uFlags = 0u; @@ -616,7 +619,8 @@ class Invariants_test : public beast::unit_test::suite {{"a trust line with deep freeze flag without normal freeze was " "created"}}, [](Account const& A1, Account const& A2, ApplyContext& ac) { - auto const sleNew = std::make_shared(keylet::line(A1, A2, A1["USD"].currency)); + auto const sleNew = + std::make_shared(keylet::rippleState(A1, A2, A1["USD"].currency)); sleNew->setFieldAmount(sfLowLimit, A1["USD"](0)); sleNew->setFieldAmount(sfHighLimit, A1["USD"](0)); std::uint32_t uFlags = 0u; @@ -630,7 +634,8 @@ class Invariants_test : public beast::unit_test::suite {{"a trust line with deep freeze flag without normal freeze was " "created"}}, [](Account const& A1, Account const& A2, ApplyContext& ac) { - auto const sleNew = std::make_shared(keylet::line(A1, A2, A1["USD"].currency)); + auto const sleNew = + std::make_shared(keylet::rippleState(A1, A2, A1["USD"].currency)); sleNew->setFieldAmount(sfLowLimit, A1["USD"](0)); sleNew->setFieldAmount(sfHighLimit, A1["USD"](0)); std::uint32_t uFlags = 0u; @@ -685,8 +690,8 @@ class Invariants_test : public beast::unit_test::suite ApplyContext& ac, int A1Balance, int A2Balance) { - auto const sleA1 = ac.view().peek(keylet::line(A1, G1["USD"])); - auto const sleA2 = ac.view().peek(keylet::line(A2, G1["USD"])); + auto const sleA1 = ac.view().peek(keylet::rippleState(A1, G1["USD"])); + auto const sleA2 = ac.view().peek(keylet::rippleState(A2, G1["USD"])); sleA1->setFieldAmount(sfBalance, G1["USD"](A1Balance)); sleA2->setFieldAmount(sfBalance, G1["USD"](A2Balance)); @@ -4129,8 +4134,8 @@ class Invariants_test : public beast::unit_test::suite auto const& goodConfig) { char const* const c1 = "USD"; char const* const c2 = "EUR"; - auto const k1 = keylet::line(A1, A2, A1[c1].currency); - auto const k2 = keylet::line(A1, A3, A1[c2].currency); + auto const k1 = keylet::rippleState(A1, A2, A1[c1].currency); + auto const k2 = keylet::rippleState(A1, A3, A1[c2].currency); bool const k1First = k1.key < k2.key; auto const& badKey = k1First ? k1 : k2; diff --git a/src/test/app/Loan_test.cpp b/src/test/app/Loan_test.cpp index ad87603661..6afd44e8d9 100644 --- a/src/test/app/Loan_test.cpp +++ b/src/test/app/Loan_test.cpp @@ -3116,7 +3116,8 @@ protected: env(pay(borrower, issuer, broker.asset(10'000))); env.close(); - auto const trustline = keylet::line(borrower, broker.asset.raw().get()); + auto const trustline = + keylet::rippleState(borrower, broker.asset.raw().get()); auto const sleLine1 = env.le(trustline); BEAST_EXPECT(sleLine1 == nullptr); @@ -3209,7 +3210,7 @@ protected: env.trust(broker.asset(0), lender); env.close(); - auto const trustline = keylet::line(lender, broker.asset.raw().get()); + auto const trustline = keylet::rippleState(lender, broker.asset.raw().get()); auto const sleLine1 = env.le(trustline); BEAST_EXPECT(sleLine1 != nullptr); @@ -4179,7 +4180,7 @@ protected: BEAST_EXPECT(le)) { auto const account = le->at(accountField); - if (auto const sleLine = env.le(keylet::line(account, IOU)); + if (auto const sleLine = env.le(keylet::rippleState(account, IOU)); BEAST_EXPECT(sleLine)) { STAmount balance = sleLine->at(sfBalance); @@ -6671,7 +6672,7 @@ protected: env(loanBroker::coverDeposit(broker, brokerInfo.brokerID, STAmount{IOU, additionalCover})); env.close(); // Verify broker owner has a trustline - auto const brokerTrustline = keylet::line(broker, IOU); + auto const brokerTrustline = keylet::rippleState(broker, IOU); BEAST_EXPECT(env.le(brokerTrustline) != nullptr); // Broker owner deletes their trustline // First, pay any positive balance to issuer to zero it out diff --git a/src/test/app/NFTokenAuth_test.cpp b/src/test/app/NFTokenAuth_test.cpp index 2542f2eb36..445cbcb5c0 100644 --- a/src/test/app/NFTokenAuth_test.cpp +++ b/src/test/app/NFTokenAuth_test.cpp @@ -130,7 +130,8 @@ public: // close ledger before running the actual tests against this trustline. // After ledger is closed, the trustline will not exist. auto const unauthTrustline = [&](OpenView& view, beast::Journal) -> bool { - auto const sleA1 = std::make_shared(keylet::line(A1, G1, G1["USD"].currency)); + auto const sleA1 = + std::make_shared(keylet::rippleState(A1, G1, G1["USD"].currency)); sleA1->setFieldAmount(sfBalance, A1["USD"](-1000)); view.rawInsert(sleA1); return true; @@ -193,7 +194,8 @@ public: // tests against this trustline. After ledger is closed, the trustline // will not exist. auto const unauthTrustline = [&](OpenView& view, beast::Journal) -> bool { - auto const sleA1 = std::make_shared(keylet::line(A1, G1, G1["USD"].currency)); + auto const sleA1 = + std::make_shared(keylet::rippleState(A1, G1, G1["USD"].currency)); sleA1->setFieldAmount(sfBalance, A1["USD"](-1000)); view.rawInsert(sleA1); return true; @@ -313,7 +315,8 @@ public: // Creating an artificial unauth trustline auto const unauthTrustline = [&](OpenView& view, beast::Journal) -> bool { - auto const sleA1 = std::make_shared(keylet::line(A1, G1, G1["USD"].currency)); + auto const sleA1 = + std::make_shared(keylet::rippleState(A1, G1, G1["USD"].currency)); sleA1->setFieldAmount(sfBalance, A1["USD"](-1000)); view.rawInsert(sleA1); return true; @@ -432,7 +435,8 @@ public: env.close(); auto const unauthTrustline = [&](OpenView& view, beast::Journal) -> bool { - auto const sleA1 = std::make_shared(keylet::line(A1, G1, G1["USD"].currency)); + auto const sleA1 = + std::make_shared(keylet::rippleState(A1, G1, G1["USD"].currency)); sleA1->setFieldAmount(sfBalance, A1["USD"](-1000)); view.rawInsert(sleA1); return true; diff --git a/src/test/app/Offer_test.cpp b/src/test/app/Offer_test.cpp index 78bdd3fef2..e527798502 100644 --- a/src/test/app/Offer_test.cpp +++ b/src/test/app/Offer_test.cpp @@ -2183,7 +2183,7 @@ public: jtx::PrettyAmount const& expectBalance) { Issue const& issue = expectBalance.value().get(); - auto const sleTrust = env.le(keylet::line(account.id(), issue)); + auto const sleTrust = env.le(keylet::rippleState(account.id(), issue)); BEAST_EXPECT(sleTrust); if (sleTrust) { @@ -2350,7 +2350,7 @@ public: else { // Verify that no trustline was created. - auto const sleTrust = env.le(keylet::line(acct, USD)); + auto const sleTrust = env.le(keylet::rippleState(acct, USD)); BEAST_EXPECT(!sleTrust); } } @@ -2535,8 +2535,8 @@ public: env.require(offers(bob, 0)); // The two trustlines that were generated by offers should be gone. - BEAST_EXPECT(!env.le(keylet::line(alice.id(), EUR))); - BEAST_EXPECT(!env.le(keylet::line(bob.id(), USD))); + BEAST_EXPECT(!env.le(keylet::rippleState(alice.id(), EUR))); + BEAST_EXPECT(!env.le(keylet::rippleState(bob.id(), USD))); // Make two more offers that leave one of the offers non-dry. We // need to properly sequence the transactions: @@ -4471,7 +4471,7 @@ public: jtx::Account const& src, jtx::Account const& dst, Currency const& cur) -> bool { - return bool(env.le(keylet::line(src, dst, cur))); + return bool(env.le(keylet::rippleState(src, dst, cur))); }; Account const alice("alice"); diff --git a/src/test/app/Path_test.cpp b/src/test/app/Path_test.cpp index e6d27de415..0449078771 100644 --- a/src/test/app/Path_test.cpp +++ b/src/test/app/Path_test.cpp @@ -880,7 +880,7 @@ public: })", jv); - auto const jv_l = env.le(keylet::line(Account("bob").id(), Account("alice")["USD"])) + auto const jv_l = env.le(keylet::rippleState(Account("bob").id(), Account("alice")["USD"])) ->getJson(JsonOptions::none); for (auto it = jv.begin(); it != jv.end(); ++it) BEAST_EXPECT(*it == jv_l[it.memberName()]); @@ -922,14 +922,15 @@ public: })", jv); - auto const jv_l = env.le(keylet::line(Account("bob").id(), Account("alice")["USD"])) + auto const jv_l = env.le(keylet::rippleState(Account("bob").id(), Account("alice")["USD"])) ->getJson(JsonOptions::none); for (auto it = jv.begin(); it != jv.end(); ++it) BEAST_EXPECT(*it == jv_l[it.memberName()]); env.trust(Account("bob")["USD"](0), "alice"); env.trust(Account("alice")["USD"](0), "bob"); - BEAST_EXPECT(env.le(keylet::line(Account("bob").id(), Account("alice")["USD"])) == nullptr); + BEAST_EXPECT( + env.le(keylet::rippleState(Account("bob").id(), Account("alice")["USD"])) == nullptr); } void @@ -972,13 +973,14 @@ public: })", jv); - auto const jv_l = env.le(keylet::line(Account("alice").id(), Account("bob")["USD"])) + auto const jv_l = env.le(keylet::rippleState(Account("alice").id(), Account("bob")["USD"])) ->getJson(JsonOptions::none); for (auto it = jv.begin(); it != jv.end(); ++it) BEAST_EXPECT(*it == jv_l[it.memberName()]); env(pay("alice", "bob", Account("alice")["USD"](50))); - BEAST_EXPECT(env.le(keylet::line(Account("alice").id(), Account("bob")["USD"])) == nullptr); + BEAST_EXPECT( + env.le(keylet::rippleState(Account("alice").id(), Account("bob")["USD"])) == nullptr); } void diff --git a/src/test/app/PayStrand_test.cpp b/src/test/app/PayStrand_test.cpp index 161903ee6d..b7d412fcfa 100644 --- a/src/test/app/PayStrand_test.cpp +++ b/src/test/app/PayStrand_test.cpp @@ -80,7 +80,7 @@ getTrustFlag( Currency const& cur, TrustFlag flag) { - if (auto sle = env.le(keylet::line(src, dst, cur))) + if (auto sle = env.le(keylet::rippleState(src, dst, cur))) { auto const useHigh = src.id() > dst.id(); return sle->isFlag(trustFlag(flag, useHigh)); @@ -454,7 +454,7 @@ struct ExistingElementPool for (auto const& c : currencies) { // Line balance - auto const lk = keylet::line(*ai1, *ai2, c); + auto const lk = keylet::rippleState(*ai1, *ai2, c); auto const b1 = lineBalance(v1, lk); auto const b2 = lineBalance(v2, lk); if (b1 != b2) diff --git a/src/test/app/SetAuth_test.cpp b/src/test/app/SetAuth_test.cpp index 5982fc282d..15cea1d2d7 100644 --- a/src/test/app/SetAuth_test.cpp +++ b/src/test/app/SetAuth_test.cpp @@ -51,7 +51,7 @@ struct SetAuth_test : public beast::unit_test::suite env(fset(gw, asfRequireAuth)); env.close(); env(auth(gw, "alice", "USD")); - BEAST_EXPECT(env.le(keylet::line(Account("alice").id(), gw.id(), USD.currency))); + BEAST_EXPECT(env.le(keylet::rippleState(Account("alice").id(), gw.id(), USD.currency))); env(trust("alice", USD(1000))); env(trust("bob", USD(1000))); env(pay(gw, "alice", USD(100))); diff --git a/src/test/app/Vault_test.cpp b/src/test/app/Vault_test.cpp index 775d579b9b..bd40267155 100644 --- a/src/test/app/Vault_test.cpp +++ b/src/test/app/Vault_test.cpp @@ -2678,7 +2678,7 @@ class Vault_test : public beast::unit_test::suite env(vault.deposit({.depositor = owner, .id = keylet.key, .amount = asset(200)})); env.close(); - auto trustline = env.le(keylet::line(owner, asset.raw().get())); + auto trustline = env.le(keylet::rippleState(owner, asset.raw().get())); BEAST_EXPECT(trustline == nullptr); // Withdraw without trust line, will succeed @@ -2860,7 +2860,7 @@ class Vault_test : public beast::unit_test::suite env(vault.deposit({.depositor = owner, .id = keylet.key, .amount = asset(200)})); env.close(); - auto trustline = env.le(keylet::line(owner, asset.raw().get())); + auto trustline = env.le(keylet::rippleState(owner, asset.raw().get())); BEAST_EXPECT(trustline == nullptr); env(ticket::create(owner, 1)); diff --git a/src/test/jtx/impl/Env.cpp b/src/test/jtx/impl/Env.cpp index f03e26b567..1818d0dd03 100644 --- a/src/test/jtx/impl/Env.cpp +++ b/src/test/jtx/impl/Env.cpp @@ -213,7 +213,7 @@ Env::balance(Account const& account, Asset const& asset) const [&](Issue const& issue) -> PrettyAmount { if (isXRP(issue.currency)) return balance(account); - auto const sle = le(keylet::line(account.id(), issue)); + auto const sle = le(keylet::rippleState(account.id(), issue)); if (!sle) return {STAmount(issue, 0), account.name()}; auto amount = sle->getFieldAmount(sfBalance); @@ -253,7 +253,7 @@ Env::balance(Account const& account, Asset const& asset) const PrettyAmount Env::limit(Account const& account, Issue const& issue) const { - auto const sle = le(keylet::line(account.id(), issue)); + auto const sle = le(keylet::rippleState(account.id(), issue)); if (!sle) return {STAmount(issue, 0), account.name()}; auto const aHigh = account.id() > issue.account; diff --git a/src/test/jtx/impl/TestHelpers.cpp b/src/test/jtx/impl/TestHelpers.cpp index f585e7b28f..7c7b6b31b9 100644 --- a/src/test/jtx/impl/TestHelpers.cpp +++ b/src/test/jtx/impl/TestHelpers.cpp @@ -357,7 +357,7 @@ xrpMinusFee(Env const& env, std::int64_t xrpAmount) [[nodiscard]] bool expectHolding(Env& env, AccountID const& account, STAmount const& value, bool defaultLimits) { - if (auto const sle = env.le(keylet::line(account, value.get()))) + if (auto const sle = env.le(keylet::rippleState(account, value.get()))) { Issue const issue = value.get(); bool const accountLow = account < issue.account; @@ -387,7 +387,7 @@ expectHolding(Env& env, AccountID const& account, STAmount const& value, bool de [[nodiscard]] bool expectHolding(Env& env, AccountID const& account, None const&, Issue const& issue) { - return !env.le(keylet::line(account, issue)); + return !env.le(keylet::rippleState(account, issue)); } [[nodiscard]] bool diff --git a/src/test/jtx/impl/balance.cpp b/src/test/jtx/impl/balance.cpp index 1c7b4c0c25..699eaa8357 100644 --- a/src/test/jtx/impl/balance.cpp +++ b/src/test/jtx/impl/balance.cpp @@ -36,7 +36,7 @@ doBalance(Env& env, AccountID const& account, bool none, STAmount const& value, } else { - auto const sle = env.le(keylet::line(account, issue)); + auto const sle = env.le(keylet::rippleState(account, issue)); if (none) { TEST_EXPECT(!sle); diff --git a/src/tests/libxrpl/helpers/TxTest.cpp b/src/tests/libxrpl/helpers/TxTest.cpp index d88f700356..15bc12b0b2 100644 --- a/src/tests/libxrpl/helpers/TxTest.cpp +++ b/src/tests/libxrpl/helpers/TxTest.cpp @@ -231,7 +231,7 @@ TxTest::getCloseTime() const STAmount TxTest::getBalance(AccountID const& account, IOU const& iou) const { - auto const sle = openLedger_->read(keylet::line(account, iou.issue())); + auto const sle = openLedger_->read(keylet::rippleState(account, iou.issue())); if (!sle) return STAmount{iou.issue(), 0}; diff --git a/src/xrpld/rpc/detail/Pathfinder.cpp b/src/xrpld/rpc/detail/Pathfinder.cpp index ed486c80a8..9972a29c0e 100644 --- a/src/xrpld/rpc/detail/Pathfinder.cpp +++ b/src/xrpld/rpc/detail/Pathfinder.cpp @@ -947,7 +947,7 @@ Pathfinder::isNoRipple( AccountID const& toAccount, Currency const& currency) { - auto sleRipple = mLedger->read(keylet::line(toAccount, fromAccount, currency)); + auto sleRipple = mLedger->read(keylet::rippleState(toAccount, fromAccount, currency)); auto const flag((toAccount > fromAccount) ? lsfHighNoRipple : lsfLowNoRipple); diff --git a/src/xrpld/rpc/handlers/ledger/LedgerEntry.cpp b/src/xrpld/rpc/handlers/ledger/LedgerEntry.cpp index fe59cf27f3..4d69f0791a 100644 --- a/src/xrpld/rpc/handlers/ledger/LedgerEntry.cpp +++ b/src/xrpld/rpc/handlers/ledger/LedgerEntry.cpp @@ -707,7 +707,7 @@ parseRippleState( "malformedCurrency", jss::currency, "Currency"); } - return keylet::line(*id1, *id2, uCurrency).key; + return keylet::rippleState(*id1, *id2, uCurrency).key; } static Expected