Skip to content

XLS-68: Sponsor#5887

Open
tequdev wants to merge 169 commits intoXRPLF:developfrom
tequdev:sponsor
Open

XLS-68: Sponsor#5887
tequdev wants to merge 169 commits intoXRPLF:developfrom
tequdev:sponsor

Conversation

@tequdev
Copy link
Member

@tequdev tequdev commented Oct 14, 2025

High Level Overview of Change

Context of Change

Type of Change

  • New feature (non-breaking change which adds functionality)

API Impact

  • Public API: New feature (new methods and/or new fields)
  • Public API: Breaking change (in general, breaking changes should only impact the next api_version)
  • libxrpl change (any change that may affect libxrpl or dependents of libxrpl)
  • Peer protocol change (must be backward compatible or bump the peer protocol version)

TYPED_SFIELD(sfSponsor, ACCOUNT, 27)
TYPED_SFIELD(sfHighSponsor, ACCOUNT, 28)
TYPED_SFIELD(sfLowSponsor, ACCOUNT, 29)
TYPED_SFIELD(sfCounterpartySponsor, ACCOUNT, 30)
Copy link
Collaborator

Choose a reason for hiding this comment

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

XLS-68 updated, sfCounterpartySponsor not present

Copy link
Member Author

Choose a reason for hiding this comment

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

@mvadari
I believe this field is necessary, but was it missing from the spec?

featureSponsor,
noPriv,
({
{sfCounterpartySponsor, soeOPTIONAL},
Copy link
Collaborator

Choose a reason for hiding this comment

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

XLS-68 updated, please fix (sfSponsor)

Copy link
Member Author

Choose a reason for hiding this comment

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

featureSponsor,
noPriv,
({
{sfCounterpartySponsor, soeOPTIONAL},
Copy link
Collaborator

Choose a reason for hiding this comment

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

XLS updated, sfSponsor

Copy link
Member Author

Choose a reason for hiding this comment

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


auto reserveSponsorAccSle = getTxReserveSponsor(view(), ctx_.tx);

if (feeAmount && (*feeAmount).xrp() > (*sponsorAccSle)[sfBalance])

Choose a reason for hiding this comment

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

SponsorshipSet update path: balance check uses total feeAmount instead of delta
In SponsorshipSet::doApply(), the balance check at line 225 compares the total new feeAmount from the transaction against the sponsor's current balance. This check runs before both the Create and Update code paths. For the Create path, this is correct. However, for the Update path (line 276+), the check is incorrect because it should compare only the delta (new - current) against the balance.

}

FeePayer
Transactor::getFeePayer(ReadView const& view, STTx const& tx)
Copy link
Collaborator

Choose a reason for hiding this comment

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

A drive-by thought: would it be better to have this function live in STTx?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Upon further review of this function, I think what makes more sense is a simpler function in STTx that just returns sfSponsor.value_or(sfDelegate).value_or(sfAccount) (I know this isn't completely correct but my point is that it just returns the account, which this function can ingest for the more complicated analysis, but the STTx helper function may be useful elsewhere)

Copy link
Member Author

Choose a reason for hiding this comment

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

If a FeeSponsor exists, we need to know whether it's PreFunded or CoSigning.
To determine this, we need a "view".

That's why I've implemented it as Transactor::getFeePayer(). And Instead of just returning an AccountID, it returns information such as the AccountKeylet and the field where the fee is deducted.


FeePayer
Transactor::getFeePayer(ReadView const& view, STTx const& tx)
{
Copy link
Collaborator

Choose a reason for hiding this comment

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

Another drive-by thought: we could merge a refactor version of introducing getFeePayer into develop to make this PR a bit smaller/easier to read.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Amendment Blocked: Needs Final XLS The corresponding final XLS must have been merged before this PR is merged. QE test required RippleX QE Team must look at this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants