more fixes (part 5) (#7779)

This commit is contained in:
Mayukha Vadari
2026-07-09 18:02:15 -04:00
committed by GitHub
parent a065ab6c09
commit 9abeb52051
15 changed files with 149 additions and 57 deletions

View File

@@ -413,6 +413,17 @@ public:
emptyDirDelete(Keylet const& directory);
};
/** Bundles the mutable ledger view and the transaction being applied.
Passed together to avoid threading two separate parameters through every
helper that needs both the view (for state reads/writes) and the
transaction (for field inspection and metadata).
Both members are non-owning references; the caller is responsible for
ensuring that the referenced objects outlive the ApplyViewContext.
TODO: replace with ApplyContext after it's untangled with xrpl/tx
*/
struct ApplyViewContext
{
ApplyView& view;

View File

@@ -43,7 +43,7 @@ struct OwnerCounts
}
if (x > std::numeric_limits<std::uint32_t>::max())
return std::numeric_limits<std::uint32_t>::max();
return std::numeric_limits<std::uint32_t>::max(); // LCOV_EXCL_LINE
return static_cast<std::uint32_t>(x);
}
@@ -65,15 +65,6 @@ struct OwnerCounts
return this == &o ||
(owner == o.owner && sponsored == o.sponsored && sponsoring == o.sponsoring);
}
[[nodiscard]] bool
valid() const
{
int64_t const x = static_cast<int64_t>(owner) - sponsored + sponsoring;
if (x < 0 || x > std::numeric_limits<std::uint32_t>::max())
return false;
return owner >= sponsored;
}
};
} // namespace xrpl

View File

@@ -68,7 +68,7 @@ escrowUnlockApplyHelper<Issue>(
if (!ctx.view.exists(trustLineKey) && createAsset)
{
// Can the account cover the trust line's reserve?
auto const sponsorSle = getTxReserveSponsor(ctx);
auto const sponsorSle = getEffectiveTxReserveSponsor(ctx, sleDest);
if (!sponsorSle)
return sponsorSle.error(); // LCOV_EXCL_LINE
@@ -197,7 +197,7 @@ escrowUnlockApplyHelper<MPTIssue>(
auto const mptKeylet = keylet::mptoken(issuanceKey.key, receiver);
if (!ctx.view.exists(mptKeylet) && createAsset && !receiverIssuer)
{
auto const sponsorSle = getTxReserveSponsor(ctx);
auto const sponsorSle = getEffectiveTxReserveSponsor(ctx, sleDest);
if (!sponsorSle)
return sponsorSle.error(); // LCOV_EXCL_LINE

View File

@@ -93,12 +93,6 @@ getLedgerEntryReserveSponsor(
SLE::const_ref sle,
SF_ACCOUNT const& field = sfSponsor);
SLE::const_pointer
getLedgerEntryReserveSponsor(
ReadView const& view,
SLE::const_ref sle,
SF_ACCOUNT const& field = sfSponsor);
void
addSponsorToLedgerEntry(
SLE::ref sle,

View File

@@ -1163,8 +1163,9 @@ TRANSACTION(ttCONFIDENTIAL_MPT_CLAWBACK, 89, ConfidentialMPTClawback,
{sfHolder, SoeRequired},
{sfMPTAmount, SoeRequired},
{sfZKProof, SoeRequired},
}))/** This transaction transfer sponsorship */
}))
/** This transaction transfers sponsorship on an object/account. */
#if TRANSACTION_INCLUDE
# include <xrpl/tx/transactors/sponsor/SponsorshipTransfer.h>
#endif
@@ -1177,7 +1178,7 @@ TRANSACTION(ttSPONSORSHIP_TRANSFER, 90, SponsorshipTransfer,
{sfSponsee, SoeOptional},
}))
/** This transaction create sponsorship object */
/** This transaction creates a Sponsorship object. */
#if TRANSACTION_INCLUDE
# include <xrpl/tx/transactors/sponsor/SponsorshipSet.h>
#endif