Compare commits

..

10 Commits

Author SHA1 Message Date
Bart
7b00f1d600 Merge branch 'bthomee/rename_binary' into bthomee/rename_namespace 2025-11-14 17:08:32 -05:00
Bart
690dced2c8 Merge branch 'develop' into bthomee/rename_binary 2025-11-14 16:52:48 -05:00
Bart
b0556e1ee1 Merge branch 'bthomee/rename_binary' into bthomee/rename_namespace 2025-11-10 11:52:48 -05:00
Bart
3faff9f7a6 Merge branch 'develop' into bthomee/rename_binary 2025-11-10 11:51:28 -05:00
Bart
09c61d6fc4 refactor: Rename ripple namespace to xrpl 2025-11-10 11:49:19 -05:00
Bart
7141781db4 Restore changes to CI pipeline undone by other PR 2025-11-10 11:47:04 -05:00
Bart
802ac5629f Merge branch 'develop' into bthomee/rename_binary 2025-11-10 11:06:01 -05:00
Bart
2f15909ffa Reverse symlink 2025-11-07 11:08:44 +00:00
Bart
9184b7274c Fix comments 2025-11-07 11:04:23 +00:00
Bart
54a19a0e8d refactor: Rename rippled binary to xrpld 2025-11-07 11:02:05 +00:00
1300 changed files with 5239 additions and 32956 deletions

6
.github/CODEOWNERS vendored
View File

@@ -1,2 +1,8 @@
# Allow anyone to review any change by default. # 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

@@ -35,7 +35,6 @@ runs:
LOG_VERBOSITY: ${{ inputs.log_verbosity }} LOG_VERBOSITY: ${{ inputs.log_verbosity }}
run: | run: |
echo 'Installing dependencies.' echo 'Installing dependencies.'
conan export --version 0.42.1 external/wasmi #TODO Switch to conan package
mkdir -p "${BUILD_DIR}" mkdir -p "${BUILD_DIR}"
cd "${BUILD_DIR}" cd "${BUILD_DIR}"
conan install \ conan install \

View File

@@ -26,6 +26,11 @@ run from the repository root.
references to `ripple` and `rippled` (with or without capital letters) to references to `ripple` and `rippled` (with or without capital letters) to
`xrpl` and `xrpld`, respectively. The name of the binary will remain as-is, `xrpl` and `xrpld`, respectively. The name of the binary will remain as-is,
and will only be renamed to `xrpld` by a later script. and will only be renamed to `xrpld` by a later script.
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: You can run all these scripts from the repository root as follows:
@@ -33,4 +38,6 @@ You can run all these scripts from the repository root as follows:
./.github/scripts/rename/definitions.sh . ./.github/scripts/rename/definitions.sh .
./.github/scripts/rename/copyright.sh . ./.github/scripts/rename/copyright.sh .
./.github/scripts/rename/cmake.sh . ./.github/scripts/rename/cmake.sh .
./.github/scripts/rename/binary.sh .
./.github/scripts/rename/namespace.sh .
``` ```

42
.github/scripts/rename/binary.sh vendored Executable file
View File

@@ -0,0 +1,42 @@
#!/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 changes the binary name from `rippled` to `xrpld`, and reverses
# the symlink that currently points from `xrpld` to `rippled` so that it points
# from `rippled` to `xrpld` instead.
# Usage: .github/scripts/rename/binary.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}
# Remove the binary name override added by the cmake.sh script.
${SED_COMMAND} -z -i -E 's@\s+# For the time being.+"rippled"\)@@' cmake/XrplCore.cmake
# Reverse the symlink.
${SED_COMMAND} -i -E 's@create_symbolic_link\(rippled@create_symbolic_link(xrpld@' cmake/XrplInstall.cmake
${SED_COMMAND} -i -E 's@/xrpld\$\{suffix\}@/rippled${suffix}@' cmake/XrplInstall.cmake
popd
echo "Processing complete."

View File

@@ -70,6 +70,9 @@ fi
if ! grep -q 'Dev Null' src/test/app/tx/apply_test.cpp; then if ! grep -q 'Dev Null' src/test/app/tx/apply_test.cpp; then
echo -e "// Copyright (c) 2020 Dev Null Productions\n\n$(cat src/test/app/tx/apply_test.cpp)" > src/test/app/tx/apply_test.cpp echo -e "// Copyright (c) 2020 Dev Null Productions\n\n$(cat src/test/app/tx/apply_test.cpp)" > src/test/app/tx/apply_test.cpp
fi fi
if ! grep -q 'Dev Null' src/test/app/NetworkOPs_test.cpp; then
echo -e "// Copyright (c) 2020 Dev Null Productions\n\n$(cat src/test/app/NetworkOPs_test.cpp)" > src/test/app/NetworkOPs_test.cpp
fi
if ! grep -q 'Dev Null' src/test/rpc/ManifestRPC_test.cpp; then if ! grep -q 'Dev Null' src/test/rpc/ManifestRPC_test.cpp; then
echo -e "// Copyright (c) 2020 Dev Null Productions\n\n$(cat src/test/rpc/ManifestRPC_test.cpp)" > src/test/rpc/ManifestRPC_test.cpp echo -e "// Copyright (c) 2020 Dev Null Productions\n\n$(cat src/test/rpc/ManifestRPC_test.cpp)" > src/test/rpc/ManifestRPC_test.cpp
fi fi

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

@@ -0,0 +1,54 @@
#!/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.
# 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}"
done
done
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

@@ -130,8 +130,8 @@ def generate_strategy_matrix(all: bool, config: Config) -> list:
if os['distro_name'] == 'rhel' and architecture['platform'] == 'linux/arm64': if os['distro_name'] == 'rhel' and architecture['platform'] == 'linux/arm64':
continue continue
# We skip all clang 20+ on arm64 due to Boost build error. # We skip all clang-20 on arm64 due to boost 1.86 build error
if f'{os['compiler_name']}-{os['compiler_version']}' in ['clang-20', 'clang-21'] and architecture['platform'] == 'linux/arm64': if f'{os['compiler_name']}-{os['compiler_version']}' == 'clang-20' and architecture['platform'] == 'linux/arm64':
continue continue
# Enable code coverage for Debian Bookworm using GCC 15 in Debug and no # Enable code coverage for Debian Bookworm using GCC 15 in Debug and no

View File

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

View File

@@ -77,7 +77,7 @@ jobs:
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
- name: Prepare runner - name: Prepare runner
uses: XRPLF/actions/.github/actions/prepare-runner@ff9f8f649df5855ffe1a1ae715df43e51807f2e0 uses: XRPLF/actions/.github/actions/prepare-runner@99685816bb60a95a66852f212f382580e180df3a
with: with:
disable_ccache: false disable_ccache: false
@@ -129,14 +129,14 @@ jobs:
--parallel "${BUILD_NPROC}" \ --parallel "${BUILD_NPROC}" \
--target "${CMAKE_TARGET}" --target "${CMAKE_TARGET}"
- name: Upload rippled artifact (Linux) - name: Upload the binary (Linux)
if: ${{ github.repository_owner == 'XRPLF' && runner.os == 'Linux' }} if: ${{ runner.os == 'Linux' }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
env: env:
BUILD_DIR: ${{ inputs.build_dir }} BUILD_DIR: ${{ inputs.build_dir }}
with: with:
name: rippled-${{ inputs.config_name }} name: xrpld-${{ inputs.config_name }}
path: ${{ env.BUILD_DIR }}/rippled path: ${{ env.BUILD_DIR }}/xrpld
retention-days: 3 retention-days: 3
if-no-files-found: error if-no-files-found: error
@@ -144,8 +144,8 @@ jobs:
if: ${{ runner.os == 'Linux' }} if: ${{ runner.os == 'Linux' }}
working-directory: ${{ inputs.build_dir }} working-directory: ${{ inputs.build_dir }}
run: | run: |
ldd ./rippled ldd ./xrpld
if [ "$(ldd ./rippled | grep -E '(libstdc\+\+|libgcc)' | wc -l)" -eq 0 ]; then if [ "$(ldd ./xrpld | grep -E '(libstdc\+\+|libgcc)' | wc -l)" -eq 0 ]; then
echo 'The binary is statically linked.' echo 'The binary is statically linked.'
else else
echo 'The binary is dynamically linked.' echo 'The binary is dynamically linked.'
@@ -156,7 +156,7 @@ jobs:
if: ${{ runner.os == 'Linux' && env.ENABLED_VOIDSTAR == 'true' }} if: ${{ runner.os == 'Linux' && env.ENABLED_VOIDSTAR == 'true' }}
working-directory: ${{ inputs.build_dir }} working-directory: ${{ inputs.build_dir }}
run: | run: |
./rippled --version | grep libvoidstar ./xrpld --version | grep libvoidstar
- name: Run the separate tests - name: Run the separate tests
if: ${{ !inputs.build_only }} if: ${{ !inputs.build_only }}
@@ -177,7 +177,7 @@ jobs:
env: env:
BUILD_NPROC: ${{ steps.nproc.outputs.nproc }} BUILD_NPROC: ${{ steps.nproc.outputs.nproc }}
run: | run: |
./rippled --unittest --unittest-jobs "${BUILD_NPROC}" ./xrpld --unittest --unittest-jobs "${BUILD_NPROC}"
- name: Debug failure (Linux) - name: Debug failure (Linux)
if: ${{ failure() && runner.os == 'Linux' && !inputs.build_only }} if: ${{ failure() && runner.os == 'Linux' && !inputs.build_only }}

View File

@@ -25,7 +25,7 @@ jobs:
env: env:
MESSAGE: | MESSAGE: |
The dependency relationships between the modules in rippled have The dependency relationships between the modules in xrpld have
changed, which may be an improvement or a regression. changed, which may be an improvement or a regression.
A rule of thumb is that if your changes caused something to be A rule of thumb is that if your changes caused something to be

View File

@@ -25,6 +25,10 @@ jobs:
run: .github/scripts/rename/copyright.sh . run: .github/scripts/rename/copyright.sh .
- name: Check CMake configs - name: Check CMake configs
run: .github/scripts/rename/cmake.sh . 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 - name: Check for differences
env: env:
MESSAGE: | MESSAGE: |

View File

@@ -70,7 +70,7 @@ jobs:
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
- name: Prepare runner - name: Prepare runner
uses: XRPLF/actions/.github/actions/prepare-runner@ff9f8f649df5855ffe1a1ae715df43e51807f2e0 uses: XRPLF/actions/.github/actions/prepare-runner@99685816bb60a95a66852f212f382580e180df3a
with: with:
disable_ccache: false disable_ccache: false

View File

@@ -144,7 +144,6 @@ git fetch origin master
git checkout master git checkout master
conan export --version 1.1.10 recipes/snappy/all conan export --version 1.1.10 recipes/snappy/all
conan export --version 4.0.3 recipes/soci/all conan export --version 4.0.3 recipes/soci/all
conan export --version 0.42.1 external/wasmi
rm -rf .git rm -rf .git
``` ```

View File

@@ -119,7 +119,6 @@ endif()
find_package(nudb REQUIRED) find_package(nudb REQUIRED)
find_package(date REQUIRED) find_package(date REQUIRED)
find_package(wasmi REQUIRED)
find_package(xxHash REQUIRED) find_package(xxHash REQUIRED)
target_link_libraries(xrpl_libs INTERFACE target_link_libraries(xrpl_libs INTERFACE

View File

@@ -299,7 +299,7 @@ For this reason:
- Example **bad** name - Example **bad** name
`"RFC1751::insert(char* s, int x, int start, int length) : length is greater than or equal zero"` `"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). (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 - 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`) 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 - Do **not** rename a contract without a good reason (e.g. the name no longer

View File

@@ -63,7 +63,6 @@ target_link_libraries(xrpl.imports.main
Xrpl::opts Xrpl::opts
Xrpl::syslibs Xrpl::syslibs
secp256k1::secp256k1 secp256k1::secp256k1
wasmi::wasmi
xrpl.libpb xrpl.libpb
xxHash::xxhash xxHash::xxhash
$<$<BOOL:${voidstar}>:antithesis-sdk-cpp> $<$<BOOL:${voidstar}>:antithesis-sdk-cpp>
@@ -224,6 +223,4 @@ if(xrpld)
src/test/ledger/Invariants_test.cpp src/test/ledger/Invariants_test.cpp
PROPERTIES SKIP_UNITY_BUILD_INCLUSION TRUE) PROPERTIES SKIP_UNITY_BUILD_INCLUSION TRUE)
endif() endif()
# For the time being, we will keep the name of the binary as it was.
set_target_properties(xrpld PROPERTIES OUTPUT_NAME "rippled")
endif() endif()

View File

@@ -67,8 +67,8 @@ if (is_root_project AND TARGET xrpld)
install(CODE " install(CODE "
set(CMAKE_MODULE_PATH \"${CMAKE_MODULE_PATH}\") set(CMAKE_MODULE_PATH \"${CMAKE_MODULE_PATH}\")
include(create_symbolic_link) include(create_symbolic_link)
create_symbolic_link(rippled${suffix} \ create_symbolic_link(xrpld${suffix} \
\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/xrpld${suffix}) \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/rippled${suffix})
") ")
endif () endif ()

62
conan.lock Normal file
View File

@@ -0,0 +1,62 @@
{
"version": "0.5",
"requires": [
"zlib/1.3.1#b8bc2603263cf7eccbd6e17e66b0ed76%1756234269.497",
"xxhash/0.8.3#681d36a0a6111fc56e5e45ea182c19cc%1756234289.683",
"sqlite3/3.49.1#8631739a4c9b93bd3d6b753bac548a63%1756234266.869",
"soci/4.0.3#a9f8d773cd33e356b5879a4b0564f287%1756234262.318",
"snappy/1.1.10#968fef506ff261592ec30c574d4a7809%1756234314.246",
"rocksdb/10.5.1#4a197eca381a3e5ae8adf8cffa5aacd0%1762797952.535",
"re2/20230301#dfd6e2bf050eb90ddd8729cfb4c844a4%1756234257.976",
"protobuf/3.21.12#d927114e28de9f4691a6bbcdd9a529d1%1756234251.614",
"openssl/3.5.4#a1d5835cc6ed5c5b8f3cd5b9b5d24205%1760106486.594",
"nudb/2.0.9#fb8dfd1a5557f5e0528114c2da17721e%1763150366.909",
"lz4/1.10.0#59fc63cac7f10fbe8e05c7e62c2f3504%1756234228.999",
"libiconv/1.17#1e65319e945f2d31941a9d28cc13c058%1756223727.64",
"libbacktrace/cci.20210118#a7691bfccd8caaf66309df196790a5a1%1756230911.03",
"libarchive/3.8.1#5cf685686322e906cb42706ab7e099a8%1756234256.696",
"jemalloc/5.3.0#e951da9cf599e956cebc117880d2d9f8%1729241615.244",
"grpc/1.50.1#02291451d1e17200293a409410d1c4e1%1756234248.958",
"doctest/2.4.12#eb9fb352fb2fdfc8abb17ec270945165%1762797941.757",
"date/3.0.4#f74bbba5a08fa388256688743136cb6f%1756234217.493",
"c-ares/1.34.5#b78b91e7cfb1f11ce777a285bbf169c6%1756234217.915",
"bzip2/1.0.8#00b4a4658791c1f06914e087f0e792f5%1756234261.716",
"boost/1.88.0#8852c0b72ce8271fb8ff7c53456d4983%1756223752.326",
"abseil/20230802.1#f0f91485b111dc9837a68972cb19ca7b%1756234220.907"
],
"build_requires": [
"zlib/1.3.1#b8bc2603263cf7eccbd6e17e66b0ed76%1756234269.497",
"strawberryperl/5.32.1.1#707032463aa0620fa17ec0d887f5fe41%1756234281.733",
"protobuf/3.21.12#d927114e28de9f4691a6bbcdd9a529d1%1756234251.614",
"nasm/2.16.01#31e26f2ee3c4346ecd347911bd126904%1756234232.901",
"msys2/cci.latest#5b73b10144f73cc5bfe0572ed9be39e1%1751977009.857",
"m4/1.4.19#f119296e5c4772b3bb7ab060ae8f417b%1760707875.678",
"cmake/3.31.8#dde3bde00bb843687e55aea5afa0e220%1756234232.89",
"b2/5.3.3#107c15377719889654eb9a162a673975%1756234226.28",
"automake/1.16.5#b91b7c384c3deaa9d535be02da14d04f%1755524470.56",
"autoconf/2.71#51077f068e61700d65bb05541ea1e4b0%1731054366.86"
],
"python_requires": [],
"overrides": {
"protobuf/3.21.12": [
null,
"protobuf/3.21.12"
],
"lz4/1.9.4": [
"lz4/1.10.0"
],
"boost/1.83.0": [
"boost/1.88.0"
],
"sqlite3/[>=3.44 <4]": [
"sqlite3/3.49.1"
],
"lz4/[>=1.9.4 <2]": [
"lz4/1.10.0#59fc63cac7f10fbe8e05c7e62c2f3504"
],
"sqlite3/3.44.2": [
"sqlite3/3.49.1"
]
},
"config_requires": []
}

View File

@@ -2,7 +2,6 @@ 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
class Xrpl(ConanFile): class Xrpl(ConanFile):
name = 'xrpl' name = 'xrpl'
@@ -30,7 +29,6 @@ class Xrpl(ConanFile):
'nudb/2.0.9', 'nudb/2.0.9',
'openssl/3.5.4', 'openssl/3.5.4',
'soci/4.0.3', 'soci/4.0.3',
'wasmi/0.42.1',
'zlib/1.3.1', 'zlib/1.3.1',
] ]
@@ -135,7 +133,6 @@ class Xrpl(ConanFile):
self.folders.generators = 'build/generators' self.folders.generators = 'build/generators'
generators = 'CMakeDeps' generators = 'CMakeDeps'
def generate(self): def generate(self):
tc = CMakeToolchain(self) tc = CMakeToolchain(self)
tc.variables['tests'] = self.options.tests tc.variables['tests'] = self.options.tests
@@ -193,7 +190,6 @@ class Xrpl(ConanFile):
'protobuf::libprotobuf', 'protobuf::libprotobuf',
'soci::soci', 'soci::soci',
'sqlite3::sqlite', 'sqlite3::sqlite',
'wasmi::wasmi',
'xxhash::xxhash', 'xxhash::xxhash',
'zlib::zlib', 'zlib::zlib',
] ]

View File

@@ -541,7 +541,7 @@ SECP256K1_API int secp256k1_ecdsa_signature_serialize_compact(
/** Verify an ECDSA signature. /** Verify an ECDSA signature.
* *
* Returns: 1: correct signature * Returns: 1: correct signature
* 0: incorrect or unparsable signature * 0: incorrect or unparseable signature
* Args: ctx: pointer to a context object * Args: ctx: pointer to a context object
* In: sig: the signature being verified. * In: sig: the signature being verified.
* msghash32: the 32-byte message hash being verified. * msghash32: the 32-byte message hash being verified.

View File

@@ -1,11 +0,0 @@
# Do not update. Maintained by programmability team.
sources:
"0.42.1":
sha256: 2a5697be33c7afce8f671af4a5a3621d9e93ce55d253d31bd8201458e465fbb8
url: https://github.com/wasmi-labs/wasmi/archive/refs/tags/v0.42.1.tar.gz
patches:
"0.42.1":
- patch_file: "patches/0001-xrplf-0.42.1.patch"
patch_type: conan
patch_description: Integration patch. Make wasmi lib to be able to build with existing smart-escrow branch.

View File

@@ -1,48 +0,0 @@
from conan import ConanFile, tools
from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout
from conan.tools.files import apply_conandata_patches, export_conandata_patches, get
import os
required_conan_version = ">=2.0.0"
class WasmiConan(ConanFile):
name = "wasmi"
license = "Apache License v2.0"
url = "https://github.com/wasmi-labs/wasmi.git"
description = "WebAssembly (Wasm) interpreter"
package_type = "library"
settings = "os", "arch", "compiler", "build_type"
options = {"shared": [False]}
default_options = {"shared": False}
def export_sources(self):
export_conandata_patches(self)
def layout(self):
cmake_layout(self, src_folder="src")
def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
apply_conandata_patches(self)
def generate(self):
tc = CMakeToolchain(self)
tc.variables["BUILD_SHARED_LIBS"] = self.options.shared
tc.generate()
deps = CMakeDeps(self)
deps.generate()
def build(self):
cmake = CMake(self)
cmake.configure(build_script_folder=os.path.join(self.source_folder, "crates", "c_api"))
cmake.build()
def package(self):
cmake = CMake(self)
cmake.install()
def package_info(self):
self.cpp_info.libs = ["wasmi"]
self.cpp_info.names["cmake_find_package"] = "wasmi"
self.cpp_info.names["cmake_find_package_multi"] = "wasmi"

View File

@@ -1,180 +0,0 @@
diff --git a/crates/c_api/CMakeLists.txt b/crates/c_api/CMakeLists.txt
index b15c787a..54eaed2d 100644
--- a/crates/c_api/CMakeLists.txt
+++ b/crates/c_api/CMakeLists.txt
@@ -6,6 +6,8 @@ option(BUILD_SHARED_LIBS "Build using shared libraries" OFF)
option(WASMI_ALWAYS_BUILD "If cmake should always invoke cargo to build Wasmi" ON)
set(WASMI_TARGET "" CACHE STRING "Rust target to build for")
+add_compile_definitions(COMPILING_WASM_RUNTIME_API=1)
+
if(NOT WASMI_TARGET)
execute_process(
COMMAND rustc -vV
@@ -43,6 +45,10 @@ endif()
list(TRANSFORM WASMI_SHARED_FILES PREPEND ${WASMI_TARGET_DIR}/)
list(TRANSFORM WASMI_STATIC_FILES PREPEND ${WASMI_TARGET_DIR}/)
+if(NOT BUILD_SHARED_LIBS)
+ set(WASMI_SHARED_FILES)
+endif()
+
# Instructions on how to build and install the Wasmi Rust crate.
find_program(WASMI_CARGO_BINARY cargo REQUIRED)
include(ExternalProject)
@@ -79,7 +85,6 @@ else()
target_link_libraries(wasmi INTERFACE ${WASMI_STATIC_FILES})
if(WASMI_TARGET MATCHES "windows")
- target_compile_options(wasmi INTERFACE -DWASM_API_EXTERN= -DWASI_API_EXTERN=)
target_link_libraries(wasmi INTERFACE ws2_32 advapi32 userenv ntdll shell32 ole32 bcrypt)
elseif(NOT WASMI_TARGET MATCHES "darwin")
target_link_libraries(wasmi INTERFACE pthread dl m)
@@ -112,6 +117,7 @@ install(
DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
+if(BUILD_SHARED_LIBS)
if(WASMI_TARGET MATCHES "darwin")
set(INSTALLED_LIB "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/libwasmi.dylib")
install(
@@ -131,6 +137,7 @@ if(WASMI_TARGET MATCHES "darwin")
install(CODE "execute_process(COMMAND ${install_name_tool_cmd})")
endif()
endif()
+endif()
# Documentation Generation via Doxygen:
set(DOXYGEN_CONF_IN ${CMAKE_CURRENT_SOURCE_DIR}/doxygen.conf.in)
@@ -141,19 +148,3 @@ add_custom_target(doc
DEPENDS ${WASMI_GENERATED_CONF_H} ${DOXYGEN_CONF_OUT}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
-
-# C-Header Formatting via clang-format:
-find_program(CLANG_FORMAT clang-format REQUIRED)
-file(GLOB_RECURSE HEADER_FILES
- ${CMAKE_CURRENT_SOURCE_DIR}/include/wasmi.h
- ${CMAKE_CURRENT_SOURCE_DIR}/include/wasmi/*.h
- ${CMAKE_CURRENT_SOURCE_DIR}/include/wasmi/*.hh
-)
-add_custom_target(check-format
- COMMAND ${CLANG_FORMAT} -style=llvm -Werror --dry-run ${HEADER_FILES}
- COMMENT "clang-format: Check formatting for Wasmi C-API header files"
-)
-add_custom_target(format
- COMMAND ${CLANG_FORMAT} -style=llvm -i ${HEADER_FILES}
- COMMENT "clang-format: Apply formatting rules for Wasmi C-API header files"
-)
diff --git a/crates/c_api/include/wasm.h b/crates/c_api/include/wasm.h
index 5ee617ff..37809a6f 100644
--- a/crates/c_api/include/wasm.h
+++ b/crates/c_api/include/wasm.h
@@ -13,11 +13,17 @@
#include <assert.h>
#ifndef WASM_API_EXTERN
-#if defined(_WIN32) && !defined(__MINGW32__) && !defined(LIBWASM_STATIC)
+#if defined(_MSC_BUILD)
+#if defined(COMPILING_WASM_RUNTIME_API)
+#define WASM_API_EXTERN __declspec(dllexport)
+#elif defined(_DLL)
#define WASM_API_EXTERN __declspec(dllimport)
#else
#define WASM_API_EXTERN
#endif
+#else
+#define WASM_API_EXTERN
+#endif
#endif
#ifdef __cplusplus
@@ -146,6 +152,13 @@ WASM_DECLARE_OWN(store)
WASM_API_EXTERN own wasm_store_t* wasm_store_new(wasm_engine_t*);
+// Store fuel functions (forward declarations)
+struct wasmi_error;
+
+WASM_API_EXTERN struct wasmi_error* wasm_store_get_fuel(const wasm_store_t*, uint64_t* fuel);
+WASM_API_EXTERN struct wasmi_error* wasm_store_set_fuel(wasm_store_t*, uint64_t fuel);
+//WASM_API_EXTERN void *wasm_store_get_data(const wasm_store_t*);
+//WASM_API_EXTERN void wasm_store_set_data(wasm_store_t*, void *data);
///////////////////////////////////////////////////////////////////////////////
// Type Representations
diff --git a/crates/c_api/include/wasmi.h b/crates/c_api/include/wasmi.h
index 2caffa37..0c0584ec 100644
--- a/crates/c_api/include/wasmi.h
+++ b/crates/c_api/include/wasmi.h
@@ -10,7 +10,7 @@
/**
* \brief Wasmi version string.
*/
-#define WASMI_VERSION "0.35.0"
+#define WASMI_VERSION "0.42.1"
/**
* \brief Wasmi major version number.
*/
@@ -18,10 +18,10 @@
/**
* \brief Wasmi minor version number.
*/
-#define WASMI_VERSION_MINOR 35
+#define WASMI_VERSION_MINOR 42
/**
* \brief Wasmi patch version number.
*/
-#define WASMI_VERSION_PATCH 0
+#define WASMI_VERSION_PATCH 1
#endif // WASMI_H
diff --git a/crates/c_api/src/store.rs b/crates/c_api/src/store.rs
index 56d4898f..543dbff8 100644
--- a/crates/c_api/src/store.rs
+++ b/crates/c_api/src/store.rs
@@ -175,3 +175,44 @@ pub extern "C" fn wasmi_context_set_fuel(
) -> Option<Box<wasmi_error_t>> {
crate::handle_result(store.set_fuel(fuel), |()| {})
}
+
+////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////
+
+/// Returns the current fuel of the wasm store context in `fuel`.
+///
+/// Wraps [`Store::get_fuel`].
+///
+/// # Errors
+///
+/// If [`Store::get_fuel`] errors.
+#[no_mangle]
+pub extern "C" fn wasm_store_get_fuel(
+ store: &wasm_store_t,
+ fuel: &mut u64,
+) -> Option<Box<wasmi_error_t>> {
+ let context = unsafe { store.inner.context() };
+ crate::handle_result(context.get_fuel(), |amt| {
+ *fuel = amt;
+ })
+}
+
+/// Sets the current fuel of the wasm store context to `fuel`.
+///
+/// Wraps [`Store::set_fuel`].
+///
+/// # Errors
+///
+/// If [`Store::set_fuel`] errors.
+#[no_mangle]
+pub extern "C" fn wasm_store_set_fuel(
+ store: &mut wasm_store_t,
+ fuel: u64,
+) -> Option<Box<wasmi_error_t>> {
+
+ let mut context = unsafe { store.inner.context_mut() };
+ crate::handle_result(context.set_fuel(fuel), |()| {})
+}
+

View File

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

View File

@@ -12,7 +12,7 @@
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
namespace ripple { namespace xrpl {
using IniFileSections = using IniFileSections =
std::unordered_map<std::string, std::vector<std::string>>; 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; return stat;
} }
} // namespace ripple } // namespace xrpl
#endif #endif

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -7,7 +7,7 @@
#include <stdexcept> #include <stdexcept>
namespace ripple { namespace xrpl {
/** Expected is an approximation of std::expected (hoped for in C++23) /** 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 #endif // XRPL_BASICS_EXPECTED_H_INCLUDED

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -5,7 +5,7 @@
#include <cassert> #include <cassert>
#include <cstddef> #include <cstddef>
namespace ripple { namespace xrpl {
/** Calculate one number divided by another number in percentage. /** 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] * 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(50'000'001, 100'000'000) == 51);
static_assert(calculatePercent(99'999'999, 100'000'000) == 100); static_assert(calculatePercent(99'999'999, 100'000'000) == 100);
} // namespace ripple } // namespace xrpl
#endif #endif

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -22,7 +22,7 @@
#include <sys/mman.h> #include <sys/mman.h>
#endif #endif
namespace ripple { namespace xrpl {
template <typename Type> template <typename Type>
class SlabAllocator class SlabAllocator
@@ -128,7 +128,7 @@ class SlabAllocator
{ {
XRPL_ASSERT( XRPL_ASSERT(
own(ptr), own(ptr),
"ripple::SlabAllocator::SlabBlock::deallocate : own input"); "xrpl::SlabAllocator::SlabBlock::deallocate : own input");
std::lock_guard l(m_); std::lock_guard l(m_);
@@ -159,7 +159,7 @@ public:
@param count the number of items the slab allocator can allocate; note @param count the number of items the slab allocator can allocate; note
that a count of 0 is valid and means that the allocator that a count of 0 is valid and means that the allocator
is, effectively, disabled. This can be very useful in some is, effectively, disabled. This can be very useful in some
contexts (e.g. when minimal memory usage is needed) and contexts (e.g. when mimimal memory usage is needed) and
allows for graceful failure. allows for graceful failure.
*/ */
constexpr explicit SlabAllocator( constexpr explicit SlabAllocator(
@@ -173,7 +173,7 @@ public:
{ {
XRPL_ASSERT( XRPL_ASSERT(
(itemAlignment_ & (itemAlignment_ - 1)) == 0, (itemAlignment_ & (itemAlignment_ - 1)) == 0,
"ripple::SlabAllocator::SlabAllocator : valid alignment"); "xrpl::SlabAllocator::SlabAllocator : valid alignment");
} }
SlabAllocator(SlabAllocator const& other) = delete; SlabAllocator(SlabAllocator const& other) = delete;
@@ -285,7 +285,7 @@ public:
{ {
XRPL_ASSERT( XRPL_ASSERT(
ptr, ptr,
"ripple::SlabAllocator::SlabAllocator::deallocate : non-null " "xrpl::SlabAllocator::SlabAllocator::deallocate : non-null "
"input"); "input");
for (auto slab = slabs_.load(); slab != nullptr; slab = slab->next_) 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 #endif // XRPL_BASICS_SLABALLOCATOR_H_INCLUDED

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -23,7 +23,7 @@
#include <cstring> #include <cstring>
#include <type_traits> #include <type_traits>
namespace ripple { namespace xrpl {
namespace detail { namespace detail {
@@ -275,7 +275,7 @@ public:
{ {
XRPL_ASSERT( XRPL_ASSERT(
c.size() * sizeof(typename Container::value_type) == size(), 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()); std::memcpy(data_.data(), c.data(), size());
} }
@@ -288,7 +288,7 @@ public:
{ {
XRPL_ASSERT( XRPL_ASSERT(
c.size() * sizeof(typename Container::value_type) == size(), 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()); std::memcpy(data_.data(), c.data(), size());
return *this; return *this;
} }
@@ -546,7 +546,7 @@ operator<=>(base_uint<Bits, Tag> const& lhs, base_uint<Bits, Tag> const& rhs)
// This comparison might seem wrong on a casual inspection because it // This comparison might seem wrong on a casual inspection because it
// compares data internally stored as std::uint32_t byte-by-byte. But // compares data internally stored as std::uint32_t byte-by-byte. But
// note that the underlying data is stored in big endian, even if the // note that the underlying data is stored in big endian, even if the
// platform is little endian. This makes the comparison correct. // plaform is little endian. This makes the comparison correct.
// //
// FIXME: use std::lexicographical_compare_three_way once support is // FIXME: use std::lexicographical_compare_three_way once support is
// added to MacOS. // added to MacOS.
@@ -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"); static_assert(sizeof(uint256) == 256 / 8, "There should be no padding bytes");
#endif #endif
} // namespace ripple } // namespace xrpl
namespace beast { namespace beast {
template <std::size_t Bits, class Tag> 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 : public std::true_type
{ {
explicit is_uniquely_represented() = default; explicit is_uniquely_represented() = default;

View File

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

View File

@@ -3,13 +3,13 @@
#include <functional> #include <functional>
namespace ripple { namespace xrpl {
#ifdef _MSC_VER #ifdef _MSC_VER
/* /*
* MSVC 2019 version 16.9.0 added [[nodiscard]] to the std comparison * MSVC 2019 version 16.9.0 added [[nodiscard]] to the std comparison
* operator() functions. boost::bimap checks that the comparator is a * operator() functions. boost::bimap checks that the comparitor is a
* BinaryFunction, in part by calling the function and ignoring the value. * BinaryFunction, in part by calling the function and ignoring the value.
* These two things don't play well together. These wrapper classes simply * These two things don't play well together. These wrapper classes simply
* strip [[nodiscard]] from operator() for use in boost::bimap. * strip [[nodiscard]] from operator() for use in boost::bimap.
@@ -52,6 +52,6 @@ using equal_to = std::equal_to<T>;
#endif #endif
} // namespace ripple } // namespace xrpl
#endif #endif

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -11,7 +11,7 @@
#include <random> #include <random>
#include <type_traits> #include <type_traits>
namespace ripple { namespace xrpl {
#ifndef __INTELLISENSE__ #ifndef __INTELLISENSE__
static_assert( static_assert(
@@ -95,7 +95,7 @@ std::enable_if_t<
Integral> Integral>
rand_int(Engine& engine, Integral min, Integral max) 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 // This should have no state and constructing it should
// be very cheap. If that turns out not to be the case // 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 #endif // XRPL_BASICS_RANDOM_H_INCLUDED

View File

@@ -3,7 +3,7 @@
#include <type_traits> #include <type_traits>
namespace ripple { namespace xrpl {
// safe_cast adds compile-time checks to a static_cast to ensure that // 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 // 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)); return unsafe_cast<Dest>(static_cast<std::underlying_type_t<Src>>(s));
} }
} // namespace ripple } // namespace xrpl
#endif #endif

View File

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

View File

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

View File

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

View File

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

View File

@@ -39,7 +39,7 @@ public:
The argument string is available to suites and The argument string is available to suites and
allows for customization of the test. Each suite allows for customization of the test. Each suite
defines its own syntax for the argument string. defines its own syntax for the argumnet string.
The same argument is passed to all suites. The same argument is passed to all suites.
*/ */
void void

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -199,7 +199,7 @@ public:
Value(UInt value); Value(UInt value);
Value(double value); Value(double value);
Value(char const* value); Value(char const* value);
Value(ripple::Number const& value); Value(xrpl::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
@@ -427,7 +427,7 @@ private:
}; };
inline Value inline Value
to_json(ripple::Number const& number) to_json(xrpl::Number const& number)
{ {
return to_string(number); return to_string(number);
} }

View File

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

View File

@@ -6,7 +6,7 @@
#include <xrpl/protocol/STAmount.h> #include <xrpl/protocol/STAmount.h>
#include <xrpl/protocol/TER.h> #include <xrpl/protocol/TER.h>
namespace ripple { namespace xrpl {
/** Editable, discardable view that can build metadata for one tx. /** Editable, discardable view that can build metadata for one tx.
@@ -75,6 +75,6 @@ private:
std::optional<STAmount> deliver_; std::optional<STAmount> deliver_;
}; };
} // namespace ripple } // namespace xrpl
#endif #endif

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -19,7 +19,7 @@
#include <map> #include <map>
#include <utility> #include <utility>
namespace ripple { namespace xrpl {
enum class WaiveTransferFee : bool { No = false, Yes }; enum class WaiveTransferFee : bool { No = false, Yes };
enum class SkipEntry : bool { No = false, Yes }; enum class SkipEntry : bool { No = false, Yes };
@@ -958,6 +958,6 @@ sharesToAssetsWithdraw(
bool bool
after(NetClock::time_point now, std::uint32_t mark); after(NetClock::time_point now, std::uint32_t mark);
} // namespace ripple } // namespace xrpl
#endif #endif

View File

@@ -11,7 +11,7 @@
#include <memory> #include <memory>
namespace ripple { namespace xrpl {
namespace detail { namespace detail {
// Helper class that buffers modifications // Helper class that buffers modifications
@@ -139,6 +139,6 @@ private:
}; };
} // namespace detail } // namespace detail
} // namespace ripple } // namespace xrpl
#endif #endif

View File

@@ -6,7 +6,7 @@
#include <xrpl/ledger/detail/ApplyStateTable.h> #include <xrpl/ledger/detail/ApplyStateTable.h>
#include <xrpl/protocol/XRPAmount.h> #include <xrpl/protocol/XRPAmount.h>
namespace ripple { namespace xrpl {
namespace detail { namespace detail {
class ApplyViewBase : public ApplyView, public RawView class ApplyViewBase : public ApplyView, public RawView
@@ -106,6 +106,6 @@ protected:
}; };
} // namespace detail } // namespace detail
} // namespace ripple } // namespace xrpl
#endif #endif

View File

@@ -10,7 +10,7 @@
#include <map> #include <map>
#include <utility> #include <utility>
namespace ripple { namespace xrpl {
namespace detail { namespace detail {
// Helper class that buffers raw modifications // Helper class that buffers raw modifications
@@ -118,6 +118,6 @@ private:
}; };
} // namespace detail } // namespace detail
} // namespace ripple } // namespace xrpl
#endif #endif

View File

@@ -5,7 +5,7 @@
#include <memory> #include <memory>
#include <optional> #include <optional>
namespace ripple { namespace xrpl {
class ReadView; class ReadView;
@@ -130,6 +130,6 @@ protected:
}; };
} // namespace detail } // namespace detail
} // namespace ripple } // namespace xrpl
#endif #endif

View File

@@ -1,7 +1,7 @@
#ifndef XRPL_LEDGER_READVIEWFWDRANGEINL_H_INCLUDED #ifndef XRPL_LEDGER_READVIEWFWDRANGEINL_H_INCLUDED
#define XRPL_LEDGER_READVIEWFWDRANGEINL_H_INCLUDED #define XRPL_LEDGER_READVIEWFWDRANGEINL_H_INCLUDED
namespace ripple { namespace xrpl {
namespace detail { namespace detail {
template <class ValueType> template <class ValueType>
@@ -63,7 +63,7 @@ ReadViewFwdRange<ValueType>::iterator::operator==(iterator const& other) const
{ {
XRPL_ASSERT( XRPL_ASSERT(
view_ == other.view_, view_ == other.view_,
"ripple::detail::ReadViewFwdRange::iterator::operator==(iterator) " "xrpl::detail::ReadViewFwdRange::iterator::operator==(iterator) "
"const : input view match"); "const : input view match");
if (impl_ != nullptr && other.impl_ != nullptr) if (impl_ != nullptr && other.impl_ != nullptr)
@@ -115,6 +115,6 @@ ReadViewFwdRange<ValueType>::iterator::operator++(int) -> iterator
} }
} // namespace detail } // namespace detail
} // namespace ripple } // namespace xrpl
#endif #endif

View File

@@ -269,7 +269,7 @@ protected:
error_code const& ec, error_code const& ec,
size_t bytesTransferred) size_t bytesTransferred)
{ {
using namespace ripple; using namespace xrpl;
if (ec) if (ec)
{ {

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