mirror of
https://github.com/Xahau/xahaud.git
synced 2026-01-12 10:45:15 +00:00
Compare commits
18 Commits
featRNG
...
conan-stri
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1d101b7130 | ||
|
|
84eee588d3 | ||
|
|
03569dbb11 | ||
|
|
cb77121e20 | ||
|
|
c55a97c51a | ||
|
|
fc0be9c416 | ||
|
|
aaccf9b5b2 | ||
|
|
17af075665 | ||
|
|
e6b362c832 | ||
|
|
5b2b915955 | ||
|
|
e801ead39d | ||
|
|
78a96dd633 | ||
|
|
b3984c166d | ||
|
|
945f737706 | ||
|
|
8360ff8bc2 | ||
|
|
c1274d2a12 | ||
|
|
4aa79b6100 | ||
|
|
6a4c563ced |
@@ -1,12 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Pre-commit hook that runs the suspicious patterns check on staged files
|
||||
|
||||
# Get the repository's root directory
|
||||
repo_root=$(git rev-parse --show-toplevel)
|
||||
|
||||
# Run the suspicious patterns script in pre-commit mode
|
||||
"$repo_root/suspicious_patterns.sh" --pre-commit
|
||||
|
||||
# Exit with the same code as the script
|
||||
exit $?
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Configuring git to use .githooks directory..."
|
||||
git config core.hooksPath .githooks
|
||||
215
.github/actions/xahau-ga-build/action.yml
vendored
215
.github/actions/xahau-ga-build/action.yml
vendored
@@ -1,215 +0,0 @@
|
||||
name: build
|
||||
description: 'Builds the project with ccache integration'
|
||||
|
||||
inputs:
|
||||
generator:
|
||||
description: 'CMake generator to use'
|
||||
required: true
|
||||
configuration:
|
||||
description: 'Build configuration (Debug, Release, etc.)'
|
||||
required: true
|
||||
build_dir:
|
||||
description: 'Directory to build in'
|
||||
required: false
|
||||
default: '.build'
|
||||
cc:
|
||||
description: 'C compiler to use'
|
||||
required: false
|
||||
default: ''
|
||||
cxx:
|
||||
description: 'C++ compiler to use'
|
||||
required: false
|
||||
default: ''
|
||||
compiler-id:
|
||||
description: 'Unique identifier: compiler-version-stdlib[-gccversion] (e.g. clang-14-libstdcxx-gcc11, gcc-13-libstdcxx)'
|
||||
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
|
||||
default: 'true'
|
||||
main_branch:
|
||||
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'
|
||||
steps:
|
||||
- name: Generate safe branch name
|
||||
if: inputs.ccache_enabled == 'true'
|
||||
id: safe-branch
|
||||
shell: bash
|
||||
run: |
|
||||
SAFE_BRANCH=$(echo "${{ github.ref_name }}" | tr -c 'a-zA-Z0-9_.-' '-')
|
||||
echo "name=${SAFE_BRANCH}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Configure ccache
|
||||
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
|
||||
|
||||
- name: Configure project
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p ${{ inputs.build_dir }}
|
||||
cd ${{ inputs.build_dir }}
|
||||
|
||||
# Set compiler environment variables if provided
|
||||
if [ -n "${{ inputs.cc }}" ]; then
|
||||
export CC="${{ inputs.cc }}"
|
||||
fi
|
||||
|
||||
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
|
||||
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} \
|
||||
-DCMAKE_BUILD_TYPE=${{ inputs.configuration }}
|
||||
|
||||
- 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}
|
||||
|
||||
- name: Show ccache statistics
|
||||
if: inputs.ccache_enabled == 'true'
|
||||
shell: bash
|
||||
run: ccache -s
|
||||
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 }}
|
||||
155
.github/actions/xahau-ga-dependencies/action.yml
vendored
155
.github/actions/xahau-ga-dependencies/action.yml
vendored
@@ -1,155 +0,0 @@
|
||||
name: dependencies
|
||||
description: 'Installs build dependencies with caching'
|
||||
|
||||
inputs:
|
||||
configuration:
|
||||
description: 'Build configuration (Debug, Release, etc.)'
|
||||
required: true
|
||||
build_dir:
|
||||
description: 'Directory to build dependencies in'
|
||||
required: false
|
||||
default: '.build'
|
||||
compiler-id:
|
||||
description: 'Unique identifier: compiler-version-stdlib[-gccversion] (e.g. clang-14-libstdcxx-gcc11, gcc-13-libstdcxx)'
|
||||
required: false
|
||||
default: ''
|
||||
cache_version:
|
||||
description: 'Cache version for invalidation'
|
||||
required: false
|
||||
default: '1'
|
||||
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:
|
||||
description: 'Whether there was a cache hit'
|
||||
value: ${{ steps.cache-restore-conan.outputs.cache-hit }}
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: Configure Conan cache paths
|
||||
if: inputs.os == 'Linux'
|
||||
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
|
||||
|
||||
- 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: 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
|
||||
|
||||
- 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 }}
|
||||
cd ${{ inputs.build_dir }}
|
||||
|
||||
# Install dependencies using conan
|
||||
conan install \
|
||||
--output-folder . \
|
||||
--build missing \
|
||||
--settings build_type=${{ inputs.configuration }} \
|
||||
..
|
||||
@@ -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("==========================================")
|
||||
99
.github/workflows/build-in-docker.yml
vendored
99
.github/workflows/build-in-docker.yml
vendored
@@ -2,94 +2,37 @@ name: Build using Docker
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["dev", "candidate", "release", "jshooks"]
|
||||
branches: [ "dev", "candidate", "release", "jshooks" ]
|
||||
pull_request:
|
||||
branches: ["dev", "candidate", "release", "jshooks"]
|
||||
branches: [ "dev", "candidate", "release", "jshooks" ]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
DEBUG_BUILD_CONTAINERS_AFTER_CLEANUP: 1
|
||||
group: ${{ github.workflow }}
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
checkout:
|
||||
runs-on: [self-hosted, vanity]
|
||||
outputs:
|
||||
checkout_path: ${{ steps.vars.outputs.checkout_path }}
|
||||
steps:
|
||||
- name: Prepare checkout path
|
||||
id: vars
|
||||
run: |
|
||||
SAFE_BRANCH=$(echo "${{ github.ref_name }}" | sed -e 's/[^a-zA-Z0-9._-]/-/g')
|
||||
CHECKOUT_PATH="${SAFE_BRANCH}-${{ github.sha }}"
|
||||
echo "checkout_path=${CHECKOUT_PATH}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
path: ${{ steps.vars.outputs.checkout_path }}
|
||||
clean: true
|
||||
fetch-depth: 2 # Only get the last 2 commits, to avoid fetching all history
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
clean: false
|
||||
checkpatterns:
|
||||
runs-on: [self-hosted, vanity]
|
||||
needs: checkout
|
||||
steps:
|
||||
- name: Check for suspicious patterns
|
||||
run: /bin/bash suspicious_patterns.sh
|
||||
build:
|
||||
runs-on: [self-hosted, xahaud-build]
|
||||
needs: [checkout]
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ${{ needs.checkout.outputs.checkout_path }}
|
||||
runs-on: [self-hosted, vanity]
|
||||
needs: checkpatterns
|
||||
steps:
|
||||
- name: Set Cleanup Script Path
|
||||
run: |
|
||||
echo "JOB_CLEANUP_SCRIPT=$(mktemp)" >> $GITHUB_ENV
|
||||
|
||||
- name: Build using Docker
|
||||
run: /bin/bash release-builder.sh
|
||||
|
||||
- name: Stop Container (Cleanup)
|
||||
if: always()
|
||||
run: |
|
||||
echo "Running cleanup script: $JOB_CLEANUP_SCRIPT"
|
||||
/bin/bash -e -x "$JOB_CLEANUP_SCRIPT"
|
||||
CLEANUP_EXIT_CODE=$?
|
||||
|
||||
if [[ "$CLEANUP_EXIT_CODE" -eq 0 ]]; then
|
||||
echo "Cleanup script succeeded."
|
||||
rm -f "$JOB_CLEANUP_SCRIPT"
|
||||
echo "Cleanup script removed."
|
||||
else
|
||||
echo "⚠️ Cleanup script failed! Keeping for debugging: $JOB_CLEANUP_SCRIPT"
|
||||
fi
|
||||
|
||||
if [[ "${DEBUG_BUILD_CONTAINERS_AFTER_CLEANUP}" == "1" ]]; then
|
||||
echo "🔍 Checking for leftover containers..."
|
||||
BUILD_CONTAINERS=$(docker ps --format '{{.Names}}' | grep '^xahaud_cached_builder' || echo "")
|
||||
|
||||
if [[ -n "$BUILD_CONTAINERS" ]]; then
|
||||
echo "⚠️ WARNING: Some build containers are still running"
|
||||
echo "$BUILD_CONTAINERS"
|
||||
else
|
||||
echo "✅ No build containers found"
|
||||
fi
|
||||
fi
|
||||
|
||||
- name: Build using Docker
|
||||
run: /bin/bash release-builder.sh
|
||||
tests:
|
||||
runs-on: [self-hosted, xahaud-build]
|
||||
needs: [build, checkout]
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ${{ needs.checkout.outputs.checkout_path }}
|
||||
runs-on: [self-hosted, vanity]
|
||||
needs: build
|
||||
steps:
|
||||
- name: Unit tests
|
||||
run: /bin/bash docker-unit-tests.sh
|
||||
- name: Unit tests
|
||||
run: /bin/bash docker-unit-tests.sh
|
||||
|
||||
cleanup:
|
||||
runs-on: [self-hosted, xahaud-build]
|
||||
needs: [tests, checkout]
|
||||
if: always()
|
||||
steps:
|
||||
- name: Cleanup workspace
|
||||
run: |
|
||||
CHECKOUT_PATH="${{ needs.checkout.outputs.checkout_path }}"
|
||||
echo "Cleaning workspace for ${CHECKOUT_PATH}"
|
||||
rm -rf "${{ github.workspace }}/${CHECKOUT_PATH}"
|
||||
|
||||
33
.github/workflows/clang-format.yml
vendored
33
.github/workflows/clang-format.yml
vendored
@@ -4,32 +4,21 @@ on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-20.04
|
||||
env:
|
||||
CLANG_VERSION: 10
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
# - name: Install clang-format
|
||||
# run: |
|
||||
# codename=$( lsb_release --codename --short )
|
||||
# sudo tee /etc/apt/sources.list.d/llvm.list >/dev/null <<EOF
|
||||
# deb http://apt.llvm.org/${codename}/ llvm-toolchain-${codename}-${CLANG_VERSION} main
|
||||
# deb-src http://apt.llvm.org/${codename}/ llvm-toolchain-${codename}-${CLANG_VERSION} main
|
||||
# EOF
|
||||
# wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add
|
||||
# sudo apt-get update -y
|
||||
# sudo apt-get install -y clang-format-${CLANG_VERSION}
|
||||
|
||||
# Temporary fix until this commit is merged
|
||||
# https://github.com/XRPLF/rippled/commit/552377c76f55b403a1c876df873a23d780fcc81c
|
||||
- name: Download and install clang-format
|
||||
- name: Install clang-format
|
||||
run: |
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y libtinfo5
|
||||
curl -LO https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.1/clang+llvm-10.0.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz
|
||||
tar -xf clang+llvm-10.0.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz
|
||||
sudo mv clang+llvm-10.0.1-x86_64-linux-gnu-ubuntu-16.04 /opt/clang-10
|
||||
sudo ln -s /opt/clang-10/bin/clang-format /usr/local/bin/clang-format-10
|
||||
codename=$( lsb_release --codename --short )
|
||||
sudo tee /etc/apt/sources.list.d/llvm.list >/dev/null <<EOF
|
||||
deb http://apt.llvm.org/${codename}/ llvm-toolchain-${codename}-${CLANG_VERSION} main
|
||||
deb-src http://apt.llvm.org/${codename}/ llvm-toolchain-${codename}-${CLANG_VERSION} main
|
||||
EOF
|
||||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add
|
||||
sudo apt-get update
|
||||
sudo apt-get install clang-format-${CLANG_VERSION}
|
||||
- name: Format src/ripple
|
||||
run: find src/ripple -type f \( -name '*.cpp' -o -name '*.h' -o -name '*.ipp' \) -print0 | xargs -0 clang-format-${CLANG_VERSION} -i
|
||||
- name: Format src/test
|
||||
@@ -41,7 +30,7 @@ jobs:
|
||||
git diff --exit-code | tee "clang-format.patch"
|
||||
- name: Upload patch
|
||||
if: failure() && steps.assert.outcome == 'failure'
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v2
|
||||
continue-on-error: true
|
||||
with:
|
||||
name: clang-format.patch
|
||||
|
||||
25
.github/workflows/doxygen.yml
vendored
Normal file
25
.github/workflows/doxygen.yml
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
name: Build and publish Doxygen documentation
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
|
||||
jobs:
|
||||
job:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: docker://rippleci/rippled-ci-builder:2944b78d22db
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: build
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DBoost_NO_BOOST_CMAKE=ON ..
|
||||
cmake --build . --target docs --parallel $(nproc)
|
||||
- name: publish
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: build/docs/html
|
||||
2
.github/workflows/levelization.yml
vendored
2
.github/workflows/levelization.yml
vendored
@@ -18,7 +18,7 @@ jobs:
|
||||
git diff --exit-code | tee "levelization.patch"
|
||||
- name: Upload patch
|
||||
if: failure() && steps.assert.outcome == 'failure'
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v2
|
||||
continue-on-error: true
|
||||
with:
|
||||
name: levelization.patch
|
||||
|
||||
95
.github/workflows/nix.yml
vendored
Normal file
95
.github/workflows/nix.yml
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
name: nix
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
|
||||
test:
|
||||
strategy:
|
||||
matrix:
|
||||
platform:
|
||||
- ubuntu-latest
|
||||
- macos-12
|
||||
generator:
|
||||
- Ninja
|
||||
configuration:
|
||||
- Release
|
||||
runs-on: ${{ matrix.platform }}
|
||||
env:
|
||||
build_dir: .build
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: install Ninja on Linux
|
||||
if: matrix.generator == 'Ninja' && runner.os == 'Linux'
|
||||
run: sudo apt install ninja-build
|
||||
- name: install Ninja on OSX
|
||||
if: matrix.generator == 'Ninja' && runner.os == 'macOS'
|
||||
run: brew install ninja
|
||||
- name: install nproc on OSX
|
||||
if: runner.os == 'macOS'
|
||||
run: brew install coreutils
|
||||
- name: choose Python
|
||||
uses: actions/setup-python@v3
|
||||
with:
|
||||
python-version: 3.9
|
||||
- name: learn Python cache directory
|
||||
id: pip-cache
|
||||
run: |
|
||||
sudo pip install --upgrade pip
|
||||
echo "::set-output name=dir::$(pip cache dir)"
|
||||
- name: restore Python cache directory
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.pip-cache.outputs.dir }}
|
||||
key: ${{ runner.os }}-${{ hashFiles('.github/workflows/nix.yml') }}
|
||||
- name: install Conan
|
||||
run: pip install wheel 'conan>=1.52.0'
|
||||
- name: check environment
|
||||
run: |
|
||||
echo ${PATH} | tr ':' '\n'
|
||||
python --version
|
||||
conan --version
|
||||
cmake --version
|
||||
env
|
||||
- name: configure Conan
|
||||
run: |
|
||||
conan profile new default --detect
|
||||
conan profile update settings.compiler.cppstd=20 default
|
||||
- name: configure Conan on Linux
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
conan profile update settings.compiler.libcxx=libstdc++11 default
|
||||
- name: learn Conan cache directory
|
||||
id: conan-cache
|
||||
run: |
|
||||
echo "::set-output name=dir::$(conan config get storage.path)"
|
||||
- name: restore Conan cache directory
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.conan-cache.outputs.dir }}
|
||||
key: ${{ hashFiles('~/.conan/profiles/default', 'conanfile.py', 'external/rocksdb/*', '.github/workflows/nix.yml') }}
|
||||
- name: export RocksDB
|
||||
run: conan export external/rocksdb
|
||||
- name: install dependencies
|
||||
run: |
|
||||
mkdir ${build_dir}
|
||||
cd ${build_dir}
|
||||
conan install .. --build missing --settings build_type=${{ matrix.configuration }} --profile:build default --profile:host default
|
||||
- name: configure
|
||||
run: |
|
||||
cd ${build_dir}
|
||||
cmake \
|
||||
-G ${{ matrix.generator }} \
|
||||
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake \
|
||||
-DCMAKE_BUILD_TYPE=${{ matrix.configuration }} \
|
||||
-Dassert=ON \
|
||||
-Dcoverage=OFF \
|
||||
-Dreporting=OFF \
|
||||
-Dunity=OFF \
|
||||
..
|
||||
- name: build
|
||||
run: |
|
||||
cmake --build ${build_dir} --target rippled --parallel $(nproc)
|
||||
- name: test
|
||||
run: |
|
||||
${build_dir}/rippled --unittest --unittest-jobs $(nproc)
|
||||
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"
|
||||
89
.github/workflows/windows.yml
vendored
Normal file
89
.github/workflows/windows.yml
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
name: windows
|
||||
# We have disabled this workflow because it fails in our CI Windows
|
||||
# environment, but we cannot replicate the failure in our personal Windows
|
||||
# test environments, nor have we gone through the trouble of setting up an
|
||||
# interactive CI Windows environment.
|
||||
# We welcome contributions to diagnose or debug the problems on Windows. Until
|
||||
# then, we leave this tombstone as a reminder that we have tried (but failed)
|
||||
# to write a reliable test for Windows.
|
||||
# on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
|
||||
test:
|
||||
strategy:
|
||||
matrix:
|
||||
generator:
|
||||
- Visual Studio 16 2019
|
||||
configuration:
|
||||
- Release
|
||||
runs-on: windows-2019
|
||||
env:
|
||||
build_dir: .build
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: choose Python
|
||||
uses: actions/setup-python@v3
|
||||
with:
|
||||
python-version: 3.9
|
||||
- name: learn Python cache directory
|
||||
id: pip-cache
|
||||
run: |
|
||||
pip install --upgrade pip
|
||||
echo "::set-output name=dir::$(pip cache dir)"
|
||||
- name: restore Python cache directory
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.pip-cache.outputs.dir }}
|
||||
key: ${{ runner.os }}-${{ hashFiles('.github/workflows/windows.yml') }}
|
||||
- name: install Conan
|
||||
run: pip install wheel 'conan>=1.52.0'
|
||||
- name: check environment
|
||||
run: |
|
||||
$env:PATH -split ';'
|
||||
python --version
|
||||
conan --version
|
||||
cmake --version
|
||||
dir env:
|
||||
- name: configure Conan
|
||||
run: |
|
||||
conan profile new default --detect
|
||||
conan profile update settings.compiler.cppstd=20 default
|
||||
conan profile update settings.compiler.runtime=MT default
|
||||
conan profile update settings.compiler.toolset=v141 default
|
||||
- name: learn Conan cache directory
|
||||
id: conan-cache
|
||||
run: |
|
||||
echo "::set-output name=dir::$(conan config get storage.path)"
|
||||
- name: restore Conan cache directory
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.conan-cache.outputs.dir }}
|
||||
key: ${{ hashFiles('~/.conan/profiles/default', 'conanfile.py', 'external/rocksdb/*', '.github/workflows/windows.yml') }}
|
||||
- name: export RocksDB
|
||||
run: conan export external/rocksdb
|
||||
- name: install dependencies
|
||||
run: |
|
||||
mkdir $env:build_dir
|
||||
cd $env:build_dir
|
||||
conan install .. --build missing --settings build_type=${{ matrix.configuration }}
|
||||
- name: configure
|
||||
run: |
|
||||
$env:build_dir
|
||||
cd $env:build_dir
|
||||
pwd
|
||||
ls
|
||||
cmake `
|
||||
-G "${{ matrix.generator }}" `
|
||||
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake `
|
||||
-Dassert=ON `
|
||||
-Dreporting=OFF `
|
||||
-Dunity=OFF `
|
||||
..
|
||||
- name: build
|
||||
run: |
|
||||
cmake --build $env:build_dir --target rippled --config ${{ matrix.configuration }} --parallel $env:NUMBER_OF_PROCESSORS
|
||||
- name: test
|
||||
run: |
|
||||
& "$env:build_dir\${{ matrix.configuration }}\rippled.exe" --unittest
|
||||
112
.github/workflows/xahau-ga-macos.yml
vendored
112
.github/workflows/xahau-ga-macos.yml
vendored
@@ -1,112 +0,0 @@
|
||||
name: MacOS - GA Runner
|
||||
|
||||
on:
|
||||
push:
|
||||
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:
|
||||
test:
|
||||
strategy:
|
||||
matrix:
|
||||
generator:
|
||||
- Ninja
|
||||
configuration:
|
||||
- Debug
|
||||
runs-on: [self-hosted, macOS]
|
||||
env:
|
||||
build_dir: .build
|
||||
# Bump this number to invalidate all caches globally.
|
||||
CACHE_VERSION: 3
|
||||
MAIN_BRANCH_NAME: dev
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Add Homebrew to PATH
|
||||
run: |
|
||||
echo "/opt/homebrew/bin" >> "$GITHUB_PATH"
|
||||
echo "/opt/homebrew/sbin" >> "$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 tools via mise
|
||||
run: |
|
||||
mise install
|
||||
mise use cmake@3.23.1 python@3.12 pipx@latest conan@2 ninja@latest ccache@latest
|
||||
mise reshim
|
||||
echo "$HOME/.local/share/mise/shims" >> "$GITHUB_PATH"
|
||||
|
||||
- name: Check environment
|
||||
run: |
|
||||
echo "PATH:"
|
||||
echo "${PATH}" | tr ':' '\n'
|
||||
which python && python --version || echo "Python not found"
|
||||
which conan && conan --version || echo "Conan not found"
|
||||
which cmake && cmake --version || echo "CMake not found"
|
||||
clang --version
|
||||
ccache --version
|
||||
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
|
||||
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}"
|
||||
|
||||
- name: Install dependencies
|
||||
uses: ./.github/actions/xahau-ga-dependencies
|
||||
with:
|
||||
configuration: ${{ matrix.configuration }}
|
||||
build_dir: ${{ env.build_dir }}
|
||||
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
|
||||
with:
|
||||
generator: ${{ matrix.generator }}
|
||||
configuration: ${{ matrix.configuration }}
|
||||
build_dir: ${{ env.build_dir }}
|
||||
compiler-id: clang
|
||||
cache_version: ${{ env.CACHE_VERSION }}
|
||||
main_branch: ${{ env.MAIN_BRANCH_NAME }}
|
||||
stdlib: libcxx
|
||||
ccache_max_size: '100G'
|
||||
|
||||
- name: Test
|
||||
run: |
|
||||
${{ env.build_dir }}/rippled --unittest --unittest-jobs $(nproc)
|
||||
349
.github/workflows/xahau-ga-nix.yml
vendored
349
.github/workflows/xahau-ga-nix.yml
vendored
@@ -1,349 +0,0 @@
|
||||
name: Nix - GA Runner
|
||||
|
||||
on:
|
||||
push:
|
||||
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
|
||||
outputs:
|
||||
artifact_name: ${{ steps.set-artifact-name.outputs.artifact_name }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix: ${{ fromJSON(needs.matrix-setup.outputs.matrix) }}
|
||||
env:
|
||||
build_dir: .build
|
||||
# Bump this number to invalidate all caches globally.
|
||||
CACHE_VERSION: 3
|
||||
MAIN_BRANCH_NAME: dev
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- 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
|
||||
|
||||
# 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
|
||||
|
||||
echo "=== GCC versions available after installation ==="
|
||||
ls -la /usr/lib/gcc/x86_64-linux-gnu/ | grep -E "^d"
|
||||
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
|
||||
|
||||
- name: Check environment
|
||||
run: |
|
||||
echo "PATH:"
|
||||
echo "${PATH}" | tr ':' '\n'
|
||||
which conan && conan --version || echo "Conan not found"
|
||||
which cmake && cmake --version || echo "CMake not found"
|
||||
which ${{ matrix.cc }} && ${{ matrix.cc }} --version || echo "${{ matrix.cc }} not found"
|
||||
which ${{ matrix.cxx }} && ${{ matrix.cxx }} --version || echo "${{ matrix.cxx }} not found"
|
||||
which ccache && ccache --version || echo "ccache not found"
|
||||
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:
|
||||
configuration: ${{ matrix.configuration }}
|
||||
build_dir: ${{ env.build_dir }}
|
||||
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
|
||||
with:
|
||||
generator: Ninja
|
||||
configuration: ${{ matrix.configuration }}
|
||||
build_dir: ${{ env.build_dir }}
|
||||
cc: ${{ matrix.cc }}
|
||||
cxx: ${{ matrix.cxx }}
|
||||
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
|
||||
run: |
|
||||
ARTIFACT_NAME="build-output-nix-${{ github.run_id }}-${{ matrix.compiler }}-${{ matrix.configuration }}"
|
||||
echo "artifact_name=${ARTIFACT_NAME}" >> "$GITHUB_OUTPUT"
|
||||
echo "Using artifact name: ${ARTIFACT_NAME}"
|
||||
|
||||
- name: Debug build directory
|
||||
run: |
|
||||
echo "Checking build directory contents: ${{ env.build_dir }}"
|
||||
ls -la ${{ env.build_dir }} || echo "Build directory not found or empty"
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
# Ensure the binary exists before trying to run
|
||||
if [ -f "${{ env.build_dir }}/rippled" ]; then
|
||||
${{ env.build_dir }}/rippled --unittest --unittest-jobs $(nproc)
|
||||
else
|
||||
echo "Error: rippled executable not found in ${{ env.build_dir }}"
|
||||
exit 1
|
||||
fi
|
||||
7
.gitignore
vendored
7
.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
|
||||
@@ -119,5 +114,3 @@ pkg_out
|
||||
pkg
|
||||
CMakeUserPresets.json
|
||||
bld.rippled/
|
||||
|
||||
generated
|
||||
|
||||
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@@ -3,11 +3,11 @@
|
||||
"C_Cpp.clang_format_path": ".clang-format",
|
||||
"C_Cpp.clang_format_fallbackStyle": "{ ColumnLimit: 0 }",
|
||||
"[cpp]":{
|
||||
"editor.wordBasedSuggestions": "off",
|
||||
"editor.wordBasedSuggestions": false,
|
||||
"editor.suggest.insertMode": "replace",
|
||||
"editor.semanticHighlighting.enabled": true,
|
||||
"editor.tabSize": 4,
|
||||
"editor.defaultFormatter": "xaver.clang-format",
|
||||
"editor.formatOnSave": true
|
||||
"editor.formatOnSave": false
|
||||
}
|
||||
}
|
||||
|
||||
425
BUILD.md
425
BUILD.md
@@ -1,12 +1,3 @@
|
||||
> These instructions assume you have a C++ development environment ready
|
||||
> with Git, Python, Conan, CMake, and a C++ compiler. For help setting one up
|
||||
> on Linux, macOS, or Windows, see [our guide](./docs/build/environment.md).
|
||||
>
|
||||
> These instructions also assume a basic familiarity with Conan and CMake.
|
||||
> If you are unfamiliar with Conan,
|
||||
> you can read our [crash course](./docs/build/conan.md)
|
||||
> or the official [Getting Started][3] walkthrough.
|
||||
|
||||
## Branches
|
||||
|
||||
For a stable release, choose the `master` branch or one of the [tagged
|
||||
@@ -22,323 +13,216 @@ For the latest release candidate, choose the `release` branch.
|
||||
git checkout release
|
||||
```
|
||||
|
||||
For the latest set of untested features, or to contribute, choose the `develop`
|
||||
branch.
|
||||
If you are contributing or want the latest set of untested features,
|
||||
then use the `develop` branch.
|
||||
|
||||
```
|
||||
git checkout develop
|
||||
```
|
||||
|
||||
|
||||
## Minimum Requirements
|
||||
## Platforms
|
||||
|
||||
- [Python 3.7](https://www.python.org/downloads/)
|
||||
- [Conan 2.x](https://conan.io/downloads)
|
||||
- [CMake 3.16](https://cmake.org/download/)
|
||||
We do not recommend Windows for rippled production use at this time. Currently,
|
||||
the Ubuntu platform has received the highest level of quality assurance,
|
||||
testing, and support. Additionally, 32-bit Windows development is not supported.
|
||||
|
||||
`rippled` is written in the C++20 dialect and includes the `<concepts>` header.
|
||||
The [minimum compiler versions][2] required are:
|
||||
Visual Studio 2022 is not yet supported.
|
||||
This is because rippled is not compatible with [Boost][] versions 1.78 or 1.79,
|
||||
but Conan cannot build Boost versions released earlier than them with VS 2022.
|
||||
We expect that rippled will be compatible with Boost 1.80, which should be
|
||||
released in August 2022.
|
||||
Until then, we advise Windows developers to use Visual Studio 2019.
|
||||
|
||||
| Compiler | Version |
|
||||
|-------------|---------|
|
||||
| GCC | 10 |
|
||||
| Clang | 13 |
|
||||
| Apple Clang | 13.1.6 |
|
||||
| MSVC | 19.23 |
|
||||
|
||||
We don't recommend Windows for `rippled` production at this time. As of
|
||||
January 2023, Ubuntu has the highest level of quality assurance, testing,
|
||||
and support.
|
||||
|
||||
Windows developers should use Visual Studio 2019. `rippled` isn't
|
||||
compatible with [Boost](https://www.boost.org/) 1.78 or 1.79, and Conan
|
||||
can't build earlier Boost versions.
|
||||
|
||||
**Note:** 32-bit Windows development isn't supported.
|
||||
[Boost]: https://www.boost.org/
|
||||
|
||||
|
||||
## Steps
|
||||
## Prerequisites
|
||||
|
||||
To build this package, you will need Python (>= 3.7),
|
||||
[Conan][] (>= 1.52), and [CMake][] (>= 3.16).
|
||||
If you are unfamiliar with Conan,
|
||||
there is a crash course at the end of this document.
|
||||
|
||||
[Conan]: https://conan.io/downloads.html
|
||||
[CMake]: https://cmake.org/download/
|
||||
|
||||
You'll need to compile in the C++20 dialect:
|
||||
|
||||
```
|
||||
conan profile update settings.cppstd=20 default
|
||||
```
|
||||
|
||||
Linux developers will commonly have a default Conan [profile][] that compiles
|
||||
with GCC and links with libstdc++.
|
||||
If you are linking with libstdc++ (see profile setting `compiler.libcxx`),
|
||||
then you will need to choose the `libstdc++11` ABI:
|
||||
|
||||
```
|
||||
conan profile update settings.compiler.libcxx=libstdc++11 default
|
||||
```
|
||||
|
||||
We find it necessary to use the x64 native build tools on Windows.
|
||||
An easy way to do that is to run the shortcut "x64 Native Tools Command
|
||||
Prompt" for the version of Visual Studio that you have installed.
|
||||
|
||||
Windows developers must build rippled and its dependencies for the x64
|
||||
architecture:
|
||||
|
||||
```
|
||||
conan profile update settings.arch=x86_64 default
|
||||
```
|
||||
|
||||
|
||||
### Set Up Conan
|
||||
## How to build and test
|
||||
|
||||
1. (Optional) If you've never used Conan, use autodetect to set up a default profile.
|
||||
Let's start with a couple of examples of common workflows.
|
||||
The first is for a single-configuration generator (e.g. Unix Makefiles) on
|
||||
Linux or MacOS:
|
||||
|
||||
```
|
||||
conan profile detect --force
|
||||
```
|
||||
```
|
||||
conan export external/rocksdb
|
||||
mkdir .build
|
||||
cd .build
|
||||
conan install .. --output-folder . --build missing --settings build_type=Release
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release ..
|
||||
cmake --build .
|
||||
./rippled --unittest
|
||||
```
|
||||
|
||||
2. Update the compiler settings.
|
||||
The second is for a multi-configuration generator (e.g. Visual Studio) on
|
||||
Windows:
|
||||
|
||||
For Conan 2, you can edit the profile directly at `~/.conan2/profiles/default`,
|
||||
or use the Conan CLI. Ensure C++20 is set:
|
||||
```
|
||||
conan export external/rocksdb
|
||||
mkdir .build
|
||||
cd .build
|
||||
conan install .. --output-folder . --build missing --settings build_type=Release --settings compiler.runtime=MT
|
||||
conan install .. --output-folder . --build missing --settings build_type=Debug --settings compiler.runtime=MTd
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake ..
|
||||
cmake --build . --config Release
|
||||
cmake --build . --config Debug
|
||||
./Release/rippled --unittest
|
||||
./Debug/rippled --unittest
|
||||
```
|
||||
|
||||
```
|
||||
conan profile show
|
||||
```
|
||||
Here we explain the individual steps:
|
||||
|
||||
Look for `compiler.cppstd=20` in the output. If it's not set, edit the profile:
|
||||
1. Export our [Conan recipe for RocksDB](./external/rocksdb).
|
||||
|
||||
```
|
||||
# Edit ~/.conan2/profiles/default and ensure these settings exist:
|
||||
[settings]
|
||||
compiler.cppstd=20
|
||||
```
|
||||
It builds version 6.27.3, which, as of July 8, 2022,
|
||||
is not available in [Conan Center](https://conan.io/center/rocksdb).
|
||||
|
||||
Linux developers will commonly have a default Conan [profile][] that compiles
|
||||
with GCC and links with libstdc++.
|
||||
If you are linking with libstdc++ (see profile setting `compiler.libcxx`),
|
||||
then you will need to choose the `libstdc++11` ABI.
|
||||
1. Create a build directory (and move into it).
|
||||
|
||||
```
|
||||
# In ~/.conan2/profiles/default, ensure:
|
||||
[settings]
|
||||
compiler.libcxx=libstdc++11
|
||||
```
|
||||
You can choose any name you want.
|
||||
|
||||
On Windows, you should use the x64 native build tools.
|
||||
An easy way to do that is to run the shortcut "x64 Native Tools Command
|
||||
Prompt" for the version of Visual Studio that you have installed.
|
||||
Conan will generate some files in what it calls the "install folder".
|
||||
These files are implementation details that you don't need to worry about.
|
||||
By default, the install folder is your current working directory.
|
||||
If you don't move into your build directory before calling Conan,
|
||||
then you may be annoyed to see it polluting your project root directory
|
||||
with these files.
|
||||
To make Conan put them in your build directory,
|
||||
you'll have to add the option
|
||||
`--install-folder` or `-if` to every `conan install` command.
|
||||
|
||||
Windows developers must also build `rippled` and its dependencies for the x64
|
||||
architecture.
|
||||
|
||||
```
|
||||
# In ~/.conan2/profiles/default, ensure:
|
||||
[settings]
|
||||
arch=x86_64
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
```
|
||||
# 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
|
||||
```
|
||||
|
||||
5. Export our [Conan recipe for SOCI](./external/soci).
|
||||
It patches their CMake to correctly import its dependencies.
|
||||
|
||||
```
|
||||
conan export external/soci --version 4.0.3 --user xahaud --channel stable
|
||||
```
|
||||
|
||||
6. Export our [Conan recipe for WasmEdge](./external/wasmedge).
|
||||
|
||||
```
|
||||
conan export external/wasmedge --version 0.11.2 --user xahaud --channel stable
|
||||
```
|
||||
|
||||
### Build and Test
|
||||
|
||||
1. Create a build directory and move into it.
|
||||
|
||||
```
|
||||
mkdir .build
|
||||
cd .build
|
||||
```
|
||||
|
||||
You can use any directory name. Conan treats your working directory as an
|
||||
install folder and generates files with implementation details.
|
||||
You don't need to worry about these files, but make sure to change
|
||||
your working directory to your build directory before calling Conan.
|
||||
|
||||
**Note:** You can specify a directory for the installation files by adding
|
||||
the `install-folder` or `-if` option to every `conan install` command
|
||||
in the next step.
|
||||
|
||||
2. Generate CMake files for every configuration you want to build.
|
||||
|
||||
```
|
||||
conan install .. --output-folder . --build missing --settings build_type=Release
|
||||
conan install .. --output-folder . --build missing --settings build_type=Debug
|
||||
```
|
||||
1. Generate CMake files for every configuration you want to build.
|
||||
|
||||
For a single-configuration generator, e.g. `Unix Makefiles` or `Ninja`,
|
||||
you only need to run this command once.
|
||||
For a multi-configuration generator, e.g. `Visual Studio`, you may want to
|
||||
run it more than once.
|
||||
|
||||
Each of these commands should also have a different `build_type` setting.
|
||||
A second command with the same `build_type` setting will overwrite the files
|
||||
generated by the first. You can pass the build type on the command line with
|
||||
`--settings build_type=$BUILD_TYPE` or in the profile itself,
|
||||
under the section `[settings]` with the key `build_type`.
|
||||
|
||||
If you are using a Microsoft Visual C++ compiler,
|
||||
then you will need to ensure consistency between the `build_type` setting
|
||||
and the `compiler.runtime` setting.
|
||||
|
||||
Each of these commands should have a different `build_type` setting.
|
||||
A second command with the same `build_type` setting will just overwrite
|
||||
the files generated by the first.
|
||||
You can pass the build type on the command line with `--settings
|
||||
build_type=$BUILD_TYPE` or in the profile itself, under the section
|
||||
`[settings]`, with the key `build_type`.
|
||||
|
||||
If you are using a Microsoft Visual C++ compiler, then you will need to
|
||||
ensure consistency between the `build_type` setting and the
|
||||
`compiler.runtime` setting.
|
||||
When `build_type` is `Release`, `compiler.runtime` should be `MT`.
|
||||
|
||||
When `build_type` is `Debug`, `compiler.runtime` should be `MTd`.
|
||||
|
||||
```
|
||||
conan install .. --output-folder . --build missing --settings build_type=Release --settings compiler.runtime=MT
|
||||
conan install .. --output-folder . --build missing --settings build_type=Debug --settings compiler.runtime=MTd
|
||||
```
|
||||
1. Configure CMake once.
|
||||
|
||||
3. Configure CMake and pass the toolchain file generated by Conan, located at
|
||||
`$OUTPUT_FOLDER/build/generators/conan_toolchain.cmake`.
|
||||
For all choices of generator, pass the toolchain file generated by Conan.
|
||||
It will be located at
|
||||
`$OUTPUT_FOLDER/build/generators/conan_toolchain.cmake`.
|
||||
If you are using a single-configuration generator, then pass the CMake
|
||||
variable [`CMAKE_BUILD_TYPE`][build_type] and make sure it matches the
|
||||
`build_type` setting you chose in the previous step.
|
||||
|
||||
Single-config generators:
|
||||
|
||||
```
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release ..
|
||||
```
|
||||
This step is where you may pass build options for rippled.
|
||||
|
||||
Pass the CMake variable [`CMAKE_BUILD_TYPE`][build_type]
|
||||
and make sure it matches the `build_type` setting you chose in the previous
|
||||
step.
|
||||
1. Build rippled.
|
||||
|
||||
Multi-config gnerators:
|
||||
|
||||
```
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake ..
|
||||
```
|
||||
|
||||
**Note:** You can pass build options for `rippled` in this step.
|
||||
|
||||
4. Build `rippled`.
|
||||
|
||||
For a single-configuration generator, it will build whatever configuration
|
||||
you passed for `CMAKE_BUILD_TYPE`. For a multi-configuration generator,
|
||||
you must pass the option `--config` to select the build configuration.
|
||||
|
||||
Single-config generators:
|
||||
|
||||
```
|
||||
cmake --build .
|
||||
```
|
||||
|
||||
Multi-config generators:
|
||||
|
||||
```
|
||||
cmake --build . --config Release
|
||||
cmake --build . --config Debug
|
||||
```
|
||||
For a multi-configuration generator, you must pass the option `--config`
|
||||
to select the build configuration.
|
||||
For a single-configuration generator, it will build whatever configuration
|
||||
you passed for `CMAKE_BUILD_TYPE`.
|
||||
|
||||
5. Test rippled.
|
||||
|
||||
Single-config generators:
|
||||
|
||||
```
|
||||
./rippled --unittest
|
||||
```
|
||||
|
||||
Multi-config generators:
|
||||
|
||||
```
|
||||
./Release/rippled --unittest
|
||||
./Debug/rippled --unittest
|
||||
```
|
||||
|
||||
The location of `rippled` in your build directory depends on your CMake
|
||||
generator. Pass `--help` to see the rest of the command line options.
|
||||
The exact location of rippled in your build directory
|
||||
depends on your choice of CMake generator.
|
||||
You can run unit tests by passing `--unittest`.
|
||||
Pass `--help` to see the rest of the command line options.
|
||||
|
||||
|
||||
## Options
|
||||
### Options
|
||||
|
||||
| Option | Default Value | Description |
|
||||
| --- | ---| ---|
|
||||
| `assert` | OFF | Enable assertions.
|
||||
| `reporting` | OFF | Build the reporting mode feature. |
|
||||
| `tests` | ON | Build tests. |
|
||||
| `unity` | ON | Configure a unity build. |
|
||||
| `san` | N/A | Enable a sanitizer with Clang. Choices are `thread` and `address`. |
|
||||
The `unity` option allows you to select between [unity][5] and non-unity
|
||||
builds.
|
||||
Unity builds may be faster for the first build (at the cost of much
|
||||
more memory) since they concatenate sources into fewer translation
|
||||
units.
|
||||
Non-unity builds may be faster for incremental builds, and can be helpful for
|
||||
detecting `#include` omissions.
|
||||
|
||||
[Unity builds][5] may be faster for the first build
|
||||
(at the cost of much more memory) since they concatenate sources into fewer
|
||||
translation units. Non-unity builds may be faster for incremental builds,
|
||||
and can be helpful for detecting `#include` omissions.
|
||||
Below are the most commonly used options,
|
||||
with their default values in parentheses.
|
||||
|
||||
- `assert` (OFF): Enable assertions.
|
||||
- `reporting` (OFF): Build the reporting mode feature.
|
||||
- `tests` (ON): Build tests.
|
||||
- `unity` (ON): Configure a [unity build][5].
|
||||
|
||||
|
||||
## Troubleshooting
|
||||
### Troubleshooting
|
||||
|
||||
|
||||
### Conan
|
||||
|
||||
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 "*"
|
||||
```
|
||||
|
||||
|
||||
### macOS compilation with Apple Clang 17+
|
||||
|
||||
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:
|
||||
|
||||
```
|
||||
[conf]
|
||||
tools.build:cxxflags=["-Wno-missing-template-arg-list-after-template-kw"]
|
||||
```
|
||||
|
||||
|
||||
### recompile with -fPIC
|
||||
|
||||
If you get a linker error suggesting that you recompile Boost with
|
||||
position-independent code, such as:
|
||||
|
||||
```
|
||||
/usr/bin/ld.gold: error: /home/username/.conan/data/boost/1.77.0/_/_/package/.../lib/libboost_container.a(alloc_lib.o):
|
||||
requires unsupported dynamic reloc 11; recompile with -fPIC
|
||||
```
|
||||
|
||||
Conan most likely downloaded a bad binary distribution of the dependency.
|
||||
This seems to be a [bug][1] in Conan just for Boost 1.77.0 compiled with GCC
|
||||
for Linux. The solution is to build the dependency locally by passing
|
||||
`--build boost` when calling `conan install`.
|
||||
If you get a linker error like the one below suggesting that you recompile
|
||||
Boost with position-independent code, the reason is most likely that Conan
|
||||
downloaded a bad binary distribution of the dependency.
|
||||
For now, this seems to be a [bug][1] in Conan just for Boost 1.77.0 compiled
|
||||
with GCC for Linux.
|
||||
The solution is to build the dependency locally by passing `--build boost`
|
||||
when calling `conan install`.
|
||||
|
||||
```
|
||||
/usr/bin/ld.gold: error: /home/username/.conan/data/boost/1.77.0/_/_/package/dc8aedd23a0f0a773a5fcdcfe1ae3e89c4205978/lib/libboost_container.a(alloc_lib.o): requires unsupported dynamic reloc 11; recompile with -fPIC
|
||||
```
|
||||
|
||||
|
||||
## Add a Dependency
|
||||
## How to add a dependency
|
||||
|
||||
If you want to experiment with a new package, follow these steps:
|
||||
If you want to experiment with a new package, here are the steps to get it
|
||||
working:
|
||||
|
||||
1. Search for the package on [Conan Center](https://conan.io/center/).
|
||||
2. Modify [`conanfile.py`](./conanfile.py):
|
||||
- Add a version of the package to the `requires` property.
|
||||
- Change any default options for the package by adding them to the
|
||||
`default_options` property (with syntax `'$package:$option': $value`).
|
||||
3. Modify [`CMakeLists.txt`](./CMakeLists.txt):
|
||||
- Add a call to `find_package($package REQUIRED)`.
|
||||
- Link a library from the package to the target `ripple_libs`
|
||||
(search for the existing call to `target_link_libraries(ripple_libs INTERFACE ...)`).
|
||||
4. Start coding! Don't forget to include whatever headers you need from the package.
|
||||
1. In [`conanfile.py`](./conanfile.py):
|
||||
1. Add a version of the package to the `requires` property.
|
||||
1. Change any default options for the package by adding them to the
|
||||
`default_options` property (with syntax `'$package:$option': $value`)
|
||||
1. In [`CMakeLists.txt`](./CMakeLists.txt):
|
||||
1. Add a call to `find_package($package REQUIRED)`.
|
||||
1. Link a library from the package to the target `ripple_libs` (search for
|
||||
the existing call to `target_link_libraries(ripple_libs INTERFACE ...)`).
|
||||
1. Start coding! Don't forget to include whatever headers you need from the
|
||||
package.
|
||||
|
||||
|
||||
## A crash course in CMake and Conan
|
||||
@@ -465,4 +349,3 @@ but it is more convenient to put them in a [profile][profile].
|
||||
[search]: https://cmake.org/cmake/help/latest/command/find_package.html#search-procedure
|
||||
[prefix_path]: https://cmake.org/cmake/help/latest/variable/CMAKE_PREFIX_PATH.html
|
||||
[profile]: https://docs.conan.io/en/latest/reference/profiles.html
|
||||
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
set (RocksDB_DIR "" CACHE PATH "Root directory of RocksDB distribution")
|
||||
|
||||
find_path (RocksDB_INCLUDE_DIR
|
||||
rocksdb/db.h
|
||||
PATHS ${RocksDB_DIR})
|
||||
|
||||
set (RocksDB_VERSION "")
|
||||
find_file (RocksDB_VERSION_FILE
|
||||
rocksdb/version.h
|
||||
PATHS ${RocksDB_DIR})
|
||||
if (RocksDB_VERSION_FILE)
|
||||
file (READ ${RocksDB_VERSION_FILE} _verfile)
|
||||
if ("${_verfile}" MATCHES "#define[ \\t]+ROCKSDB_MAJOR[ \\t]+([0-9]+)")
|
||||
string (APPEND RocksDB_VERSION "${CMAKE_MATCH_1}")
|
||||
else ()
|
||||
string (APPEND RocksDB_VERSION "0")
|
||||
endif()
|
||||
if ("${_verfile}" MATCHES "#define[ \\t]+ROCKSDB_MINOR[ \\t]+([0-9]+)")
|
||||
string (APPEND RocksDB_VERSION ".${CMAKE_MATCH_1}")
|
||||
else ()
|
||||
string (APPEND RocksDB_VERSION ".0")
|
||||
endif()
|
||||
if ("${_verfile}" MATCHES "#define[ \\t]+ROCKSDB_PATCH[ \\t]+([0-9]+)")
|
||||
string (APPEND RocksDB_VERSION ".${CMAKE_MATCH_1}")
|
||||
else ()
|
||||
string (APPEND RocksDB_VERSION ".0")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
if (RocksDB_USE_STATIC)
|
||||
list (APPEND RocksDB_NAMES
|
||||
"${CMAKE_STATIC_LIBRARY_PREFIX}rocksdb${CMAKE_STATIC_LIBRARY_SUFFIX}"
|
||||
"${CMAKE_STATIC_LIBRARY_PREFIX}rocksdblib${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
endif ()
|
||||
|
||||
list (APPEND RocksDB_NAMES rocksdb)
|
||||
|
||||
find_library (RocksDB_LIBRARY NAMES ${RocksDB_NAMES}
|
||||
PATHS
|
||||
${RocksDB_DIR}
|
||||
${RocksDB_DIR}/bin/Release
|
||||
${RocksDB_DIR}/bin64_vs2013/Release
|
||||
PATH_SUFFIXES lib lib64)
|
||||
|
||||
foreach (_n RocksDB_NAMES)
|
||||
list (APPEND RocksDB_NAMES_DBG "${_n}_d" "${_n}d")
|
||||
endforeach ()
|
||||
find_library (RocksDB_LIBRARY_DEBUG NAMES ${RocksDB_NAMES_DBG}
|
||||
PATHS
|
||||
${RocksDB_DIR}
|
||||
${RocksDB_DIR}/bin/Debug
|
||||
${RocksDB_DIR}/bin64_vs2013/Debug
|
||||
PATH_SUFFIXES lib lib64)
|
||||
|
||||
include (FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args (RocksDB
|
||||
REQUIRED_VARS RocksDB_LIBRARY RocksDB_INCLUDE_DIR
|
||||
VERSION_VAR RocksDB_VERSION)
|
||||
|
||||
mark_as_advanced (RocksDB_INCLUDE_DIR RocksDB_LIBRARY)
|
||||
set (RocksDB_INCLUDE_DIRS ${RocksDB_INCLUDE_DIR})
|
||||
set (RocksDB_LIBRARIES ${RocksDB_LIBRARY})
|
||||
@@ -1,18 +0,0 @@
|
||||
|
||||
These are modules and sources that support our CMake build.
|
||||
|
||||
== FindBoost.cmake ==
|
||||
|
||||
In order to facilitate updating to latest releases of boost, we've made a local
|
||||
copy of the FindBoost cmake module in our repo. The latest official version can
|
||||
generally be obtained
|
||||
[here](https://github.com/Kitware/CMake/blob/master/Modules/FindBoost.cmake).
|
||||
|
||||
The latest version provided by Kitware can be tailored for use with the
|
||||
version of CMake that it ships with (typically the next upcoming CMake
|
||||
release). As such, the latest version from the repository might not work
|
||||
perfectly with older versions of CMake - for instance, the latest version
|
||||
might use features or properties only available in the version of CMake that
|
||||
it ships with. Given this, it's best to test any updates to this module with a few
|
||||
different versions of cmake.
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -23,11 +23,6 @@ else()
|
||||
message(STATUS "ACL not found, continuing without ACL support")
|
||||
endif()
|
||||
|
||||
add_library(libxrpl INTERFACE)
|
||||
target_link_libraries(libxrpl INTERFACE xrpl_core)
|
||||
add_library(xrpl::libxrpl ALIAS libxrpl)
|
||||
|
||||
|
||||
#[===============================[
|
||||
beast/legacy FILES:
|
||||
TODO: review these sources for removal or replacement
|
||||
@@ -48,9 +43,7 @@ target_sources (xrpl_core PRIVATE
|
||||
src/ripple/beast/net/impl/IPAddressV6.cpp
|
||||
src/ripple/beast/net/impl/IPEndpoint.cpp
|
||||
src/ripple/beast/utility/src/beast_Journal.cpp
|
||||
src/ripple/beast/utility/src/beast_PropertyStream.cpp
|
||||
# Enhanced logging - compiles to empty when BEAST_ENHANCED_LOGGING is not defined
|
||||
src/ripple/beast/utility/src/beast_EnhancedLogging.cpp)
|
||||
src/ripple/beast/utility/src/beast_PropertyStream.cpp)
|
||||
|
||||
#[===============================[
|
||||
core sources
|
||||
@@ -157,17 +150,6 @@ target_link_libraries (xrpl_core
|
||||
ed25519::ed25519
|
||||
date::date
|
||||
Ripple::opts)
|
||||
|
||||
# date-tz for enhanced logging (always linked, code is #ifdef guarded)
|
||||
if(TARGET date::date-tz)
|
||||
target_link_libraries(xrpl_core PUBLIC date::date-tz)
|
||||
endif()
|
||||
|
||||
# BEAST_ENHANCED_LOGGING: enable for Debug builds OR when explicitly requested
|
||||
# Uses generator expression so it works with multi-config generators (Xcode, VS, Ninja Multi-Config)
|
||||
target_compile_definitions(xrpl_core PUBLIC
|
||||
$<$<OR:$<CONFIG:Debug>,$<BOOL:${BEAST_ENHANCED_LOGGING}>>:BEAST_ENHANCED_LOGGING=1>
|
||||
)
|
||||
#[=================================[
|
||||
main/core headers installation
|
||||
#]=================================]
|
||||
@@ -410,7 +392,6 @@ target_sources (rippled PRIVATE
|
||||
src/ripple/app/misc/NegativeUNLVote.cpp
|
||||
src/ripple/app/misc/NetworkOPs.cpp
|
||||
src/ripple/app/misc/SHAMapStoreImp.cpp
|
||||
src/ripple/app/misc/StateAccounting.cpp
|
||||
src/ripple/app/misc/detail/impl/WorkSSL.cpp
|
||||
src/ripple/app/misc/impl/AccountTxPaging.cpp
|
||||
src/ripple/app/misc/impl/AmendmentTable.cpp
|
||||
@@ -453,15 +434,11 @@ target_sources (rippled PRIVATE
|
||||
src/ripple/app/tx/impl/CashCheck.cpp
|
||||
src/ripple/app/tx/impl/Change.cpp
|
||||
src/ripple/app/tx/impl/ClaimReward.cpp
|
||||
src/ripple/app/tx/impl/Clawback.cpp
|
||||
src/ripple/app/tx/impl/CreateCheck.cpp
|
||||
src/ripple/app/tx/impl/CreateOffer.cpp
|
||||
src/ripple/app/tx/impl/CreateTicket.cpp
|
||||
src/ripple/app/tx/impl/Cron.cpp
|
||||
src/ripple/app/tx/impl/CronSet.cpp
|
||||
src/ripple/app/tx/impl/DeleteAccount.cpp
|
||||
src/ripple/app/tx/impl/DepositPreauth.cpp
|
||||
src/ripple/app/tx/impl/Entropy.cpp
|
||||
src/ripple/app/tx/impl/Escrow.cpp
|
||||
src/ripple/app/tx/impl/GenesisMint.cpp
|
||||
src/ripple/app/tx/impl/Import.cpp
|
||||
@@ -478,7 +455,6 @@ target_sources (rippled PRIVATE
|
||||
src/ripple/app/tx/impl/Remit.cpp
|
||||
src/ripple/app/tx/impl/SetAccount.cpp
|
||||
src/ripple/app/tx/impl/SetHook.cpp
|
||||
src/ripple/app/tx/impl/SetRemarks.cpp
|
||||
src/ripple/app/tx/impl/SetRegularKey.cpp
|
||||
src/ripple/app/tx/impl/SetSignerList.cpp
|
||||
src/ripple/app/tx/impl/SetTrust.cpp
|
||||
@@ -562,7 +538,6 @@ target_sources (rippled PRIVATE
|
||||
subdir: nodestore
|
||||
#]===============================]
|
||||
src/ripple/nodestore/backend/CassandraFactory.cpp
|
||||
src/ripple/nodestore/backend/RWDBFactory.cpp
|
||||
src/ripple/nodestore/backend/MemoryFactory.cpp
|
||||
src/ripple/nodestore/backend/NuDBFactory.cpp
|
||||
src/ripple/nodestore/backend/NullFactory.cpp
|
||||
@@ -628,7 +603,6 @@ target_sources (rippled PRIVATE
|
||||
src/ripple/rpc/handlers/BlackList.cpp
|
||||
src/ripple/rpc/handlers/BookOffers.cpp
|
||||
src/ripple/rpc/handlers/CanDelete.cpp
|
||||
src/ripple/rpc/handlers/Catalogue.cpp
|
||||
src/ripple/rpc/handlers/Connect.cpp
|
||||
src/ripple/rpc/handlers/ConsensusInfo.cpp
|
||||
src/ripple/rpc/handlers/CrawlShards.cpp
|
||||
@@ -684,7 +658,6 @@ target_sources (rippled PRIVATE
|
||||
src/ripple/rpc/handlers/ValidatorListSites.cpp
|
||||
src/ripple/rpc/handlers/Validators.cpp
|
||||
src/ripple/rpc/handlers/WalletPropose.cpp
|
||||
src/ripple/rpc/handlers/Catalogue.cpp
|
||||
src/ripple/rpc/impl/DeliveredAmount.cpp
|
||||
src/ripple/rpc/impl/Handler.cpp
|
||||
src/ripple/rpc/impl/LegacyPathFind.cpp
|
||||
@@ -696,9 +669,6 @@ target_sources (rippled PRIVATE
|
||||
src/ripple/rpc/impl/ShardVerificationScheduler.cpp
|
||||
src/ripple/rpc/impl/Status.cpp
|
||||
src/ripple/rpc/impl/TransactionSign.cpp
|
||||
src/ripple/rpc/impl/NFTokenID.cpp
|
||||
src/ripple/rpc/impl/NFTokenOfferID.cpp
|
||||
src/ripple/rpc/impl/NFTSyntheticSerializer.cpp
|
||||
#[===============================[
|
||||
main sources:
|
||||
subdir: perflog
|
||||
@@ -737,8 +707,6 @@ if (tests)
|
||||
src/test/app/BaseFee_test.cpp
|
||||
src/test/app/Check_test.cpp
|
||||
src/test/app/ClaimReward_test.cpp
|
||||
src/test/app/Cron_test.cpp
|
||||
src/test/app/Clawback_test.cpp
|
||||
src/test/app/CrossingLimits_test.cpp
|
||||
src/test/app/DeliverMin_test.cpp
|
||||
src/test/app/DepositAuth_test.cpp
|
||||
@@ -769,7 +737,6 @@ if (tests)
|
||||
src/test/app/Path_test.cpp
|
||||
src/test/app/PayChan_test.cpp
|
||||
src/test/app/PayStrand_test.cpp
|
||||
src/test/app/PreviousTxn_test.cpp
|
||||
src/test/app/PseudoTx_test.cpp
|
||||
src/test/app/RCLCensorshipDetector_test.cpp
|
||||
src/test/app/RCLValidations_test.cpp
|
||||
@@ -777,15 +744,11 @@ if (tests)
|
||||
src/test/app/Remit_test.cpp
|
||||
src/test/app/SHAMapStore_test.cpp
|
||||
src/test/app/SetAuth_test.cpp
|
||||
src/test/app/SetHook_test.cpp
|
||||
src/test/app/SetHookTSH_test.cpp
|
||||
src/test/app/SetRegularKey_test.cpp
|
||||
src/test/app/SetRemarks_test.cpp
|
||||
src/test/app/SetTrust_test.cpp
|
||||
src/test/app/Taker_test.cpp
|
||||
src/test/app/TheoreticalQuality_test.cpp
|
||||
src/test/app/Ticket_test.cpp
|
||||
src/test/app/Touch_test.cpp
|
||||
src/test/app/Transaction_ordering_test.cpp
|
||||
src/test/app/TrustAndBalance_test.cpp
|
||||
src/test/app/TxQ_test.cpp
|
||||
@@ -793,6 +756,8 @@ if (tests)
|
||||
src/test/app/ValidatorKeys_test.cpp
|
||||
src/test/app/ValidatorList_test.cpp
|
||||
src/test/app/ValidatorSite_test.cpp
|
||||
src/test/app/SetHook_test.cpp
|
||||
src/test/app/SetHookTSH_test.cpp
|
||||
src/test/app/Wildcard_test.cpp
|
||||
src/test/app/XahauGenesis_test.cpp
|
||||
src/test/app/tx/apply_test.cpp
|
||||
@@ -902,7 +867,6 @@ if (tests)
|
||||
src/test/jtx/impl/amount.cpp
|
||||
src/test/jtx/impl/balance.cpp
|
||||
src/test/jtx/impl/check.cpp
|
||||
src/test/jtx/impl/cron.cpp
|
||||
src/test/jtx/impl/delivermin.cpp
|
||||
src/test/jtx/impl/deposit.cpp
|
||||
src/test/jtx/impl/envconfig.cpp
|
||||
@@ -927,13 +891,11 @@ if (tests)
|
||||
src/test/jtx/impl/rate.cpp
|
||||
src/test/jtx/impl/regkey.cpp
|
||||
src/test/jtx/impl/reward.cpp
|
||||
src/test/jtx/impl/remarks.cpp
|
||||
src/test/jtx/impl/remit.cpp
|
||||
src/test/jtx/impl/sendmax.cpp
|
||||
src/test/jtx/impl/seq.cpp
|
||||
src/test/jtx/impl/sig.cpp
|
||||
src/test/jtx/impl/tag.cpp
|
||||
src/test/jtx/impl/TestHelpers.cpp
|
||||
src/test/jtx/impl/ticket.cpp
|
||||
src/test/jtx/impl/token.cpp
|
||||
src/test/jtx/impl/trust.cpp
|
||||
@@ -966,7 +928,6 @@ if (tests)
|
||||
src/test/nodestore/Basics_test.cpp
|
||||
src/test/nodestore/DatabaseShard_test.cpp
|
||||
src/test/nodestore/Database_test.cpp
|
||||
src/test/nodestore/NuDBFactory_test.cpp
|
||||
src/test/nodestore/Timing_test.cpp
|
||||
src/test/nodestore/import_test.cpp
|
||||
src/test/nodestore/varint_test.cpp
|
||||
@@ -1013,11 +974,6 @@ if (tests)
|
||||
subdir: resource
|
||||
#]===============================]
|
||||
src/test/resource/Logic_test.cpp
|
||||
#[===============================[
|
||||
test sources:
|
||||
subdir: rdb
|
||||
#]===============================]
|
||||
src/test/rdb/RelationalDatabase_test.cpp
|
||||
#[===============================[
|
||||
test sources:
|
||||
subdir: rpc
|
||||
@@ -1032,7 +988,6 @@ if (tests)
|
||||
src/test/rpc/AccountTx_test.cpp
|
||||
src/test/rpc/AmendmentBlocked_test.cpp
|
||||
src/test/rpc/Book_test.cpp
|
||||
src/test/rpc/Catalogue_test.cpp
|
||||
src/test/rpc/DepositAuthorized_test.cpp
|
||||
src/test/rpc/DeliveredAmount_test.cpp
|
||||
src/test/rpc/Feature_test.cpp
|
||||
@@ -1091,11 +1046,6 @@ target_link_libraries (rippled
|
||||
Ripple::opts
|
||||
Ripple::libs
|
||||
Ripple::xrpl_core
|
||||
# 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
|
||||
|
||||
@@ -35,17 +35,10 @@ target_link_libraries (opts
|
||||
$<$<BOOL:${profile}>:-pg>
|
||||
$<$<AND:$<BOOL:${is_gcc}>,$<BOOL:${profile}>>:-p>)
|
||||
|
||||
if (jemalloc)
|
||||
if (static)
|
||||
set(JEMALLOC_USE_STATIC ON CACHE BOOL "" FORCE)
|
||||
endif ()
|
||||
find_package (jemalloc REQUIRED)
|
||||
target_compile_definitions (opts INTERFACE PROFILE_JEMALLOC)
|
||||
target_include_directories (opts SYSTEM INTERFACE ${JEMALLOC_INCLUDE_DIRS})
|
||||
target_link_libraries (opts INTERFACE ${JEMALLOC_LIBRARIES})
|
||||
get_filename_component (JEMALLOC_LIB_PATH ${JEMALLOC_LIBRARIES} DIRECTORY)
|
||||
## TODO see if we can use the BUILD_RPATH target property (is it transitive?)
|
||||
set (CMAKE_BUILD_RPATH ${CMAKE_BUILD_RPATH} ${JEMALLOC_LIB_PATH})
|
||||
if(jemalloc)
|
||||
find_package(jemalloc REQUIRED)
|
||||
target_compile_definitions(opts INTERFACE PROFILE_JEMALLOC)
|
||||
target_link_libraries(opts INTERFACE jemalloc::jemalloc)
|
||||
endif ()
|
||||
|
||||
if (san)
|
||||
|
||||
@@ -10,12 +10,7 @@ if (NOT ep_procs)
|
||||
message (STATUS "Using ${ep_procs} cores for ExternalProject builds.")
|
||||
endif ()
|
||||
endif ()
|
||||
get_property (is_multiconfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||
if (is_multiconfig STREQUAL "NOTFOUND")
|
||||
if (${CMAKE_GENERATOR} STREQUAL "Xcode" OR ${CMAKE_GENERATOR} MATCHES "^Visual Studio")
|
||||
set (is_multiconfig TRUE)
|
||||
endif ()
|
||||
endif ()
|
||||
get_property(is_multiconfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||
|
||||
set (CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
|
||||
if (NOT is_multiconfig)
|
||||
@@ -49,9 +44,6 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
message (FATAL_ERROR "This project requires GCC 8 or later")
|
||||
endif ()
|
||||
endif ()
|
||||
if (CMAKE_GENERATOR STREQUAL "Xcode")
|
||||
set (is_xcode TRUE)
|
||||
endif ()
|
||||
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
set (is_linux TRUE)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
find_package(Boost 1.86 REQUIRED
|
||||
find_package(Boost 1.70 REQUIRED
|
||||
COMPONENTS
|
||||
chrono
|
||||
container
|
||||
@@ -32,7 +32,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)
|
||||
|
||||
@@ -19,4 +19,4 @@ target_compile_options(pbufs
|
||||
-Wno-deprecated-dynamic-exception-spec
|
||||
>
|
||||
)
|
||||
add_library(Ripple::pbufs ALIAS pbufs)
|
||||
add_library(Ripple::pbufs ALIAS pbufs)
|
||||
|
||||
@@ -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 (NIH::WasmEdge ALIAS wasmedge)
|
||||
|
||||
@@ -59,4 +59,4 @@ target_compile_options(grpc_pbufs
|
||||
--system-header-prefix="google/protobuf"
|
||||
-Wno-deprecated-dynamic-exception-spec
|
||||
>)
|
||||
add_library(Ripple::grpc_pbufs ALIAS grpc_pbufs)
|
||||
add_library(Ripple::grpc_pbufs ALIAS grpc_pbufs)
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
set (THIRDPARTY_LIBS "")
|
||||
|
||||
if(WITH_SNAPPY)
|
||||
add_definitions(-DSNAPPY)
|
||||
include_directories(${snappy_INCLUDE_DIRS})
|
||||
set (THIRDPARTY_LIBS ${THIRDPARTY_LIBS} ${snappy_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(WITH_LZ4)
|
||||
add_definitions(-DLZ4)
|
||||
include_directories(${lz4_INCLUDE_DIRS})
|
||||
set (THIRDPARTY_LIBS ${THIRDPARTY_LIBS} ${lz4_LIBRARIES})
|
||||
endif()
|
||||
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "rocksdb/version.h"
|
||||
#include "util/string_util.h"
|
||||
|
||||
// The build script may replace these values with real values based
|
||||
// on whether or not GIT is available and the platform settings
|
||||
static const std::string rocksdb_build_git_sha = "rocksdb_build_git_sha:@GIT_SHA@";
|
||||
static const std::string rocksdb_build_git_tag = "rocksdb_build_git_tag:@GIT_TAG@";
|
||||
#define HAS_GIT_CHANGES @GIT_MOD@
|
||||
#if HAS_GIT_CHANGES == 0
|
||||
// If HAS_GIT_CHANGES is 0, the GIT date is used.
|
||||
// Use the time the branch/tag was last modified
|
||||
static const std::string rocksdb_build_date = "rocksdb_build_date:@GIT_DATE@";
|
||||
#else
|
||||
// If HAS_GIT_CHANGES is > 0, the branch/tag has modifications.
|
||||
// Use the time the build was created.
|
||||
static const std::string rocksdb_build_date = "rocksdb_build_date:@BUILD_DATE@";
|
||||
#endif
|
||||
|
||||
namespace ROCKSDB_NAMESPACE {
|
||||
static void AddProperty(std::unordered_map<std::string, std::string> *props, const std::string& name) {
|
||||
size_t colon = name.find(":");
|
||||
if (colon != std::string::npos && colon > 0 && colon < name.length() - 1) {
|
||||
// If we found a "@:", then this property was a build-time substitution that failed. Skip it
|
||||
size_t at = name.find("@", colon);
|
||||
if (at != colon + 1) {
|
||||
// Everything before the colon is the name, after is the value
|
||||
(*props)[name.substr(0, colon)] = name.substr(colon + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static std::unordered_map<std::string, std::string>* LoadPropertiesSet() {
|
||||
auto * properties = new std::unordered_map<std::string, std::string>();
|
||||
AddProperty(properties, rocksdb_build_git_sha);
|
||||
AddProperty(properties, rocksdb_build_git_tag);
|
||||
AddProperty(properties, rocksdb_build_date);
|
||||
return properties;
|
||||
}
|
||||
|
||||
const std::unordered_map<std::string, std::string>& GetRocksBuildProperties() {
|
||||
static std::unique_ptr<std::unordered_map<std::string, std::string>> props(LoadPropertiesSet());
|
||||
return *props;
|
||||
}
|
||||
|
||||
std::string GetRocksVersionAsString(bool with_patch) {
|
||||
std::string version = ToString(ROCKSDB_MAJOR) + "." + ToString(ROCKSDB_MINOR);
|
||||
if (with_patch) {
|
||||
return version + "." + ToString(ROCKSDB_PATCH);
|
||||
} else {
|
||||
return version;
|
||||
}
|
||||
}
|
||||
|
||||
std::string GetRocksBuildInfoAsString(const std::string& program, bool verbose) {
|
||||
std::string info = program + " (RocksDB) " + GetRocksVersionAsString(true);
|
||||
if (verbose) {
|
||||
for (const auto& it : GetRocksBuildProperties()) {
|
||||
info.append("\n ");
|
||||
info.append(it.first);
|
||||
info.append(": ");
|
||||
info.append(it.second);
|
||||
}
|
||||
}
|
||||
return info;
|
||||
}
|
||||
} // namespace ROCKSDB_NAMESPACE
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
# This patches unsigned-types.h in the soci official sources
|
||||
# so as to remove type range check exceptions that cause
|
||||
# us trouble when using boost::optional to select int values
|
||||
|
||||
# Soci's CMake setup leaves flags in place that will cause warnings to
|
||||
# be treated as errors, but some compiler versions throw "new" warnings
|
||||
# that then cause the build to fail. Simplify that until soci fixes
|
||||
# those warnings.
|
||||
if (RIPPLED_SOURCE)
|
||||
execute_process( COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${RIPPLED_SOURCE}/Builds/CMake/SociConfig.cmake.patched
|
||||
cmake/SociConfig.cmake )
|
||||
endif ()
|
||||
|
||||
# Some versions of CMake erroneously patch external projects on every build.
|
||||
# If the patch makes no changes, skip it. This workaround can be
|
||||
# removed once we stop supporting vulnerable versions of CMake.
|
||||
# https://gitlab.kitware.com/cmake/cmake/-/issues/21086
|
||||
file (STRINGS include/soci/unsigned-types.h sourcecode)
|
||||
# Delete the .patched file if it exists, so it doesn't end up duplicated.
|
||||
# Trying to remove a file that does not exist is not a problem.
|
||||
file (REMOVE include/soci/unsigned-types.h.patched)
|
||||
foreach (line_ ${sourcecode})
|
||||
if (line_ MATCHES "^[ \\t]+throw[ ]+soci_error[ ]*\\([ ]*\"Value outside of allowed.+$")
|
||||
set (line_ "//${CMAKE_MATCH_0}")
|
||||
endif ()
|
||||
file (APPEND include/soci/unsigned-types.h.patched "${line_}\n")
|
||||
endforeach ()
|
||||
execute_process( COMMAND ${CMAKE_COMMAND} -E compare_files
|
||||
include/soci/unsigned-types.h include/soci/unsigned-types.h.patched
|
||||
RESULT_VARIABLE compare_result
|
||||
)
|
||||
if( compare_result EQUAL 0)
|
||||
message(DEBUG "The soci source and patch files are identical. Make no changes.")
|
||||
file (REMOVE include/soci/unsigned-types.h.patched)
|
||||
return()
|
||||
endif()
|
||||
file (RENAME include/soci/unsigned-types.h include/soci/unsigned-types.h.orig)
|
||||
file (RENAME include/soci/unsigned-types.h.patched include/soci/unsigned-types.h)
|
||||
# also fix Boost.cmake so that it just returns when we override the Boost_FOUND var
|
||||
file (APPEND cmake/dependencies/Boost.cmake.patched "if (Boost_FOUND)\n")
|
||||
file (APPEND cmake/dependencies/Boost.cmake.patched " return ()\n")
|
||||
file (APPEND cmake/dependencies/Boost.cmake.patched "endif ()\n")
|
||||
file (STRINGS cmake/dependencies/Boost.cmake sourcecode)
|
||||
foreach (line_ ${sourcecode})
|
||||
file (APPEND cmake/dependencies/Boost.cmake.patched "${line_}\n")
|
||||
endforeach ()
|
||||
file (RENAME cmake/dependencies/Boost.cmake.patched cmake/dependencies/Boost.cmake)
|
||||
|
||||
@@ -53,7 +53,7 @@ Loop: test.app test.jtx
|
||||
test.app > test.jtx
|
||||
|
||||
Loop: test.app test.rpc
|
||||
test.rpc ~= test.app
|
||||
test.rpc == test.app
|
||||
|
||||
Loop: test.jtx test.toplevel
|
||||
test.toplevel > test.jtx
|
||||
|
||||
@@ -186,10 +186,6 @@ test.protocol > ripple.crypto
|
||||
test.protocol > ripple.json
|
||||
test.protocol > ripple.protocol
|
||||
test.protocol > test.toplevel
|
||||
test.rdb > ripple.app
|
||||
test.rdb > ripple.core
|
||||
test.rdb > test.jtx
|
||||
test.rdb > test.toplevel
|
||||
test.resource > ripple.basics
|
||||
test.resource > ripple.beast
|
||||
test.resource > ripple.resource
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
cmake_minimum_required (VERSION 3.16)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
if(POLICY CMP0074)
|
||||
cmake_policy(SET CMP0074 NEW)
|
||||
@@ -14,11 +11,11 @@ endif()
|
||||
file(TO_CMAKE_PATH "${CMAKE_MODULE_PATH}" CMAKE_MODULE_PATH)
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/Builds/CMake")
|
||||
|
||||
if(POLICY CMP0144)
|
||||
cmake_policy(SET CMP0144 NEW)
|
||||
endif()
|
||||
project(rippled)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
project (rippled)
|
||||
set(Boost_NO_BOOST_CMAKE ON)
|
||||
|
||||
# make GIT_COMMIT_HASH define available to all sources
|
||||
@@ -33,33 +30,12 @@ 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++")
|
||||
add_link_options("-stdlib=libc++")
|
||||
endif()
|
||||
|
||||
option(USE_CONAN "Use Conan package manager for dependencies" OFF)
|
||||
# Then, auto-detect if conan_toolchain.cmake is being used
|
||||
if(CMAKE_TOOLCHAIN_FILE)
|
||||
# Check if the toolchain file path contains "conan_toolchain"
|
||||
if(CMAKE_TOOLCHAIN_FILE MATCHES "conan_toolchain")
|
||||
set(USE_CONAN ON CACHE BOOL "Using Conan detected from toolchain file" FORCE)
|
||||
message(STATUS "Conan toolchain detected: ${CMAKE_TOOLCHAIN_FILE}")
|
||||
message(STATUS "Building with Conan dependencies")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include (CheckCXXCompilerFlag)
|
||||
include (FetchContent)
|
||||
include (ExternalProject)
|
||||
@@ -72,7 +48,6 @@ endif ()
|
||||
include(RippledSanity)
|
||||
include(RippledVersion)
|
||||
include(RippledSettings)
|
||||
|
||||
# this check has to remain in the top-level cmake
|
||||
# because of the early return statement
|
||||
if (packages_only)
|
||||
@@ -84,6 +59,8 @@ endif ()
|
||||
include(RippledCompiler)
|
||||
include(RippledInterface)
|
||||
|
||||
###
|
||||
|
||||
include(deps/Boost)
|
||||
find_package(OpenSSL 1.1.1 REQUIRED)
|
||||
set_target_properties(OpenSSL::SSL PROPERTIES
|
||||
@@ -99,7 +76,8 @@ find_package(LibArchive REQUIRED)
|
||||
find_package(SOCI REQUIRED)
|
||||
find_package(SQLite3 REQUIRED)
|
||||
find_package(Snappy REQUIRED)
|
||||
# find_package(wasmedge REQUIRED)
|
||||
find_package(wasmedge REQUIRED)
|
||||
|
||||
option(rocksdb "Enable RocksDB" ON)
|
||||
if(rocksdb)
|
||||
find_package(RocksDB REQUIRED)
|
||||
@@ -108,12 +86,26 @@ if(rocksdb)
|
||||
)
|
||||
target_link_libraries(ripple_libs INTERFACE RocksDB::rocksdb)
|
||||
endif()
|
||||
|
||||
find_package(nudb REQUIRED)
|
||||
find_package(date REQUIRED)
|
||||
include(deps/Protobuf)
|
||||
include(deps/gRPC)
|
||||
include(deps/WasmEdge)
|
||||
if(TARGET nudb::core)
|
||||
|
||||
target_link_libraries(ripple_libs INTERFACE
|
||||
ed25519::ed25519
|
||||
LibArchive::LibArchive
|
||||
lz4::lz4
|
||||
OpenSSL::Crypto
|
||||
OpenSSL::SSL
|
||||
Ripple::grpc_pbufs
|
||||
Ripple::pbufs
|
||||
secp256k1::secp256k1
|
||||
soci::soci
|
||||
SQLite::SQLite3
|
||||
)
|
||||
|
||||
if(TARGET nudb::core)
|
||||
set(nudb nudb::core)
|
||||
elseif(TARGET NuDB::nudb)
|
||||
set(nudb NuDB::nudb)
|
||||
@@ -130,18 +122,6 @@ if(reporting)
|
||||
PostgreSQL::PostgreSQL
|
||||
)
|
||||
endif()
|
||||
target_link_libraries(ripple_libs INTERFACE
|
||||
ed25519::ed25519
|
||||
LibArchive::LibArchive
|
||||
lz4::lz4
|
||||
OpenSSL::Crypto
|
||||
OpenSSL::SSL
|
||||
Ripple::grpc_pbufs
|
||||
Ripple::pbufs
|
||||
secp256k1::secp256k1
|
||||
soci::soci
|
||||
SQLite::SQLite3
|
||||
)
|
||||
|
||||
###
|
||||
|
||||
|
||||
@@ -176,11 +176,10 @@ 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]: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/about-pull-request-merges#squash-and-merge-your-commits
|
||||
[2]: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/about-pull-request-merges#squash-and-merge-your-commits
|
||||
12
README.md
12
README.md
@@ -1,8 +1,8 @@
|
||||
# Xahau
|
||||
# Xahau
|
||||
|
||||
**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)
|
||||
@@ -67,5 +67,5 @@ git-subtree. See those directories' README files for more details.
|
||||
- [explorer.xahau.network](https://explorer.xahau.network)
|
||||
- **Testnet & Faucet**: Test applications and obtain test XAH at [xahau-test.net](https://xahau-test.net) and use the testnet explorer at [explorer.xahau.network](https://explorer.xahau.network).
|
||||
- **Supporting Wallets**: A list of wallets that support XAH and Xahau-based assets.
|
||||
- [Xaman](https://xaman.app)
|
||||
- [Crossmark](https://crossmark.io)
|
||||
- [Xumm](https://xumm.app)
|
||||
- [Crossmark](https://crossmark.io)
|
||||
124
RELEASENOTES.md
124
RELEASENOTES.md
@@ -8,130 +8,6 @@ This document contains the release notes for `rippled`, the reference server imp
|
||||
Have new ideas? Need help with setting up your node? [Please open an issue here](https://github.com/xrplf/rippled/issues/new/choose).
|
||||
|
||||
|
||||
# Introducing XRP Ledger version 1.11.0
|
||||
|
||||
Version 1.11.0 of `rippled`, the reference server implementation of the XRP Ledger protocol, is now available.
|
||||
|
||||
This release reduces memory usage, introduces the `fixNFTokenRemint` amendment, and adds new features and bug fixes. For example, the new NetworkID field in transactions helps to prevent replay attacks with side-chains.
|
||||
|
||||
[Sign Up for Future Release Announcements](https://groups.google.com/g/ripple-server)
|
||||
|
||||
<!-- BREAK -->
|
||||
|
||||
## Action Required
|
||||
|
||||
The `fixNFTokenRemint` amendment is now open for voting according to the XRP Ledger's [amendment process](https://xrpl.org/amendments.html), which enables protocol changes following two weeks of >80% support from trusted validators.
|
||||
|
||||
If you operate an XRP Ledger server, upgrade to version 1.11.0 by July 5 to ensure service continuity. The exact time that protocol changes take effect depends on the voting decisions of the decentralized network.
|
||||
|
||||
|
||||
## Install / Upgrade
|
||||
|
||||
On supported platforms, see the [instructions on installing or updating `rippled`](https://xrpl.org/install-rippled.html).
|
||||
|
||||
|
||||
## What's Changed
|
||||
|
||||
### New Features and Improvements
|
||||
|
||||
* Allow port numbers be be specified using a either a colon or a space by @RichardAH in https://github.com/XRPLF/rippled/pull/4328
|
||||
* Eliminate memory allocation from critical path: by @nbougalis in https://github.com/XRPLF/rippled/pull/4353
|
||||
* Make it easy for projects to depend on libxrpl by @thejohnfreeman in https://github.com/XRPLF/rippled/pull/4449
|
||||
* Add the ability to mark amendments as obsolete by @ximinez in https://github.com/XRPLF/rippled/pull/4291
|
||||
* Always create the FeeSettings object in genesis ledger by @ximinez in https://github.com/XRPLF/rippled/pull/4319
|
||||
* Log exception messages in several locations by @drlongle in https://github.com/XRPLF/rippled/pull/4400
|
||||
* Parse flags in account_info method by @drlongle in https://github.com/XRPLF/rippled/pull/4459
|
||||
* Add NFTokenPages to account_objects RPC by @RichardAH in https://github.com/XRPLF/rippled/pull/4352
|
||||
* add jss fields used by clio `nft_info` by @ledhed2222 in https://github.com/XRPLF/rippled/pull/4320
|
||||
* Introduce a slab-based memory allocator and optimize SHAMapItem by @nbougalis in https://github.com/XRPLF/rippled/pull/4218
|
||||
* Add NetworkID field to transactions to help prevent replay attacks on and from side-chains by @RichardAH in https://github.com/XRPLF/rippled/pull/4370
|
||||
* If present, set quorum based on command line. by @mtrippled in https://github.com/XRPLF/rippled/pull/4489
|
||||
* API does not accept seed or public key for account by @drlongle in https://github.com/XRPLF/rippled/pull/4404
|
||||
* Add `nftoken_id`, `nftoken_ids` and `offer_id` meta fields into NFT `Tx` responses by @shawnxie999 in https://github.com/XRPLF/rippled/pull/4447
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix(gateway_balances): handle overflow exception by @RichardAH in https://github.com/XRPLF/rippled/pull/4355
|
||||
* fix(ValidatorSite): handle rare null pointer dereference in timeout by @ximinez in https://github.com/XRPLF/rippled/pull/4420
|
||||
* RPC commands understand markers derived from all ledger object types by @ximinez in https://github.com/XRPLF/rippled/pull/4361
|
||||
* `fixNFTokenRemint`: prevent NFT re-mint: by @shawnxie999 in https://github.com/XRPLF/rippled/pull/4406
|
||||
* Fix a case where ripple::Expected returned a json array, not a value by @scottschurr in https://github.com/XRPLF/rippled/pull/4401
|
||||
* fix: Ledger data returns an empty list (instead of null) when all entries are filtered out by @drlongle in https://github.com/XRPLF/rippled/pull/4398
|
||||
* Fix unit test ripple.app.LedgerData by @drlongle in https://github.com/XRPLF/rippled/pull/4484
|
||||
* Fix the fix for std::result_of by @thejohnfreeman in https://github.com/XRPLF/rippled/pull/4496
|
||||
* Fix errors for Clang 16 by @thejohnfreeman in https://github.com/XRPLF/rippled/pull/4501
|
||||
* Ensure that switchover vars are initialized before use: by @seelabs in https://github.com/XRPLF/rippled/pull/4527
|
||||
* Move faulty assert by @ximinez in https://github.com/XRPLF/rippled/pull/4533
|
||||
* Fix unaligned load and stores: (#4528) by @seelabs in https://github.com/XRPLF/rippled/pull/4531
|
||||
* fix node size estimation by @dangell7 in https://github.com/XRPLF/rippled/pull/4536
|
||||
* fix: remove redundant moves by @ckeshava in https://github.com/XRPLF/rippled/pull/4565
|
||||
|
||||
### Code Cleanup and Testing
|
||||
|
||||
* Replace compare() with the three-way comparison operator in base_uint, Issue and Book by @drlongle in https://github.com/XRPLF/rippled/pull/4411
|
||||
* Rectify the import paths of boost::function_output_iterator by @ckeshava in https://github.com/XRPLF/rippled/pull/4293
|
||||
* Expand Linux test matrix by @thejohnfreeman in https://github.com/XRPLF/rippled/pull/4454
|
||||
* Add patched recipe for SOCI by @thejohnfreeman in https://github.com/XRPLF/rippled/pull/4510
|
||||
* Switch to self-hosted runners for macOS by @thejohnfreeman in https://github.com/XRPLF/rippled/pull/4511
|
||||
* [TRIVIAL] Add missing includes by @seelabs in https://github.com/XRPLF/rippled/pull/4555
|
||||
|
||||
### Docs
|
||||
|
||||
* Refactor build instructions by @thejohnfreeman in https://github.com/XRPLF/rippled/pull/4381
|
||||
* Add install instructions for package managers by @thejohnfreeman in https://github.com/XRPLF/rippled/pull/4472
|
||||
* Fix typo by @solmsted in https://github.com/XRPLF/rippled/pull/4508
|
||||
* Update environment.md by @sappenin in https://github.com/XRPLF/rippled/pull/4498
|
||||
* Update BUILD.md by @oeggert in https://github.com/XRPLF/rippled/pull/4514
|
||||
* Trivial: add comments for NFToken-related invariants by @scottschurr in https://github.com/XRPLF/rippled/pull/4558
|
||||
|
||||
## New Contributors
|
||||
* @drlongle made their first contribution in https://github.com/XRPLF/rippled/pull/4411
|
||||
* @ckeshava made their first contribution in https://github.com/XRPLF/rippled/pull/4293
|
||||
* @solmsted made their first contribution in https://github.com/XRPLF/rippled/pull/4508
|
||||
* @sappenin made their first contribution in https://github.com/XRPLF/rippled/pull/4498
|
||||
* @oeggert made their first contribution in https://github.com/XRPLF/rippled/pull/4514
|
||||
|
||||
**Full Changelog**: https://github.com/XRPLF/rippled/compare/1.10.1...1.11.0
|
||||
|
||||
|
||||
### GitHub
|
||||
|
||||
The public source code repository for `rippled` is hosted on GitHub at <https://github.com/XRPLF/rippled>.
|
||||
|
||||
We welcome all contributions and invite everyone to join the community of XRP Ledger developers to help build the Internet of Value.
|
||||
|
||||
### Credits
|
||||
|
||||
The following people contributed directly to this release:
|
||||
- Alloy Networks <45832257+alloynetworks@users.noreply.github.com>
|
||||
- Brandon Wilson <brandon@coil.com>
|
||||
- Chenna Keshava B S <21219765+ckeshava@users.noreply.github.com>
|
||||
- David Fuelling <sappenin@gmail.com>
|
||||
- Denis Angell <dangell@transia.co>
|
||||
- Ed Hennis <ed@ripple.com>
|
||||
- Elliot Lee <github.public@intelliot.com>
|
||||
- John Freeman <jfreeman08@gmail.com>
|
||||
- Mark Travis <mtrippled@users.noreply.github.com>
|
||||
- Nik Bougalis <nikb@bougalis.net>
|
||||
- RichardAH <richard.holland@starstone.co.nz>
|
||||
- Scott Determan <scott.determan@yahoo.com>
|
||||
- Scott Schurr <scott@ripple.com>
|
||||
- Shawn Xie <35279399+shawnxie999@users.noreply.github.com>
|
||||
- drlongle <drlongle@gmail.com>
|
||||
- ledhed2222 <ledhed2222@users.noreply.github.com>
|
||||
- oeggert <117319296+oeggert@users.noreply.github.com>
|
||||
- solmsted <steven.olm@gmail.com>
|
||||
|
||||
|
||||
Bug Bounties and Responsible Disclosures:
|
||||
We welcome reviews of the rippled code and urge researchers to
|
||||
responsibly disclose any issues they may find.
|
||||
|
||||
To report a bug, please send a detailed report to:
|
||||
|
||||
bugs@xrpl.org
|
||||
|
||||
|
||||
# Introducing XRP Ledger version 1.10.1
|
||||
|
||||
Version 1.10.1 of `rippled`, the reference server implementation of the XRP Ledger protocol, is now available. This release restores packages for Ubuntu 18.04.
|
||||
|
||||
13
SECURITY.md
13
SECURITY.md
@@ -61,12 +61,13 @@ For these complaints or reports, please [contact our support team](mailto:bugs@x
|
||||
|
||||
### The following type of security problems are excluded
|
||||
|
||||
1. **In scope**. Only bugs in software under the scope of the program qualify. Currently, that means `xahaud` and `xahau-lib`.
|
||||
2. **Relevant**. A security issue, posing a danger to user funds, privacy or the operation of the Xahau Ledger.
|
||||
3. **Original and previously unknown**. Bugs that are already known and discussed in public do not qualify. Previously reported bugs, even if publicly unknown, are not eligible.
|
||||
4. **Specific**. We welcome general security advice or recommendations, but we cannot pay bounties for that.
|
||||
5. **Fixable**. There has to be something we can do to permanently fix the problem. Note that bugs in other people’s software may still qualify in some cases. For example, if you find a bug in a library that we use which can compromise the security of software that is in scope and we can get it fixed, you may qualify for a bounty.
|
||||
6. **Unused**. If you use the exploit to attack the Xahau Ledger, you do not qualify for a bounty. If you report a vulnerability used in an ongoing or past attack and there is specific, concrete evidence that suggests you are the attacker we reserve the right not to pay a bounty.
|
||||
- (D)DOS attacks
|
||||
- Error messages or error pages without sensitive data
|
||||
- Tests & sample data as publicly available in our repositories at Github
|
||||
- Common issues like browser header warnings or DNS configuration, identified by vulnerability scans
|
||||
- Vulnerability scan reports for software we publicly use
|
||||
- Security issues related to outdated OS's, browsers or plugins
|
||||
- Reports for security problems that we have been notified of before
|
||||
|
||||
Please note: Reports that are lacking any proof (such as screenshots or other data), detailed information or details on how to reproduce any unexpected result will be investigated but will not be eligible for any reward.
|
||||
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
#!/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
|
||||
#!/bin/bash
|
||||
|
||||
echo "START INSIDE CONTAINER - CORE"
|
||||
|
||||
@@ -12,13 +7,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,52 +20,24 @@ 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" Builds/CMake/deps/Rocksdb.cmake &&
|
||||
mv Builds/CMake/deps/WasmEdge.cmake Builds/CMake/deps/WasmEdge.old &&
|
||||
echo "find_package(LLVM REQUIRED CONFIG)
|
||||
message(STATUS \"Found LLVM \${LLVM_PACKAGE_VERSION}\")
|
||||
message(STATUS \"Found LLVM ${LLVM_PACKAGE_VERSION}\")
|
||||
message(STATUS \"Using LLVMConfig.cmake in: \${LLVM_DIR}\")
|
||||
add_library (wasmedge STATIC IMPORTED GLOBAL)
|
||||
set_target_properties(wasmedge PROPERTIES IMPORTED_LOCATION \${WasmEdge_LIB})
|
||||
target_link_libraries (ripple_libs INTERFACE wasmedge)
|
||||
add_library (wasmedge::wasmedge ALIAS wasmedge)
|
||||
add_library (NIH::WasmEdge ALIAS wasmedge)
|
||||
message(\"WasmEdge DONE\")
|
||||
" > Builds/CMake/deps/WasmEdge.cmake &&
|
||||
|
||||
export LDFLAGS="-static-libstdc++"
|
||||
|
||||
git config --global --add safe.directory /io &&
|
||||
git checkout src/ripple/protocol/impl/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/ripple/protocol/impl/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/ripple/protocol/impl/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 &&
|
||||
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 &&
|
||||
@@ -102,8 +62,8 @@ fi
|
||||
cd ..;
|
||||
|
||||
mv src/ripple/net/impl/RegisterSSLCerts.cpp.old src/ripple/net/impl/RegisterSSLCerts.cpp;
|
||||
mv Builds/CMake/deps/Rocksdb.cmake.old Builds/CMake/deps/Rocksdb.cmake;
|
||||
mv Builds/CMake/deps/WasmEdge.old Builds/CMake/deps/WasmEdge.cmake;
|
||||
rm src/certs/certbundle.h;
|
||||
git checkout src/ripple/protocol/impl/BuildInfo.cpp;
|
||||
|
||||
|
||||
echo "END INSIDE CONTAINER - CORE"
|
||||
|
||||
100
build-full.sh
Normal file → Executable file
100
build-full.sh
Normal file → Executable file
@@ -1,9 +1,4 @@
|
||||
#!/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 -e
|
||||
#!/bin/bash
|
||||
|
||||
echo "START INSIDE CONTAINER - FULL"
|
||||
|
||||
@@ -14,10 +9,8 @@ echo "-- GITHUB_RUN_NUMBER: $4"
|
||||
|
||||
umask 0000;
|
||||
|
||||
####
|
||||
|
||||
cd /io;
|
||||
mkdir -p src/certs;
|
||||
mkdir src/certs;
|
||||
curl --silent -k https://raw.githubusercontent.com/RichardAH/rippled-release-builder/main/ca-bundle/certbundle.h -o src/certs/certbundle.h;
|
||||
if [ "`grep certbundle.h src/ripple/net/impl/RegisterSSLCerts.cpp | wc -l`" -eq "0" ]
|
||||
then
|
||||
@@ -64,15 +57,92 @@ then
|
||||
#endif/g" src/ripple/net/impl/RegisterSSLCerts.cpp &&
|
||||
sed -i "s/#include <ripple\/net\/RegisterSSLCerts.h>/\0\n#include <certs\/certbundle.h>/g" src/ripple/net/impl/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='ccache gcc' &&
|
||||
export CXX='ccache g++' &&
|
||||
mkdir .nih_c;
|
||||
mkdir .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.23.1 --" &&
|
||||
pwd &&
|
||||
( wget -nc -q https://github.com/Kitware/CMake/releases/download/v3.23.1/cmake-3.23.1-linux-x86_64.tar.gz; echo "" ) &&
|
||||
tar -xzf cmake-3.23.1-linux-x86_64.tar.gz -C /hbb/ &&
|
||||
echo "-- Install Boost 1.75.0 --" &&
|
||||
pwd &&
|
||||
( wget -nc -q https://boostorg.jfrog.io/artifactory/main/release/1.75.0/source/boost_1_75_0.tar.gz; echo "" ) &&
|
||||
tar -xzf boost_1_75_0.tar.gz &&
|
||||
cd boost_1_75_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 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 build; echo "" ) &&
|
||||
cd build &&
|
||||
export BOOST_ROOT="/usr/local/src/boost_1_75_0" &&
|
||||
export Boost_LIBRARY_DIRS="/usr/local/lib" &&
|
||||
export BOOST_INCLUDEDIR="/usr/local/src/boost_1_75_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 Builds/CMake/deps/Rocksdb.cmake Builds/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:
|
||||
#
|
||||
@@ -294,12 +295,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]
|
||||
@@ -350,7 +351,7 @@
|
||||
#
|
||||
# Examples:
|
||||
# { "command" : "server_info" }
|
||||
# { "command" : "log_level", "partition" : "xahaudcalc", "severity" : "trace" }
|
||||
# { "command" : "log_level", "partition" : "ripplecalc", "severity" : "trace" }
|
||||
#
|
||||
#
|
||||
#
|
||||
@@ -379,15 +380,16 @@
|
||||
#-----------------
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
#
|
||||
#
|
||||
# [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.
|
||||
#
|
||||
@@ -396,23 +398,24 @@
|
||||
# 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
|
||||
@@ -462,7 +465,7 @@
|
||||
#
|
||||
# IP address or domain of NTP servers to use for time synchronization.
|
||||
#
|
||||
# These NTP servers are suitable for xahaud servers located in the United
|
||||
# These NTP servers are suitable for rippled servers located in the United
|
||||
# States:
|
||||
# time.windows.com
|
||||
# time.apple.com
|
||||
@@ -563,7 +566,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>
|
||||
@@ -700,7 +703,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.
|
||||
@@ -735,18 +738,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
|
||||
#
|
||||
#
|
||||
#
|
||||
@@ -829,7 +833,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.
|
||||
@@ -840,9 +844,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]
|
||||
#
|
||||
@@ -879,15 +884,15 @@
|
||||
#
|
||||
#------------
|
||||
#
|
||||
# xahaud has an optional operating mode called Reporting Mode. In Reporting
|
||||
# Mode, xahaud does not connect to the peer to peer network. Instead, xahaud
|
||||
# will continuously extract data from one or more xahaud servers that are
|
||||
# rippled has an optional operating mode called Reporting Mode. In Reporting
|
||||
# Mode, rippled does not connect to the peer to peer network. Instead, rippled
|
||||
# will continuously extract data from one or more rippled servers that are
|
||||
# connected to the peer to peer network (referred to as an ETL source).
|
||||
# Reporting mode servers will forward RPC requests that require access to the
|
||||
# peer to peer network (submit, fee, etc) to an ETL source.
|
||||
#
|
||||
# [reporting] Settings for Reporting Mode. If and only if this section is
|
||||
# present, xahaud will start in reporting mode. This section
|
||||
# present, rippled will start in reporting mode. This section
|
||||
# contains a list of ETL source names, and key-value pairs. The
|
||||
# ETL source names each correspond to a configuration file
|
||||
# section; the names must match exactly. The key-value pairs are
|
||||
@@ -992,16 +997,16 @@
|
||||
#
|
||||
#------------
|
||||
#
|
||||
# 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. In Reporting Mode, xahauad
|
||||
# make up the current and historical ledgers. In Reporting Mode, rippled
|
||||
# uses a Postgres database instead of SQLite.
|
||||
#
|
||||
# The simplest way to work with Postgres is to install it locally.
|
||||
# When it is running, execute the initdb.sh script in the current
|
||||
# directory as: sudo -u postgres ./initdb.sh
|
||||
# This will create the xahaud user and an empty database of the same name.
|
||||
# This will create the rippled user and an empty database of the same name.
|
||||
#
|
||||
# The size of the NodeDB grows in proportion to the amount of new data and the
|
||||
# amount of historical data (a configurable setting) so the performance of the
|
||||
@@ -1009,7 +1014,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)
|
||||
#
|
||||
@@ -1020,18 +1025,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
|
||||
#
|
||||
@@ -1051,23 +1056,10 @@
|
||||
# Cassandra is an alternative backend to be used only with Reporting Mode.
|
||||
# See the Reporting Mode section for more details about Reporting Mode.
|
||||
#
|
||||
# type = RWDB
|
||||
#
|
||||
# RWDB is a high-performance memory store written by XRPL-Labs and optimized
|
||||
# for xahaud. RWDB is NOT persistent and the data will be lost on restart.
|
||||
# RWDB is recommended for Validator and Peer nodes that are not required to
|
||||
# store history.
|
||||
#
|
||||
# Required keys for NuDB and RocksDB:
|
||||
#
|
||||
# path Location to store the database
|
||||
#
|
||||
# Required keys for RWDB:
|
||||
#
|
||||
# online_delete Required. RWDB stores data in memory and will
|
||||
# grow unbounded without online_delete. See the
|
||||
# online_delete section below.
|
||||
#
|
||||
# Required keys for Cassandra:
|
||||
#
|
||||
# contact_points IP of a node in the Cassandra cluster
|
||||
@@ -1107,19 +1099,9 @@
|
||||
# if sufficient IOPS capacity is available.
|
||||
# Default 0.
|
||||
#
|
||||
# online_delete for RWDB, NuDB and RocksDB:
|
||||
# Optional keys for NuDB or RocksDB:
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# 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
|
||||
# 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.
|
||||
# If a [shard_db] section is defined, and this
|
||||
@@ -1127,40 +1109,11 @@
|
||||
# it must be defined with the same value in both
|
||||
# sections.
|
||||
#
|
||||
# Optional keys for NuDB only:
|
||||
# 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.
|
||||
#
|
||||
# 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:
|
||||
#
|
||||
@@ -1194,7 +1147,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
|
||||
@@ -1233,8 +1186,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.
|
||||
#
|
||||
# [shard_db] Settings for the Shard Database (optional)
|
||||
#
|
||||
@@ -1310,7 +1263,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.
|
||||
@@ -1320,7 +1273,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
|
||||
@@ -1334,7 +1287,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.
|
||||
@@ -1346,9 +1299,9 @@
|
||||
# conninfo Info for connecting to Postgres. Format is
|
||||
# postgres://[username]:[password]@[ip]/[database].
|
||||
# The database and user must already exist. If this
|
||||
# section is missing and xahaud is running in
|
||||
# Reporting Mode, xahaud will connect as the
|
||||
# user running xahaud to a database with the
|
||||
# section is missing and rippled is running in
|
||||
# Reporting Mode, rippled will connect as the
|
||||
# user running rippled to a database with the
|
||||
# same name. On Linux and Mac OS X, the connection
|
||||
# will take place using the server's UNIX domain
|
||||
# socket. On Windows, through the localhost IP
|
||||
@@ -1357,7 +1310,7 @@
|
||||
# use_tx_tables Valid values: 1, 0
|
||||
# The default is 1 (true). Determines whether to use
|
||||
# the SQLite transaction database. If set to 0,
|
||||
# xahaud will not write to the transaction database,
|
||||
# rippled will not write to the transaction database,
|
||||
# and will reject tx, account_tx and tx_history RPCs.
|
||||
# In Reporting Mode, this setting is ignored.
|
||||
#
|
||||
@@ -1385,7 +1338,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.
|
||||
#
|
||||
#
|
||||
#
|
||||
@@ -1402,7 +1355,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:
|
||||
@@ -1411,7 +1364,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
|
||||
#
|
||||
@@ -1421,7 +1374,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.
|
||||
@@ -1448,7 +1401,7 @@
|
||||
#
|
||||
# Example:
|
||||
# [perf]
|
||||
# perf_log=/var/log/xahaud/perf.log
|
||||
# perf_log=/var/log/rippled/perf.log
|
||||
# log_interval=2
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
@@ -1457,8 +1410,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.
|
||||
#
|
||||
@@ -1470,9 +1423,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:
|
||||
@@ -1481,26 +1434,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
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
@@ -1538,7 +1491,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"
|
||||
#
|
||||
@@ -1617,7 +1570,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
|
||||
@@ -1627,7 +1580,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"
|
||||
@@ -1655,8 +1608,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
|
||||
@@ -1667,20 +1620,20 @@ 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
|
||||
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
|
||||
@@ -1691,15 +1644,15 @@ 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
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# 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
|
||||
@@ -1712,16 +1665,16 @@ 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
|
||||
|
||||
# This is the persistent datastore for shards. It is important for the health
|
||||
# of the Xahau Network that xahaud operators shard as much as practical.
|
||||
# of the ripple network that rippled operators shard as much as practical.
|
||||
# NuDB requires SSD storage. Helpful information can be found at
|
||||
# https://xrpl.org/history-sharding.html
|
||||
#[shard_db]
|
||||
#path=/opt/xahaud/db/shards/nudb
|
||||
#path=/var/lib/rippled/db/shards/nudb
|
||||
#max_historical_shards=50
|
||||
#
|
||||
# This optional section can be configured with a list
|
||||
@@ -1732,7 +1685,7 @@ advisory_delete=0
|
||||
#/path/2
|
||||
|
||||
[database_path]
|
||||
/opt/xahaud/db
|
||||
/var/lib/rippled/db
|
||||
|
||||
|
||||
# To use Postgres, uncomment this section and fill in the appropriate connection
|
||||
@@ -1747,7 +1700,7 @@ advisory_delete=0
|
||||
# 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
|
||||
|
||||
[sntp_servers]
|
||||
time.windows.com
|
||||
@@ -1755,21 +1708,17 @@ time.apple.com
|
||||
time.nist.gov
|
||||
pool.ntp.org
|
||||
|
||||
# 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,7 +9,7 @@
|
||||
#
|
||||
# 2. Peer Protocol
|
||||
#
|
||||
# 3. XRPL Protocol
|
||||
# 3. Ripple Protocol
|
||||
#
|
||||
# 4. HTTPS Client
|
||||
#
|
||||
@@ -29,16 +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:
|
||||
#
|
||||
# This file should be named xahaud.cfg. This file is UTF-8 with DOS, UNIX,
|
||||
# https://xrpl.org/commandline-usage.html#generic-options
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
@@ -87,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.
|
||||
@@ -101,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.
|
||||
@@ -132,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.
|
||||
#
|
||||
@@ -173,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>
|
||||
@@ -192,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.
|
||||
#
|
||||
@@ -225,7 +227,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.
|
||||
#
|
||||
@@ -245,11 +247,11 @@
|
||||
# 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.
|
||||
#
|
||||
# The same IP address cannot be used in both "admin" and "secure_gateway"
|
||||
# lists for the same port. In this case, xahaud will abort with an error
|
||||
# lists for the same port. In this case, rippled will abort with an error
|
||||
# message to the console shortly after startup
|
||||
#
|
||||
# ssl_key = <filename>
|
||||
@@ -259,7 +261,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:
|
||||
#
|
||||
@@ -282,12 +284,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]
|
||||
@@ -338,7 +340,7 @@
|
||||
#
|
||||
# Examples:
|
||||
# { "command" : "server_info" }
|
||||
# { "command" : "log_level", "partition" : "xahaucalc", "severity" : "trace" }
|
||||
# { "command" : "log_level", "partition" : "ripplecalc", "severity" : "trace" }
|
||||
#
|
||||
#
|
||||
#
|
||||
@@ -367,8 +369,8 @@
|
||||
#-----------------
|
||||
#
|
||||
# These settings control security and access attributes of the Peer to Peer
|
||||
# server section of the xahaud process. Peer Protocol implements the
|
||||
# XRPL Payment protocol. It is over peer connections that transactions
|
||||
# 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.
|
||||
#
|
||||
@@ -376,7 +378,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.
|
||||
#
|
||||
@@ -385,23 +387,24 @@
|
||||
# does not generally matter.
|
||||
#
|
||||
# The default list of entries is:
|
||||
# - bacab.alloy.ee 21337
|
||||
# - hubs.xahau.as16089.net 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
|
||||
@@ -451,7 +454,7 @@
|
||||
#
|
||||
# IP address or domain of NTP servers to use for time synchronization.
|
||||
#
|
||||
# These NTP servers are suitable for xahaud servers located in the United
|
||||
# These NTP servers are suitable for rippled servers located in the United
|
||||
# States:
|
||||
# time.windows.com
|
||||
# time.apple.com
|
||||
@@ -552,7 +555,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>
|
||||
@@ -679,7 +682,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.
|
||||
@@ -714,21 +717,22 @@
|
||||
#
|
||||
# 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
|
||||
#
|
||||
#
|
||||
#
|
||||
# [path_search]
|
||||
# When searching for paths, the default search aggressiveness. This can take
|
||||
# exponentially more resources as the size is increased.
|
||||
@@ -791,7 +795,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.
|
||||
@@ -802,9 +806,9 @@
|
||||
#
|
||||
#----------------
|
||||
#
|
||||
# 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 XRPL Payment
|
||||
# fetch information such as mapping an email address to a Ripple Payment
|
||||
# Network address.
|
||||
#
|
||||
# [ssl_verify]
|
||||
@@ -842,15 +846,15 @@
|
||||
#
|
||||
#------------
|
||||
#
|
||||
# xahaud has an optional operating mode called Reporting Mode. In Reporting
|
||||
# Mode, xahaud does not connect to the peer to peer network. Instead, xahaud
|
||||
# will continuously extract data from one or more xahaud servers that are
|
||||
# rippled has an optional operating mode called Reporting Mode. In Reporting
|
||||
# Mode, rippled does not connect to the peer to peer network. Instead, rippled
|
||||
# will continuously extract data from one or more rippled servers that are
|
||||
# connected to the peer to peer network (referred to as an ETL source).
|
||||
# Reporting mode servers will forward RPC requests that require access to the
|
||||
# peer to peer network (submit, fee, etc) to an ETL source.
|
||||
#
|
||||
# [reporting] Settings for Reporting Mode. If and only if this section is
|
||||
# present, xahaud will start in reporting mode. This section
|
||||
# present, rippled will start in reporting mode. This section
|
||||
# contains a list of ETL source names, and key-value pairs. The
|
||||
# ETL source names each correspond to a configuration file
|
||||
# section; the names must match exactly. The key-value pairs are
|
||||
@@ -955,16 +959,16 @@
|
||||
#
|
||||
#------------
|
||||
#
|
||||
# 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. In Reporting Mode, xahaud
|
||||
# make up the current and historical ledgers. In Reporting Mode, rippled
|
||||
# uses a Postgres database instead of SQLite.
|
||||
#
|
||||
# The simplest way to work with Postgres is to install it locally.
|
||||
# When it is running, execute the initdb.sh script in the current
|
||||
# directory as: sudo -u postgres ./initdb.sh
|
||||
# This will create the xahaud user and an empty database of the same name.
|
||||
# This will create the rippled user and an empty database of the same name.
|
||||
#
|
||||
# The size of the NodeDB grows in proportion to the amount of new data and the
|
||||
# amount of historical data (a configurable setting) so the performance of the
|
||||
@@ -972,7 +976,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)
|
||||
#
|
||||
@@ -990,11 +994,11 @@
|
||||
# type = NuDB
|
||||
#
|
||||
# NuDB is a high-performance database written by Ripple Labs and optimized
|
||||
# for 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
|
||||
#
|
||||
@@ -1099,14 +1103,14 @@
|
||||
#
|
||||
# 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. By default, if it
|
||||
# is not the online delete process aborts and
|
||||
# tries again later. If 'recovery_wait_seconds'
|
||||
# is set and xahaud is out of sync, but likely to
|
||||
# is set and rippled is out of sync, but likely to
|
||||
# recover quickly, then online delete will wait
|
||||
# this number of seconds for xahaud to get back
|
||||
# this number of seconds for rippled to get back
|
||||
# into sync before it aborts.
|
||||
# Set this value if the node is otherwise staying
|
||||
# in sync, or recovering quickly, but the online
|
||||
@@ -1142,8 +1146,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.
|
||||
#
|
||||
# [shard_db] Settings for the Shard Database (optional)
|
||||
#
|
||||
@@ -1219,7 +1223,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.
|
||||
@@ -1229,7 +1233,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
|
||||
@@ -1243,7 +1247,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.
|
||||
@@ -1255,9 +1259,9 @@
|
||||
# conninfo Info for connecting to Postgres. Format is
|
||||
# postgres://[username]:[password]@[ip]/[database].
|
||||
# The database and user must already exist. If this
|
||||
# section is missing and xahaud is running in
|
||||
# Reporting Mode, xahaud will connect as the
|
||||
# user running xahaud to a database with the
|
||||
# section is missing and rippled is running in
|
||||
# Reporting Mode, rippled will connect as the
|
||||
# user running rippled to a database with the
|
||||
# same name. On Linux and Mac OS X, the connection
|
||||
# will take place using the server's UNIX domain
|
||||
# socket. On Windows, through the localhost IP
|
||||
@@ -1266,7 +1270,7 @@
|
||||
# use_tx_tables Valid values: 1, 0
|
||||
# The default is 1 (true). Determines whether to use
|
||||
# the SQLite transaction database. If set to 0,
|
||||
# xahaud will not write to the transaction database,
|
||||
# rippled will not write to the transaction database,
|
||||
# and will reject tx, account_tx and tx_history RPCs.
|
||||
# In Reporting Mode, this setting is ignored.
|
||||
#
|
||||
@@ -1294,7 +1298,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.
|
||||
#
|
||||
#
|
||||
#
|
||||
@@ -1311,7 +1315,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:
|
||||
@@ -1320,7 +1324,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
|
||||
#
|
||||
@@ -1330,7 +1334,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.
|
||||
@@ -1357,7 +1361,7 @@
|
||||
#
|
||||
# Example:
|
||||
# [perf]
|
||||
# perf_log=/var/log/xahaud/perf.log
|
||||
# perf_log=/var/log/rippled/perf.log
|
||||
# log_interval=2
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
@@ -1366,8 +1370,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.
|
||||
#
|
||||
@@ -1379,9 +1383,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:
|
||||
@@ -1390,26 +1394,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
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
@@ -1447,7 +1451,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"
|
||||
#
|
||||
@@ -1526,7 +1530,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
|
||||
@@ -1536,7 +1540,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"
|
||||
@@ -1564,8 +1568,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
|
||||
@@ -1583,7 +1587,7 @@ admin = 127.0.0.1
|
||||
protocol = http
|
||||
|
||||
[port_peer]
|
||||
port = 21337
|
||||
port = 51235
|
||||
ip = 0.0.0.0
|
||||
# alternatively, to accept connections on IPv4 + IPv6, use:
|
||||
#ip = ::
|
||||
@@ -1607,9 +1611,9 @@ protocol = ws
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# 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
|
||||
@@ -1622,16 +1626,16 @@ protocol = ws
|
||||
# deletion.
|
||||
[node_db]
|
||||
type=NuDB
|
||||
path=/opt/xahaud-reporting/db/nudb
|
||||
path=/var/lib/rippled-reporting/db/nudb
|
||||
# online_delete=512 #
|
||||
advisory_delete=0
|
||||
|
||||
# This is the persistent datastore for shards. It is important for the health
|
||||
# of the Xahau Network that xahaud operators shard as much as practical.
|
||||
# of the ripple network that rippled operators shard as much as practical.
|
||||
# NuDB requires SSD storage. Helpful information can be found at
|
||||
# https://xrpl.org/history-sharding.html
|
||||
#[shard_db]
|
||||
#path=/opt/xahaud-reporting/db/shards/nudb
|
||||
#path=/var/lib/rippled/db/shards/nudb
|
||||
#max_historical_shards=50
|
||||
#
|
||||
# This optional section can be configured with a list
|
||||
@@ -1642,7 +1646,7 @@ advisory_delete=0
|
||||
#/path/2
|
||||
|
||||
[database_path]
|
||||
/opt/xahaud-reporting/db
|
||||
/var/lib/rippled-reporting/db
|
||||
|
||||
# To use Postgres, uncomment this section and fill in the appropriate connection
|
||||
# info. Postgres can only be used in Reporting Mode.
|
||||
@@ -1656,7 +1660,7 @@ advisory_delete=0
|
||||
# This needs to be an absolute directory reference, not a relative one.
|
||||
# Modify this value as required.
|
||||
[debug_logfile]
|
||||
/var/log/xahaud-reporting/debug.log
|
||||
/var/log/rippled-reporting/debug.log
|
||||
|
||||
[sntp_servers]
|
||||
time.windows.com
|
||||
@@ -1664,20 +1668,17 @@ time.apple.com
|
||||
time.nist.gov
|
||||
pool.ntp.org
|
||||
|
||||
# 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]
|
||||
/opt/xahaud-reporting/etc/validators.txt
|
||||
/opt/rippled-reporting/etc/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
|
||||
@@ -1698,5 +1699,5 @@ etl_source
|
||||
|
||||
[etl_source]
|
||||
source_grpc_port=50051
|
||||
source_ws_port=6008
|
||||
source_ws_port=6005
|
||||
source_ip=127.0.0.1
|
||||
19
cfg/xahaud-standalone.cfg → cfg/rippled-standalone.cfg
Normal file → Executable file
19
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
|
||||
@@ -145,12 +144,4 @@ D686F2538F410C9D0D856788E98E3579595DAF7B38D38887F81ECAC934B06040 HooksUpdate1
|
||||
86E83A7D2ECE3AD5FA87AB2195AE015C950469ABF0B72EAACED318F74886AE90 CryptoConditionsSuite
|
||||
3C43D9A973AA4443EF3FC38E42DD306160FBFFDAB901CD8BAA15D09F2597EB87 NonFungibleTokensV1
|
||||
0285B7E5E08E1A8E4C15636F0591D87F73CB6A7B6452A932AD72BBC8E5D1CBE3 fixNFTokenDirV1
|
||||
36799EA497B1369B170805C078AEFE6188345F9B3E324C21E9CA3FF574E3C3D6 fixNFTokenNegOffer
|
||||
4C499D17719BB365B69010A436B64FD1A82AAB199FC1CEB06962EBD01059FB09 fixXahauV1
|
||||
215181D23BF5C173314B5FDB9C872C92DE6CC918483727DE037C0C13E7E6EE9D fixXahauV2
|
||||
0D8BF22FF7570D58598D1EF19EBB6E142AD46E59A223FD3816262FBB69345BEA Remit
|
||||
7CA0426E7F411D39BB014E57CD9E08F61DE1750F0D41FCD428D9FB80BB7596B0 ZeroB2M
|
||||
4B8466415FAB32FFA89D9DCBE166A42340115771DF611A7160F8D7439C87ECD8 fixNSDelete
|
||||
EDB4EE4C524E16BDD91D9A529332DED08DCAAA51CC6DC897ACFA1A0ED131C5B6 fix240819
|
||||
8063140E9260799D6716756B891CEC3E7006C4E4F277AB84670663A88F94B9C4 fixPageCap
|
||||
88693F108C3CD8A967F3F4253A32DEF5E35F9406ACD2A11B88B11D90865763A9 fix240911
|
||||
36799EA497B1369B170805C078AEFE6188345F9B3E324C21E9CA3FF574E3C3D6 fixNFTokenNegOffer
|
||||
@@ -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
|
||||
|
||||
122
conanfile.py
122
conanfile.py
@@ -1,4 +1,4 @@
|
||||
from conan import ConanFile
|
||||
from conans import ConanFile
|
||||
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
|
||||
import re
|
||||
|
||||
@@ -21,20 +21,22 @@ class Xrpl(ConanFile):
|
||||
'static': [True, False],
|
||||
'tests': [True, False],
|
||||
'unity': [True, False],
|
||||
'with_wasmedge': [True, False],
|
||||
'tool_requires_b2': [True, False],
|
||||
}
|
||||
|
||||
requires = [
|
||||
'date/3.0.3',
|
||||
'boost/1.82.0',
|
||||
'date/3.0.1',
|
||||
'libarchive/3.6.0',
|
||||
'lz4/1.9.4',
|
||||
'lz4/1.9.3',
|
||||
'grpc/1.50.1',
|
||||
'nudb/2.0.8',
|
||||
'openssl/3.6.0',
|
||||
'protobuf/3.21.12',
|
||||
'soci/4.0.3@xahaud/stable',
|
||||
'zlib/1.3.1',
|
||||
'openssl/1.1.1u',
|
||||
'protobuf/3.21.9',
|
||||
'snappy/1.1.10',
|
||||
'soci/4.0.3',
|
||||
'sqlite3/3.42.0',
|
||||
'zlib/1.2.13',
|
||||
'wasmedge/0.11.2',
|
||||
]
|
||||
|
||||
default_options = {
|
||||
@@ -48,44 +50,42 @@ class Xrpl(ConanFile):
|
||||
'static': True,
|
||||
'tests': True,
|
||||
'unity': False,
|
||||
'with_wasmedge': True,
|
||||
'tool_requires_b2': False,
|
||||
|
||||
'cassandra-cpp-driver/*:shared': False,
|
||||
'date/*:header_only': False,
|
||||
'grpc/*:shared': False,
|
||||
'grpc/*:secure': True,
|
||||
'libarchive/*:shared': False,
|
||||
'libarchive/*:with_acl': False,
|
||||
'libarchive/*:with_bzip2': False,
|
||||
'libarchive/*:with_cng': False,
|
||||
'libarchive/*:with_expat': False,
|
||||
'libarchive/*:with_iconv': False,
|
||||
'libarchive/*:with_libxml2': False,
|
||||
'libarchive/*:with_lz4': True,
|
||||
'libarchive/*:with_lzma': False,
|
||||
'libarchive/*:with_lzo': False,
|
||||
'libarchive/*:with_nettle': False,
|
||||
'libarchive/*:with_openssl': False,
|
||||
'libarchive/*:with_pcreposix': False,
|
||||
'libarchive/*:with_xattr': False,
|
||||
'libarchive/*:with_zlib': False,
|
||||
'libpq/*:shared': False,
|
||||
'lz4/*:shared': False,
|
||||
'openssl/*:shared': False,
|
||||
'protobuf/*:shared': False,
|
||||
'protobuf/*:with_zlib': True,
|
||||
'rocksdb/*:enable_sse': False,
|
||||
'rocksdb/*:lite': False,
|
||||
'rocksdb/*:shared': False,
|
||||
'rocksdb/*:use_rtti': True,
|
||||
'rocksdb/*:with_jemalloc': False,
|
||||
'rocksdb/*:with_lz4': True,
|
||||
'rocksdb/*:with_snappy': True,
|
||||
'snappy/*:shared': False,
|
||||
'soci/*:shared': False,
|
||||
'soci/*:with_sqlite3': True,
|
||||
'soci/*:with_boost': True,
|
||||
'cassandra-cpp-driver:shared': False,
|
||||
'date:header_only': True,
|
||||
'grpc:shared': False,
|
||||
'grpc:secure': True,
|
||||
'libarchive:shared': False,
|
||||
'libarchive:with_acl': False,
|
||||
'libarchive:with_bzip2': False,
|
||||
'libarchive:with_cng': False,
|
||||
'libarchive:with_expat': False,
|
||||
'libarchive:with_iconv': False,
|
||||
'libarchive:with_libxml2': False,
|
||||
'libarchive:with_lz4': True,
|
||||
'libarchive:with_lzma': False,
|
||||
'libarchive:with_lzo': False,
|
||||
'libarchive:with_nettle': False,
|
||||
'libarchive:with_openssl': False,
|
||||
'libarchive:with_pcreposix': False,
|
||||
'libarchive:with_xattr': False,
|
||||
'libarchive:with_zlib': False,
|
||||
'libpq:shared': False,
|
||||
'lz4:shared': False,
|
||||
'openssl:shared': False,
|
||||
'protobuf:shared': False,
|
||||
'protobuf:with_zlib': True,
|
||||
'rocksdb:enable_sse': False,
|
||||
'rocksdb:lite': False,
|
||||
'rocksdb:shared': False,
|
||||
'rocksdb:use_rtti': True,
|
||||
'rocksdb:with_jemalloc': False,
|
||||
'rocksdb:with_lz4': True,
|
||||
'rocksdb:with_snappy': True,
|
||||
'snappy:shared': False,
|
||||
'soci:shared': False,
|
||||
'soci:with_sqlite3': True,
|
||||
'soci:with_boost': True,
|
||||
}
|
||||
|
||||
def set_version(self):
|
||||
@@ -96,28 +96,11 @@ class Xrpl(ConanFile):
|
||||
match = next(m for m in matches if m)
|
||||
self.version = match.group(1)
|
||||
|
||||
def build_requirements(self):
|
||||
# These provide build tools (protoc, grpc plugins) that run during build
|
||||
self.tool_requires('protobuf/3.21.12')
|
||||
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 sqlite3 version to avoid conflicts with soci
|
||||
self.requires('sqlite3/3.42.0', override=True)
|
||||
# Force our custom snappy build for all dependencies
|
||||
self.requires('snappy/1.1.10@xahaud/stable', override=True)
|
||||
# Force boost version for all dependencies to avoid conflicts
|
||||
self.requires('boost/1.86.0', override=True)
|
||||
|
||||
if self.options.with_wasmedge:
|
||||
self.requires('wasmedge/0.11.2@xahaud/stable')
|
||||
if self.options.jemalloc:
|
||||
self.requires('jemalloc/5.2.1')
|
||||
if self.options.reporting:
|
||||
@@ -126,9 +109,7 @@ class Xrpl(ConanFile):
|
||||
if self.options.rocksdb:
|
||||
self.requires('rocksdb/6.27.3')
|
||||
|
||||
exports_sources = (
|
||||
'CMakeLists.txt', 'Builds/*', 'bin/getRippledInfo', 'src/*', 'cfg/*'
|
||||
)
|
||||
exports_sources = 'CMakeLists.txt', 'Builds/CMake/*', 'src/*', 'cfg/*'
|
||||
|
||||
def layout(self):
|
||||
cmake_layout(self)
|
||||
@@ -162,11 +143,8 @@ class Xrpl(ConanFile):
|
||||
cmake.install()
|
||||
|
||||
def package_info(self):
|
||||
libxrpl = self.cpp_info.components['libxrpl']
|
||||
libxrpl.libs = [
|
||||
self.cpp_info.libs = [
|
||||
'libxrpl_core.a',
|
||||
'libed25519.a',
|
||||
'libed25519-donna.a',
|
||||
'libsecp256k1.a',
|
||||
]
|
||||
libxrpl.includedirs = ['include']
|
||||
libxrpl.requires = ['boost::boost']
|
||||
|
||||
11
docker-unit-tests.sh
Executable file → Normal file
11
docker-unit-tests.sh
Executable file → Normal file
@@ -1,11 +1,4 @@
|
||||
#!/bin/bash -x
|
||||
#!/bin/bash
|
||||
|
||||
BUILD_CORES=$(echo "scale=0 ; `nproc` / 1.337" | bc)
|
||||
docker run --rm -i -v $(pwd):/io ubuntu sh -c '/io/release-build/xahaud -u'
|
||||
|
||||
if [[ "$GITHUB_REPOSITORY" == "" ]]; then
|
||||
#Default
|
||||
BUILD_CORES=8
|
||||
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'
|
||||
|
||||
84
docs/build/environment.md
vendored
84
docs/build/environment.md
vendored
@@ -1,84 +0,0 @@
|
||||
Our [build instructions][BUILD.md] assume you have a C++ development
|
||||
environment complete with Git, Python, Conan, CMake, and a C++ compiler.
|
||||
This document exists to help readers set one up on any of the Big Three
|
||||
platforms: Linux, macOS, or Windows.
|
||||
|
||||
[BUILD.md]: ../../BUILD.md
|
||||
|
||||
|
||||
## Linux
|
||||
|
||||
Package ecosystems vary across Linux distributions,
|
||||
so there is no one set of instructions that will work for every Linux user.
|
||||
These instructions are written for Ubuntu 22.04.
|
||||
They are largely copied from the [script][1] used to configure our Docker
|
||||
container for continuous integration.
|
||||
That script handles many more responsibilities.
|
||||
These instructions are just the bare minimum to build one configuration of
|
||||
rippled.
|
||||
You can check that codebase for other Linux distributions and versions.
|
||||
If you cannot find yours there,
|
||||
then we hope that these instructions can at least guide you in the right
|
||||
direction.
|
||||
|
||||
```
|
||||
apt update
|
||||
apt install --yes curl git libssl-dev python3.10-dev python3-pip make g++-11
|
||||
|
||||
curl --location --remote-name \
|
||||
"https://github.com/Kitware/CMake/releases/download/v3.25.1/cmake-3.25.1.tar.gz"
|
||||
tar -xzf cmake-3.25.1.tar.gz
|
||||
rm cmake-3.25.1.tar.gz
|
||||
cd cmake-3.25.1
|
||||
./bootstrap --parallel=$(nproc)
|
||||
make --jobs $(nproc)
|
||||
make install
|
||||
cd ..
|
||||
|
||||
pip3 install 'conan<2'
|
||||
```
|
||||
|
||||
[1]: https://github.com/thejohnfreeman/rippled-docker/blob/master/ubuntu-22.04/install.sh
|
||||
|
||||
|
||||
## macOS
|
||||
|
||||
Open a Terminal and enter the below command to bring up a dialog to install
|
||||
the command line developer tools.
|
||||
Once it is finished, this command should return a version greater than the
|
||||
minimum required (see [BUILD.md][]).
|
||||
|
||||
```
|
||||
clang --version
|
||||
```
|
||||
|
||||
The command line developer tools should include Git too:
|
||||
|
||||
```
|
||||
git --version
|
||||
```
|
||||
|
||||
Install [Homebrew][],
|
||||
use it to install [pyenv][],
|
||||
use it to install Python,
|
||||
and use it to install Conan:
|
||||
|
||||
[Homebrew]: https://brew.sh/
|
||||
[pyenv]: https://github.com/pyenv/pyenv
|
||||
|
||||
```
|
||||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||
brew update
|
||||
brew install xz
|
||||
brew install pyenv
|
||||
pyenv install 3.10-dev
|
||||
pyenv global 3.10-dev
|
||||
eval "$(pyenv init -)"
|
||||
pip install 'conan<2'
|
||||
```
|
||||
|
||||
Install CMake with Homebrew too:
|
||||
|
||||
```
|
||||
brew install cmake
|
||||
```
|
||||
159
docs/build/install.md
vendored
159
docs/build/install.md
vendored
@@ -1,159 +0,0 @@
|
||||
This document contains instructions for installing rippled.
|
||||
The APT package manager is common on Debian-based Linux distributions like
|
||||
Ubuntu,
|
||||
while the YUM package manager is common on Red Hat-based Linux distributions
|
||||
like CentOS.
|
||||
Installing from source is an option for all platforms,
|
||||
and the only supported option for installing custom builds.
|
||||
|
||||
|
||||
## From source
|
||||
|
||||
From a source build, you can install rippled and libxrpl using CMake's
|
||||
`--install` mode:
|
||||
|
||||
```
|
||||
cmake --install . --prefix /opt/local
|
||||
```
|
||||
|
||||
The default [prefix][1] is typically `/usr/local` on Linux and macOS and
|
||||
`C:/Program Files/rippled` on Windows.
|
||||
|
||||
[1]: https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX.html
|
||||
|
||||
|
||||
## With the APT package manager
|
||||
|
||||
1. Update repositories:
|
||||
|
||||
sudo apt update -y
|
||||
|
||||
2. Install utilities:
|
||||
|
||||
sudo apt install -y apt-transport-https ca-certificates wget gnupg
|
||||
|
||||
3. Add Ripple's package-signing GPG key to your list of trusted keys:
|
||||
|
||||
sudo mkdir /usr/local/share/keyrings/
|
||||
wget -q -O - "https://repos.ripple.com/repos/api/gpg/key/public" | gpg --dearmor > ripple-key.gpg
|
||||
sudo mv ripple-key.gpg /usr/local/share/keyrings
|
||||
|
||||
|
||||
4. Check the fingerprint of the newly-added key:
|
||||
|
||||
gpg /usr/local/share/keyrings/ripple-key.gpg
|
||||
|
||||
The output should include an entry for Ripple such as the following:
|
||||
|
||||
gpg: WARNING: no command supplied. Trying to guess what you mean ...
|
||||
pub rsa3072 2019-02-14 [SC] [expires: 2026-02-17]
|
||||
C0010EC205B35A3310DC90DE395F97FFCCAFD9A2
|
||||
uid TechOps Team at Ripple <techops+rippled@ripple.com>
|
||||
sub rsa3072 2019-02-14 [E] [expires: 2026-02-17]
|
||||
|
||||
|
||||
In particular, make sure that the fingerprint matches. (In the above example, the fingerprint is on the third line, starting with `C001`.)
|
||||
|
||||
4. Add the appropriate Ripple repository for your operating system version:
|
||||
|
||||
echo "deb [signed-by=/usr/local/share/keyrings/ripple-key.gpg] https://repos.ripple.com/repos/rippled-deb focal stable" | \
|
||||
sudo tee -a /etc/apt/sources.list.d/ripple.list
|
||||
|
||||
The above example is appropriate for **Ubuntu 20.04 Focal Fossa**. For other operating systems, replace the word `focal` with one of the following:
|
||||
|
||||
- `jammy` for **Ubuntu 22.04 Jammy Jellyfish**
|
||||
- `bionic` for **Ubuntu 18.04 Bionic Beaver**
|
||||
- `bullseye` for **Debian 11 Bullseye**
|
||||
- `buster` for **Debian 10 Buster**
|
||||
|
||||
If you want access to development or pre-release versions of `rippled`, use one of the following instead of `stable`:
|
||||
|
||||
- `unstable` - Pre-release builds ([`release` branch](https://github.com/ripple/rippled/tree/release))
|
||||
- `nightly` - Experimental/development builds ([`develop` branch](https://github.com/ripple/rippled/tree/develop))
|
||||
|
||||
**Warning:** Unstable and nightly builds may be broken at any time. Do not use these builds for production servers.
|
||||
|
||||
5. Fetch the Ripple repository.
|
||||
|
||||
sudo apt -y update
|
||||
|
||||
6. Install the `rippled` software package:
|
||||
|
||||
sudo apt -y install rippled
|
||||
|
||||
7. Check the status of the `rippled` service:
|
||||
|
||||
systemctl status rippled.service
|
||||
|
||||
The `rippled` service should start automatically. If not, you can start it manually:
|
||||
|
||||
sudo systemctl start rippled.service
|
||||
|
||||
8. Optional: allow `rippled` to bind to privileged ports.
|
||||
|
||||
This allows you to serve incoming API requests on port 80 or 443. (If you want to do so, you must also update the config file's port settings.)
|
||||
|
||||
sudo setcap 'cap_net_bind_service=+ep' /opt/ripple/bin/rippled
|
||||
|
||||
|
||||
## With the YUM package manager
|
||||
|
||||
1. Install the Ripple RPM repository:
|
||||
|
||||
Choose the appropriate RPM repository for the stability of releases you want:
|
||||
|
||||
- `stable` for the latest production release (`master` branch)
|
||||
- `unstable` for pre-release builds (`release` branch)
|
||||
- `nightly` for experimental/development builds (`develop` branch)
|
||||
|
||||
*Stable*
|
||||
|
||||
cat << REPOFILE | sudo tee /etc/yum.repos.d/ripple.repo
|
||||
[ripple-stable]
|
||||
name=XRP Ledger Packages
|
||||
enabled=1
|
||||
gpgcheck=0
|
||||
repo_gpgcheck=1
|
||||
baseurl=https://repos.ripple.com/repos/rippled-rpm/stable/
|
||||
gpgkey=https://repos.ripple.com/repos/rippled-rpm/stable/repodata/repomd.xml.key
|
||||
REPOFILE
|
||||
|
||||
*Unstable*
|
||||
|
||||
cat << REPOFILE | sudo tee /etc/yum.repos.d/ripple.repo
|
||||
[ripple-unstable]
|
||||
name=XRP Ledger Packages
|
||||
enabled=1
|
||||
gpgcheck=0
|
||||
repo_gpgcheck=1
|
||||
baseurl=https://repos.ripple.com/repos/rippled-rpm/unstable/
|
||||
gpgkey=https://repos.ripple.com/repos/rippled-rpm/unstable/repodata/repomd.xml.key
|
||||
REPOFILE
|
||||
|
||||
*Nightly*
|
||||
|
||||
cat << REPOFILE | sudo tee /etc/yum.repos.d/ripple.repo
|
||||
[ripple-nightly]
|
||||
name=XRP Ledger Packages
|
||||
enabled=1
|
||||
gpgcheck=0
|
||||
repo_gpgcheck=1
|
||||
baseurl=https://repos.ripple.com/repos/rippled-rpm/nightly/
|
||||
gpgkey=https://repos.ripple.com/repos/rippled-rpm/nightly/repodata/repomd.xml.key
|
||||
REPOFILE
|
||||
|
||||
2. Fetch the latest repo updates:
|
||||
|
||||
sudo yum -y update
|
||||
|
||||
3. Install the new `rippled` package:
|
||||
|
||||
sudo yum install -y rippled
|
||||
|
||||
4. Configure the `rippled` service to start on boot:
|
||||
|
||||
sudo systemctl enable rippled.service
|
||||
|
||||
5. Start the `rippled` service:
|
||||
|
||||
sudo systemctl start rippled.service
|
||||
40
external/snappy/conandata.yml
vendored
40
external/snappy/conandata.yml
vendored
@@ -1,40 +0,0 @@
|
||||
sources:
|
||||
"1.1.10":
|
||||
url: "https://github.com/google/snappy/archive/1.1.10.tar.gz"
|
||||
sha256: "49d831bffcc5f3d01482340fe5af59852ca2fe76c3e05df0e67203ebbe0f1d90"
|
||||
"1.1.9":
|
||||
url: "https://github.com/google/snappy/archive/1.1.9.tar.gz"
|
||||
sha256: "75c1fbb3d618dd3a0483bff0e26d0a92b495bbe5059c8b4f1c962b478b6e06e7"
|
||||
"1.1.8":
|
||||
url: "https://github.com/google/snappy/archive/1.1.8.tar.gz"
|
||||
sha256: "16b677f07832a612b0836178db7f374e414f94657c138e6993cbfc5dcc58651f"
|
||||
"1.1.7":
|
||||
url: "https://github.com/google/snappy/archive/1.1.7.tar.gz"
|
||||
sha256: "3dfa02e873ff51a11ee02b9ca391807f0c8ea0529a4924afa645fbf97163f9d4"
|
||||
patches:
|
||||
"1.1.10":
|
||||
- patch_file: "patches/1.1.10-0001-fix-inlining-failure.patch"
|
||||
patch_description: "disable inlining for compilation error"
|
||||
patch_type: "portability"
|
||||
- patch_file: "patches/1.1.9-0002-no-Werror.patch"
|
||||
patch_description: "disable 'warning as error' options"
|
||||
patch_type: "portability"
|
||||
- patch_file: "patches/1.1.10-0003-fix-clobber-list-older-llvm.patch"
|
||||
patch_description: "disable inline asm on apple-clang"
|
||||
patch_type: "portability"
|
||||
- patch_file: "patches/1.1.9-0004-rtti-by-default.patch"
|
||||
patch_description: "remove 'disable rtti'"
|
||||
patch_type: "conan"
|
||||
"1.1.9":
|
||||
- patch_file: "patches/1.1.9-0001-fix-inlining-failure.patch"
|
||||
patch_description: "disable inlining for compilation error"
|
||||
patch_type: "portability"
|
||||
- patch_file: "patches/1.1.9-0002-no-Werror.patch"
|
||||
patch_description: "disable 'warning as error' options"
|
||||
patch_type: "portability"
|
||||
- patch_file: "patches/1.1.9-0003-fix-clobber-list-older-llvm.patch"
|
||||
patch_description: "disable inline asm on apple-clang"
|
||||
patch_type: "portability"
|
||||
- patch_file: "patches/1.1.9-0004-rtti-by-default.patch"
|
||||
patch_description: "remove 'disable rtti'"
|
||||
patch_type: "conan"
|
||||
94
external/snappy/conanfile.py
vendored
94
external/snappy/conanfile.py
vendored
@@ -1,94 +0,0 @@
|
||||
from conan import ConanFile
|
||||
from conan.tools.build import check_min_cppstd
|
||||
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
|
||||
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir
|
||||
from conan.tools.scm import Version
|
||||
import os
|
||||
|
||||
required_conan_version = ">=1.54.0"
|
||||
|
||||
|
||||
class SnappyConan(ConanFile):
|
||||
name = "snappy"
|
||||
description = "A fast compressor/decompressor"
|
||||
topics = ("google", "compressor", "decompressor")
|
||||
url = "https://github.com/conan-io/conan-center-index"
|
||||
homepage = "https://github.com/google/snappy"
|
||||
license = "BSD-3-Clause"
|
||||
|
||||
package_type = "library"
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
options = {
|
||||
"shared": [True, False],
|
||||
"fPIC": [True, False],
|
||||
}
|
||||
default_options = {
|
||||
"shared": False,
|
||||
"fPIC": True,
|
||||
}
|
||||
|
||||
def export_sources(self):
|
||||
export_conandata_patches(self)
|
||||
|
||||
def config_options(self):
|
||||
if self.settings.os == 'Windows':
|
||||
del self.options.fPIC
|
||||
|
||||
def configure(self):
|
||||
if self.options.shared:
|
||||
self.options.rm_safe("fPIC")
|
||||
|
||||
def layout(self):
|
||||
cmake_layout(self, src_folder="src")
|
||||
|
||||
def validate(self):
|
||||
if self.settings.compiler.get_safe("cppstd"):
|
||||
check_min_cppstd(self, 11)
|
||||
|
||||
def source(self):
|
||||
get(self, **self.conan_data["sources"][self.version], strip_root=True)
|
||||
|
||||
def generate(self):
|
||||
tc = CMakeToolchain(self)
|
||||
tc.variables["SNAPPY_BUILD_TESTS"] = False
|
||||
if Version(self.version) >= "1.1.8":
|
||||
tc.variables["SNAPPY_FUZZING_BUILD"] = False
|
||||
tc.variables["SNAPPY_REQUIRE_AVX"] = False
|
||||
tc.variables["SNAPPY_REQUIRE_AVX2"] = False
|
||||
tc.variables["SNAPPY_INSTALL"] = True
|
||||
if Version(self.version) >= "1.1.9":
|
||||
tc.variables["SNAPPY_BUILD_BENCHMARKS"] = False
|
||||
tc.generate()
|
||||
|
||||
def build(self):
|
||||
apply_conandata_patches(self)
|
||||
cmake = CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def package(self):
|
||||
copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
|
||||
cmake = CMake(self)
|
||||
cmake.install()
|
||||
rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
|
||||
|
||||
def package_info(self):
|
||||
self.cpp_info.set_property("cmake_file_name", "Snappy")
|
||||
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")
|
||||
|
||||
# TODO: to remove in conan v2 once cmake_find_package* generators removed
|
||||
self.cpp_info.names["cmake_find_package"] = "Snappy"
|
||||
self.cpp_info.names["cmake_find_package_multi"] = "Snappy"
|
||||
self.cpp_info.components["snappylib"].names["cmake_find_package"] = "snappy"
|
||||
self.cpp_info.components["snappylib"].names["cmake_find_package_multi"] = "snappy"
|
||||
self.cpp_info.components["snappylib"].set_property("cmake_target_name", "Snappy::snappy")
|
||||
@@ -1,13 +0,0 @@
|
||||
diff --git a/snappy-stubs-internal.h b/snappy-stubs-internal.h
|
||||
index 1548ed7..3b4a9f3 100644
|
||||
--- a/snappy-stubs-internal.h
|
||||
+++ b/snappy-stubs-internal.h
|
||||
@@ -100,7 +100,7 @@
|
||||
|
||||
// Inlining hints.
|
||||
#if HAVE_ATTRIBUTE_ALWAYS_INLINE
|
||||
-#define SNAPPY_ATTRIBUTE_ALWAYS_INLINE __attribute__((always_inline))
|
||||
+#define SNAPPY_ATTRIBUTE_ALWAYS_INLINE
|
||||
#else
|
||||
#define SNAPPY_ATTRIBUTE_ALWAYS_INLINE
|
||||
#endif // HAVE_ATTRIBUTE_ALWAYS_INLINE
|
||||
@@ -1,13 +0,0 @@
|
||||
diff --git a/snappy.cc b/snappy.cc
|
||||
index d414718..e4efb59 100644
|
||||
--- a/snappy.cc
|
||||
+++ b/snappy.cc
|
||||
@@ -1132,7 +1132,7 @@ inline size_t AdvanceToNextTagX86Optimized(const uint8_t** ip_p, size_t* tag) {
|
||||
size_t literal_len = *tag >> 2;
|
||||
size_t tag_type = *tag;
|
||||
bool is_literal;
|
||||
-#if defined(__GCC_ASM_FLAG_OUTPUTS__) && defined(__x86_64__)
|
||||
+#if defined(__GCC_ASM_FLAG_OUTPUTS__) && defined(__x86_64__) && ( (!defined(__clang__) && !defined(__APPLE__)) || (!defined(__APPLE__) && defined(__clang__) && (__clang_major__ >= 9)) || (defined(__APPLE__) && defined(__clang__) && (__clang_major__ > 11)) )
|
||||
// TODO clang misses the fact that the (c & 3) already correctly
|
||||
// sets the zero flag.
|
||||
asm("and $3, %k[tag_type]\n\t"
|
||||
@@ -1,14 +0,0 @@
|
||||
Fixes the following error:
|
||||
error: inlining failed in call to ‘always_inline’ ‘size_t snappy::AdvanceToNextTag(const uint8_t**, size_t*)’: function body can be overwritten at link time
|
||||
|
||||
--- snappy-stubs-internal.h
|
||||
+++ snappy-stubs-internal.h
|
||||
@@ -100,7 +100,7 @@
|
||||
|
||||
// Inlining hints.
|
||||
#ifdef HAVE_ATTRIBUTE_ALWAYS_INLINE
|
||||
-#define SNAPPY_ATTRIBUTE_ALWAYS_INLINE __attribute__((always_inline))
|
||||
+#define SNAPPY_ATTRIBUTE_ALWAYS_INLINE
|
||||
#else
|
||||
#define SNAPPY_ATTRIBUTE_ALWAYS_INLINE
|
||||
#endif
|
||||
@@ -1,12 +0,0 @@
|
||||
--- CMakeLists.txt
|
||||
+++ CMakeLists.txt
|
||||
@@ -69,7 +69,7 @@
|
||||
- # Use -Werror for clang only.
|
||||
+if(0)
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
if(NOT CMAKE_CXX_FLAGS MATCHES "-Werror")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
|
||||
endif(NOT CMAKE_CXX_FLAGS MATCHES "-Werror")
|
||||
endif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
-
|
||||
+endif()
|
||||
@@ -1,12 +0,0 @@
|
||||
asm clobbers do not work for clang < 9 and apple-clang < 11 (found by SpaceIm)
|
||||
--- snappy.cc
|
||||
+++ snappy.cc
|
||||
@@ -1026,7 +1026,7 @@
|
||||
size_t literal_len = *tag >> 2;
|
||||
size_t tag_type = *tag;
|
||||
bool is_literal;
|
||||
-#if defined(__GNUC__) && defined(__x86_64__)
|
||||
+#if defined(__GNUC__) && defined(__x86_64__) && ( (!defined(__clang__) && !defined(__APPLE__)) || (!defined(__APPLE__) && defined(__clang__) && (__clang_major__ >= 9)) || (defined(__APPLE__) && defined(__clang__) && (__clang_major__ > 11)) )
|
||||
// TODO clang misses the fact that the (c & 3) already correctly
|
||||
// sets the zero flag.
|
||||
asm("and $3, %k[tag_type]\n\t"
|
||||
@@ -1,20 +0,0 @@
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -53,8 +53,6 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
add_definitions(-D_HAS_EXCEPTIONS=0)
|
||||
|
||||
# Disable RTTI.
|
||||
- string(REGEX REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-")
|
||||
else(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
# Use -Wall for clang and gcc.
|
||||
if(NOT CMAKE_CXX_FLAGS MATCHES "-Wall")
|
||||
@@ -78,8 +76,6 @@ endif()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions")
|
||||
|
||||
# Disable RTTI.
|
||||
- string(REGEX REPLACE "-frtti" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
|
||||
endif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
|
||||
# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to make
|
||||
12
external/soci/conandata.yml
vendored
12
external/soci/conandata.yml
vendored
@@ -1,12 +0,0 @@
|
||||
sources:
|
||||
"4.0.3":
|
||||
url: "https://github.com/SOCI/soci/archive/v4.0.3.tar.gz"
|
||||
sha256: "4b1ff9c8545c5d802fbe06ee6cd2886630e5c03bf740e269bb625b45cf934928"
|
||||
patches:
|
||||
"4.0.3":
|
||||
- patch_file: "patches/0001-Remove-hardcoded-INSTALL_NAME_DIR-for-relocatable-li.patch"
|
||||
patch_description: "Generate relocatable libraries on MacOS"
|
||||
patch_type: "portability"
|
||||
- patch_file: "patches/0002-Fix-soci_backend.patch"
|
||||
patch_description: "Fix variable names for dependencies"
|
||||
patch_type: "conan"
|
||||
212
external/soci/conanfile.py
vendored
212
external/soci/conanfile.py
vendored
@@ -1,212 +0,0 @@
|
||||
from conan import ConanFile
|
||||
from conan.tools.build import check_min_cppstd
|
||||
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
|
||||
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir
|
||||
from conan.tools.microsoft import is_msvc
|
||||
from conan.tools.scm import Version
|
||||
from conan.errors import ConanInvalidConfiguration
|
||||
import os
|
||||
|
||||
required_conan_version = ">=1.55.0"
|
||||
|
||||
|
||||
class SociConan(ConanFile):
|
||||
name = "soci"
|
||||
homepage = "https://github.com/SOCI/soci"
|
||||
url = "https://github.com/conan-io/conan-center-index"
|
||||
description = "The C++ Database Access Library "
|
||||
topics = ("mysql", "odbc", "postgresql", "sqlite3")
|
||||
license = "BSL-1.0"
|
||||
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
options = {
|
||||
"shared": [True, False],
|
||||
"fPIC": [True, False],
|
||||
"empty": [True, False],
|
||||
"with_sqlite3": [True, False],
|
||||
"with_db2": [True, False],
|
||||
"with_odbc": [True, False],
|
||||
"with_oracle": [True, False],
|
||||
"with_firebird": [True, False],
|
||||
"with_mysql": [True, False],
|
||||
"with_postgresql": [True, False],
|
||||
"with_boost": [True, False],
|
||||
}
|
||||
default_options = {
|
||||
"shared": False,
|
||||
"fPIC": True,
|
||||
"empty": False,
|
||||
"with_sqlite3": False,
|
||||
"with_db2": False,
|
||||
"with_odbc": False,
|
||||
"with_oracle": False,
|
||||
"with_firebird": False,
|
||||
"with_mysql": False,
|
||||
"with_postgresql": False,
|
||||
"with_boost": False,
|
||||
}
|
||||
|
||||
def export_sources(self):
|
||||
export_conandata_patches(self)
|
||||
|
||||
def layout(self):
|
||||
cmake_layout(self, src_folder="src")
|
||||
|
||||
def config_options(self):
|
||||
if self.settings.os == "Windows":
|
||||
self.options.rm_safe("fPIC")
|
||||
|
||||
def configure(self):
|
||||
if self.options.shared:
|
||||
self.options.rm_safe("fPIC")
|
||||
|
||||
def requirements(self):
|
||||
if self.options.with_sqlite3:
|
||||
self.requires("sqlite3/3.41.1")
|
||||
if self.options.with_odbc and self.settings.os != "Windows":
|
||||
self.requires("odbc/2.3.11")
|
||||
if self.options.with_mysql:
|
||||
self.requires("libmysqlclient/8.0.31")
|
||||
if self.options.with_postgresql:
|
||||
self.requires("libpq/14.7")
|
||||
if self.options.with_boost:
|
||||
self.requires("boost/1.81.0")
|
||||
|
||||
@property
|
||||
def _minimum_compilers_version(self):
|
||||
return {
|
||||
"Visual Studio": "14",
|
||||
"gcc": "4.8",
|
||||
"clang": "3.8",
|
||||
"apple-clang": "8.0"
|
||||
}
|
||||
|
||||
def validate(self):
|
||||
if self.settings.compiler.get_safe("cppstd"):
|
||||
check_min_cppstd(self, 11)
|
||||
|
||||
compiler = str(self.settings.compiler)
|
||||
compiler_version = Version(self.settings.compiler.version.value)
|
||||
if compiler not in self._minimum_compilers_version:
|
||||
self.output.warning("{} recipe lacks information about the {} compiler support.".format(self.name, self.settings.compiler))
|
||||
elif compiler_version < self._minimum_compilers_version[compiler]:
|
||||
raise ConanInvalidConfiguration("{} requires a {} version >= {}".format(self.name, compiler, compiler_version))
|
||||
|
||||
prefix = "Dependencies for"
|
||||
message = "not configured in this conan package."
|
||||
if self.options.with_db2:
|
||||
# self.requires("db2/0.0.0") # TODO add support for db2
|
||||
raise ConanInvalidConfiguration("{} DB2 {} ".format(prefix, message))
|
||||
if self.options.with_oracle:
|
||||
# self.requires("oracle_db/0.0.0") # TODO add support for oracle
|
||||
raise ConanInvalidConfiguration("{} ORACLE {} ".format(prefix, message))
|
||||
if self.options.with_firebird:
|
||||
# self.requires("firebird/0.0.0") # TODO add support for firebird
|
||||
raise ConanInvalidConfiguration("{} firebird {} ".format(prefix, message))
|
||||
|
||||
def source(self):
|
||||
get(self, **self.conan_data["sources"][self.version], strip_root=True)
|
||||
|
||||
def generate(self):
|
||||
tc = CMakeToolchain(self)
|
||||
|
||||
tc.variables["SOCI_SHARED"] = self.options.shared
|
||||
tc.variables["SOCI_STATIC"] = not self.options.shared
|
||||
tc.variables["SOCI_TESTS"] = False
|
||||
tc.variables["SOCI_CXX11"] = True
|
||||
tc.variables["SOCI_EMPTY"] = self.options.empty
|
||||
tc.variables["WITH_SQLITE3"] = self.options.with_sqlite3
|
||||
tc.variables["WITH_DB2"] = self.options.with_db2
|
||||
tc.variables["WITH_ODBC"] = self.options.with_odbc
|
||||
tc.variables["WITH_ORACLE"] = self.options.with_oracle
|
||||
tc.variables["WITH_FIREBIRD"] = self.options.with_firebird
|
||||
tc.variables["WITH_MYSQL"] = self.options.with_mysql
|
||||
tc.variables["WITH_POSTGRESQL"] = self.options.with_postgresql
|
||||
tc.variables["WITH_BOOST"] = self.options.with_boost
|
||||
tc.generate()
|
||||
|
||||
deps = CMakeDeps(self)
|
||||
deps.generate()
|
||||
|
||||
def build(self):
|
||||
apply_conandata_patches(self)
|
||||
cmake = CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def package(self):
|
||||
copy(self, "LICENSE_1_0.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder)
|
||||
|
||||
cmake = CMake(self)
|
||||
cmake.install()
|
||||
|
||||
rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
|
||||
|
||||
def package_info(self):
|
||||
self.cpp_info.set_property("cmake_file_name", "SOCI")
|
||||
|
||||
target_suffix = "" if self.options.shared else "_static"
|
||||
lib_prefix = "lib" if is_msvc(self) and not self.options.shared else ""
|
||||
version = Version(self.version)
|
||||
lib_suffix = "_{}_{}".format(version.major, version.minor) if self.settings.os == "Windows" else ""
|
||||
|
||||
# soci_core
|
||||
self.cpp_info.components["soci_core"].set_property("cmake_target_name", "SOCI::soci_core{}".format(target_suffix))
|
||||
self.cpp_info.components["soci_core"].libs = ["{}soci_core{}".format(lib_prefix, lib_suffix)]
|
||||
if self.options.with_boost:
|
||||
self.cpp_info.components["soci_core"].requires.append("boost::headers")
|
||||
|
||||
# soci_empty
|
||||
if self.options.empty:
|
||||
self.cpp_info.components["soci_empty"].set_property("cmake_target_name", "SOCI::soci_empty{}".format(target_suffix))
|
||||
self.cpp_info.components["soci_empty"].libs = ["{}soci_empty{}".format(lib_prefix, lib_suffix)]
|
||||
self.cpp_info.components["soci_empty"].requires = ["soci_core"]
|
||||
|
||||
# soci_sqlite3
|
||||
if self.options.with_sqlite3:
|
||||
self.cpp_info.components["soci_sqlite3"].set_property("cmake_target_name", "SOCI::soci_sqlite3{}".format(target_suffix))
|
||||
self.cpp_info.components["soci_sqlite3"].libs = ["{}soci_sqlite3{}".format(lib_prefix, lib_suffix)]
|
||||
self.cpp_info.components["soci_sqlite3"].requires = ["soci_core", "sqlite3::sqlite3"]
|
||||
|
||||
# soci_odbc
|
||||
if self.options.with_odbc:
|
||||
self.cpp_info.components["soci_odbc"].set_property("cmake_target_name", "SOCI::soci_odbc{}".format(target_suffix))
|
||||
self.cpp_info.components["soci_odbc"].libs = ["{}soci_odbc{}".format(lib_prefix, lib_suffix)]
|
||||
self.cpp_info.components["soci_odbc"].requires = ["soci_core"]
|
||||
if self.settings.os == "Windows":
|
||||
self.cpp_info.components["soci_odbc"].system_libs.append("odbc32")
|
||||
else:
|
||||
self.cpp_info.components["soci_odbc"].requires.append("odbc::odbc")
|
||||
|
||||
# soci_mysql
|
||||
if self.options.with_mysql:
|
||||
self.cpp_info.components["soci_mysql"].set_property("cmake_target_name", "SOCI::soci_mysql{}".format(target_suffix))
|
||||
self.cpp_info.components["soci_mysql"].libs = ["{}soci_mysql{}".format(lib_prefix, lib_suffix)]
|
||||
self.cpp_info.components["soci_mysql"].requires = ["soci_core", "libmysqlclient::libmysqlclient"]
|
||||
|
||||
# soci_postgresql
|
||||
if self.options.with_postgresql:
|
||||
self.cpp_info.components["soci_postgresql"].set_property("cmake_target_name", "SOCI::soci_postgresql{}".format(target_suffix))
|
||||
self.cpp_info.components["soci_postgresql"].libs = ["{}soci_postgresql{}".format(lib_prefix, lib_suffix)]
|
||||
self.cpp_info.components["soci_postgresql"].requires = ["soci_core", "libpq::libpq"]
|
||||
|
||||
# TODO: to remove in conan v2 once cmake_find_package* generators removed
|
||||
self.cpp_info.names["cmake_find_package"] = "SOCI"
|
||||
self.cpp_info.names["cmake_find_package_multi"] = "SOCI"
|
||||
self.cpp_info.components["soci_core"].names["cmake_find_package"] = "soci_core{}".format(target_suffix)
|
||||
self.cpp_info.components["soci_core"].names["cmake_find_package_multi"] = "soci_core{}".format(target_suffix)
|
||||
if self.options.empty:
|
||||
self.cpp_info.components["soci_empty"].names["cmake_find_package"] = "soci_empty{}".format(target_suffix)
|
||||
self.cpp_info.components["soci_empty"].names["cmake_find_package_multi"] = "soci_empty{}".format(target_suffix)
|
||||
if self.options.with_sqlite3:
|
||||
self.cpp_info.components["soci_sqlite3"].names["cmake_find_package"] = "soci_sqlite3{}".format(target_suffix)
|
||||
self.cpp_info.components["soci_sqlite3"].names["cmake_find_package_multi"] = "soci_sqlite3{}".format(target_suffix)
|
||||
if self.options.with_odbc:
|
||||
self.cpp_info.components["soci_odbc"].names["cmake_find_package"] = "soci_odbc{}".format(target_suffix)
|
||||
self.cpp_info.components["soci_odbc"].names["cmake_find_package_multi"] = "soci_odbc{}".format(target_suffix)
|
||||
if self.options.with_mysql:
|
||||
self.cpp_info.components["soci_mysql"].names["cmake_find_package"] = "soci_mysql{}".format(target_suffix)
|
||||
self.cpp_info.components["soci_mysql"].names["cmake_find_package_multi"] = "soci_mysql{}".format(target_suffix)
|
||||
if self.options.with_postgresql:
|
||||
self.cpp_info.components["soci_postgresql"].names["cmake_find_package"] = "soci_postgresql{}".format(target_suffix)
|
||||
self.cpp_info.components["soci_postgresql"].names["cmake_find_package_multi"] = "soci_postgresql{}".format(target_suffix)
|
||||
@@ -1,39 +0,0 @@
|
||||
From d491bf7b5040d314ffd0c6310ba01f78ff44c85e Mon Sep 17 00:00:00 2001
|
||||
From: Rasmus Thomsen <rasmus.thomsen@dampsoft.de>
|
||||
Date: Fri, 14 Apr 2023 09:16:29 +0200
|
||||
Subject: [PATCH] Remove hardcoded INSTALL_NAME_DIR for relocatable libraries
|
||||
on MacOS
|
||||
|
||||
---
|
||||
cmake/SociBackend.cmake | 2 +-
|
||||
src/core/CMakeLists.txt | 1 -
|
||||
2 files changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git a/cmake/SociBackend.cmake b/cmake/SociBackend.cmake
|
||||
index 5d4ef0df..39fe1f77 100644
|
||||
--- a/cmake/SociBackend.cmake
|
||||
+++ b/cmake/SociBackend.cmake
|
||||
@@ -171,7 +171,7 @@ macro(soci_backend NAME)
|
||||
set_target_properties(${THIS_BACKEND_TARGET}
|
||||
PROPERTIES
|
||||
SOVERSION ${${PROJECT_NAME}_SOVERSION}
|
||||
- INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
+ )
|
||||
|
||||
if(APPLE)
|
||||
set_target_properties(${THIS_BACKEND_TARGET}
|
||||
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
|
||||
index 3e7deeae..f9eae564 100644
|
||||
--- a/src/core/CMakeLists.txt
|
||||
+++ b/src/core/CMakeLists.txt
|
||||
@@ -59,7 +59,6 @@ if (SOCI_SHARED)
|
||||
PROPERTIES
|
||||
VERSION ${SOCI_VERSION}
|
||||
SOVERSION ${SOCI_SOVERSION}
|
||||
- INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib
|
||||
CLEAN_DIRECT_OUTPUT 1)
|
||||
endif()
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
diff --git a/cmake/SociBackend.cmake b/cmake/SociBackend.cmake
|
||||
index 0a664667..3fa2ed95 100644
|
||||
--- a/cmake/SociBackend.cmake
|
||||
+++ b/cmake/SociBackend.cmake
|
||||
@@ -31,14 +31,13 @@ macro(soci_backend_deps_found NAME DEPS SUCCESS)
|
||||
if(NOT DEPEND_FOUND)
|
||||
list(APPEND DEPS_NOT_FOUND ${dep})
|
||||
else()
|
||||
- string(TOUPPER "${dep}" DEPU)
|
||||
- if( ${DEPU}_INCLUDE_DIR )
|
||||
- list(APPEND DEPS_INCLUDE_DIRS ${${DEPU}_INCLUDE_DIR})
|
||||
+ if( ${dep}_INCLUDE_DIR )
|
||||
+ list(APPEND DEPS_INCLUDE_DIRS ${${dep}_INCLUDE_DIR})
|
||||
endif()
|
||||
- if( ${DEPU}_INCLUDE_DIRS )
|
||||
- list(APPEND DEPS_INCLUDE_DIRS ${${DEPU}_INCLUDE_DIRS})
|
||||
+ if( ${dep}_INCLUDE_DIRS )
|
||||
+ list(APPEND DEPS_INCLUDE_DIRS ${${dep}_INCLUDE_DIRS})
|
||||
endif()
|
||||
- list(APPEND DEPS_LIBRARIES ${${DEPU}_LIBRARIES})
|
||||
+ list(APPEND DEPS_LIBRARIES ${${dep}_LIBRARIES})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
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/../src/ripple/app/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/ripple/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,34 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -eu
|
||||
|
||||
SCRIPT_DIR=$(dirname "$0")
|
||||
SCRIPT_DIR=$(cd "$SCRIPT_DIR" && pwd)
|
||||
|
||||
RIPPLED_ROOT="$SCRIPT_DIR/../src/ripple"
|
||||
echo '// For documentation please see: https://xrpl-hooks.readme.io/reference/'
|
||||
echo '// Generated using generate_sfcodes.sh'
|
||||
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/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' |
|
||||
sed 's/UINT96,/20,/g' |
|
||||
sed 's/UINT192,/21,/g' |
|
||||
sed 's/UINT384,/22,/g' |
|
||||
sed 's/UINT512,/23,/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,38 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -eu
|
||||
|
||||
SCRIPT_DIR=$(dirname "$0")
|
||||
SCRIPT_DIR=$(cd "$SCRIPT_DIR" && pwd)
|
||||
|
||||
RIPPLED_ROOT="$SCRIPT_DIR/../src/ripple"
|
||||
TX_FORMATS="$RIPPLED_ROOT/protocol/TxFormats.h"
|
||||
|
||||
echo '// For documentation please see: https://xrpl-hooks.readme.io/reference/'
|
||||
echo '// Generated using generate_tts.sh'
|
||||
sed -n '/enum TxType/,/};/p' "$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)) }
|
||||
|
||||
/^[ \t]*tt[A-Z0-9_]+/ {
|
||||
line = $0
|
||||
deprecated = (line ~ /\[\[deprecated/)
|
||||
gsub(/\[\[deprecated[^]]*\]\]/, "", line)
|
||||
sub(/\/\/.*$/, "", line)
|
||||
gsub(/,[[:space:]]*$/, "", 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
|
||||
}
|
||||
'
|
||||
@@ -637,55 +637,43 @@ int64_t hook(uint32_t r)
|
||||
{
|
||||
previous_member[0] = 'V';
|
||||
|
||||
for (int tbl = 1; GUARD(2), tbl <= 2; ++tbl)
|
||||
for (int i = 1; GUARD(32), i < 32; ++i)
|
||||
{
|
||||
for (int i = 0; GUARD(66), i < 32; ++i)
|
||||
previous_member[1] = i < 2 ? 'R' : i < 12 ? 'H' : 'S';
|
||||
previous_member[2] =
|
||||
i == 0 ? 'R' :
|
||||
i == 1 ? 'D' :
|
||||
i < 12 ? i - 2 :
|
||||
i - 12;
|
||||
|
||||
uint8_t vote_key[32];
|
||||
if (state(SBUF(vote_key), SBUF(previous_member)) == 32)
|
||||
{
|
||||
previous_member[1] = i < 2 ? 'R' : i < 12 ? 'H' : 'S';
|
||||
previous_member[2] =
|
||||
i == 0 ? 'R' :
|
||||
i == 1 ? 'D' :
|
||||
i < 12 ? i - 2 :
|
||||
i - 12;
|
||||
previous_member[3] = tbl;
|
||||
uint8_t vote_count = 0;
|
||||
|
||||
uint8_t vote_key[32] = {};
|
||||
uint8_t ts =
|
||||
previous_member[1] == 'H' ? 32 : // hook topics are a 32 byte hook hash
|
||||
previous_member[1] == 'S' ? 20 : // account topics are a 20 byte account ID
|
||||
8; // reward topics are an 8 byte le xfl
|
||||
|
||||
uint8_t padding = 32 - ts;
|
||||
|
||||
if (state(vote_key + padding, ts, SBUF(previous_member)) == ts)
|
||||
// find and decrement the vote counter
|
||||
vote_key[0] = 'C';
|
||||
vote_key[1] = previous_member[1];
|
||||
vote_key[2] = previous_member[2];
|
||||
if (state(&vote_count, 1, SBUF(vote_key)) == 1)
|
||||
{
|
||||
uint8_t vote_count = 0;
|
||||
|
||||
// find and decrement the vote counter
|
||||
vote_key[0] = 'C';
|
||||
vote_key[1] = previous_member[1];
|
||||
vote_key[2] = previous_member[2];
|
||||
vote_key[3] = tbl;
|
||||
if (state(&vote_count, 1, SBUF(vote_key)) == 1)
|
||||
// if we're down to 1 vote then delete state
|
||||
if (vote_count <= 1)
|
||||
{
|
||||
// if we're down to 1 vote then delete state
|
||||
if (vote_count <= 1)
|
||||
{
|
||||
ASSERT(state_set(0,0, SBUF(vote_key)) == 0);
|
||||
trace_num(SBUF("Decrement vote count deleted"), vote_count);
|
||||
}
|
||||
else // otherwise decrement
|
||||
{
|
||||
vote_count--;
|
||||
ASSERT(state_set(&vote_count, 1, SBUF(vote_key)) == 1);
|
||||
trace_num(SBUF("Decrement vote count to"), vote_count);
|
||||
}
|
||||
ASSERT(state_set(0,0, SBUF(vote_key)) == 0);
|
||||
trace_num(SBUF("Decrement vote count deleted"), vote_count);
|
||||
}
|
||||
else // otherwise decrement
|
||||
{
|
||||
vote_count--;
|
||||
ASSERT(state_set(&vote_count, 1, SBUF(vote_key)) == 1);
|
||||
trace_num(SBUF("Decrement vote count to"), vote_count);
|
||||
}
|
||||
|
||||
// delete the vote entry
|
||||
ASSERT(state_set(0,0, SBUF(previous_member)) == 0);
|
||||
trace(SBUF("Vote entry deleted"), vote_key, 32, 1);
|
||||
}
|
||||
|
||||
// delete the vote entry
|
||||
ASSERT(state_set(0,0, SBUF(previous_member)) == 0);
|
||||
trace(SBUF("Vote entry deleted"), vote_key, 32, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* These are helper macros for writing hooks, all of them are optional as is including macro.h at all
|
||||
* These are helper macros for writing hooks, all of them are optional as is including hookmacro.h at all
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#define sfHookEmitCount ((1U << 16U) + 18U)
|
||||
#define sfHookExecutionIndex ((1U << 16U) + 19U)
|
||||
#define sfHookApiVersion ((1U << 16U) + 20U)
|
||||
#define sfHookStateScale ((1U << 16U) + 21U)
|
||||
#define sfNetworkID ((2U << 16U) + 1U)
|
||||
#define sfFlags ((2U << 16U) + 2U)
|
||||
#define sfSourceTag ((2U << 16U) + 3U)
|
||||
@@ -61,13 +60,7 @@
|
||||
#define sfBurnedNFTokens ((2U << 16U) + 44U)
|
||||
#define sfHookStateCount ((2U << 16U) + 45U)
|
||||
#define sfEmitGeneration ((2U << 16U) + 46U)
|
||||
#define sfLockCount ((2U << 16U) + 49U)
|
||||
#define sfFirstNFTokenSequence ((2U << 16U) + 50U)
|
||||
#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 sfLockCount ((2U << 16U) + 47U)
|
||||
#define sfRewardTime ((2U << 16U) + 98U)
|
||||
#define sfRewardLgrFirst ((2U << 16U) + 99U)
|
||||
#define sfRewardLgrLast ((2U << 16U) + 100U)
|
||||
@@ -87,15 +80,12 @@
|
||||
#define sfHookInstructionCount ((3U << 16U) + 17U)
|
||||
#define sfHookReturnCode ((3U << 16U) + 18U)
|
||||
#define sfReferenceCount ((3U << 16U) + 19U)
|
||||
#define sfTouchCount ((3U << 16U) + 97U)
|
||||
#define sfAccountIndex ((3U << 16U) + 98U)
|
||||
#define sfAccountCount ((3U << 16U) + 99U)
|
||||
#define sfRewardAccumulator ((3U << 16U) + 100U)
|
||||
#define sfEmailHash ((4U << 16U) + 1U)
|
||||
#define sfTakerPaysCurrency ((17U << 16U) + 1U)
|
||||
#define sfTakerPaysIssuer ((17U << 16U) + 2U)
|
||||
#define sfTakerGetsCurrency ((17U << 16U) + 3U)
|
||||
#define sfTakerGetsIssuer ((17U << 16U) + 4U)
|
||||
#define sfTakerPaysCurrency ((10U << 16U) + 1U)
|
||||
#define sfTakerPaysIssuer ((10U << 16U) + 2U)
|
||||
#define sfTakerGetsCurrency ((10U << 16U) + 3U)
|
||||
#define sfTakerGetsIssuer ((10U << 16U) + 4U)
|
||||
#define sfLedgerHash ((5U << 16U) + 1U)
|
||||
#define sfParentHash ((5U << 16U) + 2U)
|
||||
#define sfTransactionHash ((5U << 16U) + 3U)
|
||||
@@ -109,7 +99,6 @@
|
||||
#define sfEmitParentTxnID ((5U << 16U) + 11U)
|
||||
#define sfEmitNonce ((5U << 16U) + 12U)
|
||||
#define sfEmitHookHash ((5U << 16U) + 13U)
|
||||
#define sfObjectID ((5U << 16U) + 14U)
|
||||
#define sfBookDirectory ((5U << 16U) + 16U)
|
||||
#define sfInvoiceID ((5U << 16U) + 17U)
|
||||
#define sfNickname ((5U << 16U) + 18U)
|
||||
@@ -131,11 +120,6 @@
|
||||
#define sfOfferID ((5U << 16U) + 34U)
|
||||
#define sfEscrowID ((5U << 16U) + 35U)
|
||||
#define sfURITokenID ((5U << 16U) + 36U)
|
||||
#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 sfAmount ((6U << 16U) + 1U)
|
||||
#define sfBalance ((6U << 16U) + 2U)
|
||||
#define sfLimitAmount ((6U << 16U) + 3U)
|
||||
@@ -152,9 +136,6 @@
|
||||
#define sfNFTokenBrokerFee ((6U << 16U) + 19U)
|
||||
#define sfHookCallbackFee ((6U << 16U) + 20U)
|
||||
#define sfLockedBalance ((6U << 16U) + 21U)
|
||||
#define sfBaseFeeDrops ((6U << 16U) + 22U)
|
||||
#define sfReserveBaseDrops ((6U << 16U) + 23U)
|
||||
#define sfReserveIncrementDrops ((6U << 16U) + 24U)
|
||||
#define sfPublicKey ((7U << 16U) + 1U)
|
||||
#define sfMessageKey ((7U << 16U) + 2U)
|
||||
#define sfSigningPubKey ((7U << 16U) + 3U)
|
||||
@@ -180,8 +161,6 @@
|
||||
#define sfHookParameterName ((7U << 16U) + 24U)
|
||||
#define sfHookParameterValue ((7U << 16U) + 25U)
|
||||
#define sfBlob ((7U << 16U) + 26U)
|
||||
#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)
|
||||
@@ -192,13 +171,11 @@
|
||||
#define sfNFTokenMinter ((8U << 16U) + 9U)
|
||||
#define sfEmitCallback ((8U << 16U) + 10U)
|
||||
#define sfHookAccount ((8U << 16U) + 16U)
|
||||
#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 sfURITokenIDs ((19U << 16U) + 99U)
|
||||
#define sfPaths ((18U << 16U) + 1U)
|
||||
#define sfTransactionMetaData ((14U << 16U) + 2U)
|
||||
#define sfCreatedNode ((14U << 16U) + 3U)
|
||||
@@ -221,13 +198,6 @@
|
||||
#define sfHookDefinition ((14U << 16U) + 22U)
|
||||
#define sfHookParameter ((14U << 16U) + 23U)
|
||||
#define sfHookGrant ((14U << 16U) + 24U)
|
||||
#define sfRemark ((14U << 16U) + 97U)
|
||||
#define sfGenesisMint ((14U << 16U) + 96U)
|
||||
#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)
|
||||
@@ -242,9 +212,4 @@
|
||||
#define sfHookExecutions ((15U << 16U) + 18U)
|
||||
#define sfHookParameters ((15U << 16U) + 19U)
|
||||
#define sfHookGrants ((15U << 16U) + 20U)
|
||||
#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)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// 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
|
||||
@@ -9,7 +8,6 @@
|
||||
// #define ttNICKNAME_SET 6 // deprecated
|
||||
#define ttOFFER_CREATE 7
|
||||
#define ttOFFER_CANCEL 8
|
||||
// #define ttCONTRACT 9 // deprecated
|
||||
#define ttTICKET_CREATE 10
|
||||
// #define ttSPINAL_TAP 11 // deprecated
|
||||
#define ttSIGNER_LIST_SET 12
|
||||
@@ -28,15 +26,11 @@
|
||||
#define ttNFTOKEN_CREATE_OFFER 27
|
||||
#define ttNFTOKEN_CANCEL_OFFER 28
|
||||
#define ttNFTOKEN_ACCEPT_OFFER 29
|
||||
#define ttCLAWBACK 30
|
||||
#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 ttCRON 92
|
||||
#define ttCRON_SET 93
|
||||
#define ttREMARKS_SET 94
|
||||
#define ttREMIT 95
|
||||
#define ttGENESIS_MINT 96
|
||||
#define ttIMPORT 97
|
||||
@@ -46,4 +40,4 @@
|
||||
#define ttFEE 101
|
||||
#define ttUNL_MODIFY 102
|
||||
#define ttEMIT_FAILURE 103
|
||||
#define ttUNL_REPORT 104
|
||||
#define ttUNL_REPORT 104
|
||||
7602
patches/0001-Revert-Use-the-Conan-package-manager-4367.patch
Normal file
7602
patches/0001-Revert-Use-the-Conan-package-manager-4367.patch
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,10 +1,4 @@
|
||||
#!/bin/bash
|
||||
# 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,15 +9,10 @@ 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
|
||||
# GA will run this script and then delete it at the end of the job
|
||||
JOB_CLEANUP_SCRIPT=${JOB_CLEANUP_SCRIPT:-/dev/null}
|
||||
NORMALIZED_WORKFLOW=$(echo "$GITHUB_WORKFLOW" | tr -c 'a-zA-Z0-9' '-')
|
||||
NORMALIZED_REF=$(echo "$GITHUB_REF" | tr -c 'a-zA-Z0-9' '-')
|
||||
CONTAINER_NAME="xahaud_cached_builder_${NORMALIZED_WORKFLOW}-${NORMALIZED_REF}"
|
||||
CONTAINER_NAME=xahaud_cached_builder_$(echo "$GITHUB_ACTOR" | awk '{print tolower($0)}')
|
||||
|
||||
echo "-- BUILD CORES: $BUILD_CORES"
|
||||
echo "-- GITHUB_REPOSITORY: $GITHUB_REPOSITORY"
|
||||
@@ -47,192 +36,26 @@ 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
|
||||
if [[ "$STATIC_CONTAINER" -gt "0" && "$GITHUB_REPOSITORY" != "" ]]; 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 \
|
||||
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.23.1/cmake-3.23.1-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
|
||||
|
||||
ENV CC='ccache gcc'
|
||||
ENV CXX='ccache g++'
|
||||
|
||||
# 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"
|
||||
|
||||
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
|
||||
|
||||
@@ -35,8 +35,6 @@
|
||||
#include <ripple/app/misc/TxQ.h>
|
||||
#include <ripple/app/misc/ValidatorKeys.h>
|
||||
#include <ripple/app/misc/ValidatorList.h>
|
||||
#include <ripple/app/tx/impl/Change.h>
|
||||
#include <ripple/app/tx/impl/Entropy.h>
|
||||
#include <ripple/basics/random.h>
|
||||
#include <ripple/beast/core/LexicalCast.h>
|
||||
#include <ripple/consensus/LedgerTiming.h>
|
||||
@@ -136,12 +134,8 @@ RCLConsensus::Adaptor::acquireLedger(LedgerHash const& hash)
|
||||
acquiringLedger_ = hash;
|
||||
|
||||
app_.getJobQueue().addJob(
|
||||
jtADVANCE,
|
||||
"getConsensusLedger1",
|
||||
[id = hash, &app = app_, this]() {
|
||||
JLOG(j_.debug())
|
||||
<< "JOB advanceLedger getConsensusLedger1 started";
|
||||
app.getInboundLedgers().acquireAsync(
|
||||
jtADVANCE, "getConsensusLedger", [id = hash, &app = app_]() {
|
||||
app.getInboundLedgers().acquire(
|
||||
id, 0, InboundLedger::Reason::CONSENSUS);
|
||||
});
|
||||
}
|
||||
@@ -188,7 +182,7 @@ RCLConsensus::Adaptor::share(RCLCxTx const& tx)
|
||||
if (app_.getHashRouter().shouldRelay(tx.id()))
|
||||
{
|
||||
JLOG(j_.debug()) << "Relaying disputed tx " << tx.id();
|
||||
auto const slice = tx.tx_->slice();
|
||||
auto const slice = tx.tx_.slice();
|
||||
protocol::TMTransaction msg;
|
||||
msg.set_rawtransaction(slice.data(), slice.size());
|
||||
msg.set_status(protocol::tsNEW);
|
||||
@@ -227,8 +221,6 @@ RCLConsensus::Adaptor::propose(RCLCxPeerPos::Proposal const& proposal)
|
||||
|
||||
prop.set_signature(sig.data(), sig.size());
|
||||
|
||||
injectShuffleTxn(app_, sig);
|
||||
|
||||
auto const suppression = proposalUniqueId(
|
||||
proposal.position(),
|
||||
proposal.prevLedger(),
|
||||
@@ -334,7 +326,7 @@ RCLConsensus::Adaptor::onClose(
|
||||
tx.first->add(s);
|
||||
initialSet->addItem(
|
||||
SHAMapNodeType::tnTRANSACTION_NM,
|
||||
make_shamapitem(tx.first->getTransactionID(), s.slice()));
|
||||
SHAMapItem(tx.first->getTransactionID(), s.slice()));
|
||||
}
|
||||
|
||||
// Add pseudo-transactions to the set
|
||||
@@ -378,8 +370,7 @@ RCLConsensus::Adaptor::onClose(
|
||||
RCLCensorshipDetector<TxID, LedgerIndex>::TxIDSeqVec proposed;
|
||||
|
||||
initialSet->visitLeaves(
|
||||
[&proposed,
|
||||
seq](boost::intrusive_ptr<SHAMapItem const> const& item) {
|
||||
[&proposed, seq](std::shared_ptr<SHAMapItem const> const& item) {
|
||||
proposed.emplace_back(item->key(), seq);
|
||||
});
|
||||
|
||||
@@ -502,11 +493,15 @@ RCLConsensus::Adaptor::doAccept(
|
||||
|
||||
for (auto const& item : *result.txns.map_)
|
||||
{
|
||||
#ifndef DEBUG
|
||||
try
|
||||
{
|
||||
#endif
|
||||
retriableTxs.insert(
|
||||
std::make_shared<STTx const>(SerialIter{item.slice()}));
|
||||
JLOG(j_.debug()) << " Tx: " << item.key();
|
||||
|
||||
#ifndef DEBUG
|
||||
}
|
||||
catch (std::exception const& ex)
|
||||
{
|
||||
@@ -514,6 +509,7 @@ RCLConsensus::Adaptor::doAccept(
|
||||
JLOG(j_.warn())
|
||||
<< " Tx: " << item.key() << " throws: " << ex.what();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
auto built = buildLCL(
|
||||
@@ -539,7 +535,7 @@ RCLConsensus::Adaptor::doAccept(
|
||||
std::vector<TxID> accepted;
|
||||
|
||||
result.txns.map_->visitLeaves(
|
||||
[&accepted](boost::intrusive_ptr<SHAMapItem const> const& item) {
|
||||
[&accepted](std::shared_ptr<SHAMapItem const> const& item) {
|
||||
accepted.push_back(item->key());
|
||||
});
|
||||
|
||||
@@ -614,7 +610,7 @@ RCLConsensus::Adaptor::doAccept(
|
||||
<< "Test applying disputed transaction that did"
|
||||
<< " not get in " << dispute.tx().id();
|
||||
|
||||
SerialIter sit(dispute.tx().tx_->slice());
|
||||
SerialIter sit(dispute.tx().tx_.slice());
|
||||
auto txn = std::make_shared<STTx const>(sit);
|
||||
|
||||
// Disputed pseudo-transactions that were not accepted
|
||||
@@ -656,12 +652,6 @@ RCLConsensus::Adaptor::doAccept(
|
||||
tapNONE,
|
||||
"consensus",
|
||||
[&](OpenView& view, beast::Journal j) {
|
||||
if (rules->enabled(featureRNG))
|
||||
{
|
||||
auto tx = makeEntropyTxn(view, app_, j_);
|
||||
if (tx)
|
||||
app_.getOPs().submitTransaction(tx);
|
||||
}
|
||||
return app_.getTxQ().accept(app_, view);
|
||||
});
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
|
||||
@param txn The transaction to wrap
|
||||
*/
|
||||
RCLCxTx(boost::intrusive_ptr<SHAMapItem const> txn) : tx_(std::move(txn))
|
||||
RCLCxTx(SHAMapItem const& txn) : tx_{txn}
|
||||
{
|
||||
}
|
||||
|
||||
@@ -50,11 +50,11 @@ public:
|
||||
ID const&
|
||||
id() const
|
||||
{
|
||||
return tx_->key();
|
||||
return tx_.key();
|
||||
}
|
||||
|
||||
//! The SHAMapItem that represents the transaction.
|
||||
boost::intrusive_ptr<SHAMapItem const> tx_;
|
||||
SHAMapItem const tx_;
|
||||
};
|
||||
|
||||
/** Represents a set of transactions in RCLConsensus.
|
||||
@@ -90,7 +90,8 @@ public:
|
||||
bool
|
||||
insert(Tx const& t)
|
||||
{
|
||||
return map_->addItem(SHAMapNodeType::tnTRANSACTION_NM, t.tx_);
|
||||
return map_->addItem(
|
||||
SHAMapNodeType::tnTRANSACTION_NM, SHAMapItem{t.tx_});
|
||||
}
|
||||
|
||||
/** Remove a transaction from the set.
|
||||
@@ -144,7 +145,7 @@ public:
|
||||
code uses the shared_ptr semantics to know whether the find
|
||||
was successful and properly creates a Tx as needed.
|
||||
*/
|
||||
boost::intrusive_ptr<SHAMapItem const> const&
|
||||
std::shared_ptr<const SHAMapItem> const&
|
||||
find(Tx::ID const& entry) const
|
||||
{
|
||||
return map_->peekItem(entry);
|
||||
|
||||
@@ -135,10 +135,8 @@ RCLValidationsAdaptor::acquire(LedgerHash const& hash)
|
||||
Application* pApp = &app_;
|
||||
|
||||
app_.getJobQueue().addJob(
|
||||
jtADVANCE, "getConsensusLedger2", [pApp, hash, this]() {
|
||||
JLOG(j_.debug())
|
||||
<< "JOB advanceLedger getConsensusLedger2 started";
|
||||
pApp->getInboundLedgers().acquireAsync(
|
||||
jtADVANCE, "getConsensusLedger", [pApp, hash]() {
|
||||
pApp->getInboundLedgers().acquire(
|
||||
hash, 0, InboundLedger::Reason::CONSENSUS);
|
||||
});
|
||||
return std::nullopt;
|
||||
@@ -154,9 +152,7 @@ void
|
||||
handleNewValidation(
|
||||
Application& app,
|
||||
std::shared_ptr<STValidation> const& val,
|
||||
std::string const& source,
|
||||
BypassAccept const bypassAccept,
|
||||
std::optional<beast::Journal> j)
|
||||
std::string const& source)
|
||||
{
|
||||
auto const& signingKey = val->getSignerPublic();
|
||||
auto const& hash = val->getLedgerHash();
|
||||
@@ -181,23 +177,7 @@ handleNewValidation(
|
||||
if (outcome == ValStatus::current)
|
||||
{
|
||||
if (val->isTrusted())
|
||||
{
|
||||
// Was: app.getLedgerMaster().checkAccept(hash, seq);
|
||||
// https://github.com/XRPLF/rippled/commit/fbbea9e6e25795a8a6bd1bf64b780771933a9579
|
||||
if (bypassAccept == BypassAccept::yes)
|
||||
{
|
||||
assert(j.has_value());
|
||||
if (j.has_value())
|
||||
{
|
||||
JLOG(j->trace()) << "Bypassing checkAccept for validation "
|
||||
<< val->getLedgerHash();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
app.getLedgerMaster().checkAccept(hash, seq);
|
||||
}
|
||||
}
|
||||
app.getLedgerMaster().checkAccept(hash, seq);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,16 +25,12 @@
|
||||
#include <ripple/protocol/Protocol.h>
|
||||
#include <ripple/protocol/RippleLedgerHash.h>
|
||||
#include <ripple/protocol/STValidation.h>
|
||||
#include <optional>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
class Application;
|
||||
|
||||
enum class BypassAccept : bool { no = false, yes };
|
||||
|
||||
/** Wrapper over STValidation for generic Validation code
|
||||
|
||||
Wraps an STValidation for compatibility with the generic validation code.
|
||||
@@ -252,9 +248,7 @@ void
|
||||
handleNewValidation(
|
||||
Application& app,
|
||||
std::shared_ptr<STValidation> const& val,
|
||||
std::string const& source,
|
||||
BypassAccept const bypassAccept = BypassAccept::no,
|
||||
std::optional<beast::Journal> j = std::nullopt);
|
||||
std::string const& source);
|
||||
|
||||
} // namespace ripple
|
||||
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -350,8 +332,7 @@ enum hook_return_code : int64_t {
|
||||
MEM_OVERLAP = -43, // one or more specified buffers are the same memory
|
||||
TOO_MANY_STATE_MODIFICATIONS = -44, // more than 5000 modified state
|
||||
// entires in the combined hook chains
|
||||
TOO_MANY_NAMESPACES = -45,
|
||||
TOO_LITTLE_ENTROPY = -46,
|
||||
TOO_MANY_NAMESPACES = -45
|
||||
};
|
||||
|
||||
enum ExitType : uint8_t {
|
||||
@@ -368,112 +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)),
|
||||
HOOK_API_DEFINITION(I64, dice, (I32)),
|
||||
HOOK_API_DEFINITION(I64, random, (I32, 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
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <ostream>
|
||||
#include <stack>
|
||||
#include <string>
|
||||
@@ -272,19 +271,7 @@ check_guard(
|
||||
int guard_func_idx,
|
||||
int last_import_idx,
|
||||
GuardLog guardLog,
|
||||
std::string guardLogAccStr,
|
||||
/* RH NOTE:
|
||||
* rules version is a bit field, so rule update 1 is 0x01, update 2 is 0x02
|
||||
* and update 3 is 0x04 ideally at rule version 3 all bits so far are set
|
||||
* (0b111) so the ruleVersion = 7, however if a specific rule update must be
|
||||
* rolled back due to unforeseen behaviour then this may no longer be the
|
||||
* case. using a bit field here leaves us flexible to rollback changes that
|
||||
* might have unforeseen consequences, without also rolling back further
|
||||
* changes that are fine.
|
||||
*/
|
||||
uint64_t rulesVersion = 0
|
||||
|
||||
)
|
||||
std::string guardLogAccStr)
|
||||
{
|
||||
#define MAX_GUARD_CALLS 1024
|
||||
uint32_t guard_count = 0;
|
||||
@@ -634,17 +621,11 @@ check_guard(
|
||||
}
|
||||
else if (fc_type == 10) // memory.copy
|
||||
{
|
||||
if (rulesVersion & 0x02U)
|
||||
GUARD_ERROR("Memory.copy instruction is not allowed.");
|
||||
|
||||
REQUIRE(2);
|
||||
ADVANCE(2);
|
||||
}
|
||||
else if (fc_type == 11) // memory.fill
|
||||
{
|
||||
if (rulesVersion & 0x02U)
|
||||
GUARD_ERROR("Memory.fill instruction is not allowed.");
|
||||
|
||||
ADVANCE(1);
|
||||
}
|
||||
else if (fc_type <= 7) // numeric instructions
|
||||
@@ -826,15 +807,6 @@ validateGuards(
|
||||
std::vector<uint8_t> const& wasm,
|
||||
GuardLog guardLog,
|
||||
std::string guardLogAccStr,
|
||||
/* RH NOTE:
|
||||
* rules version is a bit field, so rule update 1 is 0x01, update 2 is 0x02
|
||||
* and update 3 is 0x04 ideally at rule version 3 all bits so far are set
|
||||
* (0b111) so the ruleVersion = 7, however if a specific rule update must be
|
||||
* rolled back due to unforeseen behaviour then this may no longer be the
|
||||
* case. using a bit field here leaves us flexible to rollback changes that
|
||||
* might have unforeseen consequences, without also rolling back further
|
||||
* changes that are fine.
|
||||
*/
|
||||
uint64_t rulesVersion = 0)
|
||||
{
|
||||
uint64_t byteCount = wasm.size();
|
||||
@@ -1505,8 +1477,7 @@ validateGuards(
|
||||
guard_import_number,
|
||||
last_import_number,
|
||||
guardLog,
|
||||
guardLogAccStr,
|
||||
rulesVersion);
|
||||
guardLogAccStr);
|
||||
|
||||
if (!valid)
|
||||
return {};
|
||||
|
||||
@@ -30,9 +30,8 @@ isEmittedTxn(ripple::STTx const& tx);
|
||||
class HookStateMap : public std::map<
|
||||
ripple::AccountID, // account that owns the state
|
||||
std::tuple<
|
||||
int64_t, // remaining available ownercount
|
||||
int64_t, // total namespace count
|
||||
uint16_t, // hook state scale
|
||||
int64_t, // remaining available ownercount
|
||||
int64_t, // total namespace count
|
||||
std::map<
|
||||
ripple::uint256, // namespace
|
||||
std::map<
|
||||
@@ -75,7 +74,6 @@ DECLARE_HOOK_FUNCTION(
|
||||
uint32_t read_ptr,
|
||||
uint32_t read_len,
|
||||
int64_t error_code);
|
||||
|
||||
DECLARE_HOOK_FUNCTION(
|
||||
int64_t,
|
||||
util_raddr,
|
||||
@@ -99,26 +97,6 @@ DECLARE_HOOK_FUNCTION(
|
||||
uint32_t sread_len,
|
||||
uint32_t kread_ptr,
|
||||
uint32_t kread_len);
|
||||
DECLARE_HOOK_FUNCTION(
|
||||
int64_t,
|
||||
util_sha512h,
|
||||
uint32_t write_ptr,
|
||||
uint32_t write_len,
|
||||
uint32_t read_ptr,
|
||||
uint32_t read_len);
|
||||
DECLARE_HOOK_FUNCTION(
|
||||
int64_t,
|
||||
util_keylet,
|
||||
uint32_t write_ptr,
|
||||
uint32_t write_len,
|
||||
uint32_t keylet_type,
|
||||
uint32_t a,
|
||||
uint32_t b,
|
||||
uint32_t c,
|
||||
uint32_t d,
|
||||
uint32_t e,
|
||||
uint32_t f);
|
||||
|
||||
DECLARE_HOOK_FUNCTION(
|
||||
int64_t,
|
||||
sto_validate,
|
||||
@@ -155,6 +133,25 @@ DECLARE_HOOK_FUNCTION(
|
||||
uint32_t read_len,
|
||||
uint32_t field_id);
|
||||
|
||||
DECLARE_HOOK_FUNCTION(
|
||||
int64_t,
|
||||
util_sha512h,
|
||||
uint32_t write_ptr,
|
||||
uint32_t write_len,
|
||||
uint32_t read_ptr,
|
||||
uint32_t read_len);
|
||||
DECLARE_HOOK_FUNCTION(
|
||||
int64_t,
|
||||
util_keylet,
|
||||
uint32_t write_ptr,
|
||||
uint32_t write_len,
|
||||
uint32_t keylet_type,
|
||||
uint32_t a,
|
||||
uint32_t b,
|
||||
uint32_t c,
|
||||
uint32_t d,
|
||||
uint32_t e,
|
||||
uint32_t f);
|
||||
DECLARE_HOOK_FUNCNARG(int64_t, etxn_burden);
|
||||
DECLARE_HOOK_FUNCTION(
|
||||
int64_t,
|
||||
@@ -217,6 +214,7 @@ DECLARE_HOOK_FUNCTION(
|
||||
DECLARE_HOOK_FUNCTION(int64_t, float_invert, int64_t float1);
|
||||
DECLARE_HOOK_FUNCTION(int64_t, float_divide, int64_t float1, int64_t float2);
|
||||
DECLARE_HOOK_FUNCNARG(int64_t, float_one);
|
||||
|
||||
DECLARE_HOOK_FUNCTION(int64_t, float_mantissa, int64_t float1);
|
||||
DECLARE_HOOK_FUNCTION(int64_t, float_sign, int64_t float1);
|
||||
DECLARE_HOOK_FUNCTION(
|
||||
@@ -228,6 +226,17 @@ DECLARE_HOOK_FUNCTION(
|
||||
DECLARE_HOOK_FUNCTION(int64_t, float_log, int64_t float1);
|
||||
DECLARE_HOOK_FUNCTION(int64_t, float_root, int64_t float1, uint32_t n);
|
||||
|
||||
DECLARE_HOOK_FUNCTION(
|
||||
int64_t,
|
||||
hook_account,
|
||||
uint32_t write_ptr,
|
||||
uint32_t write_len);
|
||||
DECLARE_HOOK_FUNCTION(
|
||||
int64_t,
|
||||
hook_hash,
|
||||
uint32_t write_ptr,
|
||||
uint32_t write_len,
|
||||
int32_t hook_no);
|
||||
DECLARE_HOOK_FUNCNARG(int64_t, fee_base);
|
||||
DECLARE_HOOK_FUNCNARG(int64_t, ledger_seq);
|
||||
DECLARE_HOOK_FUNCNARG(int64_t, ledger_last_time);
|
||||
@@ -241,6 +250,7 @@ DECLARE_HOOK_FUNCTION(
|
||||
ledger_nonce,
|
||||
uint32_t write_ptr,
|
||||
uint32_t write_len);
|
||||
|
||||
DECLARE_HOOK_FUNCTION(
|
||||
int64_t,
|
||||
ledger_keylet,
|
||||
@@ -251,17 +261,6 @@ DECLARE_HOOK_FUNCTION(
|
||||
uint32_t hread_ptr,
|
||||
uint32_t hread_len);
|
||||
|
||||
DECLARE_HOOK_FUNCTION(
|
||||
int64_t,
|
||||
hook_account,
|
||||
uint32_t write_ptr,
|
||||
uint32_t write_len);
|
||||
DECLARE_HOOK_FUNCTION(
|
||||
int64_t,
|
||||
hook_hash,
|
||||
uint32_t write_ptr,
|
||||
uint32_t write_len,
|
||||
int32_t hook_no);
|
||||
DECLARE_HOOK_FUNCTION(
|
||||
int64_t,
|
||||
hook_param_set,
|
||||
@@ -271,6 +270,7 @@ DECLARE_HOOK_FUNCTION(
|
||||
uint32_t kread_len,
|
||||
uint32_t hread_ptr,
|
||||
uint32_t hread_len);
|
||||
|
||||
DECLARE_HOOK_FUNCTION(
|
||||
int64_t,
|
||||
hook_param,
|
||||
@@ -278,7 +278,9 @@ DECLARE_HOOK_FUNCTION(
|
||||
uint32_t write_len,
|
||||
uint32_t read_ptr,
|
||||
uint32_t read_len);
|
||||
|
||||
DECLARE_HOOK_FUNCNARG(int64_t, hook_again);
|
||||
|
||||
DECLARE_HOOK_FUNCTION(
|
||||
int64_t,
|
||||
hook_skip,
|
||||
@@ -353,7 +355,6 @@ DECLARE_HOOK_FUNCTION(
|
||||
uint32_t nread_len,
|
||||
uint32_t aread_ptr,
|
||||
uint32_t aread_len);
|
||||
|
||||
DECLARE_HOOK_FUNCTION(
|
||||
int64_t,
|
||||
trace,
|
||||
@@ -406,9 +407,6 @@ DECLARE_HOOK_FUNCTION(
|
||||
uint32_t slot_no_tx,
|
||||
uint32_t slot_no_meta);
|
||||
|
||||
DECLARE_HOOK_FUNCTION(int64_t, dice, uint32_t sides);
|
||||
DECLARE_HOOK_FUNCTION(int64_t, random, uint32_t write_ptr, uint32_t write_len);
|
||||
|
||||
/*
|
||||
DECLARE_HOOK_FUNCTION(int64_t, str_find, uint32_t hread_ptr,
|
||||
uint32_t hread_len, uint32_t nread_ptr, uint32_t nread_len, uint32_t mode,
|
||||
@@ -430,12 +428,6 @@ namespace hook {
|
||||
bool
|
||||
canHook(ripple::TxType txType, ripple::uint256 hookOn);
|
||||
|
||||
bool
|
||||
canEmit(ripple::TxType txType, ripple::uint256 hookCanEmit);
|
||||
|
||||
ripple::uint256
|
||||
getHookCanEmit(ripple::STObject const& hookObj, SLE::pointer const& hookDef);
|
||||
|
||||
struct HookResult;
|
||||
|
||||
HookResult
|
||||
@@ -444,7 +436,6 @@ apply(
|
||||
used for caching (one day) */
|
||||
ripple::uint256 const&
|
||||
hookHash, /* hash of the actual hook byte code, used for metadata */
|
||||
ripple::uint256 const& hookCanEmit,
|
||||
ripple::uint256 const& hookNamespace,
|
||||
ripple::Blob const& wasm,
|
||||
std::map<
|
||||
@@ -469,6 +460,9 @@ apply(
|
||||
|
||||
struct HookContext;
|
||||
|
||||
uint32_t
|
||||
computeHookStateOwnerCount(uint32_t hookStateCount);
|
||||
|
||||
int64_t
|
||||
computeExecutionFee(uint64_t instructionCount);
|
||||
int64_t
|
||||
@@ -478,7 +472,6 @@ struct HookResult
|
||||
{
|
||||
ripple::uint256 const hookSetTxnID;
|
||||
ripple::uint256 const hookHash;
|
||||
ripple::uint256 const hookCanEmit;
|
||||
ripple::Keylet const accountKeylet;
|
||||
ripple::Keylet const ownerDirKeylet;
|
||||
ripple::Keylet const hookKeylet;
|
||||
@@ -516,8 +509,6 @@ struct HookResult
|
||||
false; // hook_again allows strong pre-apply to nominate
|
||||
// additional weak post-apply execution
|
||||
std::shared_ptr<STObject const> provisionalMeta;
|
||||
uint64_t rngCallCounter{
|
||||
0}; // used to ensure conseq. rng calls don't return same data
|
||||
};
|
||||
|
||||
class HookExecutor;
|
||||
@@ -882,9 +873,6 @@ public:
|
||||
ADD_HOOK_FUNCTION(meta_slot, ctx);
|
||||
ADD_HOOK_FUNCTION(xpop_slot, ctx);
|
||||
|
||||
ADD_HOOK_FUNCTION(dice, ctx);
|
||||
ADD_HOOK_FUNCTION(random, ctx);
|
||||
|
||||
/*
|
||||
ADD_HOOK_FUNCTION(str_find, ctx);
|
||||
ADD_HOOK_FUNCTION(str_replace, ctx);
|
||||
|
||||
@@ -79,7 +79,7 @@ main(int argc, char** argv)
|
||||
|
||||
close(fd);
|
||||
|
||||
auto result = validateGuards(hook, std::cout, "", 3);
|
||||
auto result = validateGuards(hook, std::cout, "", 1);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
|
||||
@@ -75,11 +75,6 @@ getTransactionalStakeHolders(STTx const& tx, ReadView const& rv)
|
||||
|
||||
switch (tt)
|
||||
{
|
||||
case ttCRON: {
|
||||
ADD_TSH(tx.getAccountID(sfOwner), tshWEAK);
|
||||
break;
|
||||
}
|
||||
|
||||
case ttREMIT: {
|
||||
if (destAcc)
|
||||
ADD_TSH(*destAcc, tshSTRONG);
|
||||
@@ -347,7 +342,8 @@ getTransactionalStakeHolders(STTx const& tx, ReadView const& rv)
|
||||
case ttOFFER_CANCEL:
|
||||
case ttTICKET_CREATE:
|
||||
case ttHOOK_SET:
|
||||
case ttOFFER_CREATE: {
|
||||
case ttOFFER_CREATE: // this is handled seperately
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -500,12 +496,6 @@ getTransactionalStakeHolders(STTx const& tx, ReadView const& rv)
|
||||
break;
|
||||
}
|
||||
|
||||
case ttCLAWBACK: {
|
||||
auto const amount = tx.getFieldAmount(sfAmount);
|
||||
ADD_TSH(amount.getIssuer(), tshWEAK);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
@@ -862,6 +852,12 @@ parseCurrency(uint8_t* cu_ptr, uint32_t cu_len)
|
||||
return {};
|
||||
}
|
||||
|
||||
uint32_t
|
||||
hook::computeHookStateOwnerCount(uint32_t hookStateCount)
|
||||
{
|
||||
return hookStateCount;
|
||||
}
|
||||
|
||||
inline int64_t
|
||||
serialize_keylet(
|
||||
ripple::Keylet& kl,
|
||||
@@ -1032,29 +1028,6 @@ hook::canHook(ripple::TxType txType, ripple::uint256 hookOn)
|
||||
return (hookOn & UINT256_BIT[txType]) != beast::zero;
|
||||
}
|
||||
|
||||
bool
|
||||
hook::canEmit(ripple::TxType txType, ripple::uint256 hookCanEmit)
|
||||
{
|
||||
return hook::canHook(txType, hookCanEmit);
|
||||
}
|
||||
|
||||
ripple::uint256
|
||||
hook::getHookCanEmit(
|
||||
ripple::STObject const& hookObj,
|
||||
SLE::pointer const& hookDef)
|
||||
{
|
||||
// default allows all transaction types
|
||||
uint256 defaultHookCanEmit = UINT256_BIT[ttHOOK_SET];
|
||||
|
||||
uint256 hookCanEmit =
|
||||
(hookObj.isFieldPresent(sfHookCanEmit)
|
||||
? hookObj.getFieldH256(sfHookCanEmit)
|
||||
: hookDef->isFieldPresent(sfHookCanEmit)
|
||||
? hookDef->getFieldH256(sfHookCanEmit)
|
||||
: defaultHookCanEmit);
|
||||
return hookCanEmit;
|
||||
}
|
||||
|
||||
// Update HookState ledger objects for the hook... only called after accept()
|
||||
// assumes the specified acc has already been checked for authoriation (hook
|
||||
// grants)
|
||||
@@ -1074,18 +1047,14 @@ hook::setHookState(
|
||||
return tefINTERNAL;
|
||||
|
||||
// if the blob is too large don't set it
|
||||
uint16_t const hookStateScale = sleAccount->isFieldPresent(sfHookStateScale)
|
||||
? sleAccount->getFieldU16(sfHookStateScale)
|
||||
: 1;
|
||||
|
||||
if (data.size() > hook::maxHookStateDataSize(hookStateScale))
|
||||
if (data.size() > hook::maxHookStateDataSize())
|
||||
return temHOOK_DATA_TOO_LARGE;
|
||||
|
||||
auto hookStateKeylet = ripple::keylet::hookState(acc, key, ns);
|
||||
auto hookStateDirKeylet = ripple::keylet::hookStateDir(acc, ns);
|
||||
|
||||
uint32_t stateCount = sleAccount->getFieldU32(sfHookStateCount);
|
||||
uint32_t oldStateCount = stateCount;
|
||||
uint32_t oldStateReserve = computeHookStateOwnerCount(stateCount);
|
||||
|
||||
auto hookState = view.peek(hookStateKeylet);
|
||||
|
||||
@@ -1116,15 +1085,13 @@ hook::setHookState(
|
||||
if (stateCount > 0)
|
||||
--stateCount; // guard this because in the "impossible" event it is
|
||||
// already 0 we'll wrap back to int_max
|
||||
|
||||
// if removing this state entry would destroy the allotment then reduce
|
||||
// the owner count
|
||||
if (stateCount < oldStateCount)
|
||||
adjustOwnerCount(view, sleAccount, -hookStateScale, j);
|
||||
if (computeHookStateOwnerCount(stateCount) < oldStateReserve)
|
||||
adjustOwnerCount(view, sleAccount, -1, j);
|
||||
|
||||
if (view.rules().enabled(featureExtendedHookState) && stateCount == 0)
|
||||
sleAccount->makeFieldAbsent(sfHookStateCount);
|
||||
else
|
||||
sleAccount->setFieldU32(sfHookStateCount, stateCount);
|
||||
sleAccount->setFieldU32(sfHookStateCount, stateCount);
|
||||
|
||||
if (nsDestroyed)
|
||||
hook::removeHookNamespaceEntry(*sleAccount, ns);
|
||||
@@ -1151,19 +1118,19 @@ hook::setHookState(
|
||||
{
|
||||
++stateCount;
|
||||
|
||||
if (stateCount > oldStateCount)
|
||||
if (computeHookStateOwnerCount(stateCount) > oldStateReserve)
|
||||
{
|
||||
// the hook used its allocated allotment of state entries for its
|
||||
// previous ownercount increment ownercount and give it another
|
||||
// allotment
|
||||
|
||||
ownerCount += hookStateScale;
|
||||
++ownerCount;
|
||||
XRPAmount const newReserve{view.fees().accountReserve(ownerCount)};
|
||||
|
||||
if (STAmount((*sleAccount)[sfBalance]).xrp() < newReserve)
|
||||
return tecINSUFFICIENT_RESERVE;
|
||||
|
||||
adjustOwnerCount(view, sleAccount, hookStateScale, j);
|
||||
adjustOwnerCount(view, sleAccount, 1, j);
|
||||
}
|
||||
|
||||
// update state count
|
||||
@@ -1212,7 +1179,6 @@ hook::apply(
|
||||
used for caching (one day) */
|
||||
ripple::uint256 const&
|
||||
hookHash, /* hash of the actual hook byte code, used for metadata */
|
||||
ripple::uint256 const& hookCanEmit,
|
||||
ripple::uint256 const& hookNamespace,
|
||||
ripple::Blob const& wasm,
|
||||
std::map<
|
||||
@@ -1240,7 +1206,6 @@ hook::apply(
|
||||
.result =
|
||||
{.hookSetTxnID = hookSetTxnID,
|
||||
.hookHash = hookHash,
|
||||
.hookCanEmit = hookCanEmit,
|
||||
.accountKeylet = keylet::account(account),
|
||||
.ownerDirKeylet = keylet::ownerDir(account),
|
||||
.hookKeylet = keylet::hook(account),
|
||||
@@ -1252,10 +1217,9 @@ hook::apply(
|
||||
.hookParamOverrides = hookParamOverrides,
|
||||
.hookParams = hookParams,
|
||||
.hookSkips = {},
|
||||
.exitType = applyCtx.view().rules().enabled(fixXahauV3)
|
||||
? hook_api::ExitType::UNSET
|
||||
: hook_api::ExitType::ROLLBACK, // default is to rollback
|
||||
// unless hook calls accept()
|
||||
.exitType =
|
||||
hook_api::ExitType::ROLLBACK, // default is to rollback unless
|
||||
// hook calls accept()
|
||||
.exitReason = std::string(""),
|
||||
.exitCode = -1,
|
||||
.hasCallback = hasCallback,
|
||||
@@ -1451,7 +1415,7 @@ lookup_state_cache(
|
||||
if (stateMap.find(acc) == stateMap.end())
|
||||
return std::nullopt;
|
||||
|
||||
auto& stateMapAcc = std::get<3>(stateMap[acc]);
|
||||
auto& stateMapAcc = std::get<2>(stateMap[acc]);
|
||||
if (stateMapAcc.find(ns) == stateMapAcc.end())
|
||||
return std::nullopt;
|
||||
|
||||
@@ -1486,7 +1450,6 @@ set_state_cache(
|
||||
|
||||
if (stateMap.find(acc) == stateMap.end())
|
||||
{
|
||||
// new Account Key
|
||||
// if this is the first time this account has been interacted with
|
||||
// we will compute how many available reserve positions there are
|
||||
auto const& fees = hookCtx.applyCtx.view().fees();
|
||||
@@ -1498,10 +1461,6 @@ set_state_cache(
|
||||
|
||||
STAmount bal = accSLE->getFieldAmount(sfBalance);
|
||||
|
||||
uint16_t const hookStateScale = accSLE->isFieldPresent(sfHookStateScale)
|
||||
? accSLE->getFieldU16(sfHookStateScale)
|
||||
: 1;
|
||||
|
||||
int64_t availableForReserves = bal.xrp().drops() -
|
||||
fees.accountReserve(accSLE->getFieldU32(sfOwnerCount)).drops();
|
||||
|
||||
@@ -1512,7 +1471,7 @@ set_state_cache(
|
||||
|
||||
availableForReserves /= increment;
|
||||
|
||||
if (availableForReserves < hookStateScale && modified)
|
||||
if (availableForReserves < 1 && modified)
|
||||
return RESERVE_INSUFFICIENT;
|
||||
|
||||
int64_t namespaceCount = accSLE->isFieldPresent(sfHookNamespaces)
|
||||
@@ -1531,28 +1490,20 @@ set_state_cache(
|
||||
|
||||
stateMap.modified_entry_count++;
|
||||
|
||||
// sanity check
|
||||
if (view.rules().enabled(featureExtendedHookState) &&
|
||||
availableForReserves < hookStateScale)
|
||||
return INTERNAL_ERROR;
|
||||
|
||||
stateMap[acc] = {
|
||||
availableForReserves - hookStateScale,
|
||||
availableForReserves - 1,
|
||||
namespaceCount,
|
||||
hookStateScale,
|
||||
{{ns, {{key, {modified, data}}}}}};
|
||||
return 1;
|
||||
}
|
||||
|
||||
auto& availableForReserves = std::get<0>(stateMap[acc]);
|
||||
auto& namespaceCount = std::get<1>(stateMap[acc]);
|
||||
auto& hookStateScale = std::get<2>(stateMap[acc]);
|
||||
auto& stateMapAcc = std::get<3>(stateMap[acc]);
|
||||
bool const canReserveNew = availableForReserves >= hookStateScale;
|
||||
auto& stateMapAcc = std::get<2>(stateMap[acc]);
|
||||
bool const canReserveNew = availableForReserves > 0;
|
||||
|
||||
if (stateMapAcc.find(ns) == stateMapAcc.end())
|
||||
{
|
||||
// new Namespace Key
|
||||
if (modified)
|
||||
{
|
||||
if (!canReserveNew)
|
||||
@@ -1570,11 +1521,7 @@ set_state_cache(
|
||||
namespaceCount++;
|
||||
}
|
||||
|
||||
if (view.rules().enabled(featureExtendedHookState) &&
|
||||
availableForReserves < hookStateScale)
|
||||
return INTERNAL_ERROR;
|
||||
|
||||
availableForReserves -= hookStateScale;
|
||||
availableForReserves--;
|
||||
stateMap.modified_entry_count++;
|
||||
}
|
||||
|
||||
@@ -1586,17 +1533,11 @@ set_state_cache(
|
||||
auto& stateMapNs = stateMapAcc[ns];
|
||||
if (stateMapNs.find(key) == stateMapNs.end())
|
||||
{
|
||||
// new State Key
|
||||
if (modified)
|
||||
{
|
||||
if (!canReserveNew)
|
||||
return RESERVE_INSUFFICIENT;
|
||||
|
||||
if (view.rules().enabled(featureExtendedHookState) &&
|
||||
availableForReserves < hookStateScale)
|
||||
return INTERNAL_ERROR;
|
||||
|
||||
availableForReserves -= hookStateScale;
|
||||
availableForReserves--;
|
||||
stateMap.modified_entry_count++;
|
||||
}
|
||||
|
||||
@@ -1605,7 +1546,6 @@ set_state_cache(
|
||||
return 1;
|
||||
}
|
||||
|
||||
// existing State Key
|
||||
if (modified)
|
||||
{
|
||||
if (!stateMapNs[key].first)
|
||||
@@ -1694,15 +1634,7 @@ DEFINE_HOOK_FUNCTION(
|
||||
(aread_len && NOT_IN_BOUNDS(aread_ptr, aread_len, memory_length)))
|
||||
return OUT_OF_BOUNDS;
|
||||
|
||||
auto const sleAccount = view.peek(hookCtx.result.accountKeylet);
|
||||
if (!sleAccount && view.rules().enabled(featureExtendedHookState))
|
||||
return tefINTERNAL;
|
||||
|
||||
uint16_t const hookStateScale = sleAccount->isFieldPresent(sfHookStateScale)
|
||||
? sleAccount->getFieldU16(sfHookStateScale)
|
||||
: 1;
|
||||
|
||||
uint32_t maxSize = hook::maxHookStateDataSize(hookStateScale);
|
||||
uint32_t maxSize = hook::maxHookStateDataSize();
|
||||
if (read_len > maxSize)
|
||||
return TOO_BIG;
|
||||
|
||||
@@ -1846,7 +1778,7 @@ hook::finalizeHookState(
|
||||
for (const auto& accEntry : stateMap)
|
||||
{
|
||||
const auto& acc = accEntry.first;
|
||||
for (const auto& nsEntry : std::get<3>(accEntry.second))
|
||||
for (const auto& nsEntry : std::get<2>(accEntry.second))
|
||||
{
|
||||
const auto& ns = nsEntry.first;
|
||||
for (const auto& cacheEntry : nsEntry.second)
|
||||
@@ -2903,6 +2835,17 @@ DEFINE_HOOK_FUNCTION(
|
||||
if (write_len < 34)
|
||||
return TOO_SMALL;
|
||||
|
||||
bool const v1 = applyCtx.view().rules().enabled(featureHooksUpdate1);
|
||||
|
||||
if (keylet_type == 0)
|
||||
return INVALID_ARGUMENT;
|
||||
|
||||
auto const last =
|
||||
v1 ? keylet_code::LAST_KLTYPE_V1 : keylet_code::LAST_KLTYPE_V0;
|
||||
|
||||
if (keylet_type > last)
|
||||
return INVALID_ARGUMENT;
|
||||
|
||||
try
|
||||
{
|
||||
switch (keylet_type)
|
||||
@@ -3004,8 +2947,7 @@ DEFINE_HOOK_FUNCTION(
|
||||
return serialize_keylet(kl, memory, write_ptr, write_len);
|
||||
}
|
||||
|
||||
// keylets that take 20 byte account id, and (4 byte uint for 32
|
||||
// byte hash)
|
||||
// keylets that take 20 byte account id, and 4 byte uint
|
||||
case keylet_code::OFFER:
|
||||
case keylet_code::CHECK:
|
||||
case keylet_code::ESCROW:
|
||||
@@ -3048,33 +2990,6 @@ DEFINE_HOOK_FUNCTION(
|
||||
return serialize_keylet(kl, memory, write_ptr, write_len);
|
||||
}
|
||||
|
||||
// keylets that take 20 byte account id, and 4 byte uint
|
||||
case keylet_code::CRON: {
|
||||
if (!applyCtx.view().rules().enabled(featureCron))
|
||||
return INVALID_ARGUMENT;
|
||||
|
||||
if (a == 0 || b == 0)
|
||||
return INVALID_ARGUMENT;
|
||||
if (e != 0 || f != 0 || d != 0)
|
||||
return INVALID_ARGUMENT;
|
||||
|
||||
uint32_t read_ptr = a, read_len = b;
|
||||
|
||||
if (NOT_IN_BOUNDS(read_ptr, read_len, memory_length))
|
||||
return OUT_OF_BOUNDS;
|
||||
|
||||
if (read_len != 20)
|
||||
return INVALID_ARGUMENT;
|
||||
|
||||
ripple::AccountID id = AccountID::fromVoid(memory + read_ptr);
|
||||
|
||||
uint32_t seq = c;
|
||||
|
||||
ripple::Keylet kl = ripple::keylet::cron(seq, id);
|
||||
|
||||
return serialize_keylet(kl, memory, write_ptr, write_len);
|
||||
}
|
||||
|
||||
// keylets that take a 32 byte uint and an 8byte uint64
|
||||
case keylet_code::PAGE: {
|
||||
if (a == 0 || b == 0)
|
||||
@@ -3122,9 +3037,6 @@ DEFINE_HOOK_FUNCTION(
|
||||
}
|
||||
|
||||
case keylet_code::HOOK_STATE_DIR: {
|
||||
if (!applyCtx.view().rules().enabled(featureHooksUpdate1))
|
||||
return INVALID_ARGUMENT;
|
||||
|
||||
if (a == 0 || b == 0 || c == 0 || d == 0)
|
||||
return INVALID_ARGUMENT;
|
||||
|
||||
@@ -3207,15 +3119,15 @@ DEFINE_HOOK_FUNCTION(
|
||||
if (a == 0 || b == 0 || c == 0 || d == 0 || e == 0 || f == 0)
|
||||
return INVALID_ARGUMENT;
|
||||
|
||||
uint32_t acc1_ptr = a, acc1_len = b, acc2_ptr = c, acc2_len = d,
|
||||
uint32_t hi_ptr = a, hi_len = b, lo_ptr = c, lo_len = d,
|
||||
cu_ptr = e, cu_len = f;
|
||||
|
||||
if (NOT_IN_BOUNDS(acc1_ptr, acc1_len, memory_length) ||
|
||||
NOT_IN_BOUNDS(acc2_ptr, acc2_len, memory_length) ||
|
||||
if (NOT_IN_BOUNDS(hi_ptr, hi_len, memory_length) ||
|
||||
NOT_IN_BOUNDS(lo_ptr, lo_len, memory_length) ||
|
||||
NOT_IN_BOUNDS(cu_ptr, cu_len, memory_length))
|
||||
return OUT_OF_BOUNDS;
|
||||
|
||||
if (acc1_len != 20 || acc2_len != 20)
|
||||
if (hi_len != 20 || lo_len != 20)
|
||||
return INVALID_ARGUMENT;
|
||||
|
||||
std::optional<Currency> cur =
|
||||
@@ -3224,8 +3136,8 @@ DEFINE_HOOK_FUNCTION(
|
||||
return INVALID_ARGUMENT;
|
||||
|
||||
auto kl = ripple::keylet::line(
|
||||
AccountID::fromVoid(memory + acc1_ptr),
|
||||
AccountID::fromVoid(memory + acc2_ptr),
|
||||
AccountID::fromVoid(memory + hi_ptr),
|
||||
AccountID::fromVoid(memory + lo_ptr),
|
||||
*cur);
|
||||
return serialize_keylet(kl, memory, write_ptr, write_len);
|
||||
}
|
||||
@@ -3299,7 +3211,7 @@ DEFINE_HOOK_FUNCTION(
|
||||
return INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
return INVALID_ARGUMENT;
|
||||
return NO_SUCH_KEYLET;
|
||||
|
||||
HOOK_TEARDOWN();
|
||||
}
|
||||
@@ -3357,16 +3269,6 @@ DEFINE_HOOK_FUNCTION(
|
||||
return EMISSION_FAILURE;
|
||||
}
|
||||
|
||||
ripple::TxType txType = stpTrans->getTxnType();
|
||||
|
||||
ripple::uint256 const& hookCanEmit = hookCtx.result.hookCanEmit;
|
||||
if (!hook::canEmit(txType, hookCanEmit))
|
||||
{
|
||||
JLOG(j.trace()) << "HookEmit[" << HC_ACC()
|
||||
<< "]: Hook cannot emit this txn.";
|
||||
return EMISSION_FAILURE;
|
||||
}
|
||||
|
||||
// check the emitted txn is valid
|
||||
/* Emitted TXN rules
|
||||
* 0. Account must match the hook account
|
||||
@@ -3634,7 +3536,7 @@ DEFINE_HOOK_FUNCTION(
|
||||
{
|
||||
JLOG(j.trace()) << "HookEmit[" << HC_ACC()
|
||||
<< "]: Transaction preflight failure: "
|
||||
<< transHuman(preflightResult.ter);
|
||||
<< preflightResult.ter;
|
||||
return EMISSION_FAILURE;
|
||||
}
|
||||
|
||||
@@ -4233,25 +4135,10 @@ DEFINE_HOOK_FUNCTION(
|
||||
|
||||
// unwrap the array if it is wrapped,
|
||||
// by removing a byte from the start and end
|
||||
// why here 0xF0?
|
||||
// STI_ARRAY = 0xF0
|
||||
// eg) Signers field value = 0x03 => 0xF3
|
||||
// eg) Amounts field value = 0x5C => 0xF0, 0x5C
|
||||
if ((*upto & 0xF0U) == 0xF0U)
|
||||
{
|
||||
if (view.rules().enabled(fixHookAPI20251128) && *upto == 0xF0U)
|
||||
{
|
||||
// field value > 15
|
||||
upto++;
|
||||
upto++;
|
||||
end--;
|
||||
}
|
||||
else
|
||||
{
|
||||
// field value <= 15
|
||||
upto++;
|
||||
end--;
|
||||
}
|
||||
upto++;
|
||||
end--;
|
||||
}
|
||||
|
||||
if (upto >= end)
|
||||
@@ -4484,30 +4371,6 @@ DEFINE_HOOK_FUNCTION(
|
||||
return MEM_OVERLAP;
|
||||
}
|
||||
|
||||
if (fread_len > 0 && view.rules().enabled(fixHookAPI20251128))
|
||||
{
|
||||
// inject field should be valid sto object and it's field id should
|
||||
// match the field_id
|
||||
unsigned char* inject_start = (unsigned char*)(memory + fread_ptr);
|
||||
unsigned char* inject_end =
|
||||
(unsigned char*)(memory + fread_ptr + fread_len);
|
||||
int type = -1, field = -1, payload_start = -1, payload_length = -1;
|
||||
int32_t length = get_stobject_length(
|
||||
inject_start,
|
||||
inject_end,
|
||||
type,
|
||||
field,
|
||||
payload_start,
|
||||
payload_length,
|
||||
0);
|
||||
if (length < 0)
|
||||
return PARSE_ERROR;
|
||||
if ((type << 16) + field != field_id)
|
||||
{
|
||||
return PARSE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
// we must inject the field at the canonical location....
|
||||
// so find that location
|
||||
unsigned char* start = (unsigned char*)(memory + sread_ptr);
|
||||
@@ -4748,19 +4611,12 @@ DEFINE_HOOK_FUNCTION(
|
||||
std::unique_ptr<STTx const> stpTrans;
|
||||
stpTrans = std::make_unique<STTx const>(std::ref(sitTrans));
|
||||
|
||||
if (!view.rules().enabled(fixHookAPI20251128))
|
||||
return Transactor::calculateBaseFee(
|
||||
*(applyCtx.app.openLedger().current()), *stpTrans)
|
||||
.drops();
|
||||
|
||||
return invoke_calculateBaseFee(
|
||||
return Transactor::calculateBaseFee(
|
||||
*(applyCtx.app.openLedger().current()), *stpTrans)
|
||||
.drops();
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
JLOG(j.trace()) << "HookInfo[" << HC_ACC()
|
||||
<< "]: etxn_fee_base exception: " << e.what();
|
||||
return INVALID_TXN;
|
||||
}
|
||||
|
||||
@@ -4932,7 +4788,7 @@ DEFINE_HOOK_FUNCTION(
|
||||
|
||||
if (float1 == 0)
|
||||
{
|
||||
j.trace() << "HookTrace[" << HC_ACC() << "]: "
|
||||
j.trace() << "HookTrace[" << HC_ACC() << "]:"
|
||||
<< (read_len == 0
|
||||
? ""
|
||||
: std::string_view(
|
||||
@@ -5546,7 +5402,7 @@ DEFINE_HOOK_FUNCTION(
|
||||
const int64_t float_one_internal = make_float(1000000000000000ull, -15, false);
|
||||
|
||||
inline int64_t
|
||||
float_divide_internal(int64_t float1, int64_t float2, bool hasFix)
|
||||
float_divide_internal(int64_t float1, int64_t float2)
|
||||
{
|
||||
RETURN_IF_INVALID_FLOAT(float1);
|
||||
RETURN_IF_INVALID_FLOAT(float2);
|
||||
@@ -5599,16 +5455,8 @@ float_divide_internal(int64_t float1, int64_t float2, bool hasFix)
|
||||
while (man2 > 0)
|
||||
{
|
||||
int i = 0;
|
||||
if (hasFix)
|
||||
{
|
||||
for (; man1 >= man2; man1 -= man2, ++i)
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (; man1 > man2; man1 -= man2, ++i)
|
||||
;
|
||||
}
|
||||
for (; man1 > man2; man1 -= man2, ++i)
|
||||
;
|
||||
|
||||
man3 *= 10;
|
||||
man3 += i;
|
||||
@@ -5628,8 +5476,7 @@ DEFINE_HOOK_FUNCTION(int64_t, float_divide, int64_t float1, int64_t float2)
|
||||
HOOK_SETUP(); // populates memory_ctx, memory, memory_length, applyCtx,
|
||||
// hookCtx on current stack
|
||||
|
||||
bool const hasFix = view.rules().enabled(fixFloatDivide);
|
||||
return float_divide_internal(float1, float2, hasFix);
|
||||
return float_divide_internal(float1, float2);
|
||||
|
||||
HOOK_TEARDOWN();
|
||||
}
|
||||
@@ -5648,9 +5495,7 @@ DEFINE_HOOK_FUNCTION(int64_t, float_invert, int64_t float1)
|
||||
return DIVISION_BY_ZERO;
|
||||
if (float1 == float_one_internal)
|
||||
return float_one_internal;
|
||||
|
||||
bool const fixV3 = view.rules().enabled(fixFloatDivide);
|
||||
return float_divide_internal(float_one_internal, float1, fixV3);
|
||||
return float_divide_internal(float_one_internal, float1);
|
||||
|
||||
HOOK_TEARDOWN();
|
||||
}
|
||||
@@ -6156,117 +6001,6 @@ DEFINE_HOOK_FUNCTION(
|
||||
|
||||
HOOK_TEARDOWN();
|
||||
}
|
||||
|
||||
// byteCount must be a multiple of 32
|
||||
inline std::vector<uint8_t>
|
||||
fairRng(ApplyContext& applyCtx, hook::HookResult& hr, uint32_t byteCount)
|
||||
{
|
||||
if (byteCount > 512)
|
||||
byteCount = 512;
|
||||
|
||||
// force the byte count to be a multiple of 32
|
||||
byteCount &= ~0b11111;
|
||||
|
||||
if (byteCount == 0)
|
||||
return {};
|
||||
|
||||
auto& view = applyCtx.view();
|
||||
|
||||
auto const sleRandom = view.peek(ripple::keylet::random());
|
||||
auto const seq = view.info().seq;
|
||||
|
||||
if (!sleRandom || sleRandom->getFieldU32(sfLedgerSequence) != seq ||
|
||||
sleRandom->getFieldU16(sfEntropyCount) < 5)
|
||||
return {};
|
||||
|
||||
// we'll generate bytes in lots of 32
|
||||
|
||||
uint256 rndData = sha512Half(
|
||||
view.info().seq,
|
||||
applyCtx.tx.getTransactionID(),
|
||||
hr.otxnAccount,
|
||||
hr.hookHash,
|
||||
hr.account,
|
||||
hr.hookChainPosition,
|
||||
hr.executeAgainAsWeak ? std::string("weak") : std::string("strong"),
|
||||
sleRandom->getFieldH256(sfRandomData),
|
||||
hr.rngCallCounter++);
|
||||
|
||||
std::vector<uint8_t> bytesOut;
|
||||
bytesOut.resize(byteCount);
|
||||
|
||||
uint8_t* ptr = bytesOut.data();
|
||||
while (1)
|
||||
{
|
||||
std::memcpy(ptr, rndData.data(), 32);
|
||||
ptr += 32;
|
||||
|
||||
if (ptr - bytesOut.data() >= byteCount)
|
||||
break;
|
||||
|
||||
rndData = sha512Half(rndData);
|
||||
}
|
||||
|
||||
return bytesOut;
|
||||
}
|
||||
|
||||
DEFINE_HOOK_FUNCTION(int64_t, dice, uint32_t sides)
|
||||
{
|
||||
HOOK_SETUP();
|
||||
|
||||
auto vec = fairRng(applyCtx, hookCtx.result, 32);
|
||||
|
||||
if (vec.empty())
|
||||
return TOO_LITTLE_ENTROPY;
|
||||
|
||||
if (vec.size() != 32)
|
||||
return INTERNAL_ERROR;
|
||||
|
||||
uint32_t value;
|
||||
std::memcpy(&value, vec.data(), sizeof(uint32_t));
|
||||
|
||||
return value % sides;
|
||||
|
||||
HOOK_TEARDOWN();
|
||||
}
|
||||
|
||||
DEFINE_HOOK_FUNCTION(int64_t, random, uint32_t write_ptr, uint32_t write_len)
|
||||
{
|
||||
HOOK_SETUP();
|
||||
|
||||
if (write_len == 0)
|
||||
return TOO_SMALL;
|
||||
|
||||
if (write_len > 512)
|
||||
return TOO_BIG;
|
||||
|
||||
uint32_t required = write_len;
|
||||
|
||||
if (required & ~0b11111 == required)
|
||||
{
|
||||
// already a multiple of 32 bytes
|
||||
}
|
||||
else
|
||||
{
|
||||
// round up
|
||||
required &= ~0b11111;
|
||||
required += 32;
|
||||
}
|
||||
|
||||
if (NOT_IN_BOUNDS(write_ptr, write_len, memory_length))
|
||||
return OUT_OF_BOUNDS;
|
||||
|
||||
auto vec = fairRng(applyCtx, hookCtx.result, required);
|
||||
|
||||
if (vec.empty())
|
||||
return TOO_LITTLE_ENTROPY;
|
||||
|
||||
WRITE_WASM_MEMORY_AND_RETURN(
|
||||
write_ptr, write_len, vec.data(), vec.size(), memory, memory_length);
|
||||
|
||||
HOOK_TEARDOWN();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
DEFINE_HOOK_FUNCTION(
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -38,21 +38,10 @@ public:
|
||||
virtual ~InboundLedgers() = default;
|
||||
|
||||
// VFALCO TODO Should this be called findOrAdd ?
|
||||
// Callers should use this if they possibly need an authoritative
|
||||
// response immediately.
|
||||
//
|
||||
virtual std::shared_ptr<Ledger const>
|
||||
acquire(uint256 const& hash, std::uint32_t seq, InboundLedger::Reason) = 0;
|
||||
|
||||
// Callers should use this if they are known to be executing on the Job
|
||||
// Queue. TODO review whether all callers of acquire() can use this
|
||||
// instead. Inbound ledger acquisition is asynchronous anyway.
|
||||
virtual void
|
||||
acquireAsync(
|
||||
uint256 const& hash,
|
||||
std::uint32_t seq,
|
||||
InboundLedger::Reason reason) = 0;
|
||||
|
||||
virtual std::shared_ptr<InboundLedger>
|
||||
find(LedgerHash const& hash) = 0;
|
||||
|
||||
|
||||
@@ -119,8 +119,9 @@ public:
|
||||
sles_type::value_type
|
||||
dereference() const override
|
||||
{
|
||||
SerialIter sit(iter_->slice());
|
||||
return std::make_shared<SLE const>(sit, iter_->key());
|
||||
auto const item = *iter_;
|
||||
SerialIter sit(item.slice());
|
||||
return std::make_shared<SLE const>(sit, item.key());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -167,7 +168,7 @@ public:
|
||||
txs_type::value_type
|
||||
dereference() const override
|
||||
{
|
||||
auto const& item = *iter_;
|
||||
auto const item = *iter_;
|
||||
if (metadata_)
|
||||
return deserializeTxPlusMeta(item);
|
||||
return {deserializeTx(item), nullptr};
|
||||
@@ -182,8 +183,8 @@ Ledger::Ledger(
|
||||
std::vector<uint256> const& amendments,
|
||||
Family& family)
|
||||
: mImmutable(false)
|
||||
, txMap_(SHAMapType::TRANSACTION, family)
|
||||
, stateMap_(SHAMapType::STATE, family)
|
||||
, txMap_(std::make_shared<SHAMap>(SHAMapType::TRANSACTION, family))
|
||||
, stateMap_(std::make_shared<SHAMap>(SHAMapType::STATE, family))
|
||||
, rules_{config.features}
|
||||
, j_(beast::Journal(beast::Journal::getNullSink()))
|
||||
{
|
||||
@@ -220,10 +221,7 @@ Ledger::Ledger(
|
||||
|
||||
{
|
||||
auto sle = std::make_shared<SLE>(keylet::fees());
|
||||
|
||||
uint32_t networkID = config.NETWORK_ID;
|
||||
if (networkID > 1024)
|
||||
sle->setFieldU32(sfNetworkID, networkID);
|
||||
sle->setFieldU32(sfNetworkID, config.NETWORK_ID);
|
||||
|
||||
// Whether featureXRPFees is supported will depend on startup options.
|
||||
if (std::find(amendments.begin(), amendments.end(), featureXRPFees) !=
|
||||
@@ -249,7 +247,7 @@ Ledger::Ledger(
|
||||
rawInsert(sle);
|
||||
}
|
||||
|
||||
stateMap_.flushDirty(hotACCOUNT_NODE);
|
||||
stateMap_->flushDirty(hotACCOUNT_NODE);
|
||||
setImmutable();
|
||||
}
|
||||
|
||||
@@ -261,8 +259,12 @@ Ledger::Ledger(
|
||||
Family& family,
|
||||
beast::Journal j)
|
||||
: mImmutable(true)
|
||||
, txMap_(SHAMapType::TRANSACTION, info.txHash, family)
|
||||
, stateMap_(SHAMapType::STATE, info.accountHash, family)
|
||||
, txMap_(std::make_shared<SHAMap>(
|
||||
SHAMapType::TRANSACTION,
|
||||
info.txHash,
|
||||
family))
|
||||
, stateMap_(
|
||||
std::make_shared<SHAMap>(SHAMapType::STATE, info.accountHash, family))
|
||||
, rules_(config.features)
|
||||
, info_(info)
|
||||
, j_(j)
|
||||
@@ -270,7 +272,7 @@ Ledger::Ledger(
|
||||
loaded = true;
|
||||
|
||||
if (info_.txHash.isNonZero() &&
|
||||
!txMap_.fetchRoot(SHAMapHash{info_.txHash}, nullptr))
|
||||
!txMap_->fetchRoot(SHAMapHash{info_.txHash}, nullptr))
|
||||
{
|
||||
if (config.reporting())
|
||||
{
|
||||
@@ -282,7 +284,7 @@ Ledger::Ledger(
|
||||
}
|
||||
|
||||
if (info_.accountHash.isNonZero() &&
|
||||
!stateMap_.fetchRoot(SHAMapHash{info_.accountHash}, nullptr))
|
||||
!stateMap_->fetchRoot(SHAMapHash{info_.accountHash}, nullptr))
|
||||
{
|
||||
if (config.reporting())
|
||||
{
|
||||
@@ -293,8 +295,8 @@ Ledger::Ledger(
|
||||
JLOG(j.warn()) << "Don't have state data root for ledger" << info_.seq;
|
||||
}
|
||||
|
||||
txMap_.setImmutable();
|
||||
stateMap_.setImmutable();
|
||||
txMap_->setImmutable();
|
||||
stateMap_->setImmutable();
|
||||
|
||||
defaultFees(config);
|
||||
if (!setup())
|
||||
@@ -308,25 +310,13 @@ Ledger::Ledger(
|
||||
}
|
||||
}
|
||||
|
||||
Ledger::Ledger(
|
||||
LedgerInfo& info,
|
||||
Config const& config,
|
||||
Family& family,
|
||||
SHAMap const& baseState)
|
||||
: mImmutable(false)
|
||||
, txMap_(SHAMapType::TRANSACTION, family)
|
||||
, stateMap_(baseState, true)
|
||||
, rules_{config.features}
|
||||
, info_(info)
|
||||
, j_(beast::Journal(beast::Journal::getNullSink()))
|
||||
{
|
||||
}
|
||||
|
||||
// Create a new ledger that follows this one
|
||||
Ledger::Ledger(Ledger const& prevLedger, NetClock::time_point closeTime)
|
||||
: mImmutable(false)
|
||||
, txMap_(SHAMapType::TRANSACTION, prevLedger.txMap_.family())
|
||||
, stateMap_(prevLedger.stateMap_, true)
|
||||
, txMap_(std::make_shared<SHAMap>(
|
||||
SHAMapType::TRANSACTION,
|
||||
prevLedger.stateMap_->family()))
|
||||
, stateMap_(prevLedger.stateMap_->snapShot(true))
|
||||
, fees_(prevLedger.fees_)
|
||||
, rules_(prevLedger.rules_)
|
||||
, j_(beast::Journal(beast::Journal::getNullSink()))
|
||||
@@ -355,8 +345,12 @@ Ledger::Ledger(Ledger const& prevLedger, NetClock::time_point closeTime)
|
||||
|
||||
Ledger::Ledger(LedgerInfo const& info, Config const& config, Family& family)
|
||||
: mImmutable(true)
|
||||
, txMap_(SHAMapType::TRANSACTION, info.txHash, family)
|
||||
, stateMap_(SHAMapType::STATE, info.accountHash, family)
|
||||
, txMap_(std::make_shared<SHAMap>(
|
||||
SHAMapType::TRANSACTION,
|
||||
info.txHash,
|
||||
family))
|
||||
, stateMap_(
|
||||
std::make_shared<SHAMap>(SHAMapType::STATE, info.accountHash, family))
|
||||
, rules_{config.features}
|
||||
, info_(info)
|
||||
, j_(beast::Journal(beast::Journal::getNullSink()))
|
||||
@@ -370,8 +364,8 @@ Ledger::Ledger(
|
||||
Config const& config,
|
||||
Family& family)
|
||||
: mImmutable(false)
|
||||
, txMap_(SHAMapType::TRANSACTION, family)
|
||||
, stateMap_(SHAMapType::STATE, family)
|
||||
, txMap_(std::make_shared<SHAMap>(SHAMapType::TRANSACTION, family))
|
||||
, stateMap_(std::make_shared<SHAMap>(SHAMapType::STATE, family))
|
||||
, rules_{config.features}
|
||||
, j_(beast::Journal(beast::Journal::getNullSink()))
|
||||
{
|
||||
@@ -389,32 +383,19 @@ Ledger::setImmutable(bool rehash)
|
||||
// place the hash transitions to valid
|
||||
if (!mImmutable && rehash)
|
||||
{
|
||||
info_.txHash = txMap_.getHash().as_uint256();
|
||||
info_.accountHash = stateMap_.getHash().as_uint256();
|
||||
info_.txHash = txMap_->getHash().as_uint256();
|
||||
info_.accountHash = stateMap_->getHash().as_uint256();
|
||||
}
|
||||
|
||||
if (rehash)
|
||||
info_.hash = calculateLedgerHash(info_);
|
||||
|
||||
mImmutable = true;
|
||||
txMap_.setImmutable();
|
||||
stateMap_.setImmutable();
|
||||
txMap_->setImmutable();
|
||||
stateMap_->setImmutable();
|
||||
setup();
|
||||
}
|
||||
|
||||
// raw setters for catalogue
|
||||
void
|
||||
Ledger::setCloseFlags(int closeFlags)
|
||||
{
|
||||
info_.closeFlags = closeFlags;
|
||||
}
|
||||
|
||||
void
|
||||
Ledger::setDrops(uint64_t drops)
|
||||
{
|
||||
info_.drops = drops;
|
||||
}
|
||||
|
||||
void
|
||||
Ledger::setAccepted(
|
||||
NetClock::time_point closeTime,
|
||||
@@ -434,8 +415,8 @@ bool
|
||||
Ledger::addSLE(SLE const& sle)
|
||||
{
|
||||
auto const s = sle.getSerializer();
|
||||
return stateMap_.addItem(
|
||||
SHAMapNodeType::tnACCOUNT_STATE, make_shamapitem(sle.key(), s.slice()));
|
||||
SHAMapItem item(sle.key(), s.slice());
|
||||
return stateMap_->addItem(SHAMapNodeType::tnACCOUNT_STATE, std::move(item));
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -470,20 +451,20 @@ bool
|
||||
Ledger::exists(Keylet const& k) const
|
||||
{
|
||||
// VFALCO NOTE Perhaps check the type for debug builds?
|
||||
return stateMap_.hasItem(k.key);
|
||||
return stateMap_->hasItem(k.key);
|
||||
}
|
||||
|
||||
bool
|
||||
Ledger::exists(uint256 const& key) const
|
||||
{
|
||||
return stateMap_.hasItem(key);
|
||||
return stateMap_->hasItem(key);
|
||||
}
|
||||
|
||||
std::optional<uint256>
|
||||
Ledger::succ(uint256 const& key, std::optional<uint256> const& last) const
|
||||
{
|
||||
auto item = stateMap_.upper_bound(key);
|
||||
if (item == stateMap_.end())
|
||||
auto item = stateMap_->upper_bound(key);
|
||||
if (item == stateMap_->end())
|
||||
return std::nullopt;
|
||||
if (last && item->key() >= last)
|
||||
return std::nullopt;
|
||||
@@ -498,7 +479,7 @@ Ledger::read(Keylet const& k) const
|
||||
assert(false);
|
||||
return nullptr;
|
||||
}
|
||||
auto const& item = stateMap_.peekItem(k.key);
|
||||
auto const& item = stateMap_->peekItem(k.key);
|
||||
if (!item)
|
||||
return nullptr;
|
||||
auto sle = std::make_shared<SLE>(SerialIter{item->slice()}, item->key());
|
||||
@@ -512,44 +493,45 @@ Ledger::read(Keylet const& k) const
|
||||
auto
|
||||
Ledger::slesBegin() const -> std::unique_ptr<sles_type::iter_base>
|
||||
{
|
||||
return std::make_unique<sles_iter_impl>(stateMap_.begin());
|
||||
return std::make_unique<sles_iter_impl>(stateMap_->begin());
|
||||
}
|
||||
|
||||
auto
|
||||
Ledger::slesEnd() const -> std::unique_ptr<sles_type::iter_base>
|
||||
{
|
||||
return std::make_unique<sles_iter_impl>(stateMap_.end());
|
||||
return std::make_unique<sles_iter_impl>(stateMap_->end());
|
||||
}
|
||||
|
||||
auto
|
||||
Ledger::slesUpperBound(uint256 const& key) const
|
||||
-> std::unique_ptr<sles_type::iter_base>
|
||||
{
|
||||
return std::make_unique<sles_iter_impl>(stateMap_.upper_bound(key));
|
||||
return std::make_unique<sles_iter_impl>(stateMap_->upper_bound(key));
|
||||
}
|
||||
|
||||
auto
|
||||
Ledger::txsBegin() const -> std::unique_ptr<txs_type::iter_base>
|
||||
{
|
||||
return std::make_unique<txs_iter_impl>(!open(), txMap_.begin());
|
||||
return std::make_unique<txs_iter_impl>(!open(), txMap_->begin());
|
||||
}
|
||||
|
||||
auto
|
||||
Ledger::txsEnd() const -> std::unique_ptr<txs_type::iter_base>
|
||||
{
|
||||
return std::make_unique<txs_iter_impl>(!open(), txMap_.end());
|
||||
return std::make_unique<txs_iter_impl>(!open(), txMap_->end());
|
||||
}
|
||||
|
||||
bool
|
||||
Ledger::txExists(uint256 const& key) const
|
||||
{
|
||||
return txMap_.hasItem(key);
|
||||
return txMap_->hasItem(key);
|
||||
}
|
||||
|
||||
auto
|
||||
Ledger::txRead(key_type const& key) const -> tx_type
|
||||
{
|
||||
auto const& item = txMap_.peekItem(key);
|
||||
assert(txMap_);
|
||||
auto const& item = txMap_->peekItem(key);
|
||||
if (!item)
|
||||
return {};
|
||||
if (!open())
|
||||
@@ -566,7 +548,7 @@ Ledger::digest(key_type const& key) const -> std::optional<digest_type>
|
||||
SHAMapHash digest;
|
||||
// VFALCO Unfortunately this loads the item
|
||||
// from the NodeStore needlessly.
|
||||
if (!stateMap_.peekItem(key, digest))
|
||||
if (!stateMap_->peekItem(key, digest))
|
||||
return std::nullopt;
|
||||
return digest.as_uint256();
|
||||
}
|
||||
@@ -576,14 +558,14 @@ Ledger::digest(key_type const& key) const -> std::optional<digest_type>
|
||||
void
|
||||
Ledger::rawErase(std::shared_ptr<SLE> const& sle)
|
||||
{
|
||||
if (!stateMap_.delItem(sle->key()))
|
||||
if (!stateMap_->delItem(sle->key()))
|
||||
LogicError("Ledger::rawErase: key not found");
|
||||
}
|
||||
|
||||
void
|
||||
Ledger::rawErase(uint256 const& key)
|
||||
{
|
||||
if (!stateMap_.delItem(key))
|
||||
if (!stateMap_->delItem(key))
|
||||
LogicError("Ledger::rawErase: key not found");
|
||||
}
|
||||
|
||||
@@ -592,9 +574,9 @@ Ledger::rawInsert(std::shared_ptr<SLE> const& sle)
|
||||
{
|
||||
Serializer ss;
|
||||
sle->add(ss);
|
||||
if (!stateMap_.addGiveItem(
|
||||
if (!stateMap_->addGiveItem(
|
||||
SHAMapNodeType::tnACCOUNT_STATE,
|
||||
make_shamapitem(sle->key(), ss.slice())))
|
||||
std::make_shared<SHAMapItem const>(sle->key(), ss.slice())))
|
||||
LogicError("Ledger::rawInsert: key already exists");
|
||||
}
|
||||
|
||||
@@ -603,9 +585,9 @@ Ledger::rawReplace(std::shared_ptr<SLE> const& sle)
|
||||
{
|
||||
Serializer ss;
|
||||
sle->add(ss);
|
||||
if (!stateMap_.updateGiveItem(
|
||||
if (!stateMap_->updateGiveItem(
|
||||
SHAMapNodeType::tnACCOUNT_STATE,
|
||||
make_shamapitem(sle->key(), ss.slice())))
|
||||
std::make_shared<SHAMapItem const>(sle->key(), ss.slice())))
|
||||
LogicError("Ledger::rawReplace: key not found");
|
||||
}
|
||||
|
||||
@@ -621,8 +603,9 @@ Ledger::rawTxInsert(
|
||||
Serializer s(txn->getDataLength() + metaData->getDataLength() + 16);
|
||||
s.addVL(txn->peekData());
|
||||
s.addVL(metaData->peekData());
|
||||
if (!txMap_.addGiveItem(
|
||||
SHAMapNodeType::tnTRANSACTION_MD, make_shamapitem(key, s.slice())))
|
||||
if (!txMap().addGiveItem(
|
||||
SHAMapNodeType::tnTRANSACTION_MD,
|
||||
std::make_shared<SHAMapItem const>(key, s.slice())))
|
||||
LogicError("duplicate_tx: " + to_string(key));
|
||||
}
|
||||
|
||||
@@ -638,9 +621,9 @@ Ledger::rawTxInsertWithHash(
|
||||
Serializer s(txn->getDataLength() + metaData->getDataLength() + 16);
|
||||
s.addVL(txn->peekData());
|
||||
s.addVL(metaData->peekData());
|
||||
auto item = make_shamapitem(key, s.slice());
|
||||
auto item = std::make_shared<SHAMapItem const>(key, s.slice());
|
||||
auto hash = sha512Half(HashPrefix::txNode, item->slice(), item->key());
|
||||
if (!txMap_.addGiveItem(SHAMapNodeType::tnTRANSACTION_MD, std::move(item)))
|
||||
if (!txMap().addGiveItem(SHAMapNodeType::tnTRANSACTION_MD, std::move(item)))
|
||||
LogicError("duplicate_tx: " + to_string(key));
|
||||
|
||||
return hash;
|
||||
@@ -740,7 +723,7 @@ Ledger::defaultFees(Config const& config)
|
||||
std::shared_ptr<SLE>
|
||||
Ledger::peek(Keylet const& k) const
|
||||
{
|
||||
auto const& value = stateMap_.peekItem(k.key);
|
||||
auto const& value = stateMap_->peekItem(k.key);
|
||||
if (!value)
|
||||
return nullptr;
|
||||
auto sle = std::make_shared<SLE>(SerialIter{value->slice()}, value->key());
|
||||
@@ -862,8 +845,8 @@ Ledger::walkLedger(beast::Journal j, bool parallel) const
|
||||
std::vector<SHAMapMissingNode> missingNodes1;
|
||||
std::vector<SHAMapMissingNode> missingNodes2;
|
||||
|
||||
if (stateMap_.getHash().isZero() && !info_.accountHash.isZero() &&
|
||||
!stateMap_.fetchRoot(SHAMapHash{info_.accountHash}, nullptr))
|
||||
if (stateMap_->getHash().isZero() && !info_.accountHash.isZero() &&
|
||||
!stateMap_->fetchRoot(SHAMapHash{info_.accountHash}, nullptr))
|
||||
{
|
||||
missingNodes1.emplace_back(
|
||||
SHAMapType::STATE, SHAMapHash{info_.accountHash});
|
||||
@@ -871,9 +854,9 @@ Ledger::walkLedger(beast::Journal j, bool parallel) const
|
||||
else
|
||||
{
|
||||
if (parallel)
|
||||
return stateMap_.walkMapParallel(missingNodes1, 32);
|
||||
return stateMap_->walkMapParallel(missingNodes1, 32);
|
||||
else
|
||||
stateMap_.walkMap(missingNodes1, 32);
|
||||
stateMap_->walkMap(missingNodes1, 32);
|
||||
}
|
||||
|
||||
if (!missingNodes1.empty())
|
||||
@@ -885,15 +868,15 @@ Ledger::walkLedger(beast::Journal j, bool parallel) const
|
||||
}
|
||||
}
|
||||
|
||||
if (txMap_.getHash().isZero() && info_.txHash.isNonZero() &&
|
||||
!txMap_.fetchRoot(SHAMapHash{info_.txHash}, nullptr))
|
||||
if (txMap_->getHash().isZero() && info_.txHash.isNonZero() &&
|
||||
!txMap_->fetchRoot(SHAMapHash{info_.txHash}, nullptr))
|
||||
{
|
||||
missingNodes2.emplace_back(
|
||||
SHAMapType::TRANSACTION, SHAMapHash{info_.txHash});
|
||||
}
|
||||
else
|
||||
{
|
||||
txMap_.walkMap(missingNodes2, 32);
|
||||
txMap_->walkMap(missingNodes2, 32);
|
||||
}
|
||||
|
||||
if (!missingNodes2.empty())
|
||||
@@ -910,9 +893,9 @@ Ledger::walkLedger(beast::Journal j, bool parallel) const
|
||||
bool
|
||||
Ledger::assertSensible(beast::Journal ledgerJ) const
|
||||
{
|
||||
if (info_.hash.isNonZero() && info_.accountHash.isNonZero() &&
|
||||
(info_.accountHash == stateMap_.getHash().as_uint256()) &&
|
||||
(info_.txHash == txMap_.getHash().as_uint256()))
|
||||
if (info_.hash.isNonZero() && info_.accountHash.isNonZero() && stateMap_ &&
|
||||
txMap_ && (info_.accountHash == stateMap_->getHash().as_uint256()) &&
|
||||
(info_.txHash == txMap_->getHash().as_uint256()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -1074,14 +1057,15 @@ pendSaveValidated(
|
||||
return true;
|
||||
}
|
||||
|
||||
JobType const jobType{isCurrent ? jtPUBLEDGER : jtPUBOLDLEDGER};
|
||||
char const* const jobName{
|
||||
isCurrent ? "Ledger::pendSave" : "Ledger::pendOldSave"};
|
||||
|
||||
// See if we can use the JobQueue.
|
||||
if (!isSynchronous &&
|
||||
app.getJobQueue().addJob(
|
||||
isCurrent ? jtPUBLEDGER : jtPUBOLDLEDGER,
|
||||
std::to_string(ledger->seq()),
|
||||
[&app, ledger, isCurrent]() {
|
||||
saveValidatedLedger(app, ledger, isCurrent);
|
||||
}))
|
||||
app.getJobQueue().addJob(jobType, jobName, [&app, ledger, isCurrent]() {
|
||||
saveValidatedLedger(app, ledger, isCurrent);
|
||||
}))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -1093,15 +1077,15 @@ pendSaveValidated(
|
||||
void
|
||||
Ledger::unshare() const
|
||||
{
|
||||
stateMap_.unshare();
|
||||
txMap_.unshare();
|
||||
stateMap_->unshare();
|
||||
txMap_->unshare();
|
||||
}
|
||||
|
||||
void
|
||||
Ledger::invariants() const
|
||||
{
|
||||
stateMap_.invariants();
|
||||
txMap_.invariants();
|
||||
stateMap_->invariants();
|
||||
txMap_->invariants();
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -83,10 +83,6 @@ public:
|
||||
Ledger&
|
||||
operator=(Ledger const&) = delete;
|
||||
|
||||
Ledger(Ledger&&) = delete;
|
||||
Ledger&
|
||||
operator=(Ledger&&) = delete;
|
||||
|
||||
/** Create the Genesis ledger.
|
||||
|
||||
The Genesis ledger contains a single account whose
|
||||
@@ -121,13 +117,6 @@ public:
|
||||
Family& family,
|
||||
beast::Journal j);
|
||||
|
||||
// used when loading ledgers from catalogue files
|
||||
Ledger(
|
||||
LedgerInfo& info,
|
||||
Config const& config,
|
||||
Family& family,
|
||||
SHAMap const& baseState);
|
||||
|
||||
/** Create a new ledger following a previous ledger
|
||||
|
||||
The ledger will have the sequence number that
|
||||
@@ -282,12 +271,6 @@ public:
|
||||
void
|
||||
setImmutable(bool rehash = true);
|
||||
|
||||
void
|
||||
setCloseFlags(int closeFlags);
|
||||
|
||||
void
|
||||
setDrops(uint64_t drops);
|
||||
|
||||
bool
|
||||
isImmutable() const
|
||||
{
|
||||
@@ -307,10 +290,10 @@ public:
|
||||
void
|
||||
setFull() const
|
||||
{
|
||||
txMap_.setFull();
|
||||
txMap_.setLedgerSeq(info_.seq);
|
||||
stateMap_.setFull();
|
||||
stateMap_.setLedgerSeq(info_.seq);
|
||||
txMap_->setFull();
|
||||
stateMap_->setFull();
|
||||
txMap_->setLedgerSeq(info_.seq);
|
||||
stateMap_->setLedgerSeq(info_.seq);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -322,25 +305,25 @@ public:
|
||||
SHAMap const&
|
||||
stateMap() const
|
||||
{
|
||||
return stateMap_;
|
||||
return *stateMap_;
|
||||
}
|
||||
|
||||
SHAMap&
|
||||
stateMap()
|
||||
{
|
||||
return stateMap_;
|
||||
return *stateMap_;
|
||||
}
|
||||
|
||||
SHAMap const&
|
||||
txMap() const
|
||||
{
|
||||
return txMap_;
|
||||
return *txMap_;
|
||||
}
|
||||
|
||||
SHAMap&
|
||||
txMap()
|
||||
{
|
||||
return txMap_;
|
||||
return *txMap_;
|
||||
}
|
||||
|
||||
// returns false on error
|
||||
@@ -418,11 +401,8 @@ private:
|
||||
|
||||
bool mImmutable;
|
||||
|
||||
// A SHAMap containing the transactions associated with this ledger.
|
||||
SHAMap mutable txMap_;
|
||||
|
||||
// A SHAMap containing the state objects for this ledger.
|
||||
SHAMap mutable stateMap_;
|
||||
std::shared_ptr<SHAMap> txMap_;
|
||||
std::shared_ptr<SHAMap> stateMap_;
|
||||
|
||||
// Protects fee variables
|
||||
std::mutex mutable mutex_;
|
||||
|
||||
@@ -51,9 +51,7 @@ LedgerHistory::LedgerHistory(
|
||||
}
|
||||
|
||||
bool
|
||||
LedgerHistory::insert(
|
||||
std::shared_ptr<Ledger const> const& ledger,
|
||||
bool validated)
|
||||
LedgerHistory::insert(std::shared_ptr<Ledger const> ledger, bool validated)
|
||||
{
|
||||
if (!ledger->isImmutable())
|
||||
LogicError("mutable Ledger in insert");
|
||||
@@ -74,9 +72,12 @@ LedgerHash
|
||||
LedgerHistory::getLedgerHash(LedgerIndex index)
|
||||
{
|
||||
std::unique_lock sl(m_ledgers_by_hash.peekMutex());
|
||||
if (auto it = mLedgersByIndex.find(index); it != mLedgersByIndex.end())
|
||||
auto it = mLedgersByIndex.find(index);
|
||||
|
||||
if (it != mLedgersByIndex.end())
|
||||
return it->second;
|
||||
return {};
|
||||
|
||||
return uint256();
|
||||
}
|
||||
|
||||
std::shared_ptr<Ledger const>
|
||||
@@ -166,19 +167,19 @@ log_metadata_difference(
|
||||
uint256 const& tx,
|
||||
beast::Journal j)
|
||||
{
|
||||
auto getMeta = [](ReadView const& ledger, uint256 const& txID) {
|
||||
std::optional<TxMeta> ret;
|
||||
if (auto meta = ledger.txRead(txID).second)
|
||||
ret.emplace(txID, ledger.seq(), *meta);
|
||||
return ret;
|
||||
auto getMeta = [](ReadView const& ledger,
|
||||
uint256 const& txID) -> std::shared_ptr<TxMeta> {
|
||||
auto meta = ledger.txRead(txID).second;
|
||||
if (!meta)
|
||||
return {};
|
||||
return std::make_shared<TxMeta>(txID, ledger.seq(), *meta);
|
||||
};
|
||||
|
||||
auto validMetaData = getMeta(validLedger, tx);
|
||||
auto builtMetaData = getMeta(builtLedger, tx);
|
||||
assert(validMetaData != nullptr || builtMetaData != nullptr);
|
||||
|
||||
assert(validMetaData || builtMetaData);
|
||||
|
||||
if (validMetaData && builtMetaData)
|
||||
if (validMetaData != nullptr && builtMetaData != nullptr)
|
||||
{
|
||||
auto const& validNodes = validMetaData->getNodes();
|
||||
auto const& builtNodes = builtMetaData->getNodes();
|
||||
@@ -279,21 +280,17 @@ log_metadata_difference(
|
||||
<< validNodes.getJson(JsonOptions::none);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (validMetaData)
|
||||
else if (validMetaData != nullptr)
|
||||
{
|
||||
JLOG(j.error()) << "MISMATCH on TX " << tx
|
||||
<< ": Metadata Difference. Valid=\n"
|
||||
<< ": Metadata Difference (built has none)\n"
|
||||
<< validMetaData->getJson(JsonOptions::none);
|
||||
}
|
||||
|
||||
if (builtMetaData)
|
||||
else // builtMetaData != nullptr
|
||||
{
|
||||
JLOG(j.error()) << "MISMATCH on TX " << tx
|
||||
<< ": Metadata Difference. Built=\n"
|
||||
<< ": Metadata Difference (valid has none)\n"
|
||||
<< builtMetaData->getJson(JsonOptions::none);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
@return `true` if the ledger was already tracked
|
||||
*/
|
||||
bool
|
||||
insert(std::shared_ptr<Ledger const> const& ledger, bool validated);
|
||||
insert(std::shared_ptr<Ledger const> ledger, bool validated);
|
||||
|
||||
/** Get the ledgers_by_hash cache hit rate
|
||||
@return the hit rate
|
||||
@@ -70,6 +70,8 @@ public:
|
||||
LedgerHash
|
||||
getLedgerHash(LedgerIndex ledgerIndex);
|
||||
|
||||
/** Remove stale cache entries
|
||||
*/
|
||||
void
|
||||
sweep()
|
||||
{
|
||||
|
||||
@@ -128,7 +128,7 @@ public:
|
||||
getEarliestFetch();
|
||||
|
||||
bool
|
||||
storeLedger(std::shared_ptr<Ledger const> ledger, bool pin = false);
|
||||
storeLedger(std::shared_ptr<Ledger const> ledger);
|
||||
|
||||
void
|
||||
setFullLedger(
|
||||
@@ -152,15 +152,6 @@ public:
|
||||
std::string
|
||||
getCompleteLedgers();
|
||||
|
||||
std::string
|
||||
getPinnedLedgers();
|
||||
|
||||
RangeSet<std::uint32_t>
|
||||
getCompleteLedgersRangeSet();
|
||||
|
||||
RangeSet<std::uint32_t>
|
||||
getPinnedLedgersRangeSet();
|
||||
|
||||
/** Apply held transactions to the open ledger
|
||||
This is normally called as we close the ledger.
|
||||
The open ledger remains open to handle new transactions
|
||||
@@ -206,10 +197,7 @@ public:
|
||||
getLedgerByHash(uint256 const& hash);
|
||||
|
||||
void
|
||||
setLedgerRangePresent(
|
||||
std::uint32_t minV,
|
||||
std::uint32_t maxV,
|
||||
bool pin = false /* if true, do not let these leaders be removed */);
|
||||
setLedgerRangePresent(std::uint32_t minV, std::uint32_t maxV);
|
||||
|
||||
std::optional<NetClock::time_point>
|
||||
getCloseTimeBySeq(LedgerIndex ledgerIndex);
|
||||
@@ -382,7 +370,6 @@ private:
|
||||
|
||||
std::recursive_mutex mCompleteLock;
|
||||
RangeSet<std::uint32_t> mCompleteLedgers;
|
||||
RangeSet<std::uint32_t> mPinnedLedgers; // Track pinned ledger ranges
|
||||
|
||||
// Publish thread is running.
|
||||
bool mAdvanceThread{false};
|
||||
|
||||
@@ -105,7 +105,7 @@ public:
|
||||
void
|
||||
gotSkipList(
|
||||
LedgerInfo const& info,
|
||||
boost::intrusive_ptr<SHAMapItem const> const& data);
|
||||
std::shared_ptr<SHAMapItem const> const& data);
|
||||
|
||||
/**
|
||||
* Process a ledger delta (extracted from a TMReplayDeltaResponse message)
|
||||
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
|
||||
std::shared_ptr<STTx const>
|
||||
fetch(
|
||||
boost::intrusive_ptr<SHAMapItem> const& item,
|
||||
std::shared_ptr<SHAMapItem> const& item,
|
||||
SHAMapNodeType type,
|
||||
std::uint32_t uCommitLedger);
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include <ripple/app/misc/CanonicalTXSet.h>
|
||||
#include <ripple/app/tx/apply.h>
|
||||
#include <ripple/protocol/Feature.h>
|
||||
#include <ripple/protocol/digest.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
@@ -104,50 +103,6 @@ applyTransactions(
|
||||
bool certainRetry = true;
|
||||
std::size_t count = 0;
|
||||
|
||||
// apply the ttSHUFFLE txns first in the ledger to
|
||||
// ensure no one can predict the outcome
|
||||
// then apply ttENTROPY transactions
|
||||
if (view.rules().enabled(featureRNG))
|
||||
for (auto tt : {ttSHUFFLE, ttENTROPY})
|
||||
{
|
||||
for (auto it = txns.begin(); it != txns.end();)
|
||||
{
|
||||
if (tt != it->second->getFieldU16(sfTransactionType))
|
||||
{
|
||||
++it;
|
||||
continue;
|
||||
}
|
||||
|
||||
auto const txid = it->first.getTXID();
|
||||
try
|
||||
{
|
||||
switch (applyTransaction(
|
||||
app, view, *it->second, certainRetry, tapNONE, j))
|
||||
{
|
||||
case ApplyResult::Success:
|
||||
it = txns.erase(it);
|
||||
++count;
|
||||
break;
|
||||
|
||||
case ApplyResult::Fail:
|
||||
failed.insert(txid);
|
||||
it = txns.erase(it);
|
||||
break;
|
||||
|
||||
case ApplyResult::Retry:
|
||||
++it;
|
||||
}
|
||||
}
|
||||
catch (std::exception const& ex)
|
||||
{
|
||||
JLOG(j.warn())
|
||||
<< "Transaction " << txid << " throws: " << ex.what();
|
||||
failed.insert(txid);
|
||||
it = txns.erase(it);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Attempt to apply all of the retriable transactions
|
||||
for (int pass = 0; pass < LEDGER_TOTAL_PASSES; ++pass)
|
||||
{
|
||||
@@ -161,8 +116,10 @@ applyTransactions(
|
||||
{
|
||||
auto const txid = it->first.getTXID();
|
||||
|
||||
#ifndef DEBUG
|
||||
try
|
||||
{
|
||||
#endif
|
||||
if (pass == 0 && built->txExists(txid))
|
||||
{
|
||||
it = txns.erase(it);
|
||||
@@ -185,6 +142,7 @@ applyTransactions(
|
||||
case ApplyResult::Retry:
|
||||
++it;
|
||||
}
|
||||
#ifndef DEBUG
|
||||
}
|
||||
catch (std::exception const& ex)
|
||||
{
|
||||
@@ -193,6 +151,7 @@ applyTransactions(
|
||||
failed.insert(txid);
|
||||
it = txns.erase(it);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
JLOG(j.debug()) << (certainRetry ? "Pass: " : "Final pass: ") << pass
|
||||
|
||||
@@ -560,7 +560,7 @@ InboundLedger::trigger(std::shared_ptr<Peer> const& peer, TriggerReason reason)
|
||||
return;
|
||||
}
|
||||
|
||||
if (auto stream = journal_.debug())
|
||||
if (auto stream = journal_.trace())
|
||||
{
|
||||
if (peer)
|
||||
stream << "Trigger acquiring ledger " << hash_ << " from " << peer;
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include <ripple/core/JobQueue.h>
|
||||
#include <ripple/nodestore/DatabaseShard.h>
|
||||
#include <ripple/protocol/jss.h>
|
||||
#include <exception>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
@@ -142,37 +141,6 @@ public:
|
||||
return inbound->getLedger();
|
||||
}
|
||||
|
||||
void
|
||||
acquireAsync(
|
||||
uint256 const& hash,
|
||||
std::uint32_t seq,
|
||||
InboundLedger::Reason reason) override
|
||||
{
|
||||
std::unique_lock lock(acquiresMutex_);
|
||||
try
|
||||
{
|
||||
if (pendingAcquires_.contains(hash))
|
||||
return;
|
||||
pendingAcquires_.insert(hash);
|
||||
lock.unlock();
|
||||
acquire(hash, seq, reason);
|
||||
}
|
||||
catch (std::exception const& e)
|
||||
{
|
||||
JLOG(j_.warn())
|
||||
<< "Exception thrown for acquiring new inbound ledger " << hash
|
||||
<< ": " << e.what();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
JLOG(j_.warn())
|
||||
<< "Unknown exception thrown for acquiring new inbound ledger "
|
||||
<< hash;
|
||||
}
|
||||
lock.lock();
|
||||
pendingAcquires_.erase(hash);
|
||||
}
|
||||
|
||||
std::shared_ptr<InboundLedger>
|
||||
find(uint256 const& hash) override
|
||||
{
|
||||
@@ -458,9 +426,6 @@ private:
|
||||
beast::insight::Counter mCounter;
|
||||
|
||||
std::unique_ptr<PeerSetBuilder> mPeerSetBuilder;
|
||||
|
||||
std::set<uint256> pendingAcquires_;
|
||||
std::mutex acquiresMutex_;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -219,7 +219,7 @@ private:
|
||||
run()
|
||||
{
|
||||
beast::setCurrentThreadName("LedgerCleaner");
|
||||
JLOG(j_.debug()) << "Started ledger cleaner";
|
||||
JLOG(j_.debug()) << "Started";
|
||||
|
||||
while (true)
|
||||
{
|
||||
@@ -392,8 +392,7 @@ private:
|
||||
|
||||
if (app_.getFeeTrack().isLoadedLocal())
|
||||
{
|
||||
JLOG(j_.debug())
|
||||
<< "Ledger Cleaner: Waiting for load to subside";
|
||||
JLOG(j_.debug()) << "Waiting for load to subside";
|
||||
std::this_thread::sleep_for(std::chrono::seconds(5));
|
||||
continue;
|
||||
}
|
||||
@@ -416,15 +415,13 @@ private:
|
||||
bool fail = false;
|
||||
if (ledgerHash.isZero())
|
||||
{
|
||||
JLOG(j_.warn())
|
||||
<< "Ledger Cleaner: Unable to get hash for ledger "
|
||||
<< ledgerIndex;
|
||||
JLOG(j_.info())
|
||||
<< "Unable to get hash for ledger " << ledgerIndex;
|
||||
fail = true;
|
||||
}
|
||||
else if (!doLedger(ledgerIndex, ledgerHash, doNodes, doTxns))
|
||||
{
|
||||
JLOG(j_.warn()) << "Ledger Cleaner: Failed to process ledger "
|
||||
<< ledgerIndex;
|
||||
JLOG(j_.info()) << "Failed to process ledger " << ledgerIndex;
|
||||
fail = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -533,20 +533,11 @@ LedgerMaster::fixIndex(LedgerIndex ledgerIndex, LedgerHash const& ledgerHash)
|
||||
}
|
||||
|
||||
bool
|
||||
LedgerMaster::storeLedger(std::shared_ptr<Ledger const> ledger, bool pin)
|
||||
LedgerMaster::storeLedger(std::shared_ptr<Ledger const> ledger)
|
||||
{
|
||||
bool validated = ledger->info().validated;
|
||||
// Returns true if we already had the ledger
|
||||
if (!mLedgerHistory.insert(std::move(ledger), validated))
|
||||
return false;
|
||||
|
||||
if (pin)
|
||||
{
|
||||
uint32_t seq = ledger->info().seq;
|
||||
mPinnedLedgers.insert(range(seq, seq));
|
||||
JLOG(m_journal.info()) << "Pinned ledger : " << seq;
|
||||
}
|
||||
return true;
|
||||
return mLedgerHistory.insert(std::move(ledger), validated);
|
||||
}
|
||||
|
||||
/** Apply held transactions to the open ledger
|
||||
@@ -604,15 +595,6 @@ void
|
||||
LedgerMaster::clearLedger(std::uint32_t seq)
|
||||
{
|
||||
std::lock_guard sl(mCompleteLock);
|
||||
|
||||
// Don't clear pinned ledgers
|
||||
if (boost::icl::contains(mPinnedLedgers, seq))
|
||||
{
|
||||
JLOG(m_journal.trace())
|
||||
<< "Ledger " << seq << " is pinned, not clearing";
|
||||
return;
|
||||
}
|
||||
|
||||
mCompleteLedgers.erase(seq);
|
||||
}
|
||||
|
||||
@@ -1732,27 +1714,6 @@ LedgerMaster::getCompleteLedgers()
|
||||
return to_string(mCompleteLedgers);
|
||||
}
|
||||
|
||||
std::string
|
||||
LedgerMaster::getPinnedLedgers()
|
||||
{
|
||||
std::lock_guard sl(mCompleteLock);
|
||||
return to_string(mPinnedLedgers);
|
||||
}
|
||||
|
||||
RangeSet<std::uint32_t>
|
||||
LedgerMaster::getCompleteLedgersRangeSet()
|
||||
{
|
||||
std::lock_guard sl(mCompleteLock);
|
||||
return mCompleteLedgers;
|
||||
}
|
||||
|
||||
RangeSet<std::uint32_t>
|
||||
LedgerMaster::getPinnedLedgersRangeSet()
|
||||
{
|
||||
std::lock_guard sl(mCompleteLock);
|
||||
return mPinnedLedgers;
|
||||
}
|
||||
|
||||
std::optional<NetClock::time_point>
|
||||
LedgerMaster::getCloseTimeBySeq(LedgerIndex ledgerIndex)
|
||||
{
|
||||
@@ -1908,26 +1869,15 @@ LedgerMaster::getLedgerByHash(uint256 const& hash)
|
||||
}
|
||||
|
||||
void
|
||||
LedgerMaster::setLedgerRangePresent(
|
||||
std::uint32_t minV,
|
||||
std::uint32_t maxV,
|
||||
bool pin)
|
||||
LedgerMaster::setLedgerRangePresent(std::uint32_t minV, std::uint32_t maxV)
|
||||
{
|
||||
std::lock_guard sl(mCompleteLock);
|
||||
mCompleteLedgers.insert(range(minV, maxV));
|
||||
|
||||
if (pin)
|
||||
{
|
||||
mPinnedLedgers.insert(range(minV, maxV));
|
||||
JLOG(m_journal.info())
|
||||
<< "Pinned ledger range: " << minV << " - " << maxV;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
LedgerMaster::sweep()
|
||||
{
|
||||
std::lock_guard sl(mCompleteLock);
|
||||
mLedgerHistory.sweep();
|
||||
fetch_packs_.sweep();
|
||||
}
|
||||
@@ -1942,24 +1892,8 @@ void
|
||||
LedgerMaster::clearPriorLedgers(LedgerIndex seq)
|
||||
{
|
||||
std::lock_guard sl(mCompleteLock);
|
||||
if (seq <= 0)
|
||||
return;
|
||||
|
||||
// First, save a copy of the pinned ledgers
|
||||
auto pinnedCopy = mPinnedLedgers;
|
||||
|
||||
// Clear everything before seq
|
||||
RangeSet<std::uint32_t> toClear;
|
||||
toClear.insert(range(0u, seq - 1));
|
||||
for (auto const& interval : toClear)
|
||||
mCompleteLedgers.erase(interval);
|
||||
|
||||
// Re-add the pinned ledgers to ensure they're preserved
|
||||
for (auto const& interval : pinnedCopy)
|
||||
mCompleteLedgers.insert(interval);
|
||||
|
||||
JLOG(m_journal.debug()) << "clearPriorLedgers: after restoration, pinned="
|
||||
<< to_string(mPinnedLedgers);
|
||||
if (seq > 0)
|
||||
mCompleteLedgers.erase(range(0u, seq - 1));
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -163,15 +163,15 @@ LedgerReplayMsgHandler::processProofPathResponse(
|
||||
JLOG(journal_.debug()) << "Bad message: Cannot deserialize";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (auto item = static_cast<SHAMapLeafNode*>(node.get())->peekItem())
|
||||
auto item = static_cast<SHAMapLeafNode*>(node.get())->peekItem();
|
||||
if (!item)
|
||||
{
|
||||
replayer_.gotSkipList(info, item);
|
||||
return true;
|
||||
JLOG(journal_.debug()) << "Bad message: Cannot get ShaMapItem";
|
||||
return false;
|
||||
}
|
||||
|
||||
JLOG(journal_.debug()) << "Bad message: Cannot get ShaMapItem";
|
||||
return false;
|
||||
replayer_.gotSkipList(info, item);
|
||||
return true;
|
||||
}
|
||||
|
||||
protocol::TMReplayDeltaResponse
|
||||
@@ -206,10 +206,9 @@ LedgerReplayMsgHandler::processReplayDeltaRequest(
|
||||
reply.set_ledgerheader(nData.getDataPtr(), nData.getLength());
|
||||
// pack transactions
|
||||
auto const& txMap = ledger->txMap();
|
||||
txMap.visitLeaves(
|
||||
[&](boost::intrusive_ptr<SHAMapItem const> const& txNode) {
|
||||
reply.add_transaction(txNode->data(), txNode->size());
|
||||
});
|
||||
txMap.visitLeaves([&](std::shared_ptr<SHAMapItem const> const& txNode) {
|
||||
reply.add_transaction(txNode->data(), txNode->size());
|
||||
});
|
||||
|
||||
JLOG(journal_.debug()) << "getReplayDelta for ledger " << ledgerHash
|
||||
<< " txMap hash " << txMap.getHash().as_uint256();
|
||||
@@ -265,9 +264,10 @@ LedgerReplayMsgHandler::processReplayDeltaResponse(
|
||||
STObject meta(metaSit, sfMetadata);
|
||||
orderedTxns.emplace(meta[sfTransactionIndex], std::move(tx));
|
||||
|
||||
if (!txMap.addGiveItem(
|
||||
SHAMapNodeType::tnTRANSACTION_MD,
|
||||
make_shamapitem(tid, shaMapItemData.slice())))
|
||||
auto item =
|
||||
std::make_shared<SHAMapItem const>(tid, shaMapItemData.slice());
|
||||
if (!item ||
|
||||
!txMap.addGiveItem(SHAMapNodeType::tnTRANSACTION_MD, item))
|
||||
{
|
||||
JLOG(journal_.debug()) << "Bad message: Cannot deserialize";
|
||||
return false;
|
||||
|
||||
@@ -172,7 +172,7 @@ LedgerReplayer::createDeltas(std::shared_ptr<LedgerReplayTask> task)
|
||||
void
|
||||
LedgerReplayer::gotSkipList(
|
||||
LedgerInfo const& info,
|
||||
boost::intrusive_ptr<SHAMapItem const> const& item)
|
||||
std::shared_ptr<SHAMapItem const> const& item)
|
||||
{
|
||||
std::shared_ptr<SkipListAcquire> skipList = {};
|
||||
{
|
||||
|
||||
@@ -131,14 +131,14 @@ fillJsonTx(
|
||||
if (stMeta)
|
||||
{
|
||||
txJson[jss::metaData] = stMeta->getJson(JsonOptions::none);
|
||||
|
||||
// If applicable, insert delivered amount
|
||||
if (txnType == ttPAYMENT || txnType == ttCHECK_CASH)
|
||||
{
|
||||
// Insert delivered amount
|
||||
auto txMeta = std::make_shared<TxMeta>(
|
||||
txn->getTransactionID(), fill.ledger.seq(), *stMeta);
|
||||
RPC::insertDeliveredAmount(
|
||||
txJson[jss::metaData],
|
||||
fill.ledger,
|
||||
txn,
|
||||
{txn->getTransactionID(), fill.ledger.seq(), *stMeta});
|
||||
txJson[jss::metaData], fill.ledger, txn, *txMeta);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user