mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-01 00:15:51 +00:00
Compare commits
1 Commits
aaa2210b69
...
a1q123456/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
85eb901d9d |
@@ -33,6 +33,5 @@ slack_app: false
|
|||||||
|
|
||||||
ignore:
|
ignore:
|
||||||
- "src/test/"
|
- "src/test/"
|
||||||
- "src/tests/"
|
|
||||||
- "include/xrpl/beast/test/"
|
- "include/xrpl/beast/test/"
|
||||||
- "include/xrpl/beast/unit_test/"
|
- "include/xrpl/beast/unit_test/"
|
||||||
|
|||||||
28
.github/actions/build-deps/action.yml
vendored
28
.github/actions/build-deps/action.yml
vendored
@@ -10,40 +10,24 @@ inputs:
|
|||||||
build_type:
|
build_type:
|
||||||
description: 'The build type to use ("Debug", "Release").'
|
description: 'The build type to use ("Debug", "Release").'
|
||||||
required: true
|
required: true
|
||||||
build_nproc:
|
|
||||||
description: "The number of processors to use for building."
|
|
||||||
required: true
|
|
||||||
force_build:
|
force_build:
|
||||||
description: 'Force building of all dependencies ("true", "false").'
|
description: 'Force building of all dependencies ("true", "false").'
|
||||||
required: false
|
required: false
|
||||||
default: "false"
|
default: "false"
|
||||||
log_verbosity:
|
|
||||||
description: "The logging verbosity."
|
|
||||||
required: false
|
|
||||||
default: "verbose"
|
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
steps:
|
steps:
|
||||||
- name: Install Conan dependencies
|
- name: Install Conan dependencies
|
||||||
shell: bash
|
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: |
|
run: |
|
||||||
echo 'Installing dependencies.'
|
echo 'Installing dependencies.'
|
||||||
mkdir -p "${BUILD_DIR}"
|
mkdir -p ${{ inputs.build_dir }}
|
||||||
cd "${BUILD_DIR}"
|
cd ${{ inputs.build_dir }}
|
||||||
conan install \
|
conan install \
|
||||||
--output-folder . \
|
--output-folder . \
|
||||||
--build="${BUILD_OPTION}" \
|
--build ${{ inputs.force_build == 'true' && '"*"' || 'missing' }} \
|
||||||
--options:host='&:tests=True' \
|
--options:host '&:tests=True' \
|
||||||
--options:host='&:xrpld=True' \
|
--options:host '&:xrpld=True' \
|
||||||
--settings:all build_type="${BUILD_TYPE}" \
|
--settings:all build_type=${{ inputs.build_type }} \
|
||||||
--conf:all tools.build:jobs=${BUILD_NPROC} \
|
|
||||||
--conf:all tools.build:verbosity="${LOG_VERBOSITY}" \
|
|
||||||
--conf:all tools.compilation:verbosity="${LOG_VERBOSITY}" \
|
|
||||||
..
|
..
|
||||||
|
|||||||
96
.github/actions/build-test/action.yml
vendored
Normal file
96
.github/actions/build-test/action.yml
vendored
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
# This action build and tests the binary. The Conan dependencies must have
|
||||||
|
# already been installed (see the build-deps action).
|
||||||
|
name: Build and Test
|
||||||
|
description: "Build and test the binary."
|
||||||
|
|
||||||
|
# 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_only:
|
||||||
|
description: 'Whether to only build or to build and test the code ("true", "false").'
|
||||||
|
required: false
|
||||||
|
default: "false"
|
||||||
|
build_type:
|
||||||
|
description: 'The build type to use ("Debug", "Release").'
|
||||||
|
required: true
|
||||||
|
cmake_args:
|
||||||
|
description: "Additional arguments to pass to CMake."
|
||||||
|
required: false
|
||||||
|
default: ""
|
||||||
|
cmake_target:
|
||||||
|
description: "The CMake target to build."
|
||||||
|
required: true
|
||||||
|
codecov_token:
|
||||||
|
description: "The Codecov token to use for uploading coverage reports."
|
||||||
|
required: false
|
||||||
|
default: ""
|
||||||
|
os:
|
||||||
|
description: 'The operating system to use for the build ("linux", "macos", "windows").'
|
||||||
|
required: true
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
- name: Configure CMake
|
||||||
|
shell: bash
|
||||||
|
working-directory: ${{ inputs.build_dir }}
|
||||||
|
run: |
|
||||||
|
echo 'Configuring CMake.'
|
||||||
|
cmake \
|
||||||
|
-G '${{ inputs.os == 'windows' && 'Visual Studio 17 2022' || 'Ninja' }}' \
|
||||||
|
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake \
|
||||||
|
-DCMAKE_BUILD_TYPE=${{ inputs.build_type }} \
|
||||||
|
${{ inputs.cmake_args }} \
|
||||||
|
..
|
||||||
|
- name: Build the binary
|
||||||
|
shell: bash
|
||||||
|
working-directory: ${{ inputs.build_dir }}
|
||||||
|
run: |
|
||||||
|
echo 'Building binary.'
|
||||||
|
cmake \
|
||||||
|
--build . \
|
||||||
|
--config ${{ inputs.build_type }} \
|
||||||
|
--parallel $(nproc) \
|
||||||
|
--target ${{ inputs.cmake_target }}
|
||||||
|
- name: Check linking
|
||||||
|
if: ${{ inputs.os == 'linux' }}
|
||||||
|
shell: bash
|
||||||
|
working-directory: ${{ inputs.build_dir }}
|
||||||
|
run: |
|
||||||
|
echo 'Checking linking.'
|
||||||
|
ldd ./rippled
|
||||||
|
if [ "$(ldd ./rippled | grep -E '(libstdc\+\+|libgcc)' | wc -l)" -eq 0 ]; then
|
||||||
|
echo 'The binary is statically linked.'
|
||||||
|
else
|
||||||
|
echo 'The binary is dynamically linked.'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
- name: Verify voidstar
|
||||||
|
if: ${{ contains(inputs.cmake_args, '-Dvoidstar=ON') }}
|
||||||
|
shell: bash
|
||||||
|
working-directory: ${{ inputs.build_dir }}
|
||||||
|
run: |
|
||||||
|
echo 'Verifying presence of instrumentation.'
|
||||||
|
./rippled --version | grep libvoidstar
|
||||||
|
- name: Test the binary
|
||||||
|
if: ${{ inputs.build_only == 'false' }}
|
||||||
|
shell: bash
|
||||||
|
working-directory: ${{ inputs.build_dir }}/${{ inputs.os == 'windows' && inputs.build_type || '' }}
|
||||||
|
run: |
|
||||||
|
echo 'Testing binary.'
|
||||||
|
./rippled --unittest --unittest-jobs $(nproc)
|
||||||
|
ctest -j $(nproc) --output-on-failure
|
||||||
|
- name: Upload coverage report
|
||||||
|
if: ${{ inputs.cmake_target == 'coverage' }}
|
||||||
|
uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3
|
||||||
|
with:
|
||||||
|
disable_search: true
|
||||||
|
disable_telem: true
|
||||||
|
fail_ci_if_error: true
|
||||||
|
files: ${{ inputs.build_dir }}/coverage.xml
|
||||||
|
plugins: noop
|
||||||
|
token: ${{ inputs.codecov_token }}
|
||||||
|
verbose: true
|
||||||
43
.github/actions/print-env/action.yml
vendored
43
.github/actions/print-env/action.yml
vendored
@@ -1,43 +0,0 @@
|
|||||||
name: Print build environment
|
|
||||||
description: "Print environment and some tooling versions"
|
|
||||||
|
|
||||||
runs:
|
|
||||||
using: composite
|
|
||||||
steps:
|
|
||||||
- name: Check configuration (Windows)
|
|
||||||
if: ${{ runner.os == 'Windows' }}
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
echo 'Checking environment variables.'
|
|
||||||
set
|
|
||||||
|
|
||||||
echo 'Checking CMake version.'
|
|
||||||
cmake --version
|
|
||||||
|
|
||||||
echo 'Checking Conan version.'
|
|
||||||
conan --version
|
|
||||||
|
|
||||||
- name: Check configuration (Linux and macOS)
|
|
||||||
if: ${{ runner.os == 'Linux' || runner.os == 'macOS' }}
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
echo 'Checking path.'
|
|
||||||
echo ${PATH} | tr ':' '\n'
|
|
||||||
|
|
||||||
echo 'Checking environment variables.'
|
|
||||||
env | sort
|
|
||||||
|
|
||||||
echo 'Checking CMake version.'
|
|
||||||
cmake --version
|
|
||||||
|
|
||||||
echo 'Checking compiler version.'
|
|
||||||
${{ runner.os == 'Linux' && '${CC}' || 'clang' }} --version
|
|
||||||
|
|
||||||
echo 'Checking Conan version.'
|
|
||||||
conan --version
|
|
||||||
|
|
||||||
echo 'Checking Ninja version.'
|
|
||||||
ninja --version
|
|
||||||
|
|
||||||
echo 'Checking nproc version.'
|
|
||||||
nproc --version
|
|
||||||
7
.github/actions/setup-conan/action.yml
vendored
7
.github/actions/setup-conan/action.yml
vendored
@@ -35,12 +35,9 @@ runs:
|
|||||||
|
|
||||||
- name: Set up Conan remote
|
- name: Set up Conan remote
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
|
||||||
CONAN_REMOTE_NAME: ${{ inputs.conan_remote_name }}
|
|
||||||
CONAN_REMOTE_URL: ${{ inputs.conan_remote_url }}
|
|
||||||
run: |
|
run: |
|
||||||
echo "Adding Conan remote '${CONAN_REMOTE_NAME}' at '${CONAN_REMOTE_URL}'."
|
echo "Adding Conan remote '${{ inputs.conan_remote_name }}' at ${{ inputs.conan_remote_url }}."
|
||||||
conan remote add --index 0 --force "${CONAN_REMOTE_NAME}" "${CONAN_REMOTE_URL}"
|
conan remote add --index 0 --force ${{ inputs.conan_remote_name }} ${{ inputs.conan_remote_url }}
|
||||||
|
|
||||||
echo 'Listing Conan remotes.'
|
echo 'Listing Conan remotes.'
|
||||||
conan remote list
|
conan remote list
|
||||||
|
|||||||
6
.github/scripts/levelization/README.md
vendored
6
.github/scripts/levelization/README.md
vendored
@@ -72,15 +72,15 @@ It generates many files of [results](results):
|
|||||||
desired as described above. In a perfect repo, this file will be
|
desired as described above. In a perfect repo, this file will be
|
||||||
empty.
|
empty.
|
||||||
This file is committed to the repo, and is used by the [levelization
|
This file is committed to the repo, and is used by the [levelization
|
||||||
Github workflow](../../workflows/reusable-check-levelization.yml) to validate
|
Github workflow](../../workflows/check-levelization.yml) to validate
|
||||||
that nothing changed.
|
that nothing changed.
|
||||||
- [`ordering.txt`](results/ordering.txt): A list showing relationships
|
- [`ordering.txt`](results/ordering.txt): A list showing relationships
|
||||||
between modules where there are no loops as they actually exist, as
|
between modules where there are no loops as they actually exist, as
|
||||||
opposed to how they are desired as described above.
|
opposed to how they are desired as described above.
|
||||||
This file is committed to the repo, and is used by the [levelization
|
This file is committed to the repo, and is used by the [levelization
|
||||||
Github workflow](../../workflows/reusable-check-levelization.yml) to validate
|
Github workflow](../../workflows/check-levelization.yml) to validate
|
||||||
that nothing changed.
|
that nothing changed.
|
||||||
- [`levelization.yml`](../../workflows/reusable-check-levelization.yml)
|
- [`levelization.yml`](../../workflows/check-levelization.yml)
|
||||||
Github Actions workflow to test that levelization loops haven't
|
Github Actions workflow to test that levelization loops haven't
|
||||||
changed. Unfortunately, if changes are detected, it can't tell if
|
changed. Unfortunately, if changes are detected, it can't tell if
|
||||||
they are improvements or not, so if you have resolved any issues or
|
they are improvements or not, so if you have resolved any issues or
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ Loop: test.jtx test.unit_test
|
|||||||
Loop: xrpld.app xrpld.core
|
Loop: xrpld.app xrpld.core
|
||||||
xrpld.app > xrpld.core
|
xrpld.app > xrpld.core
|
||||||
|
|
||||||
|
Loop: xrpld.app xrpld.ledger
|
||||||
|
xrpld.app > xrpld.ledger
|
||||||
|
|
||||||
Loop: xrpld.app xrpld.overlay
|
Loop: xrpld.app xrpld.overlay
|
||||||
xrpld.overlay > xrpld.app
|
xrpld.overlay > xrpld.app
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,6 @@ libxrpl.basics > xrpl.basics
|
|||||||
libxrpl.crypto > xrpl.basics
|
libxrpl.crypto > xrpl.basics
|
||||||
libxrpl.json > xrpl.basics
|
libxrpl.json > xrpl.basics
|
||||||
libxrpl.json > xrpl.json
|
libxrpl.json > xrpl.json
|
||||||
libxrpl.ledger > xrpl.basics
|
|
||||||
libxrpl.ledger > xrpl.json
|
|
||||||
libxrpl.ledger > xrpl.ledger
|
|
||||||
libxrpl.ledger > xrpl.protocol
|
|
||||||
libxrpl.net > xrpl.basics
|
libxrpl.net > xrpl.basics
|
||||||
libxrpl.net > xrpl.net
|
libxrpl.net > xrpl.net
|
||||||
libxrpl.protocol > xrpl.basics
|
libxrpl.protocol > xrpl.basics
|
||||||
@@ -25,11 +21,11 @@ test.app > test.unit_test
|
|||||||
test.app > xrpl.basics
|
test.app > xrpl.basics
|
||||||
test.app > xrpld.app
|
test.app > xrpld.app
|
||||||
test.app > xrpld.core
|
test.app > xrpld.core
|
||||||
|
test.app > xrpld.ledger
|
||||||
test.app > xrpld.nodestore
|
test.app > xrpld.nodestore
|
||||||
test.app > xrpld.overlay
|
test.app > xrpld.overlay
|
||||||
test.app > xrpld.rpc
|
test.app > xrpld.rpc
|
||||||
test.app > xrpl.json
|
test.app > xrpl.json
|
||||||
test.app > xrpl.ledger
|
|
||||||
test.app > xrpl.protocol
|
test.app > xrpl.protocol
|
||||||
test.app > xrpl.resource
|
test.app > xrpl.resource
|
||||||
test.basics > test.jtx
|
test.basics > test.jtx
|
||||||
@@ -48,8 +44,8 @@ test.consensus > test.unit_test
|
|||||||
test.consensus > xrpl.basics
|
test.consensus > xrpl.basics
|
||||||
test.consensus > xrpld.app
|
test.consensus > xrpld.app
|
||||||
test.consensus > xrpld.consensus
|
test.consensus > xrpld.consensus
|
||||||
|
test.consensus > xrpld.ledger
|
||||||
test.consensus > xrpl.json
|
test.consensus > xrpl.json
|
||||||
test.consensus > xrpl.ledger
|
|
||||||
test.core > test.jtx
|
test.core > test.jtx
|
||||||
test.core > test.toplevel
|
test.core > test.toplevel
|
||||||
test.core > test.unit_test
|
test.core > test.unit_test
|
||||||
@@ -67,9 +63,9 @@ test.json > xrpl.json
|
|||||||
test.jtx > xrpl.basics
|
test.jtx > xrpl.basics
|
||||||
test.jtx > xrpld.app
|
test.jtx > xrpld.app
|
||||||
test.jtx > xrpld.core
|
test.jtx > xrpld.core
|
||||||
|
test.jtx > xrpld.ledger
|
||||||
test.jtx > xrpld.rpc
|
test.jtx > xrpld.rpc
|
||||||
test.jtx > xrpl.json
|
test.jtx > xrpl.json
|
||||||
test.jtx > xrpl.ledger
|
|
||||||
test.jtx > xrpl.net
|
test.jtx > xrpl.net
|
||||||
test.jtx > xrpl.protocol
|
test.jtx > xrpl.protocol
|
||||||
test.jtx > xrpl.resource
|
test.jtx > xrpl.resource
|
||||||
@@ -79,7 +75,7 @@ test.ledger > test.toplevel
|
|||||||
test.ledger > xrpl.basics
|
test.ledger > xrpl.basics
|
||||||
test.ledger > xrpld.app
|
test.ledger > xrpld.app
|
||||||
test.ledger > xrpld.core
|
test.ledger > xrpld.core
|
||||||
test.ledger > xrpl.ledger
|
test.ledger > xrpld.ledger
|
||||||
test.ledger > xrpl.protocol
|
test.ledger > xrpl.protocol
|
||||||
test.nodestore > test.jtx
|
test.nodestore > test.jtx
|
||||||
test.nodestore > test.toplevel
|
test.nodestore > test.toplevel
|
||||||
@@ -138,11 +134,7 @@ test.toplevel > test.csf
|
|||||||
test.toplevel > xrpl.json
|
test.toplevel > xrpl.json
|
||||||
test.unit_test > xrpl.basics
|
test.unit_test > xrpl.basics
|
||||||
tests.libxrpl > xrpl.basics
|
tests.libxrpl > xrpl.basics
|
||||||
tests.libxrpl > xrpl.json
|
|
||||||
tests.libxrpl > xrpl.net
|
|
||||||
xrpl.json > xrpl.basics
|
xrpl.json > xrpl.basics
|
||||||
xrpl.ledger > xrpl.basics
|
|
||||||
xrpl.ledger > xrpl.protocol
|
|
||||||
xrpl.net > xrpl.basics
|
xrpl.net > xrpl.basics
|
||||||
xrpl.protocol > xrpl.basics
|
xrpl.protocol > xrpl.basics
|
||||||
xrpl.protocol > xrpl.json
|
xrpl.protocol > xrpl.json
|
||||||
@@ -159,7 +151,6 @@ xrpld.app > xrpld.consensus
|
|||||||
xrpld.app > xrpld.nodestore
|
xrpld.app > xrpld.nodestore
|
||||||
xrpld.app > xrpld.perflog
|
xrpld.app > xrpld.perflog
|
||||||
xrpld.app > xrpl.json
|
xrpld.app > xrpl.json
|
||||||
xrpld.app > xrpl.ledger
|
|
||||||
xrpld.app > xrpl.net
|
xrpld.app > xrpl.net
|
||||||
xrpld.app > xrpl.protocol
|
xrpld.app > xrpl.protocol
|
||||||
xrpld.app > xrpl.resource
|
xrpld.app > xrpl.resource
|
||||||
@@ -172,6 +163,9 @@ xrpld.core > xrpl.basics
|
|||||||
xrpld.core > xrpl.json
|
xrpld.core > xrpl.json
|
||||||
xrpld.core > xrpl.net
|
xrpld.core > xrpl.net
|
||||||
xrpld.core > xrpl.protocol
|
xrpld.core > xrpl.protocol
|
||||||
|
xrpld.ledger > xrpl.basics
|
||||||
|
xrpld.ledger > xrpl.json
|
||||||
|
xrpld.ledger > xrpl.protocol
|
||||||
xrpld.nodestore > xrpl.basics
|
xrpld.nodestore > xrpl.basics
|
||||||
xrpld.nodestore > xrpld.core
|
xrpld.nodestore > xrpld.core
|
||||||
xrpld.nodestore > xrpld.unity
|
xrpld.nodestore > xrpld.unity
|
||||||
@@ -192,9 +186,9 @@ xrpld.perflog > xrpl.basics
|
|||||||
xrpld.perflog > xrpl.json
|
xrpld.perflog > xrpl.json
|
||||||
xrpld.rpc > xrpl.basics
|
xrpld.rpc > xrpl.basics
|
||||||
xrpld.rpc > xrpld.core
|
xrpld.rpc > xrpld.core
|
||||||
|
xrpld.rpc > xrpld.ledger
|
||||||
xrpld.rpc > xrpld.nodestore
|
xrpld.rpc > xrpld.nodestore
|
||||||
xrpld.rpc > xrpl.json
|
xrpld.rpc > xrpl.json
|
||||||
xrpld.rpc > xrpl.ledger
|
|
||||||
xrpld.rpc > xrpl.net
|
xrpld.rpc > xrpl.net
|
||||||
xrpld.rpc > xrpl.protocol
|
xrpld.rpc > xrpl.protocol
|
||||||
xrpld.rpc > xrpl.resource
|
xrpld.rpc > xrpl.resource
|
||||||
|
|||||||
10
.github/scripts/strategy-matrix/generate.py
vendored
10
.github/scripts/strategy-matrix/generate.py
vendored
@@ -74,14 +74,14 @@ def generate_strategy_matrix(all: bool, config: Config) -> list:
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# RHEL:
|
# RHEL:
|
||||||
# - 9 using GCC 12: Debug and Unity on linux/amd64.
|
# - 9.4 using GCC 12: Debug and Unity on linux/amd64.
|
||||||
# - 10 using Clang: Release and no Unity on linux/amd64.
|
# - 9.6 using Clang: Release and no Unity on linux/amd64.
|
||||||
if os['distro_name'] == 'rhel':
|
if os['distro_name'] == 'rhel':
|
||||||
skip = True
|
skip = True
|
||||||
if os['distro_version'] == '9':
|
if os['distro_version'] == '9.4':
|
||||||
if f'{os['compiler_name']}-{os['compiler_version']}' == 'gcc-12' and build_type == 'Debug' and '-Dunity=ON' in cmake_args and architecture['platform'] == 'linux/amd64':
|
if f'{os['compiler_name']}-{os['compiler_version']}' == 'gcc-12' and build_type == 'Debug' and '-Dunity=ON' in cmake_args and architecture['platform'] == 'linux/amd64':
|
||||||
skip = False
|
skip = False
|
||||||
elif os['distro_version'] == '10':
|
elif os['distro_version'] == '9.6':
|
||||||
if f'{os['compiler_name']}-{os['compiler_version']}' == 'clang-any' and build_type == 'Release' and '-Dunity=OFF' in cmake_args and architecture['platform'] == 'linux/amd64':
|
if f'{os['compiler_name']}-{os['compiler_version']}' == 'clang-any' and build_type == 'Release' and '-Dunity=OFF' in cmake_args and architecture['platform'] == 'linux/amd64':
|
||||||
skip = False
|
skip = False
|
||||||
if skip:
|
if skip:
|
||||||
@@ -162,7 +162,7 @@ def generate_strategy_matrix(all: bool, config: Config) -> list:
|
|||||||
'config_name': config_name,
|
'config_name': config_name,
|
||||||
'cmake_args': cmake_args,
|
'cmake_args': cmake_args,
|
||||||
'cmake_target': cmake_target,
|
'cmake_target': cmake_target,
|
||||||
'build_only': build_only,
|
'build_only': 'true' if build_only else 'false',
|
||||||
'build_type': build_type,
|
'build_type': build_type,
|
||||||
'os': os,
|
'os': os,
|
||||||
'architecture': architecture,
|
'architecture': architecture,
|
||||||
|
|||||||
122
.github/scripts/strategy-matrix/linux.json
vendored
122
.github/scripts/strategy-matrix/linux.json
vendored
@@ -14,169 +14,139 @@
|
|||||||
"distro_name": "debian",
|
"distro_name": "debian",
|
||||||
"distro_version": "bookworm",
|
"distro_version": "bookworm",
|
||||||
"compiler_name": "gcc",
|
"compiler_name": "gcc",
|
||||||
"compiler_version": "12",
|
"compiler_version": "12"
|
||||||
"image_sha": "6948666"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"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": "6948666"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"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": "6948666"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"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": "6948666"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"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": "6948666"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"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": "6948666"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"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": "6948666"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"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": "6948666"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"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": "6948666"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"distro_name": "rhel",
|
"distro_name": "rhel",
|
||||||
"distro_version": "8",
|
"distro_version": "9.4",
|
||||||
"compiler_name": "gcc",
|
"compiler_name": "gcc",
|
||||||
"compiler_version": "14",
|
"compiler_version": "12"
|
||||||
"image_sha": "10e69b4"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"distro_name": "rhel",
|
"distro_name": "rhel",
|
||||||
"distro_version": "8",
|
"distro_version": "9.4",
|
||||||
|
"compiler_name": "gcc",
|
||||||
|
"compiler_version": "13"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"distro_name": "rhel",
|
||||||
|
"distro_version": "9.4",
|
||||||
|
"compiler_name": "gcc",
|
||||||
|
"compiler_version": "14"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"distro_name": "rhel",
|
||||||
|
"distro_version": "9.6",
|
||||||
|
"compiler_name": "gcc",
|
||||||
|
"compiler_version": "13"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"distro_name": "rhel",
|
||||||
|
"distro_version": "9.6",
|
||||||
|
"compiler_name": "gcc",
|
||||||
|
"compiler_version": "14"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"distro_name": "rhel",
|
||||||
|
"distro_version": "9.4",
|
||||||
"compiler_name": "clang",
|
"compiler_name": "clang",
|
||||||
"compiler_version": "any",
|
"compiler_version": "any"
|
||||||
"image_sha": "10e69b4"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"distro_name": "rhel",
|
"distro_name": "rhel",
|
||||||
"distro_version": "9",
|
"distro_version": "9.6",
|
||||||
"compiler_name": "gcc",
|
|
||||||
"compiler_version": "12",
|
|
||||||
"image_sha": "10e69b4"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"distro_name": "rhel",
|
|
||||||
"distro_version": "9",
|
|
||||||
"compiler_name": "gcc",
|
|
||||||
"compiler_version": "13",
|
|
||||||
"image_sha": "10e69b4"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"distro_name": "rhel",
|
|
||||||
"distro_version": "9",
|
|
||||||
"compiler_name": "gcc",
|
|
||||||
"compiler_version": "14",
|
|
||||||
"image_sha": "10e69b4"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"distro_name": "rhel",
|
|
||||||
"distro_version": "9",
|
|
||||||
"compiler_name": "clang",
|
"compiler_name": "clang",
|
||||||
"compiler_version": "any",
|
"compiler_version": "any"
|
||||||
"image_sha": "10e69b4"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"distro_name": "rhel",
|
|
||||||
"distro_version": "10",
|
|
||||||
"compiler_name": "gcc",
|
|
||||||
"compiler_version": "14",
|
|
||||||
"image_sha": "10e69b4"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"distro_name": "rhel",
|
|
||||||
"distro_version": "10",
|
|
||||||
"compiler_name": "clang",
|
|
||||||
"compiler_version": "any",
|
|
||||||
"image_sha": "10e69b4"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"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": "6948666"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"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": "6948666"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"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": "6948666"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"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": "6948666"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"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": "6948666"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"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": "6948666"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"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": "6948666"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"build_type": ["Debug", "Release"],
|
"build_type": ["Debug", "Release"],
|
||||||
|
|||||||
3
.github/scripts/strategy-matrix/macos.json
vendored
3
.github/scripts/strategy-matrix/macos.json
vendored
@@ -10,8 +10,7 @@
|
|||||||
"distro_name": "macos",
|
"distro_name": "macos",
|
||||||
"distro_version": "",
|
"distro_version": "",
|
||||||
"compiler_name": "",
|
"compiler_name": "",
|
||||||
"compiler_version": "",
|
"compiler_version": ""
|
||||||
"image_sha": ""
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"build_type": ["Debug", "Release"],
|
"build_type": ["Debug", "Release"],
|
||||||
|
|||||||
5
.github/scripts/strategy-matrix/windows.json
vendored
5
.github/scripts/strategy-matrix/windows.json
vendored
@@ -2,7 +2,7 @@
|
|||||||
"architecture": [
|
"architecture": [
|
||||||
{
|
{
|
||||||
"platform": "windows/amd64",
|
"platform": "windows/amd64",
|
||||||
"runner": ["self-hosted", "Windows", "devbox"]
|
"runner": ["windows-latest"]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"os": [
|
"os": [
|
||||||
@@ -10,8 +10,7 @@
|
|||||||
"distro_name": "windows",
|
"distro_name": "windows",
|
||||||
"distro_version": "",
|
"distro_version": "",
|
||||||
"compiler_name": "",
|
"compiler_name": "",
|
||||||
"compiler_version": "",
|
"compiler_version": ""
|
||||||
"image_sha": ""
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"build_type": ["Debug", "Release"],
|
"build_type": ["Debug", "Release"],
|
||||||
|
|||||||
146
.github/workflows/build-test.yml
vendored
Normal file
146
.github/workflows/build-test.yml
vendored
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
# This workflow builds and tests the binary for various configurations.
|
||||||
|
name: Build and test
|
||||||
|
|
||||||
|
# This workflow can only be triggered by other workflows. Note that the
|
||||||
|
# workflow_call event does not support the 'choice' input type, see
|
||||||
|
# https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#onworkflow_callinputsinput_idtype,
|
||||||
|
# so we use 'string' instead.
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
build_dir:
|
||||||
|
description: "The directory where to build."
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: ".build"
|
||||||
|
dependencies_force_build:
|
||||||
|
description: "Force building of all dependencies."
|
||||||
|
required: false
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
dependencies_force_upload:
|
||||||
|
description: "Force uploading of all dependencies."
|
||||||
|
required: false
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
os:
|
||||||
|
description: 'The operating system to use for the build ("linux", "macos", "windows").'
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
strategy_matrix:
|
||||||
|
# TODO: Support additional strategies, e.g. "ubuntu" for generating all Ubuntu configurations.
|
||||||
|
description: 'The strategy matrix to use for generating the configurations ("minimal", "all").'
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: "minimal"
|
||||||
|
secrets:
|
||||||
|
codecov_token:
|
||||||
|
description: "The Codecov token to use for uploading coverage reports."
|
||||||
|
required: false
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.os }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# Generate the strategy matrix to be used by the following job.
|
||||||
|
generate-matrix:
|
||||||
|
uses: ./.github/workflows/reusable-strategy-matrix.yml
|
||||||
|
with:
|
||||||
|
os: ${{ inputs.os }}
|
||||||
|
strategy_matrix: ${{ inputs.strategy_matrix }}
|
||||||
|
|
||||||
|
# Build and test the binary.
|
||||||
|
build-test:
|
||||||
|
needs:
|
||||||
|
- generate-matrix
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
|
||||||
|
runs-on: ${{ matrix.architecture.runner }}
|
||||||
|
container: ${{ inputs.os == 'linux' && format('ghcr.io/xrplf/ci/{0}-{1}:{2}-{3}', matrix.os.distro_name, matrix.os.distro_version, matrix.os.compiler_name, matrix.os.compiler_version) || null }}
|
||||||
|
steps:
|
||||||
|
- name: Check strategy matrix
|
||||||
|
run: |
|
||||||
|
echo 'Operating system distro name: ${{ matrix.os.distro_name }}'
|
||||||
|
echo 'Operating system distro version: ${{ matrix.os.distro_version }}'
|
||||||
|
echo 'Operating system compiler name: ${{ matrix.os.compiler_name }}'
|
||||||
|
echo 'Operating system compiler version: ${{ matrix.os.compiler_version }}'
|
||||||
|
echo 'Architecture platform: ${{ matrix.architecture.platform }}'
|
||||||
|
echo 'Architecture runner: ${{ toJson(matrix.architecture.runner) }}'
|
||||||
|
echo 'Build type: ${{ matrix.build_type }}'
|
||||||
|
echo 'Build only: ${{ matrix.build_only }}'
|
||||||
|
echo 'CMake arguments: ${{ matrix.cmake_args }}'
|
||||||
|
echo 'CMake target: ${{ matrix.cmake_target }}'
|
||||||
|
echo 'Config name: ${{ matrix.config_name }}'
|
||||||
|
|
||||||
|
- name: Cleanup workspace
|
||||||
|
if: ${{ runner.os == 'macOS' }}
|
||||||
|
uses: XRPLF/actions/.github/actions/cleanup-workspace@3f044c7478548e3c32ff68980eeb36ece02b364e
|
||||||
|
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
||||||
|
- name: Prepare runner
|
||||||
|
uses: XRPLF/actions/.github/actions/prepare-runner@638e0dc11ea230f91bd26622fb542116bb5254d5
|
||||||
|
with:
|
||||||
|
disable_ccache: false
|
||||||
|
|
||||||
|
- name: Check configuration (Windows)
|
||||||
|
if: ${{ inputs.os == 'windows' }}
|
||||||
|
run: |
|
||||||
|
echo 'Checking environment variables.'
|
||||||
|
set
|
||||||
|
|
||||||
|
echo 'Checking CMake version.'
|
||||||
|
cmake --version
|
||||||
|
|
||||||
|
echo 'Checking Conan version.'
|
||||||
|
conan --version
|
||||||
|
- name: Check configuration (Linux and MacOS)
|
||||||
|
if: ${{ inputs.os == 'linux' || inputs.os == 'macos' }}
|
||||||
|
run: |
|
||||||
|
echo 'Checking path.'
|
||||||
|
echo ${PATH} | tr ':' '\n'
|
||||||
|
|
||||||
|
echo 'Checking environment variables.'
|
||||||
|
env | sort
|
||||||
|
|
||||||
|
echo 'Checking CMake version.'
|
||||||
|
cmake --version
|
||||||
|
|
||||||
|
echo 'Checking compiler version.'
|
||||||
|
${{ inputs.os == 'linux' && '${CC}' || 'clang' }} --version
|
||||||
|
|
||||||
|
echo 'Checking Conan version.'
|
||||||
|
conan --version
|
||||||
|
|
||||||
|
echo 'Checking Ninja version.'
|
||||||
|
ninja --version
|
||||||
|
|
||||||
|
echo 'Checking nproc version.'
|
||||||
|
nproc --version
|
||||||
|
|
||||||
|
- name: Setup Conan
|
||||||
|
uses: ./.github/actions/setup-conan
|
||||||
|
|
||||||
|
- name: Build dependencies
|
||||||
|
uses: ./.github/actions/build-deps
|
||||||
|
with:
|
||||||
|
build_dir: ${{ inputs.build_dir }}
|
||||||
|
build_type: ${{ matrix.build_type }}
|
||||||
|
force_build: ${{ inputs.dependencies_force_build }}
|
||||||
|
|
||||||
|
- name: Build and test binary
|
||||||
|
uses: ./.github/actions/build-test
|
||||||
|
with:
|
||||||
|
build_dir: ${{ inputs.build_dir }}
|
||||||
|
build_only: ${{ matrix.build_only }}
|
||||||
|
build_type: ${{ matrix.build_type }}
|
||||||
|
cmake_args: ${{ matrix.cmake_args }}
|
||||||
|
cmake_target: ${{ matrix.cmake_target }}
|
||||||
|
codecov_token: ${{ secrets.codecov_token }}
|
||||||
|
os: ${{ inputs.os }}
|
||||||
@@ -40,52 +40,47 @@ jobs:
|
|||||||
upload:
|
upload:
|
||||||
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
|
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: ghcr.io/xrplf/ci/ubuntu-noble:gcc-13-sha-5dd7158
|
container: ghcr.io/xrplf/ci/ubuntu-noble:gcc-13
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
||||||
- name: Generate outputs
|
- name: Generate outputs
|
||||||
id: generate
|
id: generate
|
||||||
env:
|
|
||||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
||||||
run: |
|
run: |
|
||||||
echo 'Generating user and channel.'
|
echo 'Generating user and channel.'
|
||||||
echo "user=clio" >> "${GITHUB_OUTPUT}"
|
echo "user=clio" >> "${GITHUB_OUTPUT}"
|
||||||
echo "channel=pr_${PR_NUMBER}" >> "${GITHUB_OUTPUT}"
|
echo "channel=pr_${{ github.event.pull_request.number }}" >> "${GITHUB_OUTPUT}"
|
||||||
echo 'Extracting version.'
|
echo 'Extracting version.'
|
||||||
echo "version=$(cat src/libxrpl/protocol/BuildInfo.cpp | grep "versionString =" | awk -F '"' '{print $2}')" >> "${GITHUB_OUTPUT}"
|
echo "version=$(cat src/libxrpl/protocol/BuildInfo.cpp | grep "versionString =" | awk -F '"' '{print $2}')" >> "${GITHUB_OUTPUT}"
|
||||||
- name: Calculate conan reference
|
- name: Calculate conan reference
|
||||||
id: conan_ref
|
id: conan_ref
|
||||||
run: |
|
run: |
|
||||||
echo "conan_ref=${{ steps.generate.outputs.version }}@${{ steps.generate.outputs.user }}/${{ steps.generate.outputs.channel }}" >> "${GITHUB_OUTPUT}"
|
echo "conan_ref=${{ steps.generate.outputs.version }}@${{ steps.generate.outputs.user }}/${{ steps.generate.outputs.channel }}" >> "${GITHUB_OUTPUT}"
|
||||||
|
|
||||||
- name: Set up Conan
|
- name: Set up Conan
|
||||||
uses: ./.github/actions/setup-conan
|
uses: ./.github/actions/setup-conan
|
||||||
with:
|
with:
|
||||||
conan_remote_name: ${{ inputs.conan_remote_name }}
|
conan_remote_name: ${{ inputs.conan_remote_name }}
|
||||||
conan_remote_url: ${{ inputs.conan_remote_url }}
|
conan_remote_url: ${{ inputs.conan_remote_url }}
|
||||||
|
|
||||||
- name: Log into Conan remote
|
- name: Log into Conan remote
|
||||||
env:
|
run: conan remote login ${{ inputs.conan_remote_name }} "${{ secrets.conan_remote_username }}" --password "${{ secrets.conan_remote_password }}"
|
||||||
CONAN_REMOTE_NAME: ${{ inputs.conan_remote_name }}
|
|
||||||
run: conan remote login "${CONAN_REMOTE_NAME}" "${{ secrets.conan_remote_username }}" --password "${{ secrets.conan_remote_password }}"
|
|
||||||
- name: Upload package
|
- name: Upload package
|
||||||
env:
|
|
||||||
CONAN_REMOTE_NAME: ${{ inputs.conan_remote_name }}
|
|
||||||
run: |
|
run: |
|
||||||
conan export --user=${{ steps.generate.outputs.user }} --channel=${{ steps.generate.outputs.channel }} .
|
conan export --user=${{ steps.generate.outputs.user }} --channel=${{ steps.generate.outputs.channel }} .
|
||||||
conan upload --confirm --check --remote="${CONAN_REMOTE_NAME}" xrpl/${{ steps.conan_ref.outputs.conan_ref }}
|
conan upload --confirm --check --remote=${{ inputs.conan_remote_name }} xrpl/${{ steps.conan_ref.outputs.conan_ref }}
|
||||||
outputs:
|
outputs:
|
||||||
conan_ref: ${{ steps.conan_ref.outputs.conan_ref }}
|
conan_ref: ${{ steps.conan_ref.outputs.conan_ref }}
|
||||||
|
|
||||||
notify:
|
notify:
|
||||||
needs: upload
|
needs: upload
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
|
||||||
- name: Notify Clio
|
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.clio_notify_token }}
|
GH_TOKEN: ${{ secrets.clio_notify_token }}
|
||||||
PR_URL: ${{ github.event.pull_request.html_url }}
|
steps:
|
||||||
|
- name: Notify Clio
|
||||||
run: |
|
run: |
|
||||||
gh api --method POST -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" \
|
gh api --method POST -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" \
|
||||||
/repos/xrplf/clio/dispatches -f "event_type=check_libxrpl" \
|
/repos/xrplf/clio/dispatches -f "event_type=check_libxrpl" \
|
||||||
-F "client_payload[conan_ref]=${{ needs.upload.outputs.conan_ref }}" \
|
-F "client_payload[conan_ref]=${{ needs.upload.outputs.conan_ref }}" \
|
||||||
-F "client_payload[pr_url]=${PR_URL}"
|
-F "client_payload[pr_url]=${{ github.event.pull_request.html_url }}"
|
||||||
24
.github/workflows/on-pr.yml
vendored
24
.github/workflows/on-pr.yml
vendored
@@ -50,8 +50,8 @@ jobs:
|
|||||||
files: |
|
files: |
|
||||||
# These paths are unique to `on-pr.yml`.
|
# These paths are unique to `on-pr.yml`.
|
||||||
.github/scripts/levelization/**
|
.github/scripts/levelization/**
|
||||||
.github/workflows/reusable-check-levelization.yml
|
.github/workflows/check-levelization.yml
|
||||||
.github/workflows/reusable-notify-clio.yml
|
.github/workflows/notify-clio.yml
|
||||||
.github/workflows/on-pr.yml
|
.github/workflows/on-pr.yml
|
||||||
|
|
||||||
# Keep the paths below in sync with those in `on-trigger.yml`.
|
# Keep the paths below in sync with those in `on-trigger.yml`.
|
||||||
@@ -59,11 +59,8 @@ jobs:
|
|||||||
.github/actions/build-test/**
|
.github/actions/build-test/**
|
||||||
.github/actions/setup-conan/**
|
.github/actions/setup-conan/**
|
||||||
.github/scripts/strategy-matrix/**
|
.github/scripts/strategy-matrix/**
|
||||||
.github/workflows/reusable-build.yml
|
.github/workflows/build-test.yml
|
||||||
.github/workflows/reusable-build-test-config.yml
|
|
||||||
.github/workflows/reusable-build-test.yml
|
|
||||||
.github/workflows/reusable-strategy-matrix.yml
|
.github/workflows/reusable-strategy-matrix.yml
|
||||||
.github/workflows/reusable-test.yml
|
|
||||||
.codecov.yml
|
.codecov.yml
|
||||||
cmake/**
|
cmake/**
|
||||||
conan/**
|
conan/**
|
||||||
@@ -95,28 +92,27 @@ jobs:
|
|||||||
|
|
||||||
check-levelization:
|
check-levelization:
|
||||||
needs: should-run
|
needs: should-run
|
||||||
if: ${{ needs.should-run.outputs.go == 'true' }}
|
if: needs.should-run.outputs.go == 'true'
|
||||||
uses: ./.github/workflows/reusable-check-levelization.yml
|
uses: ./.github/workflows/check-levelization.yml
|
||||||
|
|
||||||
build-test:
|
build-test:
|
||||||
needs: should-run
|
needs: should-run
|
||||||
if: ${{ needs.should-run.outputs.go == 'true' }}
|
if: needs.should-run.outputs.go == 'true'
|
||||||
uses: ./.github/workflows/reusable-build-test.yml
|
uses: ./.github/workflows/build-test.yml
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
matrix:
|
||||||
os: [linux, macos, windows]
|
os: [linux, macos, windows]
|
||||||
with:
|
with:
|
||||||
os: ${{ matrix.os }}
|
os: ${{ matrix.os }}
|
||||||
secrets:
|
secrets:
|
||||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
codecov_token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
|
||||||
notify-clio:
|
notify-clio:
|
||||||
needs:
|
needs:
|
||||||
- should-run
|
- should-run
|
||||||
- build-test
|
- build-test
|
||||||
if: ${{ needs.should-run.outputs.go == 'true' && contains(fromJSON('["release", "master"]'), github.ref_name) }}
|
if: needs.should-run.outputs.go == 'true'
|
||||||
uses: ./.github/workflows/reusable-notify-clio.yml
|
uses: ./.github/workflows/notify-clio.yml
|
||||||
secrets:
|
secrets:
|
||||||
clio_notify_token: ${{ secrets.CLIO_NOTIFY_TOKEN }}
|
clio_notify_token: ${{ secrets.CLIO_NOTIFY_TOKEN }}
|
||||||
conan_remote_username: ${{ secrets.CONAN_REMOTE_USERNAME }}
|
conan_remote_username: ${{ secrets.CONAN_REMOTE_USERNAME }}
|
||||||
|
|||||||
45
.github/workflows/on-trigger.yml
vendored
45
.github/workflows/on-trigger.yml
vendored
@@ -9,12 +9,12 @@ name: Trigger
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- "develop"
|
- develop
|
||||||
- "release*"
|
- release
|
||||||
- "master"
|
- master
|
||||||
paths:
|
paths:
|
||||||
# These paths are unique to `on-trigger.yml`.
|
# These paths are unique to `on-trigger.yml`.
|
||||||
- ".github/workflows/reusable-check-missing-commits.yml"
|
- ".github/workflows/check-missing-commits.yml"
|
||||||
- ".github/workflows/on-trigger.yml"
|
- ".github/workflows/on-trigger.yml"
|
||||||
- ".github/workflows/publish-docs.yml"
|
- ".github/workflows/publish-docs.yml"
|
||||||
|
|
||||||
@@ -23,11 +23,8 @@ on:
|
|||||||
- ".github/actions/build-test/**"
|
- ".github/actions/build-test/**"
|
||||||
- ".github/actions/setup-conan/**"
|
- ".github/actions/setup-conan/**"
|
||||||
- ".github/scripts/strategy-matrix/**"
|
- ".github/scripts/strategy-matrix/**"
|
||||||
- ".github/workflows/reusable-build.yml"
|
- ".github/workflows/build-test.yml"
|
||||||
- ".github/workflows/reusable-build-test-config.yml"
|
|
||||||
- ".github/workflows/reusable-build-test.yml"
|
|
||||||
- ".github/workflows/reusable-strategy-matrix.yml"
|
- ".github/workflows/reusable-strategy-matrix.yml"
|
||||||
- ".github/workflows/reusable-test.yml"
|
|
||||||
- ".codecov.yml"
|
- ".codecov.yml"
|
||||||
- "cmake/**"
|
- "cmake/**"
|
||||||
- "conan/**"
|
- "conan/**"
|
||||||
@@ -46,16 +43,25 @@ on:
|
|||||||
schedule:
|
schedule:
|
||||||
- cron: "32 6 * * 1-5"
|
- cron: "32 6 * * 1-5"
|
||||||
|
|
||||||
# Run when manually triggered via the GitHub UI or API.
|
# Run when manually triggered via the GitHub UI or API. If `force_upload` is
|
||||||
|
# true, then the dependencies that were missing (`force_rebuild` is false) or
|
||||||
|
# rebuilt (`force_rebuild` is true) will be uploaded, overwriting existing
|
||||||
|
# dependencies if needed.
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
dependencies_force_build:
|
||||||
|
description: "Force building of all dependencies."
|
||||||
|
required: false
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
dependencies_force_upload:
|
||||||
|
description: "Force uploading of all dependencies."
|
||||||
|
required: false
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
# When a PR is merged into the develop branch it will be assigned a unique
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
# group identifier, so execution will continue even if another PR is merged
|
|
||||||
# while it is still running. In all other cases the group identifier is shared
|
|
||||||
# per branch, so that any in-progress runs are cancelled when a new commit is
|
|
||||||
# pushed.
|
|
||||||
group: ${{ github.workflow }}-${{ github.event_name == 'push' && github.ref == 'refs/heads/develop' && github.sha || github.ref }}
|
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
defaults:
|
defaults:
|
||||||
@@ -65,16 +71,15 @@ defaults:
|
|||||||
jobs:
|
jobs:
|
||||||
check-missing-commits:
|
check-missing-commits:
|
||||||
if: ${{ github.event_name == 'push' && github.ref_type == 'branch' && contains(fromJSON('["develop", "release"]'), github.ref_name) }}
|
if: ${{ github.event_name == 'push' && github.ref_type == 'branch' && contains(fromJSON('["develop", "release"]'), github.ref_name) }}
|
||||||
uses: ./.github/workflows/reusable-check-missing-commits.yml
|
uses: ./.github/workflows/check-missing-commits.yml
|
||||||
|
|
||||||
build-test:
|
build-test:
|
||||||
uses: ./.github/workflows/reusable-build-test.yml
|
uses: ./.github/workflows/build-test.yml
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: ${{ github.event_name == 'merge_group' }}
|
|
||||||
matrix:
|
matrix:
|
||||||
os: [linux, macos, windows]
|
os: [linux, macos, windows]
|
||||||
with:
|
with:
|
||||||
os: ${{ matrix.os }}
|
os: ${{ matrix.os }}
|
||||||
strategy_matrix: ${{ github.event_name == 'schedule' && 'all' || 'minimal' }}
|
strategy_matrix: "minimal"
|
||||||
secrets:
|
secrets:
|
||||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
codecov_token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
|||||||
5
.github/workflows/pre-commit.yml
vendored
5
.github/workflows/pre-commit.yml
vendored
@@ -7,9 +7,8 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# Call the workflow in the XRPLF/actions repo that runs the pre-commit hooks.
|
|
||||||
run-hooks:
|
run-hooks:
|
||||||
uses: XRPLF/actions/.github/workflows/pre-commit.yml@34790936fae4c6c751f62ec8c06696f9c1a5753a
|
uses: XRPLF/actions/.github/workflows/pre-commit.yml@af1b0f0d764cda2e5435f5ac97b240d4bd4d95d3
|
||||||
with:
|
with:
|
||||||
runs_on: ubuntu-latest
|
runs_on: ubuntu-latest
|
||||||
container: '{ "image": "ghcr.io/xrplf/ci/tools-rippled-pre-commit:sha-a8c7be1" }'
|
container: '{ "image": "ghcr.io/xrplf/ci/tools-rippled-pre-commit" }'
|
||||||
|
|||||||
20
.github/workflows/publish-docs.yml
vendored
20
.github/workflows/publish-docs.yml
vendored
@@ -23,24 +23,16 @@ defaults:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
BUILD_DIR: .build
|
BUILD_DIR: .build
|
||||||
NPROC_SUBTRACT: 2
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish:
|
publish:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: ghcr.io/xrplf/ci/tools-rippled-documentation:sha-a8c7be1
|
container: ghcr.io/xrplf/ci/tools-rippled-documentation
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
||||||
|
|
||||||
- name: Get number of processors
|
|
||||||
uses: XRPLF/actions/.github/actions/get-nproc@046b1620f6bfd6cd0985dc82c3df02786801fe0a
|
|
||||||
id: nproc
|
|
||||||
with:
|
|
||||||
subtract: ${{ env.NPROC_SUBTRACT }}
|
|
||||||
|
|
||||||
- name: Check configuration
|
- name: Check configuration
|
||||||
run: |
|
run: |
|
||||||
echo 'Checking path.'
|
echo 'Checking path.'
|
||||||
@@ -54,16 +46,12 @@ jobs:
|
|||||||
|
|
||||||
echo 'Checking Doxygen version.'
|
echo 'Checking Doxygen version.'
|
||||||
doxygen --version
|
doxygen --version
|
||||||
|
|
||||||
- name: Build documentation
|
- name: Build documentation
|
||||||
env:
|
|
||||||
BUILD_NPROC: ${{ steps.nproc.outputs.nproc }}
|
|
||||||
run: |
|
run: |
|
||||||
mkdir -p "${BUILD_DIR}"
|
mkdir -p ${{ env.BUILD_DIR }}
|
||||||
cd "${BUILD_DIR}"
|
cd ${{ env.BUILD_DIR }}
|
||||||
cmake -Donly_docs=ON ..
|
cmake -Donly_docs=ON ..
|
||||||
cmake --build . --target docs --parallel ${BUILD_NPROC}
|
cmake --build . --target docs --parallel $(nproc)
|
||||||
|
|
||||||
- name: Publish documentation
|
- name: Publish documentation
|
||||||
if: ${{ github.ref_type == 'branch' && github.ref_name == github.event.repository.default_branch }}
|
if: ${{ github.ref_type == 'branch' && github.ref_name == github.event.repository.default_branch }}
|
||||||
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
|
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
|
||||||
|
|||||||
77
.github/workflows/reusable-build-test-config.yml
vendored
77
.github/workflows/reusable-build-test-config.yml
vendored
@@ -1,77 +0,0 @@
|
|||||||
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
|
|
||||||
type: boolean
|
|
||||||
build_type:
|
|
||||||
description: 'The build type to use ("Debug", "Release").'
|
|
||||||
type: string
|
|
||||||
required: true
|
|
||||||
cmake_args:
|
|
||||||
description: "Additional arguments to pass to CMake."
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: ""
|
|
||||||
cmake_target:
|
|
||||||
description: "The CMake target to build."
|
|
||||||
type: string
|
|
||||||
required: true
|
|
||||||
|
|
||||||
runs_on:
|
|
||||||
description: Runner to run the job on as a JSON string
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
image:
|
|
||||||
description: "The image to run in (leave empty to run natively)"
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
|
|
||||||
config_name:
|
|
||||||
description: "The configuration string (used for naming artifacts and such)."
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
|
|
||||||
nproc_subtract:
|
|
||||||
description: "The number of processors to subtract when calculating parallelism."
|
|
||||||
required: false
|
|
||||||
type: number
|
|
||||||
default: 2
|
|
||||||
|
|
||||||
secrets:
|
|
||||||
CODECOV_TOKEN:
|
|
||||||
description: "The Codecov token to use for uploading coverage reports."
|
|
||||||
required: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
uses: ./.github/workflows/reusable-build.yml
|
|
||||||
with:
|
|
||||||
build_dir: ${{ inputs.build_dir }}
|
|
||||||
build_type: ${{ inputs.build_type }}
|
|
||||||
cmake_args: ${{ inputs.cmake_args }}
|
|
||||||
cmake_target: ${{ inputs.cmake_target }}
|
|
||||||
runs_on: ${{ inputs.runs_on }}
|
|
||||||
image: ${{ inputs.image }}
|
|
||||||
config_name: ${{ inputs.config_name }}
|
|
||||||
nproc_subtract: ${{ inputs.nproc_subtract }}
|
|
||||||
secrets:
|
|
||||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
|
||||||
|
|
||||||
test:
|
|
||||||
needs: build
|
|
||||||
uses: ./.github/workflows/reusable-test.yml
|
|
||||||
with:
|
|
||||||
run_tests: ${{ !inputs.build_only }}
|
|
||||||
verify_voidstar: ${{ contains(inputs.cmake_args, '-Dvoidstar=ON') }}
|
|
||||||
runs_on: ${{ inputs.runs_on }}
|
|
||||||
image: ${{ inputs.image }}
|
|
||||||
config_name: ${{ inputs.config_name }}
|
|
||||||
nproc_subtract: ${{ inputs.nproc_subtract }}
|
|
||||||
58
.github/workflows/reusable-build-test.yml
vendored
58
.github/workflows/reusable-build-test.yml
vendored
@@ -1,58 +0,0 @@
|
|||||||
# This workflow builds and tests the binary for various configurations.
|
|
||||||
name: Build and test
|
|
||||||
|
|
||||||
# This workflow can only be triggered by other workflows. Note that the
|
|
||||||
# workflow_call event does not support the 'choice' input type, see
|
|
||||||
# https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#onworkflow_callinputsinput_idtype,
|
|
||||||
# so we use 'string' instead.
|
|
||||||
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
|
|
||||||
type: string
|
|
||||||
strategy_matrix:
|
|
||||||
# TODO: Support additional strategies, e.g. "ubuntu" for generating all Ubuntu configurations.
|
|
||||||
description: 'The strategy matrix to use for generating the configurations ("minimal", "all").'
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: "minimal"
|
|
||||||
secrets:
|
|
||||||
CODECOV_TOKEN:
|
|
||||||
description: "The Codecov token to use for uploading coverage reports."
|
|
||||||
required: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
# Generate the strategy matrix to be used by the following job.
|
|
||||||
generate-matrix:
|
|
||||||
uses: ./.github/workflows/reusable-strategy-matrix.yml
|
|
||||||
with:
|
|
||||||
os: ${{ inputs.os }}
|
|
||||||
strategy_matrix: ${{ inputs.strategy_matrix }}
|
|
||||||
|
|
||||||
# Build and test the binary for each configuration.
|
|
||||||
build-test-config:
|
|
||||||
needs:
|
|
||||||
- generate-matrix
|
|
||||||
uses: ./.github/workflows/reusable-build-test-config.yml
|
|
||||||
strategy:
|
|
||||||
fail-fast: ${{ github.event_name == 'merge_group' }}
|
|
||||||
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 }}
|
|
||||||
cmake_target: ${{ matrix.cmake_target }}
|
|
||||||
runs_on: ${{ toJSON(matrix.architecture.runner) }}
|
|
||||||
image: ${{ contains(matrix.architecture.platform, 'linux') && format('ghcr.io/xrplf/ci/{0}-{1}:{2}-{3}-sha-{4}', matrix.os.distro_name, matrix.os.distro_version, matrix.os.compiler_name, matrix.os.compiler_version, matrix.os.image_sha) || '' }}
|
|
||||||
config_name: ${{ matrix.config_name }}
|
|
||||||
secrets:
|
|
||||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
|
||||||
154
.github/workflows/reusable-build.yml
vendored
154
.github/workflows/reusable-build.yml
vendored
@@ -1,154 +0,0 @@
|
|||||||
name: Build rippled
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_call:
|
|
||||||
inputs:
|
|
||||||
build_dir:
|
|
||||||
description: "The directory where to build."
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
build_type:
|
|
||||||
description: 'The build type to use ("Debug", "Release").'
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
cmake_args:
|
|
||||||
description: "Additional arguments to pass to CMake."
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
cmake_target:
|
|
||||||
description: "The CMake target to build."
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
|
|
||||||
runs_on:
|
|
||||||
description: Runner to run the job on as a JSON string
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
image:
|
|
||||||
description: "The image to run in (leave empty to run natively)"
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
|
|
||||||
config_name:
|
|
||||||
description: "The name of the configuration."
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
|
|
||||||
nproc_subtract:
|
|
||||||
description: "The number of processors to subtract when calculating parallelism."
|
|
||||||
required: true
|
|
||||||
type: number
|
|
||||||
|
|
||||||
secrets:
|
|
||||||
CODECOV_TOKEN:
|
|
||||||
description: "The Codecov token to use for uploading coverage reports."
|
|
||||||
required: true
|
|
||||||
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
name: Build ${{ inputs.config_name }}
|
|
||||||
runs-on: ${{ fromJSON(inputs.runs_on) }}
|
|
||||||
container: ${{ inputs.image != '' && inputs.image || null }}
|
|
||||||
timeout-minutes: 60
|
|
||||||
steps:
|
|
||||||
- name: Cleanup workspace
|
|
||||||
if: ${{ runner.os == 'macOS' }}
|
|
||||||
uses: XRPLF/actions/.github/actions/cleanup-workspace@3f044c7478548e3c32ff68980eeb36ece02b364e
|
|
||||||
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
|
||||||
|
|
||||||
- name: Prepare runner
|
|
||||||
uses: XRPLF/actions/.github/actions/prepare-runner@99685816bb60a95a66852f212f382580e180df3a
|
|
||||||
with:
|
|
||||||
disable_ccache: false
|
|
||||||
|
|
||||||
- name: Print build environment
|
|
||||||
uses: ./.github/actions/print-env
|
|
||||||
|
|
||||||
- name: Get number of processors
|
|
||||||
uses: XRPLF/actions/.github/actions/get-nproc@046b1620f6bfd6cd0985dc82c3df02786801fe0a
|
|
||||||
id: nproc
|
|
||||||
with:
|
|
||||||
subtract: ${{ inputs.nproc_subtract }}
|
|
||||||
|
|
||||||
- name: Setup Conan
|
|
||||||
uses: ./.github/actions/setup-conan
|
|
||||||
|
|
||||||
- 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
|
|
||||||
# amount of logs. For other OSes, the "verbose" logs are more useful.
|
|
||||||
log_verbosity: ${{ runner.os == 'Windows' && 'quiet' || 'verbose' }}
|
|
||||||
|
|
||||||
- name: Configure CMake
|
|
||||||
shell: bash
|
|
||||||
working-directory: ${{ inputs.build_dir }}
|
|
||||||
env:
|
|
||||||
BUILD_TYPE: ${{ inputs.build_type }}
|
|
||||||
CMAKE_ARGS: ${{ inputs.cmake_args }}
|
|
||||||
run: |
|
|
||||||
cmake \
|
|
||||||
-G '${{ runner.os == 'Windows' && 'Visual Studio 17 2022' || 'Ninja' }}' \
|
|
||||||
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake \
|
|
||||||
-DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \
|
|
||||||
${CMAKE_ARGS} \
|
|
||||||
..
|
|
||||||
|
|
||||||
- name: Build the binary
|
|
||||||
shell: bash
|
|
||||||
working-directory: ${{ inputs.build_dir }}
|
|
||||||
env:
|
|
||||||
BUILD_NPROC: ${{ steps.nproc.outputs.nproc }}
|
|
||||||
BUILD_TYPE: ${{ inputs.build_type }}
|
|
||||||
CMAKE_TARGET: ${{ inputs.cmake_target }}
|
|
||||||
run: |
|
|
||||||
cmake \
|
|
||||||
--build . \
|
|
||||||
--config "${BUILD_TYPE}" \
|
|
||||||
--parallel ${BUILD_NPROC} \
|
|
||||||
--target "${CMAKE_TARGET}"
|
|
||||||
|
|
||||||
- name: Put built binaries in one location
|
|
||||||
shell: bash
|
|
||||||
working-directory: ${{ inputs.build_dir }}
|
|
||||||
env:
|
|
||||||
BUILD_TYPE_DIR: ${{ runner.os == 'Windows' && inputs.build_type || '' }}
|
|
||||||
CMAKE_TARGET: ${{ inputs.cmake_target }}
|
|
||||||
run: |
|
|
||||||
mkdir -p ./binaries/doctest/
|
|
||||||
|
|
||||||
cp ./${BUILD_TYPE_DIR}/rippled* ./binaries/
|
|
||||||
if [ "${CMAKE_TARGET}" != 'coverage' ]; then
|
|
||||||
cp ./src/tests/libxrpl/${BUILD_TYPE_DIR}/xrpl.test.* ./binaries/doctest/
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Upload rippled artifact
|
|
||||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
|
||||||
env:
|
|
||||||
BUILD_DIR: ${{ inputs.build_dir }}
|
|
||||||
with:
|
|
||||||
name: rippled-${{ inputs.config_name }}
|
|
||||||
path: ${{ env.BUILD_DIR }}/binaries/
|
|
||||||
retention-days: 3
|
|
||||||
if-no-files-found: error
|
|
||||||
|
|
||||||
- name: Upload coverage report
|
|
||||||
if: ${{ github.repository_owner == 'XRPLF' && inputs.cmake_target == 'coverage' }}
|
|
||||||
uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3
|
|
||||||
with:
|
|
||||||
disable_search: true
|
|
||||||
disable_telem: true
|
|
||||||
fail_ci_if_error: true
|
|
||||||
files: ${{ inputs.build_dir }}/coverage.xml
|
|
||||||
plugins: noop
|
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
|
||||||
verbose: true
|
|
||||||
@@ -35,7 +35,4 @@ jobs:
|
|||||||
- name: Generate strategy matrix
|
- name: Generate strategy matrix
|
||||||
working-directory: .github/scripts/strategy-matrix
|
working-directory: .github/scripts/strategy-matrix
|
||||||
id: generate
|
id: generate
|
||||||
env:
|
run: ./generate.py ${{ inputs.strategy_matrix == 'all' && '--all' || '' }} ${{ inputs.os != '' && format('--config={0}.json', inputs.os) || '' }} >> "${GITHUB_OUTPUT}"
|
||||||
GENERATE_CONFIG: ${{ inputs.os != '' && format('--config={0}.json', inputs.os) || '' }}
|
|
||||||
GENERATE_OPTION: ${{ inputs.strategy_matrix == 'all' && '--all' || '' }}
|
|
||||||
run: ./generate.py ${GENERATE_OPTION} ${GENERATE_CONFIG} >> "${GITHUB_OUTPUT}"
|
|
||||||
|
|||||||
111
.github/workflows/reusable-test.yml
vendored
111
.github/workflows/reusable-test.yml
vendored
@@ -1,111 +0,0 @@
|
|||||||
name: Test rippled
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_call:
|
|
||||||
inputs:
|
|
||||||
verify_voidstar:
|
|
||||||
description: "Whether to verify the presence of voidstar instrumentation."
|
|
||||||
required: true
|
|
||||||
type: boolean
|
|
||||||
run_tests:
|
|
||||||
description: "Whether to run unit tests"
|
|
||||||
required: true
|
|
||||||
type: boolean
|
|
||||||
|
|
||||||
runs_on:
|
|
||||||
description: Runner to run the job on as a JSON string
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
image:
|
|
||||||
description: "The image to run in (leave empty to run natively)"
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
|
|
||||||
config_name:
|
|
||||||
description: "The name of the configuration."
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
|
|
||||||
nproc_subtract:
|
|
||||||
description: "The number of processors to subtract when calculating parallelism."
|
|
||||||
required: true
|
|
||||||
type: number
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
name: Test ${{ inputs.config_name }}
|
|
||||||
runs-on: ${{ fromJSON(inputs.runs_on) }}
|
|
||||||
container: ${{ inputs.image != '' && inputs.image || null }}
|
|
||||||
timeout-minutes: 30
|
|
||||||
steps:
|
|
||||||
- name: Cleanup workspace
|
|
||||||
if: ${{ runner.os == 'macOS' }}
|
|
||||||
uses: XRPLF/actions/.github/actions/cleanup-workspace@3f044c7478548e3c32ff68980eeb36ece02b364e
|
|
||||||
|
|
||||||
- name: Get number of processors
|
|
||||||
uses: XRPLF/actions/.github/actions/get-nproc@046b1620f6bfd6cd0985dc82c3df02786801fe0a
|
|
||||||
id: nproc
|
|
||||||
with:
|
|
||||||
subtract: ${{ inputs.nproc_subtract }}
|
|
||||||
|
|
||||||
- name: Download rippled artifact
|
|
||||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
|
||||||
with:
|
|
||||||
name: rippled-${{ inputs.config_name }}
|
|
||||||
|
|
||||||
- name: Make binary executable (Linux and macOS)
|
|
||||||
shell: bash
|
|
||||||
if: ${{ runner.os == 'Linux' || runner.os == 'macOS' }}
|
|
||||||
run: |
|
|
||||||
chmod +x ./rippled
|
|
||||||
|
|
||||||
- name: Check linking (Linux)
|
|
||||||
if: ${{ runner.os == 'Linux' }}
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
ldd ./rippled
|
|
||||||
if [ "$(ldd ./rippled | grep -E '(libstdc\+\+|libgcc)' | wc -l)" -eq 0 ]; then
|
|
||||||
echo 'The binary is statically linked.'
|
|
||||||
else
|
|
||||||
echo 'The binary is dynamically linked.'
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Verifying presence of instrumentation
|
|
||||||
if: ${{ inputs.verify_voidstar }}
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
./rippled --version | grep libvoidstar
|
|
||||||
|
|
||||||
- name: Run the embedded tests
|
|
||||||
if: ${{ inputs.run_tests }}
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
BUILD_NPROC: ${{ steps.nproc.outputs.nproc }}
|
|
||||||
run: |
|
|
||||||
./rippled --unittest --unittest-jobs ${BUILD_NPROC}
|
|
||||||
|
|
||||||
- name: Run the separate tests
|
|
||||||
if: ${{ inputs.run_tests }}
|
|
||||||
env:
|
|
||||||
EXT: ${{ runner.os == 'Windows' && '.exe' || '' }}
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
for test_file in ./doctest/*${EXT}; do
|
|
||||||
echo "Executing $test_file"
|
|
||||||
chmod +x "$test_file"
|
|
||||||
if [[ "${{ runner.os }}" == "Windows" && "$test_file" == "./doctest/xrpl.test.net.exe" ]]; then
|
|
||||||
echo "Skipping $test_file on Windows"
|
|
||||||
else
|
|
||||||
"$test_file"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
- name: Debug failure (Linux)
|
|
||||||
if: ${{ failure() && runner.os == 'Linux' && inputs.run_tests }}
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
echo "IPv4 local port range:"
|
|
||||||
cat /proc/sys/net/ipv4/ip_local_port_range
|
|
||||||
echo "Netstat:"
|
|
||||||
netstat -an
|
|
||||||
47
.github/workflows/upload-conan-deps.yml
vendored
47
.github/workflows/upload-conan-deps.yml
vendored
@@ -24,30 +24,26 @@ on:
|
|||||||
branches: [develop]
|
branches: [develop]
|
||||||
paths:
|
paths:
|
||||||
- .github/workflows/upload-conan-deps.yml
|
- .github/workflows/upload-conan-deps.yml
|
||||||
|
|
||||||
- .github/workflows/reusable-strategy-matrix.yml
|
- .github/workflows/reusable-strategy-matrix.yml
|
||||||
|
|
||||||
- .github/actions/build-deps/action.yml
|
- .github/actions/build-deps/action.yml
|
||||||
- .github/actions/setup-conan/action.yml
|
- .github/actions/setup-conan/action.yml
|
||||||
- ".github/scripts/strategy-matrix/**"
|
- ".github/scripts/strategy-matrix/**"
|
||||||
|
|
||||||
- conanfile.py
|
- conanfile.py
|
||||||
- conan.lock
|
- conan.lock
|
||||||
|
|
||||||
env:
|
|
||||||
CONAN_REMOTE_NAME: xrplf
|
|
||||||
CONAN_REMOTE_URL: https://conan.ripplex.io
|
|
||||||
NPROC_SUBTRACT: 2
|
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# Generate the strategy matrix to be used by the following job.
|
|
||||||
generate-matrix:
|
generate-matrix:
|
||||||
uses: ./.github/workflows/reusable-strategy-matrix.yml
|
uses: ./.github/workflows/reusable-strategy-matrix.yml
|
||||||
with:
|
with:
|
||||||
strategy_matrix: ${{ github.event_name == 'pull_request' && 'minimal' || 'all' }}
|
strategy_matrix: ${{ github.event_name == 'pull_request' && 'minimal' || 'all' }}
|
||||||
|
|
||||||
# Build and upload the dependencies for each configuration.
|
|
||||||
run-upload-conan-deps:
|
run-upload-conan-deps:
|
||||||
needs:
|
needs:
|
||||||
- generate-matrix
|
- generate-matrix
|
||||||
@@ -56,52 +52,33 @@ jobs:
|
|||||||
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
|
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
|
||||||
max-parallel: 10
|
max-parallel: 10
|
||||||
runs-on: ${{ matrix.architecture.runner }}
|
runs-on: ${{ matrix.architecture.runner }}
|
||||||
container: ${{ contains(matrix.architecture.platform, 'linux') && format('ghcr.io/xrplf/ci/{0}-{1}:{2}-{3}-sha-{4}', matrix.os.distro_name, matrix.os.distro_version, matrix.os.compiler_name, matrix.os.compiler_version, matrix.os.image_sha) || null }}
|
container: ${{ contains(matrix.architecture.platform, 'linux') && format('ghcr.io/xrplf/ci/{0}-{1}:{2}-{3}', matrix.os.distro_name, matrix.os.distro_version, matrix.os.compiler_name, matrix.os.compiler_version) || null }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Cleanup workspace
|
- name: Cleanup workspace
|
||||||
if: ${{ runner.os == 'macOS' }}
|
if: ${{ runner.os == 'macOS' }}
|
||||||
uses: XRPLF/actions/.github/actions/cleanup-workspace@3f044c7478548e3c32ff68980eeb36ece02b364e
|
uses: XRPLF/actions/.github/actions/cleanup-workspace@3f044c7478548e3c32ff68980eeb36ece02b364e
|
||||||
|
|
||||||
- name: Checkout repository
|
- 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@99685816bb60a95a66852f212f382580e180df3a
|
uses: XRPLF/actions/.github/actions/prepare-runner@638e0dc11ea230f91bd26622fb542116bb5254d5
|
||||||
with:
|
with:
|
||||||
disable_ccache: false
|
disable_ccache: false
|
||||||
|
|
||||||
- name: Print build environment
|
|
||||||
uses: ./.github/actions/print-env
|
|
||||||
|
|
||||||
- name: Get number of processors
|
|
||||||
uses: XRPLF/actions/.github/actions/get-nproc@046b1620f6bfd6cd0985dc82c3df02786801fe0a
|
|
||||||
id: nproc
|
|
||||||
with:
|
|
||||||
subtract: ${{ env.NPROC_SUBTRACT }}
|
|
||||||
|
|
||||||
- name: Setup Conan
|
- name: Setup Conan
|
||||||
uses: ./.github/actions/setup-conan
|
uses: ./.github/actions/setup-conan
|
||||||
with:
|
|
||||||
conan_remote_name: ${{ env.CONAN_REMOTE_NAME }}
|
|
||||||
conan_remote_url: ${{ env.CONAN_REMOTE_URL }}
|
|
||||||
|
|
||||||
- name: Build dependencies
|
- name: Build dependencies
|
||||||
uses: ./.github/actions/build-deps
|
uses: ./.github/actions/build-deps
|
||||||
with:
|
with:
|
||||||
build_dir: .build
|
build_dir: .build
|
||||||
build_nproc: ${{ steps.nproc.outputs.nproc }}
|
|
||||||
build_type: ${{ matrix.build_type }}
|
build_type: ${{ matrix.build_type }}
|
||||||
force_build: ${{ github.event_name == 'schedule' || github.event.inputs.force_source_build == 'true' }}
|
force_build: ${{ github.event_name == 'schedule' || github.event.inputs.force_source_build == 'true' }}
|
||||||
# Set the verbosity to "quiet" for Windows to avoid an excessive
|
|
||||||
# amount of logs. For other OSes, the "verbose" logs are more useful.
|
|
||||||
log_verbosity: ${{ runner.os == 'Windows' && 'quiet' || 'verbose' }}
|
|
||||||
|
|
||||||
- name: Log into Conan remote
|
- name: Login to Conan
|
||||||
if: ${{ github.repository_owner == 'XRPLF' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') }}
|
if: github.repository_owner == 'XRPLF' && github.event_name != 'pull_request'
|
||||||
run: conan remote login "${CONAN_REMOTE_NAME}" "${{ secrets.CONAN_REMOTE_USERNAME }}" --password "${{ secrets.CONAN_REMOTE_PASSWORD }}"
|
run: conan remote login -p ${{ secrets.CONAN_PASSWORD }} ${{ inputs.conan_remote_name }} ${{ secrets.CONAN_USERNAME }}
|
||||||
|
|
||||||
- name: Upload Conan packages
|
- name: Upload Conan packages
|
||||||
if: ${{ github.repository_owner == 'XRPLF' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') }}
|
if: github.repository_owner == 'XRPLF' && github.event_name != 'pull_request' && github.event_name != 'schedule'
|
||||||
env:
|
run: conan upload "*" -r=${{ inputs.conan_remote_name }} --confirm ${{ github.event.inputs.force_upload == 'true' && '--force' || '' }}
|
||||||
FORCE_OPTION: ${{ github.event.inputs.force_upload == 'true' && '--force' || '' }}
|
|
||||||
run: conan upload "*" --remote="${CONAN_REMOTE_NAME}" --confirm ${FORCE_OPTION}
|
|
||||||
|
|||||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -111,3 +111,6 @@ bld.rippled/
|
|||||||
|
|
||||||
# Suggested in-tree build directory
|
# Suggested in-tree build directory
|
||||||
/.build*/
|
/.build*/
|
||||||
|
|
||||||
|
# Rust
|
||||||
|
external/*/target
|
||||||
|
|||||||
22
BUILD.md
22
BUILD.md
@@ -39,12 +39,17 @@ found here](./docs/build/environment.md).
|
|||||||
|
|
||||||
- [Python 3.11](https://www.python.org/downloads/), or higher
|
- [Python 3.11](https://www.python.org/downloads/), or higher
|
||||||
- [Conan 2.17](https://conan.io/downloads.html)[^1], or higher
|
- [Conan 2.17](https://conan.io/downloads.html)[^1], or higher
|
||||||
- [CMake 3.22](https://cmake.org/download/), or higher
|
- [CMake 3.22](https://cmake.org/download/)[^2], or higher
|
||||||
|
|
||||||
[^1]:
|
[^1]:
|
||||||
It is possible to build with Conan 1.60+, but the instructions are
|
It is possible to build with Conan 1.60+, but the instructions are
|
||||||
significantly different, which is why we are not recommending it.
|
significantly different, which is why we are not recommending it.
|
||||||
|
|
||||||
|
[^2]:
|
||||||
|
CMake 4 is not yet supported by all dependencies required by this project.
|
||||||
|
If you are affected by this issue, follow [conan workaround for cmake
|
||||||
|
4](#workaround-for-cmake-4)
|
||||||
|
|
||||||
`rippled` is written in the C++20 dialect and includes the `<concepts>` header.
|
`rippled` is written in the C++20 dialect and includes the `<concepts>` header.
|
||||||
The [minimum compiler versions][2] required are:
|
The [minimum compiler versions][2] required are:
|
||||||
|
|
||||||
@@ -277,6 +282,21 @@ sed -i.bak -e 's|^arch=.*$|arch=x86_64|' $(conan config home)/profiles/default
|
|||||||
sed -i.bak -e 's|^compiler\.runtime=.*$|compiler.runtime=static|' $(conan config home)/profiles/default
|
sed -i.bak -e 's|^compiler\.runtime=.*$|compiler.runtime=static|' $(conan config home)/profiles/default
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Workaround for CMake 4
|
||||||
|
|
||||||
|
If your system CMake is version 4 rather than 3, you may have to configure Conan
|
||||||
|
profile to use CMake version 3 for dependencies, by adding the following two
|
||||||
|
lines to your profile:
|
||||||
|
|
||||||
|
```text
|
||||||
|
[tool_requires]
|
||||||
|
!cmake/*: cmake/[>=3 <4]
|
||||||
|
```
|
||||||
|
|
||||||
|
This will force Conan to download and use a locally cached CMake 3 version, and
|
||||||
|
is needed because some of the dependencies used by this project do not support
|
||||||
|
CMake 4.
|
||||||
|
|
||||||
#### Clang workaround for grpc
|
#### Clang workaround for grpc
|
||||||
|
|
||||||
If your compiler is clang, version 19 or later, or apple-clang, version 17 or
|
If your compiler is clang, version 19 or later, or apple-clang, version 17 or
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ set(SECP256K1_BUILD_EXHAUSTIVE_TESTS FALSE)
|
|||||||
set(SECP256K1_BUILD_CTIME_TESTS FALSE)
|
set(SECP256K1_BUILD_CTIME_TESTS FALSE)
|
||||||
set(SECP256K1_BUILD_EXAMPLES FALSE)
|
set(SECP256K1_BUILD_EXAMPLES FALSE)
|
||||||
add_subdirectory(external/secp256k1)
|
add_subdirectory(external/secp256k1)
|
||||||
|
add_subdirectory(external/rust-test)
|
||||||
add_library(secp256k1::secp256k1 ALIAS secp256k1)
|
add_library(secp256k1::secp256k1 ALIAS secp256k1)
|
||||||
add_subdirectory(external/ed25519-donna)
|
add_subdirectory(external/ed25519-donna)
|
||||||
add_subdirectory(external/antithesis-sdk)
|
add_subdirectory(external/antithesis-sdk)
|
||||||
@@ -129,6 +130,7 @@ target_link_libraries(ripple_libs INTERFACE
|
|||||||
secp256k1::secp256k1
|
secp256k1::secp256k1
|
||||||
soci::soci
|
soci::soci
|
||||||
SQLite::SQLite3
|
SQLite::SQLite3
|
||||||
|
RustTest
|
||||||
)
|
)
|
||||||
|
|
||||||
# Work around changes to Conan recipe for now.
|
# Work around changes to Conan recipe for now.
|
||||||
|
|||||||
@@ -104,11 +104,6 @@
|
|||||||
# 2025-08-28, Bronek Kozicki
|
# 2025-08-28, Bronek Kozicki
|
||||||
# - fix "At least one COMMAND must be given" CMake warning from policy CMP0175
|
# - fix "At least one COMMAND must be given" CMake warning from policy CMP0175
|
||||||
#
|
#
|
||||||
# 2025-09-03, Jingchen Wu
|
|
||||||
# - remove the unused function append_coverage_compiler_flags and append_coverage_compiler_flags_to_target
|
|
||||||
# - add a new function add_code_coverage_to_target
|
|
||||||
# - remove some unused code
|
|
||||||
#
|
|
||||||
# USAGE:
|
# USAGE:
|
||||||
#
|
#
|
||||||
# 1. Copy this file into your cmake modules path.
|
# 1. Copy this file into your cmake modules path.
|
||||||
@@ -117,8 +112,10 @@
|
|||||||
# using a CMake option() to enable it just optionally):
|
# using a CMake option() to enable it just optionally):
|
||||||
# include(CodeCoverage)
|
# include(CodeCoverage)
|
||||||
#
|
#
|
||||||
# 3. Append necessary compiler flags and linker flags for all supported source files:
|
# 3. Append necessary compiler flags for all supported source files:
|
||||||
# add_code_coverage_to_target(<target> <PRIVATE|PUBLIC|INTERFACE>)
|
# append_coverage_compiler_flags()
|
||||||
|
# Or for specific target:
|
||||||
|
# append_coverage_compiler_flags_to_target(YOUR_TARGET_NAME)
|
||||||
#
|
#
|
||||||
# 3.a (OPTIONAL) Set appropriate optimization flags, e.g. -O0, -O1 or -Og
|
# 3.a (OPTIONAL) Set appropriate optimization flags, e.g. -O0, -O1 or -Og
|
||||||
#
|
#
|
||||||
@@ -207,69 +204,67 @@ endforeach()
|
|||||||
|
|
||||||
set(COVERAGE_COMPILER_FLAGS "-g --coverage"
|
set(COVERAGE_COMPILER_FLAGS "-g --coverage"
|
||||||
CACHE INTERNAL "")
|
CACHE INTERNAL "")
|
||||||
|
|
||||||
set(COVERAGE_CXX_COMPILER_FLAGS "")
|
|
||||||
set(COVERAGE_C_COMPILER_FLAGS "")
|
|
||||||
set(COVERAGE_CXX_LINKER_FLAGS "")
|
|
||||||
set(COVERAGE_C_LINKER_FLAGS "")
|
|
||||||
|
|
||||||
if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)")
|
if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)")
|
||||||
include(CheckCXXCompilerFlag)
|
include(CheckCXXCompilerFlag)
|
||||||
include(CheckCCompilerFlag)
|
include(CheckCCompilerFlag)
|
||||||
include(CheckLinkerFlag)
|
|
||||||
|
|
||||||
set(COVERAGE_CXX_COMPILER_FLAGS ${COVERAGE_COMPILER_FLAGS})
|
|
||||||
set(COVERAGE_C_COMPILER_FLAGS ${COVERAGE_COMPILER_FLAGS})
|
|
||||||
set(COVERAGE_CXX_LINKER_FLAGS ${COVERAGE_COMPILER_FLAGS})
|
|
||||||
set(COVERAGE_C_LINKER_FLAGS ${COVERAGE_COMPILER_FLAGS})
|
|
||||||
|
|
||||||
check_cxx_compiler_flag(-fprofile-abs-path HAVE_cxx_fprofile_abs_path)
|
check_cxx_compiler_flag(-fprofile-abs-path HAVE_cxx_fprofile_abs_path)
|
||||||
if(HAVE_cxx_fprofile_abs_path)
|
if(HAVE_cxx_fprofile_abs_path)
|
||||||
set(COVERAGE_CXX_COMPILER_FLAGS "${COVERAGE_CXX_COMPILER_FLAGS} -fprofile-abs-path")
|
set(COVERAGE_CXX_COMPILER_FLAGS "${COVERAGE_COMPILER_FLAGS} -fprofile-abs-path")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
check_c_compiler_flag(-fprofile-abs-path HAVE_c_fprofile_abs_path)
|
check_c_compiler_flag(-fprofile-abs-path HAVE_c_fprofile_abs_path)
|
||||||
if(HAVE_c_fprofile_abs_path)
|
if(HAVE_c_fprofile_abs_path)
|
||||||
set(COVERAGE_C_COMPILER_FLAGS "${COVERAGE_C_COMPILER_FLAGS} -fprofile-abs-path")
|
set(COVERAGE_C_COMPILER_FLAGS "${COVERAGE_COMPILER_FLAGS} -fprofile-abs-path")
|
||||||
endif()
|
|
||||||
|
|
||||||
check_linker_flag(CXX -fprofile-abs-path HAVE_cxx_linker_fprofile_abs_path)
|
|
||||||
if(HAVE_cxx_linker_fprofile_abs_path)
|
|
||||||
set(COVERAGE_CXX_LINKER_FLAGS "${COVERAGE_CXX_LINKER_FLAGS} -fprofile-abs-path")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
check_linker_flag(C -fprofile-abs-path HAVE_c_linker_fprofile_abs_path)
|
|
||||||
if(HAVE_c_linker_fprofile_abs_path)
|
|
||||||
set(COVERAGE_C_LINKER_FLAGS "${COVERAGE_C_LINKER_FLAGS} -fprofile-abs-path")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
check_cxx_compiler_flag(-fprofile-update=atomic HAVE_cxx_fprofile_update)
|
check_cxx_compiler_flag(-fprofile-update=atomic HAVE_cxx_fprofile_update)
|
||||||
if(HAVE_cxx_fprofile_update)
|
if(HAVE_cxx_fprofile_update)
|
||||||
set(COVERAGE_CXX_COMPILER_FLAGS "${COVERAGE_CXX_COMPILER_FLAGS} -fprofile-update=atomic")
|
set(COVERAGE_CXX_COMPILER_FLAGS "${COVERAGE_COMPILER_FLAGS} -fprofile-update=atomic")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
check_c_compiler_flag(-fprofile-update=atomic HAVE_c_fprofile_update)
|
check_c_compiler_flag(-fprofile-update=atomic HAVE_c_fprofile_update)
|
||||||
if(HAVE_c_fprofile_update)
|
if(HAVE_c_fprofile_update)
|
||||||
set(COVERAGE_C_COMPILER_FLAGS "${COVERAGE_C_COMPILER_FLAGS} -fprofile-update=atomic")
|
set(COVERAGE_C_COMPILER_FLAGS "${COVERAGE_COMPILER_FLAGS} -fprofile-update=atomic")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
check_linker_flag(CXX -fprofile-update=atomic HAVE_cxx_linker_fprofile_update)
|
|
||||||
if(HAVE_cxx_linker_fprofile_update)
|
|
||||||
set(COVERAGE_CXX_LINKER_FLAGS "${COVERAGE_CXX_LINKER_FLAGS} -fprofile-update=atomic")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
check_linker_flag(C -fprofile-update=atomic HAVE_c_linker_fprofile_update)
|
|
||||||
if(HAVE_c_linker_fprofile_update)
|
|
||||||
set(COVERAGE_C_LINKER_FLAGS "${COVERAGE_C_LINKER_FLAGS} -fprofile-update=atomic")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(CMAKE_Fortran_FLAGS_COVERAGE
|
||||||
|
${COVERAGE_COMPILER_FLAGS}
|
||||||
|
CACHE STRING "Flags used by the Fortran compiler during coverage builds."
|
||||||
|
FORCE )
|
||||||
|
set(CMAKE_CXX_FLAGS_COVERAGE
|
||||||
|
${COVERAGE_COMPILER_FLAGS}
|
||||||
|
CACHE STRING "Flags used by the C++ compiler during coverage builds."
|
||||||
|
FORCE )
|
||||||
|
set(CMAKE_C_FLAGS_COVERAGE
|
||||||
|
${COVERAGE_COMPILER_FLAGS}
|
||||||
|
CACHE STRING "Flags used by the C compiler during coverage builds."
|
||||||
|
FORCE )
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS_COVERAGE
|
||||||
|
""
|
||||||
|
CACHE STRING "Flags used for linking binaries during coverage builds."
|
||||||
|
FORCE )
|
||||||
|
set(CMAKE_SHARED_LINKER_FLAGS_COVERAGE
|
||||||
|
""
|
||||||
|
CACHE STRING "Flags used by the shared libraries linker during coverage builds."
|
||||||
|
FORCE )
|
||||||
|
mark_as_advanced(
|
||||||
|
CMAKE_Fortran_FLAGS_COVERAGE
|
||||||
|
CMAKE_CXX_FLAGS_COVERAGE
|
||||||
|
CMAKE_C_FLAGS_COVERAGE
|
||||||
|
CMAKE_EXE_LINKER_FLAGS_COVERAGE
|
||||||
|
CMAKE_SHARED_LINKER_FLAGS_COVERAGE )
|
||||||
|
|
||||||
get_property(GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
get_property(GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||||
if(NOT (CMAKE_BUILD_TYPE STREQUAL "Debug" OR GENERATOR_IS_MULTI_CONFIG))
|
if(NOT (CMAKE_BUILD_TYPE STREQUAL "Debug" OR GENERATOR_IS_MULTI_CONFIG))
|
||||||
message(WARNING "Code coverage results with an optimised (non-Debug) build may be misleading")
|
message(WARNING "Code coverage results with an optimised (non-Debug) build may be misleading")
|
||||||
endif() # NOT (CMAKE_BUILD_TYPE STREQUAL "Debug" OR GENERATOR_IS_MULTI_CONFIG)
|
endif() # NOT (CMAKE_BUILD_TYPE STREQUAL "Debug" OR GENERATOR_IS_MULTI_CONFIG)
|
||||||
|
|
||||||
|
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
|
||||||
|
link_libraries(gcov)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Defines a target for running and collection code coverage information
|
# Defines a target for running and collection code coverage information
|
||||||
# Builds dependencies, runs the given executable and outputs reports.
|
# Builds dependencies, runs the given executable and outputs reports.
|
||||||
# NOTE! The executable should always have a ZERO as exit code otherwise
|
# NOTE! The executable should always have a ZERO as exit code otherwise
|
||||||
@@ -459,19 +454,18 @@ function(setup_target_for_coverage_gcovr)
|
|||||||
)
|
)
|
||||||
endfunction() # setup_target_for_coverage_gcovr
|
endfunction() # setup_target_for_coverage_gcovr
|
||||||
|
|
||||||
function(add_code_coverage_to_target name scope)
|
function(append_coverage_compiler_flags)
|
||||||
separate_arguments(COVERAGE_CXX_COMPILER_FLAGS NATIVE_COMMAND "${COVERAGE_CXX_COMPILER_FLAGS}")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COVERAGE_COMPILER_FLAGS}" PARENT_SCOPE)
|
||||||
separate_arguments(COVERAGE_C_COMPILER_FLAGS NATIVE_COMMAND "${COVERAGE_C_COMPILER_FLAGS}")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COVERAGE_COMPILER_FLAGS}" PARENT_SCOPE)
|
||||||
separate_arguments(COVERAGE_CXX_LINKER_FLAGS NATIVE_COMMAND "${COVERAGE_CXX_LINKER_FLAGS}")
|
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${COVERAGE_COMPILER_FLAGS}" PARENT_SCOPE)
|
||||||
separate_arguments(COVERAGE_C_LINKER_FLAGS NATIVE_COMMAND "${COVERAGE_C_LINKER_FLAGS}")
|
message(STATUS "Appending code coverage compiler flags: ${COVERAGE_COMPILER_FLAGS}")
|
||||||
|
endfunction() # append_coverage_compiler_flags
|
||||||
|
|
||||||
# Add compiler options to the target
|
# Setup coverage for specific library
|
||||||
target_compile_options(${name} ${scope}
|
function(append_coverage_compiler_flags_to_target name)
|
||||||
$<$<COMPILE_LANGUAGE:CXX>:${COVERAGE_CXX_COMPILER_FLAGS}>
|
separate_arguments(_flag_list NATIVE_COMMAND "${COVERAGE_COMPILER_FLAGS}")
|
||||||
$<$<COMPILE_LANGUAGE:C>:${COVERAGE_C_COMPILER_FLAGS}>)
|
target_compile_options(${name} PRIVATE ${_flag_list})
|
||||||
|
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
|
||||||
target_link_libraries (${name} ${scope}
|
target_link_libraries(${name} PRIVATE gcov)
|
||||||
$<$<LINK_LANGUAGE:CXX>:${COVERAGE_CXX_LINKER_FLAGS} gcov>
|
endif()
|
||||||
$<$<LINK_LANGUAGE:C>:${COVERAGE_C_LINKER_FLAGS} gcov>
|
endfunction()
|
||||||
)
|
|
||||||
endfunction() # add_code_coverage_to_target
|
|
||||||
|
|||||||
@@ -16,13 +16,16 @@ set(CMAKE_CXX_EXTENSIONS OFF)
|
|||||||
target_compile_definitions (common
|
target_compile_definitions (common
|
||||||
INTERFACE
|
INTERFACE
|
||||||
$<$<CONFIG:Debug>:DEBUG _DEBUG>
|
$<$<CONFIG:Debug>:DEBUG _DEBUG>
|
||||||
$<$<AND:$<BOOL:${profile}>,$<NOT:$<BOOL:${assert}>>>:NDEBUG>)
|
#[===[
|
||||||
# ^^^^ NOTE: CMAKE release builds already have NDEBUG
|
NOTE: CMAKE release builds already have NDEBUG defined, so no need to add it
|
||||||
# defined, so no need to add it explicitly except for
|
explicitly except for the special case of (profile ON) and (assert OFF).
|
||||||
# this special case of (profile ON) and (assert OFF)
|
Presumably this is because we don't want profile builds asserting unless
|
||||||
# -- presumably this is because we don't want profile
|
asserts were specifically requested.
|
||||||
# builds asserting unless asserts were specifically
|
]===]
|
||||||
# requested
|
$<$<AND:$<BOOL:${profile}>,$<NOT:$<BOOL:${assert}>>>:NDEBUG>
|
||||||
|
# TODO: Remove once we have migrated functions from OpenSSL 1.x to 3.x.
|
||||||
|
OPENSSL_SUPPRESS_DEPRECATED
|
||||||
|
)
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
# remove existing exception flag since we set it to -EHa
|
# remove existing exception flag since we set it to -EHa
|
||||||
|
|||||||
@@ -111,12 +111,6 @@ target_link_libraries(xrpl.libxrpl.net PUBLIC
|
|||||||
add_module(xrpl server)
|
add_module(xrpl server)
|
||||||
target_link_libraries(xrpl.libxrpl.server PUBLIC xrpl.libxrpl.protocol)
|
target_link_libraries(xrpl.libxrpl.server PUBLIC xrpl.libxrpl.protocol)
|
||||||
|
|
||||||
add_module(xrpl ledger)
|
|
||||||
target_link_libraries(xrpl.libxrpl.ledger PUBLIC
|
|
||||||
xrpl.libxrpl.basics
|
|
||||||
xrpl.libxrpl.json
|
|
||||||
xrpl.libxrpl.protocol
|
|
||||||
)
|
|
||||||
|
|
||||||
add_library(xrpl.libxrpl)
|
add_library(xrpl.libxrpl)
|
||||||
set_target_properties(xrpl.libxrpl PROPERTIES OUTPUT_NAME xrpl)
|
set_target_properties(xrpl.libxrpl PROPERTIES OUTPUT_NAME xrpl)
|
||||||
@@ -137,7 +131,6 @@ target_link_modules(xrpl PUBLIC
|
|||||||
resource
|
resource
|
||||||
server
|
server
|
||||||
net
|
net
|
||||||
ledger
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# All headers in libxrpl are in modules.
|
# All headers in libxrpl are in modules.
|
||||||
|
|||||||
@@ -33,8 +33,6 @@ setup_target_for_coverage_gcovr(
|
|||||||
FORMAT ${coverage_format}
|
FORMAT ${coverage_format}
|
||||||
EXECUTABLE rippled
|
EXECUTABLE rippled
|
||||||
EXECUTABLE_ARGS --unittest$<$<BOOL:${coverage_test}>:=${coverage_test}> --unittest-jobs ${coverage_test_parallelism} --quiet --unittest-log
|
EXECUTABLE_ARGS --unittest$<$<BOOL:${coverage_test}>:=${coverage_test}> --unittest-jobs ${coverage_test_parallelism} --quiet --unittest-log
|
||||||
EXCLUDE "src/test" "src/tests" "include/xrpl/beast/test" "include/xrpl/beast/unit_test" "${CMAKE_BINARY_DIR}/pb-xrpl.libpb"
|
EXCLUDE "src/test" "include/xrpl/beast/test" "include/xrpl/beast/unit_test" "${CMAKE_BINARY_DIR}/pb-xrpl.libpb"
|
||||||
DEPENDENCIES rippled
|
DEPENDENCIES rippled
|
||||||
)
|
)
|
||||||
|
|
||||||
add_code_coverage_to_target(opts INTERFACE)
|
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ install (
|
|||||||
xrpl.libxrpl.json
|
xrpl.libxrpl.json
|
||||||
xrpl.libxrpl.protocol
|
xrpl.libxrpl.protocol
|
||||||
xrpl.libxrpl.resource
|
xrpl.libxrpl.resource
|
||||||
xrpl.libxrpl.ledger
|
|
||||||
xrpl.libxrpl.server
|
xrpl.libxrpl.server
|
||||||
xrpl.libxrpl.net
|
xrpl.libxrpl.net
|
||||||
xrpl.libxrpl
|
xrpl.libxrpl
|
||||||
|
|||||||
@@ -28,11 +28,15 @@ target_compile_options (opts
|
|||||||
$<$<AND:$<BOOL:${is_gcc}>,$<COMPILE_LANGUAGE:CXX>>:-Wsuggest-override>
|
$<$<AND:$<BOOL:${is_gcc}>,$<COMPILE_LANGUAGE:CXX>>:-Wsuggest-override>
|
||||||
$<$<BOOL:${is_gcc}>:-Wno-maybe-uninitialized>
|
$<$<BOOL:${is_gcc}>:-Wno-maybe-uninitialized>
|
||||||
$<$<BOOL:${perf}>:-fno-omit-frame-pointer>
|
$<$<BOOL:${perf}>:-fno-omit-frame-pointer>
|
||||||
|
$<$<AND:$<BOOL:${is_gcc}>,$<BOOL:${coverage}>>:-g --coverage -fprofile-abs-path>
|
||||||
|
$<$<AND:$<BOOL:${is_clang}>,$<BOOL:${coverage}>>:-g --coverage>
|
||||||
$<$<BOOL:${profile}>:-pg>
|
$<$<BOOL:${profile}>:-pg>
|
||||||
$<$<AND:$<BOOL:${is_gcc}>,$<BOOL:${profile}>>:-p>)
|
$<$<AND:$<BOOL:${is_gcc}>,$<BOOL:${profile}>>:-p>)
|
||||||
|
|
||||||
target_link_libraries (opts
|
target_link_libraries (opts
|
||||||
INTERFACE
|
INTERFACE
|
||||||
|
$<$<AND:$<BOOL:${is_gcc}>,$<BOOL:${coverage}>>:-g --coverage -fprofile-abs-path>
|
||||||
|
$<$<AND:$<BOOL:${is_clang}>,$<BOOL:${coverage}>>:-g --coverage>
|
||||||
$<$<BOOL:${profile}>:-pg>
|
$<$<BOOL:${profile}>:-pg>
|
||||||
$<$<AND:$<BOOL:${is_gcc}>,$<BOOL:${profile}>>:-p>)
|
$<$<AND:$<BOOL:${is_gcc}>,$<BOOL:${profile}>>:-p>)
|
||||||
|
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ option(beast_no_unit_test_inline
|
|||||||
"Prevents unit test definitions from being inserted into global table"
|
"Prevents unit test definitions from being inserted into global table"
|
||||||
OFF)
|
OFF)
|
||||||
option(single_io_service_thread
|
option(single_io_service_thread
|
||||||
"Restricts the number of threads calling io_service::run to one. \
|
"Restricts the number of threads calling io_context::run to one. \
|
||||||
This can be useful when debugging."
|
This can be useful when debugging."
|
||||||
OFF)
|
OFF)
|
||||||
option(boost_show_deprecated
|
option(boost_show_deprecated
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ target_link_libraries(ripple_boost
|
|||||||
Boost::date_time
|
Boost::date_time
|
||||||
Boost::filesystem
|
Boost::filesystem
|
||||||
Boost::json
|
Boost::json
|
||||||
|
Boost::process
|
||||||
Boost::program_options
|
Boost::program_options
|
||||||
Boost::regex
|
Boost::regex
|
||||||
Boost::system
|
Boost::system
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ function(xrpl_add_test name)
|
|||||||
"${CMAKE_CURRENT_SOURCE_DIR}/${name}/*.cpp"
|
"${CMAKE_CURRENT_SOURCE_DIR}/${name}/*.cpp"
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/${name}.cpp"
|
"${CMAKE_CURRENT_SOURCE_DIR}/${name}.cpp"
|
||||||
)
|
)
|
||||||
add_executable(${target} ${ARGN} ${sources})
|
add_executable(${target} EXCLUDE_FROM_ALL ${ARGN} ${sources})
|
||||||
|
|
||||||
isolate_headers(
|
isolate_headers(
|
||||||
${target}
|
${target}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
"rocksdb/10.0.1#85537f46e538974d67da0c3977de48ac%1756234304.347",
|
"rocksdb/10.0.1#85537f46e538974d67da0c3977de48ac%1756234304.347",
|
||||||
"re2/20230301#dfd6e2bf050eb90ddd8729cfb4c844a4%1756234257.976",
|
"re2/20230301#dfd6e2bf050eb90ddd8729cfb4c844a4%1756234257.976",
|
||||||
"protobuf/3.21.12#d927114e28de9f4691a6bbcdd9a529d1%1756234251.614",
|
"protobuf/3.21.12#d927114e28de9f4691a6bbcdd9a529d1%1756234251.614",
|
||||||
"openssl/1.1.1w#a8f0792d7c5121b954578a7149d23e03%1756223730.729",
|
"openssl/3.5.2#0c5a5e15ae569f45dff57adcf1770cf7%1756234259.61",
|
||||||
"nudb/2.0.9#c62cfd501e57055a7e0d8ee3d5e5427d%1756234237.107",
|
"nudb/2.0.9#c62cfd501e57055a7e0d8ee3d5e5427d%1756234237.107",
|
||||||
"lz4/1.10.0#59fc63cac7f10fbe8e05c7e62c2f3504%1756234228.999",
|
"lz4/1.10.0#59fc63cac7f10fbe8e05c7e62c2f3504%1756234228.999",
|
||||||
"libiconv/1.17#1e65319e945f2d31941a9d28cc13c058%1756223727.64",
|
"libiconv/1.17#1e65319e945f2d31941a9d28cc13c058%1756223727.64",
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
"date/3.0.4#f74bbba5a08fa388256688743136cb6f%1756234217.493",
|
"date/3.0.4#f74bbba5a08fa388256688743136cb6f%1756234217.493",
|
||||||
"c-ares/1.34.5#b78b91e7cfb1f11ce777a285bbf169c6%1756234217.915",
|
"c-ares/1.34.5#b78b91e7cfb1f11ce777a285bbf169c6%1756234217.915",
|
||||||
"bzip2/1.0.8#00b4a4658791c1f06914e087f0e792f5%1756234261.716",
|
"bzip2/1.0.8#00b4a4658791c1f06914e087f0e792f5%1756234261.716",
|
||||||
"boost/1.83.0#5d975011d65b51abb2d2f6eb8386b368%1754325043.336",
|
"boost/1.88.0#8852c0b72ce8271fb8ff7c53456d4983%1756223752.326",
|
||||||
"abseil/20230802.1#f0f91485b111dc9837a68972cb19ca7b%1756234220.907"
|
"abseil/20230802.1#f0f91485b111dc9837a68972cb19ca7b%1756234220.907"
|
||||||
],
|
],
|
||||||
"build_requires": [
|
"build_requires": [
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
"lz4/1.10.0"
|
"lz4/1.10.0"
|
||||||
],
|
],
|
||||||
"boost/1.83.0": [
|
"boost/1.83.0": [
|
||||||
"boost/1.83.0"
|
"boost/1.88.0"
|
||||||
],
|
],
|
||||||
"sqlite3/3.44.2": [
|
"sqlite3/3.44.2": [
|
||||||
"sqlite3/3.49.1"
|
"sqlite3/3.49.1"
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
# Global configuration for Conan. This is used to set the number of parallel
|
# Global configuration for Conan. This is used to set the number of parallel
|
||||||
# downloads and uploads.
|
# downloads, uploads, and build jobs. The verbosity is set to verbose to
|
||||||
|
# provide more information during the build process.
|
||||||
core:non_interactive=True
|
core:non_interactive=True
|
||||||
core.download:parallel={{ os.cpu_count() }}
|
core.download:parallel={{ os.cpu_count() }}
|
||||||
core.upload:parallel={{ os.cpu_count() }}
|
core.upload:parallel={{ os.cpu_count() }}
|
||||||
|
tools.build:jobs={{ (os.cpu_count() * 4/5) | int }}
|
||||||
|
tools.build:verbosity=verbose
|
||||||
|
tools.compilation:verbosity=verbose
|
||||||
|
|||||||
@@ -21,14 +21,14 @@ compiler.libcxx={{detect_api.detect_libcxx(compiler, version, compiler_exe)}}
|
|||||||
|
|
||||||
[conf]
|
[conf]
|
||||||
{% if compiler == "clang" and compiler_version >= 19 %}
|
{% if compiler == "clang" and compiler_version >= 19 %}
|
||||||
grpc/1.50.1:tools.build:cxxflags+=['-Wno-missing-template-arg-list-after-template-kw']
|
tools.build:cxxflags=['-Wno-missing-template-arg-list-after-template-kw']
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if compiler == "apple-clang" and compiler_version >= 17 %}
|
{% if compiler == "apple-clang" and compiler_version >= 17 %}
|
||||||
grpc/1.50.1:tools.build:cxxflags+=['-Wno-missing-template-arg-list-after-template-kw']
|
tools.build:cxxflags=['-Wno-missing-template-arg-list-after-template-kw']
|
||||||
{% endif %}
|
|
||||||
{% if compiler == "clang" and compiler_version == 16 %}
|
|
||||||
tools.build:cxxflags=['-DBOOST_ASIO_DISABLE_CONCEPTS']
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if compiler == "gcc" and compiler_version < 13 %}
|
{% if compiler == "gcc" and compiler_version < 13 %}
|
||||||
tools.build:cxxflags+=['-Wno-restrict']
|
tools.build:cxxflags=['-Wno-restrict']
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
[tool_requires]
|
||||||
|
!cmake/*: cmake/[>=3 <4]
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class Xrpl(ConanFile):
|
|||||||
'grpc/1.50.1',
|
'grpc/1.50.1',
|
||||||
'libarchive/3.8.1',
|
'libarchive/3.8.1',
|
||||||
'nudb/2.0.9',
|
'nudb/2.0.9',
|
||||||
'openssl/1.1.1w',
|
'openssl/3.5.2',
|
||||||
'soci/4.0.3',
|
'soci/4.0.3',
|
||||||
'zlib/1.3.1',
|
'zlib/1.3.1',
|
||||||
]
|
]
|
||||||
@@ -100,11 +100,13 @@ class Xrpl(ConanFile):
|
|||||||
def configure(self):
|
def configure(self):
|
||||||
if self.settings.compiler == 'apple-clang':
|
if self.settings.compiler == 'apple-clang':
|
||||||
self.options['boost'].visibility = 'global'
|
self.options['boost'].visibility = 'global'
|
||||||
|
if self.settings.compiler in ['clang', 'gcc']:
|
||||||
|
self.options['boost'].without_cobalt = True
|
||||||
|
|
||||||
def requirements(self):
|
def requirements(self):
|
||||||
# Conan 2 requires transitive headers to be specified
|
# Conan 2 requires transitive headers to be specified
|
||||||
transitive_headers_opt = {'transitive_headers': True} if conan_version.split('.')[0] == '2' else {}
|
transitive_headers_opt = {'transitive_headers': True} if conan_version.split('.')[0] == '2' else {}
|
||||||
self.requires('boost/1.83.0', force=True, **transitive_headers_opt)
|
self.requires('boost/1.88.0', force=True, **transitive_headers_opt)
|
||||||
self.requires('date/3.0.4', **transitive_headers_opt)
|
self.requires('date/3.0.4', **transitive_headers_opt)
|
||||||
self.requires('lz4/1.10.0', force=True)
|
self.requires('lz4/1.10.0', force=True)
|
||||||
self.requires('protobuf/3.21.12', force=True)
|
self.requires('protobuf/3.21.12', force=True)
|
||||||
@@ -175,6 +177,7 @@ class Xrpl(ConanFile):
|
|||||||
'boost::filesystem',
|
'boost::filesystem',
|
||||||
'boost::json',
|
'boost::json',
|
||||||
'boost::program_options',
|
'boost::program_options',
|
||||||
|
'boost::process',
|
||||||
'boost::regex',
|
'boost::regex',
|
||||||
'boost::system',
|
'boost::system',
|
||||||
'boost::thread',
|
'boost::thread',
|
||||||
|
|||||||
15
external/rust-test/CMakeLists.txt
vendored
Normal file
15
external/rust-test/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.15)
|
||||||
|
project(RustTest)
|
||||||
|
|
||||||
|
set(CMAKE_INSTALL_CMAKEDIR "lib/cmake/RustTest")
|
||||||
|
|
||||||
|
execute_process(COMMAND cargo run --bin install -- --release WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
|
||||||
|
|
||||||
|
set(INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/target/install/release/include/")
|
||||||
|
|
||||||
|
add_library(RustTest STATIC IMPORTED GLOBAL)
|
||||||
|
|
||||||
|
set_target_properties(RustTest PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/target/install/release/lib/RustTest.a"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/target/install/release/include/"
|
||||||
|
)
|
||||||
568
external/rust-test/Cargo.lock
generated
vendored
Normal file
568
external/rust-test/Cargo.lock
generated
vendored
Normal file
@@ -0,0 +1,568 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 4
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "RustTest"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"cbindgen",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstream"
|
||||||
|
version = "0.6.19"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "301af1932e46185686725e0fad2f8f2aa7da69dd70bf6ecc44d6b703844a3933"
|
||||||
|
dependencies = [
|
||||||
|
"anstyle",
|
||||||
|
"anstyle-parse",
|
||||||
|
"anstyle-query",
|
||||||
|
"anstyle-wincon",
|
||||||
|
"colorchoice",
|
||||||
|
"is_terminal_polyfill",
|
||||||
|
"utf8parse",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstyle"
|
||||||
|
version = "1.0.11"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstyle-parse"
|
||||||
|
version = "0.2.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2"
|
||||||
|
dependencies = [
|
||||||
|
"utf8parse",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstyle-query"
|
||||||
|
version = "1.1.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6c8bdeb6047d8983be085bab0ba1472e6dc604e7041dbf6fcd5e71523014fae9"
|
||||||
|
dependencies = [
|
||||||
|
"windows-sys 0.59.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstyle-wincon"
|
||||||
|
version = "3.0.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "403f75924867bb1033c59fbf0797484329750cfbe3c4325cd33127941fabc882"
|
||||||
|
dependencies = [
|
||||||
|
"anstyle",
|
||||||
|
"once_cell_polyfill",
|
||||||
|
"windows-sys 0.59.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bitflags"
|
||||||
|
version = "2.9.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cbindgen"
|
||||||
|
version = "0.29.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "975982cdb7ad6a142be15bdf84aea7ec6a9e5d4d797c004d43185b24cfe4e684"
|
||||||
|
dependencies = [
|
||||||
|
"clap",
|
||||||
|
"heck",
|
||||||
|
"indexmap",
|
||||||
|
"log",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"syn",
|
||||||
|
"tempfile",
|
||||||
|
"toml",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cfg-if"
|
||||||
|
version = "1.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "clap"
|
||||||
|
version = "4.5.41"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "be92d32e80243a54711e5d7ce823c35c41c9d929dc4ab58e1276f625841aadf9"
|
||||||
|
dependencies = [
|
||||||
|
"clap_builder",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "clap_builder"
|
||||||
|
version = "4.5.41"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "707eab41e9622f9139419d573eca0900137718000c517d47da73045f54331c3d"
|
||||||
|
dependencies = [
|
||||||
|
"anstream",
|
||||||
|
"anstyle",
|
||||||
|
"clap_lex",
|
||||||
|
"strsim",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "clap_lex"
|
||||||
|
version = "0.7.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "colorchoice"
|
||||||
|
version = "1.0.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "equivalent"
|
||||||
|
version = "1.0.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "errno"
|
||||||
|
version = "0.3.13"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"windows-sys 0.60.2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fastrand"
|
||||||
|
version = "2.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "getrandom"
|
||||||
|
version = "0.3.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"libc",
|
||||||
|
"r-efi",
|
||||||
|
"wasi",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hashbrown"
|
||||||
|
version = "0.15.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "heck"
|
||||||
|
version = "0.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "indexmap"
|
||||||
|
version = "2.10.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661"
|
||||||
|
dependencies = [
|
||||||
|
"equivalent",
|
||||||
|
"hashbrown",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "is_terminal_polyfill"
|
||||||
|
version = "1.70.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "itoa"
|
||||||
|
version = "1.0.15"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libc"
|
||||||
|
version = "0.2.174"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "linux-raw-sys"
|
||||||
|
version = "0.9.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "log"
|
||||||
|
version = "0.4.27"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "memchr"
|
||||||
|
version = "2.7.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "once_cell"
|
||||||
|
version = "1.21.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "once_cell_polyfill"
|
||||||
|
version = "1.70.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "proc-macro2"
|
||||||
|
version = "1.0.95"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778"
|
||||||
|
dependencies = [
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "quote"
|
||||||
|
version = "1.0.40"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "r-efi"
|
||||||
|
version = "5.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rustix"
|
||||||
|
version = "1.0.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "11181fbabf243db407ef8df94a6ce0b2f9a733bd8be4ad02b4eda9602296cac8"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
"errno",
|
||||||
|
"libc",
|
||||||
|
"linux-raw-sys",
|
||||||
|
"windows-sys 0.60.2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ryu"
|
||||||
|
version = "1.0.20"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde"
|
||||||
|
version = "1.0.219"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6"
|
||||||
|
dependencies = [
|
||||||
|
"serde_derive",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_derive"
|
||||||
|
version = "1.0.219"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_json"
|
||||||
|
version = "1.0.141"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "30b9eff21ebe718216c6ec64e1d9ac57087aad11efc64e32002bce4a0d4c03d3"
|
||||||
|
dependencies = [
|
||||||
|
"itoa",
|
||||||
|
"memchr",
|
||||||
|
"ryu",
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_spanned"
|
||||||
|
version = "0.6.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "strsim"
|
||||||
|
version = "0.11.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "syn"
|
||||||
|
version = "2.0.104"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tempfile"
|
||||||
|
version = "3.20.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e8a64e3985349f2441a1a9ef0b853f869006c3855f2cda6862a94d26ebb9d6a1"
|
||||||
|
dependencies = [
|
||||||
|
"fastrand",
|
||||||
|
"getrandom",
|
||||||
|
"once_cell",
|
||||||
|
"rustix",
|
||||||
|
"windows-sys 0.59.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "toml"
|
||||||
|
version = "0.8.23"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
"serde_spanned",
|
||||||
|
"toml_datetime",
|
||||||
|
"toml_edit",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "toml_datetime"
|
||||||
|
version = "0.6.11"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "toml_edit"
|
||||||
|
version = "0.22.27"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a"
|
||||||
|
dependencies = [
|
||||||
|
"indexmap",
|
||||||
|
"serde",
|
||||||
|
"serde_spanned",
|
||||||
|
"toml_datetime",
|
||||||
|
"toml_write",
|
||||||
|
"winnow",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "toml_write"
|
||||||
|
version = "0.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-ident"
|
||||||
|
version = "1.0.18"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "utf8parse"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasi"
|
||||||
|
version = "0.14.2+wasi-0.2.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3"
|
||||||
|
dependencies = [
|
||||||
|
"wit-bindgen-rt",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-sys"
|
||||||
|
version = "0.59.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
|
||||||
|
dependencies = [
|
||||||
|
"windows-targets 0.52.6",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-sys"
|
||||||
|
version = "0.60.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb"
|
||||||
|
dependencies = [
|
||||||
|
"windows-targets 0.53.2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-targets"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
||||||
|
dependencies = [
|
||||||
|
"windows_aarch64_gnullvm 0.52.6",
|
||||||
|
"windows_aarch64_msvc 0.52.6",
|
||||||
|
"windows_i686_gnu 0.52.6",
|
||||||
|
"windows_i686_gnullvm 0.52.6",
|
||||||
|
"windows_i686_msvc 0.52.6",
|
||||||
|
"windows_x86_64_gnu 0.52.6",
|
||||||
|
"windows_x86_64_gnullvm 0.52.6",
|
||||||
|
"windows_x86_64_msvc 0.52.6",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-targets"
|
||||||
|
version = "0.53.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c66f69fcc9ce11da9966ddb31a40968cad001c5bedeb5c2b82ede4253ab48aef"
|
||||||
|
dependencies = [
|
||||||
|
"windows_aarch64_gnullvm 0.53.0",
|
||||||
|
"windows_aarch64_msvc 0.53.0",
|
||||||
|
"windows_i686_gnu 0.53.0",
|
||||||
|
"windows_i686_gnullvm 0.53.0",
|
||||||
|
"windows_i686_msvc 0.53.0",
|
||||||
|
"windows_x86_64_gnu 0.53.0",
|
||||||
|
"windows_x86_64_gnullvm 0.53.0",
|
||||||
|
"windows_x86_64_msvc 0.53.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_aarch64_gnullvm"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_aarch64_gnullvm"
|
||||||
|
version = "0.53.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_aarch64_msvc"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_aarch64_msvc"
|
||||||
|
version = "0.53.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_gnu"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_gnu"
|
||||||
|
version = "0.53.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_gnullvm"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_gnullvm"
|
||||||
|
version = "0.53.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_msvc"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_msvc"
|
||||||
|
version = "0.53.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_gnu"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_gnu"
|
||||||
|
version = "0.53.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_gnullvm"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_gnullvm"
|
||||||
|
version = "0.53.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_msvc"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_msvc"
|
||||||
|
version = "0.53.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winnow"
|
||||||
|
version = "0.7.12"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f3edebf492c8125044983378ecb5766203ad3b4c2f7a922bd7dd207f6d443e95"
|
||||||
|
dependencies = [
|
||||||
|
"memchr",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wit-bindgen-rt"
|
||||||
|
version = "0.39.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
]
|
||||||
13
external/rust-test/Cargo.toml
vendored
Normal file
13
external/rust-test/Cargo.toml
vendored
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
[package]
|
||||||
|
name = "RustTest"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
name = "test"
|
||||||
|
crate-type = ["staticlib"]
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
cbindgen = "0.29"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
15
external/rust-test/build.rs
vendored
Normal file
15
external/rust-test/build.rs
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
use std::{env};
|
||||||
|
use std::{path::PathBuf};
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let crate_name = env::var("CARGO_PKG_NAME").unwrap();
|
||||||
|
let header_name = format!("{}.h", crate_name);
|
||||||
|
|
||||||
|
let crate_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
|
||||||
|
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
|
||||||
|
let header_path = out_dir.join(header_name);
|
||||||
|
|
||||||
|
cbindgen::generate(&crate_dir)
|
||||||
|
.expect("Unable to generate bindings")
|
||||||
|
.write_to_file(header_path);
|
||||||
|
}
|
||||||
54
external/rust-test/src/bin/install.rs
vendored
Normal file
54
external/rust-test/src/bin/install.rs
vendored
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
use std::path::PathBuf;
|
||||||
|
use std::process::{Command};
|
||||||
|
use std::{env, fs};
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let args: Vec<String> = env::args().collect();
|
||||||
|
// Pass 'build' for the first argument and pass all other
|
||||||
|
// parameters to the cargo command
|
||||||
|
Command::new("cargo")
|
||||||
|
.arg("build")
|
||||||
|
.args(args.iter().skip(1))
|
||||||
|
.status()
|
||||||
|
.expect("failed to run cargo");
|
||||||
|
|
||||||
|
// Determine the build config
|
||||||
|
let build_config = args.iter()
|
||||||
|
.map(|arg| arg.to_lowercase())
|
||||||
|
.filter(|arg| arg == "--release" || arg == "--debug")
|
||||||
|
.next()
|
||||||
|
.unwrap_or("--debug".to_string());
|
||||||
|
|
||||||
|
let config = if build_config == "--debug" { "debug" } else { "release" };
|
||||||
|
|
||||||
|
let crate_name = env::var("CARGO_PKG_NAME").unwrap();
|
||||||
|
let lib_name = format!("{}.a", crate_name);
|
||||||
|
let header_name = format!("{}.h", crate_name);
|
||||||
|
|
||||||
|
let crate_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
|
||||||
|
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
|
||||||
|
let header_out_path = out_dir.join(&header_name);
|
||||||
|
let binary_dir = crate_dir.join(format!("target/{config}"));
|
||||||
|
let lib_path = fs::read_dir(binary_dir)
|
||||||
|
.expect("Failed to find lib files")
|
||||||
|
.filter_map(Result::ok)
|
||||||
|
.map(|entry| entry.path())
|
||||||
|
.find(|path| path.extension().and_then(|s| s.to_str()) == Some("a"))
|
||||||
|
.expect("Can't find a lib file");
|
||||||
|
|
||||||
|
let install_base_dir = crate_dir.join("target").join("install").join(config);
|
||||||
|
let lib_install_dir = install_base_dir.join("lib");
|
||||||
|
let include_install_dir = install_base_dir.join("include");
|
||||||
|
|
||||||
|
let include_install_path = include_install_dir.join(&header_name);
|
||||||
|
let lib_install_path = lib_install_dir.join(&lib_name);
|
||||||
|
|
||||||
|
let _ = std::fs::create_dir_all(&lib_install_dir);
|
||||||
|
let _ = std::fs::create_dir_all(&include_install_dir);
|
||||||
|
|
||||||
|
fs::copy(header_out_path, &include_install_path).expect("Failed to install the header file");
|
||||||
|
fs::copy(lib_path, &lib_install_path)
|
||||||
|
.expect("Failed to install the lib file");
|
||||||
|
|
||||||
|
println!("Installed to {}", install_base_dir.display());
|
||||||
|
}
|
||||||
4
external/rust-test/src/lib.rs
vendored
Normal file
4
external/rust-test/src/lib.rs
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#[unsafe(no_mangle)]
|
||||||
|
pub extern "C" fn add(a: i32, b: i32) -> i32 {
|
||||||
|
a + b
|
||||||
|
}
|
||||||
@@ -654,14 +654,12 @@ SharedWeakUnion<T>::convertToWeak()
|
|||||||
break;
|
break;
|
||||||
case destroy:
|
case destroy:
|
||||||
// We just added a weak ref. How could we destroy?
|
// We just added a weak ref. How could we destroy?
|
||||||
// LCOV_EXCL_START
|
|
||||||
UNREACHABLE(
|
UNREACHABLE(
|
||||||
"ripple::SharedWeakUnion::convertToWeak : destroying freshly "
|
"ripple::SharedWeakUnion::convertToWeak : destroying freshly "
|
||||||
"added ref");
|
"added ref");
|
||||||
delete p;
|
delete p;
|
||||||
unsafeSetRawPtr(nullptr);
|
unsafeSetRawPtr(nullptr);
|
||||||
return true; // Should never happen
|
return true; // Should never happen
|
||||||
// LCOV_EXCL_STOP
|
|
||||||
case partialDestroy:
|
case partialDestroy:
|
||||||
// This is a weird case. We just converted the last strong
|
// This is a weird case. We just converted the last strong
|
||||||
// pointer to a weak pointer.
|
// pointer to a weak pointer.
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
#include <xrpl/basics/Resolver.h>
|
#include <xrpl/basics/Resolver.h>
|
||||||
#include <xrpl/beast/utility/Journal.h>
|
#include <xrpl/beast/utility/Journal.h>
|
||||||
|
|
||||||
#include <boost/asio/io_service.hpp>
|
#include <boost/asio/io_context.hpp>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ public:
|
|||||||
explicit ResolverAsio() = default;
|
explicit ResolverAsio() = default;
|
||||||
|
|
||||||
static std::unique_ptr<ResolverAsio>
|
static std::unique_ptr<ResolverAsio>
|
||||||
New(boost::asio::io_service&, beast::Journal);
|
New(boost::asio::io_context&, beast::Journal);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ripple
|
} // namespace ripple
|
||||||
|
|||||||
@@ -632,16 +632,6 @@ to_string(base_uint<Bits, Tag> const& a)
|
|||||||
return strHex(a.cbegin(), a.cend());
|
return strHex(a.cbegin(), a.cend());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <std::size_t Bits, class Tag>
|
|
||||||
inline std::string
|
|
||||||
to_short_string(base_uint<Bits, Tag> const& a)
|
|
||||||
{
|
|
||||||
static_assert(
|
|
||||||
base_uint<Bits, Tag>::bytes > 4,
|
|
||||||
"For 4 bytes or less, use a native type");
|
|
||||||
return strHex(a.cbegin(), a.cbegin() + 4) + "...";
|
|
||||||
}
|
|
||||||
|
|
||||||
template <std::size_t Bits, class Tag>
|
template <std::size_t Bits, class Tag>
|
||||||
inline std::ostream&
|
inline std::ostream&
|
||||||
operator<<(std::ostream& out, base_uint<Bits, Tag> const& u)
|
operator<<(std::ostream& out, base_uint<Bits, Tag> const& u)
|
||||||
|
|||||||
@@ -28,8 +28,9 @@ namespace ripple {
|
|||||||
// the destination can hold all values of the source. This is particularly
|
// the destination can hold all values of the source. This is particularly
|
||||||
// handy when the source or destination is an enumeration type.
|
// handy when the source or destination is an enumeration type.
|
||||||
|
|
||||||
template <class Src, class Dest>
|
template <class Dest, class Src>
|
||||||
concept SafeToCast = (std::is_integral_v<Src> && std::is_integral_v<Dest>) &&
|
static constexpr bool is_safetocasttovalue_v =
|
||||||
|
(std::is_integral_v<Src> && std::is_integral_v<Dest>) &&
|
||||||
(std::is_signed<Src>::value || std::is_unsigned<Dest>::value) &&
|
(std::is_signed<Src>::value || std::is_unsigned<Dest>::value) &&
|
||||||
(std::is_signed<Src>::value != std::is_signed<Dest>::value
|
(std::is_signed<Src>::value != std::is_signed<Dest>::value
|
||||||
? sizeof(Dest) > sizeof(Src)
|
? sizeof(Dest) > sizeof(Src)
|
||||||
@@ -77,7 +78,7 @@ inline constexpr std::
|
|||||||
unsafe_cast(Src s) noexcept
|
unsafe_cast(Src s) noexcept
|
||||||
{
|
{
|
||||||
static_assert(
|
static_assert(
|
||||||
!SafeToCast<Src, Dest>,
|
!is_safetocasttovalue_v<Dest, Src>,
|
||||||
"Only unsafe if casting signed to unsigned or "
|
"Only unsafe if casting signed to unsigned or "
|
||||||
"destination is too small");
|
"destination is too small");
|
||||||
return static_cast<Dest>(s);
|
return static_cast<Dest>(s);
|
||||||
|
|||||||
@@ -23,7 +23,8 @@
|
|||||||
#include <xrpl/beast/utility/instrumentation.h>
|
#include <xrpl/beast/utility/instrumentation.h>
|
||||||
|
|
||||||
#include <boost/asio/basic_waitable_timer.hpp>
|
#include <boost/asio/basic_waitable_timer.hpp>
|
||||||
#include <boost/asio/io_service.hpp>
|
#include <boost/asio/io_context.hpp>
|
||||||
|
#include <boost/asio/post.hpp>
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
@@ -32,7 +33,7 @@
|
|||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
|
|
||||||
/** Measures handler latency on an io_service queue. */
|
/** Measures handler latency on an io_context queue. */
|
||||||
template <class Clock>
|
template <class Clock>
|
||||||
class io_latency_probe
|
class io_latency_probe
|
||||||
{
|
{
|
||||||
@@ -44,12 +45,12 @@ private:
|
|||||||
std::condition_variable_any m_cond;
|
std::condition_variable_any m_cond;
|
||||||
std::size_t m_count;
|
std::size_t m_count;
|
||||||
duration const m_period;
|
duration const m_period;
|
||||||
boost::asio::io_service& m_ios;
|
boost::asio::io_context& m_ios;
|
||||||
boost::asio::basic_waitable_timer<std::chrono::steady_clock> m_timer;
|
boost::asio::basic_waitable_timer<std::chrono::steady_clock> m_timer;
|
||||||
bool m_cancel;
|
bool m_cancel;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
io_latency_probe(duration const& period, boost::asio::io_service& ios)
|
io_latency_probe(duration const& period, boost::asio::io_context& ios)
|
||||||
: m_count(1)
|
: m_count(1)
|
||||||
, m_period(period)
|
, m_period(period)
|
||||||
, m_ios(ios)
|
, m_ios(ios)
|
||||||
@@ -64,16 +65,16 @@ public:
|
|||||||
cancel(lock, true);
|
cancel(lock, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return the io_service associated with the latency probe. */
|
/** Return the io_context associated with the latency probe. */
|
||||||
/** @{ */
|
/** @{ */
|
||||||
boost::asio::io_service&
|
boost::asio::io_context&
|
||||||
get_io_service()
|
get_io_context()
|
||||||
{
|
{
|
||||||
return m_ios;
|
return m_ios;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::asio::io_service const&
|
boost::asio::io_context const&
|
||||||
get_io_service() const
|
get_io_context() const
|
||||||
{
|
{
|
||||||
return m_ios;
|
return m_ios;
|
||||||
}
|
}
|
||||||
@@ -109,7 +110,9 @@ public:
|
|||||||
std::lock_guard lock(m_mutex);
|
std::lock_guard lock(m_mutex);
|
||||||
if (m_cancel)
|
if (m_cancel)
|
||||||
throw std::logic_error("io_latency_probe is canceled");
|
throw std::logic_error("io_latency_probe is canceled");
|
||||||
m_ios.post(sample_op<Handler>(
|
boost::asio::post(
|
||||||
|
m_ios,
|
||||||
|
sample_op<Handler>(
|
||||||
std::forward<Handler>(handler), Clock::now(), false, this));
|
std::forward<Handler>(handler), Clock::now(), false, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,7 +127,9 @@ public:
|
|||||||
std::lock_guard lock(m_mutex);
|
std::lock_guard lock(m_mutex);
|
||||||
if (m_cancel)
|
if (m_cancel)
|
||||||
throw std::logic_error("io_latency_probe is canceled");
|
throw std::logic_error("io_latency_probe is canceled");
|
||||||
m_ios.post(sample_op<Handler>(
|
boost::asio::post(
|
||||||
|
m_ios,
|
||||||
|
sample_op<Handler>(
|
||||||
std::forward<Handler>(handler), Clock::now(), true, this));
|
std::forward<Handler>(handler), Clock::now(), true, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,12 +241,13 @@ private:
|
|||||||
// The latency is too high to maintain the desired
|
// The latency is too high to maintain the desired
|
||||||
// period so don't bother with a timer.
|
// period so don't bother with a timer.
|
||||||
//
|
//
|
||||||
m_probe->m_ios.post(
|
boost::asio::post(
|
||||||
|
m_probe->m_ios,
|
||||||
sample_op<Handler>(m_handler, now, m_repeat, m_probe));
|
sample_op<Handler>(m_handler, now, m_repeat, m_probe));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_probe->m_timer.expires_from_now(when - now);
|
m_probe->m_timer.expires_after(when - now);
|
||||||
m_probe->m_timer.async_wait(
|
m_probe->m_timer.async_wait(
|
||||||
sample_op<Handler>(m_handler, now, m_repeat, m_probe));
|
sample_op<Handler>(m_handler, now, m_repeat, m_probe));
|
||||||
}
|
}
|
||||||
@@ -254,7 +260,8 @@ private:
|
|||||||
if (!m_probe)
|
if (!m_probe)
|
||||||
return;
|
return;
|
||||||
typename Clock::time_point const now(Clock::now());
|
typename Clock::time_point const now(Clock::now());
|
||||||
m_probe->m_ios.post(
|
boost::asio::post(
|
||||||
|
m_probe->m_ios,
|
||||||
sample_op<Handler>(m_handler, now, m_repeat, m_probe));
|
sample_op<Handler>(m_handler, now, m_repeat, m_probe));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -94,11 +94,7 @@ hash_append(Hasher& h, beast::IP::Address const& addr) noexcept
|
|||||||
else if (addr.is_v6())
|
else if (addr.is_v6())
|
||||||
hash_append(h, addr.to_v6().to_bytes());
|
hash_append(h, addr.to_v6().to_bytes());
|
||||||
else
|
else
|
||||||
{
|
|
||||||
// LCOV_EXCL_START
|
|
||||||
UNREACHABLE("beast::hash_append : invalid address type");
|
UNREACHABLE("beast::hash_append : invalid address type");
|
||||||
// LCOV_EXCL_STOP
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} // namespace beast
|
} // namespace beast
|
||||||
|
|
||||||
|
|||||||
@@ -8,9 +8,11 @@
|
|||||||
#ifndef BEAST_TEST_YIELD_TO_HPP
|
#ifndef BEAST_TEST_YIELD_TO_HPP
|
||||||
#define BEAST_TEST_YIELD_TO_HPP
|
#define BEAST_TEST_YIELD_TO_HPP
|
||||||
|
|
||||||
#include <boost/asio/io_service.hpp>
|
#include <boost/asio/executor_work_guard.hpp>
|
||||||
|
#include <boost/asio/io_context.hpp>
|
||||||
#include <boost/asio/spawn.hpp>
|
#include <boost/asio/spawn.hpp>
|
||||||
#include <boost/optional.hpp>
|
#include <boost/optional.hpp>
|
||||||
|
#include <boost/thread/csbl/memory/allocator_arg.hpp>
|
||||||
|
|
||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
@@ -29,10 +31,12 @@ namespace test {
|
|||||||
class enable_yield_to
|
class enable_yield_to
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
boost::asio::io_service ios_;
|
boost::asio::io_context ios_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
boost::optional<boost::asio::io_service::work> work_;
|
boost::optional<boost::asio::executor_work_guard<
|
||||||
|
boost::asio::io_context::executor_type>>
|
||||||
|
work_;
|
||||||
std::vector<std::thread> threads_;
|
std::vector<std::thread> threads_;
|
||||||
std::mutex m_;
|
std::mutex m_;
|
||||||
std::condition_variable cv_;
|
std::condition_variable cv_;
|
||||||
@@ -42,7 +46,8 @@ public:
|
|||||||
/// The type of yield context passed to functions.
|
/// The type of yield context passed to functions.
|
||||||
using yield_context = boost::asio::yield_context;
|
using yield_context = boost::asio::yield_context;
|
||||||
|
|
||||||
explicit enable_yield_to(std::size_t concurrency = 1) : work_(ios_)
|
explicit enable_yield_to(std::size_t concurrency = 1)
|
||||||
|
: work_(boost::asio::make_work_guard(ios_))
|
||||||
{
|
{
|
||||||
threads_.reserve(concurrency);
|
threads_.reserve(concurrency);
|
||||||
while (concurrency--)
|
while (concurrency--)
|
||||||
@@ -56,9 +61,9 @@ public:
|
|||||||
t.join();
|
t.join();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return the `io_service` associated with the object
|
/// Return the `io_context` associated with the object
|
||||||
boost::asio::io_service&
|
boost::asio::io_context&
|
||||||
get_io_service()
|
get_io_context()
|
||||||
{
|
{
|
||||||
return ios_;
|
return ios_;
|
||||||
}
|
}
|
||||||
@@ -111,13 +116,18 @@ enable_yield_to::spawn(F0&& f, FN&&... fn)
|
|||||||
{
|
{
|
||||||
boost::asio::spawn(
|
boost::asio::spawn(
|
||||||
ios_,
|
ios_,
|
||||||
|
boost::allocator_arg,
|
||||||
|
boost::context::fixedsize_stack(2 * 1024 * 1024),
|
||||||
[&](yield_context yield) {
|
[&](yield_context yield) {
|
||||||
f(yield);
|
f(yield);
|
||||||
std::lock_guard lock{m_};
|
std::lock_guard lock{m_};
|
||||||
if (--running_ == 0)
|
if (--running_ == 0)
|
||||||
cv_.notify_all();
|
cv_.notify_all();
|
||||||
},
|
},
|
||||||
boost::coroutines::attributes(2 * 1024 * 1024));
|
[](std::exception_ptr e) {
|
||||||
|
if (e)
|
||||||
|
std::rethrow_exception(e);
|
||||||
|
});
|
||||||
spawn(fn...);
|
spawn(fn...);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,16 +39,11 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define XRPL_ASSERT ALWAYS_OR_UNREACHABLE
|
#define XRPL_ASSERT ALWAYS_OR_UNREACHABLE
|
||||||
#define XRPL_ASSERT_PARTS(cond, function, description, ...) \
|
|
||||||
XRPL_ASSERT(cond, function " : " description)
|
|
||||||
|
|
||||||
// How to use the instrumentation macros:
|
// How to use the instrumentation macros:
|
||||||
//
|
//
|
||||||
// * XRPL_ASSERT if cond must be true but the line might not be reached during
|
// * XRPL_ASSERT if cond must be true but the line might not be reached during
|
||||||
// fuzzing. Same like `assert` in normal use.
|
// fuzzing. Same like `assert` in normal use.
|
||||||
// * XRPL_ASSERT_PARTS is for convenience, and works like XRPL_ASSERT, but
|
|
||||||
// splits the message param into "function" and "description", then joins
|
|
||||||
// them with " : " before passing to XRPL_ASSERT.
|
|
||||||
// * ALWAYS if cond must be true _and_ the line must be reached during fuzzing.
|
// * ALWAYS if cond must be true _and_ the line must be reached during fuzzing.
|
||||||
// Same like `assert` in normal use.
|
// Same like `assert` in normal use.
|
||||||
// * REACHABLE if the line must be reached during fuzzing
|
// * REACHABLE if the line must be reached during fuzzing
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ Reader::parse(Value& root, BufferSequence const& bs)
|
|||||||
std::string s;
|
std::string s;
|
||||||
s.reserve(buffer_size(bs));
|
s.reserve(buffer_size(bs));
|
||||||
for (auto const& b : bs)
|
for (auto const& b : bs)
|
||||||
s.append(buffer_cast<char const*>(b), buffer_size(b));
|
s.append(static_cast<char const*>(b.data()), buffer_size(b));
|
||||||
return parse(s, root);
|
return parse(s, root);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public:
|
|||||||
* without formatting (not human friendly).
|
* without formatting (not human friendly).
|
||||||
*
|
*
|
||||||
* The JSON document is written in a single line. It is not intended for 'human'
|
* The JSON document is written in a single line. It is not intended for 'human'
|
||||||
* consumption, but may be useful to support feature such as RPC where bandwidth
|
* consumption, but may be useful to support feature such as RPC where bandwith
|
||||||
* is limited. \sa Reader, Value
|
* is limited. \sa Reader, Value
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
AutoSocket(
|
AutoSocket(
|
||||||
boost::asio::io_service& s,
|
boost::asio::io_context& s,
|
||||||
boost::asio::ssl::context& c,
|
boost::asio::ssl::context& c,
|
||||||
bool secureOnly,
|
bool secureOnly,
|
||||||
bool plainOnly)
|
bool plainOnly)
|
||||||
@@ -58,7 +58,7 @@ public:
|
|||||||
mSocket = std::make_unique<ssl_socket>(s, c);
|
mSocket = std::make_unique<ssl_socket>(s, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
AutoSocket(boost::asio::io_service& s, boost::asio::ssl::context& c)
|
AutoSocket(boost::asio::io_context& s, boost::asio::ssl::context& c)
|
||||||
: AutoSocket(s, c, false, false)
|
: AutoSocket(s, c, false, false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
#include <xrpl/basics/ByteUtilities.h>
|
#include <xrpl/basics/ByteUtilities.h>
|
||||||
#include <xrpl/beast/utility/Journal.h>
|
#include <xrpl/beast/utility/Journal.h>
|
||||||
|
|
||||||
#include <boost/asio/io_service.hpp>
|
#include <boost/asio/io_context.hpp>
|
||||||
#include <boost/asio/streambuf.hpp>
|
#include <boost/asio/streambuf.hpp>
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
@@ -51,7 +51,7 @@ public:
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
get(bool bSSL,
|
get(bool bSSL,
|
||||||
boost::asio::io_service& io_service,
|
boost::asio::io_context& io_context,
|
||||||
std::deque<std::string> deqSites,
|
std::deque<std::string> deqSites,
|
||||||
unsigned short const port,
|
unsigned short const port,
|
||||||
std::string const& strPath,
|
std::string const& strPath,
|
||||||
@@ -65,7 +65,7 @@ public:
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
get(bool bSSL,
|
get(bool bSSL,
|
||||||
boost::asio::io_service& io_service,
|
boost::asio::io_context& io_context,
|
||||||
std::string strSite,
|
std::string strSite,
|
||||||
unsigned short const port,
|
unsigned short const port,
|
||||||
std::string const& strPath,
|
std::string const& strPath,
|
||||||
@@ -80,7 +80,7 @@ public:
|
|||||||
static void
|
static void
|
||||||
request(
|
request(
|
||||||
bool bSSL,
|
bool bSSL,
|
||||||
boost::asio::io_service& io_service,
|
boost::asio::io_context& io_context,
|
||||||
std::string strSite,
|
std::string strSite,
|
||||||
unsigned short const port,
|
unsigned short const port,
|
||||||
std::function<
|
std::function<
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ public:
|
|||||||
{
|
{
|
||||||
strm.set_verify_callback(
|
strm.set_verify_callback(
|
||||||
std::bind(
|
std::bind(
|
||||||
&rfc2818_verify,
|
&rfc6125_verify,
|
||||||
host,
|
host,
|
||||||
std::placeholders::_1,
|
std::placeholders::_1,
|
||||||
std::placeholders::_2,
|
std::placeholders::_2,
|
||||||
@@ -167,7 +167,7 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief callback invoked for name verification - just passes through
|
* @brief callback invoked for name verification - just passes through
|
||||||
* to the asio rfc2818 implementation.
|
* to the asio `host_name_verification` (rfc6125) implementation.
|
||||||
*
|
*
|
||||||
* @param domain hostname expected
|
* @param domain hostname expected
|
||||||
* @param preverified passed by implementation
|
* @param preverified passed by implementation
|
||||||
@@ -175,13 +175,13 @@ public:
|
|||||||
* @param j journal for logging
|
* @param j journal for logging
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
rfc2818_verify(
|
rfc6125_verify(
|
||||||
std::string const& domain,
|
std::string const& domain,
|
||||||
bool preverified,
|
bool preverified,
|
||||||
boost::asio::ssl::verify_context& ctx,
|
boost::asio::ssl::verify_context& ctx,
|
||||||
beast::Journal j)
|
beast::Journal j)
|
||||||
{
|
{
|
||||||
if (boost::asio::ssl::rfc2818_verification(domain)(preverified, ctx))
|
if (boost::asio::ssl::host_name_verification(domain)(preverified, ctx))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
JLOG(j.warn()) << "Outbound SSL connection to " << domain
|
JLOG(j.warn()) << "Outbound SSL connection to " << domain
|
||||||
|
|||||||
565
include/xrpl/protocol/FeeUnits.h
Normal file
565
include/xrpl/protocol/FeeUnits.h
Normal file
@@ -0,0 +1,565 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
/*
|
||||||
|
This file is part of rippled: https://github.com/ripple/rippled
|
||||||
|
Copyright (c) 2019 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 BASICS_FEES_H_INCLUDED
|
||||||
|
#define BASICS_FEES_H_INCLUDED
|
||||||
|
|
||||||
|
#include <xrpl/basics/safe_cast.h>
|
||||||
|
#include <xrpl/beast/utility/Zero.h>
|
||||||
|
#include <xrpl/beast/utility/instrumentation.h>
|
||||||
|
#include <xrpl/json/json_value.h>
|
||||||
|
|
||||||
|
#include <boost/multiprecision/cpp_int.hpp>
|
||||||
|
#include <boost/operators.hpp>
|
||||||
|
|
||||||
|
#include <iosfwd>
|
||||||
|
#include <limits>
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
|
namespace ripple {
|
||||||
|
|
||||||
|
namespace feeunit {
|
||||||
|
|
||||||
|
/** "drops" are the smallest divisible amount of XRP. This is what most
|
||||||
|
of the code uses. */
|
||||||
|
struct dropTag;
|
||||||
|
/** "fee units" calculations are a not-really-unitless value that is used
|
||||||
|
to express the cost of a given transaction vs. a reference transaction.
|
||||||
|
They are primarily used by the Transactor classes. */
|
||||||
|
struct feeunitTag;
|
||||||
|
/** "fee levels" are used by the transaction queue to compare the relative
|
||||||
|
cost of transactions that require different levels of effort to process.
|
||||||
|
See also: src/ripple/app/misc/FeeEscalation.md#fee-level */
|
||||||
|
struct feelevelTag;
|
||||||
|
/** unitless values are plain scalars wrapped in a TaggedFee. They are
|
||||||
|
used for calculations in this header. */
|
||||||
|
struct unitlessTag;
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
using enable_if_unit_t = typename std::enable_if_t<
|
||||||
|
std::is_class_v<T> && std::is_object_v<typename T::unit_type> &&
|
||||||
|
std::is_object_v<typename T::value_type>>;
|
||||||
|
|
||||||
|
/** `is_usable_unit_v` is checked to ensure that only values with
|
||||||
|
known valid type tags can be used (sometimes transparently) in
|
||||||
|
non-fee contexts. At the time of implementation, this includes
|
||||||
|
all known tags, but more may be added in the future, and they
|
||||||
|
should not be added automatically unless determined to be
|
||||||
|
appropriate.
|
||||||
|
*/
|
||||||
|
template <class T, class = enable_if_unit_t<T>>
|
||||||
|
constexpr bool is_usable_unit_v =
|
||||||
|
std::is_same_v<typename T::unit_type, feeunitTag> ||
|
||||||
|
std::is_same_v<typename T::unit_type, feelevelTag> ||
|
||||||
|
std::is_same_v<typename T::unit_type, unitlessTag> ||
|
||||||
|
std::is_same_v<typename T::unit_type, dropTag>;
|
||||||
|
|
||||||
|
template <class UnitTag, class T>
|
||||||
|
class TaggedFee : private boost::totally_ordered<TaggedFee<UnitTag, T>>,
|
||||||
|
private boost::additive<TaggedFee<UnitTag, T>>,
|
||||||
|
private boost::equality_comparable<TaggedFee<UnitTag, T>, T>,
|
||||||
|
private boost::dividable<TaggedFee<UnitTag, T>, T>,
|
||||||
|
private boost::modable<TaggedFee<UnitTag, T>, T>,
|
||||||
|
private boost::unit_steppable<TaggedFee<UnitTag, T>>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
using unit_type = UnitTag;
|
||||||
|
using value_type = T;
|
||||||
|
|
||||||
|
private:
|
||||||
|
value_type fee_;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
template <class Other>
|
||||||
|
static constexpr bool is_compatible_v =
|
||||||
|
std::is_arithmetic_v<Other> && std::is_arithmetic_v<value_type> &&
|
||||||
|
std::is_convertible_v<Other, value_type>;
|
||||||
|
|
||||||
|
template <class OtherFee, class = enable_if_unit_t<OtherFee>>
|
||||||
|
static constexpr bool is_compatiblefee_v =
|
||||||
|
is_compatible_v<typename OtherFee::value_type> &&
|
||||||
|
std::is_same_v<UnitTag, typename OtherFee::unit_type>;
|
||||||
|
|
||||||
|
template <class Other>
|
||||||
|
using enable_if_compatible_t =
|
||||||
|
typename std::enable_if_t<is_compatible_v<Other>>;
|
||||||
|
|
||||||
|
template <class OtherFee>
|
||||||
|
using enable_if_compatiblefee_t =
|
||||||
|
typename std::enable_if_t<is_compatiblefee_v<OtherFee>>;
|
||||||
|
|
||||||
|
public:
|
||||||
|
TaggedFee() = default;
|
||||||
|
constexpr TaggedFee(TaggedFee const& other) = default;
|
||||||
|
constexpr TaggedFee&
|
||||||
|
operator=(TaggedFee const& other) = default;
|
||||||
|
|
||||||
|
constexpr explicit TaggedFee(beast::Zero) : fee_(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr TaggedFee&
|
||||||
|
operator=(beast::Zero)
|
||||||
|
{
|
||||||
|
fee_ = 0;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr explicit TaggedFee(value_type fee) : fee_(fee)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
TaggedFee&
|
||||||
|
operator=(value_type fee)
|
||||||
|
{
|
||||||
|
fee_ = fee;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Instances with the same unit, and a type that is
|
||||||
|
"safe" to convert to this one can be converted
|
||||||
|
implicitly */
|
||||||
|
template <
|
||||||
|
class Other,
|
||||||
|
class = std::enable_if_t<
|
||||||
|
is_compatible_v<Other> &&
|
||||||
|
is_safetocasttovalue_v<value_type, Other>>>
|
||||||
|
constexpr TaggedFee(TaggedFee<unit_type, Other> const& fee)
|
||||||
|
: TaggedFee(safe_cast<value_type>(fee.fee()))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr TaggedFee
|
||||||
|
operator*(value_type const& rhs) const
|
||||||
|
{
|
||||||
|
return TaggedFee{fee_ * rhs};
|
||||||
|
}
|
||||||
|
|
||||||
|
friend constexpr TaggedFee
|
||||||
|
operator*(value_type lhs, TaggedFee const& rhs)
|
||||||
|
{
|
||||||
|
// multiplication is commutative
|
||||||
|
return rhs * lhs;
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr value_type
|
||||||
|
operator/(TaggedFee const& rhs) const
|
||||||
|
{
|
||||||
|
return fee_ / rhs.fee_;
|
||||||
|
}
|
||||||
|
|
||||||
|
TaggedFee&
|
||||||
|
operator+=(TaggedFee const& other)
|
||||||
|
{
|
||||||
|
fee_ += other.fee();
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
TaggedFee&
|
||||||
|
operator-=(TaggedFee const& other)
|
||||||
|
{
|
||||||
|
fee_ -= other.fee();
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
TaggedFee&
|
||||||
|
operator++()
|
||||||
|
{
|
||||||
|
++fee_;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
TaggedFee&
|
||||||
|
operator--()
|
||||||
|
{
|
||||||
|
--fee_;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
TaggedFee&
|
||||||
|
operator*=(value_type const& rhs)
|
||||||
|
{
|
||||||
|
fee_ *= rhs;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
TaggedFee&
|
||||||
|
operator/=(value_type const& rhs)
|
||||||
|
{
|
||||||
|
fee_ /= rhs;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class transparent = value_type>
|
||||||
|
std::enable_if_t<std::is_integral_v<transparent>, TaggedFee&>
|
||||||
|
operator%=(value_type const& rhs)
|
||||||
|
{
|
||||||
|
fee_ %= rhs;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
TaggedFee
|
||||||
|
operator-() const
|
||||||
|
{
|
||||||
|
static_assert(
|
||||||
|
std::is_signed_v<T>, "- operator illegal on unsigned fee types");
|
||||||
|
return TaggedFee{-fee_};
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
operator==(TaggedFee const& other) const
|
||||||
|
{
|
||||||
|
return fee_ == other.fee_;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Other, class = enable_if_compatible_t<Other>>
|
||||||
|
bool
|
||||||
|
operator==(TaggedFee<unit_type, Other> const& other) const
|
||||||
|
{
|
||||||
|
return fee_ == other.fee();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
operator==(value_type other) const
|
||||||
|
{
|
||||||
|
return fee_ == other;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Other, class = enable_if_compatible_t<Other>>
|
||||||
|
bool
|
||||||
|
operator!=(TaggedFee<unit_type, Other> const& other) const
|
||||||
|
{
|
||||||
|
return !operator==(other);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
operator<(TaggedFee const& other) const
|
||||||
|
{
|
||||||
|
return fee_ < other.fee_;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Returns true if the amount is not zero */
|
||||||
|
explicit constexpr
|
||||||
|
operator bool() const noexcept
|
||||||
|
{
|
||||||
|
return fee_ != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Return the sign of the amount */
|
||||||
|
constexpr int
|
||||||
|
signum() const noexcept
|
||||||
|
{
|
||||||
|
return (fee_ < 0) ? -1 : (fee_ ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Returns the number of drops */
|
||||||
|
constexpr value_type
|
||||||
|
fee() const
|
||||||
|
{
|
||||||
|
return fee_;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Other>
|
||||||
|
constexpr double
|
||||||
|
decimalFromReference(TaggedFee<unit_type, Other> reference) const
|
||||||
|
{
|
||||||
|
return static_cast<double>(fee_) / reference.fee();
|
||||||
|
}
|
||||||
|
|
||||||
|
// `is_usable_unit_v` is checked to ensure that only values with
|
||||||
|
// known valid type tags can be converted to JSON. At the time
|
||||||
|
// of implementation, that includes all known tags, but more may
|
||||||
|
// be added in the future.
|
||||||
|
std::enable_if_t<is_usable_unit_v<TaggedFee>, Json::Value>
|
||||||
|
jsonClipped() const
|
||||||
|
{
|
||||||
|
if constexpr (std::is_integral_v<value_type>)
|
||||||
|
{
|
||||||
|
using jsontype = std::conditional_t<
|
||||||
|
std::is_signed_v<value_type>,
|
||||||
|
Json::Int,
|
||||||
|
Json::UInt>;
|
||||||
|
|
||||||
|
constexpr auto min = std::numeric_limits<jsontype>::min();
|
||||||
|
constexpr auto max = std::numeric_limits<jsontype>::max();
|
||||||
|
|
||||||
|
if (fee_ < min)
|
||||||
|
return min;
|
||||||
|
if (fee_ > max)
|
||||||
|
return max;
|
||||||
|
return static_cast<jsontype>(fee_);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return fee_;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Returns the underlying value. Code SHOULD NOT call this
|
||||||
|
function unless the type has been abstracted away,
|
||||||
|
e.g. in a templated function.
|
||||||
|
*/
|
||||||
|
constexpr value_type
|
||||||
|
value() const
|
||||||
|
{
|
||||||
|
return fee_;
|
||||||
|
}
|
||||||
|
|
||||||
|
friend std::istream&
|
||||||
|
operator>>(std::istream& s, TaggedFee& val)
|
||||||
|
{
|
||||||
|
s >> val.fee_;
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Output Fees as just their numeric value.
|
||||||
|
template <class Char, class Traits, class UnitTag, class T>
|
||||||
|
std::basic_ostream<Char, Traits>&
|
||||||
|
operator<<(std::basic_ostream<Char, Traits>& os, TaggedFee<UnitTag, T> const& q)
|
||||||
|
{
|
||||||
|
return os << q.value();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class UnitTag, class T>
|
||||||
|
std::string
|
||||||
|
to_string(TaggedFee<UnitTag, T> const& amount)
|
||||||
|
{
|
||||||
|
return std::to_string(amount.fee());
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Source, class = enable_if_unit_t<Source>>
|
||||||
|
constexpr bool can_muldiv_source_v =
|
||||||
|
std::is_convertible_v<typename Source::value_type, std::uint64_t>;
|
||||||
|
|
||||||
|
template <class Dest, class = enable_if_unit_t<Dest>>
|
||||||
|
constexpr bool can_muldiv_dest_v =
|
||||||
|
can_muldiv_source_v<Dest> && // Dest is also a source
|
||||||
|
std::is_convertible_v<std::uint64_t, typename Dest::value_type> &&
|
||||||
|
sizeof(typename Dest::value_type) >= sizeof(std::uint64_t);
|
||||||
|
|
||||||
|
template <
|
||||||
|
class Source1,
|
||||||
|
class Source2,
|
||||||
|
class = enable_if_unit_t<Source1>,
|
||||||
|
class = enable_if_unit_t<Source2>>
|
||||||
|
constexpr bool can_muldiv_sources_v =
|
||||||
|
can_muldiv_source_v<Source1> && can_muldiv_source_v<Source2> &&
|
||||||
|
std::is_same_v<typename Source1::unit_type, typename Source2::unit_type>;
|
||||||
|
|
||||||
|
template <
|
||||||
|
class Source1,
|
||||||
|
class Source2,
|
||||||
|
class Dest,
|
||||||
|
class = enable_if_unit_t<Source1>,
|
||||||
|
class = enable_if_unit_t<Source2>,
|
||||||
|
class = enable_if_unit_t<Dest>>
|
||||||
|
constexpr bool can_muldiv_v =
|
||||||
|
can_muldiv_sources_v<Source1, Source2> && can_muldiv_dest_v<Dest>;
|
||||||
|
// Source and Dest can be the same by default
|
||||||
|
|
||||||
|
template <
|
||||||
|
class Source1,
|
||||||
|
class Source2,
|
||||||
|
class Dest,
|
||||||
|
class = enable_if_unit_t<Source1>,
|
||||||
|
class = enable_if_unit_t<Source2>,
|
||||||
|
class = enable_if_unit_t<Dest>>
|
||||||
|
constexpr bool can_muldiv_commute_v = can_muldiv_v<Source1, Source2, Dest> &&
|
||||||
|
!std::is_same_v<typename Source1::unit_type, typename Dest::unit_type>;
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
using enable_muldiv_source_t =
|
||||||
|
typename std::enable_if_t<can_muldiv_source_v<T>>;
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
using enable_muldiv_dest_t = typename std::enable_if_t<can_muldiv_dest_v<T>>;
|
||||||
|
|
||||||
|
template <class Source1, class Source2>
|
||||||
|
using enable_muldiv_sources_t =
|
||||||
|
typename std::enable_if_t<can_muldiv_sources_v<Source1, Source2>>;
|
||||||
|
|
||||||
|
template <class Source1, class Source2, class Dest>
|
||||||
|
using enable_muldiv_t =
|
||||||
|
typename std::enable_if_t<can_muldiv_v<Source1, Source2, Dest>>;
|
||||||
|
|
||||||
|
template <class Source1, class Source2, class Dest>
|
||||||
|
using enable_muldiv_commute_t =
|
||||||
|
typename std::enable_if_t<can_muldiv_commute_v<Source1, Source2, Dest>>;
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
TaggedFee<unitlessTag, T>
|
||||||
|
scalar(T value)
|
||||||
|
{
|
||||||
|
return TaggedFee<unitlessTag, T>{value};
|
||||||
|
}
|
||||||
|
|
||||||
|
template <
|
||||||
|
class Source1,
|
||||||
|
class Source2,
|
||||||
|
class Dest,
|
||||||
|
class = enable_muldiv_t<Source1, Source2, Dest>>
|
||||||
|
std::optional<Dest>
|
||||||
|
mulDivU(Source1 value, Dest mul, Source2 div)
|
||||||
|
{
|
||||||
|
// Fees can never be negative in any context.
|
||||||
|
if (value.value() < 0 || mul.value() < 0 || div.value() < 0)
|
||||||
|
{
|
||||||
|
// split the asserts so if one hits, the user can tell which
|
||||||
|
// without a debugger.
|
||||||
|
XRPL_ASSERT(
|
||||||
|
value.value() >= 0,
|
||||||
|
"ripple::feeunit::mulDivU : minimum value input");
|
||||||
|
XRPL_ASSERT(
|
||||||
|
mul.value() >= 0, "ripple::feeunit::mulDivU : minimum mul input");
|
||||||
|
XRPL_ASSERT(
|
||||||
|
div.value() >= 0, "ripple::feeunit::mulDivU : minimum div input");
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
|
||||||
|
using desttype = typename Dest::value_type;
|
||||||
|
constexpr auto max = std::numeric_limits<desttype>::max();
|
||||||
|
|
||||||
|
// Shortcuts, since these happen a lot in the real world
|
||||||
|
if (value == div)
|
||||||
|
return mul;
|
||||||
|
if (mul.value() == div.value())
|
||||||
|
{
|
||||||
|
if (value.value() > max)
|
||||||
|
return std::nullopt;
|
||||||
|
return Dest{static_cast<desttype>(value.value())};
|
||||||
|
}
|
||||||
|
|
||||||
|
using namespace boost::multiprecision;
|
||||||
|
|
||||||
|
uint128_t product;
|
||||||
|
product = multiply(
|
||||||
|
product,
|
||||||
|
static_cast<std::uint64_t>(value.value()),
|
||||||
|
static_cast<std::uint64_t>(mul.value()));
|
||||||
|
|
||||||
|
auto quotient = product / div.value();
|
||||||
|
|
||||||
|
if (quotient > max)
|
||||||
|
return std::nullopt;
|
||||||
|
|
||||||
|
return Dest{static_cast<desttype>(quotient)};
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace feeunit
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
using FeeLevel = feeunit::TaggedFee<feeunit::feelevelTag, T>;
|
||||||
|
using FeeLevel64 = FeeLevel<std::uint64_t>;
|
||||||
|
using FeeLevelDouble = FeeLevel<double>;
|
||||||
|
|
||||||
|
template <
|
||||||
|
class Source1,
|
||||||
|
class Source2,
|
||||||
|
class Dest,
|
||||||
|
class = feeunit::enable_muldiv_t<Source1, Source2, Dest>>
|
||||||
|
std::optional<Dest>
|
||||||
|
mulDiv(Source1 value, Dest mul, Source2 div)
|
||||||
|
{
|
||||||
|
return feeunit::mulDivU(value, mul, div);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <
|
||||||
|
class Source1,
|
||||||
|
class Source2,
|
||||||
|
class Dest,
|
||||||
|
class = feeunit::enable_muldiv_commute_t<Source1, Source2, Dest>>
|
||||||
|
std::optional<Dest>
|
||||||
|
mulDiv(Dest value, Source1 mul, Source2 div)
|
||||||
|
{
|
||||||
|
// Multiplication is commutative
|
||||||
|
return feeunit::mulDivU(mul, value, div);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Dest, class = feeunit::enable_muldiv_dest_t<Dest>>
|
||||||
|
std::optional<Dest>
|
||||||
|
mulDiv(std::uint64_t value, Dest mul, std::uint64_t div)
|
||||||
|
{
|
||||||
|
// Give the scalars a non-tag so the
|
||||||
|
// unit-handling version gets called.
|
||||||
|
return feeunit::mulDivU(feeunit::scalar(value), mul, feeunit::scalar(div));
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Dest, class = feeunit::enable_muldiv_dest_t<Dest>>
|
||||||
|
std::optional<Dest>
|
||||||
|
mulDiv(Dest value, std::uint64_t mul, std::uint64_t div)
|
||||||
|
{
|
||||||
|
// Multiplication is commutative
|
||||||
|
return mulDiv(mul, value, div);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <
|
||||||
|
class Source1,
|
||||||
|
class Source2,
|
||||||
|
class = feeunit::enable_muldiv_sources_t<Source1, Source2>>
|
||||||
|
std::optional<std::uint64_t>
|
||||||
|
mulDiv(Source1 value, std::uint64_t mul, Source2 div)
|
||||||
|
{
|
||||||
|
// Give the scalars a dimensionless unit so the
|
||||||
|
// unit-handling version gets called.
|
||||||
|
auto unitresult = feeunit::mulDivU(value, feeunit::scalar(mul), div);
|
||||||
|
|
||||||
|
if (!unitresult)
|
||||||
|
return std::nullopt;
|
||||||
|
|
||||||
|
return unitresult->value();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <
|
||||||
|
class Source1,
|
||||||
|
class Source2,
|
||||||
|
class = feeunit::enable_muldiv_sources_t<Source1, Source2>>
|
||||||
|
std::optional<std::uint64_t>
|
||||||
|
mulDiv(std::uint64_t value, Source1 mul, Source2 div)
|
||||||
|
{
|
||||||
|
// Multiplication is commutative
|
||||||
|
return mulDiv(mul, value, div);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Dest, class Src>
|
||||||
|
constexpr std::enable_if_t<
|
||||||
|
std::is_same_v<typename Dest::unit_type, typename Src::unit_type> &&
|
||||||
|
std::is_integral_v<typename Dest::value_type> &&
|
||||||
|
std::is_integral_v<typename Src::value_type>,
|
||||||
|
Dest>
|
||||||
|
safe_cast(Src s) noexcept
|
||||||
|
{
|
||||||
|
// Dest may not have an explicit value constructor
|
||||||
|
return Dest{safe_cast<typename Dest::value_type>(s.value())};
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Dest, class Src>
|
||||||
|
constexpr std::enable_if_t<
|
||||||
|
std::is_same_v<typename Dest::unit_type, typename Src::unit_type> &&
|
||||||
|
std::is_integral_v<typename Dest::value_type> &&
|
||||||
|
std::is_integral_v<typename Src::value_type>,
|
||||||
|
Dest>
|
||||||
|
unsafe_cast(Src s) noexcept
|
||||||
|
{
|
||||||
|
// Dest may not have an explicit value constructor
|
||||||
|
return Dest{unsafe_cast<typename Dest::value_type>(s.value())};
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace ripple
|
||||||
|
|
||||||
|
#endif // BASICS_FEES_H_INCLUDED
|
||||||
@@ -287,11 +287,9 @@ delegate(AccountID const& account, AccountID const& authorizedAccount) noexcept;
|
|||||||
Keylet
|
Keylet
|
||||||
bridge(STXChainBridge const& bridge, STXChainBridge::ChainType chainType);
|
bridge(STXChainBridge const& bridge, STXChainBridge::ChainType chainType);
|
||||||
|
|
||||||
// `seq` is stored as `sfXChainClaimID` in the object
|
|
||||||
Keylet
|
Keylet
|
||||||
xChainClaimID(STXChainBridge const& bridge, std::uint64_t seq);
|
xChainClaimID(STXChainBridge const& bridge, std::uint64_t seq);
|
||||||
|
|
||||||
// `seq` is stored as `sfXChainAccountCreateCount` in the object
|
|
||||||
Keylet
|
Keylet
|
||||||
xChainCreateAccountClaimID(STXChainBridge const& bridge, std::uint64_t seq);
|
xChainCreateAccountClaimID(STXChainBridge const& bridge, std::uint64_t seq);
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ enum LedgerEntryType : std::uint16_t
|
|||||||
#pragma push_macro("LEDGER_ENTRY")
|
#pragma push_macro("LEDGER_ENTRY")
|
||||||
#undef LEDGER_ENTRY
|
#undef LEDGER_ENTRY
|
||||||
|
|
||||||
#define LEDGER_ENTRY(tag, value, ...) tag = value,
|
#define LEDGER_ENTRY(tag, value, name, rpcName, fields) tag = value,
|
||||||
|
|
||||||
#include <xrpl/protocol/detail/ledger_entries.macro>
|
#include <xrpl/protocol/detail/ledger_entries.macro>
|
||||||
|
|
||||||
@@ -188,15 +188,6 @@ enum LedgerSpecificFlags {
|
|||||||
lsfMPTCanTransfer = 0x00000020,
|
lsfMPTCanTransfer = 0x00000020,
|
||||||
lsfMPTCanClawback = 0x00000040,
|
lsfMPTCanClawback = 0x00000040,
|
||||||
|
|
||||||
lsmfMPTCanMutateCanLock = 0x00000002,
|
|
||||||
lsmfMPTCanMutateRequireAuth = 0x00000004,
|
|
||||||
lsmfMPTCanMutateCanEscrow = 0x00000008,
|
|
||||||
lsmfMPTCanMutateCanTrade = 0x00000010,
|
|
||||||
lsmfMPTCanMutateCanTransfer = 0x00000020,
|
|
||||||
lsmfMPTCanMutateCanClawback = 0x00000040,
|
|
||||||
lsmfMPTCanMutateMetadata = 0x00010000,
|
|
||||||
lsmfMPTCanMutateTransferFee = 0x00020000,
|
|
||||||
|
|
||||||
// ltMPTOKEN
|
// ltMPTOKEN
|
||||||
lsfMPTAuthorized = 0x00000002,
|
lsfMPTAuthorized = 0x00000002,
|
||||||
|
|
||||||
|
|||||||
@@ -74,9 +74,6 @@ public:
|
|||||||
Permission&
|
Permission&
|
||||||
operator=(Permission const&) = delete;
|
operator=(Permission const&) = delete;
|
||||||
|
|
||||||
std::optional<std::string>
|
|
||||||
getPermissionName(std::uint32_t const value) const;
|
|
||||||
|
|
||||||
std::optional<std::uint32_t>
|
std::optional<std::uint32_t>
|
||||||
getGranularValue(std::string const& name) const;
|
getGranularValue(std::string const& name) const;
|
||||||
|
|
||||||
@@ -86,9 +83,6 @@ public:
|
|||||||
std::optional<TxType>
|
std::optional<TxType>
|
||||||
getGranularTxType(GranularPermissionType const& gpType) const;
|
getGranularTxType(GranularPermissionType const& gpType) const;
|
||||||
|
|
||||||
std::optional<std::reference_wrapper<uint256 const>> const
|
|
||||||
getTxFeature(TxType txType) const;
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
isDelegatable(std::uint32_t const& permissionValue, Rules const& rules)
|
isDelegatable(std::uint32_t const& permissionValue, Rules const& rules)
|
||||||
const;
|
const;
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include <xrpl/basics/ByteUtilities.h>
|
#include <xrpl/basics/ByteUtilities.h>
|
||||||
#include <xrpl/basics/base_uint.h>
|
#include <xrpl/basics/base_uint.h>
|
||||||
|
#include <xrpl/basics/partitioned_unordered_map.h>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@@ -55,10 +56,7 @@ std::size_t constexpr oversizeMetaDataCap = 5200;
|
|||||||
/** The maximum number of entries per directory page */
|
/** The maximum number of entries per directory page */
|
||||||
std::size_t constexpr dirNodeMaxEntries = 32;
|
std::size_t constexpr dirNodeMaxEntries = 32;
|
||||||
|
|
||||||
/** The maximum number of pages allowed in a directory
|
/** The maximum number of pages allowed in a directory */
|
||||||
|
|
||||||
Made obsolete by fixDirectoryLimit amendment.
|
|
||||||
*/
|
|
||||||
std::uint64_t constexpr dirNodeMaxPages = 262144;
|
std::uint64_t constexpr dirNodeMaxPages = 262144;
|
||||||
|
|
||||||
/** The maximum number of items in an NFT page */
|
/** The maximum number of items in an NFT page */
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
|
|
||||||
#include <xrpl/basics/safe_cast.h>
|
#include <xrpl/basics/safe_cast.h>
|
||||||
#include <xrpl/json/json_value.h>
|
#include <xrpl/json/json_value.h>
|
||||||
#include <xrpl/protocol/Units.h>
|
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <map>
|
#include <map>
|
||||||
@@ -72,10 +71,8 @@ class STCurrency;
|
|||||||
STYPE(STI_VL, 7) \
|
STYPE(STI_VL, 7) \
|
||||||
STYPE(STI_ACCOUNT, 8) \
|
STYPE(STI_ACCOUNT, 8) \
|
||||||
STYPE(STI_NUMBER, 9) \
|
STYPE(STI_NUMBER, 9) \
|
||||||
STYPE(STI_INT32, 10) \
|
|
||||||
STYPE(STI_INT64, 11) \
|
|
||||||
\
|
\
|
||||||
/* 12-13 are reserved */ \
|
/* 10-13 are reserved */ \
|
||||||
STYPE(STI_OBJECT, 14) \
|
STYPE(STI_OBJECT, 14) \
|
||||||
STYPE(STI_ARRAY, 15) \
|
STYPE(STI_ARRAY, 15) \
|
||||||
\
|
\
|
||||||
@@ -152,9 +149,7 @@ public:
|
|||||||
sMD_DeleteFinal = 0x04, // final value when it is deleted
|
sMD_DeleteFinal = 0x04, // final value when it is deleted
|
||||||
sMD_Create = 0x08, // value when it's created
|
sMD_Create = 0x08, // value when it's created
|
||||||
sMD_Always = 0x10, // value when node containing it is affected at all
|
sMD_Always = 0x10, // value when node containing it is affected at all
|
||||||
sMD_BaseTen = 0x20, // value is treated as base 10, overriding behavior
|
sMD_BaseTen = 0x20,
|
||||||
sMD_PseudoAccount = 0x40, // if this field is set in an ACCOUNT_ROOT
|
|
||||||
// _only_, then it is a pseudo-account
|
|
||||||
sMD_Default =
|
sMD_Default =
|
||||||
sMD_ChangeOrig | sMD_ChangeNew | sMD_DeleteFinal | sMD_Create
|
sMD_ChangeOrig | sMD_ChangeNew | sMD_DeleteFinal | sMD_Create
|
||||||
};
|
};
|
||||||
@@ -189,7 +184,7 @@ public:
|
|||||||
char const* fn,
|
char const* fn,
|
||||||
int meta = sMD_Default,
|
int meta = sMD_Default,
|
||||||
IsSigning signing = IsSigning::yes);
|
IsSigning signing = IsSigning::yes);
|
||||||
explicit SField(private_access_tag_t, int fc, char const* fn);
|
explicit SField(private_access_tag_t, int fc);
|
||||||
|
|
||||||
static SField const&
|
static SField const&
|
||||||
getField(int fieldCode);
|
getField(int fieldCode);
|
||||||
@@ -302,7 +297,7 @@ public:
|
|||||||
static int
|
static int
|
||||||
compare(SField const& f1, SField const& f2);
|
compare(SField const& f1, SField const& f2);
|
||||||
|
|
||||||
static std::unordered_map<int, SField const*> const&
|
static std::map<int, SField const*> const&
|
||||||
getKnownCodeToField()
|
getKnownCodeToField()
|
||||||
{
|
{
|
||||||
return knownCodeToField;
|
return knownCodeToField;
|
||||||
@@ -310,8 +305,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
static int num;
|
static int num;
|
||||||
static std::unordered_map<int, SField const*> knownCodeToField;
|
static std::map<int, SField const*> knownCodeToField;
|
||||||
static std::unordered_map<std::string, SField const*> knownNameToField;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** A field with a type known at compile time. */
|
/** A field with a type known at compile time. */
|
||||||
@@ -358,9 +352,6 @@ using SF_UINT256 = TypedField<STBitString<256>>;
|
|||||||
using SF_UINT384 = TypedField<STBitString<384>>;
|
using SF_UINT384 = TypedField<STBitString<384>>;
|
||||||
using SF_UINT512 = TypedField<STBitString<512>>;
|
using SF_UINT512 = TypedField<STBitString<512>>;
|
||||||
|
|
||||||
using SF_INT32 = TypedField<STInteger<std::int32_t>>;
|
|
||||||
using SF_INT64 = TypedField<STInteger<std::int64_t>>;
|
|
||||||
|
|
||||||
using SF_ACCOUNT = TypedField<STAccount>;
|
using SF_ACCOUNT = TypedField<STAccount>;
|
||||||
using SF_AMOUNT = TypedField<STAmount>;
|
using SF_AMOUNT = TypedField<STAmount>;
|
||||||
using SF_ISSUE = TypedField<STIssue>;
|
using SF_ISSUE = TypedField<STIssue>;
|
||||||
|
|||||||
@@ -81,8 +81,6 @@ using STUInt16 = STInteger<std::uint16_t>;
|
|||||||
using STUInt32 = STInteger<std::uint32_t>;
|
using STUInt32 = STInteger<std::uint32_t>;
|
||||||
using STUInt64 = STInteger<std::uint64_t>;
|
using STUInt64 = STInteger<std::uint64_t>;
|
||||||
|
|
||||||
using STInt32 = STInteger<std::int32_t>;
|
|
||||||
|
|
||||||
template <typename Integer>
|
template <typename Integer>
|
||||||
inline STInteger<Integer>::STInteger(Integer v) : value_(v)
|
inline STInteger<Integer>::STInteger(Integer v) : value_(v)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,9 +26,7 @@
|
|||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
class Rules;
|
class Rules;
|
||||||
namespace test {
|
|
||||||
class Invariants_test;
|
class Invariants_test;
|
||||||
}
|
|
||||||
|
|
||||||
class STLedgerEntry final : public STObject, public CountedObject<STLedgerEntry>
|
class STLedgerEntry final : public STObject, public CountedObject<STLedgerEntry>
|
||||||
{
|
{
|
||||||
@@ -38,8 +36,6 @@ class STLedgerEntry final : public STObject, public CountedObject<STLedgerEntry>
|
|||||||
public:
|
public:
|
||||||
using pointer = std::shared_ptr<STLedgerEntry>;
|
using pointer = std::shared_ptr<STLedgerEntry>;
|
||||||
using ref = std::shared_ptr<STLedgerEntry> const&;
|
using ref = std::shared_ptr<STLedgerEntry> const&;
|
||||||
using const_pointer = std::shared_ptr<STLedgerEntry const>;
|
|
||||||
using const_ref = std::shared_ptr<STLedgerEntry const> const&;
|
|
||||||
|
|
||||||
/** Create an empty object with the given key and type. */
|
/** Create an empty object with the given key and type. */
|
||||||
explicit STLedgerEntry(Keylet const& k);
|
explicit STLedgerEntry(Keylet const& k);
|
||||||
@@ -58,7 +54,7 @@ public:
|
|||||||
getText() const override;
|
getText() const override;
|
||||||
|
|
||||||
Json::Value
|
Json::Value
|
||||||
getJson(JsonOptions options = JsonOptions::none) const override;
|
getJson(JsonOptions options) const override;
|
||||||
|
|
||||||
/** Returns the 'key' (or 'index') of this item.
|
/** Returns the 'key' (or 'index') of this item.
|
||||||
The key identifies this entry's position in
|
The key identifies this entry's position in
|
||||||
@@ -88,8 +84,7 @@ private:
|
|||||||
void
|
void
|
||||||
setSLEType();
|
setSLEType();
|
||||||
|
|
||||||
friend test::Invariants_test; // this test wants access to the private
|
friend Invariants_test; // this test wants access to the private type_
|
||||||
// type_
|
|
||||||
|
|
||||||
STBase*
|
STBase*
|
||||||
copy(std::size_t n, void* buf) const override;
|
copy(std::size_t n, void* buf) const override;
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
#include <xrpl/basics/chrono.h>
|
#include <xrpl/basics/chrono.h>
|
||||||
#include <xrpl/basics/contract.h>
|
#include <xrpl/basics/contract.h>
|
||||||
#include <xrpl/beast/utility/instrumentation.h>
|
#include <xrpl/beast/utility/instrumentation.h>
|
||||||
|
#include <xrpl/protocol/FeeUnits.h>
|
||||||
#include <xrpl/protocol/HashPrefix.h>
|
#include <xrpl/protocol/HashPrefix.h>
|
||||||
#include <xrpl/protocol/SOTemplate.h>
|
#include <xrpl/protocol/SOTemplate.h>
|
||||||
#include <xrpl/protocol/STAmount.h>
|
#include <xrpl/protocol/STAmount.h>
|
||||||
@@ -33,7 +34,6 @@
|
|||||||
#include <xrpl/protocol/STIssue.h>
|
#include <xrpl/protocol/STIssue.h>
|
||||||
#include <xrpl/protocol/STPathSet.h>
|
#include <xrpl/protocol/STPathSet.h>
|
||||||
#include <xrpl/protocol/STVector256.h>
|
#include <xrpl/protocol/STVector256.h>
|
||||||
#include <xrpl/protocol/Units.h>
|
|
||||||
#include <xrpl/protocol/detail/STVar.h>
|
#include <xrpl/protocol/detail/STVar.h>
|
||||||
|
|
||||||
#include <boost/iterator/transform_iterator.hpp>
|
#include <boost/iterator/transform_iterator.hpp>
|
||||||
@@ -231,8 +231,6 @@ public:
|
|||||||
getFieldH192(SField const& field) const;
|
getFieldH192(SField const& field) const;
|
||||||
uint256
|
uint256
|
||||||
getFieldH256(SField const& field) const;
|
getFieldH256(SField const& field) const;
|
||||||
std::int32_t
|
|
||||||
getFieldI32(SField const& field) const;
|
|
||||||
AccountID
|
AccountID
|
||||||
getAccountID(SField const& field) const;
|
getAccountID(SField const& field) const;
|
||||||
|
|
||||||
@@ -367,8 +365,6 @@ public:
|
|||||||
void
|
void
|
||||||
setFieldH256(SField const& field, uint256 const&);
|
setFieldH256(SField const& field, uint256 const&);
|
||||||
void
|
void
|
||||||
setFieldI32(SField const& field, std::int32_t);
|
|
||||||
void
|
|
||||||
setFieldVL(SField const& field, Blob const&);
|
setFieldVL(SField const& field, Blob const&);
|
||||||
void
|
void
|
||||||
setFieldVL(SField const& field, Slice const&);
|
setFieldVL(SField const& field, Slice const&);
|
||||||
|
|||||||
@@ -54,6 +54,34 @@ public:
|
|||||||
Json::Value error;
|
Json::Value error;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** Holds the serialized result of parsing an input JSON array.
|
||||||
|
This does validation and checking on the provided JSON.
|
||||||
|
*/
|
||||||
|
class STParsedJSONArray
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/** Parses and creates an STParsedJSON array.
|
||||||
|
The result of the parsing is stored in array and error.
|
||||||
|
Exceptions:
|
||||||
|
Does not throw.
|
||||||
|
@param name The name of the JSON field, used in diagnostics.
|
||||||
|
@param json The JSON-RPC to parse.
|
||||||
|
*/
|
||||||
|
STParsedJSONArray(std::string const& name, Json::Value const& json);
|
||||||
|
|
||||||
|
STParsedJSONArray() = delete;
|
||||||
|
STParsedJSONArray(STParsedJSONArray const&) = delete;
|
||||||
|
STParsedJSONArray&
|
||||||
|
operator=(STParsedJSONArray const&) = delete;
|
||||||
|
~STParsedJSONArray() = default;
|
||||||
|
|
||||||
|
/** The STArray if the parse was successful. */
|
||||||
|
std::optional<STArray> array;
|
||||||
|
|
||||||
|
/** On failure, an appropriate set of error values. */
|
||||||
|
Json::Value error;
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace ripple
|
} // namespace ripple
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -22,10 +22,10 @@
|
|||||||
|
|
||||||
#include <xrpl/basics/Log.h>
|
#include <xrpl/basics/Log.h>
|
||||||
#include <xrpl/beast/utility/instrumentation.h>
|
#include <xrpl/beast/utility/instrumentation.h>
|
||||||
|
#include <xrpl/protocol/FeeUnits.h>
|
||||||
#include <xrpl/protocol/PublicKey.h>
|
#include <xrpl/protocol/PublicKey.h>
|
||||||
#include <xrpl/protocol/STObject.h>
|
#include <xrpl/protocol/STObject.h>
|
||||||
#include <xrpl/protocol/SecretKey.h>
|
#include <xrpl/protocol/SecretKey.h>
|
||||||
#include <xrpl/protocol/Units.h>
|
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
|||||||
@@ -673,8 +673,7 @@ isTerRetry(TER x) noexcept
|
|||||||
inline bool
|
inline bool
|
||||||
isTesSuccess(TER x) noexcept
|
isTesSuccess(TER x) noexcept
|
||||||
{
|
{
|
||||||
// Makes use of TERSubset::operator bool()
|
return (x == tesSUCCESS);
|
||||||
return !(x);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
|
|||||||
@@ -127,8 +127,6 @@ constexpr std::uint32_t tfTrustSetPermissionMask = ~(tfUniversal | tfSetfAuth |
|
|||||||
// EnableAmendment flags:
|
// EnableAmendment flags:
|
||||||
constexpr std::uint32_t tfGotMajority = 0x00010000;
|
constexpr std::uint32_t tfGotMajority = 0x00010000;
|
||||||
constexpr std::uint32_t tfLostMajority = 0x00020000;
|
constexpr std::uint32_t tfLostMajority = 0x00020000;
|
||||||
constexpr std::uint32_t tfChangeMask =
|
|
||||||
~( tfUniversal | tfGotMajority | tfLostMajority);
|
|
||||||
|
|
||||||
// PaymentChannelClaim flags:
|
// PaymentChannelClaim flags:
|
||||||
constexpr std::uint32_t tfRenew = 0x00010000;
|
constexpr std::uint32_t tfRenew = 0x00010000;
|
||||||
@@ -143,8 +141,7 @@ constexpr std::uint32_t const tfTransferable = 0x00000008;
|
|||||||
constexpr std::uint32_t const tfMutable = 0x00000010;
|
constexpr std::uint32_t const tfMutable = 0x00000010;
|
||||||
|
|
||||||
// MPTokenIssuanceCreate flags:
|
// MPTokenIssuanceCreate flags:
|
||||||
// Note: tf/lsfMPTLocked is intentionally omitted, since this transaction
|
// NOTE - there is intentionally no flag here for lsfMPTLocked, which this transaction cannot mutate.
|
||||||
// is not allowed to modify it.
|
|
||||||
constexpr std::uint32_t const tfMPTCanLock = lsfMPTCanLock;
|
constexpr std::uint32_t const tfMPTCanLock = lsfMPTCanLock;
|
||||||
constexpr std::uint32_t const tfMPTRequireAuth = lsfMPTRequireAuth;
|
constexpr std::uint32_t const tfMPTRequireAuth = lsfMPTRequireAuth;
|
||||||
constexpr std::uint32_t const tfMPTCanEscrow = lsfMPTCanEscrow;
|
constexpr std::uint32_t const tfMPTCanEscrow = lsfMPTCanEscrow;
|
||||||
@@ -154,20 +151,6 @@ constexpr std::uint32_t const tfMPTCanClawback = lsfMPTCanClawback;
|
|||||||
constexpr std::uint32_t const tfMPTokenIssuanceCreateMask =
|
constexpr std::uint32_t const tfMPTokenIssuanceCreateMask =
|
||||||
~(tfUniversal | tfMPTCanLock | tfMPTRequireAuth | tfMPTCanEscrow | tfMPTCanTrade | tfMPTCanTransfer | tfMPTCanClawback);
|
~(tfUniversal | tfMPTCanLock | tfMPTRequireAuth | tfMPTCanEscrow | tfMPTCanTrade | tfMPTCanTransfer | tfMPTCanClawback);
|
||||||
|
|
||||||
// MPTokenIssuanceCreate MutableFlags:
|
|
||||||
// Indicating specific fields or flags may be changed after issuance.
|
|
||||||
constexpr std::uint32_t const tmfMPTCanMutateCanLock = lsmfMPTCanMutateCanLock;
|
|
||||||
constexpr std::uint32_t const tmfMPTCanMutateRequireAuth = lsmfMPTCanMutateRequireAuth;
|
|
||||||
constexpr std::uint32_t const tmfMPTCanMutateCanEscrow = lsmfMPTCanMutateCanEscrow;
|
|
||||||
constexpr std::uint32_t const tmfMPTCanMutateCanTrade = lsmfMPTCanMutateCanTrade;
|
|
||||||
constexpr std::uint32_t const tmfMPTCanMutateCanTransfer = lsmfMPTCanMutateCanTransfer;
|
|
||||||
constexpr std::uint32_t const tmfMPTCanMutateCanClawback = lsmfMPTCanMutateCanClawback;
|
|
||||||
constexpr std::uint32_t const tmfMPTCanMutateMetadata = lsmfMPTCanMutateMetadata;
|
|
||||||
constexpr std::uint32_t const tmfMPTCanMutateTransferFee = lsmfMPTCanMutateTransferFee;
|
|
||||||
constexpr std::uint32_t const tmfMPTokenIssuanceCreateMutableMask =
|
|
||||||
~(tmfMPTCanMutateCanLock | tmfMPTCanMutateRequireAuth | tmfMPTCanMutateCanEscrow | tmfMPTCanMutateCanTrade
|
|
||||||
| tmfMPTCanMutateCanTransfer | tmfMPTCanMutateCanClawback | tmfMPTCanMutateMetadata | tmfMPTCanMutateTransferFee);
|
|
||||||
|
|
||||||
// MPTokenAuthorize flags:
|
// MPTokenAuthorize flags:
|
||||||
constexpr std::uint32_t const tfMPTUnauthorize = 0x00000001;
|
constexpr std::uint32_t const tfMPTUnauthorize = 0x00000001;
|
||||||
constexpr std::uint32_t const tfMPTokenAuthorizeMask = ~(tfUniversal | tfMPTUnauthorize);
|
constexpr std::uint32_t const tfMPTokenAuthorizeMask = ~(tfUniversal | tfMPTUnauthorize);
|
||||||
@@ -178,25 +161,6 @@ constexpr std::uint32_t const tfMPTUnlock = 0x00000002;
|
|||||||
constexpr std::uint32_t const tfMPTokenIssuanceSetMask = ~(tfUniversal | tfMPTLock | tfMPTUnlock);
|
constexpr std::uint32_t const tfMPTokenIssuanceSetMask = ~(tfUniversal | tfMPTLock | tfMPTUnlock);
|
||||||
constexpr std::uint32_t const tfMPTokenIssuanceSetPermissionMask = ~(tfUniversal | tfMPTLock | tfMPTUnlock);
|
constexpr std::uint32_t const tfMPTokenIssuanceSetPermissionMask = ~(tfUniversal | tfMPTLock | tfMPTUnlock);
|
||||||
|
|
||||||
// MPTokenIssuanceSet MutableFlags:
|
|
||||||
// Set or Clear flags.
|
|
||||||
constexpr std::uint32_t const tmfMPTSetCanLock = 0x00000001;
|
|
||||||
constexpr std::uint32_t const tmfMPTClearCanLock = 0x00000002;
|
|
||||||
constexpr std::uint32_t const tmfMPTSetRequireAuth = 0x00000004;
|
|
||||||
constexpr std::uint32_t const tmfMPTClearRequireAuth = 0x00000008;
|
|
||||||
constexpr std::uint32_t const tmfMPTSetCanEscrow = 0x00000010;
|
|
||||||
constexpr std::uint32_t const tmfMPTClearCanEscrow = 0x00000020;
|
|
||||||
constexpr std::uint32_t const tmfMPTSetCanTrade = 0x00000040;
|
|
||||||
constexpr std::uint32_t const tmfMPTClearCanTrade = 0x00000080;
|
|
||||||
constexpr std::uint32_t const tmfMPTSetCanTransfer = 0x00000100;
|
|
||||||
constexpr std::uint32_t const tmfMPTClearCanTransfer = 0x00000200;
|
|
||||||
constexpr std::uint32_t const tmfMPTSetCanClawback = 0x00000400;
|
|
||||||
constexpr std::uint32_t const tmfMPTClearCanClawback = 0x00000800;
|
|
||||||
constexpr std::uint32_t const tmfMPTokenIssuanceSetMutableMask = ~(tmfMPTSetCanLock | tmfMPTClearCanLock |
|
|
||||||
tmfMPTSetRequireAuth | tmfMPTClearRequireAuth | tmfMPTSetCanEscrow | tmfMPTClearCanEscrow |
|
|
||||||
tmfMPTSetCanTrade | tmfMPTClearCanTrade | tmfMPTSetCanTransfer | tmfMPTClearCanTransfer |
|
|
||||||
tmfMPTSetCanClawback | tmfMPTClearCanClawback);
|
|
||||||
|
|
||||||
// MPTokenIssuanceDestroy flags:
|
// MPTokenIssuanceDestroy flags:
|
||||||
constexpr std::uint32_t const tfMPTokenIssuanceDestroyMask = ~tfUniversal;
|
constexpr std::uint32_t const tfMPTokenIssuanceDestroyMask = ~tfUniversal;
|
||||||
|
|
||||||
|
|||||||
@@ -1,555 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of rippled: https://github.com/ripple/rippled
|
|
||||||
Copyright (c) 2019 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 PROTOCOL_UNITS_H_INCLUDED
|
|
||||||
#define PROTOCOL_UNITS_H_INCLUDED
|
|
||||||
|
|
||||||
#include <xrpl/basics/safe_cast.h>
|
|
||||||
#include <xrpl/beast/utility/Zero.h>
|
|
||||||
#include <xrpl/beast/utility/instrumentation.h>
|
|
||||||
#include <xrpl/json/json_value.h>
|
|
||||||
|
|
||||||
#include <boost/multiprecision/cpp_int.hpp>
|
|
||||||
#include <boost/operators.hpp>
|
|
||||||
|
|
||||||
#include <iosfwd>
|
|
||||||
#include <limits>
|
|
||||||
#include <optional>
|
|
||||||
|
|
||||||
namespace ripple {
|
|
||||||
|
|
||||||
namespace unit {
|
|
||||||
|
|
||||||
/** "drops" are the smallest divisible amount of XRP. This is what most
|
|
||||||
of the code uses. */
|
|
||||||
struct dropTag;
|
|
||||||
/** "fee levels" are used by the transaction queue to compare the relative
|
|
||||||
cost of transactions that require different levels of effort to process.
|
|
||||||
See also: src/ripple/app/misc/FeeEscalation.md#fee-level */
|
|
||||||
struct feelevelTag;
|
|
||||||
/** unitless values are plain scalars wrapped in a ValueUnit. They are
|
|
||||||
used for calculations in this header. */
|
|
||||||
struct unitlessTag;
|
|
||||||
|
|
||||||
/** Units to represent basis points (bips) and 1/10 basis points */
|
|
||||||
class BipsTag;
|
|
||||||
class TenthBipsTag;
|
|
||||||
|
|
||||||
// These names don't have to be too descriptive, because we're in the "unit"
|
|
||||||
// namespace.
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
concept Valid = std::is_class_v<T> && std::is_object_v<typename T::unit_type> &&
|
|
||||||
std::is_object_v<typename T::value_type>;
|
|
||||||
|
|
||||||
/** `Usable` is checked to ensure that only values with
|
|
||||||
known valid type tags can be used (sometimes transparently) in
|
|
||||||
non-unit contexts. At the time of implementation, this includes
|
|
||||||
all known tags, but more may be added in the future, and they
|
|
||||||
should not be added automatically unless determined to be
|
|
||||||
appropriate.
|
|
||||||
*/
|
|
||||||
template <class T>
|
|
||||||
concept Usable = Valid<T> &&
|
|
||||||
(std::is_same_v<typename T::unit_type, feelevelTag> ||
|
|
||||||
std::is_same_v<typename T::unit_type, unitlessTag> ||
|
|
||||||
std::is_same_v<typename T::unit_type, dropTag> ||
|
|
||||||
std::is_same_v<typename T::unit_type, BipsTag> ||
|
|
||||||
std::is_same_v<typename T::unit_type, TenthBipsTag>);
|
|
||||||
|
|
||||||
template <class Other, class VU>
|
|
||||||
concept Compatible = Valid<VU> && std::is_arithmetic_v<Other> &&
|
|
||||||
std::is_arithmetic_v<typename VU::value_type> &&
|
|
||||||
std::is_convertible_v<Other, typename VU::value_type>;
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
concept Integral = std::is_integral_v<T>;
|
|
||||||
|
|
||||||
template <class VU>
|
|
||||||
concept IntegralValue = Integral<typename VU::value_type>;
|
|
||||||
|
|
||||||
template <class VU1, class VU2>
|
|
||||||
concept CastableValue = IntegralValue<VU1> && IntegralValue<VU2> &&
|
|
||||||
std::is_same_v<typename VU1::unit_type, typename VU2::unit_type>;
|
|
||||||
|
|
||||||
template <class UnitTag, class T>
|
|
||||||
class ValueUnit : private boost::totally_ordered<ValueUnit<UnitTag, T>>,
|
|
||||||
private boost::additive<ValueUnit<UnitTag, T>>,
|
|
||||||
private boost::equality_comparable<ValueUnit<UnitTag, T>, T>,
|
|
||||||
private boost::dividable<ValueUnit<UnitTag, T>, T>,
|
|
||||||
private boost::modable<ValueUnit<UnitTag, T>, T>,
|
|
||||||
private boost::unit_steppable<ValueUnit<UnitTag, T>>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
using unit_type = UnitTag;
|
|
||||||
using value_type = T;
|
|
||||||
|
|
||||||
private:
|
|
||||||
value_type value_;
|
|
||||||
|
|
||||||
public:
|
|
||||||
ValueUnit() = default;
|
|
||||||
constexpr ValueUnit(ValueUnit const& other) = default;
|
|
||||||
constexpr ValueUnit&
|
|
||||||
operator=(ValueUnit const& other) = default;
|
|
||||||
|
|
||||||
constexpr explicit ValueUnit(beast::Zero) : value_(0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr ValueUnit&
|
|
||||||
operator=(beast::Zero)
|
|
||||||
{
|
|
||||||
value_ = 0;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr explicit ValueUnit(value_type value) : value_(value)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr ValueUnit&
|
|
||||||
operator=(value_type value)
|
|
||||||
{
|
|
||||||
value_ = value;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Instances with the same unit, and a type that is
|
|
||||||
"safe" to convert to this one can be converted
|
|
||||||
implicitly */
|
|
||||||
template <Compatible<ValueUnit> Other>
|
|
||||||
constexpr ValueUnit(ValueUnit<unit_type, Other> const& value)
|
|
||||||
requires SafeToCast<Other, value_type>
|
|
||||||
: ValueUnit(safe_cast<value_type>(value.value()))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr ValueUnit
|
|
||||||
operator+(value_type const& rhs) const
|
|
||||||
{
|
|
||||||
return ValueUnit{value_ + rhs};
|
|
||||||
}
|
|
||||||
|
|
||||||
friend constexpr ValueUnit
|
|
||||||
operator+(value_type lhs, ValueUnit const& rhs)
|
|
||||||
{
|
|
||||||
// addition is commutative
|
|
||||||
return rhs + lhs;
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr ValueUnit
|
|
||||||
operator-(value_type const& rhs) const
|
|
||||||
{
|
|
||||||
return ValueUnit{value_ - rhs};
|
|
||||||
}
|
|
||||||
|
|
||||||
friend constexpr ValueUnit
|
|
||||||
operator-(value_type lhs, ValueUnit const& rhs)
|
|
||||||
{
|
|
||||||
// subtraction is NOT commutative, but (lhs + (-rhs)) is addition, which
|
|
||||||
// is
|
|
||||||
return -rhs + lhs;
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr ValueUnit
|
|
||||||
operator*(value_type const& rhs) const
|
|
||||||
{
|
|
||||||
return ValueUnit{value_ * rhs};
|
|
||||||
}
|
|
||||||
|
|
||||||
friend constexpr ValueUnit
|
|
||||||
operator*(value_type lhs, ValueUnit const& rhs)
|
|
||||||
{
|
|
||||||
// multiplication is commutative
|
|
||||||
return rhs * lhs;
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr value_type
|
|
||||||
operator/(ValueUnit const& rhs) const
|
|
||||||
{
|
|
||||||
return value_ / rhs.value_;
|
|
||||||
}
|
|
||||||
|
|
||||||
ValueUnit&
|
|
||||||
operator+=(ValueUnit const& other)
|
|
||||||
{
|
|
||||||
value_ += other.value();
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
ValueUnit&
|
|
||||||
operator-=(ValueUnit const& other)
|
|
||||||
{
|
|
||||||
value_ -= other.value();
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
ValueUnit&
|
|
||||||
operator++()
|
|
||||||
{
|
|
||||||
++value_;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
ValueUnit&
|
|
||||||
operator--()
|
|
||||||
{
|
|
||||||
--value_;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
ValueUnit&
|
|
||||||
operator*=(value_type const& rhs)
|
|
||||||
{
|
|
||||||
value_ *= rhs;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
ValueUnit&
|
|
||||||
operator/=(value_type const& rhs)
|
|
||||||
{
|
|
||||||
value_ /= rhs;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <Integral transparent = value_type>
|
|
||||||
ValueUnit&
|
|
||||||
operator%=(value_type const& rhs)
|
|
||||||
{
|
|
||||||
value_ %= rhs;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
ValueUnit
|
|
||||||
operator-() const
|
|
||||||
{
|
|
||||||
static_assert(
|
|
||||||
std::is_signed_v<T>, "- operator illegal on unsigned value types");
|
|
||||||
return ValueUnit{-value_};
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr bool
|
|
||||||
operator==(ValueUnit const& other) const
|
|
||||||
{
|
|
||||||
return value_ == other.value_;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <Compatible<ValueUnit> Other>
|
|
||||||
constexpr bool
|
|
||||||
operator==(ValueUnit<unit_type, Other> const& other) const
|
|
||||||
{
|
|
||||||
return value_ == other.value();
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr bool
|
|
||||||
operator==(value_type other) const
|
|
||||||
{
|
|
||||||
return value_ == other;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <Compatible<ValueUnit> Other>
|
|
||||||
constexpr bool
|
|
||||||
operator!=(ValueUnit<unit_type, Other> const& other) const
|
|
||||||
{
|
|
||||||
return !operator==(other);
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr bool
|
|
||||||
operator<(ValueUnit const& other) const
|
|
||||||
{
|
|
||||||
return value_ < other.value_;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Returns true if the amount is not zero */
|
|
||||||
explicit constexpr
|
|
||||||
operator bool() const noexcept
|
|
||||||
{
|
|
||||||
return value_ != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Return the sign of the amount */
|
|
||||||
constexpr int
|
|
||||||
signum() const noexcept
|
|
||||||
{
|
|
||||||
return (value_ < 0) ? -1 : (value_ ? 1 : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Returns the number of drops */
|
|
||||||
// TODO: Move this to a new class, maybe with the old "TaggedFee" name
|
|
||||||
constexpr value_type
|
|
||||||
fee() const
|
|
||||||
{
|
|
||||||
return value_;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Other>
|
|
||||||
constexpr double
|
|
||||||
decimalFromReference(ValueUnit<unit_type, Other> reference) const
|
|
||||||
{
|
|
||||||
return static_cast<double>(value_) / reference.value();
|
|
||||||
}
|
|
||||||
|
|
||||||
// `Usable` is checked to ensure that only values with
|
|
||||||
// known valid type tags can be converted to JSON. At the time
|
|
||||||
// of implementation, that includes all known tags, but more may
|
|
||||||
// be added in the future.
|
|
||||||
Json::Value
|
|
||||||
jsonClipped() const
|
|
||||||
requires Usable<ValueUnit>
|
|
||||||
{
|
|
||||||
if constexpr (std::is_integral_v<value_type>)
|
|
||||||
{
|
|
||||||
using jsontype = std::conditional_t<
|
|
||||||
std::is_signed_v<value_type>,
|
|
||||||
Json::Int,
|
|
||||||
Json::UInt>;
|
|
||||||
|
|
||||||
constexpr auto min = std::numeric_limits<jsontype>::min();
|
|
||||||
constexpr auto max = std::numeric_limits<jsontype>::max();
|
|
||||||
|
|
||||||
if (value_ < min)
|
|
||||||
return min;
|
|
||||||
if (value_ > max)
|
|
||||||
return max;
|
|
||||||
return static_cast<jsontype>(value_);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return value_;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Returns the underlying value. Code SHOULD NOT call this
|
|
||||||
function unless the type has been abstracted away,
|
|
||||||
e.g. in a templated function.
|
|
||||||
*/
|
|
||||||
constexpr value_type
|
|
||||||
value() const
|
|
||||||
{
|
|
||||||
return value_;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend std::istream&
|
|
||||||
operator>>(std::istream& s, ValueUnit& val)
|
|
||||||
{
|
|
||||||
s >> val.value_;
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Output Values as just their numeric value.
|
|
||||||
template <class Char, class Traits, class UnitTag, class T>
|
|
||||||
std::basic_ostream<Char, Traits>&
|
|
||||||
operator<<(std::basic_ostream<Char, Traits>& os, ValueUnit<UnitTag, T> const& q)
|
|
||||||
{
|
|
||||||
return os << q.value();
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class UnitTag, class T>
|
|
||||||
std::string
|
|
||||||
to_string(ValueUnit<UnitTag, T> const& amount)
|
|
||||||
{
|
|
||||||
return std::to_string(amount.value());
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Source>
|
|
||||||
concept muldivSource = Valid<Source> &&
|
|
||||||
std::is_convertible_v<typename Source::value_type, std::uint64_t>;
|
|
||||||
|
|
||||||
template <class Dest>
|
|
||||||
concept muldivDest = muldivSource<Dest> && // Dest is also a source
|
|
||||||
std::is_convertible_v<std::uint64_t, typename Dest::value_type> &&
|
|
||||||
sizeof(typename Dest::value_type) >= sizeof(std::uint64_t);
|
|
||||||
|
|
||||||
template <class Source2, class Source1>
|
|
||||||
concept muldivSources = muldivSource<Source1> && muldivSource<Source2> &&
|
|
||||||
std::is_same_v<typename Source1::unit_type, typename Source2::unit_type>;
|
|
||||||
|
|
||||||
template <class Dest, class Source1, class Source2>
|
|
||||||
concept muldivable = muldivSources<Source1, Source2> && muldivDest<Dest>;
|
|
||||||
// Source and Dest can be the same by default
|
|
||||||
|
|
||||||
template <class Dest, class Source1, class Source2>
|
|
||||||
concept muldivCommutable = muldivable<Dest, Source1, Source2> &&
|
|
||||||
!std::is_same_v<typename Source1::unit_type, typename Dest::unit_type>;
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
ValueUnit<unitlessTag, T>
|
|
||||||
scalar(T value)
|
|
||||||
{
|
|
||||||
return ValueUnit<unitlessTag, T>{value};
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Source1, class Source2, unit::muldivable<Source1, Source2> Dest>
|
|
||||||
std::optional<Dest>
|
|
||||||
mulDivU(Source1 value, Dest mul, Source2 div)
|
|
||||||
{
|
|
||||||
// values can never be negative in any context.
|
|
||||||
if (value.value() < 0 || mul.value() < 0 || div.value() < 0)
|
|
||||||
{
|
|
||||||
// split the asserts so if one hits, the user can tell which
|
|
||||||
// without a debugger.
|
|
||||||
XRPL_ASSERT(
|
|
||||||
value.value() >= 0, "ripple::unit::mulDivU : minimum value input");
|
|
||||||
XRPL_ASSERT(
|
|
||||||
mul.value() >= 0, "ripple::unit::mulDivU : minimum mul input");
|
|
||||||
XRPL_ASSERT(
|
|
||||||
div.value() > 0, "ripple::unit::mulDivU : minimum div input");
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
|
|
||||||
using desttype = typename Dest::value_type;
|
|
||||||
constexpr auto max = std::numeric_limits<desttype>::max();
|
|
||||||
|
|
||||||
// Shortcuts, since these happen a lot in the real world
|
|
||||||
if (value == div)
|
|
||||||
return mul;
|
|
||||||
if (mul.value() == div.value())
|
|
||||||
{
|
|
||||||
if (value.value() > max)
|
|
||||||
return std::nullopt;
|
|
||||||
return Dest{static_cast<desttype>(value.value())};
|
|
||||||
}
|
|
||||||
|
|
||||||
using namespace boost::multiprecision;
|
|
||||||
|
|
||||||
uint128_t product;
|
|
||||||
product = multiply(
|
|
||||||
product,
|
|
||||||
static_cast<std::uint64_t>(value.value()),
|
|
||||||
static_cast<std::uint64_t>(mul.value()));
|
|
||||||
|
|
||||||
auto quotient = product / div.value();
|
|
||||||
|
|
||||||
if (quotient > max)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return Dest{static_cast<desttype>(quotient)};
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace unit
|
|
||||||
|
|
||||||
// Fee Levels
|
|
||||||
template <class T>
|
|
||||||
using FeeLevel = unit::ValueUnit<unit::feelevelTag, T>;
|
|
||||||
using FeeLevel64 = FeeLevel<std::uint64_t>;
|
|
||||||
using FeeLevelDouble = FeeLevel<double>;
|
|
||||||
|
|
||||||
// Basis points (Bips)
|
|
||||||
template <class T>
|
|
||||||
using Bips = unit::ValueUnit<unit::BipsTag, T>;
|
|
||||||
using Bips16 = Bips<std::uint16_t>;
|
|
||||||
using Bips32 = Bips<std::uint32_t>;
|
|
||||||
template <class T>
|
|
||||||
using TenthBips = unit::ValueUnit<unit::TenthBipsTag, T>;
|
|
||||||
using TenthBips16 = TenthBips<std::uint16_t>;
|
|
||||||
using TenthBips32 = TenthBips<std::uint32_t>;
|
|
||||||
|
|
||||||
template <class Source1, class Source2, unit::muldivable<Source1, Source2> Dest>
|
|
||||||
std::optional<Dest>
|
|
||||||
mulDiv(Source1 value, Dest mul, Source2 div)
|
|
||||||
{
|
|
||||||
return unit::mulDivU(value, mul, div);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <
|
|
||||||
class Source1,
|
|
||||||
class Source2,
|
|
||||||
unit::muldivCommutable<Source1, Source2> Dest>
|
|
||||||
std::optional<Dest>
|
|
||||||
mulDiv(Dest value, Source1 mul, Source2 div)
|
|
||||||
{
|
|
||||||
// Multiplication is commutative
|
|
||||||
return unit::mulDivU(mul, value, div);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <unit::muldivDest Dest>
|
|
||||||
std::optional<Dest>
|
|
||||||
mulDiv(std::uint64_t value, Dest mul, std::uint64_t div)
|
|
||||||
{
|
|
||||||
// Give the scalars a non-tag so the
|
|
||||||
// unit-handling version gets called.
|
|
||||||
return unit::mulDivU(unit::scalar(value), mul, unit::scalar(div));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <unit::muldivDest Dest>
|
|
||||||
std::optional<Dest>
|
|
||||||
mulDiv(Dest value, std::uint64_t mul, std::uint64_t div)
|
|
||||||
{
|
|
||||||
// Multiplication is commutative
|
|
||||||
return mulDiv(mul, value, div);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <unit::muldivSource Source1, unit::muldivSources<Source1> Source2>
|
|
||||||
std::optional<std::uint64_t>
|
|
||||||
mulDiv(Source1 value, std::uint64_t mul, Source2 div)
|
|
||||||
{
|
|
||||||
// Give the scalars a dimensionless unit so the
|
|
||||||
// unit-handling version gets called.
|
|
||||||
auto unitresult = unit::mulDivU(value, unit::scalar(mul), div);
|
|
||||||
|
|
||||||
if (!unitresult)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return unitresult->value();
|
|
||||||
}
|
|
||||||
|
|
||||||
template <unit::muldivSource Source1, unit::muldivSources<Source1> Source2>
|
|
||||||
std::optional<std::uint64_t>
|
|
||||||
mulDiv(std::uint64_t value, Source1 mul, Source2 div)
|
|
||||||
{
|
|
||||||
// Multiplication is commutative
|
|
||||||
return mulDiv(mul, value, div);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <unit::IntegralValue Dest, unit::CastableValue<Dest> Src>
|
|
||||||
constexpr Dest
|
|
||||||
safe_cast(Src s) noexcept
|
|
||||||
{
|
|
||||||
// Dest may not have an explicit value constructor
|
|
||||||
return Dest{safe_cast<typename Dest::value_type>(s.value())};
|
|
||||||
}
|
|
||||||
|
|
||||||
template <unit::IntegralValue Dest, unit::Integral Src>
|
|
||||||
constexpr Dest
|
|
||||||
safe_cast(Src s) noexcept
|
|
||||||
{
|
|
||||||
// Dest may not have an explicit value constructor
|
|
||||||
return Dest{safe_cast<typename Dest::value_type>(s)};
|
|
||||||
}
|
|
||||||
|
|
||||||
template <unit::IntegralValue Dest, unit::CastableValue<Dest> Src>
|
|
||||||
constexpr Dest
|
|
||||||
unsafe_cast(Src s) noexcept
|
|
||||||
{
|
|
||||||
// Dest may not have an explicit value constructor
|
|
||||||
return Dest{unsafe_cast<typename Dest::value_type>(s.value())};
|
|
||||||
}
|
|
||||||
|
|
||||||
template <unit::IntegralValue Dest, unit::Integral Src>
|
|
||||||
constexpr Dest
|
|
||||||
unsafe_cast(Src s) noexcept
|
|
||||||
{
|
|
||||||
// Dest may not have an explicit value constructor
|
|
||||||
return Dest{unsafe_cast<typename Dest::value_type>(s)};
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ripple
|
|
||||||
|
|
||||||
#endif // PROTOCOL_UNITS_H_INCLUDED
|
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
#include <xrpl/basics/contract.h>
|
#include <xrpl/basics/contract.h>
|
||||||
#include <xrpl/beast/utility/Zero.h>
|
#include <xrpl/beast/utility/Zero.h>
|
||||||
#include <xrpl/json/json_value.h>
|
#include <xrpl/json/json_value.h>
|
||||||
#include <xrpl/protocol/Units.h>
|
#include <xrpl/protocol/FeeUnits.h>
|
||||||
|
|
||||||
#include <boost/multiprecision/cpp_int.hpp>
|
#include <boost/multiprecision/cpp_int.hpp>
|
||||||
#include <boost/operators.hpp>
|
#include <boost/operators.hpp>
|
||||||
@@ -42,7 +42,7 @@ class XRPAmount : private boost::totally_ordered<XRPAmount>,
|
|||||||
private boost::additive<XRPAmount, std::int64_t>
|
private boost::additive<XRPAmount, std::int64_t>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using unit_type = unit::dropTag;
|
using unit_type = feeunit::dropTag;
|
||||||
using value_type = std::int64_t;
|
using value_type = std::int64_t;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -129,12 +129,10 @@ inplace_bigint_div_rem(std::span<uint64_t> numerator, std::uint64_t divisor)
|
|||||||
{
|
{
|
||||||
// should never happen, but if it does then it seems natural to define
|
// should never happen, but if it does then it seems natural to define
|
||||||
// the a null set of numbers to be zero, so the remainder is also zero.
|
// the a null set of numbers to be zero, so the remainder is also zero.
|
||||||
// LCOV_EXCL_START
|
|
||||||
UNREACHABLE(
|
UNREACHABLE(
|
||||||
"ripple::b58_fast::detail::inplace_bigint_div_rem : empty "
|
"ripple::b58_fast::detail::inplace_bigint_div_rem : empty "
|
||||||
"numerator");
|
"numerator");
|
||||||
return 0;
|
return 0;
|
||||||
// LCOV_EXCL_STOP
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto to_u128 = [](std::uint64_t high,
|
auto to_u128 = [](std::uint64_t high,
|
||||||
|
|||||||
@@ -29,14 +29,12 @@
|
|||||||
|
|
||||||
// Add new amendments to the top of this list.
|
// Add new amendments to the top of this list.
|
||||||
// Keep it sorted in reverse chronological order.
|
// Keep it sorted in reverse chronological order.
|
||||||
|
// If you add an amendment here, then do not forget to increment `numFeatures`
|
||||||
|
// in include/xrpl/protocol/Feature.h.
|
||||||
|
|
||||||
XRPL_FIX (DirectoryLimit, Supported::yes, VoteBehavior::DefaultNo)
|
|
||||||
XRPL_FIX (IncludeKeyletFields, Supported::yes, VoteBehavior::DefaultNo)
|
|
||||||
XRPL_FEATURE(DynamicMPT, Supported::no, VoteBehavior::DefaultNo)
|
|
||||||
XRPL_FIX (TokenEscrowV1, Supported::yes, VoteBehavior::DefaultNo)
|
|
||||||
XRPL_FIX (DelegateV1_1, Supported::no, VoteBehavior::DefaultNo)
|
XRPL_FIX (DelegateV1_1, Supported::no, VoteBehavior::DefaultNo)
|
||||||
XRPL_FIX (PriceOracleOrder, Supported::yes, VoteBehavior::DefaultNo)
|
XRPL_FIX (PriceOracleOrder, Supported::no, VoteBehavior::DefaultNo)
|
||||||
XRPL_FIX (MPTDeliveredAmount, Supported::yes, VoteBehavior::DefaultNo)
|
XRPL_FIX (MPTDeliveredAmount, Supported::no, VoteBehavior::DefaultNo)
|
||||||
XRPL_FIX (AMMClawbackRounding, Supported::yes, VoteBehavior::DefaultNo)
|
XRPL_FIX (AMMClawbackRounding, Supported::yes, VoteBehavior::DefaultNo)
|
||||||
XRPL_FEATURE(TokenEscrow, Supported::yes, VoteBehavior::DefaultNo)
|
XRPL_FEATURE(TokenEscrow, Supported::yes, VoteBehavior::DefaultNo)
|
||||||
XRPL_FIX (EnforceNFTokenTrustlineV2, Supported::yes, VoteBehavior::DefaultNo)
|
XRPL_FIX (EnforceNFTokenTrustlineV2, Supported::yes, VoteBehavior::DefaultNo)
|
||||||
@@ -44,7 +42,7 @@ XRPL_FIX (AMMv1_3, Supported::yes, VoteBehavior::DefaultNo
|
|||||||
XRPL_FEATURE(PermissionedDEX, Supported::yes, VoteBehavior::DefaultNo)
|
XRPL_FEATURE(PermissionedDEX, Supported::yes, VoteBehavior::DefaultNo)
|
||||||
XRPL_FEATURE(Batch, Supported::yes, VoteBehavior::DefaultNo)
|
XRPL_FEATURE(Batch, Supported::yes, VoteBehavior::DefaultNo)
|
||||||
XRPL_FEATURE(SingleAssetVault, Supported::no, VoteBehavior::DefaultNo)
|
XRPL_FEATURE(SingleAssetVault, Supported::no, VoteBehavior::DefaultNo)
|
||||||
XRPL_FEATURE(PermissionDelegation, Supported::no, VoteBehavior::DefaultNo)
|
XRPL_FEATURE(PermissionDelegation, Supported::yes, VoteBehavior::DefaultNo)
|
||||||
XRPL_FIX (PayChanCancelAfter, Supported::yes, VoteBehavior::DefaultNo)
|
XRPL_FIX (PayChanCancelAfter, Supported::yes, VoteBehavior::DefaultNo)
|
||||||
// Check flags in Credential transactions
|
// Check flags in Credential transactions
|
||||||
XRPL_FIX (InvalidTxFlags, Supported::yes, VoteBehavior::DefaultNo)
|
XRPL_FIX (InvalidTxFlags, Supported::yes, VoteBehavior::DefaultNo)
|
||||||
|
|||||||
@@ -120,7 +120,6 @@ LEDGER_ENTRY(ltNFTOKEN_PAGE, 0x0050, NFTokenPage, nft_page, ({
|
|||||||
// All fields are soeREQUIRED because there is always a SignerEntries.
|
// All fields are soeREQUIRED because there is always a SignerEntries.
|
||||||
// If there are no SignerEntries the node is deleted.
|
// If there are no SignerEntries the node is deleted.
|
||||||
LEDGER_ENTRY(ltSIGNER_LIST, 0x0053, SignerList, signer_list, ({
|
LEDGER_ENTRY(ltSIGNER_LIST, 0x0053, SignerList, signer_list, ({
|
||||||
{sfOwner, soeOPTIONAL},
|
|
||||||
{sfOwnerNode, soeREQUIRED},
|
{sfOwnerNode, soeREQUIRED},
|
||||||
{sfSignerQuorum, soeREQUIRED},
|
{sfSignerQuorum, soeREQUIRED},
|
||||||
{sfSignerEntries, soeREQUIRED},
|
{sfSignerEntries, soeREQUIRED},
|
||||||
@@ -189,7 +188,7 @@ LEDGER_ENTRY(ltDIR_NODE, 0x0064, DirectoryNode, directory, ({
|
|||||||
{sfNFTokenID, soeOPTIONAL},
|
{sfNFTokenID, soeOPTIONAL},
|
||||||
{sfPreviousTxnID, soeOPTIONAL},
|
{sfPreviousTxnID, soeOPTIONAL},
|
||||||
{sfPreviousTxnLgrSeq, soeOPTIONAL},
|
{sfPreviousTxnLgrSeq, soeOPTIONAL},
|
||||||
{sfDomainID, soeOPTIONAL} // order book directories
|
{sfDomainID, soeOPTIONAL}
|
||||||
}))
|
}))
|
||||||
|
|
||||||
/** The ledger object which lists details about amendments on the network.
|
/** The ledger object which lists details about amendments on the network.
|
||||||
@@ -344,7 +343,6 @@ LEDGER_ENTRY(ltXCHAIN_OWNED_CREATE_ACCOUNT_CLAIM_ID, 0x0074, XChainOwnedCreateAc
|
|||||||
*/
|
*/
|
||||||
LEDGER_ENTRY(ltESCROW, 0x0075, Escrow, escrow, ({
|
LEDGER_ENTRY(ltESCROW, 0x0075, Escrow, escrow, ({
|
||||||
{sfAccount, soeREQUIRED},
|
{sfAccount, soeREQUIRED},
|
||||||
{sfSequence, soeOPTIONAL},
|
|
||||||
{sfDestination, soeREQUIRED},
|
{sfDestination, soeREQUIRED},
|
||||||
{sfAmount, soeREQUIRED},
|
{sfAmount, soeREQUIRED},
|
||||||
{sfCondition, soeOPTIONAL},
|
{sfCondition, soeOPTIONAL},
|
||||||
@@ -367,7 +365,6 @@ LEDGER_ENTRY(ltESCROW, 0x0075, Escrow, escrow, ({
|
|||||||
LEDGER_ENTRY(ltPAYCHAN, 0x0078, PayChannel, payment_channel, ({
|
LEDGER_ENTRY(ltPAYCHAN, 0x0078, PayChannel, payment_channel, ({
|
||||||
{sfAccount, soeREQUIRED},
|
{sfAccount, soeREQUIRED},
|
||||||
{sfDestination, soeREQUIRED},
|
{sfDestination, soeREQUIRED},
|
||||||
{sfSequence, soeOPTIONAL},
|
|
||||||
{sfAmount, soeREQUIRED},
|
{sfAmount, soeREQUIRED},
|
||||||
{sfBalance, soeREQUIRED},
|
{sfBalance, soeREQUIRED},
|
||||||
{sfPublicKey, soeREQUIRED},
|
{sfPublicKey, soeREQUIRED},
|
||||||
@@ -415,7 +412,6 @@ LEDGER_ENTRY(ltMPTOKEN_ISSUANCE, 0x007e, MPTokenIssuance, mpt_issuance, ({
|
|||||||
{sfPreviousTxnID, soeREQUIRED},
|
{sfPreviousTxnID, soeREQUIRED},
|
||||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||||
{sfDomainID, soeOPTIONAL},
|
{sfDomainID, soeOPTIONAL},
|
||||||
{sfMutableFlags, soeDEFAULT},
|
|
||||||
}))
|
}))
|
||||||
|
|
||||||
/** A ledger object which tracks MPToken
|
/** A ledger object which tracks MPToken
|
||||||
@@ -436,7 +432,6 @@ LEDGER_ENTRY(ltMPTOKEN, 0x007f, MPToken, mptoken, ({
|
|||||||
*/
|
*/
|
||||||
LEDGER_ENTRY(ltORACLE, 0x0080, Oracle, oracle, ({
|
LEDGER_ENTRY(ltORACLE, 0x0080, Oracle, oracle, ({
|
||||||
{sfOwner, soeREQUIRED},
|
{sfOwner, soeREQUIRED},
|
||||||
{sfOracleDocumentID, soeOPTIONAL},
|
|
||||||
{sfProvider, soeREQUIRED},
|
{sfProvider, soeREQUIRED},
|
||||||
{sfPriceDataSeries, soeREQUIRED},
|
{sfPriceDataSeries, soeREQUIRED},
|
||||||
{sfAssetClass, soeREQUIRED},
|
{sfAssetClass, soeREQUIRED},
|
||||||
@@ -457,7 +452,7 @@ LEDGER_ENTRY(ltCREDENTIAL, 0x0081, Credential, credential, ({
|
|||||||
{sfExpiration, soeOPTIONAL},
|
{sfExpiration, soeOPTIONAL},
|
||||||
{sfURI, soeOPTIONAL},
|
{sfURI, soeOPTIONAL},
|
||||||
{sfIssuerNode, soeREQUIRED},
|
{sfIssuerNode, soeREQUIRED},
|
||||||
{sfSubjectNode, soeOPTIONAL},
|
{sfSubjectNode, soeREQUIRED},
|
||||||
{sfPreviousTxnID, soeREQUIRED},
|
{sfPreviousTxnID, soeREQUIRED},
|
||||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||||
}))
|
}))
|
||||||
|
|||||||
@@ -114,7 +114,6 @@ TYPED_SFIELD(sfVoteWeight, UINT32, 48)
|
|||||||
TYPED_SFIELD(sfFirstNFTokenSequence, UINT32, 50)
|
TYPED_SFIELD(sfFirstNFTokenSequence, UINT32, 50)
|
||||||
TYPED_SFIELD(sfOracleDocumentID, UINT32, 51)
|
TYPED_SFIELD(sfOracleDocumentID, UINT32, 51)
|
||||||
TYPED_SFIELD(sfPermissionValue, UINT32, 52)
|
TYPED_SFIELD(sfPermissionValue, UINT32, 52)
|
||||||
TYPED_SFIELD(sfMutableFlags, UINT32, 53)
|
|
||||||
|
|
||||||
// 64-bit integers (common)
|
// 64-bit integers (common)
|
||||||
TYPED_SFIELD(sfIndexNext, UINT64, 1)
|
TYPED_SFIELD(sfIndexNext, UINT64, 1)
|
||||||
@@ -174,8 +173,7 @@ TYPED_SFIELD(sfNFTokenID, UINT256, 10)
|
|||||||
TYPED_SFIELD(sfEmitParentTxnID, UINT256, 11)
|
TYPED_SFIELD(sfEmitParentTxnID, UINT256, 11)
|
||||||
TYPED_SFIELD(sfEmitNonce, UINT256, 12)
|
TYPED_SFIELD(sfEmitNonce, UINT256, 12)
|
||||||
TYPED_SFIELD(sfEmitHookHash, UINT256, 13)
|
TYPED_SFIELD(sfEmitHookHash, UINT256, 13)
|
||||||
TYPED_SFIELD(sfAMMID, UINT256, 14,
|
TYPED_SFIELD(sfAMMID, UINT256, 14)
|
||||||
SField::sMD_PseudoAccount | SField::sMD_Default)
|
|
||||||
|
|
||||||
// 256-bit (uncommon)
|
// 256-bit (uncommon)
|
||||||
TYPED_SFIELD(sfBookDirectory, UINT256, 16)
|
TYPED_SFIELD(sfBookDirectory, UINT256, 16)
|
||||||
@@ -197,8 +195,7 @@ TYPED_SFIELD(sfHookHash, UINT256, 31)
|
|||||||
TYPED_SFIELD(sfHookNamespace, UINT256, 32)
|
TYPED_SFIELD(sfHookNamespace, UINT256, 32)
|
||||||
TYPED_SFIELD(sfHookSetTxnID, UINT256, 33)
|
TYPED_SFIELD(sfHookSetTxnID, UINT256, 33)
|
||||||
TYPED_SFIELD(sfDomainID, UINT256, 34)
|
TYPED_SFIELD(sfDomainID, UINT256, 34)
|
||||||
TYPED_SFIELD(sfVaultID, UINT256, 35,
|
TYPED_SFIELD(sfVaultID, UINT256, 35)
|
||||||
SField::sMD_PseudoAccount | SField::sMD_Default)
|
|
||||||
TYPED_SFIELD(sfParentBatchID, UINT256, 36)
|
TYPED_SFIELD(sfParentBatchID, UINT256, 36)
|
||||||
|
|
||||||
// number (common)
|
// number (common)
|
||||||
@@ -208,12 +205,6 @@ TYPED_SFIELD(sfAssetsMaximum, NUMBER, 3)
|
|||||||
TYPED_SFIELD(sfAssetsTotal, NUMBER, 4)
|
TYPED_SFIELD(sfAssetsTotal, NUMBER, 4)
|
||||||
TYPED_SFIELD(sfLossUnrealized, NUMBER, 5)
|
TYPED_SFIELD(sfLossUnrealized, NUMBER, 5)
|
||||||
|
|
||||||
// int32
|
|
||||||
// NOTE: Do not use `sfDummyInt32`. It's so far the only use of INT32
|
|
||||||
// in this file and has been defined here for test only.
|
|
||||||
// TODO: Replace `sfDummyInt32` with actually useful field.
|
|
||||||
TYPED_SFIELD(sfDummyInt32, INT32, 1) // for tests only
|
|
||||||
|
|
||||||
// currency amount (common)
|
// currency amount (common)
|
||||||
TYPED_SFIELD(sfAmount, AMOUNT, 1)
|
TYPED_SFIELD(sfAmount, AMOUNT, 1)
|
||||||
TYPED_SFIELD(sfBalance, AMOUNT, 2)
|
TYPED_SFIELD(sfBalance, AMOUNT, 2)
|
||||||
|
|||||||
@@ -22,31 +22,16 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TRANSACTION(tag, value, name, delegatable, amendments, privileges, fields)
|
* TRANSACTION(tag, value, name, delegatable, amendments, fields)
|
||||||
*
|
|
||||||
* To ease maintenance, you may replace any unneeded values with "..."
|
|
||||||
* e.g. #define TRANSACTION(tag, value, name, ...)
|
|
||||||
*
|
*
|
||||||
* You must define a transactor class in the `ripple` namespace named `name`,
|
* You must define a transactor class in the `ripple` namespace named `name`,
|
||||||
* and include its header alongside the TRANSACTOR definition using this
|
* and include its header in `src/xrpld/app/tx/detail/applySteps.cpp`.
|
||||||
* format:
|
|
||||||
* #if TRANSACTION_INCLUDE
|
|
||||||
* # include <xrpld/app/tx/detail/HEADER.h>
|
|
||||||
* #endif
|
|
||||||
*
|
|
||||||
* The `privileges` parameter of the TRANSACTION macro is a bitfield
|
|
||||||
* defining which operations the transaction can perform.
|
|
||||||
* The values are defined and used in InvariantCheck.cpp
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** This transaction type executes a payment. */
|
/** This transaction type executes a payment. */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/Payment.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttPAYMENT, 0, Payment,
|
TRANSACTION(ttPAYMENT, 0, Payment,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
uint256{},
|
uint256{},
|
||||||
createAcct,
|
|
||||||
({
|
({
|
||||||
{sfDestination, soeREQUIRED},
|
{sfDestination, soeREQUIRED},
|
||||||
{sfAmount, soeREQUIRED, soeMPTSupported},
|
{sfAmount, soeREQUIRED, soeMPTSupported},
|
||||||
@@ -60,13 +45,9 @@ TRANSACTION(ttPAYMENT, 0, Payment,
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type creates an escrow object. */
|
/** This transaction type creates an escrow object. */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/Escrow.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttESCROW_CREATE, 1, EscrowCreate,
|
TRANSACTION(ttESCROW_CREATE, 1, EscrowCreate,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
uint256{},
|
uint256{},
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfDestination, soeREQUIRED},
|
{sfDestination, soeREQUIRED},
|
||||||
{sfAmount, soeREQUIRED, soeMPTSupported},
|
{sfAmount, soeREQUIRED, soeMPTSupported},
|
||||||
@@ -80,7 +61,6 @@ TRANSACTION(ttESCROW_CREATE, 1, EscrowCreate,
|
|||||||
TRANSACTION(ttESCROW_FINISH, 2, EscrowFinish,
|
TRANSACTION(ttESCROW_FINISH, 2, EscrowFinish,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
uint256{},
|
uint256{},
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfOwner, soeREQUIRED},
|
{sfOwner, soeREQUIRED},
|
||||||
{sfOfferSequence, soeREQUIRED},
|
{sfOfferSequence, soeREQUIRED},
|
||||||
@@ -91,13 +71,9 @@ TRANSACTION(ttESCROW_FINISH, 2, EscrowFinish,
|
|||||||
|
|
||||||
|
|
||||||
/** This transaction type adjusts various account settings. */
|
/** This transaction type adjusts various account settings. */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/SetAccount.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttACCOUNT_SET, 3, AccountSet,
|
TRANSACTION(ttACCOUNT_SET, 3, AccountSet,
|
||||||
Delegation::notDelegatable,
|
Delegation::notDelegatable,
|
||||||
uint256{},
|
uint256{},
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfEmailHash, soeOPTIONAL},
|
{sfEmailHash, soeOPTIONAL},
|
||||||
{sfWalletLocator, soeOPTIONAL},
|
{sfWalletLocator, soeOPTIONAL},
|
||||||
@@ -112,26 +88,18 @@ TRANSACTION(ttACCOUNT_SET, 3, AccountSet,
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type cancels an existing escrow. */
|
/** This transaction type cancels an existing escrow. */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/Escrow.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttESCROW_CANCEL, 4, EscrowCancel,
|
TRANSACTION(ttESCROW_CANCEL, 4, EscrowCancel,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
uint256{},
|
uint256{},
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfOwner, soeREQUIRED},
|
{sfOwner, soeREQUIRED},
|
||||||
{sfOfferSequence, soeREQUIRED},
|
{sfOfferSequence, soeREQUIRED},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type sets or clears an account's "regular key". */
|
/** This transaction type sets or clears an account's "regular key". */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/SetRegularKey.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttREGULAR_KEY_SET, 5, SetRegularKey,
|
TRANSACTION(ttREGULAR_KEY_SET, 5, SetRegularKey,
|
||||||
Delegation::notDelegatable,
|
Delegation::notDelegatable,
|
||||||
uint256{},
|
uint256{},
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfRegularKey, soeOPTIONAL},
|
{sfRegularKey, soeOPTIONAL},
|
||||||
}))
|
}))
|
||||||
@@ -139,13 +107,9 @@ TRANSACTION(ttREGULAR_KEY_SET, 5, SetRegularKey,
|
|||||||
// 6 deprecated
|
// 6 deprecated
|
||||||
|
|
||||||
/** This transaction type creates an offer to trade one asset for another. */
|
/** This transaction type creates an offer to trade one asset for another. */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/CreateOffer.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttOFFER_CREATE, 7, OfferCreate,
|
TRANSACTION(ttOFFER_CREATE, 7, OfferCreate,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
uint256{},
|
uint256{},
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfTakerPays, soeREQUIRED},
|
{sfTakerPays, soeREQUIRED},
|
||||||
{sfTakerGets, soeREQUIRED},
|
{sfTakerGets, soeREQUIRED},
|
||||||
@@ -155,13 +119,9 @@ TRANSACTION(ttOFFER_CREATE, 7, OfferCreate,
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type cancels existing offers to trade one asset for another. */
|
/** This transaction type cancels existing offers to trade one asset for another. */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/CancelOffer.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttOFFER_CANCEL, 8, OfferCancel,
|
TRANSACTION(ttOFFER_CANCEL, 8, OfferCancel,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
uint256{},
|
uint256{},
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfOfferSequence, soeREQUIRED},
|
{sfOfferSequence, soeREQUIRED},
|
||||||
}))
|
}))
|
||||||
@@ -169,13 +129,9 @@ TRANSACTION(ttOFFER_CANCEL, 8, OfferCancel,
|
|||||||
// 9 deprecated
|
// 9 deprecated
|
||||||
|
|
||||||
/** This transaction type creates a new set of tickets. */
|
/** This transaction type creates a new set of tickets. */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/CreateTicket.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttTICKET_CREATE, 10, TicketCreate,
|
TRANSACTION(ttTICKET_CREATE, 10, TicketCreate,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureTicketBatch,
|
featureTicketBatch,
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfTicketCount, soeREQUIRED},
|
{sfTicketCount, soeREQUIRED},
|
||||||
}))
|
}))
|
||||||
@@ -185,26 +141,18 @@ TRANSACTION(ttTICKET_CREATE, 10, TicketCreate,
|
|||||||
/** This transaction type modifies the signer list associated with an account. */
|
/** This transaction type modifies the signer list associated with an account. */
|
||||||
// The SignerEntries are optional because a SignerList is deleted by
|
// The SignerEntries are optional because a SignerList is deleted by
|
||||||
// setting the SignerQuorum to zero and omitting SignerEntries.
|
// setting the SignerQuorum to zero and omitting SignerEntries.
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/SetSignerList.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttSIGNER_LIST_SET, 12, SignerListSet,
|
TRANSACTION(ttSIGNER_LIST_SET, 12, SignerListSet,
|
||||||
Delegation::notDelegatable,
|
Delegation::notDelegatable,
|
||||||
uint256{},
|
uint256{},
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfSignerQuorum, soeREQUIRED},
|
{sfSignerQuorum, soeREQUIRED},
|
||||||
{sfSignerEntries, soeOPTIONAL},
|
{sfSignerEntries, soeOPTIONAL},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type creates a new unidirectional XRP payment channel. */
|
/** This transaction type creates a new unidirectional XRP payment channel. */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/PayChan.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttPAYCHAN_CREATE, 13, PaymentChannelCreate,
|
TRANSACTION(ttPAYCHAN_CREATE, 13, PaymentChannelCreate,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
uint256{},
|
uint256{},
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfDestination, soeREQUIRED},
|
{sfDestination, soeREQUIRED},
|
||||||
{sfAmount, soeREQUIRED},
|
{sfAmount, soeREQUIRED},
|
||||||
@@ -218,7 +166,6 @@ TRANSACTION(ttPAYCHAN_CREATE, 13, PaymentChannelCreate,
|
|||||||
TRANSACTION(ttPAYCHAN_FUND, 14, PaymentChannelFund,
|
TRANSACTION(ttPAYCHAN_FUND, 14, PaymentChannelFund,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
uint256{},
|
uint256{},
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfChannel, soeREQUIRED},
|
{sfChannel, soeREQUIRED},
|
||||||
{sfAmount, soeREQUIRED},
|
{sfAmount, soeREQUIRED},
|
||||||
@@ -229,7 +176,6 @@ TRANSACTION(ttPAYCHAN_FUND, 14, PaymentChannelFund,
|
|||||||
TRANSACTION(ttPAYCHAN_CLAIM, 15, PaymentChannelClaim,
|
TRANSACTION(ttPAYCHAN_CLAIM, 15, PaymentChannelClaim,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
uint256{},
|
uint256{},
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfChannel, soeREQUIRED},
|
{sfChannel, soeREQUIRED},
|
||||||
{sfAmount, soeOPTIONAL},
|
{sfAmount, soeOPTIONAL},
|
||||||
@@ -240,13 +186,9 @@ TRANSACTION(ttPAYCHAN_CLAIM, 15, PaymentChannelClaim,
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type creates a new check. */
|
/** This transaction type creates a new check. */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/CreateCheck.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttCHECK_CREATE, 16, CheckCreate,
|
TRANSACTION(ttCHECK_CREATE, 16, CheckCreate,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureChecks,
|
featureChecks,
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfDestination, soeREQUIRED},
|
{sfDestination, soeREQUIRED},
|
||||||
{sfSendMax, soeREQUIRED},
|
{sfSendMax, soeREQUIRED},
|
||||||
@@ -256,13 +198,9 @@ TRANSACTION(ttCHECK_CREATE, 16, CheckCreate,
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type cashes an existing check. */
|
/** This transaction type cashes an existing check. */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/CashCheck.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttCHECK_CASH, 17, CheckCash,
|
TRANSACTION(ttCHECK_CASH, 17, CheckCash,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureChecks,
|
featureChecks,
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfCheckID, soeREQUIRED},
|
{sfCheckID, soeREQUIRED},
|
||||||
{sfAmount, soeOPTIONAL},
|
{sfAmount, soeOPTIONAL},
|
||||||
@@ -270,25 +208,17 @@ TRANSACTION(ttCHECK_CASH, 17, CheckCash,
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type cancels an existing check. */
|
/** This transaction type cancels an existing check. */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/CancelCheck.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttCHECK_CANCEL, 18, CheckCancel,
|
TRANSACTION(ttCHECK_CANCEL, 18, CheckCancel,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureChecks,
|
featureChecks,
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfCheckID, soeREQUIRED},
|
{sfCheckID, soeREQUIRED},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type grants or revokes authorization to transfer funds. */
|
/** This transaction type grants or revokes authorization to transfer funds. */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/DepositPreauth.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttDEPOSIT_PREAUTH, 19, DepositPreauth,
|
TRANSACTION(ttDEPOSIT_PREAUTH, 19, DepositPreauth,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureDepositPreauth,
|
featureDepositPreauth,
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfAuthorize, soeOPTIONAL},
|
{sfAuthorize, soeOPTIONAL},
|
||||||
{sfUnauthorize, soeOPTIONAL},
|
{sfUnauthorize, soeOPTIONAL},
|
||||||
@@ -297,13 +227,9 @@ TRANSACTION(ttDEPOSIT_PREAUTH, 19, DepositPreauth,
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type modifies a trustline between two accounts. */
|
/** This transaction type modifies a trustline between two accounts. */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/SetTrust.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttTRUST_SET, 20, TrustSet,
|
TRANSACTION(ttTRUST_SET, 20, TrustSet,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
uint256{},
|
uint256{},
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfLimitAmount, soeOPTIONAL},
|
{sfLimitAmount, soeOPTIONAL},
|
||||||
{sfQualityIn, soeOPTIONAL},
|
{sfQualityIn, soeOPTIONAL},
|
||||||
@@ -311,13 +237,9 @@ TRANSACTION(ttTRUST_SET, 20, TrustSet,
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type deletes an existing account. */
|
/** This transaction type deletes an existing account. */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/DeleteAccount.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttACCOUNT_DELETE, 21, AccountDelete,
|
TRANSACTION(ttACCOUNT_DELETE, 21, AccountDelete,
|
||||||
Delegation::notDelegatable,
|
Delegation::notDelegatable,
|
||||||
uint256{},
|
uint256{},
|
||||||
mustDeleteAcct,
|
|
||||||
({
|
({
|
||||||
{sfDestination, soeREQUIRED},
|
{sfDestination, soeREQUIRED},
|
||||||
{sfDestinationTag, soeOPTIONAL},
|
{sfDestinationTag, soeOPTIONAL},
|
||||||
@@ -327,13 +249,9 @@ TRANSACTION(ttACCOUNT_DELETE, 21, AccountDelete,
|
|||||||
// 22 reserved
|
// 22 reserved
|
||||||
|
|
||||||
/** This transaction mints a new NFT. */
|
/** This transaction mints a new NFT. */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/NFTokenMint.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttNFTOKEN_MINT, 25, NFTokenMint,
|
TRANSACTION(ttNFTOKEN_MINT, 25, NFTokenMint,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureNonFungibleTokensV1,
|
featureNonFungibleTokensV1,
|
||||||
changeNFTCounts,
|
|
||||||
({
|
({
|
||||||
{sfNFTokenTaxon, soeREQUIRED},
|
{sfNFTokenTaxon, soeREQUIRED},
|
||||||
{sfTransferFee, soeOPTIONAL},
|
{sfTransferFee, soeOPTIONAL},
|
||||||
@@ -345,26 +263,18 @@ TRANSACTION(ttNFTOKEN_MINT, 25, NFTokenMint,
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction burns (i.e. destroys) an existing NFT. */
|
/** This transaction burns (i.e. destroys) an existing NFT. */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/NFTokenBurn.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttNFTOKEN_BURN, 26, NFTokenBurn,
|
TRANSACTION(ttNFTOKEN_BURN, 26, NFTokenBurn,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureNonFungibleTokensV1,
|
featureNonFungibleTokensV1,
|
||||||
changeNFTCounts,
|
|
||||||
({
|
({
|
||||||
{sfNFTokenID, soeREQUIRED},
|
{sfNFTokenID, soeREQUIRED},
|
||||||
{sfOwner, soeOPTIONAL},
|
{sfOwner, soeOPTIONAL},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction creates a new offer to buy or sell an NFT. */
|
/** This transaction creates a new offer to buy or sell an NFT. */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/NFTokenCreateOffer.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttNFTOKEN_CREATE_OFFER, 27, NFTokenCreateOffer,
|
TRANSACTION(ttNFTOKEN_CREATE_OFFER, 27, NFTokenCreateOffer,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureNonFungibleTokensV1,
|
featureNonFungibleTokensV1,
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfNFTokenID, soeREQUIRED},
|
{sfNFTokenID, soeREQUIRED},
|
||||||
{sfAmount, soeREQUIRED},
|
{sfAmount, soeREQUIRED},
|
||||||
@@ -374,25 +284,17 @@ TRANSACTION(ttNFTOKEN_CREATE_OFFER, 27, NFTokenCreateOffer,
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction cancels an existing offer to buy or sell an existing NFT. */
|
/** This transaction cancels an existing offer to buy or sell an existing NFT. */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/NFTokenCancelOffer.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttNFTOKEN_CANCEL_OFFER, 28, NFTokenCancelOffer,
|
TRANSACTION(ttNFTOKEN_CANCEL_OFFER, 28, NFTokenCancelOffer,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureNonFungibleTokensV1,
|
featureNonFungibleTokensV1,
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfNFTokenOffers, soeREQUIRED},
|
{sfNFTokenOffers, soeREQUIRED},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction accepts an existing offer to buy or sell an existing NFT. */
|
/** This transaction accepts an existing offer to buy or sell an existing NFT. */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/NFTokenAcceptOffer.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttNFTOKEN_ACCEPT_OFFER, 29, NFTokenAcceptOffer,
|
TRANSACTION(ttNFTOKEN_ACCEPT_OFFER, 29, NFTokenAcceptOffer,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureNonFungibleTokensV1,
|
featureNonFungibleTokensV1,
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfNFTokenBuyOffer, soeOPTIONAL},
|
{sfNFTokenBuyOffer, soeOPTIONAL},
|
||||||
{sfNFTokenSellOffer, soeOPTIONAL},
|
{sfNFTokenSellOffer, soeOPTIONAL},
|
||||||
@@ -400,26 +302,18 @@ TRANSACTION(ttNFTOKEN_ACCEPT_OFFER, 29, NFTokenAcceptOffer,
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction claws back issued tokens. */
|
/** This transaction claws back issued tokens. */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/Clawback.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttCLAWBACK, 30, Clawback,
|
TRANSACTION(ttCLAWBACK, 30, Clawback,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureClawback,
|
featureClawback,
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfAmount, soeREQUIRED, soeMPTSupported},
|
{sfAmount, soeREQUIRED, soeMPTSupported},
|
||||||
{sfHolder, soeOPTIONAL},
|
{sfHolder, soeOPTIONAL},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction claws back tokens from an AMM pool. */
|
/** This transaction claws back tokens from an AMM pool. */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/AMMClawback.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttAMM_CLAWBACK, 31, AMMClawback,
|
TRANSACTION(ttAMM_CLAWBACK, 31, AMMClawback,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureAMMClawback,
|
featureAMMClawback,
|
||||||
mayDeleteAcct | overrideFreeze,
|
|
||||||
({
|
({
|
||||||
{sfHolder, soeREQUIRED},
|
{sfHolder, soeREQUIRED},
|
||||||
{sfAsset, soeREQUIRED},
|
{sfAsset, soeREQUIRED},
|
||||||
@@ -428,13 +322,9 @@ TRANSACTION(ttAMM_CLAWBACK, 31, AMMClawback,
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type creates an AMM instance */
|
/** This transaction type creates an AMM instance */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/AMMCreate.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttAMM_CREATE, 35, AMMCreate,
|
TRANSACTION(ttAMM_CREATE, 35, AMMCreate,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureAMM,
|
featureAMM,
|
||||||
createPseudoAcct,
|
|
||||||
({
|
({
|
||||||
{sfAmount, soeREQUIRED},
|
{sfAmount, soeREQUIRED},
|
||||||
{sfAmount2, soeREQUIRED},
|
{sfAmount2, soeREQUIRED},
|
||||||
@@ -442,13 +332,9 @@ TRANSACTION(ttAMM_CREATE, 35, AMMCreate,
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type deposits into an AMM instance */
|
/** This transaction type deposits into an AMM instance */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/AMMDeposit.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttAMM_DEPOSIT, 36, AMMDeposit,
|
TRANSACTION(ttAMM_DEPOSIT, 36, AMMDeposit,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureAMM,
|
featureAMM,
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfAsset, soeREQUIRED},
|
{sfAsset, soeREQUIRED},
|
||||||
{sfAsset2, soeREQUIRED},
|
{sfAsset2, soeREQUIRED},
|
||||||
@@ -460,13 +346,9 @@ TRANSACTION(ttAMM_DEPOSIT, 36, AMMDeposit,
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type withdraws from an AMM instance */
|
/** This transaction type withdraws from an AMM instance */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/AMMWithdraw.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttAMM_WITHDRAW, 37, AMMWithdraw,
|
TRANSACTION(ttAMM_WITHDRAW, 37, AMMWithdraw,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureAMM,
|
featureAMM,
|
||||||
mayDeleteAcct,
|
|
||||||
({
|
({
|
||||||
{sfAsset, soeREQUIRED},
|
{sfAsset, soeREQUIRED},
|
||||||
{sfAsset2, soeREQUIRED},
|
{sfAsset2, soeREQUIRED},
|
||||||
@@ -477,13 +359,9 @@ TRANSACTION(ttAMM_WITHDRAW, 37, AMMWithdraw,
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type votes for the trading fee */
|
/** This transaction type votes for the trading fee */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/AMMVote.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttAMM_VOTE, 38, AMMVote,
|
TRANSACTION(ttAMM_VOTE, 38, AMMVote,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureAMM,
|
featureAMM,
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfAsset, soeREQUIRED},
|
{sfAsset, soeREQUIRED},
|
||||||
{sfAsset2, soeREQUIRED},
|
{sfAsset2, soeREQUIRED},
|
||||||
@@ -491,13 +369,9 @@ TRANSACTION(ttAMM_VOTE, 38, AMMVote,
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type bids for the auction slot */
|
/** This transaction type bids for the auction slot */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/AMMBid.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttAMM_BID, 39, AMMBid,
|
TRANSACTION(ttAMM_BID, 39, AMMBid,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureAMM,
|
featureAMM,
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfAsset, soeREQUIRED},
|
{sfAsset, soeREQUIRED},
|
||||||
{sfAsset2, soeREQUIRED},
|
{sfAsset2, soeREQUIRED},
|
||||||
@@ -507,26 +381,18 @@ TRANSACTION(ttAMM_BID, 39, AMMBid,
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type deletes AMM in the empty state */
|
/** This transaction type deletes AMM in the empty state */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/AMMDelete.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttAMM_DELETE, 40, AMMDelete,
|
TRANSACTION(ttAMM_DELETE, 40, AMMDelete,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureAMM,
|
featureAMM,
|
||||||
mustDeleteAcct,
|
|
||||||
({
|
({
|
||||||
{sfAsset, soeREQUIRED},
|
{sfAsset, soeREQUIRED},
|
||||||
{sfAsset2, soeREQUIRED},
|
{sfAsset2, soeREQUIRED},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transactions creates a crosschain sequence number */
|
/** This transactions creates a crosschain sequence number */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/XChainBridge.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttXCHAIN_CREATE_CLAIM_ID, 41, XChainCreateClaimID,
|
TRANSACTION(ttXCHAIN_CREATE_CLAIM_ID, 41, XChainCreateClaimID,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureXChainBridge,
|
featureXChainBridge,
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfXChainBridge, soeREQUIRED},
|
{sfXChainBridge, soeREQUIRED},
|
||||||
{sfSignatureReward, soeREQUIRED},
|
{sfSignatureReward, soeREQUIRED},
|
||||||
@@ -537,7 +403,6 @@ TRANSACTION(ttXCHAIN_CREATE_CLAIM_ID, 41, XChainCreateClaimID,
|
|||||||
TRANSACTION(ttXCHAIN_COMMIT, 42, XChainCommit,
|
TRANSACTION(ttXCHAIN_COMMIT, 42, XChainCommit,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureXChainBridge,
|
featureXChainBridge,
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfXChainBridge, soeREQUIRED},
|
{sfXChainBridge, soeREQUIRED},
|
||||||
{sfXChainClaimID, soeREQUIRED},
|
{sfXChainClaimID, soeREQUIRED},
|
||||||
@@ -549,7 +414,6 @@ TRANSACTION(ttXCHAIN_COMMIT, 42, XChainCommit,
|
|||||||
TRANSACTION(ttXCHAIN_CLAIM, 43, XChainClaim,
|
TRANSACTION(ttXCHAIN_CLAIM, 43, XChainClaim,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureXChainBridge,
|
featureXChainBridge,
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfXChainBridge, soeREQUIRED},
|
{sfXChainBridge, soeREQUIRED},
|
||||||
{sfXChainClaimID, soeREQUIRED},
|
{sfXChainClaimID, soeREQUIRED},
|
||||||
@@ -562,7 +426,6 @@ TRANSACTION(ttXCHAIN_CLAIM, 43, XChainClaim,
|
|||||||
TRANSACTION(ttXCHAIN_ACCOUNT_CREATE_COMMIT, 44, XChainAccountCreateCommit,
|
TRANSACTION(ttXCHAIN_ACCOUNT_CREATE_COMMIT, 44, XChainAccountCreateCommit,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureXChainBridge,
|
featureXChainBridge,
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfXChainBridge, soeREQUIRED},
|
{sfXChainBridge, soeREQUIRED},
|
||||||
{sfDestination, soeREQUIRED},
|
{sfDestination, soeREQUIRED},
|
||||||
@@ -574,7 +437,6 @@ TRANSACTION(ttXCHAIN_ACCOUNT_CREATE_COMMIT, 44, XChainAccountCreateCommit,
|
|||||||
TRANSACTION(ttXCHAIN_ADD_CLAIM_ATTESTATION, 45, XChainAddClaimAttestation,
|
TRANSACTION(ttXCHAIN_ADD_CLAIM_ATTESTATION, 45, XChainAddClaimAttestation,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureXChainBridge,
|
featureXChainBridge,
|
||||||
createAcct,
|
|
||||||
({
|
({
|
||||||
{sfXChainBridge, soeREQUIRED},
|
{sfXChainBridge, soeREQUIRED},
|
||||||
|
|
||||||
@@ -591,11 +453,9 @@ TRANSACTION(ttXCHAIN_ADD_CLAIM_ATTESTATION, 45, XChainAddClaimAttestation,
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction adds an attestation to an account */
|
/** This transaction adds an attestation to an account */
|
||||||
TRANSACTION(ttXCHAIN_ADD_ACCOUNT_CREATE_ATTESTATION, 46,
|
TRANSACTION(ttXCHAIN_ADD_ACCOUNT_CREATE_ATTESTATION, 46, XChainAddAccountCreateAttestation,
|
||||||
XChainAddAccountCreateAttestation,
|
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureXChainBridge,
|
featureXChainBridge,
|
||||||
createAcct,
|
|
||||||
({
|
({
|
||||||
{sfXChainBridge, soeREQUIRED},
|
{sfXChainBridge, soeREQUIRED},
|
||||||
|
|
||||||
@@ -616,7 +476,6 @@ TRANSACTION(ttXCHAIN_ADD_ACCOUNT_CREATE_ATTESTATION, 46,
|
|||||||
TRANSACTION(ttXCHAIN_MODIFY_BRIDGE, 47, XChainModifyBridge,
|
TRANSACTION(ttXCHAIN_MODIFY_BRIDGE, 47, XChainModifyBridge,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureXChainBridge,
|
featureXChainBridge,
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfXChainBridge, soeREQUIRED},
|
{sfXChainBridge, soeREQUIRED},
|
||||||
{sfSignatureReward, soeOPTIONAL},
|
{sfSignatureReward, soeOPTIONAL},
|
||||||
@@ -627,7 +486,6 @@ TRANSACTION(ttXCHAIN_MODIFY_BRIDGE, 47, XChainModifyBridge,
|
|||||||
TRANSACTION(ttXCHAIN_CREATE_BRIDGE, 48, XChainCreateBridge,
|
TRANSACTION(ttXCHAIN_CREATE_BRIDGE, 48, XChainCreateBridge,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureXChainBridge,
|
featureXChainBridge,
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfXChainBridge, soeREQUIRED},
|
{sfXChainBridge, soeREQUIRED},
|
||||||
{sfSignatureReward, soeREQUIRED},
|
{sfSignatureReward, soeREQUIRED},
|
||||||
@@ -635,13 +493,9 @@ TRANSACTION(ttXCHAIN_CREATE_BRIDGE, 48, XChainCreateBridge,
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type creates or updates a DID */
|
/** This transaction type creates or updates a DID */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/DID.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttDID_SET, 49, DIDSet,
|
TRANSACTION(ttDID_SET, 49, DIDSet,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureDID,
|
featureDID,
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfDIDDocument, soeOPTIONAL},
|
{sfDIDDocument, soeOPTIONAL},
|
||||||
{sfURI, soeOPTIONAL},
|
{sfURI, soeOPTIONAL},
|
||||||
@@ -652,17 +506,12 @@ TRANSACTION(ttDID_SET, 49, DIDSet,
|
|||||||
TRANSACTION(ttDID_DELETE, 50, DIDDelete,
|
TRANSACTION(ttDID_DELETE, 50, DIDDelete,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureDID,
|
featureDID,
|
||||||
noPriv,
|
|
||||||
({}))
|
({}))
|
||||||
|
|
||||||
/** This transaction type creates an Oracle instance */
|
/** This transaction type creates an Oracle instance */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/SetOracle.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttORACLE_SET, 51, OracleSet,
|
TRANSACTION(ttORACLE_SET, 51, OracleSet,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featurePriceOracle,
|
featurePriceOracle,
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfOracleDocumentID, soeREQUIRED},
|
{sfOracleDocumentID, soeREQUIRED},
|
||||||
{sfProvider, soeOPTIONAL},
|
{sfProvider, soeOPTIONAL},
|
||||||
@@ -673,97 +522,65 @@ TRANSACTION(ttORACLE_SET, 51, OracleSet,
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type deletes an Oracle instance */
|
/** This transaction type deletes an Oracle instance */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/DeleteOracle.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttORACLE_DELETE, 52, OracleDelete,
|
TRANSACTION(ttORACLE_DELETE, 52, OracleDelete,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featurePriceOracle,
|
featurePriceOracle,
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfOracleDocumentID, soeREQUIRED},
|
{sfOracleDocumentID, soeREQUIRED},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type fixes a problem in the ledger state */
|
/** This transaction type fixes a problem in the ledger state */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/LedgerStateFix.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttLEDGER_STATE_FIX, 53, LedgerStateFix,
|
TRANSACTION(ttLEDGER_STATE_FIX, 53, LedgerStateFix,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
fixNFTokenPageLinks,
|
fixNFTokenPageLinks,
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfLedgerFixType, soeREQUIRED},
|
{sfLedgerFixType, soeREQUIRED},
|
||||||
{sfOwner, soeOPTIONAL},
|
{sfOwner, soeOPTIONAL},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type creates a MPTokensIssuance instance */
|
/** This transaction type creates a MPTokensIssuance instance */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/MPTokenIssuanceCreate.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttMPTOKEN_ISSUANCE_CREATE, 54, MPTokenIssuanceCreate,
|
TRANSACTION(ttMPTOKEN_ISSUANCE_CREATE, 54, MPTokenIssuanceCreate,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureMPTokensV1,
|
featureMPTokensV1,
|
||||||
createMPTIssuance,
|
|
||||||
({
|
({
|
||||||
{sfAssetScale, soeOPTIONAL},
|
{sfAssetScale, soeOPTIONAL},
|
||||||
{sfTransferFee, soeOPTIONAL},
|
{sfTransferFee, soeOPTIONAL},
|
||||||
{sfMaximumAmount, soeOPTIONAL},
|
{sfMaximumAmount, soeOPTIONAL},
|
||||||
{sfMPTokenMetadata, soeOPTIONAL},
|
{sfMPTokenMetadata, soeOPTIONAL},
|
||||||
{sfDomainID, soeOPTIONAL},
|
{sfDomainID, soeOPTIONAL},
|
||||||
{sfMutableFlags, soeOPTIONAL},
|
|
||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type destroys a MPTokensIssuance instance */
|
/** This transaction type destroys a MPTokensIssuance instance */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/MPTokenIssuanceDestroy.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttMPTOKEN_ISSUANCE_DESTROY, 55, MPTokenIssuanceDestroy,
|
TRANSACTION(ttMPTOKEN_ISSUANCE_DESTROY, 55, MPTokenIssuanceDestroy,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureMPTokensV1,
|
featureMPTokensV1,
|
||||||
destroyMPTIssuance,
|
|
||||||
({
|
({
|
||||||
{sfMPTokenIssuanceID, soeREQUIRED},
|
{sfMPTokenIssuanceID, soeREQUIRED},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type sets flags on a MPTokensIssuance or MPToken instance */
|
/** This transaction type sets flags on a MPTokensIssuance or MPToken instance */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/MPTokenIssuanceSet.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttMPTOKEN_ISSUANCE_SET, 56, MPTokenIssuanceSet,
|
TRANSACTION(ttMPTOKEN_ISSUANCE_SET, 56, MPTokenIssuanceSet,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureMPTokensV1,
|
featureMPTokensV1,
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfMPTokenIssuanceID, soeREQUIRED},
|
{sfMPTokenIssuanceID, soeREQUIRED},
|
||||||
{sfHolder, soeOPTIONAL},
|
{sfHolder, soeOPTIONAL},
|
||||||
{sfDomainID, soeOPTIONAL},
|
{sfDomainID, soeOPTIONAL},
|
||||||
{sfMPTokenMetadata, soeOPTIONAL},
|
|
||||||
{sfTransferFee, soeOPTIONAL},
|
|
||||||
{sfMutableFlags, soeOPTIONAL},
|
|
||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type authorizes a MPToken instance */
|
/** This transaction type authorizes a MPToken instance */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/MPTokenAuthorize.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttMPTOKEN_AUTHORIZE, 57, MPTokenAuthorize,
|
TRANSACTION(ttMPTOKEN_AUTHORIZE, 57, MPTokenAuthorize,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureMPTokensV1,
|
featureMPTokensV1,
|
||||||
mustAuthorizeMPT,
|
|
||||||
({
|
({
|
||||||
{sfMPTokenIssuanceID, soeREQUIRED},
|
{sfMPTokenIssuanceID, soeREQUIRED},
|
||||||
{sfHolder, soeOPTIONAL},
|
{sfHolder, soeOPTIONAL},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type create an Credential instance */
|
/** This transaction type create an Credential instance */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/Credentials.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttCREDENTIAL_CREATE, 58, CredentialCreate,
|
TRANSACTION(ttCREDENTIAL_CREATE, 58, CredentialCreate,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureCredentials,
|
featureCredentials,
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfSubject, soeREQUIRED},
|
{sfSubject, soeREQUIRED},
|
||||||
{sfCredentialType, soeREQUIRED},
|
{sfCredentialType, soeREQUIRED},
|
||||||
@@ -775,7 +592,6 @@ TRANSACTION(ttCREDENTIAL_CREATE, 58, CredentialCreate,
|
|||||||
TRANSACTION(ttCREDENTIAL_ACCEPT, 59, CredentialAccept,
|
TRANSACTION(ttCREDENTIAL_ACCEPT, 59, CredentialAccept,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureCredentials,
|
featureCredentials,
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfIssuer, soeREQUIRED},
|
{sfIssuer, soeREQUIRED},
|
||||||
{sfCredentialType, soeREQUIRED},
|
{sfCredentialType, soeREQUIRED},
|
||||||
@@ -785,7 +601,6 @@ TRANSACTION(ttCREDENTIAL_ACCEPT, 59, CredentialAccept,
|
|||||||
TRANSACTION(ttCREDENTIAL_DELETE, 60, CredentialDelete,
|
TRANSACTION(ttCREDENTIAL_DELETE, 60, CredentialDelete,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureCredentials,
|
featureCredentials,
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfSubject, soeOPTIONAL},
|
{sfSubject, soeOPTIONAL},
|
||||||
{sfIssuer, soeOPTIONAL},
|
{sfIssuer, soeOPTIONAL},
|
||||||
@@ -793,13 +608,9 @@ TRANSACTION(ttCREDENTIAL_DELETE, 60, CredentialDelete,
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type modify a NFToken */
|
/** This transaction type modify a NFToken */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/NFTokenModify.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttNFTOKEN_MODIFY, 61, NFTokenModify,
|
TRANSACTION(ttNFTOKEN_MODIFY, 61, NFTokenModify,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureDynamicNFT,
|
featureDynamicNFT,
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfNFTokenID, soeREQUIRED},
|
{sfNFTokenID, soeREQUIRED},
|
||||||
{sfOwner, soeOPTIONAL},
|
{sfOwner, soeOPTIONAL},
|
||||||
@@ -807,51 +618,35 @@ TRANSACTION(ttNFTOKEN_MODIFY, 61, NFTokenModify,
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type creates or modifies a Permissioned Domain */
|
/** This transaction type creates or modifies a Permissioned Domain */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/PermissionedDomainSet.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttPERMISSIONED_DOMAIN_SET, 62, PermissionedDomainSet,
|
TRANSACTION(ttPERMISSIONED_DOMAIN_SET, 62, PermissionedDomainSet,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featurePermissionedDomains,
|
featurePermissionedDomains,
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfDomainID, soeOPTIONAL},
|
{sfDomainID, soeOPTIONAL},
|
||||||
{sfAcceptedCredentials, soeREQUIRED},
|
{sfAcceptedCredentials, soeREQUIRED},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type deletes a Permissioned Domain */
|
/** This transaction type deletes a Permissioned Domain */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/PermissionedDomainDelete.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttPERMISSIONED_DOMAIN_DELETE, 63, PermissionedDomainDelete,
|
TRANSACTION(ttPERMISSIONED_DOMAIN_DELETE, 63, PermissionedDomainDelete,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featurePermissionedDomains,
|
featurePermissionedDomains,
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfDomainID, soeREQUIRED},
|
{sfDomainID, soeREQUIRED},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type delegates authorized account specified permissions */
|
/** This transaction type delegates authorized account specified permissions */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/DelegateSet.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttDELEGATE_SET, 64, DelegateSet,
|
TRANSACTION(ttDELEGATE_SET, 64, DelegateSet,
|
||||||
Delegation::notDelegatable,
|
Delegation::notDelegatable,
|
||||||
featurePermissionDelegation,
|
featurePermissionDelegation,
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfAuthorize, soeREQUIRED},
|
{sfAuthorize, soeREQUIRED},
|
||||||
{sfPermissions, soeREQUIRED},
|
{sfPermissions, soeREQUIRED},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction creates a single asset vault. */
|
/** This transaction creates a single asset vault. */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/VaultCreate.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttVAULT_CREATE, 65, VaultCreate,
|
TRANSACTION(ttVAULT_CREATE, 65, VaultCreate,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureSingleAssetVault,
|
featureSingleAssetVault,
|
||||||
createPseudoAcct | createMPTIssuance | mustModifyVault,
|
|
||||||
({
|
({
|
||||||
{sfAsset, soeREQUIRED, soeMPTSupported},
|
{sfAsset, soeREQUIRED, soeMPTSupported},
|
||||||
{sfAssetsMaximum, soeOPTIONAL},
|
{sfAssetsMaximum, soeOPTIONAL},
|
||||||
@@ -863,13 +658,9 @@ TRANSACTION(ttVAULT_CREATE, 65, VaultCreate,
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction updates a single asset vault. */
|
/** This transaction updates a single asset vault. */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/VaultSet.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttVAULT_SET, 66, VaultSet,
|
TRANSACTION(ttVAULT_SET, 66, VaultSet,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureSingleAssetVault,
|
featureSingleAssetVault,
|
||||||
mustModifyVault,
|
|
||||||
({
|
({
|
||||||
{sfVaultID, soeREQUIRED},
|
{sfVaultID, soeREQUIRED},
|
||||||
{sfAssetsMaximum, soeOPTIONAL},
|
{sfAssetsMaximum, soeOPTIONAL},
|
||||||
@@ -878,38 +669,26 @@ TRANSACTION(ttVAULT_SET, 66, VaultSet,
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction deletes a single asset vault. */
|
/** This transaction deletes a single asset vault. */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/VaultDelete.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttVAULT_DELETE, 67, VaultDelete,
|
TRANSACTION(ttVAULT_DELETE, 67, VaultDelete,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureSingleAssetVault,
|
featureSingleAssetVault,
|
||||||
mustDeleteAcct | destroyMPTIssuance | mustModifyVault,
|
|
||||||
({
|
({
|
||||||
{sfVaultID, soeREQUIRED},
|
{sfVaultID, soeREQUIRED},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction trades assets for shares with a vault. */
|
/** This transaction trades assets for shares with a vault. */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/VaultDeposit.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttVAULT_DEPOSIT, 68, VaultDeposit,
|
TRANSACTION(ttVAULT_DEPOSIT, 68, VaultDeposit,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureSingleAssetVault,
|
featureSingleAssetVault,
|
||||||
mayAuthorizeMPT | mustModifyVault,
|
|
||||||
({
|
({
|
||||||
{sfVaultID, soeREQUIRED},
|
{sfVaultID, soeREQUIRED},
|
||||||
{sfAmount, soeREQUIRED, soeMPTSupported},
|
{sfAmount, soeREQUIRED, soeMPTSupported},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction trades shares for assets with a vault. */
|
/** This transaction trades shares for assets with a vault. */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/VaultWithdraw.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttVAULT_WITHDRAW, 69, VaultWithdraw,
|
TRANSACTION(ttVAULT_WITHDRAW, 69, VaultWithdraw,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureSingleAssetVault,
|
featureSingleAssetVault,
|
||||||
mayDeleteMPT | mayAuthorizeMPT | mustModifyVault,
|
|
||||||
({
|
({
|
||||||
{sfVaultID, soeREQUIRED},
|
{sfVaultID, soeREQUIRED},
|
||||||
{sfAmount, soeREQUIRED, soeMPTSupported},
|
{sfAmount, soeREQUIRED, soeMPTSupported},
|
||||||
@@ -918,13 +697,9 @@ TRANSACTION(ttVAULT_WITHDRAW, 69, VaultWithdraw,
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction claws back tokens from a vault. */
|
/** This transaction claws back tokens from a vault. */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/VaultClawback.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttVAULT_CLAWBACK, 70, VaultClawback,
|
TRANSACTION(ttVAULT_CLAWBACK, 70, VaultClawback,
|
||||||
Delegation::delegatable,
|
Delegation::delegatable,
|
||||||
featureSingleAssetVault,
|
featureSingleAssetVault,
|
||||||
mayDeleteMPT | mustModifyVault,
|
|
||||||
({
|
({
|
||||||
{sfVaultID, soeREQUIRED},
|
{sfVaultID, soeREQUIRED},
|
||||||
{sfHolder, soeREQUIRED},
|
{sfHolder, soeREQUIRED},
|
||||||
@@ -932,13 +707,9 @@ TRANSACTION(ttVAULT_CLAWBACK, 70, VaultClawback,
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
/** This transaction type batches together transactions. */
|
/** This transaction type batches together transactions. */
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/Batch.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttBATCH, 71, Batch,
|
TRANSACTION(ttBATCH, 71, Batch,
|
||||||
Delegation::notDelegatable,
|
Delegation::notDelegatable,
|
||||||
featureBatch,
|
featureBatch,
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfRawTransactions, soeREQUIRED},
|
{sfRawTransactions, soeREQUIRED},
|
||||||
{sfBatchSigners, soeOPTIONAL},
|
{sfBatchSigners, soeOPTIONAL},
|
||||||
@@ -948,13 +719,9 @@ TRANSACTION(ttBATCH, 71, Batch,
|
|||||||
|
|
||||||
For details, see: https://xrpl.org/amendments.html
|
For details, see: https://xrpl.org/amendments.html
|
||||||
*/
|
*/
|
||||||
#if TRANSACTION_INCLUDE
|
|
||||||
# include <xrpld/app/tx/detail/Change.h>
|
|
||||||
#endif
|
|
||||||
TRANSACTION(ttAMENDMENT, 100, EnableAmendment,
|
TRANSACTION(ttAMENDMENT, 100, EnableAmendment,
|
||||||
Delegation::notDelegatable,
|
Delegation::notDelegatable,
|
||||||
uint256{},
|
uint256{},
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfLedgerSequence, soeREQUIRED},
|
{sfLedgerSequence, soeREQUIRED},
|
||||||
{sfAmendment, soeREQUIRED},
|
{sfAmendment, soeREQUIRED},
|
||||||
@@ -966,7 +733,6 @@ TRANSACTION(ttAMENDMENT, 100, EnableAmendment,
|
|||||||
TRANSACTION(ttFEE, 101, SetFee,
|
TRANSACTION(ttFEE, 101, SetFee,
|
||||||
Delegation::notDelegatable,
|
Delegation::notDelegatable,
|
||||||
uint256{},
|
uint256{},
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfLedgerSequence, soeOPTIONAL},
|
{sfLedgerSequence, soeOPTIONAL},
|
||||||
// Old version uses raw numbers
|
// Old version uses raw numbers
|
||||||
@@ -987,7 +753,6 @@ TRANSACTION(ttFEE, 101, SetFee,
|
|||||||
TRANSACTION(ttUNL_MODIFY, 102, UNLModify,
|
TRANSACTION(ttUNL_MODIFY, 102, UNLModify,
|
||||||
Delegation::notDelegatable,
|
Delegation::notDelegatable,
|
||||||
uint256{},
|
uint256{},
|
||||||
noPriv,
|
|
||||||
({
|
({
|
||||||
{sfUNLModifyDisabling, soeREQUIRED},
|
{sfUNLModifyDisabling, soeREQUIRED},
|
||||||
{sfLedgerSequence, soeREQUIRED},
|
{sfLedgerSequence, soeREQUIRED},
|
||||||
|
|||||||
@@ -722,11 +722,11 @@ JSS(write_load); // out: GetCounts
|
|||||||
#pragma push_macro("LEDGER_ENTRY_DUPLICATE")
|
#pragma push_macro("LEDGER_ENTRY_DUPLICATE")
|
||||||
#undef LEDGER_ENTRY_DUPLICATE
|
#undef LEDGER_ENTRY_DUPLICATE
|
||||||
|
|
||||||
#define LEDGER_ENTRY(tag, value, name, rpcName, ...) \
|
#define LEDGER_ENTRY(tag, value, name, rpcName, fields) \
|
||||||
JSS(name); \
|
JSS(name); \
|
||||||
JSS(rpcName);
|
JSS(rpcName);
|
||||||
|
|
||||||
#define LEDGER_ENTRY_DUPLICATE(tag, value, name, rpcName, ...) JSS(rpcName);
|
#define LEDGER_ENTRY_DUPLICATE(tag, value, name, rpcName, fields) JSS(rpcName);
|
||||||
|
|
||||||
#include <xrpl/protocol/detail/ledger_entries.macro>
|
#include <xrpl/protocol/detail/ledger_entries.macro>
|
||||||
|
|
||||||
|
|||||||
@@ -436,12 +436,10 @@ public:
|
|||||||
admin_.erase(admin_.iterator_to(entry));
|
admin_.erase(admin_.iterator_to(entry));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// LCOV_EXCL_START
|
|
||||||
UNREACHABLE(
|
UNREACHABLE(
|
||||||
"ripple::Resource::Logic::release : invalid entry "
|
"ripple::Resource::Logic::release : invalid entry "
|
||||||
"kind");
|
"kind");
|
||||||
break;
|
break;
|
||||||
// LCOV_EXCL_STOP
|
|
||||||
}
|
}
|
||||||
inactive_.push_back(entry);
|
inactive_.push_back(entry);
|
||||||
entry.whenExpires = m_clock.now() + secondsUntilExpiration;
|
entry.whenExpires = m_clock.now() + secondsUntilExpiration;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
#include <xrpl/server/Port.h>
|
#include <xrpl/server/Port.h>
|
||||||
#include <xrpl/server/detail/ServerImpl.h>
|
#include <xrpl/server/detail/ServerImpl.h>
|
||||||
|
|
||||||
#include <boost/asio/io_service.hpp>
|
#include <boost/asio/io_context.hpp>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
@@ -34,10 +34,10 @@ template <class Handler>
|
|||||||
std::unique_ptr<Server>
|
std::unique_ptr<Server>
|
||||||
make_Server(
|
make_Server(
|
||||||
Handler& handler,
|
Handler& handler,
|
||||||
boost::asio::io_service& io_service,
|
boost::asio::io_context& io_context,
|
||||||
beast::Journal journal)
|
beast::Journal journal)
|
||||||
{
|
{
|
||||||
return std::make_unique<ServerImpl<Handler>>(handler, io_service, journal);
|
return std::make_unique<ServerImpl<Handler>>(handler, io_context, journal);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ripple
|
} // namespace ripple
|
||||||
|
|||||||
@@ -88,9 +88,7 @@ public:
|
|||||||
++iter)
|
++iter)
|
||||||
{
|
{
|
||||||
typename BufferSequence::value_type const& buffer(*iter);
|
typename BufferSequence::value_type const& buffer(*iter);
|
||||||
write(
|
write(buffer.data(), boost::asio::buffer_size(buffer));
|
||||||
boost::asio::buffer_cast<void const*>(buffer),
|
|
||||||
boost::asio::buffer_size(buffer));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,7 +102,7 @@ public:
|
|||||||
|
|
||||||
/** Detach the session.
|
/** Detach the session.
|
||||||
This holds the session open so that the response can be sent
|
This holds the session open so that the response can be sent
|
||||||
asynchronously. Calls to io_service::run made by the server
|
asynchronously. Calls to io_context::run made by the server
|
||||||
will not return until all detached sessions are closed.
|
will not return until all detached sessions are closed.
|
||||||
*/
|
*/
|
||||||
virtual std::shared_ptr<Session>
|
virtual std::shared_ptr<Session>
|
||||||
|
|||||||
@@ -24,11 +24,13 @@
|
|||||||
#include <xrpl/beast/net/IPAddressConversion.h>
|
#include <xrpl/beast/net/IPAddressConversion.h>
|
||||||
#include <xrpl/beast/utility/instrumentation.h>
|
#include <xrpl/beast/utility/instrumentation.h>
|
||||||
#include <xrpl/server/Session.h>
|
#include <xrpl/server/Session.h>
|
||||||
|
#include <xrpl/server/detail/Spawn.h>
|
||||||
#include <xrpl/server/detail/io_list.h>
|
#include <xrpl/server/detail/io_list.h>
|
||||||
|
|
||||||
#include <boost/asio/ip/tcp.hpp>
|
#include <boost/asio/ip/tcp.hpp>
|
||||||
#include <boost/asio/spawn.hpp>
|
#include <boost/asio/spawn.hpp>
|
||||||
#include <boost/asio/ssl/stream.hpp>
|
#include <boost/asio/ssl/stream.hpp>
|
||||||
|
#include <boost/asio/strand.hpp>
|
||||||
#include <boost/asio/streambuf.hpp>
|
#include <boost/asio/streambuf.hpp>
|
||||||
#include <boost/beast/core/stream_traits.hpp>
|
#include <boost/beast/core/stream_traits.hpp>
|
||||||
#include <boost/beast/http/dynamic_body.hpp>
|
#include <boost/beast/http/dynamic_body.hpp>
|
||||||
@@ -215,8 +217,8 @@ BaseHTTPPeer<Handler, Impl>::BaseHTTPPeer(
|
|||||||
ConstBufferSequence const& buffers)
|
ConstBufferSequence const& buffers)
|
||||||
: port_(port)
|
: port_(port)
|
||||||
, handler_(handler)
|
, handler_(handler)
|
||||||
, work_(executor)
|
, work_(boost::asio::make_work_guard(executor))
|
||||||
, strand_(executor)
|
, strand_(boost::asio::make_strand(executor))
|
||||||
, remote_address_(remote_address)
|
, remote_address_(remote_address)
|
||||||
, journal_(journal)
|
, journal_(journal)
|
||||||
{
|
{
|
||||||
@@ -356,7 +358,7 @@ BaseHTTPPeer<Handler, Impl>::on_write(
|
|||||||
return;
|
return;
|
||||||
if (graceful_)
|
if (graceful_)
|
||||||
return do_close();
|
return do_close();
|
||||||
boost::asio::spawn(
|
util::spawn(
|
||||||
strand_,
|
strand_,
|
||||||
std::bind(
|
std::bind(
|
||||||
&BaseHTTPPeer<Handler, Impl>::do_read,
|
&BaseHTTPPeer<Handler, Impl>::do_read,
|
||||||
@@ -375,7 +377,7 @@ BaseHTTPPeer<Handler, Impl>::do_writer(
|
|||||||
{
|
{
|
||||||
auto const p = impl().shared_from_this();
|
auto const p = impl().shared_from_this();
|
||||||
resume = std::function<void(void)>([this, p, writer, keep_alive]() {
|
resume = std::function<void(void)>([this, p, writer, keep_alive]() {
|
||||||
boost::asio::spawn(
|
util::spawn(
|
||||||
strand_,
|
strand_,
|
||||||
std::bind(
|
std::bind(
|
||||||
&BaseHTTPPeer<Handler, Impl>::do_writer,
|
&BaseHTTPPeer<Handler, Impl>::do_writer,
|
||||||
@@ -406,7 +408,7 @@ BaseHTTPPeer<Handler, Impl>::do_writer(
|
|||||||
if (!keep_alive)
|
if (!keep_alive)
|
||||||
return do_close();
|
return do_close();
|
||||||
|
|
||||||
boost::asio::spawn(
|
util::spawn(
|
||||||
strand_,
|
strand_,
|
||||||
std::bind(
|
std::bind(
|
||||||
&BaseHTTPPeer<Handler, Impl>::do_read,
|
&BaseHTTPPeer<Handler, Impl>::do_read,
|
||||||
@@ -448,14 +450,14 @@ BaseHTTPPeer<Handler, Impl>::write(
|
|||||||
std::shared_ptr<Writer> const& writer,
|
std::shared_ptr<Writer> const& writer,
|
||||||
bool keep_alive)
|
bool keep_alive)
|
||||||
{
|
{
|
||||||
boost::asio::spawn(bind_executor(
|
util::spawn(
|
||||||
strand_,
|
strand_,
|
||||||
std::bind(
|
std::bind(
|
||||||
&BaseHTTPPeer<Handler, Impl>::do_writer,
|
&BaseHTTPPeer<Handler, Impl>::do_writer,
|
||||||
impl().shared_from_this(),
|
impl().shared_from_this(),
|
||||||
writer,
|
writer,
|
||||||
keep_alive,
|
keep_alive,
|
||||||
std::placeholders::_1)));
|
std::placeholders::_1));
|
||||||
}
|
}
|
||||||
|
|
||||||
// DEPRECATED
|
// DEPRECATED
|
||||||
@@ -490,12 +492,12 @@ BaseHTTPPeer<Handler, Impl>::complete()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// keep-alive
|
// keep-alive
|
||||||
boost::asio::spawn(bind_executor(
|
util::spawn(
|
||||||
strand_,
|
strand_,
|
||||||
std::bind(
|
std::bind(
|
||||||
&BaseHTTPPeer<Handler, Impl>::do_read,
|
&BaseHTTPPeer<Handler, Impl>::do_read,
|
||||||
impl().shared_from_this(),
|
impl().shared_from_this(),
|
||||||
std::placeholders::_1)));
|
std::placeholders::_1));
|
||||||
}
|
}
|
||||||
|
|
||||||
// DEPRECATED
|
// DEPRECATED
|
||||||
|
|||||||
@@ -91,8 +91,8 @@ BasePeer<Handler, Impl>::BasePeer(
|
|||||||
return "##" + std::to_string(++id) + " ";
|
return "##" + std::to_string(++id) + " ";
|
||||||
}())
|
}())
|
||||||
, j_(sink_)
|
, j_(sink_)
|
||||||
, work_(executor)
|
, work_(boost::asio::make_work_guard(executor))
|
||||||
, strand_(executor)
|
, strand_(boost::asio::make_strand(executor))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
#include <xrpl/server/detail/BasePeer.h>
|
#include <xrpl/server/detail/BasePeer.h>
|
||||||
#include <xrpl/server/detail/LowestLayer.h>
|
#include <xrpl/server/detail/LowestLayer.h>
|
||||||
|
|
||||||
|
#include <boost/asio/error.hpp>
|
||||||
#include <boost/beast/core/multi_buffer.hpp>
|
#include <boost/beast/core/multi_buffer.hpp>
|
||||||
#include <boost/beast/http/message.hpp>
|
#include <boost/beast/http/message.hpp>
|
||||||
#include <boost/beast/websocket.hpp>
|
#include <boost/beast/websocket.hpp>
|
||||||
@@ -420,11 +421,17 @@ BaseWSPeer<Handler, Impl>::start_timer()
|
|||||||
// Max seconds without completing a message
|
// Max seconds without completing a message
|
||||||
static constexpr std::chrono::seconds timeout{30};
|
static constexpr std::chrono::seconds timeout{30};
|
||||||
static constexpr std::chrono::seconds timeoutLocal{3};
|
static constexpr std::chrono::seconds timeoutLocal{3};
|
||||||
error_code ec;
|
|
||||||
timer_.expires_from_now(
|
try
|
||||||
remote_endpoint().address().is_loopback() ? timeoutLocal : timeout, ec);
|
{
|
||||||
if (ec)
|
timer_.expires_after(
|
||||||
return fail(ec, "start_timer");
|
remote_endpoint().address().is_loopback() ? timeoutLocal : timeout);
|
||||||
|
}
|
||||||
|
catch (boost::system::system_error const& e)
|
||||||
|
{
|
||||||
|
return fail(e.code(), "start_timer");
|
||||||
|
}
|
||||||
|
|
||||||
timer_.async_wait(bind_executor(
|
timer_.async_wait(bind_executor(
|
||||||
strand_,
|
strand_,
|
||||||
std::bind(
|
std::bind(
|
||||||
@@ -438,8 +445,14 @@ template <class Handler, class Impl>
|
|||||||
void
|
void
|
||||||
BaseWSPeer<Handler, Impl>::cancel_timer()
|
BaseWSPeer<Handler, Impl>::cancel_timer()
|
||||||
{
|
{
|
||||||
error_code ec;
|
try
|
||||||
timer_.cancel(ec);
|
{
|
||||||
|
timer_.cancel();
|
||||||
|
}
|
||||||
|
catch (boost::system::system_error const&)
|
||||||
|
{
|
||||||
|
// ignored
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Handler, class Impl>
|
template <class Handler, class Impl>
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ private:
|
|||||||
stream_type stream_;
|
stream_type stream_;
|
||||||
socket_type& socket_;
|
socket_type& socket_;
|
||||||
endpoint_type remote_address_;
|
endpoint_type remote_address_;
|
||||||
boost::asio::io_context::strand strand_;
|
boost::asio::strand<boost::asio::io_context::executor_type> strand_;
|
||||||
beast::Journal const j_;
|
beast::Journal const j_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -95,7 +95,7 @@ private:
|
|||||||
Handler& handler_;
|
Handler& handler_;
|
||||||
boost::asio::io_context& ioc_;
|
boost::asio::io_context& ioc_;
|
||||||
acceptor_type acceptor_;
|
acceptor_type acceptor_;
|
||||||
boost::asio::io_context::strand strand_;
|
boost::asio::strand<boost::asio::io_context::executor_type> strand_;
|
||||||
bool ssl_;
|
bool ssl_;
|
||||||
bool plain_;
|
bool plain_;
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ Door<Handler>::Detector::Detector(
|
|||||||
, stream_(std::move(stream))
|
, stream_(std::move(stream))
|
||||||
, socket_(stream_.socket())
|
, socket_(stream_.socket())
|
||||||
, remote_address_(remote_address)
|
, remote_address_(remote_address)
|
||||||
, strand_(ioc_)
|
, strand_(boost::asio::make_strand(ioc_))
|
||||||
, j_(j)
|
, j_(j)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -164,7 +164,7 @@ template <class Handler>
|
|||||||
void
|
void
|
||||||
Door<Handler>::Detector::run()
|
Door<Handler>::Detector::run()
|
||||||
{
|
{
|
||||||
boost::asio::spawn(
|
util::spawn(
|
||||||
strand_,
|
strand_,
|
||||||
std::bind(
|
std::bind(
|
||||||
&Detector::do_detect,
|
&Detector::do_detect,
|
||||||
@@ -269,7 +269,7 @@ Door<Handler>::reOpen()
|
|||||||
Throw<std::exception>();
|
Throw<std::exception>();
|
||||||
}
|
}
|
||||||
|
|
||||||
acceptor_.listen(boost::asio::socket_base::max_connections, ec);
|
acceptor_.listen(boost::asio::socket_base::max_listen_connections, ec);
|
||||||
if (ec)
|
if (ec)
|
||||||
{
|
{
|
||||||
JLOG(j_.error()) << "Listen on port '" << port_.name
|
JLOG(j_.error()) << "Listen on port '" << port_.name
|
||||||
@@ -291,7 +291,7 @@ Door<Handler>::Door(
|
|||||||
, handler_(handler)
|
, handler_(handler)
|
||||||
, ioc_(io_context)
|
, ioc_(io_context)
|
||||||
, acceptor_(io_context)
|
, acceptor_(io_context)
|
||||||
, strand_(io_context)
|
, strand_(boost::asio::make_strand(io_context))
|
||||||
, ssl_(
|
, ssl_(
|
||||||
port_.protocol.count("https") > 0 ||
|
port_.protocol.count("https") > 0 ||
|
||||||
port_.protocol.count("wss") > 0 || port_.protocol.count("wss2") > 0 ||
|
port_.protocol.count("wss") > 0 || port_.protocol.count("wss2") > 0 ||
|
||||||
@@ -307,7 +307,7 @@ template <class Handler>
|
|||||||
void
|
void
|
||||||
Door<Handler>::run()
|
Door<Handler>::run()
|
||||||
{
|
{
|
||||||
boost::asio::spawn(
|
util::spawn(
|
||||||
strand_,
|
strand_,
|
||||||
std::bind(
|
std::bind(
|
||||||
&Door<Handler>::do_accept,
|
&Door<Handler>::do_accept,
|
||||||
@@ -320,7 +320,8 @@ void
|
|||||||
Door<Handler>::close()
|
Door<Handler>::close()
|
||||||
{
|
{
|
||||||
if (!strand_.running_in_this_thread())
|
if (!strand_.running_in_this_thread())
|
||||||
return strand_.post(
|
return boost::asio::post(
|
||||||
|
strand_,
|
||||||
std::bind(&Door<Handler>::close, this->shared_from_this()));
|
std::bind(&Door<Handler>::close, this->shared_from_this()));
|
||||||
error_code ec;
|
error_code ec;
|
||||||
acceptor_.close(ec);
|
acceptor_.close(ec);
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ PlainHTTPPeer<Handler>::run()
|
|||||||
{
|
{
|
||||||
if (!this->handler_.onAccept(this->session(), this->remote_address_))
|
if (!this->handler_.onAccept(this->session(), this->remote_address_))
|
||||||
{
|
{
|
||||||
boost::asio::spawn(
|
util::spawn(
|
||||||
this->strand_,
|
this->strand_,
|
||||||
std::bind(&PlainHTTPPeer::do_close, this->shared_from_this()));
|
std::bind(&PlainHTTPPeer::do_close, this->shared_from_this()));
|
||||||
return;
|
return;
|
||||||
@@ -114,7 +114,7 @@ PlainHTTPPeer<Handler>::run()
|
|||||||
if (!socket_.is_open())
|
if (!socket_.is_open())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
boost::asio::spawn(
|
util::spawn(
|
||||||
this->strand_,
|
this->strand_,
|
||||||
std::bind(
|
std::bind(
|
||||||
&PlainHTTPPeer::do_read,
|
&PlainHTTPPeer::do_read,
|
||||||
|
|||||||
@@ -115,14 +115,14 @@ SSLHTTPPeer<Handler>::run()
|
|||||||
{
|
{
|
||||||
if (!this->handler_.onAccept(this->session(), this->remote_address_))
|
if (!this->handler_.onAccept(this->session(), this->remote_address_))
|
||||||
{
|
{
|
||||||
boost::asio::spawn(
|
util::spawn(
|
||||||
this->strand_,
|
this->strand_,
|
||||||
std::bind(&SSLHTTPPeer::do_close, this->shared_from_this()));
|
std::bind(&SSLHTTPPeer::do_close, this->shared_from_this()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!socket_.is_open())
|
if (!socket_.is_open())
|
||||||
return;
|
return;
|
||||||
boost::asio::spawn(
|
util::spawn(
|
||||||
this->strand_,
|
this->strand_,
|
||||||
std::bind(
|
std::bind(
|
||||||
&SSLHTTPPeer::do_handshake,
|
&SSLHTTPPeer::do_handshake,
|
||||||
@@ -164,7 +164,7 @@ SSLHTTPPeer<Handler>::do_handshake(yield_context do_yield)
|
|||||||
this->port().protocol.count("https") > 0;
|
this->port().protocol.count("https") > 0;
|
||||||
if (http)
|
if (http)
|
||||||
{
|
{
|
||||||
boost::asio::spawn(
|
util::spawn(
|
||||||
this->strand_,
|
this->strand_,
|
||||||
std::bind(
|
std::bind(
|
||||||
&SSLHTTPPeer::do_read,
|
&SSLHTTPPeer::do_read,
|
||||||
|
|||||||
@@ -26,6 +26,8 @@
|
|||||||
#include <xrpl/server/detail/io_list.h>
|
#include <xrpl/server/detail/io_list.h>
|
||||||
|
|
||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
|
#include <boost/asio/executor_work_guard.hpp>
|
||||||
|
#include <boost/asio/io_context.hpp>
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
@@ -85,9 +87,11 @@ private:
|
|||||||
|
|
||||||
Handler& handler_;
|
Handler& handler_;
|
||||||
beast::Journal const j_;
|
beast::Journal const j_;
|
||||||
boost::asio::io_service& io_service_;
|
boost::asio::io_context& io_context_;
|
||||||
boost::asio::io_service::strand strand_;
|
boost::asio::strand<boost::asio::io_context::executor_type> strand_;
|
||||||
std::optional<boost::asio::io_service::work> work_;
|
std::optional<boost::asio::executor_work_guard<
|
||||||
|
boost::asio::io_context::executor_type>>
|
||||||
|
work_;
|
||||||
|
|
||||||
std::mutex m_;
|
std::mutex m_;
|
||||||
std::vector<Port> ports_;
|
std::vector<Port> ports_;
|
||||||
@@ -100,7 +104,7 @@ private:
|
|||||||
public:
|
public:
|
||||||
ServerImpl(
|
ServerImpl(
|
||||||
Handler& handler,
|
Handler& handler,
|
||||||
boost::asio::io_service& io_service,
|
boost::asio::io_context& io_context,
|
||||||
beast::Journal journal);
|
beast::Journal journal);
|
||||||
|
|
||||||
~ServerImpl();
|
~ServerImpl();
|
||||||
@@ -123,10 +127,10 @@ public:
|
|||||||
return ios_;
|
return ios_;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::asio::io_service&
|
boost::asio::io_context&
|
||||||
get_io_service()
|
get_io_context()
|
||||||
{
|
{
|
||||||
return io_service_;
|
return io_context_;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@@ -140,13 +144,13 @@ private:
|
|||||||
template <class Handler>
|
template <class Handler>
|
||||||
ServerImpl<Handler>::ServerImpl(
|
ServerImpl<Handler>::ServerImpl(
|
||||||
Handler& handler,
|
Handler& handler,
|
||||||
boost::asio::io_service& io_service,
|
boost::asio::io_context& io_context,
|
||||||
beast::Journal journal)
|
beast::Journal journal)
|
||||||
: handler_(handler)
|
: handler_(handler)
|
||||||
, j_(journal)
|
, j_(journal)
|
||||||
, io_service_(io_service)
|
, io_context_(io_context)
|
||||||
, strand_(io_service_)
|
, strand_(boost::asio::make_strand(io_context_))
|
||||||
, work_(io_service_)
|
, work_(std::in_place, boost::asio::make_work_guard(io_context_))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,7 +177,7 @@ ServerImpl<Handler>::ports(std::vector<Port> const& ports)
|
|||||||
ports_.push_back(port);
|
ports_.push_back(port);
|
||||||
auto& internalPort = ports_.back();
|
auto& internalPort = ports_.back();
|
||||||
if (auto sp = ios_.emplace<Door<Handler>>(
|
if (auto sp = ios_.emplace<Door<Handler>>(
|
||||||
handler_, io_service_, internalPort, j_))
|
handler_, io_context_, internalPort, j_))
|
||||||
{
|
{
|
||||||
list_.push_back(sp);
|
list_.push_back(sp);
|
||||||
|
|
||||||
|
|||||||
108
include/xrpl/server/detail/Spawn.h
Normal file
108
include/xrpl/server/detail/Spawn.h
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
/*
|
||||||
|
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_SERVER_SPAWN_H_INCLUDED
|
||||||
|
#define RIPPLE_SERVER_SPAWN_H_INCLUDED
|
||||||
|
|
||||||
|
#include <xrpl/basics/Log.h>
|
||||||
|
|
||||||
|
#include <boost/asio/spawn.hpp>
|
||||||
|
#include <boost/asio/strand.hpp>
|
||||||
|
|
||||||
|
#include <concepts>
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
|
namespace ripple::util {
|
||||||
|
namespace impl {
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
concept IsStrand = std::same_as<
|
||||||
|
std::decay_t<T>,
|
||||||
|
boost::asio::strand<typename std::decay_t<T>::inner_executor_type>>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief A completion handler that restores `boost::asio::spawn`'s behaviour
|
||||||
|
* from Boost 1.83
|
||||||
|
*
|
||||||
|
* This is intended to be passed as the third argument to `boost::asio::spawn`
|
||||||
|
* so that exceptions are not ignored but propagated to `io_context.run()` call
|
||||||
|
* site.
|
||||||
|
*
|
||||||
|
* @param ePtr The exception that was caught on the coroutine
|
||||||
|
*/
|
||||||
|
inline constexpr auto kPROPAGATE_EXCEPTIONS = [](std::exception_ptr ePtr) {
|
||||||
|
if (ePtr)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
std::rethrow_exception(ePtr);
|
||||||
|
}
|
||||||
|
catch (std::exception const& e)
|
||||||
|
{
|
||||||
|
JLOG(debugLog().warn()) << "Spawn exception: " << e.what();
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
JLOG(debugLog().warn()) << "Spawn exception: Unknown";
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace impl
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Spawns a coroutine using `boost::asio::spawn`
|
||||||
|
*
|
||||||
|
* @note This uses kPROPAGATE_EXCEPTIONS to force asio to propagate exceptions
|
||||||
|
* through `io_context`
|
||||||
|
* @note Since implicit strand was removed from boost::asio::spawn this helper
|
||||||
|
* function adds the strand back
|
||||||
|
*
|
||||||
|
* @tparam Ctx The type of the context/strand
|
||||||
|
* @tparam F The type of the function to execute
|
||||||
|
* @param ctx The execution context
|
||||||
|
* @param func The function to execute. Must return `void`
|
||||||
|
*/
|
||||||
|
template <typename Ctx, typename F>
|
||||||
|
requires std::is_invocable_r_v<void, F, boost::asio::yield_context>
|
||||||
|
void
|
||||||
|
spawn(Ctx&& ctx, F&& func)
|
||||||
|
{
|
||||||
|
if constexpr (impl::IsStrand<Ctx>)
|
||||||
|
{
|
||||||
|
boost::asio::spawn(
|
||||||
|
std::forward<Ctx>(ctx),
|
||||||
|
std::forward<F>(func),
|
||||||
|
impl::kPROPAGATE_EXCEPTIONS);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
boost::asio::spawn(
|
||||||
|
boost::asio::make_strand(
|
||||||
|
boost::asio::get_associated_executor(std::forward<Ctx>(ctx))),
|
||||||
|
std::forward<F>(func),
|
||||||
|
impl::kPROPAGATE_EXCEPTIONS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace ripple::util
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -166,7 +166,7 @@ public:
|
|||||||
May be called concurrently.
|
May be called concurrently.
|
||||||
|
|
||||||
Preconditions:
|
Preconditions:
|
||||||
No call to io_service::run on any io_service
|
No call to io_context::run on any io_context
|
||||||
used by work objects associated with this io_list
|
used by work objects associated with this io_list
|
||||||
exists in the caller's call stack.
|
exists in the caller's call stack.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -239,11 +239,9 @@ Logs::fromSeverity(beast::severities::Severity level)
|
|||||||
case kError:
|
case kError:
|
||||||
return lsERROR;
|
return lsERROR;
|
||||||
|
|
||||||
// LCOV_EXCL_START
|
|
||||||
default:
|
default:
|
||||||
UNREACHABLE("ripple::Logs::fromSeverity : invalid severity");
|
UNREACHABLE("ripple::Logs::fromSeverity : invalid severity");
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
// LCOV_EXCL_STOP
|
|
||||||
case kFatal:
|
case kFatal:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -267,11 +265,9 @@ Logs::toSeverity(LogSeverity level)
|
|||||||
return kWarning;
|
return kWarning;
|
||||||
case lsERROR:
|
case lsERROR:
|
||||||
return kError;
|
return kError;
|
||||||
// LCOV_EXCL_START
|
|
||||||
default:
|
default:
|
||||||
UNREACHABLE("ripple::Logs::toSeverity : invalid severity");
|
UNREACHABLE("ripple::Logs::toSeverity : invalid severity");
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
// LCOV_EXCL_STOP
|
|
||||||
case lsFATAL:
|
case lsFATAL:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -296,11 +292,9 @@ Logs::toString(LogSeverity s)
|
|||||||
return "Error";
|
return "Error";
|
||||||
case lsFATAL:
|
case lsFATAL:
|
||||||
return "Fatal";
|
return "Fatal";
|
||||||
// LCOV_EXCL_START
|
|
||||||
default:
|
default:
|
||||||
UNREACHABLE("ripple::Logs::toString : invalid severity");
|
UNREACHABLE("ripple::Logs::toString : invalid severity");
|
||||||
return "Unknown";
|
return "Unknown";
|
||||||
// LCOV_EXCL_STOP
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -362,11 +356,9 @@ Logs::format(
|
|||||||
case kError:
|
case kError:
|
||||||
output += "ERR ";
|
output += "ERR ";
|
||||||
break;
|
break;
|
||||||
// LCOV_EXCL_START
|
|
||||||
default:
|
default:
|
||||||
UNREACHABLE("ripple::Logs::format : invalid severity");
|
UNREACHABLE("ripple::Logs::format : invalid severity");
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
// LCOV_EXCL_STOP
|
|
||||||
case kFatal:
|
case kFatal:
|
||||||
output += "FTL ";
|
output += "FTL ";
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -25,8 +25,9 @@
|
|||||||
#include <xrpl/beast/utility/Journal.h>
|
#include <xrpl/beast/utility/Journal.h>
|
||||||
#include <xrpl/beast/utility/instrumentation.h>
|
#include <xrpl/beast/utility/instrumentation.h>
|
||||||
|
|
||||||
|
#include <boost/asio/bind_executor.hpp>
|
||||||
#include <boost/asio/error.hpp>
|
#include <boost/asio/error.hpp>
|
||||||
#include <boost/asio/io_service.hpp>
|
#include <boost/asio/io_context.hpp>
|
||||||
#include <boost/asio/ip/tcp.hpp>
|
#include <boost/asio/ip/tcp.hpp>
|
||||||
#include <boost/system/detail/error_code.hpp>
|
#include <boost/system/detail/error_code.hpp>
|
||||||
|
|
||||||
@@ -124,8 +125,8 @@ public:
|
|||||||
|
|
||||||
beast::Journal m_journal;
|
beast::Journal m_journal;
|
||||||
|
|
||||||
boost::asio::io_service& m_io_service;
|
boost::asio::io_context& m_io_context;
|
||||||
boost::asio::io_service::strand m_strand;
|
boost::asio::strand<boost::asio::io_context::executor_type> m_strand;
|
||||||
boost::asio::ip::tcp::resolver m_resolver;
|
boost::asio::ip::tcp::resolver m_resolver;
|
||||||
|
|
||||||
std::condition_variable m_cv;
|
std::condition_variable m_cv;
|
||||||
@@ -155,12 +156,12 @@ public:
|
|||||||
std::deque<Work> m_work;
|
std::deque<Work> m_work;
|
||||||
|
|
||||||
ResolverAsioImpl(
|
ResolverAsioImpl(
|
||||||
boost::asio::io_service& io_service,
|
boost::asio::io_context& io_context,
|
||||||
beast::Journal journal)
|
beast::Journal journal)
|
||||||
: m_journal(journal)
|
: m_journal(journal)
|
||||||
, m_io_service(io_service)
|
, m_io_context(io_context)
|
||||||
, m_strand(io_service)
|
, m_strand(boost::asio::make_strand(io_context))
|
||||||
, m_resolver(io_service)
|
, m_resolver(io_context)
|
||||||
, m_asyncHandlersCompleted(true)
|
, m_asyncHandlersCompleted(true)
|
||||||
, m_stop_called(false)
|
, m_stop_called(false)
|
||||||
, m_stopped(true)
|
, m_stopped(true)
|
||||||
@@ -216,8 +217,14 @@ public:
|
|||||||
{
|
{
|
||||||
if (m_stop_called.exchange(true) == false)
|
if (m_stop_called.exchange(true) == false)
|
||||||
{
|
{
|
||||||
m_io_service.dispatch(m_strand.wrap(std::bind(
|
boost::asio::dispatch(
|
||||||
&ResolverAsioImpl::do_stop, this, CompletionCounter(this))));
|
m_io_context,
|
||||||
|
boost::asio::bind_executor(
|
||||||
|
m_strand,
|
||||||
|
std::bind(
|
||||||
|
&ResolverAsioImpl::do_stop,
|
||||||
|
this,
|
||||||
|
CompletionCounter(this))));
|
||||||
|
|
||||||
JLOG(m_journal.debug()) << "Queued a stop request";
|
JLOG(m_journal.debug()) << "Queued a stop request";
|
||||||
}
|
}
|
||||||
@@ -248,7 +255,11 @@ public:
|
|||||||
|
|
||||||
// TODO NIKB use rvalue references to construct and move
|
// TODO NIKB use rvalue references to construct and move
|
||||||
// reducing cost.
|
// reducing cost.
|
||||||
m_io_service.dispatch(m_strand.wrap(std::bind(
|
boost::asio::dispatch(
|
||||||
|
m_io_context,
|
||||||
|
boost::asio::bind_executor(
|
||||||
|
m_strand,
|
||||||
|
std::bind(
|
||||||
&ResolverAsioImpl::do_resolve,
|
&ResolverAsioImpl::do_resolve,
|
||||||
this,
|
this,
|
||||||
names,
|
names,
|
||||||
@@ -279,19 +290,20 @@ public:
|
|||||||
std::string name,
|
std::string name,
|
||||||
boost::system::error_code const& ec,
|
boost::system::error_code const& ec,
|
||||||
HandlerType handler,
|
HandlerType handler,
|
||||||
boost::asio::ip::tcp::resolver::iterator iter,
|
boost::asio::ip::tcp::resolver::results_type results,
|
||||||
CompletionCounter)
|
CompletionCounter)
|
||||||
{
|
{
|
||||||
if (ec == boost::asio::error::operation_aborted)
|
if (ec == boost::asio::error::operation_aborted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::vector<beast::IP::Endpoint> addresses;
|
std::vector<beast::IP::Endpoint> addresses;
|
||||||
|
auto iter = results.begin();
|
||||||
|
|
||||||
// If we get an error message back, we don't return any
|
// If we get an error message back, we don't return any
|
||||||
// results that we may have gotten.
|
// results that we may have gotten.
|
||||||
if (!ec)
|
if (!ec)
|
||||||
{
|
{
|
||||||
while (iter != boost::asio::ip::tcp::resolver::iterator())
|
while (iter != results.end())
|
||||||
{
|
{
|
||||||
addresses.push_back(
|
addresses.push_back(
|
||||||
beast::IPAddressConversion::from_asio(*iter));
|
beast::IPAddressConversion::from_asio(*iter));
|
||||||
@@ -301,8 +313,14 @@ public:
|
|||||||
|
|
||||||
handler(name, addresses);
|
handler(name, addresses);
|
||||||
|
|
||||||
m_io_service.post(m_strand.wrap(std::bind(
|
boost::asio::post(
|
||||||
&ResolverAsioImpl::do_work, this, CompletionCounter(this))));
|
m_io_context,
|
||||||
|
boost::asio::bind_executor(
|
||||||
|
m_strand,
|
||||||
|
std::bind(
|
||||||
|
&ResolverAsioImpl::do_work,
|
||||||
|
this,
|
||||||
|
CompletionCounter(this))));
|
||||||
}
|
}
|
||||||
|
|
||||||
HostAndPort
|
HostAndPort
|
||||||
@@ -383,16 +401,21 @@ public:
|
|||||||
{
|
{
|
||||||
JLOG(m_journal.error()) << "Unable to parse '" << name << "'";
|
JLOG(m_journal.error()) << "Unable to parse '" << name << "'";
|
||||||
|
|
||||||
m_io_service.post(m_strand.wrap(std::bind(
|
boost::asio::post(
|
||||||
&ResolverAsioImpl::do_work, this, CompletionCounter(this))));
|
m_io_context,
|
||||||
|
boost::asio::bind_executor(
|
||||||
|
m_strand,
|
||||||
|
std::bind(
|
||||||
|
&ResolverAsioImpl::do_work,
|
||||||
|
this,
|
||||||
|
CompletionCounter(this))));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::asio::ip::tcp::resolver::query query(host, port);
|
|
||||||
|
|
||||||
m_resolver.async_resolve(
|
m_resolver.async_resolve(
|
||||||
query,
|
host,
|
||||||
|
port,
|
||||||
std::bind(
|
std::bind(
|
||||||
&ResolverAsioImpl::do_finish,
|
&ResolverAsioImpl::do_finish,
|
||||||
this,
|
this,
|
||||||
@@ -423,7 +446,11 @@ public:
|
|||||||
|
|
||||||
if (m_work.size() > 0)
|
if (m_work.size() > 0)
|
||||||
{
|
{
|
||||||
m_io_service.post(m_strand.wrap(std::bind(
|
boost::asio::post(
|
||||||
|
m_io_context,
|
||||||
|
boost::asio::bind_executor(
|
||||||
|
m_strand,
|
||||||
|
std::bind(
|
||||||
&ResolverAsioImpl::do_work,
|
&ResolverAsioImpl::do_work,
|
||||||
this,
|
this,
|
||||||
CompletionCounter(this))));
|
CompletionCounter(this))));
|
||||||
@@ -435,9 +462,9 @@ public:
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
std::unique_ptr<ResolverAsio>
|
std::unique_ptr<ResolverAsio>
|
||||||
ResolverAsio::New(boost::asio::io_service& io_service, beast::Journal journal)
|
ResolverAsio::New(boost::asio::io_context& io_context, beast::Journal journal)
|
||||||
{
|
{
|
||||||
return std::make_unique<ResolverAsioImpl>(io_service, journal);
|
return std::make_unique<ResolverAsioImpl>(io_context, journal);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ LogThrow(std::string const& title)
|
|||||||
[[noreturn]] void
|
[[noreturn]] void
|
||||||
LogicError(std::string const& s) noexcept
|
LogicError(std::string const& s) noexcept
|
||||||
{
|
{
|
||||||
// LCOV_EXCL_START
|
|
||||||
JLOG(debugLog().fatal()) << s;
|
JLOG(debugLog().fatal()) << s;
|
||||||
std::cerr << "Logic error: " << s << std::endl;
|
std::cerr << "Logic error: " << s << std::endl;
|
||||||
// Use a non-standard contract naming here (without namespace) because
|
// Use a non-standard contract naming here (without namespace) because
|
||||||
@@ -46,7 +45,6 @@ LogicError(std::string const& s) noexcept
|
|||||||
// For the above reasons, we want this contract to stand out.
|
// For the above reasons, we want this contract to stand out.
|
||||||
UNREACHABLE("LogicError", {{"message", s}});
|
UNREACHABLE("LogicError", {{"message", s}});
|
||||||
std::abort();
|
std::abort();
|
||||||
// LCOV_EXCL_STOP
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ripple
|
} // namespace ripple
|
||||||
|
|||||||
@@ -30,9 +30,11 @@
|
|||||||
#include <xrpl/beast/utility/instrumentation.h>
|
#include <xrpl/beast/utility/instrumentation.h>
|
||||||
|
|
||||||
#include <boost/asio/basic_waitable_timer.hpp>
|
#include <boost/asio/basic_waitable_timer.hpp>
|
||||||
|
#include <boost/asio/bind_executor.hpp>
|
||||||
#include <boost/asio/buffer.hpp>
|
#include <boost/asio/buffer.hpp>
|
||||||
#include <boost/asio/error.hpp>
|
#include <boost/asio/error.hpp>
|
||||||
#include <boost/asio/io_service.hpp>
|
#include <boost/asio/executor_work_guard.hpp>
|
||||||
|
#include <boost/asio/io_context.hpp>
|
||||||
#include <boost/asio/ip/udp.hpp>
|
#include <boost/asio/ip/udp.hpp>
|
||||||
#include <boost/asio/strand.hpp>
|
#include <boost/asio/strand.hpp>
|
||||||
#include <boost/system/detail/error_code.hpp>
|
#include <boost/system/detail/error_code.hpp>
|
||||||
@@ -238,9 +240,11 @@ private:
|
|||||||
Journal m_journal;
|
Journal m_journal;
|
||||||
IP::Endpoint m_address;
|
IP::Endpoint m_address;
|
||||||
std::string m_prefix;
|
std::string m_prefix;
|
||||||
boost::asio::io_service m_io_service;
|
boost::asio::io_context m_io_context;
|
||||||
std::optional<boost::asio::io_service::work> m_work;
|
std::optional<boost::asio::executor_work_guard<
|
||||||
boost::asio::io_service::strand m_strand;
|
boost::asio::io_context::executor_type>>
|
||||||
|
m_work;
|
||||||
|
boost::asio::strand<boost::asio::io_context::executor_type> m_strand;
|
||||||
boost::asio::basic_waitable_timer<std::chrono::steady_clock> m_timer;
|
boost::asio::basic_waitable_timer<std::chrono::steady_clock> m_timer;
|
||||||
boost::asio::ip::udp::socket m_socket;
|
boost::asio::ip::udp::socket m_socket;
|
||||||
std::deque<std::string> m_data;
|
std::deque<std::string> m_data;
|
||||||
@@ -264,18 +268,24 @@ public:
|
|||||||
: m_journal(journal)
|
: m_journal(journal)
|
||||||
, m_address(address)
|
, m_address(address)
|
||||||
, m_prefix(prefix)
|
, m_prefix(prefix)
|
||||||
, m_work(std::ref(m_io_service))
|
, m_work(boost::asio::make_work_guard(m_io_context))
|
||||||
, m_strand(m_io_service)
|
, m_strand(boost::asio::make_strand(m_io_context))
|
||||||
, m_timer(m_io_service)
|
, m_timer(m_io_context)
|
||||||
, m_socket(m_io_service)
|
, m_socket(m_io_context)
|
||||||
, m_thread(&StatsDCollectorImp::run, this)
|
, m_thread(&StatsDCollectorImp::run, this)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
~StatsDCollectorImp() override
|
~StatsDCollectorImp() override
|
||||||
{
|
{
|
||||||
boost::system::error_code ec;
|
try
|
||||||
m_timer.cancel(ec);
|
{
|
||||||
|
m_timer.cancel();
|
||||||
|
}
|
||||||
|
catch (boost::system::system_error const&)
|
||||||
|
{
|
||||||
|
// ignored
|
||||||
|
}
|
||||||
|
|
||||||
m_work.reset();
|
m_work.reset();
|
||||||
m_thread.join();
|
m_thread.join();
|
||||||
@@ -334,10 +344,10 @@ public:
|
|||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
boost::asio::io_service&
|
boost::asio::io_context&
|
||||||
get_io_service()
|
get_io_context()
|
||||||
{
|
{
|
||||||
return m_io_service;
|
return m_io_context;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string const&
|
std::string const&
|
||||||
@@ -355,8 +365,14 @@ public:
|
|||||||
void
|
void
|
||||||
post_buffer(std::string&& buffer)
|
post_buffer(std::string&& buffer)
|
||||||
{
|
{
|
||||||
m_io_service.dispatch(m_strand.wrap(std::bind(
|
boost::asio::dispatch(
|
||||||
&StatsDCollectorImp::do_post_buffer, this, std::move(buffer))));
|
m_io_context,
|
||||||
|
boost::asio::bind_executor(
|
||||||
|
m_strand,
|
||||||
|
std::bind(
|
||||||
|
&StatsDCollectorImp::do_post_buffer,
|
||||||
|
this,
|
||||||
|
std::move(buffer))));
|
||||||
}
|
}
|
||||||
|
|
||||||
// The keepAlive parameter makes sure the buffers sent to
|
// The keepAlive parameter makes sure the buffers sent to
|
||||||
@@ -386,8 +402,7 @@ public:
|
|||||||
for (auto const& buffer : buffers)
|
for (auto const& buffer : buffers)
|
||||||
{
|
{
|
||||||
std::string const s(
|
std::string const s(
|
||||||
boost::asio::buffer_cast<char const*>(buffer),
|
buffer.data(), boost::asio::buffer_size(buffer));
|
||||||
boost::asio::buffer_size(buffer));
|
|
||||||
std::cerr << s;
|
std::cerr << s;
|
||||||
}
|
}
|
||||||
std::cerr << '\n';
|
std::cerr << '\n';
|
||||||
@@ -456,7 +471,7 @@ public:
|
|||||||
set_timer()
|
set_timer()
|
||||||
{
|
{
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
m_timer.expires_from_now(1s);
|
m_timer.expires_after(1s);
|
||||||
m_timer.async_wait(std::bind(
|
m_timer.async_wait(std::bind(
|
||||||
&StatsDCollectorImp::on_timer, this, std::placeholders::_1));
|
&StatsDCollectorImp::on_timer, this, std::placeholders::_1));
|
||||||
}
|
}
|
||||||
@@ -498,13 +513,13 @@ public:
|
|||||||
|
|
||||||
set_timer();
|
set_timer();
|
||||||
|
|
||||||
m_io_service.run();
|
m_io_context.run();
|
||||||
|
|
||||||
m_socket.shutdown(boost::asio::ip::udp::socket::shutdown_send, ec);
|
m_socket.shutdown(boost::asio::ip::udp::socket::shutdown_send, ec);
|
||||||
|
|
||||||
m_socket.close();
|
m_socket.close();
|
||||||
|
|
||||||
m_io_service.poll();
|
m_io_context.poll();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -547,7 +562,9 @@ StatsDCounterImpl::~StatsDCounterImpl()
|
|||||||
void
|
void
|
||||||
StatsDCounterImpl::increment(CounterImpl::value_type amount)
|
StatsDCounterImpl::increment(CounterImpl::value_type amount)
|
||||||
{
|
{
|
||||||
m_impl->get_io_service().dispatch(std::bind(
|
boost::asio::dispatch(
|
||||||
|
m_impl->get_io_context(),
|
||||||
|
std::bind(
|
||||||
&StatsDCounterImpl::do_increment,
|
&StatsDCounterImpl::do_increment,
|
||||||
std::static_pointer_cast<StatsDCounterImpl>(shared_from_this()),
|
std::static_pointer_cast<StatsDCounterImpl>(shared_from_this()),
|
||||||
amount));
|
amount));
|
||||||
@@ -592,7 +609,9 @@ StatsDEventImpl::StatsDEventImpl(
|
|||||||
void
|
void
|
||||||
StatsDEventImpl::notify(EventImpl::value_type const& value)
|
StatsDEventImpl::notify(EventImpl::value_type const& value)
|
||||||
{
|
{
|
||||||
m_impl->get_io_service().dispatch(std::bind(
|
boost::asio::dispatch(
|
||||||
|
m_impl->get_io_context(),
|
||||||
|
std::bind(
|
||||||
&StatsDEventImpl::do_notify,
|
&StatsDEventImpl::do_notify,
|
||||||
std::static_pointer_cast<StatsDEventImpl>(shared_from_this()),
|
std::static_pointer_cast<StatsDEventImpl>(shared_from_this()),
|
||||||
value));
|
value));
|
||||||
@@ -625,7 +644,9 @@ StatsDGaugeImpl::~StatsDGaugeImpl()
|
|||||||
void
|
void
|
||||||
StatsDGaugeImpl::set(GaugeImpl::value_type value)
|
StatsDGaugeImpl::set(GaugeImpl::value_type value)
|
||||||
{
|
{
|
||||||
m_impl->get_io_service().dispatch(std::bind(
|
boost::asio::dispatch(
|
||||||
|
m_impl->get_io_context(),
|
||||||
|
std::bind(
|
||||||
&StatsDGaugeImpl::do_set,
|
&StatsDGaugeImpl::do_set,
|
||||||
std::static_pointer_cast<StatsDGaugeImpl>(shared_from_this()),
|
std::static_pointer_cast<StatsDGaugeImpl>(shared_from_this()),
|
||||||
value));
|
value));
|
||||||
@@ -634,7 +655,9 @@ StatsDGaugeImpl::set(GaugeImpl::value_type value)
|
|||||||
void
|
void
|
||||||
StatsDGaugeImpl::increment(GaugeImpl::difference_type amount)
|
StatsDGaugeImpl::increment(GaugeImpl::difference_type amount)
|
||||||
{
|
{
|
||||||
m_impl->get_io_service().dispatch(std::bind(
|
boost::asio::dispatch(
|
||||||
|
m_impl->get_io_context(),
|
||||||
|
std::bind(
|
||||||
&StatsDGaugeImpl::do_increment,
|
&StatsDGaugeImpl::do_increment,
|
||||||
std::static_pointer_cast<StatsDGaugeImpl>(shared_from_this()),
|
std::static_pointer_cast<StatsDGaugeImpl>(shared_from_this()),
|
||||||
amount));
|
amount));
|
||||||
@@ -713,7 +736,9 @@ StatsDMeterImpl::~StatsDMeterImpl()
|
|||||||
void
|
void
|
||||||
StatsDMeterImpl::increment(MeterImpl::value_type amount)
|
StatsDMeterImpl::increment(MeterImpl::value_type amount)
|
||||||
{
|
{
|
||||||
m_impl->get_io_service().dispatch(std::bind(
|
boost::asio::dispatch(
|
||||||
|
m_impl->get_io_context(),
|
||||||
|
std::bind(
|
||||||
&StatsDMeterImpl::do_increment,
|
&StatsDMeterImpl::do_increment,
|
||||||
std::static_pointer_cast<StatsDMeterImpl>(shared_from_this()),
|
std::static_pointer_cast<StatsDMeterImpl>(shared_from_this()),
|
||||||
amount));
|
amount));
|
||||||
|
|||||||
@@ -25,11 +25,11 @@ namespace IP {
|
|||||||
bool
|
bool
|
||||||
is_private(AddressV4 const& addr)
|
is_private(AddressV4 const& addr)
|
||||||
{
|
{
|
||||||
return ((addr.to_ulong() & 0xff000000) ==
|
return ((addr.to_uint() & 0xff000000) ==
|
||||||
0x0a000000) || // Prefix /8, 10. #.#.#
|
0x0a000000) || // Prefix /8, 10. #.#.#
|
||||||
((addr.to_ulong() & 0xfff00000) ==
|
((addr.to_uint() & 0xfff00000) ==
|
||||||
0xac100000) || // Prefix /12 172. 16.#.# - 172.31.#.#
|
0xac100000) || // Prefix /12 172. 16.#.# - 172.31.#.#
|
||||||
((addr.to_ulong() & 0xffff0000) ==
|
((addr.to_uint() & 0xffff0000) ==
|
||||||
0xc0a80000) || // Prefix /16 192.168.#.#
|
0xc0a80000) || // Prefix /16 192.168.#.#
|
||||||
addr.is_loopback();
|
addr.is_loopback();
|
||||||
}
|
}
|
||||||
@@ -44,7 +44,7 @@ char
|
|||||||
get_class(AddressV4 const& addr)
|
get_class(AddressV4 const& addr)
|
||||||
{
|
{
|
||||||
static char const* table = "AAAABBCD";
|
static char const* table = "AAAABBCD";
|
||||||
return table[(addr.to_ulong() & 0xE0000000) >> 29];
|
return table[(addr.to_uint() & 0xE0000000) >> 29];
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace IP
|
} // namespace IP
|
||||||
|
|||||||
@@ -20,6 +20,8 @@
|
|||||||
#include <xrpl/beast/net/IPAddressV4.h>
|
#include <xrpl/beast/net/IPAddressV4.h>
|
||||||
#include <xrpl/beast/net/IPAddressV6.h>
|
#include <xrpl/beast/net/IPAddressV6.h>
|
||||||
|
|
||||||
|
#include <boost/asio/ip/address_v4.hpp>
|
||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
namespace IP {
|
namespace IP {
|
||||||
|
|
||||||
@@ -28,7 +30,9 @@ is_private(AddressV6 const& addr)
|
|||||||
{
|
{
|
||||||
return (
|
return (
|
||||||
(addr.to_bytes()[0] & 0xfd) || // TODO fc00::/8 too ?
|
(addr.to_bytes()[0] & 0xfd) || // TODO fc00::/8 too ?
|
||||||
(addr.is_v4_mapped() && is_private(addr.to_v4())));
|
(addr.is_v4_mapped() &&
|
||||||
|
is_private(boost::asio::ip::make_address_v4(
|
||||||
|
boost::asio::ip::v4_mapped, addr))));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user