Commit Graph

13624 Commits

Author SHA1 Message Date
Ed Hennis
1e47c76fc4 Rewrite to clarify Number limitations, enforce limits in conversion
- Overflow Number -> int64 if it doesn't fit in the mantissa range.
- Only enabled if at least one of the SingleAssetVault or
  LendingProtocol amendments are enabled.
- Will throw the overflow error if the value is larger than maxMantissa.
  Current behavior is to throw if the value is larger than max int64_t
  value.
2025-11-18 23:12:28 -05:00
Ed Hennis
6503e6deae Merge branch 'develop' into ximinez/lending-number 2025-11-18 22:39:14 -05:00
sunnyraindy
ad37461ab2 chore: Fix some typos in comments (#6040) 2025-11-18 20:21:35 -05:00
Mayukha Vadari
d9c27da529 refactor: split up RPCHelpers.h into two (#6047)
This PR splits `RPCHelpers.h` into two files, by moving out all the ledger-fetching-related functions into a separate file, `RPCLedgerHelpers.h`. It also moves `getAccountObjects` to `AccountObjects.h`, since it is only used in that one place.
2025-11-18 15:44:39 -05:00
Ed Hennis
2e02c338af Expand the description of Number::isInteger_ 2025-11-17 20:27:32 -05:00
Ed Hennis
67796cfa90 Change the vaultMaximumIOUScale from 13 to 15
- Anything above 13 is _nearly_ unusable, but there might be some edge
  use cases where it is.
- Added unit tests to show this.
2025-11-17 20:25:11 -05:00
Ed Hennis
2338c55dc8 test fix: Remove cases with Vault scale 18
- The limit has been reduced to 13, so 18 is now considered malformed.
- Make the test more robust so it doesn't segfault if the vault creation
  fails.
2025-11-17 18:20:12 -05:00
Ed Hennis
bba4b444a6 fix: Number: Do not attempt to take the negative of an unsigned 2025-11-17 18:18:52 -05:00
Bart
3fb6acd29e ci: Fix filtering out of Clang 20+ on ARM (#6046)
This change fixes the strategy matrix check to filter out the Clang 20+ on ARM, which still fail due to problems with Boost.
2025-11-17 21:54:13 +00:00
Bart
77b7cef5a7 ci: Use new Debian Trixie images (#6034)
This change uses the new Debian Trixie CI images added by XRPLF/ci#83.
2025-11-17 19:31:19 +00:00
Ed Hennis
7974545da4 Fixes build errors and test failures
- STAmount::clear() needs to use 0 exponent for all integral types.
- Change vaultMaximumIOUScale to 13.
- Fix an dereferenced unseated optional.
2025-11-17 14:31:03 -05:00
Jingchen
2c187461cc refactor: Retire NegativeUNL amendment (#6033)
Amendments activated for more than 2 years can be retired. This change retires the NegativeUNL amendment.
2025-11-17 14:02:10 +00:00
Ed Hennis
596365d05d fixup! Rip out about half the code: levels, enforcement, and STAmount changes 2025-11-17 00:50:09 -05:00
Ed Hennis
8822b53bd5 Rip out about half the code: levels, enforcement, and STAmount changes
- Changed the EnforceInteger enum into a bool.
- Removed enforcement by throw.
- Essentially got rid of the "weak" and "strong" options.
- Removed integer options from STAmount. Since there's no throwing,
  there's no need to override the default.
2025-11-16 21:59:40 -05:00
Ed Hennis
2854e6bbf9 Merge branch 'develop' into ximinez/lending-number 2025-11-15 03:08:25 -05:00
Ayaz Salikhov
13a12c6402 chore: Update nudb recipe to remove linker warnings (#6038) 2025-11-14 20:27:28 +00:00
Bronek Kozicki
362ecbd1cb fix: Apply object reserve for Vault pseudo-account (#5954) 2025-11-14 17:30:56 +00:00
Jingchen
7025e92080 refactor: Retire TicketBatch amendment (#6032)
Amendments activated for more than 2 years can be retired. This change retires the TicketBatch amendment.
2025-11-14 13:33:34 +00:00
Ed Hennis
5845c5c952 Merge branch 'develop' into ximinez/lending-number 2025-11-13 12:18:31 -05:00
Vlad
f81d0d8c98 chore: Clean up incorrect comments (#6031)
This change cleans up incorrect comments that were left in test cases after one of the amendments was retired.
2025-11-13 13:37:38 +00:00
Jingchen
508937f3d1 refactor: Retire MultiSignReserve and ExpandedSignerList amendments (#5981)
Amendments activated for more than 2 years can be retired. This change retires the MultiSignReserve and ExpandedSignerList amendments.
2025-11-13 11:42:45 +00:00
Ed Hennis
a3db23ee2c Merge remote-tracking branch 'XRPLF/develop' into ximinez/lending-number
* XRPLF/develop:
  chore: Set version 3.1.0-b0 (5986)
  ci: Clean workspace on Windows self-hosted runners (6024)
  docs: fix spelling in comments (6002)
  fix: floating point representation errors in vault (5997)
  ci: Specify bash as the default shell in workflows (6021)
  refactor: Add `XRPL_RETIRE_FIX` and `XRPL_RETIRE_FEATURE` macros (6014)
  refactor: Retire DepositPreAuth and DepositAuth amendments (5978)
  chore: Move running of unit tests out of coverage target (6018)
  refactor: Retire PayChanRecipientOwnerDir amendment (5946)
2025-11-12 14:02:15 -05:00
Bronek Kozicki
8580a5795a chore: Set version 3.1.0-b0 (#5986)
Technically b0 is not a release, so no "release" prefix here. It marks the point at which we moved the preceding release (3.0.0 in this case) from Beta to Release Candidate.
3.1.0-b0
2025-11-12 18:55:49 +00:00
Bart
9b53bd9871 ci: Clean workspace on Windows self-hosted runners (#6024)
This change updates the `cleanup-workspace` action to its latest version, which added support for Windows.
2025-11-12 09:30:45 -05:00
hustrust
5fc07e3979 docs: fix spelling in comments (#6002) 2025-11-12 08:23:45 -05:00
Bronek Kozicki
2ebc2ca885 fix: floating point representation errors in vault (#5997)
This change fixes floating point errors in conversion of shares to assets and other way, used in `VaultDeposit`, `VaultWithdraw` and `VaultClawback`. In the floating point calculations the division introduces a larger error than multiplication. If we do division first, then the error introduced will be increased by the multiplication that follows, which is therefore the wrong order to perform these two operations. This change flips the order of arithmetic operations, which minimizes the error.
2025-11-11 19:39:09 +00:00
Ayaz Salikhov
c2a90b706f ci: Specify bash as the default shell in workflows (#6021) 2025-11-11 18:17:03 +00:00
Jingchen
9ffb434315 refactor: Add XRPL_RETIRE_FIX and XRPL_RETIRE_FEATURE macros (#6014)
Rather than having a single `XRPL_RETIRE` macro that applies to both feature and fix amendments, this change replaces it by new `XRPL_RETIRE_FIX` and `XRPL_RETIRE_FEATURE` macros that avoids confusion between whether to prefix the amendment name with `feature` or `fix`.
2025-11-11 12:45:13 -05:00
Jingchen
ff18cfef96 refactor: Retire DepositPreAuth and DepositAuth amendments (#5978)
Amendments activated for more than 2 years can be retired. This change retires the fDepositPreAuth and DepositAuth amendments.
2025-11-11 15:21:07 +00:00
Bronek Kozicki
03704f712b chore: Move running of unit tests out of coverage target (#6018)
This change makes the progress of unit tests visible and also gives more flexibility when running them.
2025-11-11 14:55:16 +00:00
Pratik Mankawde
9b332d88c1 refactor: Retire PayChanRecipientOwnerDir amendment (#5946)
Amendments activated for more than 2 years can be retired. This change retires the PayChanRecipientOwnerDir amendment.
2025-11-11 09:07:45 -05:00
Ed Hennis
ff9270beaa Merge branch 'develop' into ximinez/lending-number 2025-11-10 19:52:50 -05:00
Ed Hennis
a45b43e8ea Update include/xrpl/basics/Number.h
Fix typo.

Co-authored-by: Shawn Xie <35279399+shawnxie999@users.noreply.github.com>
2025-11-10 16:45:50 -05:00
Ayaz Salikhov
33309480d4 ci: Update Conan to 2.22.2 (#6019)
This updates the CI image hashes after following change: https://github.com/XRPLF/ci/pull/81. And, since we use latest Conan, we can have `conan.lock` with a newline at the end, and we don't need to exclude it from `pre-commit` hooks any longer.
2025-11-10 16:23:40 -05:00
Ed Hennis
1648eadcba Merge branch 'develop' into ximinez/lending-number 2025-11-10 15:35:04 -05:00
Bart
098eadca0a refactor: Update RocksDB, SQLite, Doctest (#6015) 2025-11-10 18:02:35 +00:00
Bronek Kozicki
3b810c305a fix: JSON parsing of negative STNumber and STAmount (#5990)
This change fixes JSON parsing of negative `int` input in `STNumber` and `STAmount`. The conversion of JSON to `STNumber` or `STAmount` may trigger a condition where we negate smallest possible `int` value, which is undefined behaviour. We use a temporary storage as `int64_t` to avoid this bug. Note that this only affects RPC, because we do not parse JSON in the protocol layer, and hence no amendment is needed.
2025-11-10 17:33:20 +00:00
Bart
3968efb5f1 chore: Make CMake improvements (#6010)
This change removes unused definitions from the CMake files, moves variable definitions from `XrplSanity` to `XrplSettings` where they better belong, and updates the minimum GCC and Clang versions to match what we actually minimally support.
2025-11-10 16:33:54 +00:00
Jingchen
12c629a1d2 refactor: Retire CheckCashMakesTrustLine amendment (#5974)
Amendments activated for more than 2 years can be retired. This change retires the CheckCashMakesTrustLine amendment.
2025-11-10 16:03:10 +00:00
Bronek Kozicki
8d2dff2e48 chore: Unify build & test, add ctest to coverage (#6013)
This change unifies the build and test jobs into a single job, and adds `ctest` to coverage reporting.

The mechanics of coverage reporting is slightly complex and most of it is encapsulated in the `coverage` target. The status quo way of preparing coverage reports involves running a single target `cmake --build . --target coverage`, which does three things:
* Build the `rippled` binary (via target dependency)
* Prepare coverage reports:
  * Run `./rippled -u` unit tests.
  * Gather test output and build reports.

This makes it awkward to add an additional `ctest` step between build and coverage reporting steps. The better solution is to split `coverage` target into separate build, followed by `ctest`, followed by test generation. Luckily, the `coverage` target has been designed specifically to support such case; it does not need to build `rippled`, it's just a dependency. Similarly it allows additional tests to be run before gathering test outputs; in principle we could even strip it from running tests and run them separately instead. This means we can keep build, `ctest` and generation of coverage reports as separate steps, as long as the state of build directory is fully (including file timestamps, additional coverage files etc.) preserved between the steps. This means that in order to run `ctest` for coverage reporting we need to integrate build and test into a single job, which this change does.
2025-11-10 10:32:08 -05:00
Ed Hennis
edb9b16583 fix: Use ".value()" instead of "->" when with STObject::Proxy objects
- Turns out that "Proxy::operator->" is not a safe substitute for
  "Proxy::value()." if the field is not required. The implementation
  is different such that "operator->" will return a null ptr if the
  field is not present. This includes default fields with a value of
  zero!
2025-11-08 16:40:19 -05:00
Ed Hennis
fabc7bd916 Merge branch 'develop' into ximinez/lending-number 2025-11-07 19:11:47 -05:00
Ed Hennis
8e56af20ee Add a distinction between a "valid" and a "representable" Number
- "valid" means the value is <= Number::maxIntValue, which has been
  changed to maxMantissa / 100. A valid number could get bigger and be
  ok - such as when paying late interest on a loan.
- "representable" means the value is <= Number::maxMantissa. An
  unrepresentable number WILL be rounded or truncated.
- Adds a fourth level of enforcement: "compatible". It is used for
  converting XRP to Number (for AMM), and when doing explicit checks.
- "weak" will now throw if the number is unrepresentable.
2025-11-07 19:07:21 -05:00
Michael Legleux
c39f9c561c chore: Point xrpld symlink to rippled (#6012)
As part of renaming ripple(d) to xrpl(d), the xrpld symlink was made to point to itself instead of to the rippled binary. This change fixes the symlink.
2025-11-07 10:51:12 +00:00
Ed Hennis
0175dd70db Catch up the consequences of Number changes
- Change the Number::maxIntValue to all 9's.
- Add integral() to Asset (copied from Lending)
- Add toNumber() functions to STAmount, MPTAmount, XRPAmount to allow
  explicit conversions with enforcement options.
- Add optional Number::EnforceInteger options to STAmount and STNumber
  ctors, conversions, etc. IOUs are never checked.
- Update Vault transactors, and helper functions, to check restrictions.
- Fix and add Vault tests.
2025-11-06 23:55:05 -05:00
Ed Hennis
cb6df196dc Fix build error - avoid copy 2025-11-06 23:55:05 -05:00
Ed Hennis
b605a2cdcc Add integer enforcement when converting to XRP/MPTAmount to Number 2025-11-06 23:55:05 -05:00
Ed Hennis
24f37d73f6 Make all STNumber fields "soeDEFAULT" 2025-11-06 23:55:05 -05:00
Ed Hennis
3cb447a4fe Add optional enforcement of valid integer range to Number 2025-11-06 23:55:05 -05:00
Bart
173f9f7bb0 chore: Removes unnecessary creation of symlink in CMake install file (#6009) 2025-11-06 09:06:45 +00:00