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

XLS-52d: NFTokenMintOffer #4845

Merged
merged 24 commits into from
Jun 14, 2024
Merged

Conversation

tequdev
Copy link
Contributor

@tequdev tequdev commented Dec 5, 2023

High Level Overview of Change

Fixed to allow creating NFTokenOffer in a NFTokenMint transaction.

Added 3 optional fields to NFTokenMint transaction:

  • Amount
  • Destination
  • Expiration

Context of Change

Type of Change

  • New feature (non-breaking change which adds functionality)
  • Tests (you added tests for code that already exists, or your new feature included in this PR)

@tequdev
Copy link
Contributor Author

tequdev commented Dec 5, 2023

Still need to add some more tests.

  • Added fields
  • NFTokenOffer field created in NFTokenMint
  • offer_id added to meta in NFTokenMint

@tequdev tequdev force-pushed the featureNFTokenMintOffer branch from e61e31f to 366db6a Compare December 5, 2023 15:58
@tequdev tequdev force-pushed the featureNFTokenMintOffer branch from 366db6a to a7f374e Compare December 5, 2023 16:41
@codecov-commenter
Copy link

codecov-commenter commented Jan 31, 2024

Codecov Report

Attention: Patch coverage is 97.83784% with 4 lines in your changes missing coverage. Please review.

Project coverage is 71.3%. Comparing base (3f5e321) to head (7bc8302).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           develop   #4845     +/-   ##
=========================================
- Coverage     71.3%   71.3%   -0.0%     
=========================================
  Files          796     796             
  Lines        66900   66966     +66     
  Branches     10868   10890     +22     
=========================================
+ Hits         47702   47739     +37     
- Misses       19198   19227     +29     
Files Coverage Δ
src/ripple/app/tx/impl/NFTokenCreateOffer.cpp 100.0% <100.0%> (+3.2%) ⬆️
src/ripple/app/tx/impl/NFTokenMint.cpp 98.0% <100.0%> (+0.8%) ⬆️
src/ripple/app/tx/impl/details/NFTokenUtils.h 100.0% <ø> (ø)
src/ripple/protocol/Feature.h 100.0% <ø> (ø)
src/ripple/protocol/impl/Feature.cpp 94.6% <ø> (ø)
src/ripple/protocol/impl/NFTokenOfferID.cpp 86.4% <100.0%> (ø)
src/ripple/protocol/impl/TxFormats.cpp 100.0% <ø> (ø)
src/ripple/app/tx/impl/details/NFTokenUtils.cpp 93.4% <96.2%> (+1.2%) ⬆️

... and 7 files with indirect coverage changes

Impacted file tree graph

@tequdev tequdev force-pushed the featureNFTokenMintOffer branch from 55b3ea2 to b2e2d0d Compare February 1, 2024 08:27
@tequdev tequdev force-pushed the featureNFTokenMintOffer branch from b2e2d0d to 65d62df Compare February 1, 2024 08:48
@tequdev tequdev force-pushed the featureNFTokenMintOffer branch 2 times, most recently from 4a780fa to 455b795 Compare February 5, 2024 05:34
@tequdev tequdev force-pushed the featureNFTokenMintOffer branch from 455b795 to 6ff088e Compare February 5, 2024 06:05
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.

Thanks! Looks good!

@kennyzlei kennyzlei requested review from scottschurr and removed request for kennyzlei and gregtatcam March 18, 2024 17:47
@scottschurr
Copy link
Collaborator

For the most part, this is a well done pull request. The tests seem to have good coverage of the new code.

I have one serious concern with the implementation. A bunch of the code from NFTokenCreateOffer.cpp has been copied into NFTokenMint. That means when one part of the code changes for maintenance the copy must change as well. Inevitably the two copies will fall out of sync. That's not an immediate problem, but is absolutely a long term problem.

One way in which this problem is blindingly apparent is when @shawnxie999 asked that you include code for an amendment that is in review. Optimally that fix should not need to be coded in two different places.

One way to address this concern is to share the code, rather than copy it. If the common code is shared, for example by calling a shared routine, then future maintenance will still only need to happen in one place: in the shared code.

I wanted to make sure this was possible before I suggested this change. So I have an example of how this code sharing might be done. The top-most commit here shows one way it might be implementated: https://github.com/scottschurr/rippled/commits/tequ-featureNFTokeMintOffer/ You are welcome to cherry-pick that commit if you want. But also feel free to take a different path to a similar solution.

If you do cherry-pick that commit then I should probably recuse myself from the remainder of this code review, since I would be blind to mistakes that I might have introduced.

I hope that helps.

@tequdev
Copy link
Contributor Author

tequdev commented May 1, 2024

Thanks, @scottschurr!
I will check your commit and cherry pick!

@scottschurr
Copy link
Collaborator

@shawnxie999, the most recent commit introduced significant changes. It would be good if you could re-review this pull request. Thanks.

@scottschurr scottschurr requested review from HowardHinnant and removed request for nbougalis and scottschurr May 6, 2024 17:00
@scottschurr
Copy link
Collaborator

I think this pull request looks good, but my view is colored by my own changes to the pull request. So I'm removing myself as a reviewer. @HowardHinnant has agreed to review this pull request in my place, although he's tied up at the moment. He can hopefully get to the review in the next week or two. Sorry for the additional delay.

@HowardHinnant
Copy link
Contributor

Needs rebasing against current develop to resolve conflicts. Doing so will also help me see how this PR would change develop.

@@ -197,7 +197,10 @@ NFTokenMint::preclaim(PreclaimContext const& ctx)
auto const nftIssuer =
ctx.tx[~sfIssuer].value_or(ctx.tx[sfAccount]);

if (!ctx.view.exists(keylet::line(nftIssuer, amount->issue())))
// If the IOU issuer and the NFToken issuer are the same,
Copy link
Contributor

Choose a reason for hiding this comment

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

The commit message should be prefixed with [FOLD] to indicate that this commit should be merged (likely with the previous commit).

@@ -110,10 +110,10 @@ NFTokenMint::preflight(PreflightContext const& ctx)
}
}

if (auto exp = ctx.tx[~sfExpiration]; exp == 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

The commit message should be prefixed with [FOLD] to indicate that this commit should be merged (likely with the previous commit).

@HowardHinnant HowardHinnant self-requested a review May 21, 2024 20:15
@scottschurr scottschurr added the Passed Passed code review & PR owner thinks it's ready to merge. Perf sign-off may still be required. label May 22, 2024
@seelabs seelabs merged commit 9f7c619 into XRPLF:develop Jun 14, 2024
19 checks passed
@seelabs seelabs mentioned this pull request Jun 20, 2024
1 task
ximinez added a commit to ximinez/rippled that referenced this pull request Jul 1, 2024
* upstream/develop: (32 commits)
  fixInnerObjTemplate2 amendment (XRPLF#5047)
  Set version to 2.3.0-b1
  Ignore restructuring commits (XRPLF#4997)
  Recompute loops (XRPLF#4997)
  Rewrite includes (XRPLF#4997)
  Rearrange sources (XRPLF#4997)
  Move CMake directory (XRPLF#4997)
  Add bin/physical.sh (XRPLF#4997)
  Prepare to rearrange sources: (XRPLF#4997)
  Change order of checks in amm_info: (XRPLF#4924)
  Add the fixEnforceNFTokenTrustline amendment: (XRPLF#4946)
  Replaces the usage of boost::string_view with std::string_view (XRPLF#4509)
  docs: explain how to find a clang-format patch generated by CI (XRPLF#4521)
  XLS-52d: NFTokenMintOffer (XRPLF#4845)
  chore: remove repeat words (XRPLF#5041)
  Expose all amendments known by libxrpl (XRPLF#5026)
  fixReducedOffersV2: prevent offers from blocking order books: (XRPLF#5032)
  Additional unit tests for testing deletion of trust lines (XRPLF#4886)
  Fix conan typo: (XRPLF#5044)
  Add new command line option to make replaying transactions easier: (XRPLF#5027)
  ...
vlntb pushed a commit to vlntb/rippled that referenced this pull request Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Passed Passed code review & PR owner thinks it's ready to merge. Perf sign-off may still be required.
Projects
Status: 🚢 Released in 2.2.0
Development

Successfully merging this pull request may close these issues.

6 participants