Add MPT support to DEX
High Level Overview of Change
Add MPT support to DEX
Context of Change
Implements XLS-82d
Adds MPT support for the following transactions:
- Payment
- OfferCreate
- CheckCash
- All AMM transactions
- Pathfinding
Retires FlowCross feature.
Type of Change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [x] 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)
- [x] 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)
- [x] Public API: Breaking change (in general, breaking changes should only impact the next api_version)
- [ ]
libxrplchange (any change that may affectlibxrplor dependents oflibxrpl) - [ ] Peer protocol change (must be backward compatible or bump the peer protocol version)
Test Plan
Extended MPToken unit-test to test for basic MPT interactions with DEX.
Codecov Report
:x: Patch coverage is 90.49128% with 120 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 78.8%. Comparing base (b33b506) to head (f4750bf).
:warning: Report is 1 commits behind head on develop.
Additional details and impacted files
@@ Coverage Diff @@
## develop #5285 +/- ##
=========================================
+ Coverage 78.6% 78.8% +0.2%
=========================================
Files 818 825 +7
Lines 68938 70615 +1677
Branches 8242 8332 +90
=========================================
+ Hits 54171 55616 +1445
- Misses 14767 14999 +232
| Files with missing lines | Coverage Δ | |
|---|---|---|
| include/xrpl/ledger/PaymentSandbox.h | 100.0% <100.0%> (ø) |
|
| include/xrpl/protocol/AMMCore.h | 100.0% <ø> (ø) |
|
| include/xrpl/protocol/Concepts.h | 100.0% <100.0%> (ø) |
|
| include/xrpl/protocol/MPTAmount.h | 90.9% <100.0%> (-9.1%) |
:arrow_down: |
| include/xrpl/protocol/MPTIssue.h | 100.0% <100.0%> (ø) |
|
| include/xrpl/protocol/STObject.h | 93.1% <ø> (ø) |
|
| include/xrpl/protocol/TER.h | 100.0% <ø> (ø) |
|
| include/xrpl/protocol/detail/ledger_entries.macro | 100.0% <ø> (ø) |
|
| include/xrpl/protocol/detail/transactions.macro | 100.0% <ø> (ø) |
|
| src/libxrpl/protocol/Asset.cpp | 100.0% <100.0%> (ø) |
|
| ... and 102 more |
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
haven't reviewed the changes but one invariant would be good to have is to ensure that the amount changed for OutstandingBalance in MPTokenIssuance should equal the net change of all the MPTokens modified in the transaction
Most recent changes are breaking the unit-tests @gregtatcam
There there are several Transactors that check have checks for featureMPTokensV1. Should those Transactors also check for featureMPTokensV2?
Most recent changes are breaking the unit-tests @gregtatcam
It runs with no errors on my local MAC. I'm not too worried for now about CI failures.
There there are several Transactors that check have checks for
featureMPTokensV1. Should those Transactors also check forfeatureMPTokensV2?
There are cases where only V1 support is required like Clawback, Escrow, and SAV.
add a comment here because I can not add on an unchanged line:
in AMMWithdraw::equalWithdrawLimit, amount2Withdraw is calculated twice, but the first calculation is not necessary.
add a comment here because I can not add on an unchanged line:
in
AMMWithdraw::equalWithdrawLimit,amount2Withdrawis calculated twice, but the first calculation is not necessary.
frac is recalculated. Therefore, amount2Withdraw has to be adjusted.
In AssetCache.cpp three XRPL_ASSERTs need to be updated from
82,30: "ripple::RippleLineCache::getRippleLines : maximum lines");
104,22: "ripple::RippleLineCache::getRippleLines : null lines");
117,18: "ripple::RippleLineCache::getRippleLines : null or nonempty lines");
to
82,30: "ripple::AssetCache::getRippleLines : maximum lines");
104,22: "ripple::AssetCache::getRippleLines : null lines");
117,18: "ripple::AssetCache::getRippleLines : null or nonempty lines");
add a comment here because I can not add on an unchanged line: in
AMMWithdraw::equalWithdrawLimit,amount2Withdrawis calculated twice, but the first calculation is not necessary.
fracis recalculated. Therefore,amount2Withdrawhas to be adjusted.
It seems the first amount2Withdraw is not used, although the frac is recalculated and used by the second amount2Withdraw
[nit]: Once the unit-testing is sorted this comment in the PR description need to updated:
Significant number of unit-tests must be added to test all aspects of MPT interactions with DEX. Essentially all current unit-tests designed to test IOU interactions with DEX must be replicated for MPT. This is work in progress.
Can we add two basic tests for PermissionedDEX with MPTs:
- A domain payment should only consume a USD/MPT offer with a domain. It must not consume a regular USD/MPT offer.
- A hybrid USD/MPT domain offer should still be consumable by a regular payment.
We don’t need extensive test coverage for this right now (though that would be a good improvement for the future).