Compare commits

..

7 Commits

Author SHA1 Message Date
Denis Angell
6da92d8922 feature 2025-12-23 18:37:45 -05:00
Bart
40198d9792 ci: Remove superfluous build directory creation (#6159)
This change modifies the build directory structure from `build/build/xxx` or `.build/build/xxx` to just `build/xxx`. Namely, the `conanfile.py` has the CMake generators build directory hardcoded to `build/generators`. We may as well leverage the top-level build directory without introducing another layer of directory nesting.
2025-12-22 16:30:23 -05:00
Bart
f059f0beda Set version to 3.2.0-b0 (#6153) 2025-12-17 18:21:01 -05:00
Mayukha Vadari
41c1be2bac refactor: remove Json::Object and related files/classes (#5894)
`Json::Object` and related objects are not used at all, so this change removes `include/xrpl/json/Object.h` and all downstream files. There are a number of minor downstream changes as well.

Full list of deleted classes and functions:
* `Json::Collections`
* `Json::Object`
* `Json::Array`
* `Json::WriterObject`
* `Json::setArray`
* `Json::addObject`
* `Json::appendArray`
* `Json::appendObject`

The last helper function, `copyFrom`, seemed a bit more complex and was actually used in a few places, so it was moved to `LedgerToJson.h` instead of deleting it.
2025-12-15 13:40:08 -05:00
Bart
f816ffa55f ci: Update shared actions (#6147)
The latest update to `cleanup-workspace`, `get-nproc`, and `prepare-runner` moved the action to the repository root directory, and also includes some ccache changes. In response, this change updates the various shared actions to the latest commit hash.
2025-12-12 19:47:34 +00:00
liuyueyangxmu
cf748702af chore: Fix some typos in comments (#6082) 2025-12-12 11:06:17 -05:00
Bart
1eb0fdac65 refactor: Rename ripple namespace to xrpl (#5982)
This change renames all occurrences of `namespace ripple` and `ripple::` to `namespace xrpl` and `xrpl::`, respectively, as well as the names of test suites. It also provides a script to allow developers to replicate the changes in their local branch or fork to avoid conflicts.
2025-12-11 16:51:49 +00:00
1365 changed files with 43195 additions and 5998 deletions

6
.github/CODEOWNERS vendored
View File

@@ -1,8 +1,2 @@
# 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

@@ -4,9 +4,6 @@ description: "Install Conan dependencies, optionally forcing a rebuild of all de
# Note that actions do not support 'type' and all inputs are strings, see
# https://docs.github.com/en/actions/reference/workflows-and-actions/metadata-syntax#inputs.
inputs:
build_dir:
description: "The directory where to build."
required: true
build_type:
description: 'The build type to use ("Debug", "Release").'
required: true
@@ -28,17 +25,13 @@ runs:
- name: Install Conan dependencies
shell: bash
env:
BUILD_DIR: ${{ inputs.build_dir }}
BUILD_NPROC: ${{ inputs.build_nproc }}
BUILD_OPTION: ${{ inputs.force_build == 'true' && '*' || 'missing' }}
BUILD_TYPE: ${{ inputs.build_type }}
LOG_VERBOSITY: ${{ inputs.log_verbosity }}
run: |
echo 'Installing dependencies.'
mkdir -p "${BUILD_DIR}"
cd "${BUILD_DIR}"
conan install \
--output-folder . \
--build="${BUILD_OPTION}" \
--options:host='&:tests=True' \
--options:host='&:xrpld=True' \
@@ -46,4 +39,4 @@ runs:
--conf:all tools.build:jobs=${BUILD_NPROC} \
--conf:all tools.build:verbosity="${LOG_VERBOSITY}" \
--conf:all tools.compilation:verbosity="${LOG_VERBOSITY}" \
..
.

View File

@@ -29,6 +29,8 @@ run from the repository root.
4. `.github/scripts/rename/binary.sh`: This script will rename the binary from
`rippled` to `xrpld`, and reverses the symlink so that `rippled` points to
the `xrpld` binary.
5. `.github/scripts/rename/namespace.sh`: This script will rename the C++
namespaces from `ripple` to `xrpl`.
You can run all these scripts from the repository root as follows:
@@ -37,4 +39,5 @@ You can run all these scripts from the repository root as follows:
./.github/scripts/rename/copyright.sh .
./.github/scripts/rename/cmake.sh .
./.github/scripts/rename/binary.sh .
./.github/scripts/rename/namespace.sh .
```

58
.github/scripts/rename/namespace.sh vendored Executable file
View File

@@ -0,0 +1,58 @@
#!/bin/bash
# Exit the script as soon as an error occurs.
set -e
# On MacOS, ensure that GNU sed is installed and available as `gsed`.
SED_COMMAND=sed
if [[ "${OSTYPE}" == 'darwin'* ]]; then
if ! command -v gsed &> /dev/null; then
echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'."
exit 1
fi
SED_COMMAND=gsed
fi
# This script renames the `ripple` namespace to `xrpl` in this project.
# Specifically, it renames all occurrences of `namespace ripple` and `ripple::`
# to `namespace xrpl` and `xrpl::`, respectively, by scanning all header and
# source files in the specified directory and its subdirectories, as well as any
# occurrences in the documentation. It also renames them in the test suites.
# Usage: .github/scripts/rename/namespace.sh <repository directory>
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <repository directory>"
exit 1
fi
DIRECTORY=$1
echo "Processing directory: ${DIRECTORY}"
if [ ! -d "${DIRECTORY}" ]; then
echo "Error: Directory '${DIRECTORY}' does not exist."
exit 1
fi
pushd ${DIRECTORY}
DIRECTORIES=("include" "src" "tests")
for DIRECTORY in "${DIRECTORIES[@]}"; do
echo "Processing directory: ${DIRECTORY}"
find "${DIRECTORY}" -type f \( -name "*.h" -o -name "*.hpp" -o -name "*.ipp" -o -name "*.cpp" \) | while read -r FILE; do
echo "Processing file: ${FILE}"
${SED_COMMAND} -i 's/namespace ripple/namespace xrpl/g' "${FILE}"
${SED_COMMAND} -i 's/ripple::/xrpl::/g' "${FILE}"
${SED_COMMAND} -i -E 's/(BEAST_DEFINE_TESTSUITE.+)ripple(.+)/\1xrpl\2/g' "${FILE}"
done
done
# Special case for NuDBFactory that has ripple twice in the test suite name.
${SED_COMMAND} -i -E 's/(BEAST_DEFINE_TESTSUITE.+)ripple(.+)/\1xrpl\2/g' src/test/nodestore/NuDBFactory_test.cpp
DIRECTORY=$1
find "${DIRECTORY}" -type f -name "*.md" | while read -r FILE; do
echo "Processing file: ${FILE}"
${SED_COMMAND} -i 's/ripple::/xrpl::/g' "${FILE}"
done
popd
echo "Renaming complete."

View File

@@ -15,196 +15,196 @@
"distro_version": "bookworm",
"compiler_name": "gcc",
"compiler_version": "12",
"image_sha": "0525eae"
"image_sha": "ca4517d"
},
{
"distro_name": "debian",
"distro_version": "bookworm",
"compiler_name": "gcc",
"compiler_version": "13",
"image_sha": "0525eae"
"image_sha": "ca4517d"
},
{
"distro_name": "debian",
"distro_version": "bookworm",
"compiler_name": "gcc",
"compiler_version": "14",
"image_sha": "0525eae"
"image_sha": "ca4517d"
},
{
"distro_name": "debian",
"distro_version": "bookworm",
"compiler_name": "gcc",
"compiler_version": "15",
"image_sha": "0525eae"
"image_sha": "ca4517d"
},
{
"distro_name": "debian",
"distro_version": "bookworm",
"compiler_name": "clang",
"compiler_version": "16",
"image_sha": "0525eae"
"image_sha": "ca4517d"
},
{
"distro_name": "debian",
"distro_version": "bookworm",
"compiler_name": "clang",
"compiler_version": "17",
"image_sha": "0525eae"
"image_sha": "ca4517d"
},
{
"distro_name": "debian",
"distro_version": "bookworm",
"compiler_name": "clang",
"compiler_version": "18",
"image_sha": "0525eae"
"image_sha": "ca4517d"
},
{
"distro_name": "debian",
"distro_version": "bookworm",
"compiler_name": "clang",
"compiler_version": "19",
"image_sha": "0525eae"
"image_sha": "ca4517d"
},
{
"distro_name": "debian",
"distro_version": "bookworm",
"compiler_name": "clang",
"compiler_version": "20",
"image_sha": "0525eae"
"image_sha": "ca4517d"
},
{
"distro_name": "debian",
"distro_version": "trixie",
"compiler_name": "gcc",
"compiler_version": "14",
"image_sha": "0525eae"
"image_sha": "ca4517d"
},
{
"distro_name": "debian",
"distro_version": "trixie",
"compiler_name": "gcc",
"compiler_version": "15",
"image_sha": "0525eae"
"image_sha": "ca4517d"
},
{
"distro_name": "debian",
"distro_version": "trixie",
"compiler_name": "clang",
"compiler_version": "20",
"image_sha": "0525eae"
"image_sha": "ca4517d"
},
{
"distro_name": "debian",
"distro_version": "trixie",
"compiler_name": "clang",
"compiler_version": "21",
"image_sha": "0525eae"
"image_sha": "ca4517d"
},
{
"distro_name": "rhel",
"distro_version": "8",
"compiler_name": "gcc",
"compiler_version": "14",
"image_sha": "e1782cd"
"image_sha": "ca4517d"
},
{
"distro_name": "rhel",
"distro_version": "8",
"compiler_name": "clang",
"compiler_version": "any",
"image_sha": "e1782cd"
"image_sha": "ca4517d"
},
{
"distro_name": "rhel",
"distro_version": "9",
"compiler_name": "gcc",
"compiler_version": "12",
"image_sha": "e1782cd"
"image_sha": "ca4517d"
},
{
"distro_name": "rhel",
"distro_version": "9",
"compiler_name": "gcc",
"compiler_version": "13",
"image_sha": "e1782cd"
"image_sha": "ca4517d"
},
{
"distro_name": "rhel",
"distro_version": "9",
"compiler_name": "gcc",
"compiler_version": "14",
"image_sha": "e1782cd"
"image_sha": "ca4517d"
},
{
"distro_name": "rhel",
"distro_version": "9",
"compiler_name": "clang",
"compiler_version": "any",
"image_sha": "e1782cd"
"image_sha": "ca4517d"
},
{
"distro_name": "rhel",
"distro_version": "10",
"compiler_name": "gcc",
"compiler_version": "14",
"image_sha": "e1782cd"
"image_sha": "ca4517d"
},
{
"distro_name": "rhel",
"distro_version": "10",
"compiler_name": "clang",
"compiler_version": "any",
"image_sha": "e1782cd"
"image_sha": "ca4517d"
},
{
"distro_name": "ubuntu",
"distro_version": "jammy",
"compiler_name": "gcc",
"compiler_version": "12",
"image_sha": "e1782cd"
"image_sha": "ca4517d"
},
{
"distro_name": "ubuntu",
"distro_version": "noble",
"compiler_name": "gcc",
"compiler_version": "13",
"image_sha": "e1782cd"
"image_sha": "ca4517d"
},
{
"distro_name": "ubuntu",
"distro_version": "noble",
"compiler_name": "gcc",
"compiler_version": "14",
"image_sha": "e1782cd"
"image_sha": "ca4517d"
},
{
"distro_name": "ubuntu",
"distro_version": "noble",
"compiler_name": "clang",
"compiler_version": "16",
"image_sha": "e1782cd"
"image_sha": "ca4517d"
},
{
"distro_name": "ubuntu",
"distro_version": "noble",
"compiler_name": "clang",
"compiler_version": "17",
"image_sha": "e1782cd"
"image_sha": "ca4517d"
},
{
"distro_name": "ubuntu",
"distro_version": "noble",
"compiler_name": "clang",
"compiler_version": "18",
"image_sha": "e1782cd"
"image_sha": "ca4517d"
},
{
"distro_name": "ubuntu",
"distro_version": "noble",
"compiler_name": "clang",
"compiler_version": "19",
"image_sha": "e1782cd"
"image_sha": "ca4517d"
}
],
"build_type": ["Debug", "Release"],

View File

@@ -22,7 +22,7 @@ defaults:
shell: bash
env:
BUILD_DIR: .build
BUILD_DIR: build
NPROC_SUBTRACT: 2
jobs:
@@ -36,7 +36,7 @@ jobs:
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
- name: Get number of processors
uses: XRPLF/actions/.github/actions/get-nproc@046b1620f6bfd6cd0985dc82c3df02786801fe0a
uses: XRPLF/actions/get-nproc@2ece4ec6ab7de266859a6f053571425b2bd684b6
id: nproc
with:
subtract: ${{ env.NPROC_SUBTRACT }}

View File

@@ -3,11 +3,6 @@ name: Build and test configuration
on:
workflow_call:
inputs:
build_dir:
description: "The directory where to build."
required: true
type: string
build_only:
description: 'Whether to only build or to build and test the code ("true", "false").'
required: true
@@ -59,6 +54,11 @@ defaults:
run:
shell: bash
env:
# Conan installs the generators in the build/generators directory, see the
# layout() method in conanfile.py. We then run CMake from the build directory.
BUILD_DIR: build
jobs:
build-and-test:
name: ${{ inputs.config_name }}
@@ -71,13 +71,13 @@ jobs:
steps:
- name: Cleanup workspace (macOS and Windows)
if: ${{ runner.os == 'macOS' || runner.os == 'Windows' }}
uses: XRPLF/actions/.github/actions/cleanup-workspace@01b244d2718865d427b499822fbd3f15e7197fcc
uses: XRPLF/actions/cleanup-workspace@2ece4ec6ab7de266859a6f053571425b2bd684b6
- name: Checkout repository
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
- name: Prepare runner
uses: XRPLF/actions/.github/actions/prepare-runner@99685816bb60a95a66852f212f382580e180df3a
uses: XRPLF/actions/prepare-runner@2ece4ec6ab7de266859a6f053571425b2bd684b6
with:
disable_ccache: false
@@ -85,7 +85,7 @@ jobs:
uses: ./.github/actions/print-env
- name: Get number of processors
uses: XRPLF/actions/.github/actions/get-nproc@046b1620f6bfd6cd0985dc82c3df02786801fe0a
uses: XRPLF/actions/get-nproc@2ece4ec6ab7de266859a6f053571425b2bd684b6
id: nproc
with:
subtract: ${{ inputs.nproc_subtract }}
@@ -96,7 +96,6 @@ jobs:
- name: Build dependencies
uses: ./.github/actions/build-deps
with:
build_dir: ${{ inputs.build_dir }}
build_nproc: ${{ steps.nproc.outputs.nproc }}
build_type: ${{ inputs.build_type }}
# Set the verbosity to "quiet" for Windows to avoid an excessive
@@ -104,7 +103,7 @@ jobs:
log_verbosity: ${{ runner.os == 'Windows' && 'quiet' || 'verbose' }}
- name: Configure CMake
working-directory: ${{ inputs.build_dir }}
working-directory: ${{ env.BUILD_DIR }}
env:
BUILD_TYPE: ${{ inputs.build_type }}
CMAKE_ARGS: ${{ inputs.cmake_args }}
@@ -117,7 +116,7 @@ jobs:
..
- name: Build the binary
working-directory: ${{ inputs.build_dir }}
working-directory: ${{ env.BUILD_DIR }}
env:
BUILD_NPROC: ${{ steps.nproc.outputs.nproc }}
BUILD_TYPE: ${{ inputs.build_type }}
@@ -132,8 +131,6 @@ jobs:
- name: Upload the binary (Linux)
if: ${{ github.repository_owner == 'XRPLF' && runner.os == 'Linux' }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
env:
BUILD_DIR: ${{ inputs.build_dir }}
with:
name: xrpld-${{ inputs.config_name }}
path: ${{ env.BUILD_DIR }}/xrpld
@@ -142,7 +139,7 @@ jobs:
- name: Check linking (Linux)
if: ${{ runner.os == 'Linux' }}
working-directory: ${{ inputs.build_dir }}
working-directory: ${{ env.BUILD_DIR }}
run: |
ldd ./xrpld
if [ "$(ldd ./xrpld | grep -E '(libstdc\+\+|libgcc)' | wc -l)" -eq 0 ]; then
@@ -154,13 +151,13 @@ jobs:
- name: Verify presence of instrumentation (Linux)
if: ${{ runner.os == 'Linux' && env.ENABLED_VOIDSTAR == 'true' }}
working-directory: ${{ inputs.build_dir }}
working-directory: ${{ env.BUILD_DIR }}
run: |
./xrpld --version | grep libvoidstar
- name: Run the separate tests
if: ${{ !inputs.build_only }}
working-directory: ${{ inputs.build_dir }}
working-directory: ${{ env.BUILD_DIR }}
# Windows locks some of the build files while running tests, and parallel jobs can collide
env:
BUILD_TYPE: ${{ inputs.build_type }}
@@ -173,7 +170,7 @@ jobs:
- name: Run the embedded tests
if: ${{ !inputs.build_only }}
working-directory: ${{ runner.os == 'Windows' && format('{0}/{1}', inputs.build_dir, inputs.build_type) || inputs.build_dir }}
working-directory: ${{ runner.os == 'Windows' && format('{0}/{1}', env.BUILD_DIR, inputs.build_type) || env.BUILD_DIR }}
env:
BUILD_NPROC: ${{ steps.nproc.outputs.nproc }}
run: |
@@ -189,7 +186,7 @@ jobs:
- name: Prepare coverage report
if: ${{ !inputs.build_only && env.ENABLED_COVERAGE == 'true' }}
working-directory: ${{ inputs.build_dir }}
working-directory: ${{ env.BUILD_DIR }}
env:
BUILD_NPROC: ${{ steps.nproc.outputs.nproc }}
BUILD_TYPE: ${{ inputs.build_type }}
@@ -207,7 +204,7 @@ jobs:
disable_search: true
disable_telem: true
fail_ci_if_error: true
files: ${{ inputs.build_dir }}/coverage.xml
files: ${{ env.BUILD_DIR }}/coverage.xml
plugins: noop
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true

View File

@@ -8,11 +8,6 @@ name: Build and test
on:
workflow_call:
inputs:
build_dir:
description: "The directory where to build."
required: false
type: string
default: ".build"
os:
description: 'The operating system to use for the build ("linux", "macos", "windows").'
required: true
@@ -46,7 +41,6 @@ jobs:
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
max-parallel: 10
with:
build_dir: ${{ inputs.build_dir }}
build_only: ${{ matrix.build_only }}
build_type: ${{ matrix.build_type }}
cmake_args: ${{ matrix.cmake_args }}

View File

@@ -27,6 +27,8 @@ jobs:
run: .github/scripts/rename/cmake.sh .
- name: Check binary name
run: .github/scripts/rename/binary.sh .
- name: Check namespaces
run: .github/scripts/rename/namespace.sh .
- name: Check for differences
env:
MESSAGE: |

View File

@@ -64,13 +64,13 @@ jobs:
steps:
- name: Cleanup workspace (macOS and Windows)
if: ${{ runner.os == 'macOS' || runner.os == 'Windows' }}
uses: XRPLF/actions/.github/actions/cleanup-workspace@01b244d2718865d427b499822fbd3f15e7197fcc
uses: XRPLF/actions/cleanup-workspace@2ece4ec6ab7de266859a6f053571425b2bd684b6
- name: Checkout repository
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
- name: Prepare runner
uses: XRPLF/actions/.github/actions/prepare-runner@99685816bb60a95a66852f212f382580e180df3a
uses: XRPLF/actions/prepare-runner@2ece4ec6ab7de266859a6f053571425b2bd684b6
with:
disable_ccache: false
@@ -78,7 +78,7 @@ jobs:
uses: ./.github/actions/print-env
- name: Get number of processors
uses: XRPLF/actions/.github/actions/get-nproc@046b1620f6bfd6cd0985dc82c3df02786801fe0a
uses: XRPLF/actions/get-nproc@2ece4ec6ab7de266859a6f053571425b2bd684b6
id: nproc
with:
subtract: ${{ env.NPROC_SUBTRACT }}
@@ -92,7 +92,6 @@ jobs:
- name: Build dependencies
uses: ./.github/actions/build-deps
with:
build_dir: .build
build_nproc: ${{ steps.nproc.outputs.nproc }}
build_type: ${{ matrix.build_type }}
force_build: ${{ github.event_name == 'schedule' || github.event.inputs.force_source_build == 'true' }}

View File

@@ -113,6 +113,7 @@ find_package(date REQUIRED)
find_package(ed25519 REQUIRED)
find_package(nudb REQUIRED)
find_package(secp256k1 REQUIRED)
find_package(wasmi REQUIRED)
find_package(xxHash REQUIRED)
target_link_libraries(xrpl_libs INTERFACE

View File

@@ -304,7 +304,7 @@ For this reason:
- Example **bad** name
`"RFC1751::insert(char* s, int x, int start, int length) : length is greater than or equal zero"`
(missing namespace, unnecessary full function signature, description too verbose).
Good name: `"ripple::RFC1751::insert : minimum length"`.
Good name: `"xrpl::RFC1751::insert : minimum length"`.
- In **few** well-justified cases a non-standard name can be used, in which case a
comment should be placed to explain the rationale (example in `contract.cpp`)
- Do **not** rename a contract without a good reason (e.g. the name no longer

View File

@@ -1290,6 +1290,39 @@
# Example:
# owner_reserve = 2000000 # 2 XRP
#
# extension_compute_limit = <gas>
#
# The extension compute limit is the maximum amount of gas that can be
# consumed by a single transaction. The gas limit is used to prevent
# transactions from consuming too many resources.
#
# If this parameter is unspecified, rippled will use an internal
# default. Don't change this without understanding the consequences.
#
# Example:
# extension_compute_limit = 1000000 # 1 million gas
#
# extension_size_limit = <bytes>
#
# The extension size limit is the maximum size of a WASM extension in
# bytes. The size limit is used to prevent extensions from consuming
# too many resources.
#
# If this parameter is unspecified, rippled will use an internal
# default. Don't change this without understanding the consequences.
#
# Example:
# extension_size_limit = 100000 # 100 kb
#
# gas_price = <bytes>
#
# The gas price is the conversion between WASM gas and its price in drops.
#
# If this parameter is unspecified, rippled will use an internal
# default. Don't change this without understanding the consequences.
#
# Example:
# gas_price = 1000000 # 1 drop per gas
#-------------------------------------------------------------------------------
#
# 9. Misc Settings

View File

@@ -63,6 +63,7 @@ target_link_libraries(xrpl.imports.main
Xrpl::opts
Xrpl::syslibs
secp256k1::secp256k1
wasmi::wasmi
xrpl.libpb
xxHash::xxhash
$<$<BOOL:${voidstar}>:antithesis-sdk-cpp>

View File

@@ -3,6 +3,7 @@
"requires": [
"zlib/1.3.1#b8bc2603263cf7eccbd6e17e66b0ed76%1756234269.497",
"xxhash/0.8.3#681d36a0a6111fc56e5e45ea182c19cc%1756234289.683",
"wasmi/0.42.1#2a96357d4e6bf40dfe201106d849c24f%1764802092.014",
"sqlite3/3.49.1#8631739a4c9b93bd3d6b753bac548a63%1756234266.869",
"soci/4.0.3#a9f8d773cd33e356b5879a4b0564f287%1756234262.318",
"snappy/1.1.10#968fef506ff261592ec30c574d4a7809%1756234314.246",

View File

@@ -35,6 +35,7 @@ class Xrpl(ConanFile):
"openssl/3.5.4",
"secp256k1/0.7.0",
"soci/4.0.3",
"wasmi/0.42.1",
"zlib/1.3.1",
]
@@ -212,6 +213,7 @@ class Xrpl(ConanFile):
"soci::soci",
"secp256k1::secp256k1",
"sqlite3::sqlite",
"wasmi::wasmi",
"xxhash::xxhash",
"zlib::zlib",
]

View File

@@ -3,7 +3,7 @@
#include <boost/filesystem.hpp>
namespace ripple {
namespace xrpl {
/** Extract a tar archive compressed with lz4
@@ -17,6 +17,6 @@ extractTarLz4(
boost::filesystem::path const& src,
boost::filesystem::path const& dst);
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -12,7 +12,7 @@
#include <unordered_map>
#include <vector>
namespace ripple {
namespace xrpl {
using IniFileSections =
std::unordered_map<std::string, std::vector<std::string>>;
@@ -380,6 +380,6 @@ get_if_exists<bool>(Section const& section, std::string const& name, bool& v)
return stat;
}
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -3,13 +3,13 @@
#include <vector>
namespace ripple {
namespace xrpl {
/** Storage for linear binary data.
Blocks of binary data appear often in various idioms and structures.
*/
using Blob = std::vector<unsigned char>;
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -8,7 +8,7 @@
#include <cstring>
#include <memory>
namespace ripple {
namespace xrpl {
/** Like std::vector<char> but better.
Meets the requirements of BufferFactory.
@@ -96,7 +96,7 @@ public:
XRPL_ASSERT(
s.size() == 0 || size_ == 0 || s.data() < p_.get() ||
s.data() >= p_.get() + size_,
"ripple::Buffer::operator=(Slice) : input not a subset");
"xrpl::Buffer::operator=(Slice) : input not a subset");
if (auto p = alloc(s.size()))
std::memcpy(p, s.data(), s.size());
@@ -215,6 +215,6 @@ operator!=(Buffer const& lhs, Buffer const& rhs) noexcept
return !(lhs == rhs);
}
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -1,7 +1,7 @@
#ifndef XRPL_BASICS_BYTEUTILITIES_H_INCLUDED
#define XRPL_BASICS_BYTEUTILITIES_H_INCLUDED
namespace ripple {
namespace xrpl {
template <class T>
constexpr auto
@@ -19,6 +19,6 @@ megabytes(T value) noexcept
static_assert(kilobytes(2) == 2048, "kilobytes(2) == 2048");
static_assert(megabytes(3) == 3145728, "megabytes(3) == 3145728");
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -10,7 +10,7 @@
#include <stdexcept>
#include <vector>
namespace ripple {
namespace xrpl {
namespace compression_algorithms {
@@ -144,6 +144,6 @@ lz4Decompress(
} // namespace compression_algorithms
} // namespace ripple
} // namespace xrpl
#endif // XRPL_COMPRESSIONALGORITHMS_H_INCLUDED

View File

@@ -8,7 +8,7 @@
#include <utility>
#include <vector>
namespace ripple {
namespace xrpl {
/** Manages all counted object types. */
class CountedObjects
@@ -133,6 +133,6 @@ public:
}
};
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -4,7 +4,7 @@
#include <chrono>
#include <cmath>
namespace ripple {
namespace xrpl {
/** Sampling function using exponential decay to provide a continuous value.
@tparam The number of seconds in the decay window.
@@ -131,6 +131,6 @@ private:
time_point when_;
};
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -7,7 +7,7 @@
#include <stdexcept>
namespace ripple {
namespace xrpl {
/** Expected is an approximation of std::expected (hoped for in C++23)
@@ -232,6 +232,6 @@ public:
}
};
} // namespace ripple
} // namespace xrpl
#endif // XRPL_BASICS_EXPECTED_H_INCLUDED

View File

@@ -6,7 +6,7 @@
#include <optional>
namespace ripple {
namespace xrpl {
std::string
getFileContents(
@@ -20,6 +20,6 @@ writeFileContents(
boost::filesystem::path const& destPath,
std::string const& contents);
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -6,7 +6,7 @@
#include <type_traits>
#include <utility>
namespace ripple {
namespace xrpl {
//------------------------------------------------------------------------------
@@ -492,5 +492,5 @@ dynamic_pointer_cast(TT const& v)
return SharedPtr<T>(DynamicCastTagSharedIntrusive{}, v);
}
} // namespace intr_ptr
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -6,7 +6,7 @@
#include <utility>
namespace ripple {
namespace xrpl {
template <class T>
template <CAdoptTag TAdoptTag>
@@ -608,7 +608,7 @@ SharedWeakUnion<T>::convertToStrong()
[[maybe_unused]] auto action = p->releaseWeakRef();
XRPL_ASSERT(
(action == ReleaseWeakRefAction::noop),
"ripple::SharedWeakUnion::convertToStrong : "
"xrpl::SharedWeakUnion::convertToStrong : "
"action is noop");
unsafeSetRawPtr(p, RefStrength::strong);
return true;
@@ -637,7 +637,7 @@ SharedWeakUnion<T>::convertToWeak()
// We just added a weak ref. How could we destroy?
// LCOV_EXCL_START
UNREACHABLE(
"ripple::SharedWeakUnion::convertToWeak : destroying freshly "
"xrpl::SharedWeakUnion::convertToWeak : destroying freshly "
"added ref");
delete p;
unsafeSetRawPtr(nullptr);
@@ -719,5 +719,5 @@ SharedWeakUnion<T>::unsafeReleaseNoStore()
}
}
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -6,7 +6,7 @@
#include <atomic>
#include <cstdint>
namespace ripple {
namespace xrpl {
/** Action to perform when releasing a strong pointer.
@@ -34,7 +34,7 @@ enum class ReleaseWeakRefAction { noop, destroy };
/** Implement the strong count, weak count, and bit flags for an intrusive
pointer.
A class can satisfy the requirements of a ripple::IntrusivePointer by
A class can satisfy the requirements of a xrpl::IntrusivePointer by
inheriting from this class.
*/
struct IntrusiveRefCounts
@@ -257,7 +257,7 @@ IntrusiveRefCounts::releaseStrongRef() const
RefCountPair const prevVal{prevIntVal};
XRPL_ASSERT(
(prevVal.strong >= strongDelta),
"ripple::IntrusiveRefCounts::releaseStrongRef : previous ref "
"xrpl::IntrusiveRefCounts::releaseStrongRef : previous ref "
"higher than new");
auto nextIntVal = prevIntVal - strongDelta;
ReleaseStrongRefAction action = noop;
@@ -282,7 +282,7 @@ IntrusiveRefCounts::releaseStrongRef() const
// twice.
XRPL_ASSERT(
(action == noop) || !(prevIntVal & partialDestroyStartedMask),
"ripple::IntrusiveRefCounts::releaseStrongRef : not in partial "
"xrpl::IntrusiveRefCounts::releaseStrongRef : not in partial "
"destroy");
return action;
}
@@ -314,7 +314,7 @@ IntrusiveRefCounts::addWeakReleaseStrongRef() const
// can't happen twice.
XRPL_ASSERT(
(!prevVal.partialDestroyStartedBit),
"ripple::IntrusiveRefCounts::addWeakReleaseStrongRef : not in "
"xrpl::IntrusiveRefCounts::addWeakReleaseStrongRef : not in "
"partial destroy");
auto nextIntVal = prevIntVal + delta;
@@ -336,7 +336,7 @@ IntrusiveRefCounts::addWeakReleaseStrongRef() const
{
XRPL_ASSERT(
(!(prevIntVal & partialDestroyStartedMask)),
"ripple::IntrusiveRefCounts::addWeakReleaseStrongRef : not "
"xrpl::IntrusiveRefCounts::addWeakReleaseStrongRef : not "
"started partial destroy");
return action;
}
@@ -408,11 +408,11 @@ inline IntrusiveRefCounts::~IntrusiveRefCounts() noexcept
auto v = refCounts.load(std::memory_order_acquire);
XRPL_ASSERT(
(!(v & valueMask)),
"ripple::IntrusiveRefCounts::~IntrusiveRefCounts : count must be zero");
"xrpl::IntrusiveRefCounts::~IntrusiveRefCounts : count must be zero");
auto t = v & tagMask;
XRPL_ASSERT(
(!t || t == tagMask),
"ripple::IntrusiveRefCounts::~IntrusiveRefCounts : valid tag");
"xrpl::IntrusiveRefCounts::~IntrusiveRefCounts : valid tag");
#endif
}
@@ -427,7 +427,7 @@ inline IntrusiveRefCounts::RefCountPair::RefCountPair(
{
XRPL_ASSERT(
(strong < checkStrongMaxValue && weak < checkWeakMaxValue),
"ripple::IntrusiveRefCounts::RefCountPair(FieldType) : inputs inside "
"xrpl::IntrusiveRefCounts::RefCountPair(FieldType) : inputs inside "
"range");
}
@@ -438,7 +438,7 @@ inline IntrusiveRefCounts::RefCountPair::RefCountPair(
{
XRPL_ASSERT(
(strong < checkStrongMaxValue && weak < checkWeakMaxValue),
"ripple::IntrusiveRefCounts::RefCountPair(CountType, CountType) : "
"xrpl::IntrusiveRefCounts::RefCountPair(CountType, CountType) : "
"inputs inside range");
}
@@ -447,7 +447,7 @@ IntrusiveRefCounts::RefCountPair::combinedValue() const noexcept
{
XRPL_ASSERT(
(strong < checkStrongMaxValue && weak < checkWeakMaxValue),
"ripple::IntrusiveRefCounts::RefCountPair::combinedValue : inputs "
"xrpl::IntrusiveRefCounts::RefCountPair::combinedValue : inputs "
"inside range");
return (static_cast<IntrusiveRefCounts::FieldType>(weak)
<< IntrusiveRefCounts::StrongCountNumBits) |
@@ -465,7 +465,7 @@ partialDestructorFinished(T** o)
XRPL_ASSERT(
(!p.partialDestroyFinishedBit && p.partialDestroyStartedBit &&
!p.strong),
"ripple::partialDestructorFinished : not a weak ref");
"xrpl::partialDestructorFinished : not a weak ref");
if (!p.weak)
{
// There was a weak count before the partial destructor ran (or we would
@@ -479,5 +479,5 @@ partialDestructorFinished(T** o)
}
//------------------------------------------------------------------------------
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -4,10 +4,10 @@
#include <xrpl/basics/TaggedCache.h>
#include <xrpl/basics/base_uint.h>
namespace ripple {
namespace xrpl {
using KeyCache = TaggedCache<uint256, int, true>;
} // namespace ripple
} // namespace xrpl
#endif // XRPL_BASICS_KEYCACHE_H

View File

@@ -6,7 +6,7 @@
#include <memory>
#include <unordered_map>
namespace ripple {
namespace xrpl {
namespace detail {
@@ -109,6 +109,6 @@ LocalValue<T>::operator*()
.emplace(this, std::make_unique<detail::LocalValues::Value<T>>(t_))
.first->second->get());
}
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -13,7 +13,7 @@
#include <mutex>
#include <utility>
namespace ripple {
namespace xrpl {
// DEPRECATED use beast::severities::Severity instead
enum LogSeverity {
@@ -271,6 +271,6 @@ setDebugLogSink(std::unique_ptr<beast::Journal::Sink> sink);
beast::Journal
debugLog();
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -5,7 +5,7 @@
#include <cassert>
#include <cstddef>
namespace ripple {
namespace xrpl {
/** Calculate one number divided by another number in percentage.
* The result is rounded up to the next integer, and capped in the range [0,100]
@@ -44,6 +44,6 @@ static_assert(calculatePercent(50'000'000, 100'000'000) == 50);
static_assert(calculatePercent(50'000'001, 100'000'000) == 51);
static_assert(calculatePercent(99'999'999, 100'000'000) == 100);
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -6,7 +6,7 @@
#include <ostream>
#include <string>
namespace ripple {
namespace xrpl {
class Number;
@@ -339,6 +339,10 @@ abs(Number x) noexcept
Number
power(Number const& f, unsigned n);
// logarithm with base 10
Number
lg(Number const& value);
// Returns f^(1/d)
// Uses NewtonRaphson iterations until the result stops changing
// to find the root of the polynomial g(x) = x^d - f
@@ -402,6 +406,6 @@ public:
operator=(NumberRoundModeGuard const&) = delete;
};
} // namespace ripple
} // namespace xrpl
#endif // XRPL_BASICS_NUMBER_H_INCLUDED

View File

@@ -21,11 +21,11 @@ ripple/basic should contain no dependencies on other modules.
- `std::set`
- For sorted containers.
- `ripple::hash_set`
- `xrpl::hash_set`
- Where inserts and contains need to be O(1).
- For "small" sets, `std::set` might be faster and smaller.
- `ripple::hardened_hash_set`
- `xrpl::hardened_hash_set`
- For data sets where the key could be manipulated by an attacker
in an attempt to mount an algorithmic complexity attack: see
http://en.wikipedia.org/wiki/Algorithmic_complexity_attack
@@ -33,5 +33,5 @@ ripple/basic should contain no dependencies on other modules.
The following container is deprecated
- `std::unordered_set`
- Use `ripple::hash_set` instead, which uses a better hashing algorithm.
- Or use `ripple::hardened_hash_set` to prevent algorithmic complexity attacks.
- Use `xrpl::hash_set` instead, which uses a better hashing algorithm.
- Or use `xrpl::hardened_hash_set` to prevent algorithmic complexity attacks.

View File

@@ -11,7 +11,7 @@
#include <string>
#include <vector>
namespace ripple {
namespace xrpl {
/** A closed interval over the domain T.
@@ -85,7 +85,7 @@ to_string(RangeSet<T> const& rs)
std::string s;
for (auto const& interval : rs)
s += ripple::to_string(interval) + ",";
s += xrpl::to_string(interval) + ",";
s.pop_back();
return s;
@@ -172,6 +172,6 @@ prevMissing(RangeSet<T> const& rs, T t, T minVal = 0)
return boost::icl::last(tgt);
}
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -6,7 +6,7 @@
#include <functional>
#include <vector>
namespace ripple {
namespace xrpl {
class Resolver
{
@@ -47,6 +47,6 @@ public:
/** @} */
};
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -6,7 +6,7 @@
#include <boost/asio/io_context.hpp>
namespace ripple {
namespace xrpl {
class ResolverAsio : public Resolver
{
@@ -17,6 +17,6 @@ public:
New(boost::asio::io_context&, beast::Journal);
};
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -6,7 +6,7 @@
#include <ostream>
namespace ripple {
namespace xrpl {
// A SHAMapHash is the hash of a node in a SHAMap, and also the
// type of the hash of the entire SHAMap.
@@ -97,6 +97,6 @@ extract(SHAMapHash const& key)
return *reinterpret_cast<std::size_t const*>(key.as_uint256().data());
}
} // namespace ripple
} // namespace xrpl
#endif // XRPL_BASICS_SHAMAP_HASH_H_INCLUDED

View File

@@ -4,7 +4,7 @@
#include <memory>
#include <variant>
namespace ripple {
namespace xrpl {
/** A combination of a std::shared_ptr and a std::weak_pointer.
@@ -112,5 +112,5 @@ public:
private:
std::variant<std::shared_ptr<T>, std::weak_ptr<T>> combo_;
};
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -3,7 +3,7 @@
#include <xrpl/basics/SharedWeakCachePointer.h>
namespace ripple {
namespace xrpl {
template <class T>
SharedWeakCachePointer<T>::SharedWeakCachePointer(
SharedWeakCachePointer const& rhs) = default;
@@ -169,5 +169,5 @@ SharedWeakCachePointer<T>::convertToWeak()
return false;
}
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -22,7 +22,7 @@
#include <sys/mman.h>
#endif
namespace ripple {
namespace xrpl {
template <typename Type>
class SlabAllocator
@@ -128,7 +128,7 @@ class SlabAllocator
{
XRPL_ASSERT(
own(ptr),
"ripple::SlabAllocator::SlabBlock::deallocate : own input");
"xrpl::SlabAllocator::SlabBlock::deallocate : own input");
std::lock_guard l(m_);
@@ -173,7 +173,7 @@ public:
{
XRPL_ASSERT(
(itemAlignment_ & (itemAlignment_ - 1)) == 0,
"ripple::SlabAllocator::SlabAllocator : valid alignment");
"xrpl::SlabAllocator::SlabAllocator : valid alignment");
}
SlabAllocator(SlabAllocator const& other) = delete;
@@ -285,7 +285,7 @@ public:
{
XRPL_ASSERT(
ptr,
"ripple::SlabAllocator::SlabAllocator::deallocate : non-null "
"xrpl::SlabAllocator::SlabAllocator::deallocate : non-null "
"input");
for (auto slab = slabs_.load(); slab != nullptr; slab = slab->next_)
@@ -419,6 +419,6 @@ public:
}
};
} // namespace ripple
} // namespace xrpl
#endif // XRPL_BASICS_SLABALLOCATOR_H_INCLUDED

View File

@@ -15,7 +15,7 @@
#include <type_traits>
#include <vector>
namespace ripple {
namespace xrpl {
/** An immutable linear range of bytes.
@@ -87,7 +87,7 @@ public:
{
XRPL_ASSERT(
i < size_,
"ripple::Slice::operator[](std::size_t) const : valid input");
"xrpl::Slice::operator[](std::size_t) const : valid input");
return data_[i];
}
@@ -243,6 +243,6 @@ makeSlice(std::basic_string<char, Traits, Alloc> const& s)
return Slice(s.data(), s.size());
}
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -12,7 +12,7 @@
#include <optional>
#include <string>
namespace ripple {
namespace xrpl {
/** Format arbitrary binary data as an SQLite "blob literal".
@@ -132,6 +132,6 @@ to_uint64(std::string const& s);
bool
isProperlyFormedTomlDomain(std::string_view domain);
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -16,7 +16,7 @@
#include <type_traits>
#include <vector>
namespace ripple {
namespace xrpl {
/** Map/cache combination.
This class implements a cache and a map. The cache keeps objects alive
@@ -315,6 +315,6 @@ private:
std::uint64_t m_misses;
};
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -4,7 +4,7 @@
#include <xrpl/basics/IntrusivePointer.ipp>
#include <xrpl/basics/TaggedCache.h>
namespace ripple {
namespace xrpl {
template <
class Key,
@@ -1005,6 +1005,6 @@ TaggedCache<
});
}
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -4,7 +4,7 @@
#include <string>
#include <type_traits>
namespace ripple {
namespace xrpl {
/** to_string() generalizes std::to_string to handle bools, chars, and strings.
@@ -43,6 +43,6 @@ to_string(char const* s)
return s;
}
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -22,7 +22,7 @@
* what container it is.
*/
namespace ripple {
namespace xrpl {
// hash containers
@@ -102,6 +102,6 @@ template <
using hardened_hash_multiset =
std::unordered_multiset<Value, Hash, Pred, Allocator>;
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -6,7 +6,7 @@
#include <ratio>
#include <thread>
namespace ripple {
namespace xrpl {
/** Tracks program uptime to seconds precision.
@@ -45,6 +45,6 @@ private:
start_clock();
};
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -3,7 +3,7 @@
#include <utility>
namespace ripple {
namespace xrpl {
// Requires: [first1, last1) and [first2, last2) are ordered ranges according to
// comp.
@@ -95,6 +95,6 @@ remove_if_intersect_or_match(
return first1;
}
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -38,7 +38,7 @@
#include <cstdint>
#include <string>
namespace ripple {
namespace xrpl {
std::string
base64_encode(std::uint8_t const* data, std::size_t len);
@@ -53,6 +53,6 @@ base64_encode(std::string const& s)
std::string
base64_decode(std::string_view data);
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -23,7 +23,7 @@
#include <cstring>
#include <type_traits>
namespace ripple {
namespace xrpl {
namespace detail {
@@ -275,7 +275,7 @@ public:
{
XRPL_ASSERT(
c.size() * sizeof(typename Container::value_type) == size(),
"ripple::base_uint::base_uint(Container auto) : input size match");
"xrpl::base_uint::base_uint(Container auto) : input size match");
std::memcpy(data_.data(), c.data(), size());
}
@@ -288,7 +288,7 @@ public:
{
XRPL_ASSERT(
c.size() * sizeof(typename Container::value_type) == size(),
"ripple::base_uint::operator=(Container auto) : input size match");
"xrpl::base_uint::operator=(Container auto) : input size match");
std::memcpy(data_.data(), c.data(), size());
return *this;
}
@@ -648,12 +648,12 @@ static_assert(sizeof(uint192) == 192 / 8, "There should be no padding bytes");
static_assert(sizeof(uint256) == 256 / 8, "There should be no padding bytes");
#endif
} // namespace ripple
} // namespace xrpl
namespace beast {
template <std::size_t Bits, class Tag>
struct is_uniquely_represented<ripple::base_uint<Bits, Tag>>
struct is_uniquely_represented<xrpl::base_uint<Bits, Tag>>
: public std::true_type
{
explicit is_uniquely_represented() = default;

View File

@@ -12,7 +12,7 @@
#include <ratio>
#include <string>
namespace ripple {
namespace xrpl {
// A few handy aliases
@@ -104,6 +104,6 @@ stopwatch()
return beast::get_abstract_clock<Facade, Clock>();
}
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -3,7 +3,7 @@
#include <functional>
namespace ripple {
namespace xrpl {
#ifdef _MSC_VER
@@ -52,6 +52,6 @@ using equal_to = std::equal_to<T>;
#endif
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -7,7 +7,7 @@
#include <string>
#include <utility>
namespace ripple {
namespace xrpl {
/* Programming By Contract
@@ -52,6 +52,6 @@ Throw(Args&&... args)
[[noreturn]] void
LogicError(std::string const& how) noexcept;
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -9,7 +9,7 @@
#include <random>
#include <utility>
namespace ripple {
namespace xrpl {
namespace detail {
@@ -92,6 +92,6 @@ public:
}
};
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -3,7 +3,7 @@
#include <string>
namespace ripple {
namespace xrpl {
template <class Stream, class Iter>
Stream&
@@ -85,6 +85,6 @@ public:
}
};
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -5,7 +5,7 @@
#include <string>
namespace ripple {
namespace xrpl {
/** Create a self-signed SSL context that allows anonymous Diffie Hellman. */
std::shared_ptr<boost::asio::ssl::context>
@@ -19,6 +19,6 @@ make_SSLContextAuthed(
std::string const& chainFile,
std::string const& cipherList);
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -5,7 +5,7 @@
#include <limits>
#include <optional>
namespace ripple {
namespace xrpl {
auto constexpr muldiv_max = std::numeric_limits<std::uint64_t>::max();
/** Return value*mul/div accurately.
@@ -21,6 +21,6 @@ auto constexpr muldiv_max = std::numeric_limits<std::uint64_t>::max();
std::optional<std::uint64_t>
mulDiv(std::uint64_t value, std::uint64_t mul, std::uint64_t div);
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -12,7 +12,7 @@
#include <utility>
#include <vector>
namespace ripple {
namespace xrpl {
template <typename Key>
static std::size_t
@@ -242,7 +242,7 @@ public:
map_.resize(partitions_);
XRPL_ASSERT(
partitions_,
"ripple::partitioned_unordered_map::partitioned_unordered_map : "
"xrpl::partitioned_unordered_map::partitioned_unordered_map : "
"nonzero partitions");
}
@@ -401,6 +401,6 @@ private:
mutable partition_map_type map_{};
};
} // namespace ripple
} // namespace xrpl
#endif // XRPL_BASICS_PARTITIONED_UNORDERED_MAP_H

View File

@@ -11,7 +11,7 @@
#include <random>
#include <type_traits>
namespace ripple {
namespace xrpl {
#ifndef __INTELLISENSE__
static_assert(
@@ -95,7 +95,7 @@ std::enable_if_t<
Integral>
rand_int(Engine& engine, Integral min, Integral max)
{
XRPL_ASSERT(max > min, "ripple::rand_int : max over min inputs");
XRPL_ASSERT(max > min, "xrpl::rand_int : max over min inputs");
// This should have no state and constructing it should
// be very cheap. If that turns out not to be the case
@@ -186,6 +186,6 @@ rand_bool()
}
/** @} */
} // namespace ripple
} // namespace xrpl
#endif // XRPL_BASICS_RANDOM_H_INCLUDED

View File

@@ -3,7 +3,7 @@
#include <type_traits>
namespace ripple {
namespace xrpl {
// safe_cast adds compile-time checks to a static_cast to ensure that
// the destination can hold all values of the source. This is particularly
@@ -80,6 +80,6 @@ inline constexpr std::
return unsafe_cast<Dest>(static_cast<std::underlying_type_t<Src>>(s));
}
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -8,7 +8,7 @@
#include <type_traits>
#include <utility>
namespace ripple {
namespace xrpl {
// RAII scope helpers. As specified in Library Fundamental, Version 3
// Basic design of idea: https://www.youtube.com/watch?v=WjTrfoiB0MQ
@@ -218,7 +218,7 @@ public:
{
XRPL_ASSERT(
plock->owns_lock(),
"ripple::scope_unlock::scope_unlock : mutex must be locked");
"xrpl::scope_unlock::scope_unlock : mutex must be locked");
plock->unlock();
}
@@ -236,6 +236,6 @@ public:
template <class Mutex>
scope_unlock(std::unique_lock<Mutex>&) -> scope_unlock<Mutex>;
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -13,7 +13,7 @@
#include <immintrin.h>
#endif
namespace ripple {
namespace xrpl {
namespace detail {
/** Inform the processor that we are in a tight spin-wait loop.
@@ -105,7 +105,7 @@ public:
{
XRPL_ASSERT(
index >= 0 && (mask_ != 0),
"ripple::packed_spinlock::packed_spinlock : valid index and mask");
"xrpl::packed_spinlock::packed_spinlock : valid index and mask");
}
[[nodiscard]] bool
@@ -206,6 +206,6 @@ public:
};
/** @} */
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -4,7 +4,7 @@
#include <boost/algorithm/hex.hpp>
#include <boost/endian/conversion.hpp>
namespace ripple {
namespace xrpl {
template <class FwdIt>
std::string
@@ -28,6 +28,6 @@ strHex(T const& from)
return strHex(from.begin(), from.end());
}
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -10,7 +10,7 @@
#include <iostream>
#include <type_traits>
namespace ripple {
namespace xrpl {
/** A type-safe wrap around standard integral types
@@ -197,11 +197,11 @@ public:
}
};
} // namespace ripple
} // namespace xrpl
namespace beast {
template <class Int, class Tag, class HashAlgorithm>
struct is_contiguously_hashable<ripple::tagged_integer<Int, Tag>, HashAlgorithm>
struct is_contiguously_hashable<xrpl::tagged_integer<Int, Tag>, HashAlgorithm>
: public is_contiguously_hashable<Int, HashAlgorithm>
{
explicit is_contiguously_hashable() = default;

View File

@@ -8,7 +8,7 @@
#include <mutex>
#include <optional>
namespace ripple {
namespace xrpl {
/**
* The role of a `ClosureCounter` is to assist in shutdown by letting callers
@@ -202,6 +202,6 @@ public:
}
};
} // namespace ripple
} // namespace xrpl
#endif // XRPL_CORE_CLOSURE_COUNTER_H_INCLUDED

View File

@@ -3,7 +3,7 @@
#include <xrpl/basics/ByteUtilities.h>
namespace ripple {
namespace xrpl {
template <class F>
JobQueue::Coro::Coro(
@@ -34,7 +34,7 @@ JobQueue::Coro::Coro(
inline JobQueue::Coro::~Coro()
{
#ifndef NDEBUG
XRPL_ASSERT(finished_, "ripple::JobQueue::Coro::~Coro : is finished");
XRPL_ASSERT(finished_, "xrpl::JobQueue::Coro::~Coro : is finished");
#endif
}
@@ -85,8 +85,7 @@ JobQueue::Coro::resume()
detail::getLocalValues().reset(&lvs_);
std::lock_guard lock(mutex_);
XRPL_ASSERT(
static_cast<bool>(coro_),
"ripple::JobQueue::Coro::resume : is runnable");
static_cast<bool>(coro_), "xrpl::JobQueue::Coro::resume : is runnable");
coro_();
detail::getLocalValues().release();
detail::getLocalValues().reset(saved);
@@ -129,6 +128,6 @@ JobQueue::Coro::join()
cv_.wait(lk, [this]() { return running_ == false; });
}
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -7,7 +7,7 @@
#include <functional>
namespace ripple {
namespace xrpl {
// Note that this queue should only be used for CPU-bound jobs
// It is primarily intended for signature checking
@@ -131,6 +131,6 @@ private:
using JobCounter = ClosureCounter<void>;
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -12,7 +12,7 @@
#include <set>
namespace ripple {
namespace xrpl {
namespace perf {
class PerfLog;
@@ -382,11 +382,11 @@ private:
lock is released which only happens after the coroutine completes.
*/
} // namespace ripple
} // namespace xrpl
#include <xrpl/core/Coro.ipp>
namespace ripple {
namespace xrpl {
template <class F>
std::shared_ptr<JobQueue::Coro>
@@ -408,6 +408,6 @@ JobQueue::postCoro(JobType t, std::string const& name, F&& f)
return coro;
}
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -5,7 +5,7 @@
#include <xrpl/beast/insight/Collector.h>
#include <xrpl/core/JobTypeInfo.h>
namespace ripple {
namespace xrpl {
struct JobTypeData
{
@@ -83,6 +83,6 @@ public:
}
};
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -3,7 +3,7 @@
#include <xrpl/core/Job.h>
namespace ripple {
namespace xrpl {
/** Holds all the 'static' information about a job, which does not change */
class JobTypeInfo
@@ -78,6 +78,6 @@ public:
}
};
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -7,7 +7,7 @@
#include <map>
#include <string>
namespace ripple {
namespace xrpl {
class JobTypes
{
@@ -35,7 +35,7 @@ private:
std::chrono::milliseconds peakLatency) {
XRPL_ASSERT(
m_map.find(jt) == m_map.end(),
"ripple::JobTypes::JobTypes::add : unique job type input");
"xrpl::JobTypes::JobTypes::add : unique job type input");
[[maybe_unused]] auto const inserted =
m_map
@@ -48,7 +48,7 @@ private:
XRPL_ASSERT(
inserted == true,
"ripple::JobTypes::JobTypes::add : input is inserted");
"xrpl::JobTypes::JobTypes::add : input is inserted");
};
// clang-format off
@@ -122,7 +122,7 @@ public:
get(JobType jt) const
{
Map::const_iterator const iter(m_map.find(jt));
XRPL_ASSERT(iter != m_map.end(), "ripple::JobTypes::get : valid input");
XRPL_ASSERT(iter != m_map.end(), "xrpl::JobTypes::get : valid input");
if (iter != m_map.end())
return iter->second;
@@ -170,6 +170,6 @@ public:
Map m_map;
};
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -4,7 +4,7 @@
#include <chrono>
#include <string>
namespace ripple {
namespace xrpl {
class LoadMonitor;
@@ -65,6 +65,6 @@ private:
std::chrono::steady_clock::duration timeRunning_;
};
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -8,7 +8,7 @@
#include <chrono>
#include <mutex>
namespace ripple {
namespace xrpl {
// Monitors load levels and response times
@@ -67,6 +67,6 @@ private:
beast::Journal const j_;
};
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -17,7 +17,7 @@ namespace beast {
class Journal;
}
namespace ripple {
namespace xrpl {
class Application;
namespace perf {
@@ -187,6 +187,6 @@ measureDurationAndLog(
}
} // namespace perf
} // namespace ripple
} // namespace xrpl
#endif // XRPL_CORE_PERFLOG_H

View File

@@ -10,7 +10,7 @@
#include <string>
#include <thread>
namespace ripple {
namespace xrpl {
namespace perf {
class PerfLog;
@@ -214,6 +214,6 @@ private:
m_paused; // holds just paused workers
};
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -1,6 +1,6 @@
/**
*
* TODO: Remove ripple::basic_semaphore (and this file) and use
* TODO: Remove xrpl::basic_semaphore (and this file) and use
* std::counting_semaphore.
*
* Background:
@@ -32,7 +32,7 @@
#include <condition_variable>
#include <mutex>
namespace ripple {
namespace xrpl {
template <class Mutex, class CondVar>
class basic_semaphore
@@ -87,6 +87,6 @@ public:
using semaphore = basic_semaphore<std::mutex, std::condition_variable>;
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -4,7 +4,7 @@
#include <string>
#include <vector>
namespace ripple {
namespace xrpl {
class RFC1751
{
@@ -42,6 +42,6 @@ private:
static char const* s_dictionary[];
};
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -3,7 +3,7 @@
#include <mutex>
namespace ripple {
namespace xrpl {
/** A cryptographically secure random number engine
@@ -70,6 +70,6 @@ public:
csprng_engine&
crypto_prng();
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -3,7 +3,7 @@
#include <cstddef>
namespace ripple {
namespace xrpl {
/** Attempts to clear the given blob of memory.
@@ -22,6 +22,6 @@ namespace ripple {
void
secure_erase(void* dest, std::size_t bytes);
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -4,7 +4,7 @@
#include <xrpl/beast/utility/PropertyStream.h>
#include <xrpl/json/json_value.h>
namespace ripple {
namespace xrpl {
/** A PropertyStream::Sink which produces a Json::Value of type objectValue. */
class JsonPropertyStream : public beast::PropertyStream
@@ -66,6 +66,6 @@ protected:
add(std::string const& v) override;
};
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -1,445 +0,0 @@
#ifndef XRPL_JSON_OBJECT_H_INCLUDED
#define XRPL_JSON_OBJECT_H_INCLUDED
#include <xrpl/json/Writer.h>
#include <memory>
namespace Json {
/**
Collection is a base class for Array and Object, classes which provide the
facade of JSON collections for the O(1) JSON writer, while still using no
heap memory and only a very small amount of stack.
From http://json.org, JSON has two types of collection: array, and object.
Everything else is a *scalar* - a number, a string, a boolean, the special
value null, or a legacy Json::Value.
Collections must write JSON "as-it-goes" in order to get the strong
performance guarantees. This puts restrictions upon API users:
1. Only one collection can be open for change at any one time.
This condition is enforced automatically and a std::logic_error thrown if
it is violated.
2. A tag may only be used once in an Object.
Some objects have many tags, so this condition might be a little
expensive. Enforcement of this condition is turned on in debug builds and
a std::logic_error is thrown when the tag is added for a second time.
Code samples:
Writer writer;
// An empty object.
{
Object::Root (writer);
}
// Outputs {}
// An object with one scalar value.
{
Object::Root root (writer);
write["hello"] = "world";
}
// Outputs {"hello":"world"}
// Same, using chaining.
{
Object::Root (writer)["hello"] = "world";
}
// Output is the same.
// Add several scalars, with chaining.
{
Object::Root (writer)
.set ("hello", "world")
.set ("flag", false)
.set ("x", 42);
}
// Outputs {"hello":"world","flag":false,"x":42}
// Add an array.
{
Object::Root root (writer);
{
auto array = root.setArray ("hands");
array.append ("left");
array.append ("right");
}
}
// Outputs {"hands":["left", "right"]}
// Same, using chaining.
{
Object::Root (writer)
.setArray ("hands")
.append ("left")
.append ("right");
}
// Output is the same.
// Add an object.
{
Object::Root root (writer);
{
auto object = root.setObject ("hands");
object["left"] = false;
object["right"] = true;
}
}
// Outputs {"hands":{"left":false,"right":true}}
// Same, using chaining.
{
Object::Root (writer)
.setObject ("hands")
.set ("left", false)
.set ("right", true);
}
}
// Outputs {"hands":{"left":false,"right":true}}
Typical ways to make mistakes and get a std::logic_error:
Writer writer;
Object::Root root (writer);
// Repeat a tag.
{
root ["hello"] = "world";
root ["hello"] = "there"; // THROWS! in a debug build.
}
// Open a subcollection, then set something else.
{
auto object = root.setObject ("foo");
root ["hello"] = "world"; // THROWS!
}
// Open two subcollections at a time.
{
auto object = root.setObject ("foo");
auto array = root.setArray ("bar"); // THROWS!!
}
For more examples, check the unit tests.
*/
class Collection
{
public:
Collection(Collection&& c) noexcept;
Collection&
operator=(Collection&& c) noexcept;
Collection() = delete;
~Collection();
protected:
// A null parent means "no parent at all".
// Writers cannot be null.
Collection(Collection* parent, Writer*);
void
checkWritable(std::string const& label);
Collection* parent_;
Writer* writer_;
bool enabled_;
};
class Array;
//------------------------------------------------------------------------------
/** Represents a JSON object being written to a Writer. */
class Object : protected Collection
{
public:
/** Object::Root is the only Collection that has a public constructor. */
class Root;
/** Set a scalar value in the Object for a key.
A JSON scalar is a single value - a number, string, boolean, nullptr or
a Json::Value.
`set()` throws an exception if this object is disabled (which means that
one of its children is enabled).
In a debug build, `set()` also throws an exception if the key has
already been set() before.
An operator[] is provided to allow writing `object["key"] = scalar;`.
*/
template <typename Scalar>
void
set(std::string const& key, Scalar const&);
void
set(std::string const& key, Json::Value const&);
// Detail class and method used to implement operator[].
class Proxy;
Proxy
operator[](std::string const& key);
Proxy
operator[](Json::StaticString const& key);
/** Make a new Object at a key and return it.
This Object is disabled until that sub-object is destroyed.
Throws an exception if this Object was already disabled.
*/
Object
setObject(std::string const& key);
/** Make a new Array at a key and return it.
This Object is disabled until that sub-array is destroyed.
Throws an exception if this Object was already disabled.
*/
Array
setArray(std::string const& key);
protected:
friend class Array;
Object(Collection* parent, Writer* w) : Collection(parent, w)
{
}
};
class Object::Root : public Object
{
public:
/** Each Object::Root must be constructed with its own unique Writer. */
Root(Writer&);
};
//------------------------------------------------------------------------------
/** Represents a JSON array being written to a Writer. */
class Array : private Collection
{
public:
/** Append a scalar to the Arrary.
Throws an exception if this array is disabled (which means that one of
its sub-collections is enabled).
*/
template <typename Scalar>
void
append(Scalar const&);
/**
Appends a Json::Value to an array.
Throws an exception if this Array was disabled.
*/
void
append(Json::Value const&);
/** Append a new Object and return it.
This Array is disabled until that sub-object is destroyed.
Throws an exception if this Array was disabled.
*/
Object
appendObject();
/** Append a new Array and return it.
This Array is disabled until that sub-array is destroyed.
Throws an exception if this Array was already disabled.
*/
Array
appendArray();
protected:
friend class Object;
Array(Collection* parent, Writer* w) : Collection(parent, w)
{
}
};
//------------------------------------------------------------------------------
// Generic accessor functions to allow Json::Value and Collection to
// interoperate.
/** Add a new subarray at a named key in a Json object. */
Json::Value&
setArray(Json::Value&, Json::StaticString const& key);
/** Add a new subarray at a named key in a Json object. */
Array
setArray(Object&, Json::StaticString const& key);
/** Add a new subobject at a named key in a Json object. */
Json::Value&
addObject(Json::Value&, Json::StaticString const& key);
/** Add a new subobject at a named key in a Json object. */
Object
addObject(Object&, Json::StaticString const& key);
/** Append a new subarray to a Json array. */
Json::Value&
appendArray(Json::Value&);
/** Append a new subarray to a Json array. */
Array
appendArray(Array&);
/** Append a new subobject to a Json object. */
Json::Value&
appendObject(Json::Value&);
/** Append a new subobject to a Json object. */
Object
appendObject(Array&);
/** Copy all the keys and values from one object into another. */
void
copyFrom(Json::Value& to, Json::Value const& from);
/** Copy all the keys and values from one object into another. */
void
copyFrom(Object& to, Json::Value const& from);
/** An Object that contains its own Writer. */
class WriterObject
{
public:
WriterObject(Output const& output)
: writer_(std::make_unique<Writer>(output))
, object_(std::make_unique<Object::Root>(*writer_))
{
}
WriterObject(WriterObject&& other) = default;
Object*
operator->()
{
return object_.get();
}
Object&
operator*()
{
return *object_;
}
private:
std::unique_ptr<Writer> writer_;
std::unique_ptr<Object::Root> object_;
};
WriterObject
stringWriterObject(std::string&);
//------------------------------------------------------------------------------
// Implementation details.
// Detail class for Object::operator[].
class Object::Proxy
{
private:
Object& object_;
std::string const key_;
public:
Proxy(Object& object, std::string const& key);
template <class T>
void
operator=(T const& t)
{
object_.set(key_, t);
// Note: This function shouldn't return *this, because it's a trap.
//
// In Json::Value, foo[jss::key] returns a reference to a
// mutable Json::Value contained _inside_ foo. But in the case of
// Json::Object, where we write once only, there isn't any such
// reference that can be returned. Returning *this would return an
// object "a level higher" than in Json::Value, leading to obscure bugs,
// particularly in generic code.
}
};
//------------------------------------------------------------------------------
template <typename Scalar>
void
Array::append(Scalar const& value)
{
checkWritable("append");
if (writer_)
writer_->append(value);
}
template <typename Scalar>
void
Object::set(std::string const& key, Scalar const& value)
{
checkWritable("set");
if (writer_)
writer_->set(key, value);
}
inline Json::Value&
setArray(Json::Value& json, Json::StaticString const& key)
{
return (json[key] = Json::arrayValue);
}
inline Array
setArray(Object& json, Json::StaticString const& key)
{
return json.setArray(std::string(key));
}
inline Json::Value&
addObject(Json::Value& json, Json::StaticString const& key)
{
return (json[key] = Json::objectValue);
}
inline Object
addObject(Object& object, Json::StaticString const& key)
{
return object.setObject(std::string(key));
}
inline Json::Value&
appendArray(Json::Value& json)
{
return json.append(Json::arrayValue);
}
inline Array
appendArray(Array& json)
{
return json.appendArray();
}
inline Json::Value&
appendObject(Json::Value& json)
{
return json.append(Json::objectValue);
}
inline Object
appendObject(Array& json)
{
return json.appendObject();
}
} // namespace Json
#endif

View File

@@ -234,7 +234,7 @@ inline void
check(bool condition, std::string const& message)
{
if (!condition)
ripple::Throw<std::logic_error>(message);
xrpl::Throw<std::logic_error>(message);
}
} // namespace Json

View File

@@ -6,6 +6,6 @@
#define JSON_ASSERT_MESSAGE(condition, message) \
if (!(condition)) \
ripple::Throw<Json::error>(message);
xrpl::Throw<Json::error>(message);
#endif

View File

@@ -199,7 +199,7 @@ public:
Value(UInt value);
Value(double value);
Value(char const* value);
Value(ripple::Number const& value);
Value(xrpl::Number const& value);
/** \brief Constructs a value from a static string.
* Like other value string constructor but do not duplicate the string for
@@ -430,7 +430,7 @@ private:
};
inline Value
to_json(ripple::Number const& number)
to_json(xrpl::Number const& number)
{
return to_string(number);
}

View File

@@ -6,7 +6,7 @@
#include <xrpl/ledger/RawView.h>
#include <xrpl/ledger/ReadView.h>
namespace ripple {
namespace xrpl {
enum ApplyFlags : std::uint32_t {
tapNONE = 0x00,
@@ -267,7 +267,7 @@ public:
{
// LCOV_EXCL_START
UNREACHABLE(
"ripple::ApplyView::dirAppend : only Offers are appended to "
"xrpl::ApplyView::dirAppend : only Offers are appended to "
"book directories");
// Only Offers are appended to book directories. Call dirInsert()
// instead
@@ -407,6 +407,6 @@ insertPage(
std::function<void(std::shared_ptr<SLE> const&)> const& describe);
} // namespace directory
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -6,7 +6,7 @@
#include <xrpl/protocol/STAmount.h>
#include <xrpl/protocol/TER.h>
namespace ripple {
namespace xrpl {
/** Editable, discardable view that can build metadata for one tx.
@@ -55,6 +55,18 @@ public:
deliver_ = amount;
}
void
setGasUsed(std::optional<std::uint32_t> const gasUsed)
{
gasUsed_ = gasUsed;
}
void
setWasmReturnCode(std::int32_t const wasmReturnCode)
{
wasmReturnCode_ = wasmReturnCode;
}
/** Get the number of modified entries
*/
std::size_t
@@ -73,8 +85,10 @@ public:
private:
std::optional<STAmount> deliver_;
std::optional<std::uint32_t> gasUsed_;
std::optional<std::int32_t> wasmReturnCode_;
};
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -4,7 +4,7 @@
#include <xrpl/beast/utility/Journal.h>
#include <xrpl/ledger/ReadView.h>
namespace ripple {
namespace xrpl {
class BookDirs
{
@@ -89,6 +89,6 @@ private:
static beast::Journal j_;
};
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -5,7 +5,7 @@
#include <xrpl/basics/base_uint.h>
#include <xrpl/protocol/STLedgerEntry.h>
namespace ripple {
namespace xrpl {
using CachedSLEs = TaggedCache<uint256, SLE const>;
}

View File

@@ -8,7 +8,7 @@
#include <mutex>
#include <type_traits>
namespace ripple {
namespace xrpl {
namespace detail {
@@ -164,6 +164,6 @@ public:
}
};
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -11,7 +11,7 @@
#include <xrpl/protocol/STTx.h>
#include <xrpl/protocol/TER.h>
namespace ripple {
namespace xrpl {
namespace credentials {
// These function will be used by the code that use DepositPreauth / Credentials
@@ -93,6 +93,6 @@ verifyDepositPreauth(
std::shared_ptr<SLE> const& sleDst,
beast::Journal j);
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -4,7 +4,7 @@
#include <xrpl/ledger/ReadView.h>
#include <xrpl/protocol/Indexes.h>
namespace ripple {
namespace xrpl {
/** A class that simplifies iterating ledger directory pages
@@ -108,6 +108,6 @@ private:
std::vector<uint256>::const_iterator it_;
};
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -13,7 +13,7 @@
#include <functional>
#include <utility>
namespace ripple {
namespace xrpl {
/** Open ledger construction tag.
@@ -252,6 +252,6 @@ public:
std::shared_ptr<Serializer const> const& metaData) override;
};
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -0,0 +1,105 @@
//------------------------------------------------------------------------------
/*
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_LEDGER_OPENVIEWSANDBOX_H_INCLUDED
#define RIPPLE_LEDGER_OPENVIEWSANDBOX_H_INCLUDED
#include <xrpl/ledger/OpenView.h>
#include <memory>
namespace xrpl {
class OpenViewSandbox
{
private:
OpenView& parent_;
std::unique_ptr<OpenView> sandbox_;
public:
using key_type = ReadView::key_type;
OpenViewSandbox(OpenView& parent)
: parent_(parent)
, sandbox_(std::make_unique<OpenView>(batch_view, parent))
{
}
void
rawErase(std::shared_ptr<SLE> const& sle)
{
sandbox_->rawErase(sle);
}
void
rawInsert(std::shared_ptr<SLE> const& sle)
{
sandbox_->rawInsert(sle);
}
void
rawReplace(std::shared_ptr<SLE> const& sle)
{
sandbox_->rawReplace(sle);
}
void
rawDestroyXRP(XRPAmount const& fee)
{
sandbox_->rawDestroyXRP(fee);
}
void
rawTxInsert(
key_type const& key,
std::shared_ptr<Serializer const> const& txn,
std::shared_ptr<Serializer const> const& metaData)
{
sandbox_->rawTxInsert(key, txn, metaData);
}
void
commit()
{
sandbox_->apply(parent_);
sandbox_ = std::make_unique<OpenView>(batch_view, parent_);
}
void
discard()
{
sandbox_ = std::make_unique<OpenView>(batch_view, parent_);
}
OpenView const&
view() const
{
return *sandbox_;
}
OpenView&
view()
{
return *sandbox_;
}
};
} // namespace xrpl
#endif

View File

@@ -8,7 +8,7 @@
#include <map>
namespace ripple {
namespace xrpl {
namespace detail {
@@ -188,6 +188,6 @@ private:
PaymentSandbox const* ps_ = nullptr;
};
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -5,7 +5,7 @@
#include <xrpl/protocol/STLedgerEntry.h>
#include <xrpl/protocol/Serializer.h>
namespace ripple {
namespace xrpl {
/** Interface for ledger entry changes.
@@ -87,6 +87,6 @@ public:
std::shared_ptr<Serializer const> const& metaData) = 0;
};
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -18,7 +18,7 @@
#include <optional>
#include <unordered_set>
namespace ripple {
namespace xrpl {
//------------------------------------------------------------------------------
@@ -258,7 +258,7 @@ makeRulesGivenLedger(
DigestAwareReadView const& ledger,
std::unordered_set<uint256, beast::uhash<>> const& presets);
} // namespace ripple
} // namespace xrpl
#include <xrpl/ledger/detail/ReadViewFwdRange.ipp>

View File

@@ -4,7 +4,7 @@
#include <xrpl/ledger/RawView.h>
#include <xrpl/ledger/detail/ApplyViewBase.h>
namespace ripple {
namespace xrpl {
/** Discardable, editable view to a ledger.
@@ -39,6 +39,6 @@ public:
}
};
} // namespace ripple
} // namespace xrpl
#endif

View File

@@ -20,7 +20,7 @@
#include <map>
#include <utility>
namespace ripple {
namespace xrpl {
enum class WaiveTransferFee : bool { No = false, Yes };
enum class SkipEntry : bool { No = false, Yes };
@@ -1083,6 +1083,41 @@ enforceMPTokenAuthorization(
XRPAmount const& priorBalance,
beast::Journal j);
enum class SendIssuerHandling {
ihSENDER_NOT_ALLOWED,
ihRECEIVER_NOT_ALLOWED,
ihIGNORE
};
enum class SendEscrowHandling { ehIGNORE, ehCHECK };
enum class SendAuthHandling {
ahCHECK_SENDER,
ahCHECK_RECEIVER,
ahBOTH,
ahNEITHER
};
enum class SendFreezeHandling {
fhCHECK_SENDER,
fhCHECK_RECEIVER,
fhBOTH,
fhNEITHER
};
enum class SendTransferHandling { thIGNORE, thCHECK };
enum class SendBalanceHandling { bhIGNORE, bhCHECK };
TER
canTransferFT(
ReadView const& view,
AccountID const& sender,
AccountID const& receiver,
STAmount const& amount,
beast::Journal j,
SendIssuerHandling issuerHandling,
SendEscrowHandling escrowHandling,
SendAuthHandling authHandling,
SendFreezeHandling freezeHandling,
SendTransferHandling transferHandling,
SendBalanceHandling balanceHandling);
/** Check if the destination account is allowed
* to receive MPT. Return tecNO_AUTH if it doesn't
* and tesSUCCESS otherwise.
@@ -1197,6 +1232,6 @@ sharesToAssetsWithdraw(
bool
after(NetClock::time_point now, std::uint32_t mark);
} // namespace ripple
} // namespace xrpl
#endif

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