From 3bdc96c0f314255eb6aad06cde211bbdc42a12cf Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Wed, 24 Jun 2026 16:28:44 -0400 Subject: [PATCH] fix SponsorshipTransfer too --- .../Sponsor/SponsorshipTransfer.cpp | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/libxrpl/tx/transactors/Sponsor/SponsorshipTransfer.cpp b/src/libxrpl/tx/transactors/Sponsor/SponsorshipTransfer.cpp index c4e9ac817f..9f2ca0fde4 100644 --- a/src/libxrpl/tx/transactors/Sponsor/SponsorshipTransfer.cpp +++ b/src/libxrpl/tx/transactors/Sponsor/SponsorshipTransfer.cpp @@ -265,6 +265,32 @@ SponsorshipTransfer::preclaim(PreclaimContext const& ctx) if (!sle) return tecNO_ENTRY; + // v1 scope: an object is only sponsorable via SponsorshipTransfer if + // its creating transaction type is itself permitted to set + // spfSponsorReserve (the allow-list in preflight1Sponsor). Otherwise + // an Oracle / Ticket / DID / etc. could be retroactively sponsored + // even though its creating tx cannot be, leaving downstream + // transactors with no path to maintain the sponsorship invariants. + switch (sle->getType()) + { + case ltDELEGATE: + case ltDEPOSIT_PREAUTH: + case ltMPTOKEN: + case ltMPTOKEN_ISSUANCE: + case ltLOAN: + case ltCREDENTIAL: + case ltRIPPLE_STATE: + // TBD object types (Check / Escrow / PaymentChannel) — kept + // sponsorable in v1; revisit when their tx-level support is + // formalized. + case ltCHECK: + case ltESCROW: + case ltPAYCHAN: + break; + default: + return tecNO_PERMISSION; + } + auto const ownerCountDelta = getLedgerEntryOwnerCount(sle); auto const owner = getLedgerEntryOwner(ctx.view, sle, sponseeID);