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

Prevent brokered sale of NFToken to owner (fix #4374) #4403

Merged

Conversation

scottschurr
Copy link
Collaborator

@scottschurr scottschurr commented Jan 31, 2023

(If approved, this PR will be merged after #4380 and #4346. These three PRs share an amendment and we want them to go out in the same release.) As of 2023-02-09, these have been merged into the feature branch.

High Level Overview of Change

Fixes #4374.

Without the amendment in this PR, it is possible for a broker to combine a sell and a buy offer from an account that already owns an NFT. Such brokering extracts money from the NFT owner and provides no benefit in return. This pull request detects when a broker is returning an NFToken to its initial owner and prohibits the transaction.

Context of Change

This fixes a bug in the original implementation of XLS-20. The fix is to forbid a broker from selling an NFToken to the account that already owns the token. The fix was initially suggested by @nixer89.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Tests (You added tests for code that already exists, or your new feature included in this PR)

@ledhed2222
Copy link
Contributor

looks good, but can you change this to be against feature/nft-fixes instead of develop?

nixer89
nixer89 previously approved these changes Jan 31, 2023
Copy link
Collaborator

@nixer89 nixer89 left a comment

Choose a reason for hiding this comment

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

lgtm

As it seems, the fixUnburnableNFToken will include this PR (Amendment).
While it makes sense to merge multiple NFT related issued into one bigger Amendment, the initial name fixUnburnableNFToken suggests it only fixes the "non burnable NFToken" issue.

Would it make sense to rename the Amendment to make it clear that there are multiple NFT fixes included and not just the one?

@WietseWind WietseWind self-requested a review February 1, 2023 13:20
WietseWind
WietseWind previously approved these changes Feb 1, 2023
@scottschurr scottschurr force-pushed the brokered-sale-to-self branch from 5a94905 to 20f2b6f Compare February 1, 2023 16:54
@scottschurr
Copy link
Collaborator Author

@ledhed2222, this commit is now rebased to sit atop feature/nft-fixes as requested.

@intelliot intelliot changed the base branch from develop to feature/nft-fixes February 1, 2023 18:22
@intelliot intelliot dismissed stale reviews from WietseWind and nixer89 February 1, 2023 18:22

The base branch was changed.

@intelliot
Copy link
Collaborator

I updated the PR's base branch to feature/nft-fixes. Let me know if that wreaked havoc.

Screen Shot 2023-02-01 at 10 22 45 AM

@scottschurr
Copy link
Collaborator Author

@intelliot, no damage from that change as far as I can see.

@intelliot intelliot added this to the 1.10 milestone Feb 1, 2023
@intelliot intelliot changed the title Prevent brokered sale of NFToken to owner #4374 Prevent brokered sale of NFToken to owner (fix #4374) Feb 2, 2023
Copy link
Collaborator

@shawnxie999 shawnxie999 left a comment

Choose a reason for hiding this comment

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

Looks good

@ledhed2222
Copy link
Contributor

lgtm! merge when ready :)

@intelliot intelliot added Passed Passed code review & PR owner thinks it's ready to merge. Perf sign-off may still be required. and removed Needs Review labels Feb 6, 2023
@intelliot intelliot linked an issue Feb 9, 2023 that may be closed by this pull request
@scottschurr scottschurr force-pushed the brokered-sale-to-self branch from 20f2b6f to db8e8ce Compare February 10, 2023 04:22
@scottschurr
Copy link
Collaborator Author

Rebased to the current state of feature/nft-fixes.

@intelliot intelliot merged commit 40c55e9 into XRPLF:feature/nft-fixes Feb 10, 2023
kennyzlei pushed a commit that referenced this pull request Feb 13, 2023
Fixes #4374

It was possible for a broker to combine a sell and a buy offer from an account that already owns an NFT. Such brokering extracts money from the NFT owner and provides no benefit in return.

With this amendment, the code detects when a broker is returning an NFToken to its initial owner and prohibits the transaction. This forbids a broker from selling an NFToken to the account that already owns the token. This fixes a bug in the original implementation of XLS-20.

Thanks to @nixer89 for suggesting this fix.
kennyzlei pushed a commit that referenced this pull request Feb 13, 2023
Fixes #4374

It was possible for a broker to combine a sell and a buy offer from an account that already owns an NFT. Such brokering extracts money from the NFT owner and provides no benefit in return.

With this amendment, the code detects when a broker is returning an NFToken to its initial owner and prohibits the transaction. This forbids a broker from selling an NFToken to the account that already owns the token. This fixes a bug in the original implementation of XLS-20.

Thanks to @nixer89 for suggesting this fix.

Signed-off-by: Kenny Lei <[email protected]>
kennyzlei pushed a commit that referenced this pull request Feb 13, 2023
Fixes #4374

It was possible for a broker to combine a sell and a buy offer from an account that already owns an NFT. Such brokering extracts money from the NFT owner and provides no benefit in return.

With this amendment, the code detects when a broker is returning an NFToken to its initial owner and prohibits the transaction. This forbids a broker from selling an NFToken to the account that already owns the token. This fixes a bug in the original implementation of XLS-20.

Thanks to @nixer89 for suggesting this fix.
kennyzlei pushed a commit that referenced this pull request Feb 13, 2023
Fixes #4374

It was possible for a broker to combine a sell and a buy offer from an account that already owns an NFT. Such brokering extracts money from the NFT owner and provides no benefit in return.

With this amendment, the code detects when a broker is returning an NFToken to its initial owner and prohibits the transaction. This forbids a broker from selling an NFToken to the account that already owns the token. This fixes a bug in the original implementation of XLS-20.

Thanks to @nixer89 for suggesting this fix.
ximinez added a commit to ximinez/rippled that referenced this pull request Feb 15, 2023
* upstream/develop:
  Rename to fixNonFungibleTokensV1_2 and some cosmetic changes (XRPLF#4419)
  Only account specified as destination can settle through brokerage: (XRPLF#4399)
  Prevent brokered sale of NFToken to owner: (XRPLF#4403)
  Fix 3 issues around NFToken offer acceptance (XRPLF#4380)
  Allow NFT to be burned when number of offers is greater than 500 (XRPLF#4346)
  Add fixUnburnableNFToken feature (XRPLF#4391)
  Change default vote on fixUniversalNumber from yes to no (XRPLF#4414)
ximinez added a commit to ximinez/rippled that referenced this pull request Feb 15, 2023
* upstream/develop:
  Rename to fixNonFungibleTokensV1_2 and some cosmetic changes (XRPLF#4419)
  Only account specified as destination can settle through brokerage: (XRPLF#4399)
  Prevent brokered sale of NFToken to owner: (XRPLF#4403)
  Fix 3 issues around NFToken offer acceptance (XRPLF#4380)
  Allow NFT to be burned when number of offers is greater than 500 (XRPLF#4346)
  Add fixUnburnableNFToken feature (XRPLF#4391)
  Change default vote on fixUniversalNumber from yes to no (XRPLF#4414)
ximinez added a commit to ximinez/rippled that referenced this pull request Feb 15, 2023
* upstream/develop:
  Rename to fixNonFungibleTokensV1_2 and some cosmetic changes (XRPLF#4419)
  Only account specified as destination can settle through brokerage: (XRPLF#4399)
  Prevent brokered sale of NFToken to owner: (XRPLF#4403)
  Fix 3 issues around NFToken offer acceptance (XRPLF#4380)
  Allow NFT to be burned when number of offers is greater than 500 (XRPLF#4346)
  Add fixUnburnableNFToken feature (XRPLF#4391)
  Change default vote on fixUniversalNumber from yes to no (XRPLF#4414)
ximinez added a commit to ximinez/rippled that referenced this pull request Feb 15, 2023
* upstream/develop:
  Rename to fixNonFungibleTokensV1_2 and some cosmetic changes (XRPLF#4419)
  Only account specified as destination can settle through brokerage: (XRPLF#4399)
  Prevent brokered sale of NFToken to owner: (XRPLF#4403)
  Fix 3 issues around NFToken offer acceptance (XRPLF#4380)
  Allow NFT to be burned when number of offers is greater than 500 (XRPLF#4346)
  Add fixUnburnableNFToken feature (XRPLF#4391)
  Change default vote on fixUniversalNumber from yes to no (XRPLF#4414)
ximinez added a commit to ximinez/rippled that referenced this pull request Feb 15, 2023
* upstream/develop:
  Rename to fixNonFungibleTokensV1_2 and some cosmetic changes (XRPLF#4419)
  Only account specified as destination can settle through brokerage: (XRPLF#4399)
  Prevent brokered sale of NFToken to owner: (XRPLF#4403)
  Fix 3 issues around NFToken offer acceptance (XRPLF#4380)
  Allow NFT to be burned when number of offers is greater than 500 (XRPLF#4346)
  Add fixUnburnableNFToken feature (XRPLF#4391)
  Change default vote on fixUniversalNumber from yes to no (XRPLF#4414)
ximinez added a commit to ximinez/rippled that referenced this pull request Feb 15, 2023
* upstream/develop:
  Rename to fixNonFungibleTokensV1_2 and some cosmetic changes (XRPLF#4419)
  Only account specified as destination can settle through brokerage: (XRPLF#4399)
  Prevent brokered sale of NFToken to owner: (XRPLF#4403)
  Fix 3 issues around NFToken offer acceptance (XRPLF#4380)
  Allow NFT to be burned when number of offers is greater than 500 (XRPLF#4346)
  Add fixUnburnableNFToken feature (XRPLF#4391)
ximinez added a commit to ximinez/rippled that referenced this pull request Feb 15, 2023
…ctionality

* upstream/develop:
  Rename to fixNonFungibleTokensV1_2 and some cosmetic changes (XRPLF#4419)
  Only account specified as destination can settle through brokerage: (XRPLF#4399)
  Prevent brokered sale of NFToken to owner: (XRPLF#4403)
  Fix 3 issues around NFToken offer acceptance (XRPLF#4380)
  Allow NFT to be burned when number of offers is greater than 500 (XRPLF#4346)
  Add fixUnburnableNFToken feature (XRPLF#4391)
  Change default vote on fixUniversalNumber from yes to no (XRPLF#4414)
ximinez added a commit to ximinez/rippled that referenced this pull request Feb 15, 2023
…tpage

* upstream/develop:
  Rename to fixNonFungibleTokensV1_2 and some cosmetic changes (XRPLF#4419)
  Only account specified as destination can settle through brokerage: (XRPLF#4399)
  Prevent brokered sale of NFToken to owner: (XRPLF#4403)
  Fix 3 issues around NFToken offer acceptance (XRPLF#4380)
  Allow NFT to be burned when number of offers is greater than 500 (XRPLF#4346)
  Add fixUnburnableNFToken feature (XRPLF#4391)
  Change default vote on fixUniversalNumber from yes to no (XRPLF#4414)
dangell7 pushed a commit to Transia-RnD/rippled that referenced this pull request Mar 5, 2023
Fixes XRPLF#4374

It was possible for a broker to combine a sell and a buy offer from an account that already owns an NFT. Such brokering extracts money from the NFT owner and provides no benefit in return.

With this amendment, the code detects when a broker is returning an NFToken to its initial owner and prohibits the transaction. This forbids a broker from selling an NFToken to the account that already owns the token. This fixes a bug in the original implementation of XLS-20.

Thanks to @nixer89 for suggesting this fix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Amendment Bug Passed Passed code review & PR owner thinks it's ready to merge. Perf sign-off may still be required. Testable Will Need Documentation
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[Bug] Brokering 2 offers from the same account when he owns the NFT
6 participants