mirror of
https://github.com/Xahau/xahaud.git
synced 2026-01-15 12:15:16 +00:00
Compare commits
1 Commits
batch
...
sublimator
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
952d9f56b4 |
31
.github/actions/xahau-configure-ccache/action.yml
vendored
Normal file
31
.github/actions/xahau-configure-ccache/action.yml
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
name: 'Configure ccache'
|
||||
description: 'Sets up ccache with consistent configuration'
|
||||
|
||||
inputs:
|
||||
max_size:
|
||||
description: 'Maximum cache size'
|
||||
required: false
|
||||
default: '2G'
|
||||
hash_dir:
|
||||
description: 'Whether to include directory paths in hash'
|
||||
required: false
|
||||
default: 'true'
|
||||
compiler_check:
|
||||
description: 'How to check compiler for changes'
|
||||
required: false
|
||||
default: 'content'
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: Configure ccache
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p ~/.ccache
|
||||
export CONF_PATH="${CCACHE_CONFIGPATH:-${CCACHE_DIR:-$HOME/.ccache}/ccache.conf}"
|
||||
mkdir -p $(dirname "$CONF_PATH")
|
||||
echo "max_size = ${{ inputs.max_size }}" > "$CONF_PATH"
|
||||
echo "hash_dir = ${{ inputs.hash_dir }}" >> "$CONF_PATH"
|
||||
echo "compiler_check = ${{ inputs.compiler_check }}" >> "$CONF_PATH"
|
||||
ccache -p # Print config for verification
|
||||
ccache -z # Zero statistics before the build
|
||||
159
.github/actions/xahau-ga-build/action.yml
vendored
159
.github/actions/xahau-ga-build/action.yml
vendored
@@ -21,17 +21,13 @@ inputs:
|
||||
required: false
|
||||
default: ''
|
||||
compiler-id:
|
||||
description: 'Unique identifier: compiler-version-stdlib[-gccversion] (e.g. clang-14-libstdcxx-gcc11, gcc-13-libstdcxx)'
|
||||
description: 'Unique identifier for compiler/version combination used for cache keys'
|
||||
required: false
|
||||
default: ''
|
||||
cache_version:
|
||||
description: 'Cache version for invalidation'
|
||||
required: false
|
||||
default: '1'
|
||||
gha_cache_enabled:
|
||||
description: 'Whether to use actions/cache (disable for self-hosted with volume mounts)'
|
||||
required: false
|
||||
default: 'true'
|
||||
ccache_enabled:
|
||||
description: 'Whether to use ccache'
|
||||
required: false
|
||||
@@ -40,29 +36,6 @@ inputs:
|
||||
description: 'Main branch name for restore keys'
|
||||
required: false
|
||||
default: 'dev'
|
||||
stdlib:
|
||||
description: 'C++ standard library to use'
|
||||
required: true
|
||||
type: choice
|
||||
options:
|
||||
- libstdcxx
|
||||
- libcxx
|
||||
clang_gcc_toolchain:
|
||||
description: 'GCC version to use for Clang toolchain (e.g. 11, 13)'
|
||||
required: false
|
||||
default: ''
|
||||
ccache_max_size:
|
||||
description: 'Maximum ccache size'
|
||||
required: false
|
||||
default: '2G'
|
||||
ccache_hash_dir:
|
||||
description: 'Whether to include directory paths in hash'
|
||||
required: false
|
||||
default: 'true'
|
||||
ccache_compiler_check:
|
||||
description: 'How to check compiler for changes'
|
||||
required: false
|
||||
default: 'content'
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
@@ -75,37 +48,18 @@ runs:
|
||||
SAFE_BRANCH=$(echo "${{ github.ref_name }}" | tr -c 'a-zA-Z0-9_.-' '-')
|
||||
echo "name=${SAFE_BRANCH}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Configure ccache
|
||||
- name: Restore ccache directory
|
||||
if: inputs.ccache_enabled == 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
# Create cache directories
|
||||
mkdir -p ~/.ccache-cache
|
||||
|
||||
# Keep config separate from cache_dir so configs aren't swapped when CCACHE_DIR changes between steps
|
||||
mkdir -p ~/.config/ccache
|
||||
export CCACHE_CONFIGPATH="$HOME/.config/ccache/ccache.conf"
|
||||
echo "CCACHE_CONFIGPATH=$CCACHE_CONFIGPATH" >> $GITHUB_ENV
|
||||
|
||||
# Keep config separate from cache_dir so configs aren't swapped when CCACHE_DIR changes between steps
|
||||
mkdir -p ~/.config/ccache
|
||||
export CCACHE_CONFIGPATH="$HOME/.config/ccache/ccache.conf"
|
||||
echo "CCACHE_CONFIGPATH=$CCACHE_CONFIGPATH" >> $GITHUB_ENV
|
||||
|
||||
# Configure ccache settings AFTER cache restore (prevents stale cached config)
|
||||
ccache --set-config=max_size=${{ inputs.ccache_max_size }}
|
||||
ccache --set-config=hash_dir=${{ inputs.ccache_hash_dir }}
|
||||
ccache --set-config=compiler_check=${{ inputs.ccache_compiler_check }}
|
||||
ccache --set-config=cache_dir="$HOME/.ccache-cache"
|
||||
echo "CCACHE_DIR=$HOME/.ccache-cache" >> $GITHUB_ENV
|
||||
echo "📦 using ~/.ccache-cache as ccache cache directory"
|
||||
|
||||
# Print config for verification
|
||||
echo "=== ccache configuration ==="
|
||||
ccache -p
|
||||
|
||||
# Zero statistics before the build
|
||||
ccache -z
|
||||
id: ccache-restore
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: ~/.ccache
|
||||
key: ${{ runner.os }}-ccache-v${{ inputs.cache_version }}-${{ inputs.compiler-id }}-${{ inputs.configuration }}-${{ steps.safe-branch.outputs.name }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-ccache-v${{ inputs.cache_version }}-${{ inputs.compiler-id }}-${{ inputs.configuration }}-${{ inputs.main_branch }}
|
||||
${{ runner.os }}-ccache-v${{ inputs.cache_version }}-${{ inputs.compiler-id }}-${{ inputs.configuration }}-
|
||||
${{ runner.os }}-ccache-v${{ inputs.cache_version }}-${{ inputs.compiler-id }}-
|
||||
${{ runner.os }}-ccache-v${{ inputs.cache_version }}-
|
||||
|
||||
- name: Configure project
|
||||
shell: bash
|
||||
@@ -121,97 +75,36 @@ runs:
|
||||
if [ -n "${{ inputs.cxx }}" ]; then
|
||||
export CXX="${{ inputs.cxx }}"
|
||||
fi
|
||||
|
||||
# Create wrapper toolchain that overlays ccache on top of Conan's toolchain
|
||||
# This enables ccache for the main app build without affecting Conan dependency builds
|
||||
if [ "${{ inputs.ccache_enabled }}" = "true" ]; then
|
||||
cat > wrapper_toolchain.cmake <<'EOF'
|
||||
# Include Conan's generated toolchain first (sets compiler, flags, etc.)
|
||||
# Note: CMAKE_CURRENT_LIST_DIR is the directory containing this wrapper (.build/)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/build/generators/conan_toolchain.cmake)
|
||||
|
||||
# Overlay ccache configuration for main application build
|
||||
# This does NOT affect Conan dependency builds (already completed)
|
||||
set(CMAKE_C_COMPILER_LAUNCHER ccache CACHE STRING "C compiler launcher" FORCE)
|
||||
set(CMAKE_CXX_COMPILER_LAUNCHER ccache CACHE STRING "C++ compiler launcher" FORCE)
|
||||
EOF
|
||||
TOOLCHAIN_FILE="wrapper_toolchain.cmake"
|
||||
echo "✅ Created wrapper toolchain with ccache enabled"
|
||||
else
|
||||
TOOLCHAIN_FILE="build/generators/conan_toolchain.cmake"
|
||||
echo "ℹ️ Using Conan toolchain directly (ccache disabled)"
|
||||
fi
|
||||
|
||||
# Configure C++ standard library if specified
|
||||
# libstdcxx used for clang-14/16 to work around missing lexicographical_compare_three_way in libc++
|
||||
# libcxx can be used with clang-17+ which has full C++20 support
|
||||
# Note: -stdlib flag is Clang-specific, GCC always uses libstdc++
|
||||
CMAKE_CXX_FLAGS=""
|
||||
if [[ "${{ inputs.cxx }}" == clang* ]]; then
|
||||
# Only Clang needs the -stdlib flag
|
||||
if [ "${{ inputs.stdlib }}" = "libstdcxx" ]; then
|
||||
CMAKE_CXX_FLAGS="-stdlib=libstdc++"
|
||||
elif [ "${{ inputs.stdlib }}" = "libcxx" ]; then
|
||||
CMAKE_CXX_FLAGS="-stdlib=libc++"
|
||||
fi
|
||||
fi
|
||||
# GCC always uses libstdc++ and doesn't need/support the -stdlib flag
|
||||
|
||||
# Configure GCC toolchain for Clang if specified
|
||||
if [ -n "${{ inputs.clang_gcc_toolchain }}" ] && [[ "${{ inputs.cxx }}" == clang* ]]; then
|
||||
# Extract Clang version from compiler executable name (e.g., clang++-14 -> 14)
|
||||
clang_version=$(echo "${{ inputs.cxx }}" | grep -oE '[0-9]+$')
|
||||
|
||||
# Clang 16+ supports --gcc-install-dir (precise path specification)
|
||||
# Clang <16 only has --gcc-toolchain (uses discovery heuristics)
|
||||
if [ -n "$clang_version" ] && [ "$clang_version" -ge "16" ]; then
|
||||
# Clang 16+ uses --gcc-install-dir (canonical, precise)
|
||||
CMAKE_CXX_FLAGS="$CMAKE_CXX_FLAGS --gcc-install-dir=/usr/lib/gcc/x86_64-linux-gnu/${{ inputs.clang_gcc_toolchain }}"
|
||||
else
|
||||
# Clang 14-15 uses --gcc-toolchain (deprecated but necessary)
|
||||
# Note: This still uses discovery, so we hide newer GCC versions in the workflow
|
||||
CMAKE_CXX_FLAGS="$CMAKE_CXX_FLAGS --gcc-toolchain=/usr"
|
||||
fi
|
||||
# Configure ccache launcher args
|
||||
CCACHE_ARGS=""
|
||||
if [ "${{ inputs.ccache_enabled }}" = "true" ]; then
|
||||
CCACHE_ARGS="-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
|
||||
fi
|
||||
|
||||
# Run CMake configure
|
||||
# Note: conanfile.py hardcodes 'build/generators' as the output path.
|
||||
# If we're in a 'build' folder, Conan detects this and uses just 'generators/'
|
||||
# If we're in '.build' (non-standard), Conan adds the full 'build/generators/'
|
||||
# So we get: .build/build/generators/ with our non-standard folder name
|
||||
cmake .. \
|
||||
-G "${{ inputs.generator }}" \
|
||||
${CMAKE_CXX_FLAGS:+-DCMAKE_CXX_FLAGS="$CMAKE_CXX_FLAGS"} \
|
||||
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=${TOOLCHAIN_FILE} \
|
||||
$CCACHE_ARGS \
|
||||
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake \
|
||||
-DCMAKE_BUILD_TYPE=${{ inputs.configuration }} \
|
||||
-Dtests=TRUE \
|
||||
-Dxrpld=TRUE
|
||||
|
||||
- name: Show ccache config before build
|
||||
if: inputs.ccache_enabled == 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
echo "=========================================="
|
||||
echo "ccache configuration before build"
|
||||
echo "=========================================="
|
||||
ccache -p
|
||||
echo ""
|
||||
|
||||
- name: Build project
|
||||
shell: bash
|
||||
run: |
|
||||
cd ${{ inputs.build_dir }}
|
||||
|
||||
# Check for verbose build flag in commit message
|
||||
VERBOSE_FLAG=""
|
||||
if echo "${XAHAU_GA_COMMIT_MSG}" | grep -q '\[ci-ga-cmake-verbose\]'; then
|
||||
echo "🔊 [ci-ga-cmake-verbose] detected - enabling verbose output"
|
||||
VERBOSE_FLAG="-- -v"
|
||||
fi
|
||||
|
||||
cmake --build . --config ${{ inputs.configuration }} --parallel $(nproc) ${VERBOSE_FLAG}
|
||||
cmake --build . --config ${{ inputs.configuration }} --parallel $(nproc)
|
||||
|
||||
- name: Show ccache statistics
|
||||
if: inputs.ccache_enabled == 'true'
|
||||
shell: bash
|
||||
run: ccache -s
|
||||
|
||||
- name: Save ccache directory
|
||||
if: inputs.ccache_enabled == 'true'
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: ~/.ccache
|
||||
key: ${{ steps.ccache-restore.outputs.cache-primary-key }}
|
||||
|
||||
146
.github/actions/xahau-ga-cache-restore/action.yml
vendored
146
.github/actions/xahau-ga-cache-restore/action.yml
vendored
@@ -1,146 +0,0 @@
|
||||
name: 'Cache Restore'
|
||||
description: 'Restores cache with optional clearing based on commit message tags'
|
||||
|
||||
inputs:
|
||||
path:
|
||||
description: 'A list of files, directories, and wildcard patterns to cache'
|
||||
required: true
|
||||
key:
|
||||
description: 'An explicit key for restoring the cache'
|
||||
required: true
|
||||
restore-keys:
|
||||
description: 'An ordered list of prefix-matched keys to use for restoring stale cache if no cache hit occurred for key'
|
||||
required: false
|
||||
default: ''
|
||||
cache-type:
|
||||
description: 'Type of cache (for logging purposes, e.g., "ccache-main", "Conan")'
|
||||
required: false
|
||||
default: 'cache'
|
||||
fail-on-cache-miss:
|
||||
description: 'Fail the workflow if cache entry is not found'
|
||||
required: false
|
||||
default: 'false'
|
||||
lookup-only:
|
||||
description: 'Check if a cache entry exists for the given input(s) without downloading it'
|
||||
required: false
|
||||
default: 'false'
|
||||
additional-clear-keys:
|
||||
description: 'Additional cache keys to clear (newline separated)'
|
||||
required: false
|
||||
default: ''
|
||||
|
||||
outputs:
|
||||
cache-hit:
|
||||
description: 'A boolean value to indicate an exact match was found for the primary key'
|
||||
value: ${{ steps.restore-cache.outputs.cache-hit }}
|
||||
cache-primary-key:
|
||||
description: 'The key that was used to restore the cache'
|
||||
value: ${{ steps.restore-cache.outputs.cache-primary-key }}
|
||||
cache-matched-key:
|
||||
description: 'The key that was used to restore the cache (exact or prefix match)'
|
||||
value: ${{ steps.restore-cache.outputs.cache-matched-key }}
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: Clear cache if requested via commit message
|
||||
shell: bash
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
echo "=========================================="
|
||||
echo "${{ inputs.cache-type }} cache clear tag detection"
|
||||
echo "=========================================="
|
||||
echo "Searching for: [ci-ga-clear-cache] or [ci-ga-clear-cache:*]"
|
||||
echo ""
|
||||
|
||||
CACHE_KEY="${{ inputs.key }}"
|
||||
|
||||
# Extract search terms if present (e.g., "ccache" from "[ci-ga-clear-cache:ccache]")
|
||||
SEARCH_TERMS=$(echo "${XAHAU_GA_COMMIT_MSG}" | grep -o '\[ci-ga-clear-cache:[^]]*\]' | sed 's/\[ci-ga-clear-cache://;s/\]//' || echo "")
|
||||
|
||||
SHOULD_CLEAR=false
|
||||
|
||||
if [ -n "${SEARCH_TERMS}" ]; then
|
||||
# Search terms provided - check if THIS cache key matches ALL terms (AND logic)
|
||||
echo "🔍 [ci-ga-clear-cache:${SEARCH_TERMS}] detected"
|
||||
echo "Checking if cache key matches search terms..."
|
||||
echo " Cache key: ${CACHE_KEY}"
|
||||
echo " Search terms: ${SEARCH_TERMS}"
|
||||
echo ""
|
||||
|
||||
MATCHES=true
|
||||
for term in ${SEARCH_TERMS}; do
|
||||
if ! echo "${CACHE_KEY}" | grep -q "${term}"; then
|
||||
MATCHES=false
|
||||
echo " ✗ Key does not contain '${term}'"
|
||||
break
|
||||
else
|
||||
echo " ✓ Key contains '${term}'"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "${MATCHES}" = "true" ]; then
|
||||
echo ""
|
||||
echo "✅ Cache key matches all search terms - will clear cache"
|
||||
SHOULD_CLEAR=true
|
||||
else
|
||||
echo ""
|
||||
echo "⏭️ Cache key doesn't match search terms - skipping cache clear"
|
||||
fi
|
||||
elif echo "${XAHAU_GA_COMMIT_MSG}" | grep -q '\[ci-ga-clear-cache\]'; then
|
||||
# No search terms - always clear this job's cache
|
||||
echo "🗑️ [ci-ga-clear-cache] detected in commit message"
|
||||
echo "Clearing ${{ inputs.cache-type }} cache for key: ${CACHE_KEY}"
|
||||
SHOULD_CLEAR=true
|
||||
fi
|
||||
|
||||
if [ "${SHOULD_CLEAR}" = "true" ]; then
|
||||
echo ""
|
||||
echo "Deleting ${{ inputs.cache-type }} caches via GitHub API..."
|
||||
|
||||
# Delete primary cache key
|
||||
echo "Checking for cache: ${CACHE_KEY}"
|
||||
if gh cache list --key "${CACHE_KEY}" --json key --jq '.[].key' | grep -q "${CACHE_KEY}"; then
|
||||
echo " Deleting: ${CACHE_KEY}"
|
||||
gh cache delete "${CACHE_KEY}" || true
|
||||
echo " ✓ Deleted"
|
||||
else
|
||||
echo " ℹ️ Not found"
|
||||
fi
|
||||
|
||||
# Delete additional keys if provided
|
||||
if [ -n "${{ inputs.additional-clear-keys }}" ]; then
|
||||
echo ""
|
||||
echo "Checking additional keys..."
|
||||
while IFS= read -r key; do
|
||||
[ -z "${key}" ] && continue
|
||||
echo "Checking for cache: ${key}"
|
||||
if gh cache list --key "${key}" --json key --jq '.[].key' | grep -q "${key}"; then
|
||||
echo " Deleting: ${key}"
|
||||
gh cache delete "${key}" || true
|
||||
echo " ✓ Deleted"
|
||||
else
|
||||
echo " ℹ️ Not found"
|
||||
fi
|
||||
done <<< "${{ inputs.additional-clear-keys }}"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "✅ ${{ inputs.cache-type }} cache cleared successfully"
|
||||
echo "Build will proceed from scratch"
|
||||
else
|
||||
echo ""
|
||||
echo "ℹ️ No ${{ inputs.cache-type }} cache clear requested"
|
||||
fi
|
||||
echo "=========================================="
|
||||
|
||||
- name: Restore cache
|
||||
id: restore-cache
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: ${{ inputs.path }}
|
||||
key: ${{ inputs.key }}
|
||||
restore-keys: ${{ inputs.restore-keys }}
|
||||
fail-on-cache-miss: ${{ inputs.fail-on-cache-miss }}
|
||||
lookup-only: ${{ inputs.lookup-only }}
|
||||
137
.github/actions/xahau-ga-dependencies/action.yml
vendored
137
.github/actions/xahau-ga-dependencies/action.yml
vendored
@@ -10,46 +10,21 @@ inputs:
|
||||
required: false
|
||||
default: '.build'
|
||||
compiler-id:
|
||||
description: 'Unique identifier: compiler-version-stdlib[-gccversion] (e.g. clang-14-libstdcxx-gcc11, gcc-13-libstdcxx)'
|
||||
description: 'Unique identifier for compiler/version combination used for cache keys'
|
||||
required: false
|
||||
default: ''
|
||||
cache_version:
|
||||
description: 'Cache version for invalidation'
|
||||
required: false
|
||||
default: '1'
|
||||
cache_enabled:
|
||||
description: 'Whether to use caching'
|
||||
required: false
|
||||
default: 'true'
|
||||
main_branch:
|
||||
description: 'Main branch name for restore keys'
|
||||
required: false
|
||||
default: 'dev'
|
||||
os:
|
||||
description: 'Operating system (Linux, Macos)'
|
||||
required: false
|
||||
default: 'Linux'
|
||||
arch:
|
||||
description: 'Architecture (x86_64, armv8)'
|
||||
required: false
|
||||
default: 'x86_64'
|
||||
compiler:
|
||||
description: 'Compiler type (gcc, clang, apple-clang)'
|
||||
required: true
|
||||
compiler_version:
|
||||
description: 'Compiler version (11, 13, 14, etc.)'
|
||||
required: true
|
||||
cc:
|
||||
description: 'C compiler executable (gcc-13, clang-14, etc.), empty for macOS'
|
||||
required: false
|
||||
default: ''
|
||||
cxx:
|
||||
description: 'C++ compiler executable (g++-14, clang++-14, etc.), empty for macOS'
|
||||
required: false
|
||||
default: ''
|
||||
stdlib:
|
||||
description: 'C++ standard library for Conan configuration (note: also in compiler-id)'
|
||||
required: true
|
||||
type: choice
|
||||
options:
|
||||
- libstdcxx
|
||||
- libcxx
|
||||
|
||||
outputs:
|
||||
cache-hit:
|
||||
@@ -59,89 +34,36 @@ outputs:
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: Configure Conan cache paths
|
||||
if: inputs.os == 'Linux'
|
||||
- name: Generate safe branch name
|
||||
if: inputs.cache_enabled == 'true'
|
||||
id: safe-branch
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p /.conan-cache/conan2 /.conan-cache/conan2_download /.conan-cache/conan2_sources
|
||||
echo 'core.cache:storage_path=/.conan-cache/conan2' > ~/.conan2/global.conf
|
||||
echo 'core.download:download_cache=/.conan-cache/conan2_download' >> ~/.conan2/global.conf
|
||||
echo 'core.sources:download_cache=/.conan-cache/conan2_sources' >> ~/.conan2/global.conf
|
||||
SAFE_BRANCH=$(echo "${{ github.ref_name }}" | tr -c 'a-zA-Z0-9_.-' '-')
|
||||
echo "name=${SAFE_BRANCH}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Configure Conan cache paths
|
||||
if: inputs.gha_cache_enabled == 'false'
|
||||
shell: bash
|
||||
# For self-hosted runners, register cache paths to be used as volumes
|
||||
# This allows the cache to be shared between containers
|
||||
run: |
|
||||
mkdir -p /.conan-cache/conan2 /.conan-cache/conan2_download /.conan-cache/conan2_sources
|
||||
echo 'core.cache:storage_path=/.conan-cache/conan2' > ~/.conan2/global.conf
|
||||
echo 'core.download:download_cache=/.conan-cache/conan2_download' >> ~/.conan2/global.conf
|
||||
echo 'core.sources:download_cache=/.conan-cache/conan2_sources' >> ~/.conan2/global.conf
|
||||
|
||||
- name: Configure Conan
|
||||
shell: bash
|
||||
run: |
|
||||
# Create the default profile directory if it doesn't exist
|
||||
mkdir -p ~/.conan2/profiles
|
||||
|
||||
# Determine the correct libcxx based on stdlib parameter
|
||||
if [ "${{ inputs.stdlib }}" = "libcxx" ]; then
|
||||
LIBCXX="libc++"
|
||||
else
|
||||
LIBCXX="libstdc++11"
|
||||
fi
|
||||
|
||||
# Create profile with our specific settings
|
||||
# This overwrites any cached profile to ensure fresh configuration
|
||||
cat > ~/.conan2/profiles/default <<EOF
|
||||
[settings]
|
||||
arch=${{ inputs.arch }}
|
||||
build_type=${{ inputs.configuration }}
|
||||
compiler=${{ inputs.compiler }}
|
||||
compiler.cppstd=20
|
||||
compiler.libcxx=${LIBCXX}
|
||||
compiler.version=${{ inputs.compiler_version }}
|
||||
os=${{ inputs.os }}
|
||||
EOF
|
||||
|
||||
# Add buildenv and conf sections for Linux (not needed for macOS)
|
||||
if [ "${{ inputs.os }}" = "Linux" ] && [ -n "${{ inputs.cc }}" ]; then
|
||||
cat >> ~/.conan2/profiles/default <<EOF
|
||||
|
||||
[buildenv]
|
||||
CC=/usr/bin/${{ inputs.cc }}
|
||||
CXX=/usr/bin/${{ inputs.cxx }}
|
||||
|
||||
[conf]
|
||||
tools.build:compiler_executables={"c": "/usr/bin/${{ inputs.cc }}", "cpp": "/usr/bin/${{ inputs.cxx }}"}
|
||||
EOF
|
||||
fi
|
||||
|
||||
# Add macOS-specific conf if needed
|
||||
if [ "${{ inputs.os }}" = "Macos" ]; then
|
||||
cat >> ~/.conan2/profiles/default <<EOF
|
||||
|
||||
[conf]
|
||||
# Workaround for gRPC with newer Apple Clang
|
||||
tools.build:cxxflags=["-Wno-missing-template-arg-list-after-template-kw"]
|
||||
EOF
|
||||
fi
|
||||
|
||||
# Display profile for verification
|
||||
conan profile show
|
||||
- name: Restore Conan cache
|
||||
if: inputs.cache_enabled == 'true'
|
||||
id: cache-restore-conan
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: |
|
||||
~/.conan
|
||||
~/.conan2
|
||||
key: ${{ runner.os }}-conan-v${{ inputs.cache_version }}-${{ inputs.compiler-id }}-${{ hashFiles('**/conanfile.txt', '**/conanfile.py') }}-${{ inputs.configuration }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-conan-v${{ inputs.cache_version }}-${{ inputs.compiler-id }}-${{ hashFiles('**/conanfile.txt', '**/conanfile.py') }}-
|
||||
${{ runner.os }}-conan-v${{ inputs.cache_version }}-${{ inputs.compiler-id }}-
|
||||
${{ runner.os }}-conan-v${{ inputs.cache_version }}-
|
||||
|
||||
- name: Export custom recipes
|
||||
shell: bash
|
||||
run: |
|
||||
conan export external/snappy --version 1.1.10 --user xahaud --channel stable
|
||||
conan export external/soci --version 4.0.3 --user xahaud --channel stable
|
||||
conan export external/wasmedge --version 0.11.2 --user xahaud --channel stable
|
||||
conan export external/snappy snappy/1.1.10@
|
||||
conan export external/soci soci/4.0.3@
|
||||
|
||||
- name: Install dependencies
|
||||
shell: bash
|
||||
env:
|
||||
CONAN_REQUEST_TIMEOUT: 180 # Increase timeout to 3 minutes for slow mirrors
|
||||
run: |
|
||||
# Create build directory
|
||||
mkdir -p ${{ inputs.build_dir }}
|
||||
@@ -153,3 +75,12 @@ runs:
|
||||
--build missing \
|
||||
--settings build_type=${{ inputs.configuration }} \
|
||||
..
|
||||
|
||||
- name: Save Conan cache
|
||||
if: inputs.cache_enabled == 'true' && steps.cache-restore-conan.outputs.cache-hit != 'true'
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: |
|
||||
~/.conan
|
||||
~/.conan2
|
||||
key: ${{ steps.cache-restore-conan.outputs.cache-primary-key }}
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
name: 'Get Commit Message'
|
||||
description: 'Gets commit message for both push and pull_request events and sets XAHAU_GA_COMMIT_MSG env var'
|
||||
|
||||
inputs:
|
||||
event-name:
|
||||
description: 'The event name (push or pull_request)'
|
||||
required: true
|
||||
head-commit-message:
|
||||
description: 'The head commit message (for push events)'
|
||||
required: false
|
||||
default: ''
|
||||
pr-head-sha:
|
||||
description: 'The PR head SHA (for pull_request events)'
|
||||
required: false
|
||||
default: ''
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: Get commit message and set environment variable
|
||||
shell: python
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
import json
|
||||
import os
|
||||
import secrets
|
||||
import urllib.request
|
||||
|
||||
event_name = "${{ inputs.event-name }}"
|
||||
pr_head_sha = "${{ inputs.pr-head-sha }}"
|
||||
repository = "${{ github.repository }}"
|
||||
|
||||
print("==========================================")
|
||||
print("Setting XAHAU_GA_COMMIT_MSG environment variable")
|
||||
print("==========================================")
|
||||
print(f"Event: {event_name}")
|
||||
|
||||
if event_name == 'push':
|
||||
# For push events, use the input directly
|
||||
message = """${{ inputs.head-commit-message }}"""
|
||||
print("Source: workflow input (github.event.head_commit.message)")
|
||||
elif event_name == 'pull_request' and pr_head_sha:
|
||||
# For PR events, fetch via GitHub API
|
||||
print(f"Source: GitHub API (fetching commit {pr_head_sha})")
|
||||
try:
|
||||
url = f"https://api.github.com/repos/{repository}/commits/{pr_head_sha}"
|
||||
req = urllib.request.Request(url, headers={
|
||||
"Accept": "application/vnd.github.v3+json",
|
||||
"Authorization": f"Bearer {os.environ.get('GH_TOKEN', '')}"
|
||||
})
|
||||
with urllib.request.urlopen(req) as response:
|
||||
data = json.load(response)
|
||||
message = data["commit"]["message"]
|
||||
except Exception as e:
|
||||
print(f"Failed to fetch commit message: {e}")
|
||||
message = ""
|
||||
else:
|
||||
message = ""
|
||||
print(f"Warning: Unknown event type: {event_name}")
|
||||
|
||||
print(f"Commit message (first 100 chars): {message[:100]}")
|
||||
|
||||
# Write to GITHUB_ENV using heredoc with random delimiter (prevents injection attacks)
|
||||
# See: https://securitylab.github.com/resources/github-actions-untrusted-input/
|
||||
delimiter = f"EOF_{secrets.token_hex(16)}"
|
||||
|
||||
with open(os.environ['GITHUB_ENV'], 'a') as f:
|
||||
f.write(f'XAHAU_GA_COMMIT_MSG<<{delimiter}\n')
|
||||
f.write(message)
|
||||
f.write(f'\n{delimiter}\n')
|
||||
|
||||
print(f"✓ XAHAU_GA_COMMIT_MSG set (available to all subsequent steps)")
|
||||
print("==========================================")
|
||||
6
.github/workflows/build-in-docker.yml
vendored
6
.github/workflows/build-in-docker.yml
vendored
@@ -33,7 +33,7 @@ jobs:
|
||||
fetch-depth: 2 # Only get the last 2 commits, to avoid fetching all history
|
||||
|
||||
build:
|
||||
runs-on: [self-hosted, xahaud-build]
|
||||
runs-on: [self-hosted, vanity]
|
||||
needs: [checkout]
|
||||
defaults:
|
||||
run:
|
||||
@@ -74,7 +74,7 @@ jobs:
|
||||
fi
|
||||
|
||||
tests:
|
||||
runs-on: [self-hosted, xahaud-build]
|
||||
runs-on: [self-hosted, vanity]
|
||||
needs: [build, checkout]
|
||||
defaults:
|
||||
run:
|
||||
@@ -84,7 +84,7 @@ jobs:
|
||||
run: /bin/bash docker-unit-tests.sh
|
||||
|
||||
cleanup:
|
||||
runs-on: [self-hosted, xahaud-build]
|
||||
runs-on: [self-hosted, vanity]
|
||||
needs: [tests, checkout]
|
||||
if: always()
|
||||
steps:
|
||||
|
||||
1
.github/workflows/instrumentation.yml
vendored
1
.github/workflows/instrumentation.yml
vendored
@@ -21,7 +21,6 @@ jobs:
|
||||
# with compiler versions. Instrumentation requires clang version 16 or later
|
||||
|
||||
instrumentation-build:
|
||||
if: false # disable for now
|
||||
env:
|
||||
CLANG_RELEASE: 16
|
||||
strategy:
|
||||
|
||||
36
.github/workflows/verify-generated-headers.yml
vendored
36
.github/workflows/verify-generated-headers.yml
vendored
@@ -1,36 +0,0 @@
|
||||
name: Verify Generated Hook Headers
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
verify-generated-headers:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- target: hook/error.h
|
||||
generator: ./hook/generate_error.sh
|
||||
- target: hook/extern.h
|
||||
generator: ./hook/generate_extern.sh
|
||||
- target: hook/sfcodes.h
|
||||
generator: bash ./hook/generate_sfcodes.sh
|
||||
- target: hook/tts.h
|
||||
generator: ./hook/generate_tts.sh
|
||||
runs-on: ubuntu-latest
|
||||
name: ${{ matrix.target }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Verify ${{ matrix.target }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
chmod +x hook/generate_*.sh || true
|
||||
|
||||
tmp=$(mktemp)
|
||||
trap 'rm -f "$tmp"' EXIT
|
||||
|
||||
${{ matrix.generator }} > "$tmp"
|
||||
diff -u ${{ matrix.target }} "$tmp"
|
||||
80
.github/workflows/xahau-ga-macos.yml
vendored
80
.github/workflows/xahau-ga-macos.yml
vendored
@@ -5,8 +5,6 @@ on:
|
||||
branches: ["dev", "candidate", "release"]
|
||||
pull_request:
|
||||
branches: ["dev", "candidate", "release"]
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
@@ -20,39 +18,62 @@ jobs:
|
||||
- Ninja
|
||||
configuration:
|
||||
- Debug
|
||||
runs-on: [self-hosted, macOS]
|
||||
runs-on: macos-15
|
||||
env:
|
||||
build_dir: .build
|
||||
# Bump this number to invalidate all caches globally.
|
||||
CACHE_VERSION: 3
|
||||
CACHE_VERSION: 1
|
||||
MAIN_BRANCH_NAME: dev
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Add Homebrew to PATH
|
||||
- name: Install Conan
|
||||
run: |
|
||||
echo "/opt/homebrew/bin" >> "$GITHUB_PATH"
|
||||
echo "/opt/homebrew/sbin" >> "$GITHUB_PATH"
|
||||
brew install conan@1
|
||||
# Add Conan 1 to the PATH for this job
|
||||
echo "$(brew --prefix conan@1)/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Install Coreutils
|
||||
run: |
|
||||
brew install coreutils
|
||||
echo "Num proc: $(nproc)"
|
||||
|
||||
# To isolate environments for each Runner, instead of installing globally with brew,
|
||||
# use mise to isolate environments for each Runner directory.
|
||||
- name: Setup toolchain (mise)
|
||||
uses: jdx/mise-action@v2
|
||||
with:
|
||||
install: true
|
||||
- name: Install Ninja
|
||||
if: matrix.generator == 'Ninja'
|
||||
run: brew install ninja
|
||||
|
||||
- name: Install tools via mise
|
||||
- name: Install Python
|
||||
run: |
|
||||
mise install
|
||||
mise use cmake@3.25.3 python@3.12 pipx@latest conan@2 ninja@latest ccache@latest
|
||||
mise reshim
|
||||
echo "$HOME/.local/share/mise/shims" >> "$GITHUB_PATH"
|
||||
if which python3 > /dev/null 2>&1; then
|
||||
echo "Python 3 executable exists"
|
||||
python3 --version
|
||||
else
|
||||
brew install python@3.12
|
||||
fi
|
||||
# Create 'python' symlink if it doesn't exist (for tools expecting 'python')
|
||||
if ! which python > /dev/null 2>&1; then
|
||||
sudo ln -sf $(which python3) /usr/local/bin/python
|
||||
fi
|
||||
|
||||
- name: Install CMake
|
||||
run: |
|
||||
if which cmake > /dev/null 2>&1; then
|
||||
echo "cmake executable exists"
|
||||
cmake --version
|
||||
else
|
||||
brew install cmake
|
||||
fi
|
||||
|
||||
- name: Install ccache
|
||||
run: brew install ccache
|
||||
|
||||
- name: Configure ccache
|
||||
uses: ./.github/actions/xahau-configure-ccache
|
||||
with:
|
||||
max_size: 2G
|
||||
hash_dir: true
|
||||
compiler_check: content
|
||||
|
||||
- name: Check environment
|
||||
run: |
|
||||
@@ -66,20 +87,10 @@ jobs:
|
||||
echo "---- Full Environment ----"
|
||||
env
|
||||
|
||||
- name: Get commit message
|
||||
id: get-commit-message
|
||||
uses: ./.github/actions/xahau-ga-get-commit-message
|
||||
with:
|
||||
event-name: ${{ github.event_name }}
|
||||
head-commit-message: ${{ github.event.head_commit.message }}
|
||||
pr-head-sha: ${{ github.event.pull_request.head.sha }}
|
||||
|
||||
- name: Detect compiler version
|
||||
id: detect-compiler
|
||||
- name: Configure Conan
|
||||
run: |
|
||||
COMPILER_VERSION=$(clang --version | grep -oE 'version [0-9]+' | grep -oE '[0-9]+')
|
||||
echo "compiler_version=${COMPILER_VERSION}" >> $GITHUB_OUTPUT
|
||||
echo "Detected Apple Clang version: ${COMPILER_VERSION}"
|
||||
conan profile new default --detect || true # Ignore error if profile exists
|
||||
conan profile update settings.compiler.cppstd=20 default
|
||||
|
||||
- name: Install dependencies
|
||||
uses: ./.github/actions/xahau-ga-dependencies
|
||||
@@ -89,11 +100,6 @@ jobs:
|
||||
compiler-id: clang
|
||||
cache_version: ${{ env.CACHE_VERSION }}
|
||||
main_branch: ${{ env.MAIN_BRANCH_NAME }}
|
||||
os: Macos
|
||||
arch: armv8
|
||||
compiler: apple-clang
|
||||
compiler_version: ${{ steps.detect-compiler.outputs.compiler_version }}
|
||||
stdlib: libcxx
|
||||
|
||||
- name: Build
|
||||
uses: ./.github/actions/xahau-ga-build
|
||||
@@ -104,8 +110,6 @@ jobs:
|
||||
compiler-id: clang
|
||||
cache_version: ${{ env.CACHE_VERSION }}
|
||||
main_branch: ${{ env.MAIN_BRANCH_NAME }}
|
||||
stdlib: libcxx
|
||||
ccache_max_size: '100G'
|
||||
|
||||
- name: Test
|
||||
run: |
|
||||
|
||||
304
.github/workflows/xahau-ga-nix.yml
vendored
304
.github/workflows/xahau-ga-nix.yml
vendored
@@ -5,195 +5,30 @@ on:
|
||||
branches: ["dev", "candidate", "release"]
|
||||
pull_request:
|
||||
branches: ["dev", "candidate", "release"]
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
matrix-setup:
|
||||
runs-on: [self-hosted, generic, 20.04]
|
||||
container: python:3-slim
|
||||
outputs:
|
||||
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
||||
steps:
|
||||
- name: escape double quotes
|
||||
id: escape
|
||||
shell: bash
|
||||
env:
|
||||
PR_TITLE: ${{ github.event.pull_request.title }}
|
||||
run: |
|
||||
ESCAPED_PR_TITLE="${PR_TITLE//\"/\\\"}"
|
||||
echo "title=${ESCAPED_PR_TITLE}" >> "$GITHUB_OUTPUT"
|
||||
- name: Generate build matrix
|
||||
id: set-matrix
|
||||
shell: python
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
import json
|
||||
import os
|
||||
import urllib.request
|
||||
|
||||
# Full matrix with all 6 compiler configurations
|
||||
# Each configuration includes all parameters needed by the build job
|
||||
full_matrix = [
|
||||
{
|
||||
"compiler_id": "gcc-11-libstdcxx",
|
||||
"compiler": "gcc",
|
||||
"cc": "gcc-11",
|
||||
"cxx": "g++-11",
|
||||
"compiler_version": 11,
|
||||
"stdlib": "libstdcxx",
|
||||
"configuration": "Debug"
|
||||
},
|
||||
{
|
||||
"compiler_id": "gcc-13-libstdcxx",
|
||||
"compiler": "gcc",
|
||||
"cc": "gcc-13",
|
||||
"cxx": "g++-13",
|
||||
"compiler_version": 13,
|
||||
"stdlib": "libstdcxx",
|
||||
"configuration": "Debug"
|
||||
},
|
||||
{
|
||||
"compiler_id": "clang-14-libstdcxx-gcc11",
|
||||
"compiler": "clang",
|
||||
"cc": "clang-14",
|
||||
"cxx": "clang++-14",
|
||||
"compiler_version": 14,
|
||||
"stdlib": "libstdcxx",
|
||||
"clang_gcc_toolchain": 11,
|
||||
"configuration": "Debug"
|
||||
},
|
||||
{
|
||||
"compiler_id": "clang-16-libstdcxx-gcc13",
|
||||
"compiler": "clang",
|
||||
"cc": "clang-16",
|
||||
"cxx": "clang++-16",
|
||||
"compiler_version": 16,
|
||||
"stdlib": "libstdcxx",
|
||||
"clang_gcc_toolchain": 13,
|
||||
"configuration": "Debug"
|
||||
},
|
||||
{
|
||||
"compiler_id": "clang-17-libcxx",
|
||||
"compiler": "clang",
|
||||
"cc": "clang-17",
|
||||
"cxx": "clang++-17",
|
||||
"compiler_version": 17,
|
||||
"stdlib": "libcxx",
|
||||
"configuration": "Debug"
|
||||
},
|
||||
{
|
||||
# Clang 18 - testing if it's faster than Clang 17 with libc++
|
||||
# Requires patching Conan v1 settings.yml to add version 18
|
||||
"compiler_id": "clang-18-libcxx",
|
||||
"compiler": "clang",
|
||||
"cc": "clang-18",
|
||||
"cxx": "clang++-18",
|
||||
"compiler_version": 18,
|
||||
"stdlib": "libcxx",
|
||||
"configuration": "Debug"
|
||||
}
|
||||
]
|
||||
|
||||
# Minimal matrix for PRs and feature branches
|
||||
minimal_matrix = [
|
||||
full_matrix[1], # gcc-13 (middle-ground gcc)
|
||||
full_matrix[2] # clang-14 (mature, stable clang)
|
||||
]
|
||||
|
||||
# Determine which matrix to use based on the target branch
|
||||
ref = "${{ github.ref }}"
|
||||
base_ref = "${{ github.base_ref }}" # For PRs, this is the target branch
|
||||
event_name = "${{ github.event_name }}"
|
||||
pr_title = """${{ steps.escape.outputs.title }}"""
|
||||
pr_head_sha = "${{ github.event.pull_request.head.sha }}"
|
||||
|
||||
# Get commit message - for PRs, fetch via API since head_commit.message is empty
|
||||
if event_name == "pull_request" and pr_head_sha:
|
||||
try:
|
||||
url = f"https://api.github.com/repos/${{ github.repository }}/commits/{pr_head_sha}"
|
||||
req = urllib.request.Request(url, headers={
|
||||
"Accept": "application/vnd.github.v3+json",
|
||||
"Authorization": f"Bearer {os.environ.get('GH_TOKEN', '')}"
|
||||
})
|
||||
with urllib.request.urlopen(req) as response:
|
||||
data = json.load(response)
|
||||
commit_message = data["commit"]["message"]
|
||||
except Exception as e:
|
||||
print(f"Failed to fetch commit message: {e}")
|
||||
commit_message = ""
|
||||
else:
|
||||
commit_message = """${{ github.event.head_commit.message }}"""
|
||||
|
||||
# Debug logging
|
||||
print(f"Event: {event_name}")
|
||||
print(f"Ref: {ref}")
|
||||
print(f"Base ref: {base_ref}")
|
||||
print(f"PR head SHA: {pr_head_sha}")
|
||||
print(f"PR title: {pr_title}")
|
||||
print(f"Commit message: {commit_message}")
|
||||
|
||||
# Check for override tags in commit message or PR title
|
||||
force_full = "[ci-nix-full-matrix]" in commit_message or "[ci-nix-full-matrix]" in pr_title
|
||||
print(f"Force full matrix: {force_full}")
|
||||
|
||||
# Check if this is targeting a main branch
|
||||
# For PRs: check base_ref (target branch)
|
||||
# For pushes: check ref (current branch)
|
||||
main_branches = ["refs/heads/dev", "refs/heads/release", "refs/heads/candidate"]
|
||||
|
||||
if force_full:
|
||||
# Override: always use full matrix if tag is present
|
||||
use_full = True
|
||||
elif event_name == "pull_request":
|
||||
# For PRs, base_ref is just the branch name (e.g., "dev", not "refs/heads/dev")
|
||||
# Check if the PR targets release or candidate (more critical branches)
|
||||
use_full = base_ref in ["release", "candidate"]
|
||||
else:
|
||||
# For pushes, ref is the full reference (e.g., "refs/heads/dev")
|
||||
use_full = ref in main_branches
|
||||
|
||||
# Select the appropriate matrix
|
||||
if use_full:
|
||||
if force_full:
|
||||
print(f"Using FULL matrix (6 configs) - forced by [ci-nix-full-matrix] tag")
|
||||
else:
|
||||
print(f"Using FULL matrix (6 configs) - targeting main branch")
|
||||
matrix = full_matrix
|
||||
else:
|
||||
print(f"Using MINIMAL matrix (2 configs) - feature branch/PR")
|
||||
matrix = minimal_matrix
|
||||
|
||||
# Output the matrix as JSON
|
||||
output = json.dumps({"include": matrix})
|
||||
with open(os.environ['GITHUB_OUTPUT'], 'a') as f:
|
||||
f.write(f"matrix={output}\n")
|
||||
|
||||
build:
|
||||
needs: matrix-setup
|
||||
runs-on: [self-hosted, generic, 20.04]
|
||||
container:
|
||||
image: ubuntu:24.04
|
||||
volumes:
|
||||
- /home/runner/.conan-cache:/.conan-cache
|
||||
- /home/runner/.ccache-cache:/github/home/.ccache-cache
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
build-job:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
artifact_name: ${{ steps.set-artifact-name.outputs.artifact_name }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix: ${{ fromJSON(needs.matrix-setup.outputs.matrix) }}
|
||||
matrix:
|
||||
compiler: [gcc]
|
||||
configuration: [Debug]
|
||||
include:
|
||||
- compiler: gcc
|
||||
cc: gcc-11
|
||||
cxx: g++-11
|
||||
compiler_id: gcc-11
|
||||
env:
|
||||
build_dir: .build
|
||||
# Bump this number to invalidate all caches globally.
|
||||
CACHE_VERSION: 3
|
||||
CACHE_VERSION: 1
|
||||
MAIN_BRANCH_NAME: dev
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -201,80 +36,36 @@ jobs:
|
||||
|
||||
- name: Install build dependencies
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y software-properties-common
|
||||
add-apt-repository ppa:ubuntu-toolchain-r/test -y
|
||||
apt-get update
|
||||
apt-get install -y python3 python-is-python3 pipx
|
||||
pipx ensurepath
|
||||
apt-get install -y cmake ninja-build ${{ matrix.cc }} ${{ matrix.cxx }} ccache
|
||||
apt-get install -y perl # for openssl build
|
||||
apt-get install -y libsqlite3-dev # for xahaud build
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y ninja-build ${{ matrix.cc }} ${{ matrix.cxx }} ccache
|
||||
# Install specific Conan version needed
|
||||
pip install --upgrade "conan<2"
|
||||
|
||||
# Install the specific GCC version needed for Clang
|
||||
if [ -n "${{ matrix.clang_gcc_toolchain }}" ]; then
|
||||
echo "=== Installing GCC ${{ matrix.clang_gcc_toolchain }} for Clang ==="
|
||||
apt-get install -y gcc-${{ matrix.clang_gcc_toolchain }} g++-${{ matrix.clang_gcc_toolchain }} libstdc++-${{ matrix.clang_gcc_toolchain }}-dev
|
||||
- name: Configure ccache
|
||||
uses: ./.github/actions/xahau-configure-ccache
|
||||
with:
|
||||
max_size: 2G
|
||||
hash_dir: true
|
||||
compiler_check: content
|
||||
|
||||
echo "=== GCC versions available after installation ==="
|
||||
ls -la /usr/lib/gcc/x86_64-linux-gnu/ | grep -E "^d"
|
||||
- name: Configure Conan
|
||||
run: |
|
||||
conan profile new default --detect || true # Ignore error if profile exists
|
||||
conan profile update settings.compiler.cppstd=20 default
|
||||
conan profile update settings.compiler=${{ matrix.compiler }} default
|
||||
conan profile update settings.compiler.libcxx=libstdc++11 default
|
||||
conan profile update env.CC=/usr/bin/${{ matrix.cc }} default
|
||||
conan profile update env.CXX=/usr/bin/${{ matrix.cxx }} default
|
||||
conan profile update conf.tools.build:compiler_executables='{"c": "/usr/bin/${{ matrix.cc }}", "cpp": "/usr/bin/${{ matrix.cxx }}"}' default
|
||||
|
||||
# Set correct compiler version based on matrix.compiler
|
||||
if [ "${{ matrix.compiler }}" = "gcc" ]; then
|
||||
conan profile update settings.compiler.version=11 default
|
||||
elif [ "${{ matrix.compiler }}" = "clang" ]; then
|
||||
conan profile update settings.compiler.version=14 default
|
||||
fi
|
||||
|
||||
# For Clang < 16 with --gcc-toolchain, hide newer GCC versions
|
||||
# This is needed because --gcc-toolchain still picks the highest version
|
||||
#
|
||||
# THE GREAT GCC HIDING TRICK (for Clang < 16):
|
||||
# Clang versions before 16 don't have --gcc-install-dir, only --gcc-toolchain
|
||||
# which is deprecated and still uses discovery heuristics that ALWAYS pick
|
||||
# the highest version number. So we play a sneaky game...
|
||||
#
|
||||
# We rename newer GCC versions to very low integers (1, 2, 3...) which makes
|
||||
# Clang think they're ancient GCC versions. Since 11 > 3 > 2 > 1, Clang will
|
||||
# pick GCC 11 over our renamed versions. It's dumb but it works!
|
||||
#
|
||||
# Example: GCC 12→1, GCC 13→2, GCC 14→3, so Clang picks 11 (highest number)
|
||||
if [ -n "${{ matrix.clang_gcc_toolchain }}" ] && [ "${{ matrix.compiler_version }}" -lt "16" ]; then
|
||||
echo "=== Hiding GCC versions newer than ${{ matrix.clang_gcc_toolchain }} for Clang < 16 ==="
|
||||
target_version=${{ matrix.clang_gcc_toolchain }}
|
||||
counter=1 # Start with 1 - these will be seen as "GCC version 1, 2, 3" etc
|
||||
for dir in /usr/lib/gcc/x86_64-linux-gnu/*/; do
|
||||
if [ -d "$dir" ]; then
|
||||
version=$(basename "$dir")
|
||||
# Check if version is numeric and greater than target
|
||||
if [[ "$version" =~ ^[0-9]+$ ]] && [ "$version" -gt "$target_version" ]; then
|
||||
echo "Hiding GCC $version -> renaming to $counter (will be seen as GCC version $counter)"
|
||||
# Safety check: ensure target doesn't already exist
|
||||
if [ ! -e "/usr/lib/gcc/x86_64-linux-gnu/$counter" ]; then
|
||||
mv "$dir" "/usr/lib/gcc/x86_64-linux-gnu/$counter"
|
||||
else
|
||||
echo "ERROR: Cannot rename GCC $version - /usr/lib/gcc/x86_64-linux-gnu/$counter already exists"
|
||||
exit 1
|
||||
fi
|
||||
counter=$((counter + 1))
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Verify what Clang will use
|
||||
if [ -n "${{ matrix.clang_gcc_toolchain }}" ]; then
|
||||
echo "=== Verifying GCC toolchain selection ==="
|
||||
echo "Available GCC versions:"
|
||||
ls -la /usr/lib/gcc/x86_64-linux-gnu/ | grep -E "^d.*[0-9]+$" || true
|
||||
|
||||
echo ""
|
||||
echo "Clang's detected GCC installation:"
|
||||
${{ matrix.cxx }} -v -E -x c++ /dev/null -o /dev/null 2>&1 | grep "Found candidate GCC installation" || true
|
||||
fi
|
||||
|
||||
# Install libc++ dev packages if using libc++ (not needed for libstdc++)
|
||||
if [ "${{ matrix.stdlib }}" = "libcxx" ]; then
|
||||
apt-get install -y libc++-${{ matrix.compiler_version }}-dev libc++abi-${{ matrix.compiler_version }}-dev
|
||||
fi
|
||||
|
||||
# Install Conan 2
|
||||
pipx install "conan>=2.0,<3"
|
||||
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
||||
# Display profile for verification
|
||||
conan profile show default
|
||||
|
||||
- name: Check environment
|
||||
run: |
|
||||
@@ -288,14 +79,6 @@ jobs:
|
||||
echo "---- Full Environment ----"
|
||||
env
|
||||
|
||||
- name: Get commit message
|
||||
id: get-commit-message
|
||||
uses: ./.github/actions/xahau-ga-get-commit-message
|
||||
with:
|
||||
event-name: ${{ github.event_name }}
|
||||
head-commit-message: ${{ github.event.head_commit.message }}
|
||||
pr-head-sha: ${{ github.event.pull_request.head.sha }}
|
||||
|
||||
- name: Install dependencies
|
||||
uses: ./.github/actions/xahau-ga-dependencies
|
||||
with:
|
||||
@@ -304,12 +87,6 @@ jobs:
|
||||
compiler-id: ${{ matrix.compiler_id }}
|
||||
cache_version: ${{ env.CACHE_VERSION }}
|
||||
main_branch: ${{ env.MAIN_BRANCH_NAME }}
|
||||
compiler: ${{ matrix.compiler }}
|
||||
compiler_version: ${{ matrix.compiler_version }}
|
||||
cc: ${{ matrix.cc }}
|
||||
cxx: ${{ matrix.cxx }}
|
||||
stdlib: ${{ matrix.stdlib }}
|
||||
gha_cache_enabled: 'false' # Disable caching for self hosted runner
|
||||
|
||||
- name: Build
|
||||
uses: ./.github/actions/xahau-ga-build
|
||||
@@ -322,9 +99,6 @@ jobs:
|
||||
compiler-id: ${{ matrix.compiler_id }}
|
||||
cache_version: ${{ env.CACHE_VERSION }}
|
||||
main_branch: ${{ env.MAIN_BRANCH_NAME }}
|
||||
stdlib: ${{ matrix.stdlib }}
|
||||
clang_gcc_toolchain: ${{ matrix.clang_gcc_toolchain || '' }}
|
||||
ccache_max_size: '100G'
|
||||
|
||||
- name: Set artifact name
|
||||
id: set-artifact-name
|
||||
@@ -346,4 +120,4 @@ jobs:
|
||||
else
|
||||
echo "Error: rippled executable not found in ${{ env.build_dir }}"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -24,11 +24,6 @@ bin/project-cache.jam
|
||||
|
||||
build/docker
|
||||
|
||||
# Ignore release builder files
|
||||
.env
|
||||
release-build
|
||||
cmake-*.tar.gz
|
||||
|
||||
# Ignore object files.
|
||||
*.o
|
||||
build
|
||||
|
||||
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@@ -8,6 +8,6 @@
|
||||
"editor.semanticHighlighting.enabled": true,
|
||||
"editor.tabSize": 4,
|
||||
"editor.defaultFormatter": "xaver.clang-format",
|
||||
"editor.formatOnSave": true
|
||||
"editor.formatOnSave": false
|
||||
}
|
||||
}
|
||||
|
||||
144
BUILD.md
144
BUILD.md
@@ -36,7 +36,7 @@ See [System Requirements](https://xrpl.org/system-requirements.html).
|
||||
Building rippled generally requires git, Python, Conan, CMake, and a C++ compiler. Some guidance on setting up such a [C++ development environment can be found here](./docs/build/environment.md).
|
||||
|
||||
- [Python 3.7](https://www.python.org/downloads/)
|
||||
- [Conan 2.x](https://conan.io/downloads)
|
||||
- [Conan 1.60](https://conan.io/downloads.html)[^1]
|
||||
- [CMake 3.16](https://cmake.org/download/)
|
||||
|
||||
[^1]: It is possible to build with Conan 2.x,
|
||||
@@ -89,24 +89,13 @@ If you are unfamiliar with Conan, then please read [this crash course](./docs/bu
|
||||
You'll need at least one Conan profile:
|
||||
|
||||
```
|
||||
conan profile detect --force
|
||||
conan profile new default --detect
|
||||
```
|
||||
|
||||
Update the compiler settings:
|
||||
|
||||
For Conan 2, you can edit the profile directly at `~/.conan2/profiles/default`,
|
||||
or use the Conan CLI. Ensure C++20 is set:
|
||||
|
||||
```
|
||||
conan profile show
|
||||
```
|
||||
|
||||
Look for `compiler.cppstd=20` in the output. If it's not set, edit the profile:
|
||||
|
||||
```
|
||||
# Edit ~/.conan2/profiles/default and ensure these settings exist:
|
||||
[settings]
|
||||
compiler.cppstd=20
|
||||
conan profile update settings.compiler.cppstd=20 default
|
||||
```
|
||||
|
||||
Configure Conan (1.x only) to use recipe revisions:
|
||||
@@ -121,9 +110,7 @@ If you are linking with libstdc++ (see profile setting `compiler.libcxx`),
|
||||
then you will need to choose the `libstdc++11` ABI:
|
||||
|
||||
```
|
||||
# In ~/.conan2/profiles/default, ensure:
|
||||
[settings]
|
||||
compiler.libcxx=libstdc++11
|
||||
conan profile update settings.compiler.libcxx=libstdc++11 default
|
||||
```
|
||||
|
||||
|
||||
@@ -148,50 +135,73 @@ Prompt" for the version of Visual Studio that you have installed.
|
||||
architecture:
|
||||
|
||||
```
|
||||
# In ~/.conan2/profiles/default, ensure:
|
||||
[settings]
|
||||
arch=x86_64
|
||||
conan profile update settings.arch=x86_64 default
|
||||
```
|
||||
|
||||
3. (Optional) If you have multiple compilers installed on your platform,
|
||||
make sure that Conan and CMake select the one you want to use.
|
||||
This setting will set the correct variables (`CMAKE_<LANG>_COMPILER`)
|
||||
in the generated CMake toolchain file.
|
||||
### Multiple compilers
|
||||
|
||||
When `/usr/bin/g++` exists on a platform, it is the default cpp compiler. This
|
||||
default works for some users.
|
||||
|
||||
However, if this compiler cannot build rippled or its dependencies, then you can
|
||||
install another compiler and set Conan and CMake to use it.
|
||||
Update the `conf.tools.build:compiler_executables` setting in order to set the correct variables (`CMAKE_<LANG>_COMPILER`) in the
|
||||
generated CMake toolchain file.
|
||||
For example, on Ubuntu 20, you may have gcc at `/usr/bin/gcc` and g++ at `/usr/bin/g++`; if that is the case, you can select those compilers with:
|
||||
```
|
||||
conan profile update 'conf.tools.build:compiler_executables={"c": "/usr/bin/gcc", "cpp": "/usr/bin/g++"}' default
|
||||
```
|
||||
|
||||
Replace `/usr/bin/gcc` and `/usr/bin/g++` with paths to the desired compilers.
|
||||
|
||||
It should choose the compiler for dependencies as well,
|
||||
but not all of them have a Conan recipe that respects this setting (yet).
|
||||
For the rest, you can set these environment variables.
|
||||
Replace `<path>` with paths to the desired compilers:
|
||||
|
||||
- `conan profile update env.CC=<path> default`
|
||||
- `conan profile update env.CXX=<path> default`
|
||||
|
||||
Export our [Conan recipe for Snappy](./external/snappy).
|
||||
It does not explicitly link the C++ standard library,
|
||||
which allows you to statically link it with GCC, if you want.
|
||||
|
||||
```
|
||||
# In ~/.conan2/profiles/default, add under [conf] section:
|
||||
[conf]
|
||||
tools.build:compiler_executables={"c": "<path>", "cpp": "<path>"}
|
||||
```
|
||||
|
||||
For setting environment variables for dependencies:
|
||||
|
||||
```
|
||||
# In ~/.conan2/profiles/default, add under [buildenv] section:
|
||||
[buildenv]
|
||||
CC=<path>
|
||||
CXX=<path>
|
||||
```
|
||||
|
||||
4. Export our [Conan recipe for Snappy](./external/snappy).
|
||||
It doesn't explicitly link the C++ standard library,
|
||||
which allows you to statically link it with GCC, if you want.
|
||||
|
||||
```
|
||||
conan export external/snappy --version 1.1.10 --user xahaud --channel stable
|
||||
# Conan 1.x
|
||||
conan export external/snappy snappy/1.1.10@
|
||||
# Conan 2.x
|
||||
conan export --version 1.1.10 external/snappy
|
||||
```
|
||||
|
||||
Export our [Conan recipe for RocksDB](./external/rocksdb).
|
||||
It does not override paths to dependencies when building with Visual Studio.
|
||||
|
||||
```
|
||||
conan export external/soci --version 4.0.3 --user xahaud --channel stable
|
||||
# Conan 1.x
|
||||
conan export external/rocksdb rocksdb/6.29.5@
|
||||
# Conan 2.x
|
||||
conan export --version 6.29.5 external/rocksdb
|
||||
```
|
||||
|
||||
6. Export our [Conan recipe for WasmEdge](./external/wasmedge).
|
||||
Export our [Conan recipe for SOCI](./external/soci).
|
||||
It patches their CMake to correctly import its dependencies.
|
||||
|
||||
```
|
||||
conan export external/wasmedge --version 0.11.2 --user xahaud --channel stable
|
||||
# Conan 1.x
|
||||
conan export external/soci soci/4.0.3@
|
||||
# Conan 2.x
|
||||
conan export --version 4.0.3 external/soci
|
||||
```
|
||||
|
||||
Export our [Conan recipe for NuDB](./external/nudb).
|
||||
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 export --version 2.0.8 external/nudb
|
||||
```
|
||||
|
||||
### Build and Test
|
||||
@@ -391,26 +401,40 @@ and can be helpful for detecting `#include` omissions.
|
||||
If you have trouble building dependencies after changing Conan settings,
|
||||
try removing the Conan cache.
|
||||
|
||||
For Conan 2:
|
||||
```
|
||||
rm -rf ~/.conan2/p
|
||||
```
|
||||
|
||||
Or clear the entire Conan 2 cache:
|
||||
```
|
||||
conan cache clean "*"
|
||||
rm -rf ~/.conan/data
|
||||
```
|
||||
|
||||
|
||||
### macOS compilation with Apple Clang 17+
|
||||
### 'protobuf/port_def.inc' file not found
|
||||
|
||||
If you're on macOS with Apple Clang 17 or newer, you need to add a compiler flag to work around a compilation error in gRPC dependencies.
|
||||
|
||||
Edit `~/.conan2/profiles/default` and add under the `[conf]` section:
|
||||
If `cmake --build .` results in an error due to a missing a protobuf file, then you might have generated CMake files for a different `build_type` than the `CMAKE_BUILD_TYPE` you passed to conan.
|
||||
|
||||
```
|
||||
[conf]
|
||||
tools.build:cxxflags=["-Wno-missing-template-arg-list-after-template-kw"]
|
||||
/rippled/.build/pb-xrpl.libpb/xrpl/proto/ripple.pb.h:10:10: fatal error: 'google/protobuf/port_def.inc' file not found
|
||||
10 | #include <google/protobuf/port_def.inc>
|
||||
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
1 error generated.
|
||||
```
|
||||
|
||||
For example, if you want to build Debug:
|
||||
|
||||
1. For conan install, pass `--settings build_type=Debug`
|
||||
2. For cmake, pass `-DCMAKE_BUILD_TYPE=Debug`
|
||||
|
||||
|
||||
### no std::result_of
|
||||
|
||||
If your compiler version is recent enough to have removed `std::result_of` as
|
||||
part of C++20, e.g. Apple Clang 15.0, then you might need to add a preprocessor
|
||||
definition to your build.
|
||||
|
||||
```
|
||||
conan profile update 'options.boost:extra_b2_flags="define=BOOST_ASIO_HAS_STD_INVOKE_RESULT"' default
|
||||
conan profile update 'env.CFLAGS="-DBOOST_ASIO_HAS_STD_INVOKE_RESULT"' default
|
||||
conan profile update 'env.CXXFLAGS="-DBOOST_ASIO_HAS_STD_INVOKE_RESULT"' default
|
||||
conan profile update 'conf.tools.build:cflags+=["-DBOOST_ASIO_HAS_STD_INVOKE_RESULT"]' default
|
||||
conan profile update 'conf.tools.build:cxxflags+=["-DBOOST_ASIO_HAS_STD_INVOKE_RESULT"]' default
|
||||
```
|
||||
|
||||
|
||||
|
||||
@@ -103,10 +103,6 @@ test.protocol > test.toplevel
|
||||
test.protocol > xrpl.basics
|
||||
test.protocol > xrpl.json
|
||||
test.protocol > xrpl.protocol
|
||||
test.rdb > test.jtx
|
||||
test.rdb > test.toplevel
|
||||
test.rdb > xrpld.app
|
||||
test.rdb > xrpld.core
|
||||
test.resource > test.unit_test
|
||||
test.resource > xrpl.basics
|
||||
test.resource > xrpl.resource
|
||||
|
||||
144
CMakeLists.txt
144
CMakeLists.txt
@@ -41,16 +41,6 @@ if(Git_FOUND)
|
||||
endif()
|
||||
endif() #git
|
||||
|
||||
# make SOURCE_ROOT_PATH define available for logging
|
||||
set(SOURCE_ROOT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/src/")
|
||||
add_definitions(-DSOURCE_ROOT_PATH="${SOURCE_ROOT_PATH}")
|
||||
|
||||
# BEAST_ENHANCED_LOGGING - adds file:line numbers and formatting to logs
|
||||
# Automatically enabled for Debug builds via generator expression
|
||||
# Can be explicitly controlled with -DBEAST_ENHANCED_LOGGING=ON/OFF
|
||||
option(BEAST_ENHANCED_LOGGING "Include file and line numbers in log messages (auto: Debug=ON, Release=OFF)" OFF)
|
||||
message(STATUS "BEAST_ENHANCED_LOGGING option: ${BEAST_ENHANCED_LOGGING}")
|
||||
|
||||
if(thread_safety_analysis)
|
||||
add_compile_options(-Wthread-safety -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS -DRIPPLE_ENABLE_THREAD_SAFETY_ANNOTATIONS)
|
||||
add_compile_options("-stdlib=libc++")
|
||||
@@ -68,6 +58,11 @@ if(CMAKE_TOOLCHAIN_FILE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT USE_CONAN)
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/deps")
|
||||
endif()
|
||||
|
||||
include (CheckCXXCompilerFlag)
|
||||
include (FetchContent)
|
||||
include (ExternalProject)
|
||||
@@ -79,7 +74,9 @@ endif ()
|
||||
include(RippledSanity)
|
||||
include(RippledVersion)
|
||||
include(RippledSettings)
|
||||
|
||||
if (NOT USE_CONAN)
|
||||
include(RippledNIH)
|
||||
endif()
|
||||
# this check has to remain in the top-level cmake
|
||||
# because of the early return statement
|
||||
if (packages_only)
|
||||
@@ -91,56 +88,81 @@ endif ()
|
||||
include(RippledCompiler)
|
||||
include(RippledInterface)
|
||||
|
||||
include(deps/Boost)
|
||||
find_package(OpenSSL 1.1.1 REQUIRED)
|
||||
set_target_properties(OpenSSL::SSL PROPERTIES
|
||||
INTERFACE_COMPILE_DEFINITIONS OPENSSL_NO_SSL2
|
||||
)
|
||||
set(SECP256K1_INSTALL TRUE)
|
||||
add_subdirectory(external/secp256k1)
|
||||
add_library(secp256k1::secp256k1 ALIAS secp256k1)
|
||||
add_subdirectory(external/ed25519-donna)
|
||||
add_subdirectory(external/antithesis-sdk)
|
||||
find_package(gRPC REQUIRED)
|
||||
find_package(lz4 REQUIRED)
|
||||
# Target names with :: are not allowed in a generator expression.
|
||||
# We need to pull the include directories and imported location properties
|
||||
# from separate targets.
|
||||
find_package(LibArchive REQUIRED)
|
||||
find_package(SOCI REQUIRED)
|
||||
find_package(SQLite3 REQUIRED)
|
||||
include(deps/WasmEdge)
|
||||
option(rocksdb "Enable RocksDB" ON)
|
||||
if(rocksdb)
|
||||
find_package(RocksDB REQUIRED)
|
||||
set_target_properties(RocksDB::rocksdb PROPERTIES
|
||||
INTERFACE_COMPILE_DEFINITIONS RIPPLE_ROCKSDB_AVAILABLE=1
|
||||
)
|
||||
target_link_libraries(ripple_libs INTERFACE RocksDB::rocksdb)
|
||||
endif()
|
||||
find_package(nudb REQUIRED)
|
||||
find_package(date REQUIRED)
|
||||
find_package(xxHash REQUIRED)
|
||||
if(TARGET nudb::core)
|
||||
set(nudb nudb::core)
|
||||
elseif(TARGET NuDB::nudb)
|
||||
set(nudb NuDB::nudb)
|
||||
###
|
||||
if (NOT USE_CONAN)
|
||||
set(SECP256K1_INSTALL TRUE)
|
||||
add_subdirectory(external/secp256k1)
|
||||
add_library(secp256k1::secp256k1 ALIAS secp256k1)
|
||||
add_subdirectory(external/ed25519-donna)
|
||||
add_subdirectory(external/antithesis-sdk)
|
||||
include(deps/Boost)
|
||||
include(deps/OpenSSL)
|
||||
# include(deps/Secp256k1)
|
||||
# include(deps/Ed25519-donna)
|
||||
include(deps/Lz4)
|
||||
include(deps/Libarchive)
|
||||
include(deps/Sqlite)
|
||||
include(deps/Soci)
|
||||
include(deps/Rocksdb)
|
||||
include(deps/Nudb)
|
||||
include(deps/date)
|
||||
# include(deps/Protobuf)
|
||||
# include(deps/gRPC)
|
||||
include(deps/cassandra)
|
||||
include(deps/Postgres)
|
||||
include(deps/WasmEdge)
|
||||
else()
|
||||
message(FATAL_ERROR "unknown nudb target")
|
||||
endif()
|
||||
target_link_libraries(ripple_libs INTERFACE ${nudb})
|
||||
include(conan/Boost)
|
||||
find_package(OpenSSL 1.1.1 REQUIRED)
|
||||
set_target_properties(OpenSSL::SSL PROPERTIES
|
||||
INTERFACE_COMPILE_DEFINITIONS OPENSSL_NO_SSL2
|
||||
)
|
||||
set(SECP256K1_INSTALL TRUE)
|
||||
add_subdirectory(external/secp256k1)
|
||||
add_library(secp256k1::secp256k1 ALIAS secp256k1)
|
||||
add_subdirectory(external/ed25519-donna)
|
||||
add_subdirectory(external/antithesis-sdk)
|
||||
find_package(gRPC REQUIRED)
|
||||
find_package(lz4 REQUIRED)
|
||||
# Target names with :: are not allowed in a generator expression.
|
||||
# We need to pull the include directories and imported location properties
|
||||
# from separate targets.
|
||||
find_package(LibArchive REQUIRED)
|
||||
find_package(SOCI REQUIRED)
|
||||
find_package(SQLite3 REQUIRED)
|
||||
find_package(wasmedge REQUIRED)
|
||||
option(rocksdb "Enable RocksDB" ON)
|
||||
if(rocksdb)
|
||||
find_package(RocksDB REQUIRED)
|
||||
set_target_properties(RocksDB::rocksdb PROPERTIES
|
||||
INTERFACE_COMPILE_DEFINITIONS RIPPLE_ROCKSDB_AVAILABLE=1
|
||||
)
|
||||
target_link_libraries(ripple_libs INTERFACE RocksDB::rocksdb)
|
||||
endif()
|
||||
find_package(nudb REQUIRED)
|
||||
find_package(date REQUIRED)
|
||||
find_package(xxHash REQUIRED)
|
||||
if(TARGET nudb::core)
|
||||
set(nudb nudb::core)
|
||||
elseif(TARGET NuDB::nudb)
|
||||
set(nudb NuDB::nudb)
|
||||
else()
|
||||
message(FATAL_ERROR "unknown nudb target")
|
||||
endif()
|
||||
target_link_libraries(ripple_libs INTERFACE ${nudb})
|
||||
|
||||
target_link_libraries(ripple_libs INTERFACE
|
||||
ed25519::ed25519
|
||||
lz4::lz4
|
||||
OpenSSL::Crypto
|
||||
OpenSSL::SSL
|
||||
# Ripple::grpc_pbufs
|
||||
# Ripple::pbufs
|
||||
secp256k1::secp256k1
|
||||
soci::soci
|
||||
SQLite::SQLite3
|
||||
)
|
||||
target_link_libraries(ripple_libs INTERFACE
|
||||
ed25519::ed25519
|
||||
lz4::lz4
|
||||
OpenSSL::Crypto
|
||||
OpenSSL::SSL
|
||||
# Ripple::grpc_pbufs
|
||||
# Ripple::pbufs
|
||||
secp256k1::secp256k1
|
||||
soci::soci
|
||||
SQLite::SQLite3
|
||||
)
|
||||
endif()
|
||||
|
||||
if(coverage)
|
||||
include(RippledCov)
|
||||
@@ -148,6 +170,10 @@ endif()
|
||||
|
||||
set(PROJECT_EXPORT_SET RippleExports)
|
||||
include(RippledCore)
|
||||
if (NOT USE_CONAN)
|
||||
include(deps/Protobuf)
|
||||
include(deps/gRPC)
|
||||
endif()
|
||||
include(RippledInstall)
|
||||
include(RippledDocs)
|
||||
include(RippledValidatorKeys)
|
||||
|
||||
@@ -488,10 +488,9 @@ existing maintainer without a vote.
|
||||
|
||||
## Current Maintainers
|
||||
|
||||
* [Richard Holland](https://github.com/RichardAH) (XRPL Labs + INFTF)
|
||||
* [Denis Angell](https://github.com/dangell7) (XRPL Labs + INFTF)
|
||||
* [Wietse Wind](https://github.com/WietseWind) (XRPL Labs + INFTF)
|
||||
* [tequ](https://github.com/tequdev) (Independent + INFTF)
|
||||
* [Richard Holland](https://github.com/RichardAH) (XRPL Labs + XRP Ledger Foundation)
|
||||
* [Denis Angell](https://github.com/dangell7) (XRPL Labs + XRP Ledger Foundation)
|
||||
* [Wietse Wind](https://github.com/WietseWind) (XRPL Labs + XRP Ledger Foundation)
|
||||
|
||||
|
||||
[1]: https://docs.github.com/en/get-started/quickstart/contributing-to-projects
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
**Note:** Throughout this README, references to "we" or "our" pertain to the community and contributors involved in the Xahau network. It does not imply a legal entity or a specific collection of individuals.
|
||||
|
||||
[Xahau](https://xahau.network/) is a decentralized cryptographic ledger that builds upon the robust foundation of the XRP Ledger. It inherits the XRP Ledger's Byzantine Fault Tolerant consensus algorithm and enhances it with additional features and functionalities. Developers and users familiar with the XRP Ledger will find that most documentation and tutorials available on [xrpl.org](https://xrpl.org) are relevant and applicable to Xahau, including those related to running validators and managing validator keys. For Xahau specific documentation you can visit our [documentation](https://xahau.network/)
|
||||
[Xahau](https://xahau.network/) is a decentralized cryptographic ledger that builds upon the robust foundation of the XRP Ledger. It inherits the XRP Ledger's Byzantine Fault Tolerant consensus algorithm and enhances it with additional features and functionalities. Developers and users familiar with the XRP Ledger will find that most documentation and tutorials available on [xrpl.org](https://xrpl.org) are relevant and applicable to Xahau, including those related to running validators and managing validator keys. For Xahau specific documentation you can visit our [documentation](https://docs.xahau.network/)
|
||||
|
||||
## XAH
|
||||
XAH is the public, counterparty-free asset native to Xahau and functions primarily as network gas. Transactions submitted to the Xahau network must supply an appropriate amount of XAH, to be burnt by the network as a fee, in order to be successfully included in a validated ledger. In addition, XAH also acts as a bridge currency within the Xahau DEX. XAH is traded on the open-market and is available for anyone to access. Xahau was created in 2023 with a supply of 600 million units of XAH.
|
||||
@@ -12,7 +12,7 @@ The server software that powers Xahau is called `xahaud` and is available in thi
|
||||
|
||||
### Build from Source
|
||||
|
||||
* [Read the build instructions in our documentation](https://xahau.network/infrastructure/building-xahau)
|
||||
* [Read the build instructions in our documentation](https://docs.xahau.network/infrastructure/building-xahau)
|
||||
* If you encounter any issues, please [open an issue](https://github.com/xahau/xahaud/issues)
|
||||
|
||||
## Highlights of Xahau
|
||||
@@ -58,7 +58,7 @@ git-subtree. See those directories' README files for more details.
|
||||
|
||||
- **Documentation**: Documentation for XRPL, Xahau and Hooks.
|
||||
- [Xrpl Documentation](https://xrpl.org)
|
||||
- [Xahau Documentation](https://xahau.network/)
|
||||
- [Xahau Documentation](https://docs.xahau.network/)
|
||||
- [Hooks Technical Documentation](https://xrpl-hooks.readme.io/)
|
||||
- **Explorers**: Explore the Xahau ledger using various explorers:
|
||||
- [xahauexplorer.com](https://xahauexplorer.com)
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
# debugging.
|
||||
set -ex
|
||||
|
||||
set -e
|
||||
|
||||
echo "START INSIDE CONTAINER - CORE"
|
||||
|
||||
echo "-- BUILD CORES: $3"
|
||||
@@ -12,13 +14,6 @@ echo "-- GITHUB_REPOSITORY: $1"
|
||||
echo "-- GITHUB_SHA: $2"
|
||||
echo "-- GITHUB_RUN_NUMBER: $4"
|
||||
|
||||
# Use mounted filesystem for temp files to avoid container space limits
|
||||
export TMPDIR=/io/tmp
|
||||
export TEMP=/io/tmp
|
||||
export TMP=/io/tmp
|
||||
mkdir -p /io/tmp
|
||||
echo "=== Using temp directory: /io/tmp ==="
|
||||
|
||||
umask 0000;
|
||||
|
||||
cd /io/ &&
|
||||
@@ -32,8 +27,7 @@ if [[ "$?" -ne "0" ]]; then
|
||||
exit 127
|
||||
fi
|
||||
|
||||
BUILD_TYPE=Release
|
||||
|
||||
perl -i -pe "s/^(\\s*)-DBUILD_SHARED_LIBS=OFF/\\1-DBUILD_SHARED_LIBS=OFF\\n\\1-DROCKSDB_BUILD_SHARED=OFF/g" cmake/deps/Rocksdb.cmake &&
|
||||
mv cmake/deps/WasmEdge.cmake cmake/deps/WasmEdge.old &&
|
||||
echo "find_package(LLVM REQUIRED CONFIG)
|
||||
message(STATUS \"Found LLVM \${LLVM_PACKAGE_VERSION}\")
|
||||
@@ -44,47 +38,20 @@ target_link_libraries (ripple_libs INTERFACE wasmedge)
|
||||
add_library (wasmedge::wasmedge ALIAS wasmedge)
|
||||
message(\"WasmEdge DONE\")
|
||||
" > cmake/deps/WasmEdge.cmake &&
|
||||
|
||||
export LDFLAGS="-static-libstdc++"
|
||||
export CMAKE_EXE_LINKER_FLAGS="-static-libstdc++"
|
||||
export CMAKE_STATIC_LINKER_FLAGS="-static-libstdc++"
|
||||
|
||||
git config --global --add safe.directory /io &&
|
||||
git checkout src/libxrpl/protocol/BuildInfo.cpp &&
|
||||
sed -i s/\"0.0.0\"/\"$(date +%Y).$(date +%-m).$(date +%-d)-$(git rev-parse --abbrev-ref HEAD)$(if [ -n "$4" ]; then echo "+$4"; fi)\"/g src/libxrpl/protocol/BuildInfo.cpp &&
|
||||
conan export external/snappy --version 1.1.10 --user xahaud --channel stable &&
|
||||
conan export external/soci --version 4.0.3 --user xahaud --channel stable &&
|
||||
conan export external/wasmedge --version 0.11.2 --user xahaud --channel stable &&
|
||||
sed -i s/\"0.0.0\"/\"$(date +%Y).$(date +%-m).$(date +%-d)-$(git rev-parse --abbrev-ref HEAD)+$4\"/g src/libxrpl/protocol/BuildInfo.cpp &&
|
||||
cd release-build &&
|
||||
# Install dependencies - tool_requires in conanfile.py handles glibc 2.28 compatibility
|
||||
# for build tools (protoc, grpc plugins, b2) in HBB environment
|
||||
# The tool_requires('b2/5.3.2') in conanfile.py should force b2 to build from source
|
||||
# with the correct toolchain, avoiding the GLIBCXX_3.4.29 issue
|
||||
echo "=== Installing dependencies ===" &&
|
||||
conan install .. --output-folder . --build missing --settings build_type=$BUILD_TYPE \
|
||||
-o with_wasmedge=False -o tool_requires_b2=True &&
|
||||
cmake .. -G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
|
||||
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="-static-libstdc++" \
|
||||
-DLLVM_DIR=$LLVM_DIR \
|
||||
-DWasmEdge_LIB=$WasmEdge_LIB \
|
||||
-Dxrpld=TRUE \
|
||||
-Dtests=TRUE &&
|
||||
ccache -z &&
|
||||
ninja -j $3 && echo "=== Re-running final link with verbose output ===" && rm -f rippled && ninja -v rippled &&
|
||||
ccache -s &&
|
||||
which cmake &&
|
||||
cmake --version &&
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DBoost_NO_BOOST_CMAKE=ON -DLLVM_DIR=/usr/lib64/llvm13/lib/cmake/llvm/ -DLLVM_LIBRARY_DIR=/usr/lib64/llvm13/lib/ -DWasmEdge_LIB=/usr/local/lib64/libwasmedge.a &&
|
||||
make -j$3 VERBOSE=1 &&
|
||||
strip -s rippled &&
|
||||
mv rippled xahaud &&
|
||||
echo "=== Full ldd output ===" &&
|
||||
ldd xahaud &&
|
||||
echo "=== Running libcheck ===" &&
|
||||
libcheck xahaud &&
|
||||
echo "Build host: `hostname`" > release.info &&
|
||||
echo "Build date: `date`" >> release.info &&
|
||||
echo "Build md5: `md5sum xahaud`" >> release.info &&
|
||||
echo "Git remotes:" >> release.info &&
|
||||
git remote -v >> release.info &&
|
||||
git remote -v >> release.info
|
||||
echo "Git status:" >> release.info &&
|
||||
git status -v >> release.info &&
|
||||
echo "Git log [last 20]:" >> release.info &&
|
||||
@@ -104,8 +71,8 @@ fi
|
||||
cd ..;
|
||||
|
||||
mv src/xrpld/net/detail/RegisterSSLCerts.cpp.old src/xrpld/net/detail/RegisterSSLCerts.cpp;
|
||||
mv cmake/deps/Rocksdb.cmake.old cmake/deps/Rocksdb.cmake;
|
||||
mv cmake/deps/WasmEdge.old cmake/deps/WasmEdge.cmake;
|
||||
rm src/certs/certbundle.h;
|
||||
git checkout src/libxrpl/protocol/BuildInfo.cpp;
|
||||
|
||||
|
||||
echo "END INSIDE CONTAINER - CORE"
|
||||
|
||||
100
build-full.sh
100
build-full.sh
@@ -3,6 +3,8 @@
|
||||
# processes launched or upon any unbound variable.
|
||||
# We use set -x to print commands before running them to help with
|
||||
# debugging.
|
||||
set -ex
|
||||
|
||||
set -e
|
||||
|
||||
echo "START INSIDE CONTAINER - FULL"
|
||||
@@ -14,6 +16,13 @@ echo "-- GITHUB_RUN_NUMBER: $4"
|
||||
|
||||
umask 0000;
|
||||
|
||||
echo "Fixing CentOS 7 EOL"
|
||||
|
||||
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
|
||||
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
|
||||
yum clean all
|
||||
yum-config-manager --disable centos-sclo-sclo
|
||||
|
||||
####
|
||||
|
||||
cd /io;
|
||||
@@ -64,15 +73,94 @@ then
|
||||
#endif/g" src/xrpld/net/detail/RegisterSSLCerts.cpp &&
|
||||
sed -i "s/#include <xrpld\/net\/RegisterSSLCerts.h>/\0\n#include <certs\/certbundle.h>/g" src/xrpld/net/detail/RegisterSSLCerts.cpp
|
||||
fi
|
||||
# Environment setup moved to Dockerfile in release-builder.sh
|
||||
source /opt/rh/gcc-toolset-11/enable
|
||||
export PATH=/usr/local/bin:$PATH
|
||||
export CC='/usr/lib64/ccache/gcc' &&
|
||||
export CXX='/usr/lib64/ccache/g++' &&
|
||||
mkdir -p .nih_c;
|
||||
mkdir -p .nih_toolchain;
|
||||
cd .nih_toolchain &&
|
||||
yum install -y wget lz4 lz4-devel git llvm13-static.x86_64 llvm13-devel.x86_64 devtoolset-10-binutils zlib-static ncurses-static -y \
|
||||
devtoolset-7-gcc-c++ \
|
||||
devtoolset-9-gcc-c++ \
|
||||
devtoolset-10-gcc-c++ \
|
||||
snappy snappy-devel \
|
||||
zlib zlib-devel \
|
||||
lz4-devel \
|
||||
libasan &&
|
||||
export PATH=`echo $PATH | sed -E "s/devtoolset-9/devtoolset-7/g"` &&
|
||||
echo "-- Install ZStd 1.1.3 --" &&
|
||||
yum install epel-release -y &&
|
||||
ZSTD_VERSION="1.1.3" &&
|
||||
( wget -nc -q -O zstd-${ZSTD_VERSION}.tar.gz https://github.com/facebook/zstd/archive/v${ZSTD_VERSION}.tar.gz; echo "" ) &&
|
||||
tar xzvf zstd-${ZSTD_VERSION}.tar.gz &&
|
||||
cd zstd-${ZSTD_VERSION} &&
|
||||
make -j$3 install &&
|
||||
cd .. &&
|
||||
echo "-- Install Cmake 3.25.3 --" &&
|
||||
pwd &&
|
||||
( wget -nc -q https://github.com/Kitware/CMake/releases/download/v3.25.3/cmake-3.25.3-linux-x86_64.tar.gz; echo "" ) &&
|
||||
tar -xzf cmake-3.25.3-linux-x86_64.tar.gz -C /hbb/ &&
|
||||
ln -sf /hbb/cmake-3.25.3-linux-x86_64/bin/cmake /hbb/bin/cmake &&
|
||||
export PATH="/hbb/cmake-3.25.3-linux-x86_64/bin:$PATH" &&
|
||||
echo "-- Install Boost 1.86.0 --" &&
|
||||
pwd &&
|
||||
( wget -nc -q https://archives.boost.io/release/1.86.0/source/boost_1_86_0.tar.gz; echo "" ) &&
|
||||
tar -xzf boost_1_86_0.tar.gz &&
|
||||
cd boost_1_86_0 && ./bootstrap.sh && ./b2 link=static -j$3 && ./b2 install &&
|
||||
cd ../ &&
|
||||
echo "-- Install Protobuf 3.20.0 --" &&
|
||||
pwd &&
|
||||
( wget -nc -q https://github.com/protocolbuffers/protobuf/releases/download/v3.20.0/protobuf-all-3.20.0.tar.gz; echo "" ) &&
|
||||
tar -xzf protobuf-all-3.20.0.tar.gz &&
|
||||
cd protobuf-3.20.0/ &&
|
||||
./autogen.sh && ./configure --prefix=/usr --disable-shared link=static && make -j$3 && make install &&
|
||||
cd .. &&
|
||||
echo "-- Build LLD --" &&
|
||||
pwd &&
|
||||
ln /usr/bin/llvm-config-13 /usr/bin/llvm-config &&
|
||||
mv /opt/rh/devtoolset-9/root/usr/bin/ar /opt/rh/devtoolset-9/root/usr/bin/ar-9 &&
|
||||
ln /opt/rh/devtoolset-10/root/usr/bin/ar /opt/rh/devtoolset-9/root/usr/bin/ar &&
|
||||
( wget -nc -q https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.1/lld-13.0.1.src.tar.xz; echo "" ) &&
|
||||
( wget -nc -q https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.1/libunwind-13.0.1.src.tar.xz; echo "" ) &&
|
||||
tar -xf lld-13.0.1.src.tar.xz &&
|
||||
tar -xf libunwind-13.0.1.src.tar.xz &&
|
||||
cp -r libunwind-13.0.1.src/include libunwind-13.0.1.src/src lld-13.0.1.src/ &&
|
||||
cd lld-13.0.1.src &&
|
||||
rm -rf build CMakeCache.txt &&
|
||||
mkdir -p build &&
|
||||
cd build &&
|
||||
cmake .. -DLLVM_LIBRARY_DIR=/usr/lib64/llvm13/lib/ -DCMAKE_INSTALL_PREFIX=/usr/lib64/llvm13/ -DCMAKE_BUILD_TYPE=Release &&
|
||||
make -j$3 install &&
|
||||
ln -s /usr/lib64/llvm13/lib/include/lld /usr/include/lld &&
|
||||
cp /usr/lib64/llvm13/lib/liblld*.a /usr/local/lib/ &&
|
||||
cd ../../ &&
|
||||
echo "-- Build WasmEdge --" &&
|
||||
( wget -nc -q https://github.com/WasmEdge/WasmEdge/archive/refs/tags/0.11.2.zip; unzip -o 0.11.2.zip; ) &&
|
||||
cd WasmEdge-0.11.2 &&
|
||||
( mkdir -p build; echo "" ) &&
|
||||
cd build &&
|
||||
export BOOST_ROOT="/usr/local/src/boost_1_86_0" &&
|
||||
export Boost_LIBRARY_DIRS="/usr/local/lib" &&
|
||||
export BOOST_INCLUDEDIR="/usr/local/src/boost_1_86_0" &&
|
||||
export PATH=`echo $PATH | sed -E "s/devtoolset-7/devtoolset-9/g"` &&
|
||||
cmake .. \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DWASMEDGE_BUILD_SHARED_LIB=OFF \
|
||||
-DWASMEDGE_BUILD_STATIC_LIB=ON \
|
||||
-DWASMEDGE_BUILD_AOT_RUNTIME=ON \
|
||||
-DWASMEDGE_FORCE_DISABLE_LTO=ON \
|
||||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
|
||||
-DWASMEDGE_LINK_LLVM_STATIC=ON \
|
||||
-DWASMEDGE_BUILD_PLUGINS=OFF \
|
||||
-DWASMEDGE_LINK_TOOLS_STATIC=ON \
|
||||
-DBoost_NO_BOOST_CMAKE=ON -DLLVM_DIR=/usr/lib64/llvm13/lib/cmake/llvm/ -DLLVM_LIBRARY_DIR=/usr/lib64/llvm13/lib/ &&
|
||||
make -j$3 install &&
|
||||
export PATH=`echo $PATH | sed -E "s/devtoolset-9/devtoolset-10/g"` &&
|
||||
cp -r include/api/wasmedge /usr/include/ &&
|
||||
cd /io/ &&
|
||||
echo "-- Build Rippled --" &&
|
||||
pwd &&
|
||||
cp cmake/deps/Rocksdb.cmake cmake/deps/Rocksdb.cmake.old &&
|
||||
|
||||
echo "MOVING TO [ build-core.sh ]";
|
||||
echo "MOVING TO [ build-core.sh ]"
|
||||
cd /io;
|
||||
|
||||
printenv > .env.temp;
|
||||
cat .env.temp | grep '=' | sed s/\\\(^[^=]\\+=\\\)/\\1\\\"/g|sed s/\$/\\\"/g > .env;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#
|
||||
# 2. Peer Protocol
|
||||
#
|
||||
# 3. XRPL Protocol
|
||||
# 3. Ripple Protocol
|
||||
#
|
||||
# 4. HTTPS Client
|
||||
#
|
||||
@@ -29,17 +29,18 @@
|
||||
#
|
||||
# Purpose
|
||||
#
|
||||
# This file documents and provides examples of all xahaud server process
|
||||
# configuration options. When the xahaud server instance is launched, it
|
||||
# This file documents and provides examples of all rippled server process
|
||||
# configuration options. When the rippled server instance is launched, it
|
||||
# looks for a file with the following name:
|
||||
#
|
||||
# xahaud.cfg
|
||||
# rippled.cfg
|
||||
#
|
||||
# To run xahaud with a custom configuration file, use the "--conf {file}" flag.
|
||||
# By default, xahaud will look in the local working directory or the home directory.
|
||||
# For more information on where the rippled server instance searches for the
|
||||
# file, visit:
|
||||
#
|
||||
# https://xrpl.org/commandline-usage.html#generic-options
|
||||
#
|
||||
# This file should be named xahaud.cfg. This file is UTF-8 with DOS, UNIX,
|
||||
# This file should be named rippled.cfg. This file is UTF-8 with DOS, UNIX,
|
||||
# or Mac style end of lines. Blank lines and lines beginning with '#' are
|
||||
# ignored. Undefined sections are reserved. No escapes are currently defined.
|
||||
#
|
||||
@@ -88,8 +89,8 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
# xahaud offers various server protocols to clients making inbound
|
||||
# connections. The listening ports xahaud uses are "universal" ports
|
||||
# rippled offers various server protocols to clients making inbound
|
||||
# connections. The listening ports rippled uses are "universal" ports
|
||||
# which may be configured to handshake in one or more of the available
|
||||
# supported protocols. These universal ports simplify administration:
|
||||
# A single open port can be used for multiple protocols.
|
||||
@@ -102,7 +103,7 @@
|
||||
#
|
||||
# A list of port names and key/value pairs. A port name must start with a
|
||||
# letter and contain only letters and numbers. The name is not case-sensitive.
|
||||
# For each name in this list, xahaud will look for a configuration file
|
||||
# For each name in this list, rippled will look for a configuration file
|
||||
# section with the same name and use it to create a listening port. The
|
||||
# name is informational only; the choice of name does not affect the function
|
||||
# of the listening port.
|
||||
@@ -133,7 +134,7 @@
|
||||
# ip = 127.0.0.1
|
||||
# protocol = http
|
||||
#
|
||||
# When xahaud is used as a command line client (for example, issuing a
|
||||
# When rippled is used as a command line client (for example, issuing a
|
||||
# server stop command), the first port advertising the http or https
|
||||
# protocol will be used to make the connection.
|
||||
#
|
||||
@@ -174,7 +175,7 @@
|
||||
# same time. It is possible have both Websockets and Secure Websockets
|
||||
# together in one port.
|
||||
#
|
||||
# NOTE If no ports support the peer protocol, xahaud cannot
|
||||
# NOTE If no ports support the peer protocol, rippled cannot
|
||||
# receive incoming peer connections or become a superpeer.
|
||||
#
|
||||
# limit = <number>
|
||||
@@ -193,7 +194,7 @@
|
||||
# required. IP address restrictions, if any, will be checked in addition
|
||||
# to the credentials specified here.
|
||||
#
|
||||
# When acting in the client role, xahaud will supply these credentials
|
||||
# When acting in the client role, rippled will supply these credentials
|
||||
# using HTTP's Basic Authentication headers when making outbound HTTP/S
|
||||
# requests.
|
||||
#
|
||||
@@ -236,7 +237,7 @@
|
||||
# WS, or WSS protocol interfaces. If administrative commands are
|
||||
# disabled for a port, these credentials have no effect.
|
||||
#
|
||||
# When acting in the client role, xahaud will supply these credentials
|
||||
# When acting in the client role, rippled will supply these credentials
|
||||
# in the submitted JSON for any administrative command requests when
|
||||
# invoking JSON-RPC commands on remote servers.
|
||||
#
|
||||
@@ -257,7 +258,7 @@
|
||||
# resource controls will default to those for non-administrative users.
|
||||
#
|
||||
# The secure_gateway IP addresses are intended to represent
|
||||
# proxies. Since xahaud trusts these hosts, they must be
|
||||
# proxies. Since rippled trusts these hosts, they must be
|
||||
# responsible for properly authenticating the remote user.
|
||||
#
|
||||
# If some IP addresses are included for both "admin" and
|
||||
@@ -271,7 +272,7 @@
|
||||
# Use the specified files when configuring SSL on the port.
|
||||
#
|
||||
# NOTE If no files are specified and secure protocols are selected,
|
||||
# xahaud will generate an internal self-signed certificate.
|
||||
# rippled will generate an internal self-signed certificate.
|
||||
#
|
||||
# The files have these meanings:
|
||||
#
|
||||
@@ -296,12 +297,12 @@
|
||||
# Control the ciphers which the server will support over SSL on the port,
|
||||
# specified using the OpenSSL "cipher list format".
|
||||
#
|
||||
# NOTE If unspecified, xahaud will automatically configure a modern
|
||||
# NOTE If unspecified, rippled will automatically configure a modern
|
||||
# cipher suite. This default suite should be widely supported.
|
||||
#
|
||||
# You should not modify this string unless you have a specific
|
||||
# reason and cryptographic expertise. Incorrect modification may
|
||||
# keep xahaud from connecting to other instances of xahaud or
|
||||
# keep rippled from connecting to other instances of rippled or
|
||||
# prevent RPC and WebSocket clients from connecting.
|
||||
#
|
||||
# send_queue_limit = [1..65535]
|
||||
@@ -352,7 +353,7 @@
|
||||
#
|
||||
# Examples:
|
||||
# { "command" : "server_info" }
|
||||
# { "command" : "log_level", "partition" : "xahaudcalc", "severity" : "trace" }
|
||||
# { "command" : "log_level", "partition" : "ripplecalc", "severity" : "trace" }
|
||||
#
|
||||
#
|
||||
#
|
||||
@@ -381,9 +382,10 @@
|
||||
#-----------------
|
||||
#
|
||||
# These settings control security and access attributes of the Peer to Peer
|
||||
# server section of the xahaud process. It is over peer connections that
|
||||
# transactions and validations are passed from to machine to machine, to
|
||||
# determine the contents of validated ledgers.
|
||||
# server section of the rippled process. Peer Protocol implements the
|
||||
# Ripple Payment protocol. It is over peer connections that transactions
|
||||
# and validations are passed from to machine to machine, to determine the
|
||||
# contents of validated ledgers.
|
||||
#
|
||||
#
|
||||
#
|
||||
@@ -394,7 +396,7 @@
|
||||
# true - enables compression
|
||||
# false - disables compression [default].
|
||||
#
|
||||
# The xahaud server can save bandwidth by compressing its peer-to-peer communications,
|
||||
# The rippled server can save bandwidth by compressing its peer-to-peer communications,
|
||||
# at a cost of greater CPU usage. If you enable link compression,
|
||||
# the server automatically compresses communications with peer servers
|
||||
# that also have link compression enabled.
|
||||
@@ -404,7 +406,7 @@
|
||||
#
|
||||
# [ips]
|
||||
#
|
||||
# List of hostnames or ips where the XRPL protocol is served. A default
|
||||
# List of hostnames or ips where the Ripple protocol is served. A default
|
||||
# starter list is included in the code and used if no other hostnames are
|
||||
# available.
|
||||
#
|
||||
@@ -415,23 +417,24 @@
|
||||
# of entries does not generally matter.
|
||||
#
|
||||
# The default list of entries is:
|
||||
# - hubs.xahau.as16089.net 21337
|
||||
# - bacab.alloy.ee 21337
|
||||
# - r.ripple.com 51235
|
||||
# - zaphod.alloy.ee 51235
|
||||
# - sahyadri.isrdc.in 51235
|
||||
#
|
||||
# Examples:
|
||||
#
|
||||
# [ips]
|
||||
# 192.168.0.1
|
||||
# 192.168.0.1 21337
|
||||
# bacab.alloy.ee 21337
|
||||
# 192.168.0.1 2459
|
||||
# r.ripple.com 51235
|
||||
#
|
||||
#
|
||||
# [ips_fixed]
|
||||
#
|
||||
# List of IP addresses or hostnames to which xahaud should always attempt to
|
||||
# List of IP addresses or hostnames to which rippled should always attempt to
|
||||
# maintain peer connections with. This is useful for manually forming private
|
||||
# networks, for example to configure a validation server that connects to the
|
||||
# Xahau Network through a public-facing server, or for building a set
|
||||
# Ripple network through a public-facing server, or for building a set
|
||||
# of cluster peers.
|
||||
#
|
||||
# One address or domain names per line is allowed. A port must be specified
|
||||
@@ -569,7 +572,7 @@
|
||||
#
|
||||
# minimum_txn_in_ledger_standalone = <number>
|
||||
#
|
||||
# Like minimum_txn_in_ledger when xahaud is running in standalone
|
||||
# Like minimum_txn_in_ledger when rippled is running in standalone
|
||||
# mode. Default: 1000.
|
||||
#
|
||||
# target_txn_in_ledger = <number>
|
||||
@@ -706,7 +709,7 @@
|
||||
#
|
||||
# [validator_token]
|
||||
#
|
||||
# This is an alternative to [validation_seed] that allows xahaud to perform
|
||||
# This is an alternative to [validation_seed] that allows rippled to perform
|
||||
# validation without having to store the validator keys on the network
|
||||
# connected server. The field should contain a single token in the form of a
|
||||
# base64-encoded blob.
|
||||
@@ -741,18 +744,19 @@
|
||||
#
|
||||
# Specify the file by its name or path.
|
||||
# Unless an absolute path is specified, it will be considered relative to
|
||||
# the folder in which the xahaud.cfg file is located.
|
||||
# the folder in which the rippled.cfg file is located.
|
||||
#
|
||||
# Examples:
|
||||
# /home/xahaud/validators.txt
|
||||
# C:/home/xahaud/validators.txt
|
||||
# /home/ripple/validators.txt
|
||||
# C:/home/ripple/validators.txt
|
||||
#
|
||||
# Example content:
|
||||
# [validators]
|
||||
# n9L3GdotB8a3AqtsvS7NXt4BUTQSAYyJUr9xtFj2qXJjfbZsawKY
|
||||
# n9LQDHLWyFuAn5BXJuW2ow5J9uGqpmSjRYS2cFRpxf6uJbxwDzvM
|
||||
# n9MCWyKVUkiatXVJTKUrAESB5kBFP8R3hm43jGHtg8WBnjv3iDfb
|
||||
# n9KWXCLRhjpajuZtULTXsy6R5xbisA6ozGxM4zdEJFq6uHiFZDvW
|
||||
# n949f75evCHwgyP4fPVgaHqNHxUVN15PsJEZ3B3HnXPcPjcZAoy7
|
||||
# n9MD5h24qrQqiyBC8aeqqCWvpiBiYQ3jxSr91uiDvmrkyHRdYLUj
|
||||
# n9L81uNCaPgtUJfaHh89gmdvXKAmSt5Gdsw2g1iPWaPkAHW5Nm4C
|
||||
# n9KiYM9CgngLvtRCQHZwgC2gjpdaZcCcbt3VboxiNFcKuwFVujzS
|
||||
# n9LdgEtkmGB9E2h3K4Vp7iGUaKuq23Zr32ehxiU8FWY7xoxbWTSA
|
||||
#
|
||||
#
|
||||
#
|
||||
@@ -835,7 +839,7 @@
|
||||
#
|
||||
# 0: Disable the ledger replay feature [default]
|
||||
# 1: Enable the ledger replay feature. With this feature enabled, when
|
||||
# acquiring a ledger from the network, a xahaud node only downloads
|
||||
# acquiring a ledger from the network, a rippled node only downloads
|
||||
# the ledger header and the transactions instead of the whole ledger.
|
||||
# And the ledger is built by applying the transactions to the parent
|
||||
# ledger.
|
||||
@@ -846,9 +850,10 @@
|
||||
#
|
||||
#----------------
|
||||
#
|
||||
# The xahaud server instance uses HTTPS GET requests in a variety of
|
||||
# The rippled server instance uses HTTPS GET requests in a variety of
|
||||
# circumstances, including but not limited to contacting trusted domains to
|
||||
# fetch information such as mapping an email address to a user's r address.
|
||||
# fetch information such as mapping an email address to a Ripple Payment
|
||||
# Network address.
|
||||
#
|
||||
# [ssl_verify]
|
||||
#
|
||||
@@ -885,7 +890,7 @@
|
||||
#
|
||||
#------------
|
||||
#
|
||||
# xahaud creates 4 SQLite database to hold bookkeeping information
|
||||
# rippled creates 4 SQLite database to hold bookkeeping information
|
||||
# about transactions, local credentials, and various other things.
|
||||
# It also creates the NodeDB, which holds all the objects that
|
||||
# make up the current and historical ledgers.
|
||||
@@ -896,7 +901,7 @@
|
||||
# the performance of the server.
|
||||
#
|
||||
# Partial pathnames will be considered relative to the location of
|
||||
# the xahaud.cfg file.
|
||||
# the rippled.cfg file.
|
||||
#
|
||||
# [node_db] Settings for the Node Database (required)
|
||||
#
|
||||
@@ -907,18 +912,18 @@
|
||||
#
|
||||
# Example:
|
||||
# type=nudb
|
||||
# path=/opt/xahaud/db/nudb
|
||||
# path=db/nudb
|
||||
#
|
||||
# The "type" field must be present and controls the choice of backend:
|
||||
#
|
||||
# type = NuDB
|
||||
#
|
||||
# NuDB is a high-performance database written by Ripple Labs and optimized
|
||||
# for and solid-state drives.
|
||||
# for rippled and solid-state drives.
|
||||
#
|
||||
# NuDB maintains its high speed regardless of the amount of history
|
||||
# stored. Online delete may be selected, but is not required. NuDB is
|
||||
# available on all platforms that xahaud runs on.
|
||||
# available on all platforms that rippled runs on.
|
||||
#
|
||||
# type = RocksDB
|
||||
#
|
||||
@@ -937,7 +942,11 @@
|
||||
# RWDB is recommended for Validator and Peer nodes that are not required to
|
||||
# store history.
|
||||
#
|
||||
# Required keys for NuDB and RocksDB:
|
||||
# RWDB maintains its high speed regardless of the amount of history
|
||||
# stored. Online delete should NOT be used instead RWDB will use the
|
||||
# ledger_history config value to determine how many ledgers to keep in memory.
|
||||
#
|
||||
# Required keys for NuDB, RWDB and RocksDB:
|
||||
#
|
||||
# path Location to store the database
|
||||
#
|
||||
@@ -965,56 +974,18 @@
|
||||
# if sufficient IOPS capacity is available.
|
||||
# Default 0.
|
||||
#
|
||||
# online_delete for RWDB, NuDB and RocksDB:
|
||||
# Optional keys for NuDB or RocksDB:
|
||||
#
|
||||
# earliest_seq The default is 32570 to match the XRP ledger
|
||||
# network's earliest allowed sequence. Alternate
|
||||
# networks may set this value. Minimum value of 1.
|
||||
#
|
||||
# online_delete Minimum value of 256. Enable automatic purging
|
||||
# of older ledger information. Maintain at least this
|
||||
# number of ledger records online. Must be greater
|
||||
# than or equal to ledger_history.
|
||||
# than or equal to ledger_history. If using RWDB
|
||||
# this value is ignored.
|
||||
#
|
||||
# REQUIRED for RWDB to prevent out-of-memory errors.
|
||||
# Optional for NuDB and RocksDB.
|
||||
#
|
||||
# Optional keys for NuDB and RocksDB:
|
||||
#
|
||||
# earliest_seq The default is 32570 to match the XRP Ledger's
|
||||
# network's earliest allowed sequence. Alternate
|
||||
# networks may set this value. Minimum value of 1.
|
||||
#
|
||||
# Optional keys for NuDB only:
|
||||
#
|
||||
# nudb_block_size EXPERIMENTAL: Block size in bytes for NuDB storage.
|
||||
# Must be a power of 2 between 4096 and 32768. Default is 4096.
|
||||
#
|
||||
# This parameter controls the fundamental storage unit
|
||||
# size for NuDB's internal data structures. The choice
|
||||
# of block size can significantly impact performance
|
||||
# depending on your storage hardware and filesystem:
|
||||
#
|
||||
# - 4096 bytes: Optimal for most standard SSDs and
|
||||
# traditional filesystems (ext4, NTFS, HFS+).
|
||||
# Provides good balance of performance and storage
|
||||
# efficiency. Recommended for most deployments.
|
||||
#
|
||||
# - 8192-16384 bytes: May improve performance on
|
||||
# high-end NVMe SSDs and copy-on-write filesystems
|
||||
# like ZFS or Btrfs that benefit from larger block
|
||||
# alignment. Can reduce metadata overhead for large
|
||||
# databases.
|
||||
#
|
||||
# - 32768 bytes (32K): Maximum supported block size
|
||||
# for high-performance scenarios with very fast
|
||||
# storage. May increase memory usage and reduce
|
||||
# efficiency for smaller databases.
|
||||
#
|
||||
# Note: This setting cannot be changed after database
|
||||
# creation without rebuilding the entire database.
|
||||
# Choose carefully based on your hardware and expected
|
||||
# database size.
|
||||
#
|
||||
# Example: nudb_block_size=4096
|
||||
#
|
||||
|
||||
# These keys modify the behavior of online_delete, and thus are only
|
||||
# relevant if online_delete is defined and non-zero:
|
||||
#
|
||||
@@ -1048,7 +1019,7 @@
|
||||
#
|
||||
# recovery_wait_seconds
|
||||
# The online delete process checks periodically
|
||||
# that xahaud is still in sync with the network,
|
||||
# that rippled is still in sync with the network,
|
||||
# and that the validated ledger is less than
|
||||
# 'age_threshold_seconds' old. If not, then continue
|
||||
# sleeping for this number of seconds and
|
||||
@@ -1068,8 +1039,8 @@
|
||||
# The server creates and maintains 4 to 5 bookkeeping SQLite databases in
|
||||
# the 'database_path' location. If you omit this configuration setting,
|
||||
# the server creates a directory called "db" located in the same place as
|
||||
# your xahaud.cfg file.
|
||||
# Partial pathnames are relative to the location of the xahaud executable.
|
||||
# your rippled.cfg file.
|
||||
# Partial pathnames are relative to the location of the rippled executable.
|
||||
#
|
||||
# [sqlite] Tuning settings for the SQLite databases (optional)
|
||||
#
|
||||
@@ -1119,7 +1090,7 @@
|
||||
# The default is "wal", which uses a write-ahead
|
||||
# log to implement database transactions.
|
||||
# Alternately, "memory" saves disk I/O, but if
|
||||
# xahaud crashes during a transaction, the
|
||||
# rippled crashes during a transaction, the
|
||||
# database is likely to be corrupted.
|
||||
# See https://www.sqlite.org/pragma.html#pragma_journal_mode
|
||||
# for more details about the available options.
|
||||
@@ -1129,7 +1100,7 @@
|
||||
# synchronous Valid values: off, normal, full, extra
|
||||
# The default is "normal", which works well with
|
||||
# the "wal" journal mode. Alternatively, "off"
|
||||
# allows xahaud to continue as soon as data is
|
||||
# allows rippled to continue as soon as data is
|
||||
# passed to the OS, which can significantly
|
||||
# increase speed, but risks data corruption if
|
||||
# the host computer crashes before writing that
|
||||
@@ -1143,7 +1114,7 @@
|
||||
# The default is "file", which will use files
|
||||
# for temporary database tables and indices.
|
||||
# Alternatively, "memory" may save I/O, but
|
||||
# xahaud does not currently use many, if any,
|
||||
# rippled does not currently use many, if any,
|
||||
# of these temporary objects.
|
||||
# See https://www.sqlite.org/pragma.html#pragma_temp_store
|
||||
# for more details about the available options.
|
||||
@@ -1172,7 +1143,7 @@
|
||||
#
|
||||
# These settings are designed to help server administrators diagnose
|
||||
# problems, and obtain detailed information about the activities being
|
||||
# performed by the xahaud process.
|
||||
# performed by the rippled process.
|
||||
#
|
||||
#
|
||||
#
|
||||
@@ -1189,7 +1160,7 @@
|
||||
#
|
||||
# Configuration parameters for the Beast. Insight stats collection module.
|
||||
#
|
||||
# Insight is a module that collects information from the areas of xahaud
|
||||
# Insight is a module that collects information from the areas of rippled
|
||||
# that have instrumentation. The configuration parameters control where the
|
||||
# collection metrics are sent. The parameters are expressed as key = value
|
||||
# pairs with no white space. The main parameter is the choice of server:
|
||||
@@ -1198,7 +1169,7 @@
|
||||
#
|
||||
# Choice of server to send metrics to. Currently the only choice is
|
||||
# "statsd" which sends UDP packets to a StatsD daemon, which must be
|
||||
# running while xahaud is running. More information on StatsD is
|
||||
# running while rippled is running. More information on StatsD is
|
||||
# available here:
|
||||
# https://github.com/b/statsd_spec
|
||||
#
|
||||
@@ -1208,7 +1179,7 @@
|
||||
# in the format, n.n.n.n:port.
|
||||
#
|
||||
# "prefix" A string prepended to each collected metric. This is used
|
||||
# to distinguish between different running instances of xahaud.
|
||||
# to distinguish between different running instances of rippled.
|
||||
#
|
||||
# If this section is missing, or the server type is unspecified or unknown,
|
||||
# statistics are not collected or reported.
|
||||
@@ -1235,7 +1206,7 @@
|
||||
#
|
||||
# Example:
|
||||
# [perf]
|
||||
# perf_log=/var/log/xahaud/perf.log
|
||||
# perf_log=/var/log/rippled/perf.log
|
||||
# log_interval=2
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
@@ -1244,8 +1215,8 @@
|
||||
#
|
||||
#----------
|
||||
#
|
||||
# The vote settings configure settings for the entire Xahau Network.
|
||||
# While a single instance of xahaud cannot unilaterally enforce network-wide
|
||||
# The vote settings configure settings for the entire Ripple network.
|
||||
# While a single instance of rippled cannot unilaterally enforce network-wide
|
||||
# settings, these choices become part of the instance's vote during the
|
||||
# consensus process for each voting ledger.
|
||||
#
|
||||
@@ -1257,9 +1228,9 @@
|
||||
#
|
||||
# The cost of the reference transaction fee, specified in drops.
|
||||
# The reference transaction is the simplest form of transaction.
|
||||
# It represents an XAH payment between two parties.
|
||||
# It represents an XRP payment between two parties.
|
||||
#
|
||||
# If this parameter is unspecified, xahaud will use an internal
|
||||
# If this parameter is unspecified, rippled will use an internal
|
||||
# default. Don't change this without understanding the consequences.
|
||||
#
|
||||
# Example:
|
||||
@@ -1268,26 +1239,26 @@
|
||||
# account_reserve = <drops>
|
||||
#
|
||||
# The account reserve requirement is specified in drops. The portion of an
|
||||
# account's XAH balance that is at or below the reserve may only be
|
||||
# account's XRP balance that is at or below the reserve may only be
|
||||
# spent on transaction fees, and not transferred out of the account.
|
||||
#
|
||||
# If this parameter is unspecified, xahaud will use an internal
|
||||
# If this parameter is unspecified, rippled will use an internal
|
||||
# default. Don't change this without understanding the consequences.
|
||||
#
|
||||
# Example:
|
||||
# account_reserve = 10000000 # 10 XAH
|
||||
# account_reserve = 10000000 # 10 XRP
|
||||
#
|
||||
# owner_reserve = <drops>
|
||||
#
|
||||
# The owner reserve is the amount of XAH reserved in the account for
|
||||
# The owner reserve is the amount of XRP reserved in the account for
|
||||
# each ledger item owned by the account. Ledger items an account may
|
||||
# own include trust lines, open orders, and tickets.
|
||||
#
|
||||
# If this parameter is unspecified, xahaud will use an internal
|
||||
# If this parameter is unspecified, rippled will use an internal
|
||||
# default. Don't change this without understanding the consequences.
|
||||
#
|
||||
# Example:
|
||||
# owner_reserve = 2000000 # 2 XAH
|
||||
# owner_reserve = 2000000 # 2 XRP
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
@@ -1325,7 +1296,7 @@
|
||||
# tool instead.
|
||||
#
|
||||
# This flag has no effect on the "sign" and "sign_for" command line options
|
||||
# that xahaud makes available.
|
||||
# that rippled makes available.
|
||||
#
|
||||
# The default value of this field is "false"
|
||||
#
|
||||
@@ -1404,7 +1375,7 @@
|
||||
#--------------------
|
||||
#
|
||||
# Administrators can use these values as a starting point for configuring
|
||||
# their instance of xahaud, but each value should be checked to make sure
|
||||
# their instance of rippled, but each value should be checked to make sure
|
||||
# it meets the business requirements for the organization.
|
||||
#
|
||||
# Server
|
||||
@@ -1414,7 +1385,7 @@
|
||||
# "peer"
|
||||
#
|
||||
# Peer protocol open to everyone. This is required to accept
|
||||
# incoming xahaud connections. This does not affect automatic
|
||||
# incoming rippled connections. This does not affect automatic
|
||||
# or manual outgoing Peer protocol connections.
|
||||
#
|
||||
# "rpc"
|
||||
@@ -1431,7 +1402,7 @@
|
||||
#
|
||||
# ETL commands for Clio. We recommend setting secure_gateway
|
||||
# in this section to a comma-separated list of the addresses
|
||||
# of your Clio servers, in order to bypass xahaud's rate limiting.
|
||||
# of your Clio servers, in order to bypass rippled's rate limiting.
|
||||
#
|
||||
# This port is commented out but can be enabled by removing
|
||||
# the '#' from each corresponding line including the entry under [server]
|
||||
@@ -1448,8 +1419,8 @@
|
||||
# NOTE
|
||||
#
|
||||
# To accept connections on well known ports such as 80 (HTTP) or
|
||||
# 443 (HTTPS), most operating systems will require xahaud to
|
||||
# run with administrator privileges, or else xahaud will not start.
|
||||
# 443 (HTTPS), most operating systems will require rippled to
|
||||
# run with administrator privileges, or else rippled will not start.
|
||||
|
||||
[server]
|
||||
port_rpc_admin_local
|
||||
@@ -1460,20 +1431,23 @@ port_ws_admin_local
|
||||
#ssl_cert = /etc/ssl/certs/server.crt
|
||||
|
||||
[port_rpc_admin_local]
|
||||
port = 5009
|
||||
port = 5005
|
||||
ip = 127.0.0.1
|
||||
admin = 127.0.0.1
|
||||
protocol = http
|
||||
|
||||
[port_peer]
|
||||
port = 21337
|
||||
# Many servers still use the legacy port of 51235, so for backward-compatibility
|
||||
# we maintain that port number here. However, for new servers we recommend
|
||||
# changing this to the default port of 2459.
|
||||
port = 51235
|
||||
ip = 0.0.0.0
|
||||
# alternatively, to accept connections on IPv4 + IPv6, use:
|
||||
#ip = ::
|
||||
protocol = peer
|
||||
|
||||
[port_ws_admin_local]
|
||||
port = 6009
|
||||
port = 6006
|
||||
ip = 127.0.0.1
|
||||
admin = 127.0.0.1
|
||||
protocol = ws
|
||||
@@ -1485,16 +1459,16 @@ ip = 127.0.0.1
|
||||
secure_gateway = 127.0.0.1
|
||||
|
||||
#[port_ws_public]
|
||||
#port = 6008
|
||||
#port = 6005
|
||||
#ip = 127.0.0.1
|
||||
#protocol = wss
|
||||
#send_queue_limit = 500
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# This is primary persistent datastore for xahaud. This includes transaction
|
||||
# This is primary persistent datastore for rippled. This includes transaction
|
||||
# metadata, account states, and ledger headers. Helpful information can be
|
||||
# found at https://xahau.network/docs/infrastructure/system-requirements
|
||||
# found at https://xrpl.org/capacity-planning.html#node-db-type
|
||||
# type=NuDB is recommended for non-validators with fast SSDs. Validators or
|
||||
# slow / spinning disks should use RocksDB. Caution: Spinning disks are
|
||||
# not recommended. They do not perform well enough to consistently remain
|
||||
@@ -1507,34 +1481,30 @@ secure_gateway = 127.0.0.1
|
||||
# deletion.
|
||||
[node_db]
|
||||
type=NuDB
|
||||
path=/opt/xahaud/db/nudb
|
||||
path=/var/lib/rippled/db/nudb
|
||||
online_delete=512
|
||||
advisory_delete=0
|
||||
|
||||
[database_path]
|
||||
/opt/xahaud/db
|
||||
/var/lib/rippled/db
|
||||
|
||||
|
||||
# This needs to be an absolute directory reference, not a relative one.
|
||||
# Modify this value as required.
|
||||
[debug_logfile]
|
||||
/var/log/xahaud/debug.log
|
||||
/var/log/rippled/debug.log
|
||||
|
||||
# To use the Xahau test network
|
||||
# (see https://xahau.network/docs/infrastructure/installing-xahaud),
|
||||
# To use the XRP test network
|
||||
# (see https://xrpl.org/connect-your-rippled-to-the-xrp-test-net.html),
|
||||
# use the following [ips] section:
|
||||
# [ips]
|
||||
# 79.110.60.121 21338
|
||||
# 79.110.60.122 21338
|
||||
# 79.110.60.124 21338
|
||||
# 79.110.60.125 21338
|
||||
|
||||
# r.altnet.rippletest.net 51235
|
||||
|
||||
# File containing trusted validator keys or validator list publishers.
|
||||
# Unless an absolute path is specified, it will be considered relative to the
|
||||
# folder in which the xahaud.cfg file is located.
|
||||
# folder in which the rippled.cfg file is located.
|
||||
[validators_file]
|
||||
validators-xahau.txt
|
||||
validators.txt
|
||||
|
||||
# Turn down default logging to save disk space in the long run.
|
||||
# Valid values here are trace, debug, info, warning, error, and fatal
|
||||
9
cfg/xahaud-standalone.cfg → cfg/rippled-standalone.cfg
Normal file → Executable file
9
cfg/xahaud-standalone.cfg → cfg/rippled-standalone.cfg
Normal file → Executable file
@@ -1,4 +1,4 @@
|
||||
# standalone: ./xahaud -a --ledgerfile config/genesis.json --conf config/xahaud-standalone.cfg
|
||||
# standalone: ./rippled -a --ledgerfile config/genesis.json --conf config/rippled-standalone.cfg
|
||||
[server]
|
||||
port_rpc_admin_local
|
||||
port_ws_public
|
||||
@@ -21,7 +21,7 @@ ip = 0.0.0.0
|
||||
protocol = ws
|
||||
|
||||
# [port_peer]
|
||||
# port = 21337
|
||||
# port = 51235
|
||||
# ip = 0.0.0.0
|
||||
# protocol = peer
|
||||
|
||||
@@ -69,8 +69,7 @@ time.nist.gov
|
||||
pool.ntp.org
|
||||
|
||||
[ips]
|
||||
bacab.alloy.ee 21337
|
||||
hubs.xahau.as16089.net 21337
|
||||
r.ripple.com 51235
|
||||
|
||||
[validators_file]
|
||||
validators-example.txt
|
||||
@@ -95,7 +94,7 @@ validators-example.txt
|
||||
1000000
|
||||
|
||||
[network_id]
|
||||
21337
|
||||
21338
|
||||
|
||||
[amendments]
|
||||
740352F2412A9909880C23A559FCECEDA3BE2126FED62FC7660D628A06927F11 Flow
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# Default validators.txt
|
||||
#
|
||||
# This file is located in the same folder as your xahaud.cfg file
|
||||
# This file is located in the same folder as your rippled.cfg file
|
||||
# and defines which validators your server trusts not to collude.
|
||||
#
|
||||
# This file is UTF-8 with DOS, UNIX, or Mac style line endings.
|
||||
@@ -17,17 +17,18 @@
|
||||
# See validator_list_sites and validator_list_keys below.
|
||||
#
|
||||
# Examples:
|
||||
# n9L3GdotB8a3AqtsvS7NXt4BUTQSAYyJUr9xtFj2qXJjfbZsawKY
|
||||
# n9M7G6eLwQtUjfCthWUmTN8L4oEZn1sNr46yvKrpsq58K1C6LAxz
|
||||
# n9KorY8QtTdRx7TVDpwnG9NvyxsDwHUKUEeDLY3AkiGncVaSXZi5
|
||||
# n9MqiExBcoG19UXwoLjBJnhsxEhAZMuWwJDRdkyDz1EkEkwzQTNt
|
||||
#
|
||||
# [validator_list_sites]
|
||||
#
|
||||
# List of URIs serving lists of recommended validators.
|
||||
#
|
||||
# Examples:
|
||||
# https://vl.xahau.org
|
||||
# https://vl.ripple.com
|
||||
# https://vl.xrplf.org
|
||||
# http://127.0.0.1:8000
|
||||
# file:///etc/opt/xahaud/vl.txt
|
||||
# file:///etc/opt/ripple/vl.txt
|
||||
#
|
||||
# [validator_list_keys]
|
||||
#
|
||||
@@ -38,48 +39,50 @@
|
||||
# Validator list keys should be hex-encoded.
|
||||
#
|
||||
# Examples:
|
||||
# EDA46E9C39B1389894E690E58914DC1029602870370A0993E5B87C4A24EAF4A8E8
|
||||
# ED2677ABFFD1B33AC6FBC3062B71F1E8397C1505E1C42C64D11AD1B28FF73F4734
|
||||
# ED307A760EE34F2D0CAA103377B1969117C38B8AA0AA1E2A24DAC1F32FC97087ED
|
||||
#
|
||||
# [import_vl_keys]
|
||||
#
|
||||
# This section is used to import the public keys of trusted validator list publishers.
|
||||
# The keys are used to authenticate and accept new lists of trusted validators.
|
||||
# In this example, the key for the publisher "vl.xrplf.org" is imported.
|
||||
# Each key is represented as a hexadecimal string.
|
||||
#
|
||||
# Examples:
|
||||
# ED45D1840EE724BE327ABE9146503D5848EFD5F38B6D5FEDE71E80ACCE5E6E738B
|
||||
# ED42AEC58B701EEBB77356FFFEC26F83C1F0407263530F068C7C73D392C7E06FD1
|
||||
# ED2677ABFFD1B33AC6FBC3062B71F1E8397C1505E1C42C64D11AD1B28FF73F4734
|
||||
# ED2677ABFFD1B33AC6FBC3062B71F1E8397C1505E1C42C64D11AD1B28FF73F4734
|
||||
|
||||
# The default validator list publishers that the xahaud instance
|
||||
# The default validator list publishers that the rippled instance
|
||||
# trusts.
|
||||
#
|
||||
# WARNING: Changing these values can cause your xahaud instance to see a
|
||||
# validated ledger that contradicts other xahaud instances'
|
||||
# WARNING: Changing these values can cause your rippled instance to see a
|
||||
# validated ledger that contradicts other rippled instances'
|
||||
# validated ledgers (aka a ledger fork) if your validator list(s)
|
||||
# do not sufficiently overlap with the list(s) used by others.
|
||||
# See: https://arxiv.org/pdf/1802.07242.pdf
|
||||
|
||||
[validator_list_sites]
|
||||
https://vl.xahau.org
|
||||
https://vl.ripple.com
|
||||
https://vl.xrplf.org
|
||||
|
||||
[validator_list_keys]
|
||||
# vl.xahau.org
|
||||
EDA46E9C39B1389894E690E58914DC1029602870370A0993E5B87C4A24EAF4A8E8
|
||||
#vl.ripple.com
|
||||
ED2677ABFFD1B33AC6FBC3062B71F1E8397C1505E1C42C64D11AD1B28FF73F4734
|
||||
# vl.xrplf.org
|
||||
ED45D1840EE724BE327ABE9146503D5848EFD5F38B6D5FEDE71E80ACCE5E6E738B
|
||||
|
||||
[import_vl_keys]
|
||||
ED45D1840EE724BE327ABE9146503D5848EFD5F38B6D5FEDE71E80ACCE5E6E738B
|
||||
ED42AEC58B701EEBB77356FFFEC26F83C1F0407263530F068C7C73D392C7E06FD1
|
||||
# vl.xrplf.org
|
||||
ED2677ABFFD1B33AC6FBC3062B71F1E8397C1505E1C42C64D11AD1B28FF73F4734
|
||||
|
||||
# To use the test network (see https://xahau.network/docs/infrastructure/installing-xahaud),
|
||||
# To use the test network (see https://xrpl.org/connect-your-rippled-to-the-xrp-test-net.html),
|
||||
# use the following configuration instead:
|
||||
#
|
||||
# [validators]
|
||||
# nHBoJCE3wPgkTcrNPMHyTJFQ2t77EyCAqcBRspFCpL6JhwCm94VZ
|
||||
# nHUVv4g47bFMySAZFUKVaXUYEmfiUExSoY4FzwXULNwJRzju4XnQ
|
||||
# nHBvr8avSFTz4TFxZvvi4rEJZZtyqE3J6KAAcVWVtifsE7edPM7q
|
||||
# nHUH3Z8TRU57zetHbEPr1ynyrJhxQCwrJvNjr4j1SMjYADyW1WWe
|
||||
# [validator_list_sites]
|
||||
# https://vl.altnet.rippletest.net
|
||||
#
|
||||
# [validator_list_keys]
|
||||
# ED264807102805220DA0F312E71FC2C69E1552C9C5790F6C25E3729DEB573D5860
|
||||
#
|
||||
# [import_vl_keys]
|
||||
# ED264807102805220DA0F312E71FC2C69E1552C9C5790F6C25E3729DEB573D5860
|
||||
|
||||
@@ -17,9 +17,7 @@ target_compile_features (common INTERFACE cxx_std_20)
|
||||
target_compile_definitions (common
|
||||
INTERFACE
|
||||
$<$<CONFIG:Debug>:DEBUG _DEBUG>
|
||||
$<$<AND:$<BOOL:${profile}>,$<NOT:$<BOOL:${assert}>>>:NDEBUG>
|
||||
# TODO: Remove once we have migrated functions from OpenSSL 1.x to 3.x.
|
||||
OPENSSL_SUPPRESS_DEPRECATED)
|
||||
$<$<AND:$<BOOL:${profile}>,$<NOT:$<BOOL:${assert}>>>:NDEBUG>)
|
||||
# ^^^^ NOTE: CMAKE release builds already have NDEBUG
|
||||
# defined, so no need to add it explicitly except for
|
||||
# this special case of (profile ON) and (assert OFF)
|
||||
@@ -151,16 +149,6 @@ if (use_mold)
|
||||
ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
|
||||
if ("${LD_VERSION}" MATCHES "mold")
|
||||
target_link_libraries (common INTERFACE -fuse-ld=mold)
|
||||
else ()
|
||||
# Checking for mold linker (< GCC 12.1.0)
|
||||
execute_process (
|
||||
COMMAND ${CMAKE_CXX_COMPILER} -B/usr/libexec/mold -Wl,--version
|
||||
OUTPUT_VARIABLE LD_VERSION_OUT
|
||||
ERROR_VARIABLE LD_VERSION_ERR)
|
||||
set(LD_VERSION "${LD_VERSION_OUT}${LD_VERSION_ERR}")
|
||||
if ("${LD_VERSION}" MATCHES "mold")
|
||||
target_link_libraries (common INTERFACE -B/usr/libexec/mold)
|
||||
endif ()
|
||||
endif ()
|
||||
unset (LD_VERSION)
|
||||
elseif (use_gold AND is_gcc)
|
||||
|
||||
@@ -78,12 +78,6 @@ target_link_libraries(xrpl.libxrpl.beast PUBLIC
|
||||
xrpl.libpb
|
||||
)
|
||||
|
||||
# Conditionally add enhanced logging source when BEAST_ENHANCED_LOGGING is enabled
|
||||
if(DEFINED BEAST_ENHANCED_LOGGING AND BEAST_ENHANCED_LOGGING)
|
||||
target_sources(xrpl.libxrpl.beast PRIVATE
|
||||
src/libxrpl/beast/utility/src/beast_EnhancedLogging.cpp)
|
||||
endif()
|
||||
|
||||
# Level 02
|
||||
add_module(xrpl basics)
|
||||
target_link_libraries(xrpl.libxrpl.basics PUBLIC xrpl.libxrpl.beast)
|
||||
@@ -181,11 +175,6 @@ if(xrpld)
|
||||
Ripple::opts
|
||||
Ripple::libs
|
||||
xrpl.libxrpl
|
||||
# Workaround for a Conan 1.x bug that prevents static linking of libstdc++
|
||||
# when a dependency (snappy) modifies system_libs. See the comment in
|
||||
# external/snappy/conanfile.py for a full explanation.
|
||||
# This is likely not strictly necessary, but listed explicitly as a good practice.
|
||||
m
|
||||
)
|
||||
exclude_if_included(rippled)
|
||||
# define a macro for tests that might need to
|
||||
|
||||
33
cmake/RippledNIH.cmake
Normal file
33
cmake/RippledNIH.cmake
Normal file
@@ -0,0 +1,33 @@
|
||||
#[===================================================================[
|
||||
NIH prefix path..this is where we will download
|
||||
and build any ExternalProjects, and they will hopefully
|
||||
survive across build directory deletion (manual cleans)
|
||||
#]===================================================================]
|
||||
|
||||
string (REGEX REPLACE "[ \\/%]+" "_" gen_for_path ${CMAKE_GENERATOR})
|
||||
string (TOLOWER ${gen_for_path} gen_for_path)
|
||||
# HACK: trying to shorten paths for windows CI (which hits 260 MAXPATH easily)
|
||||
# @see: https://issues.jenkins-ci.org/browse/JENKINS-38706?focusedCommentId=339847
|
||||
string (REPLACE "visual_studio" "vs" gen_for_path ${gen_for_path})
|
||||
if (NOT DEFINED NIH_CACHE_ROOT)
|
||||
if (DEFINED ENV{NIH_CACHE_ROOT})
|
||||
set (NIH_CACHE_ROOT $ENV{NIH_CACHE_ROOT})
|
||||
else ()
|
||||
set (NIH_CACHE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/.nih_c")
|
||||
endif ()
|
||||
endif ()
|
||||
set (nih_cache_path
|
||||
"${NIH_CACHE_ROOT}/${gen_for_path}/${CMAKE_CXX_COMPILER_ID}_${CMAKE_CXX_COMPILER_VERSION}")
|
||||
if (NOT is_multiconfig)
|
||||
set (nih_cache_path "${nih_cache_path}/${CMAKE_BUILD_TYPE}")
|
||||
endif ()
|
||||
file(TO_CMAKE_PATH "${nih_cache_path}" nih_cache_path)
|
||||
message (STATUS "NIH-EP cache path: ${nih_cache_path}")
|
||||
## two convenience variables:
|
||||
set (ep_lib_prefix ${CMAKE_STATIC_LIBRARY_PREFIX})
|
||||
set (ep_lib_suffix ${CMAKE_STATIC_LIBRARY_SUFFIX})
|
||||
|
||||
# this is a setting for FetchContent and needs to be
|
||||
# a cache variable
|
||||
# https://cmake.org/cmake/help/latest/module/FetchContent.html#populating-the-content
|
||||
set (FETCHCONTENT_BASE_DIR ${nih_cache_path} CACHE STRING "" FORCE)
|
||||
54
cmake/conan/Boost.cmake
Normal file
54
cmake/conan/Boost.cmake
Normal file
@@ -0,0 +1,54 @@
|
||||
find_package(Boost 1.83 REQUIRED
|
||||
COMPONENTS
|
||||
chrono
|
||||
container
|
||||
context
|
||||
coroutine
|
||||
date_time
|
||||
filesystem
|
||||
json
|
||||
program_options
|
||||
regex
|
||||
system
|
||||
thread
|
||||
)
|
||||
|
||||
add_library(ripple_boost INTERFACE)
|
||||
add_library(Ripple::boost ALIAS ripple_boost)
|
||||
if(XCODE)
|
||||
target_include_directories(ripple_boost BEFORE INTERFACE ${Boost_INCLUDE_DIRS})
|
||||
target_compile_options(ripple_boost INTERFACE --system-header-prefix="boost/")
|
||||
else()
|
||||
target_include_directories(ripple_boost SYSTEM BEFORE INTERFACE ${Boost_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
target_link_libraries(ripple_boost
|
||||
INTERFACE
|
||||
Boost::boost
|
||||
Boost::chrono
|
||||
Boost::container
|
||||
Boost::coroutine
|
||||
Boost::date_time
|
||||
Boost::filesystem
|
||||
Boost::json
|
||||
Boost::program_options
|
||||
Boost::regex
|
||||
Boost::system
|
||||
Boost::iostreams
|
||||
Boost::thread)
|
||||
if(Boost_COMPILER)
|
||||
target_link_libraries(ripple_boost INTERFACE Boost::disable_autolinking)
|
||||
endif()
|
||||
if(san AND is_clang)
|
||||
# TODO: gcc does not support -fsanitize-blacklist...can we do something else
|
||||
# for gcc ?
|
||||
if(NOT Boost_INCLUDE_DIRS AND TARGET Boost::headers)
|
||||
get_target_property(Boost_INCLUDE_DIRS Boost::headers INTERFACE_INCLUDE_DIRECTORIES)
|
||||
endif()
|
||||
message(STATUS "Adding [${Boost_INCLUDE_DIRS}] to sanitizer blacklist")
|
||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/san_bl.txt "src:${Boost_INCLUDE_DIRS}/*")
|
||||
target_compile_options(opts
|
||||
INTERFACE
|
||||
# ignore boost headers for sanitizing
|
||||
-fsanitize-blacklist=${CMAKE_CURRENT_BINARY_DIR}/san_bl.txt)
|
||||
endif()
|
||||
@@ -1,4 +1,52 @@
|
||||
find_package(Boost 1.83 REQUIRED
|
||||
#[===================================================================[
|
||||
NIH dep: boost
|
||||
#]===================================================================]
|
||||
if((NOT DEFINED BOOST_ROOT) AND(DEFINED ENV{BOOST_ROOT}))
|
||||
set(BOOST_ROOT $ENV{BOOST_ROOT})
|
||||
endif()
|
||||
if((NOT DEFINED BOOST_LIBRARYDIR) AND(DEFINED ENV{BOOST_LIBRARYDIR}))
|
||||
set(BOOST_LIBRARYDIR $ENV{BOOST_LIBRARYDIR})
|
||||
endif()
|
||||
file(TO_CMAKE_PATH "${BOOST_ROOT}" BOOST_ROOT)
|
||||
if(WIN32 OR CYGWIN)
|
||||
# Workaround for MSVC having two boost versions - x86 and x64 on same PC in stage folders
|
||||
if((NOT DEFINED BOOST_LIBRARYDIR) AND (DEFINED BOOST_ROOT))
|
||||
if(IS_DIRECTORY ${BOOST_ROOT}/stage64/lib)
|
||||
set(BOOST_LIBRARYDIR ${BOOST_ROOT}/stage64/lib)
|
||||
elseif(IS_DIRECTORY ${BOOST_ROOT}/stage/lib)
|
||||
set(BOOST_LIBRARYDIR ${BOOST_ROOT}/stage/lib)
|
||||
elseif(IS_DIRECTORY ${BOOST_ROOT}/lib)
|
||||
set(BOOST_LIBRARYDIR ${BOOST_ROOT}/lib)
|
||||
else()
|
||||
message(WARNING "Did not find expected boost library dir. "
|
||||
"Defaulting to ${BOOST_ROOT}")
|
||||
set(BOOST_LIBRARYDIR ${BOOST_ROOT})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
message(STATUS "BOOST_ROOT: ${BOOST_ROOT}")
|
||||
message(STATUS "BOOST_LIBRARYDIR: ${BOOST_LIBRARYDIR}")
|
||||
|
||||
# uncomment the following as needed to debug FindBoost issues:
|
||||
#set(Boost_DEBUG ON)
|
||||
|
||||
#[=========================================================[
|
||||
boost dynamic libraries don't trivially support @rpath
|
||||
linking right now (cmake's default), so just force
|
||||
static linking for macos, or if requested on linux by flag
|
||||
#]=========================================================]
|
||||
if(static)
|
||||
set(Boost_USE_STATIC_LIBS ON)
|
||||
endif()
|
||||
set(Boost_USE_MULTITHREADED ON)
|
||||
if(static AND NOT APPLE)
|
||||
set(Boost_USE_STATIC_RUNTIME ON)
|
||||
else()
|
||||
set(Boost_USE_STATIC_RUNTIME OFF)
|
||||
endif()
|
||||
# TBD:
|
||||
# Boost_USE_DEBUG_RUNTIME: When ON, uses Boost libraries linked against the
|
||||
find_package(Boost 1.86 REQUIRED
|
||||
COMPONENTS
|
||||
chrono
|
||||
container
|
||||
@@ -10,12 +58,12 @@ find_package(Boost 1.83 REQUIRED
|
||||
program_options
|
||||
regex
|
||||
system
|
||||
thread
|
||||
)
|
||||
iostreams
|
||||
thread)
|
||||
|
||||
add_library(ripple_boost INTERFACE)
|
||||
add_library(Ripple::boost ALIAS ripple_boost)
|
||||
if(XCODE)
|
||||
if(is_xcode)
|
||||
target_include_directories(ripple_boost BEFORE INTERFACE ${Boost_INCLUDE_DIRS})
|
||||
target_compile_options(ripple_boost INTERFACE --system-header-prefix="boost/")
|
||||
else()
|
||||
@@ -35,7 +83,6 @@ target_link_libraries(ripple_boost
|
||||
Boost::program_options
|
||||
Boost::regex
|
||||
Boost::system
|
||||
Boost::iostreams
|
||||
Boost::thread)
|
||||
if(Boost_COMPILER)
|
||||
target_link_libraries(ripple_boost INTERFACE Boost::disable_autolinking)
|
||||
|
||||
28
cmake/deps/Ed25519-donna.cmake
Normal file
28
cmake/deps/Ed25519-donna.cmake
Normal file
@@ -0,0 +1,28 @@
|
||||
#[===================================================================[
|
||||
NIH dep: ed25519-donna
|
||||
#]===================================================================]
|
||||
|
||||
add_library (ed25519-donna STATIC
|
||||
external/ed25519-donna/ed25519.c)
|
||||
target_include_directories (ed25519-donna
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/external>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/ed25519-donna)
|
||||
#[=========================================================[
|
||||
NOTE for macos:
|
||||
https://github.com/floodyberry/ed25519-donna/issues/29
|
||||
our source for ed25519-donna-portable.h has been
|
||||
patched to workaround this.
|
||||
#]=========================================================]
|
||||
target_link_libraries (ed25519-donna PUBLIC OpenSSL::SSL)
|
||||
add_library (NIH::ed25519-donna ALIAS ed25519-donna)
|
||||
target_link_libraries (ripple_libs INTERFACE NIH::ed25519-donna)
|
||||
#[===========================[
|
||||
headers installation
|
||||
#]===========================]
|
||||
install (
|
||||
FILES
|
||||
external/ed25519-donna/ed25519.h
|
||||
DESTINATION include/ed25519-donna)
|
||||
2200
cmake/deps/FindBoost.cmake
Normal file
2200
cmake/deps/FindBoost.cmake
Normal file
File diff suppressed because it is too large
Load Diff
47
cmake/deps/Findjemalloc.cmake
Normal file
47
cmake/deps/Findjemalloc.cmake
Normal file
@@ -0,0 +1,47 @@
|
||||
# - Try to find jemalloc
|
||||
# Once done this will define
|
||||
# JEMALLOC_FOUND - System has jemalloc
|
||||
# JEMALLOC_INCLUDE_DIRS - The jemalloc include directories
|
||||
# JEMALLOC_LIBRARIES - The libraries needed to use jemalloc
|
||||
|
||||
if(NOT USE_BUNDLED_JEMALLOC)
|
||||
find_package(PkgConfig)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(PC_JEMALLOC QUIET jemalloc)
|
||||
endif()
|
||||
else()
|
||||
set(PC_JEMALLOC_INCLUDEDIR)
|
||||
set(PC_JEMALLOC_INCLUDE_DIRS)
|
||||
set(PC_JEMALLOC_LIBDIR)
|
||||
set(PC_JEMALLOC_LIBRARY_DIRS)
|
||||
set(LIMIT_SEARCH NO_DEFAULT_PATH)
|
||||
endif()
|
||||
|
||||
set(JEMALLOC_DEFINITIONS ${PC_JEMALLOC_CFLAGS_OTHER})
|
||||
|
||||
find_path(JEMALLOC_INCLUDE_DIR jemalloc/jemalloc.h
|
||||
PATHS ${PC_JEMALLOC_INCLUDEDIR} ${PC_JEMALLOC_INCLUDE_DIRS}
|
||||
${LIMIT_SEARCH})
|
||||
|
||||
# If we're asked to use static linkage, add libjemalloc.a as a preferred library name.
|
||||
if(JEMALLOC_USE_STATIC)
|
||||
list(APPEND JEMALLOC_NAMES
|
||||
"${CMAKE_STATIC_LIBRARY_PREFIX}jemalloc${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
endif()
|
||||
|
||||
list(APPEND JEMALLOC_NAMES jemalloc)
|
||||
|
||||
find_library(JEMALLOC_LIBRARY NAMES ${JEMALLOC_NAMES}
|
||||
HINTS ${PC_JEMALLOC_LIBDIR} ${PC_JEMALLOC_LIBRARY_DIRS}
|
||||
${LIMIT_SEARCH})
|
||||
|
||||
set(JEMALLOC_LIBRARIES ${JEMALLOC_LIBRARY})
|
||||
set(JEMALLOC_INCLUDE_DIRS ${JEMALLOC_INCLUDE_DIR})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
# handle the QUIETLY and REQUIRED arguments and set JEMALLOC_FOUND to TRUE
|
||||
# if all listed variables are TRUE
|
||||
find_package_handle_standard_args(JeMalloc DEFAULT_MSG
|
||||
JEMALLOC_LIBRARY JEMALLOC_INCLUDE_DIR)
|
||||
|
||||
mark_as_advanced(JEMALLOC_INCLUDE_DIR JEMALLOC_LIBRARY)
|
||||
22
cmake/deps/Findlibarchive_pc.cmake
Normal file
22
cmake/deps/Findlibarchive_pc.cmake
Normal file
@@ -0,0 +1,22 @@
|
||||
find_package (PkgConfig REQUIRED)
|
||||
pkg_search_module (libarchive_PC QUIET libarchive>=3.4.3)
|
||||
|
||||
if(static)
|
||||
set(LIBARCHIVE_LIB libarchive.a)
|
||||
else()
|
||||
set(LIBARCHIVE_LIB archive)
|
||||
endif()
|
||||
|
||||
find_library (archive
|
||||
NAMES ${LIBARCHIVE_LIB}
|
||||
HINTS
|
||||
${libarchive_PC_LIBDIR}
|
||||
${libarchive_PC_LIBRARY_DIRS}
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
find_path (LIBARCHIVE_INCLUDE_DIR
|
||||
NAMES archive.h
|
||||
HINTS
|
||||
${libarchive_PC_INCLUDEDIR}
|
||||
${libarchive_PC_INCLUDEDIRS}
|
||||
NO_DEFAULT_PATH)
|
||||
24
cmake/deps/Findlz4.cmake
Normal file
24
cmake/deps/Findlz4.cmake
Normal file
@@ -0,0 +1,24 @@
|
||||
find_package (PkgConfig)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_search_module (lz4_PC QUIET liblz4>=1.9)
|
||||
endif ()
|
||||
|
||||
if(static)
|
||||
set(LZ4_LIB liblz4.a)
|
||||
else()
|
||||
set(LZ4_LIB lz4.so)
|
||||
endif()
|
||||
|
||||
find_library (lz4
|
||||
NAMES ${LZ4_LIB}
|
||||
HINTS
|
||||
${lz4_PC_LIBDIR}
|
||||
${lz4_PC_LIBRARY_DIRS}
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
find_path (LZ4_INCLUDE_DIR
|
||||
NAMES lz4.h
|
||||
HINTS
|
||||
${lz4_PC_INCLUDEDIR}
|
||||
${lz4_PC_INCLUDEDIRS}
|
||||
NO_DEFAULT_PATH)
|
||||
24
cmake/deps/Findsecp256k1.cmake
Normal file
24
cmake/deps/Findsecp256k1.cmake
Normal file
@@ -0,0 +1,24 @@
|
||||
find_package (PkgConfig)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_search_module (secp256k1_PC QUIET libsecp256k1)
|
||||
endif ()
|
||||
|
||||
if(static)
|
||||
set(SECP256K1_LIB libsecp256k1.a)
|
||||
else()
|
||||
set(SECP256K1_LIB secp256k1)
|
||||
endif()
|
||||
|
||||
find_library(secp256k1
|
||||
NAMES ${SECP256K1_LIB}
|
||||
HINTS
|
||||
${secp256k1_PC_LIBDIR}
|
||||
${secp256k1_PC_LIBRARY_PATHS}
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
find_path (SECP256K1_INCLUDE_DIR
|
||||
NAMES secp256k1.h
|
||||
HINTS
|
||||
${secp256k1_PC_INCLUDEDIR}
|
||||
${secp256k1_PC_INCLUDEDIRS}
|
||||
NO_DEFAULT_PATH)
|
||||
24
cmake/deps/Findsnappy.cmake
Normal file
24
cmake/deps/Findsnappy.cmake
Normal file
@@ -0,0 +1,24 @@
|
||||
find_package (PkgConfig)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_search_module (snappy_PC QUIET snappy>=1.1.7)
|
||||
endif ()
|
||||
|
||||
if(static)
|
||||
set(SNAPPY_LIB libsnappy.a)
|
||||
else()
|
||||
set(SNAPPY_LIB libsnappy.so)
|
||||
endif()
|
||||
|
||||
find_library (snappy
|
||||
NAMES ${SNAPPY_LIB}
|
||||
HINTS
|
||||
${snappy_PC_LIBDIR}
|
||||
${snappy_PC_LIBRARY_DIRS}
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
find_path (SNAPPY_INCLUDE_DIR
|
||||
NAMES snappy.h
|
||||
HINTS
|
||||
${snappy_PC_INCLUDEDIR}
|
||||
${snappy_PC_INCLUDEDIRS}
|
||||
NO_DEFAULT_PATH)
|
||||
19
cmake/deps/Findsoci.cmake
Normal file
19
cmake/deps/Findsoci.cmake
Normal file
@@ -0,0 +1,19 @@
|
||||
find_package (PkgConfig)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
# TBD - currently no soci pkgconfig
|
||||
#pkg_search_module (soci_PC QUIET libsoci_core>=3.2)
|
||||
endif ()
|
||||
|
||||
if(static)
|
||||
set(SOCI_LIB libsoci.a)
|
||||
else()
|
||||
set(SOCI_LIB libsoci_core.so)
|
||||
endif()
|
||||
|
||||
find_library (soci
|
||||
NAMES ${SOCI_LIB})
|
||||
|
||||
find_path (SOCI_INCLUDE_DIR
|
||||
NAMES soci/soci.h)
|
||||
|
||||
message("SOCI FOUND AT: ${SOCI_LIB}")
|
||||
24
cmake/deps/Findsqlite.cmake
Normal file
24
cmake/deps/Findsqlite.cmake
Normal file
@@ -0,0 +1,24 @@
|
||||
find_package (PkgConfig)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_search_module (sqlite_PC QUIET sqlite3>=3.26.0)
|
||||
endif ()
|
||||
|
||||
if(static)
|
||||
set(SQLITE_LIB libsqlite3.a)
|
||||
else()
|
||||
set(SQLITE_LIB sqlite3.so)
|
||||
endif()
|
||||
|
||||
find_library (sqlite3
|
||||
NAMES ${SQLITE_LIB}
|
||||
HINTS
|
||||
${sqlite_PC_LIBDIR}
|
||||
${sqlite_PC_LIBRARY_DIRS}
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
find_path (SQLITE_INCLUDE_DIR
|
||||
NAMES sqlite3.h
|
||||
HINTS
|
||||
${sqlite_PC_INCLUDEDIR}
|
||||
${sqlite_PC_INCLUDEDIRS}
|
||||
NO_DEFAULT_PATH)
|
||||
163
cmake/deps/Libarchive.cmake
Normal file
163
cmake/deps/Libarchive.cmake
Normal file
@@ -0,0 +1,163 @@
|
||||
#[===================================================================[
|
||||
NIH dep: libarchive
|
||||
#]===================================================================]
|
||||
|
||||
option (local_libarchive "use local build of libarchive." OFF)
|
||||
add_library (archive_lib UNKNOWN IMPORTED GLOBAL)
|
||||
|
||||
if (NOT local_libarchive)
|
||||
if (NOT WIN32)
|
||||
find_package(libarchive_pc REQUIRED)
|
||||
endif ()
|
||||
if (archive)
|
||||
message (STATUS "Found libarchive using pkg-config. Using ${archive}.")
|
||||
set_target_properties (archive_lib PROPERTIES
|
||||
IMPORTED_LOCATION_DEBUG
|
||||
${archive}
|
||||
IMPORTED_LOCATION_RELEASE
|
||||
${archive}
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
${LIBARCHIVE_INCLUDE_DIR})
|
||||
# pkg-config can return extra info for static lib linking
|
||||
# this is probably needed/useful generally, but apply
|
||||
# to APPLE for now (mostly for homebrew)
|
||||
if (APPLE AND static AND libarchive_PC_STATIC_LIBRARIES)
|
||||
message(STATUS "NOTE: libarchive static libs: ${libarchive_PC_STATIC_LIBRARIES}")
|
||||
# also, APPLE seems to need iconv...maybe linux does too (TBD)
|
||||
target_link_libraries (archive_lib
|
||||
INTERFACE iconv ${libarchive_PC_STATIC_LIBRARIES})
|
||||
endif ()
|
||||
else ()
|
||||
## now try searching using the minimal find module that cmake provides
|
||||
find_package(LibArchive 3.4.3 QUIET)
|
||||
if (LibArchive_FOUND)
|
||||
if (static)
|
||||
# find module doesn't find static libs currently, so we re-search
|
||||
get_filename_component(_loc ${LibArchive_LIBRARY} DIRECTORY)
|
||||
find_library(_la_static
|
||||
NAMES libarchive.a archive_static.lib archive.lib
|
||||
PATHS ${_loc})
|
||||
if (_la_static)
|
||||
set (_la_lib ${_la_static})
|
||||
else ()
|
||||
message (WARNING "unable to find libarchive static lib - switching to local build")
|
||||
set (local_libarchive ON CACHE BOOL "" FORCE)
|
||||
endif ()
|
||||
else ()
|
||||
set (_la_lib ${LibArchive_LIBRARY})
|
||||
endif ()
|
||||
if (NOT local_libarchive)
|
||||
message (STATUS "Found libarchive using module/config. Using ${_la_lib}.")
|
||||
set_target_properties (archive_lib PROPERTIES
|
||||
IMPORTED_LOCATION_DEBUG
|
||||
${_la_lib}
|
||||
IMPORTED_LOCATION_RELEASE
|
||||
${_la_lib}
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
${LibArchive_INCLUDE_DIRS})
|
||||
endif ()
|
||||
else ()
|
||||
set (local_libarchive ON CACHE BOOL "" FORCE)
|
||||
endif ()
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
if (local_libarchive)
|
||||
set (lib_post "")
|
||||
if (MSVC)
|
||||
set (lib_post "_static")
|
||||
endif ()
|
||||
ExternalProject_Add (libarchive
|
||||
PREFIX ${nih_cache_path}
|
||||
GIT_REPOSITORY https://github.com/libarchive/libarchive.git
|
||||
GIT_TAG v3.4.3
|
||||
CMAKE_ARGS
|
||||
# passing the compiler seems to be needed for windows CI, sadly
|
||||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||
$<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:-DCMAKE_VERBOSE_MAKEFILE=ON>
|
||||
-DCMAKE_DEBUG_POSTFIX=_d
|
||||
$<$<NOT:$<BOOL:${is_multiconfig}>>:-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}>
|
||||
-DENABLE_LZ4=ON
|
||||
-ULZ4_*
|
||||
-DLZ4_INCLUDE_DIR=$<JOIN:$<TARGET_PROPERTY:lz4_lib,INTERFACE_INCLUDE_DIRECTORIES>,::>
|
||||
# because we are building a static lib, this lz4 library doesn't
|
||||
# actually matter since you can't generally link static libs to other static
|
||||
# libs. The include files are needed, but the library itself is not (until
|
||||
# we link our application, at which point we use the lz4 we built above).
|
||||
# nonetheless, we need to provide a library to libarchive else it will
|
||||
# NOT include lz4 support when configuring
|
||||
-DLZ4_LIBRARY=$<IF:$<CONFIG:Debug>,$<TARGET_PROPERTY:lz4_lib,IMPORTED_LOCATION_DEBUG>,$<TARGET_PROPERTY:lz4_lib,IMPORTED_LOCATION_RELEASE>>
|
||||
-DENABLE_WERROR=OFF
|
||||
-DENABLE_TAR=OFF
|
||||
-DENABLE_TAR_SHARED=OFF
|
||||
-DENABLE_INSTALL=ON
|
||||
-DENABLE_NETTLE=OFF
|
||||
-DENABLE_OPENSSL=OFF
|
||||
-DENABLE_LZO=OFF
|
||||
-DENABLE_LZMA=OFF
|
||||
-DENABLE_ZLIB=OFF
|
||||
-DENABLE_BZip2=OFF
|
||||
-DENABLE_LIBXML2=OFF
|
||||
-DENABLE_EXPAT=OFF
|
||||
-DENABLE_PCREPOSIX=OFF
|
||||
-DENABLE_LibGCC=OFF
|
||||
-DENABLE_CNG=OFF
|
||||
-DENABLE_CPIO=OFF
|
||||
-DENABLE_CPIO_SHARED=OFF
|
||||
-DENABLE_CAT=OFF
|
||||
-DENABLE_CAT_SHARED=OFF
|
||||
-DENABLE_XATTR=OFF
|
||||
-DENABLE_ACL=OFF
|
||||
-DENABLE_ICONV=OFF
|
||||
-DENABLE_TEST=OFF
|
||||
-DENABLE_COVERAGE=OFF
|
||||
$<$<BOOL:${MSVC}>:
|
||||
"-DCMAKE_C_FLAGS=-GR -Gd -fp:precise -FS -MP"
|
||||
"-DCMAKE_C_FLAGS_DEBUG=-MTd"
|
||||
"-DCMAKE_C_FLAGS_RELEASE=-MT"
|
||||
>
|
||||
LIST_SEPARATOR ::
|
||||
LOG_BUILD ON
|
||||
LOG_CONFIGURE ON
|
||||
BUILD_COMMAND
|
||||
${CMAKE_COMMAND}
|
||||
--build .
|
||||
--config $<CONFIG>
|
||||
--target archive_static
|
||||
--parallel ${ep_procs}
|
||||
$<$<BOOL:${is_multiconfig}>:
|
||||
COMMAND
|
||||
${CMAKE_COMMAND} -E copy
|
||||
<BINARY_DIR>/libarchive/$<CONFIG>/${ep_lib_prefix}archive${lib_post}$<$<CONFIG:Debug>:_d>${ep_lib_suffix}
|
||||
<BINARY_DIR>/libarchive
|
||||
>
|
||||
TEST_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
DEPENDS lz4_lib
|
||||
BUILD_BYPRODUCTS
|
||||
<BINARY_DIR>/libarchive/${ep_lib_prefix}archive${lib_post}${ep_lib_suffix}
|
||||
<BINARY_DIR>/libarchive/${ep_lib_prefix}archive${lib_post}_d${ep_lib_suffix}
|
||||
)
|
||||
ExternalProject_Get_Property (libarchive BINARY_DIR)
|
||||
ExternalProject_Get_Property (libarchive SOURCE_DIR)
|
||||
if (CMAKE_VERBOSE_MAKEFILE)
|
||||
print_ep_logs (libarchive)
|
||||
endif ()
|
||||
file (MAKE_DIRECTORY ${SOURCE_DIR}/libarchive)
|
||||
set_target_properties (archive_lib PROPERTIES
|
||||
IMPORTED_LOCATION_DEBUG
|
||||
${BINARY_DIR}/libarchive/${ep_lib_prefix}archive${lib_post}_d${ep_lib_suffix}
|
||||
IMPORTED_LOCATION_RELEASE
|
||||
${BINARY_DIR}/libarchive/${ep_lib_prefix}archive${lib_post}${ep_lib_suffix}
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
${SOURCE_DIR}/libarchive
|
||||
INTERFACE_COMPILE_DEFINITIONS
|
||||
LIBARCHIVE_STATIC)
|
||||
endif()
|
||||
|
||||
add_dependencies (archive_lib libarchive)
|
||||
target_link_libraries (archive_lib INTERFACE lz4_lib)
|
||||
target_link_libraries (ripple_libs INTERFACE archive_lib)
|
||||
exclude_if_included (libarchive)
|
||||
exclude_if_included (archive_lib)
|
||||
79
cmake/deps/Lz4.cmake
Normal file
79
cmake/deps/Lz4.cmake
Normal file
@@ -0,0 +1,79 @@
|
||||
#[===================================================================[
|
||||
NIH dep: lz4
|
||||
#]===================================================================]
|
||||
|
||||
add_library (lz4_lib STATIC IMPORTED GLOBAL)
|
||||
|
||||
if (NOT WIN32)
|
||||
find_package(lz4)
|
||||
endif()
|
||||
|
||||
if(lz4)
|
||||
set_target_properties (lz4_lib PROPERTIES
|
||||
IMPORTED_LOCATION_DEBUG
|
||||
${lz4}
|
||||
IMPORTED_LOCATION_RELEASE
|
||||
${lz4}
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
${LZ4_INCLUDE_DIR})
|
||||
|
||||
else()
|
||||
ExternalProject_Add (lz4
|
||||
PREFIX ${nih_cache_path}
|
||||
GIT_REPOSITORY https://github.com/lz4/lz4.git
|
||||
GIT_TAG v1.9.2
|
||||
SOURCE_SUBDIR contrib/cmake_unofficial
|
||||
CMAKE_ARGS
|
||||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||
$<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:-DCMAKE_VERBOSE_MAKEFILE=ON>
|
||||
-DCMAKE_DEBUG_POSTFIX=_d
|
||||
$<$<NOT:$<BOOL:${is_multiconfig}>>:-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}>
|
||||
-DBUILD_STATIC_LIBS=ON
|
||||
-DBUILD_SHARED_LIBS=OFF
|
||||
$<$<BOOL:${MSVC}>:
|
||||
"-DCMAKE_C_FLAGS=-GR -Gd -fp:precise -FS -MP"
|
||||
"-DCMAKE_C_FLAGS_DEBUG=-MTd"
|
||||
"-DCMAKE_C_FLAGS_RELEASE=-MT"
|
||||
>
|
||||
LOG_BUILD ON
|
||||
LOG_CONFIGURE ON
|
||||
BUILD_COMMAND
|
||||
${CMAKE_COMMAND}
|
||||
--build .
|
||||
--config $<CONFIG>
|
||||
--target lz4_static
|
||||
--parallel ${ep_procs}
|
||||
$<$<BOOL:${is_multiconfig}>:
|
||||
COMMAND
|
||||
${CMAKE_COMMAND} -E copy
|
||||
<BINARY_DIR>/$<CONFIG>/${ep_lib_prefix}lz4$<$<CONFIG:Debug>:_d>${ep_lib_suffix}
|
||||
<BINARY_DIR>
|
||||
>
|
||||
TEST_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
BUILD_BYPRODUCTS
|
||||
<BINARY_DIR>/${ep_lib_prefix}lz4${ep_lib_suffix}
|
||||
<BINARY_DIR>/${ep_lib_prefix}lz4_d${ep_lib_suffix}
|
||||
)
|
||||
ExternalProject_Get_Property (lz4 BINARY_DIR)
|
||||
ExternalProject_Get_Property (lz4 SOURCE_DIR)
|
||||
|
||||
file (MAKE_DIRECTORY ${SOURCE_DIR}/lz4)
|
||||
set_target_properties (lz4_lib PROPERTIES
|
||||
IMPORTED_LOCATION_DEBUG
|
||||
${BINARY_DIR}/${ep_lib_prefix}lz4_d${ep_lib_suffix}
|
||||
IMPORTED_LOCATION_RELEASE
|
||||
${BINARY_DIR}/${ep_lib_prefix}lz4${ep_lib_suffix}
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
${SOURCE_DIR}/lib)
|
||||
|
||||
if (CMAKE_VERBOSE_MAKEFILE)
|
||||
print_ep_logs (lz4)
|
||||
endif ()
|
||||
add_dependencies (lz4_lib lz4)
|
||||
target_link_libraries (ripple_libs INTERFACE lz4_lib)
|
||||
exclude_if_included (lz4)
|
||||
endif()
|
||||
|
||||
exclude_if_included (lz4_lib)
|
||||
31
cmake/deps/Nudb.cmake
Normal file
31
cmake/deps/Nudb.cmake
Normal file
@@ -0,0 +1,31 @@
|
||||
#[===================================================================[
|
||||
NIH dep: nudb
|
||||
|
||||
NuDB is header-only, thus is an INTERFACE lib in CMake.
|
||||
TODO: move the library definition into NuDB repo and add
|
||||
proper targets and export/install
|
||||
#]===================================================================]
|
||||
|
||||
if (is_root_project) # NuDB not needed in the case of xrpl.libpb inclusion build
|
||||
add_library (nudb INTERFACE)
|
||||
FetchContent_Declare(
|
||||
nudb_src
|
||||
GIT_REPOSITORY https://github.com/CPPAlliance/NuDB.git
|
||||
GIT_TAG 2.0.5
|
||||
)
|
||||
FetchContent_GetProperties(nudb_src)
|
||||
if(NOT nudb_src_POPULATED)
|
||||
message (STATUS "Pausing to download NuDB...")
|
||||
FetchContent_Populate(nudb_src)
|
||||
endif()
|
||||
|
||||
file(TO_CMAKE_PATH "${nudb_src_SOURCE_DIR}" nudb_src_SOURCE_DIR)
|
||||
# specify as system includes so as to avoid warnings
|
||||
target_include_directories (nudb SYSTEM INTERFACE ${nudb_src_SOURCE_DIR}/include)
|
||||
target_link_libraries (nudb
|
||||
INTERFACE
|
||||
Boost::thread
|
||||
Boost::system)
|
||||
add_library (NIH::nudb ALIAS nudb)
|
||||
target_link_libraries (ripple_libs INTERFACE NIH::nudb)
|
||||
endif ()
|
||||
48
cmake/deps/OpenSSL.cmake
Normal file
48
cmake/deps/OpenSSL.cmake
Normal file
@@ -0,0 +1,48 @@
|
||||
#[===================================================================[
|
||||
NIH dep: openssl
|
||||
#]===================================================================]
|
||||
|
||||
#[===============================================[
|
||||
OPENSSL_ROOT_DIR is the only variable that
|
||||
FindOpenSSL honors for locating, so convert any
|
||||
OPENSSL_ROOT vars to this
|
||||
#]===============================================]
|
||||
if (NOT DEFINED OPENSSL_ROOT_DIR)
|
||||
if (DEFINED ENV{OPENSSL_ROOT})
|
||||
set (OPENSSL_ROOT_DIR $ENV{OPENSSL_ROOT})
|
||||
elseif (HOMEBREW)
|
||||
execute_process (COMMAND ${HOMEBREW} --prefix openssl
|
||||
OUTPUT_VARIABLE OPENSSL_ROOT_DIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
endif ()
|
||||
file (TO_CMAKE_PATH "${OPENSSL_ROOT_DIR}" OPENSSL_ROOT_DIR)
|
||||
endif ()
|
||||
|
||||
if (static)
|
||||
set (OPENSSL_USE_STATIC_LIBS ON)
|
||||
endif ()
|
||||
set (OPENSSL_MSVC_STATIC_RT ON)
|
||||
find_package (OpenSSL 1.1.1 REQUIRED)
|
||||
target_link_libraries (ripple_libs
|
||||
INTERFACE
|
||||
OpenSSL::SSL
|
||||
OpenSSL::Crypto)
|
||||
# disable SSLv2...this can also be done when building/configuring OpenSSL
|
||||
set_target_properties(OpenSSL::SSL PROPERTIES
|
||||
INTERFACE_COMPILE_DEFINITIONS OPENSSL_NO_SSL2)
|
||||
#[=========================================================[
|
||||
https://gitlab.kitware.com/cmake/cmake/issues/16885
|
||||
depending on how openssl is built, it might depend
|
||||
on zlib. In fact, the openssl find package should
|
||||
figure this out for us, but it does not currently...
|
||||
so let's add zlib ourselves to the lib list
|
||||
TODO: investigate linking to static zlib for static
|
||||
build option
|
||||
#]=========================================================]
|
||||
find_package (ZLIB)
|
||||
set (has_zlib FALSE)
|
||||
if (TARGET ZLIB::ZLIB)
|
||||
set_target_properties(OpenSSL::Crypto PROPERTIES
|
||||
INTERFACE_LINK_LIBRARIES ZLIB::ZLIB)
|
||||
set (has_zlib TRUE)
|
||||
endif ()
|
||||
70
cmake/deps/Postgres.cmake
Normal file
70
cmake/deps/Postgres.cmake
Normal file
@@ -0,0 +1,70 @@
|
||||
if(reporting)
|
||||
find_package(PostgreSQL)
|
||||
if(NOT PostgreSQL_FOUND)
|
||||
message("find_package did not find postgres")
|
||||
find_library(postgres NAMES pq libpq libpq-dev pq-dev postgresql-devel)
|
||||
find_path(libpq-fe NAMES libpq-fe.h PATH_SUFFIXES postgresql pgsql include)
|
||||
|
||||
if(NOT libpq-fe_FOUND OR NOT postgres_FOUND)
|
||||
message("No system installed Postgres found. Will build")
|
||||
add_library(postgres SHARED IMPORTED GLOBAL)
|
||||
add_library(pgport SHARED IMPORTED GLOBAL)
|
||||
add_library(pgcommon SHARED IMPORTED GLOBAL)
|
||||
ExternalProject_Add(postgres_src
|
||||
PREFIX ${nih_cache_path}
|
||||
GIT_REPOSITORY https://github.com/postgres/postgres.git
|
||||
GIT_TAG REL_14_5
|
||||
CONFIGURE_COMMAND ./configure --without-readline > /dev/null
|
||||
BUILD_COMMAND ${CMAKE_COMMAND} -E env --unset=MAKELEVEL make
|
||||
UPDATE_COMMAND ""
|
||||
BUILD_IN_SOURCE 1
|
||||
INSTALL_COMMAND ""
|
||||
BUILD_BYPRODUCTS
|
||||
<BINARY_DIR>/src/interfaces/libpq/${ep_lib_prefix}pq.a
|
||||
<BINARY_DIR>/src/common/${ep_lib_prefix}pgcommon.a
|
||||
<BINARY_DIR>/src/port/${ep_lib_prefix}pgport.a
|
||||
LOG_BUILD TRUE
|
||||
)
|
||||
ExternalProject_Get_Property (postgres_src SOURCE_DIR)
|
||||
ExternalProject_Get_Property (postgres_src BINARY_DIR)
|
||||
|
||||
set (postgres_src_SOURCE_DIR "${SOURCE_DIR}")
|
||||
file (MAKE_DIRECTORY ${postgres_src_SOURCE_DIR})
|
||||
list(APPEND INCLUDE_DIRS
|
||||
${SOURCE_DIR}/src/include
|
||||
${SOURCE_DIR}/src/interfaces/libpq
|
||||
)
|
||||
set_target_properties(postgres PROPERTIES
|
||||
IMPORTED_LOCATION
|
||||
${BINARY_DIR}/src/interfaces/libpq/${ep_lib_prefix}pq.a
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
"${INCLUDE_DIRS}"
|
||||
)
|
||||
set_target_properties(pgcommon PROPERTIES
|
||||
IMPORTED_LOCATION
|
||||
${BINARY_DIR}/src/common/${ep_lib_prefix}pgcommon.a
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
"${INCLUDE_DIRS}"
|
||||
)
|
||||
set_target_properties(pgport PROPERTIES
|
||||
IMPORTED_LOCATION
|
||||
${BINARY_DIR}/src/port/${ep_lib_prefix}pgport.a
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
"${INCLUDE_DIRS}"
|
||||
)
|
||||
add_dependencies(postgres postgres_src)
|
||||
add_dependencies(pgcommon postgres_src)
|
||||
add_dependencies(pgport postgres_src)
|
||||
file(TO_CMAKE_PATH "${postgres_src_SOURCE_DIR}" postgres_src_SOURCE_DIR)
|
||||
target_link_libraries(ripple_libs INTERFACE postgres pgcommon pgport)
|
||||
else()
|
||||
message("Found system installed Postgres via find_libary")
|
||||
target_include_directories(ripple_libs INTERFACE ${libpq-fe})
|
||||
target_link_libraries(ripple_libs INTERFACE ${postgres})
|
||||
endif()
|
||||
else()
|
||||
message("Found system installed Postgres via find_package")
|
||||
target_include_directories(ripple_libs INTERFACE ${PostgreSQL_INCLUDE_DIRS})
|
||||
target_link_libraries(ripple_libs INTERFACE ${PostgreSQL_LIBRARIES})
|
||||
endif()
|
||||
endif()
|
||||
156
cmake/deps/Protobuf.cmake
Normal file
156
cmake/deps/Protobuf.cmake
Normal file
@@ -0,0 +1,156 @@
|
||||
#[===================================================================[
|
||||
import protobuf (lib and compiler) and create a lib
|
||||
from our proto message definitions. If the system protobuf
|
||||
is not found, fallback on EP to download and build a version
|
||||
from official source.
|
||||
#]===================================================================]
|
||||
|
||||
if (static)
|
||||
set (Protobuf_USE_STATIC_LIBS ON)
|
||||
endif ()
|
||||
find_package (Protobuf 3.8)
|
||||
if (is_multiconfig)
|
||||
set(protobuf_protoc_lib ${Protobuf_PROTOC_LIBRARIES})
|
||||
else ()
|
||||
string(TOUPPER ${CMAKE_BUILD_TYPE} upper_cmake_build_type)
|
||||
set(protobuf_protoc_lib ${Protobuf_PROTOC_LIBRARY_${upper_cmake_build_type}})
|
||||
endif ()
|
||||
if (local_protobuf OR NOT (Protobuf_FOUND AND Protobuf_PROTOC_EXECUTABLE AND protobuf_protoc_lib))
|
||||
include (GNUInstallDirs)
|
||||
message (STATUS "using local protobuf build.")
|
||||
set(protobuf_reqs Protobuf_PROTOC_EXECUTABLE protobuf_protoc_lib)
|
||||
foreach(lib ${protobuf_reqs})
|
||||
if(NOT ${lib})
|
||||
message(STATUS "Couldn't find ${lib}")
|
||||
endif()
|
||||
endforeach()
|
||||
if (WIN32)
|
||||
# protobuf prepends lib even on windows
|
||||
set (pbuf_lib_pre "lib")
|
||||
else ()
|
||||
set (pbuf_lib_pre ${ep_lib_prefix})
|
||||
endif ()
|
||||
# for the external project build of protobuf, we currently ignore the
|
||||
# static option and always build static libs here. This is consistent
|
||||
# with our other EP builds. Dynamic libs in an EP would add complexity
|
||||
# because we'd need to get them into the runtime path, and probably
|
||||
# install them.
|
||||
ExternalProject_Add (protobuf_src
|
||||
PREFIX ${nih_cache_path}
|
||||
GIT_REPOSITORY https://github.com/protocolbuffers/protobuf.git
|
||||
GIT_TAG v3.8.0
|
||||
SOURCE_SUBDIR cmake
|
||||
CMAKE_ARGS
|
||||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||
-DCMAKE_INSTALL_PREFIX=<BINARY_DIR>/_installed_
|
||||
-Dprotobuf_BUILD_TESTS=OFF
|
||||
-Dprotobuf_BUILD_EXAMPLES=OFF
|
||||
-Dprotobuf_BUILD_PROTOC_BINARIES=ON
|
||||
-Dprotobuf_MSVC_STATIC_RUNTIME=ON
|
||||
-DBUILD_SHARED_LIBS=OFF
|
||||
-Dprotobuf_BUILD_SHARED_LIBS=OFF
|
||||
-DCMAKE_DEBUG_POSTFIX=_d
|
||||
-Dprotobuf_DEBUG_POSTFIX=_d
|
||||
-Dprotobuf_WITH_ZLIB=$<IF:$<BOOL:${has_zlib}>,ON,OFF>
|
||||
$<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:-DCMAKE_VERBOSE_MAKEFILE=ON>
|
||||
$<$<BOOL:${unity}>:-DCMAKE_UNITY_BUILD=ON}>
|
||||
$<$<NOT:$<BOOL:${is_multiconfig}>>:-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}>
|
||||
$<$<BOOL:${MSVC}>:
|
||||
"-DCMAKE_CXX_FLAGS=-GR -Gd -fp:precise -FS -EHa -MP"
|
||||
>
|
||||
LOG_BUILD ON
|
||||
LOG_CONFIGURE ON
|
||||
BUILD_COMMAND
|
||||
${CMAKE_COMMAND}
|
||||
--build .
|
||||
--config $<CONFIG>
|
||||
--parallel ${ep_procs}
|
||||
TEST_COMMAND ""
|
||||
INSTALL_COMMAND
|
||||
${CMAKE_COMMAND} -E env --unset=DESTDIR ${CMAKE_COMMAND} --build . --config $<CONFIG> --target install
|
||||
BUILD_BYPRODUCTS
|
||||
<BINARY_DIR>/_installed_/${CMAKE_INSTALL_LIBDIR}/${pbuf_lib_pre}protobuf${ep_lib_suffix}
|
||||
<BINARY_DIR>/_installed_/${CMAKE_INSTALL_LIBDIR}/${pbuf_lib_pre}protobuf_d${ep_lib_suffix}
|
||||
<BINARY_DIR>/_installed_/${CMAKE_INSTALL_LIBDIR}/${pbuf_lib_pre}protoc${ep_lib_suffix}
|
||||
<BINARY_DIR>/_installed_/${CMAKE_INSTALL_LIBDIR}/${pbuf_lib_pre}protoc_d${ep_lib_suffix}
|
||||
<BINARY_DIR>/_installed_/bin/protoc${CMAKE_EXECUTABLE_SUFFIX}
|
||||
)
|
||||
ExternalProject_Get_Property (protobuf_src BINARY_DIR)
|
||||
ExternalProject_Get_Property (protobuf_src SOURCE_DIR)
|
||||
if (CMAKE_VERBOSE_MAKEFILE)
|
||||
print_ep_logs (protobuf_src)
|
||||
endif ()
|
||||
exclude_if_included (protobuf_src)
|
||||
|
||||
if (NOT TARGET protobuf::libprotobuf)
|
||||
add_library (protobuf::libprotobuf STATIC IMPORTED GLOBAL)
|
||||
endif ()
|
||||
file (MAKE_DIRECTORY ${BINARY_DIR}/_installed_/include)
|
||||
set_target_properties (protobuf::libprotobuf PROPERTIES
|
||||
IMPORTED_LOCATION_DEBUG
|
||||
${BINARY_DIR}/_installed_/${CMAKE_INSTALL_LIBDIR}/${pbuf_lib_pre}protobuf_d${ep_lib_suffix}
|
||||
IMPORTED_LOCATION_RELEASE
|
||||
${BINARY_DIR}/_installed_/${CMAKE_INSTALL_LIBDIR}/${pbuf_lib_pre}protobuf${ep_lib_suffix}
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
${BINARY_DIR}/_installed_/include)
|
||||
add_dependencies (protobuf::libprotobuf protobuf_src)
|
||||
exclude_if_included (protobuf::libprotobuf)
|
||||
|
||||
if (NOT TARGET protobuf::libprotoc)
|
||||
add_library (protobuf::libprotoc STATIC IMPORTED GLOBAL)
|
||||
endif ()
|
||||
set_target_properties (protobuf::libprotoc PROPERTIES
|
||||
IMPORTED_LOCATION_DEBUG
|
||||
${BINARY_DIR}/_installed_/${CMAKE_INSTALL_LIBDIR}/${pbuf_lib_pre}protoc_d${ep_lib_suffix}
|
||||
IMPORTED_LOCATION_RELEASE
|
||||
${BINARY_DIR}/_installed_/${CMAKE_INSTALL_LIBDIR}/${pbuf_lib_pre}protoc${ep_lib_suffix}
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
${BINARY_DIR}/_installed_/include)
|
||||
add_dependencies (protobuf::libprotoc protobuf_src)
|
||||
exclude_if_included (protobuf::libprotoc)
|
||||
|
||||
if (NOT TARGET protobuf::protoc)
|
||||
add_executable (protobuf::protoc IMPORTED)
|
||||
exclude_if_included (protobuf::protoc)
|
||||
endif ()
|
||||
set_target_properties (protobuf::protoc PROPERTIES
|
||||
IMPORTED_LOCATION "${BINARY_DIR}/_installed_/bin/protoc${CMAKE_EXECUTABLE_SUFFIX}")
|
||||
add_dependencies (protobuf::protoc protobuf_src)
|
||||
else ()
|
||||
if (NOT TARGET protobuf::protoc)
|
||||
if (EXISTS "${Protobuf_PROTOC_EXECUTABLE}")
|
||||
add_executable (protobuf::protoc IMPORTED)
|
||||
set_target_properties (protobuf::protoc PROPERTIES
|
||||
IMPORTED_LOCATION "${Protobuf_PROTOC_EXECUTABLE}")
|
||||
else ()
|
||||
message (FATAL_ERROR "Protobuf import failed")
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
set(output_dir ${CMAKE_BINARY_DIR}/proto_gen)
|
||||
file(MAKE_DIRECTORY ${output_dir})
|
||||
set(ccbd ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set(CMAKE_CURRENT_BINARY_DIR ${output_dir})
|
||||
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS src/ripple/proto/ripple.proto)
|
||||
set(CMAKE_CURRENT_BINARY_DIR ${ccbd})
|
||||
|
||||
target_include_directories(xrpl.libpb SYSTEM PUBLIC
|
||||
# The generated implementation imports the header relative to the output
|
||||
# directory.
|
||||
$<BUILD_INTERFACE:${output_dir}>
|
||||
$<BUILD_INTERFACE:${output_dir}/src>
|
||||
)
|
||||
target_sources(xrpl.libpb PRIVATE ${output_dir}/src/ripple/proto/ripple.pb.cc)
|
||||
install(
|
||||
FILES ${output_dir}/src/ripple/proto/ripple.pb.h
|
||||
DESTINATION include/ripple/proto)
|
||||
target_link_libraries(xrpl.libpb PUBLIC protobuf::libprotobuf)
|
||||
target_compile_options(xrpl.libpb
|
||||
PUBLIC
|
||||
$<$<BOOL:${is_xcode}>:
|
||||
--system-header-prefix="google/protobuf"
|
||||
-Wno-deprecated-dynamic-exception-spec
|
||||
>
|
||||
)
|
||||
177
cmake/deps/Rocksdb.cmake
Normal file
177
cmake/deps/Rocksdb.cmake
Normal file
@@ -0,0 +1,177 @@
|
||||
#[===================================================================[
|
||||
NIH dep: rocksdb
|
||||
#]===================================================================]
|
||||
|
||||
add_library (rocksdb_lib UNKNOWN IMPORTED GLOBAL)
|
||||
set_target_properties (rocksdb_lib
|
||||
PROPERTIES INTERFACE_COMPILE_DEFINITIONS RIPPLE_ROCKSDB_AVAILABLE=1)
|
||||
|
||||
option (local_rocksdb "use local build of rocksdb." OFF)
|
||||
if (NOT local_rocksdb)
|
||||
find_package (RocksDB 6.27 QUIET CONFIG)
|
||||
if (TARGET RocksDB::rocksdb)
|
||||
message (STATUS "Found RocksDB using config.")
|
||||
get_target_property (_rockslib_l RocksDB::rocksdb IMPORTED_LOCATION_DEBUG)
|
||||
if (_rockslib_l)
|
||||
set_target_properties (rocksdb_lib PROPERTIES IMPORTED_LOCATION_DEBUG ${_rockslib_l})
|
||||
endif ()
|
||||
get_target_property (_rockslib_l RocksDB::rocksdb IMPORTED_LOCATION_RELEASE)
|
||||
if (_rockslib_l)
|
||||
set_target_properties (rocksdb_lib PROPERTIES IMPORTED_LOCATION_RELEASE ${_rockslib_l})
|
||||
endif ()
|
||||
get_target_property (_rockslib_l RocksDB::rocksdb IMPORTED_LOCATION)
|
||||
if (_rockslib_l)
|
||||
set_target_properties (rocksdb_lib PROPERTIES IMPORTED_LOCATION ${_rockslib_l})
|
||||
endif ()
|
||||
get_target_property (_rockslib_i RocksDB::rocksdb INTERFACE_INCLUDE_DIRECTORIES)
|
||||
if (_rockslib_i)
|
||||
set_target_properties (rocksdb_lib PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${_rockslib_i})
|
||||
endif ()
|
||||
target_link_libraries (ripple_libs INTERFACE RocksDB::rocksdb)
|
||||
else ()
|
||||
# using a find module with rocksdb is difficult because
|
||||
# you have no idea how it was configured (transitive dependencies).
|
||||
# the code below will generally find rocksdb using the module, but
|
||||
# will then result in linker errors for static linkage since the
|
||||
# transitive dependencies are unknown. force local build here for now, but leave the code as
|
||||
# a placeholder for future investigation.
|
||||
if (static)
|
||||
set (local_rocksdb ON CACHE BOOL "" FORCE)
|
||||
# TBD if there is some way to extract transitive deps..then:
|
||||
#set (RocksDB_USE_STATIC ON)
|
||||
else ()
|
||||
find_package (RocksDB 6.27 MODULE)
|
||||
if (ROCKSDB_FOUND)
|
||||
if (RocksDB_LIBRARY_DEBUG)
|
||||
set_target_properties (rocksdb_lib PROPERTIES IMPORTED_LOCATION_DEBUG ${RocksDB_LIBRARY_DEBUG})
|
||||
endif ()
|
||||
set_target_properties (rocksdb_lib PROPERTIES IMPORTED_LOCATION_RELEASE ${RocksDB_LIBRARIES})
|
||||
set_target_properties (rocksdb_lib PROPERTIES IMPORTED_LOCATION ${RocksDB_LIBRARIES})
|
||||
set_target_properties (rocksdb_lib PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${RocksDB_INCLUDE_DIRS})
|
||||
else ()
|
||||
set (local_rocksdb ON CACHE BOOL "" FORCE)
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (local_rocksdb)
|
||||
message (STATUS "Using local build of RocksDB.")
|
||||
ExternalProject_Add (rocksdb
|
||||
PREFIX ${nih_cache_path}
|
||||
GIT_REPOSITORY https://github.com/facebook/rocksdb.git
|
||||
GIT_TAG v6.27.3
|
||||
PATCH_COMMAND
|
||||
# only used by windows build
|
||||
${CMAKE_COMMAND} -E copy_if_different
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/rocks_thirdparty.inc
|
||||
<SOURCE_DIR>/thirdparty.inc
|
||||
COMMAND
|
||||
# fixup their build version file to keep the values
|
||||
# from changing always
|
||||
${CMAKE_COMMAND} -E copy_if_different
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/rocksdb_build_version.cc.in
|
||||
<SOURCE_DIR>/util/build_version.cc.in
|
||||
CMAKE_ARGS
|
||||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||
$<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:-DCMAKE_VERBOSE_MAKEFILE=ON>
|
||||
$<$<BOOL:${unity}>:-DCMAKE_UNITY_BUILD=ON}>
|
||||
-DCMAKE_DEBUG_POSTFIX=_d
|
||||
$<$<NOT:$<BOOL:${is_multiconfig}>>:-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}>
|
||||
-DBUILD_SHARED_LIBS=OFF
|
||||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||
-DWITH_JEMALLOC=$<IF:$<BOOL:${jemalloc}>,ON,OFF>
|
||||
-DWITH_SNAPPY=ON
|
||||
-DWITH_LZ4=ON
|
||||
-DWITH_ZLIB=OFF
|
||||
-DUSE_RTTI=ON
|
||||
-DWITH_ZSTD=OFF
|
||||
-DWITH_GFLAGS=OFF
|
||||
-DWITH_BZ2=OFF
|
||||
-ULZ4_*
|
||||
-Ulz4_*
|
||||
-Dlz4_INCLUDE_DIRS=$<JOIN:$<TARGET_PROPERTY:lz4_lib,INTERFACE_INCLUDE_DIRECTORIES>,::>
|
||||
-Dlz4_LIBRARIES=$<IF:$<CONFIG:Debug>,$<TARGET_PROPERTY:lz4_lib,IMPORTED_LOCATION_DEBUG>,$<TARGET_PROPERTY:lz4_lib,IMPORTED_LOCATION_RELEASE>>
|
||||
-Dlz4_FOUND=ON
|
||||
-USNAPPY_*
|
||||
-Usnappy_*
|
||||
-USnappy_*
|
||||
-Dsnappy_INCLUDE_DIRS=$<JOIN:$<TARGET_PROPERTY:snappy_lib,INTERFACE_INCLUDE_DIRECTORIES>,::>
|
||||
-Dsnappy_LIBRARIES=$<IF:$<CONFIG:Debug>,$<TARGET_PROPERTY:snappy_lib,IMPORTED_LOCATION_DEBUG>,$<TARGET_PROPERTY:snappy_lib,IMPORTED_LOCATION_RELEASE>>
|
||||
-Dsnappy_FOUND=ON
|
||||
-DSnappy_INCLUDE_DIRS=$<JOIN:$<TARGET_PROPERTY:snappy_lib,INTERFACE_INCLUDE_DIRECTORIES>,::>
|
||||
-DSnappy_LIBRARIES=$<IF:$<CONFIG:Debug>,$<TARGET_PROPERTY:snappy_lib,IMPORTED_LOCATION_DEBUG>,$<TARGET_PROPERTY:snappy_lib,IMPORTED_LOCATION_RELEASE>>
|
||||
-DSnappy_FOUND=ON
|
||||
-DWITH_MD_LIBRARY=OFF
|
||||
-DWITH_RUNTIME_DEBUG=$<IF:$<CONFIG:Debug>,ON,OFF>
|
||||
-DFAIL_ON_WARNINGS=OFF
|
||||
-DWITH_ASAN=OFF
|
||||
-DWITH_TSAN=OFF
|
||||
-DWITH_UBSAN=OFF
|
||||
-DWITH_NUMA=OFF
|
||||
-DWITH_TBB=OFF
|
||||
-DWITH_WINDOWS_UTF8_FILENAMES=OFF
|
||||
-DWITH_XPRESS=OFF
|
||||
-DPORTABLE=ON
|
||||
-DFORCE_SSE42=OFF
|
||||
-DDISABLE_STALL_NOTIF=OFF
|
||||
-DOPTDBG=ON
|
||||
-DROCKSDB_LITE=OFF
|
||||
-DWITH_FALLOCATE=ON
|
||||
-DWITH_LIBRADOS=OFF
|
||||
-DWITH_JNI=OFF
|
||||
-DROCKSDB_INSTALL_ON_WINDOWS=OFF
|
||||
-DWITH_TESTS=OFF
|
||||
-DWITH_TOOLS=OFF
|
||||
$<$<BOOL:${MSVC}>:
|
||||
"-DCMAKE_CXX_FLAGS=-GR -Gd -fp:precise -FS -MP /DNDEBUG"
|
||||
>
|
||||
$<$<NOT:$<BOOL:${MSVC}>>:
|
||||
"-DCMAKE_CXX_FLAGS=-DNDEBUG"
|
||||
>
|
||||
LOG_BUILD ON
|
||||
LOG_CONFIGURE ON
|
||||
BUILD_COMMAND
|
||||
${CMAKE_COMMAND}
|
||||
--build .
|
||||
--config $<CONFIG>
|
||||
--parallel ${ep_procs}
|
||||
$<$<BOOL:${is_multiconfig}>:
|
||||
COMMAND
|
||||
${CMAKE_COMMAND} -E copy
|
||||
<BINARY_DIR>/$<CONFIG>/${ep_lib_prefix}rocksdb$<$<CONFIG:Debug>:_d>${ep_lib_suffix}
|
||||
<BINARY_DIR>
|
||||
>
|
||||
LIST_SEPARATOR ::
|
||||
TEST_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
DEPENDS snappy_lib lz4_lib
|
||||
BUILD_BYPRODUCTS
|
||||
<BINARY_DIR>/${ep_lib_prefix}rocksdb${ep_lib_suffix}
|
||||
<BINARY_DIR>/${ep_lib_prefix}rocksdb_d${ep_lib_suffix}
|
||||
)
|
||||
ExternalProject_Get_Property (rocksdb BINARY_DIR)
|
||||
ExternalProject_Get_Property (rocksdb SOURCE_DIR)
|
||||
if (CMAKE_VERBOSE_MAKEFILE)
|
||||
print_ep_logs (rocksdb)
|
||||
endif ()
|
||||
file (MAKE_DIRECTORY ${SOURCE_DIR}/include)
|
||||
set_target_properties (rocksdb_lib PROPERTIES
|
||||
IMPORTED_LOCATION_DEBUG
|
||||
${BINARY_DIR}/${ep_lib_prefix}rocksdb_d${ep_lib_suffix}
|
||||
IMPORTED_LOCATION_RELEASE
|
||||
${BINARY_DIR}/${ep_lib_prefix}rocksdb${ep_lib_suffix}
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
${SOURCE_DIR}/include)
|
||||
add_dependencies (rocksdb_lib rocksdb)
|
||||
exclude_if_included (rocksdb)
|
||||
endif ()
|
||||
|
||||
target_link_libraries (rocksdb_lib
|
||||
INTERFACE
|
||||
snappy_lib
|
||||
lz4_lib
|
||||
$<$<BOOL:${MSVC}>:rpcrt4>)
|
||||
exclude_if_included (rocksdb_lib)
|
||||
target_link_libraries (ripple_libs INTERFACE rocksdb_lib)
|
||||
58
cmake/deps/Secp256k1.cmake
Normal file
58
cmake/deps/Secp256k1.cmake
Normal file
@@ -0,0 +1,58 @@
|
||||
#[===================================================================[
|
||||
NIH dep: secp256k1
|
||||
#]===================================================================]
|
||||
|
||||
add_library (secp256k1_lib STATIC IMPORTED GLOBAL)
|
||||
|
||||
if (NOT WIN32)
|
||||
find_package(secp256k1)
|
||||
endif()
|
||||
|
||||
if(secp256k1)
|
||||
set_target_properties (secp256k1_lib PROPERTIES
|
||||
IMPORTED_LOCATION_DEBUG
|
||||
${secp256k1}
|
||||
IMPORTED_LOCATION_RELEASE
|
||||
${secp256k1}
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
${SECP256K1_INCLUDE_DIR})
|
||||
|
||||
add_library (secp256k1 ALIAS secp256k1_lib)
|
||||
add_library (NIH::secp256k1 ALIAS secp256k1_lib)
|
||||
|
||||
else()
|
||||
set(INSTALL_SECP256K1 true)
|
||||
|
||||
add_library (secp256k1 STATIC
|
||||
external/secp256k1/src/secp256k1.c)
|
||||
target_compile_definitions (secp256k1
|
||||
PRIVATE
|
||||
USE_NUM_NONE
|
||||
USE_FIELD_10X26
|
||||
USE_FIELD_INV_BUILTIN
|
||||
USE_SCALAR_8X32
|
||||
USE_SCALAR_INV_BUILTIN)
|
||||
target_include_directories (secp256k1
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/external>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/external/secp256k1)
|
||||
target_compile_options (secp256k1
|
||||
PRIVATE
|
||||
$<$<BOOL:${MSVC}>:-wd4319>
|
||||
$<$<NOT:$<BOOL:${MSVC}>>:
|
||||
-Wno-deprecated-declarations
|
||||
-Wno-unused-function
|
||||
>
|
||||
$<$<BOOL:${is_gcc}>:-Wno-nonnull-compare>)
|
||||
target_link_libraries (ripple_libs INTERFACE NIH::secp256k1)
|
||||
#[===========================[
|
||||
headers installation
|
||||
#]===========================]
|
||||
install (
|
||||
FILES
|
||||
external/secp256k1/include/secp256k1.h
|
||||
DESTINATION include/secp256k1/include)
|
||||
|
||||
add_library (NIH::secp256k1 ALIAS secp256k1)
|
||||
endif()
|
||||
77
cmake/deps/Snappy.cmake
Normal file
77
cmake/deps/Snappy.cmake
Normal file
@@ -0,0 +1,77 @@
|
||||
#[===================================================================[
|
||||
NIH dep: snappy
|
||||
#]===================================================================]
|
||||
|
||||
add_library (snappy_lib STATIC IMPORTED GLOBAL)
|
||||
|
||||
if (NOT WIN32)
|
||||
find_package(snappy)
|
||||
endif()
|
||||
|
||||
if(snappy)
|
||||
set_target_properties (snappy_lib PROPERTIES
|
||||
IMPORTED_LOCATION_DEBUG
|
||||
${snappy}
|
||||
IMPORTED_LOCATION_RELEASE
|
||||
${snappy}
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
${SNAPPY_INCLUDE_DIR})
|
||||
|
||||
else()
|
||||
ExternalProject_Add (snappy
|
||||
PREFIX ${nih_cache_path}
|
||||
GIT_REPOSITORY https://github.com/google/snappy.git
|
||||
GIT_TAG 1.1.7
|
||||
CMAKE_ARGS
|
||||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||
$<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:-DCMAKE_VERBOSE_MAKEFILE=ON>
|
||||
-DCMAKE_DEBUG_POSTFIX=_d
|
||||
$<$<NOT:$<BOOL:${is_multiconfig}>>:-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}>
|
||||
-DBUILD_SHARED_LIBS=OFF
|
||||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||
-DSNAPPY_BUILD_TESTS=OFF
|
||||
$<$<BOOL:${MSVC}>:
|
||||
"-DCMAKE_CXX_FLAGS=-GR -Gd -fp:precise -FS -EHa -MP"
|
||||
"-DCMAKE_CXX_FLAGS_DEBUG=-MTd"
|
||||
"-DCMAKE_CXX_FLAGS_RELEASE=-MT"
|
||||
>
|
||||
LOG_BUILD ON
|
||||
LOG_CONFIGURE ON
|
||||
BUILD_COMMAND
|
||||
${CMAKE_COMMAND}
|
||||
--build .
|
||||
--config $<CONFIG>
|
||||
--parallel ${ep_procs}
|
||||
$<$<BOOL:${is_multiconfig}>:
|
||||
COMMAND
|
||||
${CMAKE_COMMAND} -E copy
|
||||
<BINARY_DIR>/$<CONFIG>/${ep_lib_prefix}snappy$<$<CONFIG:Debug>:_d>${ep_lib_suffix}
|
||||
<BINARY_DIR>
|
||||
>
|
||||
TEST_COMMAND ""
|
||||
INSTALL_COMMAND
|
||||
${CMAKE_COMMAND} -E copy_if_different <BINARY_DIR>/config.h <BINARY_DIR>/snappy-stubs-public.h <SOURCE_DIR>
|
||||
BUILD_BYPRODUCTS
|
||||
<BINARY_DIR>/${ep_lib_prefix}snappy${ep_lib_suffix}
|
||||
<BINARY_DIR>/${ep_lib_prefix}snappy_d${ep_lib_suffix}
|
||||
)
|
||||
ExternalProject_Get_Property (snappy BINARY_DIR)
|
||||
ExternalProject_Get_Property (snappy SOURCE_DIR)
|
||||
if (CMAKE_VERBOSE_MAKEFILE)
|
||||
print_ep_logs (snappy)
|
||||
endif ()
|
||||
file (MAKE_DIRECTORY ${SOURCE_DIR}/snappy)
|
||||
set_target_properties (snappy_lib PROPERTIES
|
||||
IMPORTED_LOCATION_DEBUG
|
||||
${BINARY_DIR}/${ep_lib_prefix}snappy_d${ep_lib_suffix}
|
||||
IMPORTED_LOCATION_RELEASE
|
||||
${BINARY_DIR}/${ep_lib_prefix}snappy${ep_lib_suffix}
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
${SOURCE_DIR})
|
||||
endif()
|
||||
|
||||
add_dependencies (snappy_lib snappy)
|
||||
target_link_libraries (ripple_libs INTERFACE snappy_lib)
|
||||
exclude_if_included (snappy)
|
||||
exclude_if_included (snappy_lib)
|
||||
165
cmake/deps/Soci.cmake
Normal file
165
cmake/deps/Soci.cmake
Normal file
@@ -0,0 +1,165 @@
|
||||
#[===================================================================[
|
||||
NIH dep: soci
|
||||
#]===================================================================]
|
||||
|
||||
foreach (_comp core empty sqlite3)
|
||||
add_library ("soci_${_comp}" STATIC IMPORTED GLOBAL)
|
||||
endforeach ()
|
||||
|
||||
if (NOT WIN32)
|
||||
find_package(soci)
|
||||
endif()
|
||||
|
||||
if (soci)
|
||||
foreach (_comp core empty sqlite3)
|
||||
set_target_properties ("soci_${_comp}" PROPERTIES
|
||||
IMPORTED_LOCATION_DEBUG
|
||||
${soci}
|
||||
IMPORTED_LOCATION_RELEASE
|
||||
${soci}
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
${SOCI_INCLUDE_DIR})
|
||||
endforeach ()
|
||||
|
||||
else()
|
||||
set (soci_lib_pre ${ep_lib_prefix})
|
||||
set (soci_lib_post "")
|
||||
if (WIN32)
|
||||
# for some reason soci on windows still prepends lib (non-standard)
|
||||
set (soci_lib_pre lib)
|
||||
# this version in the name might change if/when we change versions of soci
|
||||
set (soci_lib_post "_4_0")
|
||||
endif ()
|
||||
get_target_property (_boost_incs Boost::date_time INTERFACE_INCLUDE_DIRECTORIES)
|
||||
get_target_property (_boost_dt Boost::date_time IMPORTED_LOCATION)
|
||||
if (NOT _boost_dt)
|
||||
get_target_property (_boost_dt Boost::date_time IMPORTED_LOCATION_RELEASE)
|
||||
endif ()
|
||||
if (NOT _boost_dt)
|
||||
get_target_property (_boost_dt Boost::date_time IMPORTED_LOCATION_DEBUG)
|
||||
endif ()
|
||||
|
||||
ExternalProject_Add (soci
|
||||
PREFIX ${nih_cache_path}
|
||||
GIT_REPOSITORY https://github.com/SOCI/soci.git
|
||||
GIT_TAG 04e1870294918d20761736743bb6136314c42dd5
|
||||
# We had an issue with soci integer range checking for boost::optional
|
||||
# and needed to remove the exception that SOCI throws in this case.
|
||||
# This is *probably* a bug in SOCI, but has never been investigated more
|
||||
# nor reported to the maintainers.
|
||||
# This cmake script comments out the lines in question.
|
||||
# This patch process is likely fragile and should be reviewed carefully
|
||||
# whenever we update the GIT_TAG above.
|
||||
PATCH_COMMAND
|
||||
${CMAKE_COMMAND} -D RIPPLED_SOURCE=${CMAKE_CURRENT_SOURCE_DIR}
|
||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/soci_patch.cmake
|
||||
CMAKE_ARGS
|
||||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||
$<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:-DCMAKE_VERBOSE_MAKEFILE=ON>
|
||||
$<$<BOOL:${CMAKE_TOOLCHAIN_FILE}>:-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}>
|
||||
$<$<BOOL:${VCPKG_TARGET_TRIPLET}>:-DVCPKG_TARGET_TRIPLET=${VCPKG_TARGET_TRIPLET}>
|
||||
$<$<BOOL:${unity}>:-DCMAKE_UNITY_BUILD=ON}>
|
||||
-DCMAKE_PREFIX_PATH=${CMAKE_BINARY_DIR}/sqlite3
|
||||
-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR}/cmake
|
||||
-DCMAKE_INCLUDE_PATH=$<JOIN:$<TARGET_PROPERTY:sqlite,INTERFACE_INCLUDE_DIRECTORIES>,::>
|
||||
-DCMAKE_LIBRARY_PATH=${sqlite_BINARY_DIR}
|
||||
-DCMAKE_DEBUG_POSTFIX=_d
|
||||
$<$<NOT:$<BOOL:${is_multiconfig}>>:-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}>
|
||||
-DSOCI_CXX_C11=ON
|
||||
-DSOCI_STATIC=ON
|
||||
-DSOCI_LIBDIR=lib
|
||||
-DSOCI_SHARED=OFF
|
||||
-DSOCI_TESTS=OFF
|
||||
# hacks to workaround the fact that soci doesn't currently use
|
||||
# boost imported targets in its cmake. If they switch to
|
||||
# proper imported targets, this next line can be removed
|
||||
# (as well as the get_property above that sets _boost_incs)
|
||||
-DBoost_INCLUDE_DIRS=$<JOIN:${_boost_incs},::>
|
||||
-DBoost_INCLUDE_DIR=$<JOIN:${_boost_incs},::>
|
||||
-DBOOST_ROOT=${BOOST_ROOT}
|
||||
-DWITH_BOOST=ON
|
||||
-DBoost_FOUND=ON
|
||||
-DBoost_NO_BOOST_CMAKE=ON
|
||||
-DBoost_DATE_TIME_FOUND=ON
|
||||
-DSOCI_HAVE_BOOST=ON
|
||||
-DSOCI_HAVE_BOOST_DATE_TIME=ON
|
||||
-DBoost_DATE_TIME_LIBRARY=${_boost_dt}
|
||||
-DSOCI_DB2=OFF
|
||||
-DSOCI_FIREBIRD=OFF
|
||||
-DSOCI_MYSQL=OFF
|
||||
-DSOCI_ODBC=OFF
|
||||
-DSOCI_ORACLE=OFF
|
||||
-DSOCI_POSTGRESQL=OFF
|
||||
-DSOCI_SQLITE3=ON
|
||||
-DSQLITE3_INCLUDE_DIR=$<JOIN:$<TARGET_PROPERTY:sqlite,INTERFACE_INCLUDE_DIRECTORIES>,::>
|
||||
-DSQLITE3_LIBRARY=$<IF:$<CONFIG:Debug>,$<TARGET_PROPERTY:sqlite,IMPORTED_LOCATION_DEBUG>,$<TARGET_PROPERTY:sqlite,IMPORTED_LOCATION_RELEASE>>
|
||||
$<$<BOOL:${APPLE}>:-DCMAKE_FIND_FRAMEWORK=LAST>
|
||||
$<$<BOOL:${MSVC}>:
|
||||
"-DCMAKE_CXX_FLAGS=-GR -Gd -fp:precise -FS -EHa -MP"
|
||||
"-DCMAKE_CXX_FLAGS_DEBUG=-MTd"
|
||||
"-DCMAKE_CXX_FLAGS_RELEASE=-MT"
|
||||
>
|
||||
$<$<NOT:$<BOOL:${MSVC}>>:
|
||||
"-DCMAKE_CXX_FLAGS=-Wno-deprecated-declarations"
|
||||
>
|
||||
# SEE: https://github.com/SOCI/soci/issues/640
|
||||
$<$<AND:$<BOOL:${is_gcc}>,$<VERSION_GREATER_EQUAL:${CMAKE_CXX_COMPILER_VERSION},8>>:
|
||||
"-DCMAKE_CXX_FLAGS=-Wno-deprecated-declarations -Wno-error=format-overflow -Wno-format-overflow -Wno-error=format-truncation"
|
||||
>
|
||||
LIST_SEPARATOR ::
|
||||
LOG_BUILD ON
|
||||
LOG_CONFIGURE ON
|
||||
BUILD_COMMAND
|
||||
${CMAKE_COMMAND}
|
||||
--build .
|
||||
--config $<CONFIG>
|
||||
--parallel ${ep_procs}
|
||||
$<$<BOOL:${is_multiconfig}>:
|
||||
COMMAND
|
||||
${CMAKE_COMMAND} -E copy
|
||||
<BINARY_DIR>/lib/$<CONFIG>/${soci_lib_pre}soci_core${soci_lib_post}$<$<CONFIG:Debug>:_d>${ep_lib_suffix}
|
||||
<BINARY_DIR>/lib/$<CONFIG>/${soci_lib_pre}soci_empty${soci_lib_post}$<$<CONFIG:Debug>:_d>${ep_lib_suffix}
|
||||
<BINARY_DIR>/lib/$<CONFIG>/${soci_lib_pre}soci_sqlite3${soci_lib_post}$<$<CONFIG:Debug>:_d>${ep_lib_suffix}
|
||||
<BINARY_DIR>/lib
|
||||
>
|
||||
TEST_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
DEPENDS sqlite
|
||||
BUILD_BYPRODUCTS
|
||||
<BINARY_DIR>/lib/${soci_lib_pre}soci_core${soci_lib_post}${ep_lib_suffix}
|
||||
<BINARY_DIR>/lib/${soci_lib_pre}soci_core${soci_lib_post}_d${ep_lib_suffix}
|
||||
<BINARY_DIR>/lib/${soci_lib_pre}soci_empty${soci_lib_post}${ep_lib_suffix}
|
||||
<BINARY_DIR>/lib/${soci_lib_pre}soci_empty${soci_lib_post}_d${ep_lib_suffix}
|
||||
<BINARY_DIR>/lib/${soci_lib_pre}soci_sqlite3${soci_lib_post}${ep_lib_suffix}
|
||||
<BINARY_DIR>/lib/${soci_lib_pre}soci_sqlite3${soci_lib_post}_d${ep_lib_suffix}
|
||||
)
|
||||
ExternalProject_Get_Property (soci BINARY_DIR)
|
||||
ExternalProject_Get_Property (soci SOURCE_DIR)
|
||||
if (CMAKE_VERBOSE_MAKEFILE)
|
||||
print_ep_logs (soci)
|
||||
endif ()
|
||||
file (MAKE_DIRECTORY ${SOURCE_DIR}/include)
|
||||
file (MAKE_DIRECTORY ${BINARY_DIR}/include)
|
||||
foreach (_comp core empty sqlite3)
|
||||
set_target_properties ("soci_${_comp}" PROPERTIES
|
||||
IMPORTED_LOCATION_DEBUG
|
||||
${BINARY_DIR}/lib/${soci_lib_pre}soci_${_comp}${soci_lib_post}_d${ep_lib_suffix}
|
||||
IMPORTED_LOCATION_RELEASE
|
||||
${BINARY_DIR}/lib/${soci_lib_pre}soci_${_comp}${soci_lib_post}${ep_lib_suffix}
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
"${SOURCE_DIR}/include;${BINARY_DIR}/include")
|
||||
add_dependencies ("soci_${_comp}" soci) # something has to depend on the ExternalProject to trigger it
|
||||
target_link_libraries (ripple_libs INTERFACE "soci_${_comp}")
|
||||
if (NOT _comp STREQUAL "core")
|
||||
target_link_libraries ("soci_${_comp}" INTERFACE soci_core)
|
||||
endif ()
|
||||
endforeach ()
|
||||
endif()
|
||||
|
||||
foreach (_comp core empty sqlite3)
|
||||
exclude_if_included ("soci_${_comp}")
|
||||
endforeach ()
|
||||
|
||||
|
||||
exclude_if_included (soci)
|
||||
93
cmake/deps/Sqlite.cmake
Normal file
93
cmake/deps/Sqlite.cmake
Normal file
@@ -0,0 +1,93 @@
|
||||
#[===================================================================[
|
||||
NIH dep: sqlite
|
||||
#]===================================================================]
|
||||
|
||||
add_library (sqlite STATIC IMPORTED GLOBAL)
|
||||
|
||||
if (NOT WIN32)
|
||||
find_package(sqlite)
|
||||
endif()
|
||||
|
||||
|
||||
if(sqlite3)
|
||||
set_target_properties (sqlite PROPERTIES
|
||||
IMPORTED_LOCATION_DEBUG
|
||||
${sqlite3}
|
||||
IMPORTED_LOCATION_RELEASE
|
||||
${sqlite3}
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
${SQLITE_INCLUDE_DIR})
|
||||
|
||||
else()
|
||||
ExternalProject_Add (sqlite3
|
||||
PREFIX ${nih_cache_path}
|
||||
# sqlite doesn't use git, but it provides versioned tarballs
|
||||
URL https://www.sqlite.org/2018/sqlite-amalgamation-3260000.zip
|
||||
http://www.sqlite.org/2018/sqlite-amalgamation-3260000.zip
|
||||
https://www2.sqlite.org/2018/sqlite-amalgamation-3260000.zip
|
||||
http://www2.sqlite.org/2018/sqlite-amalgamation-3260000.zip
|
||||
# ^^^ version is apparent in the URL: 3260000 => 3.26.0
|
||||
URL_HASH SHA256=de5dcab133aa339a4cf9e97c40aa6062570086d6085d8f9ad7bc6ddf8a52096e
|
||||
# Don't need to worry about MITM attacks too much because the download
|
||||
# is checked against a strong hash
|
||||
TLS_VERIFY false
|
||||
# we wrote a very simple CMake file to build sqlite
|
||||
# so that's what we copy here so that we can build with
|
||||
# CMake. sqlite doesn't generally provided a build system
|
||||
# for the single amalgamation source file.
|
||||
PATCH_COMMAND
|
||||
${CMAKE_COMMAND} -E copy_if_different
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/CMake_sqlite3.txt
|
||||
<SOURCE_DIR>/CMakeLists.txt
|
||||
CMAKE_ARGS
|
||||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||
$<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:-DCMAKE_VERBOSE_MAKEFILE=ON>
|
||||
-DCMAKE_DEBUG_POSTFIX=_d
|
||||
$<$<NOT:$<BOOL:${is_multiconfig}>>:-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}>
|
||||
$<$<BOOL:${MSVC}>:
|
||||
"-DCMAKE_C_FLAGS=-GR -Gd -fp:precise -FS -MP"
|
||||
"-DCMAKE_C_FLAGS_DEBUG=-MTd"
|
||||
"-DCMAKE_C_FLAGS_RELEASE=-MT"
|
||||
>
|
||||
LOG_BUILD ON
|
||||
LOG_CONFIGURE ON
|
||||
BUILD_COMMAND
|
||||
${CMAKE_COMMAND}
|
||||
--build .
|
||||
--config $<CONFIG>
|
||||
--parallel ${ep_procs}
|
||||
$<$<BOOL:${is_multiconfig}>:
|
||||
COMMAND
|
||||
${CMAKE_COMMAND} -E copy
|
||||
<BINARY_DIR>/$<CONFIG>/${ep_lib_prefix}sqlite3$<$<CONFIG:Debug>:_d>${ep_lib_suffix}
|
||||
<BINARY_DIR>
|
||||
>
|
||||
TEST_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
BUILD_BYPRODUCTS
|
||||
<BINARY_DIR>/${ep_lib_prefix}sqlite3${ep_lib_suffix}
|
||||
<BINARY_DIR>/${ep_lib_prefix}sqlite3_d${ep_lib_suffix}
|
||||
)
|
||||
ExternalProject_Get_Property (sqlite3 BINARY_DIR)
|
||||
ExternalProject_Get_Property (sqlite3 SOURCE_DIR)
|
||||
if (CMAKE_VERBOSE_MAKEFILE)
|
||||
print_ep_logs (sqlite3)
|
||||
endif ()
|
||||
|
||||
set_target_properties (sqlite PROPERTIES
|
||||
IMPORTED_LOCATION_DEBUG
|
||||
${BINARY_DIR}/${ep_lib_prefix}sqlite3_d${ep_lib_suffix}
|
||||
IMPORTED_LOCATION_RELEASE
|
||||
${BINARY_DIR}/${ep_lib_prefix}sqlite3${ep_lib_suffix}
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
${SOURCE_DIR})
|
||||
|
||||
add_dependencies (sqlite sqlite3)
|
||||
exclude_if_included (sqlite3)
|
||||
endif()
|
||||
|
||||
target_link_libraries (sqlite INTERFACE $<$<NOT:$<BOOL:${MSVC}>>:dl>)
|
||||
target_link_libraries (ripple_libs INTERFACE sqlite)
|
||||
exclude_if_included (sqlite)
|
||||
set(sqlite_BINARY_DIR ${BINARY_DIR})
|
||||
@@ -1 +1,84 @@
|
||||
find_package(wasmedge REQUIRED)
|
||||
#[===================================================================[
|
||||
NIH dep: wasmedge: web assembly runtime for hooks.
|
||||
#]===================================================================]
|
||||
|
||||
find_package(Curses)
|
||||
if(CURSES_FOUND)
|
||||
include_directories(${CURSES_INCLUDE_DIR})
|
||||
target_link_libraries(ripple_libs INTERFACE ${CURSES_LIBRARY})
|
||||
else()
|
||||
message(WARNING "CURSES library not found... (only important for mac builds)")
|
||||
endif()
|
||||
|
||||
|
||||
find_package(LLVM REQUIRED CONFIG)
|
||||
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
|
||||
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
|
||||
ExternalProject_Add (wasmedge_src
|
||||
PREFIX ${nih_cache_path}
|
||||
GIT_REPOSITORY https://github.com/WasmEdge/WasmEdge.git
|
||||
GIT_TAG 0.11.2
|
||||
CMAKE_ARGS
|
||||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||
$<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:-DCMAKE_VERBOSE_MAKEFILE=ON>
|
||||
-DCMAKE_DEBUG_POSTFIX=_d
|
||||
-DWASMEDGE_BUILD_SHARED_LIB=OFF
|
||||
-DWASMEDGE_BUILD_STATIC_LIB=ON
|
||||
-DWASMEDGE_BUILD_AOT_RUNTIME=ON
|
||||
-DWASMEDGE_FORCE_DISABLE_LTO=ON
|
||||
-DWASMEDGE_LINK_LLVM_STATIC=ON
|
||||
-DWASMEDGE_LINK_TOOLS_STATIC=ON
|
||||
-DWASMEDGE_BUILD_PLUGINS=OFF
|
||||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||
-DLLVM_DIR=${LLVM_DIR}
|
||||
-DLLVM_LIBRARY_DIR=${LLVM_LIBRARY_DIR}
|
||||
-DLLVM_ENABLE_TERMINFO=OFF
|
||||
$<$<NOT:$<BOOL:${is_multiconfig}>>:-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}>
|
||||
$<$<BOOL:${MSVC}>:
|
||||
"-DCMAKE_C_FLAGS=-GR -Gd -fp:precise -FS -MP -march=native"
|
||||
"-DCMAKE_C_FLAGS_DEBUG=-MTd"
|
||||
"-DCMAKE_C_FLAGS_RELEASE=-MT"
|
||||
>
|
||||
LOG_CONFIGURE ON
|
||||
LOG_BUILD ON
|
||||
LOG_CONFIGURE ON
|
||||
COMMAND
|
||||
pwd
|
||||
BUILD_COMMAND
|
||||
${CMAKE_COMMAND}
|
||||
--build .
|
||||
--config $<CONFIG>
|
||||
$<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.12>:--parallel ${ep_procs}>
|
||||
TEST_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
BUILD_BYPRODUCTS
|
||||
<BINARY_DIR>/lib/api/libwasmedge.a
|
||||
)
|
||||
add_library (wasmedge STATIC IMPORTED GLOBAL)
|
||||
ExternalProject_Get_Property (wasmedge_src BINARY_DIR)
|
||||
ExternalProject_Get_Property (wasmedge_src SOURCE_DIR)
|
||||
set (wasmedge_src_BINARY_DIR "${BINARY_DIR}")
|
||||
add_dependencies (wasmedge wasmedge_src)
|
||||
execute_process(
|
||||
COMMAND
|
||||
mkdir -p "${wasmedge_src_BINARY_DIR}/include/api"
|
||||
)
|
||||
set_target_properties (wasmedge PROPERTIES
|
||||
IMPORTED_LOCATION_DEBUG
|
||||
"${wasmedge_src_BINARY_DIR}/lib/api/libwasmedge.a"
|
||||
IMPORTED_LOCATION_RELEASE
|
||||
"${wasmedge_src_BINARY_DIR}/lib/api/libwasmedge.a"
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
"${wasmedge_src_BINARY_DIR}/include/api/"
|
||||
)
|
||||
target_link_libraries (ripple_libs INTERFACE wasmedge)
|
||||
#RH NOTE: some compilers / versions of some libraries need these, most don't
|
||||
|
||||
find_library(XAR_LIBRARY NAMES xar)
|
||||
if(XAR_LIBRARY)
|
||||
target_link_libraries(ripple_libs INTERFACE ${XAR_LIBRARY})
|
||||
else()
|
||||
message(WARNING "xar library not found... (only important for mac builds)")
|
||||
endif()
|
||||
add_library (wasmedge::wasmedge ALIAS wasmedge)
|
||||
|
||||
167
cmake/deps/cassandra.cmake
Normal file
167
cmake/deps/cassandra.cmake
Normal file
@@ -0,0 +1,167 @@
|
||||
if(reporting)
|
||||
find_library(cassandra NAMES cassandra)
|
||||
if(NOT cassandra)
|
||||
|
||||
message("System installed Cassandra cpp driver not found. Will build")
|
||||
|
||||
find_library(zlib NAMES zlib1g-dev zlib-devel zlib z)
|
||||
if(NOT zlib)
|
||||
message("zlib not found. will build")
|
||||
add_library(zlib STATIC IMPORTED GLOBAL)
|
||||
ExternalProject_Add(zlib_src
|
||||
PREFIX ${nih_cache_path}
|
||||
GIT_REPOSITORY https://github.com/madler/zlib.git
|
||||
GIT_TAG v1.2.12
|
||||
INSTALL_COMMAND ""
|
||||
BUILD_BYPRODUCTS <BINARY_DIR>/${ep_lib_prefix}z.a
|
||||
LOG_BUILD TRUE
|
||||
LOG_CONFIGURE TRUE
|
||||
)
|
||||
|
||||
|
||||
ExternalProject_Get_Property (zlib_src SOURCE_DIR)
|
||||
ExternalProject_Get_Property (zlib_src BINARY_DIR)
|
||||
set (zlib_src_SOURCE_DIR "${SOURCE_DIR}")
|
||||
file (MAKE_DIRECTORY ${zlib_src_SOURCE_DIR}/include)
|
||||
|
||||
set_target_properties (zlib PROPERTIES
|
||||
IMPORTED_LOCATION
|
||||
${BINARY_DIR}/${ep_lib_prefix}z.a
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
${SOURCE_DIR}/include)
|
||||
add_dependencies(zlib zlib_src)
|
||||
|
||||
file(TO_CMAKE_PATH "${zlib_src_SOURCE_DIR}" zlib_src_SOURCE_DIR)
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
|
||||
find_library(krb5 NAMES krb5-dev libkrb5-dev)
|
||||
|
||||
if(NOT krb5)
|
||||
message("krb5 not found. will build")
|
||||
add_library(krb5 STATIC IMPORTED GLOBAL)
|
||||
ExternalProject_Add(krb5_src
|
||||
PREFIX ${nih_cache_path}
|
||||
GIT_REPOSITORY https://github.com/krb5/krb5.git
|
||||
GIT_TAG krb5-1.20-final
|
||||
UPDATE_COMMAND ""
|
||||
CONFIGURE_COMMAND autoreconf src && CFLAGS=-fcommon ./src/configure --enable-static --disable-shared > /dev/null
|
||||
BUILD_IN_SOURCE 1
|
||||
BUILD_COMMAND make
|
||||
INSTALL_COMMAND ""
|
||||
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/${ep_lib_prefix}krb5.a
|
||||
LOG_BUILD TRUE
|
||||
)
|
||||
|
||||
ExternalProject_Get_Property (krb5_src SOURCE_DIR)
|
||||
ExternalProject_Get_Property (krb5_src BINARY_DIR)
|
||||
set (krb5_src_SOURCE_DIR "${SOURCE_DIR}")
|
||||
file (MAKE_DIRECTORY ${krb5_src_SOURCE_DIR}/include)
|
||||
|
||||
set_target_properties (krb5 PROPERTIES
|
||||
IMPORTED_LOCATION
|
||||
${BINARY_DIR}/lib/${ep_lib_prefix}krb5.a
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
${SOURCE_DIR}/include)
|
||||
add_dependencies(krb5 krb5_src)
|
||||
|
||||
file(TO_CMAKE_PATH "${krb5_src_SOURCE_DIR}" krb5_src_SOURCE_DIR)
|
||||
endif()
|
||||
|
||||
|
||||
find_library(libuv1 NAMES uv1 libuv1 liubuv1-dev libuv1:amd64)
|
||||
|
||||
|
||||
if(NOT libuv1)
|
||||
message("libuv1 not found, will build")
|
||||
add_library(libuv1 STATIC IMPORTED GLOBAL)
|
||||
ExternalProject_Add(libuv_src
|
||||
PREFIX ${nih_cache_path}
|
||||
GIT_REPOSITORY https://github.com/libuv/libuv.git
|
||||
GIT_TAG v1.44.2
|
||||
INSTALL_COMMAND ""
|
||||
BUILD_BYPRODUCTS <BINARY_DIR>/${ep_lib_prefix}uv_a.a
|
||||
LOG_BUILD TRUE
|
||||
LOG_CONFIGURE TRUE
|
||||
)
|
||||
|
||||
ExternalProject_Get_Property (libuv_src SOURCE_DIR)
|
||||
ExternalProject_Get_Property (libuv_src BINARY_DIR)
|
||||
set (libuv_src_SOURCE_DIR "${SOURCE_DIR}")
|
||||
file (MAKE_DIRECTORY ${libuv_src_SOURCE_DIR}/include)
|
||||
|
||||
set_target_properties (libuv1 PROPERTIES
|
||||
IMPORTED_LOCATION
|
||||
${BINARY_DIR}/${ep_lib_prefix}uv_a.a
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
${SOURCE_DIR}/include)
|
||||
add_dependencies(libuv1 libuv_src)
|
||||
|
||||
file(TO_CMAKE_PATH "${libuv_src_SOURCE_DIR}" libuv_src_SOURCE_DIR)
|
||||
endif()
|
||||
|
||||
add_library (cassandra STATIC IMPORTED GLOBAL)
|
||||
ExternalProject_Add(cassandra_src
|
||||
PREFIX ${nih_cache_path}
|
||||
GIT_REPOSITORY https://github.com/datastax/cpp-driver.git
|
||||
GIT_TAG 2.16.2
|
||||
CMAKE_ARGS
|
||||
-DLIBUV_ROOT_DIR=${BINARY_DIR}
|
||||
-DLIBUV_LIBARY=${BINARY_DIR}/libuv_a.a
|
||||
-DLIBUV_INCLUDE_DIR=${SOURCE_DIR}/include
|
||||
-DCASS_BUILD_STATIC=ON
|
||||
-DCASS_BUILD_SHARED=OFF
|
||||
-DOPENSSL_ROOT_DIR=/opt/local/openssl
|
||||
INSTALL_COMMAND ""
|
||||
BUILD_BYPRODUCTS <BINARY_DIR>/${ep_lib_prefix}cassandra_static.a
|
||||
LOG_BUILD TRUE
|
||||
LOG_CONFIGURE TRUE
|
||||
)
|
||||
|
||||
ExternalProject_Get_Property (cassandra_src SOURCE_DIR)
|
||||
ExternalProject_Get_Property (cassandra_src BINARY_DIR)
|
||||
set (cassandra_src_SOURCE_DIR "${SOURCE_DIR}")
|
||||
file (MAKE_DIRECTORY ${cassandra_src_SOURCE_DIR}/include)
|
||||
|
||||
set_target_properties (cassandra PROPERTIES
|
||||
IMPORTED_LOCATION
|
||||
${BINARY_DIR}/${ep_lib_prefix}cassandra_static.a
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
${SOURCE_DIR}/include)
|
||||
add_dependencies(cassandra cassandra_src)
|
||||
|
||||
if(NOT libuv1)
|
||||
ExternalProject_Add_StepDependencies(cassandra_src build libuv1)
|
||||
target_link_libraries(cassandra INTERFACE libuv1)
|
||||
else()
|
||||
target_link_libraries(cassandra INTERFACE ${libuv1})
|
||||
endif()
|
||||
if(NOT krb5)
|
||||
|
||||
ExternalProject_Add_StepDependencies(cassandra_src build krb5)
|
||||
target_link_libraries(cassandra INTERFACE krb5)
|
||||
else()
|
||||
target_link_libraries(cassandra INTERFACE ${krb5})
|
||||
endif()
|
||||
|
||||
if(NOT zlib)
|
||||
ExternalProject_Add_StepDependencies(cassandra_src build zlib)
|
||||
target_link_libraries(cassandra INTERFACE zlib)
|
||||
else()
|
||||
target_link_libraries(cassandra INTERFACE ${zlib})
|
||||
endif()
|
||||
|
||||
file(TO_CMAKE_PATH "${cassandra_src_SOURCE_DIR}" cassandra_src_SOURCE_DIR)
|
||||
target_link_libraries(ripple_libs INTERFACE cassandra)
|
||||
else()
|
||||
message("Found system installed cassandra cpp driver")
|
||||
|
||||
find_path(cassandra_includes NAMES cassandra.h REQUIRED)
|
||||
target_link_libraries (ripple_libs INTERFACE ${cassandra})
|
||||
target_include_directories(ripple_libs INTERFACE ${cassandra_includes})
|
||||
endif()
|
||||
|
||||
exclude_if_included (cassandra)
|
||||
endif()
|
||||
18
cmake/deps/date.cmake
Normal file
18
cmake/deps/date.cmake
Normal file
@@ -0,0 +1,18 @@
|
||||
#[===================================================================[
|
||||
NIH dep: date
|
||||
|
||||
the main library is header-only, thus is an INTERFACE lib in CMake.
|
||||
|
||||
NOTE: this has been accepted into c++20 so can likely be replaced
|
||||
when we update to that standard
|
||||
#]===================================================================]
|
||||
|
||||
find_package (date QUIET)
|
||||
if (NOT TARGET date::date)
|
||||
FetchContent_Declare(
|
||||
hh_date_src
|
||||
GIT_REPOSITORY https://github.com/HowardHinnant/date.git
|
||||
GIT_TAG fc4cf092f9674f2670fb9177edcdee870399b829
|
||||
)
|
||||
FetchContent_MakeAvailable(hh_date_src)
|
||||
endif ()
|
||||
392
cmake/deps/gRPC.cmake
Normal file
392
cmake/deps/gRPC.cmake
Normal file
@@ -0,0 +1,392 @@
|
||||
|
||||
# currently linking to unsecure versions...if we switch, we'll
|
||||
# need to add ssl as a link dependency to the grpc targets
|
||||
option (use_secure_grpc "use TLS version of grpc libs." OFF)
|
||||
if (use_secure_grpc)
|
||||
set (grpc_suffix "")
|
||||
else ()
|
||||
set (grpc_suffix "_unsecure")
|
||||
endif ()
|
||||
|
||||
find_package (gRPC 1.23 CONFIG QUIET)
|
||||
if (TARGET gRPC::gpr AND NOT local_grpc)
|
||||
get_target_property (_grpc_l gRPC::gpr IMPORTED_LOCATION_DEBUG)
|
||||
if (NOT _grpc_l)
|
||||
get_target_property (_grpc_l gRPC::gpr IMPORTED_LOCATION_RELEASE)
|
||||
endif ()
|
||||
if (NOT _grpc_l)
|
||||
get_target_property (_grpc_l gRPC::gpr IMPORTED_LOCATION)
|
||||
endif ()
|
||||
message (STATUS "Found cmake config for gRPC. Using ${_grpc_l}.")
|
||||
else ()
|
||||
find_package (PkgConfig QUIET)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules (grpc QUIET "grpc${grpc_suffix}>=1.25" "grpc++${grpc_suffix}" gpr)
|
||||
endif ()
|
||||
|
||||
if (grpc_FOUND)
|
||||
message (STATUS "Found gRPC using pkg-config. Using ${grpc_gpr_PREFIX}.")
|
||||
endif ()
|
||||
|
||||
add_executable (gRPC::grpc_cpp_plugin IMPORTED)
|
||||
exclude_if_included (gRPC::grpc_cpp_plugin)
|
||||
|
||||
if (grpc_FOUND AND NOT local_grpc)
|
||||
# use installed grpc (via pkg-config)
|
||||
macro (add_imported_grpc libname_)
|
||||
if (static)
|
||||
set (_search "${CMAKE_STATIC_LIBRARY_PREFIX}${libname_}${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
else ()
|
||||
set (_search "${CMAKE_SHARED_LIBRARY_PREFIX}${libname_}${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
endif()
|
||||
find_library(_found_${libname_}
|
||||
NAMES ${_search}
|
||||
HINTS ${grpc_LIBRARY_DIRS})
|
||||
if (_found_${libname_})
|
||||
message (STATUS "importing ${libname_} as ${_found_${libname_}}")
|
||||
else ()
|
||||
message (FATAL_ERROR "using pkg-config for grpc, can't find ${_search}")
|
||||
endif ()
|
||||
add_library ("gRPC::${libname_}" STATIC IMPORTED GLOBAL)
|
||||
set_target_properties ("gRPC::${libname_}" PROPERTIES IMPORTED_LOCATION ${_found_${libname_}})
|
||||
if (grpc_INCLUDE_DIRS)
|
||||
set_target_properties ("gRPC::${libname_}" PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${grpc_INCLUDE_DIRS})
|
||||
endif ()
|
||||
target_link_libraries (ripple_libs INTERFACE "gRPC::${libname_}")
|
||||
exclude_if_included ("gRPC::${libname_}")
|
||||
endmacro ()
|
||||
|
||||
set_target_properties (gRPC::grpc_cpp_plugin PROPERTIES
|
||||
IMPORTED_LOCATION "${grpc_gpr_PREFIX}/bin/grpc_cpp_plugin${CMAKE_EXECUTABLE_SUFFIX}")
|
||||
|
||||
pkg_check_modules (cares QUIET libcares)
|
||||
if (cares_FOUND)
|
||||
if (static)
|
||||
set (_search "${CMAKE_STATIC_LIBRARY_PREFIX}cares${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
set (_prefix cares_STATIC)
|
||||
set (_static STATIC)
|
||||
else ()
|
||||
set (_search "${CMAKE_SHARED_LIBRARY_PREFIX}cares${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
set (_prefix cares)
|
||||
set (_static)
|
||||
endif()
|
||||
find_library(_location NAMES ${_search} HINTS ${cares_LIBRARY_DIRS})
|
||||
if (NOT _location)
|
||||
message (FATAL_ERROR "using pkg-config for grpc, can't find c-ares")
|
||||
endif ()
|
||||
if(${_location} MATCHES "\\.a$")
|
||||
add_library(c-ares::cares STATIC IMPORTED GLOBAL)
|
||||
else()
|
||||
add_library(c-ares::cares SHARED IMPORTED GLOBAL)
|
||||
endif()
|
||||
set_target_properties (c-ares::cares PROPERTIES
|
||||
IMPORTED_LOCATION ${_location}
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${${_prefix}_INCLUDE_DIRS}"
|
||||
INTERFACE_LINK_OPTIONS "${${_prefix}_LDFLAGS}"
|
||||
)
|
||||
exclude_if_included (c-ares::cares)
|
||||
else ()
|
||||
message (FATAL_ERROR "using pkg-config for grpc, can't find c-ares")
|
||||
endif ()
|
||||
else ()
|
||||
#[===========================[
|
||||
c-ares (grpc requires)
|
||||
#]===========================]
|
||||
ExternalProject_Add (c-ares_src
|
||||
PREFIX ${nih_cache_path}
|
||||
GIT_REPOSITORY https://github.com/c-ares/c-ares.git
|
||||
GIT_TAG cares-1_15_0
|
||||
CMAKE_ARGS
|
||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||
$<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:-DCMAKE_VERBOSE_MAKEFILE=ON>
|
||||
-DCMAKE_DEBUG_POSTFIX=_d
|
||||
$<$<NOT:$<BOOL:${is_multiconfig}>>:-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}>
|
||||
-DCMAKE_INSTALL_PREFIX=<BINARY_DIR>/_installed_
|
||||
-DCARES_SHARED=OFF
|
||||
-DCARES_STATIC=ON
|
||||
-DCARES_STATIC_PIC=ON
|
||||
-DCARES_INSTALL=ON
|
||||
-DCARES_MSVC_STATIC_RUNTIME=ON
|
||||
$<$<BOOL:${MSVC}>:
|
||||
"-DCMAKE_C_FLAGS=-GR -Gd -fp:precise -FS -MP"
|
||||
>
|
||||
LOG_BUILD ON
|
||||
LOG_CONFIGURE ON
|
||||
BUILD_COMMAND
|
||||
${CMAKE_COMMAND}
|
||||
--build .
|
||||
--config $<CONFIG>
|
||||
--parallel ${ep_procs}
|
||||
TEST_COMMAND ""
|
||||
INSTALL_COMMAND
|
||||
${CMAKE_COMMAND} -E env --unset=DESTDIR ${CMAKE_COMMAND} --build . --config $<CONFIG> --target install
|
||||
BUILD_BYPRODUCTS
|
||||
<BINARY_DIR>/_installed_/lib/${ep_lib_prefix}cares${ep_lib_suffix}
|
||||
<BINARY_DIR>/_installed_/lib/${ep_lib_prefix}cares_d${ep_lib_suffix}
|
||||
)
|
||||
exclude_if_included (c-ares_src)
|
||||
ExternalProject_Get_Property (c-ares_src BINARY_DIR)
|
||||
set (cares_binary_dir "${BINARY_DIR}")
|
||||
|
||||
add_library (c-ares::cares STATIC IMPORTED GLOBAL)
|
||||
file (MAKE_DIRECTORY ${BINARY_DIR}/_installed_/include)
|
||||
set_target_properties (c-ares::cares PROPERTIES
|
||||
IMPORTED_LOCATION_DEBUG
|
||||
${BINARY_DIR}/_installed_/lib/${ep_lib_prefix}cares_d${ep_lib_suffix}
|
||||
IMPORTED_LOCATION_RELEASE
|
||||
${BINARY_DIR}/_installed_/lib/${ep_lib_prefix}cares${ep_lib_suffix}
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
${BINARY_DIR}/_installed_/include)
|
||||
add_dependencies (c-ares::cares c-ares_src)
|
||||
exclude_if_included (c-ares::cares)
|
||||
|
||||
if (NOT has_zlib)
|
||||
#[===========================[
|
||||
zlib (grpc requires)
|
||||
#]===========================]
|
||||
if (MSVC)
|
||||
set (zlib_debug_postfix "d") # zlib cmake sets this internally for MSVC, so we really don't have a choice
|
||||
set (zlib_base "zlibstatic")
|
||||
else ()
|
||||
set (zlib_debug_postfix "_d")
|
||||
set (zlib_base "z")
|
||||
endif ()
|
||||
ExternalProject_Add (zlib_src
|
||||
PREFIX ${nih_cache_path}
|
||||
GIT_REPOSITORY https://github.com/madler/zlib.git
|
||||
GIT_TAG v1.2.11
|
||||
CMAKE_ARGS
|
||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||
$<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:-DCMAKE_VERBOSE_MAKEFILE=ON>
|
||||
-DCMAKE_DEBUG_POSTFIX=${zlib_debug_postfix}
|
||||
$<$<NOT:$<BOOL:${is_multiconfig}>>:-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}>
|
||||
-DCMAKE_INSTALL_PREFIX=<BINARY_DIR>/_installed_
|
||||
-DBUILD_SHARED_LIBS=OFF
|
||||
$<$<BOOL:${MSVC}>:
|
||||
"-DCMAKE_C_FLAGS=-GR -Gd -fp:precise -FS -MP"
|
||||
"-DCMAKE_C_FLAGS_DEBUG=-MTd"
|
||||
"-DCMAKE_C_FLAGS_RELEASE=-MT"
|
||||
>
|
||||
LOG_BUILD ON
|
||||
LOG_CONFIGURE ON
|
||||
BUILD_COMMAND
|
||||
${CMAKE_COMMAND}
|
||||
--build .
|
||||
--config $<CONFIG>
|
||||
--parallel ${ep_procs}
|
||||
TEST_COMMAND ""
|
||||
INSTALL_COMMAND
|
||||
${CMAKE_COMMAND} -E env --unset=DESTDIR ${CMAKE_COMMAND} --build . --config $<CONFIG> --target install
|
||||
BUILD_BYPRODUCTS
|
||||
<BINARY_DIR>/_installed_/lib/${ep_lib_prefix}${zlib_base}${ep_lib_suffix}
|
||||
<BINARY_DIR>/_installed_/lib/${ep_lib_prefix}${zlib_base}${zlib_debug_postfix}${ep_lib_suffix}
|
||||
)
|
||||
exclude_if_included (zlib_src)
|
||||
ExternalProject_Get_Property (zlib_src BINARY_DIR)
|
||||
set (zlib_binary_dir "${BINARY_DIR}")
|
||||
|
||||
add_library (ZLIB::ZLIB STATIC IMPORTED GLOBAL)
|
||||
file (MAKE_DIRECTORY ${BINARY_DIR}/_installed_/include)
|
||||
set_target_properties (ZLIB::ZLIB PROPERTIES
|
||||
IMPORTED_LOCATION_DEBUG
|
||||
${BINARY_DIR}/_installed_/lib/${ep_lib_prefix}${zlib_base}${zlib_debug_postfix}${ep_lib_suffix}
|
||||
IMPORTED_LOCATION_RELEASE
|
||||
${BINARY_DIR}/_installed_/lib/${ep_lib_prefix}${zlib_base}${ep_lib_suffix}
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
${BINARY_DIR}/_installed_/include)
|
||||
add_dependencies (ZLIB::ZLIB zlib_src)
|
||||
exclude_if_included (ZLIB::ZLIB)
|
||||
endif ()
|
||||
|
||||
#[===========================[
|
||||
grpc
|
||||
#]===========================]
|
||||
ExternalProject_Add (grpc_src
|
||||
PREFIX ${nih_cache_path}
|
||||
GIT_REPOSITORY https://github.com/grpc/grpc.git
|
||||
GIT_TAG v1.25.0
|
||||
CMAKE_ARGS
|
||||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||
-DCMAKE_CXX_STANDARD=17
|
||||
$<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:-DCMAKE_VERBOSE_MAKEFILE=ON>
|
||||
$<$<BOOL:${CMAKE_TOOLCHAIN_FILE}>:-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}>
|
||||
$<$<BOOL:${VCPKG_TARGET_TRIPLET}>:-DVCPKG_TARGET_TRIPLET=${VCPKG_TARGET_TRIPLET}>
|
||||
$<$<BOOL:${unity}>:-DCMAKE_UNITY_BUILD=ON}>
|
||||
-DCMAKE_DEBUG_POSTFIX=_d
|
||||
$<$<NOT:$<BOOL:${is_multiconfig}>>:-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}>
|
||||
-DgRPC_BUILD_TESTS=OFF
|
||||
-DgRPC_BENCHMARK_PROVIDER=""
|
||||
-DgRPC_BUILD_CSHARP_EXT=OFF
|
||||
-DgRPC_MSVC_STATIC_RUNTIME=ON
|
||||
-DgRPC_INSTALL=OFF
|
||||
-DgRPC_CARES_PROVIDER=package
|
||||
-Dc-ares_DIR=${cares_binary_dir}/_installed_/lib/cmake/c-ares
|
||||
-DgRPC_SSL_PROVIDER=package
|
||||
-DOPENSSL_ROOT_DIR=${OPENSSL_ROOT_DIR}
|
||||
-DgRPC_PROTOBUF_PROVIDER=package
|
||||
-DProtobuf_USE_STATIC_LIBS=$<IF:$<AND:$<BOOL:${Protobuf_FOUND}>,$<NOT:$<BOOL:${static}>>>,OFF,ON>
|
||||
-DProtobuf_INCLUDE_DIR=$<JOIN:$<TARGET_PROPERTY:protobuf::libprotobuf,INTERFACE_INCLUDE_DIRECTORIES>,:_:>
|
||||
-DProtobuf_LIBRARY=$<IF:$<CONFIG:Debug>,$<TARGET_PROPERTY:protobuf::libprotobuf,IMPORTED_LOCATION_DEBUG>,$<TARGET_PROPERTY:protobuf::libprotobuf,IMPORTED_LOCATION_RELEASE>>
|
||||
-DProtobuf_PROTOC_LIBRARY=$<IF:$<CONFIG:Debug>,$<TARGET_PROPERTY:protobuf::libprotoc,IMPORTED_LOCATION_DEBUG>,$<TARGET_PROPERTY:protobuf::libprotoc,IMPORTED_LOCATION_RELEASE>>
|
||||
-DProtobuf_PROTOC_EXECUTABLE=$<TARGET_PROPERTY:protobuf::protoc,IMPORTED_LOCATION>
|
||||
-DgRPC_ZLIB_PROVIDER=package
|
||||
$<$<NOT:$<BOOL:${has_zlib}>>:-DZLIB_ROOT=${zlib_binary_dir}/_installed_>
|
||||
$<$<BOOL:${MSVC}>:
|
||||
"-DCMAKE_CXX_FLAGS=-GR -Gd -fp:precise -FS -EHa -MP"
|
||||
"-DCMAKE_C_FLAGS=-GR -Gd -fp:precise -FS -MP"
|
||||
>
|
||||
LOG_BUILD ON
|
||||
LOG_CONFIGURE ON
|
||||
BUILD_COMMAND
|
||||
${CMAKE_COMMAND}
|
||||
--build .
|
||||
--config $<CONFIG>
|
||||
--parallel ${ep_procs}
|
||||
$<$<BOOL:${is_multiconfig}>:
|
||||
COMMAND
|
||||
${CMAKE_COMMAND} -E copy
|
||||
<BINARY_DIR>/$<CONFIG>/${ep_lib_prefix}grpc${grpc_suffix}$<$<CONFIG:Debug>:_d>${ep_lib_suffix}
|
||||
<BINARY_DIR>/$<CONFIG>/${ep_lib_prefix}grpc++${grpc_suffix}$<$<CONFIG:Debug>:_d>${ep_lib_suffix}
|
||||
<BINARY_DIR>/$<CONFIG>/${ep_lib_prefix}address_sorting$<$<CONFIG:Debug>:_d>${ep_lib_suffix}
|
||||
<BINARY_DIR>/$<CONFIG>/${ep_lib_prefix}gpr$<$<CONFIG:Debug>:_d>${ep_lib_suffix}
|
||||
<BINARY_DIR>/$<CONFIG>/grpc_cpp_plugin${CMAKE_EXECUTABLE_SUFFIX}
|
||||
<BINARY_DIR>
|
||||
>
|
||||
LIST_SEPARATOR :_:
|
||||
TEST_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
DEPENDS c-ares_src
|
||||
BUILD_BYPRODUCTS
|
||||
<BINARY_DIR>/${ep_lib_prefix}grpc${grpc_suffix}${ep_lib_suffix}
|
||||
<BINARY_DIR>/${ep_lib_prefix}grpc${grpc_suffix}_d${ep_lib_suffix}
|
||||
<BINARY_DIR>/${ep_lib_prefix}grpc++${grpc_suffix}${ep_lib_suffix}
|
||||
<BINARY_DIR>/${ep_lib_prefix}grpc++${grpc_suffix}_d${ep_lib_suffix}
|
||||
<BINARY_DIR>/${ep_lib_prefix}address_sorting${ep_lib_suffix}
|
||||
<BINARY_DIR>/${ep_lib_prefix}address_sorting_d${ep_lib_suffix}
|
||||
<BINARY_DIR>/${ep_lib_prefix}gpr${ep_lib_suffix}
|
||||
<BINARY_DIR>/${ep_lib_prefix}gpr_d${ep_lib_suffix}
|
||||
<BINARY_DIR>/grpc_cpp_plugin${CMAKE_EXECUTABLE_SUFFIX}
|
||||
)
|
||||
if (TARGET protobuf_src)
|
||||
ExternalProject_Add_StepDependencies(grpc_src build protobuf_src)
|
||||
endif ()
|
||||
exclude_if_included (grpc_src)
|
||||
ExternalProject_Get_Property (grpc_src BINARY_DIR)
|
||||
ExternalProject_Get_Property (grpc_src SOURCE_DIR)
|
||||
set (grpc_binary_dir "${BINARY_DIR}")
|
||||
set (grpc_source_dir "${SOURCE_DIR}")
|
||||
if (CMAKE_VERBOSE_MAKEFILE)
|
||||
print_ep_logs (grpc_src)
|
||||
endif ()
|
||||
file (MAKE_DIRECTORY ${SOURCE_DIR}/include)
|
||||
|
||||
macro (add_imported_grpc libname_)
|
||||
add_library ("gRPC::${libname_}" STATIC IMPORTED GLOBAL)
|
||||
set_target_properties ("gRPC::${libname_}" PROPERTIES
|
||||
IMPORTED_LOCATION_DEBUG
|
||||
${grpc_binary_dir}/${ep_lib_prefix}${libname_}_d${ep_lib_suffix}
|
||||
IMPORTED_LOCATION_RELEASE
|
||||
${grpc_binary_dir}/${ep_lib_prefix}${libname_}${ep_lib_suffix}
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
${grpc_source_dir}/include)
|
||||
add_dependencies ("gRPC::${libname_}" grpc_src)
|
||||
target_link_libraries (ripple_libs INTERFACE "gRPC::${libname_}")
|
||||
exclude_if_included ("gRPC::${libname_}")
|
||||
endmacro ()
|
||||
|
||||
set_target_properties (gRPC::grpc_cpp_plugin PROPERTIES
|
||||
IMPORTED_LOCATION "${grpc_binary_dir}/grpc_cpp_plugin${CMAKE_EXECUTABLE_SUFFIX}")
|
||||
add_dependencies (gRPC::grpc_cpp_plugin grpc_src)
|
||||
endif ()
|
||||
|
||||
add_imported_grpc (gpr)
|
||||
add_imported_grpc ("grpc${grpc_suffix}")
|
||||
add_imported_grpc ("grpc++${grpc_suffix}")
|
||||
add_imported_grpc (address_sorting)
|
||||
|
||||
target_link_libraries ("gRPC::grpc${grpc_suffix}" INTERFACE c-ares::cares gRPC::gpr gRPC::address_sorting ZLIB::ZLIB)
|
||||
target_link_libraries ("gRPC::grpc++${grpc_suffix}" INTERFACE "gRPC::grpc${grpc_suffix}" gRPC::gpr)
|
||||
endif ()
|
||||
|
||||
#[=================================[
|
||||
generate protobuf sources for
|
||||
grpc defs and bundle into a
|
||||
static lib
|
||||
#]=================================]
|
||||
set(output_dir "${CMAKE_BINARY_DIR}/proto_gen_grpc")
|
||||
set(GRPC_GEN_DIR "${output_dir}/ripple/proto")
|
||||
file(MAKE_DIRECTORY ${GRPC_GEN_DIR})
|
||||
set(GRPC_PROTO_SRCS)
|
||||
set(GRPC_PROTO_HDRS)
|
||||
set(GRPC_PROTO_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/src/ripple/proto/org")
|
||||
file(GLOB_RECURSE GRPC_DEFINITION_FILES "${GRPC_PROTO_ROOT}/*.proto")
|
||||
foreach(file ${GRPC_DEFINITION_FILES})
|
||||
# /home/user/rippled/src/ripple/proto/org/.../v1/get_ledger.proto
|
||||
get_filename_component(_abs_file ${file} ABSOLUTE)
|
||||
# /home/user/rippled/src/ripple/proto/org/.../v1
|
||||
get_filename_component(_abs_dir ${_abs_file} DIRECTORY)
|
||||
# get_ledger
|
||||
get_filename_component(_basename ${file} NAME_WE)
|
||||
# /home/user/rippled/src/ripple/proto
|
||||
get_filename_component(_proto_inc ${GRPC_PROTO_ROOT} DIRECTORY) # updir one level
|
||||
# org/.../v1/get_ledger.proto
|
||||
file(RELATIVE_PATH _rel_root_file ${_proto_inc} ${_abs_file})
|
||||
# org/.../v1
|
||||
get_filename_component(_rel_root_dir ${_rel_root_file} DIRECTORY)
|
||||
# src/ripple/proto/org/.../v1
|
||||
file(RELATIVE_PATH _rel_dir ${CMAKE_CURRENT_SOURCE_DIR} ${_abs_dir})
|
||||
|
||||
set(src_1 "${GRPC_GEN_DIR}/${_rel_root_dir}/${_basename}.grpc.pb.cc")
|
||||
set(src_2 "${GRPC_GEN_DIR}/${_rel_root_dir}/${_basename}.pb.cc")
|
||||
set(hdr_1 "${GRPC_GEN_DIR}/${_rel_root_dir}/${_basename}.grpc.pb.h")
|
||||
set(hdr_2 "${GRPC_GEN_DIR}/${_rel_root_dir}/${_basename}.pb.h")
|
||||
add_custom_command(
|
||||
OUTPUT ${src_1} ${src_2} ${hdr_1} ${hdr_2}
|
||||
COMMAND protobuf::protoc
|
||||
ARGS --grpc_out=${GRPC_GEN_DIR}
|
||||
--cpp_out=${GRPC_GEN_DIR}
|
||||
--plugin=protoc-gen-grpc=$<TARGET_FILE:gRPC::grpc_cpp_plugin>
|
||||
-I ${_proto_inc} -I ${_rel_dir}
|
||||
${_abs_file}
|
||||
DEPENDS ${_abs_file} protobuf::protoc gRPC::grpc_cpp_plugin
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMENT "Running gRPC C++ protocol buffer compiler on ${file}"
|
||||
VERBATIM)
|
||||
set_source_files_properties(${src_1} ${src_2} ${hdr_1} ${hdr_2} PROPERTIES
|
||||
GENERATED TRUE
|
||||
SKIP_UNITY_BUILD_INCLUSION ON
|
||||
)
|
||||
list(APPEND GRPC_PROTO_SRCS ${src_1} ${src_2})
|
||||
list(APPEND GRPC_PROTO_HDRS ${hdr_1} ${hdr_2})
|
||||
endforeach()
|
||||
|
||||
target_include_directories(xrpl.libpb SYSTEM PUBLIC
|
||||
$<BUILD_INTERFACE:${output_dir}>
|
||||
$<BUILD_INTERFACE:${output_dir}/ripple/proto>
|
||||
# The generated sources include headers relative to this path. Fix it later.
|
||||
$<INSTALL_INTERFACE:include/ripple/proto>
|
||||
)
|
||||
target_sources(xrpl.libpb PRIVATE ${GRPC_PROTO_SRCS})
|
||||
install(
|
||||
DIRECTORY ${output_dir}/ripple
|
||||
DESTINATION include/
|
||||
FILES_MATCHING PATTERN "*.h"
|
||||
)
|
||||
target_link_libraries(xrpl.libpb PUBLIC
|
||||
"gRPC::grpc++"
|
||||
# libgrpc is missing references.
|
||||
absl::random_random
|
||||
)
|
||||
target_compile_options(xrpl.libpb
|
||||
PRIVATE
|
||||
$<$<BOOL:${MSVC}>:-wd4065>
|
||||
$<$<NOT:$<BOOL:${MSVC}>>:-Wno-deprecated-declarations>
|
||||
PUBLIC
|
||||
$<$<BOOL:${MSVC}>:-wd4996>
|
||||
$<$<BOOL:${is_xcode}>:
|
||||
--system-header-prefix="google/protobuf"
|
||||
-Wno-deprecated-dynamic-exception-spec
|
||||
>)
|
||||
# target_link_libraries (ripple_libs INTERFACE Ripple::grpc_pbufs)
|
||||
# exclude_if_included (grpc_pbufs)
|
||||
32
conanfile.py
32
conanfile.py
@@ -21,8 +21,6 @@ class Xrpl(ConanFile):
|
||||
'tests': [True, False],
|
||||
'unity': [True, False],
|
||||
'xrpld': [True, False],
|
||||
'with_wasmedge': [True, False],
|
||||
'tool_requires_b2': [True, False],
|
||||
}
|
||||
|
||||
requires = [
|
||||
@@ -30,14 +28,15 @@ class Xrpl(ConanFile):
|
||||
'grpc/1.50.1',
|
||||
'libarchive/3.7.6',
|
||||
'nudb/2.0.8',
|
||||
'openssl/3.6.0',
|
||||
'soci/4.0.3@xahaud/stable',
|
||||
'openssl/1.1.1v',
|
||||
'soci/4.0.3',
|
||||
'xxhash/0.8.2',
|
||||
'wasmedge/0.11.2',
|
||||
'zlib/1.3.1',
|
||||
]
|
||||
|
||||
tool_requires = [
|
||||
'protobuf/3.21.12',
|
||||
'protobuf/3.21.9',
|
||||
]
|
||||
|
||||
default_options = {
|
||||
@@ -50,11 +49,9 @@ class Xrpl(ConanFile):
|
||||
'static': True,
|
||||
'tests': False,
|
||||
'unity': False,
|
||||
'with_wasmedge': True,
|
||||
'tool_requires_b2': False,
|
||||
'xrpld': False,
|
||||
|
||||
'date/*:header_only': False,
|
||||
'date/*:header_only': True,
|
||||
'grpc/*:shared': False,
|
||||
'grpc/*:secure': True,
|
||||
'libarchive/*:shared': False,
|
||||
@@ -98,28 +95,15 @@ class Xrpl(ConanFile):
|
||||
match = next(m for m in matches if m)
|
||||
self.version = match.group(1)
|
||||
|
||||
def build_requirements(self):
|
||||
self.tool_requires('grpc/1.50.1')
|
||||
# Explicitly require b2 (e.g. for building from source for glibc compatibility)
|
||||
if self.options.tool_requires_b2:
|
||||
self.tool_requires('b2/5.3.2')
|
||||
|
||||
def configure(self):
|
||||
if self.settings.compiler == 'apple-clang':
|
||||
self.options['boost/*'].visibility = 'global'
|
||||
self.options['boost'].visibility = 'global'
|
||||
|
||||
def requirements(self):
|
||||
# Force boost version for all dependencies to avoid conflicts
|
||||
self.requires('boost/1.86.0', override=True)
|
||||
self.requires('boost/1.86.0', force=True)
|
||||
self.requires('lz4/1.10.0', force=True)
|
||||
self.requires('protobuf/3.21.9', force=True)
|
||||
# Force sqlite3 version to avoid conflicts with soci
|
||||
self.requires('sqlite3/3.47.0', override=True)
|
||||
# Force our custom snappy build for all dependencies
|
||||
self.requires('snappy/1.1.10@xahaud/stable', override=True)
|
||||
|
||||
if self.options.with_wasmedge:
|
||||
self.requires('wasmedge/0.11.2@xahaud/stable')
|
||||
self.requires('sqlite3/3.47.0', force=True)
|
||||
if self.options.jemalloc:
|
||||
self.requires('jemalloc/5.3.0')
|
||||
if self.options.rocksdb:
|
||||
|
||||
@@ -8,4 +8,4 @@ if [[ "$GITHUB_REPOSITORY" == "" ]]; then
|
||||
fi
|
||||
|
||||
echo "Mounting $(pwd)/io in ubuntu and running unit tests"
|
||||
docker run --rm -i -v $(pwd):/io --platform=linux/amd64 -e BUILD_CORES=$BUILD_CORES ubuntu sh -c '/io/release-build/xahaud --unittest-jobs $BUILD_CORES -u'
|
||||
docker run --rm -i -v $(pwd):/io -e BUILD_CORES=$BUILD_CORES ubuntu sh -c '/io/release-build/xahaud --unittest-jobs $BUILD_CORES -u'
|
||||
|
||||
11
external/snappy/conanfile.py
vendored
11
external/snappy/conanfile.py
vendored
@@ -77,14 +77,9 @@ class SnappyConan(ConanFile):
|
||||
self.cpp_info.set_property("cmake_target_name", "Snappy::snappy")
|
||||
# TODO: back to global scope in conan v2 once cmake_find_package* generators removed
|
||||
self.cpp_info.components["snappylib"].libs = ["snappy"]
|
||||
# The following block is commented out as a workaround for a bug in the
|
||||
# Conan 1.x CMakeDeps generator. Including system_libs ("m") here
|
||||
# incorrectly triggers a heuristic that adds a dynamic link to `stdc++`
|
||||
# (-lstdc++), preventing a fully static build.
|
||||
# This behavior is expected to be corrected in Conan 2.
|
||||
# if not self.options.shared:
|
||||
# if self.settings.os in ["Linux", "FreeBSD"]:
|
||||
# self.cpp_info.components["snappylib"].system_libs.append("m")
|
||||
if not self.options.shared:
|
||||
if self.settings.os in ["Linux", "FreeBSD"]:
|
||||
self.cpp_info.components["snappylib"].system_libs.append("m")
|
||||
|
||||
# TODO: to remove in conan v2 once cmake_find_package* generators removed
|
||||
self.cpp_info.names["cmake_find_package"] = "Snappy"
|
||||
|
||||
11
external/wasmedge/conanfile.py
vendored
11
external/wasmedge/conanfile.py
vendored
@@ -38,15 +38,8 @@ class WasmedgeConan(ConanFile):
|
||||
raise ConanInvalidConfiguration("Binaries for this combination of version/os/arch/compiler are not available")
|
||||
|
||||
def package_id(self):
|
||||
# Make binary compatible across compiler versions (since we're downloading prebuilt)
|
||||
self.info.settings.rm_safe("compiler.version")
|
||||
# Group compilers by their binary compatibility
|
||||
# Note: We must use self.info.settings here, not self.settings (forbidden in Conan 2)
|
||||
compiler_name = str(self.info.settings.compiler)
|
||||
if compiler_name in ["Visual Studio", "msvc"]:
|
||||
self.info.settings.compiler = "Visual Studio"
|
||||
else:
|
||||
self.info.settings.compiler = "gcc"
|
||||
del self.info.settings.compiler.version
|
||||
self.info.settings.compiler = self._compiler_alias
|
||||
|
||||
def build(self):
|
||||
# This is packaging binaries so the download needs to be in build
|
||||
|
||||
@@ -48,4 +48,4 @@
|
||||
#define TOO_MANY_STATE_MODIFICATIONS -44
|
||||
#define TOO_MANY_NAMESPACES -45
|
||||
#define HOOK_ERROR_CODES
|
||||
#endif //HOOK_ERROR_CODES
|
||||
#endif //HOOK_ERROR_CODES
|
||||
@@ -12,6 +12,8 @@ accept(uint32_t read_ptr, uint32_t read_len, int64_t error_code);
|
||||
extern int64_t
|
||||
rollback(uint32_t read_ptr, uint32_t read_len, int64_t error_code);
|
||||
|
||||
// UTIL
|
||||
|
||||
extern int64_t
|
||||
util_raddr(
|
||||
uint32_t write_ptr,
|
||||
@@ -54,6 +56,8 @@ util_keylet(
|
||||
uint32_t e,
|
||||
uint32_t f);
|
||||
|
||||
// STO
|
||||
|
||||
extern int64_t
|
||||
sto_validate(uint32_t tread_ptr, uint32_t tread_len);
|
||||
|
||||
@@ -81,6 +85,8 @@ sto_erase(
|
||||
uint32_t read_len,
|
||||
uint32_t field_id);
|
||||
|
||||
// EMITTED TXN
|
||||
|
||||
extern int64_t
|
||||
etxn_burden(void);
|
||||
|
||||
@@ -106,6 +112,8 @@ emit(
|
||||
uint32_t read_ptr,
|
||||
uint32_t read_len);
|
||||
|
||||
// FLOAT
|
||||
|
||||
extern int64_t
|
||||
float_set(int32_t exponent, int64_t mantissa);
|
||||
|
||||
@@ -166,6 +174,8 @@ float_log(int64_t float1);
|
||||
extern int64_t
|
||||
float_root(int64_t float1, uint32_t n);
|
||||
|
||||
// LEDGER
|
||||
|
||||
extern int64_t
|
||||
fee_base(void);
|
||||
|
||||
@@ -190,6 +200,8 @@ ledger_keylet(
|
||||
uint32_t hread_ptr,
|
||||
uint32_t hread_len);
|
||||
|
||||
// HOOK
|
||||
|
||||
extern int64_t
|
||||
hook_account(uint32_t write_ptr, uint32_t write_len);
|
||||
|
||||
@@ -221,6 +233,8 @@ hook_skip(uint32_t read_ptr, uint32_t read_len, uint32_t flags);
|
||||
extern int64_t
|
||||
hook_pos(void);
|
||||
|
||||
// SLOT
|
||||
|
||||
extern int64_t
|
||||
slot(uint32_t write_ptr, uint32_t write_len, uint32_t slot);
|
||||
|
||||
@@ -248,6 +262,8 @@ slot_type(uint32_t slot_no, uint32_t flags);
|
||||
extern int64_t
|
||||
slot_float(uint32_t slot_no);
|
||||
|
||||
// STATE
|
||||
|
||||
extern int64_t
|
||||
state_set(
|
||||
uint32_t read_ptr,
|
||||
@@ -284,6 +300,8 @@ state_foreign(
|
||||
uint32_t aread_ptr,
|
||||
uint32_t aread_len);
|
||||
|
||||
// TRACE
|
||||
|
||||
extern int64_t
|
||||
trace(
|
||||
uint32_t mread_ptr,
|
||||
@@ -298,6 +316,8 @@ trace_num(uint32_t read_ptr, uint32_t read_len, int64_t number);
|
||||
extern int64_t
|
||||
trace_float(uint32_t read_ptr, uint32_t read_len, int64_t float1);
|
||||
|
||||
// OTXN
|
||||
|
||||
extern int64_t
|
||||
otxn_burden(void);
|
||||
|
||||
@@ -326,8 +346,9 @@ otxn_param(
|
||||
extern int64_t
|
||||
meta_slot(uint32_t slot_no);
|
||||
|
||||
extern int64_t
|
||||
xpop_slot(uint32_t slot_no_tx, uint32_t slot_no_meta);
|
||||
// featureHooks1
|
||||
|
||||
extern int64_t xpop_slot(uint32_t, uint32_t);
|
||||
|
||||
#define HOOK_EXTERN
|
||||
#endif // HOOK_EXTERN
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -eu
|
||||
|
||||
SCRIPT_DIR=$(dirname "$0")
|
||||
SCRIPT_DIR=$(cd "$SCRIPT_DIR" && pwd)
|
||||
|
||||
ENUM_FILE="$SCRIPT_DIR/../include/xrpl/hook/Enum.h"
|
||||
|
||||
echo '// For documentation please see: https://xrpl-hooks.readme.io/reference/'
|
||||
echo '// Generated using generate_error.sh'
|
||||
echo '#ifndef HOOK_ERROR_CODES'
|
||||
sed -n '/enum hook_return_code/,/};/p' "$ENUM_FILE" |
|
||||
awk '
|
||||
function ltrim(s) { sub(/^[[:space:]]+/, "", s); return s }
|
||||
function rtrim(s) { sub(/[[:space:]]+$/, "", s); return s }
|
||||
function trim(s) { return rtrim(ltrim(s)) }
|
||||
function emit(entry) {
|
||||
entry = trim(entry)
|
||||
if (entry == "")
|
||||
return
|
||||
gsub(/,[[:space:]]*$/, "", entry)
|
||||
split(entry, parts, "=")
|
||||
if (length(parts) < 2)
|
||||
return
|
||||
name = trim(parts[1])
|
||||
value = trim(parts[2])
|
||||
if (name == "" || value == "")
|
||||
return
|
||||
printf "#define %s %s\n", name, value
|
||||
}
|
||||
|
||||
{
|
||||
line = $0
|
||||
if (line ~ /enum[[:space:]]+hook_return_code/)
|
||||
next
|
||||
if (line ~ /^[[:space:]]*\{/)
|
||||
next
|
||||
|
||||
sub(/\/\/.*$/, "", line)
|
||||
|
||||
if (line ~ /^[[:space:]]*\};/) {
|
||||
emit(buffer)
|
||||
exit
|
||||
}
|
||||
|
||||
if (line ~ /^[[:space:]]*$/)
|
||||
next
|
||||
|
||||
buffer = buffer line " "
|
||||
|
||||
if (line ~ /,[[:space:]]*$/) {
|
||||
emit(buffer)
|
||||
buffer = ""
|
||||
}
|
||||
}
|
||||
'
|
||||
echo '#define HOOK_ERROR_CODES'
|
||||
echo '#endif //HOOK_ERROR_CODES'
|
||||
@@ -1,145 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -eu
|
||||
|
||||
SCRIPT_DIR=$(dirname "$0")
|
||||
SCRIPT_DIR=$(cd "$SCRIPT_DIR" && pwd)
|
||||
|
||||
APPLY_HOOK="$SCRIPT_DIR/../src/xrpld/app/hook/applyHook.h"
|
||||
|
||||
{
|
||||
echo '// For documentation please see: https://xrpl-hooks.readme.io/reference/'
|
||||
echo '// Generated using generate_extern.sh'
|
||||
echo '#include <stdint.h>'
|
||||
echo '#ifndef HOOK_EXTERN'
|
||||
echo
|
||||
awk '
|
||||
function trim(s) {
|
||||
sub(/^[[:space:]]+/, "", s);
|
||||
sub(/[[:space:]]+$/, "", s);
|
||||
return s;
|
||||
}
|
||||
|
||||
function emit(ret, name, argc, argt, argn) {
|
||||
attr = (name == "_g") ? " __attribute__((noduplicate))" : "";
|
||||
if (!first)
|
||||
printf("\n");
|
||||
first = 0;
|
||||
printf("extern %s%s\n", ret, attr);
|
||||
if (argc == 0) {
|
||||
printf("%s(void);\n", name);
|
||||
return;
|
||||
}
|
||||
if (argc <= 3) {
|
||||
line = argt[1] " " argn[1];
|
||||
for (i = 2; i <= argc; ++i)
|
||||
line = line ", " argt[i] " " argn[i];
|
||||
printf("%s(%s);\n", name, line);
|
||||
return;
|
||||
}
|
||||
printf("%s(\n", name);
|
||||
for (i = 1; i <= argc; ++i) {
|
||||
sep = (i < argc) ? "," : ");";
|
||||
printf(" %s %s%s\n", argt[i], argn[i], sep);
|
||||
}
|
||||
}
|
||||
|
||||
function process(buffer, kind, payload, parts, n, i, arg, tokens, argc, argt, argn) {
|
||||
if (kind == "func")
|
||||
sub(/^DECLARE_HOOK_FUNCTION[[:space:]]*\(/, "", buffer);
|
||||
else
|
||||
sub(/^DECLARE_HOOK_FUNCNARG[[:space:]]*\(/, "", buffer);
|
||||
buffer = trim(buffer);
|
||||
sub(/\)[[:space:]]*$/, "", buffer);
|
||||
n = split(buffer, parts, ",");
|
||||
for (i = 1; i <= n; ++i)
|
||||
parts[i] = trim(parts[i]);
|
||||
ret = parts[1];
|
||||
name = parts[2];
|
||||
argc = 0;
|
||||
delete argt;
|
||||
delete argn;
|
||||
for (i = 3; i <= n; ++i) {
|
||||
arg = parts[i];
|
||||
if (arg == "")
|
||||
continue;
|
||||
split(arg, tokens, /[[:space:]]+/);
|
||||
if (length(tokens) < 2)
|
||||
continue;
|
||||
++argc;
|
||||
argt[argc] = tokens[1];
|
||||
argn[argc] = tokens[2];
|
||||
}
|
||||
emit(ret, name, argc, argt, argn);
|
||||
}
|
||||
|
||||
BEGIN {
|
||||
first = 1;
|
||||
in_block = 0;
|
||||
in_macro = 0;
|
||||
}
|
||||
|
||||
{
|
||||
line = $0;
|
||||
if (in_block) {
|
||||
if (line ~ /\*\//) {
|
||||
sub(/.*\*\//, "", line);
|
||||
in_block = 0;
|
||||
}
|
||||
else
|
||||
next;
|
||||
}
|
||||
while (line ~ /\/\*/) {
|
||||
if (line ~ /\/\*.*\*\//) {
|
||||
gsub(/\/\*.*\*\//, "", line);
|
||||
}
|
||||
else {
|
||||
sub(/\/\*.*/, "", line);
|
||||
in_block = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
sub(/\/\/.*$/, "", line);
|
||||
line = trim(line);
|
||||
if (line == "")
|
||||
next;
|
||||
|
||||
if (!in_macro && line ~ /^DECLARE_HOOK_FUNCTION\(/) {
|
||||
buffer = line;
|
||||
kind = "func";
|
||||
if (line ~ /\);[[:space:]]*$/) {
|
||||
sub(/\);[[:space:]]*$/, "", buffer);
|
||||
process(buffer, kind);
|
||||
}
|
||||
else
|
||||
in_macro = 1;
|
||||
next;
|
||||
}
|
||||
if (!in_macro && line ~ /^DECLARE_HOOK_FUNCNARG\(/) {
|
||||
buffer = line;
|
||||
kind = "narg";
|
||||
if (line ~ /\);[[:space:]]*$/) {
|
||||
sub(/\);[[:space:]]*$/, "", buffer);
|
||||
process(buffer, kind);
|
||||
}
|
||||
else
|
||||
in_macro = 1;
|
||||
next;
|
||||
}
|
||||
if (in_macro) {
|
||||
buffer = buffer " " line;
|
||||
if (line ~ /\);[[:space:]]*$/) {
|
||||
sub(/\);[[:space:]]*$/, "", buffer);
|
||||
process(buffer, kind);
|
||||
in_macro = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
END {
|
||||
printf("\n");
|
||||
}
|
||||
' "$APPLY_HOOK"
|
||||
|
||||
echo '#define HOOK_EXTERN'
|
||||
echo '#endif // HOOK_EXTERN'
|
||||
}
|
||||
@@ -1,24 +1,22 @@
|
||||
#!/bin/bash
|
||||
set -eu
|
||||
|
||||
SCRIPT_DIR=$(dirname "$0")
|
||||
SCRIPT_DIR=$(cd "$SCRIPT_DIR" && pwd)
|
||||
RIPPLED_ROOT="$SCRIPT_DIR/../include/xrpl"
|
||||
#/bin/bash
|
||||
RIPPLED_ROOT="../src/ripple"
|
||||
echo '// For documentation please see: https://xrpl-hooks.readme.io/reference/'
|
||||
echo '// Generated using generate_sfcodes.sh'
|
||||
cat $RIPPLED_ROOT/protocol/detail/sfields.macro | grep -E '^(TYPED_SFIELD|UNTYPED_SFIELD)' |
|
||||
cat $RIPPLED_ROOT/protocol/impl/SField.cpp | grep -E '^CONSTRUCT_' |
|
||||
sed 's/UINT16,/1,/g' |
|
||||
sed 's/UINT32,/2,/g' |
|
||||
sed 's/UINT64,/3,/g' |
|
||||
sed 's/HASH128,/4,/g' |
|
||||
sed 's/HASH256,/5,/g' |
|
||||
sed 's/UINT128,/4,/g' |
|
||||
sed 's/UINT256,/5,/g' |
|
||||
sed 's/AMOUNT,/6,/g' |
|
||||
sed 's/VL,/7,/g' |
|
||||
sed 's/ACCOUNT,/8,/g' |
|
||||
sed 's/NUMBER,/9,/g' |
|
||||
sed 's/OBJECT,/14,/g' |
|
||||
sed 's/ARRAY,/15,/g' |
|
||||
sed 's/UINT8,/16,/g' |
|
||||
sed 's/HASH160,/17,/g' |
|
||||
sed 's/UINT160,/17,/g' |
|
||||
sed 's/PATHSET,/18,/g' |
|
||||
sed 's/VECTOR256,/19,/g' |
|
||||
@@ -26,9 +24,6 @@ cat $RIPPLED_ROOT/protocol/detail/sfields.macro | grep -E '^(TYPED_SFIELD|UNTYPE
|
||||
sed 's/UINT192,/21,/g' |
|
||||
sed 's/UINT384,/22,/g' |
|
||||
sed 's/UINT512,/23,/g' |
|
||||
sed 's/ISSUE,/24,/g' |
|
||||
sed 's/XCHAIN_BRIDGE,/25,/g' |
|
||||
sed 's/CURRENCY,/26,/g' |
|
||||
grep -Eo '\(([^,]+), *([0-9]+), *([0-9]+)' |
|
||||
sed s/\(sf//g | sed 's/ *//g' | sed 's/,/ /g' |
|
||||
grep -Eo '"([^"]+)", *([0-9]+), *([0-9]+)' |
|
||||
sed 's/"//g' | sed 's/ *//g' | sed 's/,/ /g' |
|
||||
awk '{print ("#define sf"$1" (("$2"U << 16U) + "$3"U)")}'
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -eu
|
||||
|
||||
SCRIPT_DIR=$(dirname "$0")
|
||||
SCRIPT_DIR=$(cd "$SCRIPT_DIR" && pwd)
|
||||
|
||||
RIPPLED_ROOT="$SCRIPT_DIR/../include/xrpl"
|
||||
TX_FORMATS="$RIPPLED_ROOT/protocol/detail/transactions.macro"
|
||||
|
||||
echo '// For documentation please see: https://xrpl-hooks.readme.io/reference/'
|
||||
echo '// Generated using generate_tts.sh'
|
||||
cat "$TX_FORMATS" |
|
||||
awk '
|
||||
function ltrim(s) { sub(/^[[:space:]]+/, "", s); return s }
|
||||
function rtrim(s) { sub(/[[:space:]]+$/, "", s); return s }
|
||||
function trim(s) { return rtrim(ltrim(s)) }
|
||||
|
||||
/^TRANSACTION\(tt/ {
|
||||
line = $0
|
||||
sub(/^TRANSACTION\(/, "", line)
|
||||
|
||||
split(line, parts, ",")
|
||||
if (length(parts) < 2)
|
||||
next
|
||||
|
||||
name = trim(parts[1])
|
||||
value = trim(parts[2])
|
||||
if (name == "" || value == "")
|
||||
next
|
||||
|
||||
prefix = deprecated ? "// " : ""
|
||||
postfix = deprecated ? " // deprecated" : ""
|
||||
printf "%s#define %s %s%s\n", prefix, name, value, postfix
|
||||
}
|
||||
'
|
||||
@@ -37,7 +37,6 @@
|
||||
#define KEYLET_NFT_OFFER 23
|
||||
#define KEYLET_HOOK_DEFINITION 24
|
||||
#define KEYLET_HOOK_STATE_DIR 25
|
||||
#define KEYLET_CRON 26
|
||||
|
||||
#define COMPARE_EQUAL 1U
|
||||
#define COMPARE_LESS 2U
|
||||
|
||||
100
hook/sfcodes.h
100
hook/sfcodes.h
@@ -3,25 +3,18 @@
|
||||
#define sfCloseResolution ((16U << 16U) + 1U)
|
||||
#define sfMethod ((16U << 16U) + 2U)
|
||||
#define sfTransactionResult ((16U << 16U) + 3U)
|
||||
#define sfScale ((16U << 16U) + 4U)
|
||||
#define sfAssetScale ((16U << 16U) + 5U)
|
||||
#define sfTickSize ((16U << 16U) + 16U)
|
||||
#define sfUNLModifyDisabling ((16U << 16U) + 17U)
|
||||
#define sfHookResult ((16U << 16U) + 18U)
|
||||
#define sfWasLockingChainSend ((16U << 16U) + 19U)
|
||||
#define sfLedgerEntryType ((1U << 16U) + 1U)
|
||||
#define sfTransactionType ((1U << 16U) + 2U)
|
||||
#define sfSignerWeight ((1U << 16U) + 3U)
|
||||
#define sfTransferFee ((1U << 16U) + 4U)
|
||||
#define sfTradingFee ((1U << 16U) + 5U)
|
||||
#define sfDiscountedFee ((1U << 16U) + 6U)
|
||||
#define sfVersion ((1U << 16U) + 16U)
|
||||
#define sfHookStateChangeCount ((1U << 16U) + 17U)
|
||||
#define sfHookEmitCount ((1U << 16U) + 18U)
|
||||
#define sfHookExecutionIndex ((1U << 16U) + 19U)
|
||||
#define sfHookApiVersion ((1U << 16U) + 20U)
|
||||
#define sfHookStateScale ((1U << 16U) + 21U)
|
||||
#define sfLedgerFixType ((1U << 16U) + 22U)
|
||||
#define sfNetworkID ((2U << 16U) + 1U)
|
||||
#define sfFlags ((2U << 16U) + 2U)
|
||||
#define sfSourceTag ((2U << 16U) + 3U)
|
||||
@@ -36,7 +29,6 @@
|
||||
#define sfWalletSize ((2U << 16U) + 12U)
|
||||
#define sfOwnerCount ((2U << 16U) + 13U)
|
||||
#define sfDestinationTag ((2U << 16U) + 14U)
|
||||
#define sfLastUpdateTime ((2U << 16U) + 15U)
|
||||
#define sfHighQualityIn ((2U << 16U) + 16U)
|
||||
#define sfHighQualityOut ((2U << 16U) + 17U)
|
||||
#define sfLowQualityIn ((2U << 16U) + 18U)
|
||||
@@ -68,13 +60,8 @@
|
||||
#define sfBurnedNFTokens ((2U << 16U) + 44U)
|
||||
#define sfHookStateCount ((2U << 16U) + 45U)
|
||||
#define sfEmitGeneration ((2U << 16U) + 46U)
|
||||
#define sfVoteWeight ((2U << 16U) + 48U)
|
||||
#define sfLockCount ((2U << 16U) + 49U)
|
||||
#define sfFirstNFTokenSequence ((2U << 16U) + 50U)
|
||||
#define sfOracleDocumentID ((2U << 16U) + 51U)
|
||||
#define sfStartTime ((2U << 16U) + 93U)
|
||||
#define sfRepeatCount ((2U << 16U) + 94U)
|
||||
#define sfDelaySeconds ((2U << 16U) + 95U)
|
||||
#define sfXahauActivationLgrSeq ((2U << 16U) + 96U)
|
||||
#define sfImportSequence ((2U << 16U) + 97U)
|
||||
#define sfRewardTime ((2U << 16U) + 98U)
|
||||
@@ -96,15 +83,6 @@
|
||||
#define sfHookInstructionCount ((3U << 16U) + 17U)
|
||||
#define sfHookReturnCode ((3U << 16U) + 18U)
|
||||
#define sfReferenceCount ((3U << 16U) + 19U)
|
||||
#define sfXChainClaimID ((3U << 16U) + 20U)
|
||||
#define sfXChainAccountCreateCount ((3U << 16U) + 21U)
|
||||
#define sfXChainAccountClaimCount ((3U << 16U) + 22U)
|
||||
#define sfAssetPrice ((3U << 16U) + 23U)
|
||||
#define sfMaximumAmount ((3U << 16U) + 24U)
|
||||
#define sfOutstandingAmount ((3U << 16U) + 25U)
|
||||
#define sfMPTAmount ((3U << 16U) + 26U)
|
||||
#define sfIssuerNode ((3U << 16U) + 27U)
|
||||
#define sfSubjectNode ((3U << 16U) + 28U)
|
||||
#define sfTouchCount ((3U << 16U) + 97U)
|
||||
#define sfAccountIndex ((3U << 16U) + 98U)
|
||||
#define sfAccountCount ((3U << 16U) + 99U)
|
||||
@@ -114,7 +92,6 @@
|
||||
#define sfTakerPaysIssuer ((17U << 16U) + 2U)
|
||||
#define sfTakerGetsCurrency ((17U << 16U) + 3U)
|
||||
#define sfTakerGetsIssuer ((17U << 16U) + 4U)
|
||||
#define sfMPTokenIssuanceID ((21U << 16U) + 1U)
|
||||
#define sfLedgerHash ((5U << 16U) + 1U)
|
||||
#define sfParentHash ((5U << 16U) + 2U)
|
||||
#define sfTransactionHash ((5U << 16U) + 3U)
|
||||
@@ -128,8 +105,6 @@
|
||||
#define sfEmitParentTxnID ((5U << 16U) + 11U)
|
||||
#define sfEmitNonce ((5U << 16U) + 12U)
|
||||
#define sfEmitHookHash ((5U << 16U) + 13U)
|
||||
#define sfObjectID ((5U << 16U) + 14U)
|
||||
#define sfAMMID ((5U << 16U) + 15U)
|
||||
#define sfBookDirectory ((5U << 16U) + 16U)
|
||||
#define sfInvoiceID ((5U << 16U) + 17U)
|
||||
#define sfNickname ((5U << 16U) + 18U)
|
||||
@@ -151,14 +126,9 @@
|
||||
#define sfOfferID ((5U << 16U) + 34U)
|
||||
#define sfEscrowID ((5U << 16U) + 35U)
|
||||
#define sfURITokenID ((5U << 16U) + 36U)
|
||||
#define sfDomainID ((5U << 16U) + 37U)
|
||||
#define sfParentBatchID ((5U << 16U) + 38U)
|
||||
#define sfGovernanceFlags ((5U << 16U) + 99U)
|
||||
#define sfGovernanceMarks ((5U << 16U) + 98U)
|
||||
#define sfEmittedTxnID ((5U << 16U) + 97U)
|
||||
#define sfHookCanEmit ((5U << 16U) + 96U)
|
||||
#define sfCron ((5U << 16U) + 95U)
|
||||
#define sfNumber ((9U << 16U) + 1U)
|
||||
#define sfAmount ((6U << 16U) + 1U)
|
||||
#define sfBalance ((6U << 16U) + 2U)
|
||||
#define sfLimitAmount ((6U << 16U) + 3U)
|
||||
@@ -169,9 +139,6 @@
|
||||
#define sfFee ((6U << 16U) + 8U)
|
||||
#define sfSendMax ((6U << 16U) + 9U)
|
||||
#define sfDeliverMin ((6U << 16U) + 10U)
|
||||
#define sfAmount2 ((6U << 16U) + 11U)
|
||||
#define sfBidMin ((6U << 16U) + 12U)
|
||||
#define sfBidMax ((6U << 16U) + 13U)
|
||||
#define sfMinimumOffer ((6U << 16U) + 16U)
|
||||
#define sfRippleEscrow ((6U << 16U) + 17U)
|
||||
#define sfDeliveredAmount ((6U << 16U) + 18U)
|
||||
@@ -181,13 +148,6 @@
|
||||
#define sfBaseFeeDrops ((6U << 16U) + 22U)
|
||||
#define sfReserveBaseDrops ((6U << 16U) + 23U)
|
||||
#define sfReserveIncrementDrops ((6U << 16U) + 24U)
|
||||
#define sfLPTokenOut ((6U << 16U) + 25U)
|
||||
#define sfLPTokenIn ((6U << 16U) + 26U)
|
||||
#define sfEPrice ((6U << 16U) + 27U)
|
||||
#define sfPrice ((6U << 16U) + 28U)
|
||||
#define sfSignatureReward ((6U << 16U) + 29U)
|
||||
#define sfMinAccountCreateAmount ((6U << 16U) + 30U)
|
||||
#define sfLPTokenBalance ((6U << 16U) + 31U)
|
||||
#define sfPublicKey ((7U << 16U) + 1U)
|
||||
#define sfMessageKey ((7U << 16U) + 2U)
|
||||
#define sfSigningPubKey ((7U << 16U) + 3U)
|
||||
@@ -213,14 +173,6 @@
|
||||
#define sfHookParameterName ((7U << 16U) + 24U)
|
||||
#define sfHookParameterValue ((7U << 16U) + 25U)
|
||||
#define sfBlob ((7U << 16U) + 26U)
|
||||
#define sfDIDDocument ((7U << 16U) + 27U)
|
||||
#define sfData ((7U << 16U) + 28U)
|
||||
#define sfAssetClass ((7U << 16U) + 29U)
|
||||
#define sfProvider ((7U << 16U) + 30U)
|
||||
#define sfMPTokenMetadata ((7U << 16U) + 31U)
|
||||
#define sfCredentialType ((7U << 16U) + 32U)
|
||||
#define sfRemarkValue ((7U << 16U) + 98U)
|
||||
#define sfRemarkName ((7U << 16U) + 99U)
|
||||
#define sfAccount ((8U << 16U) + 1U)
|
||||
#define sfOwner ((8U << 16U) + 2U)
|
||||
#define sfDestination ((8U << 16U) + 3U)
|
||||
@@ -230,31 +182,15 @@
|
||||
#define sfRegularKey ((8U << 16U) + 8U)
|
||||
#define sfNFTokenMinter ((8U << 16U) + 9U)
|
||||
#define sfEmitCallback ((8U << 16U) + 10U)
|
||||
#define sfHolder ((8U << 16U) + 11U)
|
||||
#define sfHookAccount ((8U << 16U) + 16U)
|
||||
#define sfOtherChainSource ((8U << 16U) + 18U)
|
||||
#define sfOtherChainDestination ((8U << 16U) + 19U)
|
||||
#define sfAttestationSignerAccount ((8U << 16U) + 20U)
|
||||
#define sfAttestationRewardAccount ((8U << 16U) + 21U)
|
||||
#define sfLockingChainDoor ((8U << 16U) + 22U)
|
||||
#define sfIssuingChainDoor ((8U << 16U) + 23U)
|
||||
#define sfSubject ((8U << 16U) + 24U)
|
||||
#define sfInform ((8U << 16U) + 99U)
|
||||
#define sfIndexes ((19U << 16U) + 1U)
|
||||
#define sfHashes ((19U << 16U) + 2U)
|
||||
#define sfAmendments ((19U << 16U) + 3U)
|
||||
#define sfNFTokenOffers ((19U << 16U) + 4U)
|
||||
#define sfHookNamespaces ((19U << 16U) + 5U)
|
||||
#define sfCredentialIDs ((19U << 16U) + 6U)
|
||||
#define sfURITokenIDs ((19U << 16U) + 99U)
|
||||
#define sfPaths ((18U << 16U) + 1U)
|
||||
#define sfBaseAsset ((26U << 16U) + 1U)
|
||||
#define sfQuoteAsset ((26U << 16U) + 2U)
|
||||
#define sfLockingChainIssue ((24U << 16U) + 1U)
|
||||
#define sfIssuingChainIssue ((24U << 16U) + 2U)
|
||||
#define sfAsset ((24U << 16U) + 3U)
|
||||
#define sfAsset2 ((24U << 16U) + 4U)
|
||||
#define sfXChainBridge ((25U << 16U) + 1U)
|
||||
#define sfTransactionMetaData ((14U << 16U) + 2U)
|
||||
#define sfCreatedNode ((14U << 16U) + 3U)
|
||||
#define sfDeletedNode ((14U << 16U) + 4U)
|
||||
@@ -276,24 +212,12 @@
|
||||
#define sfHookDefinition ((14U << 16U) + 22U)
|
||||
#define sfHookParameter ((14U << 16U) + 23U)
|
||||
#define sfHookGrant ((14U << 16U) + 24U)
|
||||
#define sfVoteEntry ((14U << 16U) + 25U)
|
||||
#define sfAuctionSlot ((14U << 16U) + 26U)
|
||||
#define sfAuthAccount ((14U << 16U) + 27U)
|
||||
#define sfXChainClaimProofSig ((14U << 16U) + 28U)
|
||||
#define sfXChainCreateAccountProofSig ((14U << 16U) + 29U)
|
||||
#define sfXChainClaimAttestationCollectionElement ((14U << 16U) + 30U)
|
||||
#define sfXChainCreateAccountAttestationCollectionElement ((14U << 16U) + 31U)
|
||||
#define sfPriceData ((14U << 16U) + 32U)
|
||||
#define sfCredential ((14U << 16U) + 33U)
|
||||
#define sfRawTransaction ((14U << 16U) + 34U)
|
||||
#define sfBatchSigner ((14U << 16U) + 35U)
|
||||
#define sfAmountEntry ((14U << 16U) + 91U)
|
||||
#define sfMintURIToken ((14U << 16U) + 92U)
|
||||
#define sfHookEmission ((14U << 16U) + 93U)
|
||||
#define sfImportVLKey ((14U << 16U) + 94U)
|
||||
#define sfActiveValidator ((14U << 16U) + 95U)
|
||||
#define sfGenesisMint ((14U << 16U) + 96U)
|
||||
#define sfRemark ((14U << 16U) + 97U)
|
||||
#define sfActiveValidator ((14U << 16U) + 95U)
|
||||
#define sfImportVLKey ((14U << 16U) + 94U)
|
||||
#define sfHookEmission ((14U << 16U) + 93U)
|
||||
#define sfMintURIToken ((14U << 16U) + 92U)
|
||||
#define sfAmountEntry ((14U << 16U) + 91U)
|
||||
#define sfSigners ((15U << 16U) + 3U)
|
||||
#define sfSignerEntries ((15U << 16U) + 4U)
|
||||
#define sfTemplate ((15U << 16U) + 5U)
|
||||
@@ -303,25 +227,13 @@
|
||||
#define sfMemos ((15U << 16U) + 9U)
|
||||
#define sfNFTokens ((15U << 16U) + 10U)
|
||||
#define sfHooks ((15U << 16U) + 11U)
|
||||
#define sfVoteSlots ((15U << 16U) + 12U)
|
||||
#define sfMajorities ((15U << 16U) + 16U)
|
||||
#define sfDisabledValidators ((15U << 16U) + 17U)
|
||||
#define sfHookExecutions ((15U << 16U) + 18U)
|
||||
#define sfHookParameters ((15U << 16U) + 19U)
|
||||
#define sfHookGrants ((15U << 16U) + 20U)
|
||||
#define sfXChainClaimAttestations ((15U << 16U) + 21U)
|
||||
#define sfXChainCreateAccountAttestations ((15U << 16U) + 22U)
|
||||
#define sfPriceDataSeries ((15U << 16U) + 24U)
|
||||
#define sfAuthAccounts ((15U << 16U) + 25U)
|
||||
#define sfAuthorizeCredentials ((15U << 16U) + 26U)
|
||||
#define sfUnauthorizeCredentials ((15U << 16U) + 27U)
|
||||
#define sfAcceptedCredentials ((15U << 16U) + 28U)
|
||||
#define sfPermissions ((15U << 16U) + 29U)
|
||||
#define sfRawTransactions ((15U << 16U) + 30U)
|
||||
#define sfBatchSigners ((15U << 16U) + 31U)
|
||||
#define sfRemarks ((15U << 16U) + 97U)
|
||||
#define sfGenesisMints ((15U << 16U) + 96U)
|
||||
#define sfActiveValidators ((15U << 16U) + 95U)
|
||||
#define sfImportVLKeys ((15U << 16U) + 94U)
|
||||
#define sfHookEmissions ((15U << 16U) + 93U)
|
||||
#define sfAmounts ((15U << 16U) + 92U)
|
||||
#define sfAmounts ((15U << 16U) + 92U)
|
||||
40
hook/tts.h
40
hook/tts.h
@@ -1,14 +1,15 @@
|
||||
// For documentation please see: https://xrpl-hooks.readme.io/reference/
|
||||
// Generated using generate_tts.sh
|
||||
#define ttPAYMENT 0
|
||||
#define ttESCROW_CREATE 1
|
||||
#define ttESCROW_FINISH 2
|
||||
#define ttACCOUNT_SET 3
|
||||
#define ttESCROW_CANCEL 4
|
||||
#define ttREGULAR_KEY_SET 5
|
||||
// #define ttNICKNAME_SET 6 // deprecated
|
||||
#define ttOFFER_CREATE 7
|
||||
#define ttOFFER_CANCEL 8
|
||||
#define ttTICKET_CREATE 10
|
||||
// #define ttSPINAL_TAP 11 // deprecated
|
||||
#define ttSIGNER_LIST_SET 12
|
||||
#define ttPAYCHAN_CREATE 13
|
||||
#define ttPAYCHAN_FUND 14
|
||||
@@ -25,46 +26,11 @@
|
||||
#define ttNFTOKEN_CREATE_OFFER 27
|
||||
#define ttNFTOKEN_CANCEL_OFFER 28
|
||||
#define ttNFTOKEN_ACCEPT_OFFER 29
|
||||
#define ttCLAWBACK 30
|
||||
#define ttAMM_CLAWBACK 31
|
||||
#define ttAMM_CREATE 35
|
||||
#define ttAMM_DEPOSIT 36
|
||||
#define ttAMM_WITHDRAW 37
|
||||
#define ttAMM_VOTE 38
|
||||
#define ttAMM_BID 39
|
||||
#define ttAMM_DELETE 40
|
||||
#define ttURITOKEN_MINT 45
|
||||
#define ttURITOKEN_BURN 46
|
||||
#define ttURITOKEN_BUY 47
|
||||
#define ttURITOKEN_CREATE_SELL_OFFER 48
|
||||
#define ttURITOKEN_CANCEL_SELL_OFFER 49
|
||||
#define ttXCHAIN_CREATE_CLAIM_ID 50
|
||||
#define ttXCHAIN_COMMIT 51
|
||||
#define ttXCHAIN_CLAIM 52
|
||||
#define ttXCHAIN_ACCOUNT_CREATE_COMMIT 53
|
||||
#define ttXCHAIN_ADD_CLAIM_ATTESTATION 54
|
||||
#define ttXCHAIN_ADD_ACCOUNT_CREATE_ATTESTATION 55
|
||||
#define ttXCHAIN_MODIFY_BRIDGE 56
|
||||
#define ttXCHAIN_CREATE_BRIDGE 57
|
||||
#define ttDID_SET 58
|
||||
#define ttDID_DELETE 59
|
||||
#define ttORACLE_SET 60
|
||||
#define ttORACLE_DELETE 61
|
||||
#define ttLEDGER_STATE_FIX 62
|
||||
#define ttMPTOKEN_ISSUANCE_CREATE 63
|
||||
#define ttMPTOKEN_ISSUANCE_DESTROY 64
|
||||
#define ttMPTOKEN_ISSUANCE_SET 65
|
||||
#define ttMPTOKEN_AUTHORIZE 66
|
||||
#define ttCREDENTIAL_CREATE 67
|
||||
#define ttCREDENTIAL_ACCEPT 68
|
||||
#define ttCREDENTIAL_DELETE 69
|
||||
#define ttNFTOKEN_MODIFY 70
|
||||
#define ttPERMISSIONED_DOMAIN_SET 71
|
||||
#define ttPERMISSIONED_DOMAIN_DELETE 72
|
||||
#define ttBATCH 73
|
||||
#define ttCRON 92
|
||||
#define ttCRON_SET 93
|
||||
#define ttREMARKS_SET 94
|
||||
#define ttREMIT 95
|
||||
#define ttGENESIS_MINT 96
|
||||
#define ttIMPORT 97
|
||||
@@ -74,4 +40,4 @@
|
||||
#define ttFEE 101
|
||||
#define ttUNL_MODIFY 102
|
||||
#define ttEMIT_FAILURE 103
|
||||
#define ttUNL_REPORT 104
|
||||
#define ttUNL_REPORT 104
|
||||
@@ -253,22 +253,13 @@ private:
|
||||
// Wraps a Journal::Stream to skip evaluation of
|
||||
// expensive argument lists if the stream is not active.
|
||||
#ifndef JLOG
|
||||
#ifdef BEAST_ENHANCED_LOGGING
|
||||
#define JLOG(x) \
|
||||
if (!(x)) \
|
||||
{ \
|
||||
} \
|
||||
else \
|
||||
(x).withLocation(__FILE__, __LINE__)
|
||||
#else
|
||||
#define JLOG(x) \
|
||||
if (!(x)) \
|
||||
if (!x) \
|
||||
{ \
|
||||
} \
|
||||
else \
|
||||
x
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef CLOG
|
||||
#define CLOG(ss) \
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_UTILITY_ENHANCEDLOGGING_H_INCLUDED
|
||||
#define BEAST_UTILITY_ENHANCEDLOGGING_H_INCLUDED
|
||||
|
||||
#include <cstddef> // for size_t
|
||||
#include <iosfwd> // for std::ostream
|
||||
|
||||
namespace beast {
|
||||
namespace detail {
|
||||
|
||||
// Check if we should use colors - cached at startup
|
||||
bool
|
||||
should_log_use_colors();
|
||||
|
||||
// Get the log highlight color - can be overridden via
|
||||
// LOG_HIGHLIGHT_COLOR
|
||||
const char*
|
||||
get_log_highlight_color();
|
||||
|
||||
// Strip source root path from __FILE__ at compile time
|
||||
// IMPORTANT: This MUST stay in the header as constexpr for compile-time
|
||||
// evaluation!
|
||||
constexpr const char*
|
||||
strip_source_root(const char* file)
|
||||
{
|
||||
// Handle relative paths from build/ directory (common with ccache)
|
||||
// e.g., "../src/ripple/..." -> "ripple/..."
|
||||
if (file && file[0] == '.' && file[1] == '.' && file[2] == '/' &&
|
||||
file[3] == 's' && file[4] == 'r' && file[5] == 'c' && file[6] == '/')
|
||||
{
|
||||
return file + 7; // skip "../src/"
|
||||
}
|
||||
|
||||
#ifdef SOURCE_ROOT_PATH
|
||||
constexpr const char* sourceRoot = SOURCE_ROOT_PATH;
|
||||
constexpr auto strlen_constexpr = [](const char* s) constexpr {
|
||||
const char* p = s;
|
||||
while (*p)
|
||||
++p;
|
||||
return p - s;
|
||||
};
|
||||
constexpr auto strncmp_constexpr =
|
||||
[](const char* a, const char* b, size_t n) constexpr {
|
||||
for (size_t i = 0; i < n; ++i)
|
||||
{
|
||||
if (a[i] != b[i])
|
||||
return a[i] - b[i];
|
||||
if (a[i] == '\0')
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
constexpr size_t sourceRootLen = strlen_constexpr(sourceRoot);
|
||||
return (strncmp_constexpr(file, sourceRoot, sourceRootLen) == 0)
|
||||
? file + sourceRootLen
|
||||
: file;
|
||||
#else
|
||||
return file;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Check if location info should be shown - cached at startup
|
||||
bool
|
||||
should_show_location();
|
||||
|
||||
// Helper to write location string (no leading/trailing space)
|
||||
void
|
||||
log_write_location_string(std::ostream& os, const char* file, int line);
|
||||
|
||||
} // namespace detail
|
||||
} // namespace beast
|
||||
|
||||
#endif
|
||||
@@ -155,10 +155,6 @@ public:
|
||||
|
||||
ScopedStream(Sink& sink, Severity level);
|
||||
|
||||
#ifdef BEAST_ENHANCED_LOGGING
|
||||
ScopedStream(Sink& sink, Severity level, const char* file, int line);
|
||||
#endif
|
||||
|
||||
template <typename T>
|
||||
ScopedStream(Stream const& stream, T const& t);
|
||||
|
||||
@@ -186,10 +182,6 @@ public:
|
||||
Sink& m_sink;
|
||||
Severity const m_level;
|
||||
std::ostringstream mutable m_ostream;
|
||||
#ifdef BEAST_ENHANCED_LOGGING
|
||||
const char* file_ = nullptr;
|
||||
int line_ = 0;
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifndef __INTELLISENSE__
|
||||
@@ -208,33 +200,6 @@ public:
|
||||
//--------------------------------------------------------------------------
|
||||
public:
|
||||
/** Provide a light-weight way to check active() before string formatting */
|
||||
|
||||
#ifdef BEAST_ENHANCED_LOGGING
|
||||
/** Stream with location information that prepends file:line to the first
|
||||
* message */
|
||||
class StreamWithLocation
|
||||
{
|
||||
public:
|
||||
StreamWithLocation(Stream const& stream, const char* file, int line)
|
||||
: file_(file), line_(line), stream_(stream)
|
||||
{
|
||||
}
|
||||
|
||||
/** Override to inject file:line before the first output */
|
||||
template <typename T>
|
||||
ScopedStream
|
||||
operator<<(T const& t) const;
|
||||
|
||||
ScopedStream
|
||||
operator<<(std::ostream& manip(std::ostream&)) const;
|
||||
|
||||
private:
|
||||
const char* file_;
|
||||
int line_;
|
||||
const Stream& stream_;
|
||||
};
|
||||
#endif
|
||||
|
||||
class Stream
|
||||
{
|
||||
public:
|
||||
@@ -302,15 +267,6 @@ public:
|
||||
operator<<(T const& t) const;
|
||||
/** @} */
|
||||
|
||||
#ifdef BEAST_ENHANCED_LOGGING
|
||||
/** Create a StreamWithLocation that prepends file:line info */
|
||||
StreamWithLocation
|
||||
withLocation(const char* file, int line) const
|
||||
{
|
||||
return StreamWithLocation(*this, file, line);
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
Sink& m_sink;
|
||||
Severity m_level;
|
||||
@@ -410,8 +366,6 @@ static_assert(std::is_nothrow_destructible<Journal>::value == true, "");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template <typename T>
|
||||
Journal::ScopedStream::ScopedStream(Journal::Stream const& stream, T const& t)
|
||||
: ScopedStream(stream.sink(), stream.level())
|
||||
@@ -436,21 +390,6 @@ Journal::Stream::operator<<(T const& t) const
|
||||
return ScopedStream(*this, t);
|
||||
}
|
||||
|
||||
#ifdef BEAST_ENHANCED_LOGGING
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template <typename T>
|
||||
Journal::ScopedStream
|
||||
Journal::StreamWithLocation::operator<<(T const& t) const
|
||||
{
|
||||
// Create a ScopedStream with location info
|
||||
ScopedStream scoped(stream_.sink(), stream_.level(), file_, line_);
|
||||
scoped.ostream() << t;
|
||||
return scoped;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <class CharT, class Traits = std::char_traits<CharT>>
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <string>
|
||||
@@ -29,8 +28,6 @@ enum HookEmissionFlags : uint16_t {
|
||||
};
|
||||
} // namespace ripple
|
||||
|
||||
using namespace ripple;
|
||||
|
||||
namespace hook {
|
||||
// RH TODO: put these somewhere better, and allow rules to be fed in
|
||||
inline uint32_t
|
||||
@@ -45,26 +42,10 @@ maxHookParameterValueSize(void)
|
||||
return 256;
|
||||
}
|
||||
|
||||
inline uint16_t
|
||||
maxHookStateScale(void)
|
||||
{
|
||||
return 16;
|
||||
}
|
||||
|
||||
inline uint32_t
|
||||
maxHookStateDataSize(uint16_t hookStateScale)
|
||||
maxHookStateDataSize(void)
|
||||
{
|
||||
if (hookStateScale == 0)
|
||||
{
|
||||
// should not happen, but just in case
|
||||
return 256U;
|
||||
}
|
||||
if (hookStateScale > maxHookStateScale())
|
||||
{
|
||||
// should not happen, but just in case
|
||||
return 256 * maxHookStateScale();
|
||||
}
|
||||
return 256U * hookStateScale;
|
||||
return 256U;
|
||||
}
|
||||
|
||||
inline uint32_t
|
||||
@@ -278,7 +259,8 @@ enum keylet_code : uint32_t {
|
||||
NFT_OFFER = 23,
|
||||
HOOK_DEFINITION = 24,
|
||||
HOOK_STATE_DIR = 25,
|
||||
CRON = 26
|
||||
LAST_KLTYPE_V0 = HOOK_DEFINITION,
|
||||
LAST_KLTYPE_V1 = HOOK_STATE_DIR,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -367,110 +349,90 @@ const uint8_t max_emit = 255;
|
||||
const uint8_t max_params = 16;
|
||||
const double fee_base_multiplier = 1.1f;
|
||||
|
||||
#define I32 0x7FU
|
||||
#define I64 0x7EU
|
||||
|
||||
#define HOOK_WRAP_PARAMS(...) __VA_ARGS__
|
||||
#define HOOK_API_DEFINITION(RETURN_TYPE, FUNCTION_NAME, PARAMS_TUPLE) \
|
||||
{ \
|
||||
#FUNCTION_NAME, \
|
||||
{ \
|
||||
RETURN_TYPE, HOOK_WRAP_PARAMS PARAMS_TUPLE \
|
||||
} \
|
||||
}
|
||||
|
||||
using APIWhitelist = std::map<std::string, std::vector<uint8_t>>;
|
||||
|
||||
// RH NOTE: Find descriptions of api functions in ./impl/applyHook.cpp and
|
||||
// hookapi.h (include for hooks) this is a map of the api name to its return
|
||||
// code (vec[0] and its parameters vec[>0]) as wasm type codes
|
||||
static const APIWhitelist import_whitelist{
|
||||
// clang-format off
|
||||
HOOK_API_DEFINITION(I32, _g, (I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, accept, (I32, I32, I64)),
|
||||
HOOK_API_DEFINITION(I64, rollback, (I32, I32, I64)),
|
||||
HOOK_API_DEFINITION(I64, util_raddr, (I32, I32, I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, util_accid, (I32, I32, I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, util_verify, (I32, I32, I32, I32, I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, util_sha512h, (I32, I32, I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, util_keylet, (I32, I32, I32, I32, I32, I32, I32, I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, sto_validate, (I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, sto_subfield, (I32, I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, sto_subarray, (I32, I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, sto_emplace, (I32, I32, I32, I32, I32, I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, sto_erase, (I32, I32, I32, I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, etxn_burden, ()),
|
||||
HOOK_API_DEFINITION(I64, etxn_details, (I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, etxn_fee_base, (I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, etxn_reserve, (I32)),
|
||||
HOOK_API_DEFINITION(I64, etxn_generation, ()),
|
||||
HOOK_API_DEFINITION(I64, etxn_nonce, (I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, emit, (I32, I32, I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, float_set, (I32, I64)),
|
||||
HOOK_API_DEFINITION(I64, float_multiply, (I64, I64)),
|
||||
HOOK_API_DEFINITION(I64, float_mulratio, (I64, I32, I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, float_negate, (I64)),
|
||||
HOOK_API_DEFINITION(I64, float_compare, (I64, I64, I32)),
|
||||
HOOK_API_DEFINITION(I64, float_sum, (I64, I64)),
|
||||
HOOK_API_DEFINITION(I64, float_sto, (I32, I32, I32, I32, I32, I32, I64, I32)),
|
||||
HOOK_API_DEFINITION(I64, float_sto_set, (I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, float_invert, (I64)),
|
||||
HOOK_API_DEFINITION(I64, float_divide, (I64, I64)),
|
||||
HOOK_API_DEFINITION(I64, float_one, ()),
|
||||
HOOK_API_DEFINITION(I64, float_mantissa, (I64)),
|
||||
HOOK_API_DEFINITION(I64, float_sign, (I64)),
|
||||
HOOK_API_DEFINITION(I64, float_int, (I64, I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, float_log, (I64)),
|
||||
HOOK_API_DEFINITION(I64, float_root, (I64, I32)),
|
||||
HOOK_API_DEFINITION(I64, fee_base, ()),
|
||||
HOOK_API_DEFINITION(I64, ledger_seq, ()),
|
||||
HOOK_API_DEFINITION(I64, ledger_last_time, ()),
|
||||
HOOK_API_DEFINITION(I64, ledger_last_hash, (I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, ledger_nonce, (I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, ledger_keylet, (I32, I32, I32, I32, I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, hook_account, (I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, hook_hash, (I32, I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, hook_param_set, (I32, I32, I32, I32, I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, hook_param, (I32, I32, I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, hook_again, ()),
|
||||
HOOK_API_DEFINITION(I64, hook_skip, (I32, I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, hook_pos, ()),
|
||||
HOOK_API_DEFINITION(I64, slot, (I32, I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, slot_clear, (I32)),
|
||||
HOOK_API_DEFINITION(I64, slot_count, (I32)),
|
||||
HOOK_API_DEFINITION(I64, slot_set, (I32, I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, slot_size, (I32)),
|
||||
HOOK_API_DEFINITION(I64, slot_subarray, (I32, I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, slot_subfield, (I32, I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, slot_type, (I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, slot_float, (I32)),
|
||||
HOOK_API_DEFINITION(I64, state_set, (I32, I32, I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, state_foreign_set, (I32, I32, I32, I32, I32, I32, I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, state, (I32, I32, I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, state_foreign, (I32, I32, I32, I32, I32, I32, I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, trace, (I32, I32, I32, I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, trace_num, (I32, I32, I64)),
|
||||
HOOK_API_DEFINITION(I64, trace_float, (I32, I32, I64)),
|
||||
HOOK_API_DEFINITION(I64, otxn_burden, ()),
|
||||
HOOK_API_DEFINITION(I64, otxn_field, (I32, I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, otxn_generation, ()),
|
||||
HOOK_API_DEFINITION(I64, otxn_id, (I32, I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, otxn_type, ()),
|
||||
HOOK_API_DEFINITION(I64, otxn_slot, (I32)),
|
||||
HOOK_API_DEFINITION(I64, otxn_param, (I32, I32, I32, I32)),
|
||||
HOOK_API_DEFINITION(I64, meta_slot, (I32)),
|
||||
// clang-format on
|
||||
};
|
||||
static const std::map<std::string, std::vector<uint8_t>> import_whitelist{
|
||||
{"_g", {0x7FU, 0x7FU, 0x7FU}},
|
||||
{"accept", {0x7EU, 0x7FU, 0x7FU, 0x7EU}},
|
||||
{"rollback", {0x7EU, 0x7FU, 0x7FU, 0x7EU}},
|
||||
{"util_raddr", {0x7EU, 0x7FU, 0x7FU, 0x7FU, 0x7FU}},
|
||||
{"util_accid", {0x7EU, 0x7FU, 0x7FU, 0x7FU, 0x7FU}},
|
||||
{"util_verify", {0x7EU, 0x7FU, 0x7FU, 0x7FU, 0x7FU, 0x7FU, 0x7FU}},
|
||||
{"util_sha512h", {0x7EU, 0x7FU, 0x7FU, 0x7FU, 0x7FU}},
|
||||
{"util_keylet",
|
||||
{0x7EU, 0x7FU, 0x7FU, 0x7FU, 0x7FU, 0x7FU, 0x7FU, 0x7FU, 0x7FU, 0x7FU}},
|
||||
{"sto_validate", {0x7EU, 0x7FU, 0x7FU}},
|
||||
{"sto_subfield", {0x7EU, 0x7FU, 0x7FU, 0x7FU}},
|
||||
{"sto_subarray", {0x7EU, 0x7FU, 0x7FU, 0x7FU}},
|
||||
{"sto_emplace", {0x7EU, 0x7FU, 0x7FU, 0x7FU, 0x7FU, 0x7FU, 0x7FU, 0x7FU}},
|
||||
{"sto_erase", {0x7EU, 0x7FU, 0x7FU, 0x7FU, 0x7FU, 0x7FU}},
|
||||
{"etxn_burden", {0x7EU}},
|
||||
{"etxn_details", {0x7EU, 0x7FU, 0x7FU}},
|
||||
{"etxn_fee_base", {0x7EU, 0x7FU, 0x7FU}},
|
||||
{"etxn_reserve", {0x7EU, 0x7FU}},
|
||||
{"etxn_generation", {0x7EU}},
|
||||
{"etxn_nonce", {0x7EU, 0x7FU, 0x7FU}},
|
||||
{"emit", {0x7EU, 0x7FU, 0x7FU, 0x7FU, 0x7FU}},
|
||||
{"float_set", {0x7EU, 0x7FU, 0x7EU}},
|
||||
{"float_multiply", {0x7EU, 0x7EU, 0x7EU}},
|
||||
{"float_mulratio", {0x7EU, 0x7EU, 0x7FU, 0x7FU, 0x7FU}},
|
||||
{"float_negate", {0x7EU, 0x7EU}},
|
||||
{"float_compare", {0x7EU, 0x7EU, 0x7EU, 0x7FU}},
|
||||
{"float_sum", {0x7EU, 0x7EU, 0x7EU}},
|
||||
{"float_sto",
|
||||
{0x7EU, 0x7FU, 0x7FU, 0x7FU, 0x7FU, 0x7FU, 0x7FU, 0x7EU, 0x7FU}},
|
||||
{"float_sto_set", {0x7EU, 0x7FU, 0x7FU}},
|
||||
{"float_invert", {0x7EU, 0x7EU}},
|
||||
{"float_divide", {0x7EU, 0x7EU, 0x7EU}},
|
||||
{"float_one", {0x7EU}},
|
||||
{"float_mantissa", {0x7EU, 0x7EU}},
|
||||
{"float_sign", {0x7EU, 0x7EU}},
|
||||
{"float_int", {0x7EU, 0x7EU, 0x7FU, 0x7FU}},
|
||||
{"float_log", {0x7EU, 0x7EU}},
|
||||
{"float_root", {0x7EU, 0x7EU, 0x7FU}},
|
||||
{"fee_base", {0x7EU}},
|
||||
{"ledger_seq", {0x7EU}},
|
||||
{"ledger_last_time", {0x7EU}},
|
||||
{"ledger_last_hash", {0x7EU, 0x7FU, 0x7FU}},
|
||||
{"ledger_nonce", {0x7EU, 0x7FU, 0x7FU}},
|
||||
{"ledger_keylet", {0x7EU, 0x7FU, 0x7FU, 0x7FU, 0x7FU, 0x7FU, 0x7FU}},
|
||||
{"hook_account", {0x7EU, 0x7FU, 0x7FU}},
|
||||
{"hook_hash", {0x7EU, 0x7FU, 0x7FU, 0x7FU}},
|
||||
{"hook_param_set", {0x7EU, 0x7FU, 0x7FU, 0x7FU, 0x7FU, 0x7FU, 0x7FU}},
|
||||
{"hook_param", {0x7EU, 0x7FU, 0x7FU, 0x7FU, 0x7FU}},
|
||||
{"hook_again", {0x7EU}},
|
||||
{"hook_skip", {0x7EU, 0x7FU, 0x7FU, 0x7FU}},
|
||||
{"hook_pos", {0x7EU}},
|
||||
{"slot", {0x7EU, 0x7FU, 0x7FU, 0x7FU}},
|
||||
{"slot_clear", {0x7EU, 0x7FU}},
|
||||
{"slot_count", {0x7EU, 0x7FU}},
|
||||
{"slot_set", {0x7EU, 0x7FU, 0x7FU, 0x7FU}},
|
||||
{"slot_size", {0x7EU, 0x7FU}},
|
||||
{"slot_subarray", {0x7EU, 0x7FU, 0x7FU, 0x7FU}},
|
||||
{"slot_subfield", {0x7EU, 0x7FU, 0x7FU, 0x7FU}},
|
||||
{"slot_type", {0x7EU, 0x7FU, 0x7FU}},
|
||||
{"slot_float", {0x7EU, 0x7FU}},
|
||||
{"state_set", {0x7EU, 0x7FU, 0x7FU, 0x7FU, 0x7FU}},
|
||||
{"state_foreign_set",
|
||||
{0x7EU, 0x7FU, 0x7FU, 0x7FU, 0x7FU, 0x7FU, 0x7FU, 0x7FU, 0x7FU}},
|
||||
{"state", {0x7EU, 0x7FU, 0x7FU, 0x7FU, 0x7FU}},
|
||||
{"state_foreign",
|
||||
{0x7EU, 0x7FU, 0x7FU, 0x7FU, 0x7FU, 0x7FU, 0x7FU, 0x7FU, 0x7FU}},
|
||||
{"trace", {0x7EU, 0x7FU, 0x7FU, 0x7FU, 0x7FU, 0x7FU}},
|
||||
{"trace_num", {0x7EU, 0x7FU, 0x7FU, 0x7EU}},
|
||||
{"trace_float", {0x7EU, 0x7FU, 0x7FU, 0x7EU}},
|
||||
{"otxn_burden", {0x7EU}},
|
||||
{"otxn_field", {0x7EU, 0x7FU, 0x7FU, 0x7FU}},
|
||||
{"otxn_generation", {0x7EU}},
|
||||
{"otxn_id", {0x7EU, 0x7FU, 0x7FU, 0x7FU}},
|
||||
{"otxn_type", {0x7EU}},
|
||||
{"otxn_slot", {0x7EU, 0x7FU}},
|
||||
{"otxn_param", {0x7EU, 0x7FU, 0x7FU, 0x7FU, 0x7FU}},
|
||||
{"meta_slot", {0x7EU, 0x7FU}}};
|
||||
|
||||
// featureHooks1
|
||||
static const APIWhitelist import_whitelist_1{
|
||||
// clang-format off
|
||||
HOOK_API_DEFINITION(I64, xpop_slot, (I32, I32)),
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
#undef HOOK_API_DEFINITION
|
||||
#undef I32
|
||||
#undef I64
|
||||
static const std::map<std::string, std::vector<uint8_t>> import_whitelist_1{
|
||||
{"xpop_slot", {0x7EU, 0x7FU, 0x7FU}}};
|
||||
}; // namespace hook_api
|
||||
#endif
|
||||
|
||||
@@ -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
|
||||
@@ -80,7 +80,7 @@ namespace detail {
|
||||
// Feature.cpp. Because it's only used to reserve storage, and determine how
|
||||
// large to make the FeatureBitset, it MAY be larger. It MUST NOT be less than
|
||||
// the actual number of amendments. A LogicError on startup will verify this.
|
||||
static constexpr std::size_t numFeatures = 111;
|
||||
static constexpr std::size_t numFeatures = 110;
|
||||
|
||||
/** Amendments that this server supports and the default voting behavior.
|
||||
Whether they are enabled depends on the Rules defined in the validated
|
||||
|
||||
@@ -96,9 +96,6 @@ enum class HashPrefix : std::uint32_t {
|
||||
|
||||
/** Credentials signature */
|
||||
credential = detail::make_hash_prefix('C', 'R', 'D'),
|
||||
|
||||
/** Batch */
|
||||
batch = detail::make_hash_prefix('B', 'C', 'H'),
|
||||
};
|
||||
|
||||
template <class Hasher>
|
||||
|
||||
@@ -306,9 +306,6 @@ import_vlseq(PublicKey const& key) noexcept;
|
||||
Keylet
|
||||
uritoken(AccountID const& issuer, Blob const& uri);
|
||||
|
||||
Keylet
|
||||
cron(uint32_t timestamp, std::optional<AccountID> const& id = std::nullopt);
|
||||
|
||||
/** AMM entry */
|
||||
Keylet
|
||||
amm(Asset const& issue1, Asset const& issue2) noexcept;
|
||||
|
||||
@@ -147,8 +147,9 @@ enum LedgerSpecificFlags {
|
||||
0x40000000, // True, has minted tokens in the past
|
||||
lsfDisallowIncomingRemit = // True, no remits allowed to this account
|
||||
0x80000000,
|
||||
lsfAllowTrustLineClawback =
|
||||
0x00001000, // True, enable clawback
|
||||
// 0x0004000 is available
|
||||
lsfAllowTrustLineClawback =
|
||||
0x00008000, // True, enable clawback
|
||||
|
||||
// ltOFFER
|
||||
lsfPassive = 0x00010000,
|
||||
@@ -163,10 +164,10 @@ enum LedgerSpecificFlags {
|
||||
lsfHighNoRipple = 0x00200000,
|
||||
lsfLowFreeze = 0x00400000, // True, low side has set freeze flag
|
||||
lsfHighFreeze = 0x00800000, // True, high side has set freeze flag
|
||||
lsfAMMNode = 0x01000000, // True, trust line to AMM. Used by client
|
||||
// apps to identify payments via AMM.
|
||||
lsfLowDeepFreeze = 0x02000000, // True, low side has set deep freeze flag
|
||||
lsfHighDeepFreeze = 0x04000000, // True, high side has set deep freeze flag
|
||||
lsfAMMNode = 0x01000000, // True, trust line to AMM. Used by client
|
||||
// apps to identify payments via AMM.
|
||||
|
||||
// ltSIGNER_LIST
|
||||
lsfOneOwnerCount = 0x00010000, // True, uses only one OwnerCount
|
||||
|
||||
@@ -154,13 +154,6 @@ std::size_t constexpr maxPriceScale = 20;
|
||||
*/
|
||||
std::size_t constexpr maxTrim = 25;
|
||||
|
||||
/** The maximum number of delegate permissions an account can grant
|
||||
*/
|
||||
std::size_t constexpr permissionMaxSize = 10;
|
||||
|
||||
/** The maximum number of transactions that can be in a batch. */
|
||||
std::size_t constexpr maxBatchTxCount = 8;
|
||||
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -120,16 +120,10 @@ public:
|
||||
@return `true` if valid signature. If invalid, the error message string.
|
||||
*/
|
||||
enum class RequireFullyCanonicalSig : bool { no, yes };
|
||||
|
||||
Expected<void, std::string>
|
||||
checkSign(RequireFullyCanonicalSig requireCanonicalSig, Rules const& rules)
|
||||
const;
|
||||
|
||||
Expected<void, std::string>
|
||||
checkBatchSign(
|
||||
RequireFullyCanonicalSig requireCanonicalSig,
|
||||
Rules const& rules) const;
|
||||
|
||||
// SQL Functions with metadata.
|
||||
static std::string const&
|
||||
getMetaSQLInsertReplaceHeader();
|
||||
@@ -145,9 +139,6 @@ public:
|
||||
char status,
|
||||
std::string const& escapedMetaData) const;
|
||||
|
||||
std::vector<uint256>
|
||||
getBatchTransactionIDs() const;
|
||||
|
||||
private:
|
||||
Expected<void, std::string>
|
||||
checkSingleSign(RequireFullyCanonicalSig requireCanonicalSig) const;
|
||||
@@ -157,24 +148,12 @@ private:
|
||||
RequireFullyCanonicalSig requireCanonicalSig,
|
||||
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*
|
||||
copy(std::size_t n, void* buf) const override;
|
||||
STBase*
|
||||
move(std::size_t n, void* buf) override;
|
||||
|
||||
friend class detail::STVar;
|
||||
mutable std::vector<uint256> batch_txn_ids_;
|
||||
};
|
||||
|
||||
bool
|
||||
|
||||
@@ -143,8 +143,8 @@ enum TEMcodes : TERUnderlyingType {
|
||||
|
||||
temARRAY_EMPTY,
|
||||
temARRAY_TOO_LARGE,
|
||||
|
||||
temBAD_TRANSFER_FEE,
|
||||
temINVALID_INNER_BATCH,
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -348,20 +348,19 @@ enum TECcodes : TERUnderlyingType {
|
||||
tecXCHAIN_PAYMENT_FAILED = 184,
|
||||
tecXCHAIN_SELF_COMMIT = 185,
|
||||
tecXCHAIN_CREATE_ACCOUNT_DISABLED = 186,
|
||||
tecXCHAIN_BAD_PUBLIC_KEY_ACCOUNT_PAIR = 192,
|
||||
tecXCHAIN_BAD_PUBLIC_KEY_ACCOUNT_PAIR = 191,
|
||||
tecINSUF_RESERVE_SELLER = 187,
|
||||
tecIMMUTABLE = 188,
|
||||
tecTOO_MANY_REMARKS = 189,
|
||||
tecHAS_HOOK_STATE = 190,
|
||||
tecINCOMPLETE = 191,
|
||||
// 192: tecXCHAIN_BAD_PUBLIC_KEY_ACCOUNT_PAIR
|
||||
tecEMPTY_DID = 193,
|
||||
tecINVALID_UPDATE_TIME = 194,
|
||||
tecTOKEN_PAIR_NOT_FOUND = 195,
|
||||
tecARRAY_EMPTY = 196,
|
||||
tecARRAY_TOO_LARGE = 197,
|
||||
tecLOCKED = 198,
|
||||
tecBAD_CREDENTIALS = 199,
|
||||
tecINCOMPLETE = 190,
|
||||
// 191: tecXCHAIN_BAD_PUBLIC_KEY_ACCOUNT_PAIR
|
||||
tecEMPTY_DID = 192,
|
||||
tecINVALID_UPDATE_TIME = 193,
|
||||
tecTOKEN_PAIR_NOT_FOUND = 194,
|
||||
tecARRAY_EMPTY = 195,
|
||||
tecARRAY_TOO_LARGE = 196,
|
||||
tecLOCKED = 197,
|
||||
tecBAD_CREDENTIALS = 198,
|
||||
tecLAST_POSSIBLE_ENTRY = 255,
|
||||
};
|
||||
|
||||
@@ -648,27 +647,27 @@ using TER = TERSubset<CanCvtToTER>;
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
inline bool
|
||||
isTelLocal(TER x) noexcept
|
||||
isTelLocal(TER x)
|
||||
{
|
||||
return (x >= telLOCAL_ERROR && x < temMALFORMED);
|
||||
return ((x) >= telLOCAL_ERROR && (x) < temMALFORMED);
|
||||
}
|
||||
|
||||
inline bool
|
||||
isTemMalformed(TER x) noexcept
|
||||
isTemMalformed(TER x)
|
||||
{
|
||||
return (x >= temMALFORMED && x < tefFAILURE);
|
||||
return ((x) >= temMALFORMED && (x) < tefFAILURE);
|
||||
}
|
||||
|
||||
inline bool
|
||||
isTefFailure(TER x) noexcept
|
||||
isTefFailure(TER x)
|
||||
{
|
||||
return (x >= tefFAILURE && x < terRETRY);
|
||||
return ((x) >= tefFAILURE && (x) < terRETRY);
|
||||
}
|
||||
|
||||
inline bool
|
||||
isTerRetry(TER x) noexcept
|
||||
isTerRetry(TER x)
|
||||
{
|
||||
return (x >= terRETRY && x < tesSUCCESS);
|
||||
return ((x) >= terRETRY && (x) < tesSUCCESS);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@@ -679,13 +678,13 @@ isTesSuccess(T x)
|
||||
}
|
||||
|
||||
inline bool
|
||||
isTesSuccess(TER x) noexcept
|
||||
isTesSuccess(TER x)
|
||||
{
|
||||
return ((x) >= tesSUCCESS) && (x) < tecCLAIM;
|
||||
}
|
||||
|
||||
inline bool
|
||||
isTecClaim(TER x) noexcept
|
||||
isTecClaim(TER x)
|
||||
{
|
||||
return ((x) >= tecCLAIM);
|
||||
}
|
||||
|
||||
@@ -59,9 +59,8 @@ namespace ripple {
|
||||
// Universal Transaction flags:
|
||||
enum UniversalFlags : uint32_t {
|
||||
tfFullyCanonicalSig = 0x80000000,
|
||||
tfInnerBatchTxn = 0x40000000,
|
||||
};
|
||||
constexpr std::uint32_t tfUniversal = tfFullyCanonicalSig | tfInnerBatchTxn;
|
||||
constexpr std::uint32_t tfUniversal = tfFullyCanonicalSig;
|
||||
constexpr std::uint32_t tfUniversalMask = ~tfUniversal;
|
||||
|
||||
// AccountSet flags:
|
||||
@@ -240,12 +239,6 @@ constexpr std::uint32_t const tfImmutable = 1;
|
||||
// Clawback flags:
|
||||
constexpr std::uint32_t const tfClawbackMask = ~tfUniversal;
|
||||
|
||||
// CronSet Flags:
|
||||
enum CronSetFlags : uint32_t {
|
||||
tfCronUnset = 0x00000001,
|
||||
};
|
||||
constexpr std::uint32_t const tfCronSetMask = ~(tfUniversal | tfCronUnset);
|
||||
|
||||
// AMM Flags:
|
||||
constexpr std::uint32_t tfLPToken = 0x00010000;
|
||||
constexpr std::uint32_t tfWithdrawAll = 0x00020000;
|
||||
@@ -275,22 +268,6 @@ enum BridgeModifyFlags : uint32_t {
|
||||
tfClearAccountCreateAmount = 0x00010000,
|
||||
};
|
||||
constexpr std::uint32_t tfBridgeModifyMask = ~(tfUniversal | tfClearAccountCreateAmount);
|
||||
|
||||
// Batch Flags:
|
||||
enum BatchFlags : uint32_t {
|
||||
tfAllOrNothing = 0x00010000,
|
||||
tfOnlyOne = 0x00020000,
|
||||
tfUntilFailure = 0x00040000,
|
||||
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
|
||||
|
||||
} // namespace ripple
|
||||
|
||||
@@ -44,10 +44,7 @@ private:
|
||||
CtorHelper);
|
||||
|
||||
public:
|
||||
TxMeta(
|
||||
uint256 const& transactionID,
|
||||
std::uint32_t ledger,
|
||||
std::optional<uint256> parentBatchId = std::nullopt);
|
||||
TxMeta(uint256 const& transactionID, std::uint32_t ledger);
|
||||
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, STObject const&);
|
||||
@@ -170,27 +167,6 @@ public:
|
||||
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:
|
||||
uint256 mTransactionID;
|
||||
std::uint32_t mLedger;
|
||||
@@ -200,7 +176,6 @@ private:
|
||||
std::optional<STAmount> mDelivered;
|
||||
std::optional<STArray> mHookExecutions;
|
||||
std::optional<STArray> mHookEmissions;
|
||||
std::optional<uint256> mParentBatchId;
|
||||
|
||||
STArray mNodes;
|
||||
};
|
||||
|
||||
@@ -29,54 +29,52 @@
|
||||
// If you add an amendment here, then do not forget to increment `numFeatures`
|
||||
// in include/xrpl/protocol/Feature.h.
|
||||
|
||||
XRPL_FEATURE(Batch, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(PermissionedDomains, Supported::no, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(DynamicNFT, Supported::no, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(Credentials, Supported::no, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (FrozenLPTokenTransfer, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(DeepFreeze, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(PermissionedDomains, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(DynamicNFT, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(Credentials, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(AMMClawback, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(MPTokensV1, Supported::no, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (AMMv1_2, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(MPTokensV1, Supported::yes, VoteBehavior::DefaultNo)
|
||||
// InvariantsV1_1 will be changes to Supported::yes when all the
|
||||
// invariants expected to be included under it are complete.
|
||||
XRPL_FEATURE(InvariantsV1_1, Supported::no, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (NFTokenPageLinks, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (InnerObjTemplate2, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (EnforceNFTokenTrustline, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (ReducedOffersV2, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FEATURE(NFTokenMintOffer, Supported::no, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (PreviousTxnID, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FIX (ReducedOffersV2, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(NFTokenMintOffer, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (AMMv1_1, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (PreviousTxnID, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (XChainRewardRounding, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(PriceOracle, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (InnerObjTemplate, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FIX (AMMOverflowOffer, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FIX (InnerObjTemplate, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (NFTokenReserve, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (FillOrKill, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FEATURE(DID, Supported::no, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (DisallowIncomingV1, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FEATURE(XChainBridge, Supported::no, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (FillOrKill, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(DID, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (DisallowIncomingV1, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(XChainBridge, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(AMM, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (HookAPI20251128, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FIX (CronStacking, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FEATURE(ExtendedHookState, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(Cron, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (InvalidTxFlags, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FEATURE(IOUIssuerWeakTSH, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(DeepFreeze, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(Clawback, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (ReducedOffersV1, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FIX (ProvisionalDoubleThreading, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FIX (RewardClaimFlags, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FIX (ReducedOffersV1, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (RewardClaimFlags, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FEATURE(HookCanEmit, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (20250131, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FIX (XahauV3, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FIX (ReduceImport, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FIX (20250131, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FIX (XahauV3, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FIX (ReduceImport, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FEATURE(Touch, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(Remarks, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (FloatDivide, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FIX (240911, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FIX (PageCap, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FIX (240819, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FIX (NSDelete, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (FloatDivide, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FIX (240911, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FIX (PageCap, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FIX (240819, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FIX (NSDelete, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(ZeroB2M, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(Remit, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (XahauV2, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (XahauV1, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (XahauV2, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (XahauV1, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(HooksUpdate1, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FEATURE(XahauGenesis, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FEATURE(Import, Supported::yes, VoteBehavior::DefaultYes)
|
||||
@@ -107,7 +105,7 @@ XRPL_FIX (1781, Supported::yes, VoteBehavior::DefaultYe
|
||||
XRPL_FEATURE(RequireFullyCanonicalSig, Supported::yes, VoteBehavior::DefaultYes)
|
||||
// fixQualityUpperBound should be activated before FlowCross
|
||||
XRPL_FIX (QualityUpperBound, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FEATURE(DeletableAccounts, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(DeletableAccounts, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FIX (PayChanRecipientOwnerDir, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FIX (CheckThreading, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FIX (MasterKeyAsRegularKey, Supported::yes, VoteBehavior::DefaultYes)
|
||||
|
||||
@@ -54,20 +54,6 @@ LEDGER_ENTRY(ltNFTOKEN_OFFER, 0x0037, NFTokenOffer, nft_offer, ({
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
}))
|
||||
|
||||
/** A ledger object representing a scheduled cron execution on an account.
|
||||
|
||||
\sa keylet::cron
|
||||
*/
|
||||
LEDGER_ENTRY_DUPLICATE(ltCRON, 0x0041, Cron, cron, ({
|
||||
{sfOwner, soeREQUIRED},
|
||||
{sfStartTime, soeREQUIRED},
|
||||
{sfDelaySeconds, soeREQUIRED},
|
||||
{sfRepeatCount, soeREQUIRED},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED}
|
||||
}))
|
||||
|
||||
/** A ledger object which describes a check.
|
||||
|
||||
\sa keylet::check
|
||||
@@ -255,8 +241,6 @@ LEDGER_ENTRY(ltACCOUNT_ROOT, 0x0061, AccountRoot, account, ({
|
||||
{sfGovernanceMarks, soeOPTIONAL},
|
||||
{sfAccountIndex, soeOPTIONAL},
|
||||
{sfTouchCount, soeOPTIONAL},
|
||||
{sfHookStateScale, soeOPTIONAL},
|
||||
{sfCron, soeOPTIONAL},
|
||||
{sfAMMID, soeOPTIONAL},
|
||||
}))
|
||||
|
||||
@@ -498,8 +482,8 @@ LEDGER_ENTRY(ltAMM, 0x0079, AMM, amm, ({
|
||||
{sfAsset, soeREQUIRED},
|
||||
{sfAsset2, soeREQUIRED},
|
||||
{sfOwnerNode, soeREQUIRED},
|
||||
{sfPreviousTxnID, soeREQUIRED},
|
||||
{sfPreviousTxnLgrSeq, soeREQUIRED},
|
||||
{sfPreviousTxnID, soeOPTIONAL},
|
||||
{sfPreviousTxnLgrSeq, soeOPTIONAL},
|
||||
}))
|
||||
|
||||
/** A ledger object which tracks Oracle
|
||||
|
||||
@@ -57,8 +57,7 @@ TYPED_SFIELD(sfHookStateChangeCount, UINT16, 17)
|
||||
TYPED_SFIELD(sfHookEmitCount, UINT16, 18)
|
||||
TYPED_SFIELD(sfHookExecutionIndex, UINT16, 19)
|
||||
TYPED_SFIELD(sfHookApiVersion, UINT16, 20)
|
||||
TYPED_SFIELD(sfHookStateScale, UINT16, 21)
|
||||
TYPED_SFIELD(sfLedgerFixType, UINT16, 22)
|
||||
TYPED_SFIELD(sfLedgerFixType, UINT16, 21)
|
||||
|
||||
// 32-bit integers (common)
|
||||
TYPED_SFIELD(sfNetworkID, UINT32, 1)
|
||||
@@ -115,9 +114,6 @@ TYPED_SFIELD(sfLockCount, UINT32, 49)
|
||||
TYPED_SFIELD(sfFirstNFTokenSequence, UINT32, 50)
|
||||
TYPED_SFIELD(sfOracleDocumentID, UINT32, 51)
|
||||
|
||||
TYPED_SFIELD(sfStartTime, UINT32, 93)
|
||||
TYPED_SFIELD(sfRepeatCount, UINT32, 94)
|
||||
TYPED_SFIELD(sfDelaySeconds, UINT32, 95)
|
||||
TYPED_SFIELD(sfXahauActivationLgrSeq, UINT32, 96)
|
||||
TYPED_SFIELD(sfImportSequence, UINT32, 97)
|
||||
TYPED_SFIELD(sfRewardTime, UINT32, 98)
|
||||
@@ -210,12 +206,10 @@ TYPED_SFIELD(sfOfferID, UINT256, 34)
|
||||
TYPED_SFIELD(sfEscrowID, UINT256, 35)
|
||||
TYPED_SFIELD(sfURITokenID, UINT256, 36)
|
||||
TYPED_SFIELD(sfDomainID, UINT256, 37)
|
||||
TYPED_SFIELD(sfParentBatchID, UINT256, 38)
|
||||
TYPED_SFIELD(sfGovernanceFlags, UINT256, 99)
|
||||
TYPED_SFIELD(sfGovernanceMarks, UINT256, 98)
|
||||
TYPED_SFIELD(sfEmittedTxnID, UINT256, 97)
|
||||
TYPED_SFIELD(sfHookCanEmit, UINT256, 96)
|
||||
TYPED_SFIELD(sfCron, UINT256, 95)
|
||||
|
||||
// number (common)
|
||||
TYPED_SFIELD(sfNumber, NUMBER, 1)
|
||||
@@ -378,8 +372,6 @@ UNTYPED_SFIELD(sfXChainClaimAttestationCollectionElement, OBJECT, 30)
|
||||
UNTYPED_SFIELD(sfXChainCreateAccountAttestationCollectionElement, OBJECT, 31)
|
||||
UNTYPED_SFIELD(sfPriceData, OBJECT, 32)
|
||||
UNTYPED_SFIELD(sfCredential, OBJECT, 33)
|
||||
UNTYPED_SFIELD(sfRawTransaction, OBJECT, 34)
|
||||
UNTYPED_SFIELD(sfBatchSigner, OBJECT, 35)
|
||||
UNTYPED_SFIELD(sfAmountEntry, OBJECT, 91)
|
||||
UNTYPED_SFIELD(sfMintURIToken, OBJECT, 92)
|
||||
UNTYPED_SFIELD(sfHookEmission, OBJECT, 93)
|
||||
@@ -417,9 +409,6 @@ UNTYPED_SFIELD(sfAuthAccounts, ARRAY, 25)
|
||||
UNTYPED_SFIELD(sfAuthorizeCredentials, ARRAY, 26)
|
||||
UNTYPED_SFIELD(sfUnauthorizeCredentials, ARRAY, 27)
|
||||
UNTYPED_SFIELD(sfAcceptedCredentials, ARRAY, 28)
|
||||
UNTYPED_SFIELD(sfPermissions, ARRAY, 29)
|
||||
UNTYPED_SFIELD(sfRawTransactions, ARRAY, 30)
|
||||
UNTYPED_SFIELD(sfBatchSigners, ARRAY, 31, SField::sMD_Default, SField::notSigning)
|
||||
UNTYPED_SFIELD(sfRemarks, ARRAY, 97)
|
||||
UNTYPED_SFIELD(sfGenesisMints, ARRAY, 96)
|
||||
UNTYPED_SFIELD(sfActiveValidators, ARRAY, 95)
|
||||
|
||||
@@ -73,7 +73,6 @@ TRANSACTION(ttACCOUNT_SET, 3, AccountSet, ({
|
||||
{sfClearFlag, soeOPTIONAL},
|
||||
{sfTickSize, soeOPTIONAL},
|
||||
{sfNFTokenMinter, soeOPTIONAL},
|
||||
{sfHookStateScale, soeOPTIONAL},
|
||||
}))
|
||||
|
||||
/** This transaction type cancels an existing escrow. */
|
||||
@@ -500,25 +499,6 @@ TRANSACTION(ttPERMISSIONED_DOMAIN_DELETE, 72, PermissionedDomainDelete, ({
|
||||
{sfDomainID, soeREQUIRED},
|
||||
}))
|
||||
|
||||
/** This transaction type batches together transactions. */
|
||||
TRANSACTION(ttBATCH, 73, Batch, ({
|
||||
{sfRawTransactions, soeREQUIRED},
|
||||
{sfBatchSigners, soeOPTIONAL},
|
||||
}))
|
||||
|
||||
/* A pseudo-txn alarm signal for invoking a hook, emitted by validators after alarm set conditions are met */
|
||||
TRANSACTION(ttCRON, 92, Cron, ({
|
||||
{sfOwner, soeREQUIRED},
|
||||
{sfLedgerSequence, soeREQUIRED},
|
||||
}))
|
||||
|
||||
/* Sechedule an alarm for later */
|
||||
TRANSACTION(ttCRON_SET, 93, CronSet, ({
|
||||
{sfDelaySeconds, soeOPTIONAL},
|
||||
{sfRepeatCount, soeOPTIONAL},
|
||||
{sfStartTime, soeOPTIONAL},
|
||||
}))
|
||||
|
||||
/* A note attaching transactor that allows the owner or issuer (on a object by object basis) to attach remarks */
|
||||
TRANSACTION(ttREMARKS_SET, 94, SetRemarks, ({
|
||||
{sfObjectID, soeREQUIRED},
|
||||
|
||||
@@ -109,8 +109,6 @@ JSS(PriceDataSeries); // field.
|
||||
JSS(PriceData); // field.
|
||||
JSS(Provider); // field.
|
||||
JSS(QuoteAsset); // in: Oracle.
|
||||
JSS(RawTransaction); // in: Batch
|
||||
JSS(RawTransactions); // in: BatchJSS(RawTransactions);
|
||||
JSS(SLE_hit_rate); // out: GetCounts.
|
||||
JSS(Scale); // field.
|
||||
JSS(SettleDelay); // in: TransactionSign
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
#!/bin/bash
|
||||
#!/bin/bash -u
|
||||
# We use set -e and bash with -u to bail on first non zero exit code of any
|
||||
# processes launched or upon any unbound variable.
|
||||
# We use set -x to print commands before running them to help with
|
||||
# debugging.
|
||||
|
||||
set -ex
|
||||
|
||||
echo "START BUILDING (HOST)"
|
||||
@@ -15,7 +14,7 @@ BUILD_CORES=$(echo "scale=0 ; `nproc` / 1.337" | bc)
|
||||
|
||||
if [[ "$GITHUB_REPOSITORY" == "" ]]; then
|
||||
#Default
|
||||
BUILD_CORES=${BUILD_CORES:-8}
|
||||
BUILD_CORES=8
|
||||
fi
|
||||
|
||||
# Ensure still works outside of GH Actions by setting these to /dev/null
|
||||
@@ -47,192 +46,29 @@ fi
|
||||
|
||||
STATIC_CONTAINER=$(docker ps -a | grep $CONTAINER_NAME |wc -l)
|
||||
|
||||
CACHE_VOLUME_NAME="xahau-release-builder-cache"
|
||||
|
||||
# if [[ "$STATIC_CONTAINER" -gt "0" && "$GITHUB_REPOSITORY" != "" ]]; then
|
||||
if false; then
|
||||
echo "Static container, execute in static container to have max. cache"
|
||||
docker start $CONTAINER_NAME
|
||||
docker exec -i $CONTAINER_NAME /hbb_exe/activate-exec bash -c "source /opt/rh/gcc-toolset-11/enable && bash -x /io/build-core.sh '$GITHUB_REPOSITORY' '$GITHUB_SHA' '$BUILD_CORES' '$GITHUB_RUN_NUMBER'"
|
||||
docker exec -i $CONTAINER_NAME /hbb_exe/activate-exec bash -x /io/build-core.sh "$GITHUB_REPOSITORY" "$GITHUB_SHA" "$BUILD_CORES" "$GITHUB_RUN_NUMBER"
|
||||
docker stop $CONTAINER_NAME
|
||||
else
|
||||
echo "No static container, build on temp container"
|
||||
rm -rf release-build;
|
||||
mkdir -p release-build;
|
||||
|
||||
docker volume create $CACHE_VOLUME_NAME
|
||||
|
||||
# Create inline Dockerfile with environment setup for build-full.sh
|
||||
DOCKERFILE_CONTENT=$(cat <<'DOCKERFILE_EOF'
|
||||
FROM ghcr.io/phusion/holy-build-box:4.0.1-amd64
|
||||
|
||||
ARG BUILD_CORES=8
|
||||
|
||||
# Enable repositories and install dependencies
|
||||
RUN /hbb_exe/activate-exec bash -c "dnf install -y epel-release && \
|
||||
dnf config-manager --set-enabled powertools || dnf config-manager --set-enabled crb && \
|
||||
dnf install -y --enablerepo=devel \
|
||||
wget git \
|
||||
gcc-toolset-11-gcc-c++ gcc-toolset-11-binutils gcc-toolset-11-libatomic-devel \
|
||||
lz4 lz4-devel \
|
||||
ncurses-static ncurses-devel \
|
||||
snappy snappy-devel \
|
||||
zlib zlib-devel zlib-static \
|
||||
libasan \
|
||||
python3 python3-pip \
|
||||
ccache \
|
||||
ninja-build \
|
||||
mold \
|
||||
patch \
|
||||
glibc-devel glibc-static \
|
||||
libxml2-devel \
|
||||
autoconf \
|
||||
automake \
|
||||
texinfo \
|
||||
libtool \
|
||||
llvm14-static llvm14-devel && \
|
||||
dnf clean all"
|
||||
|
||||
# Install Conan 2 and CMake
|
||||
RUN /hbb_exe/activate-exec pip3 install "conan>=2.0,<3.0" && \
|
||||
/hbb_exe/activate-exec wget -q https://github.com/Kitware/CMake/releases/download/v3.25.3/cmake-3.25.3-linux-x86_64.tar.gz -O cmake.tar.gz && \
|
||||
mkdir cmake && \
|
||||
tar -xzf cmake.tar.gz --strip-components=1 -C cmake && \
|
||||
rm cmake.tar.gz
|
||||
|
||||
# Dual Boost configuration in HBB environment:
|
||||
# - Manual Boost in /usr/local (minimal: for WasmEdge which is pre-built in Docker)
|
||||
# - Conan Boost (full: for the application and all dependencies via toolchain)
|
||||
#
|
||||
# Install minimal Boost 1.86.0 for WasmEdge only (filesystem and its dependencies)
|
||||
# The main application will use Conan-provided Boost for all other components
|
||||
# IMPORTANT: Understanding Boost linking options:
|
||||
# - link=static: Creates static Boost libraries (.a files) instead of shared (.so files)
|
||||
# - runtime-link=shared: Links Boost libraries against shared libc (glibc)
|
||||
# WasmEdge only needs boost::filesystem and boost::system
|
||||
RUN /hbb_exe/activate-exec bash -c "echo 'Boost cache bust: v5-minimal' && \
|
||||
rm -rf /usr/local/lib/libboost* /usr/local/include/boost && \
|
||||
cd /tmp && \
|
||||
wget -q https://archives.boost.io/release/1.86.0/source/boost_1_86_0.tar.gz -O boost.tar.gz && \
|
||||
mkdir boost && \
|
||||
tar -xzf boost.tar.gz --strip-components=1 -C boost && \
|
||||
cd boost && \
|
||||
./bootstrap.sh && \
|
||||
./b2 install \
|
||||
link=static runtime-link=shared -j${BUILD_CORES} \
|
||||
--with-filesystem --with-system && \
|
||||
cd /tmp && \
|
||||
rm -rf boost boost.tar.gz"
|
||||
|
||||
ENV CMAKE_EXE_LINKER_FLAGS="-static-libstdc++"
|
||||
|
||||
ENV LLVM_DIR=/usr/lib64/llvm14/lib/cmake/llvm
|
||||
ENV WasmEdge_LIB=/usr/local/lib64/libwasmedge.a
|
||||
|
||||
# Install LLD
|
||||
RUN /hbb_exe/activate-exec bash -c "source /opt/rh/gcc-toolset-11/enable && \
|
||||
cd /tmp && \
|
||||
wget -q https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.3/lld-14.0.3.src.tar.xz && \
|
||||
wget -q https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.3/libunwind-14.0.3.src.tar.xz && \
|
||||
tar -xf lld-14.0.3.src.tar.xz && \
|
||||
tar -xf libunwind-14.0.3.src.tar.xz && \
|
||||
cp -r libunwind-14.0.3.src/include libunwind-14.0.3.src/src lld-14.0.3.src/ && \
|
||||
cd lld-14.0.3.src && \
|
||||
mkdir -p build && cd build && \
|
||||
cmake .. \
|
||||
-DLLVM_LIBRARY_DIR=/usr/lib64/llvm14/lib/ \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr/lib64/llvm14/ \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_EXE_LINKER_FLAGS=\"\$CMAKE_EXE_LINKER_FLAGS\" && \
|
||||
make -j${BUILD_CORES} install && \
|
||||
ln -s /usr/lib64/llvm14/lib/include/lld /usr/include/lld && \
|
||||
cp /usr/lib64/llvm14/lib/liblld*.a /usr/local/lib/ && \
|
||||
cd /tmp && rm -rf lld-* libunwind-*"
|
||||
|
||||
# Build and install WasmEdge (static version)
|
||||
# Note: Conan only provides WasmEdge with shared library linking.
|
||||
# For a fully static build, we need to manually install:
|
||||
# * Boost: Static C++ libraries for filesystem and system operations (built from source above)
|
||||
# * LLVM: Static LLVM libraries for WebAssembly compilation (installed via llvm14-static package)
|
||||
# * LLD: Static linker to produce the final static binary (built from source above)
|
||||
# These were installed above to enable WASMEDGE_LINK_LLVM_STATIC=ON
|
||||
RUN cd /tmp && \
|
||||
( wget -nc -q https://github.com/WasmEdge/WasmEdge/archive/refs/tags/0.11.2.zip; unzip -o 0.11.2.zip; ) && \
|
||||
cd WasmEdge-0.11.2 && \
|
||||
( mkdir -p build; echo "" ) && \
|
||||
cd build && \
|
||||
/hbb_exe/activate-exec bash -c "source /opt/rh/gcc-toolset-11/enable && \
|
||||
ln -sf /opt/rh/gcc-toolset-11/root/usr/bin/ar /usr/bin/ar && \
|
||||
ln -sf /opt/rh/gcc-toolset-11/root/usr/bin/ranlib /usr/bin/ranlib && \
|
||||
echo '=== Binutils version check ===' && \
|
||||
ar --version | head -1 && \
|
||||
ranlib --version | head -1 && \
|
||||
cmake .. \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr/local \
|
||||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
|
||||
-DWASMEDGE_BUILD_SHARED_LIB=OFF \
|
||||
-DWASMEDGE_BUILD_STATIC_LIB=ON \
|
||||
-DWASMEDGE_BUILD_AOT_RUNTIME=ON \
|
||||
-DWASMEDGE_FORCE_DISABLE_LTO=ON \
|
||||
-DWASMEDGE_LINK_LLVM_STATIC=ON \
|
||||
-DWASMEDGE_BUILD_PLUGINS=OFF \
|
||||
-DWASMEDGE_LINK_TOOLS_STATIC=ON \
|
||||
-DBoost_NO_BOOST_CMAKE=ON \
|
||||
-DCMAKE_EXE_LINKER_FLAGS=\"\$CMAKE_EXE_LINKER_FLAGS\" \
|
||||
&& \
|
||||
make -j${BUILD_CORES} install" && \
|
||||
cp -r include/api/wasmedge /usr/include/ && \
|
||||
cd /tmp && rm -rf WasmEdge* 0.11.2.zip
|
||||
|
||||
# Set environment variables
|
||||
ENV PATH=/usr/local/bin:$PATH
|
||||
|
||||
# Configure ccache and Conan 2
|
||||
# NOTE: Using echo commands instead of heredocs because heredocs in Docker RUN commands are finnicky
|
||||
RUN /hbb_exe/activate-exec bash -c "ccache -M 100G && \
|
||||
ccache -o cache_dir=/cache/ccache && \
|
||||
ccache -o compiler_check=content && \
|
||||
mkdir -p ~/.conan2 /cache/conan2 /cache/conan2_download /cache/conan2_sources && \
|
||||
echo 'core.cache:storage_path=/cache/conan2' > ~/.conan2/global.conf && \
|
||||
echo 'core.download:download_cache=/cache/conan2_download' >> ~/.conan2/global.conf && \
|
||||
echo 'core.sources:download_cache=/cache/conan2_sources' >> ~/.conan2/global.conf && \
|
||||
conan profile detect --force && \
|
||||
echo '[settings]' > ~/.conan2/profiles/default && \
|
||||
echo 'arch=x86_64' >> ~/.conan2/profiles/default && \
|
||||
echo 'build_type=Release' >> ~/.conan2/profiles/default && \
|
||||
echo 'compiler=gcc' >> ~/.conan2/profiles/default && \
|
||||
echo 'compiler.cppstd=20' >> ~/.conan2/profiles/default && \
|
||||
echo 'compiler.libcxx=libstdc++11' >> ~/.conan2/profiles/default && \
|
||||
echo 'compiler.version=11' >> ~/.conan2/profiles/default && \
|
||||
echo 'os=Linux' >> ~/.conan2/profiles/default && \
|
||||
echo '' >> ~/.conan2/profiles/default && \
|
||||
echo '[conf]' >> ~/.conan2/profiles/default && \
|
||||
echo '# Force building from source for packages with binary compatibility issues' >> ~/.conan2/profiles/default && \
|
||||
echo '*:tools.system.package_manager:mode=build' >> ~/.conan2/profiles/default && \
|
||||
ln -s ../../bin/ccache /usr/lib64/ccache/g++ && \
|
||||
ln -s ../../bin/ccache /usr/lib64/ccache/c++"
|
||||
|
||||
DOCKERFILE_EOF
|
||||
)
|
||||
|
||||
# Build custom Docker image
|
||||
IMAGE_NAME="xahaud-builder:latest"
|
||||
echo "Building custom Docker image with dependencies..."
|
||||
echo "$DOCKERFILE_CONTENT" | docker build --build-arg BUILD_CORES="$BUILD_CORES" -t "$IMAGE_NAME" - || exit 1
|
||||
|
||||
if [[ "$GITHUB_REPOSITORY" == "" ]]; then
|
||||
# Non GH, local building
|
||||
echo "Non-GH runner, local building, temp container"
|
||||
docker run -i --user 0:$(id -g) --rm -v /data/builds:/data/builds -v `pwd`:/io -v "$CACHE_VOLUME_NAME":/cache --network host "$IMAGE_NAME" /hbb_exe/activate-exec bash -c "source /opt/rh/gcc-toolset-11/enable && bash -x /io/build-full.sh '$GITHUB_REPOSITORY' '$GITHUB_SHA' '$BUILD_CORES' '$GITHUB_RUN_NUMBER'"
|
||||
docker run -i --user 0:$(id -g) --rm -v /data/builds:/data/builds -v `pwd`:/io --network host ghcr.io/foobarwidget/holy-build-box-x64 /hbb_exe/activate-exec bash -x /io/build-full.sh "$GITHUB_REPOSITORY" "$GITHUB_SHA" "$BUILD_CORES" "$GITHUB_RUN_NUMBER"
|
||||
else
|
||||
# GH Action, runner
|
||||
echo "GH Action, runner, clean & re-create create persistent container"
|
||||
docker rm -f $CONTAINER_NAME
|
||||
echo "echo 'Stopping container: $CONTAINER_NAME'" >> "$JOB_CLEANUP_SCRIPT"
|
||||
echo "docker stop --time=15 \"$CONTAINER_NAME\" || echo 'Failed to stop container or container not running'" >> "$JOB_CLEANUP_SCRIPT"
|
||||
docker run -di --user 0:$(id -g) --name $CONTAINER_NAME -v /data/builds:/data/builds -v `pwd`:/io -v "$CACHE_VOLUME_NAME":/cache --network host "$IMAGE_NAME" /hbb_exe/activate-exec bash
|
||||
docker exec -i $CONTAINER_NAME /hbb_exe/activate-exec bash -c "source /opt/rh/gcc-toolset-11/enable && bash -x /io/build-full.sh '$GITHUB_REPOSITORY' '$GITHUB_SHA' '$BUILD_CORES' '$GITHUB_RUN_NUMBER'"
|
||||
docker run -di --user 0:$(id -g) --name $CONTAINER_NAME -v /data/builds:/data/builds -v `pwd`:/io --network host ghcr.io/foobarwidget/holy-build-box-x64 /hbb_exe/activate-exec bash
|
||||
docker exec -i $CONTAINER_NAME /hbb_exe/activate-exec bash -x /io/build-full.sh "$GITHUB_REPOSITORY" "$GITHUB_SHA" "$BUILD_CORES" "$GITHUB_RUN_NUMBER"
|
||||
docker stop $CONTAINER_NAME
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -17,20 +17,11 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <date/date.h>
|
||||
|
||||
#include <xrpl/basics/Log.h>
|
||||
#include <xrpl/basics/chrono.h>
|
||||
#include <xrpl/basics/contract.h>
|
||||
#include <xrpl/beast/utility/instrumentation.h>
|
||||
#ifdef BEAST_ENHANCED_LOGGING
|
||||
#include <xrpl/beast/utility/EnhancedLogging.h>
|
||||
#include <date/tz.h>
|
||||
#endif
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
#include <ctime>
|
||||
#include <fstream>
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
@@ -333,47 +324,11 @@ Logs::format(
|
||||
{
|
||||
output.reserve(message.size() + partition.size() + 100);
|
||||
|
||||
#ifdef BEAST_ENHANCED_LOGGING
|
||||
// Environment variables are used instead of config file because:
|
||||
// 1. Logging starts before config parsing (needed to debug config issues)
|
||||
// 2. This is a developer feature - devs can easily set env vars
|
||||
// 3. Allows per-run overrides without editing config files
|
||||
static const char* fmt = []() {
|
||||
const char* env = std::getenv("LOG_DATE_FORMAT");
|
||||
return env ? env : "%Y-%b-%d %T %Z"; // Default format
|
||||
}();
|
||||
|
||||
// Check if we should use local time
|
||||
static const bool useLocalTime = []() {
|
||||
const char* env = std::getenv("LOG_DATE_LOCAL");
|
||||
return env && std::strcmp(env, "1") == 0;
|
||||
}();
|
||||
|
||||
if (useLocalTime)
|
||||
{
|
||||
auto now = std::chrono::system_clock::now();
|
||||
auto local = date::make_zoned(date::current_zone(), now);
|
||||
output = date::format(fmt, local);
|
||||
}
|
||||
else
|
||||
{
|
||||
output = date::format(fmt, std::chrono::system_clock::now());
|
||||
}
|
||||
#else
|
||||
output = to_string(std::chrono::system_clock::now());
|
||||
#endif
|
||||
|
||||
if (!output.empty()) // Allow setting date format to an empty string
|
||||
output += " ";
|
||||
|
||||
output += " ";
|
||||
if (!partition.empty())
|
||||
{
|
||||
#ifdef BEAST_ENHANCED_LOGGING
|
||||
if (beast::detail::should_log_use_colors())
|
||||
output += beast::detail::get_log_highlight_color();
|
||||
#endif
|
||||
output += partition + ":";
|
||||
}
|
||||
|
||||
using namespace beast::severities;
|
||||
switch (severity)
|
||||
@@ -401,11 +356,6 @@ Logs::format(
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef BEAST_ENHANCED_LOGGING
|
||||
if (beast::detail::should_log_use_colors())
|
||||
output += "\033[0m";
|
||||
#endif
|
||||
|
||||
output += message;
|
||||
|
||||
// Limit the maximum length of the output
|
||||
|
||||
@@ -1,118 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
||||
|
||||
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.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifdef BEAST_ENHANCED_LOGGING
|
||||
|
||||
#include <xrpl/beast/utility/EnhancedLogging.h>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <ostream>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace beast {
|
||||
namespace detail {
|
||||
|
||||
// Check if we should use colors - cached at startup
|
||||
bool
|
||||
should_log_use_colors()
|
||||
{
|
||||
static const bool use_colors = []() {
|
||||
// Honor NO_COLOR environment variable (standard)
|
||||
if (std::getenv("NO_COLOR"))
|
||||
return false;
|
||||
|
||||
// Honor FORCE_COLOR to override terminal detection
|
||||
if (std::getenv("FORCE_COLOR"))
|
||||
return true;
|
||||
|
||||
// Check if stderr is a terminal
|
||||
return isatty(STDERR_FILENO) != 0;
|
||||
}();
|
||||
return use_colors;
|
||||
}
|
||||
|
||||
// Get the log highlight color - can be overridden via
|
||||
// LOG_HIGHLIGHT_COLOR
|
||||
const char*
|
||||
get_log_highlight_color()
|
||||
{
|
||||
static const char* escape = []() {
|
||||
const char* env = std::getenv("LOG_HIGHLIGHT_COLOR");
|
||||
if (!env)
|
||||
return "\033[36m"; // Default: cyan
|
||||
|
||||
// Simple map of color names to escape sequences
|
||||
if (std::strcmp(env, "red") == 0)
|
||||
return "\033[31m";
|
||||
if (std::strcmp(env, "green") == 0)
|
||||
return "\033[32m";
|
||||
if (std::strcmp(env, "yellow") == 0)
|
||||
return "\033[33m";
|
||||
if (std::strcmp(env, "blue") == 0)
|
||||
return "\033[34m";
|
||||
if (std::strcmp(env, "magenta") == 0)
|
||||
return "\033[35m";
|
||||
if (std::strcmp(env, "cyan") == 0)
|
||||
return "\033[36m";
|
||||
if (std::strcmp(env, "white") == 0)
|
||||
return "\033[37m";
|
||||
if (std::strcmp(env, "gray") == 0 || std::strcmp(env, "grey") == 0)
|
||||
return "\033[90m"; // Bright black (gray)
|
||||
if (std::strcmp(env, "orange") == 0)
|
||||
return "\033[93m"; // Bright yellow (appears orange-ish)
|
||||
if (std::strcmp(env, "none") == 0)
|
||||
return "";
|
||||
|
||||
// Default to cyan if unknown color name
|
||||
return "\033[36m";
|
||||
}();
|
||||
return escape;
|
||||
}
|
||||
|
||||
// Check if location info should be shown - cached at startup
|
||||
bool
|
||||
should_show_location()
|
||||
{
|
||||
static const bool show = []() {
|
||||
const char* env = std::getenv("LOG_DISABLE");
|
||||
// Show location by default, hide if LOG_DISABLE=1
|
||||
return !env || std::strcmp(env, "1") != 0;
|
||||
}();
|
||||
return show;
|
||||
}
|
||||
|
||||
// Helper to write location string (no leading/trailing space)
|
||||
void
|
||||
log_write_location_string(std::ostream& os, const char* file, int line)
|
||||
{
|
||||
if (detail::should_log_use_colors())
|
||||
{
|
||||
os << detail::get_log_highlight_color() << "["
|
||||
<< detail::strip_source_root(file) << ":" << line << "]\033[0m";
|
||||
}
|
||||
else
|
||||
{
|
||||
os << "[" << detail::strip_source_root(file) << ":" << line << "]";
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace beast
|
||||
|
||||
#endif // BEAST_ENHANCED_LOGGING
|
||||
@@ -19,12 +19,6 @@
|
||||
|
||||
#include <xrpl/beast/utility/Journal.h>
|
||||
#include <xrpl/beast/utility/instrumentation.h>
|
||||
#include <cassert>
|
||||
#ifdef BEAST_ENHANCED_LOGGING
|
||||
#include <xrpl/beast/utility/EnhancedLogging.h>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#endif
|
||||
|
||||
namespace beast {
|
||||
|
||||
@@ -144,65 +138,9 @@ Journal::ScopedStream::ScopedStream(
|
||||
m_ostream << manip;
|
||||
}
|
||||
|
||||
#ifdef BEAST_ENHANCED_LOGGING
|
||||
Journal::ScopedStream::ScopedStream(
|
||||
Sink& sink,
|
||||
Severity level,
|
||||
const char* file,
|
||||
int line)
|
||||
: m_sink(sink), m_level(level), file_(file), line_(line)
|
||||
{
|
||||
// Modifiers applied from all ctors
|
||||
m_ostream << std::boolalpha << std::showbase;
|
||||
}
|
||||
#endif
|
||||
|
||||
Journal::ScopedStream::~ScopedStream()
|
||||
{
|
||||
std::string s(m_ostream.str());
|
||||
|
||||
#ifdef BEAST_ENHANCED_LOGGING
|
||||
// Add suffix if location is enabled
|
||||
if (file_ && detail::should_show_location() && !s.empty())
|
||||
{
|
||||
// Single optimized scan from the end
|
||||
size_t const lastNonWhitespace = s.find_last_not_of(" \n\r\t");
|
||||
|
||||
// Skip if message is only whitespace (e.g., just "\n" or " \n\n")
|
||||
if (lastNonWhitespace != std::string::npos)
|
||||
{
|
||||
// Count only the trailing newlines (tiny range)
|
||||
size_t trailingNewlines = 0;
|
||||
for (size_t i = lastNonWhitespace + 1; i < s.length(); ++i)
|
||||
{
|
||||
if (s[i] == '\n')
|
||||
++trailingNewlines;
|
||||
}
|
||||
|
||||
// Build location string once
|
||||
std::ostringstream locStream;
|
||||
detail::log_write_location_string(locStream, file_, line_);
|
||||
std::string const location = locStream.str();
|
||||
|
||||
// Pre-allocate exact size → zero reallocations
|
||||
size_t const finalSize = lastNonWhitespace + 1 + 1 +
|
||||
location.length() + trailingNewlines;
|
||||
|
||||
std::string result;
|
||||
result.reserve(finalSize);
|
||||
|
||||
// Direct string ops (no ostringstream overhead)
|
||||
result.append(s, 0, lastNonWhitespace + 1);
|
||||
result.push_back(' ');
|
||||
result += location;
|
||||
if (trailingNewlines > 0)
|
||||
result.append(trailingNewlines, '\n');
|
||||
|
||||
s = std::move(result); // Move, no copy
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
std::string const& s(m_ostream.str());
|
||||
if (!s.empty())
|
||||
{
|
||||
if (s == "\n")
|
||||
@@ -226,18 +164,4 @@ Journal::Stream::operator<<(std::ostream& manip(std::ostream&)) const
|
||||
return ScopedStream(*this, manip);
|
||||
}
|
||||
|
||||
#ifdef BEAST_ENHANCED_LOGGING
|
||||
|
||||
// Implementation moved to use new constructor
|
||||
Journal::ScopedStream
|
||||
Journal::StreamWithLocation::operator<<(
|
||||
std::ostream& manip(std::ostream&)) const
|
||||
{
|
||||
// Create a ScopedStream with location info
|
||||
ScopedStream scoped(stream_.sink(), stream_.level(), file_, line_);
|
||||
scoped.ostream() << manip;
|
||||
return scoped;
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace beast
|
||||
|
||||
@@ -78,7 +78,6 @@ enum class LedgerNameSpace : std::uint16_t {
|
||||
URI_TOKEN = 'U',
|
||||
IMPORT_VLSEQ = 'I',
|
||||
UNL_REPORT = 'R',
|
||||
CRON = 'L',
|
||||
AMM = 'A',
|
||||
BRIDGE = 'H',
|
||||
XCHAIN_CLAIM_ID = 'Q',
|
||||
@@ -492,58 +491,6 @@ uritoken(AccountID const& issuer, Blob const& uri)
|
||||
LedgerNameSpace::URI_TOKEN, issuer, Slice{uri.data(), uri.size()})};
|
||||
}
|
||||
|
||||
// Constructs an ordered CRON keylet (32 bytes):
|
||||
// [8-byte namespace][4-byte timestamp (big-endian, seconds)][20-byte
|
||||
// AccountID]
|
||||
//
|
||||
// Properties
|
||||
// - Namespacing: first 8 bytes are the most-significant bytes of
|
||||
// indexHash(LedgerNameSpace::CRON).
|
||||
// - Uniqueness (per ts,acct): exactly ONE cron per (timestamp, AccountID).
|
||||
// Insert is upsert (last-write-wins).
|
||||
// This is fine because we only ever allow one cron per account at a time—if
|
||||
// the same (ts,acct) is written, it’s simply an update to that single entry
|
||||
// (idempotent; no duplicate leaves).
|
||||
// - Iteration order: chronological by timestamp (BE), then by raw AccountID
|
||||
// bytes.
|
||||
// NOTE: raw AccountID ordering may bias priority; consider hashing AccountID
|
||||
// for uniform per-timestamp spread.
|
||||
// - Expected accidental prefix collisions (foreign objects sharing the 8-byte
|
||||
// namespace): n / 2^64,
|
||||
// assuming uniform high-64-bit distribution of other objects.
|
||||
// Examples: 100M → ~5.4e-12, 1B → ~5.4e-11, 10B → ~5.4e-10, 100B → ~5.4e-9
|
||||
// (negligible).
|
||||
Keylet
|
||||
cron(uint32_t timestamp, std::optional<AccountID> const& id)
|
||||
{
|
||||
static const uint256 ns = indexHash(LedgerNameSpace::CRON);
|
||||
|
||||
uint8_t h[32];
|
||||
|
||||
// first 8 bytes are the namespacing
|
||||
std::memcpy(h, ns.data(), 8);
|
||||
|
||||
// next 4 bytes are the timestamp in BE
|
||||
h[8] = static_cast<uint8_t>((timestamp >> 24) & 0xFFU);
|
||||
h[9] = static_cast<uint8_t>((timestamp >> 16) & 0xFFU);
|
||||
h[10] = static_cast<uint8_t>((timestamp >> 8) & 0xFFU);
|
||||
h[11] = static_cast<uint8_t>((timestamp >> 0) & 0xFFU);
|
||||
|
||||
if (!id.has_value())
|
||||
{
|
||||
// final 20 bytes are zero
|
||||
std::memset(h + 12, 0, 20);
|
||||
return {ltCRON, uint256::fromVoid(h)};
|
||||
}
|
||||
|
||||
const uint256 accHash = indexHash(LedgerNameSpace::CRON, timestamp, *id);
|
||||
|
||||
// final 20 bytes are account ID
|
||||
std::memcpy(h + 12, accHash.cdata(), 20);
|
||||
|
||||
return {ltCRON, uint256::fromVoid(h)};
|
||||
}
|
||||
|
||||
Keylet
|
||||
amm(Asset const& issue1, Asset const& issue2) noexcept
|
||||
{
|
||||
|
||||
@@ -262,13 +262,6 @@ InnerObjectFormats::InnerObjectFormats()
|
||||
{sfIssuer, soeREQUIRED},
|
||||
{sfCredentialType, soeREQUIRED},
|
||||
});
|
||||
|
||||
add(sfBatchSigner.jsonName.c_str(),
|
||||
sfBatchSigner.getCode(),
|
||||
{{sfAccount, soeREQUIRED},
|
||||
{sfSigningPubKey, soeOPTIONAL},
|
||||
{sfTxnSignature, soeOPTIONAL},
|
||||
{sfSigners, soeOPTIONAL}});
|
||||
}
|
||||
|
||||
InnerObjectFormats const&
|
||||
|
||||
@@ -135,11 +135,12 @@ STLedgerEntry::getJson(JsonOptions options) const
|
||||
bool
|
||||
STLedgerEntry::isThreadedType(Rules const& rules) const
|
||||
{
|
||||
static constexpr std::array<LedgerEntryType, 7> newPreviousTxnIDTypes = {
|
||||
static constexpr std::array<LedgerEntryType, 8> newPreviousTxnIDTypes = {
|
||||
ltDIR_NODE,
|
||||
ltAMENDMENTS,
|
||||
ltFEE_SETTINGS,
|
||||
ltNEGATIVE_UNL,
|
||||
ltAMM,
|
||||
ltHOOK_STATE,
|
||||
ltHOOK_DEFINITION,
|
||||
ltIMPORT_VLSEQ,
|
||||
|
||||
@@ -69,9 +69,12 @@ STObject::makeInnerObject(SField const& name)
|
||||
// The if is complicated because inner object templates were added in
|
||||
// two phases:
|
||||
// 1. If there are no available Rules, then always apply the template.
|
||||
// 2. fixInnerObjTemplate added templates to all inner objects.
|
||||
// 2. fixInnerObjTemplate added templates to two AMM inner objects.
|
||||
// 3. fixInnerObjTemplate2 added templates to all remaining inner objects.
|
||||
std::optional<Rules> const& rules = getCurrentTransactionRules();
|
||||
if (!rules || rules->enabled(fixInnerObjTemplate))
|
||||
bool const isAMMObj = name == sfAuctionSlot || name == sfVoteEntry;
|
||||
if (!rules || (rules->enabled(fixInnerObjTemplate) && isAMMObj) ||
|
||||
(rules->enabled(fixInnerObjTemplate2) && !isAMMObj))
|
||||
{
|
||||
if (SOTemplate const* elements =
|
||||
InnerObjectFormats::getInstance().findSOTemplateBySField(name))
|
||||
|
||||
@@ -17,21 +17,12 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <xrpl/basics/Blob.h>
|
||||
#include <xrpl/basics/Expected.h>
|
||||
#include <xrpl/basics/Log.h>
|
||||
#include <xrpl/basics/Slice.h>
|
||||
#include <xrpl/basics/StringUtilities.h>
|
||||
#include <xrpl/basics/contract.h>
|
||||
#include <xrpl/basics/safe_cast.h>
|
||||
#include <xrpl/basics/strHex.h>
|
||||
#include <xrpl/beast/utility/Zero.h>
|
||||
#include <xrpl/beast/utility/instrumentation.h>
|
||||
#include <xrpl/hook/Enum.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
#include <xrpl/json/to_string.h>
|
||||
#include <xrpl/protocol/AccountID.h>
|
||||
#include <xrpl/protocol/Batch.h>
|
||||
#include <xrpl/protocol/Feature.h>
|
||||
#include <xrpl/protocol/HashPrefix.h>
|
||||
#include <xrpl/protocol/Protocol.h>
|
||||
@@ -39,10 +30,6 @@
|
||||
#include <xrpl/protocol/STAccount.h>
|
||||
#include <xrpl/protocol/STArray.h>
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
#include <xrpl/protocol/STVector256.h>
|
||||
#include <xrpl/protocol/SecretKey.h>
|
||||
#include <xrpl/protocol/SeqProxy.h>
|
||||
#include <xrpl/protocol/Serializer.h>
|
||||
#include <xrpl/protocol/Sign.h>
|
||||
#include <xrpl/protocol/TxFlags.h>
|
||||
#include <xrpl/protocol/UintTypes.h>
|
||||
@@ -243,42 +230,6 @@ STTx::checkSign(
|
||||
return Unexpected("Internal signature check failure.");
|
||||
}
|
||||
|
||||
Expected<void, std::string>
|
||||
STTx::checkBatchSign(
|
||||
RequireFullyCanonicalSig requireCanonicalSig,
|
||||
Rules const& rules) const
|
||||
{
|
||||
try
|
||||
{
|
||||
XRPL_ASSERT(
|
||||
getTxnType() == ttBATCH,
|
||||
"STTx::checkBatchSign : not a batch transaction");
|
||||
if (getTxnType() != ttBATCH)
|
||||
{
|
||||
JLOG(debugLog().fatal()) << "not a batch transaction";
|
||||
return Unexpected("Not a batch transaction.");
|
||||
}
|
||||
STArray const& signers{getFieldArray(sfBatchSigners)};
|
||||
for (auto const& signer : signers)
|
||||
{
|
||||
Blob const& signingPubKey = signer.getFieldVL(sfSigningPubKey);
|
||||
auto const result = signingPubKey.empty()
|
||||
? checkBatchMultiSign(signer, requireCanonicalSig, rules)
|
||||
: checkBatchSingleSign(signer, requireCanonicalSig);
|
||||
|
||||
if (!result)
|
||||
return result;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
catch (std::exception const& e)
|
||||
{
|
||||
JLOG(debugLog().error())
|
||||
<< "Batch signature check failed: " << e.what();
|
||||
}
|
||||
return Unexpected("Internal batch signature check failure.");
|
||||
}
|
||||
|
||||
Json::Value
|
||||
STTx::getJson(JsonOptions options) const
|
||||
{
|
||||
@@ -358,101 +309,89 @@ STTx::getMetaSQL(
|
||||
getFieldU32(sfSequence) % inLedger % status % rTxn % escapedMetaData);
|
||||
}
|
||||
|
||||
static Expected<void, std::string>
|
||||
singleSignHelper(
|
||||
STObject const& signer,
|
||||
Slice const& data,
|
||||
bool const fullyCanonical)
|
||||
Expected<void, std::string>
|
||||
STTx::checkSingleSign(RequireFullyCanonicalSig requireCanonicalSig) const
|
||||
{
|
||||
// We don't allow both a non-empty sfSigningPubKey and an sfSigners.
|
||||
// That would allow the transaction to be signed two ways. So if both
|
||||
// fields are present the signature is invalid.
|
||||
if (signer.isFieldPresent(sfSigners))
|
||||
if (isFieldPresent(sfSigners))
|
||||
return Unexpected("Cannot both single- and multi-sign.");
|
||||
|
||||
// wildcard network gets a free pass on all signatures
|
||||
bool const isWildcardNetwork = signer.isFieldPresent(sfNetworkID) &&
|
||||
signer.getFieldU32(sfNetworkID) == 65535;
|
||||
bool const isWildcardNetwork =
|
||||
isFieldPresent(sfNetworkID) && getFieldU32(sfNetworkID) == 65535;
|
||||
|
||||
bool validSig = false;
|
||||
try
|
||||
{
|
||||
auto const spk = signer.getFieldVL(sfSigningPubKey);
|
||||
bool const fullyCanonical = (getFlags() & tfFullyCanonicalSig) ||
|
||||
(requireCanonicalSig == RequireFullyCanonicalSig::yes);
|
||||
|
||||
auto const spk = getFieldVL(sfSigningPubKey);
|
||||
|
||||
if (publicKeyType(makeSlice(spk)))
|
||||
{
|
||||
Blob const signature = signer.getFieldVL(sfTxnSignature);
|
||||
Blob const signature = getFieldVL(sfTxnSignature);
|
||||
Blob const data = getSigningData(*this);
|
||||
|
||||
validSig = isWildcardNetwork ||
|
||||
verify(PublicKey(makeSlice(spk)),
|
||||
data,
|
||||
makeSlice(data),
|
||||
makeSlice(signature),
|
||||
fullyCanonical);
|
||||
}
|
||||
}
|
||||
catch (std::exception const&)
|
||||
{
|
||||
// Assume it was a signature failure.
|
||||
validSig = false;
|
||||
}
|
||||
|
||||
if (!validSig)
|
||||
if (validSig == false)
|
||||
return Unexpected("Invalid signature.");
|
||||
|
||||
// Signature was verified.
|
||||
return {};
|
||||
}
|
||||
|
||||
Expected<void, std::string>
|
||||
STTx::checkSingleSign(RequireFullyCanonicalSig requireCanonicalSig) const
|
||||
{
|
||||
auto const data = getSigningData(*this);
|
||||
bool const fullyCanonical = (getFlags() & tfFullyCanonicalSig) ||
|
||||
(requireCanonicalSig == STTx::RequireFullyCanonicalSig::yes);
|
||||
return singleSignHelper(*this, makeSlice(data), fullyCanonical);
|
||||
}
|
||||
|
||||
Expected<void, std::string>
|
||||
STTx::checkBatchSingleSign(
|
||||
STObject const& batchSigner,
|
||||
RequireFullyCanonicalSig requireCanonicalSig) const
|
||||
{
|
||||
Serializer msg;
|
||||
serializeBatch(msg, getFlags(), getBatchTransactionIDs());
|
||||
bool const fullyCanonical = (getFlags() & tfFullyCanonicalSig) ||
|
||||
(requireCanonicalSig == STTx::RequireFullyCanonicalSig::yes);
|
||||
return singleSignHelper(batchSigner, msg.slice(), fullyCanonical);
|
||||
}
|
||||
|
||||
Expected<void, std::string>
|
||||
multiSignHelper(
|
||||
STObject const& signerObj,
|
||||
bool const fullyCanonical,
|
||||
std::function<Serializer(AccountID const&)> makeMsg,
|
||||
Rules const& rules)
|
||||
STTx::checkMultiSign(
|
||||
RequireFullyCanonicalSig requireCanonicalSig,
|
||||
Rules const& rules) const
|
||||
{
|
||||
// Make sure the MultiSigners are present. Otherwise they are not
|
||||
// attempting multi-signing and we just have a bad SigningPubKey.
|
||||
if (!signerObj.isFieldPresent(sfSigners))
|
||||
if (!isFieldPresent(sfSigners))
|
||||
return Unexpected("Empty SigningPubKey.");
|
||||
|
||||
// We don't allow both an sfSigners and an sfTxnSignature. Both fields
|
||||
// being present would indicate that the transaction is signed both ways.
|
||||
if (signerObj.isFieldPresent(sfTxnSignature))
|
||||
if (isFieldPresent(sfTxnSignature))
|
||||
return Unexpected("Cannot both single- and multi-sign.");
|
||||
|
||||
STArray const& signers{signerObj.getFieldArray(sfSigners)};
|
||||
STArray const& signers{getFieldArray(sfSigners)};
|
||||
|
||||
// There are well known bounds that the number of signers must be within.
|
||||
if (signers.size() < STTx::minMultiSigners ||
|
||||
signers.size() > STTx::maxMultiSigners(&rules))
|
||||
if (signers.size() < minMultiSigners ||
|
||||
signers.size() > maxMultiSigners(&rules))
|
||||
return Unexpected("Invalid Signers array size.");
|
||||
|
||||
// We can ease the computational load inside the loop a bit by
|
||||
// pre-constructing part of the data that we hash. Fill a Serializer
|
||||
// with the stuff that stays constant from signature to signature.
|
||||
Serializer const dataStart{startMultiSigningData(*this)};
|
||||
|
||||
// We also use the sfAccount field inside the loop. Get it once.
|
||||
auto const txnAccountID = signerObj.getAccountID(sfAccount);
|
||||
auto const txnAccountID = getAccountID(sfAccount);
|
||||
|
||||
// Determine whether signatures must be full canonical.
|
||||
bool const fullyCanonical = (getFlags() & tfFullyCanonicalSig) ||
|
||||
(requireCanonicalSig == RequireFullyCanonicalSig::yes);
|
||||
|
||||
// Signers must be in sorted order by AccountID.
|
||||
AccountID lastAccountID(beast::zero);
|
||||
|
||||
bool const isWildcardNetwork = signerObj.isFieldPresent(sfNetworkID) &&
|
||||
signerObj.getFieldU32(sfNetworkID) == 65535;
|
||||
bool const isWildcardNetwork =
|
||||
isFieldPresent(sfNetworkID) && getFieldU32(sfNetworkID) == 65535;
|
||||
|
||||
for (auto const& signer : signers)
|
||||
{
|
||||
@@ -477,7 +416,11 @@ multiSignHelper(
|
||||
bool validSig = false;
|
||||
try
|
||||
{
|
||||
Serializer s = dataStart;
|
||||
finishMultiSigningData(accountID, s);
|
||||
|
||||
auto spk = signer.getFieldVL(sfSigningPubKey);
|
||||
|
||||
if (publicKeyType(makeSlice(spk)))
|
||||
{
|
||||
Blob const signature = signer.getFieldVL(sfTxnSignature);
|
||||
@@ -485,7 +428,7 @@ multiSignHelper(
|
||||
// wildcard network gets a free pass
|
||||
validSig = isWildcardNetwork ||
|
||||
verify(PublicKey(makeSlice(spk)),
|
||||
makeMsg(accountID).slice(),
|
||||
s.slice(),
|
||||
makeSlice(signature),
|
||||
fullyCanonical);
|
||||
}
|
||||
@@ -504,90 +447,6 @@ multiSignHelper(
|
||||
return {};
|
||||
}
|
||||
|
||||
Expected<void, std::string>
|
||||
STTx::checkBatchMultiSign(
|
||||
STObject const& batchSigner,
|
||||
RequireFullyCanonicalSig requireCanonicalSig,
|
||||
Rules const& rules) const
|
||||
{
|
||||
bool const fullyCanonical = (getFlags() & tfFullyCanonicalSig) ||
|
||||
(requireCanonicalSig == RequireFullyCanonicalSig::yes);
|
||||
|
||||
// We can ease the computational load inside the loop a bit by
|
||||
// pre-constructing part of the data that we hash. Fill a Serializer
|
||||
// with the stuff that stays constant from signature to signature.
|
||||
Serializer dataStart;
|
||||
serializeBatch(dataStart, getFlags(), getBatchTransactionIDs());
|
||||
return multiSignHelper(
|
||||
batchSigner,
|
||||
fullyCanonical,
|
||||
[&dataStart](AccountID const& accountID) mutable -> Serializer {
|
||||
Serializer s = dataStart;
|
||||
finishMultiSigningData(accountID, s);
|
||||
return s;
|
||||
},
|
||||
rules);
|
||||
}
|
||||
|
||||
Expected<void, std::string>
|
||||
STTx::checkMultiSign(
|
||||
RequireFullyCanonicalSig requireCanonicalSig,
|
||||
Rules const& rules) const
|
||||
{
|
||||
bool const fullyCanonical = (getFlags() & tfFullyCanonicalSig) ||
|
||||
(requireCanonicalSig == RequireFullyCanonicalSig::yes);
|
||||
|
||||
// We can ease the computational load inside the loop a bit by
|
||||
// pre-constructing part of the data that we hash. Fill a Serializer
|
||||
// with the stuff that stays constant from signature to signature.
|
||||
Serializer dataStart = startMultiSigningData(*this);
|
||||
return multiSignHelper(
|
||||
*this,
|
||||
fullyCanonical,
|
||||
[&dataStart](AccountID const& accountID) mutable -> Serializer {
|
||||
Serializer s = dataStart;
|
||||
finishMultiSigningData(accountID, s);
|
||||
return s;
|
||||
},
|
||||
rules);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Retrieves a batch of transaction IDs from the STTx.
|
||||
*
|
||||
* This function returns a vector of transaction IDs by extracting them from
|
||||
* the field array `sfRawTransactions` within the STTx. If the batch
|
||||
* transaction IDs have already been computed and cached in `batch_txn_ids_`,
|
||||
* it returns the cached vector. Otherwise, it computes the transaction IDs,
|
||||
* caches them, and then returns the vector.
|
||||
*
|
||||
* @return A vector of `uint256` containing the batch transaction IDs.
|
||||
*
|
||||
* @note The function asserts that the `sfRawTransactions` field array is not
|
||||
* empty and that the size of the computed batch transaction IDs matches the
|
||||
* size of the `sfRawTransactions` field array.
|
||||
*/
|
||||
std::vector<uint256>
|
||||
STTx::getBatchTransactionIDs() const
|
||||
{
|
||||
XRPL_ASSERT(
|
||||
getTxnType() == ttBATCH,
|
||||
"STTx::getBatchTransactionIDs : not a batch transaction");
|
||||
XRPL_ASSERT(
|
||||
getFieldArray(sfRawTransactions).size() != 0,
|
||||
"STTx::getBatchTransactionIDs : empty raw transactions");
|
||||
if (batch_txn_ids_.size() != 0)
|
||||
return batch_txn_ids_;
|
||||
|
||||
for (STObject const& rb : getFieldArray(sfRawTransactions))
|
||||
batch_txn_ids_.push_back(rb.getHash(HashPrefix::transactionID));
|
||||
|
||||
XRPL_ASSERT(
|
||||
batch_txn_ids_.size() == getFieldArray(sfRawTransactions).size(),
|
||||
"STTx::getBatchTransactionIDs : batch transaction IDs size mismatch");
|
||||
return batch_txn_ids_;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
static bool
|
||||
@@ -780,42 +639,6 @@ invalidMPTAmountInTx(STObject const& tx)
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool
|
||||
isRawTransactionOkay(STObject const& st, std::string& reason)
|
||||
{
|
||||
if (!st.isFieldPresent(sfRawTransactions))
|
||||
return true;
|
||||
|
||||
if (st.isFieldPresent(sfBatchSigners) &&
|
||||
st.getFieldArray(sfBatchSigners).size() > maxBatchTxCount)
|
||||
{
|
||||
reason = "Batch Signers array exceeds max entries.";
|
||||
return false;
|
||||
}
|
||||
|
||||
auto const& rawTxns = st.getFieldArray(sfRawTransactions);
|
||||
if (rawTxns.size() > maxBatchTxCount)
|
||||
{
|
||||
reason = "Raw Transactions array exceeds max entries.";
|
||||
return false;
|
||||
}
|
||||
for (STObject raw : rawTxns)
|
||||
{
|
||||
try
|
||||
{
|
||||
TxType const tt =
|
||||
safe_cast<TxType>(raw.getFieldU16(sfTransactionType));
|
||||
raw.applyTemplate(getTxFormat(tt)->getSOTemplate());
|
||||
}
|
||||
catch (std::exception const& e)
|
||||
{
|
||||
reason = e.what();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
passesLocalChecks(STObject const& st, std::string& reason)
|
||||
{
|
||||
@@ -840,9 +663,6 @@ passesLocalChecks(STObject const& st, std::string& reason)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isRawTransactionOkay(st, reason))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -858,15 +678,13 @@ sterilize(STTx const& stx)
|
||||
bool
|
||||
isPseudoTx(STObject const& tx)
|
||||
{
|
||||
auto const t = tx[~sfTransactionType];
|
||||
|
||||
auto t = tx[~sfTransactionType];
|
||||
if (!t)
|
||||
return false;
|
||||
|
||||
auto const tt = safe_cast<TxType>(*t);
|
||||
|
||||
auto tt = safe_cast<TxType>(*t);
|
||||
return tt == ttAMENDMENT || tt == ttFEE || tt == ttUNL_MODIFY ||
|
||||
tt == ttEMIT_FAILURE || tt == ttUNL_REPORT || tt == ttCRON;
|
||||
tt == ttEMIT_FAILURE || tt == ttUNL_REPORT;
|
||||
}
|
||||
|
||||
} // namespace ripple
|
||||
|
||||
@@ -98,7 +98,6 @@ transResults()
|
||||
MAKE_ERROR(tecINSUF_RESERVE_SELLER, "The seller of an object has insufficient reserves, and thus cannot complete the sale."),
|
||||
MAKE_ERROR(tecIMMUTABLE, "The remark is marked immutable on the object, and therefore cannot be updated."),
|
||||
MAKE_ERROR(tecTOO_MANY_REMARKS, "The number of remarks on the object would exceed the limit of 32."),
|
||||
MAKE_ERROR(tecHAS_HOOK_STATE, "Delete all hook state before reducing scale"),
|
||||
MAKE_ERROR(tecINCOMPLETE, "Some work was completed, but more submissions required to finish."),
|
||||
MAKE_ERROR(tecXCHAIN_BAD_TRANSFER_ISSUE, "Bad xchain transfer issue."),
|
||||
MAKE_ERROR(tecXCHAIN_NO_CLAIM_ID, "No such xchain claim id."),
|
||||
@@ -222,7 +221,6 @@ transResults()
|
||||
MAKE_ERROR(temARRAY_EMPTY, "Malformed: Array is empty."),
|
||||
MAKE_ERROR(temARRAY_TOO_LARGE, "Malformed: Array is too large."),
|
||||
MAKE_ERROR(temBAD_TRANSFER_FEE, "Malformed: Transfer fee is outside valid range."),
|
||||
MAKE_ERROR(temINVALID_INNER_BATCH, "Malformed: Invalid inner batch transaction."),
|
||||
|
||||
MAKE_ERROR(temHOOK_DATA_TOO_LARGE, "Malformed: The hook CreateCode field is to large to be applied to the ledger."),
|
||||
MAKE_ERROR(terRETRY, "Retry transaction."),
|
||||
|
||||
@@ -49,9 +49,6 @@ TxMeta::TxMeta(
|
||||
|
||||
if (obj.isFieldPresent(sfHookEmissions))
|
||||
setHookEmissions(obj.getFieldArray(sfHookEmissions));
|
||||
|
||||
if (obj.isFieldPresent(sfParentBatchID))
|
||||
setParentBatchId(obj.getFieldH256(sfParentBatchID));
|
||||
}
|
||||
|
||||
TxMeta::TxMeta(uint256 const& txid, std::uint32_t ledger, STObject const& obj)
|
||||
@@ -78,9 +75,6 @@ TxMeta::TxMeta(uint256 const& txid, std::uint32_t ledger, STObject const& obj)
|
||||
|
||||
if (obj.isFieldPresent(sfHookEmissions))
|
||||
setHookEmissions(obj.getFieldArray(sfHookEmissions));
|
||||
|
||||
if (obj.isFieldPresent(sfParentBatchID))
|
||||
setParentBatchId(obj.getFieldH256(sfParentBatchID));
|
||||
}
|
||||
|
||||
TxMeta::TxMeta(uint256 const& txid, std::uint32_t ledger, Blob const& vec)
|
||||
@@ -96,15 +90,11 @@ TxMeta::TxMeta(
|
||||
{
|
||||
}
|
||||
|
||||
TxMeta::TxMeta(
|
||||
uint256 const& transactionID,
|
||||
std::uint32_t ledger,
|
||||
std::optional<uint256> parentBatchId)
|
||||
TxMeta::TxMeta(uint256 const& transactionID, std::uint32_t ledger)
|
||||
: mTransactionID(transactionID)
|
||||
, mLedger(ledger)
|
||||
, mIndex(static_cast<std::uint32_t>(-1))
|
||||
, mResult(255)
|
||||
, mParentBatchId(parentBatchId)
|
||||
, mNodes(sfAffectedNodes)
|
||||
{
|
||||
mNodes.reserve(32);
|
||||
@@ -255,9 +245,6 @@ TxMeta::getAsObject() const
|
||||
if (hasHookEmissions())
|
||||
metaData.setFieldArray(sfHookEmissions, getHookEmissions());
|
||||
|
||||
if (hasParentBatchId())
|
||||
metaData.setFieldH256(sfParentBatchID, getParentBatchId());
|
||||
|
||||
return metaData;
|
||||
}
|
||||
|
||||
|
||||
@@ -94,10 +94,20 @@ private:
|
||||
sendmax(BTC(1'000)),
|
||||
txflags(tfPartialPayment));
|
||||
|
||||
BEAST_EXPECT(ammCarol.expectBalances(
|
||||
STAmount{BTC, UINT64_C(1'001'000000374815), -12},
|
||||
USD(100'000),
|
||||
ammCarol.tokens()));
|
||||
if (!features[fixAMMv1_1])
|
||||
{
|
||||
BEAST_EXPECT(ammCarol.expectBalances(
|
||||
STAmount{BTC, UINT64_C(1'001'000000374812), -12},
|
||||
USD(100'000),
|
||||
ammCarol.tokens()));
|
||||
}
|
||||
else
|
||||
{
|
||||
BEAST_EXPECT(ammCarol.expectBalances(
|
||||
STAmount{BTC, UINT64_C(1'001'000000374815), -12},
|
||||
USD(100'000),
|
||||
ammCarol.tokens()));
|
||||
}
|
||||
|
||||
env.require(balance(bob, USD(200'100)));
|
||||
BEAST_EXPECT(isOffer(env, carol, BTC(49), XRP(49)));
|
||||
@@ -710,12 +720,24 @@ private:
|
||||
auto const jrr = env.rpc("json", "submit", to_string(payment));
|
||||
BEAST_EXPECT(jrr[jss::result][jss::status] == "success");
|
||||
BEAST_EXPECT(jrr[jss::result][jss::engine_result] == "tesSUCCESS");
|
||||
BEAST_EXPECT(ammAlice.expectBalances(
|
||||
STAmount(XTS, UINT64_C(101'0101010101011), -13),
|
||||
XXX(99),
|
||||
ammAlice.tokens()));
|
||||
BEAST_EXPECT(expectLine(
|
||||
env, bob, STAmount{XTS, UINT64_C(98'9898989898989), -13}));
|
||||
if (!features[fixAMMv1_1])
|
||||
{
|
||||
BEAST_EXPECT(ammAlice.expectBalances(
|
||||
STAmount(XTS, UINT64_C(101'010101010101), -12),
|
||||
XXX(99),
|
||||
ammAlice.tokens()));
|
||||
BEAST_EXPECT(expectLine(
|
||||
env, bob, STAmount{XTS, UINT64_C(98'989898989899), -12}));
|
||||
}
|
||||
else
|
||||
{
|
||||
BEAST_EXPECT(ammAlice.expectBalances(
|
||||
STAmount(XTS, UINT64_C(101'0101010101011), -13),
|
||||
XXX(99),
|
||||
ammAlice.tokens()));
|
||||
BEAST_EXPECT(expectLine(
|
||||
env, bob, STAmount{XTS, UINT64_C(98'9898989898989), -13}));
|
||||
}
|
||||
BEAST_EXPECT(expectLine(env, bob, XXX(101)));
|
||||
}
|
||||
|
||||
@@ -1269,17 +1291,34 @@ private:
|
||||
env(offer(cam, B_BUX(30), A_BUX(30)));
|
||||
|
||||
// AMM is consumed up to the first cam Offer quality
|
||||
BEAST_EXPECT(ammCarol.expectBalances(
|
||||
STAmount{A_BUX, UINT64_C(309'3541659651604), -13},
|
||||
STAmount{B_BUX, UINT64_C(320'0215509984419), -13},
|
||||
ammCarol.tokens()));
|
||||
BEAST_EXPECT(expectOffers(
|
||||
env,
|
||||
cam,
|
||||
1,
|
||||
{{Amounts{
|
||||
STAmount{B_BUX, UINT64_C(20'0215509984419), -13},
|
||||
STAmount{A_BUX, UINT64_C(20'0215509984419), -13}}}}));
|
||||
if (!features[fixAMMv1_1])
|
||||
{
|
||||
BEAST_EXPECT(ammCarol.expectBalances(
|
||||
STAmount{A_BUX, UINT64_C(309'3541659651605), -13},
|
||||
STAmount{B_BUX, UINT64_C(320'0215509984417), -13},
|
||||
ammCarol.tokens()));
|
||||
BEAST_EXPECT(expectOffers(
|
||||
env,
|
||||
cam,
|
||||
1,
|
||||
{{Amounts{
|
||||
STAmount{B_BUX, UINT64_C(20'0215509984417), -13},
|
||||
STAmount{A_BUX, UINT64_C(20'0215509984417), -13}}}}));
|
||||
}
|
||||
else
|
||||
{
|
||||
BEAST_EXPECT(ammCarol.expectBalances(
|
||||
STAmount{A_BUX, UINT64_C(309'3541659651604), -13},
|
||||
STAmount{B_BUX, UINT64_C(320'0215509984419), -13},
|
||||
ammCarol.tokens()));
|
||||
BEAST_EXPECT(expectOffers(
|
||||
env,
|
||||
cam,
|
||||
1,
|
||||
{{Amounts{
|
||||
STAmount{B_BUX, UINT64_C(20'0215509984419), -13},
|
||||
STAmount{A_BUX, UINT64_C(20'0215509984419), -13}}}}));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1405,6 +1444,7 @@ private:
|
||||
using namespace jtx;
|
||||
FeatureBitset const all{supported_amendments()};
|
||||
testRmFundedOffer(all);
|
||||
testRmFundedOffer(all - fixAMMv1_1);
|
||||
testEnforceNoRipple(all);
|
||||
testFillModes(all);
|
||||
testOfferCrossWithXRP(all);
|
||||
@@ -1418,6 +1458,7 @@ private:
|
||||
testOfferCreateThenCross(all);
|
||||
testSellFlagExceedLimit(all);
|
||||
testGatewayCrossCurrency(all);
|
||||
testGatewayCrossCurrency(all - fixAMMv1_1);
|
||||
testBridgedCross(all);
|
||||
testSellWithFillOrKill(all);
|
||||
testTransferRateOffer(all);
|
||||
@@ -1425,6 +1466,7 @@ private:
|
||||
testBadPathAssert(all);
|
||||
testSellFlagBasic(all);
|
||||
testDirectToDirectPath(all);
|
||||
testDirectToDirectPath(all - fixAMMv1_1);
|
||||
testRequireAuth(all);
|
||||
testMissingAuth(all);
|
||||
}
|
||||
@@ -1478,6 +1520,7 @@ private:
|
||||
auto const AUD = gw["AUD"];
|
||||
env.fund(XRP(10'000), alice, bob, carol, gw);
|
||||
env(rate(gw, 1.1));
|
||||
env.close();
|
||||
env.trust(AUD(2'000), bob, carol);
|
||||
env(pay(gw, carol, AUD(51)));
|
||||
env.close();
|
||||
@@ -1887,7 +1930,7 @@ private:
|
||||
|
||||
{
|
||||
// simple IOU/IOU offer
|
||||
Env env(*this, features - featureXahauGenesis - featureTouch);
|
||||
Env env(*this, features);
|
||||
|
||||
fund(
|
||||
env,
|
||||
@@ -1898,6 +1941,7 @@ private:
|
||||
Fund::All);
|
||||
|
||||
AMM ammBob(env, bob, BTC(100), USD(150));
|
||||
env.close();
|
||||
|
||||
env(pay(alice, carol, USD(50)), path(~USD), sendmax(BTC(50)));
|
||||
|
||||
@@ -1985,10 +2029,11 @@ private:
|
||||
}
|
||||
{
|
||||
// test unfunded offers are removed when payment succeeds
|
||||
Env env(*this, features - featureXahauGenesis - featureTouch);
|
||||
Env env(*this, features);
|
||||
|
||||
env.fund(XRP(10'000), alice, carol, gw);
|
||||
env.fund(XRP(10'000), bob);
|
||||
env.close();
|
||||
env.trust(USD(1'000), alice, bob, carol);
|
||||
env.trust(BTC(1'000), alice, bob, carol);
|
||||
env.trust(EUR(1'000), alice, bob, carol);
|
||||
@@ -2281,16 +2326,36 @@ private:
|
||||
txflags(tfNoRippleDirect | tfPartialPayment | tfLimitQuality));
|
||||
env.close();
|
||||
|
||||
// alice buys 77.2727USD with 75.5555GBP and pays 25% tr fee
|
||||
// on 75.5555GBP
|
||||
// 1,200 - 75.55555*1.25 = 1200 - 94.4444 = 1105.55555GBP
|
||||
BEAST_EXPECT(expectLine(
|
||||
env, alice, STAmount{GBP, UINT64_C(1'105'555555555554), -12}));
|
||||
// 75.5555GBP is swapped in for 77.7272USD
|
||||
BEAST_EXPECT(amm.expectBalances(
|
||||
STAmount{GBP, UINT64_C(1'075'555555555557), -12},
|
||||
STAmount{USD, UINT64_C(1'022'727272727272), -12},
|
||||
amm.tokens()));
|
||||
if (!features[fixAMMv1_1])
|
||||
{
|
||||
// alice buys 77.2727USD with 75.5555GBP and pays 25% tr fee
|
||||
// on 75.5555GBP
|
||||
// 1,200 - 75.55555*1.25 = 1200 - 94.4444 = 1105.55555GBP
|
||||
BEAST_EXPECT(expectLine(
|
||||
env,
|
||||
alice,
|
||||
STAmount{GBP, UINT64_C(1'105'555555555555), -12}));
|
||||
// 75.5555GBP is swapped in for 77.7272USD
|
||||
BEAST_EXPECT(amm.expectBalances(
|
||||
STAmount{GBP, UINT64_C(1'075'555555555556), -12},
|
||||
STAmount{USD, UINT64_C(1'022'727272727272), -12},
|
||||
amm.tokens()));
|
||||
}
|
||||
else
|
||||
{
|
||||
// alice buys 77.2727USD with 75.5555GBP and pays 25% tr fee
|
||||
// on 75.5555GBP
|
||||
// 1,200 - 75.55555*1.25 = 1200 - 94.4444 = 1105.55555GBP
|
||||
BEAST_EXPECT(expectLine(
|
||||
env,
|
||||
alice,
|
||||
STAmount{GBP, UINT64_C(1'105'555555555554), -12}));
|
||||
// 75.5555GBP is swapped in for 77.7272USD
|
||||
BEAST_EXPECT(amm.expectBalances(
|
||||
STAmount{GBP, UINT64_C(1'075'555555555557), -12},
|
||||
STAmount{USD, UINT64_C(1'022'727272727272), -12},
|
||||
amm.tokens()));
|
||||
}
|
||||
BEAST_EXPECT(expectLine(
|
||||
env, carol, STAmount{USD, UINT64_C(1'277'272727272728), -12}));
|
||||
}
|
||||
@@ -2308,18 +2373,36 @@ private:
|
||||
env(offer(alice, EUR(100), USD(100)));
|
||||
env.close();
|
||||
|
||||
// 95.2380USD is swapped in for 100EUR
|
||||
BEAST_EXPECT(amm.expectBalances(
|
||||
STAmount{USD, UINT64_C(1'095'238095238096), -12},
|
||||
EUR(1'050),
|
||||
amm.tokens()));
|
||||
// alice pays 25% tr fee on 95.2380USD
|
||||
// 1200-95.2380*1.25 = 1200 - 119.0477 = 1080.9523USD
|
||||
BEAST_EXPECT(expectLine(
|
||||
env,
|
||||
alice,
|
||||
STAmount{USD, UINT64_C(1'080'95238095238), -11},
|
||||
EUR(1'300)));
|
||||
if (!features[fixAMMv1_1])
|
||||
{
|
||||
// 95.2380USD is swapped in for 100EUR
|
||||
BEAST_EXPECT(amm.expectBalances(
|
||||
STAmount{USD, UINT64_C(1'095'238095238095), -12},
|
||||
EUR(1'050),
|
||||
amm.tokens()));
|
||||
// alice pays 25% tr fee on 95.2380USD
|
||||
// 1200-95.2380*1.25 = 1200 - 119.0477 = 1080.9523USD
|
||||
BEAST_EXPECT(expectLine(
|
||||
env,
|
||||
alice,
|
||||
STAmount{USD, UINT64_C(1'080'952380952381), -12},
|
||||
EUR(1'300)));
|
||||
}
|
||||
else
|
||||
{
|
||||
// 95.2380USD is swapped in for 100EUR
|
||||
BEAST_EXPECT(amm.expectBalances(
|
||||
STAmount{USD, UINT64_C(1'095'238095238096), -12},
|
||||
EUR(1'050),
|
||||
amm.tokens()));
|
||||
// alice pays 25% tr fee on 95.2380USD
|
||||
// 1200-95.2380*1.25 = 1200 - 119.0477 = 1080.9523USD
|
||||
BEAST_EXPECT(expectLine(
|
||||
env,
|
||||
alice,
|
||||
STAmount{USD, UINT64_C(1'080'95238095238), -11},
|
||||
EUR(1'300)));
|
||||
}
|
||||
BEAST_EXPECT(expectOffers(env, alice, 0));
|
||||
}
|
||||
|
||||
@@ -2343,23 +2426,42 @@ private:
|
||||
env(pay(gw, dan, USD(1'000)));
|
||||
AMM ammDan(env, dan, USD(1'000), EUR(1'050));
|
||||
|
||||
// alice -> bob -> gw -> carol. $50 should have transfer fee;
|
||||
// $10, no fee
|
||||
env(pay(alice, carol, EUR(50)),
|
||||
path(bob, gw, ~EUR),
|
||||
sendmax(USDA(60.1)),
|
||||
txflags(tfNoRippleDirect));
|
||||
BEAST_EXPECT(ammDan.expectBalances(
|
||||
STAmount{USD, UINT64_C(1'050'000000000001), -12},
|
||||
EUR(1'000),
|
||||
ammDan.tokens()));
|
||||
BEAST_EXPECT(expectLine(env, dan, USD(0)));
|
||||
BEAST_EXPECT(expectLine(env, dan, EUR(0)));
|
||||
BEAST_EXPECT(expectLine(
|
||||
env, bob, STAmount{USD, INT64_C(-10'000000000001), -12}));
|
||||
BEAST_EXPECT(expectLine(
|
||||
env, bob, STAmount{USDA, UINT64_C(60'000000000001), -12}));
|
||||
BEAST_EXPECT(expectLine(env, carol, EUR(50)));
|
||||
if (!features[fixAMMv1_1])
|
||||
{
|
||||
// alice -> bob -> gw -> carol. $50 should have transfer fee;
|
||||
// $10, no fee
|
||||
env(pay(alice, carol, EUR(50)),
|
||||
path(bob, gw, ~EUR),
|
||||
sendmax(USDA(60)),
|
||||
txflags(tfNoRippleDirect));
|
||||
BEAST_EXPECT(ammDan.expectBalances(
|
||||
USD(1'050), EUR(1'000), ammDan.tokens()));
|
||||
BEAST_EXPECT(expectLine(env, dan, USD(0)));
|
||||
BEAST_EXPECT(expectLine(env, dan, EUR(0)));
|
||||
BEAST_EXPECT(expectLine(env, bob, USD(-10)));
|
||||
BEAST_EXPECT(expectLine(env, bob, USDA(60)));
|
||||
BEAST_EXPECT(expectLine(env, carol, EUR(50)));
|
||||
}
|
||||
else
|
||||
{
|
||||
// alice -> bob -> gw -> carol. $50 should have transfer fee;
|
||||
// $10, no fee
|
||||
env(pay(alice, carol, EUR(50)),
|
||||
path(bob, gw, ~EUR),
|
||||
sendmax(USDA(60.1)),
|
||||
txflags(tfNoRippleDirect));
|
||||
BEAST_EXPECT(ammDan.expectBalances(
|
||||
STAmount{USD, UINT64_C(1'050'000000000001), -12},
|
||||
EUR(1'000),
|
||||
ammDan.tokens()));
|
||||
BEAST_EXPECT(expectLine(env, dan, USD(0)));
|
||||
BEAST_EXPECT(expectLine(env, dan, EUR(0)));
|
||||
BEAST_EXPECT(expectLine(
|
||||
env, bob, STAmount{USD, INT64_C(-10'000000000001), -12}));
|
||||
BEAST_EXPECT(expectLine(
|
||||
env, bob, STAmount{USDA, UINT64_C(60'000000000001), -12}));
|
||||
BEAST_EXPECT(expectLine(env, carol, EUR(50)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2371,7 +2473,7 @@ private:
|
||||
|
||||
{
|
||||
// payment via AMM
|
||||
Env env(*this, features - featureXahauGenesis - featureTouch);
|
||||
Env env(*this, features);
|
||||
|
||||
fund(
|
||||
env,
|
||||
@@ -2393,10 +2495,21 @@ private:
|
||||
// alice buys 107.1428USD with 120GBP and pays 25% tr fee on 120GBP
|
||||
// 1,000 - 120*1.25 = 850GBP
|
||||
BEAST_EXPECT(expectLine(env, alice, GBP(850)));
|
||||
BEAST_EXPECT(amm.expectBalances(
|
||||
GBP(1'120),
|
||||
STAmount{USD, UINT64_C(892'8571428571429), -13},
|
||||
amm.tokens()));
|
||||
if (!features[fixAMMv1_1])
|
||||
{
|
||||
// 120GBP is swapped in for 107.1428USD
|
||||
BEAST_EXPECT(amm.expectBalances(
|
||||
GBP(1'120),
|
||||
STAmount{USD, UINT64_C(892'8571428571428), -13},
|
||||
amm.tokens()));
|
||||
}
|
||||
else
|
||||
{
|
||||
BEAST_EXPECT(amm.expectBalances(
|
||||
GBP(1'120),
|
||||
STAmount{USD, UINT64_C(892'8571428571429), -13},
|
||||
amm.tokens()));
|
||||
}
|
||||
// 25% of 85.7142USD is paid in tr fee
|
||||
// 85.7142*1.25 = 107.1428USD
|
||||
BEAST_EXPECT(expectLine(
|
||||
@@ -2471,20 +2584,38 @@ private:
|
||||
env.close();
|
||||
|
||||
BEAST_EXPECT(expectLine(env, alice, GBP(850)));
|
||||
// alice buys 107.1428EUR with 120GBP and pays 25% tr fee on
|
||||
// 120GBP 1,000 - 120*1.25 = 850GBP 120GBP is swapped in for
|
||||
// 107.1428EUR
|
||||
BEAST_EXPECT(amm1.expectBalances(
|
||||
GBP(1'120),
|
||||
STAmount{EUR, UINT64_C(892'8571428571429), -13},
|
||||
amm1.tokens()));
|
||||
// 25% on 85.7142EUR is paid in tr fee 85.7142*1.25 =
|
||||
// 107.1428EUR 85.7142EUR is swapped in for 78.9473USD
|
||||
BEAST_EXPECT(amm2.expectBalances(
|
||||
STAmount(EUR, UINT64_C(1'085'714285714286), -12),
|
||||
STAmount{USD, UINT64_C(921'052631578948), -12},
|
||||
amm2.tokens()));
|
||||
|
||||
if (!features[fixAMMv1_1])
|
||||
{
|
||||
// alice buys 107.1428EUR with 120GBP and pays 25% tr fee on
|
||||
// 120GBP 1,000 - 120*1.25 = 850GBP 120GBP is swapped in for
|
||||
// 107.1428EUR
|
||||
BEAST_EXPECT(amm1.expectBalances(
|
||||
GBP(1'120),
|
||||
STAmount{EUR, UINT64_C(892'8571428571428), -13},
|
||||
amm1.tokens()));
|
||||
// 25% on 85.7142EUR is paid in tr fee 85.7142*1.25 =
|
||||
// 107.1428EUR 85.7142EUR is swapped in for 78.9473USD
|
||||
BEAST_EXPECT(amm2.expectBalances(
|
||||
STAmount(EUR, UINT64_C(1'085'714285714286), -12),
|
||||
STAmount{USD, UINT64_C(921'0526315789471), -13},
|
||||
amm2.tokens()));
|
||||
}
|
||||
else
|
||||
{
|
||||
// alice buys 107.1428EUR with 120GBP and pays 25% tr fee on
|
||||
// 120GBP 1,000 - 120*1.25 = 850GBP 120GBP is swapped in for
|
||||
// 107.1428EUR
|
||||
BEAST_EXPECT(amm1.expectBalances(
|
||||
GBP(1'120),
|
||||
STAmount{EUR, UINT64_C(892'8571428571429), -13},
|
||||
amm1.tokens()));
|
||||
// 25% on 85.7142EUR is paid in tr fee 85.7142*1.25 =
|
||||
// 107.1428EUR 85.7142EUR is swapped in for 78.9473USD
|
||||
BEAST_EXPECT(amm2.expectBalances(
|
||||
STAmount(EUR, UINT64_C(1'085'714285714286), -12),
|
||||
STAmount{USD, UINT64_C(921'052631578948), -12},
|
||||
amm2.tokens()));
|
||||
}
|
||||
// 25% on 63.1578USD is paid in tr fee 63.1578*1.25 = 78.9473USD
|
||||
BEAST_EXPECT(expectLine(
|
||||
env, carol, STAmount(USD, UINT64_C(1'063'157894736842), -12)));
|
||||
@@ -2570,17 +2701,31 @@ private:
|
||||
txflags(tfNoRippleDirect | tfPartialPayment | tfLimitQuality));
|
||||
env.close();
|
||||
|
||||
// alice buys 28.125USD with 24GBP and pays 25% tr fee
|
||||
// on 24GBP
|
||||
// 1,200 - 24*1.25 =~ 1,170GBP
|
||||
BEAST_EXPECT(expectLine(
|
||||
env, alice, STAmount{GBP, UINT64_C(1'169'999999999999), -12}));
|
||||
// 24GBP is swapped in for 28.125USD
|
||||
BEAST_EXPECT(amm.expectBalances(
|
||||
STAmount{GBP, UINT64_C(1'024'000000000001), -12},
|
||||
USD(1'171.875),
|
||||
amm.tokens()));
|
||||
|
||||
if (!features[fixAMMv1_1])
|
||||
{
|
||||
// alice buys 28.125USD with 24GBP and pays 25% tr fee
|
||||
// on 24GBP
|
||||
// 1,200 - 24*1.25 = 1,170GBP
|
||||
BEAST_EXPECT(expectLine(env, alice, GBP(1'170)));
|
||||
// 24GBP is swapped in for 28.125USD
|
||||
BEAST_EXPECT(amm.expectBalances(
|
||||
GBP(1'024), USD(1'171.875), amm.tokens()));
|
||||
}
|
||||
else
|
||||
{
|
||||
// alice buys 28.125USD with 24GBP and pays 25% tr fee
|
||||
// on 24GBP
|
||||
// 1,200 - 24*1.25 =~ 1,170GBP
|
||||
BEAST_EXPECT(expectLine(
|
||||
env,
|
||||
alice,
|
||||
STAmount{GBP, UINT64_C(1'169'999999999999), -12}));
|
||||
// 24GBP is swapped in for 28.125USD
|
||||
BEAST_EXPECT(amm.expectBalances(
|
||||
STAmount{GBP, UINT64_C(1'024'000000000001), -12},
|
||||
USD(1'171.875),
|
||||
amm.tokens()));
|
||||
}
|
||||
// 25% on 22.5USD is paid in tr fee
|
||||
// 22.5*1.25 = 28.125USD
|
||||
BEAST_EXPECT(expectLine(env, carol, USD(1'222.5)));
|
||||
@@ -2613,32 +2758,66 @@ private:
|
||||
txflags(tfNoRippleDirect | tfPartialPayment | tfLimitQuality));
|
||||
env.close();
|
||||
|
||||
// alice buys 70.4210EUR with 70.4210GBP via the offer
|
||||
// and pays 25% tr fee on 70.4210GBP
|
||||
// 1,400 - 70.4210*1.25 = 1400 - 88.0262 = 1311.9736GBP
|
||||
BEAST_EXPECT(expectLine(
|
||||
env, alice, STAmount{GBP, UINT64_C(1'311'973684210525), -12}));
|
||||
// ed doesn't pay tr fee, the balances reflect consumed offer
|
||||
// 70.4210GBP/70.4210EUR
|
||||
BEAST_EXPECT(expectLine(
|
||||
env,
|
||||
ed,
|
||||
STAmount{EUR, UINT64_C(1'329'57894736842), -11},
|
||||
STAmount{GBP, UINT64_C(1'470'42105263158), -11}));
|
||||
BEAST_EXPECT(expectOffers(
|
||||
env,
|
||||
ed,
|
||||
1,
|
||||
{Amounts{
|
||||
STAmount{GBP, UINT64_C(929'57894736842), -11},
|
||||
STAmount{EUR, UINT64_C(929'57894736842), -11}}}));
|
||||
// 25% on 56.3368EUR is paid in tr fee 56.3368*1.25 = 70.4210EUR
|
||||
// 56.3368EUR is swapped in for 74.6651USD
|
||||
BEAST_EXPECT(amm.expectBalances(
|
||||
STAmount{EUR, UINT64_C(1'056'336842105264), -12},
|
||||
STAmount{USD, UINT64_C(1'325'334821428571), -12},
|
||||
amm.tokens()));
|
||||
|
||||
if (!features[fixAMMv1_1])
|
||||
{
|
||||
// alice buys 70.4210EUR with 70.4210GBP via the offer
|
||||
// and pays 25% tr fee on 70.4210GBP
|
||||
// 1,400 - 70.4210*1.25 = 1400 - 88.0262 = 1311.9736GBP
|
||||
BEAST_EXPECT(expectLine(
|
||||
env,
|
||||
alice,
|
||||
STAmount{GBP, UINT64_C(1'311'973684210527), -12}));
|
||||
// ed doesn't pay tr fee, the balances reflect consumed offer
|
||||
// 70.4210GBP/70.4210EUR
|
||||
BEAST_EXPECT(expectLine(
|
||||
env,
|
||||
ed,
|
||||
STAmount{EUR, UINT64_C(1'329'578947368421), -12},
|
||||
STAmount{GBP, UINT64_C(1'470'421052631579), -12}));
|
||||
BEAST_EXPECT(expectOffers(
|
||||
env,
|
||||
ed,
|
||||
1,
|
||||
{Amounts{
|
||||
STAmount{GBP, UINT64_C(929'5789473684212), -13},
|
||||
STAmount{EUR, UINT64_C(929'5789473684212), -13}}}));
|
||||
// 25% on 56.3368EUR is paid in tr fee 56.3368*1.25 = 70.4210EUR
|
||||
// 56.3368EUR is swapped in for 74.6651USD
|
||||
BEAST_EXPECT(amm.expectBalances(
|
||||
STAmount{EUR, UINT64_C(1'056'336842105263), -12},
|
||||
STAmount{USD, UINT64_C(1'325'334821428571), -12},
|
||||
amm.tokens()));
|
||||
}
|
||||
else
|
||||
{
|
||||
// alice buys 70.4210EUR with 70.4210GBP via the offer
|
||||
// and pays 25% tr fee on 70.4210GBP
|
||||
// 1,400 - 70.4210*1.25 = 1400 - 88.0262 = 1311.9736GBP
|
||||
BEAST_EXPECT(expectLine(
|
||||
env,
|
||||
alice,
|
||||
STAmount{GBP, UINT64_C(1'311'973684210525), -12}));
|
||||
// ed doesn't pay tr fee, the balances reflect consumed offer
|
||||
// 70.4210GBP/70.4210EUR
|
||||
BEAST_EXPECT(expectLine(
|
||||
env,
|
||||
ed,
|
||||
STAmount{EUR, UINT64_C(1'329'57894736842), -11},
|
||||
STAmount{GBP, UINT64_C(1'470'42105263158), -11}));
|
||||
BEAST_EXPECT(expectOffers(
|
||||
env,
|
||||
ed,
|
||||
1,
|
||||
{Amounts{
|
||||
STAmount{GBP, UINT64_C(929'57894736842), -11},
|
||||
STAmount{EUR, UINT64_C(929'57894736842), -11}}}));
|
||||
// 25% on 56.3368EUR is paid in tr fee 56.3368*1.25 = 70.4210EUR
|
||||
// 56.3368EUR is swapped in for 74.6651USD
|
||||
BEAST_EXPECT(amm.expectBalances(
|
||||
STAmount{EUR, UINT64_C(1'056'336842105264), -12},
|
||||
STAmount{USD, UINT64_C(1'325'334821428571), -12},
|
||||
amm.tokens()));
|
||||
}
|
||||
// 25% on 59.7321USD is paid in tr fee 59.7321*1.25 = 74.6651USD
|
||||
BEAST_EXPECT(expectLine(
|
||||
env, carol, STAmount(USD, UINT64_C(1'459'732142857143), -12)));
|
||||
@@ -2671,19 +2850,40 @@ private:
|
||||
txflags(tfNoRippleDirect | tfPartialPayment | tfLimitQuality));
|
||||
env.close();
|
||||
|
||||
// alice buys 53.3322EUR with 56.3368GBP via the amm
|
||||
// and pays 25% tr fee on 56.3368GBP
|
||||
// 1,400 - 56.3368*1.25 = 1400 - 70.4210 = 1329.5789GBP
|
||||
BEAST_EXPECT(expectLine(
|
||||
env, alice, STAmount{GBP, UINT64_C(1'329'57894736842), -11}));
|
||||
//// 25% on 56.3368EUR is paid in tr fee 56.3368*1.25
|
||||
///= 70.4210EUR
|
||||
// 56.3368GBP is swapped in for 53.3322EUR
|
||||
BEAST_EXPECT(amm.expectBalances(
|
||||
STAmount{GBP, UINT64_C(1'056'336842105264), -12},
|
||||
STAmount{EUR, UINT64_C(946'6677295918366), -13},
|
||||
amm.tokens()));
|
||||
|
||||
if (!features[fixAMMv1_1])
|
||||
{
|
||||
// alice buys 53.3322EUR with 56.3368GBP via the amm
|
||||
// and pays 25% tr fee on 56.3368GBP
|
||||
// 1,400 - 56.3368*1.25 = 1400 - 70.4210 = 1329.5789GBP
|
||||
BEAST_EXPECT(expectLine(
|
||||
env,
|
||||
alice,
|
||||
STAmount{GBP, UINT64_C(1'329'578947368421), -12}));
|
||||
//// 25% on 56.3368EUR is paid in tr fee 56.3368*1.25
|
||||
///= 70.4210EUR
|
||||
// 56.3368GBP is swapped in for 53.3322EUR
|
||||
BEAST_EXPECT(amm.expectBalances(
|
||||
STAmount{GBP, UINT64_C(1'056'336842105263), -12},
|
||||
STAmount{EUR, UINT64_C(946'6677295918366), -13},
|
||||
amm.tokens()));
|
||||
}
|
||||
else
|
||||
{
|
||||
// alice buys 53.3322EUR with 56.3368GBP via the amm
|
||||
// and pays 25% tr fee on 56.3368GBP
|
||||
// 1,400 - 56.3368*1.25 = 1400 - 70.4210 = 1329.5789GBP
|
||||
BEAST_EXPECT(expectLine(
|
||||
env,
|
||||
alice,
|
||||
STAmount{GBP, UINT64_C(1'329'57894736842), -11}));
|
||||
//// 25% on 56.3368EUR is paid in tr fee 56.3368*1.25
|
||||
///= 70.4210EUR
|
||||
// 56.3368GBP is swapped in for 53.3322EUR
|
||||
BEAST_EXPECT(amm.expectBalances(
|
||||
STAmount{GBP, UINT64_C(1'056'336842105264), -12},
|
||||
STAmount{EUR, UINT64_C(946'6677295918366), -13},
|
||||
amm.tokens()));
|
||||
}
|
||||
// 25% on 42.6658EUR is paid in tr fee 42.6658*1.25 = 53.3322EUR
|
||||
// 42.6658EUR/59.7321USD
|
||||
BEAST_EXPECT(expectLine(
|
||||
@@ -2728,23 +2928,48 @@ private:
|
||||
txflags(tfNoRippleDirect | tfPartialPayment | tfLimitQuality));
|
||||
env.close();
|
||||
|
||||
// alice buys 53.3322EUR with 107.5308GBP
|
||||
// 25% on 86.0246GBP is paid in tr fee
|
||||
// 1,400 - 86.0246*1.25 = 1400 - 107.5308 = 1229.4691GBP
|
||||
BEAST_EXPECT(expectLine(
|
||||
env, alice, STAmount{GBP, UINT64_C(1'292'469135802466), -12}));
|
||||
// 86.0246GBP is swapped in for 79.2106EUR
|
||||
BEAST_EXPECT(amm1.expectBalances(
|
||||
STAmount{GBP, UINT64_C(1'086'024691358027), -12},
|
||||
STAmount{EUR, UINT64_C(920'7893779556188), -13},
|
||||
amm1.tokens()));
|
||||
// 25% on 63.3684EUR is paid in tr fee 63.3684*1.25 = 79.2106EUR
|
||||
// 63.3684EUR is swapped in for 83.4291USD
|
||||
BEAST_EXPECT(amm2.expectBalances(
|
||||
STAmount{EUR, UINT64_C(1'063'368497635505), -12},
|
||||
STAmount{USD, UINT64_C(1'316'570881226053), -12},
|
||||
amm2.tokens()));
|
||||
|
||||
if (!features[fixAMMv1_1])
|
||||
{
|
||||
// alice buys 53.3322EUR with 107.5308GBP
|
||||
// 25% on 86.0246GBP is paid in tr fee
|
||||
// 1,400 - 86.0246*1.25 = 1400 - 107.5308 = 1229.4691GBP
|
||||
BEAST_EXPECT(expectLine(
|
||||
env,
|
||||
alice,
|
||||
STAmount{GBP, UINT64_C(1'292'469135802469), -12}));
|
||||
// 86.0246GBP is swapped in for 79.2106EUR
|
||||
BEAST_EXPECT(amm1.expectBalances(
|
||||
STAmount{GBP, UINT64_C(1'086'024691358025), -12},
|
||||
STAmount{EUR, UINT64_C(920'78937795562), -11},
|
||||
amm1.tokens()));
|
||||
// 25% on 63.3684EUR is paid in tr fee 63.3684*1.25 = 79.2106EUR
|
||||
// 63.3684EUR is swapped in for 83.4291USD
|
||||
BEAST_EXPECT(amm2.expectBalances(
|
||||
STAmount{EUR, UINT64_C(1'063'368497635504), -12},
|
||||
STAmount{USD, UINT64_C(1'316'570881226053), -12},
|
||||
amm2.tokens()));
|
||||
}
|
||||
else
|
||||
{
|
||||
// alice buys 53.3322EUR with 107.5308GBP
|
||||
// 25% on 86.0246GBP is paid in tr fee
|
||||
// 1,400 - 86.0246*1.25 = 1400 - 107.5308 = 1229.4691GBP
|
||||
BEAST_EXPECT(expectLine(
|
||||
env,
|
||||
alice,
|
||||
STAmount{GBP, UINT64_C(1'292'469135802466), -12}));
|
||||
// 86.0246GBP is swapped in for 79.2106EUR
|
||||
BEAST_EXPECT(amm1.expectBalances(
|
||||
STAmount{GBP, UINT64_C(1'086'024691358027), -12},
|
||||
STAmount{EUR, UINT64_C(920'7893779556188), -13},
|
||||
amm1.tokens()));
|
||||
// 25% on 63.3684EUR is paid in tr fee 63.3684*1.25 = 79.2106EUR
|
||||
// 63.3684EUR is swapped in for 83.4291USD
|
||||
BEAST_EXPECT(amm2.expectBalances(
|
||||
STAmount{EUR, UINT64_C(1'063'368497635505), -12},
|
||||
STAmount{USD, UINT64_C(1'316'570881226053), -12},
|
||||
amm2.tokens()));
|
||||
}
|
||||
// 25% on 66.7432USD is paid in tr fee 66.7432*1.25 = 83.4291USD
|
||||
BEAST_EXPECT(expectLine(
|
||||
env, carol, STAmount(USD, UINT64_C(1'466'743295019157), -12)));
|
||||
@@ -2774,18 +2999,34 @@ private:
|
||||
txflags(tfNoRippleDirect | tfPartialPayment | tfLimitQuality));
|
||||
env.close();
|
||||
|
||||
// 108.1481GBP is swapped in for 97.5935EUR
|
||||
BEAST_EXPECT(amm1.expectBalances(
|
||||
STAmount{GBP, UINT64_C(1'108'148148148151), -12},
|
||||
STAmount{EUR, UINT64_C(902'4064171122975), -13},
|
||||
amm1.tokens()));
|
||||
// 25% on 78.0748EUR is paid in tr fee 78.0748*1.25 = 97.5935EUR
|
||||
// 78.0748EUR is swapped in for 101.3888USD
|
||||
BEAST_EXPECT(amm2.expectBalances(
|
||||
STAmount{EUR, UINT64_C(1'078'074866310162), -12},
|
||||
STAmount{USD, UINT64_C(1'298'611111111111), -12},
|
||||
amm2.tokens()));
|
||||
|
||||
if (!features[fixAMMv1_1])
|
||||
{
|
||||
// 108.1481GBP is swapped in for 97.5935EUR
|
||||
BEAST_EXPECT(amm1.expectBalances(
|
||||
STAmount{GBP, UINT64_C(1'108'148148148149), -12},
|
||||
STAmount{EUR, UINT64_C(902'4064171122988), -13},
|
||||
amm1.tokens()));
|
||||
// 25% on 78.0748EUR is paid in tr fee 78.0748*1.25 = 97.5935EUR
|
||||
// 78.0748EUR is swapped in for 101.3888USD
|
||||
BEAST_EXPECT(amm2.expectBalances(
|
||||
STAmount{EUR, UINT64_C(1'078'074866310161), -12},
|
||||
STAmount{USD, UINT64_C(1'298'611111111111), -12},
|
||||
amm2.tokens()));
|
||||
}
|
||||
else
|
||||
{
|
||||
// 108.1481GBP is swapped in for 97.5935EUR
|
||||
BEAST_EXPECT(amm1.expectBalances(
|
||||
STAmount{GBP, UINT64_C(1'108'148148148151), -12},
|
||||
STAmount{EUR, UINT64_C(902'4064171122975), -13},
|
||||
amm1.tokens()));
|
||||
// 25% on 78.0748EUR is paid in tr fee 78.0748*1.25 = 97.5935EUR
|
||||
// 78.0748EUR is swapped in for 101.3888USD
|
||||
BEAST_EXPECT(amm2.expectBalances(
|
||||
STAmount{EUR, UINT64_C(1'078'074866310162), -12},
|
||||
STAmount{USD, UINT64_C(1'298'611111111111), -12},
|
||||
amm2.tokens()));
|
||||
}
|
||||
// 25% on 81.1111USD is paid in tr fee 81.1111*1.25 = 101.3888USD
|
||||
BEAST_EXPECT(expectLine(
|
||||
env, carol, STAmount{USD, UINT64_C(1'481'111111111111), -12}));
|
||||
@@ -2931,8 +3172,12 @@ private:
|
||||
// Alice offers to buy 1000 XRP for 1000 USD. She takes Bob's first
|
||||
// offer, removes 999 more as unfunded, then hits the step limit.
|
||||
env(offer(alice, USD(1'000), XRP(1'000)));
|
||||
env.require(
|
||||
balance(alice, STAmount{USD, UINT64_C(2'050125257867587), -15}));
|
||||
if (!features[fixAMMv1_1])
|
||||
env.require(balance(
|
||||
alice, STAmount{USD, UINT64_C(2'050126257867561), -15}));
|
||||
else
|
||||
env.require(balance(
|
||||
alice, STAmount{USD, UINT64_C(2'050125257867587), -15}));
|
||||
env.require(owners(alice, 2));
|
||||
env.require(balance(bob, USD(0)));
|
||||
env.require(owners(bob, 1'001));
|
||||
@@ -3038,19 +3283,33 @@ private:
|
||||
env(offer(bob, XRP(100), USD(100)));
|
||||
env(offer(bob, XRP(1'000), USD(100)));
|
||||
AMM ammDan(env, dan, XRP(1'000), USD(1'100));
|
||||
|
||||
env(pay(alice, carol, USD(10'000)),
|
||||
paths(XRP),
|
||||
delivermin(USD(200)),
|
||||
txflags(tfPartialPayment),
|
||||
sendmax(XRPAmount(200'000'001)));
|
||||
env.require(balance(bob, USD(0)));
|
||||
env.require(
|
||||
balance(carol, STAmount{USD, UINT64_C(200'00000090909), -11}));
|
||||
BEAST_EXPECT(ammDan.expectBalances(
|
||||
XRPAmount{1'100'000'001},
|
||||
STAmount{USD, UINT64_C(999'99999909091), -11},
|
||||
ammDan.tokens()));
|
||||
if (!features[fixAMMv1_1])
|
||||
{
|
||||
env(pay(alice, carol, USD(10'000)),
|
||||
paths(XRP),
|
||||
delivermin(USD(200)),
|
||||
txflags(tfPartialPayment),
|
||||
sendmax(XRP(200)));
|
||||
env.require(balance(bob, USD(0)));
|
||||
env.require(balance(carol, USD(200)));
|
||||
BEAST_EXPECT(ammDan.expectBalances(
|
||||
XRP(1'100), USD(1'000), ammDan.tokens()));
|
||||
}
|
||||
else
|
||||
{
|
||||
env(pay(alice, carol, USD(10'000)),
|
||||
paths(XRP),
|
||||
delivermin(USD(200)),
|
||||
txflags(tfPartialPayment),
|
||||
sendmax(XRPAmount(200'000'001)));
|
||||
env.require(balance(bob, USD(0)));
|
||||
env.require(balance(
|
||||
carol, STAmount{USD, UINT64_C(200'00000090909), -11}));
|
||||
BEAST_EXPECT(ammDan.expectBalances(
|
||||
XRPAmount{1'100'000'001},
|
||||
STAmount{USD, UINT64_C(999'99999909091), -11},
|
||||
ammDan.tokens()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3204,7 +3463,7 @@ private:
|
||||
testcase("RippleState Freeze");
|
||||
|
||||
using namespace test::jtx;
|
||||
Env env(*this, features - featureXahauGenesis - featureTouch);
|
||||
Env env(*this, features);
|
||||
|
||||
Account const G1{"G1"};
|
||||
Account const alice{"alice"};
|
||||
@@ -3258,7 +3517,8 @@ private:
|
||||
env(trust(G1, bob["USD"](0), tfSetFreeze));
|
||||
auto affected = env.meta()->getJson(
|
||||
JsonOptions::none)[sfAffectedNodes.fieldName];
|
||||
if (!BEAST_EXPECT(checkArraySize(affected, 2u)))
|
||||
if (!BEAST_EXPECT(checkArraySize(
|
||||
affected, 2u + 1u))) // 2u + 1u(Issuer Account as Touch)
|
||||
return;
|
||||
auto ff =
|
||||
affected[1u][sfModifiedNode.fieldName][sfFinalFields.fieldName];
|
||||
@@ -3276,10 +3536,11 @@ private:
|
||||
env(offer(bob, G1["USD"](5), XRP(25)));
|
||||
auto affected = env.meta()->getJson(
|
||||
JsonOptions::none)[sfAffectedNodes.fieldName];
|
||||
if (!BEAST_EXPECT(checkArraySize(affected, 4u)))
|
||||
if (!BEAST_EXPECT(checkArraySize(
|
||||
affected, 4u + 1u))) // 4u + 1u(Issuer Account as Touch)
|
||||
return;
|
||||
auto ff =
|
||||
affected[1u][sfModifiedNode.fieldName][sfFinalFields.fieldName];
|
||||
affected[2u][sfModifiedNode.fieldName][sfFinalFields.fieldName];
|
||||
BEAST_EXPECT(
|
||||
ff[sfHighLimit.fieldName] ==
|
||||
bob["USD"](100).value().getJson(JsonOptions::none));
|
||||
@@ -3346,7 +3607,8 @@ private:
|
||||
env(trust(G1, bob["USD"](0), tfClearFreeze));
|
||||
auto affected = env.meta()->getJson(
|
||||
JsonOptions::none)[sfAffectedNodes.fieldName];
|
||||
if (!BEAST_EXPECT(checkArraySize(affected, 2u)))
|
||||
if (!BEAST_EXPECT(checkArraySize(
|
||||
affected, 2u + 1u))) // 2u + 1u(Issuer Account as Touch)
|
||||
return;
|
||||
auto ff =
|
||||
affected[1u][sfModifiedNode.fieldName][sfFinalFields.fieldName];
|
||||
@@ -3503,7 +3765,7 @@ private:
|
||||
testcase("Offers for Frozen Trust Lines");
|
||||
|
||||
using namespace test::jtx;
|
||||
Env env(*this, features - featureXahauGenesis - featureTouch);
|
||||
Env env(*this, features);
|
||||
|
||||
Account G1{"G1"};
|
||||
Account A2{"A2"};
|
||||
@@ -3548,15 +3810,16 @@ private:
|
||||
BEAST_EXPECT(info[jss::amm][jss::asset2_frozen].asBool());
|
||||
auto affected =
|
||||
env.meta()->getJson(JsonOptions::none)[sfAffectedNodes.fieldName];
|
||||
if (!BEAST_EXPECT(checkArraySize(affected, 2u)))
|
||||
if (!BEAST_EXPECT(checkArraySize(
|
||||
affected, 2u + 1u))) // 2u + 1u(Issuer Account as Touch)
|
||||
return;
|
||||
auto ff =
|
||||
affected[1u][sfModifiedNode.fieldName][sfFinalFields.fieldName];
|
||||
affected[0u][sfModifiedNode.fieldName][sfFinalFields.fieldName];
|
||||
BEAST_EXPECT(
|
||||
ff[sfHighLimit.fieldName] ==
|
||||
ff[sfLowLimit.fieldName] ==
|
||||
G1["USD"](0).value().getJson(JsonOptions::none));
|
||||
BEAST_EXPECT(!(ff[jss::Flags].asUInt() & lsfLowFreeze));
|
||||
BEAST_EXPECT(ff[jss::Flags].asUInt() & lsfHighFreeze);
|
||||
BEAST_EXPECT(ff[jss::Flags].asUInt() & lsfLowFreeze);
|
||||
BEAST_EXPECT(!(ff[jss::Flags].asUInt() & lsfHighFreeze));
|
||||
env.close();
|
||||
|
||||
// test: Can make a payment via the new offer
|
||||
@@ -3571,9 +3834,10 @@ private:
|
||||
env(trust(G1, A4["USD"](0), tfSetFreeze));
|
||||
affected =
|
||||
env.meta()->getJson(JsonOptions::none)[sfAffectedNodes.fieldName];
|
||||
if (!BEAST_EXPECT(checkArraySize(affected, 2u)))
|
||||
if (!BEAST_EXPECT(checkArraySize(
|
||||
affected, 2u + 1u))) // 2u + 1u(Issuer Account as Touch)
|
||||
return;
|
||||
ff = affected[0u][sfModifiedNode.fieldName][sfFinalFields.fieldName];
|
||||
ff = affected[1u][sfModifiedNode.fieldName][sfFinalFields.fieldName];
|
||||
BEAST_EXPECT(
|
||||
ff[sfLowLimit.fieldName] ==
|
||||
G1["USD"](0).value().getJson(JsonOptions::none));
|
||||
@@ -3587,7 +3851,7 @@ private:
|
||||
env.meta()->getJson(JsonOptions::none)[sfAffectedNodes.fieldName];
|
||||
if (!BEAST_EXPECT(checkArraySize(affected, 8u)))
|
||||
return;
|
||||
auto created = affected[0u][sfCreatedNode.fieldName];
|
||||
auto created = affected[5u][sfCreatedNode.fieldName];
|
||||
BEAST_EXPECT(
|
||||
created[sfNewFields.fieldName][jss::Account] == A2.human());
|
||||
env.close();
|
||||
@@ -3769,9 +4033,10 @@ private:
|
||||
auto const CNY = gw["CNY"];
|
||||
|
||||
{
|
||||
Env env(*this, features - featureXahauGenesis - featureTouch);
|
||||
Env env(*this, features);
|
||||
|
||||
env.fund(XRP(10'000), alice, bob, carol, gw);
|
||||
env.close();
|
||||
env.trust(USD(10'000), alice, bob, carol);
|
||||
|
||||
env(pay(gw, bob, USD(100)));
|
||||
@@ -3835,7 +4100,9 @@ private:
|
||||
testBookStep(all);
|
||||
testBookStep(all | ownerPaysFee);
|
||||
testTransferRate(all | ownerPaysFee);
|
||||
testTransferRate((all - fixAMMv1_1) | ownerPaysFee);
|
||||
testTransferRateNoOwnerFee(all);
|
||||
testTransferRateNoOwnerFee(all - fixAMMv1_1);
|
||||
testLimitQuality();
|
||||
testXRPPathLoop();
|
||||
}
|
||||
@@ -3846,6 +4113,7 @@ private:
|
||||
using namespace jtx;
|
||||
FeatureBitset const all{supported_amendments()};
|
||||
testStepLimit(all);
|
||||
testStepLimit(all - fixAMMv1_1);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -3854,6 +4122,7 @@ private:
|
||||
using namespace jtx;
|
||||
FeatureBitset const all{supported_amendments()};
|
||||
test_convert_all_of_an_asset(all);
|
||||
test_convert_all_of_an_asset(all - fixAMMv1_1);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -27,6 +27,12 @@ namespace test {
|
||||
class AccountDelete_test : public beast::unit_test::suite
|
||||
{
|
||||
private:
|
||||
std::uint32_t
|
||||
openLedgerSeq(jtx::Env& env)
|
||||
{
|
||||
return env.current()->seq();
|
||||
}
|
||||
|
||||
// Helper function that verifies the expected DeliveredAmount is present.
|
||||
//
|
||||
// NOTE: the function _infers_ the transaction to operate on by calling
|
||||
@@ -76,6 +82,26 @@ private:
|
||||
return jv;
|
||||
};
|
||||
|
||||
// Close the ledger until the ledger sequence is large enough to close
|
||||
// the account. If margin is specified, close the ledger so `margin`
|
||||
// more closes are needed
|
||||
void
|
||||
incLgrSeqForAccDel(
|
||||
jtx::Env& env,
|
||||
jtx::Account const& acc,
|
||||
std::uint32_t margin = 0)
|
||||
{
|
||||
int const delta = [&]() -> int {
|
||||
if (env.seq(acc) + 255 > openLedgerSeq(env))
|
||||
return env.seq(acc) - openLedgerSeq(env) + 255 - margin;
|
||||
return 0;
|
||||
}();
|
||||
BEAST_EXPECT(margin == 0 || delta >= 0);
|
||||
for (int i = 0; i < delta; ++i)
|
||||
env.close();
|
||||
BEAST_EXPECT(openLedgerSeq(env) == env.seq(acc) + 255 - margin);
|
||||
}
|
||||
|
||||
public:
|
||||
void
|
||||
testBasics(FeatureBitset features)
|
||||
@@ -84,7 +110,7 @@ public:
|
||||
|
||||
testcase("Basics");
|
||||
|
||||
Env env(*this, features | featureDID);
|
||||
Env env(*this, features);
|
||||
Account const alice("alice");
|
||||
Account const becky("becky");
|
||||
Account const carol("carol");
|
||||
@@ -341,6 +367,7 @@ public:
|
||||
NetClock::time_point const& cancelAfter) {
|
||||
Json::Value jv;
|
||||
jv[jss::TransactionType] = jss::EscrowCreate;
|
||||
jv[jss::Flags] = tfUniversal;
|
||||
jv[jss::Account] = account.human();
|
||||
jv[jss::Destination] = to.human();
|
||||
jv[jss::Amount] = amount.getJson(JsonOptions::none);
|
||||
@@ -370,6 +397,7 @@ public:
|
||||
[](Account const& account, Account const& from, std::uint32_t seq) {
|
||||
Json::Value jv;
|
||||
jv[jss::TransactionType] = jss::EscrowCancel;
|
||||
jv[jss::Flags] = tfUniversal;
|
||||
jv[jss::Account] = account.human();
|
||||
jv[sfOwner.jsonName] = from.human();
|
||||
jv[sfOfferSequence.jsonName] = seq;
|
||||
@@ -507,6 +535,7 @@ public:
|
||||
auto payChanClaim = [&]() {
|
||||
Json::Value jv;
|
||||
jv[jss::TransactionType] = jss::PaymentChannelClaim;
|
||||
jv[jss::Flags] = tfUniversal;
|
||||
jv[jss::Account] = alice.human();
|
||||
jv[sfChannel.jsonName] = to_string(payChanKey.key);
|
||||
jv[sfBalance.jsonName] =
|
||||
@@ -884,7 +913,7 @@ public:
|
||||
}
|
||||
|
||||
void
|
||||
testDestinationDepositAuthCredentials(FeatureBitset features)
|
||||
testDestinationDepositAuthCredentials()
|
||||
{
|
||||
{
|
||||
testcase(
|
||||
@@ -899,7 +928,7 @@ public:
|
||||
|
||||
const char credType[] = "abcd";
|
||||
|
||||
Env env{*this, features};
|
||||
Env env{*this};
|
||||
env.fund(XRP(100000), alice, becky, carol, daria);
|
||||
env.close();
|
||||
|
||||
@@ -1120,7 +1149,7 @@ public:
|
||||
Account const becky{"becky"};
|
||||
Account const carol{"carol"};
|
||||
|
||||
Env env{*this, features - featureCredentials};
|
||||
Env env{*this, supported_amendments() - featureCredentials};
|
||||
env.fund(XRP(100000), alice, becky, carol);
|
||||
env.close();
|
||||
|
||||
@@ -1152,7 +1181,7 @@ public:
|
||||
}
|
||||
|
||||
void
|
||||
testDeleteCredentialsOwner(FeatureBitset features)
|
||||
testDeleteCredentialsOwner()
|
||||
{
|
||||
{
|
||||
testcase("Deleting Issuer deletes issued credentials");
|
||||
@@ -1165,7 +1194,7 @@ public:
|
||||
|
||||
const char credType[] = "abcd";
|
||||
|
||||
Env env{*this, features};
|
||||
Env env{*this};
|
||||
env.fund(XRP(100000), alice, becky, carol);
|
||||
env.close();
|
||||
|
||||
@@ -1209,7 +1238,7 @@ public:
|
||||
|
||||
const char credType[] = "abcd";
|
||||
|
||||
Env env{*this, features};
|
||||
Env env{*this};
|
||||
env.fund(XRP(100000), alice, becky, carol);
|
||||
env.close();
|
||||
|
||||
@@ -1257,13 +1286,12 @@ public:
|
||||
testBalanceTooSmallForFee(features);
|
||||
testWithTickets(features);
|
||||
testDest(features);
|
||||
testDestinationDepositAuthCredentials(features);
|
||||
testDeleteCredentialsOwner(features);
|
||||
testDestinationDepositAuthCredentials();
|
||||
testDeleteCredentialsOwner();
|
||||
};
|
||||
|
||||
using namespace test::jtx;
|
||||
auto const sa =
|
||||
(supported_amendments() | featureCredentials) - featureXahauGenesis;
|
||||
auto const sa = supported_amendments();
|
||||
testWithFeatures(sa);
|
||||
}
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -823,19 +823,6 @@ class Clawback_test : public beast::unit_test::suite
|
||||
BEAST_EXPECT(getLineFreezeFlag(env, alice, bob, USD.currency));
|
||||
}
|
||||
|
||||
static STAmount
|
||||
lockedAmount(
|
||||
test::jtx::Env const& env,
|
||||
test::jtx::Account const& account,
|
||||
test::jtx::Account const& gw,
|
||||
test::jtx::IOU const& iou)
|
||||
{
|
||||
auto const sle = env.le(keylet::line(account, gw, iou.currency));
|
||||
if (sle->isFieldPresent(sfLockedBalance))
|
||||
return (*sle)[sfLockedBalance];
|
||||
return STAmount(iou, 0);
|
||||
}
|
||||
|
||||
void
|
||||
testAmountExceedsAvailable(FeatureBitset features)
|
||||
{
|
||||
@@ -966,7 +953,7 @@ public:
|
||||
run() override
|
||||
{
|
||||
using namespace test::jtx;
|
||||
FeatureBitset const all{supported_amendments() | featureMPTokensV1};
|
||||
FeatureBitset const all{supported_amendments()};
|
||||
|
||||
testWithFeats(all - featureMPTokensV1);
|
||||
testWithFeats(all);
|
||||
|
||||
@@ -967,7 +967,7 @@ struct Credentials_test : public beast::unit_test::suite
|
||||
}
|
||||
|
||||
void
|
||||
testRPC(FeatureBitset features)
|
||||
testRPC()
|
||||
{
|
||||
using namespace test::jtx;
|
||||
|
||||
@@ -977,7 +977,7 @@ struct Credentials_test : public beast::unit_test::suite
|
||||
|
||||
{
|
||||
using namespace jtx;
|
||||
Env env{*this, features};
|
||||
Env env{*this};
|
||||
|
||||
env.fund(XRP(5000), subject, issuer);
|
||||
env.close();
|
||||
@@ -1094,9 +1094,7 @@ struct Credentials_test : public beast::unit_test::suite
|
||||
run() override
|
||||
{
|
||||
using namespace test::jtx;
|
||||
FeatureBitset const all{
|
||||
(supported_amendments() | featureCredentials) -
|
||||
featureXahauGenesis};
|
||||
FeatureBitset const all{supported_amendments()};
|
||||
testSuccessful(all);
|
||||
testCredentialsDelete(all);
|
||||
testCreateFailed(all);
|
||||
@@ -1104,7 +1102,7 @@ struct Credentials_test : public beast::unit_test::suite
|
||||
testDeleteFailed(all);
|
||||
testFeatureFailed(all - featureCredentials);
|
||||
testFlags(all);
|
||||
testRPC(all);
|
||||
testRPC();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user