Skip to content
Open
Show file tree
Hide file tree
Changes from 95 commits
Commits
Show all changes
169 commits
Select commit Hold shift + click to select a range
cad305a
PoC for sponsored fees
mvadari Mar 13, 2024
43c16f3
PoC for sponsored reserve
mvadari Mar 18, 2024
5b9c767
Merge remote-tracking branch 'upstream/develop' into sponsor
tequdev Jul 29, 2025
d40f8cc
SponsorReserve,SponsorAccount
tequdev Jul 30, 2025
198ed72
fix OwnerCount
tequdev Jul 30, 2025
a798c60
test Disabled
tequdev Jul 30, 2025
f0addd8
fix addEmptyHolding
tequdev Jul 31, 2025
67bdd09
check reserve
tequdev Jul 31, 2025
0bddc95
clang-format
tequdev Jul 31, 2025
6e01f23
fix `fees().accountReserve(0)` to `fees().reserve`
tequdev Jul 31, 2025
abd8620
Add SponsorTransfer
tequdev Aug 1, 2025
5e65813
add reserve checks for SponsorTransfer
tequdev Aug 1, 2025
2071b39
use helper
tequdev Aug 1, 2025
9ff71aa
Merge remote-tracking branch 'upstream/develop' into sponsor
tequdev Sep 6, 2025
02d8f9f
Sponsor signing
tequdev Sep 7, 2025
e589b71
v2. SponsorSet
tequdev Sep 13, 2025
8e895a3
fullly rename
tequdev Sep 13, 2025
4eea76c
Create Sponsored Account / AccountDelete with ltSponsorship, Sponsore…
tequdev Sep 13, 2025
6aa0331
sfAccount to sfOwner
tequdev Sep 13, 2025
4abd94e
MaxFee
tequdev Sep 15, 2025
1cdf7bb
feePayer
tequdev Sep 15, 2025
110b222
add MaxFee test
tequdev Sep 15, 2025
20bce64
test AccountDelete for sponsorship
tequdev Sep 15, 2025
6c0732c
test checks
tequdev Sep 15, 2025
2a27280
fix test error
tequdev Sep 15, 2025
5ac7bbf
test SponsorshipRequire flags
tequdev Sep 15, 2025
759f843
Sponsor permissions
tequdev Sep 16, 2025
2afe570
High/Low SponsorAccount
tequdev Sep 18, 2025
a43ae9a
add InvariantCheck for sponsor count
tequdev Sep 18, 2025
89af817
add tests
tequdev Sep 18, 2025
453fd23
add Sponsor Oracle
tequdev Sep 19, 2025
cc5e063
add Credential sponsor test
tequdev Sep 19, 2025
5dc63b6
fix SponsorshipTransfer
tequdev Sep 20, 2025
613fe48
update account_objects for sponsorship
tequdev Sep 20, 2025
f7e1d4b
add AccountTx tests for Sponsorship
tequdev Sep 20, 2025
fed56b2
address SponsorAccount/Sponsee field changes
tequdev Sep 20, 2025
d494738
Fully Support NFTokenMint/Burn
tequdev Sep 20, 2025
6eb453f
Merge branch 'develop' into sponsor
tequdev Sep 20, 2025
ea72198
Transfer Trustline Sponsorship
tequdev Sep 24, 2025
aeaf679
Merge remote-tracking branch 'upstream/develop' into sponsor
tequdev Sep 24, 2025
ab4ac64
test Sponsor Reserve checks for Checks
tequdev Sep 24, 2025
3501309
test Sponsor Reserve checks for OfferCreate
tequdev Sep 24, 2025
c4b798e
test Sponsor Reserve checks for TicketCreate
tequdev Sep 24, 2025
9694de9
test Sponsor Reserve checks for Credentials
tequdev Sep 24, 2025
0c93bd6
test Sponsor Reserve checks for DelegateSet
tequdev Sep 24, 2025
b78885d
test Sponsor Reserve checks for DepositPreauth
tequdev Sep 24, 2025
cc4b07d
test Sponsor Reserve checks for DID, Escrow
tequdev Sep 24, 2025
ec11763
test Sponsor Reserve checks for NFToken
tequdev Sep 24, 2025
71b81b7
test Sponsor Reserve checks for PayChan, PermissionedDomain, Oracle
tequdev Sep 24, 2025
699297f
test Sponsor Reserve checks for SignerListSet
tequdev Sep 24, 2025
d5a1314
test Sponsor Reserve checks for TrustSet
tequdev Sep 24, 2025
e82c300
test Sponsor Reserve checks for AMM
tequdev Sep 25, 2025
dbbfc13
test for Vault
tequdev Sep 26, 2025
b096662
add InvariantChecks for pseudo-account
tequdev Sep 26, 2025
75aaeb5
Merge remote-tracking branch 'upstream/develop' into sponsor
tequdev Sep 26, 2025
1ee2508
Merge remote-tracking branch 'upstream/develop' into sponsor
tequdev Sep 30, 2025
5b64ff0
address 5594, 5592 changes
tequdev Sep 30, 2025
bc1ef1e
add tests for XChainBridge
tequdev Oct 2, 2025
59c3d5b
add insufficient reserve check for xchain, vault
tequdev Oct 2, 2025
4126d53
Merge remote-tracking branch 'origin/develop' into sponsor
tequdev Oct 3, 2025
ee385e9
fix bad merge
tequdev Oct 3, 2025
101b70f
add assert when adding/removing sponsor field to LedgerEntry
tequdev Oct 3, 2025
bc71d9c
Add support for extra transaction signature validation
ximinez Oct 3, 2025
d597726
refactor: signature autofilling for Simulate RPC
tequdev Oct 4, 2025
8d32b0f
Add jtx, STObject, and RPC support for sig object fields
ximinez Oct 6, 2025
1441abc
use `sfSponsorSignature`
tequdev Oct 3, 2025
9df0ad6
Merge branch 'sponsor-new-signing' into sponsor
tequdev Oct 7, 2025
28c5cad
fix transactions.macro format
tequdev Oct 7, 2025
a6b0eff
typo
tequdev Oct 7, 2025
32cc782
Merge branch 'refactor-simulate-autofill' into sponsor
tequdev Oct 7, 2025
754f597
Support sfSponsorSignature autofilling in Simulate RPC
tequdev Oct 7, 2025
7f922c4
reserve co-signing
tequdev Oct 7, 2025
a65cf6e
add tests for sponsor flags
tequdev Oct 8, 2025
d8dc000
add prefunded sponsor tests
tequdev Oct 8, 2025
5d597e3
Merge remote-tracking branch 'upstream/develop' into sponsor
tequdev Oct 16, 2025
2337d34
Allow delegation for Sponsorship transactions
tequdev Oct 17, 2025
4fe7e87
Merge remote-tracking branch 'upstream/develop' into sponsor
tequdev Oct 17, 2025
d0bcca6
Fix the behavior of co-sign + pre-fund
tequdev Oct 28, 2025
965ecd3
Add sponsored outer batch
tequdev Oct 28, 2025
774917d
Merge remote-tracking branch 'upstream/develop' into sponsor
tequdev Oct 31, 2025
b4188a8
address reviews
tequdev Nov 6, 2025
3e6d6c6
Merge remote-tracking branch 'upstream/develop' into sponsor
tequdev Nov 6, 2025
13145f6
fix header name
tequdev Nov 6, 2025
297083e
fix: specify type for adjust variable in SetOracle transaction proces…
tequdev Nov 6, 2025
cd62f7f
remove copyright
tequdev Nov 6, 2025
e03c7a9
add sponsor transfer test
tequdev Nov 9, 2025
fbf403a
add tests for sponsor field
tequdev Nov 9, 2025
a49cb91
add tests
tequdev Nov 10, 2025
3f96735
fix comment for LCOV
tequdev Nov 10, 2025
af9d91b
add tests fro SponsorshipTransfer
tequdev Nov 10, 2025
9d1b5eb
Merge remote-tracking branch 'upstream/develop' into sponsor
tequdev Nov 17, 2025
b5db596
update Sponsored VaultCreate test
tequdev Nov 17, 2025
c38cb90
Merge remote-tracking branch 'upstream/develop' into sponsor
tequdev Nov 21, 2025
7f0a940
Merge remote-tracking branch 'upstream/develop' into sponsor
tequdev Nov 21, 2025
a9629ae
address reviews
tequdev Nov 21, 2025
d96998c
Merge remote-tracking branch 'upstream/develop' into sponsor
tequdev Nov 26, 2025
e49d338
address SponsorshipSet reviews
tequdev Nov 26, 2025
f5e2195
address reviews
tequdev Dec 11, 2025
ea29fe5
Merge remote-tracking branch 'upstream/develop' into sponsor
tequdev Dec 11, 2025
0f36de8
Merge remote-tracking branch 'upstream/develop' into sponsor
tequdev Jan 7, 2026
198f3f8
remove unused insSponsorCoSigning args
tequdev Jan 7, 2026
163a2ac
add `sfPreviousTxnID` and `sfPreviousTxnLgrSeq` to ltSponsorship
tequdev Jan 7, 2026
2813fea
address review
tequdev Jan 7, 2026
cf03c4c
change Sponsor related fields to `soeDEFAULT`
tequdev Jan 7, 2026
edddf3f
address review
tequdev Jan 7, 2026
dc325a9
Merge branch 'develop' into sponsor
tequdev Jan 7, 2026
0791ca1
fix template exception
tequdev Jan 7, 2026
82b146b
fix ripple -> xrpl
tequdev Jan 7, 2026
1e8f6ce
address reviews
tequdev Jan 9, 2026
ffb5382
Merge remote-tracking branch 'upstream/develop' into sponsor
tequdev Jan 9, 2026
f88e964
allow `sponsee` on cspell
tequdev Jan 9, 2026
ec05613
fix typo
tequdev Jan 9, 2026
1bc5a1b
address spec changes (payment flags/ iou amount)
tequdev Jan 14, 2026
f885f02
address spec changes (sfReserveCount, sfFeeAmount)
tequdev Jan 14, 2026
5b91d81
address revew (std::optional + std::shared_ptr<SLE>)
tequdev Jan 15, 2026
9e65dba
fix redundant co-signed sponsor check
tequdev Jan 15, 2026
c321e10
address reviews
tequdev Jan 15, 2026
3568df4
add `calculateReserve` helper
tequdev Jan 15, 2026
c3e5bcf
address review (DeleteAccount)
tequdev Jan 15, 2026
52ae31b
Merge commit 'c9458b72cab68d3cbbf533cc87d14309c2eb93b7' into sponsor
tequdev Jan 15, 2026
204138f
Revert the use of calculateReserve in xrpLiquid
tequdev Jan 15, 2026
f333dd1
add signature existence check, consume ReserveCount if pre-funded spo…
tequdev Jan 27, 2026
1823d70
refactor Oracle Reserve calculation
tequdev Jan 27, 2026
990627f
Merge remote-tracking branch 'upstream/develop' into sponsor
tequdev Jan 27, 2026
ce8049a
fix parseSponsorship
tequdev Jan 27, 2026
88e870b
change sfSponsor to STAccount, Sponsor flags as global flags
tequdev Jan 27, 2026
87718bd
remove unused HashPrefix
tequdev Jan 29, 2026
8be44c7
Merge remote-tracking branch 'upstream/develop' into sponsor
tequdev Jan 29, 2026
ab1de45
add comment
tequdev Jan 29, 2026
5f385e0
update to use sfSponsorFlags
tequdev Jan 30, 2026
6576823
Payback ReserveCount
tequdev Jan 30, 2026
d7ab1b4
Separate test suite
tequdev Jan 30, 2026
c0de722
`sfHigh/LowSponsorAccount` -> `High/LowSponsor`
tequdev Jan 30, 2026
5155a94
Add sponsor tests for Batch innerTxn
tequdev Jan 30, 2026
4cd8d0d
fix simulate test
tequdev Jan 30, 2026
175a2df
chang `sfFeeAmount` to `soeOPTIONAL`
tequdev Jan 30, 2026
7cdaa24
Fixed the minimum amount for creating a Sponsored Account.
tequdev Jan 30, 2026
40cf599
Add sanity check for sponsoringAccountCount = 0
tequdev Jan 30, 2026
8f8fc03
Add InvariantChecks for if OwnerCount < SponsoredOwnerCount
tequdev Jan 30, 2026
0a41002
refactor SponsorshipSet flag checks
tequdev Jan 30, 2026
4a205eb
add checks to accountReserve and fix sponsored owner count for xrpLiquid
tequdev Jan 30, 2026
527d7bb
fix to return error if FeeAmount > Balance on SponsorshipSet
tequdev Jan 30, 2026
8d24afe
Merge remote-tracking branch 'upstream/develop' into sponsor
tequdev Jan 30, 2026
4e87de7
add test for Sponsored trustline
tequdev Jan 30, 2026
d390bc7
clang-format
tequdev Jan 30, 2026
f820908
Add tests for LoanBroker transactions
tequdev Feb 1, 2026
37f4ea9
Add tests for Loan
tequdev Feb 2, 2026
49c5269
`sfSponsorAccount` -> `sfSponsor`/`sfCounterpartySponsor`
tequdev Feb 2, 2026
fe07547
address review
tequdev Feb 2, 2026
e1aee43
address review
tequdev Feb 3, 2026
446681d
Merge remote-tracking branch 'upstream/develop' into sponsor
tequdev Feb 18, 2026
392a913
audit 3
tequdev Feb 18, 2026
d1d613d
audit 4
tequdev Feb 18, 2026
c1e1be5
audit 5
tequdev Feb 18, 2026
686f945
audit 6
tequdev Feb 18, 2026
bf4fa37
audit 7
tequdev Feb 18, 2026
f6d79f7
audit 8
tequdev Feb 18, 2026
9859ba8
audit 9
tequdev Feb 18, 2026
9cde57d
audit 10
tequdev Feb 18, 2026
fe5fab0
audit 11
tequdev Feb 18, 2026
2fd8e1b
audit 12
tequdev Feb 18, 2026
dcfcb1f
audit 13
tequdev Feb 18, 2026
293394f
audit 14
tequdev Feb 18, 2026
178bb8f
Allow zero value for ReserveCount, FeeAmount, MaxFee
tequdev Feb 21, 2026
f86b255
Add `SponsorshipEnd/Create/Reassign` flags for SponsorshipTransfer
tequdev Feb 21, 2026
4a91351
Add `sfSponsee` to `ttSponsorshipTransfer`
tequdev Feb 22, 2026
1ad6dd1
Add tests for deleting Sponsor Account with ltSponsorship
tequdev Feb 23, 2026
062ece3
Merge remote-tracking branch 'upstream/develop' into sponsor
tequdev Feb 23, 2026
9961887
clang-format
tequdev Feb 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 103 additions & 3 deletions include/xrpl/ledger/View.h
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,62 @@ areCompatible(
beast::Journal::Stream& s,
char const* reason);

uint32_t
ownerCount(std::shared_ptr<SLE const> const& sponsorSle);

bool
isReserveSponsored(STTx const& tx);

bool
isSponsorReserveCoSigning(STTx const& tx);

TER
checkInsufficientReserve(
ReadView const& view,
STTx const& tx,
std::shared_ptr<SLE const> accSle,
STAmount const& accBalance,
std::optional<std::shared_ptr<SLE const>> const& sponsorSle,
std::int32_t ownerCountDelta,
std::int32_t accountCountDelta = 0);

std::optional<AccountID>
getTxReserveSponsorAccountID(STTx const& tx);

std::optional<std::shared_ptr<SLE>>
getTxReserveSponsor(ApplyView& view, STTx const& tx);

std::optional<std::shared_ptr<SLE const>>
getTxReserveSponsor(ReadView const& view, STTx const& tx);

std::optional<AccountID>
getLedgerEntryReserveSponsorAccountID(
std::shared_ptr<SLE const> sle,
SF_ACCOUNT const& field = sfSponsorAccount);

std::optional<std::shared_ptr<SLE>>
getLedgerEntryReserveSponsor(
ApplyView& view,
std::shared_ptr<SLE> sle,
SF_ACCOUNT const& field = sfSponsorAccount);

std::optional<std::shared_ptr<SLE const>>
getLedgerEntryReserveSponsor(
ReadView const& view,
std::shared_ptr<SLE const> sle,
SF_ACCOUNT const& field = sfSponsorAccount);

void
addSponsorToLedgerEntry(
std::shared_ptr<SLE> const& sle,
std::optional<std::shared_ptr<SLE>> const& sponsorSle,
SF_ACCOUNT const& field = sfSponsorAccount);

void
removeSponsorFromLedgerEntry(
std::shared_ptr<SLE> const& sle,
SF_ACCOUNT const& field = sfSponsorAccount);

//------------------------------------------------------------------------------
//
// Modifiers
Expand All @@ -442,10 +498,42 @@ areCompatible(
void
adjustOwnerCount(
ApplyView& view,
std::shared_ptr<SLE> const& sle,
std::shared_ptr<SLE> const& accountSle,
std::optional<std::shared_ptr<SLE>> const& sponsorSle,
std::int32_t amount,
beast::Journal j);

inline void
adjustOwnerCount(
ApplyView& view,
STTx const& tx,
std::shared_ptr<SLE> const& accountSle,
std::optional<std::shared_ptr<SLE>> const& sponsorSle,
std::int32_t amount,
beast::Journal j)
{
adjustOwnerCount(view, accountSle, sponsorSle, amount, j);
}

inline void
adjustOwnerCount(
ApplyView& view,
STTx const& tx,
AccountID const& account,
std::optional<AccountID> const& sponsor,
std::int32_t amount,
beast::Journal j)
{
return adjustOwnerCount(
view,
tx,
view.peek(keylet::account(account)),
sponsor ? view.peek(keylet::account(*sponsor))
: std::optional<std::shared_ptr<SLE>>(),
amount,
j);
}

/** @{ */
/** Returns the first entry in the directory, advancing the index

Expand Down Expand Up @@ -567,6 +655,7 @@ canAddHolding(ReadView const& view, Asset const& asset);
[[nodiscard]] TER
addEmptyHolding(
ApplyView& view,
STTx const& tx,
AccountID const& accountID,
XRPAmount priorBalance,
Issue const& issue,
Expand All @@ -575,6 +664,7 @@ addEmptyHolding(
[[nodiscard]] TER
addEmptyHolding(
ApplyView& view,
STTx const& tx,
AccountID const& accountID,
XRPAmount priorBalance,
MPTIssue const& mptIssue,
Expand All @@ -583,6 +673,7 @@ addEmptyHolding(
[[nodiscard]] inline TER
addEmptyHolding(
ApplyView& view,
STTx const& tx,
AccountID const& accountID,
XRPAmount priorBalance,
Asset const& asset,
Expand All @@ -591,14 +682,15 @@ addEmptyHolding(
return std::visit(
[&]<ValidIssueType TIss>(TIss const& issue) -> TER {
return addEmptyHolding(
view, accountID, priorBalance, issue, journal);
view, tx, accountID, priorBalance, issue, journal);
},
asset.value());
}

[[nodiscard]] TER
authorizeMPToken(
ApplyView& view,
STTx const& tx,
XRPAmount const& priorBalance,
MPTID const& mptIssuanceID,
AccountID const& account,
Expand Down Expand Up @@ -631,32 +723,37 @@ trustCreate(
// Issuer should be the account being set.
std::uint32_t uSrcQualityIn,
std::uint32_t uSrcQualityOut,
std::optional<AccountID> const& sponsorAccountID,
bool const isSponsorCoSigning,
beast::Journal j);

[[nodiscard]] TER
removeEmptyHolding(
ApplyView& view,
STTx const& tx,
AccountID const& accountID,
Issue const& issue,
beast::Journal journal);

[[nodiscard]] TER
removeEmptyHolding(
ApplyView& view,
STTx const& tx,
AccountID const& accountID,
MPTIssue const& mptIssue,
beast::Journal journal);

[[nodiscard]] inline TER
removeEmptyHolding(
ApplyView& view,
STTx const& tx,
AccountID const& accountID,
Asset const& asset,
beast::Journal journal)
{
return std::visit(
[&]<ValidIssueType TIss>(TIss const& issue) -> TER {
return removeEmptyHolding(view, accountID, issue, journal);
return removeEmptyHolding(view, tx, accountID, issue, journal);
},
asset.value());
}
Expand Down Expand Up @@ -729,6 +826,8 @@ accountSend(
AccountID const& to,
STAmount const& saAmount,
beast::Journal j,
std::optional<AccountID> const& sponsorAcc = std::nullopt,
bool isSponsorCoSigning = false,
WaiveTransferFee waiveFee = WaiveTransferFee::No);

[[nodiscard]] TER
Expand Down Expand Up @@ -859,6 +958,7 @@ requireAuth(
[[nodiscard]] TER
enforceMPTokenAuthorization(
ApplyView& view,
STTx const& tx,
MPTID const& mptIssuanceID,
AccountID const& account,
XRPAmount const& priorBalance,
Expand Down
12 changes: 10 additions & 2 deletions include/xrpl/protocol/Fees.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,17 @@
the reserve increment times the number of increments.
*/
XRPAmount
accountReserve(std::size_t ownerCount) const
accountReserve(
std::size_t ownerCount,
std::size_t sponsoredOwnerCount = 0,
std::size_t sponsoringOwnerCount = 0,
bool isAccountSponsored = false,
std::size_t sponsoringAccountCount = 0) const
{
return reserve + ownerCount * increment;
return (isAccountSponsored ? XRPAmount(0) : reserve) +
increment *

Check warning on line 38 in include/xrpl/protocol/Fees.h

View check run for this annotation

Codecov / codecov/patch

include/xrpl/protocol/Fees.h#L38

Added line #L38 was not covered by tests
(ownerCount + sponsoringOwnerCount - sponsoredOwnerCount) +
reserve * sponsoringAccountCount;
}
};

Expand Down
3 changes: 3 additions & 0 deletions include/xrpl/protocol/HashPrefix.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ enum class HashPrefix : std::uint32_t {

/** Batch */
batch = detail::make_hash_prefix('B', 'C', 'H'),

/** Sponsor */
sponsor = detail::make_hash_prefix('S', 'P', 'N'),
};

template <class Hasher>
Expand Down
4 changes: 4 additions & 0 deletions include/xrpl/protocol/Indexes.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ static ticket_t const ticket{};
Keylet
signers(AccountID const& account) noexcept;

/** A Sponsor */
Keylet
sponsor(AccountID const& sponsor, AccountID const& sponsee) noexcept;

/** A Check */
/** @{ */
Keylet
Expand Down
6 changes: 6 additions & 0 deletions include/xrpl/protocol/LedgerFormats.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ enum LedgerSpecificFlags {
0x40000000, // True, enable trustline locking
lsfAllowTrustLineClawback =
0x80000000, // True, enable clawback
lsfDisallowIncomingSponsor =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to double check if we still want to add this flag.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0x00004000, // True, reject new sponsor

// ltOFFER
lsfPassive = 0x00010000,
Expand Down Expand Up @@ -186,6 +188,10 @@ enum LedgerSpecificFlags {

// ltVAULT
lsfVaultPrivate = 0x00010000,

// ltSPONSORSHIP
lsfSponsorshipRequireSignForFee = 0x00010000,
lsfSponsorshipRequireSignForReserve = 0x00020000,
};

//------------------------------------------------------------------------------
Expand Down
18 changes: 18 additions & 0 deletions include/xrpl/protocol/Sponsor.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include <xrpl/protocol/AccountID.h>
#include <xrpl/protocol/HashPrefix.h>
#include <xrpl/protocol/STVector256.h>
#include <xrpl/protocol/Serializer.h>

namespace ripple {

inline void
addSerializeSponsorData(
Serializer& msg,
AccountID const& sponsorID,
std::uint32_t const& flags)
{
msg.addBitString(sponsorID);
msg.add32(flags);
}

} // namespace ripple
2 changes: 2 additions & 0 deletions include/xrpl/protocol/TER.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ enum TERcodes : TERUnderlyingType {
terADDRESS_COLLISION, // Failed to allocate AccountID when trying to
// create a pseudo-account
terNO_DELEGATE_PERMISSION, // Delegate does not have permission
terNO_SPONSORSHIP, // No sponsorship found
};

//------------------------------------------------------------------------------
Expand Down Expand Up @@ -347,6 +348,7 @@ enum TECcodes : TERUnderlyingType {
// backward compatibility with historical data on non-prod networks, can be
// reclaimed after those networks reset.
tecNO_DELEGATE_PERMISSION = 198,
tecNO_SPONSOR_PERMISSION = 199,
};

//------------------------------------------------------------------------------
Expand Down
17 changes: 16 additions & 1 deletion include/xrpl/protocol/TxFlags.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ constexpr std::uint32_t tfInnerBatchTxn = 0x40000000;
constexpr std::uint32_t tfUniversal = tfFullyCanonicalSig | tfInnerBatchTxn;
constexpr std::uint32_t tfUniversalMask = ~tfUniversal;

// Sponsor flags (Global):
constexpr std::uint32_t tfSponsorFee = 0x00000001;
constexpr std::uint32_t tfSponsorReserve = 0x00000002;
constexpr std::uint32_t tfSponsorMask = ~(tfSponsorFee | tfSponsorReserve);

// AccountSet flags:
constexpr std::uint32_t tfRequireDestTag = 0x00010000;
constexpr std::uint32_t tfOptionalDestTag = 0x00020000;
Expand Down Expand Up @@ -74,6 +79,7 @@ constexpr std::uint32_t asfDisallowIncomingPayChan = 14;
constexpr std::uint32_t asfDisallowIncomingTrustline = 15;
constexpr std::uint32_t asfAllowTrustLineClawback = 16;
constexpr std::uint32_t asfAllowTrustLineLocking = 17;
constexpr std::uint32_t asfDisallowIncomingSponsor = 19;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be 18?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setting this to 19 because asfDisallowIncomingCredentials uses 18.

#5704

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the discussion in #5704 I don't think we need to hold the number. Also, we can always change the number in #5704 to 19 (or whatever the next available number is).


// OfferCreate flags:
constexpr std::uint32_t tfPassive = 0x00010000;
Expand All @@ -88,8 +94,9 @@ constexpr std::uint32_t tfOfferCreateMask =
constexpr std::uint32_t tfNoRippleDirect = 0x00010000;
constexpr std::uint32_t tfPartialPayment = 0x00020000;
constexpr std::uint32_t tfLimitQuality = 0x00040000;
constexpr std::uint32_t tfSponsorCreatedAccount = 0x00080000;
constexpr std::uint32_t tfPaymentMask =
~(tfUniversal | tfPartialPayment | tfLimitQuality | tfNoRippleDirect);
~(tfUniversal | tfPartialPayment | tfLimitQuality | tfNoRippleDirect | tfSponsorCreatedAccount);
constexpr std::uint32_t tfMPTPaymentMask = ~(tfUniversal | tfPartialPayment);

// TrustSet flags:
Expand Down Expand Up @@ -266,6 +273,14 @@ constexpr std::uint32_t tfIndependent = 0x00080000;
constexpr std::uint32_t const tfBatchMask =
~(tfUniversal | tfAllOrNothing | tfOnlyOne | tfUntilFailure | tfIndependent) | tfInnerBatchTxn;

// SponsorshipSet flags:
constexpr std::uint32_t tfSponsorshipSetRequireSignForFee = 0x00010000;
constexpr std::uint32_t tfSponsorshipClearRequireSignForFee = 0x00020000;
constexpr std::uint32_t tfSponsorshipSetRequireSignForReserve = 0x00040000;
constexpr std::uint32_t tfSponsorshipClearRequireSignForReserve = 0x00080000;
constexpr std::uint32_t tfDeleteObject = 0x00100000;
constexpr std::uint32_t tfSponsorshipSetMask = ~(tfUniversal | tfSponsorshipSetRequireSignForFee | tfSponsorshipClearRequireSignForFee | tfSponsorshipSetRequireSignForReserve | tfSponsorshipClearRequireSignForReserve | tfDeleteObject);

// clang-format on

} // namespace ripple
Expand Down
1 change: 1 addition & 0 deletions include/xrpl/protocol/detail/features.macro
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// Add new amendments to the top of this list.
// Keep it sorted in reverse chronological order.

XRPL_FEATURE(Sponsor, Supported::no, VoteBehavior::DefaultNo)
XRPL_FEATURE(PermissionDelegationV1_1, Supported::no, VoteBehavior::DefaultNo)
XRPL_FIX (DirectoryLimit, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (IncludeKeyletFields, Supported::yes, VoteBehavior::DefaultNo)
Expand Down
18 changes: 18 additions & 0 deletions include/xrpl/protocol/detail/ledger_entries.macro
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ LEDGER_ENTRY(ltACCOUNT_ROOT, 0x0061, AccountRoot, account, ({
{sfFirstNFTokenSequence, soeOPTIONAL},
{sfAMMID, soeOPTIONAL}, // pseudo-account designator
{sfVaultID, soeOPTIONAL}, // pseudo-account designator
{sfSponsoredOwnerCount, soeOPTIONAL},
{sfSponsoringOwnerCount, soeOPTIONAL},
{sfSponsoringAccountCount,soeOPTIONAL},
}))

/** A ledger object which contains a list of object identifiers.
Expand Down Expand Up @@ -283,6 +286,8 @@ LEDGER_ENTRY(ltRIPPLE_STATE, 0x0072, RippleState, state, ({
{sfHighNode, soeOPTIONAL},
{sfHighQualityIn, soeOPTIONAL},
{sfHighQualityOut, soeOPTIONAL},
{sfHighSponsorAccount, soeOPTIONAL},
{sfLowSponsorAccount, soeOPTIONAL},
}))

/** The ledger object which lists the network's fee settings.
Expand Down Expand Up @@ -490,5 +495,18 @@ LEDGER_ENTRY(ltVAULT, 0x0084, Vault, vault, ({
// no PermissionedDomainID ever (use MPTIssuance.sfDomainID)
}))

/** A ledger object representing a sponsorship.
\sa keylet::sponsor
*/
LEDGER_ENTRY(ltSPONSORSHIP, 0x0085, Sponsorship, sponsorship, ({
{sfOwner, soeREQUIRED},
{sfSponsee, soeREQUIRED},
{sfFeeAmount, soeOPTIONAL},
{sfMaxFee, soeOPTIONAL},
{sfReserveCount, soeOPTIONAL},
{sfOwnerNode, soeREQUIRED},
{sfSponseeNode, soeREQUIRED},
}))

#undef EXPAND
#undef LEDGER_ENTRY_DUPLICATE
Loading