Ed Hennis 91d239f10b Improve and fix bugs in Lending Protocol - XLS-66 (#6156)
- Fix overpayment asserts (#6084)

- MPTTester::operator() parameter should be std::int64_t
	- Originally defined as uint64_t, but the testIssuerLoan() test called
	  it with a negative number, causing an overflow to a very large number
	  that in some circumstances could be silently cast back to an int64_t,
	  but might not be. I believe this is UB, and we don't want to rely on
	  that.

- Fix Overpayment Calculation  (#6087)
	- Adds additional unit tests to cover math calculations.
	- Removes unused methods.
- Fix LoanBrokerSet debtMaximum limits (#6116)
- Fix some minor bugs in Lending Protocol (#6101)
	- add nodiscard to unimpairLoan, and check result in LoanPay
	- add a check to verify that issuer exists
	- improve LoanManage error code for dust amounts

- In overpayment results, the management fee was being calculated twice:
  once as part of the value change, and as part of the fees paid.
  Exclude it from the value change.

- Round the initial total value computation upward, unless there is
  0-interest.
- Rename getVaultScale to getAssetsTotalScale, and convert one incorrect
  computation to use it.
- Use adjustImpreciseNumber for LossUnrealized.
- Add some logging to computeLoanProperties.

- Check permissions in LoanSet and LoanPay (#6108)

- Disallow pseudo accounts to be Destination for LoanBrokerCoverWithdraw (#6106)

- Ensure vault asset cap is not exceeded (#6124)

- Fix Overpayment ValueChange calculation in Lending Protocol (#6114)
	- Adds loan state to LoanProperties.
	- Cleans up computeLoanProperties.
	- Fixes missing management fee from overpayment.

- fix: Enable LP Deposits when the broker is the asset issuer (#6119)

- Add a few minor changes (#6158)
	- Updates or fixes a couple of things I noticed while reviewing changes
	  to the spec.
	- Rename sfPreviousPaymentDate to sfPreviousPaymentDueDate.
	- Make the vault asset cap check added in #6124 a little more robust:
	  1. Check in preflight if the vault is _already_ over the limit.
	  2. Prevent overflow when checking with the loan value. (Subtract
	     instead of adding, in case the values are near maxint. Both return
	     the same result. Also add a unit test so each case is covered.

- Add minimum grace period validation (#6133)

- Fix bugs: frozen pseudo-account, and FLC cutoff (#6170)
	- Fixes LoanManage tfBAD_LEDGER case by capping the amount of FLC to use to cover a loss at the amount of cover available.
	- Check if the Vault pseudo-account is frozen in LoanBrokerSet

- refactor: Rename raw state to theoretical state (#6187)

- Check if a withdrawal amount exceeds any applicable receiving limit. (#6117)
	- Check the trust line limit is not exceeded for a withdraw to a third party Destination account.

- Fix test failures from interaction between #6120 and #6133
	- LoanSet transaction added in #6120 failed the minimum grace period
	  added by #6133.

- Fix overpayment result calculation (#6195)

- Address review feedback from Lending Protocol re-review (#6161)
	- Reduce code duplication in LoanBrokerDelete
	- Reorder "canWithdraw" parameters to put "view" first
	- Combine accountSpendable into accountHolds
	- Avoid copies by taking a reference for the claw amount
	- Return function results directly
	- Fix typo for "parseLoan" in ledger_entry RPC
	- Improve some comments and unused variables
	- No need for late payment components lambda
	- Add explanatory comment for computeLoanProperties
	- Add comment linking computeRawLoanState to spec
	- Fix typo: TrueTotalPrincipalOutstanding
	- Fix missed ripple -> xrpl update
	- Remove unnecessary "else"s.
	- Clean up std::visit in accountHolds.
	
---------

Co-authored-by: Vito Tumas <5780819+Tapanito@users.noreply.github.com>
Co-authored-by: Shawn Xie <35279399+shawnxie999@users.noreply.github.com>
Co-authored-by: Jingchen <a1q123456@users.noreply.github.com>
Co-authored-by: Gregory Tsipenyuk <gregtatcam@users.noreply.github.com>
2026-01-12 18:08:35 -05:00
2025-08-22 10:02:56 -04:00
2025-08-22 10:02:56 -04:00
2014-05-13 12:15:59 -07:00
2025-11-28 11:20:31 +00:00

codecov

The XRP Ledger

The XRP Ledger is a decentralized cryptographic ledger powered by a network of peer-to-peer nodes. The XRP Ledger uses a novel Byzantine Fault Tolerant consensus algorithm to settle and record transactions in a secure distributed database without a central operator.

XRP

XRP is a public, counterparty-free crypto-asset native to the XRP Ledger, and is designed as a gas token for network services and to bridge different currencies. XRP is traded on the open-market and is available for anyone to access. The XRP Ledger was created in 2012 with a finite supply of 100 billion units of XRP.

rippled

The server software that powers the XRP Ledger is called rippled and is available in this repository under the permissive ISC open-source license. The rippled server software is written primarily in C++ and runs on a variety of platforms. The rippled server software can run in several modes depending on its configuration.

If you are interested in running an API Server (including a Full History Server), take a look at Clio. (rippled Reporting Mode has been replaced by Clio.)

Build from Source

Key Features of the XRP Ledger

  • Censorship-Resistant Transaction Processing: No single party decides which transactions succeed or fail, and no one can "roll back" a transaction after it completes. As long as those who choose to participate in the network keep it healthy, they can settle transactions in seconds.
  • Fast, Efficient Consensus Algorithm: The XRP Ledger's consensus algorithm settles transactions in 4 to 5 seconds, processing at a throughput of up to 1500 transactions per second. These properties put XRP at least an order of magnitude ahead of other top digital assets.
  • Finite XRP Supply: When the XRP Ledger began, 100 billion XRP were created, and no more XRP will ever be created. The available supply of XRP decreases slowly over time as small amounts are destroyed to pay transaction fees.
  • Responsible Software Governance: A team of full-time developers at Ripple & other organizations maintain and continually improve the XRP Ledger's underlying software with contributions from the open-source community. Ripple acts as a steward for the technology and an advocate for its interests.
  • Secure, Adaptable Cryptography: The XRP Ledger relies on industry standard digital signature systems like ECDSA (the same scheme used by Bitcoin) but also supports modern, efficient algorithms like Ed25519. The extensible nature of the XRP Ledger's software makes it possible to add and disable algorithms as the state of the art in cryptography advances.
  • Modern Features: Features like Escrow, Checks, and Payment Channels support financial applications atop of the XRP Ledger. This toolbox of advanced features comes with safety features like a process for amending the network and separate checks against invariant constraints.
  • On-Ledger Decentralized Exchange: In addition to all the features that make XRP useful on its own, the XRP Ledger also has a fully-functional accounting system for tracking and trading obligations denominated in any way users want, and an exchange built into the protocol. The XRP Ledger can settle long, cross-currency payment paths and exchanges of multiple currencies in atomic transactions, bridging gaps of trust with XRP.

Source Code

Here are some good places to start learning the source code:

  • Read the markdown files in the source tree: src/ripple/**/*.md.
  • Read the levelization document to get an idea of the internal dependency graph.
  • In the big picture, the main function constructs an ApplicationImp object, which implements the Application virtual interface. Almost every component in the application takes an Application& parameter in its constructor, typically named app and stored as a member variable app_. This allows most components to depend on any other component.

Repository Contents

Folder Contents
./bin Scripts and data files for Ripple integrators.
./Builds Platform-specific guides for building rippled.
./docs Source documentation files and doxygen config.
./cfg Example configuration files.
./src Source code.

Some of the directories under src are external repositories included using git-subtree. See those directories' README files for more details.

Additional Documentation

See Also

Description
Decentralized cryptocurrency blockchain daemon implementing the XRP Ledger protocol in C++
Readme 350 MiB
Languages
C++ 99%
CMake 0.5%
Python 0.2%
Mako 0.2%