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

Proposed 2.2.0-rc2 #5018

Merged
merged 11 commits into from
May 16, 2024
Merged

Proposed 2.2.0-rc2 #5018

merged 11 commits into from
May 16, 2024

Conversation

seelabs
Copy link
Collaborator

@seelabs seelabs commented May 16, 2024

High Level Overview of Change

This is a release candidate for the 2.2.0 release.

Highlights:

The base branch is release. All releases (including betas) go in release. This PR will be merged with --ff-only (not squashed or rebased, and not using the GitHub UI) to both release and develop.

Context of Change

This introduces

  • the fixAMMv1_1 amendment which fixes several issues with the AMM including: low quality lob offers blocking AMM offers, fixing how transfer fees are handled with the AMM, fixing an issue with an internal function that adjust amounts by lp tokens, and fixing an issue when the lp token balance of the last liquidity provider does not match the LPTokenBalance (due to floating point issues).
  • Fixes to the price oracle where some input parameters were not properly validated.
  • Misc fixes for conan, missing include files, and updating the CONTRIBUTING file.

It also introduces the first step in a physical code reorganization, unit test utilities to test RPC calls, and a global Rules object for transaction processing.

Type of Change

  • Release

API Impact

No API impact.

nbougalis and others added 11 commits April 29, 2024 18:44
I am resigning from my role as maintainer of the `rippled` codebase.

Please update repository permissions accordingly, prior to merging this pull request.

Thanks to everyone who has contributed, especially those whom I had the opportunity to closely collaborate with.
Rounding in the payment engine is causing an assert to sometimes fire
with "dust" amounts. This is causing issues when running debug builds of
rippled. This issue will be addressed, but the assert is no longer
serving its purpose.
…PLF#5013)

* Price Oracle: validate input parameters and extend test coverage:

Validate trim, time_threshold, document_id are valid
Int, UInt, or string convertible to UInt. Validate base_asset
and quote_asset are valid currency. Update error codes.
Extend Oracle and GetAggregatePrice unit-tests.
Denote unreachable coverage code.

* Set one-line LCOV_EXCL_LINE

* Move ledger_entry tests to LedgerRPC_test.cpp

* Add constants for "None"

* Fix LedgerRPC test

---------

Co-authored-by: Scott Determan <scott.determan@yahoo.com>
* Fix AMM offer rounding and low quality LOB offer blocking AMM:

A single-path AMM offer with account offer on DEX, is always generated
starting with the takerPays first, which is rounded up, and then
the takerGets, which is rounded down. This rounding ensures that the pool's
product invariant is maintained. However, when one of the offer's side
is XRP, this rounding can result in the AMM offer having a lower
quality, potentially causing offer generation to fail if the quality
is lower than the account's offer quality.

To address this issue, the proposed fix adjusts the offer generation process
to start with the XRP side first and always rounds it down. This results
in a smaller offer size, improving the offer's quality. Regardless if the offer
has XRP or not, the rounding is done so that the offer size is minimized.
This change still ensures the product invariant, as the other generated
side is the exact result of the swap-in or swap-out equations.

If a liquidity can be provided by both AMM and LOB offer on offer crossing
then AMM offer is generated so that it matches LOB offer quality. If LOB
offer quality is less than limit quality then generated AMM offer quality
is also less than limit quality and the offer doesn't cross. To address
this issue, if LOB quality is better than limit quality then use LOB
quality to generate AMM offer. Otherwise, don't use the quality to generate
AMM offer. In this case, limitOut() function in StrandFlow limits
the out amount to match strand's quality to limit quality and consume
maximum AMM liquidity.
The fix is to return the actual adjusted lp tokens and amounts
by the function.
Single path AMM offer has to factor in the transfer in rate
when calculating the upper bound quality and the quality function
because single path AMM's offer quality is not constant.
This fix factors in the transfer fee in
BookStep::adjustQualityWithFees().
Due to the rounding, LPTokenBalance of the last
Liquidity Provider (LP), might not match this LP's
trustline balance. This fix sets LPTokenBalance on
last LP withdrawal to this LP's LPToken trustline
balance.
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 93.37979% with 19 lines in your changes are missing coverage. Please review.

Project coverage is 71.1%. Comparing base (02ec8b7) to head (d5e5c3c).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           release   #5018     +/-   ##
=========================================
+ Coverage     70.9%   71.1%   +0.2%     
=========================================
  Files          796     796             
  Lines        66792   66997    +205     
  Branches     10998   10979     -19     
=========================================
+ Hits         47378   47633    +255     
+ Misses       19414   19364     -50     
Files Coverage Δ
src/ripple/app/misc/impl/AMMHelpers.cpp 97.6% <100.0%> (+0.8%) ⬆️
src/ripple/app/misc/impl/AMMUtils.cpp 99.4% <100.0%> (+0.2%) ⬆️
src/ripple/app/paths/impl/StrandFlow.h 86.1% <ø> (+1.0%) ⬆️
src/ripple/app/tx/impl/AMMCreate.cpp 90.2% <ø> (ø)
src/ripple/app/tx/impl/DeleteOracle.cpp 100.0% <ø> (+27.5%) ⬆️
src/ripple/app/tx/impl/SetOracle.cpp 100.0% <ø> (+5.6%) ⬆️
src/ripple/basics/Number.h 100.0% <100.0%> (ø)
src/ripple/conditions/impl/utils.h 69.4% <ø> (ø)
src/ripple/consensus/LedgerTrie.h 85.8% <ø> (ø)
src/ripple/ledger/impl/View.cpp 91.6% <100.0%> (ø)
... and 10 more

... and 6 files with indirect coverage changes

Impacted file tree graph

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.

Builds, passes unit tests, syncs, and shuts down cleanly for me on macOS. 👍

@seelabs seelabs merged commit d5e5c3c into XRPLF:release May 16, 2024
25 checks passed
@seelabs seelabs deleted the develop-next branch May 20, 2024 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants