mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-01 16:35:53 +00:00
Compare commits
41 Commits
Bronek/ext
...
a1q123456/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
62dbd3d1d3 | ||
|
|
4565e97af9 | ||
|
|
2169abc438 | ||
|
|
404ea567ef | ||
|
|
f59a3c81c1 | ||
|
|
c65b13c730 | ||
|
|
3e13bd036e | ||
|
|
0b29ff0bf7 | ||
|
|
af284bf23f | ||
|
|
47a73e6b0f | ||
|
|
c3a7ae3730 | ||
|
|
ac5ff24323 | ||
|
|
4ec90d7c73 | ||
|
|
0a21224c98 | ||
|
|
881f5d9d71 | ||
|
|
780816a2ec | ||
|
|
5e49158258 | ||
|
|
b82ec378c9 | ||
|
|
09bcaaa035 | ||
|
|
775e8e4af7 | ||
|
|
0dc0bc42ba | ||
|
|
41d9d9528c | ||
|
|
4483921eeb | ||
|
|
28c37ba244 | ||
|
|
e2a83c9205 | ||
|
|
6379bf1953 | ||
|
|
3e71229185 | ||
|
|
d2ee6f0c9d | ||
|
|
13410f2a76 | ||
|
|
e11e805c34 | ||
|
|
09abafd8d6 | ||
|
|
0f9f3a0834 | ||
|
|
f62e9c0ba5 | ||
|
|
0590c13de3 | ||
|
|
95b9a77126 | ||
|
|
f85432aee4 | ||
|
|
a6f97ed7b3 | ||
|
|
092c37f52e | ||
|
|
a3651b417c | ||
|
|
00697a49fe | ||
|
|
6d730f9ffb |
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
@@ -2,7 +2,7 @@
|
|||||||
*
|
*
|
||||||
|
|
||||||
# Require the rpc-reviewers team to review changes to the rpc code.
|
# Require the rpc-reviewers team to review changes to the rpc code.
|
||||||
include/xrpl/protocol/ @xrplf/rpc-reviewers
|
include/libxrpl/protocol/ @xrplf/rpc-reviewers
|
||||||
src/libxrpl/protocol/ @xrplf/rpc-reviewers
|
src/libxrpl/protocol/ @xrplf/rpc-reviewers
|
||||||
src/xrpld/rpc/ @xrplf/rpc-reviewers
|
src/xrpld/rpc/ @xrplf/rpc-reviewers
|
||||||
src/xrpld/app/misc/ @xrplf/rpc-reviewers
|
src/xrpld/app/misc/ @xrplf/rpc-reviewers
|
||||||
|
|||||||
43
.github/actions/dependencies/action.yml
vendored
43
.github/actions/dependencies/action.yml
vendored
@@ -6,33 +6,36 @@ inputs:
|
|||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
steps:
|
steps:
|
||||||
|
- name: unlock Conan
|
||||||
|
shell: bash
|
||||||
|
run: conan remove --locks
|
||||||
- name: export custom recipes
|
- name: export custom recipes
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
conan export --version 1.1.10 external/snappy
|
conan config set general.revisions_enabled=1
|
||||||
conan export --version 9.7.3 external/rocksdb
|
conan export external/snappy snappy/1.1.10@
|
||||||
conan export --version 4.0.3 external/soci
|
conan export external/rocksdb rocksdb/9.7.3@
|
||||||
conan export --version 6.30.1 external/protobuf
|
conan export external/soci soci/4.0.3@
|
||||||
|
conan export external/nudb nudb/2.0.8@
|
||||||
- name: add Ripple Conan remote
|
- name: add Ripple Conan remote
|
||||||
if: env.CONAN_URL != ''
|
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
if conan remote list | grep -q "ripple"; then
|
conan remote list
|
||||||
conan remote remove ripple
|
conan remote remove ripple || true
|
||||||
echo "Removed conan remote ripple"
|
# Do not quote the URL. An empty string will be accepted (with
|
||||||
fi
|
# a non-fatal warning), but a missing argument will not.
|
||||||
conan remote add --index 0 ripple "${CONAN_URL}"
|
conan remote add ripple ${{ env.CONAN_URL }} --insert 0
|
||||||
echo "Added conan remote ripple at ${CONAN_URL}"
|
|
||||||
|
|
||||||
- name: try to authenticate to Ripple Conan remote
|
- name: try to authenticate to Ripple Conan remote
|
||||||
if: env.CONAN_URL != '' && env.CONAN_LOGIN_USERNAME_RIPPLE != '' && env.CONAN_PASSWORD_RIPPLE != ''
|
|
||||||
id: remote
|
id: remote
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
echo "Authenticating to ripple remote..."
|
# `conan user` implicitly uses the environment variables
|
||||||
conan remote auth ripple --force
|
# CONAN_LOGIN_USERNAME_<REMOTE> and CONAN_PASSWORD_<REMOTE>.
|
||||||
conan remote list-users
|
# https://docs.conan.io/1/reference/commands/misc/user.html#using-environment-variables
|
||||||
|
# https://docs.conan.io/1/reference/env_vars.html#conan-login-username-conan-login-username-remote-name
|
||||||
|
# https://docs.conan.io/1/reference/env_vars.html#conan-password-conan-password-remote-name
|
||||||
|
echo outcome=$(conan user --remote ripple --password >&2 \
|
||||||
|
&& echo success || echo failure) | tee ${GITHUB_OUTPUT}
|
||||||
- name: list missing binaries
|
- name: list missing binaries
|
||||||
id: binaries
|
id: binaries
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -48,7 +51,7 @@ runs:
|
|||||||
conan install \
|
conan install \
|
||||||
--output-folder . \
|
--output-folder . \
|
||||||
--build missing \
|
--build missing \
|
||||||
--options:host "&:tests=True" \
|
--options tests=True \
|
||||||
--options:host "&:xrpld=True" \
|
--options xrpld=True \
|
||||||
--settings:all build_type=${{ inputs.configuration }} \
|
--settings build_type=${{ inputs.configuration }} \
|
||||||
..
|
..
|
||||||
|
|||||||
29
.github/workflows/clang-format.yml
vendored
29
.github/workflows/clang-format.yml
vendored
@@ -9,25 +9,24 @@ jobs:
|
|||||||
check:
|
check:
|
||||||
if: ${{ github.event_name == 'push' || github.event.pull_request.draft != true || contains(github.event.pull_request.labels.*.name, 'DraftRunCI') }}
|
if: ${{ github.event_name == 'push' || github.event.pull_request.draft != true || contains(github.event.pull_request.labels.*.name, 'DraftRunCI') }}
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
container: ghcr.io/xrplf/ci/tools-rippled-clang-format
|
env:
|
||||||
|
CLANG_VERSION: 18
|
||||||
steps:
|
steps:
|
||||||
# For jobs running in containers, $GITHUB_WORKSPACE and ${{ github.workspace }} might not be the
|
|
||||||
# same directory. The actions/checkout step is *supposed* to checkout into $GITHUB_WORKSPACE and
|
|
||||||
# then add it to safe.directory (see instructions at https://github.com/actions/checkout)
|
|
||||||
# but that's apparently not happening for some container images. We can't be sure what is actually
|
|
||||||
# happening, so let's pre-emptively add both directories to safe.directory. There's a
|
|
||||||
# Github issue opened in 2022 and not resolved in 2025 https://github.com/actions/runner/issues/2058 ¯\_(ツ)_/¯
|
|
||||||
- run: |
|
|
||||||
git config --global --add safe.directory $GITHUB_WORKSPACE
|
|
||||||
git config --global --add safe.directory ${{ github.workspace }}
|
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Format first-party sources
|
- name: Install clang-format
|
||||||
run: |
|
run: |
|
||||||
clang-format --version
|
codename=$( lsb_release --codename --short )
|
||||||
find include src tests -type f \( -name '*.cpp' -o -name '*.hpp' -o -name '*.h' -o -name '*.ipp' \) -exec clang-format -i {} +
|
sudo tee /etc/apt/sources.list.d/llvm.list >/dev/null <<EOF
|
||||||
|
deb http://apt.llvm.org/${codename}/ llvm-toolchain-${codename}-${CLANG_VERSION} main
|
||||||
|
deb-src http://apt.llvm.org/${codename}/ llvm-toolchain-${codename}-${CLANG_VERSION} main
|
||||||
|
EOF
|
||||||
|
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install clang-format-${CLANG_VERSION}
|
||||||
|
- name: Format first-party sources
|
||||||
|
run: find include src tests -type f \( -name '*.cpp' -o -name '*.hpp' -o -name '*.h' -o -name '*.ipp' \) -exec clang-format-${CLANG_VERSION} -i {} +
|
||||||
- name: Check for differences
|
- name: Check for differences
|
||||||
id: assert
|
id: assert
|
||||||
shell: bash
|
|
||||||
run: |
|
run: |
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
git diff --exit-code | tee "clang-format.patch"
|
git diff --exit-code | tee "clang-format.patch"
|
||||||
@@ -59,6 +58,6 @@ jobs:
|
|||||||
in your repo, commit, and push.
|
in your repo, commit, and push.
|
||||||
run: |
|
run: |
|
||||||
echo "${PREAMBLE}"
|
echo "${PREAMBLE}"
|
||||||
clang-format --version
|
clang-format-${CLANG_VERSION} --version
|
||||||
echo "${SUGGESTION}"
|
echo "${SUGGESTION}"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
2
.github/workflows/doxygen.yml
vendored
2
.github/workflows/doxygen.yml
vendored
@@ -10,7 +10,7 @@ concurrency:
|
|||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
documentation:
|
job:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
|||||||
2
.github/workflows/libxrpl.yml
vendored
2
.github/workflows/libxrpl.yml
vendored
@@ -1,6 +1,6 @@
|
|||||||
name: Check libXRPL compatibility with Clio
|
name: Check libXRPL compatibility with Clio
|
||||||
env:
|
env:
|
||||||
CONAN_URL: http://18.143.149.228:8081/artifactory/api/conan/dev
|
CONAN_URL: http://18.143.149.228:8081/artifactory/api/conan/conan-non-prod
|
||||||
CONAN_LOGIN_USERNAME_RIPPLE: ${{ secrets.CONAN_USERNAME }}
|
CONAN_LOGIN_USERNAME_RIPPLE: ${{ secrets.CONAN_USERNAME }}
|
||||||
CONAN_PASSWORD_RIPPLE: ${{ secrets.CONAN_TOKEN }}
|
CONAN_PASSWORD_RIPPLE: ${{ secrets.CONAN_TOKEN }}
|
||||||
on:
|
on:
|
||||||
|
|||||||
52
.github/workflows/macos.yml
vendored
52
.github/workflows/macos.yml
vendored
@@ -15,18 +15,6 @@ on:
|
|||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
# This part of Conan configuration is specific to this workflow only; we do not want
|
|
||||||
# to pollute conan/profiles directory with settings which might not work for others
|
|
||||||
env:
|
|
||||||
#CONAN_URL: http://18.143.149.228:8081/artifactory/api/conan/dev
|
|
||||||
CONAN_LOGIN_USERNAME_RIPPLE: ${{ secrets.CONAN_USERNAME }}
|
|
||||||
CONAN_PASSWORD_RIPPLE: ${{ secrets.CONAN_TOKEN }}
|
|
||||||
CONAN_GLOBAL_CONF: |
|
|
||||||
core.download:parallel={{os.cpu_count()}}
|
|
||||||
core.upload:parallel={{os.cpu_count()}}
|
|
||||||
tools.build:jobs={{ (os.cpu_count() * 4/5) | int }}
|
|
||||||
tools.build:verbosity=verbose
|
|
||||||
tools.compilation:verbosity=verbose
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
@@ -40,22 +28,23 @@ jobs:
|
|||||||
- Ninja
|
- Ninja
|
||||||
configuration:
|
configuration:
|
||||||
- Release
|
- Release
|
||||||
runs-on: [self-hosted, macOS, mac-runner-m1]
|
runs-on: [self-hosted, macOS]
|
||||||
env:
|
env:
|
||||||
# The `build` action requires these variables.
|
# The `build` action requires these variables.
|
||||||
build_dir: .build
|
build_dir: .build
|
||||||
NUM_PROCESSORS: 12
|
NUM_PROCESSORS: 12
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
uses: actions/checkout@v4
|
||||||
- name: install Conan
|
- name: install Conan
|
||||||
run: |
|
run: |
|
||||||
brew install conan
|
brew install conan@1
|
||||||
|
echo '/opt/homebrew/opt/conan@1/bin' >> $GITHUB_PATH
|
||||||
- name: install Ninja
|
- name: install Ninja
|
||||||
if: matrix.generator == 'Ninja'
|
if: matrix.generator == 'Ninja'
|
||||||
run: brew install ninja
|
run: brew install ninja
|
||||||
- name: install python
|
- name: install python
|
||||||
run: |
|
run: |
|
||||||
if which python > /dev/null 2>&1; then
|
if which python > /dev/null 2>&1; then
|
||||||
echo "Python executable exists"
|
echo "Python executable exists"
|
||||||
else
|
else
|
||||||
@@ -87,28 +76,14 @@ jobs:
|
|||||||
clang --version
|
clang --version
|
||||||
- name: configure Conan
|
- name: configure Conan
|
||||||
run : |
|
run : |
|
||||||
echo "${CONAN_GLOBAL_CONF}" >> $(conan config home)/global.conf
|
conan profile new default --detect || true
|
||||||
conan config install conan/profiles/ -tf $(conan config home)/profiles/
|
conan profile update settings.compiler.cppstd=20 default
|
||||||
conan profile show
|
|
||||||
- name: export custom recipes
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
conan export --version 1.1.10 external/snappy
|
|
||||||
conan export --version 9.7.3 external/rocksdb
|
|
||||||
conan export --version 4.0.3 external/soci
|
|
||||||
conan export --version 6.30.1 external/protobuf
|
|
||||||
- name: add Ripple Conan remote
|
|
||||||
if: env.CONAN_URL != ''
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
if conan remote list | grep -q "ripple"; then
|
|
||||||
conan remote remove ripple
|
|
||||||
echo "Removed conan remote ripple"
|
|
||||||
fi
|
|
||||||
conan remote add --index 0 ripple "${CONAN_URL}"
|
|
||||||
echo "Added conan remote ripple at ${CONAN_URL}"
|
|
||||||
- name: build dependencies
|
- name: build dependencies
|
||||||
uses: ./.github/actions/dependencies
|
uses: ./.github/actions/dependencies
|
||||||
|
env:
|
||||||
|
CONAN_URL: http://18.143.149.228:8081/artifactory/api/conan/conan-non-prod
|
||||||
|
CONAN_LOGIN_USERNAME_RIPPLE: ${{ secrets.CONAN_USERNAME }}
|
||||||
|
CONAN_PASSWORD_RIPPLE: ${{ secrets.CONAN_TOKEN }}
|
||||||
with:
|
with:
|
||||||
configuration: ${{ matrix.configuration }}
|
configuration: ${{ matrix.configuration }}
|
||||||
- name: build
|
- name: build
|
||||||
@@ -121,7 +96,4 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
n=$(nproc)
|
n=$(nproc)
|
||||||
echo "Using $n test jobs"
|
echo "Using $n test jobs"
|
||||||
|
${build_dir}/rippled --unittest --unittest-jobs $n
|
||||||
cd ${build_dir}
|
|
||||||
./rippled --unittest --unittest-jobs $n
|
|
||||||
ctest -j $n --output-on-failure
|
|
||||||
|
|||||||
257
.github/workflows/nix.yml
vendored
257
.github/workflows/nix.yml
vendored
@@ -16,19 +16,6 @@ concurrency:
|
|||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
# This part of Conan configuration is specific to this workflow only; we do not want
|
|
||||||
# to pollute conan/profiles directory with settings which might not work for others
|
|
||||||
env:
|
|
||||||
#CONAN_URL: http://18.143.149.228:8081/artifactory/api/conan/dev
|
|
||||||
CONAN_LOGIN_USERNAME_RIPPLE: ${{ secrets.CONAN_USERNAME }}
|
|
||||||
CONAN_PASSWORD_RIPPLE: ${{ secrets.CONAN_TOKEN }}
|
|
||||||
CONAN_GLOBAL_CONF: |
|
|
||||||
core.download:parallel={{ os.cpu_count() }}
|
|
||||||
core.upload:parallel={{ os.cpu_count() }}
|
|
||||||
tools.build:jobs={{ (os.cpu_count() * 4/5) | int }}
|
|
||||||
tools.build:verbosity=verbose
|
|
||||||
tools.compilation:verbosity=verbose
|
|
||||||
|
|
||||||
# This workflow has multiple job matrixes.
|
# This workflow has multiple job matrixes.
|
||||||
# They can be considered phases because most of the matrices ("test",
|
# They can be considered phases because most of the matrices ("test",
|
||||||
# "coverage", "conan", ) depend on the first ("dependencies").
|
# "coverage", "conan", ) depend on the first ("dependencies").
|
||||||
@@ -67,46 +54,59 @@ jobs:
|
|||||||
- Release
|
- Release
|
||||||
include:
|
include:
|
||||||
- compiler: gcc
|
- compiler: gcc
|
||||||
compiler_version: 12
|
profile:
|
||||||
distro: ubuntu
|
version: 11
|
||||||
codename: jammy
|
cc: /usr/bin/gcc
|
||||||
|
cxx: /usr/bin/g++
|
||||||
- compiler: clang
|
- compiler: clang
|
||||||
compiler_version: 16
|
profile:
|
||||||
distro: debian
|
version: 14
|
||||||
codename: bookworm
|
cc: /usr/bin/clang-14
|
||||||
|
cxx: /usr/bin/clang++-14
|
||||||
runs-on: [self-hosted, heavy]
|
runs-on: [self-hosted, heavy]
|
||||||
container: ghcr.io/xrplf/ci/${{ matrix.distro }}-${{ matrix.codename }}:${{ matrix.compiler }}-${{ matrix.compiler_version }}
|
container: ghcr.io/xrplf/rippled-build-ubuntu:aaf5e3e
|
||||||
env:
|
env:
|
||||||
build_dir: .build
|
build_dir: .build
|
||||||
steps:
|
steps:
|
||||||
|
- name: upgrade conan
|
||||||
|
run: |
|
||||||
|
pip install --upgrade "conan<2"
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
uses: actions/checkout@v4
|
||||||
- name: check environment
|
- name: check environment
|
||||||
run: |
|
run: |
|
||||||
echo ${PATH} | tr ':' '\n'
|
echo ${PATH} | tr ':' '\n'
|
||||||
lsb_release -a || true
|
lsb_release -a || true
|
||||||
${{ matrix.compiler }}-${{ matrix.compiler_version }} --version
|
${{ matrix.profile.cc }} --version
|
||||||
conan --version
|
conan --version
|
||||||
cmake --version
|
cmake --version
|
||||||
env | sort
|
env | sort
|
||||||
- name: configure Conan
|
- name: configure Conan
|
||||||
run: |
|
run: |
|
||||||
echo "${CONAN_GLOBAL_CONF}" >> $(conan config home)/global.conf
|
conan profile new default --detect
|
||||||
conan config install conan/profiles/ -tf $(conan config home)/profiles/
|
conan profile update settings.compiler.cppstd=20 default
|
||||||
conan profile show
|
conan profile update settings.compiler=${{ matrix.compiler }} default
|
||||||
|
conan profile update settings.compiler.version=${{ matrix.profile.version }} default
|
||||||
|
conan profile update settings.compiler.libcxx=libstdc++11 default
|
||||||
|
conan profile update env.CC=${{ matrix.profile.cc }} default
|
||||||
|
conan profile update env.CXX=${{ matrix.profile.cxx }} default
|
||||||
|
conan profile update conf.tools.build:compiler_executables='{"c": "${{ matrix.profile.cc }}", "cpp": "${{ matrix.profile.cxx }}"}' default
|
||||||
- name: archive profile
|
- name: archive profile
|
||||||
# Create this archive before dependencies are added to the local cache.
|
# Create this archive before dependencies are added to the local cache.
|
||||||
run: tar -czf conan.tar.gz -C ${CONAN_HOME} .
|
run: tar -czf conan.tar -C ~/.conan .
|
||||||
- name: build dependencies
|
- name: build dependencies
|
||||||
uses: ./.github/actions/dependencies
|
uses: ./.github/actions/dependencies
|
||||||
|
env:
|
||||||
|
CONAN_URL: http://18.143.149.228:8081/artifactory/api/conan/conan-non-prod
|
||||||
|
CONAN_LOGIN_USERNAME_RIPPLE: ${{ secrets.CONAN_USERNAME }}
|
||||||
|
CONAN_PASSWORD_RIPPLE: ${{ secrets.CONAN_TOKEN }}
|
||||||
with:
|
with:
|
||||||
configuration: ${{ matrix.configuration }}
|
configuration: ${{ matrix.configuration }}
|
||||||
- name: upload archive
|
- name: upload archive
|
||||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ matrix.platform }}-${{ matrix.compiler }}-${{ matrix.configuration }}
|
name: ${{ matrix.platform }}-${{ matrix.compiler }}-${{ matrix.configuration }}
|
||||||
path: conan.tar.gz
|
path: conan.tar
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
test:
|
test:
|
||||||
@@ -121,32 +121,26 @@ jobs:
|
|||||||
configuration:
|
configuration:
|
||||||
- Debug
|
- Debug
|
||||||
- Release
|
- Release
|
||||||
include:
|
|
||||||
- compiler: gcc
|
|
||||||
compiler_version: 12
|
|
||||||
distro: ubuntu
|
|
||||||
codename: jammy
|
|
||||||
- compiler: clang
|
|
||||||
compiler_version: 16
|
|
||||||
distro: debian
|
|
||||||
codename: bookworm
|
|
||||||
cmake-args:
|
cmake-args:
|
||||||
-
|
-
|
||||||
- "-Dunity=ON"
|
- "-Dunity=ON"
|
||||||
needs: dependencies
|
needs: dependencies
|
||||||
runs-on: [self-hosted, heavy]
|
runs-on: [self-hosted, heavy]
|
||||||
container: ghcr.io/xrplf/ci/${{ matrix.distro }}-${{ matrix.codename }}:${{ matrix.compiler }}-${{ matrix.compiler_version }}
|
container: ghcr.io/xrplf/rippled-build-ubuntu:aaf5e3e
|
||||||
env:
|
env:
|
||||||
build_dir: .build
|
build_dir: .build
|
||||||
steps:
|
steps:
|
||||||
|
- name: upgrade conan
|
||||||
|
run: |
|
||||||
|
pip install --upgrade "conan<2"
|
||||||
- name: download cache
|
- name: download cache
|
||||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ matrix.platform }}-${{ matrix.compiler }}-${{ matrix.configuration }}
|
name: ${{ matrix.platform }}-${{ matrix.compiler }}-${{ matrix.configuration }}
|
||||||
- name: extract cache
|
- name: extract cache
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ${CONAN_HOME}
|
mkdir -p ~/.conan
|
||||||
tar -xzf conan.tar.gz -C ${CONAN_HOME}
|
tar -xzf conan.tar -C ~/.conan
|
||||||
- name: check environment
|
- name: check environment
|
||||||
run: |
|
run: |
|
||||||
env | sort
|
env | sort
|
||||||
@@ -154,9 +148,11 @@ jobs:
|
|||||||
conan --version
|
conan --version
|
||||||
cmake --version
|
cmake --version
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
uses: actions/checkout@v4
|
||||||
- name: dependencies
|
- name: dependencies
|
||||||
uses: ./.github/actions/dependencies
|
uses: ./.github/actions/dependencies
|
||||||
|
env:
|
||||||
|
CONAN_URL: http://18.143.149.228:8081/artifactory/api/conan/conan-non-prod
|
||||||
with:
|
with:
|
||||||
configuration: ${{ matrix.configuration }}
|
configuration: ${{ matrix.configuration }}
|
||||||
- name: build
|
- name: build
|
||||||
@@ -165,21 +161,9 @@ jobs:
|
|||||||
generator: Ninja
|
generator: Ninja
|
||||||
configuration: ${{ matrix.configuration }}
|
configuration: ${{ matrix.configuration }}
|
||||||
cmake-args: "-Dassert=TRUE -Dwerr=TRUE ${{ matrix.cmake-args }}"
|
cmake-args: "-Dassert=TRUE -Dwerr=TRUE ${{ matrix.cmake-args }}"
|
||||||
- name: check linking
|
|
||||||
run: |
|
|
||||||
cd ${build_dir}
|
|
||||||
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: test
|
- name: test
|
||||||
run: |
|
run: |
|
||||||
cd ${build_dir}
|
${build_dir}/rippled --unittest --unittest-jobs $(nproc)
|
||||||
./rippled --unittest --unittest-jobs $(nproc)
|
|
||||||
ctest -j $(nproc) --output-on-failure
|
|
||||||
|
|
||||||
reference-fee-test:
|
reference-fee-test:
|
||||||
strategy:
|
strategy:
|
||||||
@@ -196,18 +180,21 @@ jobs:
|
|||||||
- "-DUNIT_TEST_REFERENCE_FEE=1000"
|
- "-DUNIT_TEST_REFERENCE_FEE=1000"
|
||||||
needs: dependencies
|
needs: dependencies
|
||||||
runs-on: [self-hosted, heavy]
|
runs-on: [self-hosted, heavy]
|
||||||
container: ghcr.io/xrplf/ci/ubuntu-jammy:gcc-12
|
container: ghcr.io/xrplf/rippled-build-ubuntu:aaf5e3e
|
||||||
env:
|
env:
|
||||||
build_dir: .build
|
build_dir: .build
|
||||||
steps:
|
steps:
|
||||||
|
- name: upgrade conan
|
||||||
|
run: |
|
||||||
|
pip install --upgrade "conan<2"
|
||||||
- name: download cache
|
- name: download cache
|
||||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ matrix.platform }}-${{ matrix.compiler }}-${{ matrix.configuration }}
|
name: ${{ matrix.platform }}-${{ matrix.compiler }}-${{ matrix.configuration }}
|
||||||
- name: extract cache
|
- name: extract cache
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ${CONAN_HOME}
|
mkdir -p ~/.conan
|
||||||
tar -xzf conan.tar.gz -C ${CONAN_HOME}
|
tar -xzf conan.tar -C ~/.conan
|
||||||
- name: check environment
|
- name: check environment
|
||||||
run: |
|
run: |
|
||||||
env | sort
|
env | sort
|
||||||
@@ -215,9 +202,11 @@ jobs:
|
|||||||
conan --version
|
conan --version
|
||||||
cmake --version
|
cmake --version
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
uses: actions/checkout@v4
|
||||||
- name: dependencies
|
- name: dependencies
|
||||||
uses: ./.github/actions/dependencies
|
uses: ./.github/actions/dependencies
|
||||||
|
env:
|
||||||
|
CONAN_URL: http://18.143.149.228:8081/artifactory/api/conan/conan-non-prod
|
||||||
with:
|
with:
|
||||||
configuration: ${{ matrix.configuration }}
|
configuration: ${{ matrix.configuration }}
|
||||||
- name: build
|
- name: build
|
||||||
@@ -228,9 +217,7 @@ jobs:
|
|||||||
cmake-args: "-Dassert=TRUE -Dwerr=TRUE ${{ matrix.cmake-args }}"
|
cmake-args: "-Dassert=TRUE -Dwerr=TRUE ${{ matrix.cmake-args }}"
|
||||||
- name: test
|
- name: test
|
||||||
run: |
|
run: |
|
||||||
cd ${build_dir}
|
${build_dir}/rippled --unittest --unittest-jobs $(nproc)
|
||||||
./rippled --unittest --unittest-jobs $(nproc)
|
|
||||||
ctest -j $(nproc) --output-on-failure
|
|
||||||
|
|
||||||
coverage:
|
coverage:
|
||||||
strategy:
|
strategy:
|
||||||
@@ -244,18 +231,23 @@ jobs:
|
|||||||
- Debug
|
- Debug
|
||||||
needs: dependencies
|
needs: dependencies
|
||||||
runs-on: [self-hosted, heavy]
|
runs-on: [self-hosted, heavy]
|
||||||
container: ghcr.io/xrplf/ci/ubuntu-jammy:gcc-12
|
container: ghcr.io/xrplf/rippled-build-ubuntu:aaf5e3e
|
||||||
env:
|
env:
|
||||||
build_dir: .build
|
build_dir: .build
|
||||||
steps:
|
steps:
|
||||||
|
- name: upgrade conan
|
||||||
|
run: |
|
||||||
|
pip install --upgrade "conan<2"
|
||||||
- name: download cache
|
- name: download cache
|
||||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ matrix.platform }}-${{ matrix.compiler }}-${{ matrix.configuration }}
|
name: ${{ matrix.platform }}-${{ matrix.compiler }}-${{ matrix.configuration }}
|
||||||
- name: extract cache
|
- name: extract cache
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ${CONAN_HOME}
|
mkdir -p ~/.conan
|
||||||
tar -xzf conan.tar.gz -C ${CONAN_HOME}
|
tar -xzf conan.tar -C ~/.conan
|
||||||
|
- name: install gcovr
|
||||||
|
run: pip install "gcovr>=7,<9"
|
||||||
- name: check environment
|
- name: check environment
|
||||||
run: |
|
run: |
|
||||||
echo ${PATH} | tr ':' '\n'
|
echo ${PATH} | tr ':' '\n'
|
||||||
@@ -263,11 +255,13 @@ jobs:
|
|||||||
cmake --version
|
cmake --version
|
||||||
gcovr --version
|
gcovr --version
|
||||||
env | sort
|
env | sort
|
||||||
ls ${CONAN_HOME}
|
ls ~/.conan
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
uses: actions/checkout@v4
|
||||||
- name: dependencies
|
- name: dependencies
|
||||||
uses: ./.github/actions/dependencies
|
uses: ./.github/actions/dependencies
|
||||||
|
env:
|
||||||
|
CONAN_URL: http://18.143.149.228:8081/artifactory/api/conan/conan-non-prod
|
||||||
with:
|
with:
|
||||||
configuration: ${{ matrix.configuration }}
|
configuration: ${{ matrix.configuration }}
|
||||||
- name: build
|
- name: build
|
||||||
@@ -289,7 +283,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
mv "${build_dir}/coverage.xml" ./
|
mv "${build_dir}/coverage.xml" ./
|
||||||
- name: archive coverage report
|
- name: archive coverage report
|
||||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: coverage.xml
|
name: coverage.xml
|
||||||
path: coverage.xml
|
path: coverage.xml
|
||||||
@@ -311,23 +305,22 @@ jobs:
|
|||||||
conan:
|
conan:
|
||||||
needs: dependencies
|
needs: dependencies
|
||||||
runs-on: [self-hosted, heavy]
|
runs-on: [self-hosted, heavy]
|
||||||
container:
|
container: ghcr.io/xrplf/rippled-build-ubuntu:aaf5e3e
|
||||||
image: ghcr.io/xrplf/ci/ubuntu-jammy:gcc-12
|
|
||||||
env:
|
env:
|
||||||
build_dir: .build
|
build_dir: .build
|
||||||
platform: linux
|
|
||||||
compiler: gcc
|
|
||||||
compiler_version: 12
|
|
||||||
configuration: Release
|
configuration: Release
|
||||||
steps:
|
steps:
|
||||||
|
- name: upgrade conan
|
||||||
|
run: |
|
||||||
|
pip install --upgrade "conan<2"
|
||||||
- name: download cache
|
- name: download cache
|
||||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ env.platform }}-${{ env.compiler }}-${{ env.configuration }}
|
name: linux-gcc-${{ env.configuration }}
|
||||||
- name: extract cache
|
- name: extract cache
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ${CONAN_HOME}
|
mkdir -p ~/.conan
|
||||||
tar -xzf conan.tar.gz -C ${CONAN_HOME}
|
tar -xzf conan.tar -C ~/.conan
|
||||||
- name: check environment
|
- name: check environment
|
||||||
run: |
|
run: |
|
||||||
env | sort
|
env | sort
|
||||||
@@ -335,61 +328,96 @@ jobs:
|
|||||||
conan --version
|
conan --version
|
||||||
cmake --version
|
cmake --version
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
uses: actions/checkout@v4
|
||||||
- name: dependencies
|
- name: dependencies
|
||||||
uses: ./.github/actions/dependencies
|
uses: ./.github/actions/dependencies
|
||||||
|
env:
|
||||||
|
CONAN_URL: http://18.143.149.228:8081/artifactory/api/conan/conan-non-prod
|
||||||
with:
|
with:
|
||||||
configuration: ${{ env.configuration }}
|
configuration: ${{ env.configuration }}
|
||||||
- name: export
|
- name: export
|
||||||
run: |
|
run: |
|
||||||
conan export . --version head
|
version=$(conan inspect --raw version .)
|
||||||
|
reference="xrpl/${version}@local/test"
|
||||||
|
conan remove -f ${reference} || true
|
||||||
|
conan export . local/test
|
||||||
|
echo "reference=${reference}" >> "${GITHUB_ENV}"
|
||||||
- name: build
|
- name: build
|
||||||
run: |
|
run: |
|
||||||
cd tests/conan
|
cd tests/conan
|
||||||
mkdir ${build_dir} && cd ${build_dir}
|
mkdir ${build_dir}
|
||||||
conan install .. \
|
cd ${build_dir}
|
||||||
--settings:all build_type=${configuration} \
|
conan install .. --output-folder . \
|
||||||
--output-folder . \
|
--require-override ${reference} --build missing
|
||||||
--build missing
|
|
||||||
cmake .. \
|
cmake .. \
|
||||||
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=./build/${configuration}/generators/conan_toolchain.cmake \
|
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=./build/${configuration}/generators/conan_toolchain.cmake \
|
||||||
-DCMAKE_BUILD_TYPE=${configuration}
|
-DCMAKE_BUILD_TYPE=${configuration}
|
||||||
cmake --build .
|
cmake --build .
|
||||||
./example | grep '^[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+'
|
./example | grep '^[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+'
|
||||||
|
|
||||||
|
# NOTE we are not using dependencies built above because it lags with
|
||||||
|
# compiler versions. Instrumentation requires clang version 16 or
|
||||||
|
# later
|
||||||
|
|
||||||
instrumentation-build:
|
instrumentation-build:
|
||||||
needs: dependencies
|
if: ${{ github.event_name == 'push' || github.event.pull_request.draft != true || contains(github.event.pull_request.labels.*.name, 'DraftRunCI') }}
|
||||||
runs-on: [self-hosted, heavy]
|
|
||||||
container: ghcr.io/xrplf/ci/debian-bookworm:clang-16
|
|
||||||
env:
|
env:
|
||||||
build_dir: .build
|
CLANG_RELEASE: 16
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
runs-on: [self-hosted, heavy]
|
||||||
|
container: debian:bookworm
|
||||||
steps:
|
steps:
|
||||||
- name: download cache
|
- name: install prerequisites
|
||||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
|
env:
|
||||||
with:
|
DEBIAN_FRONTEND: noninteractive
|
||||||
name: linux-clang-Debug
|
|
||||||
- name: extract cache
|
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ${CONAN_HOME}
|
apt-get update
|
||||||
tar -xzf conan.tar.gz -C ${CONAN_HOME}
|
apt-get install --yes --no-install-recommends \
|
||||||
- name: check environment
|
clang-${CLANG_RELEASE} clang++-${CLANG_RELEASE} \
|
||||||
run: |
|
python3-pip python-is-python3 make cmake git wget
|
||||||
echo ${PATH} | tr ':' '\n'
|
apt-get clean
|
||||||
conan --version
|
update-alternatives --install \
|
||||||
cmake --version
|
/usr/bin/clang clang /usr/bin/clang-${CLANG_RELEASE} 100 \
|
||||||
env | sort
|
--slave /usr/bin/clang++ clang++ /usr/bin/clang++-${CLANG_RELEASE}
|
||||||
ls ${CONAN_HOME}
|
update-alternatives --auto clang
|
||||||
|
pip install --no-cache --break-system-packages "conan<2"
|
||||||
|
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
uses: actions/checkout@v4
|
||||||
- name: dependencies
|
|
||||||
uses: ./.github/actions/dependencies
|
|
||||||
with:
|
|
||||||
configuration: Debug
|
|
||||||
- name: prepare environment
|
- name: prepare environment
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ${build_dir}
|
mkdir ${GITHUB_WORKSPACE}/.build
|
||||||
echo "SOURCE_DIR=$(pwd)" >> $GITHUB_ENV
|
echo "SOURCE_DIR=$GITHUB_WORKSPACE" >> $GITHUB_ENV
|
||||||
echo "BUILD_DIR=$(pwd)/${build_dir}" >> $GITHUB_ENV
|
echo "BUILD_DIR=$GITHUB_WORKSPACE/.build" >> $GITHUB_ENV
|
||||||
|
echo "CC=/usr/bin/clang" >> $GITHUB_ENV
|
||||||
|
echo "CXX=/usr/bin/clang++" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: configure Conan
|
||||||
|
run: |
|
||||||
|
conan profile new --detect default
|
||||||
|
conan profile update settings.compiler=clang default
|
||||||
|
conan profile update settings.compiler.version=${CLANG_RELEASE} default
|
||||||
|
conan profile update settings.compiler.libcxx=libstdc++11 default
|
||||||
|
conan profile update settings.compiler.cppstd=20 default
|
||||||
|
conan profile update options.rocksdb=False default
|
||||||
|
conan profile update \
|
||||||
|
'conf.tools.build:compiler_executables={"c": "/usr/bin/clang", "cpp": "/usr/bin/clang++"}' default
|
||||||
|
conan profile update 'env.CXXFLAGS="-DBOOST_ASIO_DISABLE_CONCEPTS"' default
|
||||||
|
conan profile update 'conf.tools.build:cxxflags+=["-DBOOST_ASIO_DISABLE_CONCEPTS"]' default
|
||||||
|
conan export external/snappy snappy/1.1.10@
|
||||||
|
conan export external/soci soci/4.0.3@
|
||||||
|
|
||||||
|
- name: build dependencies
|
||||||
|
run: |
|
||||||
|
cd ${BUILD_DIR}
|
||||||
|
conan install ${SOURCE_DIR} \
|
||||||
|
--output-folder ${BUILD_DIR} \
|
||||||
|
--install-folder ${BUILD_DIR} \
|
||||||
|
--build missing \
|
||||||
|
--settings build_type=Debug
|
||||||
|
|
||||||
- name: build with instrumentation
|
- name: build with instrumentation
|
||||||
run: |
|
run: |
|
||||||
cd ${BUILD_DIR}
|
cd ${BUILD_DIR}
|
||||||
@@ -403,12 +431,13 @@ jobs:
|
|||||||
-DSECP256K1_BUILD_EXHAUSTIVE_TESTS=OFF \
|
-DSECP256K1_BUILD_EXHAUSTIVE_TESTS=OFF \
|
||||||
-DCMAKE_TOOLCHAIN_FILE=${BUILD_DIR}/build/generators/conan_toolchain.cmake
|
-DCMAKE_TOOLCHAIN_FILE=${BUILD_DIR}/build/generators/conan_toolchain.cmake
|
||||||
cmake --build . --parallel $(nproc)
|
cmake --build . --parallel $(nproc)
|
||||||
|
|
||||||
- name: verify instrumentation enabled
|
- name: verify instrumentation enabled
|
||||||
run: |
|
run: |
|
||||||
cd ${BUILD_DIR}
|
cd ${BUILD_DIR}
|
||||||
./rippled --version | grep libvoidstar
|
./rippled --version | grep libvoidstar
|
||||||
|
|
||||||
- name: run unit tests
|
- name: run unit tests
|
||||||
run: |
|
run: |
|
||||||
cd ${BUILD_DIR}
|
cd ${BUILD_DIR}
|
||||||
./rippled -u --unittest-jobs $(( $(nproc)/4 ))
|
./rippled -u --unittest-jobs $(( $(nproc)/4 ))
|
||||||
ctest -j $(nproc) --output-on-failure
|
|
||||||
|
|||||||
56
.github/workflows/windows.yml
vendored
56
.github/workflows/windows.yml
vendored
@@ -18,18 +18,6 @@ on:
|
|||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
# This part of Conan configuration is specific to this workflow only; we do not want
|
|
||||||
# to pollute conan/profiles directory with settings which might not work for others
|
|
||||||
env:
|
|
||||||
#CONAN_URL: http://18.143.149.228:8081/artifactory/api/conan/dev
|
|
||||||
CONAN_LOGIN_USERNAME_RIPPLE: ${{ secrets.CONAN_USERNAME }}
|
|
||||||
CONAN_PASSWORD_RIPPLE: ${{ secrets.CONAN_TOKEN }}
|
|
||||||
CONAN_GLOBAL_CONF: |
|
|
||||||
core.download:parallel={{os.cpu_count()}}
|
|
||||||
core.upload:parallel={{os.cpu_count()}}
|
|
||||||
tools.build:jobs=24
|
|
||||||
tools.build:verbosity=verbose
|
|
||||||
tools.compilation:verbosity=verbose
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
@@ -54,11 +42,11 @@ jobs:
|
|||||||
build_dir: .build
|
build_dir: .build
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
uses: actions/checkout@v4
|
||||||
- name: choose Python
|
- name: choose Python
|
||||||
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: 3.13
|
python-version: 3.9
|
||||||
- name: learn Python cache directory
|
- name: learn Python cache directory
|
||||||
id: pip-cache
|
id: pip-cache
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -66,12 +54,12 @@ jobs:
|
|||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
echo "dir=$(pip cache dir)" | tee ${GITHUB_OUTPUT}
|
echo "dir=$(pip cache dir)" | tee ${GITHUB_OUTPUT}
|
||||||
- name: restore Python cache directory
|
- name: restore Python cache directory
|
||||||
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.pip-cache.outputs.dir }}
|
path: ${{ steps.pip-cache.outputs.dir }}
|
||||||
key: ${{ runner.os }}-${{ hashFiles('.github/workflows/windows.yml') }}
|
key: ${{ runner.os }}-${{ hashFiles('.github/workflows/windows.yml') }}
|
||||||
- name: install Conan
|
- name: install Conan
|
||||||
run: pip install wheel conan
|
run: pip install wheel 'conan<2'
|
||||||
- name: check environment
|
- name: check environment
|
||||||
run: |
|
run: |
|
||||||
dir env:
|
dir env:
|
||||||
@@ -82,28 +70,17 @@ jobs:
|
|||||||
- name: configure Conan
|
- name: configure Conan
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
echo "${CONAN_GLOBAL_CONF}" >> $(conan config home)/global.conf
|
conan profile new default --detect
|
||||||
conan config install conan/profiles/ -tf $(conan config home)/profiles/
|
conan profile update settings.compiler.cppstd=20 default
|
||||||
conan profile show
|
conan profile update \
|
||||||
- name: export custom recipes
|
settings.compiler.runtime=MT${{ matrix.configuration.runtime }} \
|
||||||
shell: bash
|
default
|
||||||
run: |
|
|
||||||
conan export --version 1.1.10 external/snappy
|
|
||||||
conan export --version 9.7.3 external/rocksdb
|
|
||||||
conan export --version 4.0.3 external/soci
|
|
||||||
conan export --version 6.30.1 external/protobuf
|
|
||||||
- name: add Ripple Conan remote
|
|
||||||
if: env.CONAN_URL != ''
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
if conan remote list | grep -q "ripple"; then
|
|
||||||
conan remote remove ripple
|
|
||||||
echo "Removed conan remote ripple"
|
|
||||||
fi
|
|
||||||
conan remote add --index 0 ripple "${CONAN_URL}"
|
|
||||||
echo "Added conan remote ripple at ${CONAN_URL}"
|
|
||||||
- name: build dependencies
|
- name: build dependencies
|
||||||
uses: ./.github/actions/dependencies
|
uses: ./.github/actions/dependencies
|
||||||
|
env:
|
||||||
|
CONAN_URL: http://18.143.149.228:8081/artifactory/api/conan/conan-non-prod
|
||||||
|
CONAN_LOGIN_USERNAME_RIPPLE: ${{ secrets.CONAN_USERNAME }}
|
||||||
|
CONAN_PASSWORD_RIPPLE: ${{ secrets.CONAN_TOKEN }}
|
||||||
with:
|
with:
|
||||||
configuration: ${{ matrix.configuration.type }}
|
configuration: ${{ matrix.configuration.type }}
|
||||||
- name: build
|
- name: build
|
||||||
@@ -118,6 +95,5 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
if: ${{ matrix.configuration.tests }}
|
if: ${{ matrix.configuration.tests }}
|
||||||
run: |
|
run: |
|
||||||
cd ${build_dir}/${{ matrix.configuration.type }}
|
${build_dir}/${{ matrix.configuration.type }}/rippled --unittest \
|
||||||
./rippled --unittest --unittest-jobs $(nproc)
|
--unittest-jobs $(nproc)
|
||||||
ctest -j $(nproc) --output-on-failure
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# .pre-commit-config.yaml
|
# .pre-commit-config.yaml
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/pre-commit/mirrors-clang-format
|
- repo: https://github.com/pre-commit/mirrors-clang-format
|
||||||
rev: v18.1.8
|
rev: v18.1.3
|
||||||
hooks:
|
hooks:
|
||||||
- id: clang-format
|
- id: clang-format
|
||||||
|
|||||||
17
BUILD.md
17
BUILD.md
@@ -167,6 +167,8 @@ It does not explicitly link the C++ standard library,
|
|||||||
which allows you to statically link it with GCC, if you want.
|
which allows you to statically link it with GCC, if you want.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
# Conan 1.x
|
||||||
|
conan export external/snappy snappy/1.1.10@
|
||||||
# Conan 2.x
|
# Conan 2.x
|
||||||
conan export --version 1.1.10 external/snappy
|
conan export --version 1.1.10 external/snappy
|
||||||
```
|
```
|
||||||
@@ -175,6 +177,8 @@ Export our [Conan recipe for RocksDB](./external/rocksdb).
|
|||||||
It does not override paths to dependencies when building with Visual Studio.
|
It does not override paths to dependencies when building with Visual Studio.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
# Conan 1.x
|
||||||
|
conan export external/rocksdb rocksdb/9.7.3@
|
||||||
# Conan 2.x
|
# Conan 2.x
|
||||||
conan export --version 9.7.3 external/rocksdb
|
conan export --version 9.7.3 external/rocksdb
|
||||||
```
|
```
|
||||||
@@ -183,16 +187,21 @@ Export our [Conan recipe for SOCI](./external/soci).
|
|||||||
It patches their CMake to correctly import its dependencies.
|
It patches their CMake to correctly import its dependencies.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
# Conan 1.x
|
||||||
|
conan export external/soci soci/4.0.3@
|
||||||
# Conan 2.x
|
# Conan 2.x
|
||||||
conan export --version 4.0.3 external/soci
|
conan export --version 4.0.3 external/soci
|
||||||
```
|
```
|
||||||
|
|
||||||
Export our [Conan recipe for Protobuf](./external/rocksdb).
|
Export our [Conan recipe for NuDB](./external/nudb).
|
||||||
It fixes compilation errors with clang-16 and Visual Studio.
|
It fixes some source files to add missing `#include`s.
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
# Conan 1.x
|
||||||
|
conan export external/nudb nudb/2.0.8@
|
||||||
# Conan 2.x
|
# Conan 2.x
|
||||||
conan export --version 6.30.1 external/protobuf
|
conan export --version 2.0.8 external/nudb
|
||||||
```
|
```
|
||||||
|
|
||||||
### Build and Test
|
### Build and Test
|
||||||
@@ -279,7 +288,7 @@ It fixes compilation errors with clang-16 and Visual Studio.
|
|||||||
Single-config generators:
|
Single-config generators:
|
||||||
|
|
||||||
```
|
```
|
||||||
cmake --build . -j $(nproc)
|
cmake --build .
|
||||||
```
|
```
|
||||||
|
|
||||||
Multi-config generators:
|
Multi-config generators:
|
||||||
|
|||||||
@@ -132,7 +132,6 @@ test.shamap > xrpl.protocol
|
|||||||
test.toplevel > test.csf
|
test.toplevel > test.csf
|
||||||
test.toplevel > xrpl.json
|
test.toplevel > xrpl.json
|
||||||
test.unit_test > xrpl.basics
|
test.unit_test > xrpl.basics
|
||||||
tests.libxrpl > xrpl.basics
|
|
||||||
xrpl.json > xrpl.basics
|
xrpl.json > xrpl.basics
|
||||||
xrpl.protocol > xrpl.basics
|
xrpl.protocol > xrpl.basics
|
||||||
xrpl.protocol > xrpl.json
|
xrpl.protocol > xrpl.json
|
||||||
|
|||||||
@@ -90,11 +90,6 @@ set_target_properties(OpenSSL::SSL PROPERTIES
|
|||||||
INTERFACE_COMPILE_DEFINITIONS OPENSSL_NO_SSL2
|
INTERFACE_COMPILE_DEFINITIONS OPENSSL_NO_SSL2
|
||||||
)
|
)
|
||||||
set(SECP256K1_INSTALL TRUE)
|
set(SECP256K1_INSTALL TRUE)
|
||||||
set(SECP256K1_BUILD_BENCHMARK FALSE)
|
|
||||||
set(SECP256K1_BUILD_TESTS FALSE)
|
|
||||||
set(SECP256K1_BUILD_EXHAUSTIVE_TESTS FALSE)
|
|
||||||
set(SECP256K1_BUILD_CTIME_TESTS FALSE)
|
|
||||||
set(SECP256K1_BUILD_EXAMPLES FALSE)
|
|
||||||
add_subdirectory(external/secp256k1)
|
add_subdirectory(external/secp256k1)
|
||||||
add_library(secp256k1::secp256k1 ALIAS secp256k1)
|
add_library(secp256k1::secp256k1 ALIAS secp256k1)
|
||||||
add_subdirectory(external/ed25519-donna)
|
add_subdirectory(external/ed25519-donna)
|
||||||
@@ -149,8 +144,3 @@ set(PROJECT_EXPORT_SET RippleExports)
|
|||||||
include(RippledCore)
|
include(RippledCore)
|
||||||
include(RippledInstall)
|
include(RippledInstall)
|
||||||
include(RippledValidatorKeys)
|
include(RippledValidatorKeys)
|
||||||
|
|
||||||
if(tests)
|
|
||||||
include(CTest)
|
|
||||||
add_subdirectory(src/tests/libxrpl)
|
|
||||||
endif()
|
|
||||||
|
|||||||
4817
RELEASENOTES.md
Normal file
4817
RELEASENOTES.md
Normal file
File diff suppressed because it is too large
Load Diff
@@ -83,7 +83,7 @@ To report a qualifying bug, please send a detailed report to:
|
|||||||
|Long Key ID | `0xCD49A0AFC57929BE` |
|
|Long Key ID | `0xCD49A0AFC57929BE` |
|
||||||
|Fingerprint | `24E6 3B02 37E0 FA9C 5E96 8974 CD49 A0AF C579 29BE` |
|
|Fingerprint | `24E6 3B02 37E0 FA9C 5E96 8974 CD49 A0AF C579 29BE` |
|
||||||
|
|
||||||
The full PGP key for this address, which is also available on several key servers (e.g. on [keyserver.ubuntu.com](https://keyserver.ubuntu.com)), is:
|
The full PGP key for this address, which is also available on several key servers (e.g. on [keys.gnupg.net](https://keys.gnupg.net)), is:
|
||||||
```
|
```
|
||||||
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||||
mQINBFUwGHYBEAC0wpGpBPkd8W1UdQjg9+cEFzeIEJRaoZoeuJD8mofwI5Ejnjdt
|
mQINBFUwGHYBEAC0wpGpBPkd8W1UdQjg9+cEFzeIEJRaoZoeuJD8mofwI5Ejnjdt
|
||||||
|
|||||||
@@ -53,9 +53,9 @@ set(download_script "${CMAKE_BINARY_DIR}/docs/download-cppreference.cmake")
|
|||||||
file(WRITE
|
file(WRITE
|
||||||
"${download_script}"
|
"${download_script}"
|
||||||
"file(DOWNLOAD \
|
"file(DOWNLOAD \
|
||||||
https://github.com/PeterFeicht/cppreference-doc/releases/download/v20250209/html-book-20250209.zip \
|
http://upload.cppreference.com/mwiki/images/b/b2/html_book_20190607.zip \
|
||||||
${CMAKE_BINARY_DIR}/docs/cppreference.zip \
|
${CMAKE_BINARY_DIR}/docs/cppreference.zip \
|
||||||
EXPECTED_HASH MD5=bda585f72fbca4b817b29a3d5746567b \
|
EXPECTED_HASH MD5=82b3a612d7d35a83e3cb1195a63689ab \
|
||||||
)\n \
|
)\n \
|
||||||
execute_process( \
|
execute_process( \
|
||||||
COMMAND \"${CMAKE_COMMAND}\" -E tar -xf cppreference.zip \
|
COMMAND \"${CMAKE_COMMAND}\" -E tar -xf cppreference.zip \
|
||||||
|
|||||||
@@ -2,6 +2,16 @@
|
|||||||
convenience variables and sanity checks
|
convenience variables and sanity checks
|
||||||
#]===================================================================]
|
#]===================================================================]
|
||||||
|
|
||||||
|
include(ProcessorCount)
|
||||||
|
|
||||||
|
if (NOT ep_procs)
|
||||||
|
ProcessorCount(ep_procs)
|
||||||
|
if (ep_procs GREATER 1)
|
||||||
|
# never use more than half of cores for EP builds
|
||||||
|
math (EXPR ep_procs "${ep_procs} / 2")
|
||||||
|
message (STATUS "Using ${ep_procs} cores for ExternalProject builds.")
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
get_property(is_multiconfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
get_property(is_multiconfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||||
|
|
||||||
set (CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
|
set (CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ if(tests)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(unity "Creates a build using UNITY support in cmake." OFF)
|
option(unity "Creates a build using UNITY support in cmake. This is the default" ON)
|
||||||
if(unity)
|
if(unity)
|
||||||
if(NOT is_ci)
|
if(NOT is_ci)
|
||||||
set(CMAKE_UNITY_BUILD_BATCH_SIZE 15 CACHE STRING "")
|
set(CMAKE_UNITY_BUILD_BATCH_SIZE 15 CACHE STRING "")
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ find_package(Boost 1.82 REQUIRED
|
|||||||
COMPONENTS
|
COMPONENTS
|
||||||
chrono
|
chrono
|
||||||
container
|
container
|
||||||
|
context
|
||||||
coroutine
|
coroutine
|
||||||
date_time
|
date_time
|
||||||
filesystem
|
filesystem
|
||||||
@@ -23,7 +24,7 @@ endif()
|
|||||||
|
|
||||||
target_link_libraries(ripple_boost
|
target_link_libraries(ripple_boost
|
||||||
INTERFACE
|
INTERFACE
|
||||||
Boost::headers
|
Boost::boost
|
||||||
Boost::chrono
|
Boost::chrono
|
||||||
Boost::container
|
Boost::container
|
||||||
Boost::coroutine
|
Boost::coroutine
|
||||||
|
|||||||
@@ -1,41 +0,0 @@
|
|||||||
include(isolate_headers)
|
|
||||||
|
|
||||||
function(xrpl_add_test name)
|
|
||||||
set(target ${PROJECT_NAME}.test.${name})
|
|
||||||
|
|
||||||
file(GLOB_RECURSE sources CONFIGURE_DEPENDS
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/${name}/*.cpp"
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/${name}.cpp"
|
|
||||||
)
|
|
||||||
add_executable(${target} EXCLUDE_FROM_ALL ${ARGN} ${sources})
|
|
||||||
|
|
||||||
isolate_headers(
|
|
||||||
${target}
|
|
||||||
"${CMAKE_SOURCE_DIR}"
|
|
||||||
"${CMAKE_SOURCE_DIR}/tests/${name}"
|
|
||||||
PRIVATE
|
|
||||||
)
|
|
||||||
|
|
||||||
# Make sure the test isn't optimized away in unity builds
|
|
||||||
set_target_properties(${target} PROPERTIES
|
|
||||||
UNITY_BUILD_MODE GROUP
|
|
||||||
UNITY_BUILD_BATCH_SIZE 0) # Adjust as needed
|
|
||||||
|
|
||||||
add_test(NAME ${target} COMMAND ${target})
|
|
||||||
set_tests_properties(
|
|
||||||
${target} PROPERTIES
|
|
||||||
FIXTURES_REQUIRED ${target}_fixture
|
|
||||||
)
|
|
||||||
|
|
||||||
add_test(
|
|
||||||
NAME ${target}.build
|
|
||||||
COMMAND
|
|
||||||
${CMAKE_COMMAND}
|
|
||||||
--build ${CMAKE_BINARY_DIR}
|
|
||||||
--config $<CONFIG>
|
|
||||||
--target ${target}
|
|
||||||
)
|
|
||||||
set_tests_properties(${target}.build PROPERTIES
|
|
||||||
FIXTURES_SETUP ${target}_fixture
|
|
||||||
)
|
|
||||||
endfunction()
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
{% set os = detect_api.detect_os() %}
|
|
||||||
{% set arch = detect_api.detect_arch() %}
|
|
||||||
{% set compiler, version, compiler_exe = detect_api.detect_default_compiler() %}
|
|
||||||
{% set compiler_version = version %}
|
|
||||||
{% if os == "Linux" %}
|
|
||||||
{% set compiler_version = detect_api.default_compiler_version(compiler, version) %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
[settings]
|
|
||||||
os={{ os }}
|
|
||||||
arch={{ arch }}
|
|
||||||
build_type=Debug
|
|
||||||
compiler={{compiler}}
|
|
||||||
compiler.version={{ compiler_version }}
|
|
||||||
compiler.cppstd=20
|
|
||||||
{% if os == "Windows" %}
|
|
||||||
compiler.runtime=static
|
|
||||||
{% else %}
|
|
||||||
compiler.libcxx={{detect_api.detect_libcxx(compiler, version, compiler_exe)}}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
[conf]
|
|
||||||
{% if compiler == "clang" and compiler_version >= 19 %}
|
|
||||||
tools.build:cxxflags=['-Wno-missing-template-arg-list-after-template-kw']
|
|
||||||
{% endif %}
|
|
||||||
{% if compiler == "apple-clang" and compiler_version >= 17 %}
|
|
||||||
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 %}
|
|
||||||
{% if compiler == "gcc" and compiler_version < 13 %}
|
|
||||||
tools.build:cxxflags=['-Wno-restrict']
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
[tool_requires]
|
|
||||||
!cmake/*: cmake/[>=3 <4]
|
|
||||||
53
conanfile.py
53
conanfile.py
@@ -1,4 +1,4 @@
|
|||||||
from conan import ConanFile, __version__ as conan_version
|
from conan import ConanFile
|
||||||
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
|
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
|
||||||
import re
|
import re
|
||||||
|
|
||||||
@@ -24,20 +24,18 @@ class Xrpl(ConanFile):
|
|||||||
}
|
}
|
||||||
|
|
||||||
requires = [
|
requires = [
|
||||||
'grpc/1.72.0',
|
'date/3.0.3',
|
||||||
'libarchive/3.8.1',
|
'grpc/1.50.1',
|
||||||
'nudb/2.0.9',
|
'libarchive/3.7.6',
|
||||||
'openssl/1.1.1w',
|
'nudb/2.0.8',
|
||||||
|
'openssl/1.1.1v',
|
||||||
'soci/4.0.3',
|
'soci/4.0.3',
|
||||||
|
'xxhash/0.8.2',
|
||||||
'zlib/1.3.1',
|
'zlib/1.3.1',
|
||||||
]
|
]
|
||||||
|
|
||||||
test_requires = [
|
|
||||||
'doctest/2.4.11',
|
|
||||||
]
|
|
||||||
|
|
||||||
tool_requires = [
|
tool_requires = [
|
||||||
'protobuf/6.30.1',
|
'protobuf/3.21.9',
|
||||||
]
|
]
|
||||||
|
|
||||||
default_options = {
|
default_options = {
|
||||||
@@ -89,31 +87,26 @@ class Xrpl(ConanFile):
|
|||||||
}
|
}
|
||||||
|
|
||||||
def set_version(self):
|
def set_version(self):
|
||||||
if self.version is None:
|
path = f'{self.recipe_folder}/src/libxrpl/protocol/BuildInfo.cpp'
|
||||||
path = f'{self.recipe_folder}/src/libxrpl/protocol/BuildInfo.cpp'
|
regex = r'versionString\s?=\s?\"(.*)\"'
|
||||||
regex = r'versionString\s?=\s?\"(.*)\"'
|
with open(path, 'r') as file:
|
||||||
with open(path, encoding='utf-8') as file:
|
matches = (re.search(regex, line) for line in file)
|
||||||
matches = (re.search(regex, line) for line in file)
|
match = next(m for m in matches if m)
|
||||||
match = next(m for m in matches if m)
|
self.version = match.group(1)
|
||||||
self.version = match.group(1)
|
|
||||||
|
|
||||||
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'
|
||||||
|
|
||||||
def requirements(self):
|
def requirements(self):
|
||||||
# Conan 2 requires transitive headers to be specified
|
self.requires('boost/1.83.0', force=True)
|
||||||
transitive_headers_opt = {'transitive_headers': True} if conan_version.split('.')[0] == '2' else {}
|
|
||||||
self.requires('boost/1.83.0', force=True, **transitive_headers_opt)
|
|
||||||
self.requires('date/3.0.4', **transitive_headers_opt)
|
|
||||||
self.requires('lz4/1.10.0', force=True)
|
self.requires('lz4/1.10.0', force=True)
|
||||||
self.requires('protobuf/6.30.1', force=True)
|
self.requires('protobuf/3.21.9', force=True)
|
||||||
self.requires('sqlite3/3.49.1', force=True)
|
self.requires('sqlite3/3.47.0', force=True)
|
||||||
if self.options.jemalloc:
|
if self.options.jemalloc:
|
||||||
self.requires('jemalloc/5.3.0')
|
self.requires('jemalloc/5.3.0')
|
||||||
if self.options.rocksdb:
|
if self.options.rocksdb:
|
||||||
self.requires('rocksdb/9.7.3')
|
self.requires('rocksdb/9.7.3')
|
||||||
self.requires('xxhash/0.8.3', **transitive_headers_opt)
|
|
||||||
|
|
||||||
exports_sources = (
|
exports_sources = (
|
||||||
'CMakeLists.txt',
|
'CMakeLists.txt',
|
||||||
@@ -168,17 +161,7 @@ class Xrpl(ConanFile):
|
|||||||
# `include/`, not `include/ripple/proto/`.
|
# `include/`, not `include/ripple/proto/`.
|
||||||
libxrpl.includedirs = ['include', 'include/ripple/proto']
|
libxrpl.includedirs = ['include', 'include/ripple/proto']
|
||||||
libxrpl.requires = [
|
libxrpl.requires = [
|
||||||
'boost::headers',
|
'boost::boost',
|
||||||
'boost::chrono',
|
|
||||||
'boost::container',
|
|
||||||
'boost::coroutine',
|
|
||||||
'boost::date_time',
|
|
||||||
'boost::filesystem',
|
|
||||||
'boost::json',
|
|
||||||
'boost::program_options',
|
|
||||||
'boost::regex',
|
|
||||||
'boost::system',
|
|
||||||
'boost::thread',
|
|
||||||
'date::date',
|
'date::date',
|
||||||
'grpc::grpc++',
|
'grpc::grpc++',
|
||||||
'libarchive::libarchive',
|
'libarchive::libarchive',
|
||||||
|
|||||||
5
docs/build/environment.md
vendored
5
docs/build/environment.md
vendored
@@ -23,7 +23,7 @@ direction.
|
|||||||
|
|
||||||
```
|
```
|
||||||
apt update
|
apt update
|
||||||
apt install --yes curl git libssl-dev pipx python3.10-dev python3-pip make g++-11 libprotobuf-dev protobuf-compiler
|
apt install --yes curl git libssl-dev python3.10-dev python3-pip make g++-11 libprotobuf-dev protobuf-compiler
|
||||||
|
|
||||||
curl --location --remote-name \
|
curl --location --remote-name \
|
||||||
"https://github.com/Kitware/CMake/releases/download/v3.25.1/cmake-3.25.1.tar.gz"
|
"https://github.com/Kitware/CMake/releases/download/v3.25.1/cmake-3.25.1.tar.gz"
|
||||||
@@ -35,8 +35,7 @@ make --jobs $(nproc)
|
|||||||
make install
|
make install
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
pipx install 'conan<2'
|
pip3 install 'conan<2'
|
||||||
pipx ensurepath
|
|
||||||
```
|
```
|
||||||
|
|
||||||
[1]: https://github.com/thejohnfreeman/rippled-docker/blob/master/ubuntu-22.04/install.sh
|
[1]: https://github.com/thejohnfreeman/rippled-docker/blob/master/ubuntu-22.04/install.sh
|
||||||
|
|||||||
2
external/antithesis-sdk/CMakeLists.txt
vendored
2
external/antithesis-sdk/CMakeLists.txt
vendored
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.18)
|
cmake_minimum_required(VERSION 3.25)
|
||||||
|
|
||||||
# Note, version set explicitly by rippled project
|
# Note, version set explicitly by rippled project
|
||||||
project(antithesis-sdk-cpp VERSION 0.4.4 LANGUAGES CXX)
|
project(antithesis-sdk-cpp VERSION 0.4.4 LANGUAGES CXX)
|
||||||
|
|||||||
10
external/nudb/conandata.yml
vendored
Normal file
10
external/nudb/conandata.yml
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
sources:
|
||||||
|
"2.0.8":
|
||||||
|
url: "https://github.com/CPPAlliance/NuDB/archive/2.0.8.tar.gz"
|
||||||
|
sha256: "9b71903d8ba111cd893ab064b9a8b6ac4124ed8bd6b4f67250205bc43c7f13a8"
|
||||||
|
patches:
|
||||||
|
"2.0.8":
|
||||||
|
- patch_file: "patches/2.0.8-0001-add-include-stdexcept-for-msvc.patch"
|
||||||
|
patch_description: "Fix build for MSVC by including stdexcept"
|
||||||
|
patch_type: "portability"
|
||||||
|
patch_source: "https://github.com/cppalliance/NuDB/pull/100/files"
|
||||||
72
external/nudb/conanfile.py
vendored
Normal file
72
external/nudb/conanfile.py
vendored
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
from conan import ConanFile
|
||||||
|
from conan.tools.build import check_min_cppstd
|
||||||
|
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get
|
||||||
|
from conan.tools.layout import basic_layout
|
||||||
|
|
||||||
|
required_conan_version = ">=1.52.0"
|
||||||
|
|
||||||
|
|
||||||
|
class NudbConan(ConanFile):
|
||||||
|
name = "nudb"
|
||||||
|
description = "A fast key/value insert-only database for SSD drives in C++11"
|
||||||
|
license = "BSL-1.0"
|
||||||
|
url = "https://github.com/conan-io/conan-center-index"
|
||||||
|
homepage = "https://github.com/CPPAlliance/NuDB"
|
||||||
|
topics = ("header-only", "KVS", "insert-only")
|
||||||
|
|
||||||
|
package_type = "header-library"
|
||||||
|
settings = "os", "arch", "compiler", "build_type"
|
||||||
|
no_copy_source = True
|
||||||
|
|
||||||
|
@property
|
||||||
|
def _min_cppstd(self):
|
||||||
|
return 11
|
||||||
|
|
||||||
|
def export_sources(self):
|
||||||
|
export_conandata_patches(self)
|
||||||
|
|
||||||
|
def layout(self):
|
||||||
|
basic_layout(self, src_folder="src")
|
||||||
|
|
||||||
|
def requirements(self):
|
||||||
|
self.requires("boost/1.83.0")
|
||||||
|
|
||||||
|
def package_id(self):
|
||||||
|
self.info.clear()
|
||||||
|
|
||||||
|
def validate(self):
|
||||||
|
if self.settings.compiler.cppstd:
|
||||||
|
check_min_cppstd(self, self._min_cppstd)
|
||||||
|
|
||||||
|
def source(self):
|
||||||
|
get(self, **self.conan_data["sources"][self.version], strip_root=True)
|
||||||
|
|
||||||
|
def build(self):
|
||||||
|
apply_conandata_patches(self)
|
||||||
|
|
||||||
|
def package(self):
|
||||||
|
copy(self, "LICENSE*",
|
||||||
|
dst=os.path.join(self.package_folder, "licenses"),
|
||||||
|
src=self.source_folder)
|
||||||
|
copy(self, "*",
|
||||||
|
dst=os.path.join(self.package_folder, "include"),
|
||||||
|
src=os.path.join(self.source_folder, "include"))
|
||||||
|
|
||||||
|
def package_info(self):
|
||||||
|
self.cpp_info.bindirs = []
|
||||||
|
self.cpp_info.libdirs = []
|
||||||
|
|
||||||
|
self.cpp_info.set_property("cmake_target_name", "NuDB")
|
||||||
|
self.cpp_info.set_property("cmake_target_aliases", ["NuDB::nudb"])
|
||||||
|
self.cpp_info.set_property("cmake_find_mode", "both")
|
||||||
|
|
||||||
|
self.cpp_info.components["core"].set_property("cmake_target_name", "nudb")
|
||||||
|
self.cpp_info.components["core"].names["cmake_find_package"] = "nudb"
|
||||||
|
self.cpp_info.components["core"].names["cmake_find_package_multi"] = "nudb"
|
||||||
|
self.cpp_info.components["core"].requires = ["boost::thread", "boost::system"]
|
||||||
|
|
||||||
|
# TODO: to remove in conan v2 once cmake_find_package_* generators removed
|
||||||
|
self.cpp_info.names["cmake_find_package"] = "NuDB"
|
||||||
|
self.cpp_info.names["cmake_find_package_multi"] = "NuDB"
|
||||||
24
external/nudb/patches/2.0.8-0001-add-include-stdexcept-for-msvc.patch
vendored
Normal file
24
external/nudb/patches/2.0.8-0001-add-include-stdexcept-for-msvc.patch
vendored
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
diff --git a/include/nudb/detail/stream.hpp b/include/nudb/detail/stream.hpp
|
||||||
|
index 6c07bf1..e0ce8ed 100644
|
||||||
|
--- a/include/nudb/detail/stream.hpp
|
||||||
|
+++ b/include/nudb/detail/stream.hpp
|
||||||
|
@@ -14,6 +14,7 @@
|
||||||
|
#include <cstdint>
|
||||||
|
#include <cstring>
|
||||||
|
#include <memory>
|
||||||
|
+#include <stdexcept>
|
||||||
|
|
||||||
|
namespace nudb {
|
||||||
|
namespace detail {
|
||||||
|
diff --git a/include/nudb/impl/context.ipp b/include/nudb/impl/context.ipp
|
||||||
|
index beb7058..ffde0b3 100644
|
||||||
|
--- a/include/nudb/impl/context.ipp
|
||||||
|
+++ b/include/nudb/impl/context.ipp
|
||||||
|
@@ -9,6 +9,7 @@
|
||||||
|
#define NUDB_IMPL_CONTEXT_IPP
|
||||||
|
|
||||||
|
#include <nudb/detail/store_base.hpp>
|
||||||
|
+#include <stdexcept>
|
||||||
|
|
||||||
|
namespace nudb {
|
||||||
|
|
||||||
54
external/protobuf/conandata.yml
vendored
54
external/protobuf/conandata.yml
vendored
@@ -1,54 +0,0 @@
|
|||||||
sources:
|
|
||||||
"6.30.1":
|
|
||||||
url: "https://github.com/protocolbuffers/protobuf/archive/refs/tags/v6.30.1.tar.gz"
|
|
||||||
sha256: "c97cc064278ef2b8c4da66c1f85613642ecbd5a0c4217c0defdf7ad1b3de9fa5"
|
|
||||||
patches:
|
|
||||||
"6.30.1":
|
|
||||||
- patch_file: "patches/protobuf-6.30.1-change-empty-string.patch"
|
|
||||||
patch_description: "Change how we decide which empty string implementation to use"
|
|
||||||
patch_type: "backport"
|
|
||||||
patch_source: "https://github.com/protocolbuffers/protobuf/issues/20645"
|
|
||||||
- patch_file: "patches/protobuf-6.30.1-disable-fixed-string-MSVC.patch"
|
|
||||||
patch_description: "Disable the optimization for fixed_address_empty_string for MSVC"
|
|
||||||
patch_type: "backport"
|
|
||||||
patch_source: "https://github.com/protocolbuffers/protobuf/issues/21957"
|
|
||||||
absl_deps:
|
|
||||||
# reference: https://github.com/protocolbuffers/protobuf/blob/main/cmake/abseil-cpp.cmake
|
|
||||||
"6.30.1":
|
|
||||||
- absl_absl_check
|
|
||||||
- absl_absl_log
|
|
||||||
- absl_algorithm
|
|
||||||
- absl_base
|
|
||||||
- absl_bind_front
|
|
||||||
- absl_bits
|
|
||||||
- absl_btree
|
|
||||||
- absl_cleanup
|
|
||||||
- absl_cord
|
|
||||||
- absl_core_headers
|
|
||||||
- absl_debugging
|
|
||||||
- absl_die_if_null
|
|
||||||
- absl_dynamic_annotations
|
|
||||||
- absl_flags
|
|
||||||
- absl_flat_hash_map
|
|
||||||
- absl_flat_hash_set
|
|
||||||
- absl_function_ref
|
|
||||||
- absl_hash
|
|
||||||
- absl_layout
|
|
||||||
- absl_log_initialize
|
|
||||||
- absl_log_globals
|
|
||||||
- absl_log_severity
|
|
||||||
- absl_memory
|
|
||||||
- absl_node_hash_map
|
|
||||||
- absl_node_hash_set
|
|
||||||
- absl_optional
|
|
||||||
- absl_random_distributions
|
|
||||||
- absl_random_random
|
|
||||||
- absl_span
|
|
||||||
- absl_status
|
|
||||||
- absl_statusor
|
|
||||||
- absl_strings
|
|
||||||
- absl_synchronization
|
|
||||||
- absl_time
|
|
||||||
- absl_type_traits
|
|
||||||
- absl_utility
|
|
||||||
- absl_variant
|
|
||||||
330
external/protobuf/conanfile.py
vendored
330
external/protobuf/conanfile.py
vendored
@@ -1,330 +0,0 @@
|
|||||||
from conan import ConanFile
|
|
||||||
from conan.errors import ConanInvalidConfiguration
|
|
||||||
from conan.tools.apple import is_apple_os
|
|
||||||
from conan.tools.build import check_min_cppstd
|
|
||||||
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
|
|
||||||
from conan.tools.files import copy, rename, get, apply_conandata_patches, export_conandata_patches, replace_in_file, rmdir, rm, save
|
|
||||||
from conan.tools.microsoft import check_min_vs, msvc_runtime_flag, is_msvc, is_msvc_static_runtime
|
|
||||||
from conan.tools.scm import Version
|
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
required_conan_version = ">=1.53"
|
|
||||||
|
|
||||||
|
|
||||||
class ProtobufConan(ConanFile):
|
|
||||||
name = "protobuf"
|
|
||||||
description = "Protocol Buffers - Google's data interchange format"
|
|
||||||
topics = ("protocol-buffers", "protocol-compiler", "serialization", "rpc", "protocol-compiler")
|
|
||||||
url = "https://github.com/conan-io/conan-center-index"
|
|
||||||
homepage = "https://github.com/protocolbuffers/protobuf"
|
|
||||||
license = "BSD-3-Clause"
|
|
||||||
package_type = "library"
|
|
||||||
settings = "os", "arch", "compiler", "build_type"
|
|
||||||
options = {
|
|
||||||
"shared": [True, False],
|
|
||||||
"fPIC": [True, False],
|
|
||||||
"with_zlib": [True, False],
|
|
||||||
"with_rtti": [True, False],
|
|
||||||
"lite": [True, False],
|
|
||||||
"upb": [True, False],
|
|
||||||
"debug_suffix": [True, False],
|
|
||||||
}
|
|
||||||
default_options = {
|
|
||||||
"shared": False,
|
|
||||||
"fPIC": True,
|
|
||||||
"with_zlib": True,
|
|
||||||
"with_rtti": True,
|
|
||||||
"lite": False,
|
|
||||||
"upb": False,
|
|
||||||
"debug_suffix": True,
|
|
||||||
}
|
|
||||||
|
|
||||||
short_paths = True
|
|
||||||
|
|
||||||
@property
|
|
||||||
def _is_clang_cl(self):
|
|
||||||
return self.settings.compiler == "clang" and self.settings.os == "Windows"
|
|
||||||
|
|
||||||
@property
|
|
||||||
def _is_clang_x86(self):
|
|
||||||
return self.settings.compiler == "clang" and self.settings.arch == "x86"
|
|
||||||
|
|
||||||
@property
|
|
||||||
def _protobuf_release(self):
|
|
||||||
current_ver = Version(self.version)
|
|
||||||
return Version(f"{current_ver.minor}.{current_ver.patch}")
|
|
||||||
|
|
||||||
def export_sources(self):
|
|
||||||
export_conandata_patches(self)
|
|
||||||
copy(self, "protobuf-conan-protoc-target.cmake", self.recipe_folder, os.path.join(self.export_sources_folder, "src"))
|
|
||||||
|
|
||||||
def config_options(self):
|
|
||||||
if self.settings.os == "Windows":
|
|
||||||
del self.options.fPIC
|
|
||||||
|
|
||||||
def configure(self):
|
|
||||||
if self.options.shared:
|
|
||||||
self.options.rm_safe("fPIC")
|
|
||||||
|
|
||||||
if self._protobuf_release < "27.0":
|
|
||||||
self.options.rm_safe("upb")
|
|
||||||
|
|
||||||
def layout(self):
|
|
||||||
cmake_layout(self, src_folder="src")
|
|
||||||
|
|
||||||
def requirements(self):
|
|
||||||
if self.options.with_zlib:
|
|
||||||
self.requires("zlib/[>=1.2.11 <2]")
|
|
||||||
|
|
||||||
if self._protobuf_release >= "22.0":
|
|
||||||
self.requires("abseil/[>=20230802.1 <=20250127.0]", transitive_headers=True)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def _compilers_minimum_version(self):
|
|
||||||
return {
|
|
||||||
"gcc": "6",
|
|
||||||
"clang": "5",
|
|
||||||
"apple-clang": "10",
|
|
||||||
"Visual Studio": "15",
|
|
||||||
"msvc": "191",
|
|
||||||
}
|
|
||||||
|
|
||||||
def validate(self):
|
|
||||||
if self.options.shared and is_msvc_static_runtime(self):
|
|
||||||
raise ConanInvalidConfiguration("Protobuf can't be built with shared + MT(d) runtimes")
|
|
||||||
|
|
||||||
if is_msvc(self) and self._protobuf_release >= "22" and self.options.shared and \
|
|
||||||
not self.dependencies["abseil"].options.shared:
|
|
||||||
raise ConanInvalidConfiguration("When building protobuf as a shared library on Windows, "
|
|
||||||
"abseil needs to be a shared library too")
|
|
||||||
if self._protobuf_release >= "30.1":
|
|
||||||
check_min_cppstd(self, 17)
|
|
||||||
elif self._protobuf_release >= "22.0":
|
|
||||||
if self.settings.compiler.get_safe("cppstd"):
|
|
||||||
check_min_cppstd(self, 14)
|
|
||||||
else:
|
|
||||||
minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), None)
|
|
||||||
compiler_version = Version(self.settings.compiler.version)
|
|
||||||
if minimum_version and compiler_version < minimum_version:
|
|
||||||
raise ConanInvalidConfiguration(
|
|
||||||
f"{self.ref} requires C++14, which your compiler does not support.",
|
|
||||||
)
|
|
||||||
|
|
||||||
check_min_vs(self, "190")
|
|
||||||
|
|
||||||
if self.settings.compiler == "clang":
|
|
||||||
if Version(self.settings.compiler.version) < "4":
|
|
||||||
raise ConanInvalidConfiguration(f"{self.ref} doesn't support clang < 4")
|
|
||||||
|
|
||||||
if "abseil" in self.dependencies.host:
|
|
||||||
abseil_cppstd = self.dependencies.host['abseil'].info.settings.compiler.cppstd
|
|
||||||
if abseil_cppstd != self.settings.compiler.cppstd:
|
|
||||||
raise ConanInvalidConfiguration(f"Protobuf and abseil must be built with the same compiler.cppstd setting")
|
|
||||||
|
|
||||||
def source(self):
|
|
||||||
get(self, **self.conan_data["sources"][self.version], strip_root=True)
|
|
||||||
|
|
||||||
def build_requirements(self):
|
|
||||||
if self._protobuf_release >= "30.1":
|
|
||||||
self.tool_requires("cmake/[>=3.16 <4]")
|
|
||||||
|
|
||||||
@property
|
|
||||||
def _cmake_install_base_path(self):
|
|
||||||
return os.path.join("lib", "cmake", "protobuf")
|
|
||||||
|
|
||||||
def generate(self):
|
|
||||||
tc = CMakeToolchain(self)
|
|
||||||
if self._protobuf_release >= "30.1":
|
|
||||||
tc.cache_variables["protobuf_LOCAL_DEPENDENCIES_ONLY"] = True
|
|
||||||
tc.cache_variables["CMAKE_INSTALL_CMAKEDIR"] = self._cmake_install_base_path.replace("\\", "/")
|
|
||||||
tc.cache_variables["protobuf_WITH_ZLIB"] = self.options.with_zlib
|
|
||||||
tc.cache_variables["protobuf_BUILD_TESTS"] = False
|
|
||||||
tc.cache_variables["protobuf_BUILD_PROTOC_BINARIES"] = self.settings.os != "tvOS"
|
|
||||||
if not self.options.debug_suffix:
|
|
||||||
tc.cache_variables["protobuf_DEBUG_POSTFIX"] = ""
|
|
||||||
tc.cache_variables["protobuf_BUILD_LIBPROTOC"] = self.settings.os != "tvOS"
|
|
||||||
tc.cache_variables["protobuf_DISABLE_RTTI"] = not self.options.with_rtti
|
|
||||||
tc.cache_variables["protobuf_BUILD_LIBUPB"] = self.options.get_safe("upb")
|
|
||||||
if self._protobuf_release >= "22.0":
|
|
||||||
tc.cache_variables["protobuf_ABSL_PROVIDER"] = "package"
|
|
||||||
if not self.settings.compiler.get_safe("cppstd") and self._protobuf_release >= "22.0":
|
|
||||||
tc.variables["CMAKE_CXX_STANDARD"] = 14
|
|
||||||
if is_msvc(self) or self._is_clang_cl:
|
|
||||||
runtime = self.settings.get_safe("compiler.runtime")
|
|
||||||
if runtime:
|
|
||||||
tc.cache_variables["protobuf_MSVC_STATIC_RUNTIME"] = runtime == "static"
|
|
||||||
if is_apple_os(self) and self.options.shared:
|
|
||||||
# Workaround against SIP on macOS for consumers while invoking protoc when protobuf lib is shared
|
|
||||||
tc.variables["CMAKE_INSTALL_RPATH"] = "@loader_path/../lib"
|
|
||||||
|
|
||||||
if self.settings.os == "Linux":
|
|
||||||
# Use RPATH instead of RUNPATH to help with specific case
|
|
||||||
# in the grpc recipe when grpc_cpp_plugin is run with protoc
|
|
||||||
# in the same build. RPATH ensures that the rpath in the binary
|
|
||||||
# is respected for transitive dependencies too
|
|
||||||
project_include = os.path.join(self.generators_folder, "protobuf_project_include.cmake")
|
|
||||||
save(self, project_include, "add_link_options(-Wl,--disable-new-dtags)")
|
|
||||||
tc.variables["CMAKE_PROJECT_INCLUDE"] = project_include
|
|
||||||
# Note: conan2 only could be:
|
|
||||||
# tc.extra_exelinkflags.append("-Wl,--disable-new-dtags")
|
|
||||||
# tc.extra_sharedlinkflags.append("-Wl,--disable-new-dtags")
|
|
||||||
|
|
||||||
tc.generate()
|
|
||||||
|
|
||||||
deps = CMakeDeps(self)
|
|
||||||
deps.generate()
|
|
||||||
|
|
||||||
def _patch_sources(self):
|
|
||||||
apply_conandata_patches(self)
|
|
||||||
|
|
||||||
if self._protobuf_release < "22.0":
|
|
||||||
# In older versions of protobuf, this file defines the `protobuf_generate` function
|
|
||||||
protobuf_config_cmake = os.path.join(self.source_folder, "cmake", "protobuf-config.cmake.in")
|
|
||||||
replace_in_file(self, protobuf_config_cmake, "@_protobuf_FIND_ZLIB@", "")
|
|
||||||
replace_in_file(self, protobuf_config_cmake,
|
|
||||||
"include(\"${CMAKE_CURRENT_LIST_DIR}/protobuf-targets.cmake\")",
|
|
||||||
""
|
|
||||||
)
|
|
||||||
|
|
||||||
# Disable a potential warning in protobuf-module.cmake.in
|
|
||||||
# TODO: remove this patch? Is it really useful?
|
|
||||||
protobuf_module_cmake = os.path.join(self.source_folder, "cmake", "protobuf-module.cmake.in")
|
|
||||||
replace_in_file(self,
|
|
||||||
protobuf_module_cmake,
|
|
||||||
"if(DEFINED Protobuf_SRC_ROOT_FOLDER)",
|
|
||||||
"if(0)\nif(DEFINED Protobuf_SRC_ROOT_FOLDER)",
|
|
||||||
)
|
|
||||||
replace_in_file(self,
|
|
||||||
protobuf_module_cmake,
|
|
||||||
"# Define upper case versions of output variables",
|
|
||||||
"endif()",
|
|
||||||
)
|
|
||||||
|
|
||||||
def build(self):
|
|
||||||
self._patch_sources()
|
|
||||||
cmake = CMake(self)
|
|
||||||
cmake_root = "cmake" if Version(self.version) < "3.21" else None
|
|
||||||
cmake.configure(build_script_folder=cmake_root)
|
|
||||||
cmake.build()
|
|
||||||
|
|
||||||
def package(self):
|
|
||||||
copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
|
|
||||||
cmake = CMake(self)
|
|
||||||
cmake.install()
|
|
||||||
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
|
|
||||||
rmdir(self, os.path.join(self.package_folder, "lib", "cmake", "utf8_range"))
|
|
||||||
if self._protobuf_release < "22.0":
|
|
||||||
rename(self, os.path.join(self.package_folder, self._cmake_install_base_path, "protobuf-config.cmake"),
|
|
||||||
os.path.join(self.package_folder, self._cmake_install_base_path, "protobuf-generate.cmake"))
|
|
||||||
|
|
||||||
cmake_config_folder = os.path.join(self.package_folder, self._cmake_install_base_path)
|
|
||||||
rm(self, "protobuf-config*.cmake", folder=cmake_config_folder)
|
|
||||||
rm(self, "protobuf-targets*.cmake", folder=cmake_config_folder)
|
|
||||||
copy(self, "protobuf-conan-protoc-target.cmake", src=self.source_folder, dst=cmake_config_folder)
|
|
||||||
|
|
||||||
if not self.options.lite:
|
|
||||||
rm(self, "libprotobuf-lite*", os.path.join(self.package_folder, "lib"))
|
|
||||||
rm(self, "libprotobuf-lite*", os.path.join(self.package_folder, "bin"))
|
|
||||||
|
|
||||||
def package_info(self):
|
|
||||||
self.cpp_info.set_property("cmake_find_mode", "both")
|
|
||||||
self.cpp_info.set_property("cmake_module_file_name", "Protobuf")
|
|
||||||
self.cpp_info.set_property("cmake_file_name", "protobuf")
|
|
||||||
self.cpp_info.set_property("pkg_config_name", "protobuf_full_package") # unofficial, but required to avoid side effects (libprotobuf component "steals" the default global pkg_config name)
|
|
||||||
|
|
||||||
build_modules = [
|
|
||||||
os.path.join(self._cmake_install_base_path, "protobuf-generate.cmake"),
|
|
||||||
os.path.join(self._cmake_install_base_path, "protobuf-module.cmake"),
|
|
||||||
os.path.join(self._cmake_install_base_path, "protobuf-options.cmake"),
|
|
||||||
os.path.join(self._cmake_install_base_path, "protobuf-conan-protoc-target.cmake"),
|
|
||||||
]
|
|
||||||
self.cpp_info.set_property("cmake_build_modules", build_modules)
|
|
||||||
|
|
||||||
lib_prefix = "lib" if (is_msvc(self) or self._is_clang_cl) else ""
|
|
||||||
lib_suffix = "d" if self.settings.build_type == "Debug" and self.options.debug_suffix else ""
|
|
||||||
|
|
||||||
if self._protobuf_release >= "22.0":
|
|
||||||
absl_deps = [f"abseil::{c}" for c in self.conan_data["absl_deps"][self.version]]
|
|
||||||
|
|
||||||
if self._protobuf_release >= "22.0" and (not self.options.shared or self.options.get_safe("upb")):
|
|
||||||
# utf8 libraries
|
|
||||||
# it's a private dependency and unconditionally built as a static library, should only
|
|
||||||
# be exposed when protobuf itself is static (or if upb is being built)
|
|
||||||
self.cpp_info.components["utf8_range"].set_property("cmake_target_name", "utf8_range::utf8_range")
|
|
||||||
self.cpp_info.components["utf8_validity"].set_property("cmake_target_name", "utf8_range::utf8_validity")
|
|
||||||
# https://github.com/protocolbuffers/protobuf/blob/0d815c5b74281f081c1ee4b431a4d5bbb1615c97/third_party/utf8_range/CMakeLists.txt#L24
|
|
||||||
if self._protobuf_release >= "30.1" and self.settings.os == "Windows":
|
|
||||||
self.cpp_info.components["utf8_range"].libs = ["libutf8_range"]
|
|
||||||
self.cpp_info.components["utf8_validity"].libs = ["libutf8_validity"]
|
|
||||||
else:
|
|
||||||
self.cpp_info.components["utf8_range"].libs = ["utf8_range"]
|
|
||||||
self.cpp_info.components["utf8_validity"].libs = ["utf8_validity"]
|
|
||||||
self.cpp_info.components["utf8_validity"].requires = ["abseil::absl_strings"]
|
|
||||||
|
|
||||||
if self.options.get_safe("upb"):
|
|
||||||
# upb libraries: note that these are unconditionally static
|
|
||||||
self.cpp_info.components["upb"].set_property("cmake_target_name", "protobuf::libupb")
|
|
||||||
self.cpp_info.components["upb"].libs = [lib_prefix + "upb" + lib_suffix]
|
|
||||||
self.cpp_info.components["upb"].requires = ["utf8_range"]
|
|
||||||
|
|
||||||
# libprotobuf
|
|
||||||
self.cpp_info.components["libprotobuf"].set_property("cmake_target_name", "protobuf::libprotobuf")
|
|
||||||
self.cpp_info.components["libprotobuf"].set_property("pkg_config_name", "protobuf")
|
|
||||||
self.cpp_info.components["libprotobuf"].builddirs.append(self._cmake_install_base_path)
|
|
||||||
self.cpp_info.components["libprotobuf"].libs = [lib_prefix + "protobuf" + lib_suffix]
|
|
||||||
if self.options.with_zlib:
|
|
||||||
self.cpp_info.components["libprotobuf"].requires = ["zlib::zlib"]
|
|
||||||
if self._protobuf_release >= "22.0":
|
|
||||||
self.cpp_info.components["libprotobuf"].requires.extend(absl_deps)
|
|
||||||
if not self.options.shared:
|
|
||||||
self.cpp_info.components["libprotobuf"].requires.extend(["utf8_validity"])
|
|
||||||
|
|
||||||
if self.settings.os in ["Linux", "FreeBSD"]:
|
|
||||||
self.cpp_info.components["libprotobuf"].system_libs.extend(["m", "pthread"])
|
|
||||||
if self._is_clang_x86 or "arm" in str(self.settings.arch):
|
|
||||||
self.cpp_info.components["libprotobuf"].system_libs.append("atomic")
|
|
||||||
if self.settings.os == "Android":
|
|
||||||
self.cpp_info.components["libprotobuf"].system_libs.append("log")
|
|
||||||
if self.settings.os == "Windows":
|
|
||||||
if self.options.shared:
|
|
||||||
self.cpp_info.components["libprotobuf"].defines = ["PROTOBUF_USE_DLLS"]
|
|
||||||
|
|
||||||
# libprotoc
|
|
||||||
if self.settings.os != "tvOS":
|
|
||||||
self.cpp_info.components["libprotoc"].set_property("cmake_target_name", "protobuf::libprotoc")
|
|
||||||
self.cpp_info.components["libprotoc"].libs = [lib_prefix + "protoc" + lib_suffix]
|
|
||||||
self.cpp_info.components["libprotoc"].requires = ["libprotobuf"]
|
|
||||||
if self._protobuf_release >= "22.0":
|
|
||||||
self.cpp_info.components["libprotoc"].requires.extend(absl_deps)
|
|
||||||
|
|
||||||
# libprotobuf-lite
|
|
||||||
if self.options.lite:
|
|
||||||
self.cpp_info.components["libprotobuf-lite"].set_property("cmake_target_name", "protobuf::libprotobuf-lite")
|
|
||||||
self.cpp_info.components["libprotobuf-lite"].set_property("pkg_config_name", "protobuf-lite")
|
|
||||||
self.cpp_info.components["libprotobuf-lite"].builddirs.append(self._cmake_install_base_path)
|
|
||||||
self.cpp_info.components["libprotobuf-lite"].libs = [lib_prefix + "protobuf-lite" + lib_suffix]
|
|
||||||
if self.settings.os in ["Linux", "FreeBSD"]:
|
|
||||||
self.cpp_info.components["libprotobuf-lite"].system_libs.extend(["m", "pthread"])
|
|
||||||
if self._is_clang_x86 or "arm" in str(self.settings.arch):
|
|
||||||
self.cpp_info.components["libprotobuf-lite"].system_libs.append("atomic")
|
|
||||||
if self.settings.os == "Windows":
|
|
||||||
if self.options.shared:
|
|
||||||
self.cpp_info.components["libprotobuf-lite"].defines = ["PROTOBUF_USE_DLLS"]
|
|
||||||
if self.settings.os == "Android":
|
|
||||||
self.cpp_info.components["libprotobuf-lite"].system_libs.append("log")
|
|
||||||
if self._protobuf_release >= "22.0":
|
|
||||||
self.cpp_info.components["libprotobuf-lite"].requires.extend(absl_deps)
|
|
||||||
if not self.options.shared:
|
|
||||||
self.cpp_info.components["libprotobuf-lite"].requires.extend(["utf8_validity"])
|
|
||||||
|
|
||||||
# TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed
|
|
||||||
self.cpp_info.filenames["cmake_find_package"] = "Protobuf"
|
|
||||||
self.cpp_info.filenames["cmake_find_package_multi"] = "protobuf"
|
|
||||||
self.cpp_info.names["pkg_config"] ="protobuf_full_package"
|
|
||||||
for generator in ["cmake_find_package", "cmake_find_package_multi"]:
|
|
||||||
self.cpp_info.components["libprotobuf"].build_modules[generator] = build_modules
|
|
||||||
if self.options.lite:
|
|
||||||
for generator in ["cmake_find_package", "cmake_find_package_multi"]:
|
|
||||||
self.cpp_info.components["libprotobuf-lite"].build_modules[generator] = build_modules
|
|
||||||
self.env_info.PATH.append(os.path.join(self.package_folder, "bin"))
|
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
diff --git a/src/google/protobuf/port.cc b/src/google/protobuf/port.cc
|
|
||||||
index af668e9e2..d60c2b89f 100644
|
|
||||||
--- a/src/google/protobuf/port.cc
|
|
||||||
+++ b/src/google/protobuf/port.cc
|
|
||||||
@@ -97,14 +97,9 @@ void RealDebugCounter::Register(absl::string_view name) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
-#if defined(__cpp_lib_constexpr_string) && __cpp_lib_constexpr_string >= 201907L
|
|
||||||
-PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT const GlobalEmptyString
|
|
||||||
- fixed_address_empty_string{};
|
|
||||||
-#else
|
|
||||||
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT
|
|
||||||
PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 GlobalEmptyString
|
|
||||||
fixed_address_empty_string{};
|
|
||||||
-#endif
|
|
||||||
|
|
||||||
} // namespace internal
|
|
||||||
} // namespace protobuf
|
|
||||||
diff --git a/src/google/protobuf/port.h b/src/google/protobuf/port.h
|
|
||||||
index 5f9e909a0..386ecc02a 100644
|
|
||||||
--- a/src/google/protobuf/port.h
|
|
||||||
+++ b/src/google/protobuf/port.h
|
|
||||||
@@ -494,20 +494,27 @@ class NoopDebugCounter {
|
|
||||||
// Default empty string object. Don't use this directly. Instead, call
|
|
||||||
// GetEmptyString() to get the reference. This empty string is aligned with a
|
|
||||||
// minimum alignment of 8 bytes to match the requirement of ArenaStringPtr.
|
|
||||||
-#if defined(__cpp_lib_constexpr_string) && __cpp_lib_constexpr_string >= 201907L
|
|
||||||
+
|
|
||||||
// Take advantage of C++20 constexpr support in std::string.
|
|
||||||
-class alignas(8) GlobalEmptyString {
|
|
||||||
+class alignas(8) GlobalEmptyStringConstexpr {
|
|
||||||
public:
|
|
||||||
const std::string& get() const { return value_; }
|
|
||||||
// Nothing to init, or destroy.
|
|
||||||
std::string* Init() const { return nullptr; }
|
|
||||||
|
|
||||||
+ template <typename T = std::string, bool = (T(), true)>
|
|
||||||
+ static constexpr std::true_type HasConstexprDefaultConstructor(int) {
|
|
||||||
+ return {};
|
|
||||||
+ }
|
|
||||||
+ static constexpr std::false_type HasConstexprDefaultConstructor(char) {
|
|
||||||
+ return {};
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
private:
|
|
||||||
std::string value_;
|
|
||||||
};
|
|
||||||
-PROTOBUF_EXPORT extern const GlobalEmptyString fixed_address_empty_string;
|
|
||||||
-#else
|
|
||||||
-class alignas(8) GlobalEmptyString {
|
|
||||||
+
|
|
||||||
+class alignas(8) GlobalEmptyStringDynamicInit {
|
|
||||||
public:
|
|
||||||
const std::string& get() const {
|
|
||||||
return *reinterpret_cast<const std::string*>(internal::Launder(buffer_));
|
|
||||||
@@ -519,8 +526,12 @@ class alignas(8) GlobalEmptyString {
|
|
||||||
private:
|
|
||||||
alignas(std::string) char buffer_[sizeof(std::string)];
|
|
||||||
};
|
|
||||||
+
|
|
||||||
+using GlobalEmptyString = std::conditional_t<
|
|
||||||
+ GlobalEmptyStringConstexpr::HasConstexprDefaultConstructor(0),
|
|
||||||
+ const GlobalEmptyStringConstexpr, GlobalEmptyStringDynamicInit>;
|
|
||||||
+
|
|
||||||
PROTOBUF_EXPORT extern GlobalEmptyString fixed_address_empty_string;
|
|
||||||
-#endif
|
|
||||||
|
|
||||||
} // namespace internal
|
|
||||||
} // namespace protobuf
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
diff --git a/src/google/protobuf/port.h b/src/google/protobuf/port.h
|
|
||||||
index 386ecc02a..32d260c42 100644
|
|
||||||
--- a/src/google/protobuf/port.h
|
|
||||||
+++ b/src/google/protobuf/port.h
|
|
||||||
@@ -502,10 +502,16 @@ class alignas(8) GlobalEmptyStringConstexpr {
|
|
||||||
// Nothing to init, or destroy.
|
|
||||||
std::string* Init() const { return nullptr; }
|
|
||||||
|
|
||||||
+ // Disable the optimization for MSVC.
|
|
||||||
+ // There are some builds where the default constructed string can't be used as
|
|
||||||
+ // `constinit` even though the constructor is `constexpr` and can be used
|
|
||||||
+ // during constant evaluation.
|
|
||||||
+#if !defined(_MSC_VER)
|
|
||||||
template <typename T = std::string, bool = (T(), true)>
|
|
||||||
static constexpr std::true_type HasConstexprDefaultConstructor(int) {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
+#endif
|
|
||||||
static constexpr std::false_type HasConstexprDefaultConstructor(char) {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
if(NOT TARGET protobuf::protoc)
|
|
||||||
# Locate protoc executable
|
|
||||||
## Workaround for legacy "cmake" generator in case of cross-build
|
|
||||||
if(CMAKE_CROSSCOMPILING)
|
|
||||||
find_program(PROTOC_PROGRAM NAMES protoc PATHS ENV PATH NO_DEFAULT_PATH)
|
|
||||||
endif()
|
|
||||||
## And here this will work fine with "CMakeToolchain" (for native & cross-build)
|
|
||||||
## and legacy "cmake" generator in case of native build
|
|
||||||
if(NOT PROTOC_PROGRAM)
|
|
||||||
find_program(PROTOC_PROGRAM NAMES protoc)
|
|
||||||
endif()
|
|
||||||
## Last resort: we search in package folder directly
|
|
||||||
if(NOT PROTOC_PROGRAM)
|
|
||||||
set(PROTOC_PROGRAM "${CMAKE_CURRENT_LIST_DIR}/../../../bin/protoc${CMAKE_EXECUTABLE_SUFFIX}")
|
|
||||||
endif()
|
|
||||||
get_filename_component(PROTOC_PROGRAM "${PROTOC_PROGRAM}" ABSOLUTE)
|
|
||||||
|
|
||||||
# Give opportunity to users to provide an external protoc executable
|
|
||||||
# (this is a feature of official FindProtobuf.cmake)
|
|
||||||
set(Protobuf_PROTOC_EXECUTABLE ${PROTOC_PROGRAM} CACHE FILEPATH "The protoc compiler")
|
|
||||||
|
|
||||||
# Create executable imported target protobuf::protoc
|
|
||||||
add_executable(protobuf::protoc IMPORTED)
|
|
||||||
set_property(TARGET protobuf::protoc PROPERTY IMPORTED_LOCATION ${Protobuf_PROTOC_EXECUTABLE})
|
|
||||||
endif()
|
|
||||||
28
external/protobuf/test_package/CMakeLists.txt
vendored
28
external/protobuf/test_package/CMakeLists.txt
vendored
@@ -1,28 +0,0 @@
|
|||||||
cmake_minimum_required(VERSION 3.15)
|
|
||||||
|
|
||||||
project(test_package LANGUAGES CXX)
|
|
||||||
|
|
||||||
find_package(protobuf CONFIG REQUIRED)
|
|
||||||
|
|
||||||
add_executable(${PROJECT_NAME} test_package.cpp)
|
|
||||||
|
|
||||||
if(CONAN_TEST_USE_CXXSTD_14)
|
|
||||||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14)
|
|
||||||
else()
|
|
||||||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (protobuf_LITE)
|
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE protobuf::libprotobuf-lite)
|
|
||||||
target_compile_definitions(${PROJECT_NAME} PRIVATE CONANTEST_PROTOBUF_LITE=1)
|
|
||||||
else()
|
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE protobuf::libprotobuf)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT TARGET protobuf::protoc)
|
|
||||||
message(FATAL_ERROR "protoc executable should have been defined as part of find_package(protobuf)")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT COMMAND protobuf_generate)
|
|
||||||
message(FATAL_ERROR "protobuf_generate should have been defined as part of find_package(protobuf)")
|
|
||||||
endif()
|
|
||||||
64
external/protobuf/test_package/addressbook.proto
vendored
64
external/protobuf/test_package/addressbook.proto
vendored
@@ -1,64 +0,0 @@
|
|||||||
// See README.txt for information and build instructions.
|
|
||||||
//
|
|
||||||
// Note: START and END tags are used in comments to define sections used in
|
|
||||||
// tutorials. They are not part of the syntax for Protocol Buffers.
|
|
||||||
//
|
|
||||||
// To get an in-depth walkthrough of this file and the related examples, see:
|
|
||||||
// https://developers.google.com/protocol-buffers/docs/tutorials
|
|
||||||
|
|
||||||
// [START declaration]
|
|
||||||
syntax = "proto3";
|
|
||||||
package tutorial;
|
|
||||||
|
|
||||||
import "google/protobuf/timestamp.proto";
|
|
||||||
// [END declaration]
|
|
||||||
|
|
||||||
// [START java_declaration]
|
|
||||||
option java_package = "com.example.tutorial";
|
|
||||||
option java_outer_classname = "AddressBookProtos";
|
|
||||||
// [END java_declaration]
|
|
||||||
|
|
||||||
// [START csharp_declaration]
|
|
||||||
option csharp_namespace = "Google.Protobuf.Examples.AddressBook";
|
|
||||||
// [END csharp_declaration]
|
|
||||||
|
|
||||||
// [START messages]
|
|
||||||
message Person {
|
|
||||||
string name = 1;
|
|
||||||
int32 id = 2; // Unique ID number for this person.
|
|
||||||
string email = 3;
|
|
||||||
|
|
||||||
enum PhoneType {
|
|
||||||
MOBILE = 0;
|
|
||||||
HOME = 1;
|
|
||||||
WORK = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message PhoneNumber {
|
|
||||||
string number = 1;
|
|
||||||
PhoneType type = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
repeated PhoneNumber phones = 4;
|
|
||||||
|
|
||||||
google.protobuf.Timestamp last_updated = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Our address book file is just one of these.
|
|
||||||
message AddressBook {
|
|
||||||
repeated Person people = 1;
|
|
||||||
}
|
|
||||||
// [END messages]
|
|
||||||
|
|
||||||
// Artibrary message with a GID type, to cause
|
|
||||||
// the .pb.h file to define `GID_MAX`, which
|
|
||||||
// may conflict with a macro defined by system
|
|
||||||
// headers on macOS.
|
|
||||||
message FooBar {
|
|
||||||
enum GID {
|
|
||||||
FOO = 0;
|
|
||||||
}
|
|
||||||
enum UID {
|
|
||||||
BAR = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
40
external/protobuf/test_package/conanfile.py
vendored
40
external/protobuf/test_package/conanfile.py
vendored
@@ -1,40 +0,0 @@
|
|||||||
from conan import ConanFile
|
|
||||||
from conan.tools.build import can_run
|
|
||||||
from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain
|
|
||||||
from conan.tools.scm import Version
|
|
||||||
import os
|
|
||||||
|
|
||||||
|
|
||||||
class TestPackageConan(ConanFile):
|
|
||||||
settings = "os", "arch", "compiler", "build_type"
|
|
||||||
generators = "CMakeDeps", "VirtualBuildEnv", "VirtualRunEnv"
|
|
||||||
test_type = "explicit"
|
|
||||||
|
|
||||||
def layout(self):
|
|
||||||
cmake_layout(self)
|
|
||||||
|
|
||||||
def requirements(self):
|
|
||||||
# note `run=True` so that the runenv can find protoc
|
|
||||||
self.requires(self.tested_reference_str, run=True)
|
|
||||||
|
|
||||||
def generate(self):
|
|
||||||
tc = CMakeToolchain(self)
|
|
||||||
tc.cache_variables["protobuf_LITE"] = self.dependencies[self.tested_reference_str].options.lite
|
|
||||||
protobuf_version = Version(self.dependencies[self.tested_reference_str].ref.version)
|
|
||||||
tc.cache_variables["CONAN_TEST_USE_CXXSTD_14"] = protobuf_version >= "3.22"
|
|
||||||
tc.generate()
|
|
||||||
|
|
||||||
def build(self):
|
|
||||||
cmake = CMake(self)
|
|
||||||
cmake.configure()
|
|
||||||
cmake.build()
|
|
||||||
|
|
||||||
def test(self):
|
|
||||||
if can_run(self):
|
|
||||||
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package")
|
|
||||||
self.run(bin_path, env="conanrun")
|
|
||||||
|
|
||||||
# Invoke protoc in the same way CMake would
|
|
||||||
self.run(f"protoc --proto_path={self.source_folder} --cpp_out={self.build_folder} {self.source_folder}/addressbook.proto", env="conanrun")
|
|
||||||
assert os.path.exists(os.path.join(self.build_folder,"addressbook.pb.cc"))
|
|
||||||
assert os.path.exists(os.path.join(self.build_folder,"addressbook.pb.h"))
|
|
||||||
23
external/protobuf/test_package/test_package.cpp
vendored
23
external/protobuf/test_package/test_package.cpp
vendored
@@ -1,23 +0,0 @@
|
|||||||
#include <cstdlib>
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
#if !defined(CONANTEST_PROTOBUF_LITE)
|
|
||||||
#include <google/protobuf/timestamp.pb.h>
|
|
||||||
#include <google/protobuf/util/time_util.h>
|
|
||||||
#else
|
|
||||||
#include <google/protobuf/message_lite.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
|
|
||||||
#if !defined(CONANTEST_PROTOBUF_LITE)
|
|
||||||
google::protobuf::Timestamp ts;
|
|
||||||
google::protobuf::util::TimeUtil::FromString("1972-01-01T10:00:20.021Z", &ts);
|
|
||||||
const auto nanoseconds = ts.nanos();
|
|
||||||
std::cout << "1972-01-01T10:00:20.021Z in nanoseconds: " << nanoseconds << "\n";
|
|
||||||
#else
|
|
||||||
google::protobuf::ShutdownProtobufLibrary();
|
|
||||||
#endif
|
|
||||||
return EXIT_SUCCESS;
|
|
||||||
}
|
|
||||||
@@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
|
|||||||
@@ -22,18 +22,8 @@
|
|||||||
|
|
||||||
#include <xrpl/basics/contract.h>
|
#include <xrpl/basics/contract.h>
|
||||||
|
|
||||||
#if defined(__clang__)
|
|
||||||
#pragma clang diagnostic push
|
|
||||||
#pragma clang diagnostic ignored "-Wdeprecated"
|
|
||||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <boost/outcome.hpp>
|
#include <boost/outcome.hpp>
|
||||||
|
|
||||||
#if defined(__clang__)
|
|
||||||
#pragma clang diagnostic pop
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
#include <array>
|
#include <array>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#ifndef RIPPLE_ALGORITHM_H_INCLUDED
|
#ifndef RIPPLE_ALGORITHM_H_INCLUDED
|
||||||
#define RIPPLE_ALGORITHM_H_INCLUDED
|
#define RIPPLE_ALGORITHM_H_INCLUDED
|
||||||
|
|
||||||
|
#include <iterator>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|||||||
@@ -24,8 +24,12 @@
|
|||||||
#include <xrpl/beast/hash/xxhasher.h>
|
#include <xrpl/beast/hash/xxhasher.h>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <functional>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <random>
|
#include <random>
|
||||||
|
#include <type_traits>
|
||||||
|
#include <unordered_map>
|
||||||
|
#include <unordered_set>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
auto constexpr muldiv_max = std::numeric_limits<std::uint64_t>::max();
|
auto constexpr muldiv_max = std::numeric_limits<std::uint64_t>::max();
|
||||||
|
|||||||
@@ -24,8 +24,10 @@
|
|||||||
|
|
||||||
#include <boost/operators.hpp>
|
#include <boost/operators.hpp>
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,9 @@
|
|||||||
#ifndef BEAST_CHRONO_ABSTRACT_CLOCK_H_INCLUDED
|
#ifndef BEAST_CHRONO_ABSTRACT_CLOCK_H_INCLUDED
|
||||||
#define BEAST_CHRONO_ABSTRACT_CLOCK_H_INCLUDED
|
#define BEAST_CHRONO_ABSTRACT_CLOCK_H_INCLUDED
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
|
|
||||||
/** Abstract interface to a clock.
|
/** Abstract interface to a clock.
|
||||||
|
|||||||
@@ -23,8 +23,6 @@
|
|||||||
#include <xrpl/beast/clock/abstract_clock.h>
|
#include <xrpl/beast/clock/abstract_clock.h>
|
||||||
#include <xrpl/beast/utility/instrumentation.h>
|
#include <xrpl/beast/utility/instrumentation.h>
|
||||||
|
|
||||||
#include <chrono>
|
|
||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
|
|
||||||
/** Manual clock implementation.
|
/** Manual clock implementation.
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
|
|
||||||
#include <xrpl/beast/container/aged_container.h>
|
#include <xrpl/beast/container/aged_container.h>
|
||||||
|
|
||||||
#include <chrono>
|
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
|
|||||||
@@ -20,6 +20,8 @@
|
|||||||
#ifndef BEAST_CONTAINER_DETAIL_AGED_ASSOCIATIVE_CONTAINER_H_INCLUDED
|
#ifndef BEAST_CONTAINER_DETAIL_AGED_ASSOCIATIVE_CONTAINER_H_INCLUDED
|
||||||
#define BEAST_CONTAINER_DETAIL_AGED_ASSOCIATIVE_CONTAINER_H_INCLUDED
|
#define BEAST_CONTAINER_DETAIL_AGED_ASSOCIATIVE_CONTAINER_H_INCLUDED
|
||||||
|
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <initializer_list>
|
#include <initializer_list>
|
||||||
|
#include <iterator>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|||||||
120
include/xrpl/beast/core/FunctionProfiler.h
Normal file
120
include/xrpl/beast/core/FunctionProfiler.h
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
|
||||||
|
#ifndef RIPPLE_BASICS_FUNCTIONPROFILER_H_INCLUDED
|
||||||
|
#define RIPPLE_BASICS_FUNCTIONPROFILER_H_INCLUDED
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
|
#include <csignal>
|
||||||
|
#include <mutex>
|
||||||
|
#include <source_location>
|
||||||
|
#include <sstream>
|
||||||
|
#include <string>
|
||||||
|
#include <unordered_map>
|
||||||
|
#include <vector>
|
||||||
|
#include <cmath>
|
||||||
|
#include <numeric> // std::accumulate
|
||||||
|
|
||||||
|
#define PROFILING 1
|
||||||
|
|
||||||
|
#if PROFILING && (defined(__x86_64__) || defined(_M_X64))
|
||||||
|
#include <x86intrin.h>
|
||||||
|
#else
|
||||||
|
#define __rdtsc() 0
|
||||||
|
#endif
|
||||||
|
namespace beast {
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
double compute_stddev(const std::vector<T>& samples) {
|
||||||
|
if (samples.size() < 2) return 0.0;
|
||||||
|
|
||||||
|
double mean = std::accumulate(samples.begin(), samples.end(), 0.0) / samples.size();
|
||||||
|
double sum_sq = 0.0;
|
||||||
|
|
||||||
|
for (double x : samples) {
|
||||||
|
sum_sq += (x - mean) * (x - mean);
|
||||||
|
}
|
||||||
|
|
||||||
|
return std::sqrt(sum_sq / (samples.size() - 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
logProfilingResults();
|
||||||
|
|
||||||
|
class FunctionProfiler
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
std::string functionName;
|
||||||
|
std::chrono::steady_clock::time_point start;
|
||||||
|
std::uint64_t cpuCycleStart;
|
||||||
|
inline static std::mutex mutex_;
|
||||||
|
|
||||||
|
struct StatisticData
|
||||||
|
{
|
||||||
|
std::vector<std::chrono::nanoseconds> time;
|
||||||
|
std::vector<std::uint64_t> cpuCycles;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline static std::unordered_map<
|
||||||
|
std::string,
|
||||||
|
StatisticData>
|
||||||
|
funcionDurations;
|
||||||
|
FunctionProfiler(
|
||||||
|
std::string const& tag,
|
||||||
|
std::source_location location = std::source_location::current())
|
||||||
|
#if PROFILING
|
||||||
|
: functionName(location.function_name() + tag)
|
||||||
|
, start(std::chrono::steady_clock::now())
|
||||||
|
, cpuCycleStart(__rdtsc())
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
~FunctionProfiler() noexcept
|
||||||
|
{
|
||||||
|
#if PROFILING
|
||||||
|
auto duration = std::chrono::steady_clock::now() - start;
|
||||||
|
std::lock_guard<std::mutex> lock{mutex_};
|
||||||
|
funcionDurations[functionName].time.emplace_back(duration);
|
||||||
|
funcionDurations[functionName].cpuCycles.emplace_back((__rdtsc() - cpuCycleStart));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
inline std::string
|
||||||
|
getProfilingResults()
|
||||||
|
{
|
||||||
|
#if PROFILING
|
||||||
|
std::lock_guard<std::mutex> lock{FunctionProfiler::mutex_};
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << "Function profiling results:" << std::endl;
|
||||||
|
ss << "name,time,cpu cycles,count,average time(ns),time standard deviation,average cpu cycles,cpu cycles standard deviation" << std::endl;
|
||||||
|
for (auto const& [name, duration] : FunctionProfiler::funcionDurations)
|
||||||
|
{
|
||||||
|
std::vector<std::int64_t> times;
|
||||||
|
times.reserve(duration.time.size());
|
||||||
|
|
||||||
|
std::transform(std::begin(duration.time), std::end(duration.time), std::back_inserter(times), [](const std::chrono::nanoseconds& time) {
|
||||||
|
return static_cast<std::int64_t>(time.count());
|
||||||
|
});
|
||||||
|
|
||||||
|
auto timeInTotal = std::accumulate(std::begin(times), std::end(times), std::int64_t{0});
|
||||||
|
auto cpuCyclesInTotal = std::accumulate(std::begin(duration.cpuCycles), std::end(duration.cpuCycles), std::int64_t{0});
|
||||||
|
|
||||||
|
ss << name << "," << timeInTotal << ","
|
||||||
|
<< cpuCyclesInTotal << ","
|
||||||
|
<< duration.time.size() << ","
|
||||||
|
<< timeInTotal / (double)duration.time.size() << ","
|
||||||
|
<< compute_stddev(times) << ","
|
||||||
|
<< cpuCyclesInTotal / (double)duration.cpuCycles.size() << ","
|
||||||
|
<< compute_stddev(duration.cpuCycles)
|
||||||
|
<< std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ss.str();
|
||||||
|
#else
|
||||||
|
return "";
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace beast
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -29,9 +29,11 @@
|
|||||||
#include <charconv>
|
#include <charconv>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
|
#include <limits>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
|
|
||||||
|
|||||||
@@ -24,36 +24,14 @@
|
|||||||
#include <boost/container/flat_set.hpp>
|
#include <boost/container/flat_set.hpp>
|
||||||
#include <boost/endian/conversion.hpp>
|
#include <boost/endian/conversion.hpp>
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
Workaround for overzealous clang warning, which trips on libstdc++ headers
|
|
||||||
|
|
||||||
In file included from
|
|
||||||
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_algo.h:61:
|
|
||||||
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_tempbuf.h:263:8:
|
|
||||||
error: 'get_temporary_buffer<std::pair<ripple::Quality, const
|
|
||||||
std::vector<std::unique_ptr<ripple::Step>> *>>' is deprecated
|
|
||||||
[-Werror,-Wdeprecated-declarations] 263 |
|
|
||||||
std::get_temporary_buffer<value_type>(_M_original_len));
|
|
||||||
^
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if defined(__clang__)
|
|
||||||
#pragma clang diagnostic push
|
|
||||||
#pragma clang diagnostic ignored "-Wdeprecated"
|
|
||||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <functional>
|
|
||||||
|
|
||||||
#if defined(__clang__)
|
|
||||||
#pragma clang diagnostic pop
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
#include <cstdint>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <functional>
|
||||||
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <system_error>
|
#include <system_error>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace beast {
|
|||||||
template <class Hasher = xxhasher>
|
template <class Hasher = xxhasher>
|
||||||
struct uhash
|
struct uhash
|
||||||
{
|
{
|
||||||
uhash() = default;
|
explicit uhash() = default;
|
||||||
|
|
||||||
using result_type = typename Hasher::result_type;
|
using result_type = typename Hasher::result_type;
|
||||||
|
|
||||||
|
|||||||
@@ -20,24 +20,48 @@
|
|||||||
#ifndef BEAST_HASH_XXHASHER_H_INCLUDED
|
#ifndef BEAST_HASH_XXHASHER_H_INCLUDED
|
||||||
#define BEAST_HASH_XXHASHER_H_INCLUDED
|
#define BEAST_HASH_XXHASHER_H_INCLUDED
|
||||||
|
|
||||||
|
#include <xrpl/beast/core/FunctionProfiler.h>
|
||||||
|
|
||||||
#include <boost/endian/conversion.hpp>
|
#include <boost/endian/conversion.hpp>
|
||||||
|
|
||||||
#include <xxhash.h>
|
#include <xxhash.h>
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
#include <iostream>
|
||||||
#include <new>
|
#include <new>
|
||||||
|
#include <span>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
|
#define ORIGINAL_HASH 1
|
||||||
|
#define BIT_SHIFT_HASH 0
|
||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
|
|
||||||
class xxhasher
|
class xxhasher
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
using HashType = std::size_t;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// requires 64-bit std::size_t
|
// requires 64-bit std::size_t
|
||||||
static_assert(sizeof(std::size_t) == 8, "");
|
static_assert(sizeof(std::size_t) == 8, "");
|
||||||
|
|
||||||
|
#if ORIGINAL_HASH
|
||||||
XXH3_state_t* state_;
|
XXH3_state_t* state_;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if PROFILING
|
||||||
|
std::size_t totalSize_ = 0;
|
||||||
|
std::chrono::nanoseconds duration_{};
|
||||||
|
std::uint64_t cpuCycles = 0;
|
||||||
|
#endif
|
||||||
|
XXH64_hash_t seed_ = 0;
|
||||||
|
|
||||||
|
std::array<std::uint8_t, 40> buffer_;
|
||||||
|
std::span<std::uint8_t> readBuffer_;
|
||||||
|
std::span<std::uint8_t> writeBuffer_;
|
||||||
|
|
||||||
|
#if ORIGINAL_HASH
|
||||||
static XXH3_state_t*
|
static XXH3_state_t*
|
||||||
allocState()
|
allocState()
|
||||||
{
|
{
|
||||||
@@ -46,6 +70,24 @@ private:
|
|||||||
throw std::bad_alloc();
|
throw std::bad_alloc();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void
|
||||||
|
setupBuffers()
|
||||||
|
{
|
||||||
|
writeBuffer_ = std::span{buffer_};
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
writeBuffer(void const* data, std::size_t len)
|
||||||
|
{
|
||||||
|
auto bytesToWrite = std::min(len, writeBuffer_.size());
|
||||||
|
|
||||||
|
std::memcpy(writeBuffer_.data(), data, bytesToWrite);
|
||||||
|
writeBuffer_ = writeBuffer_.subspan(bytesToWrite);
|
||||||
|
readBuffer_ = std::span{
|
||||||
|
std::begin(buffer_), buffer_.size() - writeBuffer_.size()};
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using result_type = std::size_t;
|
using result_type = std::size_t;
|
||||||
@@ -58,22 +100,48 @@ public:
|
|||||||
|
|
||||||
xxhasher()
|
xxhasher()
|
||||||
{
|
{
|
||||||
|
#if PROFILING
|
||||||
|
auto start = std::chrono::steady_clock::now();
|
||||||
|
auto cpuCyclesStart = __rdtsc();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ORIGINAL_HASH
|
||||||
state_ = allocState();
|
state_ = allocState();
|
||||||
XXH3_64bits_reset(state_);
|
XXH3_64bits_reset(state_);
|
||||||
|
#else
|
||||||
|
setupBuffers();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if PROFILING
|
||||||
|
duration_ += std::chrono::steady_clock::now() - start;
|
||||||
|
cpuCycles += (__rdtsc() - cpuCyclesStart);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if ORIGINAL_HASH
|
||||||
~xxhasher() noexcept
|
~xxhasher() noexcept
|
||||||
{
|
{
|
||||||
XXH3_freeState(state_);
|
XXH3_freeState(state_);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
template <
|
template <
|
||||||
class Seed,
|
class Seed,
|
||||||
std::enable_if_t<std::is_unsigned<Seed>::value>* = nullptr>
|
std::enable_if_t<std::is_unsigned<Seed>::value>* = nullptr>
|
||||||
explicit xxhasher(Seed seed)
|
explicit xxhasher(Seed seed)
|
||||||
{
|
{
|
||||||
|
seed_ = seed;
|
||||||
|
|
||||||
|
|
||||||
|
#if ORIGINAL_HASH
|
||||||
|
auto start = std::chrono::steady_clock::now();
|
||||||
|
auto cpuCyclesStart = __rdtsc();
|
||||||
state_ = allocState();
|
state_ = allocState();
|
||||||
XXH3_64bits_reset_withSeed(state_, seed);
|
XXH3_64bits_reset_withSeed(state_, seed);
|
||||||
|
duration_ += (std::chrono::steady_clock::now() - start);
|
||||||
|
cpuCycles += (__rdtsc() - cpuCyclesStart);
|
||||||
|
#else
|
||||||
|
setupBuffers();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template <
|
template <
|
||||||
@@ -81,20 +149,92 @@ public:
|
|||||||
std::enable_if_t<std::is_unsigned<Seed>::value>* = nullptr>
|
std::enable_if_t<std::is_unsigned<Seed>::value>* = nullptr>
|
||||||
xxhasher(Seed seed, Seed)
|
xxhasher(Seed seed, Seed)
|
||||||
{
|
{
|
||||||
|
#if PROFILING
|
||||||
|
auto start = std::chrono::steady_clock::now();
|
||||||
|
auto cpuCyclesStart = __rdtsc();
|
||||||
|
#endif
|
||||||
|
seed_ = seed;
|
||||||
|
|
||||||
|
#if ORIGINAL_HASH
|
||||||
state_ = allocState();
|
state_ = allocState();
|
||||||
XXH3_64bits_reset_withSeed(state_, seed);
|
XXH3_64bits_reset_withSeed(state_, seed);
|
||||||
|
#else
|
||||||
|
setupBuffers();
|
||||||
|
#endif
|
||||||
|
#if PROFILING
|
||||||
|
duration_ += (std::chrono::steady_clock::now() - start);
|
||||||
|
cpuCycles += (__rdtsc() - cpuCyclesStart);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
operator()(void const* key, std::size_t len) noexcept
|
operator()(void const* key, std::size_t len) noexcept
|
||||||
{
|
{
|
||||||
|
#if PROFILING
|
||||||
|
totalSize_ += len;
|
||||||
|
auto start = std::chrono::steady_clock::now();
|
||||||
|
auto cpuCyclesStart = __rdtsc();
|
||||||
|
#endif
|
||||||
|
#if ORIGINAL_HASH
|
||||||
XXH3_64bits_update(state_, key, len);
|
XXH3_64bits_update(state_, key, len);
|
||||||
|
#else
|
||||||
|
writeBuffer(key, len);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if PROFILING
|
||||||
|
duration_ += (std::chrono::steady_clock::now() - start);
|
||||||
|
cpuCycles += (__rdtsc() - cpuCyclesStart);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit
|
explicit
|
||||||
operator std::size_t() noexcept
|
operator HashType() noexcept
|
||||||
{
|
{
|
||||||
return XXH3_64bits_digest(state_);
|
#if ORIGINAL_HASH == 0
|
||||||
|
if (readBuffer_.size() == 0) return 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if PROFILING
|
||||||
|
auto start = std::chrono::steady_clock::now();
|
||||||
|
auto cpuCyclesStart = __rdtsc();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if BIT_SHIFT_HASH
|
||||||
|
const size_t bit_width = readBuffer_.size() * 8;
|
||||||
|
const size_t shift = seed_ % bit_width;
|
||||||
|
|
||||||
|
// Copy input into a buffer long enough to safely extract 64 bits with wraparound
|
||||||
|
std::uint64_t buffer = 0;
|
||||||
|
|
||||||
|
// Load the first 8 bytes (or wrap if input < 8 bytes)
|
||||||
|
for (size_t i = 0; i < 8; ++i) {
|
||||||
|
size_t index = readBuffer_.size() - 1 - (i % readBuffer_.size());
|
||||||
|
buffer <<= 8;
|
||||||
|
buffer |= readBuffer_[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rotate and return
|
||||||
|
auto result = (buffer << shift) | (buffer >> (64 - shift));
|
||||||
|
#elif ORIGINAL_HASH
|
||||||
|
auto result = XXH3_64bits_digest(state_);
|
||||||
|
#else
|
||||||
|
auto result = seed_ == 0 ?
|
||||||
|
XXH3_64bits(readBuffer_.data(), readBuffer_.size()) :
|
||||||
|
XXH3_64bits_withSeed(readBuffer_.data(), readBuffer_.size(), seed_);
|
||||||
|
#endif
|
||||||
|
#if PROFILING
|
||||||
|
duration_ += (std::chrono::steady_clock::now() - start);
|
||||||
|
cpuCycles += (__rdtsc() - cpuCyclesStart);
|
||||||
|
|
||||||
|
std::lock_guard<std::mutex> lock{FunctionProfiler::mutex_};
|
||||||
|
FunctionProfiler::funcionDurations
|
||||||
|
["xxhasher-" + std::to_string(totalSize_)]
|
||||||
|
.time.emplace_back(duration_);
|
||||||
|
FunctionProfiler::funcionDurations
|
||||||
|
["xxhasher-" + std::to_string(totalSize_)]
|
||||||
|
.cpuCycles.emplace_back(cpuCycles);
|
||||||
|
#endif
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,11 @@
|
|||||||
#include <boost/asio/ip/address.hpp>
|
#include <boost/asio/ip/address.hpp>
|
||||||
#include <boost/functional/hash.hpp>
|
#include <boost/functional/hash.hpp>
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <ios>
|
||||||
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <typeinfo>
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,12 @@
|
|||||||
|
|
||||||
#include <boost/asio/ip/address_v4.hpp>
|
#include <boost/asio/ip/address_v4.hpp>
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <functional>
|
||||||
|
#include <ios>
|
||||||
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
namespace IP {
|
namespace IP {
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,12 @@
|
|||||||
|
|
||||||
#include <boost/asio/ip/address_v6.hpp>
|
#include <boost/asio/ip/address_v6.hpp>
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <functional>
|
||||||
|
#include <ios>
|
||||||
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
namespace IP {
|
namespace IP {
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
#include <xrpl/beast/net/IPAddress.h>
|
#include <xrpl/beast/net/IPAddress.h>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <ios>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@@ -214,7 +215,7 @@ namespace std {
|
|||||||
template <>
|
template <>
|
||||||
struct hash<::beast::IP::Endpoint>
|
struct hash<::beast::IP::Endpoint>
|
||||||
{
|
{
|
||||||
hash() = default;
|
explicit hash() = default;
|
||||||
|
|
||||||
std::size_t
|
std::size_t
|
||||||
operator()(::beast::IP::Endpoint const& endpoint) const
|
operator()(::beast::IP::Endpoint const& endpoint) const
|
||||||
@@ -229,7 +230,7 @@ namespace boost {
|
|||||||
template <>
|
template <>
|
||||||
struct hash<::beast::IP::Endpoint>
|
struct hash<::beast::IP::Endpoint>
|
||||||
{
|
{
|
||||||
hash() = default;
|
explicit hash() = default;
|
||||||
|
|
||||||
std::size_t
|
std::size_t
|
||||||
operator()(::beast::IP::Endpoint const& endpoint) const
|
operator()(::beast::IP::Endpoint const& endpoint) const
|
||||||
|
|||||||
@@ -28,8 +28,10 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
#include <cstdint>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include <boost/optional.hpp>
|
#include <boost/optional.hpp>
|
||||||
|
|
||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
|
#include <functional>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
#include <functional>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
#include <ostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
|
|||||||
@@ -31,28 +31,36 @@ namespace beast {
|
|||||||
|
|
||||||
template <class Generator>
|
template <class Generator>
|
||||||
void
|
void
|
||||||
rngfill(void* const buffer, std::size_t const bytes, Generator& g)
|
rngfill(void* buffer, std::size_t bytes, Generator& g)
|
||||||
{
|
{
|
||||||
using result_type = typename Generator::result_type;
|
using result_type = typename Generator::result_type;
|
||||||
constexpr std::size_t result_size = sizeof(result_type);
|
|
||||||
|
|
||||||
std::uint8_t* const buffer_start = static_cast<std::uint8_t*>(buffer);
|
while (bytes >= sizeof(result_type))
|
||||||
std::size_t const complete_iterations = bytes / result_size;
|
|
||||||
std::size_t const bytes_remaining = bytes % result_size;
|
|
||||||
|
|
||||||
for (std::size_t count = 0; count < complete_iterations; ++count)
|
|
||||||
{
|
{
|
||||||
result_type const v = g();
|
auto const v = g();
|
||||||
std::size_t const offset = count * result_size;
|
std::memcpy(buffer, &v, sizeof(v));
|
||||||
std::memcpy(buffer_start + offset, &v, result_size);
|
buffer = reinterpret_cast<std::uint8_t*>(buffer) + sizeof(v);
|
||||||
|
bytes -= sizeof(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bytes_remaining > 0)
|
XRPL_ASSERT(
|
||||||
|
bytes < sizeof(result_type), "beast::rngfill(void*) : maximum bytes");
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
// gcc 11.1 (falsely) warns about an array-bounds overflow in release mode.
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Warray-bounds"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (bytes > 0)
|
||||||
{
|
{
|
||||||
result_type const v = g();
|
auto const v = g();
|
||||||
std::size_t const offset = complete_iterations * result_size;
|
std::memcpy(buffer, &v, bytes);
|
||||||
std::memcpy(buffer_start + offset, &v, bytes_remaining);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template <
|
template <
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
#ifndef RIPPLE_JSON_JSON_VALUE_H_INCLUDED
|
#ifndef RIPPLE_JSON_JSON_VALUE_H_INCLUDED
|
||||||
#define RIPPLE_JSON_JSON_VALUE_H_INCLUDED
|
#define RIPPLE_JSON_JSON_VALUE_H_INCLUDED
|
||||||
|
|
||||||
#include <xrpl/basics/Number.h>
|
|
||||||
#include <xrpl/json/json_forwards.h>
|
#include <xrpl/json/json_forwards.h>
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
@@ -217,7 +216,6 @@ public:
|
|||||||
Value(UInt value);
|
Value(UInt value);
|
||||||
Value(double value);
|
Value(double value);
|
||||||
Value(char const* value);
|
Value(char const* value);
|
||||||
Value(ripple::Number const& value);
|
|
||||||
/** \brief Constructs a value from a static string.
|
/** \brief Constructs a value from a static string.
|
||||||
|
|
||||||
* Like other value string constructor but do not duplicate the string for
|
* Like other value string constructor but do not duplicate the string for
|
||||||
@@ -367,8 +365,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
Value&
|
Value&
|
||||||
operator[](StaticString const& key);
|
operator[](StaticString const& key);
|
||||||
Value const&
|
|
||||||
operator[](StaticString const& key) const;
|
|
||||||
|
|
||||||
/// Return the member named key if it exist, defaultValue otherwise.
|
/// Return the member named key if it exist, defaultValue otherwise.
|
||||||
Value
|
Value
|
||||||
@@ -440,12 +436,6 @@ private:
|
|||||||
int allocated_ : 1; // Notes: if declared as bool, bitfield is useless.
|
int allocated_ : 1; // Notes: if declared as bool, bitfield is useless.
|
||||||
};
|
};
|
||||||
|
|
||||||
inline Value
|
|
||||||
to_json(ripple::Number const& number)
|
|
||||||
{
|
|
||||||
return to_string(number);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
operator==(Value const&, Value const&);
|
operator==(Value const&, Value const&);
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,14 @@ class STObject;
|
|||||||
class STAmount;
|
class STAmount;
|
||||||
class Rules;
|
class Rules;
|
||||||
|
|
||||||
|
/** Calculate AMM account ID.
|
||||||
|
*/
|
||||||
|
AccountID
|
||||||
|
ammAccountID(
|
||||||
|
std::uint16_t prefix,
|
||||||
|
uint256 const& parentHash,
|
||||||
|
uint256 const& ammID);
|
||||||
|
|
||||||
/** Calculate Liquidity Provider Token (LPT) Currency.
|
/** Calculate Liquidity Provider Token (LPT) Currency.
|
||||||
*/
|
*/
|
||||||
Currency
|
Currency
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
#include <xrpl/protocol/json_get_or_throw.h>
|
#include <xrpl/protocol/json_get_or_throw.h>
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
#include <mutex>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@@ -148,7 +149,7 @@ namespace std {
|
|||||||
template <>
|
template <>
|
||||||
struct hash<ripple::AccountID> : ripple::AccountID::hasher
|
struct hash<ripple::AccountID> : ripple::AccountID::hasher
|
||||||
{
|
{
|
||||||
hash() = default;
|
explicit hash() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace std
|
} // namespace std
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#ifndef RIPPLE_PROTOCOL_APIVERSION_H_INCLUDED
|
#ifndef RIPPLE_PROTOCOL_APIVERSION_H_INCLUDED
|
||||||
#define RIPPLE_PROTOCOL_APIVERSION_H_INCLUDED
|
#define RIPPLE_PROTOCOL_APIVERSION_H_INCLUDED
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
#ifndef RIPPLE_PROTOCOL_ASSET_H_INCLUDED
|
#ifndef RIPPLE_PROTOCOL_ASSET_H_INCLUDED
|
||||||
#define RIPPLE_PROTOCOL_ASSET_H_INCLUDED
|
#define RIPPLE_PROTOCOL_ASSET_H_INCLUDED
|
||||||
|
|
||||||
#include <xrpl/basics/Number.h>
|
|
||||||
#include <xrpl/basics/base_uint.h>
|
#include <xrpl/basics/base_uint.h>
|
||||||
#include <xrpl/protocol/Issue.h>
|
#include <xrpl/protocol/Issue.h>
|
||||||
#include <xrpl/protocol/MPTIssue.h>
|
#include <xrpl/protocol/MPTIssue.h>
|
||||||
@@ -28,7 +27,6 @@
|
|||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
class Asset;
|
class Asset;
|
||||||
class STAmount;
|
|
||||||
|
|
||||||
template <typename TIss>
|
template <typename TIss>
|
||||||
concept ValidIssueType =
|
concept ValidIssueType =
|
||||||
@@ -94,9 +92,6 @@ public:
|
|||||||
void
|
void
|
||||||
setJson(Json::Value& jv) const;
|
setJson(Json::Value& jv) const;
|
||||||
|
|
||||||
STAmount
|
|
||||||
operator()(Number const&) const;
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
native() const
|
native() const
|
||||||
{
|
{
|
||||||
@@ -119,14 +114,6 @@ public:
|
|||||||
equalTokens(Asset const& lhs, Asset const& rhs);
|
equalTokens(Asset const& lhs, Asset const& rhs);
|
||||||
};
|
};
|
||||||
|
|
||||||
inline Json::Value
|
|
||||||
to_json(Asset const& asset)
|
|
||||||
{
|
|
||||||
Json::Value jv;
|
|
||||||
asset.setJson(jv);
|
|
||||||
return jv;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <ValidIssueType TIss>
|
template <ValidIssueType TIss>
|
||||||
constexpr bool
|
constexpr bool
|
||||||
Asset::holds() const
|
Asset::holds() const
|
||||||
@@ -232,6 +219,9 @@ validJSONAsset(Json::Value const& jv);
|
|||||||
Asset
|
Asset
|
||||||
assetFromJson(Json::Value const& jv);
|
assetFromJson(Json::Value const& jv);
|
||||||
|
|
||||||
|
Json::Value
|
||||||
|
to_json(Asset const& asset);
|
||||||
|
|
||||||
} // namespace ripple
|
} // namespace ripple
|
||||||
|
|
||||||
#endif // RIPPLE_PROTOCOL_ASSET_H_INCLUDED
|
#endif // RIPPLE_PROTOCOL_ASSET_H_INCLUDED
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of rippled: https://github.com/ripple/rippled
|
|
||||||
Copyright (c) 2024 Ripple Labs Inc.
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
#include <xrpl/protocol/HashPrefix.h>
|
|
||||||
#include <xrpl/protocol/STVector256.h>
|
|
||||||
#include <xrpl/protocol/Serializer.h>
|
|
||||||
|
|
||||||
namespace ripple {
|
|
||||||
|
|
||||||
inline void
|
|
||||||
serializeBatch(
|
|
||||||
Serializer& msg,
|
|
||||||
std::uint32_t const& flags,
|
|
||||||
std::vector<uint256> const& txids)
|
|
||||||
{
|
|
||||||
msg.add32(HashPrefix::batch);
|
|
||||||
msg.add32(flags);
|
|
||||||
msg.add32(std::uint32_t(txids.size()));
|
|
||||||
for (auto const& txid : txids)
|
|
||||||
msg.addBitString(txid);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ripple
|
|
||||||
@@ -21,7 +21,6 @@
|
|||||||
#define RIPPLE_PROTOCOL_BOOK_H_INCLUDED
|
#define RIPPLE_PROTOCOL_BOOK_H_INCLUDED
|
||||||
|
|
||||||
#include <xrpl/basics/CountedObject.h>
|
#include <xrpl/basics/CountedObject.h>
|
||||||
#include <xrpl/basics/base_uint.h>
|
|
||||||
#include <xrpl/protocol/Issue.h>
|
#include <xrpl/protocol/Issue.h>
|
||||||
|
|
||||||
#include <boost/utility/base_from_member.hpp>
|
#include <boost/utility/base_from_member.hpp>
|
||||||
@@ -37,17 +36,12 @@ class Book final : public CountedObject<Book>
|
|||||||
public:
|
public:
|
||||||
Issue in;
|
Issue in;
|
||||||
Issue out;
|
Issue out;
|
||||||
std::optional<uint256> domain;
|
|
||||||
|
|
||||||
Book()
|
Book()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Book(
|
Book(Issue const& in_, Issue const& out_) : in(in_), out(out_)
|
||||||
Issue const& in_,
|
|
||||||
Issue const& out_,
|
|
||||||
std::optional<uint256> const& domain_)
|
|
||||||
: in(in_), out(out_), domain(domain_)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -67,8 +61,6 @@ hash_append(Hasher& h, Book const& b)
|
|||||||
{
|
{
|
||||||
using beast::hash_append;
|
using beast::hash_append;
|
||||||
hash_append(h, b.in, b.out);
|
hash_append(h, b.in, b.out);
|
||||||
if (b.domain)
|
|
||||||
hash_append(h, *(b.domain));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Book
|
Book
|
||||||
@@ -79,8 +71,7 @@ reversed(Book const& book);
|
|||||||
[[nodiscard]] inline constexpr bool
|
[[nodiscard]] inline constexpr bool
|
||||||
operator==(Book const& lhs, Book const& rhs)
|
operator==(Book const& lhs, Book const& rhs)
|
||||||
{
|
{
|
||||||
return (lhs.in == rhs.in) && (lhs.out == rhs.out) &&
|
return (lhs.in == rhs.in) && (lhs.out == rhs.out);
|
||||||
(lhs.domain == rhs.domain);
|
|
||||||
}
|
}
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
@@ -91,18 +82,7 @@ operator<=>(Book const& lhs, Book const& rhs)
|
|||||||
{
|
{
|
||||||
if (auto const c{lhs.in <=> rhs.in}; c != 0)
|
if (auto const c{lhs.in <=> rhs.in}; c != 0)
|
||||||
return c;
|
return c;
|
||||||
if (auto const c{lhs.out <=> rhs.out}; c != 0)
|
return lhs.out <=> rhs.out;
|
||||||
return c;
|
|
||||||
|
|
||||||
// Manually compare optionals
|
|
||||||
if (lhs.domain && rhs.domain)
|
|
||||||
return *lhs.domain <=> *rhs.domain; // Compare values if both exist
|
|
||||||
if (!lhs.domain && rhs.domain)
|
|
||||||
return std::weak_ordering::less; // Empty is considered less
|
|
||||||
if (lhs.domain && !rhs.domain)
|
|
||||||
return std::weak_ordering::greater; // Non-empty is greater
|
|
||||||
|
|
||||||
return std::weak_ordering::equivalent; // Both are empty
|
|
||||||
}
|
}
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
@@ -124,7 +104,7 @@ private:
|
|||||||
boost::base_from_member<std::hash<ripple::AccountID>, 1>;
|
boost::base_from_member<std::hash<ripple::AccountID>, 1>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
hash() = default;
|
explicit hash() = default;
|
||||||
|
|
||||||
using value_type = std::size_t;
|
using value_type = std::size_t;
|
||||||
using argument_type = ripple::Issue;
|
using argument_type = ripple::Issue;
|
||||||
@@ -146,14 +126,12 @@ template <>
|
|||||||
struct hash<ripple::Book>
|
struct hash<ripple::Book>
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
using issue_hasher = std::hash<ripple::Issue>;
|
using hasher = std::hash<ripple::Issue>;
|
||||||
using uint256_hasher = ripple::uint256::hasher;
|
|
||||||
|
|
||||||
issue_hasher m_issue_hasher;
|
hasher m_hasher;
|
||||||
uint256_hasher m_uint256_hasher;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
hash() = default;
|
explicit hash() = default;
|
||||||
|
|
||||||
using value_type = std::size_t;
|
using value_type = std::size_t;
|
||||||
using argument_type = ripple::Book;
|
using argument_type = ripple::Book;
|
||||||
@@ -161,12 +139,8 @@ public:
|
|||||||
value_type
|
value_type
|
||||||
operator()(argument_type const& value) const
|
operator()(argument_type const& value) const
|
||||||
{
|
{
|
||||||
value_type result(m_issue_hasher(value.in));
|
value_type result(m_hasher(value.in));
|
||||||
boost::hash_combine(result, m_issue_hasher(value.out));
|
boost::hash_combine(result, m_hasher(value.out));
|
||||||
|
|
||||||
if (value.domain)
|
|
||||||
boost::hash_combine(result, m_uint256_hasher(*value.domain));
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -180,7 +154,7 @@ namespace boost {
|
|||||||
template <>
|
template <>
|
||||||
struct hash<ripple::Issue> : std::hash<ripple::Issue>
|
struct hash<ripple::Issue> : std::hash<ripple::Issue>
|
||||||
{
|
{
|
||||||
hash() = default;
|
explicit hash() = default;
|
||||||
|
|
||||||
using Base = std::hash<ripple::Issue>;
|
using Base = std::hash<ripple::Issue>;
|
||||||
// VFALCO NOTE broken in vs2012
|
// VFALCO NOTE broken in vs2012
|
||||||
@@ -190,7 +164,7 @@ struct hash<ripple::Issue> : std::hash<ripple::Issue>
|
|||||||
template <>
|
template <>
|
||||||
struct hash<ripple::Book> : std::hash<ripple::Book>
|
struct hash<ripple::Book> : std::hash<ripple::Book>
|
||||||
{
|
{
|
||||||
hash() = default;
|
explicit hash() = default;
|
||||||
|
|
||||||
using Base = std::hash<ripple::Book>;
|
using Base = std::hash<ripple::Book>;
|
||||||
// VFALCO NOTE broken in vs2012
|
// VFALCO NOTE broken in vs2012
|
||||||
|
|||||||
@@ -154,10 +154,7 @@ enum error_code_i {
|
|||||||
// Simulate
|
// Simulate
|
||||||
rpcTX_SIGNED = 96,
|
rpcTX_SIGNED = 96,
|
||||||
|
|
||||||
// Pathfinding
|
rpcLAST = rpcTX_SIGNED // rpcLAST should always equal the last code.
|
||||||
rpcDOMAIN_MALFORMED = 97,
|
|
||||||
|
|
||||||
rpcLAST = rpcDOMAIN_MALFORMED // rpcLAST should always equal the last code.
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Codes returned in the `warnings` array of certain RPC commands.
|
/** Codes returned in the `warnings` array of certain RPC commands.
|
||||||
@@ -169,8 +166,6 @@ enum warning_code_i {
|
|||||||
warnRPC_AMENDMENT_BLOCKED = 1002,
|
warnRPC_AMENDMENT_BLOCKED = 1002,
|
||||||
warnRPC_EXPIRED_VALIDATOR_LIST = 1003,
|
warnRPC_EXPIRED_VALIDATOR_LIST = 1003,
|
||||||
// unused = 1004
|
// unused = 1004
|
||||||
warnRPC_FIELDS_DEPRECATED = 2004, // rippled needs to maintain
|
|
||||||
// compatibility with Clio on this code.
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include <boost/container/flat_map.hpp>
|
#include <boost/container/flat_map.hpp>
|
||||||
|
|
||||||
|
#include <array>
|
||||||
#include <bitset>
|
#include <bitset>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
@@ -53,18 +54,6 @@
|
|||||||
* then change the macro parameter in features.macro to
|
* then change the macro parameter in features.macro to
|
||||||
* `VoteBehavior::DefaultYes`. The communication process is beyond
|
* `VoteBehavior::DefaultYes`. The communication process is beyond
|
||||||
* the scope of these instructions.
|
* the scope of these instructions.
|
||||||
|
|
||||||
* 5) If a supported feature (`Supported::yes`) was _ever_ in a released
|
|
||||||
* version, it can never be changed back to `Supported::no`, because
|
|
||||||
* it _may_ still become enabled at any time. This would cause newer
|
|
||||||
* versions of `rippled` to become amendment blocked.
|
|
||||||
* Instead, to prevent newer versions from voting on the feature, use
|
|
||||||
* `VoteBehavior::Obsolete`. Obsolete features can not be voted for
|
|
||||||
* by any versions of `rippled` built with that setting, but will still
|
|
||||||
* work correctly if they get enabled. If a feature remains obsolete
|
|
||||||
* for long enough that _all_ clients that could vote for it are
|
|
||||||
* amendment blocked, the feature can be removed from the code
|
|
||||||
* as if it was unsupported.
|
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* When a feature has been enabled for several years, the conditional code
|
* When a feature has been enabled for several years, the conditional code
|
||||||
|
|||||||
@@ -27,9 +27,14 @@
|
|||||||
#include <boost/multiprecision/cpp_int.hpp>
|
#include <boost/multiprecision/cpp_int.hpp>
|
||||||
#include <boost/operators.hpp>
|
#include <boost/operators.hpp>
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
#include <ios>
|
||||||
#include <iosfwd>
|
#include <iosfwd>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
#include <sstream>
|
||||||
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
|
|||||||
@@ -88,9 +88,6 @@ enum class HashPrefix : std::uint32_t {
|
|||||||
|
|
||||||
/** Credentials signature */
|
/** Credentials signature */
|
||||||
credential = detail::make_hash_prefix('C', 'R', 'D'),
|
credential = detail::make_hash_prefix('C', 'R', 'D'),
|
||||||
|
|
||||||
/** Batch */
|
|
||||||
batch = detail::make_hash_prefix('B', 'C', 'H'),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class Hasher>
|
template <class Hasher>
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
@@ -98,12 +99,6 @@ public:
|
|||||||
|
|
||||||
static IOUAmount
|
static IOUAmount
|
||||||
minPositiveAmount();
|
minPositiveAmount();
|
||||||
|
|
||||||
friend std::ostream&
|
|
||||||
operator<<(std::ostream& os, IOUAmount const& x)
|
|
||||||
{
|
|
||||||
return os << to_string(x);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inline IOUAmount::IOUAmount(beast::Zero)
|
inline IOUAmount::IOUAmount(beast::Zero)
|
||||||
|
|||||||
@@ -32,7 +32,6 @@
|
|||||||
#include <xrpl/protocol/jss.h>
|
#include <xrpl/protocol/jss.h>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <set>
|
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
@@ -335,15 +334,6 @@ mptoken(uint256 const& mptokenKey)
|
|||||||
Keylet
|
Keylet
|
||||||
mptoken(uint256 const& issuanceKey, AccountID const& holder) noexcept;
|
mptoken(uint256 const& issuanceKey, AccountID const& holder) noexcept;
|
||||||
|
|
||||||
Keylet
|
|
||||||
vault(AccountID const& owner, std::uint32_t seq) noexcept;
|
|
||||||
|
|
||||||
inline Keylet
|
|
||||||
vault(uint256 const& vaultKey)
|
|
||||||
{
|
|
||||||
return {ltVAULT, vaultKey};
|
|
||||||
}
|
|
||||||
|
|
||||||
Keylet
|
Keylet
|
||||||
permissionedDomain(AccountID const& account, std::uint32_t seq) noexcept;
|
permissionedDomain(AccountID const& account, std::uint32_t seq) noexcept;
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,9 @@
|
|||||||
#include <xrpl/json/json_value.h>
|
#include <xrpl/json/json_value.h>
|
||||||
#include <xrpl/protocol/UintTypes.h>
|
#include <xrpl/protocol/UintTypes.h>
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
/** A currency issued by an account.
|
/** A currency issued by an account.
|
||||||
|
|||||||
@@ -145,15 +145,13 @@ enum LedgerSpecificFlags {
|
|||||||
0x10000000, // True, reject new paychans
|
0x10000000, // True, reject new paychans
|
||||||
lsfDisallowIncomingTrustline =
|
lsfDisallowIncomingTrustline =
|
||||||
0x20000000, // True, reject new trustlines (only if no issued assets)
|
0x20000000, // True, reject new trustlines (only if no issued assets)
|
||||||
lsfAllowTrustLineLocking =
|
// 0x40000000 is available
|
||||||
0x40000000, // True, enable trustline locking
|
|
||||||
lsfAllowTrustLineClawback =
|
lsfAllowTrustLineClawback =
|
||||||
0x80000000, // True, enable clawback
|
0x80000000, // True, enable clawback
|
||||||
|
|
||||||
// ltOFFER
|
// ltOFFER
|
||||||
lsfPassive = 0x00010000,
|
lsfPassive = 0x00010000,
|
||||||
lsfSell = 0x00020000, // True, offer was placed as a sell.
|
lsfSell = 0x00020000, // True, offer was placed as a sell.
|
||||||
lsfHybrid = 0x00040000, // True, offer is hybrid.
|
|
||||||
|
|
||||||
// ltRIPPLE_STATE
|
// ltRIPPLE_STATE
|
||||||
lsfLowReserve = 0x00010000, // True, if entry counts toward reserve.
|
lsfLowReserve = 0x00010000, // True, if entry counts toward reserve.
|
||||||
@@ -193,9 +191,6 @@ enum LedgerSpecificFlags {
|
|||||||
|
|
||||||
// ltCREDENTIAL
|
// ltCREDENTIAL
|
||||||
lsfAccepted = 0x00010000,
|
lsfAccepted = 0x00010000,
|
||||||
|
|
||||||
// ltVAULT
|
|
||||||
lsfVaultPrivate = 0x00010000,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -24,12 +24,15 @@
|
|||||||
#include <xrpl/basics/contract.h>
|
#include <xrpl/basics/contract.h>
|
||||||
#include <xrpl/basics/safe_cast.h>
|
#include <xrpl/basics/safe_cast.h>
|
||||||
#include <xrpl/beast/utility/Zero.h>
|
#include <xrpl/beast/utility/Zero.h>
|
||||||
|
#include <xrpl/json/json_value.h>
|
||||||
|
|
||||||
#include <boost/multiprecision/cpp_int.hpp>
|
#include <boost/multiprecision/cpp_int.hpp>
|
||||||
#include <boost/operators.hpp>
|
#include <boost/operators.hpp>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
|
|||||||
@@ -42,11 +42,8 @@ public:
|
|||||||
AccountID const&
|
AccountID const&
|
||||||
getIssuer() const;
|
getIssuer() const;
|
||||||
|
|
||||||
constexpr MPTID const&
|
MPTID const&
|
||||||
getMptID() const
|
getMptID() const;
|
||||||
{
|
|
||||||
return mptID_;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
getText() const;
|
getText() const;
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
#include <concepts>
|
#include <concepts>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include <limits>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
|||||||
@@ -28,8 +28,6 @@
|
|||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
namespace RPC {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Adds common synthetic fields to transaction-related JSON responses
|
Adds common synthetic fields to transaction-related JSON responses
|
||||||
|
|
||||||
@@ -42,7 +40,6 @@ insertNFTSyntheticInJson(
|
|||||||
TxMeta const&);
|
TxMeta const&);
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
} // namespace RPC
|
|
||||||
} // namespace ripple
|
} // namespace ripple
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
#include <optional>
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
#include <unordered_set>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -116,16 +116,6 @@ std::size_t constexpr maxMPTokenMetadataLength = 1024;
|
|||||||
/** The maximum amount of MPTokenIssuance */
|
/** The maximum amount of MPTokenIssuance */
|
||||||
std::uint64_t constexpr maxMPTokenAmount = 0x7FFF'FFFF'FFFF'FFFFull;
|
std::uint64_t constexpr maxMPTokenAmount = 0x7FFF'FFFF'FFFF'FFFFull;
|
||||||
|
|
||||||
/** The maximum length of Data payload */
|
|
||||||
std::size_t constexpr maxDataPayloadLength = 256;
|
|
||||||
|
|
||||||
/** Vault withdrawal policies */
|
|
||||||
std::uint8_t constexpr vaultStrategyFirstComeFirstServe = 1;
|
|
||||||
|
|
||||||
/** Maximum recursion depth for vault shares being put as an asset inside
|
|
||||||
* another vault; counted from 0 */
|
|
||||||
std::uint8_t constexpr maxAssetCheckDepth = 5;
|
|
||||||
|
|
||||||
/** A ledger index. */
|
/** A ledger index. */
|
||||||
using LedgerIndex = std::uint32_t;
|
using LedgerIndex = std::uint32_t;
|
||||||
|
|
||||||
@@ -169,9 +159,6 @@ std::size_t constexpr maxTrim = 25;
|
|||||||
*/
|
*/
|
||||||
std::size_t constexpr permissionMaxSize = 10;
|
std::size_t constexpr permissionMaxSize = 10;
|
||||||
|
|
||||||
/** The maximum number of transactions that can be in a batch. */
|
|
||||||
std::size_t constexpr maxBatchTxCount = 8;
|
|
||||||
|
|
||||||
} // namespace ripple
|
} // namespace ripple
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
|
|||||||
@@ -28,9 +28,6 @@
|
|||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
bool
|
|
||||||
isFeatureEnabled(uint256 const& feature);
|
|
||||||
|
|
||||||
class DigestAwareReadView;
|
class DigestAwareReadView;
|
||||||
|
|
||||||
/** Rules controlling protocol behavior. */
|
/** Rules controlling protocol behavior. */
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <initializer_list>
|
#include <initializer_list>
|
||||||
|
#include <memory>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|||||||
@@ -153,12 +153,6 @@ public:
|
|||||||
template <AssetType A>
|
template <AssetType A>
|
||||||
STAmount(A const& asset, int mantissa, int exponent = 0);
|
STAmount(A const& asset, int mantissa, int exponent = 0);
|
||||||
|
|
||||||
template <AssetType A>
|
|
||||||
STAmount(A const& asset, Number const& number)
|
|
||||||
: STAmount(asset, number.mantissa(), number.exponent())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// Legacy support for new-style amounts
|
// Legacy support for new-style amounts
|
||||||
STAmount(IOUAmount const& amount, Issue const& issue);
|
STAmount(IOUAmount const& amount, Issue const& issue);
|
||||||
STAmount(XRPAmount const& amount);
|
STAmount(XRPAmount const& amount);
|
||||||
@@ -236,9 +230,6 @@ public:
|
|||||||
STAmount&
|
STAmount&
|
||||||
operator=(XRPAmount const& amount);
|
operator=(XRPAmount const& amount);
|
||||||
|
|
||||||
STAmount&
|
|
||||||
operator=(Number const&);
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Modification
|
// Modification
|
||||||
@@ -277,7 +268,7 @@ public:
|
|||||||
std::string
|
std::string
|
||||||
getText() const override;
|
getText() const override;
|
||||||
|
|
||||||
Json::Value getJson(JsonOptions = JsonOptions::none) const override;
|
Json::Value getJson(JsonOptions) const override;
|
||||||
|
|
||||||
void
|
void
|
||||||
add(Serializer& s) const override;
|
add(Serializer& s) const override;
|
||||||
@@ -426,7 +417,7 @@ STAmount
|
|||||||
amountFromQuality(std::uint64_t rate);
|
amountFromQuality(std::uint64_t rate);
|
||||||
|
|
||||||
STAmount
|
STAmount
|
||||||
amountFromString(Asset const& asset, std::string const& amount);
|
amountFromString(Asset const& issue, std::string const& amount);
|
||||||
|
|
||||||
STAmount
|
STAmount
|
||||||
amountFromJson(SField const& name, Json::Value const& v);
|
amountFromJson(SField const& name, Json::Value const& v);
|
||||||
@@ -550,16 +541,6 @@ STAmount::operator=(XRPAmount const& amount)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline STAmount&
|
|
||||||
STAmount::operator=(Number const& number)
|
|
||||||
{
|
|
||||||
mIsNegative = number.mantissa() < 0;
|
|
||||||
mValue = mIsNegative ? -number.mantissa() : number.mantissa();
|
|
||||||
mOffset = number.exponent();
|
|
||||||
canonicalize();
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
STAmount::negate()
|
STAmount::negate()
|
||||||
{
|
{
|
||||||
@@ -703,12 +684,6 @@ isXRP(STAmount const& amount)
|
|||||||
return amount.native();
|
return amount.native();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
canAdd(STAmount const& amt1, STAmount const& amt2);
|
|
||||||
|
|
||||||
bool
|
|
||||||
canSubtract(STAmount const& amt1, STAmount const& amt2);
|
|
||||||
|
|
||||||
// Since `canonicalize` does not have access to a ledger, this is needed to put
|
// Since `canonicalize` does not have access to a ledger, this is needed to put
|
||||||
// the low-level routine stAmountCanonicalize on an amendment switch. Only
|
// the low-level routine stAmountCanonicalize on an amendment switch. Only
|
||||||
// transactions need to use this switchover. Outside of a transaction it's safe
|
// transactions need to use this switchover. Outside of a transaction it's safe
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include <xrpl/protocol/SField.h>
|
#include <xrpl/protocol/SField.h>
|
||||||
#include <xrpl/protocol/Serializer.h>
|
#include <xrpl/protocol/Serializer.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
@@ -91,16 +92,6 @@ struct JsonOptions
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
requires requires(T const& t) {
|
|
||||||
{ t.getJson(JsonOptions::none) } -> std::convertible_to<Json::Value>;
|
|
||||||
}
|
|
||||||
Json::Value
|
|
||||||
to_json(T const& t)
|
|
||||||
{
|
|
||||||
return t.getJson(JsonOptions::none);
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
class STVar;
|
class STVar;
|
||||||
}
|
}
|
||||||
@@ -166,7 +157,7 @@ public:
|
|||||||
virtual std::string
|
virtual std::string
|
||||||
getText() const;
|
getText() const;
|
||||||
|
|
||||||
virtual Json::Value getJson(JsonOptions = JsonOptions::none) const;
|
virtual Json::Value getJson(JsonOptions /*options*/) const;
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
add(Serializer& s) const;
|
add(Serializer& s) const;
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
#include <xrpl/protocol/STBase.h>
|
#include <xrpl/protocol/STBase.h>
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ public:
|
|||||||
using value_type = Asset;
|
using value_type = Asset;
|
||||||
|
|
||||||
STIssue() = default;
|
STIssue() = default;
|
||||||
STIssue(STIssue const& rhs) = default;
|
|
||||||
|
|
||||||
explicit STIssue(SerialIter& sit, SField const& name);
|
explicit STIssue(SerialIter& sit, SField const& name);
|
||||||
|
|
||||||
@@ -46,9 +45,6 @@ public:
|
|||||||
|
|
||||||
explicit STIssue(SField const& name);
|
explicit STIssue(SField const& name);
|
||||||
|
|
||||||
STIssue&
|
|
||||||
operator=(STIssue const& rhs) = default;
|
|
||||||
|
|
||||||
template <ValidIssueType TIss>
|
template <ValidIssueType TIss>
|
||||||
TIss const&
|
TIss const&
|
||||||
get() const;
|
get() const;
|
||||||
|
|||||||
@@ -63,13 +63,6 @@ public:
|
|||||||
void
|
void
|
||||||
setValue(Number const& v);
|
setValue(Number const& v);
|
||||||
|
|
||||||
STNumber&
|
|
||||||
operator=(Number const& rhs)
|
|
||||||
{
|
|
||||||
setValue(rhs);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
isEquivalent(STBase const& t) const override;
|
isEquivalent(STBase const& t) const override;
|
||||||
bool
|
bool
|
||||||
@@ -90,19 +83,6 @@ private:
|
|||||||
std::ostream&
|
std::ostream&
|
||||||
operator<<(std::ostream& out, STNumber const& rhs);
|
operator<<(std::ostream& out, STNumber const& rhs);
|
||||||
|
|
||||||
struct NumberParts
|
|
||||||
{
|
|
||||||
std::uint64_t mantissa = 0;
|
|
||||||
int exponent = 0;
|
|
||||||
bool negative = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
NumberParts
|
|
||||||
partsFromString(std::string const& number);
|
|
||||||
|
|
||||||
STNumber
|
|
||||||
numberFromJson(SField const& field, Json::Value const& value);
|
|
||||||
|
|
||||||
} // namespace ripple
|
} // namespace ripple
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -154,7 +154,8 @@ public:
|
|||||||
getText() const override;
|
getText() const override;
|
||||||
|
|
||||||
// TODO(tom): options should be an enum.
|
// TODO(tom): options should be an enum.
|
||||||
Json::Value getJson(JsonOptions = JsonOptions::none) const override;
|
Json::Value
|
||||||
|
getJson(JsonOptions options) const override;
|
||||||
|
|
||||||
void
|
void
|
||||||
addWithoutSigningFields(Serializer& s) const;
|
addWithoutSigningFields(Serializer& s) const;
|
||||||
@@ -483,19 +484,9 @@ private:
|
|||||||
template <class T>
|
template <class T>
|
||||||
class STObject::Proxy
|
class STObject::Proxy
|
||||||
{
|
{
|
||||||
public:
|
protected:
|
||||||
using value_type = typename T::value_type;
|
using value_type = typename T::value_type;
|
||||||
|
|
||||||
value_type
|
|
||||||
value() const;
|
|
||||||
|
|
||||||
value_type
|
|
||||||
operator*() const;
|
|
||||||
|
|
||||||
T const*
|
|
||||||
operator->() const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
STObject* st_;
|
STObject* st_;
|
||||||
SOEStyle style_;
|
SOEStyle style_;
|
||||||
TypedField<T> const* f_;
|
TypedField<T> const* f_;
|
||||||
@@ -504,6 +495,9 @@ protected:
|
|||||||
|
|
||||||
Proxy(STObject* st, TypedField<T> const* f);
|
Proxy(STObject* st, TypedField<T> const* f);
|
||||||
|
|
||||||
|
value_type
|
||||||
|
value() const;
|
||||||
|
|
||||||
T const*
|
T const*
|
||||||
find() const;
|
find() const;
|
||||||
|
|
||||||
@@ -518,7 +512,7 @@ template <typename U>
|
|||||||
concept IsArithmetic = std::is_arithmetic_v<U> || std::is_same_v<U, STAmount>;
|
concept IsArithmetic = std::is_arithmetic_v<U> || std::is_same_v<U, STAmount>;
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
class STObject::ValueProxy : public Proxy<T>
|
class STObject::ValueProxy : private Proxy<T>
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
using value_type = typename T::value_type;
|
using value_type = typename T::value_type;
|
||||||
@@ -544,13 +538,6 @@ public:
|
|||||||
|
|
||||||
operator value_type() const;
|
operator value_type() const;
|
||||||
|
|
||||||
template <typename U>
|
|
||||||
friend bool
|
|
||||||
operator==(U const& lhs, STObject::ValueProxy<T> const& rhs)
|
|
||||||
{
|
|
||||||
return rhs.value() == lhs;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class STObject;
|
friend class STObject;
|
||||||
|
|
||||||
@@ -558,7 +545,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
class STObject::OptionalProxy : public Proxy<T>
|
class STObject::OptionalProxy : private Proxy<T>
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
using value_type = typename T::value_type;
|
using value_type = typename T::value_type;
|
||||||
@@ -578,6 +565,15 @@ public:
|
|||||||
explicit
|
explicit
|
||||||
operator bool() const noexcept;
|
operator bool() const noexcept;
|
||||||
|
|
||||||
|
/** Return the contained value
|
||||||
|
|
||||||
|
Throws:
|
||||||
|
|
||||||
|
STObject::FieldErr if !engaged()
|
||||||
|
*/
|
||||||
|
value_type
|
||||||
|
operator*() const;
|
||||||
|
|
||||||
operator optional_type() const;
|
operator optional_type() const;
|
||||||
|
|
||||||
/** Explicit conversion to std::optional */
|
/** Explicit conversion to std::optional */
|
||||||
@@ -721,20 +717,6 @@ STObject::Proxy<T>::value() const -> value_type
|
|||||||
return value_type{};
|
return value_type{};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
|
||||||
auto
|
|
||||||
STObject::Proxy<T>::operator*() const -> value_type
|
|
||||||
{
|
|
||||||
return this->value();
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
T const*
|
|
||||||
STObject::Proxy<T>::operator->() const
|
|
||||||
{
|
|
||||||
return this->find();
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline T const*
|
inline T const*
|
||||||
STObject::Proxy<T>::find() const
|
STObject::Proxy<T>::find() const
|
||||||
@@ -810,6 +792,13 @@ STObject::OptionalProxy<T>::operator bool() const noexcept
|
|||||||
return engaged();
|
return engaged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
auto
|
||||||
|
STObject::OptionalProxy<T>::operator*() const -> value_type
|
||||||
|
{
|
||||||
|
return this->value();
|
||||||
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
STObject::OptionalProxy<T>::operator typename STObject::OptionalProxy<
|
STObject::OptionalProxy<T>::operator typename STObject::OptionalProxy<
|
||||||
T>::optional_type() const
|
T>::optional_type() const
|
||||||
|
|||||||
@@ -102,10 +102,6 @@ public:
|
|||||||
SeqProxy
|
SeqProxy
|
||||||
getSeqProxy() const;
|
getSeqProxy() const;
|
||||||
|
|
||||||
/** Returns the first non-zero value of (Sequence, TicketSequence). */
|
|
||||||
std::uint32_t
|
|
||||||
getSeqValue() const;
|
|
||||||
|
|
||||||
boost::container::flat_set<AccountID>
|
boost::container::flat_set<AccountID>
|
||||||
getMentionedAccounts() const;
|
getMentionedAccounts() const;
|
||||||
|
|
||||||
@@ -125,16 +121,10 @@ public:
|
|||||||
@return `true` if valid signature. If invalid, the error message string.
|
@return `true` if valid signature. If invalid, the error message string.
|
||||||
*/
|
*/
|
||||||
enum class RequireFullyCanonicalSig : bool { no, yes };
|
enum class RequireFullyCanonicalSig : bool { no, yes };
|
||||||
|
|
||||||
Expected<void, std::string>
|
Expected<void, std::string>
|
||||||
checkSign(RequireFullyCanonicalSig requireCanonicalSig, Rules const& rules)
|
checkSign(RequireFullyCanonicalSig requireCanonicalSig, Rules const& rules)
|
||||||
const;
|
const;
|
||||||
|
|
||||||
Expected<void, std::string>
|
|
||||||
checkBatchSign(
|
|
||||||
RequireFullyCanonicalSig requireCanonicalSig,
|
|
||||||
Rules const& rules) const;
|
|
||||||
|
|
||||||
// SQL Functions with metadata.
|
// SQL Functions with metadata.
|
||||||
static std::string const&
|
static std::string const&
|
||||||
getMetaSQLInsertReplaceHeader();
|
getMetaSQLInsertReplaceHeader();
|
||||||
@@ -150,9 +140,6 @@ public:
|
|||||||
char status,
|
char status,
|
||||||
std::string const& escapedMetaData) const;
|
std::string const& escapedMetaData) const;
|
||||||
|
|
||||||
std::vector<uint256>
|
|
||||||
getBatchTransactionIDs() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Expected<void, std::string>
|
Expected<void, std::string>
|
||||||
checkSingleSign(RequireFullyCanonicalSig requireCanonicalSig) const;
|
checkSingleSign(RequireFullyCanonicalSig requireCanonicalSig) const;
|
||||||
@@ -162,24 +149,12 @@ private:
|
|||||||
RequireFullyCanonicalSig requireCanonicalSig,
|
RequireFullyCanonicalSig requireCanonicalSig,
|
||||||
Rules const& rules) const;
|
Rules const& rules) const;
|
||||||
|
|
||||||
Expected<void, std::string>
|
|
||||||
checkBatchSingleSign(
|
|
||||||
STObject const& batchSigner,
|
|
||||||
RequireFullyCanonicalSig requireCanonicalSig) const;
|
|
||||||
|
|
||||||
Expected<void, std::string>
|
|
||||||
checkBatchMultiSign(
|
|
||||||
STObject const& batchSigner,
|
|
||||||
RequireFullyCanonicalSig requireCanonicalSig,
|
|
||||||
Rules const& rules) const;
|
|
||||||
|
|
||||||
STBase*
|
STBase*
|
||||||
copy(std::size_t n, void* buf) const override;
|
copy(std::size_t n, void* buf) const override;
|
||||||
STBase*
|
STBase*
|
||||||
move(std::size_t n, void* buf) override;
|
move(std::size_t n, void* buf) override;
|
||||||
|
|
||||||
friend class detail::STVar;
|
friend class detail::STVar;
|
||||||
mutable std::vector<uint256> batch_txn_ids_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|||||||
@@ -28,6 +28,8 @@
|
|||||||
#include <xrpl/protocol/SecretKey.h>
|
#include <xrpl/protocol/SecretKey.h>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <functional>
|
||||||
|
#include <memory>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <iomanip>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|||||||
@@ -25,6 +25,8 @@
|
|||||||
#include <xrpl/protocol/STObject.h>
|
#include <xrpl/protocol/STObject.h>
|
||||||
#include <xrpl/protocol/SecretKey.h>
|
#include <xrpl/protocol/SecretKey.h>
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
/** Sign an STObject
|
/** Sign an STObject
|
||||||
|
|||||||
@@ -139,8 +139,8 @@ enum TEMcodes : TERUnderlyingType {
|
|||||||
|
|
||||||
temARRAY_EMPTY,
|
temARRAY_EMPTY,
|
||||||
temARRAY_TOO_LARGE,
|
temARRAY_TOO_LARGE,
|
||||||
|
|
||||||
temBAD_TRANSFER_FEE,
|
temBAD_TRANSFER_FEE,
|
||||||
temINVALID_INNER_BATCH,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@@ -225,8 +225,6 @@ enum TERcodes : TERUnderlyingType {
|
|||||||
terQUEUED, // Transaction is being held in TxQ until fee drops
|
terQUEUED, // Transaction is being held in TxQ until fee drops
|
||||||
terPRE_TICKET, // Ticket is not yet in ledger but might be on its way
|
terPRE_TICKET, // Ticket is not yet in ledger but might be on its way
|
||||||
terNO_AMM, // AMM doesn't exist for the asset pair
|
terNO_AMM, // AMM doesn't exist for the asset pair
|
||||||
terADDRESS_COLLISION, // Failed to allocate AccountID when trying to
|
|
||||||
// create a pseudo-account
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@@ -267,17 +265,6 @@ enum TECcodes : TERUnderlyingType {
|
|||||||
// Otherwise, treated as terRETRY.
|
// Otherwise, treated as terRETRY.
|
||||||
//
|
//
|
||||||
// DO NOT CHANGE THESE NUMBERS: They appear in ledger meta data.
|
// DO NOT CHANGE THESE NUMBERS: They appear in ledger meta data.
|
||||||
//
|
|
||||||
// Note:
|
|
||||||
// tecNO_ENTRY is often used interchangeably with tecOBJECT_NOT_FOUND.
|
|
||||||
// While there does not seem to be a clear rule which to use when, the
|
|
||||||
// following guidance will help to keep errors consistent with the
|
|
||||||
// majority of (but not all) transaction types:
|
|
||||||
// - tecNO_ENTRY : cannot find the primary ledger object on which the
|
|
||||||
// transaction is being attempted
|
|
||||||
// - tecOBJECT_NOT_FOUND : cannot find the additional object(s) needed to
|
|
||||||
// complete the transaction
|
|
||||||
|
|
||||||
tecCLAIM = 100,
|
tecCLAIM = 100,
|
||||||
tecPATH_PARTIAL = 101,
|
tecPATH_PARTIAL = 101,
|
||||||
tecUNFUNDED_ADD = 102, // Unused legacy code
|
tecUNFUNDED_ADD = 102, // Unused legacy code
|
||||||
@@ -357,11 +344,6 @@ enum TECcodes : TERUnderlyingType {
|
|||||||
tecARRAY_TOO_LARGE = 191,
|
tecARRAY_TOO_LARGE = 191,
|
||||||
tecLOCKED = 192,
|
tecLOCKED = 192,
|
||||||
tecBAD_CREDENTIALS = 193,
|
tecBAD_CREDENTIALS = 193,
|
||||||
tecWRONG_ASSET = 194,
|
|
||||||
tecLIMIT_EXCEEDED = 195,
|
|
||||||
tecPSEUDO_ACCOUNT = 196,
|
|
||||||
tecPRECISION_LOSS = 197,
|
|
||||||
tecNO_DELEGATE_PERMISSION = 198,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@@ -647,37 +629,37 @@ using TER = TERSubset<CanCvtToTER>;
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
isTelLocal(TER x) noexcept
|
isTelLocal(TER x)
|
||||||
{
|
{
|
||||||
return (x >= telLOCAL_ERROR && x < temMALFORMED);
|
return ((x) >= telLOCAL_ERROR && (x) < temMALFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
isTemMalformed(TER x) noexcept
|
isTemMalformed(TER x)
|
||||||
{
|
{
|
||||||
return (x >= temMALFORMED && x < tefFAILURE);
|
return ((x) >= temMALFORMED && (x) < tefFAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
isTefFailure(TER x) noexcept
|
isTefFailure(TER x)
|
||||||
{
|
{
|
||||||
return (x >= tefFAILURE && x < terRETRY);
|
return ((x) >= tefFAILURE && (x) < terRETRY);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
isTerRetry(TER x) noexcept
|
isTerRetry(TER x)
|
||||||
{
|
{
|
||||||
return (x >= terRETRY && x < tesSUCCESS);
|
return ((x) >= terRETRY && (x) < tesSUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
isTesSuccess(TER x) noexcept
|
isTesSuccess(TER x)
|
||||||
{
|
{
|
||||||
return (x == tesSUCCESS);
|
return ((x) == tesSUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
isTecClaim(TER x) noexcept
|
isTecClaim(TER x)
|
||||||
{
|
{
|
||||||
return ((x) >= tecCLAIM);
|
return ((x) >= tecCLAIM);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,8 +58,7 @@ namespace ripple {
|
|||||||
// clang-format off
|
// clang-format off
|
||||||
// Universal Transaction flags:
|
// Universal Transaction flags:
|
||||||
constexpr std::uint32_t tfFullyCanonicalSig = 0x80000000;
|
constexpr std::uint32_t tfFullyCanonicalSig = 0x80000000;
|
||||||
constexpr std::uint32_t tfInnerBatchTxn = 0x40000000;
|
constexpr std::uint32_t tfUniversal = tfFullyCanonicalSig;
|
||||||
constexpr std::uint32_t tfUniversal = tfFullyCanonicalSig | tfInnerBatchTxn;
|
|
||||||
constexpr std::uint32_t tfUniversalMask = ~tfUniversal;
|
constexpr std::uint32_t tfUniversalMask = ~tfUniversal;
|
||||||
|
|
||||||
// AccountSet flags:
|
// AccountSet flags:
|
||||||
@@ -92,16 +91,14 @@ constexpr std::uint32_t asfDisallowIncomingCheck = 13;
|
|||||||
constexpr std::uint32_t asfDisallowIncomingPayChan = 14;
|
constexpr std::uint32_t asfDisallowIncomingPayChan = 14;
|
||||||
constexpr std::uint32_t asfDisallowIncomingTrustline = 15;
|
constexpr std::uint32_t asfDisallowIncomingTrustline = 15;
|
||||||
constexpr std::uint32_t asfAllowTrustLineClawback = 16;
|
constexpr std::uint32_t asfAllowTrustLineClawback = 16;
|
||||||
constexpr std::uint32_t asfAllowTrustLineLocking = 17;
|
|
||||||
|
|
||||||
// OfferCreate flags:
|
// OfferCreate flags:
|
||||||
constexpr std::uint32_t tfPassive = 0x00010000;
|
constexpr std::uint32_t tfPassive = 0x00010000;
|
||||||
constexpr std::uint32_t tfImmediateOrCancel = 0x00020000;
|
constexpr std::uint32_t tfImmediateOrCancel = 0x00020000;
|
||||||
constexpr std::uint32_t tfFillOrKill = 0x00040000;
|
constexpr std::uint32_t tfFillOrKill = 0x00040000;
|
||||||
constexpr std::uint32_t tfSell = 0x00080000;
|
constexpr std::uint32_t tfSell = 0x00080000;
|
||||||
constexpr std::uint32_t tfHybrid = 0x00100000;
|
|
||||||
constexpr std::uint32_t tfOfferCreateMask =
|
constexpr std::uint32_t tfOfferCreateMask =
|
||||||
~(tfUniversal | tfPassive | tfImmediateOrCancel | tfFillOrKill | tfSell | tfHybrid);
|
~(tfUniversal | tfPassive | tfImmediateOrCancel | tfFillOrKill | tfSell);
|
||||||
|
|
||||||
// Payment flags:
|
// Payment flags:
|
||||||
constexpr std::uint32_t tfNoRippleDirect = 0x00010000;
|
constexpr std::uint32_t tfNoRippleDirect = 0x00010000;
|
||||||
@@ -122,7 +119,13 @@ constexpr std::uint32_t tfClearDeepFreeze = 0x00800000;
|
|||||||
constexpr std::uint32_t tfTrustSetMask =
|
constexpr std::uint32_t tfTrustSetMask =
|
||||||
~(tfUniversal | tfSetfAuth | tfSetNoRipple | tfClearNoRipple | tfSetFreeze |
|
~(tfUniversal | tfSetfAuth | tfSetNoRipple | tfClearNoRipple | tfSetFreeze |
|
||||||
tfClearFreeze | tfSetDeepFreeze | tfClearDeepFreeze);
|
tfClearFreeze | tfSetDeepFreeze | tfClearDeepFreeze);
|
||||||
constexpr std::uint32_t tfTrustSetPermissionMask = ~(tfUniversal | tfSetfAuth | tfSetFreeze | tfClearFreeze);
|
|
||||||
|
// valid flags for granular permission
|
||||||
|
constexpr std::uint32_t tfTrustSetGranularMask = tfSetfAuth | tfSetFreeze | tfClearFreeze;
|
||||||
|
|
||||||
|
// bits representing supportedGranularMask are set to 0 and the bits
|
||||||
|
// representing other flags are set to 1 in tfPermissionMask.
|
||||||
|
constexpr std::uint32_t tfTrustSetPermissionMask = (~tfTrustSetMask) & (~tfTrustSetGranularMask);
|
||||||
|
|
||||||
// EnableAmendment flags:
|
// EnableAmendment flags:
|
||||||
constexpr std::uint32_t tfGotMajority = 0x00010000;
|
constexpr std::uint32_t tfGotMajority = 0x00010000;
|
||||||
@@ -159,7 +162,8 @@ constexpr std::uint32_t const tfMPTokenAuthorizeMask = ~(tfUniversal | tfMPTUna
|
|||||||
constexpr std::uint32_t const tfMPTLock = 0x00000001;
|
constexpr std::uint32_t const tfMPTLock = 0x00000001;
|
||||||
constexpr std::uint32_t const tfMPTUnlock = 0x00000002;
|
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 tfMPTokenIssuanceSetGranularMask = tfMPTLock | tfMPTUnlock;
|
||||||
|
constexpr std::uint32_t const tfMPTokenIssuanceSetPermissionMask = (~tfMPTokenIssuanceSetMask) & (~tfMPTokenIssuanceSetGranularMask);
|
||||||
|
|
||||||
// MPTokenIssuanceDestroy flags:
|
// MPTokenIssuanceDestroy flags:
|
||||||
constexpr std::uint32_t const tfMPTokenIssuanceDestroyMask = ~tfUniversal;
|
constexpr std::uint32_t const tfMPTokenIssuanceDestroyMask = ~tfUniversal;
|
||||||
@@ -229,26 +233,6 @@ constexpr std::uint32_t tfAMMClawbackMask = ~(tfUniversal | tfClawTwoAssets);
|
|||||||
// BridgeModify flags:
|
// BridgeModify flags:
|
||||||
constexpr std::uint32_t tfClearAccountCreateAmount = 0x00010000;
|
constexpr std::uint32_t tfClearAccountCreateAmount = 0x00010000;
|
||||||
constexpr std::uint32_t tfBridgeModifyMask = ~(tfUniversal | tfClearAccountCreateAmount);
|
constexpr std::uint32_t tfBridgeModifyMask = ~(tfUniversal | tfClearAccountCreateAmount);
|
||||||
|
|
||||||
// VaultCreate flags:
|
|
||||||
constexpr std::uint32_t const tfVaultPrivate = 0x00010000;
|
|
||||||
static_assert(tfVaultPrivate == lsfVaultPrivate);
|
|
||||||
constexpr std::uint32_t const tfVaultShareNonTransferable = 0x00020000;
|
|
||||||
constexpr std::uint32_t const tfVaultCreateMask = ~(tfUniversal | tfVaultPrivate | tfVaultShareNonTransferable);
|
|
||||||
|
|
||||||
// Batch Flags:
|
|
||||||
constexpr std::uint32_t tfAllOrNothing = 0x00010000;
|
|
||||||
constexpr std::uint32_t tfOnlyOne = 0x00020000;
|
|
||||||
constexpr std::uint32_t tfUntilFailure = 0x00040000;
|
|
||||||
constexpr std::uint32_t tfIndependent = 0x00080000;
|
|
||||||
/**
|
|
||||||
* @note If nested Batch transactions are supported in the future, the tfInnerBatchTxn flag
|
|
||||||
* will need to be removed from this mask to allow Batch transaction to be inside
|
|
||||||
* the sfRawTransactions array.
|
|
||||||
*/
|
|
||||||
constexpr std::uint32_t const tfBatchMask =
|
|
||||||
~(tfUniversal | tfAllOrNothing | tfOnlyOne | tfUntilFailure | tfIndependent) | tfInnerBatchTxn;
|
|
||||||
|
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
} // namespace ripple
|
} // namespace ripple
|
||||||
|
|||||||
@@ -46,10 +46,7 @@ private:
|
|||||||
CtorHelper);
|
CtorHelper);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TxMeta(
|
TxMeta(uint256 const& transactionID, std::uint32_t ledger);
|
||||||
uint256 const& transactionID,
|
|
||||||
std::uint32_t ledger,
|
|
||||||
std::optional<uint256> parentBatchId = std::nullopt);
|
|
||||||
TxMeta(uint256 const& txID, std::uint32_t ledger, Blob const&);
|
TxMeta(uint256 const& txID, std::uint32_t ledger, Blob const&);
|
||||||
TxMeta(uint256 const& txID, std::uint32_t ledger, std::string const&);
|
TxMeta(uint256 const& txID, std::uint32_t ledger, std::string const&);
|
||||||
TxMeta(uint256 const& txID, std::uint32_t ledger, STObject const&);
|
TxMeta(uint256 const& txID, std::uint32_t ledger, STObject const&);
|
||||||
@@ -133,27 +130,6 @@ public:
|
|||||||
return static_cast<bool>(mDelivered);
|
return static_cast<bool>(mDelivered);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
setParentBatchId(uint256 const& parentBatchId)
|
|
||||||
{
|
|
||||||
mParentBatchId = parentBatchId;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint256
|
|
||||||
getParentBatchId() const
|
|
||||||
{
|
|
||||||
XRPL_ASSERT(
|
|
||||||
hasParentBatchId(),
|
|
||||||
"ripple::TxMeta::getParentBatchId : non-null batch id");
|
|
||||||
return *mParentBatchId;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
hasParentBatchId() const
|
|
||||||
{
|
|
||||||
return static_cast<bool>(mParentBatchId);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint256 mTransactionID;
|
uint256 mTransactionID;
|
||||||
std::uint32_t mLedger;
|
std::uint32_t mLedger;
|
||||||
@@ -161,7 +137,6 @@ private:
|
|||||||
int mResult;
|
int mResult;
|
||||||
|
|
||||||
std::optional<STAmount> mDelivered;
|
std::optional<STAmount> mDelivered;
|
||||||
std::optional<uint256> mParentBatchId;
|
|
||||||
|
|
||||||
STArray mNodes;
|
STArray mNodes;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -63,9 +63,6 @@ using NodeID = base_uint<160, detail::NodeIDTag>;
|
|||||||
* and a 160-bit account */
|
* and a 160-bit account */
|
||||||
using MPTID = base_uint<192>;
|
using MPTID = base_uint<192>;
|
||||||
|
|
||||||
/** Domain is a 256-bit hash representing a specific domain. */
|
|
||||||
using Domain = base_uint<256>;
|
|
||||||
|
|
||||||
/** XRP currency. */
|
/** XRP currency. */
|
||||||
Currency const&
|
Currency const&
|
||||||
xrpCurrency();
|
xrpCurrency();
|
||||||
@@ -122,25 +119,25 @@ namespace std {
|
|||||||
template <>
|
template <>
|
||||||
struct hash<ripple::Currency> : ripple::Currency::hasher
|
struct hash<ripple::Currency> : ripple::Currency::hasher
|
||||||
{
|
{
|
||||||
hash() = default;
|
explicit hash() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct hash<ripple::NodeID> : ripple::NodeID::hasher
|
struct hash<ripple::NodeID> : ripple::NodeID::hasher
|
||||||
{
|
{
|
||||||
hash() = default;
|
explicit hash() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct hash<ripple::Directory> : ripple::Directory::hasher
|
struct hash<ripple::Directory> : ripple::Directory::hasher
|
||||||
{
|
{
|
||||||
hash() = default;
|
explicit hash() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct hash<ripple::uint256> : ripple::uint256::hasher
|
struct hash<ripple::uint256> : ripple::uint256::hasher
|
||||||
{
|
{
|
||||||
hash() = default;
|
explicit hash() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace std
|
} // namespace std
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user