Compare commits

...

62 Commits

Author SHA1 Message Date
Bronek Kozicki
c365da1208 WIP 2025-07-17 11:57:18 +01:00
Vlad
8bfaa7fe0a test: Run unit tests regardless of 'Supported' amendment status (#5537) 2025-07-16 11:47:54 +00:00
Vlad
c9135a63cd Retire Flow Cross amendment (#5562)
The FlowCross amendment is now permanently enabled, so all code branches that have this amendment disabled are removed.
2025-07-16 06:53:13 -04:00
Michael Legleux
452263eaa5 chore: Update CI to use Conan 2 (#5556)
This is a minimally invasive update to use Conan 2 provided by our new build images.
2025-07-15 22:17:22 +00:00
yinyiqian1
8aa94ea09a fixAMMClawbackRounding: adjust last holder's LPToken balance (#5513)
Due to rounding, the LPTokenBalance of the last LP might not match the LP's trustline balance. This was fixed for `AMMWithdraw` in `fixAMMv1_1` by adjusting the LPTokenBalance to be the same as the trustline balance. Since `AMMClawback` is also performing a withdrawal, we need to adjust LPTokenBalance as well in `AMMClawback.`

This change includes:
1. Refactored `verifyAndAdjustLPTokenBalance` function in `AMMUtils`, which both`AMMWithdraw` and `AMMClawback` call to adjust LPTokenBalance.
2. Added the unit test `testLastHolderLPTokenBalance` to test the scenario.
3. Modify the existing unit tests for `fixAMMClawbackRounding`.
2025-07-11 20:03:28 +00:00
Bronek Kozicki
258ba71363 chore: Add gcc-12 workaround (#5554)
This change silences a dummy warning, which is breaking builds with GCC 12 (but not newer versions of GCC) in release mode only.
2025-07-11 18:57:09 +00:00
Shawn Xie
b8626ea3c6 Add MPT related txns into issuer's account history (#5530)
Currently there is no easy way to track MPT related transactions for the issuer. This change allows MPT transactions to show up on issuer's AccountTx RPC (to align with how IOUs work).
2025-07-11 17:50:03 +00:00
Vlad
6534757d85 chore: Remove unused headers (#5526) 2025-07-10 18:15:42 +00:00
Denis Angell
8e94ea3154 fix: add allowTrustLineLocking flag for account_info (#5525)
* Update the `account_info` API so that the `allowTrustLineLocking` flag is included in the response.
* The proposed `TokenEscrow` amendment added an `allowTrustLineLocking` flag in the `AccountRoot` object.
* In the API response, under `account_flags`, there is now an `allowTrustLineLocking` field with a boolean (`true` or `false`) value.
* For reference, the XLS-85 Token-Enabled Escrows implementation can be found in https://github.com/XRPLF/rippled/pull/5185
2025-07-10 16:29:51 +00:00
Bronek Kozicki
b113190563 Downgrade required CMake version for Antithesis SDK (#5548)
The current version was copied from `antithesis-sdk-cpp` but there is no logical reason to require this specific version of CMake. This change downgrades the version to make the project build with older CMake versions.
2025-07-10 11:46:02 -04:00
Ayaz Salikhov
358b7f50a7 fix: Link with boost libraries explicitly (#5546)
Having `boost::boost` in `self.requires` makes clio link with all boost libraries. There are additionally several Boost stacktrace backends that are both linked with, which violate ODR.
This change fixes the problem.
2025-07-10 06:14:27 -04:00
Bronek Kozicki
f47e2f4e82 chore: Fix compilation error with clang-20 and cleanup (#5543)
Removes clutter for old compilers, defaults to non-unity builds in cmake to match conanfile.py, and workaround for clang-20 compilation errors.
2025-07-09 17:47:34 +00:00
Bronek Kozicki
a7eea9546f test: Remove circular jtx.h dependencies (#5544)
Circular includes in header files can yield unpredictable results.
2025-07-09 08:43:11 -04:00
Jingchen
9874d47d7f Decouple CredentialHelpers from xrpld/app/tx (#5487)
This PR refactors `CredentialHelpers` and removes some unnecessary dependencies as a step of modularization.

The ledger component is almost independent except that it references `MPTokenAuthorize` and `CredentialHelpers.h`, and the latter further references `Transactor.h`. This PR partially clears the path to modularizing the ledger component and decouples `CredentialHelpers` from xrpld.
2025-07-03 14:27:37 +00:00
Mayukha Vadari
c2f3e2e263 fix: crash when trace-logging in tests (#5529)
This PR fixes a crash in tests when the test `Env is run at trace/debug log level.

This issue only affects tests, and only if logging at trace/debug level, so really only relevant during rippled development, and does not affect production servers.
2025-07-02 19:10:25 +00:00
Vlad
e18f27f5f7 test: switch some unit tests to doctest (#5383)
This change moves some tests from the current unit tests that are compiled into the rippled binary to using the doctest framework.
2025-06-26 19:35:31 +00:00
Jingchen
df6daf0d8f Add XRPL_ABANDON and use it to abandon OwnerPaysFee (#5510) 2025-06-26 12:09:05 -04:00
Jingchen
e9d46f0bfc Remove OwnerPaysFee as it's never fully supported (#5435)
The OwnerPaysFee amendment was never fully supported, and this change removes the feature to the extent possible.
2025-06-24 18:56:58 +00:00
Bart
42fd74b77b Removes release notes from codebase (#5508) 2025-06-24 13:10:00 -04:00
tequ
c55ea56c5e Add nftoken_id, nftoken_ids, offer_id to meta for transaction stream (#5230) 2025-06-24 09:02:22 -04:00
Michael Legleux
1e01cd34f7 Set version to 2.5.0 2025-06-23 10:13:01 -07:00
Alex Kremer
e2fa5c1b7c chore: Change libXRPL check conan remote to dev (#5482)
This change aligns the Conan remote used by the libXRPL Clio compatibility check workflow with the recent changes applied to Clio.
2025-06-20 17:02:16 +00:00
Ed Hennis
fc0984d286 Require a message on "Application::signalStop" (#5255)
This change adds a message parameter to Application::signalStop for extra context.
2025-06-20 16:24:34 +00:00
Valentin Balaschenko
8b3dcd41f7 refactor: Change getNodeFat Missing Node State Tree error into warning (#5455) 2025-06-20 15:44:42 +00:00
Denis Angell
8f2f5310e2 Fix: Improve error handling in Batch RPC response (#5503) 2025-06-18 17:46:45 -04:00
Michael Legleux
edb4f0342c Set version to 2.5.0-rc2 2025-06-11 17:10:45 -07:00
yinyiqian1
ea17abb92a fix: Ensure delegate tests do not silently fail with batch (#5476)
The tests that ensure `tfInnerBatchTxn` won't block delegated transactions silently fail in `Delegate_test.cpp`. This change removes these cases from that file and adds them to `Batch_test.cpp` instead where they do not silently fail, because there the batch delegate results are explicitly checked. Moving them to that file further avoids refactoring many helper functions.
2025-06-11 13:21:24 +08:00
Mayukha Vadari
35a40a8e62 fix: Improve multi-sign usage of simulate (#5479)
This change allows users to submit simulate requests from a multi-sign account without needing to specify the accounts that are doing the multi-signing, and fixes an error with simulate that allowed double-"signed" (both single-sign and multi-sign public keys are provided) transactions.
2025-06-10 14:47:27 +08:00
Ed Hennis
d494bf45b2 refactor: Collapse some split log messages into one (#5347)
Multi-line log messages are hard to work with. Writing these handful of related messages as one message should make the log a tiny bit easier to manage.
2025-06-06 16:01:02 +00:00
Vlad
8bf4a5cbff chore: Remove external project build cores division (#5475)
The CMake statements that make it seem as if the number of cores used to build external project dependencies is halved don't actually do anything. This change removes these statements.
2025-06-05 13:37:30 +00:00
Denis Angell
58c2c82a30 fix: Amendment-guard TokenEscrow preclaim and expand tests (#5473)
This change amendment-guards the preclaim for `TokenEscrow`, as well as expands tests to increase code coverage.
2025-06-05 12:54:45 +00:00
Michael Legleux
11edaa441d Set version to 2.5.0-rc1 (#5472) 2025-06-04 17:55:23 +00:00
yinyiqian1
a5e953b191 fix: Add tecNO_DELEGATE_PERMISSION and fix flags (#5465)
* Adds `tecNO_DELEGATE_PERMISSION` for unauthorized transactions sent by a delegated account.
* Returns `tecNO_TARGET` instead of `terNO_ACCOUNT` for the `DelegateSet` transaction if the delegated account does not exist.
* Fixes `tfFullyCanonicalSig` and `tfInnerBatchTxn` blocking transactions issue by adding `tfUniversal` in the permission related masks in `txFlags.h`
2025-06-03 22:20:29 +00:00
Mark Travis
506ae12a8c Increase network i/o capacity (#5464)
The change increases the default network I/O worker thread pool size from 2 to 6. This will improve stability, as worker thread saturation correlates to desyncs, particularly on high-traffic peers, such as hubs.
2025-06-03 21:33:09 +00:00
Ayaz Salikhov
0310c5cbe0 fix: Specify transitive_headers when building with Conan 2 (#5462)
To be able to consume `rippled` in Conan 2, the recipe should specify transitive_headers for external libraries that are present in the exported header files. This change remains compatibility with Conan 1, where this flag was not present.
2025-06-03 17:33:32 +00:00
Denis Angell
053e1af7ff Add support for XLS-85 Token Escrow (#5185)
- Specification: https://github.com/XRPLF/XRPL-Standards/pull/272
- Amendment: `TokenEscrow`
- Enables escrowing of IOU and MPT tokens in addition to native XRP.
- Allows accounts to lock issued tokens (IOU/MPT) in escrow objects, with support for freeze, authorization, and transfer rates.
- Adds new ledger fields (`sfLockedAmount`, `sfIssuerNode`, etc.) to track locked balances for IOU and MPT escrows.
- Updates EscrowCreate, EscrowFinish, and EscrowCancel transaction logic to support IOU and MPT assets, including proper handling of trustlines and MPT authorization, transfer rates, and locked balances.
- Enforces invariant checks for escrowed IOU/MPT amounts.
- Extends GatewayBalances RPC to report locked (escrowed) balances.
2025-06-03 12:51:55 -04:00
Vlad
7e24adbdd0 fix: Address NFT interactions with trustlines (#5297)
The changes are focused on fixing NFT transactions bypassing the trustline authorization requirement and potential invariant violation when interacting with deep frozen trustlines.
2025-06-02 16:13:20 +00:00
Gregory Tsipenyuk
621df422a7 fix: Add AMMv1_3 amendment (#5203)
* Add AMM bid/create/deposit/swap/withdraw/vote invariants:
  - Deposit, Withdrawal invariants: `sqrt(asset1Balance * asset2Balance) >= LPTokens`.
  - Bid: `sqrt(asset1Balance * asset2Balance) > LPTokens` and the pool balances don't change.
  - Create: `sqrt(asset1Balance * assetBalance2) == LPTokens`.
  - Swap: `asset1BalanceAfter * asset2BalanceAfter >= asset1BalanceBefore * asset2BalanceBefore`
     and `LPTokens` don't change.
  - Vote: `LPTokens` and pool balances don't change.
  - All AMM and swap transactions: amounts and tokens are greater than zero, except on withdrawal if all tokens
    are withdrawn.
* Add AMM deposit and withdraw rounding to ensure AMM invariant:
  - On deposit, tokens out are rounded downward and deposit amount is rounded upward.
  - On withdrawal, tokens in are rounded upward and withdrawal amount is rounded downward.
* Add Order Book Offer invariant to verify consumed amounts. Consumed amounts are less than the offer.
* Fix Bid validation. `AuthAccount` can't have duplicate accounts or the submitter account.
2025-06-02 09:52:10 -04:00
Shawn Xie
0a34b5c691 Add support for XLS-81 Permissioned DEX (#5404)
Modified transactions:
- OfferCreate
- Payment

Modified RPCs:
- book_changes
- subscribe
- book_offers
- ripple_path_find
- path_find

Spec: https://github.com/XRPLF/XRPL-Standards/pull/281
2025-05-30 13:24:48 -04:00
Matt Mankins
e0bc3dd51f docs: update example keyserver host in SECURITY.md (#5460) 2025-05-30 08:46:08 -04:00
Bronek Kozicki
dacecd24ba Fix unit build error (#5459)
This change fixes the issue that there is a `using namespace` statement inside a namespace scope.
2025-05-29 20:53:31 +00:00
Mayukha Vadari
05105743e9 chore[tests]: improve env.meta usage (#5457)
This commit changes the ledger close in env.meta to be conditional on if it hasn't already been closed (i.e. the current ledger doesn't have any transactions in it). This change will make it a bit easier to use, as it will still work if you close the ledger outside of this usage. Previously, if you accidentally closed the ledger outside of the meta function, it would segfault and it was incredibly difficult to debug.
2025-05-29 16:28:09 +00:00
Bronek Kozicki
9e1fe9a85e Fix: Improve handling of expired credentials in VaultDeposit (#5452)
This change returns `tecEXPIRED` from VaultDeposit to allow the Transactor to remove the expired credentials.
2025-05-28 10:28:18 -04:00
Vito Tumas
d71ce51901 feat: improve squelching configuration (#5438)
This commit introduces the following changes:
* Renames `vp_enable config` option to `vp_base_squelch_enable` to enable squelching for validators.
* Removes `vp_squelch` config option which was used to configure whether to send squelch messages to peers or not. With this flag removed, if squelching is enabled, squelch messages will be sent. This was an option used for debugging.
* Introduces a temporary `vp_base_squelch_max_trusted_peers` config option to change the max number of peers who are selected as validator message sources. This is a temporary option, which will be removed once a good value is found.
* Adds a traffic counter to count the number of times peers ignored squelch messages and kept sending messages for squelched validators.
* Moves the decision whether squelching is enabled and ready into Slot.h.
2025-05-28 06:30:03 -04:00
Michael Legleux
be668ee26d chore: Update CPP ref source (#5453) 2025-05-27 20:46:25 +00:00
Bart
cae5294b4e chore: Rename docs job (#5398) 2025-05-27 20:03:23 +00:00
Elliot.
cd777f79ef docs: add -j $(nproc) to BUILD.md (#5288)
This improves build times.
2025-05-27 19:11:13 +00:00
Valentin Balaschenko
8b9e21e3f5 docs: Update build instructions for Ubuntu 22.04+ (#5292) 2025-05-27 18:32:25 +00:00
Denis Angell
2a61aee562 Add Batch feature (XLS-56) (#5060)
- Specification: [XRPLF/XRPL-Standards 56](https://github.com/XRPLF/XRPL-Standards/blob/master/XLS-0056d-batch/README.md)
- Amendment: `Batch`
- Implements execution of multiple transactions within a single batch transaction with four execution modes: `tfAllOrNothing`, `tfOnlyOne`, `tfUntilFailure`, and `tfIndependent`.
- Enables atomic multi-party transactions where multiple accounts can participate in a single batch, with up to 8 inner transactions and 8 batch signers per batch transaction.
- Inner transactions use `tfInnerBatchTxn` flag with zero fees, no signature, and empty signing public key.
- Inner transactions are applied after the outer batch succeeds via the `applyBatchTransactions` function in apply.cpp.
- Network layer prevents relay of transactions with `tfInnerBatchTxn` flag - each peer applies inner transactions locally from the batch.
- Batch transactions are excluded from AccountDelegate permissions but inner transactions retain full delegation support.
- Metadata includes `ParentBatchID` linking inner transactions to their containing batch for traceability and auditing.
- Extended STTx with batch-specific signature verification methods and added protocol structures (`sfRawTransactions`, `sfBatchSigners`).
2025-05-23 19:53:53 +00:00
Bronek Kozicki
40ce8a8833 fix: Fix pseudo-account ID calculation (#5447)
Before #5224, the pseudoaccount ID was calculated using prefix expressed in `std::uint16_t`. The refactoring to move the pseudoaccount ID calculation to View.cpp had accidentally changed the prefix type to `int` (derived from `auto i = 0`) which in turn changed the length of the input to `sha512Half` from 2 bytes to 4, altering the result.

This resulted in a different ID of the pseudoaccount calculated from the function after the refactoring, breaking the ledger. This impacts AMMCreate, even when the `SingleAssetVault` amendment is not active. This change restores the prefix type to `std::uint16_t`.
2025-05-23 14:05:36 +00:00
Bronek Kozicki
7713ff8c5c Add codecov badge, raise .codecov.yml thresholds (#5428) 2025-05-22 14:43:41 +00:00
Olek
70371a4344 Fix initializer list initialization for GCC-15 (#5443) 2025-05-21 13:28:18 -04:00
Bronek Kozicki
e514de76ed Add single asset vault (XLS-65d) (#5224)
- Specification: XRPLF/XRPL-Standards#239
- Amendment: `SingleAssetVault`
- Implements a vault feature used to store a fungible asset (XRP, IOU, or MPT, but not NFT) and to receive shares in the vault (an MPT) in exchange.
- A vault can be private or public.
- A private vault can use permissioned domains, subject to the `PermissionedDomains` amendment.
- Shares can be exchanged back into asset with `VaultWithdraw`.
- Permissions on the asset in the vault are transitively applied on shares in the vault.
- Issuer of the asset in the vault can clawback with `VaultClawback`.
- Extended `MPTokenIssuance` with `DomainID`, used by the permissioned domain on the vault shares.

Co-authored-by: John Freeman <jfreeman08@gmail.com>
2025-05-20 14:06:41 -04:00
Bart
dd62cfcc22 fix: Update path in CODEOWNERS (#5440) 2025-05-20 15:24:07 +00:00
Michael Legleux
09690f1b38 Set version to 2.5.0-b1 2025-05-18 20:39:18 +01:00
Valentin Balaschenko
380ba9f1c1 Fix: Resolve slow test on macOS pipeline (#5392)
Using std::barrier performs extremely poorly (~1 hour vs ~1 minute to run the test suite) in certain macOS environments.
To unblock our macOS CI pipeline, std::barrier has been replaced with a custom mutex-based barrier (Barrier) that significantly improves performance without compromising correctness.
2025-05-16 10:31:51 +00:00
brettmollin
c3e9380fb4 fix: Update validators-example.txt fix xrplf example URL (#5384) 2025-05-16 09:49:14 +00:00
Jingchen
e3ebc253fa fix: Ensure that coverage file generation is atomic. (#5426)
Running unit tests in parallel and multiple threads can write into one file can corrupt output files, and then gcovr won't be able to parse the corrupted file. This change adds -fprofile-update=atomic as instructed by https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68080.
2025-05-12 14:54:01 +00:00
Bart
c6c7c84355 Configure CODEOWNERS for changes to RPC code (#5266)
To ensure changes to any RPC-related code are compatible with other services, such as Clio, the RPC team will be required to review them.
2025-05-12 12:42:03 +00:00
yinyiqian1
28f50cb7cf fix: enable LedgerStateFix for delegation (#5427) 2025-05-10 10:36:11 -04:00
Vito Tumas
3e152fec74 refactor: use east const convention (#5409)
This change refactors the codebase to use the "east const convention", and adds a clang-format rule to follow this convention.
2025-05-08 11:00:42 +00:00
yinyiqian1
2db2791805 Add PermissionDelegation feature (#5354)
This change implements the account permission delegation described in XLS-75d, see https://github.com/XRPLF/XRPL-Standards/pull/257.

* Introduces transaction-level and granular permissions that can be delegated to other accounts.
* Adds `DelegateSet` transaction to grant specified permissions to another account.
* Adds `ltDelegate` ledger object to maintain the permission list for delegating/delegated account pair.
* Adds an optional `Delegate` field in common fields, allowing a delegated account to send transactions on behalf of the delegating account within the granted permission scope. The `Account` field remains the delegating account; the `Delegate` field specifies the delegated account. The transaction is signed by the delegated account.
2025-05-08 06:14:02 -04:00
545 changed files with 35920 additions and 10979 deletions

View File

@@ -94,3 +94,4 @@ SpacesInSquareBrackets: false
Standard: Cpp11 Standard: Cpp11
TabWidth: 8 TabWidth: 8
UseTab: Never UseTab: Never
QualifierAlignment: Right

View File

@@ -7,13 +7,13 @@ comment:
show_carryforward_flags: false show_carryforward_flags: false
coverage: coverage:
range: "60..80" range: "70..85"
precision: 1 precision: 1
round: nearest round: nearest
status: status:
project: project:
default: default:
target: 60% target: 75%
threshold: 2% threshold: 2%
patch: patch:
default: default:

8
.github/CODEOWNERS vendored Normal file
View File

@@ -0,0 +1,8 @@
# Allow anyone to review any change by default.
*
# Require the rpc-reviewers team to review changes to the rpc code.
include/xrpl/protocol/ @xrplf/rpc-reviewers
src/libxrpl/protocol/ @xrplf/rpc-reviewers
src/xrpld/rpc/ @xrplf/rpc-reviewers
src/xrpld/app/misc/ @xrplf/rpc-reviewers

View File

@@ -6,36 +6,33 @@ inputs:
runs: runs:
using: composite using: composite
steps: steps:
- name: unlock Conan
shell: bash
run: conan remove --locks
- name: export custom recipes - name: export custom recipes
shell: bash shell: bash
run: | run: |
conan config set general.revisions_enabled=1 conan export --version 1.1.10 external/snappy
conan export external/snappy snappy/1.1.10@ conan export --version 9.7.3 external/rocksdb
conan export external/rocksdb rocksdb/9.7.3@ conan export --version 4.0.3 external/soci
conan export external/soci soci/4.0.3@ conan export --version 2.0.8 external/nudb
conan export external/nudb nudb/2.0.8@
- name: add Ripple Conan remote - name: add Ripple Conan remote
if: env.CONAN_URL != ''
shell: bash shell: bash
run: | run: |
conan remote list if conan remote list | grep -q "ripple"; then
conan remote remove ripple || true conan remote remove ripple
# Do not quote the URL. An empty string will be accepted (with echo "Removed conan remote ripple"
# a non-fatal warning), but a missing argument will not. fi
conan remote add ripple ${{ env.CONAN_URL }} --insert 0 conan remote add --index 0 ripple "${CONAN_URL}"
echo "Added conan remote ripple at ${CONAN_URL}"
- name: try to authenticate to Ripple Conan remote - name: try to authenticate to Ripple Conan remote
if: env.CONAN_LOGIN_USERNAME_RIPPLE != '' && env.CONAN_PASSWORD_RIPPLE != ''
id: remote id: remote
shell: bash shell: bash
run: | run: |
# `conan user` implicitly uses the environment variables echo "Authenticating to ripple remote..."
# CONAN_LOGIN_USERNAME_<REMOTE> and CONAN_PASSWORD_<REMOTE>. conan remote auth ripple --force
# https://docs.conan.io/1/reference/commands/misc/user.html#using-environment-variables conan remote list-users
# https://docs.conan.io/1/reference/env_vars.html#conan-login-username-conan-login-username-remote-name
# https://docs.conan.io/1/reference/env_vars.html#conan-password-conan-password-remote-name
echo outcome=$(conan user --remote ripple --password >&2 \
&& echo success || echo failure) | tee ${GITHUB_OUTPUT}
- name: list missing binaries - name: list missing binaries
id: binaries id: binaries
shell: bash shell: bash
@@ -51,7 +48,7 @@ runs:
conan install \ conan install \
--output-folder . \ --output-folder . \
--build missing \ --build missing \
--options tests=True \ --options:host "&:tests=True" \
--options xrpld=True \ --options:host "&:xrpld=True" \
--settings build_type=${{ inputs.configuration }} \ --settings:all build_type=${{ inputs.configuration }} \
.. ..

View File

@@ -9,24 +9,16 @@ jobs:
check: check:
if: ${{ github.event_name == 'push' || github.event.pull_request.draft != true || contains(github.event.pull_request.labels.*.name, 'DraftRunCI') }} if: ${{ github.event_name == 'push' || github.event.pull_request.draft != true || contains(github.event.pull_request.labels.*.name, 'DraftRunCI') }}
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
env: container: ghcr.io/xrplf/ci/tools-rippled-clang-format
CLANG_VERSION: 18
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install clang-format
run: |
codename=$( lsb_release --codename --short )
sudo tee /etc/apt/sources.list.d/llvm.list >/dev/null <<EOF
deb http://apt.llvm.org/${codename}/ llvm-toolchain-${codename}-${CLANG_VERSION} main
deb-src http://apt.llvm.org/${codename}/ llvm-toolchain-${codename}-${CLANG_VERSION} main
EOF
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add
sudo apt-get update
sudo apt-get install clang-format-${CLANG_VERSION}
- name: Format first-party sources - name: Format first-party sources
run: find include src tests -type f \( -name '*.cpp' -o -name '*.hpp' -o -name '*.h' -o -name '*.ipp' \) -exec clang-format-${CLANG_VERSION} -i {} + run: |
clang-format --version
find include src tests -type f \( -name '*.cpp' -o -name '*.hpp' -o -name '*.h' -o -name '*.ipp' \) -exec clang-format -i {} +
- name: Check for differences - name: Check for differences
id: assert id: assert
shell: bash
run: | run: |
set -o pipefail set -o pipefail
git diff --exit-code | tee "clang-format.patch" git diff --exit-code | tee "clang-format.patch"
@@ -58,6 +50,6 @@ jobs:
in your repo, commit, and push. in your repo, commit, and push.
run: | run: |
echo "${PREAMBLE}" echo "${PREAMBLE}"
clang-format-${CLANG_VERSION} --version clang-format --version
echo "${SUGGESTION}" echo "${SUGGESTION}"
exit 1 exit 1

View File

@@ -10,7 +10,7 @@ concurrency:
cancel-in-progress: true cancel-in-progress: true
jobs: jobs:
job: documentation:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: write contents: write

View File

@@ -1,6 +1,6 @@
name: Check libXRPL compatibility with Clio name: Check libXRPL compatibility with Clio
env: env:
CONAN_URL: http://18.143.149.228:8081/artifactory/api/conan/conan-non-prod CONAN_URL: http://18.143.149.228:8081/artifactory/api/conan/dev
CONAN_LOGIN_USERNAME_RIPPLE: ${{ secrets.CONAN_USERNAME }} CONAN_LOGIN_USERNAME_RIPPLE: ${{ secrets.CONAN_USERNAME }}
CONAN_PASSWORD_RIPPLE: ${{ secrets.CONAN_TOKEN }} CONAN_PASSWORD_RIPPLE: ${{ secrets.CONAN_TOKEN }}
on: on:

View File

@@ -15,6 +15,18 @@ on:
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.ref }} group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true cancel-in-progress: true
# This part of Conan configuration is specific to this workflow only; we do not want
# to pollute conan/profiles directory with settings which might not work for others
env:
CONAN_URL: http://18.143.149.228:8081/artifactory/api/conan/dev
CONAN_LOGIN_USERNAME_RIPPLE: ${{ secrets.CONAN_USERNAME }}
CONAN_PASSWORD_RIPPLE: ${{ secrets.CONAN_TOKEN }}
CONAN_GLOBAL_CONF: |
core.download:parallel={{os.cpu_count()}}
core.upload:parallel={{os.cpu_count()}}
tools.build:jobs={{ (os.cpu_count() * 4/5) | int }}
tools.build:verbosity=verbose
tools.compilation:verbosity=verbose
jobs: jobs:
@@ -35,11 +47,10 @@ jobs:
NUM_PROCESSORS: 12 NUM_PROCESSORS: 12
steps: steps:
- name: checkout - name: checkout
uses: actions/checkout@v4 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: install Conan - name: install Conan
run: | run: |
brew install conan@1 brew install conan
echo '/opt/homebrew/opt/conan@1/bin' >> $GITHUB_PATH
- name: install Ninja - name: install Ninja
if: matrix.generator == 'Ninja' if: matrix.generator == 'Ninja'
run: brew install ninja run: brew install ninja
@@ -71,16 +82,33 @@ jobs:
nproc --version nproc --version
echo -n "nproc returns: " echo -n "nproc returns: "
nproc nproc
system_profiler SPHardwareDataType
sysctl -n hw.logicalcpu
clang --version
- name: configure Conan - name: configure Conan
run : | run : |
conan profile new default --detect || true echo "${CONAN_GLOBAL_CONF}" > global.conf
conan profile update settings.compiler.cppstd=20 default conan config install conan/profiles/ -tf $(conan config home)/profiles/
conan profile show
- name: export custom recipes
shell: bash
run: |
conan export --version 1.1.10 external/snappy
conan export --version 9.7.3 external/rocksdb
conan export --version 4.0.3 external/soci
conan export --version 2.0.8 external/nudb
- name: add Ripple Conan remote
if: env.CONAN_URL != ''
shell: bash
run: |
if conan remote list | grep -q "ripple"; then
conan remote remove ripple
echo "Removed conan remote ripple"
fi
conan remote add --index 0 ripple "${CONAN_URL}"
echo "Added conan remote ripple at ${CONAN_URL}"
- name: build dependencies - name: build dependencies
uses: ./.github/actions/dependencies uses: ./.github/actions/dependencies
env:
CONAN_URL: http://18.143.149.228:8081/artifactory/api/conan/conan-non-prod
CONAN_LOGIN_USERNAME_RIPPLE: ${{ secrets.CONAN_USERNAME }}
CONAN_PASSWORD_RIPPLE: ${{ secrets.CONAN_TOKEN }}
with: with:
configuration: ${{ matrix.configuration }} configuration: ${{ matrix.configuration }}
- name: build - name: build
@@ -89,9 +117,11 @@ jobs:
generator: ${{ matrix.generator }} generator: ${{ matrix.generator }}
configuration: ${{ matrix.configuration }} configuration: ${{ matrix.configuration }}
cmake-args: "-Dassert=TRUE -Dwerr=TRUE ${{ matrix.cmake-args }}" cmake-args: "-Dassert=TRUE -Dwerr=TRUE ${{ matrix.cmake-args }}"
# TODO: Temporary disabled tests - name: test
# - name: test run: |
# run: | n=$(nproc)
# n=$(nproc) echo "Using $n test jobs"
# echo "Using $n test jobs"
# ${build_dir}/rippled --unittest --unittest-jobs $n cd ${build_dir}
./rippled --unittest --unittest-jobs $n
ctest -j $n --output-on-failure

View File

@@ -16,6 +16,19 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }} group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true cancel-in-progress: true
# This part of Conan configuration is specific to this workflow only; we do not want
# to pollute conan/profiles directory with settings which might not work for others
env:
CONAN_URL: http://18.143.149.228:8081/artifactory/api/conan/dev
CONAN_LOGIN_USERNAME_RIPPLE: ${{ secrets.CONAN_USERNAME }}
CONAN_PASSWORD_RIPPLE: ${{ secrets.CONAN_TOKEN }}
CONAN_GLOBAL_CONF: |
core.download:parallel={{ os.cpu_count() }}
core.upload:parallel={{ os.cpu_count() }}
tools.build:jobs={{ (os.cpu_count() * 4/5) | int }}
tools.build:verbosity=verbose
tools.compilation:verbosity=verbose
# This workflow has multiple job matrixes. # This workflow has multiple job matrixes.
# They can be considered phases because most of the matrices ("test", # They can be considered phases because most of the matrices ("test",
# "coverage", "conan", ) depend on the first ("dependencies"). # "coverage", "conan", ) depend on the first ("dependencies").
@@ -54,59 +67,45 @@ jobs:
- Release - Release
include: include:
- compiler: gcc - compiler: gcc
profile: compiler_version: 12
version: 11 distro: ubuntu
cc: /usr/bin/gcc codename: jammy
cxx: /usr/bin/g++
- compiler: clang - compiler: clang
profile: compiler_version: 16
version: 14 distro: debian
cc: /usr/bin/clang-14 codename: bookworm
cxx: /usr/bin/clang++-14
runs-on: [self-hosted, heavy] runs-on: [self-hosted, heavy]
container: ghcr.io/xrplf/rippled-build-ubuntu:aaf5e3e container: ghcr.io/xrplf/ci/${{ matrix.distro }}-${{ matrix.codename }}:${{ matrix.compiler }}-${{ matrix.compiler_version }}
env: env:
build_dir: .build build_dir: .build
steps: steps:
- name: upgrade conan
run: |
pip install --upgrade "conan<2"
- name: checkout - name: checkout
uses: actions/checkout@v4 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: check environment - name: check environment
run: | run: |
echo ${PATH} | tr ':' '\n' echo ${PATH} | tr ':' '\n'
lsb_release -a || true lsb_release -a || true
${{ matrix.profile.cc }} --version ${{ matrix.compiler }}-${{ matrix.compiler_version }} --version
conan --version conan --version
cmake --version cmake --version
env | sort env | sort
- name: configure Conan - name: configure Conan
run: | run: |
conan profile new default --detect echo "${CONAN_GLOBAL_CONF}" >> ${CONAN_HOME}/global.conf
conan profile update settings.compiler.cppstd=20 default conan profile show
conan profile update settings.compiler=${{ matrix.compiler }} default
conan profile update settings.compiler.version=${{ matrix.profile.version }} default
conan profile update settings.compiler.libcxx=libstdc++11 default
conan profile update env.CC=${{ matrix.profile.cc }} default
conan profile update env.CXX=${{ matrix.profile.cxx }} default
conan profile update conf.tools.build:compiler_executables='{"c": "${{ matrix.profile.cc }}", "cpp": "${{ matrix.profile.cxx }}"}' default
- name: archive profile - name: archive profile
# Create this archive before dependencies are added to the local cache. # Create this archive before dependencies are added to the local cache.
run: tar -czf conan.tar -C ~/.conan . run: tar -czf conan.tar.gz -C ${CONAN_HOME} .
- name: build dependencies - name: build dependencies
uses: ./.github/actions/dependencies uses: ./.github/actions/dependencies
env:
CONAN_URL: http://18.143.149.228:8081/artifactory/api/conan/conan-non-prod
CONAN_LOGIN_USERNAME_RIPPLE: ${{ secrets.CONAN_USERNAME }}
CONAN_PASSWORD_RIPPLE: ${{ secrets.CONAN_TOKEN }}
with: with:
configuration: ${{ matrix.configuration }} configuration: ${{ matrix.configuration }}
- name: upload archive - name: upload archive
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with: with:
name: ${{ matrix.platform }}-${{ matrix.compiler }}-${{ matrix.configuration }} name: ${{ matrix.platform }}-${{ matrix.compiler }}-${{ matrix.configuration }}
path: conan.tar path: conan.tar.gz
if-no-files-found: error if-no-files-found: error
test: test:
@@ -121,26 +120,32 @@ jobs:
configuration: configuration:
- Debug - Debug
- Release - Release
include:
- compiler: gcc
compiler_version: 12
distro: ubuntu
codename: jammy
- compiler: clang
compiler_version: 16
distro: debian
codename: bookworm
cmake-args: cmake-args:
- -
- "-Dunity=ON" - "-Dunity=ON"
needs: dependencies needs: dependencies
runs-on: [self-hosted, heavy] runs-on: [self-hosted, heavy]
container: ghcr.io/xrplf/rippled-build-ubuntu:aaf5e3e container: ghcr.io/xrplf/ci/${{ matrix.distro }}-${{ matrix.codename }}:${{ matrix.compiler }}-${{ matrix.compiler_version }}
env: env:
build_dir: .build build_dir: .build
steps: steps:
- name: upgrade conan
run: |
pip install --upgrade "conan<2"
- name: download cache - name: download cache
uses: actions/download-artifact@v4 uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
with: with:
name: ${{ matrix.platform }}-${{ matrix.compiler }}-${{ matrix.configuration }} name: ${{ matrix.platform }}-${{ matrix.compiler }}-${{ matrix.configuration }}
- name: extract cache - name: extract cache
run: | run: |
mkdir -p ~/.conan mkdir -p ${CONAN_HOME}
tar -xzf conan.tar -C ~/.conan tar -xzf conan.tar.gz -C ${CONAN_HOME}
- name: check environment - name: check environment
run: | run: |
env | sort env | sort
@@ -148,11 +153,9 @@ jobs:
conan --version conan --version
cmake --version cmake --version
- name: checkout - name: checkout
uses: actions/checkout@v4 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: dependencies - name: dependencies
uses: ./.github/actions/dependencies uses: ./.github/actions/dependencies
env:
CONAN_URL: http://18.143.149.228:8081/artifactory/api/conan/conan-non-prod
with: with:
configuration: ${{ matrix.configuration }} configuration: ${{ matrix.configuration }}
- name: build - name: build
@@ -163,7 +166,9 @@ jobs:
cmake-args: "-Dassert=TRUE -Dwerr=TRUE ${{ matrix.cmake-args }}" cmake-args: "-Dassert=TRUE -Dwerr=TRUE ${{ matrix.cmake-args }}"
- name: test - name: test
run: | run: |
${build_dir}/rippled --unittest --unittest-jobs $(nproc) cd ${build_dir}
./rippled --unittest --unittest-jobs $(nproc)
ctest -j $(nproc) --output-on-failure
reference-fee-test: reference-fee-test:
strategy: strategy:
@@ -180,21 +185,18 @@ jobs:
- "-DUNIT_TEST_REFERENCE_FEE=1000" - "-DUNIT_TEST_REFERENCE_FEE=1000"
needs: dependencies needs: dependencies
runs-on: [self-hosted, heavy] runs-on: [self-hosted, heavy]
container: ghcr.io/xrplf/rippled-build-ubuntu:aaf5e3e container: ghcr.io/xrplf/ci/ubuntu-jammy:gcc-12
env: env:
build_dir: .build build_dir: .build
steps: steps:
- name: upgrade conan
run: |
pip install --upgrade "conan<2"
- name: download cache - name: download cache
uses: actions/download-artifact@v4 uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
with: with:
name: ${{ matrix.platform }}-${{ matrix.compiler }}-${{ matrix.configuration }} name: ${{ matrix.platform }}-${{ matrix.compiler }}-${{ matrix.configuration }}
- name: extract cache - name: extract cache
run: | run: |
mkdir -p ~/.conan mkdir -p ${CONAN_HOME}
tar -xzf conan.tar -C ~/.conan tar -xzf conan.tar.gz -C ${CONAN_HOME}
- name: check environment - name: check environment
run: | run: |
env | sort env | sort
@@ -202,11 +204,9 @@ jobs:
conan --version conan --version
cmake --version cmake --version
- name: checkout - name: checkout
uses: actions/checkout@v4 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: dependencies - name: dependencies
uses: ./.github/actions/dependencies uses: ./.github/actions/dependencies
env:
CONAN_URL: http://18.143.149.228:8081/artifactory/api/conan/conan-non-prod
with: with:
configuration: ${{ matrix.configuration }} configuration: ${{ matrix.configuration }}
- name: build - name: build
@@ -217,8 +217,9 @@ jobs:
cmake-args: "-Dassert=TRUE -Dwerr=TRUE ${{ matrix.cmake-args }}" cmake-args: "-Dassert=TRUE -Dwerr=TRUE ${{ matrix.cmake-args }}"
- name: test - name: test
run: | run: |
${build_dir}/rippled --unittest --unittest-jobs $(nproc) cd ${build_dir}
./rippled --unittest --unittest-jobs $(nproc)
ctest -j $(nproc) --output-on-failure
coverage: coverage:
strategy: strategy:
fail-fast: false fail-fast: false
@@ -231,23 +232,18 @@ jobs:
- Debug - Debug
needs: dependencies needs: dependencies
runs-on: [self-hosted, heavy] runs-on: [self-hosted, heavy]
container: ghcr.io/xrplf/rippled-build-ubuntu:aaf5e3e container: ghcr.io/xrplf/ci/ubuntu-jammy:gcc-12
env: env:
build_dir: .build build_dir: .build
steps: steps:
- name: upgrade conan
run: |
pip install --upgrade "conan<2"
- name: download cache - name: download cache
uses: actions/download-artifact@v4 uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
with: with:
name: ${{ matrix.platform }}-${{ matrix.compiler }}-${{ matrix.configuration }} name: ${{ matrix.platform }}-${{ matrix.compiler }}-${{ matrix.configuration }}
- name: extract cache - name: extract cache
run: | run: |
mkdir -p ~/.conan mkdir -p ${CONAN_HOME}
tar -xzf conan.tar -C ~/.conan tar -xzf conan.tar.gz -C ${CONAN_HOME}
- name: install gcovr
run: pip install "gcovr>=7,<8"
- name: check environment - name: check environment
run: | run: |
echo ${PATH} | tr ':' '\n' echo ${PATH} | tr ':' '\n'
@@ -255,13 +251,11 @@ jobs:
cmake --version cmake --version
gcovr --version gcovr --version
env | sort env | sort
ls ~/.conan ls ${CONAN_HOME}
- name: checkout - name: checkout
uses: actions/checkout@v4 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: dependencies - name: dependencies
uses: ./.github/actions/dependencies uses: ./.github/actions/dependencies
env:
CONAN_URL: http://18.143.149.228:8081/artifactory/api/conan/conan-non-prod
with: with:
configuration: ${{ matrix.configuration }} configuration: ${{ matrix.configuration }}
- name: build - name: build
@@ -283,7 +277,7 @@ jobs:
run: | run: |
mv "${build_dir}/coverage.xml" ./ mv "${build_dir}/coverage.xml" ./
- name: archive coverage report - name: archive coverage report
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with: with:
name: coverage.xml name: coverage.xml
path: coverage.xml path: coverage.xml
@@ -302,25 +296,28 @@ jobs:
attempt_limit: 5 attempt_limit: 5
attempt_delay: 210000 # in milliseconds attempt_delay: 210000 # in milliseconds
conan: conan:
needs: dependencies needs: dependencies
runs-on: [self-hosted, heavy] runs-on: [self-hosted, heavy]
container: ghcr.io/xrplf/rippled-build-ubuntu:aaf5e3e container:
image: ghcr.io/xrplf/ci/ubuntu-jammy:gcc-12
env: env:
build_dir: .build build_dir: .build
platform: linux
compiler: gcc
compiler_version: 12
configuration: Release configuration: Release
steps: steps:
- name: upgrade conan
run: |
pip install --upgrade "conan<2"
- name: download cache - name: download cache
uses: actions/download-artifact@v4 uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
with: with:
name: linux-gcc-${{ env.configuration }} name: ${{ env.platform }}-${{ env.compiler }}-${{ env.configuration }}
- name: extract cache - name: extract cache
run: | run: |
mkdir -p ~/.conan mkdir -p ${CONAN_HOME}
tar -xzf conan.tar -C ~/.conan tar -xzf conan.tar.gz -C ${CONAN_HOME}
- name: check environment - name: check environment
run: | run: |
env | sort env | sort
@@ -328,27 +325,22 @@ jobs:
conan --version conan --version
cmake --version cmake --version
- name: checkout - name: checkout
uses: actions/checkout@v4 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: dependencies - name: dependencies
uses: ./.github/actions/dependencies uses: ./.github/actions/dependencies
env:
CONAN_URL: http://18.143.149.228:8081/artifactory/api/conan/conan-non-prod
with: with:
configuration: ${{ env.configuration }} configuration: ${{ env.configuration }}
- name: export - name: export
run: | run: |
version=$(conan inspect --raw version .) conan export . --version head
reference="xrpl/${version}@local/test"
conan remove -f ${reference} || true
conan export . local/test
echo "reference=${reference}" >> "${GITHUB_ENV}"
- name: build - name: build
run: | run: |
cd tests/conan cd tests/conan
mkdir ${build_dir} mkdir ${build_dir} && cd ${build_dir}
cd ${build_dir} conan install .. \
conan install .. --output-folder . \ --settings:all build_type=${configuration} \
--require-override ${reference} --build missing --output-folder . \
--build missing
cmake .. \ cmake .. \
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=./build/${configuration}/generators/conan_toolchain.cmake \ -DCMAKE_TOOLCHAIN_FILE:FILEPATH=./build/${configuration}/generators/conan_toolchain.cmake \
-DCMAKE_BUILD_TYPE=${configuration} -DCMAKE_BUILD_TYPE=${configuration}
@@ -363,60 +355,30 @@ jobs:
if: ${{ github.event_name == 'push' || github.event.pull_request.draft != true || contains(github.event.pull_request.labels.*.name, 'DraftRunCI') }} if: ${{ github.event_name == 'push' || github.event.pull_request.draft != true || contains(github.event.pull_request.labels.*.name, 'DraftRunCI') }}
env: env:
CLANG_RELEASE: 16 CLANG_RELEASE: 16
strategy:
fail-fast: false
runs-on: [self-hosted, heavy] runs-on: [self-hosted, heavy]
container: debian:bookworm container: ghcr.io/xrplf/ci/debian-bookworm:clang-16
steps:
- name: install prerequisites
env:
DEBIAN_FRONTEND: noninteractive
run: |
apt-get update
apt-get install --yes --no-install-recommends \
clang-${CLANG_RELEASE} clang++-${CLANG_RELEASE} \
python3-pip python-is-python3 make cmake git wget
apt-get clean
update-alternatives --install \
/usr/bin/clang clang /usr/bin/clang-${CLANG_RELEASE} 100 \
--slave /usr/bin/clang++ clang++ /usr/bin/clang++-${CLANG_RELEASE}
update-alternatives --auto clang
pip install --no-cache --break-system-packages "conan<2"
steps:
- name: checkout - name: checkout
uses: actions/checkout@v4 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: prepare environment - name: prepare environment
run: | run: |
mkdir ${GITHUB_WORKSPACE}/.build mkdir ${GITHUB_WORKSPACE}/.build
echo "SOURCE_DIR=$GITHUB_WORKSPACE" >> $GITHUB_ENV echo "SOURCE_DIR=$GITHUB_WORKSPACE" >> $GITHUB_ENV
echo "BUILD_DIR=$GITHUB_WORKSPACE/.build" >> $GITHUB_ENV echo "BUILD_DIR=$GITHUB_WORKSPACE/.build" >> $GITHUB_ENV
echo "CC=/usr/bin/clang" >> $GITHUB_ENV
echo "CXX=/usr/bin/clang++" >> $GITHUB_ENV
- name: configure Conan - name: configure Conan
run: | run: |
conan profile new --detect default echo "${CONAN_GLOBAL_CONF}" >> ${CONAN_HOME}/global.conf
conan profile update settings.compiler=clang default conan profile show
conan profile update settings.compiler.version=${CLANG_RELEASE} default
conan profile update settings.compiler.libcxx=libstdc++11 default
conan profile update settings.compiler.cppstd=20 default
conan profile update options.rocksdb=False default
conan profile update \
'conf.tools.build:compiler_executables={"c": "/usr/bin/clang", "cpp": "/usr/bin/clang++"}' default
conan profile update 'env.CXXFLAGS="-DBOOST_ASIO_DISABLE_CONCEPTS"' default
conan profile update 'conf.tools.build:cxxflags+=["-DBOOST_ASIO_DISABLE_CONCEPTS"]' default
conan export external/snappy snappy/1.1.10@
conan export external/soci soci/4.0.3@
- name: build dependencies - name: build dependencies
run: | run: |
cd ${BUILD_DIR} cd ${BUILD_DIR}
conan install ${SOURCE_DIR} \ conan install ${SOURCE_DIR} \
--output-folder ${BUILD_DIR} \ --output-folder ${BUILD_DIR} \
--install-folder ${BUILD_DIR} \
--build missing \ --build missing \
--settings build_type=Debug --settings:all build_type=Debug
- name: build with instrumentation - name: build with instrumentation
run: | run: |
@@ -441,3 +403,4 @@ jobs:
run: | run: |
cd ${BUILD_DIR} cd ${BUILD_DIR}
./rippled -u --unittest-jobs $(( $(nproc)/4 )) ./rippled -u --unittest-jobs $(( $(nproc)/4 ))
ctest -j $(nproc) --output-on-failure

View File

@@ -18,6 +18,18 @@ on:
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.ref }} group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true cancel-in-progress: true
# This part of Conan configuration is specific to this workflow only; we do not want
# to pollute conan/profiles directory with settings which might not work for others
env:
CONAN_URL: http://18.143.149.228:8081/artifactory/api/conan/dev
CONAN_LOGIN_USERNAME_RIPPLE: ${{ secrets.CONAN_USERNAME }}
CONAN_PASSWORD_RIPPLE: ${{ secrets.CONAN_TOKEN }}
CONAN_GLOBAL_CONF: |
core.download:parallel={{os.cpu_count()}}
core.upload:parallel={{os.cpu_count()}}
tools.build:jobs=24
tools.build:verbosity=verbose
tools.compilation:verbosity=verbose
jobs: jobs:
@@ -42,11 +54,11 @@ jobs:
build_dir: .build build_dir: .build
steps: steps:
- name: checkout - name: checkout
uses: actions/checkout@v4 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: choose Python - name: choose Python
uses: actions/setup-python@v5 uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
with: with:
python-version: 3.9 python-version: 3.13
- name: learn Python cache directory - name: learn Python cache directory
id: pip-cache id: pip-cache
shell: bash shell: bash
@@ -54,12 +66,12 @@ jobs:
python -m pip install --upgrade pip python -m pip install --upgrade pip
echo "dir=$(pip cache dir)" | tee ${GITHUB_OUTPUT} echo "dir=$(pip cache dir)" | tee ${GITHUB_OUTPUT}
- name: restore Python cache directory - name: restore Python cache directory
uses: actions/cache@v4 uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684
with: with:
path: ${{ steps.pip-cache.outputs.dir }} path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-${{ hashFiles('.github/workflows/windows.yml') }} key: ${{ runner.os }}-${{ hashFiles('.github/workflows/windows.yml') }}
- name: install Conan - name: install Conan
run: pip install wheel 'conan<2' run: pip install wheel conan
- name: check environment - name: check environment
run: | run: |
dir env: dir env:
@@ -70,17 +82,29 @@ jobs:
- name: configure Conan - name: configure Conan
shell: bash shell: bash
run: | run: |
conan profile new default --detect echo "${CONAN_GLOBAL_CONF}" > global.conf
conan profile update settings.compiler.cppstd=20 default mv conan/profiles/libxrpl conan/profiles/default
conan profile update \ conan config install conan/profiles/ -tf $(conan config home)/profiles/
settings.compiler.runtime=MT${{ matrix.configuration.runtime }} \ conan profile show
default - name: export custom recipes
shell: bash
run: |
conan export --version 1.1.10 external/snappy
conan export --version 9.7.3 external/rocksdb
conan export --version 4.0.3 external/soci
conan export --version 2.0.8 external/nudb
- name: add Ripple Conan remote
if: env.CONAN_URL != ''
shell: bash
run: |
if conan remote list | grep -q "ripple"; then
conan remote remove ripple
echo "Removed conan remote ripple"
fi
conan remote add --index 0 ripple "${CONAN_URL}"
echo "Added conan remote ripple at ${CONAN_URL}"
- name: build dependencies - name: build dependencies
uses: ./.github/actions/dependencies uses: ./.github/actions/dependencies
env:
CONAN_URL: http://18.143.149.228:8081/artifactory/api/conan/conan-non-prod
CONAN_LOGIN_USERNAME_RIPPLE: ${{ secrets.CONAN_USERNAME }}
CONAN_PASSWORD_RIPPLE: ${{ secrets.CONAN_TOKEN }}
with: with:
configuration: ${{ matrix.configuration.type }} configuration: ${{ matrix.configuration.type }}
- name: build - name: build
@@ -95,5 +119,6 @@ jobs:
shell: bash shell: bash
if: ${{ matrix.configuration.tests }} if: ${{ matrix.configuration.tests }}
run: | run: |
${build_dir}/${{ matrix.configuration.type }}/rippled --unittest \ cd ${build_dir}/${{ matrix.configuration.type }}
--unittest-jobs $(nproc) ./rippled --unittest --unittest-jobs $(nproc)
ctest -j $(nproc) --output-on-failure

View File

@@ -1,6 +1,6 @@
# .pre-commit-config.yaml # .pre-commit-config.yaml
repos: repos:
- repo: https://github.com/pre-commit/mirrors-clang-format - repo: https://github.com/pre-commit/mirrors-clang-format
rev: v18.1.3 rev: v18.1.8
hooks: hooks:
- id: clang-format - id: clang-format

View File

@@ -288,7 +288,7 @@ It fixes some source files to add missing `#include`s.
Single-config generators: Single-config generators:
``` ```
cmake --build . cmake --build . -j $(nproc)
``` ```
Multi-config generators: Multi-config generators:

View File

@@ -132,6 +132,7 @@ test.shamap > xrpl.protocol
test.toplevel > test.csf test.toplevel > test.csf
test.toplevel > xrpl.json test.toplevel > xrpl.json
test.unit_test > xrpl.basics test.unit_test > xrpl.basics
tests.libxrpl > xrpl.basics
xrpl.json > xrpl.basics xrpl.json > xrpl.basics
xrpl.protocol > xrpl.basics xrpl.protocol > xrpl.basics
xrpl.protocol > xrpl.json xrpl.protocol > xrpl.json

View File

@@ -90,6 +90,11 @@ set_target_properties(OpenSSL::SSL PROPERTIES
INTERFACE_COMPILE_DEFINITIONS OPENSSL_NO_SSL2 INTERFACE_COMPILE_DEFINITIONS OPENSSL_NO_SSL2
) )
set(SECP256K1_INSTALL TRUE) set(SECP256K1_INSTALL TRUE)
set(SECP256K1_BUILD_BENCHMARK FALSE)
set(SECP256K1_BUILD_TESTS FALSE)
set(SECP256K1_BUILD_EXHAUSTIVE_TESTS FALSE)
set(SECP256K1_BUILD_CTIME_TESTS FALSE)
set(SECP256K1_BUILD_EXAMPLES FALSE)
add_subdirectory(external/secp256k1) add_subdirectory(external/secp256k1)
add_library(secp256k1::secp256k1 ALIAS secp256k1) add_library(secp256k1::secp256k1 ALIAS secp256k1)
add_subdirectory(external/ed25519-donna) add_subdirectory(external/ed25519-donna)
@@ -144,3 +149,8 @@ set(PROJECT_EXPORT_SET RippleExports)
include(RippledCore) include(RippledCore)
include(RippledInstall) include(RippledInstall)
include(RippledValidatorKeys) include(RippledValidatorKeys)
if(tests)
include(CTest)
add_subdirectory(src/tests/libxrpl)
endif()

View File

@@ -1,3 +1,5 @@
[![codecov](https://codecov.io/gh/XRPLF/rippled/graph/badge.svg?token=WyFr5ajq3O)](https://codecov.io/gh/XRPLF/rippled)
# The XRP Ledger # The XRP Ledger
The [XRP Ledger](https://xrpl.org/) 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. The [XRP Ledger](https://xrpl.org/) 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.

File diff suppressed because it is too large Load Diff

View File

@@ -83,7 +83,7 @@ To report a qualifying bug, please send a detailed report to:
|Long Key ID | `0xCD49A0AFC57929BE` | |Long Key ID | `0xCD49A0AFC57929BE` |
|Fingerprint | `24E6 3B02 37E0 FA9C 5E96 8974 CD49 A0AF C579 29BE` | |Fingerprint | `24E6 3B02 37E0 FA9C 5E96 8974 CD49 A0AF C579 29BE` |
The full PGP key for this address, which is also available on several key servers (e.g. on [keys.gnupg.net](https://keys.gnupg.net)), is: The full PGP key for this address, which is also available on several key servers (e.g. on [keyserver.ubuntu.com](https://keyserver.ubuntu.com)), is:
``` ```
-----BEGIN PGP PUBLIC KEY BLOCK----- -----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBFUwGHYBEAC0wpGpBPkd8W1UdQjg9+cEFzeIEJRaoZoeuJD8mofwI5Ejnjdt mQINBFUwGHYBEAC0wpGpBPkd8W1UdQjg9+cEFzeIEJRaoZoeuJD8mofwI5Ejnjdt

View File

@@ -26,7 +26,7 @@
# #
# Examples: # Examples:
# https://vl.ripple.com # https://vl.ripple.com
# https://vl.xrplf.org # https://unl.xrplf.org
# http://127.0.0.1:8000 # http://127.0.0.1:8000
# file:///etc/opt/ripple/vl.txt # file:///etc/opt/ripple/vl.txt
# #

View File

@@ -98,6 +98,9 @@
# 2024-04-03, Bronek Kozicki # 2024-04-03, Bronek Kozicki
# - add support for output formats: jacoco, clover, lcov # - add support for output formats: jacoco, clover, lcov
# #
# 2025-05-12, Jingchen Wu
# - add -fprofile-update=atomic to ensure atomic profile generation
#
# USAGE: # USAGE:
# #
# 1. Copy this file into your cmake modules path. # 1. Copy this file into your cmake modules path.
@@ -200,15 +203,27 @@ set(COVERAGE_COMPILER_FLAGS "-g --coverage"
CACHE INTERNAL "") CACHE INTERNAL "")
if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)") if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)")
include(CheckCXXCompilerFlag) include(CheckCXXCompilerFlag)
include(CheckCCompilerFlag)
check_cxx_compiler_flag(-fprofile-abs-path HAVE_cxx_fprofile_abs_path) check_cxx_compiler_flag(-fprofile-abs-path HAVE_cxx_fprofile_abs_path)
if(HAVE_cxx_fprofile_abs_path) if(HAVE_cxx_fprofile_abs_path)
set(COVERAGE_CXX_COMPILER_FLAGS "${COVERAGE_COMPILER_FLAGS} -fprofile-abs-path") set(COVERAGE_CXX_COMPILER_FLAGS "${COVERAGE_COMPILER_FLAGS} -fprofile-abs-path")
endif() endif()
include(CheckCCompilerFlag)
check_c_compiler_flag(-fprofile-abs-path HAVE_c_fprofile_abs_path) check_c_compiler_flag(-fprofile-abs-path HAVE_c_fprofile_abs_path)
if(HAVE_c_fprofile_abs_path) if(HAVE_c_fprofile_abs_path)
set(COVERAGE_C_COMPILER_FLAGS "${COVERAGE_COMPILER_FLAGS} -fprofile-abs-path") set(COVERAGE_C_COMPILER_FLAGS "${COVERAGE_COMPILER_FLAGS} -fprofile-abs-path")
endif() endif()
check_cxx_compiler_flag(-fprofile-update HAVE_cxx_fprofile_update)
if(HAVE_cxx_fprofile_update)
set(COVERAGE_CXX_COMPILER_FLAGS "${COVERAGE_COMPILER_FLAGS} -fprofile-update=atomic")
endif()
check_c_compiler_flag(-fprofile-update HAVE_c_fprofile_update)
if(HAVE_c_fprofile_update)
set(COVERAGE_C_COMPILER_FLAGS "${COVERAGE_COMPILER_FLAGS} -fprofile-update=atomic")
endif()
endif() endif()
set(CMAKE_Fortran_FLAGS_COVERAGE set(CMAKE_Fortran_FLAGS_COVERAGE

View File

@@ -53,9 +53,9 @@ set(download_script "${CMAKE_BINARY_DIR}/docs/download-cppreference.cmake")
file(WRITE file(WRITE
"${download_script}" "${download_script}"
"file(DOWNLOAD \ "file(DOWNLOAD \
http://upload.cppreference.com/mwiki/images/b/b2/html_book_20190607.zip \ https://github.com/PeterFeicht/cppreference-doc/releases/download/v20250209/html-book-20250209.zip \
${CMAKE_BINARY_DIR}/docs/cppreference.zip \ ${CMAKE_BINARY_DIR}/docs/cppreference.zip \
EXPECTED_HASH MD5=82b3a612d7d35a83e3cb1195a63689ab \ EXPECTED_HASH MD5=bda585f72fbca4b817b29a3d5746567b \
)\n \ )\n \
execute_process( \ execute_process( \
COMMAND \"${CMAKE_COMMAND}\" -E tar -xf cppreference.zip \ COMMAND \"${CMAKE_COMMAND}\" -E tar -xf cppreference.zip \

View File

@@ -2,16 +2,6 @@
convenience variables and sanity checks convenience variables and sanity checks
#]===================================================================] #]===================================================================]
include(ProcessorCount)
if (NOT ep_procs)
ProcessorCount(ep_procs)
if (ep_procs GREATER 1)
# never use more than half of cores for EP builds
math (EXPR ep_procs "${ep_procs} / 2")
message (STATUS "Using ${ep_procs} cores for ExternalProject builds.")
endif ()
endif ()
get_property(is_multiconfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) get_property(is_multiconfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
set (CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE) set (CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)

View File

@@ -18,7 +18,7 @@ if(tests)
endif() endif()
endif() endif()
option(unity "Creates a build using UNITY support in cmake. This is the default" ON) option(unity "Creates a build using UNITY support in cmake." OFF)
if(unity) if(unity)
if(NOT is_ci) if(NOT is_ci)
set(CMAKE_UNITY_BUILD_BATCH_SIZE 15 CACHE STRING "") set(CMAKE_UNITY_BUILD_BATCH_SIZE 15 CACHE STRING "")

View File

@@ -2,7 +2,6 @@ find_package(Boost 1.82 REQUIRED
COMPONENTS COMPONENTS
chrono chrono
container container
context
coroutine coroutine
date_time date_time
filesystem filesystem
@@ -24,7 +23,7 @@ endif()
target_link_libraries(ripple_boost target_link_libraries(ripple_boost
INTERFACE INTERFACE
Boost::boost Boost::headers
Boost::chrono Boost::chrono
Boost::container Boost::container
Boost::coroutine Boost::coroutine

41
cmake/xrpl_add_test.cmake Normal file
View File

@@ -0,0 +1,41 @@
include(isolate_headers)
function(xrpl_add_test name)
set(target ${PROJECT_NAME}.test.${name})
file(GLOB_RECURSE sources CONFIGURE_DEPENDS
"${CMAKE_CURRENT_SOURCE_DIR}/${name}/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/${name}.cpp"
)
add_executable(${target} EXCLUDE_FROM_ALL ${ARGN} ${sources})
isolate_headers(
${target}
"${CMAKE_SOURCE_DIR}"
"${CMAKE_SOURCE_DIR}/tests/${name}"
PRIVATE
)
# Make sure the test isn't optimized away in unity builds
set_target_properties(${target} PROPERTIES
UNITY_BUILD_MODE GROUP
UNITY_BUILD_BATCH_SIZE 0) # Adjust as needed
add_test(NAME ${target} COMMAND ${target})
set_tests_properties(
${target} PROPERTIES
FIXTURES_REQUIRED ${target}_fixture
)
add_test(
NAME ${target}.build
COMMAND
${CMAKE_COMMAND}
--build ${CMAKE_BINARY_DIR}
--config $<CONFIG>
--target ${target}
)
set_tests_properties(${target}.build PROPERTIES
FIXTURES_SETUP ${target}_fixture
)
endfunction()

23
conan/profiles/libxrpl Normal file
View File

@@ -0,0 +1,23 @@
{% set os = detect_api.detect_os() %}
{% set arch = detect_api.detect_arch() %}
{% set compiler, version, compiler_exe = detect_api.detect_default_compiler() %}
{% set compiler_version = version %}
{% if os == "Linux" %}
{% set compiler_version = detect_api.default_compiler_version(compiler, version) %}
{% endif %}
{% if os == "Linux" %}
include(default)
{% endif %}
[settings]
os={{ os }}
arch={{ arch }}
compiler={{compiler}}
compiler.version={{ compiler_version }}
compiler.cppstd=20
{% if os == "Windows" %}
compiler.runtime=static
{% else %}
compiler.libcxx={{detect_api.detect_libcxx(compiler, version, compiler_exe)}}
{% endif %}

View File

@@ -1,4 +1,4 @@
from conan import ConanFile from conan import ConanFile, __version__ as conan_version
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
import re import re
@@ -24,16 +24,18 @@ class Xrpl(ConanFile):
} }
requires = [ requires = [
'date/3.0.3',
'grpc/1.50.1', 'grpc/1.50.1',
'libarchive/3.7.6', 'libarchive/3.7.6',
'nudb/2.0.8', 'nudb/2.0.8',
'openssl/1.1.1v', 'openssl/1.1.1v',
'soci/4.0.3', 'soci/4.0.3',
'xxhash/0.8.2',
'zlib/1.3.1', 'zlib/1.3.1',
] ]
test_requires = [
'doctest/2.4.11',
]
tool_requires = [ tool_requires = [
'protobuf/3.21.9', 'protobuf/3.21.9',
] ]
@@ -87,9 +89,10 @@ class Xrpl(ConanFile):
} }
def set_version(self): def set_version(self):
if self.version is None:
path = f'{self.recipe_folder}/src/libxrpl/protocol/BuildInfo.cpp' path = f'{self.recipe_folder}/src/libxrpl/protocol/BuildInfo.cpp'
regex = r'versionString\s?=\s?\"(.*)\"' regex = r'versionString\s?=\s?\"(.*)\"'
with open(path, 'r') as file: with open(path, encoding='utf-8') as file:
matches = (re.search(regex, line) for line in file) matches = (re.search(regex, line) for line in file)
match = next(m for m in matches if m) match = next(m for m in matches if m)
self.version = match.group(1) self.version = match.group(1)
@@ -99,7 +102,10 @@ class Xrpl(ConanFile):
self.options['boost'].visibility = 'global' self.options['boost'].visibility = 'global'
def requirements(self): def requirements(self):
self.requires('boost/1.83.0', force=True) # Conan 2 requires transitive headers to be specified
transitive_headers_opt = {'transitive_headers': True} if conan_version.split('.')[0] == '2' else {}
self.requires('boost/1.83.0', force=True, **transitive_headers_opt)
self.requires('date/3.0.3', **transitive_headers_opt)
self.requires('lz4/1.10.0', force=True) self.requires('lz4/1.10.0', force=True)
self.requires('protobuf/3.21.9', force=True) self.requires('protobuf/3.21.9', force=True)
self.requires('sqlite3/3.47.0', force=True) self.requires('sqlite3/3.47.0', force=True)
@@ -107,6 +113,7 @@ class Xrpl(ConanFile):
self.requires('jemalloc/5.3.0') self.requires('jemalloc/5.3.0')
if self.options.rocksdb: if self.options.rocksdb:
self.requires('rocksdb/9.7.3') self.requires('rocksdb/9.7.3')
self.requires('xxhash/0.8.2', **transitive_headers_opt)
exports_sources = ( exports_sources = (
'CMakeLists.txt', 'CMakeLists.txt',
@@ -136,6 +143,8 @@ class Xrpl(ConanFile):
tc.variables['static'] = self.options.static tc.variables['static'] = self.options.static
tc.variables['unity'] = self.options.unity tc.variables['unity'] = self.options.unity
tc.variables['xrpld'] = self.options.xrpld tc.variables['xrpld'] = self.options.xrpld
if self.settings.compiler == 'clang' and self.settings.compiler.version == 16:
tc.extra_cxxflags = ["-DBOOST_ASIO_DISABLE_CONCEPTS"]
tc.generate() tc.generate()
def build(self): def build(self):
@@ -161,7 +170,17 @@ class Xrpl(ConanFile):
# `include/`, not `include/ripple/proto/`. # `include/`, not `include/ripple/proto/`.
libxrpl.includedirs = ['include', 'include/ripple/proto'] libxrpl.includedirs = ['include', 'include/ripple/proto']
libxrpl.requires = [ libxrpl.requires = [
'boost::boost', 'boost::headers',
'boost::chrono',
'boost::container',
'boost::coroutine',
'boost::date_time',
'boost::filesystem',
'boost::json',
'boost::program_options',
'boost::regex',
'boost::system',
'boost::thread',
'date::date', 'date::date',
'grpc::grpc++', 'grpc::grpc++',
'libarchive::libarchive', 'libarchive::libarchive',

View File

@@ -23,7 +23,7 @@ direction.
``` ```
apt update apt update
apt install --yes curl git libssl-dev python3.10-dev python3-pip make g++-11 libprotobuf-dev protobuf-compiler apt install --yes curl git libssl-dev pipx python3.10-dev python3-pip make g++-11 libprotobuf-dev protobuf-compiler
curl --location --remote-name \ curl --location --remote-name \
"https://github.com/Kitware/CMake/releases/download/v3.25.1/cmake-3.25.1.tar.gz" "https://github.com/Kitware/CMake/releases/download/v3.25.1/cmake-3.25.1.tar.gz"
@@ -35,7 +35,8 @@ make --jobs $(nproc)
make install make install
cd .. cd ..
pip3 install 'conan<2' pipx install 'conan<2'
pipx ensurepath
``` ```
[1]: https://github.com/thejohnfreeman/rippled-docker/blob/master/ubuntu-22.04/install.sh [1]: https://github.com/thejohnfreeman/rippled-docker/blob/master/ubuntu-22.04/install.sh

View File

@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.25) cmake_minimum_required(VERSION 3.18)
# Note, version set explicitly by rippled project # Note, version set explicitly by rippled project
project(antithesis-sdk-cpp VERSION 0.4.4 LANGUAGES CXX) project(antithesis-sdk-cpp VERSION 0.4.4 LANGUAGES CXX)

View File

@@ -367,7 +367,7 @@ get(Section const& section,
} }
inline std::string inline std::string
get(Section const& section, std::string const& name, const char* defaultValue) get(Section const& section, std::string const& name, char const* defaultValue)
{ {
try try
{ {

View File

@@ -25,6 +25,7 @@
#include <cstdint> #include <cstdint>
#include <cstring> #include <cstring>
#include <memory>
namespace ripple { namespace ripple {

View File

@@ -55,7 +55,7 @@ lz4Compress(void const* in, std::size_t inSize, BufferFactory&& bf)
auto compressed = bf(outCapacity); auto compressed = bf(outCapacity);
auto compressedSize = LZ4_compress_default( auto compressedSize = LZ4_compress_default(
reinterpret_cast<const char*>(in), reinterpret_cast<char const*>(in),
reinterpret_cast<char*>(compressed), reinterpret_cast<char*>(compressed),
inSize, inSize,
outCapacity); outCapacity);
@@ -89,7 +89,7 @@ lz4Decompress(
Throw<std::runtime_error>("lz4Decompress: integer overflow (output)"); Throw<std::runtime_error>("lz4Decompress: integer overflow (output)");
if (LZ4_decompress_safe( if (LZ4_decompress_safe(
reinterpret_cast<const char*>(in), reinterpret_cast<char const*>(in),
reinterpret_cast<char*>(decompressed), reinterpret_cast<char*>(decompressed),
inSize, inSize,
decompressedSize) != decompressedSize) decompressedSize) != decompressedSize)

View File

@@ -22,8 +22,18 @@
#include <xrpl/basics/contract.h> #include <xrpl/basics/contract.h>
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated"
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif
#include <boost/outcome.hpp> #include <boost/outcome.hpp>
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
#include <stdexcept> #include <stdexcept>
namespace ripple { namespace ripple {
@@ -93,7 +103,7 @@ public:
{ {
} }
constexpr const E& constexpr E const&
value() const& value() const&
{ {
return val_; return val_;
@@ -111,7 +121,7 @@ public:
return std::move(val_); return std::move(val_);
} }
constexpr const E&& constexpr E const&&
value() const&& value() const&&
{ {
return std::move(val_); return std::move(val_);

View File

@@ -29,7 +29,6 @@
#include <array> #include <array>
#include <cstdint> #include <cstdint>
#include <optional> #include <optional>
#include <sstream>
#include <string> #include <string>
namespace ripple { namespace ripple {

View File

@@ -115,7 +115,7 @@ public:
sweep(); sweep();
bool bool
del(const key_type& key, bool valid); del(key_type const& key, bool valid);
public: public:
/** Replace aliased objects with originals. /** Replace aliased objects with originals.
@@ -134,20 +134,20 @@ public:
template <class R> template <class R>
bool bool
canonicalize( canonicalize(
const key_type& key, key_type const& key,
SharedPointerType& data, SharedPointerType& data,
R&& replaceCallback); R&& replaceCallback);
bool bool
canonicalize_replace_cache( canonicalize_replace_cache(
const key_type& key, key_type const& key,
SharedPointerType const& data); SharedPointerType const& data);
bool bool
canonicalize_replace_client(const key_type& key, SharedPointerType& data); canonicalize_replace_client(key_type const& key, SharedPointerType& data);
SharedPointerType SharedPointerType
fetch(const key_type& key); fetch(key_type const& key);
/** Insert the element into the container. /** Insert the element into the container.
If the key already exists, nothing happens. If the key already exists, nothing happens.
@@ -168,7 +168,7 @@ public:
// simply return an iterator. // simply return an iterator.
// //
bool bool
retrieve(const key_type& key, T& data); retrieve(key_type const& key, T& data);
mutex_type& mutex_type&
peekMutex(); peekMutex();
@@ -322,10 +322,10 @@ private:
std::string m_name; std::string m_name;
// Desired number of cache entries (0 = ignore) // Desired number of cache entries (0 = ignore)
const int m_target_size; int const m_target_size;
// Desired maximum cache age // Desired maximum cache age
const clock_type::duration m_target_age; clock_type::duration const m_target_age;
// Number of items cached // Number of items cached
int m_cache_count; int m_cache_count;

View File

@@ -365,7 +365,7 @@ TaggedCache<
SharedPointerType, SharedPointerType,
Hash, Hash,
KeyEqual, KeyEqual,
Mutex>::del(const key_type& key, bool valid) Mutex>::del(key_type const& key, bool valid)
{ {
// Remove from cache, if !valid, remove from map too. Returns true if // Remove from cache, if !valid, remove from map too. Returns true if
// removed from cache // removed from cache
@@ -414,7 +414,7 @@ TaggedCache<
KeyEqual, KeyEqual,
Mutex>:: Mutex>::
canonicalize( canonicalize(
const key_type& key, key_type const& key,
SharedPointerType& data, SharedPointerType& data,
R&& replaceCallback) R&& replaceCallback)
{ {
@@ -509,7 +509,7 @@ TaggedCache<
KeyEqual, KeyEqual,
Mutex>:: Mutex>::
canonicalize_replace_cache( canonicalize_replace_cache(
const key_type& key, key_type const& key,
SharedPointerType const& data) SharedPointerType const& data)
{ {
return canonicalize( return canonicalize(
@@ -535,7 +535,7 @@ TaggedCache<
Hash, Hash,
KeyEqual, KeyEqual,
Mutex>:: Mutex>::
canonicalize_replace_client(const key_type& key, SharedPointerType& data) canonicalize_replace_client(key_type const& key, SharedPointerType& data)
{ {
return canonicalize(key, data, []() { return false; }); return canonicalize(key, data, []() { return false; });
} }
@@ -558,7 +558,7 @@ TaggedCache<
SharedPointerType, SharedPointerType,
Hash, Hash,
KeyEqual, KeyEqual,
Mutex>::fetch(const key_type& key) Mutex>::fetch(key_type const& key)
{ {
std::lock_guard<mutex_type> l(m_mutex); std::lock_guard<mutex_type> l(m_mutex);
auto ret = initialFetch(key, l); auto ret = initialFetch(key, l);
@@ -656,7 +656,7 @@ TaggedCache<
SharedPointerType, SharedPointerType,
Hash, Hash,
KeyEqual, KeyEqual,
Mutex>::retrieve(const key_type& key, T& data) Mutex>::retrieve(key_type const& key, T& data)
{ {
// retrieve the value of the stored data // retrieve the value of the stored data
auto entry = fetch(key); auto entry = fetch(key);

View File

@@ -20,7 +20,6 @@
#ifndef RIPPLE_ALGORITHM_H_INCLUDED #ifndef RIPPLE_ALGORITHM_H_INCLUDED
#define RIPPLE_ALGORITHM_H_INCLUDED #define RIPPLE_ALGORITHM_H_INCLUDED
#include <iterator>
#include <utility> #include <utility>
namespace ripple { namespace ripple {

View File

@@ -374,7 +374,7 @@ public:
} }
base_uint& base_uint&
operator^=(const base_uint& b) operator^=(base_uint const& b)
{ {
for (int i = 0; i < WIDTH; i++) for (int i = 0; i < WIDTH; i++)
data_[i] ^= b.data_[i]; data_[i] ^= b.data_[i];
@@ -383,7 +383,7 @@ public:
} }
base_uint& base_uint&
operator&=(const base_uint& b) operator&=(base_uint const& b)
{ {
for (int i = 0; i < WIDTH; i++) for (int i = 0; i < WIDTH; i++)
data_[i] &= b.data_[i]; data_[i] &= b.data_[i];
@@ -392,7 +392,7 @@ public:
} }
base_uint& base_uint&
operator|=(const base_uint& b) operator|=(base_uint const& b)
{ {
for (int i = 0; i < WIDTH; i++) for (int i = 0; i < WIDTH; i++)
data_[i] |= b.data_[i]; data_[i] |= b.data_[i];
@@ -415,11 +415,11 @@ public:
return *this; return *this;
} }
const base_uint base_uint const
operator++(int) operator++(int)
{ {
// postfix operator // postfix operator
const base_uint ret = *this; base_uint const ret = *this;
++(*this); ++(*this);
return ret; return ret;
@@ -441,11 +441,11 @@ public:
return *this; return *this;
} }
const base_uint base_uint const
operator--(int) operator--(int)
{ {
// postfix operator // postfix operator
const base_uint ret = *this; base_uint const ret = *this;
--(*this); --(*this);
return ret; return ret;
@@ -466,7 +466,7 @@ public:
} }
base_uint& base_uint&
operator+=(const base_uint& b) operator+=(base_uint const& b)
{ {
std::uint64_t carry = 0; std::uint64_t carry = 0;
@@ -511,7 +511,7 @@ public:
} }
[[nodiscard]] constexpr bool [[nodiscard]] constexpr bool
parseHex(const char* str) parseHex(char const* str)
{ {
return parseHex(std::string_view{str}); return parseHex(std::string_view{str});
} }

View File

@@ -43,7 +43,7 @@ struct less
using result_type = bool; using result_type = bool;
constexpr bool constexpr bool
operator()(const T& left, const T& right) const operator()(T const& left, T const& right) const
{ {
return std::less<T>()(left, right); return std::less<T>()(left, right);
} }
@@ -55,7 +55,7 @@ struct equal_to
using result_type = bool; using result_type = bool;
constexpr bool constexpr bool
operator()(const T& left, const T& right) const operator()(T const& left, T const& right) const
{ {
return std::equal_to<T>()(left, right); return std::equal_to<T>()(left, right);
} }

View File

@@ -24,12 +24,8 @@
#include <xrpl/beast/hash/xxhasher.h> #include <xrpl/beast/hash/xxhasher.h>
#include <cstdint> #include <cstdint>
#include <functional>
#include <mutex> #include <mutex>
#include <random> #include <random>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility> #include <utility>
namespace ripple { namespace ripple {

View File

@@ -23,7 +23,6 @@
#include <cstdint> #include <cstdint>
#include <limits> #include <limits>
#include <optional> #include <optional>
#include <utility>
namespace ripple { namespace ripple {
auto constexpr muldiv_max = std::numeric_limits<std::uint64_t>::max(); auto constexpr muldiv_max = std::numeric_limits<std::uint64_t>::max();

View File

@@ -52,7 +52,7 @@ template <
typename Value, typename Value,
typename Hash, typename Hash,
typename Pred = std::equal_to<Key>, typename Pred = std::equal_to<Key>,
typename Alloc = std::allocator<std::pair<const Key, Value>>> typename Alloc = std::allocator<std::pair<Key const, Value>>>
class partitioned_unordered_map class partitioned_unordered_map
{ {
std::size_t partitions_; std::size_t partitions_;

View File

@@ -24,10 +24,8 @@
#include <boost/operators.hpp> #include <boost/operators.hpp>
#include <functional>
#include <iostream> #include <iostream>
#include <type_traits> #include <type_traits>
#include <utility>
namespace ripple { namespace ripple {
@@ -76,13 +74,13 @@ public:
} }
bool bool
operator<(const tagged_integer& rhs) const noexcept operator<(tagged_integer const& rhs) const noexcept
{ {
return m_value < rhs.m_value; return m_value < rhs.m_value;
} }
bool bool
operator==(const tagged_integer& rhs) const noexcept operator==(tagged_integer const& rhs) const noexcept
{ {
return m_value == rhs.m_value; return m_value == rhs.m_value;
} }
@@ -144,14 +142,14 @@ public:
} }
tagged_integer& tagged_integer&
operator<<=(const tagged_integer& rhs) noexcept operator<<=(tagged_integer const& rhs) noexcept
{ {
m_value <<= rhs.m_value; m_value <<= rhs.m_value;
return *this; return *this;
} }
tagged_integer& tagged_integer&
operator>>=(const tagged_integer& rhs) noexcept operator>>=(tagged_integer const& rhs) noexcept
{ {
m_value >>= rhs.m_value; m_value >>= rhs.m_value;
return *this; return *this;

View File

@@ -20,9 +20,6 @@
#ifndef BEAST_CHRONO_ABSTRACT_CLOCK_H_INCLUDED #ifndef BEAST_CHRONO_ABSTRACT_CLOCK_H_INCLUDED
#define BEAST_CHRONO_ABSTRACT_CLOCK_H_INCLUDED #define BEAST_CHRONO_ABSTRACT_CLOCK_H_INCLUDED
#include <chrono>
#include <string>
namespace beast { namespace beast {
/** Abstract interface to a clock. /** Abstract interface to a clock.

View File

@@ -23,6 +23,8 @@
#include <xrpl/beast/clock/abstract_clock.h> #include <xrpl/beast/clock/abstract_clock.h>
#include <xrpl/beast/utility/instrumentation.h> #include <xrpl/beast/utility/instrumentation.h>
#include <chrono>
namespace beast { namespace beast {
/** Manual clock implementation. /** Manual clock implementation.

View File

@@ -22,6 +22,7 @@
#include <xrpl/beast/container/aged_container.h> #include <xrpl/beast/container/aged_container.h>
#include <chrono>
#include <type_traits> #include <type_traits>
namespace beast { namespace beast {

View File

@@ -20,8 +20,6 @@
#ifndef BEAST_CONTAINER_DETAIL_AGED_ASSOCIATIVE_CONTAINER_H_INCLUDED #ifndef BEAST_CONTAINER_DETAIL_AGED_ASSOCIATIVE_CONTAINER_H_INCLUDED
#define BEAST_CONTAINER_DETAIL_AGED_ASSOCIATIVE_CONTAINER_H_INCLUDED #define BEAST_CONTAINER_DETAIL_AGED_ASSOCIATIVE_CONTAINER_H_INCLUDED
#include <type_traits>
namespace beast { namespace beast {
namespace detail { namespace detail {

View File

@@ -33,7 +33,6 @@
#include <algorithm> #include <algorithm>
#include <functional> #include <functional>
#include <initializer_list> #include <initializer_list>
#include <iterator>
#include <memory> #include <memory>
#include <type_traits> #include <type_traits>
#include <utility> #include <utility>

View File

@@ -29,11 +29,9 @@
#include <charconv> #include <charconv>
#include <cstdlib> #include <cstdlib>
#include <iterator> #include <iterator>
#include <limits>
#include <string> #include <string>
#include <type_traits> #include <type_traits>
#include <typeinfo> #include <typeinfo>
#include <utility>
namespace beast { namespace beast {

View File

@@ -24,14 +24,36 @@
#include <boost/container/flat_set.hpp> #include <boost/container/flat_set.hpp>
#include <boost/endian/conversion.hpp> #include <boost/endian/conversion.hpp>
/*
Workaround for overzealous clang warning, which trips on libstdc++ headers
In file included from
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_algo.h:61:
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_tempbuf.h:263:8:
error: 'get_temporary_buffer<std::pair<ripple::Quality, const
std::vector<std::unique_ptr<ripple::Step>> *>>' is deprecated
[-Werror,-Wdeprecated-declarations] 263 |
std::get_temporary_buffer<value_type>(_M_original_len));
^
*/
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated"
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif
#include <functional>
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
#include <array> #include <array>
#include <chrono> #include <chrono>
#include <cstdint>
#include <cstring> #include <cstring>
#include <functional>
#include <map>
#include <memory> #include <memory>
#include <set>
#include <string> #include <string>
#include <system_error> #include <system_error>
#include <tuple> #include <tuple>

View File

@@ -30,7 +30,7 @@ namespace beast {
template <class Hasher = xxhasher> template <class Hasher = xxhasher>
struct uhash struct uhash
{ {
explicit uhash() = default; uhash() = default;
using result_type = typename Hasher::result_type; using result_type = typename Hasher::result_type;

View File

@@ -29,11 +29,7 @@
#include <boost/asio/ip/address.hpp> #include <boost/asio/ip/address.hpp>
#include <boost/functional/hash.hpp> #include <boost/functional/hash.hpp>
#include <cstdint>
#include <ios>
#include <sstream>
#include <string> #include <string>
#include <typeinfo>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------

View File

@@ -24,12 +24,6 @@
#include <boost/asio/ip/address_v4.hpp> #include <boost/asio/ip/address_v4.hpp>
#include <cstdint>
#include <functional>
#include <ios>
#include <string>
#include <utility>
namespace beast { namespace beast {
namespace IP { namespace IP {

View File

@@ -24,12 +24,6 @@
#include <boost/asio/ip/address_v6.hpp> #include <boost/asio/ip/address_v6.hpp>
#include <cstdint>
#include <functional>
#include <ios>
#include <string>
#include <utility>
namespace beast { namespace beast {
namespace IP { namespace IP {

View File

@@ -25,7 +25,6 @@
#include <xrpl/beast/net/IPAddress.h> #include <xrpl/beast/net/IPAddress.h>
#include <cstdint> #include <cstdint>
#include <ios>
#include <optional> #include <optional>
#include <string> #include <string>
@@ -215,7 +214,7 @@ namespace std {
template <> template <>
struct hash<::beast::IP::Endpoint> struct hash<::beast::IP::Endpoint>
{ {
explicit hash() = default; hash() = default;
std::size_t std::size_t
operator()(::beast::IP::Endpoint const& endpoint) const operator()(::beast::IP::Endpoint const& endpoint) const
@@ -230,7 +229,7 @@ namespace boost {
template <> template <>
struct hash<::beast::IP::Endpoint> struct hash<::beast::IP::Endpoint>
{ {
explicit hash() = default; hash() = default;
std::size_t std::size_t
operator()(::beast::IP::Endpoint const& endpoint) const operator()(::beast::IP::Endpoint const& endpoint) const

View File

@@ -28,10 +28,8 @@
#include <algorithm> #include <algorithm>
#include <cctype> #include <cctype>
#include <cstdint>
#include <iterator> #include <iterator>
#include <string> #include <string>
#include <utility>
#include <vector> #include <vector>
namespace beast { namespace beast {

View File

@@ -13,7 +13,6 @@
#include <boost/optional.hpp> #include <boost/optional.hpp>
#include <condition_variable> #include <condition_variable>
#include <functional>
#include <mutex> #include <mutex>
#include <thread> #include <thread>
#include <vector> #include <vector>

View File

@@ -16,7 +16,6 @@
#include <algorithm> #include <algorithm>
#include <chrono> #include <chrono>
#include <functional>
#include <iomanip> #include <iomanip>
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>

View File

@@ -13,7 +13,6 @@
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <mutex> #include <mutex>
#include <ostream>
#include <string> #include <string>
namespace beast { namespace beast {

View File

@@ -48,8 +48,10 @@ rngfill(void* buffer, std::size_t bytes, Generator& g)
#ifdef __GNUC__ #ifdef __GNUC__
// gcc 11.1 (falsely) warns about an array-bounds overflow in release mode. // gcc 11.1 (falsely) warns about an array-bounds overflow in release mode.
// gcc 12.1 (also falsely) warns about an string overflow in release mode.
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds" #pragma GCC diagnostic ignored "-Warray-bounds"
#pragma GCC diagnostic ignored "-Wstringop-overflow"
#endif #endif
if (bytes > 0) if (bytes > 0)

View File

@@ -37,9 +37,9 @@ class temp_dir
public: public:
#if !GENERATING_DOCS #if !GENERATING_DOCS
temp_dir(const temp_dir&) = delete; temp_dir(temp_dir const&) = delete;
temp_dir& temp_dir&
operator=(const temp_dir&) = delete; operator=(temp_dir const&) = delete;
#endif #endif
/// Construct a temporary directory. /// Construct a temporary directory.

View File

@@ -39,7 +39,7 @@ class Reader
{ {
public: public:
using Char = char; using Char = char;
using Location = const Char*; using Location = Char const*;
/** \brief Constructs a Reader allowing all features /** \brief Constructs a Reader allowing all features
* for parsing. * for parsing.
@@ -64,7 +64,7 @@ public:
* error occurred. * error occurred.
*/ */
bool bool
parse(const char* beginDoc, const char* endDoc, Value& root); parse(char const* beginDoc, char const* endDoc, Value& root);
/// \brief Parse from input stream. /// \brief Parse from input stream.
/// \see Json::operator>>(std::istream&, Json::Value&). /// \see Json::operator>>(std::istream&, Json::Value&).
@@ -133,7 +133,7 @@ private:
using Errors = std::deque<ErrorInfo>; using Errors = std::deque<ErrorInfo>;
bool bool
expectToken(TokenType type, Token& token, const char* message); expectToken(TokenType type, Token& token, char const* message);
bool bool
readToken(Token& token); readToken(Token& token);
void void

View File

@@ -20,6 +20,7 @@
#ifndef RIPPLE_JSON_JSON_VALUE_H_INCLUDED #ifndef RIPPLE_JSON_JSON_VALUE_H_INCLUDED
#define RIPPLE_JSON_JSON_VALUE_H_INCLUDED #define RIPPLE_JSON_JSON_VALUE_H_INCLUDED
#include <xrpl/basics/Number.h>
#include <xrpl/json/json_forwards.h> #include <xrpl/json/json_forwards.h>
#include <cstring> #include <cstring>
@@ -61,24 +62,24 @@ enum ValueType {
class StaticString class StaticString
{ {
public: public:
constexpr explicit StaticString(const char* czstring) : str_(czstring) constexpr explicit StaticString(char const* czstring) : str_(czstring)
{ {
} }
constexpr constexpr
operator const char*() const operator char const*() const
{ {
return str_; return str_;
} }
constexpr const char* constexpr char const*
c_str() const c_str() const
{ {
return str_; return str_;
} }
private: private:
const char* str_; char const* str_;
}; };
inline bool inline bool
@@ -156,10 +157,10 @@ public:
using Int = Json::Int; using Int = Json::Int;
using ArrayIndex = UInt; using ArrayIndex = UInt;
static const Value null; static Value const null;
static const Int minInt; static Int const minInt;
static const Int maxInt; static Int const maxInt;
static const UInt maxUInt; static UInt const maxUInt;
private: private:
class CZString class CZString
@@ -171,24 +172,24 @@ private:
duplicateOnCopy duplicateOnCopy
}; };
CZString(int index); CZString(int index);
CZString(const char* cstr, DuplicationPolicy allocate); CZString(char const* cstr, DuplicationPolicy allocate);
CZString(const CZString& other); CZString(CZString const& other);
~CZString(); ~CZString();
CZString& CZString&
operator=(const CZString& other) = delete; operator=(CZString const& other) = delete;
bool bool
operator<(const CZString& other) const; operator<(CZString const& other) const;
bool bool
operator==(const CZString& other) const; operator==(CZString const& other) const;
int int
index() const; index() const;
const char* char const*
c_str() const; c_str() const;
bool bool
isStaticString() const; isStaticString() const;
private: private:
const char* cstr_; char const* cstr_;
int index_; int index_;
}; };
@@ -215,7 +216,8 @@ public:
Value(Int value); Value(Int value);
Value(UInt value); Value(UInt value);
Value(double value); Value(double value);
Value(const char* value); Value(char const* value);
Value(ripple::Number const& value);
/** \brief Constructs a value from a static string. /** \brief Constructs a value from a static string.
* Like other value string constructor but do not duplicate the string for * Like other value string constructor but do not duplicate the string for
@@ -227,10 +229,10 @@ public:
* Json::Value aValue( StaticString("some text") ); * Json::Value aValue( StaticString("some text") );
* \endcode * \endcode
*/ */
Value(const StaticString& value); Value(StaticString const& value);
Value(std::string const& value); Value(std::string const& value);
Value(bool value); Value(bool value);
Value(const Value& other); Value(Value const& other);
~Value(); ~Value();
Value& Value&
@@ -247,7 +249,7 @@ public:
ValueType ValueType
type() const; type() const;
const char* char const*
asCString() const; asCString() const;
/** Returns the unquoted string value. */ /** Returns the unquoted string value. */
std::string std::string
@@ -317,12 +319,12 @@ public:
/// Access an array element (zero based index ) /// Access an array element (zero based index )
/// (You may need to say 'value[0u]' to get your compiler to distinguish /// (You may need to say 'value[0u]' to get your compiler to distinguish
/// this from the operator[] which takes a string.) /// this from the operator[] which takes a string.)
const Value& Value const&
operator[](UInt index) const; operator[](UInt index) const;
/// If the array contains at least index+1 elements, returns the element /// If the array contains at least index+1 elements, returns the element
/// value, otherwise returns defaultValue. /// value, otherwise returns defaultValue.
Value Value
get(UInt index, const Value& defaultValue) const; get(UInt index, Value const& defaultValue) const;
/// Return true if index < size(). /// Return true if index < size().
bool bool
isValidIndex(UInt index) const; isValidIndex(UInt index) const;
@@ -330,25 +332,25 @@ public:
/// ///
/// Equivalent to jsonvalue[jsonvalue.size()] = value; /// Equivalent to jsonvalue[jsonvalue.size()] = value;
Value& Value&
append(const Value& value); append(Value const& value);
Value& Value&
append(Value&& value); append(Value&& value);
/// Access an object value by name, create a null member if it does not /// Access an object value by name, create a null member if it does not
/// exist. /// exist.
Value& Value&
operator[](const char* key); operator[](char const* key);
/// Access an object value by name, returns null if there is no member with /// Access an object value by name, returns null if there is no member with
/// that name. /// that name.
const Value& Value const&
operator[](const char* key) const; operator[](char const* key) const;
/// Access an object value by name, create a null member if it does not /// Access an object value by name, create a null member if it does not
/// exist. /// exist.
Value& Value&
operator[](std::string const& key); operator[](std::string const& key);
/// Access an object value by name, returns null if there is no member with /// Access an object value by name, returns null if there is no member with
/// that name. /// that name.
const Value& Value const&
operator[](std::string const& key) const; operator[](std::string const& key) const;
/** \brief Access an object value by name, create a null member if it does /** \brief Access an object value by name, create a null member if it does
not exist. not exist.
@@ -364,14 +366,16 @@ public:
* \endcode * \endcode
*/ */
Value& Value&
operator[](const StaticString& key); operator[](StaticString const& key);
Value const&
operator[](StaticString const& key) const;
/// Return the member named key if it exist, defaultValue otherwise. /// Return the member named key if it exist, defaultValue otherwise.
Value Value
get(const char* key, const Value& defaultValue) const; get(char const* key, Value const& defaultValue) const;
/// Return the member named key if it exist, defaultValue otherwise. /// Return the member named key if it exist, defaultValue otherwise.
Value Value
get(std::string const& key, const Value& defaultValue) const; get(std::string const& key, Value const& defaultValue) const;
/// \brief Remove and return the named member. /// \brief Remove and return the named member.
/// ///
@@ -380,14 +384,14 @@ public:
/// \pre type() is objectValue or nullValue /// \pre type() is objectValue or nullValue
/// \post type() is unchanged /// \post type() is unchanged
Value Value
removeMember(const char* key); removeMember(char const* key);
/// Same as removeMember(const char*) /// Same as removeMember(const char*)
Value Value
removeMember(std::string const& key); removeMember(std::string const& key);
/// Return true if the object has a member named key. /// Return true if the object has a member named key.
bool bool
isMember(const char* key) const; isMember(char const* key) const;
/// Return true if the object has a member named key. /// Return true if the object has a member named key.
bool bool
isMember(std::string const& key) const; isMember(std::string const& key) const;
@@ -414,13 +418,13 @@ public:
end(); end();
friend bool friend bool
operator==(const Value&, const Value&); operator==(Value const&, Value const&);
friend bool friend bool
operator<(const Value&, const Value&); operator<(Value const&, Value const&);
private: private:
Value& Value&
resolveReference(const char* key, bool isStatic); resolveReference(char const* key, bool isStatic);
private: private:
union ValueHolder union ValueHolder
@@ -436,32 +440,38 @@ private:
int allocated_ : 1; // Notes: if declared as bool, bitfield is useless. int allocated_ : 1; // Notes: if declared as bool, bitfield is useless.
}; };
inline Value
to_json(ripple::Number const& number)
{
return to_string(number);
}
bool bool
operator==(const Value&, const Value&); operator==(Value const&, Value const&);
inline bool inline bool
operator!=(const Value& x, const Value& y) operator!=(Value const& x, Value const& y)
{ {
return !(x == y); return !(x == y);
} }
bool bool
operator<(const Value&, const Value&); operator<(Value const&, Value const&);
inline bool inline bool
operator<=(const Value& x, const Value& y) operator<=(Value const& x, Value const& y)
{ {
return !(y < x); return !(y < x);
} }
inline bool inline bool
operator>(const Value& x, const Value& y) operator>(Value const& x, Value const& y)
{ {
return y < x; return y < x;
} }
inline bool inline bool
operator>=(const Value& x, const Value& y) operator>=(Value const& x, Value const& y)
{ {
return !(x < y); return !(x < y);
} }
@@ -482,11 +492,11 @@ public:
virtual ~ValueAllocator() = default; virtual ~ValueAllocator() = default;
virtual char* virtual char*
makeMemberName(const char* memberName) = 0; makeMemberName(char const* memberName) = 0;
virtual void virtual void
releaseMemberName(char* memberName) = 0; releaseMemberName(char* memberName) = 0;
virtual char* virtual char*
duplicateStringValue(const char* value, unsigned int length = unknown) = 0; duplicateStringValue(char const* value, unsigned int length = unknown) = 0;
virtual void virtual void
releaseStringValue(char* value) = 0; releaseStringValue(char* value) = 0;
}; };
@@ -503,16 +513,16 @@ public:
ValueIteratorBase(); ValueIteratorBase();
explicit ValueIteratorBase(const Value::ObjectValues::iterator& current); explicit ValueIteratorBase(Value::ObjectValues::iterator const& current);
bool bool
operator==(const SelfType& other) const operator==(SelfType const& other) const
{ {
return isEqual(other); return isEqual(other);
} }
bool bool
operator!=(const SelfType& other) const operator!=(SelfType const& other) const
{ {
return !isEqual(other); return !isEqual(other);
} }
@@ -528,7 +538,7 @@ public:
/// Return the member name of the referenced Value. "" if it is not an /// Return the member name of the referenced Value. "" if it is not an
/// objectValue. /// objectValue.
const char* char const*
memberName() const; memberName() const;
protected: protected:
@@ -542,13 +552,13 @@ protected:
decrement(); decrement();
difference_type difference_type
computeDistance(const SelfType& other) const; computeDistance(SelfType const& other) const;
bool bool
isEqual(const SelfType& other) const; isEqual(SelfType const& other) const;
void void
copy(const SelfType& other); copy(SelfType const& other);
private: private:
Value::ObjectValues::iterator current_; Value::ObjectValues::iterator current_;
@@ -566,8 +576,8 @@ class ValueConstIterator : public ValueIteratorBase
public: public:
using size_t = unsigned int; using size_t = unsigned int;
using difference_type = int; using difference_type = int;
using reference = const Value&; using reference = Value const&;
using pointer = const Value*; using pointer = Value const*;
using SelfType = ValueConstIterator; using SelfType = ValueConstIterator;
ValueConstIterator() = default; ValueConstIterator() = default;
@@ -575,11 +585,11 @@ public:
private: private:
/*! \internal Use by Value to create an iterator. /*! \internal Use by Value to create an iterator.
*/ */
explicit ValueConstIterator(const Value::ObjectValues::iterator& current); explicit ValueConstIterator(Value::ObjectValues::iterator const& current);
public: public:
SelfType& SelfType&
operator=(const ValueIteratorBase& other); operator=(ValueIteratorBase const& other);
SelfType SelfType
operator++(int) operator++(int)
@@ -632,17 +642,17 @@ public:
using SelfType = ValueIterator; using SelfType = ValueIterator;
ValueIterator() = default; ValueIterator() = default;
ValueIterator(const ValueConstIterator& other); ValueIterator(ValueConstIterator const& other);
ValueIterator(const ValueIterator& other); ValueIterator(ValueIterator const& other);
private: private:
/*! \internal Use by Value to create an iterator. /*! \internal Use by Value to create an iterator.
*/ */
explicit ValueIterator(const Value::ObjectValues::iterator& current); explicit ValueIterator(Value::ObjectValues::iterator const& current);
public: public:
SelfType& SelfType&
operator=(const SelfType& other); operator=(SelfType const& other);
SelfType SelfType
operator++(int) operator++(int)

View File

@@ -39,7 +39,7 @@ public:
{ {
} }
virtual std::string virtual std::string
write(const Value& root) = 0; write(Value const& root) = 0;
}; };
/** \brief Outputs a Value in <a HREF="http://www.json.org">JSON</a> format /** \brief Outputs a Value in <a HREF="http://www.json.org">JSON</a> format
@@ -60,11 +60,11 @@ public:
public: // overridden from Writer public: // overridden from Writer
std::string std::string
write(const Value& root) override; write(Value const& root) override;
private: private:
void void
writeValue(const Value& value); writeValue(Value const& value);
std::string document_; std::string document_;
}; };
@@ -101,15 +101,15 @@ public: // overridden from Writer
* JSON document that represents the root value. * JSON document that represents the root value.
*/ */
std::string std::string
write(const Value& root) override; write(Value const& root) override;
private: private:
void void
writeValue(const Value& value); writeValue(Value const& value);
void void
writeArrayValue(const Value& value); writeArrayValue(Value const& value);
bool bool
isMultineArray(const Value& value); isMultineArray(Value const& value);
void void
pushValue(std::string const& value); pushValue(std::string const& value);
void void
@@ -168,15 +168,15 @@ public:
* return a value. * return a value.
*/ */
void void
write(std::ostream& out, const Value& root); write(std::ostream& out, Value const& root);
private: private:
void void
writeValue(const Value& value); writeValue(Value const& value);
void void
writeArrayValue(const Value& value); writeArrayValue(Value const& value);
bool bool
isMultineArray(const Value& value); isMultineArray(Value const& value);
void void
pushValue(std::string const& value); pushValue(std::string const& value);
void void
@@ -207,12 +207,12 @@ valueToString(double value);
std::string std::string
valueToString(bool value); valueToString(bool value);
std::string std::string
valueToQuotedString(const char* value); valueToQuotedString(char const* value);
/// \brief Output using the StyledStreamWriter. /// \brief Output using the StyledStreamWriter.
/// \see Json::operator>>() /// \see Json::operator>>()
std::ostream& std::ostream&
operator<<(std::ostream&, const Value& root); operator<<(std::ostream&, Value const& root);
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------

View File

@@ -37,7 +37,7 @@ pretty(Value const&);
/** Output using the StyledStreamWriter. @see Json::operator>>(). */ /** Output using the StyledStreamWriter. @see Json::operator>>(). */
std::ostream& std::ostream&
operator<<(std::ostream&, const Value& root); operator<<(std::ostream&, Value const& root);
} // namespace Json } // namespace Json

View File

@@ -48,14 +48,6 @@ class STObject;
class STAmount; class STAmount;
class Rules; class Rules;
/** Calculate AMM account ID.
*/
AccountID
ammAccountID(
std::uint16_t prefix,
uint256 const& parentHash,
uint256 const& ammID);
/** Calculate Liquidity Provider Token (LPT) Currency. /** Calculate Liquidity Provider Token (LPT) Currency.
*/ */
Currency Currency

View File

@@ -29,7 +29,6 @@
#include <xrpl/protocol/json_get_or_throw.h> #include <xrpl/protocol/json_get_or_throw.h>
#include <cstddef> #include <cstddef>
#include <mutex>
#include <optional> #include <optional>
#include <string> #include <string>
@@ -149,7 +148,7 @@ namespace std {
template <> template <>
struct hash<ripple::AccountID> : ripple::AccountID::hasher struct hash<ripple::AccountID> : ripple::AccountID::hasher
{ {
explicit hash() = default; hash() = default;
}; };
} // namespace std } // namespace std

View File

@@ -20,7 +20,6 @@
#ifndef RIPPLE_PROTOCOL_APIVERSION_H_INCLUDED #ifndef RIPPLE_PROTOCOL_APIVERSION_H_INCLUDED
#define RIPPLE_PROTOCOL_APIVERSION_H_INCLUDED #define RIPPLE_PROTOCOL_APIVERSION_H_INCLUDED
#include <functional>
#include <type_traits> #include <type_traits>
#include <utility> #include <utility>

View File

@@ -20,6 +20,7 @@
#ifndef RIPPLE_PROTOCOL_ASSET_H_INCLUDED #ifndef RIPPLE_PROTOCOL_ASSET_H_INCLUDED
#define RIPPLE_PROTOCOL_ASSET_H_INCLUDED #define RIPPLE_PROTOCOL_ASSET_H_INCLUDED
#include <xrpl/basics/Number.h>
#include <xrpl/basics/base_uint.h> #include <xrpl/basics/base_uint.h>
#include <xrpl/protocol/Issue.h> #include <xrpl/protocol/Issue.h>
#include <xrpl/protocol/MPTIssue.h> #include <xrpl/protocol/MPTIssue.h>
@@ -27,6 +28,7 @@
namespace ripple { namespace ripple {
class Asset; class Asset;
class STAmount;
template <typename TIss> template <typename TIss>
concept ValidIssueType = concept ValidIssueType =
@@ -92,6 +94,9 @@ public:
void void
setJson(Json::Value& jv) const; setJson(Json::Value& jv) const;
STAmount
operator()(Number const&) const;
bool bool
native() const native() const
{ {
@@ -114,6 +119,14 @@ public:
equalTokens(Asset const& lhs, Asset const& rhs); equalTokens(Asset const& lhs, Asset const& rhs);
}; };
inline Json::Value
to_json(Asset const& asset)
{
Json::Value jv;
asset.setJson(jv);
return jv;
}
template <ValidIssueType TIss> template <ValidIssueType TIss>
constexpr bool constexpr bool
Asset::holds() const Asset::holds() const
@@ -219,9 +232,6 @@ validJSONAsset(Json::Value const& jv);
Asset Asset
assetFromJson(Json::Value const& jv); assetFromJson(Json::Value const& jv);
Json::Value
to_json(Asset const& asset);
} // namespace ripple } // namespace ripple
#endif // RIPPLE_PROTOCOL_ASSET_H_INCLUDED #endif // RIPPLE_PROTOCOL_ASSET_H_INCLUDED

View File

@@ -0,0 +1,37 @@
//------------------------------------------------------------------------------
/*
This file is part of rippled: https://github.com/ripple/rippled
Copyright (c) 2024 Ripple Labs Inc.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
#include <xrpl/protocol/HashPrefix.h>
#include <xrpl/protocol/STVector256.h>
#include <xrpl/protocol/Serializer.h>
namespace ripple {
inline void
serializeBatch(
Serializer& msg,
std::uint32_t const& flags,
std::vector<uint256> const& txids)
{
msg.add32(HashPrefix::batch);
msg.add32(flags);
msg.add32(std::uint32_t(txids.size()));
for (auto const& txid : txids)
msg.addBitString(txid);
}
} // namespace ripple

View File

@@ -21,6 +21,7 @@
#define RIPPLE_PROTOCOL_BOOK_H_INCLUDED #define RIPPLE_PROTOCOL_BOOK_H_INCLUDED
#include <xrpl/basics/CountedObject.h> #include <xrpl/basics/CountedObject.h>
#include <xrpl/basics/base_uint.h>
#include <xrpl/protocol/Issue.h> #include <xrpl/protocol/Issue.h>
#include <boost/utility/base_from_member.hpp> #include <boost/utility/base_from_member.hpp>
@@ -36,12 +37,17 @@ class Book final : public CountedObject<Book>
public: public:
Issue in; Issue in;
Issue out; Issue out;
std::optional<uint256> domain;
Book() Book()
{ {
} }
Book(Issue const& in_, Issue const& out_) : in(in_), out(out_) Book(
Issue const& in_,
Issue const& out_,
std::optional<uint256> const& domain_)
: in(in_), out(out_), domain(domain_)
{ {
} }
}; };
@@ -61,6 +67,8 @@ hash_append(Hasher& h, Book const& b)
{ {
using beast::hash_append; using beast::hash_append;
hash_append(h, b.in, b.out); hash_append(h, b.in, b.out);
if (b.domain)
hash_append(h, *(b.domain));
} }
Book Book
@@ -71,7 +79,8 @@ reversed(Book const& book);
[[nodiscard]] inline constexpr bool [[nodiscard]] inline constexpr bool
operator==(Book const& lhs, Book const& rhs) operator==(Book const& lhs, Book const& rhs)
{ {
return (lhs.in == rhs.in) && (lhs.out == rhs.out); return (lhs.in == rhs.in) && (lhs.out == rhs.out) &&
(lhs.domain == rhs.domain);
} }
/** @} */ /** @} */
@@ -82,7 +91,18 @@ operator<=>(Book const& lhs, Book const& rhs)
{ {
if (auto const c{lhs.in <=> rhs.in}; c != 0) if (auto const c{lhs.in <=> rhs.in}; c != 0)
return c; return c;
return lhs.out <=> rhs.out; if (auto const c{lhs.out <=> rhs.out}; c != 0)
return c;
// Manually compare optionals
if (lhs.domain && rhs.domain)
return *lhs.domain <=> *rhs.domain; // Compare values if both exist
if (!lhs.domain && rhs.domain)
return std::weak_ordering::less; // Empty is considered less
if (lhs.domain && !rhs.domain)
return std::weak_ordering::greater; // Non-empty is greater
return std::weak_ordering::equivalent; // Both are empty
} }
/** @} */ /** @} */
@@ -104,7 +124,7 @@ private:
boost::base_from_member<std::hash<ripple::AccountID>, 1>; boost::base_from_member<std::hash<ripple::AccountID>, 1>;
public: public:
explicit hash() = default; hash() = default;
using value_type = std::size_t; using value_type = std::size_t;
using argument_type = ripple::Issue; using argument_type = ripple::Issue;
@@ -126,12 +146,14 @@ template <>
struct hash<ripple::Book> struct hash<ripple::Book>
{ {
private: private:
using hasher = std::hash<ripple::Issue>; using issue_hasher = std::hash<ripple::Issue>;
using uint256_hasher = ripple::uint256::hasher;
hasher m_hasher; issue_hasher m_issue_hasher;
uint256_hasher m_uint256_hasher;
public: public:
explicit hash() = default; hash() = default;
using value_type = std::size_t; using value_type = std::size_t;
using argument_type = ripple::Book; using argument_type = ripple::Book;
@@ -139,8 +161,12 @@ public:
value_type value_type
operator()(argument_type const& value) const operator()(argument_type const& value) const
{ {
value_type result(m_hasher(value.in)); value_type result(m_issue_hasher(value.in));
boost::hash_combine(result, m_hasher(value.out)); boost::hash_combine(result, m_issue_hasher(value.out));
if (value.domain)
boost::hash_combine(result, m_uint256_hasher(*value.domain));
return result; return result;
} }
}; };
@@ -154,7 +180,7 @@ namespace boost {
template <> template <>
struct hash<ripple::Issue> : std::hash<ripple::Issue> struct hash<ripple::Issue> : std::hash<ripple::Issue>
{ {
explicit hash() = default; hash() = default;
using Base = std::hash<ripple::Issue>; using Base = std::hash<ripple::Issue>;
// VFALCO NOTE broken in vs2012 // VFALCO NOTE broken in vs2012
@@ -164,7 +190,7 @@ struct hash<ripple::Issue> : std::hash<ripple::Issue>
template <> template <>
struct hash<ripple::Book> : std::hash<ripple::Book> struct hash<ripple::Book> : std::hash<ripple::Book>
{ {
explicit hash() = default; hash() = default;
using Base = std::hash<ripple::Book>; using Base = std::hash<ripple::Book>;
// VFALCO NOTE broken in vs2012 // VFALCO NOTE broken in vs2012

View File

@@ -120,7 +120,7 @@ enum error_code_i {
rpcSRC_ACT_MALFORMED = 65, rpcSRC_ACT_MALFORMED = 65,
rpcSRC_ACT_MISSING = 66, rpcSRC_ACT_MISSING = 66,
rpcSRC_ACT_NOT_FOUND = 67, rpcSRC_ACT_NOT_FOUND = 67,
// unused 68, rpcDELEGATE_ACT_NOT_FOUND = 68,
rpcSRC_CUR_MALFORMED = 69, rpcSRC_CUR_MALFORMED = 69,
rpcSRC_ISR_MALFORMED = 70, rpcSRC_ISR_MALFORMED = 70,
rpcSTREAM_MALFORMED = 71, rpcSTREAM_MALFORMED = 71,
@@ -154,7 +154,10 @@ enum error_code_i {
// Simulate // Simulate
rpcTX_SIGNED = 96, rpcTX_SIGNED = 96,
rpcLAST = rpcTX_SIGNED // rpcLAST should always equal the last code. // Pathfinding
rpcDOMAIN_MALFORMED = 97,
rpcLAST = rpcDOMAIN_MALFORMED // rpcLAST should always equal the last code.
}; };
/** Codes returned in the `warnings` array of certain RPC commands. /** Codes returned in the `warnings` array of certain RPC commands.

View File

@@ -24,7 +24,6 @@
#include <boost/container/flat_map.hpp> #include <boost/container/flat_map.hpp>
#include <array>
#include <bitset> #include <bitset>
#include <map> #include <map>
#include <optional> #include <optional>
@@ -55,6 +54,18 @@
* `VoteBehavior::DefaultYes`. The communication process is beyond * `VoteBehavior::DefaultYes`. The communication process is beyond
* the scope of these instructions. * the scope of these instructions.
* *
* 5) A feature marked as Obsolete can mean either:
* 1) It is in the ledger (marked as Supported::yes) and it is on its way to
* become Retired
* 2) The feature is not in the ledger (has always been marked as
* Supported::no) and the code to support it has been removed
*
* If we want to discontinue a feature that we've never fully supported and
* the feature has never been enabled, we should remove all the related
* code, and mark the feature as "abandoned". To do this:
*
* 1) Open features.macro, move the feature to the abandoned section and
* change the macro to XRPL_ABANDON
* *
* When a feature has been enabled for several years, the conditional code * When a feature has been enabled for several years, the conditional code
* may be removed, and the feature "retired". To retire a feature: * may be removed, and the feature "retired". To retire a feature:
@@ -88,10 +99,13 @@ namespace detail {
#undef XRPL_FIX #undef XRPL_FIX
#pragma push_macro("XRPL_RETIRE") #pragma push_macro("XRPL_RETIRE")
#undef XRPL_RETIRE #undef XRPL_RETIRE
#pragma push_macro("XRPL_ABANDON")
#undef XRPL_ABANDON
#define XRPL_FEATURE(name, supported, vote) +1 #define XRPL_FEATURE(name, supported, vote) +1
#define XRPL_FIX(name, supported, vote) +1 #define XRPL_FIX(name, supported, vote) +1
#define XRPL_RETIRE(name) +1 #define XRPL_RETIRE(name) +1
#define XRPL_ABANDON(name) +1
// This value SHOULD be equal to the number of amendments registered in // This value SHOULD be equal to the number of amendments registered in
// Feature.cpp. Because it's only used to reserve storage, and determine how // Feature.cpp. Because it's only used to reserve storage, and determine how
@@ -108,6 +122,8 @@ static constexpr std::size_t numFeatures =
#pragma pop_macro("XRPL_FIX") #pragma pop_macro("XRPL_FIX")
#undef XRPL_FEATURE #undef XRPL_FEATURE
#pragma pop_macro("XRPL_FEATURE") #pragma pop_macro("XRPL_FEATURE")
#undef XRPL_ABANDON
#pragma pop_macro("XRPL_ABANDON")
/** Amendments that this server supports and the default voting behavior. /** Amendments that this server supports and the default voting behavior.
Whether they are enabled depends on the Rules defined in the validated Whether they are enabled depends on the Rules defined in the validated
@@ -349,10 +365,13 @@ foreachFeature(FeatureBitset bs, F&& f)
#undef XRPL_FIX #undef XRPL_FIX
#pragma push_macro("XRPL_RETIRE") #pragma push_macro("XRPL_RETIRE")
#undef XRPL_RETIRE #undef XRPL_RETIRE
#pragma push_macro("XRPL_ABANDON")
#undef XRPL_ABANDON
#define XRPL_FEATURE(name, supported, vote) extern uint256 const feature##name; #define XRPL_FEATURE(name, supported, vote) extern uint256 const feature##name;
#define XRPL_FIX(name, supported, vote) extern uint256 const fix##name; #define XRPL_FIX(name, supported, vote) extern uint256 const fix##name;
#define XRPL_RETIRE(name) #define XRPL_RETIRE(name)
#define XRPL_ABANDON(name)
#include <xrpl/protocol/detail/features.macro> #include <xrpl/protocol/detail/features.macro>
@@ -362,6 +381,8 @@ foreachFeature(FeatureBitset bs, F&& f)
#pragma pop_macro("XRPL_FIX") #pragma pop_macro("XRPL_FIX")
#undef XRPL_FEATURE #undef XRPL_FEATURE
#pragma pop_macro("XRPL_FEATURE") #pragma pop_macro("XRPL_FEATURE")
#undef XRPL_ABANDON
#pragma pop_macro("XRPL_ABANDON")
} // namespace ripple } // namespace ripple

View File

@@ -27,14 +27,9 @@
#include <boost/multiprecision/cpp_int.hpp> #include <boost/multiprecision/cpp_int.hpp>
#include <boost/operators.hpp> #include <boost/operators.hpp>
#include <cmath>
#include <ios>
#include <iosfwd> #include <iosfwd>
#include <limits> #include <limits>
#include <optional> #include <optional>
#include <sstream>
#include <string>
#include <utility>
namespace ripple { namespace ripple {
@@ -336,7 +331,7 @@ public:
// Output Fees as just their numeric value. // Output Fees as just their numeric value.
template <class Char, class Traits, class UnitTag, class T> template <class Char, class Traits, class UnitTag, class T>
std::basic_ostream<Char, Traits>& std::basic_ostream<Char, Traits>&
operator<<(std::basic_ostream<Char, Traits>& os, const TaggedFee<UnitTag, T>& q) operator<<(std::basic_ostream<Char, Traits>& os, TaggedFee<UnitTag, T> const& q)
{ {
return os << q.value(); return os << q.value();
} }

View File

@@ -88,6 +88,9 @@ enum class HashPrefix : std::uint32_t {
/** Credentials signature */ /** Credentials signature */
credential = detail::make_hash_prefix('C', 'R', 'D'), credential = detail::make_hash_prefix('C', 'R', 'D'),
/** Batch */
batch = detail::make_hash_prefix('B', 'C', 'H'),
}; };
template <class Hasher> template <class Hasher>

View File

@@ -28,7 +28,6 @@
#include <cstdint> #include <cstdint>
#include <string> #include <string>
#include <utility>
namespace ripple { namespace ripple {
@@ -99,6 +98,12 @@ public:
static IOUAmount static IOUAmount
minPositiveAmount(); minPositiveAmount();
friend std::ostream&
operator<<(std::ostream& os, IOUAmount const& x)
{
return os << to_string(x);
}
}; };
inline IOUAmount::IOUAmount(beast::Zero) inline IOUAmount::IOUAmount(beast::Zero)

View File

@@ -32,6 +32,7 @@
#include <xrpl/protocol/jss.h> #include <xrpl/protocol/jss.h>
#include <cstdint> #include <cstdint>
#include <set>
namespace ripple { namespace ripple {
@@ -279,6 +280,10 @@ amm(Asset const& issue1, Asset const& issue2) noexcept;
Keylet Keylet
amm(uint256 const& amm) noexcept; amm(uint256 const& amm) noexcept;
/** A keylet for Delegate object */
Keylet
delegate(AccountID const& account, AccountID const& authorizedAccount) noexcept;
Keylet Keylet
bridge(STXChainBridge const& bridge, STXChainBridge::ChainType chainType); bridge(STXChainBridge const& bridge, STXChainBridge::ChainType chainType);
@@ -330,6 +335,15 @@ mptoken(uint256 const& mptokenKey)
Keylet Keylet
mptoken(uint256 const& issuanceKey, AccountID const& holder) noexcept; mptoken(uint256 const& issuanceKey, AccountID const& holder) noexcept;
Keylet
vault(AccountID const& owner, std::uint32_t seq) noexcept;
inline Keylet
vault(uint256 const& vaultKey)
{
return {ltVAULT, vaultKey};
}
Keylet Keylet
permissionedDomain(AccountID const& account, std::uint32_t seq) noexcept; permissionedDomain(AccountID const& account, std::uint32_t seq) noexcept;

View File

@@ -24,9 +24,6 @@
#include <xrpl/json/json_value.h> #include <xrpl/json/json_value.h>
#include <xrpl/protocol/UintTypes.h> #include <xrpl/protocol/UintTypes.h>
#include <functional>
#include <type_traits>
namespace ripple { namespace ripple {
/** A currency issued by an account. /** A currency issued by an account.

View File

@@ -145,13 +145,15 @@ enum LedgerSpecificFlags {
0x10000000, // True, reject new paychans 0x10000000, // True, reject new paychans
lsfDisallowIncomingTrustline = lsfDisallowIncomingTrustline =
0x20000000, // True, reject new trustlines (only if no issued assets) 0x20000000, // True, reject new trustlines (only if no issued assets)
// 0x40000000 is available lsfAllowTrustLineLocking =
0x40000000, // True, enable trustline locking
lsfAllowTrustLineClawback = lsfAllowTrustLineClawback =
0x80000000, // True, enable clawback 0x80000000, // True, enable clawback
// ltOFFER // ltOFFER
lsfPassive = 0x00010000, lsfPassive = 0x00010000,
lsfSell = 0x00020000, // True, offer was placed as a sell. lsfSell = 0x00020000, // True, offer was placed as a sell.
lsfHybrid = 0x00040000, // True, offer is hybrid.
// ltRIPPLE_STATE // ltRIPPLE_STATE
lsfLowReserve = 0x00010000, // True, if entry counts toward reserve. lsfLowReserve = 0x00010000, // True, if entry counts toward reserve.
@@ -185,12 +187,16 @@ enum LedgerSpecificFlags {
lsfMPTCanTrade = 0x00000010, lsfMPTCanTrade = 0x00000010,
lsfMPTCanTransfer = 0x00000020, lsfMPTCanTransfer = 0x00000020,
lsfMPTCanClawback = 0x00000040, lsfMPTCanClawback = 0x00000040,
lsfMPTMutableMeta = 0x00000080,
// ltMPTOKEN // ltMPTOKEN
lsfMPTAuthorized = 0x00000002, lsfMPTAuthorized = 0x00000002,
// ltCREDENTIAL // ltCREDENTIAL
lsfAccepted = 0x00010000, lsfAccepted = 0x00010000,
// ltVAULT
lsfVaultPrivate = 0x00010000,
}; };
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------

View File

@@ -24,15 +24,12 @@
#include <xrpl/basics/contract.h> #include <xrpl/basics/contract.h>
#include <xrpl/basics/safe_cast.h> #include <xrpl/basics/safe_cast.h>
#include <xrpl/beast/utility/Zero.h> #include <xrpl/beast/utility/Zero.h>
#include <xrpl/json/json_value.h>
#include <boost/multiprecision/cpp_int.hpp> #include <boost/multiprecision/cpp_int.hpp>
#include <boost/operators.hpp> #include <boost/operators.hpp>
#include <cstdint> #include <cstdint>
#include <optional>
#include <string> #include <string>
#include <type_traits>
namespace ripple { namespace ripple {

View File

@@ -42,8 +42,11 @@ public:
AccountID const& AccountID const&
getIssuer() const; getIssuer() const;
MPTID const& constexpr MPTID const&
getMptID() const; getMptID() const
{
return mptID_;
}
std::string std::string
getText() const; getText() const;

View File

@@ -28,7 +28,6 @@
#include <concepts> #include <concepts>
#include <cstdlib> #include <cstdlib>
#include <functional> #include <functional>
#include <limits>
#include <type_traits> #include <type_traits>
#include <utility> #include <utility>
@@ -80,7 +79,7 @@ struct MultiApiJson
} }
void void
set(const char* key, auto const& v) set(char const* key, auto const& v)
requires std::constructible_from<Json::Value, decltype(v)> requires std::constructible_from<Json::Value, decltype(v)>
{ {
for (auto& a : this->val) for (auto& a : this->val)
@@ -91,7 +90,7 @@ struct MultiApiJson
enum IsMemberResult : int { none = 0, some, all }; enum IsMemberResult : int { none = 0, some, all };
[[nodiscard]] IsMemberResult [[nodiscard]] IsMemberResult
isMember(const char* key) const isMember(char const* key) const
{ {
int count = 0; int count = 0;
for (auto& a : this->val) for (auto& a : this->val)

View File

@@ -28,6 +28,8 @@
namespace ripple { namespace ripple {
namespace RPC {
/** /**
Adds common synthetic fields to transaction-related JSON responses Adds common synthetic fields to transaction-related JSON responses
@@ -40,6 +42,7 @@ insertNFTSyntheticInJson(
TxMeta const&); TxMeta const&);
/** @} */ /** @} */
} // namespace RPC
} // namespace ripple } // namespace ripple
#endif #endif

View File

@@ -0,0 +1,96 @@
//------------------------------------------------------------------------------
/*
This file is part of rippled: https://github.com/ripple/rippled
Copyright (c) 2025 Ripple Labs Inc.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
#ifndef RIPPLE_PROTOCOL_PERMISSION_H_INCLUDED
#define RIPPLE_PROTOCOL_PERMISSION_H_INCLUDED
#include <xrpl/protocol/TxFormats.h>
#include <optional>
#include <string>
#include <unordered_map>
namespace ripple {
/**
* We have both transaction type permissions and granular type permissions.
* Since we will reuse the TransactionFormats to parse the Transaction
* Permissions, only the GranularPermissionType is defined here. To prevent
* conflicts with TxType, the GranularPermissionType is always set to a value
* greater than the maximum value of uint16.
*/
enum GranularPermissionType : std::uint32_t {
#pragma push_macro("PERMISSION")
#undef PERMISSION
#define PERMISSION(type, txType, value) type = value,
#include <xrpl/protocol/detail/permissions.macro>
#undef PERMISSION
#pragma pop_macro("PERMISSION")
};
enum Delegation { delegatable, notDelegatable };
class Permission
{
private:
Permission();
std::unordered_map<std::uint16_t, Delegation> delegatableTx_;
std::unordered_map<std::string, GranularPermissionType>
granularPermissionMap_;
std::unordered_map<GranularPermissionType, std::string> granularNameMap_;
std::unordered_map<GranularPermissionType, TxType> granularTxTypeMap_;
public:
static Permission const&
getInstance();
Permission(Permission const&) = delete;
Permission&
operator=(Permission const&) = delete;
std::optional<std::uint32_t>
getGranularValue(std::string const& name) const;
std::optional<std::string>
getGranularName(GranularPermissionType const& value) const;
std::optional<TxType>
getGranularTxType(GranularPermissionType const& gpType) const;
bool
isDelegatable(std::uint32_t const& permissionValue) const;
// for tx level permission, permission value is equal to tx type plus one
uint32_t
txToPermissionType(TxType const& type) const;
// tx type value is permission value minus one
TxType
permissionToTxType(uint32_t const& value) const;
};
} // namespace ripple
#endif

View File

@@ -116,6 +116,16 @@ std::size_t constexpr maxMPTokenMetadataLength = 1024;
/** The maximum amount of MPTokenIssuance */ /** The maximum amount of MPTokenIssuance */
std::uint64_t constexpr maxMPTokenAmount = 0x7FFF'FFFF'FFFF'FFFFull; std::uint64_t constexpr maxMPTokenAmount = 0x7FFF'FFFF'FFFF'FFFFull;
/** The maximum length of Data payload */
std::size_t constexpr maxDataPayloadLength = 256;
/** Vault withdrawal policies */
std::uint8_t constexpr vaultStrategyFirstComeFirstServe = 1;
/** Maximum recursion depth for vault shares being put as an asset inside
* another vault; counted from 0 */
std::uint8_t constexpr maxAssetCheckDepth = 5;
/** A ledger index. */ /** A ledger index. */
using LedgerIndex = std::uint32_t; using LedgerIndex = std::uint32_t;
@@ -155,6 +165,13 @@ std::size_t constexpr maxPriceScale = 20;
*/ */
std::size_t constexpr maxTrim = 25; std::size_t constexpr maxTrim = 25;
/** The maximum number of delegate permissions an account can grant
*/
std::size_t constexpr permissionMaxSize = 10;
/** The maximum number of transactions that can be in a batch. */
std::size_t constexpr maxBatchTxCount = 8;
} // namespace ripple } // namespace ripple
#endif #endif

View File

@@ -32,7 +32,6 @@
#include <cstring> #include <cstring>
#include <optional> #include <optional>
#include <ostream> #include <ostream>
#include <utility>
namespace ripple { namespace ripple {

View File

@@ -113,8 +113,8 @@ public:
// have lower unsigned integer representations. // have lower unsigned integer representations.
using value_type = std::uint64_t; using value_type = std::uint64_t;
static const int minTickSize = 3; static int const minTickSize = 3;
static const int maxTickSize = 16; static int const maxTickSize = 16;
private: private:
// This has the same representation as STAmount, see the comment on the // This has the same representation as STAmount, see the comment on the

View File

@@ -28,6 +28,9 @@
namespace ripple { namespace ripple {
bool
isFeatureEnabled(uint256 const& feature);
class DigestAwareReadView; class DigestAwareReadView;
/** Rules controlling protocol behavior. */ /** Rules controlling protocol behavior. */

View File

@@ -25,7 +25,6 @@
#include <cstdint> #include <cstdint>
#include <map> #include <map>
#include <utility>
namespace ripple { namespace ripple {
@@ -182,22 +181,22 @@ public:
private_access_tag_t, private_access_tag_t,
SerializedTypeID tid, SerializedTypeID tid,
int fv, int fv,
const char* fn, char const* fn,
int meta = sMD_Default, int meta = sMD_Default,
IsSigning signing = IsSigning::yes); IsSigning signing = IsSigning::yes);
explicit SField(private_access_tag_t, int fc); explicit SField(private_access_tag_t, int fc);
static const SField& static SField const&
getField(int fieldCode); getField(int fieldCode);
static const SField& static SField const&
getField(std::string const& fieldName); getField(std::string const& fieldName);
static const SField& static SField const&
getField(int type, int value) getField(int type, int value)
{ {
return getField(field_code(type, value)); return getField(field_code(type, value));
} }
static const SField& static SField const&
getField(SerializedTypeID type, int value) getField(SerializedTypeID type, int value)
{ {
return getField(field_code(type, value)); return getField(field_code(type, value));
@@ -284,19 +283,19 @@ public:
} }
bool bool
operator==(const SField& f) const operator==(SField const& f) const
{ {
return fieldCode == f.fieldCode; return fieldCode == f.fieldCode;
} }
bool bool
operator!=(const SField& f) const operator!=(SField const& f) const
{ {
return fieldCode != f.fieldCode; return fieldCode != f.fieldCode;
} }
static int static int
compare(const SField& f1, const SField& f2); compare(SField const& f1, SField const& f2);
static std::map<int, SField const*> const& static std::map<int, SField const*> const&
getKnownCodeToField() getKnownCodeToField()

View File

@@ -25,7 +25,6 @@
#include <functional> #include <functional>
#include <initializer_list> #include <initializer_list>
#include <memory>
#include <stdexcept> #include <stdexcept>
namespace ripple { namespace ripple {

View File

@@ -58,7 +58,7 @@ public:
add(Serializer& s) const override; add(Serializer& s) const override;
bool bool
isEquivalent(const STBase& t) const override; isEquivalent(STBase const& t) const override;
bool bool
isDefault() const override; isDefault() const override;

View File

@@ -62,20 +62,20 @@ private:
public: public:
using value_type = STAmount; using value_type = STAmount;
static const int cMinOffset = -96; static int const cMinOffset = -96;
static const int cMaxOffset = 80; static int const cMaxOffset = 80;
// Maximum native value supported by the code // Maximum native value supported by the code
static const std::uint64_t cMinValue = 1000000000000000ull; static std::uint64_t const cMinValue = 1000000000000000ull;
static const std::uint64_t cMaxValue = 9999999999999999ull; static std::uint64_t const cMaxValue = 9999999999999999ull;
static const std::uint64_t cMaxNative = 9000000000000000000ull; static std::uint64_t const cMaxNative = 9000000000000000000ull;
// Max native value on network. // Max native value on network.
static const std::uint64_t cMaxNativeN = 100000000000000000ull; static std::uint64_t const cMaxNativeN = 100000000000000000ull;
static const std::uint64_t cIssuedCurrency = 0x8000000000000000ull; static std::uint64_t const cIssuedCurrency = 0x8000000000000000ull;
static const std::uint64_t cPositive = 0x4000000000000000ull; static std::uint64_t const cPositive = 0x4000000000000000ull;
static const std::uint64_t cMPToken = 0x2000000000000000ull; static std::uint64_t const cMPToken = 0x2000000000000000ull;
static const std::uint64_t cValueMask = ~(cPositive | cMPToken); static std::uint64_t const cValueMask = ~(cPositive | cMPToken);
static std::uint64_t const uRateOne; static std::uint64_t const uRateOne;
@@ -153,6 +153,12 @@ public:
template <AssetType A> template <AssetType A>
STAmount(A const& asset, int mantissa, int exponent = 0); STAmount(A const& asset, int mantissa, int exponent = 0);
template <AssetType A>
STAmount(A const& asset, Number const& number)
: STAmount(asset, number.mantissa(), number.exponent())
{
}
// Legacy support for new-style amounts // Legacy support for new-style amounts
STAmount(IOUAmount const& amount, Issue const& issue); STAmount(IOUAmount const& amount, Issue const& issue);
STAmount(XRPAmount const& amount); STAmount(XRPAmount const& amount);
@@ -230,6 +236,9 @@ public:
STAmount& STAmount&
operator=(XRPAmount const& amount); operator=(XRPAmount const& amount);
STAmount&
operator=(Number const&);
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
// //
// Modification // Modification
@@ -268,13 +277,13 @@ public:
std::string std::string
getText() const override; getText() const override;
Json::Value getJson(JsonOptions) const override; Json::Value getJson(JsonOptions = JsonOptions::none) const override;
void void
add(Serializer& s) const override; add(Serializer& s) const override;
bool bool
isEquivalent(const STBase& t) const override; isEquivalent(STBase const& t) const override;
bool bool
isDefault() const override; isDefault() const override;
@@ -417,7 +426,7 @@ STAmount
amountFromQuality(std::uint64_t rate); amountFromQuality(std::uint64_t rate);
STAmount STAmount
amountFromString(Asset const& issue, std::string const& amount); amountFromString(Asset const& asset, std::string const& amount);
STAmount STAmount
amountFromJson(SField const& name, Json::Value const& v); amountFromJson(SField const& name, Json::Value const& v);
@@ -541,6 +550,16 @@ STAmount::operator=(XRPAmount const& amount)
return *this; return *this;
} }
inline STAmount&
STAmount::operator=(Number const& number)
{
mIsNegative = number.mantissa() < 0;
mValue = mIsNegative ? -number.mantissa() : number.mantissa();
mOffset = number.exponent();
canonicalize();
return *this;
}
inline void inline void
STAmount::negate() STAmount::negate()
{ {
@@ -684,6 +703,12 @@ isXRP(STAmount const& amount)
return amount.native(); return amount.native();
} }
bool
canAdd(STAmount const& amt1, STAmount const& amt2);
bool
canSubtract(STAmount const& amt1, STAmount const& amt2);
// Since `canonicalize` does not have access to a ledger, this is needed to put // Since `canonicalize` does not have access to a ledger, this is needed to put
// the low-level routine stAmountCanonicalize on an amendment switch. Only // the low-level routine stAmountCanonicalize on an amendment switch. Only
// transactions need to use this switchover. Outside of a transaction it's safe // transactions need to use this switchover. Outside of a transaction it's safe

View File

@@ -128,13 +128,13 @@ public:
add(Serializer& s) const override; add(Serializer& s) const override;
void void
sort(bool (*compare)(const STObject& o1, const STObject& o2)); sort(bool (*compare)(STObject const& o1, STObject const& o2));
bool bool
operator==(const STArray& s) const; operator==(STArray const& s) const;
bool bool
operator!=(const STArray& s) const; operator!=(STArray const& s) const;
iterator iterator
erase(iterator pos); erase(iterator pos);
@@ -152,7 +152,7 @@ public:
getSType() const override; getSType() const override;
bool bool
isEquivalent(const STBase& t) const override; isEquivalent(STBase const& t) const override;
bool bool
isDefault() const override; isDefault() const override;
@@ -275,13 +275,13 @@ STArray::swap(STArray& a) noexcept
} }
inline bool inline bool
STArray::operator==(const STArray& s) const STArray::operator==(STArray const& s) const
{ {
return v_ == s.v_; return v_ == s.v_;
} }
inline bool inline bool
STArray::operator!=(const STArray& s) const STArray::operator!=(STArray const& s) const
{ {
return v_ != s.v_; return v_ != s.v_;
} }

View File

@@ -24,7 +24,6 @@
#include <xrpl/protocol/SField.h> #include <xrpl/protocol/SField.h>
#include <xrpl/protocol/Serializer.h> #include <xrpl/protocol/Serializer.h>
#include <memory>
#include <ostream> #include <ostream>
#include <string> #include <string>
#include <type_traits> #include <type_traits>
@@ -92,6 +91,16 @@ struct JsonOptions
} }
}; };
template <typename T>
requires requires(T const& t) {
{ t.getJson(JsonOptions::none) } -> std::convertible_to<Json::Value>;
}
Json::Value
to_json(T const& t)
{
return t.getJson(JsonOptions::none);
}
namespace detail { namespace detail {
class STVar; class STVar;
} }
@@ -129,16 +138,16 @@ class STBase
public: public:
virtual ~STBase() = default; virtual ~STBase() = default;
STBase(); STBase();
STBase(const STBase&) = default; STBase(STBase const&) = default;
STBase& STBase&
operator=(const STBase& t); operator=(STBase const& t);
explicit STBase(SField const& n); explicit STBase(SField const& n);
bool bool
operator==(const STBase& t) const; operator==(STBase const& t) const;
bool bool
operator!=(const STBase& t) const; operator!=(STBase const& t) const;
template <class D> template <class D>
D& D&
@@ -157,7 +166,7 @@ public:
virtual std::string virtual std::string
getText() const; getText() const;
virtual Json::Value getJson(JsonOptions /*options*/) const; virtual Json::Value getJson(JsonOptions = JsonOptions::none) const;
virtual void virtual void
add(Serializer& s) const; add(Serializer& s) const;
@@ -197,7 +206,7 @@ private:
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
std::ostream& std::ostream&
operator<<(std::ostream& out, const STBase& t); operator<<(std::ostream& out, STBase const& t);
template <class D> template <class D>
D& D&

View File

@@ -45,8 +45,8 @@ public:
STBitString() = default; STBitString() = default;
STBitString(SField const& n); STBitString(SField const& n);
STBitString(const value_type& v); STBitString(value_type const& v);
STBitString(SField const& n, const value_type& v); STBitString(SField const& n, value_type const& v);
STBitString(SerialIter& sit, SField const& name); STBitString(SerialIter& sit, SField const& name);
SerializedTypeID SerializedTypeID
@@ -56,7 +56,7 @@ public:
getText() const override; getText() const override;
bool bool
isEquivalent(const STBase& t) const override; isEquivalent(STBase const& t) const override;
void void
add(Serializer& s) const override; add(Serializer& s) const override;
@@ -93,12 +93,12 @@ inline STBitString<Bits>::STBitString(SField const& n) : STBase(n)
} }
template <int Bits> template <int Bits>
inline STBitString<Bits>::STBitString(const value_type& v) : value_(v) inline STBitString<Bits>::STBitString(value_type const& v) : value_(v)
{ {
} }
template <int Bits> template <int Bits>
inline STBitString<Bits>::STBitString(SField const& n, const value_type& v) inline STBitString<Bits>::STBitString(SField const& n, value_type const& v)
: STBase(n), value_(v) : STBase(n), value_(v)
{ {
} }
@@ -160,9 +160,9 @@ STBitString<Bits>::getText() const
template <int Bits> template <int Bits>
bool bool
STBitString<Bits>::isEquivalent(const STBase& t) const STBitString<Bits>::isEquivalent(STBase const& t) const
{ {
const STBitString* v = dynamic_cast<const STBitString*>(&t); STBitString const* v = dynamic_cast<STBitString const*>(&t);
return v && (value_ == v->value_); return v && (value_ == v->value_);
} }

View File

@@ -27,7 +27,6 @@
#include <xrpl/protocol/STBase.h> #include <xrpl/protocol/STBase.h>
#include <cstring> #include <cstring>
#include <memory>
namespace ripple { namespace ripple {
@@ -63,7 +62,7 @@ public:
add(Serializer& s) const override; add(Serializer& s) const override;
bool bool
isEquivalent(const STBase& t) const override; isEquivalent(STBase const& t) const override;
bool bool
isDefault() const override; isDefault() const override;

View File

@@ -65,7 +65,7 @@ public:
add(Serializer& s) const override; add(Serializer& s) const override;
bool bool
isEquivalent(const STBase& t) const override; isEquivalent(STBase const& t) const override;
bool bool
isDefault() const override; isDefault() const override;

View File

@@ -54,7 +54,7 @@ public:
isDefault() const override; isDefault() const override;
bool bool
isEquivalent(const STBase& t) const override; isEquivalent(STBase const& t) const override;
STInteger& STInteger&
operator=(value_type const& v); operator=(value_type const& v);
@@ -127,9 +127,9 @@ STInteger<Integer>::isDefault() const
template <typename Integer> template <typename Integer>
inline bool inline bool
STInteger<Integer>::isEquivalent(const STBase& t) const STInteger<Integer>::isEquivalent(STBase const& t) const
{ {
const STInteger* v = dynamic_cast<const STInteger*>(&t); STInteger const* v = dynamic_cast<STInteger const*>(&t);
return v && (value_ == v->value_); return v && (value_ == v->value_);
} }

View File

@@ -37,6 +37,7 @@ public:
using value_type = Asset; using value_type = Asset;
STIssue() = default; STIssue() = default;
STIssue(STIssue const& rhs) = default;
explicit STIssue(SerialIter& sit, SField const& name); explicit STIssue(SerialIter& sit, SField const& name);
@@ -45,6 +46,9 @@ public:
explicit STIssue(SField const& name); explicit STIssue(SField const& name);
STIssue&
operator=(STIssue const& rhs) = default;
template <ValidIssueType TIss> template <ValidIssueType TIss>
TIss const& TIss const&
get() const; get() const;
@@ -71,7 +75,7 @@ public:
add(Serializer& s) const override; add(Serializer& s) const override;
bool bool
isEquivalent(const STBase& t) const override; isEquivalent(STBase const& t) const override;
bool bool
isDefault() const override; isDefault() const override;

View File

@@ -35,7 +35,7 @@ class STLedgerEntry final : public STObject, public CountedObject<STLedgerEntry>
public: public:
using pointer = std::shared_ptr<STLedgerEntry>; using pointer = std::shared_ptr<STLedgerEntry>;
using ref = const std::shared_ptr<STLedgerEntry>&; using ref = std::shared_ptr<STLedgerEntry> const&;
/** Create an empty object with the given key and type. */ /** Create an empty object with the given key and type. */
explicit STLedgerEntry(Keylet const& k); explicit STLedgerEntry(Keylet const& k);

View File

@@ -63,6 +63,13 @@ public:
void void
setValue(Number const& v); setValue(Number const& v);
STNumber&
operator=(Number const& rhs)
{
setValue(rhs);
return *this;
}
bool bool
isEquivalent(STBase const& t) const override; isEquivalent(STBase const& t) const override;
bool bool
@@ -83,6 +90,19 @@ private:
std::ostream& std::ostream&
operator<<(std::ostream& out, STNumber const& rhs); operator<<(std::ostream& out, STNumber const& rhs);
struct NumberParts
{
std::uint64_t mantissa = 0;
int exponent = 0;
bool negative = false;
};
NumberParts
partsFromString(std::string const& number);
STNumber
numberFromJson(SField const& field, Json::Value const& value);
} // namespace ripple } // namespace ripple
#endif #endif

Some files were not shown because too many files have changed in this diff Show More