Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

featureDisallowIncoming: Opt-out of incoming Checks, PayChans, NFTokenOffers and Trustlines #4336

Merged
merged 5 commits into from
Dec 20, 2022

Conversation

RichardAH
Copy link
Collaborator

@RichardAH RichardAH commented Nov 5, 2022

High Level Overview of Change

Allow users of the XRPL to signal (and enforce) that they do not wish to accept an incoming instrument of any (or all) of the following:

  • Check
  • NFTokenOffer
  • PaymentChannel
  • Trustlines

Context of Change

Significant support resources at XUMM are being wasted by end users who are on the unsolicited receiving end of these objects. While a client side block is possible, it is better for the ledger that unsolicited objects are never created in the first place.

If enabled the following three AccountSet Flags are added:

asfDisallowIncomingNFTOffer
asfDisallowIncomingCheck
asfDisallowIncomingPayChan
asfDisallowIncomingTrustline

Their behaviour and usage is exactly as you'd expect so I won't detail it.

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 Updates
  • Release

Test Plan

Tests have been added in PayChan_test.cpp, Check_test.cpp, NFToken_test.cpp and SetTrust_test.cpp

@RichardAH RichardAH changed the title featureDisallowIncoming: Opt-out of incoming Checks, PayChans and NFTokenOffers featureDisallowIncoming: Opt-out of incoming Checks, PayChans and NFTokenOffers Nov 5, 2022
@RichardAH
Copy link
Collaborator Author

Longest suite times:
   41.9s ripple.tx.Offer
   35.0s ripple.app.ValidatorSite
   30.7s ripple.tx.NFToken
   21.3s ripple.rpc.NodeToShardRPC
   16.9s ripple.tx.NFTokenBurn
   13.8s ripple.app.Flow
   13.7s ripple.app.ShardArchiveHandler
   12.7s ripple.app.TheoreticalQuality
    8.4s ripple.app.LedgerReplayer
    7.7s ripple.tx.NFTokenDir
348.9s, 204 suites, 1591 cases, 548477 tests total, 0 failures

@WietseWind
Copy link
Member

WietseWind commented Nov 5, 2022

Yes. We need this. Users need this. The current situation confuses users.

Thanks for the quick Dev 😬

https://twitter.com/wietsewind/status/1588889982026285056

@seelabs
Copy link
Collaborator

seelabs commented Nov 7, 2022

@RichardAH Just a head's up that Scott S. is away this week, I don't think he'll be able to review this until next week.

@intelliot
Copy link
Collaborator

intelliot commented Nov 8, 2022

What's the envisioned user experience in cases where users change their mind?

e.g. they don't think they want NFT offers, but later try to use the feature. What prevents confusion about the feature being blocked?

And then when they do - intentionally - want to allow incoming NFT offers, what prevents users from being spammed anyway?

I know that the PR description states that ignoring such objects on the client side is an inferior solution, but I think we should dig into this a bit further, and discuss it for the benefit of developers who read about this amendment in the future:

Wallets could ignore such objects by default (and not show them to users). Similar to spam email, the wallet could run some kind of simple algorithm to determine whether the user should be shown the unsolicited object.

Introducing these three account flags won't eliminate spam on the ledger, as it's a public blockchain and there are myriad different ways to spam (for example - even to the extent of creating new accounts, which may or may not be controllable by the spammer).

Copy link
Contributor

@nbougalis nbougalis left a comment

Choose a reason for hiding this comment

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

I like this functionality. I think we need to consider (separately) a flag that marks an account as “not incoming trustlines” which prevents the creation of trustlines to the account.

I only gave this a quick look, but it looks fine. Mark this as approved by me.

@WietseWind
Copy link
Member

Thanks @nbougalis

And @intelliot: I do not believe client side filtering is the right solution. We're living in 2022 and still receiving spam in our mailbox, and still instructing people to check their spam box. On top of that, all resources to send, transfer, receive, filter email are still being wasted. We have a shot here at preventing that hot mess on the XRPL, by simply allowing users to opt out of certain objects.

(Example with NFTs, same applies for other objects) If I own no NFTs, why would I possibly want to receive offers to buy one? Even if my client filters it: it pollutes the ledger, it pollutes my account history, and it moves the responsibility to keep things clean to hopefully one day 100 different clients, instead of the single source of truth where something unwanted could be stopped at the source.

And with the above example in mind: if I, one day, want to purchase an NFT, I use a random marketplace: the market place asks me to sign in, sees my r-address, sees I have the flag set not to receive offers, and tells me to change that flag in one simple swipe. Streamlined UI, lot of support tickets, forever persisting history pollution and wasted ledger resources prevented.

@RichardAH
Copy link
Collaborator Author

RichardAH commented Nov 8, 2022

What's the envisioned user experience in cases where users change their mind?

The flags are easy for a platform to check. When you sign into that platform they check to see if your account is in the correct state to receive the objects their platform uses, and if it isn’t then give you a sign request to change your account settings.

Introducing these three account flags won't eliminate spam on the ledger, as it's a public blockchain and there are myriad different ways to spam (for example - even to the extent of creating new accounts, which may or may not be controllable by the spammer).

Creating new accounts still won’t allow you to send NFTOffers to an account who has asfDisallowIncomingNFTOffer.

As the ledger gets more complicated it is (highly) likely that different users will have different use cases. A bank doesn’t necessarily want to receive NFTOffers and an NFT trader doesn’t necessarily want to receive payment channels. At best receiving (being the target of) objects you don’t want or understand is annoying at worst it is a compliance (“how do we avoid putting this on our books”) and fear (“am I hacked?”) issue for end users. The XRPL already started down the path of ledger-side blocking with asfRequireAuth and asfRequireDest. It is very inconsistent to then add random new features without a way to also restrict these affecting an account and say “let the wallet deal with it”. If we are going to do that then I propose removing the existing flags too

@RichardAH
Copy link
Collaborator Author

I like this functionality. I think we need to consider (separately) a flag that marks an account as “not incoming trustlines” which prevents the creation of trustlines to the account.

I only gave this a quick look, but it looks fine. Mark this as approved by me.

I was going to add such a flag but then realised asfRequireAuth should already do this? Incidentally blocking trustline creation is a form of freezing. It needs to be done carefully as not to contradict other behaviour

@nbougalis
Copy link
Contributor

I was going to add such a flag but then realised asfRequireAuth should already do this? Incidentally blocking trustline creation is a form of freezing. It needs to be done carefully as not to contradict other behaviour

It doesn't: even if you have asfRequireAuth, the trustline can be created and there is a big difference between that and marking an account as "not issuing".

Copy link
Collaborator

@seelabs seelabs left a comment

Choose a reason for hiding this comment

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

I'm in favor of this. I left a few nits, but I'm giving a thumbs-up now (however you want to resolve those is fine with me, including keeping it as-is).

My only concern is we are using one flag per object type, and we have a limited number of flags. Every time we add a new ledger object that requires permission we need to use another flag. Having said that, it's not a huge concern and this is good as-is. Thanks Richard! 👍 from me.

src/ripple/app/tx/impl/CreateCheck.cpp Outdated Show resolved Hide resolved
src/ripple/app/tx/impl/NFTokenCreateOffer.cpp Outdated Show resolved Hide resolved
src/ripple/app/tx/impl/SetAccount.cpp Outdated Show resolved Hide resolved
@RichardAH
Copy link
Collaborator Author

It doesn't: even if you have asfRequireAuth, the trustline can be created and there is a big difference between that and marking an account as "not issuing".

Ah gotcha. Happy to add another flag for 'non-issuing' in that case. I think we avoid any risk of it being used as another type of freeze by only allowing the flag to be set if the account has no issued balances on any of their trustlines. Can't freeze what doesn't exist.

My only concern is we are using one flag per object type, and we have a limited number of flags. Every time we add a new ledger object that requires permission we need to use another flag. Having said that, it's not a huge concern and this is good as-is. Thanks Richard! 👍 from me.

Thanks for the review, I'll update the PR tomorrow with your recommendations in mind and the above additional flag.
I note that the lsf flags start at 0x10000. Is there a reason for this? Can we not use the 16 flags 0x0000 - 0x8000?

If flag exhaustion is a serious issue then we could move the DisallowIncoming flags to a dedicated serialized field on account root. The logic then would be: If the field sfDisallowIncoming is present then check the flags in it before allowing an incoming object.

Another slightly more hacky solution is to wait until we have actually exhausted flags and then just add an sfFlagsTwo

@RichardAH
Copy link
Collaborator Author

RichardAH commented Nov 14, 2022

After some discussion here in the office with @WietseWind we decided that having existing outstanding assets (issued IOUs) should not block asfDisallowIncomingTrustline (even though it could be considered a light version of freeze in some circumstances.)

On the contrary we decided using this adds a new use-case to the XRPL: Maintaining a currency only tradable between trusted parties. First you setup all the trustlines you will ever allow then you enable the flag. Now you have an isolated currency. (Credit: @WietseWind)

Trustlines can still be created in two additional ways, neither of which are checked by the new flag: offer crossing and checkmakestrustline. We figure no check is necessary here because it is something the user is initiating that produces the result. If you don't want the result then don't initiate the action.

Longest suite times:
   41.8s ripple.tx.Offer
   35.0s ripple.app.ValidatorSite
   31.2s ripple.tx.NFToken
   21.3s ripple.rpc.NodeToShardRPC
   17.1s ripple.tx.NFTokenBurn
   13.9s ripple.app.Flow
   13.3s ripple.app.ShardArchiveHandler
   12.5s ripple.app.TheoreticalQuality
    8.0s ripple.app.LedgerReplayer
    7.8s ripple.tx.NFTokenDir
349.3s, 204 suites, 1602 cases, 548790 tests total, 0 failures

@RichardAH RichardAH changed the title featureDisallowIncoming: Opt-out of incoming Checks, PayChans and NFTokenOffers featureDisallowIncoming: Opt-out of incoming Checks, PayChans, NFTokenOffers and Trustlines Nov 14, 2022
Copy link
Collaborator

@intelliot intelliot left a comment

Choose a reason for hiding this comment

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

Explanations / justifications make sense - thank you.

Copy link
Collaborator

@scottschurr scottschurr left a comment

Choose a reason for hiding this comment

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

I noted a few nits that you might choose to fix, but nothing that should block this pull request.

Thanks for the great tests!

src/ripple/app/tx/impl/NFTokenCreateOffer.cpp Outdated Show resolved Hide resolved
src/ripple/app/tx/impl/PayChan.cpp Show resolved Hide resolved
src/test/app/Check_test.cpp Outdated Show resolved Hide resolved
src/test/app/Check_test.cpp Outdated Show resolved Hide resolved
src/test/app/Check_test.cpp Show resolved Hide resolved
src/test/app/NFToken_test.cpp Show resolved Hide resolved
src/test/app/PayChan_test.cpp Show resolved Hide resolved
src/test/app/PayChan_test.cpp Show resolved Hide resolved
src/test/app/SetTrust_test.cpp Outdated Show resolved Hide resolved
src/test/app/SetTrust_test.cpp Show resolved Hide resolved
@RichardAH
Copy link
Collaborator Author

RichardAH commented Nov 17, 2022

Hi @scottschurr thanks for the code review
I think I addressed everything in recent push

Longest suite times:
   42.3s ripple.tx.Offer
   35.0s ripple.app.ValidatorSite
   31.8s ripple.tx.NFToken
   21.1s ripple.rpc.NodeToShardRPC
   17.7s ripple.tx.NFTokenBurn
   13.9s ripple.app.Flow
   13.7s ripple.app.ShardArchiveHandler
   12.9s ripple.app.TheoreticalQuality
    8.4s ripple.app.LedgerReplayer
    8.2s ripple.tx.NFTokenDir
355.7s, 204 suites, 1602 cases, 548790 tests total, 0 failures

Copy link
Collaborator

@scottschurr scottschurr left a comment

Choose a reason for hiding this comment

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

👍 Looks great to me!

@intelliot
Copy link
Collaborator

@WietseWind could we get a quick confirmation that this still resolves the issue for users? Thank you!

@intelliot
Copy link
Collaborator

Just mentioning @mDuo13 for awareness since this change will cause the need for a documentation update on XRPL.org

@intelliot intelliot assigned WietseWind and unassigned seelabs and scottschurr Dec 14, 2022
@WietseWind
Copy link
Member

@WietseWind could we get a quick confirmation that this still resolves the issue for users? Thank you!

Sure does!

@intelliot intelliot merged commit d8a84e9 into XRPLF:develop Dec 20, 2022
RichardAH added a commit to RichardAH/rippled that referenced this pull request Dec 23, 2022
…kenOffers and Trustlines (XRPLF#4336)

featureDisallowIncoming is a new amendment that would allow users to opt-out of incoming Checks, Payment Channels, NFTokenOffers, and trust lines. This commit includes tests.

Adds four new AccountSet Flags:
1. asfDisallowIncomingNFTOffer
2. asfDisallowIncomingCheck
3. asfDisallowIncomingPayChan
4. asfDisallowIncomingTrustline
dangell7 pushed a commit to Transia-RnD/rippled that referenced this pull request Dec 27, 2022
…kenOffers and Trustlines (XRPLF#4336)

featureDisallowIncoming is a new amendment that would allow users to opt-out of incoming Checks, Payment Channels, NFTokenOffers, and trust lines. This commit includes tests.

Adds four new AccountSet Flags:
1. asfDisallowIncomingNFTOffer
2. asfDisallowIncomingCheck
3. asfDisallowIncomingPayChan
4. asfDisallowIncomingTrustline
dangell7 pushed a commit to Transia-RnD/rippled that referenced this pull request Jan 24, 2023
…kenOffers and Trustlines (XRPLF#4336)

featureDisallowIncoming is a new amendment that would allow users to opt-out of incoming Checks, Payment Channels, NFTokenOffers, and trust lines. This commit includes tests.

Adds four new AccountSet Flags:
1. asfDisallowIncomingNFTOffer
2. asfDisallowIncomingCheck
3. asfDisallowIncomingPayChan
4. asfDisallowIncomingTrustline
@intelliot intelliot added this to the 1.10.0 milestone Feb 28, 2023
intelliot pushed a commit that referenced this pull request Mar 2, 2023
* Follow-up to #4336
* NFToken is the naming convention in the codebase (rather than NFT)
* Rename `lsfDisallowIncomingNFTOffer` to `lsfDisallowIncomingNFTokenOffer`
* Rename `asfDisallowIncomingNFTOffer` to `asfDisallowIncomingNFTokenOffer`
dangell7 pushed a commit to Transia-RnD/rippled that referenced this pull request Mar 5, 2023
…kenOffers and Trustlines (XRPLF#4336)

featureDisallowIncoming is a new amendment that would allow users to opt-out of incoming Checks, Payment Channels, NFTokenOffers, and trust lines. This commit includes tests.

Adds four new AccountSet Flags:
1. asfDisallowIncomingNFTOffer
2. asfDisallowIncomingCheck
3. asfDisallowIncomingPayChan
4. asfDisallowIncomingTrustline
dangell7 pushed a commit to Transia-RnD/rippled that referenced this pull request Mar 5, 2023
* Follow-up to XRPLF#4336
* NFToken is the naming convention in the codebase (rather than NFT)
* Rename `lsfDisallowIncomingNFTOffer` to `lsfDisallowIncomingNFTokenOffer`
* Rename `asfDisallowIncomingNFTOffer` to `asfDisallowIncomingNFTokenOffer`
@ckeshava
Copy link
Collaborator

Hello,
I'm new a developer to the XRP Ledger. I notice that this amendment has ~77% yes votes from the validators. Is there any expectation of getting this amendment passed in the near future? Is there an ETA or possibility of discarding this amendment otherwise?

@WietseWind
Copy link
Member

@ckeshava
Copy link
Collaborator

@WietseWind thanks, yes I understand that. But since this PR was merged about 6 months ago, I am curious to know if there is any specific reason why it is not voted in by the majority of the community. I guess it's impossible to know the intentions/reasons of all the validators.

cc @MorganBergen : This PR is related to one of your projects.

@kennyzlei
Copy link
Collaborator

@ckeshava this PR was merged 6 months ago but included in the 1.10 release in March 2023 https://xrpl.org/blog/2023/rippled-1.10.0.html. The voting time for this particular amendment seems reasonable right now

Voting by validators naturally takes time to evaluate and we also want nodes to all upgrade to the version to avoid amendment blocking

tequdev pushed a commit to tequdev/rippled that referenced this pull request Nov 17, 2023
…kenOffers and Trustlines (XRPLF#4336)

featureDisallowIncoming is a new amendment that would allow users to opt-out of incoming Checks, Payment Channels, NFTokenOffers, and trust lines. This commit includes tests.

Adds four new AccountSet Flags:
1. asfDisallowIncomingNFTOffer
2. asfDisallowIncomingCheck
3. asfDisallowIncomingPayChan
4. asfDisallowIncomingTrustline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

9 participants