From b96883f00b91a371e204eef4d5f16dc58424ea34 Mon Sep 17 00:00:00 2001 From: Gregory Tsipenyuk Date: Wed, 18 Dec 2024 09:38:24 -0500 Subject: [PATCH] Fix merge conflicts --- include/xrpl/protocol/AmountConversions.h | 8 ++++---- src/libxrpl/protocol/STPathSet.cpp | 4 ++-- src/xrpld/app/misc/detail/MPTUtils.cpp | 2 +- src/xrpld/app/paths/detail/DirectStep.cpp | 2 +- src/xrpld/app/paths/detail/MPTEndpointStep.cpp | 8 ++++---- src/xrpld/app/tx/detail/AMMBid.cpp | 3 +-- src/xrpld/app/tx/detail/AMMClawback.cpp | 6 +++--- src/xrpld/app/tx/detail/AMMDelete.cpp | 4 ++-- src/xrpld/app/tx/detail/AMMDeposit.cpp | 8 ++++---- src/xrpld/app/tx/detail/AMMVote.cpp | 3 +-- src/xrpld/app/tx/detail/AMMWithdraw.cpp | 11 +++-------- 11 files changed, 26 insertions(+), 33 deletions(-) diff --git a/include/xrpl/protocol/AmountConversions.h b/include/xrpl/protocol/AmountConversions.h index 1be98945ac5..6ba5cb95e40 100644 --- a/include/xrpl/protocol/AmountConversions.h +++ b/include/xrpl/protocol/AmountConversions.h @@ -32,7 +32,7 @@ namespace ripple { inline STAmount toSTAmount(IOUAmount const& iou, Asset const& iss) { - ASSERT(iss.holds(), "ripple::toSTAmount : is Issue"); + XRPL_ASSERT(iss.holds(), "ripple::toSTAmount : is Issue"); bool const isNeg = iou.signum() < 0; std::uint64_t const umant = isNeg ? -iou.mantissa() : iou.mantissa(); return STAmount(iss, umant, iou.exponent(), isNeg, STAmount::unchecked()); @@ -55,7 +55,7 @@ toSTAmount(XRPAmount const& xrp) inline STAmount toSTAmount(XRPAmount const& xrp, Asset const& iss) { - ASSERT(isXRP(iss), "ripple::toSTAmount : is XRP"); + XRPL_ASSERT(isXRP(iss), "ripple::toSTAmount : is XRP"); return toSTAmount(xrp); } @@ -68,7 +68,7 @@ toSTAmount(MPTAmount const& mpt) inline STAmount toSTAmount(MPTAmount const& mpt, Asset const& iss) { - ASSERT(iss.holds(), "ripple::toSTAmount : is MPT"); + XRPL_ASSERT(iss.holds(), "ripple::toSTAmount : is MPT"); return STAmount(mpt, iss.get()); } @@ -117,7 +117,7 @@ template <> inline MPTAmount toAmount(STAmount const& amt) { - ASSERT( + XRPL_ASSERT( amt.holds() && amt.mantissa() <= maxMPTokenAmount, "ripple::toAmount : maximum mantissa"); bool const isNeg = amt.negative(); diff --git a/src/libxrpl/protocol/STPathSet.cpp b/src/libxrpl/protocol/STPathSet.cpp index 879469cac05..e3abfcbb593 100644 --- a/src/libxrpl/protocol/STPathSet.cpp +++ b/src/libxrpl/protocol/STPathSet.cpp @@ -101,7 +101,7 @@ STPathSet::STPathSet(SerialIter& sit, SField const& name) : STBase(name) if (hasAccount) account = sit.get160(); - ASSERT( + XRPL_ASSERT( !(hasCurrency && hasMPT), "ripple::STPathSet::STPathSet : not has Currency and MPT"); if (hasCurrency) @@ -195,7 +195,7 @@ STPath::getJson(JsonOptions) const if (iType & STPathElement::typeAccount) elem[jss::account] = to_string(it.getAccountID()); - ASSERT( + XRPL_ASSERT( !(iType & STPathElement::typeCurrency && iType & STPathElement::typeMPT), "ripple::STPath::getJson : not type Currency and MPT"); diff --git a/src/xrpld/app/misc/detail/MPTUtils.cpp b/src/xrpld/app/misc/detail/MPTUtils.cpp index c99a4b925ab..22e808352f3 100644 --- a/src/xrpld/app/misc/detail/MPTUtils.cpp +++ b/src/xrpld/app/misc/detail/MPTUtils.cpp @@ -42,7 +42,7 @@ isMPTAllowed( auto const allMPTTx = ammTx || txType == ttOFFER_CREATE || txType == ttCHECK_CREATE || txType == ttCHECK_CASH || txType == ttPAYMENT; - ASSERT(allMPTTx || isDEX, "ripple::isMPTAllowed : all MPT tx or DEX"); + XRPL_ASSERT(allMPTTx || isDEX, "ripple::isMPTAllowed : all MPT tx or DEX"); auto const issuanceKey = keylet::mptIssuance(issuanceID); auto const issuanceSle = view.read(issuanceKey); diff --git a/src/xrpld/app/paths/detail/DirectStep.cpp b/src/xrpld/app/paths/detail/DirectStep.cpp index ea5d3f7429a..3675d9f2980 100644 --- a/src/xrpld/app/paths/detail/DirectStep.cpp +++ b/src/xrpld/app/paths/detail/DirectStep.cpp @@ -722,7 +722,7 @@ DirectStepI::validFwd( auto const savCache = *cache_; - XRPL_ASSERT(!in.native, "ripple::DirectStepI::validFwd : input is not XRP"); + XRPL_ASSERT(!in.native(), "ripple::DirectStepI::validFwd : input is not XRP"); auto const [maxSrcToDst, srcDebtDir] = static_cast(this)->maxFlow(sb, cache_->srcToDst); diff --git a/src/xrpld/app/paths/detail/MPTEndpointStep.cpp b/src/xrpld/app/paths/detail/MPTEndpointStep.cpp index 178560bb1d0..6d69d82a82a 100644 --- a/src/xrpld/app/paths/detail/MPTEndpointStep.cpp +++ b/src/xrpld/app/paths/detail/MPTEndpointStep.cpp @@ -512,7 +512,7 @@ MPTEndpointStep::revImp( auto const [srcQOut, dstQIn] = qualities(sb, srcDebtDir, StrandDirection::reverse); - ASSERT( + XRPL_ASSERT( static_cast(this)->verifyDstQualityIn(dstQIn), "MPTEndpointStep::revImp : verify dst quaity in"); @@ -634,7 +634,7 @@ MPTEndpointStep::fwdImp( boost::container::flat_set& /*ofrsToRm*/, MPTAmount const& in) { - ASSERT(cache_, "MPTEndpointStep::fwdImp : valid cache"); + XRPL_ASSERT(cache_, "MPTEndpointStep::fwdImp : valid cache"); auto const [maxSrcToDst, srcDebtDir] = static_cast(this)->maxFlow(sb, cache_->srcToDst); @@ -723,7 +723,7 @@ MPTEndpointStep::validFwd( auto const savCache = *cache_; - ASSERT( + XRPL_ASSERT( !in.native() && !in.isIOU(), "MPTEndpoint::validFwd : not XRP or IOU"); @@ -789,7 +789,7 @@ MPTEndpointStep::qualitiesSrcIssues( { // Charge a transfer rate when issuing and previous step redeems - ASSERT( + XRPL_ASSERT( static_cast(this)->verifyPrevStepDebtDirection( prevStepDebtDirection), "MPTEndpointStep::qualitiesSrcIssues : verify prev step debt " diff --git a/src/xrpld/app/tx/detail/AMMBid.cpp b/src/xrpld/app/tx/detail/AMMBid.cpp index 3edc61cc5d0..aec7d953f81 100644 --- a/src/xrpld/app/tx/detail/AMMBid.cpp +++ b/src/xrpld/app/tx/detail/AMMBid.cpp @@ -51,8 +51,7 @@ AMMBid::preflight(PreflightContext const& ctx) return temINVALID_FLAG; } - if (auto const res = invalidAMMAssetPair( - ctx.tx[sfAsset].get(), ctx.tx[sfAsset2].get())) + if (auto const res = invalidAMMAssetPair(ctx.tx[sfAsset], ctx.tx[sfAsset2])) { JLOG(ctx.j.debug()) << "AMM Bid: Invalid asset pair."; return res; diff --git a/src/xrpld/app/tx/detail/AMMClawback.cpp b/src/xrpld/app/tx/detail/AMMClawback.cpp index 9f9db8ecd17..bba09a80040 100644 --- a/src/xrpld/app/tx/detail/AMMClawback.cpp +++ b/src/xrpld/app/tx/detail/AMMClawback.cpp @@ -83,7 +83,7 @@ AMMClawback::preflight(PreflightContext const& ctx) return temMALFORMED; } - if (clawAmount && clawAmount->get() != asset) + if (clawAmount && clawAmount->issue() != asset) { JLOG(ctx.j.trace()) << "AMMClawback: Amount's issuer/currency subfield " "does not match Asset field"; @@ -99,8 +99,8 @@ AMMClawback::preflight(PreflightContext const& ctx) TER AMMClawback::preclaim(PreclaimContext const& ctx) { - auto const asset = ctx.tx[sfAsset].get(); - auto const asset2 = ctx.tx[sfAsset2].get(); + auto const asset = ctx.tx[sfAsset]; + auto const asset2 = ctx.tx[sfAsset2]; auto const sleIssuer = ctx.view.read(keylet::account(ctx.tx[sfAccount])); if (!sleIssuer) return terNO_ACCOUNT; // LCOV_EXCL_LINE diff --git a/src/xrpld/app/tx/detail/AMMDelete.cpp b/src/xrpld/app/tx/detail/AMMDelete.cpp index e25cfcc494d..4592bbedf2c 100644 --- a/src/xrpld/app/tx/detail/AMMDelete.cpp +++ b/src/xrpld/app/tx/detail/AMMDelete.cpp @@ -77,8 +77,8 @@ AMMDelete::doApply() // as we go on processing transactions. Sandbox sb(&ctx_.view()); - auto const ter = deleteAMMAccount( - sb, ctx_.tx[sfAsset].get(), ctx_.tx[sfAsset2].get(), j_); + auto const ter = + deleteAMMAccount(sb, ctx_.tx[sfAsset], ctx_.tx[sfAsset2], j_); if (ter == tesSUCCESS || ter == tecINCOMPLETE) sb.apply(ctx_.rawView()); diff --git a/src/xrpld/app/tx/detail/AMMDeposit.cpp b/src/xrpld/app/tx/detail/AMMDeposit.cpp index 882c63d2730..416bb4cc2d5 100644 --- a/src/xrpld/app/tx/detail/AMMDeposit.cpp +++ b/src/xrpld/app/tx/detail/AMMDeposit.cpp @@ -108,8 +108,8 @@ AMMDeposit::preflight(PreflightContext const& ctx) return temMALFORMED; } - auto const asset = ctx.tx[sfAsset].get(); - auto const asset2 = ctx.tx[sfAsset2].get(); + auto const asset = ctx.tx[sfAsset]; + auto const asset2 = ctx.tx[sfAsset2]; if (auto const res = invalidAMMAssetPair(asset, asset2)) { JLOG(ctx.j.debug()) << "AMM Deposit: invalid asset pair."; @@ -279,10 +279,10 @@ AMMDeposit::preclaim(PreclaimContext const& ctx) return tesSUCCESS; }; - if (auto const ter = checkAsset(ctx.tx[sfAsset].get())) + if (auto const ter = checkAsset(ctx.tx[sfAsset])) return ter; - if (auto const ter = checkAsset(ctx.tx[sfAsset2].get())) + if (auto const ter = checkAsset(ctx.tx[sfAsset2])) return ter; } diff --git a/src/xrpld/app/tx/detail/AMMVote.cpp b/src/xrpld/app/tx/detail/AMMVote.cpp index 9396bf59d5f..c57198162aa 100644 --- a/src/xrpld/app/tx/detail/AMMVote.cpp +++ b/src/xrpld/app/tx/detail/AMMVote.cpp @@ -43,8 +43,7 @@ AMMVote::preflight(PreflightContext const& ctx) if (auto const ret = preflight1(ctx); !isTesSuccess(ret)) return ret; - if (auto const res = invalidAMMAssetPair( - ctx.tx[sfAsset].get(), ctx.tx[sfAsset2].get())) + if (auto const res = invalidAMMAssetPair(ctx.tx[sfAsset], ctx.tx[sfAsset2])) { JLOG(ctx.j.debug()) << "AMM Vote: invalid asset pair."; return res; diff --git a/src/xrpld/app/tx/detail/AMMWithdraw.cpp b/src/xrpld/app/tx/detail/AMMWithdraw.cpp index b1991c2fa0a..de9a45655d4 100644 --- a/src/xrpld/app/tx/detail/AMMWithdraw.cpp +++ b/src/xrpld/app/tx/detail/AMMWithdraw.cpp @@ -109,8 +109,8 @@ AMMWithdraw::preflight(PreflightContext const& ctx) return temMALFORMED; } - auto const asset = ctx.tx[sfAsset].get(); - auto const asset2 = ctx.tx[sfAsset2].get(); + auto const asset = ctx.tx[sfAsset]; + auto const asset2 = ctx.tx[sfAsset2]; if (auto const res = invalidAMMAssetPair(asset, asset2)) { JLOG(ctx.j.debug()) << "AMM Withdraw: Invalid asset pair."; @@ -441,12 +441,7 @@ AMMWithdraw::applyGuts(Sandbox& sb) return {result, false}; auto const res = deleteAMMAccountIfEmpty( - sb, - ammSle, - newLPTokenBalance, - ctx_.tx[sfAsset].get(), - ctx_.tx[sfAsset2].get(), - j_); + sb, ammSle, newLPTokenBalance, ctx_.tx[sfAsset], ctx_.tx[sfAsset2], j_); // LCOV_EXCL_START if (!res.second) return {res.first, false};