Skip to content

IOUIssuerWeakTSH#388

Merged
RichardAH merged 35 commits intoXahau:devfrom
tequdev:IOUIssuerWeakTSH
Jul 9, 2025
Merged

IOUIssuerWeakTSH#388
RichardAH merged 35 commits intoXahau:devfrom
tequdev:IOUIssuerWeakTSH

Conversation

@tequdev
Copy link
Member

@tequdev tequdev commented Oct 29, 2024

Affected to

  • CheckCreate
  • CheckCash
  • EscrowCancel
  • EscrowCreate
  • EscrowFinish
  • OfferCreate
  • Payment
  • PaymentChannelClaim
  • PaymentChannelCreate
  • PaymentChannelFund
  • URITokenBuy
  • Remit

High Level Overview of Change

Context of Change

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (non-breaking change that only restructures code)
  • Tests (you added tests for code that already exists, or your new feature included in this PR)
  • Documentation update
  • Chore (no impact to binary, e.g. .gitignore, formatting, dropping support for older tooling)
  • Release

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)

if (ctx_.view().rules().enabled(featureIOUIssuerWeakTSH))
{
additionalWeakTSH_.emplace(lowAcc);
additionalWeakTSH_.emplace(highAcc);
Copy link
Contributor

Choose a reason for hiding this comment

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

The code in which additionalWeakTSH_ is processed probably needs to be changed to ensure if an account appears twice as a result of this change that it will always use the strongest TSH status

if (alreadyProcessed.find(tshAccountID) != alreadyProcessed.end())

Copy link
Member Author

Choose a reason for hiding this comment

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

strongTSH is added by getTransactionalStakeHolders(), and weakTSHs are added to the end of that vector list.

Therefore, in the alreadyProcessed processing, strongTSH won't be processed after weakTSH, right?

@tequdev
Copy link
Member Author

tequdev commented Nov 15, 2024

Need to resolve WeakTSH handling issue when transaction results in deletion of ledger object

#137

@tequdev tequdev changed the title IOUIssuerWeakTSH [DO NOT MERGE] IOUIssuerWeakTSH May 29, 2025
@tequdev tequdev linked an issue May 29, 2025 that may be closed by this pull request
// the burner is the owner and not the issuer of the token
// the burner is the issuer and not the owner of the token

if (iouIssuerWeakTSH && amount)
Copy link
Contributor

Choose a reason for hiding this comment

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

amount.has_value() is preferred way to test optionals

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm also wondering if this should be a weak tsh? This amount field on the uritoken is for a sale offer, but here the token is being destroyed. I guess it doesn't hurt but it's very very ancillary to the amount's issuer. None of their tokens change hands here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, we need consistency.

  1. Only treat as TSH when there is a change in the IOU Balance

or

  1. Treat as TSH when IOU is specified in the transaction (regardless of whether there is a change in the Balance) (and Balance changed)

Copy link
Contributor

Choose a reason for hiding this comment

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

Tbh it's kind of beyond a weak tsh, like "ultra weak" or ancillary or hypothetical tsh. Because the Issuer isn't a party to the transaction, isn't a stakeholder in the transaction, what we're actually saying is that they might become a party to a transaction involving this object later, and specifically in this case: that they will no longer be a party to a hypothetical future transaction involving this object later. Very ancillary indeed.

I guess my question is: does the meticulous chasing of these ancillary edges cases actually make weak tsh too expensive or less useful for its intended usecase? Should we instead add a third category of tsh for these cases and let them opt into that maybe? I suppose they can always use HookOn to ensure they're opting out, unless they're both an issuer for a currency and the issuer of uritokens.

std::vector<hook::HookResult> weakResults;

doTSH(false, stateMap, weakResults, proMeta);
if (!view().rules().enabled(featureIOUIssuerWeakTSH))
Copy link
Contributor

Choose a reason for hiding this comment

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

is this condition supposed to be inverted?

Copy link
Member Author

Choose a reason for hiding this comment

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

This PR changes getTransactionalStakeHolders() to be called only once, but since a second call is still needed when the feature is disabled, it is called here.

I will add a comment.

@RichardAH RichardAH merged commit ee27049 into Xahau:dev Jul 9, 2025
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants