8000 Permissioned DEX by shawnxie999 · Pull Request #5404 · XRPLF/rippled · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Permissioned DEX #5404

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

Merged
merged 39 commits into from
May 30, 2025
Merged

Permissioned DEX #5404

merged 39 commits into from
May 30, 2025

Conversation

shawnxie999
Copy link
Collaborator
@shawnxie999 shawnxie999 commented Apr 16, 2025

High Level Overview of Change

https://github.com/XRPLF/XRPL-Standards/pull/281/files#diff-35a11d4d87e9deea6056a8e974075ece34ffb081689d0afb8a85b6d9bcded756

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)
  • Performance (increase or change in throughput and/or latency)
  • 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 8000 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)

@shawnxie999 shawnxie999 marked this pull request as ready for review April 16, 2025 14:58
@shawnxie999 shawnxie999 changed the title Perm Dex (DRAFT) Perm Dex Apr 16, 2025
Copy link
codecov bot commented Apr 16, 2025

Codecov Report

Attention: Patch coverage is 94.98208% with 14 lines in your changes missing coverage. Please review.

Project coverage is 78.8%. Comparing base (e0bc3dd) to head (166d314).
Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
src/xrpld/app/paths/PathRequest.cpp 70.0% 3 Missing ⚠️
src/xrpld/app/ledger/OrderBookDB.cpp 95.1% 2 Missing ⚠️
src/xrpld/app/misc/PermissionedDEXHelpers.cpp 93.1% 2 Missing ⚠️
src/xrpld/app/tx/detail/CreateOffer.cpp 96.7% 2 Missing ⚠️
src/xrpld/rpc/BookChanges.h 66.7% 2 Missing ⚠️
src/xrpld/rpc/detail/TransactionSign.cpp 85.7% 1 Missing ⚠️
src/xrpld/rpc/handlers/Subscribe.cpp 83.3% 1 Missing ⚠️
src/xrpld/rpc/handlers/Unsubscribe.cpp 83.3% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           develop   #5404     +/-   ##
=========================================
+ Coverage     78.7%   78.8%   +0.2%     
=========================================
  Files          816     817      +1     
  Lines        70542   70782    +240     
  Branches      8284    8235     -49     
=========================================
+ Hits         55493   55790    +297     
+ Misses       15049   14992     -57     
Files with missing lines Coverage Δ
include/xrpl/protocol/Book.h 100.0% <100.0%> (ø)
include/xrpl/protocol/ErrorCodes.h 100.0% <ø> (ø)
include/xrpl/protocol/UintTypes.h 100.0% <ø> (ø)
include/xrpl/protocol/detail/ledger_entries.macro 100.0% <ø> (ø)
include/xrpl/protocol/detail/transactions.macro 100.0% <ø> (ø)
src/libxrpl/protocol/Book.cpp 100.0% <100.0%> (ø)
src/libxrpl/protocol/ErrorCodes.cpp 85.7% <ø> (ø)
src/libxrpl/protocol/Indexes.cpp 96.9% <100.0%> (+0.1%) ⬆️
src/libxrpl/protocol/InnerObjectFormats.cpp 100.0% <100.0%> (ø)
src/xrpld/app/paths/Flow.cpp 96.4% <ø> (ø)
... and 25 more

... and 5 files with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@oleks-rip
Copy link
Collaborator

Please fix the clang-format and clang builds

@yinyiqian1
Copy link
Collaborator

Would you mind adding the spec link to the PR? If the implementation differs from the spec, could you please clarify the differences?

@shawnxie999 shawnxie999 requested a review from mathbunnyru May 23, 2025 13:36
if (sleOffer->getFieldH256(sfDomainID) != domainID)
return false; // LCOV_EXCL_LINE

if (sleOffer->isFlag(lsfHybrid) &&
Copy link
Collaborator

Choose a reason for hiding this comment

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

We're checking this in InvariantCheck.cpp so maybe this is redundant?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's intentional. Invariant is meant to serve as a defensive check

if (tx_json.isMember(jss::domain))
{
uint256 num;
if (!tx_json[sfDomainID.jsonName].isString() ||
Copy link
Collaborator

Choose a reason for hiding this comment

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

jsonName is unnecessary here and below

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

jsonName is necessary here, unless the field is using jss::

Copy link
Collaborator

Choose a reason for hiding this comment

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

try removing it inside the indexing operator[], you will see :) It is indeed needed for isMember().

@@ -222,6 +223,22 @@ checkPayment(
rpcINVALID_PARAMS,
"Cannot specify both 'tx_json.Paths' and 'build_path'");

std::optional<uint256> domain;
if (tx_json.isMember(jss::domain))
Copy link
Collaborator

Choose a reason for hiding this comment

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

we're mxing jss::domain and sfDomainID, it seems to be a bug and it's not unit tested

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This API is deprecated anyways. I'll change it to sfDomainID. Unit test is not really important here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd suggest using jss::domain instead of sfDomainID to maintain consistency

if (!jvParams[jss::domain].isString() ||
!num.parseHex(jvParams[jss::domain].asString()))
{
jvStatus = rpcError(rpcDOMAIN_MALFORMED);
Copy link
Collaborator

Choose a reason for hiding this comment

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

It'd be better if it can be covered by unit tests

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i think we're currently lacking unit tests for this RPC overall, it'd be good for future work. However RPCs in general are less important than transactions, which should have full coverage

@kennyzlei kennyzlei removed the Ready to merge *PR author* thinks it's ready to merge. Has passed code review. Perf sign-off may still be required. label May 28, 2025
@kennyzlei kennyzlei requested a review from a1q123456 May 28, 2025 18:07
@shawnxie999
Copy link
Collaborator Author

Commit message

Add support for XLS-81 Permissioned DEX.

Modified transactions:
- OfferCreate
- Payment

Modified RPCs:
- book_changes
- subscribe
- book_offers
- ripple_path_find
- path_find

Spec: https://github.com/shawnxie999/XRPL-Standards/tree/perm-dex/XLS-0081d-permissioned-dex

@kennyzlei kennyzlei added the Ready to merge *PR author* thinks it's ready to merge. Has passed code review. Perf sign-off may still be required. label May 30, 2025
@bthomee bthomee merged commit 0a34b5c into XRPLF:develop May 30, 2025
26 checks passed
@Bronek Bronek mentioned this pull request Jun 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Amendment API Change Perf Attn Needed Attention needed from RippleX Performance Team Ready to merge *PR author* thinks it's ready to merge. Has passed code review. Perf sign-off may still be required.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0