Analysis of the XLS-30 AMM Amendment

RippleX has enabled its validator to vote in support of the XLS-30 amendment, introducing innovative AMM capabilities to the XRPL. We, at RippleX, place great emphasis on the strength that collaborative effort and shared responsibility bring to the enhancement and security of the XRPL. Today, we earnestly request the community's consideration of the XLS-30 amendment—a proposal poised to offer numerous advantages by bolstering liquidity, offering yield opportunities for liquidity providers and amplifying the XRPL network's utility. 

As a responsible community, we recognize the significance of questions and concerns when considering a change of this magnitude. While we are confident that AMM integration will enhance the network's utility, we remain committed to addressing any concerns raised by the community. In the following sections, we actively engage with and aim to resolve these concerns collaboratively. Of course, each validator will need to make an independent assessment of the amendment before voting. We hope our analysis below aids the validator community in making an informed decision.  

Performance Impact 

The report, published by RippleX's performance and engineering teams, concludes that activating the AMM amendment will not have a detrimental impact on the network's consensus performance or its capacity to process other transactions, all without the need for infrastructure upgrade. In fact, this rise in transactions is poised to enhance the network's utility, particularly for cross-currency payments, an area where XRP Ledger excels. 

In our assessment, the advantages of incorporating AMM outweighs any concerns regarding the network's ability to handle the expected increase in transaction load.

Quality Assurance: With the introduction of the AMM feature, we have made a substantial impact on the XRPL codebase. Our commitment to quality assurance is evident as approximately 55% of the added code is dedicated to rigorous unit testing. Moreover, our comprehensive QA process includes separate tests to verify that the feature operates seamlessly and without any adverse effects on the rest of the ledger..

Security 

We fully recognize and acknowledge the importance of conducting a thorough security audit to instill confidence and validate the integrity of a project. In pursuit of this objective, in addition to the rigorous review of the AMM codebase, we have engaged the services of CertiK, a renowned leader in blockchain security. Certik’s team of seasoned security experts has meticulously scrutinized the codebase, identifying potential vulnerabilities and outlining stringent security measures to protect the platform's functionality.

The audit primarily centered around the following key areas:

  • Reviewing the mathematical formulas utilized in AMM operations.
  • Ensuring adherence to industry best practices and standards.
  • Verifying that the code functions as intended and aligns with the specifications of XLS-30.
  • Conducting a thorough line-by-line examination of the code, led by experienced C++ engineers.

Upon the conclusion of the audit, the RippleX engineering team worked closely alongside CertiK to address the identified findings and make necessary improvements. For a more detailed account of the audit results, we encourage you to refer to the official report.

LOB vs AMM 

While the XRPL DEX currently relies on manual market making and order books for liquidity provision, the introduction of AMM brings forth several compelling advantages:

  • Constant Liquidity: AMMs provide constant liquidity by using algorithmically determined pricing. Users can trade without needing active counterparties as the liquidity is always available.
  • Smoother Trading Experience: AMMs play a crucial role in facilitating trading for new and existing projects, ensuring a more accessible, efficient and smoother trading experience.
  • Liquidity Provision Opportunity–a community benefit: AMMs are designed for token holders to participate by providing liquidity to pools. As liquidity providers, they earn trading fees from all swap and trading activity.
  • Improved Pricing: AMMs continually incentivize arbitrageurs to balance the AMM so they are much more likely to offer a fair price and a narrow spread. This, in turn, reduces the risk for users seeking quick asset trades.

Moreover, XRPL DEX is two-way interoperable, i.e. the interleaved execution of the AMM trades with the existing order book based DEX. This ensures aggregated liquidity across different DEXs and strictly better exchange rates for the traders.

“Frontrunning” on AMM

Front running is already possible on XRPL’s LOB based DEX. To be clear, by front running, we are not referring to the TradFi market manipulative practice of trading on inside information ahead of the market. We are referring to the technical arbitrage opportunity that arises due to the necessity of a consensus which results in a delay window between the transaction being submitted and finalized in the ledger. Although the pending transaction information is public (and therefore not inside information), market participants can trade based on the content of the yet to be executed transactions.

One of the reasons that frontrunning is possible on blockchains is because the users have to include slippage tolerance into their trade executions. The slippage tolerance reduces the chance of transaction failure due to market movement. However, it exposes the user to being frontrun. 

Trader’s Dilemma: Trade is not profitable to frontrun when the slippage tolerance is smaller than the cost of submitting the frontrunning transactions. However, due to the lower transaction fees on the XRP Ledger, a trader using such a low slippage tolerance would surely experience many trade failures due to natural market movement. It is unreasonable to set a low slippage tolerance to avoid frontrunning when it is associated with the inconvenience of resubmitting the transaction. When computing the slippage tolerance, the trader has to optimize between the cost of their trade failing due to a too-low slippage tolerance and the cost of being frontrun. The following mitigation strategy allows the user to compute a more optimal slippage tolerance.

Mitigation: This mitigation strategy computes the slippage tolerance as a fraction of the trade size. It leverages historical data to estimate the probability of transaction failure caused by price fluctuations and the price change between two ledger updates. The slippage tolerance is calculated to minimize potential profits for frontrunners and ensure the successful execution of the trade. This proactive approach serves as a deterrent to potential frontrunners attempting to flood the ledger with "frontrun" transactions, thereby helping maintain the ledger's stability. The key advantage of this approach is that it requires no modifications to XRPL’s implementation. 

Finally, we don’t believe the risk of front running is a reason to oppose the inclusion of AMMs on XRPL because users should get strictly better rates regardless and the risk exists under the current environment.

In summary, we are at a pivotal moment in the evolution of the XRPL, with the XLS-30 amendment representing a critical opportunity to enhance its overall functionality and utility.  As noted above, RippleX has voted in support of the amendment because we believe it enhances the utility of the XRPL. If you in your capacity as a validator are also supportive of the amendment, we kindly remind you to exercise your right to vote.  

Your active participation and engagement are pivotal in this transformative journey.

Casting a Ballot

To vote in favor of a particular amendment, the command to execute is:
/opt/ripple/bin/rippled feature NAME accept

To vote against a particular amendment, the command to execute is:
/opt/ripple/bin/rippled feature NAME reject

Replace /opt/ripple/bin/ with the path to your rippled binary, and NAME with the name of the amendment.

For example, the XLS-30 AMM is named "AMM". If rippled is at /opt/ripple/bin/rippled, then to vote in favor of the XLS-30 AMM:
/opt/ripple/bin/rippled feature AMM accept