Coin Brief ENDE

xrpl.js moves its BigNumber fix for dropsToXrp off main to a 6.0.0 branch

The maintainers of xrpl.js, the JavaScript library for the XRP Ledger, merged two pull requests on 12 November that move a precision fix out of the main branch and change how breaking changes are handled.

The fix itself, pull request 3341, was merged on 5 November. It changed dropsToXrp() and Client.getXrpBalance() to return a BigNumber instead of a JavaScript number. Its description traces the bug to version 3.0.0, when the two functions switched from string to number. A double cannot hold every drop above 2^33 XRP, about 8.6 billion XRP: dropsToXrp('9999999999999999') returned 9999999999.999998, and converting that back gave '9999999999999998', one drop lost. Near the 100 billion XRP supply the round trip loses up to 15 drops. The pull request first returned a string, then switched to BigNumber after review, because adding two strings would silently concatenate them while TypeScript rejects adding two BigNumber values.

The problem was where it landed. Pull request 3587, a revert, explains that 3341 is a breaking change, so the next release from main would have had to be 6.0.0. The plan is to release 5.4.0 first with the non-breaking fixes merged since 5.3.0, and more such fixes are expected, so 5.4.0 cannot be cut from an older commit. The fix therefore leaves main and will be re-landed on a new xrpl-6.0.0 branch, created after the revert so that a later rebase keeps it. Once 5.4.0 is out, that branch will be rebased onto main, merged and released as 6.0.0. The issue the fix addresses, 3316, was reopened until then.

The companion pull request, 3586, writes the procedure into the project's documents. CONTRIBUTING.md gains a section on breaking changes, the pull request template's breaking-change checkbox now tells contributors to target the next major's branch, and RELEASE.md says a major version is released from main only after its branch is merged, with pending fixes released first. According to the description, this records what the team already did for versions 3.0 and 4.0.

xrpl.js moves its BigNumber fix for dropsToXrp off main to a 6.0.0 branch
xrpl.js moves its BigNumber fix for dropsToXrp off main to a 6.0.0 branch — Coin Brief

Why it matters

Applications that handle balances near the top of the supply, such as exchanges and custody systems, still get the lossy number from 5.x. Until 6.0.0 ships, the safe path is to work in drops as strings and convert with a decimal library, rather than rely on dropsToXrp for amounts that must reconcile exactly.

Primary source
xrpl.js pull requests
https://github.com/XRPLF/xrpl.js/pull/3587
Written by Victoria Shinder.