mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-05 03:35:51 +00:00
Compare commits
205 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
350d213ee8 | ||
|
|
ca3198164c | ||
|
|
c53a5e7a72 | ||
|
|
ffb53f2085 | ||
|
|
3b191a3097 | ||
|
|
656948cd0f | ||
|
|
46f3d3ef61 | ||
|
|
06251aa76f | ||
|
|
5aef102f4f | ||
|
|
431646437e | ||
|
|
fe8621b00f | ||
|
|
c045060560 | ||
|
|
8ec475b1fd | ||
|
|
e33a6d5c2b | ||
|
|
923e1cef99 | ||
|
|
2e93dd57eb | ||
|
|
92957d685d | ||
|
|
f05acbd782 | ||
|
|
44a9266c9e | ||
|
|
c1710900b4 | ||
|
|
d5059b11b9 | ||
|
|
f95fa338c9 | ||
|
|
96c926c71e | ||
|
|
4dff203787 | ||
|
|
4977a5d43c | ||
|
|
8ce85a9750 | ||
|
|
d5939727e0 | ||
|
|
7b49f1e1de | ||
|
|
ac27089c69 | ||
|
|
4cb0bcb003 | ||
|
|
cf4e9e5578 | ||
|
|
32ced493de | ||
|
|
09e0f103f4 | ||
|
|
056255e396 | ||
|
|
85342b21c8 | ||
|
|
26b0322aa5 | ||
|
|
3b624d8bf8 | ||
|
|
ac02e56519 | ||
|
|
1eac4d2c07 | ||
|
|
3e5f770a38 | ||
|
|
2a66bb3fc7 | ||
|
|
397268394b | ||
|
|
5026cbdaf3 | ||
|
|
5af9dc5abd | ||
|
|
8d86c5e17d | ||
|
|
078bd606c7 | ||
|
|
b421945e71 | ||
|
|
41cd337506 | ||
|
|
b69156ac01 | ||
|
|
be6ac7e7a1 | ||
|
|
1fc1eb9f68 | ||
|
|
1fde585003 | ||
|
|
c915984340 | ||
|
|
50cc1cf0c9 | ||
|
|
1151fba415 | ||
|
|
3e08c390f5 | ||
|
|
053b69c63f | ||
|
|
ced14ec1ab | ||
|
|
6ba9450c89 | ||
|
|
ec8626046b | ||
|
|
4e84ad6cd7 | ||
|
|
40ebbecac8 | ||
|
|
0c43eb3973 | ||
|
|
3dea78d34b | ||
|
|
e27d24ba00 | ||
|
|
925aca764b | ||
|
|
2bb8de030f | ||
|
|
b92d511558 | ||
|
|
548c91ebb6 | ||
|
|
2c56d9fc3e | ||
|
|
6b61505ac2 | ||
|
|
e4db0fba2b | ||
|
|
8f89694fae | ||
|
|
5433e133d5 | ||
|
|
2487dab194 | ||
|
|
77e0912a0e | ||
|
|
a948203dae | ||
|
|
8f65bc24a0 | ||
|
|
9f102fc99d | ||
|
|
7bff9dc7f0 | ||
|
|
e86181c096 | ||
|
|
65df4bceaa | ||
|
|
3397922989 | ||
|
|
046d0c2f0a | ||
|
|
01fc4b0203 | ||
|
|
5b7d2c133a | ||
|
|
237b406e8c | ||
|
|
5427321260 | ||
|
|
ce570c166d | ||
|
|
649c11a78e | ||
|
|
7fae1c1262 | ||
|
|
f259cc1ab6 | ||
|
|
002893f280 | ||
|
|
1d9db1bfdd | ||
|
|
3b5fcd5873 | ||
|
|
a95505739d | ||
|
|
31c8281922 | ||
|
|
c6f6375015 | ||
|
|
6f74a745db | ||
|
|
36cb5f90e2 | ||
|
|
89780c8e4f | ||
|
|
9d4d8c22d9 | ||
|
|
b014b79d88 | ||
|
|
a61a88ea81 | ||
|
|
f31c50d04d | ||
|
|
8ceb0f3a79 | ||
|
|
d943c58b3d | ||
|
|
7ca1c644d1 | ||
|
|
300b7e078a | ||
|
|
3574956e5e | ||
|
|
e8a7b2a1fc | ||
|
|
b580049ec0 | ||
|
|
21c4aaf993 | ||
|
|
213491d94b | ||
|
|
da203b241b | ||
|
|
5d88b726c2 | ||
|
|
dcb7dd8d27 | ||
|
|
91e9658217 | ||
|
|
b28f62bbd9 | ||
|
|
4f4951022c | ||
|
|
58f7aecb0b | ||
|
|
5530a0b665 | ||
|
|
aded4a7a92 | ||
|
|
01df19c08b | ||
|
|
c197c4cdd9 | ||
|
|
5ba1f984df | ||
|
|
cb09e61d2f | ||
|
|
3c9db4b69e | ||
|
|
eeb8b41889 | ||
|
|
f7dd37e355 | ||
|
|
a45a95e5ea | ||
|
|
c6fee28b92 | ||
|
|
77dc63b549 | ||
|
|
66bfe909e6 | ||
|
|
9c50415ebe | ||
|
|
516ffb2147 | ||
|
|
f18c6dfea7 | ||
|
|
1cb67fbd20 | ||
|
|
54afdaa101 | ||
|
|
1c2ae10dc0 | ||
|
|
d34e8be316 | ||
|
|
4111382a31 | ||
|
|
11e914fbe9 | ||
|
|
0e983528e1 | ||
|
|
6b4437db39 | ||
|
|
534a36536c | ||
|
|
beba87129e | ||
|
|
b7e902dccc | ||
|
|
9eb30d4316 | ||
|
|
8fdad0d7fd | ||
|
|
0b812cdece | ||
|
|
724a301599 | ||
|
|
71d7d67fa3 | ||
|
|
264280edd7 | ||
|
|
beb0904a32 | ||
|
|
77c0a62a74 | ||
|
|
5d011c7e6b | ||
|
|
5644c8704f | ||
|
|
c9a586c243 | ||
|
|
f709311762 | ||
|
|
adde0c2d11 | ||
|
|
adf672ff83 | ||
|
|
029580886e | ||
|
|
32f8ae1af1 | ||
|
|
ce997a6de8 | ||
|
|
3620ac287e | ||
|
|
629ed5c691 | ||
|
|
78076a6903 | ||
|
|
67238b9fa6 | ||
|
|
c7ef4c9783 | ||
|
|
b21a05d465 | ||
|
|
436de0e03a | ||
|
|
8d482d3557 | ||
|
|
c5003969de | ||
|
|
1f417764c3 | ||
|
|
e75cd49313 | ||
|
|
4f95b9d7a6 | ||
|
|
066f91ca07 | ||
|
|
c3acbce82d | ||
|
|
b7f588b789 | ||
|
|
9346842eed | ||
|
|
f191c911d4 | ||
|
|
e6f49040f5 | ||
|
|
2f3f6dcb03 | ||
|
|
5ebcaf0a6c | ||
|
|
8bfdbcbab5 | ||
|
|
135b63dbe0 | ||
|
|
46167d1c46 | ||
|
|
79e621d96c | ||
|
|
66627b26cf | ||
|
|
7aad6e5127 | ||
|
|
dffcdea12b | ||
|
|
d7725837f5 | ||
|
|
7745c72b2c | ||
|
|
acb373280b | ||
|
|
9fcb28acad | ||
|
|
305c9a8d61 | ||
|
|
9b2d563dec | ||
|
|
150d4a47e4 | ||
|
|
1c9df69b33 | ||
|
|
10555faa92 | ||
|
|
0f1ffff068 | ||
|
|
9309b57364 | ||
|
|
cb08f2b6ec | ||
|
|
84cde3ce0b |
29
.github/actions/build/action.yml
vendored
Normal file
29
.github/actions/build/action.yml
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
name: build
|
||||
inputs:
|
||||
generator:
|
||||
default: null
|
||||
configuration:
|
||||
required: true
|
||||
cmake-args:
|
||||
default: null
|
||||
# An implicit input is the environment variable `build_dir`.
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: configure
|
||||
shell: bash
|
||||
run: |
|
||||
cd ${build_dir}
|
||||
cmake \
|
||||
${{ inputs.generator && format('-G "{0}"', inputs.generator) || '' }} \
|
||||
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake \
|
||||
-DCMAKE_BUILD_TYPE=${{ inputs.configuration }} \
|
||||
${{ inputs.cmake-args }} \
|
||||
..
|
||||
- name: build
|
||||
shell: bash
|
||||
run: |
|
||||
cmake \
|
||||
--build ${build_dir} \
|
||||
--config ${{ inputs.configuration }} \
|
||||
--parallel ${NUM_PROCESSORS:-$(nproc)}
|
||||
26
.github/actions/dependencies/action.yml
vendored
Normal file
26
.github/actions/dependencies/action.yml
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
name: dependencies
|
||||
inputs:
|
||||
configuration:
|
||||
required: true
|
||||
# An implicit input is the environment variable `build_dir`.
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: unlock Conan
|
||||
shell: bash
|
||||
run: conan remove --locks
|
||||
- name: export custom recipes
|
||||
shell: bash
|
||||
run: |
|
||||
conan export external/snappy snappy/1.1.10@
|
||||
conan export external/soci soci/4.0.3@
|
||||
- name: install dependencies
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir ${build_dir}
|
||||
cd ${build_dir}
|
||||
conan install \
|
||||
--output-folder . \
|
||||
--build missing \
|
||||
--settings build_type=${{ inputs.configuration }} \
|
||||
..
|
||||
21
.github/pull_request_template.md
vendored
21
.github/pull_request_template.md
vendored
@@ -33,10 +33,27 @@ Please check [x] relevant options, delete irrelevant ones.
|
||||
- [ ] New feature (non-breaking change which adds functionality)
|
||||
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
||||
- [ ] Refactor (non-breaking change that only restructures code)
|
||||
- [ ] Tests (You added tests for code that already exists, or your new feature included in this PR)
|
||||
- [ ] Documentation Updates
|
||||
- [ ] Tests (you added tests for code that already exists, or your new feature included in this PR)
|
||||
- [ ] Documentation update
|
||||
- [ ] Chore (no impact to binary, e.g. `.gitignore`, formatting, dropping support for older tooling)
|
||||
- [ ] Release
|
||||
|
||||
### API Impact
|
||||
|
||||
<!--
|
||||
Please check [x] relevant options, delete irrelevant ones.
|
||||
|
||||
* If there is any impact to the public API methods (HTTP / WebSocket), please update https://github.com/xrplf/rippled/blob/develop/API-CHANGELOG.md
|
||||
* Update API-CHANGELOG.md and add the change directly in this PR by pushing to your PR branch.
|
||||
* libxrpl: See https://github.com/XRPLF/rippled/blob/develop/docs/build/depend.md
|
||||
* Peer Protocol: See https://xrpl.org/peer-protocol.html
|
||||
-->
|
||||
|
||||
- [ ] Public API: New feature (new methods and/or new fields)
|
||||
- [ ] Public API: Breaking change (in general, breaking changes should only impact the next api_version)
|
||||
- [ ] `libxrpl` change (any change that may affect `libxrpl` or dependents of `libxrpl`)
|
||||
- [ ] Peer protocol change (must be backward compatible or bump the peer protocol version)
|
||||
|
||||
<!--
|
||||
## Before / After
|
||||
If relevant, use this section for an English description of the change at a technical level.
|
||||
|
||||
2
.github/workflows/clang-format.yml
vendored
2
.github/workflows/clang-format.yml
vendored
@@ -8,7 +8,7 @@ jobs:
|
||||
env:
|
||||
CLANG_VERSION: 10
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install clang-format
|
||||
run: |
|
||||
codename=$( lsb_release --codename --short )
|
||||
|
||||
7
.github/workflows/doxygen.yml
vendored
7
.github/workflows/doxygen.yml
vendored
@@ -4,10 +4,15 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
job:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
container:
|
||||
image: docker://rippleci/rippled-ci-builder:2944b78d22db
|
||||
steps:
|
||||
@@ -18,7 +23,7 @@ jobs:
|
||||
echo ${PATH} | tr ':' '\n'
|
||||
cmake --version
|
||||
doxygen --version
|
||||
env
|
||||
env | sort
|
||||
- name: build
|
||||
run: |
|
||||
mkdir build
|
||||
|
||||
2
.github/workflows/levelization.yml
vendored
2
.github/workflows/levelization.yml
vendored
@@ -8,7 +8,7 @@ jobs:
|
||||
env:
|
||||
CLANG_VERSION: 10
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Check levelization
|
||||
run: Builds/levelization/levelization.sh
|
||||
- name: Check for differences
|
||||
|
||||
51
.github/workflows/macos.yml
vendored
Normal file
51
.github/workflows/macos.yml
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
name: macos
|
||||
on: [push, pull_request]
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
|
||||
test:
|
||||
strategy:
|
||||
matrix:
|
||||
platform:
|
||||
- macos
|
||||
generator:
|
||||
- Ninja
|
||||
configuration:
|
||||
- Release
|
||||
runs-on: [self-hosted, macOS]
|
||||
env:
|
||||
# The `build` action requires these variables.
|
||||
build_dir: .build
|
||||
NUM_PROCESSORS: 12
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: install Ninja
|
||||
if: matrix.generator == 'Ninja'
|
||||
run: brew install ninja
|
||||
- name: check environment
|
||||
run: |
|
||||
echo ${PATH} | tr ':' '\n'
|
||||
python --version
|
||||
conan --version
|
||||
cmake --version
|
||||
env | sort
|
||||
- name: configure Conan
|
||||
run : |
|
||||
conan profile get env.CXXFLAGS default || true
|
||||
conan profile update 'conf.tools.build:cxxflags+=["-DBOOST_ASIO_DISABLE_CONCEPTS"]' default
|
||||
- name: dependencies
|
||||
uses: ./.github/actions/dependencies
|
||||
with:
|
||||
configuration: ${{ matrix.configuration }}
|
||||
- name: build
|
||||
uses: ./.github/actions/build
|
||||
with:
|
||||
generator: ${{ matrix.generator }}
|
||||
configuration: ${{ matrix.configuration }}
|
||||
- name: test
|
||||
run: |
|
||||
${build_dir}/rippled --unittest
|
||||
203
.github/workflows/nix.yml
vendored
203
.github/workflows/nix.yml
vendored
@@ -1,96 +1,161 @@
|
||||
name: nix
|
||||
on: [push, pull_request]
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
# This workflow has two job matrixes.
|
||||
# They can be considered phases because the second matrix ("test")
|
||||
# depends on the first ("dependencies").
|
||||
#
|
||||
# The first phase has a job in the matrix for each combination of
|
||||
# variables that affects dependency ABI:
|
||||
# platform, compiler, and configuration.
|
||||
# It creates a GitHub artifact holding the Conan profile,
|
||||
# and builds and caches binaries for all the dependencies.
|
||||
# If an Artifactory remote is configured, they are cached there.
|
||||
# If not, they are added to the GitHub artifact.
|
||||
# GitHub's "cache" action has a size limit (10 GB) that is too small
|
||||
# to hold the binaries if they are built locally.
|
||||
# We must use the "{upload,download}-artifact" actions instead.
|
||||
#
|
||||
# The second phase has a job in the matrix for each test configuration.
|
||||
# It installs dependency binaries from the cache, whichever was used,
|
||||
# and builds and tests rippled.
|
||||
|
||||
jobs:
|
||||
|
||||
dependencies:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform:
|
||||
- linux
|
||||
compiler:
|
||||
- gcc
|
||||
- clang
|
||||
configuration:
|
||||
- Debug
|
||||
- Release
|
||||
include:
|
||||
- compiler: gcc
|
||||
profile:
|
||||
version: 11
|
||||
cc: /usr/bin/gcc
|
||||
cxx: /usr/bin/g++
|
||||
- compiler: clang
|
||||
profile:
|
||||
version: 14
|
||||
cc: /usr/bin/clang-14
|
||||
cxx: /usr/bin/clang++-14
|
||||
runs-on: [self-hosted, heavy]
|
||||
container: thejohnfreeman/rippled-build-ubuntu:12e19cd9034b
|
||||
env:
|
||||
build_dir: .build
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: check environment
|
||||
run: |
|
||||
echo ${PATH} | tr ':' '\n'
|
||||
conan --version
|
||||
cmake --version
|
||||
env | sort
|
||||
- name: configure Conan
|
||||
env:
|
||||
CONAN_URL: http://18.143.149.228:8081/artifactory/api/conan/conan-non-prod
|
||||
run: |
|
||||
conan profile new default --detect
|
||||
conan profile update settings.compiler.cppstd=20 default
|
||||
conan profile update settings.compiler=${{ matrix.compiler }} default
|
||||
conan profile update settings.compiler.version=${{ matrix.profile.version }} default
|
||||
conan profile update settings.compiler.libcxx=libstdc++11 default
|
||||
conan profile update env.CC=${{ matrix.profile.cc }} default
|
||||
conan profile update env.CXX=${{ matrix.profile.cxx }} default
|
||||
conan profile update conf.tools.build:compiler_executables='{"c": "${{ matrix.profile.cc }}", "cpp": "${{ matrix.profile.cxx }}"}' default
|
||||
# Do not quote the URL. An empty string will be accepted (with
|
||||
# a non-fatal warning), but a missing argument will not.
|
||||
conan remote add ripple ${{ env.CONAN_URL }} --insert 0
|
||||
- name: try to authenticate to ripple Conan remote
|
||||
id: remote
|
||||
run: |
|
||||
echo outcome=$(conan user --remote ripple ${{ secrets.CONAN_USERNAME }} --password ${{ secrets.CONAN_TOKEN }} >&2 && echo success || echo failure) | tee ${GITHUB_OUTPUT}
|
||||
- name: archive profile
|
||||
# Create this archive before dependencies are added to the local cache.
|
||||
run: tar -czf conan.tar -C ~/.conan .
|
||||
- name: list missing binaries
|
||||
id: binaries
|
||||
# Print the list of dependencies that would need to be built locally.
|
||||
# A non-empty list means we have "failed" to cache binaries remotely.
|
||||
run: |
|
||||
echo missing=$(conan info . --build missing --settings build_type=${{ matrix.configuration }} --json 2>/dev/null | grep '^\[') | tee ${GITHUB_OUTPUT}
|
||||
- name: build dependencies
|
||||
if: (steps.binaries.outputs.missing != '[]')
|
||||
uses: ./.github/actions/dependencies
|
||||
with:
|
||||
configuration: ${{ matrix.configuration }}
|
||||
- name: upload dependencies to remote
|
||||
if: (steps.binaries.outputs.missing != '[]') && (steps.remote.outputs.outcome == 'success')
|
||||
run: conan upload --remote ripple '*' --all --parallel --confirm
|
||||
- name: recreate archive with dependencies
|
||||
if: (steps.binaries.outputs.missing != '[]') && (steps.remote.outputs.outcome == 'failure')
|
||||
run: tar -czf conan.tar -C ~/.conan .
|
||||
- name: upload archive
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.platform }}-${{ matrix.compiler }}-${{ matrix.configuration }}
|
||||
path: conan.tar
|
||||
if-no-files-found: error
|
||||
|
||||
|
||||
test:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform:
|
||||
- ubuntu-latest
|
||||
- macos-12
|
||||
generator:
|
||||
- Ninja
|
||||
- linux
|
||||
compiler:
|
||||
- gcc
|
||||
- clang
|
||||
configuration:
|
||||
- Debug
|
||||
- Release
|
||||
runs-on: ${{ matrix.platform }}
|
||||
cmake-args:
|
||||
-
|
||||
- "-Dunity=ON"
|
||||
needs: dependencies
|
||||
runs-on: [self-hosted, heavy]
|
||||
container: thejohnfreeman/rippled-build-ubuntu:12e19cd9034b
|
||||
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
|
||||
- name: download cache
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
python-version: 3.9
|
||||
- name: learn Python cache directory
|
||||
id: pip-cache
|
||||
name: ${{ matrix.platform }}-${{ matrix.compiler }}-${{ matrix.configuration }}
|
||||
- name: extract 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'
|
||||
mkdir -p ~/.conan
|
||||
tar -xzf conan.tar -C ~/.conan
|
||||
- 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
|
||||
env | sort
|
||||
ls ~/.conan
|
||||
- name: checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: dependencies
|
||||
uses: ./.github/actions/dependencies
|
||||
with:
|
||||
path: ${{ steps.conan-cache.outputs.dir }}
|
||||
key: ${{ hashFiles('~/.conan/profiles/default', 'conanfile.py', 'external/rocksdb/*', '.github/workflows/nix.yml') }}
|
||||
- name: export Snappy
|
||||
run: conan export external/snappy snappy/1.1.9@
|
||||
- name: install dependencies
|
||||
run: |
|
||||
mkdir ${build_dir}
|
||||
cd ${build_dir}
|
||||
conan install .. --build missing --settings build_type=${{ matrix.configuration }}
|
||||
- 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 \
|
||||
..
|
||||
configuration: ${{ matrix.configuration }}
|
||||
- name: build
|
||||
run: |
|
||||
cmake --build ${build_dir} --target rippled --parallel $(nproc)
|
||||
uses: ./.github/actions/build
|
||||
with:
|
||||
generator: Ninja
|
||||
configuration: ${{ matrix.configuration }}
|
||||
cmake-args: ${{ matrix.cmake-args }}
|
||||
- name: test
|
||||
run: |
|
||||
${build_dir}/rippled --unittest --unittest-jobs $(nproc)
|
||||
|
||||
109
.github/workflows/windows.yml
vendored
109
.github/workflows/windows.yml
vendored
@@ -1,19 +1,11 @@
|
||||
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]
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- 'action'
|
||||
paths:
|
||||
- '.github/workflow/windows.yml'
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
# https://docs.github.com/en/actions/using-jobs/using-concurrency
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
|
||||
@@ -25,6 +17,11 @@ jobs:
|
||||
- Visual Studio 16 2019
|
||||
configuration:
|
||||
- Release
|
||||
# Github hosted runners tend to hang when running Debug unit tests.
|
||||
# Instead of trying to work around it, disable the Debug job until
|
||||
# something beefier (i.e. a heavy self-hosted runner) becomes
|
||||
# available.
|
||||
# - Debug
|
||||
runs-on: windows-2019
|
||||
env:
|
||||
build_dir: .build
|
||||
@@ -37,16 +34,17 @@ jobs:
|
||||
python-version: 3.9
|
||||
- name: learn Python cache directory
|
||||
id: pip-cache
|
||||
shell: bash
|
||||
run: |
|
||||
pip install --upgrade pip
|
||||
echo "::set-output name=dir::$(pip cache dir)"
|
||||
python -m pip install --upgrade pip
|
||||
echo "dir=$(pip cache dir)" | tee ${GITHUB_OUTPUT}
|
||||
- name: restore Python cache directory
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
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'
|
||||
run: pip install wheel 'conan<2'
|
||||
- name: check environment
|
||||
run: |
|
||||
$env:PATH -split ';'
|
||||
@@ -55,43 +53,48 @@ jobs:
|
||||
cmake --version
|
||||
dir env:
|
||||
- name: configure Conan
|
||||
shell: bash
|
||||
env:
|
||||
CONAN_URL: http://18.143.149.228:8081/artifactory/api/conan/conan-non-prod
|
||||
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
|
||||
conan profile update settings.compiler.runtime=MT${{ matrix.configuration == 'Debug' && 'd' || '' }} default
|
||||
# Do not quote the URL. An empty string will be accepted (with
|
||||
# a non-fatal warning), but a missing argument will not.
|
||||
conan remote add ripple ${{ env.CONAN_URL }} --insert 0
|
||||
- name: try to authenticate to ripple Conan remote
|
||||
shell: bash
|
||||
id: remote
|
||||
run: |
|
||||
echo "::set-output name=dir::$(conan config get storage.path)"
|
||||
- name: restore Conan cache directory
|
||||
uses: actions/cache@v2
|
||||
echo outcome=$(conan user --remote ripple ${{ secrets.CONAN_USERNAME }} \
|
||||
--password ${{ secrets.CONAN_TOKEN }} >&2 && echo success || \
|
||||
echo failure) | tee ${GITHUB_OUTPUT}
|
||||
- name: list missing binaries
|
||||
id: binaries
|
||||
shell: bash
|
||||
# Print the list of dependencies that would need to be built locally.
|
||||
# A non-empty list means we have "failed" to cache binaries remotely.
|
||||
run: |
|
||||
echo missing=$(conan info . --build missing --settings build_type=${{ matrix.configuration }} --json 2>/dev/null | grep '^\[') | tee ${GITHUB_OUTPUT}
|
||||
- name: build dependencies
|
||||
uses: ./.github/actions/dependencies
|
||||
with:
|
||||
path: ${{ steps.conan-cache.outputs.dir }}
|
||||
key: ${{ hashFiles('~/.conan/profiles/default', 'conanfile.py', 'external/rocksdb/*', '.github/workflows/windows.yml') }}
|
||||
- name: export Snappy
|
||||
run: conan export external/snappy snappy/1.1.9@
|
||||
- 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 `
|
||||
..
|
||||
configuration: ${{ matrix.configuration }}
|
||||
- name: upload dependencies to remote
|
||||
if: (steps.binaries.outputs.missing != '[]') && (steps.remote.outputs.outcome == 'success')
|
||||
run: conan upload --remote ripple '*' --all --parallel --confirm
|
||||
- name: build
|
||||
uses: ./.github/actions/build
|
||||
with:
|
||||
generator: '${{ matrix.generator }}'
|
||||
configuration: ${{ matrix.configuration }}
|
||||
# Hard code for now. Move to the matrix if varied options are needed
|
||||
cmake-args: '-Dassert=ON -Dreporting=OFF -Dunity=ON'
|
||||
- name: test (permitted to silently fail)
|
||||
shell: bash
|
||||
# Github runners are resource limited, which causes unit tests to fail
|
||||
# (e.g. OOM). To allow forward progress until self-hosted runners are
|
||||
# up and running reliably, allow the job to succeed even if tests fail.
|
||||
continue-on-error: true
|
||||
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
|
||||
${build_dir}/${{ matrix.configuration }}/rippled --unittest --unittest-jobs $(nproc)
|
||||
|
||||
7
.gitignore
vendored
7
.gitignore
vendored
@@ -21,7 +21,6 @@ bin/project-cache.jam
|
||||
|
||||
# Ignore object files.
|
||||
*.o
|
||||
build
|
||||
.nih_c
|
||||
tags
|
||||
TAGS
|
||||
@@ -65,7 +64,7 @@ docs/html_doc
|
||||
# Xcode user-specific project settings
|
||||
# Xcode
|
||||
.DS_Store
|
||||
*/build/*
|
||||
/build/
|
||||
*.pbxuser
|
||||
!default.pbxuser
|
||||
*.mode1v3
|
||||
@@ -109,3 +108,7 @@ pkg_out
|
||||
pkg
|
||||
CMakeUserPresets.json
|
||||
bld.rippled/
|
||||
.vscode
|
||||
|
||||
# Suggested in-tree build directory
|
||||
/.build/
|
||||
|
||||
6
.pre-commit-config.yaml
Normal file
6
.pre-commit-config.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
# .pre-commit-config.yaml
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/mirrors-clang-format
|
||||
rev: v10.0.1
|
||||
hooks:
|
||||
- id: clang-format
|
||||
194
API-CHANGELOG.md
Normal file
194
API-CHANGELOG.md
Normal file
@@ -0,0 +1,194 @@
|
||||
# API Changelog
|
||||
|
||||
This changelog is intended to list all updates to the [public API methods](https://xrpl.org/public-api-methods.html).
|
||||
|
||||
For info about how [API versioning](https://xrpl.org/request-formatting.html#api-versioning) works, including examples, please view the [XLS-22d spec](https://github.com/XRPLF/XRPL-Standards/discussions/54). For details about the implementation of API versioning, view the [implementation PR](https://github.com/XRPLF/rippled/pull/3155). API versioning ensures existing integrations and users continue to receive existing behavior, while those that request a higher API version will experience new behavior.
|
||||
|
||||
The API version controls the API behavior you see. This includes what properties you see in responses, what parameters you're permitted to send in requests, and so on. You specify the API version in each of your requests. When a breaking change is introduced to the `rippled` API, a new version is released. To avoid breaking your code, you should set (or increase) your version when you're ready to upgrade.
|
||||
|
||||
For a log of breaking changes, see the **API Version [number]** headings. In general, breaking changes are associated with a particular API Version number. For non-breaking changes, scroll to the **XRP Ledger version [x.y.z]** headings. Non-breaking changes are associated with a particular XRP Ledger (`rippled`) release.
|
||||
|
||||
## API Version 1
|
||||
|
||||
This version is supported by all `rippled` versions. At time of writing, it is the default API version, used when no `api_version` is specified. When a new API version is introduced, the command line interface will default to the latest API version. The command line is intended for ad-hoc usage by humans, not programs or automated scripts. The command line is not meant for use in production code.
|
||||
|
||||
### Idiosyncrasies
|
||||
|
||||
#### V1 account_info response
|
||||
|
||||
In [the response to the `account_info` command](https://xrpl.org/account_info.html#response-format), there is `account_data` - which is supposed to be an `AccountRoot` object - and `signer_lists` is returned in this object. However, the docs say that `signer_lists` should be at the root level of the reponse.
|
||||
|
||||
It makes sense for `signer_lists` to be at the root level because signer lists are not part of the AccountRoot object. (First reported in [xrpl-dev-portal#938](https://github.com/XRPLF/xrpl-dev-portal/issues/938).)
|
||||
|
||||
In `api_version: 2`, the `signer_lists` field [will be moved](#modifications-to-account_info-response-in-v2) to the root level of the account_info response. (https://github.com/XRPLF/rippled/pull/3770)
|
||||
|
||||
#### server_info - network_id
|
||||
|
||||
The `network_id` field was added in the `server_info` response in version 1.5.0 (2019), but it is not returned in [reporting mode](https://xrpl.org/rippled-server-modes.html#reporting-mode).
|
||||
|
||||
## XRP Ledger server version 2.0.0
|
||||
|
||||
### Additions in 2.0
|
||||
|
||||
Additions are intended to be non-breaking (because they are purely additive).
|
||||
|
||||
- `server_definitions`: A new RPC that generates a `definitions.json`-like output that can be used in XRPL libraries.
|
||||
- In `Payment` transactions, `DeliverMax` has been added. This is a replacement for the `Amount` field, which should not be used. Typically, the `delivered_amount` (in transaction metadata) should be used. To ease the transition, `DeliverMax` is present regardless of API version, since adding a field is non-breaking.
|
||||
- API version 2 has been moved from beta to supported, meaning that it is generally available (regardless of the `beta_rpc_api` setting).
|
||||
|
||||
|
||||
## XRP Ledger server version 1.12.0
|
||||
|
||||
[Version 1.12.0](https://github.com/XRPLF/rippled/releases/tag/1.12.0) was released on Sep 6, 2023.
|
||||
|
||||
### Additions in 1.12
|
||||
|
||||
Additions are intended to be non-breaking (because they are purely additive).
|
||||
|
||||
- `server_info`: Added `ports`, an array which advertises the RPC and WebSocket ports. This information is also included in the `/crawl` endpoint (which calls `server_info` internally). `grpc` and `peer` ports are also included. (https://github.com/XRPLF/rippled/pull/4427)
|
||||
- `ports` contains objects, each containing a `port` for the listening port (a number string), and a `protocol` array listing the supported protocols on that port.
|
||||
- This allows crawlers to build a more detailed topology without needing to port-scan nodes.
|
||||
- (For peers and other non-admin clients, the info about admin ports is excluded.)
|
||||
- Clawback: The following additions are gated by the Clawback amendment (`featureClawback`). (https://github.com/XRPLF/rippled/pull/4553)
|
||||
- Adds an [AccountRoot flag](https://xrpl.org/accountroot.html#accountroot-flags) called `lsfAllowTrustLineClawback` (https://github.com/XRPLF/rippled/pull/4617)
|
||||
- Adds the corresponding `asfAllowTrustLineClawback` [AccountSet Flag](https://xrpl.org/accountset.html#accountset-flags) as well.
|
||||
- Clawback is disabled by default, so if an issuer desires the ability to claw back funds, they must use an `AccountSet` transaction to set the AllowTrustLineClawback flag. They must do this before creating any trust lines, offers, escrows, payment channels, or checks.
|
||||
- Adds the [Clawback transaction type](https://github.com/XRPLF/XRPL-Standards/blob/master/XLS-39d-clawback/README.md#331-clawback-transaction), containing these fields:
|
||||
- `Account`: The issuer of the asset being clawed back. Must also be the sender of the transaction.
|
||||
- `Amount`: The amount being clawed back, with the `Amount.issuer` being the token holder's address.
|
||||
- Adds [AMM](https://github.com/XRPLF/XRPL-Standards/discussions/78) ([#4294](https://github.com/XRPLF/rippled/pull/4294), [#4626](https://github.com/XRPLF/rippled/pull/4626)) feature:
|
||||
- Adds `amm_info` API to retrieve AMM information for a given tokens pair.
|
||||
- Adds `AMMCreate` transaction type to create `AMM` instance.
|
||||
- Adds `AMMDeposit` transaction type to deposit funds into `AMM` instance.
|
||||
- Adds `AMMWithdraw` transaction type to withdraw funds from `AMM` instance.
|
||||
- Adds `AMMVote` transaction type to vote for the trading fee of `AMM` instance.
|
||||
- Adds `AMMBid` transaction type to bid for the Auction Slot of `AMM` instance.
|
||||
- Adds `AMMDelete` transaction type to delete `AMM` instance.
|
||||
- Adds `sfAMMID` to `AccountRoot` to indicate that the account is `AMM`'s account. `AMMID` is used to fetch `ltAMM`.
|
||||
- Adds `lsfAMMNode` `TrustLine` flag to indicate that one side of the `TrustLine` is `AMM` account.
|
||||
- Adds `tfLPToken`, `tfSingleAsset`, `tfTwoAsset`, `tfOneAssetLPToken`, `tfLimitLPToken`, `tfTwoAssetIfEmpty`,
|
||||
`tfWithdrawAll`, `tfOneAssetWithdrawAll` which allow a trader to specify different fields combination
|
||||
for `AMMDeposit` and `AMMWithdraw` transactions.
|
||||
- Adds new transaction result codes:
|
||||
- tecUNFUNDED_AMM: insufficient balance to fund AMM. The account does not have funds for liquidity provision.
|
||||
- tecAMM_BALANCE: AMM has invalid balance. Calculated balances greater than the current pool balances.
|
||||
- tecAMM_FAILED: AMM transaction failed. Fails due to a processing failure.
|
||||
- tecAMM_INVALID_TOKENS: AMM invalid LP tokens. Invalid input values, format, or calculated values.
|
||||
- tecAMM_EMPTY: AMM is in empty state. Transaction requires AMM in non-empty state (LP tokens > 0).
|
||||
- tecAMM_NOT_EMPTY: AMM is not in empty state. Transaction requires AMM in empty state (LP tokens == 0).
|
||||
- tecAMM_ACCOUNT: AMM account. Clawback of AMM account.
|
||||
- tecINCOMPLETE: Some work was completed, but more submissions required to finish. AMMDelete partially deletes the trustlines.
|
||||
|
||||
## XRP Ledger server version 1.11.0
|
||||
|
||||
[Version 1.11.0](https://github.com/XRPLF/rippled/releases/tag/1.11.0) was released on Jun 20, 2023.
|
||||
|
||||
### Breaking changes in 1.11
|
||||
|
||||
- Added the ability to mark amendments as obsolete. For the `feature` admin API, there is a new possible value for the `vetoed` field. (https://github.com/XRPLF/rippled/pull/4291)
|
||||
- The value of `vetoed` can now be `true`, `false`, or `"Obsolete"`.
|
||||
- Removed the acceptance of seeds or public keys in place of account addresses. (https://github.com/XRPLF/rippled/pull/4404)
|
||||
- This simplifies the API and encourages better security practices (i.e. seeds should never be sent over the network).
|
||||
- For the `ledger_data` method, when all entries are filtered out, the `state` field of the response is now an empty list (in other words, an empty array, `[]`). (Previously, it would return `null`.) While this is technically a breaking change, the new behavior is consistent with the documentation, so this is considered only a bug fix. (https://github.com/XRPLF/rippled/pull/4398)
|
||||
- If and when the `fixNFTokenRemint` amendment activates, there will be a new AccountRoot field, `FirstNFTSequence`. This field is set to the current account sequence when the account issues their first NFT. If an account has not issued any NFTs, then the field is not set. ([#4406](https://github.com/XRPLF/rippled/pull/4406))
|
||||
- There is a new account deletion restriction: an account can only be deleted if `FirstNFTSequence` + `MintedNFTokens` + `256` is less than the current ledger sequence.
|
||||
- This is potentially a breaking change if clients have logic for determining whether an account can be deleted.
|
||||
- NetworkID
|
||||
- For sidechains and networks with a network ID greater than 1024, there is a new [transaction common field](https://xrpl.org/transaction-common-fields.html), `NetworkID`. (https://github.com/XRPLF/rippled/pull/4370)
|
||||
- This field helps to prevent replay attacks and is now required for chains whose network ID is 1025 or higher.
|
||||
- The field must be omitted for Mainnet, so there is no change for Mainnet users.
|
||||
- There are three new local error codes:
|
||||
- `telNETWORK_ID_MAKES_TX_NON_CANONICAL`: a `NetworkID` is present but the chain's network ID is less than 1025. Remove the field from the transaction, and try again.
|
||||
- `telREQUIRES_NETWORK_ID`: a `NetworkID` is required, but is not present. Add the field to the transaction, and try again.
|
||||
- `telWRONG_NETWORK`: a `NetworkID` is specified, but it is for a different network. Submit the transaction to a different server which is connected to the correct network.
|
||||
|
||||
### Additions and bug fixes in 1.11
|
||||
|
||||
- Added `nftoken_id`, `nftoken_ids` and `offer_id` meta fields into NFT `tx` and `account_tx` responses. (https://github.com/XRPLF/rippled/pull/4447)
|
||||
- Added an `account_flags` object to the `account_info` method response. (https://github.com/XRPLF/rippled/pull/4459)
|
||||
- Added `NFTokenPages` to the `account_objects` RPC. (https://github.com/XRPLF/rippled/pull/4352)
|
||||
- Fixed: `marker` returned from the `account_lines` command would not work on subsequent commands. (https://github.com/XRPLF/rippled/pull/4361)
|
||||
|
||||
## XRP Ledger server version 1.10.0
|
||||
|
||||
[Version 1.10.0](https://github.com/XRPLF/rippled/releases/tag/1.10.0)
|
||||
was released on Mar 14, 2023.
|
||||
|
||||
### Breaking changes in 1.10
|
||||
|
||||
- If the `XRPFees` feature is enabled, the `fee_ref` field will be
|
||||
removed from the [ledger subscription stream](https://xrpl.org/subscribe.html#ledger-stream), because it will no longer
|
||||
have any meaning.
|
||||
|
||||
## API Version 2
|
||||
|
||||
API version 2 is introduced in `rippled` version 2.0. Users can request it explicitly by specifying `"api_version" : 2`.
|
||||
|
||||
#### Removed methods
|
||||
|
||||
In API version 2, the following deprecated methods are no longer available: (https://github.com/XRPLF/rippled/pull/4759)
|
||||
|
||||
- `tx_history` - Instead, use other methods such as `account_tx` or `ledger` with the `transactions` field set to `true`.
|
||||
- `ledger_header` - Instead, use the `ledger` method.
|
||||
|
||||
#### Modifications to JSON transaction element in V2
|
||||
|
||||
In API version 2, JSON elements for transaction output have been changed and made consistent for all methods which output transactions. (https://github.com/XRPLF/rippled/pull/4775)
|
||||
This helps to unify the JSON serialization format of transactions. (https://github.com/XRPLF/clio/issues/722, https://github.com/XRPLF/rippled/issues/4727)
|
||||
|
||||
- JSON transaction element is named `tx_json`
|
||||
- Binary transaction element is named `tx_blob`
|
||||
- JSON transaction metadata element is named `meta`
|
||||
- Binary transaction metadata element is named `meta_blob`
|
||||
|
||||
Additionally, these elements are now consistently available next to `tx_json` (i.e. sibling elements), where possible:
|
||||
|
||||
- `hash` - Transaction ID. This data was stored inside transaction output in API version 1, but in API version 2 is a sibling element.
|
||||
- `ledger_index` - Ledger index (only set on validated ledgers)
|
||||
- `ledger_hash` - Ledger hash (only set on closed or validated ledgers)
|
||||
- `close_time_iso` - Ledger close time expressed in ISO 8601 time format (only set on validated ledgers)
|
||||
- `validated` - Bool element set to `true` if the transaction is in a validated ledger, otherwise `false`
|
||||
|
||||
This change affects the following methods:
|
||||
|
||||
- `tx` - Transaction data moved into element `tx_json` (was inline inside `result`) or, if binary output was requested, moved from `tx` to `tx_blob`. Renamed binary transaction metadata element (if it was requested) from `meta` to `meta_blob`. Changed location of `hash` and added new elements
|
||||
- `account_tx` - Renamed transaction element from `tx` to `tx_json`. Renamed binary transaction metadata element (if it was requested) from `meta` to `meta_blob`. Changed location of `hash` and added new elements
|
||||
- `transaction_entry` - Renamed transaction metadata element from `metadata` to `meta`. Changed location of `hash` and added new elements
|
||||
- `subscribe` - Renamed transaction element from `transaction` to `tx_json`. Changed location of `hash` and added new elements
|
||||
- `sign`, `sign_for`, `submit` and `submit_multisigned` - Changed location of `hash` element.
|
||||
|
||||
#### Modification to `Payment` transaction JSON schema
|
||||
|
||||
When reading Payments, the `Amount` field should generally **not** be used. Instead, use [delivered_amount](https://xrpl.org/partial-payments.html#the-delivered_amount-field) to see the amount that the Payment delivered. To clarify its meaning, the `Amount` field is being renamed to `DeliverMax`. (https://github.com/XRPLF/rippled/pull/4733)
|
||||
|
||||
- In `Payment` transaction type, JSON RPC field `Amount` is renamed to `DeliverMax`. To enable smooth client transition, `Amount` is still handled, as described below: (https://github.com/XRPLF/rippled/pull/4733)
|
||||
- On JSON RPC input (e.g. `submit_multisigned` etc. methods), `Amount` is recognized as an alias to `DeliverMax` for both API version 1 and version 2 clients.
|
||||
- On JSON RPC input, submitting both `Amount` and `DeliverMax` fields is allowed _only_ if they are identical; otherwise such input is rejected with `rpcINVALID_PARAMS` error.
|
||||
- On JSON RPC output (e.g. `subscribe`, `account_tx` etc. methods), `DeliverMax` is present in both API version 1 and version 2.
|
||||
- On JSON RPC output, `Amount` is only present in API version 1 and _not_ in version 2.
|
||||
|
||||
#### Modifications to account_info response
|
||||
|
||||
- `signer_lists` is returned in the root of the response. In API version 1, it was nested under `account_data`. (https://github.com/XRPLF/rippled/pull/3770)
|
||||
- When using an invalid `signer_lists` value, the API now returns an "invalidParams" error. (https://github.com/XRPLF/rippled/pull/4585)
|
||||
- (`signer_lists` must be a boolean. In API version 1, strings were accepted and may return a normal response - i.e. as if `signer_lists` were `true`.)
|
||||
|
||||
#### Modifications to [account_tx](https://xrpl.org/account_tx.html#account_tx) response
|
||||
|
||||
- Using `ledger_index_min`, `ledger_index_max`, and `ledger_index` returns `invalidParams` because if you use `ledger_index_min` or `ledger_index_max`, then it does not make sense to also specify `ledger_index`. In API version 1, no error was returned. (https://github.com/XRPLF/rippled/pull/4571)
|
||||
- The same applies for `ledger_index_min`, `ledger_index_max`, and `ledger_hash`. (https://github.com/XRPLF/rippled/issues/4545#issuecomment-1565065579)
|
||||
- Using a `ledger_index_min` or `ledger_index_max` beyond the range of ledgers that the server has:
|
||||
- returns `lgrIdxMalformed` in API version 2. Previously, in API version 1, no error was returned. (https://github.com/XRPLF/rippled/issues/4288)
|
||||
- Attempting to use a non-boolean value (such as a string) for the `binary` or `forward` parameters returns `invalidParams` (`rpcINVALID_PARAMS`). Previously, in API version 1, no error was returned. (https://github.com/XRPLF/rippled/pull/4620)
|
||||
|
||||
#### Modifications to [noripple_check](https://xrpl.org/noripple_check.html#noripple_check) response
|
||||
|
||||
- Attempting to use a non-boolean value (such as a string) for the `transactions` parameter returns `invalidParams` (`rpcINVALID_PARAMS`). Previously, in API version 1, no error was returned. (https://github.com/XRPLF/rippled/pull/4620)
|
||||
|
||||
# Unit tests for API changes
|
||||
|
||||
The following information is useful to developers contributing to this project:
|
||||
|
||||
The purpose of unit tests is to catch bugs and prevent regressions. In general, it often makes sense to create a test function when there is a breaking change to the API. For APIs that have changed in a new API version, the tests should be modified so that both the prior version and the new version are properly tested.
|
||||
|
||||
To take one example: for `account_info` version 1, WebSocket and JSON-RPC behavior should be tested. The latest API version, i.e. API version 2, should be tested over WebSocket, JSON-RPC, and command line.
|
||||
551
BUILD.md
551
BUILD.md
@@ -1,121 +1,11 @@
|
||||
## A crash course in CMake and Conan
|
||||
|
||||
To better understand how to use Conan,
|
||||
we should first understand _why_ we use Conan,
|
||||
and to understand that,
|
||||
we need to understand how we use CMake.
|
||||
|
||||
|
||||
### CMake
|
||||
|
||||
Technically, you don't need CMake to build this project.
|
||||
You could manually compile every translation unit into an object file,
|
||||
using the right compiler options,
|
||||
and then manually link all those objects together,
|
||||
using the right linker options.
|
||||
However, that is very tedious and error-prone,
|
||||
which is why we lean on tools like CMake.
|
||||
|
||||
We have written CMake configuration files
|
||||
([`CMakeLists.txt`](./CMakeLists.txt) and friends)
|
||||
for this project so that CMake can be used to correctly compile and link
|
||||
all of the translation units in it.
|
||||
Or rather, CMake will generate files for a separate build system
|
||||
(e.g. Make, Ninja, Visual Studio, Xcode, etc.)
|
||||
that compile and link all of the translation units.
|
||||
Even then, CMake has parameters, some of which are platform-specific.
|
||||
In CMake's parlance, parameters are specially-named **variables** like
|
||||
[`CMAKE_BUILD_TYPE`][build_type] or
|
||||
[`CMAKE_MSVC_RUNTIME_LIBRARY`][runtime].
|
||||
Parameters include:
|
||||
|
||||
- what build system to generate files for
|
||||
- where to find the compiler and linker
|
||||
- where to find dependencies, e.g. libraries and headers
|
||||
- how to link dependencies, e.g. any special compiler or linker flags that
|
||||
need to be used with them, including preprocessor definitions
|
||||
- how to compile translation units, e.g. with optimizations, debug symbols,
|
||||
position-independent code, etc.
|
||||
- on Windows, which runtime library to link with
|
||||
|
||||
For some of these parameters, like the build system and compiler,
|
||||
CMake goes through a complicated search process to choose default values.
|
||||
For others, like the dependencies,
|
||||
_we_ had written in the CMake configuration files of this project
|
||||
our own complicated process to choose defaults.
|
||||
For most developers, things "just worked"... until they didn't, and then
|
||||
you were left trying to debug one of these complicated processes, instead of
|
||||
choosing and manually passing the parameter values yourself.
|
||||
|
||||
You can pass every parameter to CMake on the command line,
|
||||
but writing out these parameters every time we want to configure CMake is
|
||||
a pain.
|
||||
Most humans prefer to put them into a configuration file, once, that
|
||||
CMake can read every time it is configured.
|
||||
For CMake, that file is a [toolchain file][toolchain].
|
||||
|
||||
|
||||
### Conan
|
||||
|
||||
These next few paragraphs on Conan are going to read much like the ones above
|
||||
for CMake.
|
||||
|
||||
Technically, you don't need Conan to build this project.
|
||||
You could manually download, configure, build, and install all of the
|
||||
dependencies yourself, and then pass all of the parameters necessary for
|
||||
CMake to link to those dependencies.
|
||||
To guarantee ABI compatibility, you must be sure to use the same set of
|
||||
compiler and linker options for all dependencies _and_ this project.
|
||||
However, that is very tedious and error-prone, which is why we lean on tools
|
||||
like Conan.
|
||||
|
||||
We have written a Conan configuration file ([`conanfile.py`](./conanfile.py))
|
||||
so that Conan can be used to correctly download, configure, build, and install
|
||||
all of the dependencies for this project,
|
||||
using a single set of compiler and linker options for all of them.
|
||||
It generates files that contain almost all of the parameters that CMake
|
||||
expects.
|
||||
Those files include:
|
||||
|
||||
- A single toolchain file.
|
||||
- For every dependency, a CMake [package configuration file][pcf],
|
||||
[package version file][pvf], and for every build type, a package
|
||||
targets file.
|
||||
Together, these files implement version checking and define `IMPORTED`
|
||||
targets for the dependencies.
|
||||
|
||||
The toolchain file itself amends the search path
|
||||
([`CMAKE_PREFIX_PATH`][prefix_path]) so that [`find_package()`][find_package]
|
||||
will [discover][search] the generated package configuration files.
|
||||
|
||||
**Nearly all we must do to properly configure CMake is pass the toolchain
|
||||
file.**
|
||||
What CMake parameters are left out?
|
||||
You'll still need to pick a build system generator,
|
||||
and if you choose a single-configuration generator,
|
||||
you'll need to pass the `CMAKE_BUILD_TYPE`,
|
||||
which should match the `build_type` setting you gave to Conan.
|
||||
|
||||
Even then, Conan has parameters, some of which are platform-specific.
|
||||
In Conan's parlance, parameters are either settings or options.
|
||||
**Settings** are shared by all packages, e.g. the build type.
|
||||
**Options** are specific to a given package, e.g. whether to build and link
|
||||
OpenSSL as a shared library.
|
||||
|
||||
For settings, Conan goes through a complicated search process to choose
|
||||
defaults.
|
||||
For options, each package recipe defines its own defaults.
|
||||
|
||||
You can pass every parameter to Conan on the command line,
|
||||
but it is more convenient to put them in a [profile][profile].
|
||||
**All we must do to properly configure Conan is edit and pass the profile.**
|
||||
By default, Conan will use the profile named "default".
|
||||
You can let Conan create the default profile with this command:
|
||||
|
||||
```
|
||||
conan profile new default --detect
|
||||
```
|
||||
| :warning: **WARNING** :warning:
|
||||
|---|
|
||||
| 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 this 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
|
||||
|
||||
@@ -132,297 +22,346 @@ For the latest release candidate, choose the `release` branch.
|
||||
git checkout release
|
||||
```
|
||||
|
||||
If you are contributing or want the latest set of untested features,
|
||||
then use the `develop` branch.
|
||||
For the latest set of untested features, or to contribute, choose the `develop`
|
||||
branch.
|
||||
|
||||
```
|
||||
git checkout develop
|
||||
```
|
||||
|
||||
## Minimum Requirements
|
||||
|
||||
## Platforms
|
||||
See [System Requirements](https://xrpl.org/system-requirements.html).
|
||||
|
||||
rippled is written in the C++20 dialect and includes the `<concepts>` header.
|
||||
The [minimum compiler versions][2] that can compile this dialect are given
|
||||
below:
|
||||
Building rippled generally requires git, Python, Conan, CMake, and a C++ compiler. Some guidance on setting up such a [C++ development environment can be found here](./docs/build/environment.md).
|
||||
|
||||
| Compiler | Minimum Version
|
||||
|---|---
|
||||
| GCC | 10
|
||||
| Clang | 13
|
||||
| Apple Clang | 13.1.6
|
||||
| MSVC | 19.23
|
||||
- [Python 3.7](https://www.python.org/downloads/)
|
||||
- [Conan 1.55](https://conan.io/downloads.html)
|
||||
- [CMake 3.16](https://cmake.org/download/)
|
||||
|
||||
We do not recommend Windows for rippled production use at this time.
|
||||
As of January 2023, the Ubuntu platform has received the highest level of
|
||||
`rippled` is written in the C++20 dialect and includes the `<concepts>` header.
|
||||
The [minimum compiler versions][2] required are:
|
||||
|
||||
| Compiler | Version |
|
||||
|-------------|---------|
|
||||
| GCC | 11 |
|
||||
| Clang | 13 |
|
||||
| Apple Clang | 13.1.6 |
|
||||
| MSVC | 19.23 |
|
||||
|
||||
### Linux
|
||||
|
||||
The Ubuntu operating system has received the highest level of
|
||||
quality assurance, testing, and support.
|
||||
Additionally, 32-bit Windows development is not supported.
|
||||
|
||||
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.
|
||||
Here are [sample instructions for setting up a C++ development environment on Linux](./docs/build/environment.md#linux).
|
||||
|
||||
### Mac
|
||||
|
||||
Many rippled engineers use macOS for development.
|
||||
|
||||
Here are [sample instructions for setting up a C++ development environment on macOS](./docs/build/environment.md#macos).
|
||||
|
||||
### Windows
|
||||
|
||||
Windows is not recommended for production use at this time.
|
||||
|
||||
- Additionally, 32-bit Windows development is not supported.
|
||||
- Visual Studio 2022 is not yet supported.
|
||||
- rippled generally requires [Boost][] 1.77, which Conan cannot build with VS 2022.
|
||||
- Until rippled is updated for compatibility with later versions of Boost, Windows developers may need to use Visual Studio 2019.
|
||||
|
||||
[Boost]: https://www.boost.org/
|
||||
|
||||
## Steps
|
||||
|
||||
## Prerequisites
|
||||
### Set Up Conan
|
||||
|
||||
To build this package, you will need Python (>= 3.7),
|
||||
[Conan][] (>= 1.55), and [CMake][] (>= 3.16).
|
||||
After you have a [C++ development environment](./docs/build/environment.md) ready with Git, Python, Conan, CMake, and a C++ compiler, you may need to set up your Conan profile.
|
||||
|
||||
> **Warning**
|
||||
> The commands in this document are not meant to be blindly copied and pasted.
|
||||
> This document is written for multiple audiences,
|
||||
> meaning that your particular circumstances may require some commands and not
|
||||
> others.
|
||||
> You should never run any commands without understanding what they do
|
||||
> and why you are running them.
|
||||
>
|
||||
> These instructions assume a basic familiarity with Conan and CMake.
|
||||
> If you are unfamiliar with Conan,
|
||||
> then please read the [crash course](#a-crash-course-in-cmake-and-conan)
|
||||
> at the beginning of this document,
|
||||
> or the official [Getting Started][3] walkthrough.
|
||||
These instructions assume a basic familiarity with Conan and CMake.
|
||||
|
||||
[Conan]: https://conan.io/downloads.html
|
||||
[CMake]: https://cmake.org/download/
|
||||
If you are unfamiliar with Conan, then please read [this crash course](./docs/build/conan.md) or the official [Getting Started][3] walkthrough.
|
||||
|
||||
You'll need to compile in the C++20 dialect:
|
||||
You'll need at least one Conan profile:
|
||||
|
||||
```
|
||||
conan profile update settings.compiler.cppstd=20 default
|
||||
```
|
||||
```
|
||||
conan profile new default --detect
|
||||
```
|
||||
|
||||
Linux developers will commonly have a default Conan [profile][] that compiles
|
||||
Update the compiler settings:
|
||||
|
||||
```
|
||||
conan profile update settings.compiler.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
|
||||
```
|
||||
```
|
||||
conan profile update settings.compiler.libcxx=libstdc++11 default
|
||||
```
|
||||
|
||||
We find it necessary to use the x64 native build tools on Windows.
|
||||
**Windows** developers may need to 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.
|
||||
|
||||
Windows developers must build rippled and its dependencies for the x64
|
||||
architecture:
|
||||
Windows developers must also build `rippled` and its dependencies for the x64
|
||||
architecture:
|
||||
|
||||
```
|
||||
conan profile update settings.arch=x86_64 default
|
||||
```
|
||||
|
||||
### Multiple compilers
|
||||
|
||||
When `/usr/bin/g++` exists on a platform, it is the default cpp compiler. This
|
||||
default works for some users.
|
||||
|
||||
However, if this compiler cannot build rippled or its dependencies, then you can
|
||||
install another compiler and set Conan and CMake to use it.
|
||||
Update the `conf.tools.build:compiler_executables` setting in order to set the correct variables (`CMAKE_<LANG>_COMPILER`) in the
|
||||
generated CMake toolchain file.
|
||||
For example, on Ubuntu 20, you may have gcc at `/usr/bin/gcc` and g++ at `/usr/bin/g++`; if that is the case, you can select those compilers with:
|
||||
```
|
||||
conan profile update settings.arch=x86_64 default
|
||||
conan profile update 'conf.tools.build:compiler_executables={"c": "/usr/bin/gcc", "cpp": "/usr/bin/g++"}' default
|
||||
```
|
||||
|
||||
If you have multiple compilers installed on your platform,
|
||||
then you'll need to 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:
|
||||
|
||||
```
|
||||
conan profile update 'conf.tools.build:compiler_executables={"c": "<path>", "cpp": "<path>"}' default
|
||||
```
|
||||
Replace `/usr/bin/gcc` and `/usr/bin/g++` with paths to the desired compilers.
|
||||
|
||||
It should choose the compiler for dependencies as well,
|
||||
but not all of them have a Conan recipe that respects this setting (yet).
|
||||
For the rest, you can set these environment variables:
|
||||
For the rest, you can set these environment variables.
|
||||
Replace `<path>` with paths to the desired compilers:
|
||||
|
||||
```
|
||||
conan profile update env.CC=<path> default
|
||||
conan profile update env.CXX=<path> default
|
||||
```
|
||||
- `conan profile update env.CC=<path> default`
|
||||
- `conan profile update env.CXX=<path> default`
|
||||
|
||||
Export our [Conan recipe for Snappy](./external/snappy).
|
||||
It does not explicitly link the C++ standard library,
|
||||
which allows you to statically link it with GCC, if you want.
|
||||
|
||||
## How to build and test
|
||||
```
|
||||
conan export external/snappy snappy/1.1.10@
|
||||
```
|
||||
|
||||
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:
|
||||
Export our [Conan recipe for SOCI](./external/soci).
|
||||
It patches their CMake to correctly import its dependencies.
|
||||
|
||||
```
|
||||
conan export external/snappy snappy/1.1.9@
|
||||
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
|
||||
```
|
||||
```
|
||||
conan export external/soci soci/4.0.3@
|
||||
```
|
||||
|
||||
The second is for a multi-configuration generator (e.g. Visual Studio) on
|
||||
Windows:
|
||||
### Build and Test
|
||||
|
||||
```
|
||||
conan export external/snappy snappy/1.1.9@
|
||||
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
|
||||
```
|
||||
1. Create a build directory and move into it.
|
||||
|
||||
Now to explain the individual steps in each example:
|
||||
```
|
||||
mkdir .build
|
||||
cd .build
|
||||
```
|
||||
|
||||
1. Export our [Conan recipe for Snappy](./external/snappy).
|
||||
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.
|
||||
|
||||
It does not explicitly link the C++ standard library,
|
||||
which allows us to statically link it.
|
||||
**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.
|
||||
|
||||
1. Create a build directory (and move into it).
|
||||
2. Generate CMake files for every configuration you want to build.
|
||||
|
||||
You can choose any name you want.
|
||||
|
||||
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.
|
||||
|
||||
1. 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
|
||||
```
|
||||
|
||||
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 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.
|
||||
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.
|
||||
|
||||
When `build_type` is `Release`, `compiler.runtime` should be `MT`.
|
||||
|
||||
When `build_type` is `Debug`, `compiler.runtime` should be `MTd`.
|
||||
|
||||
1. Configure CMake once.
|
||||
```
|
||||
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
|
||||
```
|
||||
|
||||
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.
|
||||
3. Configure CMake and pass the toolchain file generated by Conan, located at
|
||||
`$OUTPUT_FOLDER/build/generators/conan_toolchain.cmake`.
|
||||
|
||||
This step is where you may pass build options for rippled.
|
||||
Single-config generators:
|
||||
|
||||
1. Build rippled.
|
||||
```
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release ..
|
||||
```
|
||||
|
||||
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`.
|
||||
Pass the CMake variable [`CMAKE_BUILD_TYPE`][build_type]
|
||||
and make sure it matches the `build_type` setting you chose in the previous
|
||||
step.
|
||||
|
||||
Multi-config generators:
|
||||
|
||||
```
|
||||
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
|
||||
```
|
||||
|
||||
5. Test rippled.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
|
||||
### Options
|
||||
## Options
|
||||
|
||||
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.
|
||||
| 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`. |
|
||||
|
||||
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].
|
||||
- `san` (): Enable a sanitizer with Clang. Choices are `thread` and `address`.
|
||||
[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.
|
||||
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
#### Conan
|
||||
|
||||
If you find trouble building dependencies after changing Conan settings,
|
||||
then you should retry after removing the Conan cache:
|
||||
|
||||
```
|
||||
rm -rf ~/.conan/data
|
||||
```
|
||||
## Troubleshooting
|
||||
|
||||
|
||||
#### no std::result_of
|
||||
### Conan
|
||||
|
||||
After any updates or changes to dependencies, you may need to do the following:
|
||||
|
||||
1. Remove your build directory.
|
||||
2. Remove the Conan cache:
|
||||
```
|
||||
rm -rf ~/.conan/data
|
||||
```
|
||||
4. Re-run [conan install](#build-and-test).
|
||||
|
||||
|
||||
### no std::result_of
|
||||
|
||||
If your compiler version is recent enough to have removed `std::result_of` as
|
||||
part of C++20, e.g. Apple Clang 15.0,
|
||||
then you might need to add a preprocessor definition to your bulid:
|
||||
part of C++20, e.g. Apple Clang 15.0, then you might need to add a preprocessor
|
||||
definition to your build.
|
||||
|
||||
```
|
||||
conan profile update 'options.boost:extra_b2_flags="define=BOOST_ASIO_HAS_STD_INVOKE_RESULT"' default
|
||||
conan profile update 'env.CFLAGS="-DBOOST_ASIO_HAS_STD_INVOKE_RESULT"' default
|
||||
conan profile update 'env.CXXFLAGS="-DBOOST_ASIO_HAS_STD_INVOKE_RESULT"' default
|
||||
conan profile update 'tools.build:cflags+=["-DBOOST_ASIO_HAS_STD_INVOKE_RESULT"]' default
|
||||
conan profile update 'tools.build:cxxflags+=["-DBOOST_ASIO_HAS_STD_INVOKE_RESULT"]' default
|
||||
conan profile update 'conf.tools.build:cflags+=["-DBOOST_ASIO_HAS_STD_INVOKE_RESULT"]' default
|
||||
conan profile update 'conf.tools.build:cxxflags+=["-DBOOST_ASIO_HAS_STD_INVOKE_RESULT"]' default
|
||||
```
|
||||
|
||||
|
||||
#### recompile with -fPIC
|
||||
### call to 'async_teardown' is ambiguous
|
||||
|
||||
If you are compiling with an early version of Clang 16, then you might hit
|
||||
a [regression][6] when compiling C++20 that manifests as an [error in a Boost
|
||||
header][7]. You can workaround it by adding this preprocessor definition:
|
||||
|
||||
```
|
||||
conan profile update 'env.CXXFLAGS="-DBOOST_ASIO_DISABLE_CONCEPTS"' default
|
||||
conan profile update 'conf.tools.build:cxxflags+=["-DBOOST_ASIO_DISABLE_CONCEPTS"]' default
|
||||
```
|
||||
|
||||
|
||||
### 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
|
||||
```
|
||||
|
||||
If you get a linker error like the one above 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`:
|
||||
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`.
|
||||
|
||||
```
|
||||
conan install --build boost ...
|
||||
```
|
||||
|
||||
|
||||
## How to add a dependency
|
||||
## Add a Dependency
|
||||
|
||||
If you want to experiment with a new package, here are the steps to get it
|
||||
working:
|
||||
If you want to experiment with a new package, follow these steps:
|
||||
|
||||
1. Search for the package on [Conan Center](https://conan.io/center/).
|
||||
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.
|
||||
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]: https://github.com/conan-io/conan-center-index/issues/13168
|
||||
[2]: https://en.cppreference.com/w/cpp/compiler_support/20
|
||||
[3]: https://docs.conan.io/en/latest/getting_started.html
|
||||
[5]: https://en.wikipedia.org/wiki/Unity_build
|
||||
[6]: https://github.com/boostorg/beast/issues/2648
|
||||
[7]: https://github.com/boostorg/beast/issues/2661
|
||||
[build_type]: https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html
|
||||
[runtime]: https://cmake.org/cmake/help/latest/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html
|
||||
[toolchain]: https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html
|
||||
|
||||
@@ -13,7 +13,6 @@ link_libraries (Ripple::common)
|
||||
set_target_properties (common
|
||||
PROPERTIES INTERFACE_POSITION_INDEPENDENT_CODE ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
target_compile_features (common INTERFACE cxx_std_17)
|
||||
target_compile_definitions (common
|
||||
INTERFACE
|
||||
$<$<CONFIG:Debug>:DEBUG _DEBUG>
|
||||
@@ -108,6 +107,7 @@ else ()
|
||||
-Wno-char-subscripts
|
||||
-Wno-format
|
||||
-Wno-unused-local-typedefs
|
||||
-fstack-protector
|
||||
$<$<BOOL:${is_gcc}>:
|
||||
-Wno-unused-but-set-variable
|
||||
-Wno-deprecated
|
||||
@@ -120,6 +120,7 @@ else ()
|
||||
target_link_libraries (common
|
||||
INTERFACE
|
||||
-rdynamic
|
||||
$<$<BOOL:${is_linux}>:-Wl,-z,relro,-z,now>
|
||||
# link to static libc/c++ iff:
|
||||
# * static option set and
|
||||
# * NOT APPLE (AppleClang does not support static libc/c++) and
|
||||
@@ -130,7 +131,16 @@ else ()
|
||||
>)
|
||||
endif ()
|
||||
|
||||
if (use_gold AND is_gcc)
|
||||
if (use_mold)
|
||||
# use mold linker if available
|
||||
execute_process (
|
||||
COMMAND ${CMAKE_CXX_COMPILER} -fuse-ld=mold -Wl,--version
|
||||
ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
|
||||
if ("${LD_VERSION}" MATCHES "mold")
|
||||
target_link_libraries (common INTERFACE -fuse-ld=mold)
|
||||
endif ()
|
||||
unset (LD_VERSION)
|
||||
elseif (use_gold AND is_gcc)
|
||||
# use gold linker if available
|
||||
execute_process (
|
||||
COMMAND ${CMAKE_CXX_COMPILER} -fuse-ld=gold -Wl,--version
|
||||
@@ -162,9 +172,7 @@ if (use_gold AND is_gcc)
|
||||
$<$<NOT:$<BOOL:${static}>>:-Wl,--disable-new-dtags>)
|
||||
endif ()
|
||||
unset (LD_VERSION)
|
||||
endif ()
|
||||
|
||||
if (use_lld)
|
||||
elseif (use_lld)
|
||||
# use lld linker if available
|
||||
execute_process (
|
||||
COMMAND ${CMAKE_CXX_COMPILER} -fuse-ld=lld -Wl,--version
|
||||
@@ -175,6 +183,7 @@ if (use_lld)
|
||||
unset (LD_VERSION)
|
||||
endif()
|
||||
|
||||
|
||||
if (assert)
|
||||
foreach (var_ CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELEASE)
|
||||
STRING (REGEX REPLACE "[-/]DNDEBUG" "" ${var_} "${${var_}}")
|
||||
|
||||
@@ -13,6 +13,10 @@ if (unity)
|
||||
set_target_properties(xrpl_core PROPERTIES UNITY_BUILD ON)
|
||||
endif ()
|
||||
|
||||
add_library(libxrpl INTERFACE)
|
||||
target_link_libraries(libxrpl INTERFACE xrpl_core)
|
||||
add_library(xrpl::libxrpl ALIAS libxrpl)
|
||||
|
||||
|
||||
#[===============================[
|
||||
beast/legacy FILES:
|
||||
@@ -70,6 +74,7 @@ target_sources (xrpl_core PRIVATE
|
||||
subdir: protocol
|
||||
#]===============================]
|
||||
src/ripple/protocol/impl/AccountID.cpp
|
||||
src/ripple/protocol/impl/AMMCore.cpp
|
||||
src/ripple/protocol/impl/Book.cpp
|
||||
src/ripple/protocol/impl/BuildInfo.cpp
|
||||
src/ripple/protocol/impl/ErrorCodes.cpp
|
||||
@@ -77,10 +82,13 @@ target_sources (xrpl_core PRIVATE
|
||||
src/ripple/protocol/impl/Indexes.cpp
|
||||
src/ripple/protocol/impl/InnerObjectFormats.cpp
|
||||
src/ripple/protocol/impl/Issue.cpp
|
||||
src/ripple/protocol/impl/STIssue.cpp
|
||||
src/ripple/protocol/impl/Keylet.cpp
|
||||
src/ripple/protocol/impl/LedgerFormats.cpp
|
||||
src/ripple/protocol/impl/LedgerHeader.cpp
|
||||
src/ripple/protocol/impl/PublicKey.cpp
|
||||
src/ripple/protocol/impl/Quality.cpp
|
||||
src/ripple/protocol/impl/QualityFunction.cpp
|
||||
src/ripple/protocol/impl/Rate2.cpp
|
||||
src/ripple/protocol/impl/Rules.cpp
|
||||
src/ripple/protocol/impl/SField.cpp
|
||||
@@ -95,7 +103,9 @@ target_sources (xrpl_core PRIVATE
|
||||
src/ripple/protocol/impl/STObject.cpp
|
||||
src/ripple/protocol/impl/STParsedJSON.cpp
|
||||
src/ripple/protocol/impl/STPathSet.cpp
|
||||
src/ripple/protocol/impl/STXChainBridge.cpp
|
||||
src/ripple/protocol/impl/STTx.cpp
|
||||
src/ripple/protocol/impl/XChainAttestations.cpp
|
||||
src/ripple/protocol/impl/STValidation.cpp
|
||||
src/ripple/protocol/impl/STVar.cpp
|
||||
src/ripple/protocol/impl/STVector256.cpp
|
||||
@@ -109,6 +119,9 @@ target_sources (xrpl_core PRIVATE
|
||||
src/ripple/protocol/impl/UintTypes.cpp
|
||||
src/ripple/protocol/impl/digest.cpp
|
||||
src/ripple/protocol/impl/tokens.cpp
|
||||
src/ripple/protocol/impl/NFTSyntheticSerializer.cpp
|
||||
src/ripple/protocol/impl/NFTokenID.cpp
|
||||
src/ripple/protocol/impl/NFTokenOfferID.cpp
|
||||
#[===============================[
|
||||
main sources:
|
||||
subdir: crypto
|
||||
@@ -145,31 +158,54 @@ target_link_libraries (xrpl_core
|
||||
#]=================================]
|
||||
install (
|
||||
FILES
|
||||
src/ripple/basics/algorithm.h
|
||||
src/ripple/basics/Archive.h
|
||||
src/ripple/basics/base64.h
|
||||
src/ripple/basics/base_uint.h
|
||||
src/ripple/basics/BasicConfig.h
|
||||
src/ripple/basics/Blob.h
|
||||
src/ripple/basics/Buffer.h
|
||||
src/ripple/basics/ByteUtilities.h
|
||||
src/ripple/basics/chrono.h
|
||||
src/ripple/basics/comparators.h
|
||||
src/ripple/basics/CompressionAlgorithms.h
|
||||
src/ripple/basics/contract.h
|
||||
src/ripple/basics/CountedObject.h
|
||||
src/ripple/basics/DecayingSample.h
|
||||
src/ripple/basics/Expected.h
|
||||
src/ripple/basics/FeeUnits.h
|
||||
src/ripple/basics/FileUtilities.h
|
||||
src/ripple/basics/hardened_hash.h
|
||||
src/ripple/basics/IOUAmount.h
|
||||
src/ripple/basics/join.h
|
||||
src/ripple/basics/KeyCache.h
|
||||
src/ripple/basics/LocalValue.h
|
||||
src/ripple/basics/Log.h
|
||||
src/ripple/basics/make_SSLContext.h
|
||||
src/ripple/basics/MathUtilities.h
|
||||
src/ripple/basics/mulDiv.h
|
||||
src/ripple/basics/Number.h
|
||||
src/ripple/basics/partitioned_unordered_map.h
|
||||
src/ripple/basics/PerfLog.h
|
||||
src/ripple/basics/random.h
|
||||
src/ripple/basics/RangeSet.h
|
||||
src/ripple/basics/README.md
|
||||
src/ripple/basics/ResolverAsio.h
|
||||
src/ripple/basics/Resolver.h
|
||||
src/ripple/basics/safe_cast.h
|
||||
src/ripple/basics/scope.h
|
||||
src/ripple/basics/SHAMapHash.h
|
||||
src/ripple/basics/Slice.h
|
||||
src/ripple/basics/spinlock.h
|
||||
src/ripple/basics/strHex.h
|
||||
src/ripple/basics/StringUtilities.h
|
||||
src/ripple/basics/TaggedCache.h
|
||||
src/ripple/basics/tagged_integer.h
|
||||
src/ripple/basics/ThreadSafetyAnalysis.h
|
||||
src/ripple/basics/ToString.h
|
||||
src/ripple/basics/UnorderedContainers.h
|
||||
src/ripple/basics/UptimeClock.h
|
||||
src/ripple/basics/XRPAmount.h
|
||||
src/ripple/basics/algorithm.h
|
||||
src/ripple/basics/base_uint.h
|
||||
src/ripple/basics/chrono.h
|
||||
src/ripple/basics/contract.h
|
||||
src/ripple/basics/FeeUnits.h
|
||||
src/ripple/basics/hardened_hash.h
|
||||
src/ripple/basics/strHex.h
|
||||
DESTINATION include/ripple/basics)
|
||||
install (
|
||||
FILES
|
||||
@@ -180,6 +216,7 @@ install (
|
||||
install (
|
||||
FILES
|
||||
src/ripple/json/JsonPropertyStream.h
|
||||
src/ripple/json/MultivarJson.h
|
||||
src/ripple/json/Object.h
|
||||
src/ripple/json/Output.h
|
||||
src/ripple/json/Writer.h
|
||||
@@ -196,28 +233,37 @@ install (
|
||||
install (
|
||||
FILES
|
||||
src/ripple/protocol/AccountID.h
|
||||
src/ripple/protocol/AMMCore.h
|
||||
src/ripple/protocol/AmountConversions.h
|
||||
src/ripple/protocol/Book.h
|
||||
src/ripple/protocol/BuildInfo.h
|
||||
src/ripple/protocol/ErrorCodes.h
|
||||
src/ripple/protocol/Feature.h
|
||||
src/ripple/protocol/Fees.h
|
||||
src/ripple/protocol/HashPrefix.h
|
||||
src/ripple/protocol/Indexes.h
|
||||
src/ripple/protocol/InnerObjectFormats.h
|
||||
src/ripple/protocol/Issue.h
|
||||
src/ripple/protocol/json_get_or_throw.h
|
||||
src/ripple/protocol/KeyType.h
|
||||
src/ripple/protocol/Keylet.h
|
||||
src/ripple/protocol/KnownFormats.h
|
||||
src/ripple/protocol/LedgerFormats.h
|
||||
src/ripple/protocol/LedgerHeader.h
|
||||
src/ripple/protocol/NFTSyntheticSerializer.h
|
||||
src/ripple/protocol/NFTokenID.h
|
||||
src/ripple/protocol/NFTokenOfferID.h
|
||||
src/ripple/protocol/Protocol.h
|
||||
src/ripple/protocol/PublicKey.h
|
||||
src/ripple/protocol/Quality.h
|
||||
src/ripple/protocol/QualityFunction.h
|
||||
src/ripple/protocol/Rate.h
|
||||
src/ripple/protocol/Rules.h
|
||||
src/ripple/protocol/SField.h
|
||||
src/ripple/protocol/SOTemplate.h
|
||||
src/ripple/protocol/STAccount.h
|
||||
src/ripple/protocol/STAmount.h
|
||||
src/ripple/protocol/STIssue.h
|
||||
src/ripple/protocol/STArray.h
|
||||
src/ripple/protocol/STBase.h
|
||||
src/ripple/protocol/STBitString.h
|
||||
@@ -229,6 +275,8 @@ install (
|
||||
src/ripple/protocol/STParsedJSON.h
|
||||
src/ripple/protocol/STPathSet.h
|
||||
src/ripple/protocol/STTx.h
|
||||
src/ripple/protocol/XChainAttestations.h
|
||||
src/ripple/protocol/STXChainBridge.h
|
||||
src/ripple/protocol/STValidation.h
|
||||
src/ripple/protocol/STVector256.h
|
||||
src/ripple/protocol/SecretKey.h
|
||||
@@ -244,6 +292,9 @@ install (
|
||||
src/ripple/protocol/UintTypes.h
|
||||
src/ripple/protocol/digest.h
|
||||
src/ripple/protocol/jss.h
|
||||
src/ripple/protocol/serialize.h
|
||||
src/ripple/protocol/nft.h
|
||||
src/ripple/protocol/nftPageMask.h
|
||||
src/ripple/protocol/tokens.h
|
||||
DESTINATION include/ripple/protocol)
|
||||
install (
|
||||
@@ -263,6 +314,7 @@ install (
|
||||
DESTINATION include/ripple/beast/clock)
|
||||
install (
|
||||
FILES
|
||||
src/ripple/beast/core/CurrentThreadName.h
|
||||
src/ripple/beast/core/LexicalCast.h
|
||||
src/ripple/beast/core/List.h
|
||||
src/ripple/beast/core/SemanticVersion.h
|
||||
@@ -276,6 +328,14 @@ install (
|
||||
install (
|
||||
FILES src/ripple/beast/hash/impl/xxhash.h
|
||||
DESTINATION include/ripple/beast/hash/impl)
|
||||
install (
|
||||
FILES
|
||||
src/ripple/beast/net/IPAddress.h
|
||||
src/ripple/beast/net/IPAddressConversion.h
|
||||
src/ripple/beast/net/IPAddressV4.h
|
||||
src/ripple/beast/net/IPAddressV6.h
|
||||
src/ripple/beast/net/IPEndpoint.h
|
||||
DESTINATION include/ripple/beast/net)
|
||||
install (
|
||||
FILES
|
||||
src/ripple/beast/rfc2616.h
|
||||
@@ -283,6 +343,26 @@ install (
|
||||
src/ripple/beast/unit_test.h
|
||||
src/ripple/beast/xor_shift_engine.h
|
||||
DESTINATION include/ripple/beast)
|
||||
install (
|
||||
FILES
|
||||
src/ripple/beast/unit_test/amount.hpp
|
||||
src/ripple/beast/unit_test/dstream.hpp
|
||||
src/ripple/beast/unit_test/global_suites.hpp
|
||||
src/ripple/beast/unit_test/main.cpp
|
||||
src/ripple/beast/unit_test/match.hpp
|
||||
src/ripple/beast/unit_test/recorder.hpp
|
||||
src/ripple/beast/unit_test/reporter.hpp
|
||||
src/ripple/beast/unit_test/results.hpp
|
||||
src/ripple/beast/unit_test/runner.hpp
|
||||
src/ripple/beast/unit_test/suite.hpp
|
||||
src/ripple/beast/unit_test/suite_info.hpp
|
||||
src/ripple/beast/unit_test/suite_list.hpp
|
||||
src/ripple/beast/unit_test/thread.hpp
|
||||
DESTINATION include/ripple/beast/unit_test)
|
||||
install (
|
||||
FILES
|
||||
src/ripple/beast/unit_test/detail/const_container.hpp
|
||||
DESTINATION include/ripple/beast/unit_test/detail)
|
||||
install (
|
||||
FILES
|
||||
src/ripple/beast/utility/Journal.h
|
||||
@@ -376,6 +456,8 @@ target_sources (rippled PRIVATE
|
||||
src/ripple/app/reporting/ReportingETL.cpp
|
||||
src/ripple/app/reporting/ETLSource.cpp
|
||||
src/ripple/app/reporting/P2pProxy.cpp
|
||||
src/ripple/app/misc/impl/AMMHelpers.cpp
|
||||
src/ripple/app/misc/impl/AMMUtils.cpp
|
||||
src/ripple/app/misc/CanonicalTXSet.cpp
|
||||
src/ripple/app/misc/FeeVoteImpl.cpp
|
||||
src/ripple/app/misc/HashRouter.cpp
|
||||
@@ -385,6 +467,7 @@ target_sources (rippled PRIVATE
|
||||
src/ripple/app/misc/detail/impl/WorkSSL.cpp
|
||||
src/ripple/app/misc/impl/AccountTxPaging.cpp
|
||||
src/ripple/app/misc/impl/AmendmentTable.cpp
|
||||
src/ripple/app/misc/impl/DeliverMax.cpp
|
||||
src/ripple/app/misc/impl/LoadFeeTrack.cpp
|
||||
src/ripple/app/misc/impl/Manifest.cpp
|
||||
src/ripple/app/misc/impl/Transaction.cpp
|
||||
@@ -401,6 +484,8 @@ target_sources (rippled PRIVATE
|
||||
src/ripple/app/paths/RippleCalc.cpp
|
||||
src/ripple/app/paths/RippleLineCache.cpp
|
||||
src/ripple/app/paths/TrustLine.cpp
|
||||
src/ripple/app/paths/impl/AMMLiquidity.cpp
|
||||
src/ripple/app/paths/impl/AMMOffer.cpp
|
||||
src/ripple/app/paths/impl/BookStep.cpp
|
||||
src/ripple/app/paths/impl/DirectStep.cpp
|
||||
src/ripple/app/paths/impl/PaySteps.cpp
|
||||
@@ -417,17 +502,25 @@ target_sources (rippled PRIVATE
|
||||
src/ripple/app/rdb/impl/UnitaryShard.cpp
|
||||
src/ripple/app/rdb/impl/Vacuum.cpp
|
||||
src/ripple/app/rdb/impl/Wallet.cpp
|
||||
src/ripple/app/tx/impl/AMMBid.cpp
|
||||
src/ripple/app/tx/impl/AMMCreate.cpp
|
||||
src/ripple/app/tx/impl/AMMDelete.cpp
|
||||
src/ripple/app/tx/impl/AMMDeposit.cpp
|
||||
src/ripple/app/tx/impl/AMMVote.cpp
|
||||
src/ripple/app/tx/impl/AMMWithdraw.cpp
|
||||
src/ripple/app/tx/impl/ApplyContext.cpp
|
||||
src/ripple/app/tx/impl/BookTip.cpp
|
||||
src/ripple/app/tx/impl/CancelCheck.cpp
|
||||
src/ripple/app/tx/impl/CancelOffer.cpp
|
||||
src/ripple/app/tx/impl/CashCheck.cpp
|
||||
src/ripple/app/tx/impl/Change.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/DeleteAccount.cpp
|
||||
src/ripple/app/tx/impl/DepositPreauth.cpp
|
||||
src/ripple/app/tx/impl/DID.cpp
|
||||
src/ripple/app/tx/impl/Escrow.cpp
|
||||
src/ripple/app/tx/impl/InvariantCheck.cpp
|
||||
src/ripple/app/tx/impl/NFTokenAcceptOffer.cpp
|
||||
@@ -442,6 +535,7 @@ target_sources (rippled PRIVATE
|
||||
src/ripple/app/tx/impl/SetRegularKey.cpp
|
||||
src/ripple/app/tx/impl/SetSignerList.cpp
|
||||
src/ripple/app/tx/impl/SetTrust.cpp
|
||||
src/ripple/app/tx/impl/XChainBridge.cpp
|
||||
src/ripple/app/tx/impl/SignerEntries.cpp
|
||||
src/ripple/app/tx/impl/Taker.cpp
|
||||
src/ripple/app/tx/impl/Transactor.cpp
|
||||
@@ -476,9 +570,7 @@ target_sources (rippled PRIVATE
|
||||
src/ripple/core/impl/JobQueue.cpp
|
||||
src/ripple/core/impl/LoadEvent.cpp
|
||||
src/ripple/core/impl/LoadMonitor.cpp
|
||||
src/ripple/core/impl/SNTPClock.cpp
|
||||
src/ripple/core/impl/SociDB.cpp
|
||||
src/ripple/core/impl/TimeKeeper.cpp
|
||||
src/ripple/core/impl/Workers.cpp
|
||||
src/ripple/core/Pg.cpp
|
||||
#[===============================[
|
||||
@@ -532,7 +624,6 @@ target_sources (rippled PRIVATE
|
||||
src/ripple/nodestore/impl/DeterministicShard.cpp
|
||||
src/ripple/nodestore/impl/DecodedBlob.cpp
|
||||
src/ripple/nodestore/impl/DummyScheduler.cpp
|
||||
src/ripple/nodestore/impl/EncodedBlob.cpp
|
||||
src/ripple/nodestore/impl/ManagerImp.cpp
|
||||
src/ripple/nodestore/impl/NodeObject.cpp
|
||||
src/ripple/nodestore/impl/Shard.cpp
|
||||
@@ -582,6 +673,7 @@ target_sources (rippled PRIVATE
|
||||
src/ripple/rpc/handlers/AccountObjects.cpp
|
||||
src/ripple/rpc/handlers/AccountOffers.cpp
|
||||
src/ripple/rpc/handlers/AccountTx.cpp
|
||||
src/ripple/rpc/handlers/AMMInfo.cpp
|
||||
src/ripple/rpc/handlers/BlackList.cpp
|
||||
src/ripple/rpc/handlers/BookOffers.cpp
|
||||
src/ripple/rpc/handlers/CanDelete.cpp
|
||||
@@ -645,7 +737,7 @@ target_sources (rippled PRIVATE
|
||||
src/ripple/rpc/impl/RPCHandler.cpp
|
||||
src/ripple/rpc/impl/RPCHelpers.cpp
|
||||
src/ripple/rpc/impl/Role.cpp
|
||||
src/ripple/rpc/impl/ServerHandlerImp.cpp
|
||||
src/ripple/rpc/impl/ServerHandler.cpp
|
||||
src/ripple/rpc/impl/ShardArchiveHandler.cpp
|
||||
src/ripple/rpc/impl/ShardVerificationScheduler.cpp
|
||||
src/ripple/rpc/impl/Status.cpp
|
||||
@@ -685,11 +777,16 @@ if (tests)
|
||||
src/test/app/AccountDelete_test.cpp
|
||||
src/test/app/AccountTxPaging_test.cpp
|
||||
src/test/app/AmendmentTable_test.cpp
|
||||
src/test/app/AMM_test.cpp
|
||||
src/test/app/AMMCalc_test.cpp
|
||||
src/test/app/AMMExtended_test.cpp
|
||||
src/test/app/Check_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
|
||||
src/test/app/Discrepancy_test.cpp
|
||||
src/test/app/DID_test.cpp
|
||||
src/test/app/DNS_test.cpp
|
||||
src/test/app/Escrow_test.cpp
|
||||
src/test/app/FeeVote_test.cpp
|
||||
@@ -698,10 +795,12 @@ if (tests)
|
||||
src/test/app/HashRouter_test.cpp
|
||||
src/test/app/LedgerHistory_test.cpp
|
||||
src/test/app/LedgerLoad_test.cpp
|
||||
src/test/app/LedgerMaster_test.cpp
|
||||
src/test/app/LedgerReplay_test.cpp
|
||||
src/test/app/LoadFeeTrack_test.cpp
|
||||
src/test/app/Manifest_test.cpp
|
||||
src/test/app/MultiSign_test.cpp
|
||||
src/test/app/NetworkID_test.cpp
|
||||
src/test/app/NFToken_test.cpp
|
||||
src/test/app/NFTokenBurn_test.cpp
|
||||
src/test/app/NFTokenDir_test.cpp
|
||||
@@ -714,8 +813,10 @@ if (tests)
|
||||
src/test/app/PseudoTx_test.cpp
|
||||
src/test/app/RCLCensorshipDetector_test.cpp
|
||||
src/test/app/RCLValidations_test.cpp
|
||||
src/test/app/ReducedOffer_test.cpp
|
||||
src/test/app/Regression_test.cpp
|
||||
src/test/app/SHAMapStore_test.cpp
|
||||
src/test/app/XChain_test.cpp
|
||||
src/test/app/SetAuth_test.cpp
|
||||
src/test/app/SetRegularKey_test.cpp
|
||||
src/test/app/SetTrust_test.cpp
|
||||
@@ -817,6 +918,7 @@ if (tests)
|
||||
src/test/json/Output_test.cpp
|
||||
src/test/json/Writer_test.cpp
|
||||
src/test/json/json_value_test.cpp
|
||||
src/test/json/MultivarJson_test.cpp
|
||||
#[===============================[
|
||||
test sources:
|
||||
subdir: jtx
|
||||
@@ -824,17 +926,21 @@ if (tests)
|
||||
src/test/jtx/Env_test.cpp
|
||||
src/test/jtx/WSClient_test.cpp
|
||||
src/test/jtx/impl/Account.cpp
|
||||
src/test/jtx/impl/AMM.cpp
|
||||
src/test/jtx/impl/AMMTest.cpp
|
||||
src/test/jtx/impl/Env.cpp
|
||||
src/test/jtx/impl/JSONRPCClient.cpp
|
||||
src/test/jtx/impl/ManualTimeKeeper.cpp
|
||||
src/test/jtx/impl/TestHelpers.cpp
|
||||
src/test/jtx/impl/WSClient.cpp
|
||||
src/test/jtx/impl/acctdelete.cpp
|
||||
src/test/jtx/impl/account_txn_id.cpp
|
||||
src/test/jtx/impl/amount.cpp
|
||||
src/test/jtx/impl/attester.cpp
|
||||
src/test/jtx/impl/balance.cpp
|
||||
src/test/jtx/impl/check.cpp
|
||||
src/test/jtx/impl/delivermin.cpp
|
||||
src/test/jtx/impl/deposit.cpp
|
||||
src/test/jtx/impl/did.cpp
|
||||
src/test/jtx/impl/envconfig.cpp
|
||||
src/test/jtx/impl/fee.cpp
|
||||
src/test/jtx/impl/flags.cpp
|
||||
@@ -852,6 +958,7 @@ if (tests)
|
||||
src/test/jtx/impl/regkey.cpp
|
||||
src/test/jtx/impl/sendmax.cpp
|
||||
src/test/jtx/impl/seq.cpp
|
||||
src/test/jtx/impl/xchain_bridge.cpp
|
||||
src/test/jtx/impl/sig.cpp
|
||||
src/test/jtx/impl/tag.cpp
|
||||
src/test/jtx/impl/ticket.cpp
|
||||
@@ -942,6 +1049,7 @@ if (tests)
|
||||
src/test/rpc/AccountSet_test.cpp
|
||||
src/test/rpc/AccountTx_test.cpp
|
||||
src/test/rpc/AmendmentBlocked_test.cpp
|
||||
src/test/rpc/AMMInfo_test.cpp
|
||||
src/test/rpc/Book_test.cpp
|
||||
src/test/rpc/DepositAuthorized_test.cpp
|
||||
src/test/rpc/DeliveredAmount_test.cpp
|
||||
@@ -952,6 +1060,7 @@ if (tests)
|
||||
src/test/rpc/KeyGeneration_test.cpp
|
||||
src/test/rpc/LedgerClosed_test.cpp
|
||||
src/test/rpc/LedgerData_test.cpp
|
||||
src/test/rpc/LedgerHeader_test.cpp
|
||||
src/test/rpc/LedgerRPC_test.cpp
|
||||
src/test/rpc/LedgerRequestRPC_test.cpp
|
||||
src/test/rpc/ManifestRPC_test.cpp
|
||||
@@ -975,6 +1084,7 @@ if (tests)
|
||||
src/test/rpc/ValidatorInfo_test.cpp
|
||||
src/test/rpc/ValidatorRPC_test.cpp
|
||||
src/test/rpc/Version_test.cpp
|
||||
src/test/rpc/Handler_test.cpp
|
||||
#[===============================[
|
||||
test sources:
|
||||
subdir: server
|
||||
|
||||
@@ -14,7 +14,7 @@ if (is_multiconfig)
|
||||
file(GLOB md_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} CONFIGURE_DEPENDS
|
||||
*.md)
|
||||
LIST(APPEND all_sources ${md_files})
|
||||
foreach (_target secp256k1::secp256k1 ed25519::ed25519 pbufs xrpl_core rippled)
|
||||
foreach (_target secp256k1::secp256k1 ed25519::ed25519 xrpl_core rippled)
|
||||
get_target_property (_type ${_target} TYPE)
|
||||
if(_type STREQUAL "INTERFACE_LIBRARY")
|
||||
continue()
|
||||
|
||||
@@ -49,7 +49,7 @@ if (is_root_project)
|
||||
docker run
|
||||
-v ${CMAKE_CURRENT_SOURCE_DIR}:/opt/rippled_bld/pkg/rippled
|
||||
-v ${CMAKE_CURRENT_BINARY_DIR}/packages:/opt/rippled_bld/pkg/out
|
||||
-t rippleci/rippled-rpm-builder:${container_label}
|
||||
-t rippled-rpm-builder:${container_label}
|
||||
/bin/bash -c "cp -fpu rippled/Builds/containers/packaging/rpm/build_rpm.sh . && ./build_rpm.sh"
|
||||
VERBATIM
|
||||
USES_TERMINAL
|
||||
|
||||
@@ -37,6 +37,7 @@ if (is_linux)
|
||||
option (static "link protobuf, openssl, libc++, and boost statically" ON)
|
||||
option (perf "Enables flags that assist with perf recording" OFF)
|
||||
option (use_gold "enables detection of gold (binutils) linker" ON)
|
||||
option (use_mold "enables detection of mold (binutils) linker" ON)
|
||||
else ()
|
||||
# we are not ready to allow shared-libs on windows because it would require
|
||||
# export declarations. On macos it's more feasible, but static openssl
|
||||
@@ -45,6 +46,7 @@ else ()
|
||||
set (static ON CACHE BOOL "static link, linux only. ON for WIN/macos" FORCE)
|
||||
set (perf OFF CACHE BOOL "perf flags, linux only" FORCE)
|
||||
set (use_gold OFF CACHE BOOL "gold linker, linux only" FORCE)
|
||||
set (use_mold OFF CACHE BOOL "mold linker, linux only" FORCE)
|
||||
endif ()
|
||||
if (is_clang)
|
||||
option (use_lld "enables detection of lld linker" ON)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
find_package(Boost 1.70 REQUIRED
|
||||
find_package(Boost 1.82 REQUIRED
|
||||
COMPONENTS
|
||||
chrono
|
||||
container
|
||||
@@ -6,6 +6,7 @@ find_package(Boost 1.70 REQUIRED
|
||||
coroutine
|
||||
date_time
|
||||
filesystem
|
||||
json
|
||||
program_options
|
||||
regex
|
||||
system
|
||||
@@ -29,6 +30,7 @@ target_link_libraries(ripple_boost
|
||||
Boost::coroutine
|
||||
Boost::date_time
|
||||
Boost::filesystem
|
||||
Boost::json
|
||||
Boost::program_options
|
||||
Boost::regex
|
||||
Boost::system
|
||||
|
||||
@@ -1,22 +1,27 @@
|
||||
find_package(Protobuf 3.8)
|
||||
|
||||
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/proto_gen)
|
||||
set(output_dir ${CMAKE_BINARY_DIR}/proto_gen)
|
||||
file(MAKE_DIRECTORY ${output_dir})
|
||||
set(ccbd ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set(CMAKE_CURRENT_BINARY_DIR ${CMAKE_BINARY_DIR}/proto_gen)
|
||||
set(CMAKE_CURRENT_BINARY_DIR ${output_dir})
|
||||
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS src/ripple/proto/ripple.proto)
|
||||
set(CMAKE_CURRENT_BINARY_DIR ${ccbd})
|
||||
|
||||
add_library(pbufs STATIC ${PROTO_SRCS} ${PROTO_HDRS})
|
||||
target_include_directories(pbufs SYSTEM PUBLIC
|
||||
${CMAKE_BINARY_DIR}/proto_gen
|
||||
${CMAKE_BINARY_DIR}/proto_gen/src/ripple/proto
|
||||
target_include_directories(xrpl_core SYSTEM PUBLIC
|
||||
# The generated implementation imports the header relative to the output
|
||||
# directory.
|
||||
$<BUILD_INTERFACE:${output_dir}>
|
||||
$<BUILD_INTERFACE:${output_dir}/src>
|
||||
)
|
||||
target_link_libraries(pbufs protobuf::libprotobuf)
|
||||
target_compile_options(pbufs
|
||||
target_sources(xrpl_core PRIVATE ${output_dir}/src/ripple/proto/ripple.pb.cc)
|
||||
install(
|
||||
FILES ${output_dir}/src/ripple/proto/ripple.pb.h
|
||||
DESTINATION include/ripple/proto)
|
||||
target_link_libraries(xrpl_core PUBLIC protobuf::libprotobuf)
|
||||
target_compile_options(xrpl_core
|
||||
PUBLIC
|
||||
$<$<BOOL:${XCODE}>:
|
||||
--system-header-prefix="google/protobuf"
|
||||
-Wno-deprecated-dynamic-exception-spec
|
||||
>
|
||||
)
|
||||
add_library(Ripple::pbufs ALIAS pbufs)
|
||||
|
||||
@@ -5,21 +5,30 @@ find_package(gRPC 1.23)
|
||||
grpc defs and bundle into a
|
||||
static lib
|
||||
#]=================================]
|
||||
set(GRPC_GEN_DIR "${CMAKE_BINARY_DIR}/proto_gen_grpc")
|
||||
set(output_dir "${CMAKE_BINARY_DIR}/proto_gen_grpc")
|
||||
set(GRPC_GEN_DIR "${output_dir}/ripple/proto")
|
||||
file(MAKE_DIRECTORY ${GRPC_GEN_DIR})
|
||||
set(GRPC_PROTO_SRCS)
|
||||
set(GRPC_PROTO_HDRS)
|
||||
set(GRPC_PROTO_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/src/ripple/proto/org")
|
||||
file(GLOB_RECURSE GRPC_DEFINITION_FILES LIST_DIRECTORIES false "${GRPC_PROTO_ROOT}/*.proto")
|
||||
file(GLOB_RECURSE GRPC_DEFINITION_FILES "${GRPC_PROTO_ROOT}/*.proto")
|
||||
foreach(file ${GRPC_DEFINITION_FILES})
|
||||
# /home/user/rippled/src/ripple/proto/org/.../v1/get_ledger.proto
|
||||
get_filename_component(_abs_file ${file} ABSOLUTE)
|
||||
# /home/user/rippled/src/ripple/proto/org/.../v1
|
||||
get_filename_component(_abs_dir ${_abs_file} DIRECTORY)
|
||||
# get_ledger
|
||||
get_filename_component(_basename ${file} NAME_WE)
|
||||
# /home/user/rippled/src/ripple/proto
|
||||
get_filename_component(_proto_inc ${GRPC_PROTO_ROOT} DIRECTORY) # updir one level
|
||||
# org/.../v1/get_ledger.proto
|
||||
file(RELATIVE_PATH _rel_root_file ${_proto_inc} ${_abs_file})
|
||||
# org/.../v1
|
||||
get_filename_component(_rel_root_dir ${_rel_root_file} DIRECTORY)
|
||||
# src/ripple/proto/org/.../v1
|
||||
file(RELATIVE_PATH _rel_dir ${CMAKE_CURRENT_SOURCE_DIR} ${_abs_dir})
|
||||
|
||||
# .cmake/proto_gen_grpc/ripple/proto/org/.../v1/get_ledger.grpc.pb.cc
|
||||
set(src_1 "${GRPC_GEN_DIR}/${_rel_root_dir}/${_basename}.grpc.pb.cc")
|
||||
set(src_2 "${GRPC_GEN_DIR}/${_rel_root_dir}/${_basename}.pb.cc")
|
||||
set(hdr_1 "${GRPC_GEN_DIR}/${_rel_root_dir}/${_basename}.grpc.pb.h")
|
||||
@@ -36,20 +45,32 @@ foreach(file ${GRPC_DEFINITION_FILES})
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMENT "Running gRPC C++ protocol buffer compiler on ${file}"
|
||||
VERBATIM)
|
||||
set_source_files_properties(${src_1} ${src_2} ${hdr_1} ${hdr_2} PROPERTIES GENERATED TRUE)
|
||||
set_source_files_properties(${src_1} ${src_2} ${hdr_1} ${hdr_2} PROPERTIES
|
||||
GENERATED TRUE
|
||||
SKIP_UNITY_BUILD_INCLUSION ON
|
||||
)
|
||||
list(APPEND GRPC_PROTO_SRCS ${src_1} ${src_2})
|
||||
list(APPEND GRPC_PROTO_HDRS ${hdr_1} ${hdr_2})
|
||||
endforeach()
|
||||
|
||||
add_library(grpc_pbufs STATIC ${GRPC_PROTO_SRCS} ${GRPC_PROTO_HDRS})
|
||||
#target_include_directories(grpc_pbufs PRIVATE src)
|
||||
target_include_directories(grpc_pbufs SYSTEM PUBLIC ${GRPC_GEN_DIR})
|
||||
target_link_libraries(grpc_pbufs
|
||||
target_include_directories(xrpl_core SYSTEM PUBLIC
|
||||
$<BUILD_INTERFACE:${output_dir}>
|
||||
$<BUILD_INTERFACE:${output_dir}/ripple/proto>
|
||||
# The generated sources include headers relative to this path. Fix it later.
|
||||
$<INSTALL_INTERFACE:include/ripple/proto>
|
||||
)
|
||||
target_sources(xrpl_core PRIVATE ${GRPC_PROTO_SRCS})
|
||||
install(
|
||||
DIRECTORY ${output_dir}/ripple
|
||||
DESTINATION include/
|
||||
FILES_MATCHING PATTERN "*.h"
|
||||
)
|
||||
target_link_libraries(xrpl_core PUBLIC
|
||||
"gRPC::grpc++"
|
||||
# libgrpc is missing references.
|
||||
absl::random_random
|
||||
)
|
||||
target_compile_options(grpc_pbufs
|
||||
target_compile_options(xrpl_core
|
||||
PRIVATE
|
||||
$<$<BOOL:${MSVC}>:-wd4065>
|
||||
$<$<NOT:$<BOOL:${MSVC}>>:-Wno-deprecated-declarations>
|
||||
@@ -59,4 +80,3 @@ target_compile_options(grpc_pbufs
|
||||
--system-header-prefix="google/protobuf"
|
||||
-Wno-deprecated-dynamic-exception-spec
|
||||
>)
|
||||
add_library(Ripple::grpc_pbufs ALIAS grpc_pbufs)
|
||||
|
||||
1
Builds/README.md
Normal file
1
Builds/README.md
Normal file
@@ -0,0 +1 @@
|
||||
[Please see the BUILD instructions here](../BUILD.md)
|
||||
@@ -1 +0,0 @@
|
||||
[Build instructions are currently located in `BUILD.md`](../../BUILD.md)
|
||||
@@ -1,45 +0,0 @@
|
||||
{
|
||||
// See https://go.microsoft.com//fwlink//?linkid=834763 for more information about this file.
|
||||
"configurations": [
|
||||
{
|
||||
"name": "x64-Debug",
|
||||
"generator": "Visual Studio 16 2019",
|
||||
"configurationType": "Debug",
|
||||
"inheritEnvironments": [ "msvc_x64_x64" ],
|
||||
"buildRoot": "${thisFileDir}\\build\\${name}",
|
||||
"cmakeCommandArgs": "",
|
||||
"buildCommandArgs": "-v:minimal",
|
||||
"ctestCommandArgs": "",
|
||||
"variables": [
|
||||
{
|
||||
"name": "BOOST_ROOT",
|
||||
"value": "C:\\lib\\boost"
|
||||
},
|
||||
{
|
||||
"name": "OPENSSL_ROOT",
|
||||
"value": "C:\\lib\\OpenSSL-Win64"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "x64-Release",
|
||||
"generator": "Visual Studio 16 2019",
|
||||
"configurationType": "Release",
|
||||
"inheritEnvironments": [ "msvc_x64_x64" ],
|
||||
"buildRoot": "${thisFileDir}\\build\\${name}",
|
||||
"cmakeCommandArgs": "",
|
||||
"buildCommandArgs": "-v:minimal",
|
||||
"ctestCommandArgs": "",
|
||||
"variables": [
|
||||
{
|
||||
"name": "BOOST_ROOT",
|
||||
"value": "C:\\lib\\boost"
|
||||
},
|
||||
{
|
||||
"name": "OPENSSL_ROOT",
|
||||
"value": "C:\\lib\\OpenSSL-Win64"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,263 +0,0 @@
|
||||
# Visual Studio 2019 Build Instructions
|
||||
|
||||
## Important
|
||||
|
||||
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 versions are not supported.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
To clone the source code repository, create branches for inspection or
|
||||
modification, build rippled under Visual Studio, and run the unit tests you will
|
||||
need these software components
|
||||
|
||||
| Component | Minimum Recommended Version |
|
||||
|-----------|-----------------------|
|
||||
| [Visual Studio 2019](README.md#install-visual-studio-2019)| 15.5.4 |
|
||||
| [Git for Windows](README.md#install-git-for-windows)| 2.16.1 |
|
||||
| [OpenSSL Library](README.md#install-openssl) | 1.1.1L |
|
||||
| [Boost library](README.md#build-boost) | 1.70.0 |
|
||||
| [CMake for Windows](README.md#optional-install-cmake-for-windows)* | 3.12 |
|
||||
|
||||
\* Only needed if not using the integrated CMake in VS 2019 and prefer generating dedicated project/solution files.
|
||||
|
||||
## Install Software
|
||||
|
||||
### Install Visual Studio 2019
|
||||
|
||||
If not already installed on your system, download your choice of installer from
|
||||
the [Visual Studio 2019
|
||||
Download](https://www.visualstudio.com/downloads/download-visual-studio-vs)
|
||||
page, run the installer, and follow the directions. **You may need to choose the
|
||||
`Desktop development with C++` workload to install all necessary C++ features.**
|
||||
|
||||
Any version of Visual Studio 2019 may be used to build rippled. The **Visual
|
||||
Studio 2019 Community** edition is available free of charge (see [the product
|
||||
page](https://www.visualstudio.com/products/visual-studio-community-vs) for
|
||||
licensing details), while paid editions may be used for an initial free-trial
|
||||
period.
|
||||
|
||||
### Install Git for Windows
|
||||
|
||||
Git is a distributed revision control system. The Windows version also provides
|
||||
the bash shell and many Windows versions of Unix commands. While there are other
|
||||
varieties of Git (such as TortoiseGit, which has a native Windows interface and
|
||||
integrates with the Explorer shell), we recommend installing [Git for
|
||||
Windows](https://git-scm.com/) since it provides a Unix-like command line
|
||||
environment useful for running shell scripts. Use of the bash shell under
|
||||
Windows is mandatory for running the unit tests.
|
||||
|
||||
### Install OpenSSL
|
||||
|
||||
[Download the latest version of
|
||||
OpenSSL.](http://slproweb.com/products/Win32OpenSSL.html) There will
|
||||
several `Win64` bit variants available, you want the non-light
|
||||
`v1.1` line. As of this writing, you **should** select
|
||||
|
||||
* Win64 OpenSSL v1.1.1q
|
||||
|
||||
and should **not** select
|
||||
|
||||
* Anything with "Win32" in the name
|
||||
* Anything with "light" in the name
|
||||
* Anything with "EXPERIMENTAL" in the name
|
||||
* Anything in the 3.0 line - rippled won't currently build with this version.
|
||||
|
||||
Run the installer, and choose an appropriate location for your OpenSSL
|
||||
installation. In this guide we use `C:\lib\OpenSSL-Win64` as the destination
|
||||
location.
|
||||
|
||||
You may be informed on running the installer that "Visual C++ 2008
|
||||
Redistributables" must first be installed first. If so, download it from the
|
||||
[same page](http://slproweb.com/products/Win32OpenSSL.html), again making sure
|
||||
to get the correct 32-/64-bit variant.
|
||||
|
||||
* NOTE: Since rippled links statically to OpenSSL, it does not matter where the
|
||||
OpenSSL .DLL files are placed, or what version they are. rippled does not use
|
||||
or require any external .DLL files to run other than the standard operating
|
||||
system ones.
|
||||
|
||||
### Build Boost
|
||||
|
||||
Boost 1.70 or later is required.
|
||||
|
||||
[Download boost](http://www.boost.org/users/download/) and unpack it
|
||||
to `c:\lib`. As of this writing, the most recent version of boost is 1.80.0,
|
||||
which will unpack into a directory named `boost_1_80_0`. We recommended either
|
||||
renaming this directory to `boost`, or creating a junction link `mklink /J boost
|
||||
boost_1_80_0`, so that you can more easily switch between versions.
|
||||
|
||||
Next, open **Developer Command Prompt** and type the following commands
|
||||
|
||||
```powershell
|
||||
cd C:\lib\boost
|
||||
bootstrap
|
||||
```
|
||||
|
||||
The rippled application is linked statically to the standard runtimes and
|
||||
external dependencies on Windows, to ensure that the behavior of the executable
|
||||
is not affected by changes in outside files. Therefore, it is necessary to build
|
||||
the required boost static libraries using this command:
|
||||
|
||||
```powershell
|
||||
b2 -j<Num Parallel> --toolset=msvc-14.2 address-model=64 architecture=x86 link=static threading=multi runtime-link=shared,static stage
|
||||
```
|
||||
|
||||
where you should replace `<Num Parallel>` with the number of parallel
|
||||
invocations to use build, e.g. `bjam -j8 ...` would use up to 8 concurrent build
|
||||
shell commands for the build.
|
||||
|
||||
Building the boost libraries may take considerable time. When the build process
|
||||
is completed, take note of both the reported compiler include paths and linker
|
||||
library paths as they will be required later.
|
||||
|
||||
### (Optional) Install CMake for Windows
|
||||
|
||||
[CMake](http://cmake.org) is a cross platform build system generator. Visual
|
||||
Studio 2019 includes an integrated version of CMake that avoids having to
|
||||
manually run CMake, but it is undergoing continuous improvement. Users that
|
||||
prefer to use standard Visual Studio project and solution files need to install
|
||||
a dedicated version of CMake to generate them. The latest version can be found
|
||||
at the [CMake download site](https://cmake.org/download/). It is recommended you
|
||||
select the install option to add CMake to your path.
|
||||
|
||||
## Clone the rippled repository
|
||||
|
||||
If you are familiar with cloning github repositories, just follow your normal
|
||||
process and clone `git@github.com:ripple/rippled.git`. Otherwise follow this
|
||||
section for instructions.
|
||||
|
||||
1. If you don't have a github account, sign up for one at
|
||||
[github.com](https://github.com/).
|
||||
2. Make sure you have Github ssh keys. For help see
|
||||
[generating-ssh-keys](https://help.github.com/articles/generating-ssh-keys).
|
||||
|
||||
Open the "Git Bash" shell that was installed with "Git for Windows" in the step
|
||||
above. Navigate to the directory where you want to clone rippled (git bash uses
|
||||
`/c` for windows's `C:` and forward slash where windows uses backslash, so
|
||||
`C:\Users\joe\projs` would be `/c/Users/joe/projs` in git bash). Now clone the
|
||||
repository and optionally switch to the *master* branch. Type the following at
|
||||
the bash prompt:
|
||||
|
||||
```powershell
|
||||
git clone git@github.com:XRPLF/rippled.git
|
||||
cd rippled
|
||||
```
|
||||
If you receive an error about not having the "correct access rights" make sure
|
||||
you have Github ssh keys, as described above.
|
||||
|
||||
For a stable release, choose the `master` branch or one of the tagged releases
|
||||
listed on [rippled's GitHub page](https://github.com/ripple/rippled/releases).
|
||||
|
||||
```
|
||||
git checkout master
|
||||
```
|
||||
|
||||
To test the latest release candidate, choose the `release` branch.
|
||||
|
||||
```
|
||||
git checkout release
|
||||
```
|
||||
|
||||
If you are doing development work and want the latest set of beta features,
|
||||
you can consider using the `develop` branch instead.
|
||||
|
||||
```
|
||||
git checkout develop
|
||||
```
|
||||
|
||||
# Build using Visual Studio integrated CMake
|
||||
|
||||
In Visual Studio 2017, Microsoft added [integrated IDE support for
|
||||
cmake](https://blogs.msdn.microsoft.com/vcblog/2016/10/05/cmake-support-in-visual-studio/).
|
||||
To begin, simply:
|
||||
|
||||
1. Launch Visual Studio and choose **File | Open | Folder**, navigating to the
|
||||
cloned rippled folder.
|
||||
2. Right-click on `CMakeLists.txt` in the **Solution Explorer - Folder View** to
|
||||
generate a `CMakeSettings.json` file. A sample settings file is provided
|
||||
[here](/Builds/VisualStudio2019/CMakeSettings-example.json). Customize the
|
||||
settings for `BOOST_ROOT`, `OPENSSL_ROOT` to match the install paths if they
|
||||
differ from those in the file.
|
||||
4. Select either the `x64-Release` or `x64-Debug` configuration from the
|
||||
**Project Settings** drop-down. This should invoke the built-in CMake project
|
||||
generator. If not, you can right-click on the `CMakeLists.txt` file and
|
||||
choose **Configure rippled**.
|
||||
5. Select the `rippled.exe`
|
||||
option in the **Select Startup Item** drop-down. This will be the target
|
||||
built when you press F7. Alternatively, you can choose a target to build from
|
||||
the top-level **CMake | Build** menu. Note that at this time, there are other
|
||||
targets listed that come from third party visual studio files embedded in the
|
||||
rippled repo, e.g. `datagen.vcxproj`. Please ignore them.
|
||||
|
||||
For details on configuring debugging sessions or further customization of CMake,
|
||||
please refer to the [CMake tools for VS
|
||||
documentation](https://docs.microsoft.com/en-us/cpp/ide/cmake-tools-for-visual-cpp).
|
||||
|
||||
If using the provided `CMakeSettings.json` file, the executable will be in
|
||||
```
|
||||
.\build\x64-Release\Release\rippled.exe
|
||||
```
|
||||
or
|
||||
```
|
||||
.\build\x64-Debug\Debug\rippled.exe
|
||||
```
|
||||
These paths are relative to your cloned git repository.
|
||||
|
||||
# Build using stand-alone CMake
|
||||
|
||||
This requires having installed [CMake for
|
||||
Windows](README.md#optional-install-cmake-for-windows). We do not recommend
|
||||
mixing this method with the integrated CMake method for the same repository
|
||||
clone. Assuming you included the cmake executable folder in your path,
|
||||
execute the following commands within your `rippled` cloned repository:
|
||||
|
||||
```
|
||||
mkdir build\cmake
|
||||
cd build\cmake
|
||||
cmake ..\.. -G"Visual Studio 16 2019" -Ax64 -DBOOST_ROOT="C:\lib\boost" -DOPENSSL_ROOT="C:\lib\OpenSSL-Win64" -DCMAKE_GENERATOR_TOOLSET=host=x64
|
||||
```
|
||||
Now launch Visual Studio 2019 and select **File | Open | Project/Solution**.
|
||||
Navigate to the `build\cmake` folder created above and select the `rippled.sln`
|
||||
file. You can then choose whether to build the `Debug` or `Release` solution
|
||||
configuration.
|
||||
|
||||
The executable will be in
|
||||
```
|
||||
.\build\cmake\Release\rippled.exe
|
||||
```
|
||||
or
|
||||
```
|
||||
.\build\cmake\Debug\rippled.exe
|
||||
```
|
||||
These paths are relative to your cloned git repository.
|
||||
|
||||
# Unity/No-Unity Builds
|
||||
|
||||
The rippled build system defaults to using
|
||||
[unity source files](http://onqtam.com/programming/2018-07-07-unity-builds/)
|
||||
to improve build times. In some cases it might be desirable to disable the
|
||||
unity build and compile individual translation units. Here is how you can
|
||||
switch to a "no-unity" build configuration:
|
||||
|
||||
## Visual Studio Integrated CMake
|
||||
|
||||
Edit your `CmakeSettings.json` (described above) by adding `-Dunity=OFF`
|
||||
to the `cmakeCommandArgs` entry for each build configuration.
|
||||
|
||||
## Standalone CMake Builds
|
||||
|
||||
When running cmake to generate the Visual Studio project files, add
|
||||
`-Dunity=OFF` to the command line options passed to cmake.
|
||||
|
||||
**Note:** you will need to re-run the cmake configuration step anytime you
|
||||
want to switch between unity/no-unity builds.
|
||||
|
||||
# Unit Test (Recommended)
|
||||
|
||||
`rippled` builds a set of unit tests into the server executable. To run these
|
||||
unit tests after building, pass the `--unittest` option to the compiled
|
||||
`rippled` executable. The executable will exit with summary info after running
|
||||
the unit tests.
|
||||
|
||||
@@ -10,6 +10,6 @@ apk add \
|
||||
bash util-linux coreutils binutils grep \
|
||||
make ninja cmake build-base gcc g++ abuild git \
|
||||
python3 python3-dev
|
||||
pip3 install awscli
|
||||
pip3 install awscli --break-system-packages
|
||||
# list curdir contents to build log:
|
||||
ls -la
|
||||
|
||||
@@ -14,7 +14,7 @@ variables:
|
||||
RPM_CONTAINER_TAG: "2023-02-13"
|
||||
RPM_CONTAINER_NAME: "rippled-rpm-builder"
|
||||
RPM_CONTAINER_FULLNAME: "${RPM_CONTAINER_NAME}:${RPM_CONTAINER_TAG}"
|
||||
DPKG_CONTAINER_TAG: "2023-03-20"
|
||||
DPKG_CONTAINER_TAG: "2023-07-31"
|
||||
DPKG_CONTAINER_NAME: "rippled-dpkg-builder"
|
||||
DPKG_CONTAINER_FULLNAME: "${DPKG_CONTAINER_NAME}:${DPKG_CONTAINER_TAG}"
|
||||
ARTIFACTORY_HOST: "artifactory.ops.ripple.com"
|
||||
@@ -193,12 +193,30 @@ rocky_8_smoketest:
|
||||
name: artifactory.ops.ripple.com/rockylinux/rockylinux:8
|
||||
<<: *run_local_smoketest
|
||||
|
||||
fedora_37_smoketest:
|
||||
rocky_9_smoketest:
|
||||
stage: smoketest
|
||||
dependencies:
|
||||
- rpm_build
|
||||
image:
|
||||
name: artifactory.ops.ripple.com/fedora:37
|
||||
name: artifactory.ops.ripple.com/rockylinux/rockylinux:9
|
||||
|
||||
<<: *run_local_smoketest
|
||||
|
||||
alma_8_smoketest:
|
||||
stage: smoketest
|
||||
dependencies:
|
||||
- rpm_build
|
||||
image:
|
||||
name: artifactory.ops.ripple.com/almalinux:8
|
||||
<<: *run_local_smoketest
|
||||
|
||||
alma_9_smoketest:
|
||||
stage: smoketest
|
||||
dependencies:
|
||||
- rpm_build
|
||||
image:
|
||||
name: artifactory.ops.ripple.com/almalinux:9
|
||||
|
||||
<<: *run_local_smoketest
|
||||
|
||||
fedora_38_smoketest:
|
||||
@@ -209,6 +227,14 @@ fedora_38_smoketest:
|
||||
name: artifactory.ops.ripple.com/fedora:38
|
||||
<<: *run_local_smoketest
|
||||
|
||||
fedora_39_smoketest:
|
||||
stage: smoketest
|
||||
dependencies:
|
||||
- rpm_build
|
||||
image:
|
||||
name: artifactory.ops.ripple.com/fedora:39
|
||||
<<: *run_local_smoketest
|
||||
|
||||
ubuntu_18_smoketest:
|
||||
stage: smoketest
|
||||
dependencies:
|
||||
@@ -249,6 +275,14 @@ debian_11_smoketest:
|
||||
name: artifactory.ops.ripple.com/debian:11
|
||||
<<: *run_local_smoketest
|
||||
|
||||
debian_12_smoketest:
|
||||
stage: smoketest
|
||||
dependencies:
|
||||
- dpkg_build
|
||||
image:
|
||||
name: artifactory.ops.ripple.com/debian:12
|
||||
<<: *run_local_smoketest
|
||||
|
||||
#########################################################################
|
||||
## ##
|
||||
## stage: verify_sig ##
|
||||
@@ -345,7 +379,6 @@ centos_7_verify_repo_test:
|
||||
<<: *only_primary
|
||||
<<: *run_repo_smoketest
|
||||
|
||||
|
||||
rocky_8_verify_repo_test:
|
||||
stage: verify_from_test
|
||||
variables:
|
||||
@@ -357,12 +390,34 @@ rocky_8_verify_repo_test:
|
||||
<<: *only_primary
|
||||
<<: *run_repo_smoketest
|
||||
|
||||
fedora_37_verify_repo_test:
|
||||
rocky_9_verify_repo_test:
|
||||
stage: verify_from_test
|
||||
variables:
|
||||
RPM_REPO: "rippled-rpm-test-mirror"
|
||||
image:
|
||||
name: artifactory.ops.ripple.com/fedora:37
|
||||
name: artifactory.ops.ripple.com/rockylinux/rockylinux:9
|
||||
dependencies:
|
||||
- rpm_sign
|
||||
<<: *only_primary
|
||||
<<: *run_repo_smoketest
|
||||
|
||||
almalinux_8_verify_repo_test:
|
||||
stage: verify_from_test
|
||||
variables:
|
||||
RPM_REPO: "rippled-rpm-test-mirror"
|
||||
image:
|
||||
name: artifactory.ops.ripple.com/almalinux:8
|
||||
dependencies:
|
||||
- rpm_sign
|
||||
<<: *only_primary
|
||||
<<: *run_repo_smoketest
|
||||
|
||||
almalinux_9_verify_repo_test:
|
||||
stage: verify_from_test
|
||||
variables:
|
||||
RPM_REPO: "rippled-rpm-test-mirror"
|
||||
image:
|
||||
name: artifactory.ops.ripple.com/almalinux:9
|
||||
dependencies:
|
||||
- rpm_sign
|
||||
<<: *only_primary
|
||||
@@ -379,6 +434,18 @@ fedora_38_verify_repo_test:
|
||||
<<: *only_primary
|
||||
<<: *run_repo_smoketest
|
||||
|
||||
fedora_39_verify_repo_test:
|
||||
stage: verify_from_test
|
||||
variables:
|
||||
RPM_REPO: "rippled-rpm-test-mirror"
|
||||
image:
|
||||
name: artifactory.ops.ripple.com/fedora:39
|
||||
|
||||
dependencies:
|
||||
- rpm_sign
|
||||
<<: *only_primary
|
||||
<<: *run_repo_smoketest
|
||||
|
||||
ubuntu_18_verify_repo_test:
|
||||
stage: verify_from_test
|
||||
variables:
|
||||
@@ -439,6 +506,18 @@ debian_11_verify_repo_test:
|
||||
<<: *only_primary
|
||||
<<: *run_repo_smoketest
|
||||
|
||||
debian_12_verify_repo_test:
|
||||
stage: verify_from_test
|
||||
variables:
|
||||
DISTRO: "bookworm"
|
||||
DEB_REPO: "rippled-deb-test-mirror"
|
||||
image:
|
||||
name: artifactory.ops.ripple.com/debian:12
|
||||
dependencies:
|
||||
- dpkg_sign
|
||||
<<: *only_primary
|
||||
<<: *run_repo_smoketest
|
||||
|
||||
#########################################################################
|
||||
## ##
|
||||
## stage: wait_approval_prod ##
|
||||
@@ -515,6 +594,39 @@ rocky_8_verify_repo_prod:
|
||||
<<: *only_primary
|
||||
<<: *run_repo_smoketest
|
||||
|
||||
rocky_9_verify_repo_prod:
|
||||
stage: verify_from_prod
|
||||
variables:
|
||||
RPM_REPO: "rippled-rpm"
|
||||
image:
|
||||
name: artifactory.ops.ripple.com/rockylinux/rockylinux:9
|
||||
dependencies:
|
||||
- rpm_sign
|
||||
<<: *only_primary
|
||||
<<: *run_repo_smoketest
|
||||
|
||||
alma_8_verify_repo_prod:
|
||||
stage: verify_from_prod
|
||||
variables:
|
||||
RPM_REPO: "rippled-rpm"
|
||||
image:
|
||||
name: artifactory.ops.ripple.com/almalinux:8
|
||||
dependencies:
|
||||
- rpm_sign
|
||||
<<: *only_primary
|
||||
<<: *run_repo_smoketest
|
||||
|
||||
alma_9_verify_repo_prod:
|
||||
stage: verify_from_prod
|
||||
variables:
|
||||
RPM_REPO: "rippled-rpm"
|
||||
image:
|
||||
name: artifactory.ops.ripple.com/almalinux:9
|
||||
dependencies:
|
||||
- rpm_sign
|
||||
<<: *only_primary
|
||||
<<: *run_repo_smoketest
|
||||
|
||||
fedora_37_verify_repo_prod:
|
||||
stage: verify_from_prod
|
||||
variables:
|
||||
@@ -597,6 +709,19 @@ debian_11_verify_repo_prod:
|
||||
<<: *only_primary
|
||||
<<: *run_repo_smoketest
|
||||
|
||||
debian_12_verify_repo_prod:
|
||||
stage: verify_from_prod
|
||||
variables:
|
||||
DISTRO: "bookworm"
|
||||
DEB_REPO: "rippled-deb"
|
||||
image:
|
||||
name: artifactory.ops.ripple.com/debian:12
|
||||
dependencies:
|
||||
- dpkg_sign
|
||||
<<: *only_primary
|
||||
<<: *run_repo_smoketest
|
||||
|
||||
|
||||
#########################################################################
|
||||
## ##
|
||||
## stage: get_final_hashes ##
|
||||
|
||||
@@ -20,7 +20,7 @@ RIPPLED_REPORTING_DBG_PKG=$(ls rippled-reporting-dbgsym_*.*deb)
|
||||
# TODO - where to upload src tgz?
|
||||
RIPPLED_SRC=$(ls rippled_*.orig.tar.gz)
|
||||
DEB_MATRIX=";deb.component=${COMPONENT};deb.architecture=amd64"
|
||||
for dist in buster bullseye bionic focal jammy; do
|
||||
for dist in bookworm buster bullseye bionic focal jammy; do
|
||||
DEB_MATRIX="${DEB_MATRIX};deb.distribution=${dist}"
|
||||
done
|
||||
echo "{ \"debs\": {" > "${TOPDIR}/files.info"
|
||||
|
||||
@@ -16,7 +16,7 @@ case ${ID} in
|
||||
ubuntu|debian)
|
||||
pkgtype="dpkg"
|
||||
;;
|
||||
fedora|centos|rhel|scientific|rocky)
|
||||
fedora|centos|rhel|scientific|rocky|almalinux)
|
||||
pkgtype="rpm"
|
||||
;;
|
||||
*)
|
||||
@@ -62,9 +62,10 @@ else
|
||||
yum -y update
|
||||
if [ "${install_from}" = "repo" ] ; then
|
||||
pkgs=("yum-utils coreutils util-linux")
|
||||
if [ "$ID" = "rocky" ]; then
|
||||
pkgs="${pkgs[@]/coreutils}"
|
||||
fi
|
||||
case "$ID" in
|
||||
rocky|almalinux)
|
||||
pkgs="${pkgs[@]/coreutils}"
|
||||
esac
|
||||
yum install -y $pkgs
|
||||
REPOFILE="/etc/yum.repos.d/artifactory.repo"
|
||||
echo "[Artifactory]" > ${REPOFILE}
|
||||
@@ -79,16 +80,8 @@ else
|
||||
# yum --showduplicates list rippled
|
||||
yum -y install ${rpm_version_release}
|
||||
elif [ "${install_from}" = "local" ] ; then
|
||||
# cached pkg install
|
||||
pkgs=("yum-utils openssl-static zlib-static")
|
||||
if [[ "$ID" =~ rocky|fedora ]]; then
|
||||
if [[ "$ID" =~ "rocky" ]]; then
|
||||
sed -i 's/enabled=0/enabled=1/g' /etc/yum.repos.d/Rocky-PowerTools.repo
|
||||
fi
|
||||
pkgs="${pkgs[@]/openssl-static}"
|
||||
fi
|
||||
yum install -y $pkgs
|
||||
rm -f build/rpm/packages/rippled-debug*.rpm
|
||||
rm -f build/rpm/packages/rippled-devel*.rpm
|
||||
rm -f build/rpm/packages/*.src.rpm
|
||||
rpm -i build/rpm/packages/*.rpm
|
||||
else
|
||||
|
||||
@@ -67,6 +67,10 @@ if [ -e rippled_${RIPPLED_DPKG_FULL_VERSION}_amd64.buildinfo ] ; then
|
||||
cp rippled_${RIPPLED_DPKG_FULL_VERSION}_amd64.buildinfo ${PKG_OUTDIR}
|
||||
fi
|
||||
|
||||
pushd ${PKG_OUTDIR}
|
||||
for f in *.ddeb; do mv -- "$f" "${f%.ddeb}.deb"; done
|
||||
popd
|
||||
|
||||
cat rippled_${RIPPLED_DPKG_FULL_VERSION}_amd64.changes
|
||||
# extract the text in the .changes file that appears between
|
||||
# Checksums-Sha256: ...
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
bld/rippled-reporting/rippled-reporting opt/rippled-reporting/bin
|
||||
build.rippled-reporting/rippled-reporting opt/rippled-reporting/bin
|
||||
cfg/rippled-reporting.cfg opt/rippled-reporting/etc
|
||||
debian/tmp/opt/rippled-reporting/etc/validators.txt opt/rippled-reporting/etc
|
||||
|
||||
opt/rippled-reporting/bin/update-rippled-reporting.sh
|
||||
opt/rippled-reporting/bin/getRippledReportingInfo
|
||||
opt/rippled-reporting/etc/update-rippled-reporting-cron
|
||||
etc/logrotate.d/rippled-reporting
|
||||
etc/logrotate.d/rippled-reporting
|
||||
|
||||
@@ -15,55 +15,56 @@ override_dh_systemd_start:
|
||||
dh_systemd_start --no-restart-on-upgrade
|
||||
|
||||
override_dh_auto_configure:
|
||||
env
|
||||
rm -rf bld
|
||||
/root/.pyenv/shims/conan export external/snappy snappy/1.1.10@
|
||||
/root/.pyenv/shims/conan export external/soci soci/4.0.3@
|
||||
|
||||
conan export external/snappy snappy/1.1.9@
|
||||
mkdir build.rippled
|
||||
|
||||
conan install . \
|
||||
--install-folder bld/rippled \
|
||||
--build missing \
|
||||
--build boost \
|
||||
--build sqlite3 \
|
||||
--settings build_type=Release
|
||||
cd build.rippled && \
|
||||
/root/.pyenv/shims/conan install .. \
|
||||
--profile gcc \
|
||||
--output-folder . \
|
||||
--build missing \
|
||||
--settings build_type=Release
|
||||
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake \
|
||||
-G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX=/opt/ripple \
|
||||
-Dstatic=ON \
|
||||
-Dunity=OFF \
|
||||
-DCMAKE_VERBOSE_MAKEFILE=ON \
|
||||
-Dvalidator_keys=ON \
|
||||
-B bld/rippled
|
||||
cd build.rippled && \
|
||||
cmake .. \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-Dvalidator_keys=ON \
|
||||
-DCMAKE_VERBOSE_MAKEFILE=ON \
|
||||
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake
|
||||
|
||||
conan install . \
|
||||
--install-folder bld/rippled-reporting \
|
||||
--build missing \
|
||||
--build boost \
|
||||
--build sqlite3 \
|
||||
--build libuv \
|
||||
--settings build_type=Release \
|
||||
--options reporting=True
|
||||
mkdir build.rippled-reporting
|
||||
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake \
|
||||
-G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX=/opt/rippled-reporting \
|
||||
-Dstatic=ON \
|
||||
-Dunity=OFF \
|
||||
-DCMAKE_VERBOSE_MAKEFILE=ON \
|
||||
-Dreporting=ON \
|
||||
-B bld/rippled-reporting
|
||||
cd build.rippled-reporting && \
|
||||
/root/.pyenv/shims/conan install .. \
|
||||
--profile gcc \
|
||||
--output-folder . \
|
||||
--settings compiler.cppstd=17 \
|
||||
--settings build_type=Release \
|
||||
--build missing \
|
||||
--build boost \
|
||||
--build sqlite3 \
|
||||
--build libuv \
|
||||
--options reporting=True
|
||||
|
||||
cd build.rippled-reporting && \
|
||||
cmake .. \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-Dvalidator_keys=ON \
|
||||
-Dstatic=ON \
|
||||
-Dunity=OFF \
|
||||
-Dreporting=ON \
|
||||
-DCMAKE_VERBOSE_MAKEFILE=ON \
|
||||
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake
|
||||
|
||||
override_dh_auto_build:
|
||||
cmake --build bld/rippled --target rippled --target validator-keys -j${nproc}
|
||||
|
||||
cmake --build bld/rippled-reporting --target rippled -j${nproc}
|
||||
cmake --build build.rippled --target rippled --target validator-keys --parallel 8
|
||||
cmake --build build.rippled-reporting --target rippled --parallel 8
|
||||
|
||||
override_dh_auto_install:
|
||||
cmake --install bld/rippled --prefix debian/tmp/opt/ripple
|
||||
install -D bld/rippled/validator-keys/validator-keys debian/tmp/opt/ripple/bin/validator-keys
|
||||
cmake --install build.rippled --prefix debian/tmp/opt/ripple
|
||||
install -D build.rippled/validator-keys/validator-keys debian/tmp/opt/ripple/bin/validator-keys
|
||||
install -D Builds/containers/shared/update-rippled.sh debian/tmp/opt/ripple/bin/update-rippled.sh
|
||||
install -D bin/getRippledInfo debian/tmp/opt/ripple/bin/getRippledInfo
|
||||
install -D Builds/containers/shared/update-rippled-cron debian/tmp/opt/ripple/etc/update-rippled-cron
|
||||
|
||||
@@ -36,41 +36,44 @@ History server for XRP Ledger
|
||||
%setup -c -n rippled
|
||||
|
||||
%build
|
||||
rm -rf ~/.conan/profiles/default
|
||||
|
||||
source /opt/rh/devtoolset-11/enable
|
||||
source /opt/rh/rh-python38/enable
|
||||
|
||||
pip install "conan<2"
|
||||
|
||||
conan profile new default --detect
|
||||
conan profile update settings.compiler.cppstd=20 default
|
||||
conan profile update settings.compiler.libcxx=libstdc++11 default
|
||||
|
||||
cd rippled
|
||||
|
||||
conan export external/snappy snappy/1.1.10@
|
||||
conan export external/soci soci/4.0.3@
|
||||
|
||||
mkdir -p bld.rippled
|
||||
pushd bld.rippled
|
||||
|
||||
cp /opt/libcstd/libstdc++.so.6.0.22 /usr/lib64
|
||||
cp /opt/libcstd/libstdc++.so.6.0.22 /lib64
|
||||
ln -sf /usr/lib64/libstdc++.so.6.0.22 /usr/lib64/libstdc++.so.6
|
||||
ln -sf /lib64/libstdc++.so.6.0.22 /usr/lib64/libstdc++.so.6
|
||||
|
||||
source /opt/rh/rh-python38/enable
|
||||
pip install "conan<2"
|
||||
conan profile new default --detect
|
||||
conan profile update settings.compiler.libcxx=libstdc++11 default
|
||||
conan profile update settings.compiler.cppstd=20 default
|
||||
|
||||
cd rippled
|
||||
|
||||
mkdir -p bld.rippled
|
||||
conan export external/snappy snappy/1.1.9@
|
||||
|
||||
pushd bld.rippled
|
||||
conan install .. \
|
||||
--settings build_type=Release \
|
||||
--output-folder . \
|
||||
--build missing
|
||||
--profile default \
|
||||
--output-folder . \
|
||||
--build missing \
|
||||
--settings build_type=Release
|
||||
|
||||
cmake -G Ninja \
|
||||
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake \
|
||||
-DCMAKE_INSTALL_PREFIX=%{_prefix} \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-Dunity=OFF \
|
||||
-Dstatic=ON \
|
||||
-Dvalidator_keys=ON \
|
||||
-DCMAKE_VERBOSE_MAKEFILE=ON \
|
||||
..
|
||||
cmake .. \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-Dvalidator_keys=ON \
|
||||
-DCMAKE_INSTALL_PREFIX=%{_prefix} \
|
||||
-DCMAKE_VERBOSE_MAKEFILE=ON \
|
||||
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake
|
||||
|
||||
cmake --build . --parallel $(nproc) --target rippled --target validator-keys
|
||||
|
||||
popd
|
||||
|
||||
mkdir -p bld.rippled-reporting
|
||||
@@ -83,16 +86,16 @@ conan install .. \
|
||||
--settings compiler.cppstd=17 \
|
||||
--options reporting=True
|
||||
|
||||
cmake -G Ninja \
|
||||
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake \
|
||||
-DCMAKE_INSTALL_PREFIX=%{_prefix} \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-Dunity=OFF \
|
||||
-Dstatic=ON \
|
||||
-Dvalidator_keys=ON \
|
||||
-Dreporting=ON \
|
||||
-DCMAKE_VERBOSE_MAKEFILE=ON \
|
||||
..
|
||||
cmake .. \
|
||||
-G Ninja \
|
||||
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake \
|
||||
-DCMAKE_INSTALL_PREFIX=%{_prefix} \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-Dunity=OFF \
|
||||
-Dstatic=ON \
|
||||
-Dvalidator_keys=ON \
|
||||
-Dreporting=ON \
|
||||
-DCMAKE_VERBOSE_MAKEFILE=ON \
|
||||
|
||||
cmake --build . --parallel $(nproc) --target rippled
|
||||
|
||||
@@ -103,7 +106,7 @@ test -e /etc/pki/tls || { mkdir -p /etc/pki; ln -s /usr/lib/ssl /etc/pki/tls; }
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
DESTDIR=$RPM_BUILD_ROOT cmake --build rippled/bld.rippled --target install #-- -v
|
||||
mkdir -p $RPM_BUILD_ROOT
|
||||
rm -rf ${RPM_BUILD_ROOT}/%{_prefix}/lib64/
|
||||
rm -rf ${RPM_BUILD_ROOT}%{_prefix}/lib64/
|
||||
install -d ${RPM_BUILD_ROOT}/etc/opt/ripple
|
||||
install -d ${RPM_BUILD_ROOT}/usr/local/bin
|
||||
|
||||
@@ -130,9 +133,9 @@ install -D rippled/bld.rippled-reporting/rippled-reporting ${RPM_BUILD_ROOT}%{_b
|
||||
install -D ./rippled/cfg/rippled-reporting.cfg ${RPM_BUILD_ROOT}%{_prefix}/etc/rippled-reporting.cfg
|
||||
install -D ./rippled/cfg/validators-example.txt ${RPM_BUILD_ROOT}%{_prefix}/etc/validators.txt
|
||||
install -D ./rippled/Builds/containers/packaging/rpm/50-rippled-reporting.preset ${RPM_BUILD_ROOT}/usr/lib/systemd/system-preset/50-rippled-reporting.preset
|
||||
ln -s %{_prefix}/bin/rippled-reporting ${RPM_BUILD_ROOT}/usr/local/bin/rippled-reporting
|
||||
ln -s %{_prefix}/etc/rippled-reporting.cfg ${RPM_BUILD_ROOT}/etc/opt/rippled-reporting/rippled-reporting.cfg
|
||||
ln -s %{_prefix}/etc/validators.txt ${RPM_BUILD_ROOT}/etc/opt/rippled-reporting/validators.txt
|
||||
ln -sf %{_prefix}/bin/rippled-reporting ${RPM_BUILD_ROOT}/usr/local/bin/rippled-reporting
|
||||
ln -sf %{_prefix}/etc/rippled-reporting.cfg ${RPM_BUILD_ROOT}/etc/opt/rippled-reporting/rippled-reporting.cfg
|
||||
ln -sf %{_prefix}/etc/validators.txt ${RPM_BUILD_ROOT}/etc/opt/rippled-reporting/validators.txt
|
||||
install -d $RPM_BUILD_ROOT/var/log/rippled-reporting
|
||||
install -d $RPM_BUILD_ROOT/var/lib/rippled-reporting
|
||||
install -D ./rippled/Builds/containers/shared/rippled-reporting.service ${RPM_BUILD_ROOT}/usr/lib/systemd/system/rippled-reporting.service
|
||||
|
||||
@@ -6,8 +6,15 @@ LABEL git-commit=$GIT_COMMIT
|
||||
|
||||
WORKDIR /root
|
||||
COPY ubuntu-builder/ubuntu_setup.sh .
|
||||
COPY ubuntu-builder/ubuntu_setup2.sh .
|
||||
|
||||
RUN ./ubuntu_setup.sh && rm ubuntu_setup.sh
|
||||
|
||||
RUN ./ubuntu_setup2.sh && rm ubuntu_setup2.sh
|
||||
|
||||
COPY ubuntu-builder/ubuntu_setup3.sh .
|
||||
RUN ./ubuntu_setup3.sh && rm ubuntu_setup3.sh
|
||||
|
||||
RUN mkdir -m 777 -p /opt/rippled_bld/pkg/
|
||||
WORKDIR /opt/rippled_bld/pkg
|
||||
|
||||
|
||||
@@ -6,37 +6,33 @@ set -o xtrace
|
||||
|
||||
# Parameters
|
||||
|
||||
gcc_version=${GCC_VERSION:-10}
|
||||
cmake_version=${CMAKE_VERSION:-3.25.1}
|
||||
conan_version=${CONAN_VERSION:-1.59}
|
||||
gcc_version=${GCC_VERSION:-11}
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
apt update
|
||||
# Iteratively build the list of packages to install so that we can interleave
|
||||
# the lines with comments explaining their inclusion.
|
||||
dependencies=''
|
||||
# - to identify the Ubuntu version
|
||||
dependencies+=' lsb-release'
|
||||
# - for add-apt-repository
|
||||
dependencies+=' software-properties-common'
|
||||
# - to download CMake
|
||||
dependencies+=' curl'
|
||||
# - to build CMake
|
||||
dependencies+=' libssl-dev'
|
||||
# - Python headers for Boost.Python
|
||||
dependencies+=' python3-dev'
|
||||
# - to install Conan
|
||||
dependencies+=' python3-pip'
|
||||
# - for Python
|
||||
dependencies+=' libbz2-dev liblzma-dev libsqlite3-dev'
|
||||
# - to download rippled
|
||||
dependencies+=' git'
|
||||
# - CMake generators (but not CMake itself)
|
||||
dependencies+=' make ninja-build'
|
||||
apt install --yes ${dependencies}
|
||||
apt-get install --yes ${dependencies}
|
||||
|
||||
add-apt-repository --yes ppa:ubuntu-toolchain-r/test
|
||||
apt install --yes gcc-${gcc_version} g++-${gcc_version} \
|
||||
debhelper debmake debsums gnupg dh-buildinfo dh-make dh-systemd cmake \
|
||||
ninja-build zlib1g-dev make cmake ninja-build autoconf automake \
|
||||
pkg-config apt-transport-https
|
||||
apt-get install --yes gcc-${gcc_version} g++-${gcc_version}
|
||||
apt-get install --yes build-essential libssl-dev zlib1g-dev \
|
||||
libbz2-dev libreadline-dev libsqlite3-dev curl \
|
||||
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
|
||||
|
||||
# Give us nice unversioned aliases for gcc and company.
|
||||
update-alternatives --install \
|
||||
@@ -49,28 +45,3 @@ update-alternatives --install \
|
||||
--slave /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-dump-${gcc_version} \
|
||||
--slave /usr/bin/gcov-dump gcov-dump /usr/bin/gcov-tool-${gcc_version}
|
||||
update-alternatives --auto gcc
|
||||
|
||||
# Download and unpack CMake.
|
||||
cmake_slug="cmake-${cmake_version}"
|
||||
curl --location --remote-name \
|
||||
"https://github.com/Kitware/CMake/releases/download/v${cmake_version}/${cmake_slug}.tar.gz"
|
||||
tar xzf ${cmake_slug}.tar.gz
|
||||
rm ${cmake_slug}.tar.gz
|
||||
|
||||
# Build and install CMake.
|
||||
cd ${cmake_slug}
|
||||
./bootstrap --parallel=$(nproc)
|
||||
make --jobs $(nproc)
|
||||
make install
|
||||
cd ..
|
||||
rm --recursive --force ${cmake_slug}
|
||||
|
||||
# Install Conan.
|
||||
pip3 install conan==${conan_version}
|
||||
|
||||
conan profile new --detect gcc
|
||||
conan profile update settings.compiler=gcc gcc
|
||||
conan profile update settings.compiler.version=${gcc_version} gcc
|
||||
conan profile update settings.compiler.libcxx=libstdc++11 gcc
|
||||
conan profile update env.CC=/usr/bin/gcc gcc
|
||||
conan profile update env.CXX=/usr/bin/g++ gcc
|
||||
|
||||
49
Builds/containers/ubuntu-builder/ubuntu_setup2.sh
Executable file
49
Builds/containers/ubuntu-builder/ubuntu_setup2.sh
Executable file
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o xtrace
|
||||
|
||||
# Parameters
|
||||
|
||||
gcc_version=${GCC_VERSION:-11}
|
||||
cmake_version=${CMAKE_VERSION:-3.25.1}
|
||||
cmake_sha256=1c511d09516af493694ed9baf13c55947a36389674d657a2d5e0ccedc6b291d8
|
||||
conan_version=${CONAN_VERSION:-1.60}
|
||||
|
||||
curl https://pyenv.run | bash
|
||||
export PYENV_ROOT="$HOME/.pyenv"
|
||||
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
|
||||
eval "$(pyenv init -)"
|
||||
|
||||
pyenv install 3.11.2
|
||||
pyenv global 3.11.2
|
||||
|
||||
# Download and unpack CMake.
|
||||
cmake_slug="cmake-${cmake_version}"
|
||||
cmake_archive="${cmake_slug}.tar.gz"
|
||||
curl --location --remote-name \
|
||||
"https://github.com/Kitware/CMake/releases/download/v${cmake_version}/${cmake_archive}"
|
||||
echo "${cmake_sha256} ${cmake_archive}" | sha256sum --check
|
||||
tar -xzf ${cmake_archive}
|
||||
rm ${cmake_archive}
|
||||
|
||||
# Build and install CMake.
|
||||
cd ${cmake_slug}
|
||||
./bootstrap --parallel=$(nproc)
|
||||
make --jobs $(nproc)
|
||||
make install
|
||||
cd ..
|
||||
rm --recursive --force ${cmake_slug}
|
||||
|
||||
# Install Conan.
|
||||
pip install --upgrade pip
|
||||
pip install conan==${conan_version}
|
||||
|
||||
conan profile new --detect gcc
|
||||
conan profile update settings.compiler=gcc gcc
|
||||
conan profile update settings.compiler.version=${gcc_version} gcc
|
||||
conan profile update settings.compiler.libcxx=libstdc++11 gcc
|
||||
conan profile update settings.compiler.cppstd=20 gcc
|
||||
conan profile update env.CC=/usr/bin/gcc gcc
|
||||
conan profile update env.CXX=/usr/bin/g++ gcc
|
||||
7
Builds/containers/ubuntu-builder/ubuntu_setup3.sh
Executable file
7
Builds/containers/ubuntu-builder/ubuntu_setup3.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o xtrace
|
||||
|
||||
apt-get install --yes build-essential fakeroot devscripts cmake debhelper dh-systemd
|
||||
@@ -132,6 +132,7 @@ test.csf > ripple.json
|
||||
test.csf > ripple.protocol
|
||||
test.json > ripple.beast
|
||||
test.json > ripple.json
|
||||
test.json > ripple.rpc
|
||||
test.json > test.jtx
|
||||
test.jtx > ripple.app
|
||||
test.jtx > ripple.basics
|
||||
@@ -142,6 +143,8 @@ test.jtx > ripple.json
|
||||
test.jtx > ripple.ledger
|
||||
test.jtx > ripple.net
|
||||
test.jtx > ripple.protocol
|
||||
test.jtx > ripple.resource
|
||||
test.jtx > ripple.rpc
|
||||
test.jtx > ripple.server
|
||||
test.ledger > ripple.app
|
||||
test.ledger > ripple.basics
|
||||
@@ -168,7 +171,6 @@ test.nodestore > test.unit_test
|
||||
test.overlay > ripple.app
|
||||
test.overlay > ripple.basics
|
||||
test.overlay > ripple.beast
|
||||
test.overlay > ripple.core
|
||||
test.overlay > ripple.overlay
|
||||
test.overlay > ripple.peerfinder
|
||||
test.overlay > ripple.protocol
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
[Build instructions are currently located in `BUILD.md`](../../BUILD.md)
|
||||
@@ -1 +0,0 @@
|
||||
[Build instructions are currently located in `BUILD.md`](../../BUILD.md)
|
||||
@@ -19,7 +19,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
# make GIT_COMMIT_HASH define available to all sources
|
||||
find_package(Git)
|
||||
if(Git_FOUND)
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} describe --always --abbrev=40
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} --git-dir=${CMAKE_CURRENT_SOURCE_DIR}/.git describe --always --abbrev=40
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE gch)
|
||||
if(gch)
|
||||
set(GIT_COMMIT_HASH "${gch}")
|
||||
@@ -71,7 +71,9 @@ find_package(OpenSSL 1.1.1 REQUIRED)
|
||||
set_target_properties(OpenSSL::SSL PROPERTIES
|
||||
INTERFACE_COMPILE_DEFINITIONS OPENSSL_NO_SSL2
|
||||
)
|
||||
set(SECP256K1_INSTALL TRUE)
|
||||
add_subdirectory(src/secp256k1)
|
||||
add_library(secp256k1::secp256k1 ALIAS secp256k1)
|
||||
add_subdirectory(src/ed25519-donna)
|
||||
find_package(lz4 REQUIRED)
|
||||
# Target names with :: are not allowed in a generator expression.
|
||||
@@ -93,23 +95,28 @@ endif()
|
||||
|
||||
find_package(nudb REQUIRED)
|
||||
find_package(date REQUIRED)
|
||||
include(deps/Protobuf)
|
||||
include(deps/gRPC)
|
||||
|
||||
target_link_libraries(ripple_libs INTERFACE
|
||||
ed25519::ed25519
|
||||
LibArchive::LibArchive
|
||||
lz4::lz4
|
||||
nudb::core
|
||||
OpenSSL::Crypto
|
||||
OpenSSL::SSL
|
||||
Ripple::grpc_pbufs
|
||||
Ripple::pbufs
|
||||
secp256k1::secp256k1
|
||||
soci::soci
|
||||
SQLite::SQLite3
|
||||
)
|
||||
|
||||
# Work around changes to Conan recipe for now.
|
||||
if(TARGET nudb::core)
|
||||
set(nudb nudb::core)
|
||||
elseif(TARGET NuDB::nudb)
|
||||
set(nudb NuDB::nudb)
|
||||
else()
|
||||
message(FATAL_ERROR "unknown nudb target")
|
||||
endif()
|
||||
target_link_libraries(ripple_libs INTERFACE ${nudb})
|
||||
|
||||
if(reporting)
|
||||
find_package(cassandra-cpp-driver REQUIRED)
|
||||
find_package(PostgreSQL REQUIRED)
|
||||
@@ -122,6 +129,8 @@ endif()
|
||||
###
|
||||
|
||||
include(RippledCore)
|
||||
include(deps/Protobuf)
|
||||
include(deps/gRPC)
|
||||
include(RippledInstall)
|
||||
include(RippledCov)
|
||||
include(RippledMultiConfig)
|
||||
|
||||
@@ -1,54 +1,51 @@
|
||||
The XRP Ledger has many and diverse stakeholders, and everyone deserves
|
||||
a chance to contribute meaningful changes to the code that runs the XRPL.
|
||||
a chance to contribute meaningful changes to the code that runs the
|
||||
XRPL.
|
||||
|
||||
# Contributing
|
||||
|
||||
We assume you are familiar with the general practice of [making contributions
|
||||
on GitHub][1].
|
||||
This file includes only special instructions specific to this project.
|
||||
We assume you are familiar with the general practice of [making
|
||||
contributions on GitHub][1]. This file includes only special
|
||||
instructions specific to this project.
|
||||
|
||||
|
||||
## Before you start
|
||||
|
||||
All of your contributions must be developed in your personal
|
||||
In general, contributions should be developed in your personal
|
||||
[fork](https://github.com/XRPLF/rippled/fork).
|
||||
No personal branches may ever be pushed to the [main project][rippled].
|
||||
These are the only branches that may ever exist in the main project:
|
||||
|
||||
The following branches exist in the main project repository:
|
||||
|
||||
- `develop`: The latest set of unreleased features, and the most common
|
||||
starting point for contributions.
|
||||
- `release`: The latest release candidate.
|
||||
- `release`: The latest beta release or release candidate.
|
||||
- `master`: The latest stable release.
|
||||
- `gh-pages`: The documentation for this project, built by Doxygen.
|
||||
|
||||
The tip of each branch must be signed.
|
||||
In order for GitHub to sign a squashed commit that it builds from your pull
|
||||
request,
|
||||
all of your commits must be signed,
|
||||
and GitHub must know your verifying key.
|
||||
Please walk through the excellent documentation from GitHub to set
|
||||
up [signature verification][signing].
|
||||
The tip of each branch must be signed. In order for GitHub to sign a
|
||||
squashed commit that it builds from your pull request, GitHub must know
|
||||
your verifying key. Please set up [signature verification][signing].
|
||||
|
||||
[rippled]: https://github.com/XRPLF/rippled
|
||||
[signing]: https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification
|
||||
[signing]:
|
||||
https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification
|
||||
|
||||
|
||||
## Major contributions
|
||||
|
||||
If your contribution is a major feature or breaking change,
|
||||
then you must first write an XRP Ledger Standard (XLS) describing it.
|
||||
Go to [XRPL-Standards](https://github.com/XRPLF/XRPL-Standards/discussions),
|
||||
choose the next available standard number, and
|
||||
open a discussion with an appropriate title to propose your draft standard.
|
||||
If your contribution is a major feature or breaking change, then you
|
||||
must first write an XRP Ledger Standard (XLS) describing it. Go to
|
||||
[XRPL-Standards](https://github.com/XRPLF/XRPL-Standards/discussions),
|
||||
choose the next available standard number, and open a discussion with an
|
||||
appropriate title to propose your draft standard.
|
||||
|
||||
When you submit a pull request, please link the corresponding XLS in the
|
||||
description.
|
||||
An XLS still in draft status is considered a work-in-progress and open for
|
||||
discussion.
|
||||
Please do not submit a pull request before allowing due time for questions,
|
||||
suggestions, and changes to the XLS draft.
|
||||
It is the responsibility of the XLS author to update the draft to match the
|
||||
final implementation when its corresponding pull request is merged.
|
||||
description. An XLS still in draft status is considered a
|
||||
work-in-progress and open for discussion. Please allow time for
|
||||
questions, suggestions, and changes to the XLS draft. It is the
|
||||
responsibility of the XLS author to update the draft to match the final
|
||||
implementation when its corresponding pull request is merged, unless the
|
||||
author delegates that responsibility to others.
|
||||
|
||||
|
||||
## Before making a pull request
|
||||
@@ -79,13 +76,13 @@ Header includes must be [levelized](./Builds/levelization).
|
||||
|
||||
## Pull requests
|
||||
|
||||
Pull requests must target the `develop` branch.[^1]
|
||||
In general, pull requests use `develop` as the base branch.
|
||||
|
||||
[^1]: There are exceptions to this policy for hotfixes, but no one consulting
|
||||
this document will be in that situation.
|
||||
(Hotfixes are an exception.)
|
||||
|
||||
Changes to pull requests must be added as new commits.
|
||||
You may **never force push a branch in a pull request** (e.g. after a rebase).
|
||||
Once code reviewers have started looking at your code, please avoid
|
||||
force-pushing a branch in a pull request.
|
||||
This preserves the ability for reviewers to filter changes since their last
|
||||
review.
|
||||
|
||||
@@ -100,8 +97,9 @@ to preserve a linear history for the `develop` branch.
|
||||
|
||||
# Style guide
|
||||
|
||||
This is a non-exhaustive list of recommended style guidelines.
|
||||
These are not always strictly enforced and serve as a way to keep the codebase coherent rather than a set of _thou shalt not_ commandments.
|
||||
This is a non-exhaustive list of recommended style guidelines. These are
|
||||
not always strictly enforced and serve as a way to keep the codebase
|
||||
coherent rather than a set of _thou shalt not_ commandments.
|
||||
|
||||
|
||||
## Formatting
|
||||
@@ -121,6 +119,11 @@ this:
|
||||
You can format individual files in place by running `clang-format -i <file>...`
|
||||
from any directory within this project.
|
||||
|
||||
You can install a pre-commit hook to automatically run `clang-format` before every commit:
|
||||
```
|
||||
pip3 install pre-commit
|
||||
pre-commit install
|
||||
```
|
||||
|
||||
## Avoid
|
||||
|
||||
@@ -128,20 +131,27 @@ from any directory within this project.
|
||||
2. Proliferation of new files and classes.
|
||||
3. Complex inheritance and complex OOP patterns.
|
||||
4. Unmanaged memory allocation and raw pointers.
|
||||
5. Macros and non-trivial templates (unless they add significant value.)
|
||||
6. Lambda patterns (unless these add significant value.)
|
||||
7. CPU or architecture-specific code unless there is a good reason to include it, and where it is used guard it with macros and provide explanatory comments.
|
||||
5. Macros and non-trivial templates (unless they add significant value).
|
||||
6. Lambda patterns (unless these add significant value).
|
||||
7. CPU or architecture-specific code unless there is a good reason to
|
||||
include it, and where it is used, guard it with macros and provide
|
||||
explanatory comments.
|
||||
8. Importing new libraries unless there is a very good reason to do so.
|
||||
|
||||
|
||||
## Seek to
|
||||
|
||||
9. Extend functionality of existing code rather than creating new code.
|
||||
10. Prefer readability over terseness where important logic is concerned.
|
||||
11. Inline functions that are not used or are not likely to be used elsewhere in the codebase.
|
||||
12. Use clear and self-explanatory names for functions, variables, structs and classes.
|
||||
13. Use TitleCase for classes, structs and filenames, camelCase for function and variable names, lower case for namespaces and folders.
|
||||
14. Provide as many comments as you feel that a competent programmer would need to understand what your code does.
|
||||
10. Prefer readability over terseness where important logic is
|
||||
concerned.
|
||||
11. Inline functions that are not used or are not likely to be used
|
||||
elsewhere in the codebase.
|
||||
12. Use clear and self-explanatory names for functions, variables,
|
||||
structs and classes.
|
||||
13. Use TitleCase for classes, structs and filenames, camelCase for
|
||||
function and variable names, lower case for namespaces and folders.
|
||||
14. Provide as many comments as you feel that a competent programmer
|
||||
would need to understand what your code does.
|
||||
|
||||
|
||||
# Maintainers
|
||||
|
||||
13
README.md
13
README.md
@@ -3,14 +3,17 @@
|
||||
The [XRP Ledger](https://xrpl.org/) is a decentralized cryptographic ledger powered by a network of peer-to-peer nodes. The XRP Ledger uses a novel Byzantine Fault Tolerant consensus algorithm to settle and record transactions in a secure distributed database without a central operator.
|
||||
|
||||
## XRP
|
||||
[XRP](https://xrpl.org/xrp.html) is a public, counterparty-free asset native to the XRP Ledger, and is designed to bridge the many different currencies in use worldwide. XRP is traded on the open-market and is available for anyone to access. The XRP Ledger was created in 2012 with a finite supply of 100 billion units of XRP. Its creators gifted 80 billion XRP to a company, now called [Ripple](https://ripple.com/), to develop the XRP Ledger and its ecosystem. Ripple uses XRP to help build the Internet of Value, ushering in a world in which money moves as fast and efficiently as information does today.
|
||||
[XRP](https://xrpl.org/xrp.html) is a public, counterparty-free asset native to the XRP Ledger, and is designed to bridge the many different currencies in use worldwide. XRP is traded on the open-market and is available for anyone to access. The XRP Ledger was created in 2012 with a finite supply of 100 billion units of XRP.
|
||||
|
||||
## rippled
|
||||
The server software that powers the XRP Ledger is called `rippled` and is available in this repository under the permissive [ISC open-source license](LICENSE.md). The `rippled` server software is written primarily in C++ and runs on a variety of platforms. The `rippled` server software can run in several modes depending on its [configuration](https://xrpl.org/rippled-server-modes.html).
|
||||
The server software that powers the XRP Ledger is called `rippled` and is available in this repository under the permissive [ISC open-source license](LICENSE.md). The `rippled` server software is written primarily in C++ and runs on a variety of platforms. The `rippled` server software can run in several modes depending on its [configuration](https://xrpl.org/rippled-server-modes.html).
|
||||
|
||||
If you are interested in running an **API Server** (including a **Full History Server**) or a **Reporting Mode** server, take a look at [Clio](https://github.com/XRPLF/clio). rippled Reporting Mode is expected to be replaced by Clio.
|
||||
|
||||
### Build from Source
|
||||
|
||||
* [Read the build instructions in `BUILD.md`](BUILD.md)
|
||||
* If you encounter any issues, please [open an issue](https://github.com/XRPLF/rippled/issues)
|
||||
|
||||
## Key Features of the XRP Ledger
|
||||
|
||||
@@ -53,10 +56,14 @@ Some of the directories under `src` are external repositories included using
|
||||
git-subtree. See those directories' README files for more details.
|
||||
|
||||
|
||||
## See Also
|
||||
## Additional Documentation
|
||||
|
||||
* [XRP Ledger Dev Portal](https://xrpl.org/)
|
||||
* [Setup and Installation](https://xrpl.org/install-rippled.html)
|
||||
* [Source Documentation (Doxygen)](https://xrplf.github.io/rippled/)
|
||||
|
||||
## See Also
|
||||
|
||||
* [Clio API Server for the XRP Ledger](https://github.com/XRPLF/clio)
|
||||
* [Mailing List for Release Announcements](https://groups.google.com/g/ripple-server)
|
||||
* [Learn more about the XRP Ledger (YouTube)](https://www.youtube.com/playlist?list=PLJQ55Tj1hIVZtJ_JdTvSum2qMTsedWkNi)
|
||||
|
||||
247
RELEASENOTES.md
247
RELEASENOTES.md
@@ -7,6 +7,253 @@ 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.12.0
|
||||
|
||||
Version 1.12.0 of `rippled`, the reference server implementation of the XRP Ledger protocol, is now available. This release adds new features and bug fixes, and introduces these amendments:
|
||||
|
||||
- `AMM`
|
||||
- `Clawback`
|
||||
- `fixReducedOffersV1`
|
||||
|
||||
[Sign Up for Future Release Announcements](https://groups.google.com/g/ripple-server)
|
||||
|
||||
<!-- BREAK -->
|
||||
|
||||
## Action Required
|
||||
|
||||
Three new amendments are 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.12.0 by September 20, 2023 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).
|
||||
|
||||
The XRPL Foundation publishes portable binaries, which are drop-in replacements for the `rippled` daemon. [See information and downloads for the portable binaries](https://github.com/XRPLF/rippled-portable-builds#portable-builds-of-the-rippled-server). This will work on most distributions, including Ubuntu 16.04, 18.04, 20.04, and 22.04; CentOS; and others. Please test and open issues on GitHub if there are problems.
|
||||
|
||||
|
||||
## Changelog
|
||||
|
||||
### Amendments, New Features, and Changes
|
||||
(These are changes which may impact or be useful to end users. For example, you may be able to update your code/workflow to take advantage of these changes.)
|
||||
|
||||
- **`AMM`**: Introduces an automated market maker (AMM) protocol to the XRP Ledger's decentralized exchange, enabling you to trade assets without a counterparty. For more information about AMMs, see: [Automated Market Maker](https://opensource.ripple.com/docs/xls-30d-amm/amm-uc/). [#4294](https://github.com/XRPLF/rippled/pull/4294)
|
||||
|
||||
- **`Clawback`**: Adds a setting, *Allow Clawback*, which lets an issuer recover, or _claw back_, tokens that they previously issued. Issuers cannot enable this setting if they have issued tokens already. For additional documentation on this feature, see: [#4553](https://github.com/XRPLF/rippled/pull/4553).
|
||||
|
||||
- **`fixReducedOffersV1`**: Reduces the occurrence of order books that are blocked by reduced offers. [#4512](https://github.com/XRPLF/rippled/pull/4512)
|
||||
|
||||
- Added WebSocket and RPC port info to `server_info` responses. [#4427](https://github.com/XRPLF/rippled/pull/4427)
|
||||
|
||||
- Removed the deprecated `accepted`, `seqNum`, `hash`, and `totalCoins` fields from the `ledger` method. [#4244](https://github.com/XRPLF/rippled/pull/4244)
|
||||
|
||||
|
||||
### Bug Fixes and Performance Improvements
|
||||
(These are behind-the-scenes improvements, such as internal changes to the code, which are not expected to impact end users.)
|
||||
|
||||
- Added a pre-commit hook that runs the clang-format linter locally before committing changes. To install this feature, see: [CONTRIBUTING](https://github.com/XRPLF/xrpl-dev-portal/blob/master/CONTRIBUTING.md). [#4599](https://github.com/XRPLF/rippled/pull/4599)
|
||||
|
||||
- In order to make it more straightforward to catch and handle overflows: changed the output type of the `mulDiv()` function from `std::pair<bool, uint64_t>` to `std::optional`. [#4243](https://github.com/XRPLF/rippled/pull/4243)
|
||||
|
||||
- Updated `Handler::Condition` enum values to make the code less brittle. [#4239](https://github.com/XRPLF/rippled/pull/4239)
|
||||
|
||||
- Renamed `ServerHandlerImp` to `ServerHandler`. [#4516](https://github.com/XRPLF/rippled/pull/4516), [#4592](https://github.com/XRPLF/rippled/pull/4592)
|
||||
|
||||
- Replaced hand-rolled code with `std::from_chars` for better maintainability. [#4473](https://github.com/XRPLF/rippled/pull/4473)
|
||||
|
||||
- Removed an unused `TypedField` move constructor. [#4567](https://github.com/XRPLF/rippled/pull/4567)
|
||||
|
||||
|
||||
### Docs and Build System
|
||||
|
||||
- Updated checkout versions to resolve warnings during GitHub jobs. [#4598](https://github.com/XRPLF/rippled/pull/4598)
|
||||
|
||||
- Fixed an issue with the Debian package build. [#4591](https://github.com/XRPLF/rippled/pull/4591)
|
||||
|
||||
- Updated build instructions with additional steps to take after updating dependencies. [#4623](https://github.com/XRPLF/rippled/pull/4623)
|
||||
|
||||
- Updated contributing doc to clarify that beta releases should also be pushed to the `release` branch. [#4589](https://github.com/XRPLF/rippled/pull/4589)
|
||||
|
||||
- Enabled the `BETA_RPC_API` flag in the default unit tests config, making the API v2 (beta) available to unit tests. [#4573](https://github.com/XRPLF/rippled/pull/4573)
|
||||
|
||||
- Conan dependency management.
|
||||
- Fixed package definitions for Conan. [#4485](https://github.com/XRPLF/rippled/pull/4485)
|
||||
- Updated build dependencies to the most recent versions in Conan Center. [#4595](https://github.com/XRPLF/rippled/pull/4595)
|
||||
- Updated Conan recipe for NuDB. [#4615](https://github.com/XRPLF/rippled/pull/4615)
|
||||
|
||||
- Added binary hardening and linker flags to enhance security during the build process. [#4603](https://github.com/XRPLF/rippled/pull/4603)
|
||||
|
||||
- Added an Artifactory to the `nix` workflow to improve build times. [#4556](https://github.com/XRPLF/rippled/pull/4556)
|
||||
|
||||
- Added quality-of-life improvements to workflows, using new [concurrency control](https://docs.github.com/en/actions/using-jobs/using-concurrency) features. [#4597](https://github.com/XRPLF/rippled/pull/4597)
|
||||
|
||||
|
||||
[Full Commit Log](https://github.com/XRPLF/rippled/compare/1.11.0...1.12.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:
|
||||
|
||||
- Alphonse N. Mousse <39067955+a-noni-mousse@users.noreply.github.com>
|
||||
- Arihant Kothari <arihantkothari17@gmail.com>
|
||||
- Chenna Keshava B S <21219765+ckeshava@users.noreply.github.com>
|
||||
- Denis Angell <dangell@transia.co>
|
||||
- Ed Hennis <ed@ripple.com>
|
||||
- Elliot Lee <github.public@intelliot.com>
|
||||
- Gregory Tsipenyuk <gregtatcam@users.noreply.github.com>
|
||||
- Howard Hinnant <howard.hinnant@gmail.com>
|
||||
- Ikko Eltociear Ashimine <eltociear@gmail.com>
|
||||
- John Freeman <jfreeman08@gmail.com>
|
||||
- Manoj Doshi <mdoshi@ripple.com>
|
||||
- Mark Travis <mtravis@ripple.com>
|
||||
- Mayukha Vadari <mvadari@gmail.com>
|
||||
- Michael Legleux <legleux@users.noreply.github.com>
|
||||
- Peter Chen <34582813+PeterChen13579@users.noreply.github.com>
|
||||
- RichardAH <richard.holland@starstone.co.nz>
|
||||
- Rome Reginelli <rome@ripple.com>
|
||||
- Scott Schurr <scott@ripple.com>
|
||||
- Shawn Xie <35279399+shawnxie999@users.noreply.github.com>
|
||||
- drlongle <drlongle@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.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
|
||||
|
||||
|
||||
12
SECURITY.md
12
SECURITY.md
@@ -37,7 +37,7 @@ Your report should include the following:
|
||||
- The steps to reproduce the vulnerability;
|
||||
- Any other relevant details or artifacts, including code, scripts or patches.
|
||||
|
||||
In your mail, please describe of the issue or the potential threat; if possible, please include a "repro" (code that can reproduce the issue) or describe the best way to reproduce and replicate the issue. Please make your report as extensive as possible.
|
||||
In your email, please describe the issue or potential threat. If possible, include a "repro" (code that can reproduce the issue) or describe the best way to reproduce and replicate the issue. Please make your report as detailed and comprehensive as possible.
|
||||
|
||||
For more information on responsible disclosure, please read this [Wikipedia article](https://en.wikipedia.org/wiki/Responsible_disclosure).
|
||||
|
||||
@@ -60,15 +60,15 @@ While we commit to responding with 24 hours of your initial report with our tria
|
||||
|
||||
## Bug Bounty Program
|
||||
|
||||
[Ripple](https://ripple.com) is generously sponsoring a bug bounty program for vulnerabilities in [`rippled`](https://github.com/ripple/rippled) (and other related projects, like [`ripple-lib`](https://github.com/ripple/ripple-lib)).
|
||||
[Ripple](https://ripple.com) is generously sponsoring a bug bounty program for vulnerabilities in [`rippled`](https://github.com/XRPLF/rippled) (and other related projects, like [`xrpl.js`](https://github.com/XRPLF/xrpl.js), [`xrpl-py`](https://github.com/XRPLF/xrpl-py), [`xrpl4j`](https://github.com/XRPLF/xrpl4j)).
|
||||
|
||||
This program allows us to recognize and reward individuals or groups that identify and report bugs. In summary, order to qualify for a bounty, the bug must be:
|
||||
This program allows us to recognize and reward individuals or groups that identify and report bugs. In summary, in order to qualify for a bounty, the bug must be:
|
||||
|
||||
1. **In scope**. Only bugs in software under the scope of the program qualify. Currently, that means `rippled` and `ripple-lib`.
|
||||
2. **Relevant**. A security issue, posing a danger to user funds, privacy or the operation of the XRP Ledger.
|
||||
1. **In scope**. Only bugs in software under the scope of the program qualify. Currently, that means `rippled`, `xrpl.js`, `xrpl-py`, `xrpl4j`.
|
||||
2. **Relevant**. A security issue, posing a danger to user funds, privacy, or the operation of the XRP 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 compromises the security of software that is in scope and we can get it fixed, you may qualify for a bounty.
|
||||
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 XRP 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.
|
||||
|
||||
The amount paid varies dramatically. Vulnerabilities that are harmless on their own, but could form part of a critical exploit will usually receive a bounty. Full-blown exploits can receive much higher bounties. Please don’t hold back partial vulnerabilities while trying to construct a full-blown exploit. We will pay a bounty to anyone who reports a complete chain of vulnerabilities even if they have reported each component of the exploit separately and those vulnerabilities have been fixed in the meantime. However, to qualify for a the full bounty, you must to have been the first to report each of the partial exploits.
|
||||
|
||||
@@ -283,12 +283,14 @@
|
||||
# ssl_cert
|
||||
#
|
||||
# Specifies the path to the SSL certificate file in PEM format.
|
||||
# This is not needed if the chain includes it.
|
||||
# This is not needed if the chain includes it. Use ssl_chain if
|
||||
# your certificate includes one or more intermediates.
|
||||
#
|
||||
# ssl_chain
|
||||
#
|
||||
# If you need a certificate chain, specify the path to the
|
||||
# certificate chain here. The chain may include the end certificate.
|
||||
# This must be used if the certificate includes intermediates.
|
||||
#
|
||||
# ssl_ciphers = <cipherlist>
|
||||
#
|
||||
@@ -387,6 +389,21 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
# [compression]
|
||||
#
|
||||
# true or false
|
||||
#
|
||||
# true - enables compression
|
||||
# false - disables compression [default].
|
||||
#
|
||||
# The rippled server can save bandwidth by compressing its peer-to-peer communications,
|
||||
# at a cost of greater CPU usage. If you enable link compression,
|
||||
# the server automatically compresses communications with peer servers
|
||||
# that also have link compression enabled.
|
||||
# https://xrpl.org/enable-link-compression.html
|
||||
#
|
||||
#
|
||||
#
|
||||
# [ips]
|
||||
#
|
||||
# List of hostnames or ips where the Ripple protocol is served. A default
|
||||
@@ -461,19 +478,6 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
# [sntp_servers]
|
||||
#
|
||||
# IP address or domain of NTP servers to use for time synchronization.
|
||||
#
|
||||
# These NTP servers are suitable for rippled servers located in the United
|
||||
# States:
|
||||
# time.windows.com
|
||||
# time.apple.com
|
||||
# time.nist.gov
|
||||
# pool.ntp.org
|
||||
#
|
||||
#
|
||||
#
|
||||
# [max_transactions]
|
||||
#
|
||||
# Configure the maximum number of transactions to have in the job queue
|
||||
@@ -1441,7 +1445,7 @@
|
||||
# default. Don't change this without understanding the consequences.
|
||||
#
|
||||
# Example:
|
||||
# account_reserve = 20000000 # 20 XRP
|
||||
# account_reserve = 10000000 # 10 XRP
|
||||
#
|
||||
# owner_reserve = <drops>
|
||||
#
|
||||
@@ -1453,7 +1457,7 @@
|
||||
# default. Don't change this without understanding the consequences.
|
||||
#
|
||||
# Example:
|
||||
# owner_reserve = 5000000 # 5 XRP
|
||||
# owner_reserve = 2000000 # 2 XRP
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
@@ -1702,12 +1706,6 @@ advisory_delete=0
|
||||
[debug_logfile]
|
||||
/var/log/rippled/debug.log
|
||||
|
||||
[sntp_servers]
|
||||
time.windows.com
|
||||
time.apple.com
|
||||
time.nist.gov
|
||||
pool.ntp.org
|
||||
|
||||
# To use the XRP test network
|
||||
# (see https://xrpl.org/connect-your-rippled-to-the-xrp-test-net.html),
|
||||
# use the following [ips] section:
|
||||
|
||||
@@ -450,19 +450,6 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
# [sntp_servers]
|
||||
#
|
||||
# IP address or domain of NTP servers to use for time synchronization.
|
||||
#
|
||||
# These NTP servers are suitable for rippled servers located in the United
|
||||
# States:
|
||||
# time.windows.com
|
||||
# time.apple.com
|
||||
# time.nist.gov
|
||||
# pool.ntp.org
|
||||
#
|
||||
#
|
||||
#
|
||||
# [max_transactions]
|
||||
#
|
||||
# Configure the maximum number of transactions to have in the job queue
|
||||
@@ -1401,7 +1388,7 @@
|
||||
# default. Don't change this without understanding the consequences.
|
||||
#
|
||||
# Example:
|
||||
# account_reserve = 20000000 # 20 XRP
|
||||
# account_reserve = 10000000 # 10 XRP
|
||||
#
|
||||
# owner_reserve = <drops>
|
||||
#
|
||||
@@ -1413,7 +1400,7 @@
|
||||
# default. Don't change this without understanding the consequences.
|
||||
#
|
||||
# Example:
|
||||
# owner_reserve = 5000000 # 5 XRP
|
||||
# owner_reserve = 2000000 # 2 XRP
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
@@ -1662,12 +1649,6 @@ advisory_delete=0
|
||||
[debug_logfile]
|
||||
/var/log/rippled-reporting/debug.log
|
||||
|
||||
[sntp_servers]
|
||||
time.windows.com
|
||||
time.apple.com
|
||||
time.nist.gov
|
||||
pool.ntp.org
|
||||
|
||||
# To use the XRP test network
|
||||
# (see https://xrpl.org/connect-your-rippled-to-the-xrp-test-net.html),
|
||||
# use the following [ips] section:
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#
|
||||
# Examples:
|
||||
# https://vl.ripple.com
|
||||
# https://vl.coil.com
|
||||
# https://vl.xrplf.org
|
||||
# http://127.0.0.1:8000
|
||||
# file:///etc/opt/ripple/vl.txt
|
||||
|
||||
43
conanfile.py
43
conanfile.py
@@ -1,4 +1,4 @@
|
||||
from conans import ConanFile
|
||||
from conan import ConanFile
|
||||
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
|
||||
import re
|
||||
|
||||
@@ -24,18 +24,18 @@ class Xrpl(ConanFile):
|
||||
}
|
||||
|
||||
requires = [
|
||||
'boost/1.77.0',
|
||||
'boost/1.82.0',
|
||||
'date/3.0.1',
|
||||
'libarchive/3.6.0',
|
||||
'lz4/1.9.3',
|
||||
'grpc/1.50.1',
|
||||
'libarchive/3.6.2',
|
||||
'lz4/1.9.3',
|
||||
'nudb/2.0.8',
|
||||
'openssl/1.1.1m',
|
||||
'protobuf/3.21.4',
|
||||
'snappy/1.1.9',
|
||||
'openssl/1.1.1u',
|
||||
'protobuf/3.21.9',
|
||||
'snappy/1.1.10',
|
||||
'soci/4.0.3',
|
||||
'sqlite3/3.38.0',
|
||||
'zlib/1.2.12',
|
||||
'sqlite3/3.42.0',
|
||||
'zlib/1.2.13',
|
||||
]
|
||||
|
||||
default_options = {
|
||||
@@ -51,6 +51,7 @@ class Xrpl(ConanFile):
|
||||
'unity': False,
|
||||
|
||||
'cassandra-cpp-driver:shared': False,
|
||||
'cassandra-cpp-driver:use_atomic': None,
|
||||
'date:header_only': True,
|
||||
'grpc:shared': False,
|
||||
'grpc:secure': True,
|
||||
@@ -101,14 +102,16 @@ class Xrpl(ConanFile):
|
||||
|
||||
def requirements(self):
|
||||
if self.options.jemalloc:
|
||||
self.requires('jemalloc/5.2.1')
|
||||
self.requires('jemalloc/5.3.0')
|
||||
if self.options.reporting:
|
||||
self.requires('cassandra-cpp-driver/2.15.3')
|
||||
self.requires('libpq/13.6')
|
||||
self.requires('libpq/14.7')
|
||||
if self.options.rocksdb:
|
||||
self.requires('rocksdb/6.27.3')
|
||||
self.requires('rocksdb/6.29.5')
|
||||
|
||||
exports_sources = 'CMakeLists.txt', 'Builds/CMake/*', 'src/*', 'cfg/*'
|
||||
exports_sources = (
|
||||
'CMakeLists.txt', 'Builds/*', 'bin/getRippledInfo', 'src/*', 'cfg/*'
|
||||
)
|
||||
|
||||
def layout(self):
|
||||
cmake_layout(self)
|
||||
@@ -142,8 +145,18 @@ class Xrpl(ConanFile):
|
||||
cmake.install()
|
||||
|
||||
def package_info(self):
|
||||
self.cpp_info.libs = [
|
||||
libxrpl = self.cpp_info.components['libxrpl']
|
||||
libxrpl.libs = [
|
||||
'libxrpl_core.a',
|
||||
'libed25519-donna.a',
|
||||
'libed25519.a',
|
||||
'libsecp256k1.a',
|
||||
]
|
||||
# TODO: Fix the protobufs to include each other relative to
|
||||
# `include/`, not `include/ripple/proto/`.
|
||||
libxrpl.includedirs = ['include', 'include/ripple/proto']
|
||||
libxrpl.requires = [
|
||||
'boost::boost',
|
||||
'openssl::crypto',
|
||||
'date::date',
|
||||
'grpc::grpc++',
|
||||
]
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
RUN apt -y update
|
||||
RUN apt -y upgrade
|
||||
RUN apt -y install build-essential g++ git libbz2-dev wget python-dev
|
||||
RUN apt -y install cmake flex bison graphviz graphviz-dev libicu-dev
|
||||
RUN apt -y install jarwrapper java-common
|
||||
|
||||
RUN cd /tmp
|
||||
ENV CM_INSTALLER=cmake-3.10.0-rc3-Linux-x86_64.sh
|
||||
ENV CM_VER_DIR=/opt/local/cmake-3.10.0
|
||||
RUN cd /tmp && wget https://cmake.org/files/v3.10/$CM_INSTALLER && chmod a+x $CM_INSTALLER
|
||||
RUN mkdir -p $CM_VER_DIR
|
||||
RUN ln -s $CM_VER_DIR /opt/local/cmake
|
||||
RUN /tmp/$CM_INSTALLER --prefix=$CM_VER_DIR --exclude-subdir
|
||||
RUN rm -f /tmp/$CM_INSTALLER
|
||||
|
||||
RUN cd /tmp && wget https://ftp.stack.nl/pub/users/dimitri/doxygen-1.8.14.src.tar.gz
|
||||
RUN cd /tmp && tar xvf doxygen-1.8.14.src.tar.gz
|
||||
RUN mkdir -p /tmp/doxygen-1.8.14/build
|
||||
RUN cd /tmp/doxygen-1.8.14/build && /opt/local/cmake/bin/cmake -G "Unix Makefiles" ..
|
||||
RUN cd /tmp/doxygen-1.8.14/build && make -j2
|
||||
RUN cd /tmp/doxygen-1.8.14/build && make install
|
||||
RUN rm -f /tmp/doxygen-1.8.14.src.tar.gz
|
||||
RUN rm -rf /tmp/doxygen-1.8.14
|
||||
|
||||
RUN mkdir -p /opt/plantuml
|
||||
RUN wget -O /opt/plantuml/plantuml.jar http://sourceforge.net/projects/plantuml/files/plantuml.jar/download
|
||||
ENV DOXYGEN_PLANTUML_JAR_PATH=/opt/plantuml/plantuml.jar
|
||||
|
||||
ENV DOXYGEN_OUTPUT_DIRECTORY=html
|
||||
CMD cd /opt/rippled && doxygen docs/Doxyfile
|
||||
114
docs/build/conan.md
vendored
Normal file
114
docs/build/conan.md
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
## A crash course in CMake and Conan
|
||||
|
||||
To better understand how to use Conan,
|
||||
we should first understand _why_ we use Conan,
|
||||
and to understand that,
|
||||
we need to understand how we use CMake.
|
||||
|
||||
|
||||
### CMake
|
||||
|
||||
Technically, you don't need CMake to build this project.
|
||||
You could manually compile every translation unit into an object file,
|
||||
using the right compiler options,
|
||||
and then manually link all those objects together,
|
||||
using the right linker options.
|
||||
However, that is very tedious and error-prone,
|
||||
which is why we lean on tools like CMake.
|
||||
|
||||
We have written CMake configuration files
|
||||
([`CMakeLists.txt`](./CMakeLists.txt) and friends)
|
||||
for this project so that CMake can be used to correctly compile and link
|
||||
all of the translation units in it.
|
||||
Or rather, CMake will generate files for a separate build system
|
||||
(e.g. Make, Ninja, Visual Studio, Xcode, etc.)
|
||||
that compile and link all of the translation units.
|
||||
Even then, CMake has parameters, some of which are platform-specific.
|
||||
In CMake's parlance, parameters are specially-named **variables** like
|
||||
[`CMAKE_BUILD_TYPE`][build_type] or
|
||||
[`CMAKE_MSVC_RUNTIME_LIBRARY`][runtime].
|
||||
Parameters include:
|
||||
|
||||
- what build system to generate files for
|
||||
- where to find the compiler and linker
|
||||
- where to find dependencies, e.g. libraries and headers
|
||||
- how to link dependencies, e.g. any special compiler or linker flags that
|
||||
need to be used with them, including preprocessor definitions
|
||||
- how to compile translation units, e.g. with optimizations, debug symbols,
|
||||
position-independent code, etc.
|
||||
- on Windows, which runtime library to link with
|
||||
|
||||
For some of these parameters, like the build system and compiler,
|
||||
CMake goes through a complicated search process to choose default values.
|
||||
For others, like the dependencies,
|
||||
_we_ had written in the CMake configuration files of this project
|
||||
our own complicated process to choose defaults.
|
||||
For most developers, things "just worked"... until they didn't, and then
|
||||
you were left trying to debug one of these complicated processes, instead of
|
||||
choosing and manually passing the parameter values yourself.
|
||||
|
||||
You can pass every parameter to CMake on the command line,
|
||||
but writing out these parameters every time we want to configure CMake is
|
||||
a pain.
|
||||
Most humans prefer to put them into a configuration file, once, that
|
||||
CMake can read every time it is configured.
|
||||
For CMake, that file is a [toolchain file][toolchain].
|
||||
|
||||
|
||||
### Conan
|
||||
|
||||
These next few paragraphs on Conan are going to read much like the ones above
|
||||
for CMake.
|
||||
|
||||
Technically, you don't need Conan to build this project.
|
||||
You could manually download, configure, build, and install all of the
|
||||
dependencies yourself, and then pass all of the parameters necessary for
|
||||
CMake to link to those dependencies.
|
||||
To guarantee ABI compatibility, you must be sure to use the same set of
|
||||
compiler and linker options for all dependencies _and_ this project.
|
||||
However, that is very tedious and error-prone, which is why we lean on tools
|
||||
like Conan.
|
||||
|
||||
We have written a Conan configuration file ([`conanfile.py`](../../conanfile.py))
|
||||
so that Conan can be used to correctly download, configure, build, and install
|
||||
all of the dependencies for this project,
|
||||
using a single set of compiler and linker options for all of them.
|
||||
It generates files that contain almost all of the parameters that CMake
|
||||
expects.
|
||||
Those files include:
|
||||
|
||||
- A single toolchain file.
|
||||
- For every dependency, a CMake [package configuration file][pcf],
|
||||
[package version file][pvf], and for every build type, a package
|
||||
targets file.
|
||||
Together, these files implement version checking and define `IMPORTED`
|
||||
targets for the dependencies.
|
||||
|
||||
The toolchain file itself amends the search path
|
||||
([`CMAKE_PREFIX_PATH`][prefix_path]) so that [`find_package()`][find_package]
|
||||
will [discover][search] the generated package configuration files.
|
||||
|
||||
**Nearly all we must do to properly configure CMake is pass the toolchain
|
||||
file.**
|
||||
What CMake parameters are left out?
|
||||
You'll still need to pick a build system generator,
|
||||
and if you choose a single-configuration generator,
|
||||
you'll need to pass the `CMAKE_BUILD_TYPE`,
|
||||
which should match the `build_type` setting you gave to Conan.
|
||||
|
||||
Even then, Conan has parameters, some of which are platform-specific.
|
||||
In Conan's parlance, parameters are either settings or options.
|
||||
**Settings** are shared by all packages, e.g. the build type.
|
||||
**Options** are specific to a given package, e.g. whether to build and link
|
||||
OpenSSL as a shared library.
|
||||
|
||||
For settings, Conan goes through a complicated search process to choose
|
||||
defaults.
|
||||
For options, each package recipe defines its own defaults.
|
||||
|
||||
You can pass every parameter to Conan on the command line,
|
||||
but it is more convenient to put them in a configuration file, once, that
|
||||
Conan can read every time it is configured.
|
||||
For Conan, that file is a [profile][profile].
|
||||
**All we must do to properly configure Conan is edit and pass the profile.**
|
||||
By default, Conan will use the profile named "default".
|
||||
98
docs/build/depend.md
vendored
Normal file
98
docs/build/depend.md
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
We recommend two different methods to depend on libxrpl in your own [CMake][]
|
||||
project.
|
||||
Both methods add a CMake library target named `xrpl::libxrpl`.
|
||||
|
||||
|
||||
## Conan requirement
|
||||
|
||||
The first method adds libxrpl as a [Conan][] requirement.
|
||||
With this method, there is no need for a Git [submodule][].
|
||||
It is good for when you just need a dependency on libxrpl as-is.
|
||||
|
||||
```
|
||||
# This conanfile.txt is just an example.
|
||||
[requires]
|
||||
xrpl/1.10.0
|
||||
|
||||
[generators]
|
||||
CMakeDeps
|
||||
CMakeToolchain
|
||||
```
|
||||
|
||||
```
|
||||
# If you want to depend on a version of libxrpl that is not in ConanCenter,
|
||||
# then you can export the recipe from the rippled project.
|
||||
conan export <path>
|
||||
```
|
||||
|
||||
```cmake
|
||||
# Find and link the library in your CMake project.
|
||||
find_package(xrpl)
|
||||
target_link_libraries(<target> PUBLIC xrpl::libxrpl)
|
||||
```
|
||||
|
||||
```
|
||||
# Download, build, and connect dependencies with Conan.
|
||||
mkdir .build
|
||||
cd .build
|
||||
mkdir -p build/generators
|
||||
conan install \
|
||||
--install-folder build/generators \
|
||||
--build missing \
|
||||
--settings build_type=Release \
|
||||
..
|
||||
cmake \
|
||||
-DCMAKE_TOOLCHAIN_FILE=build/generators/conan_toolchain.cmake \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
..
|
||||
cmake --build . --parallel
|
||||
```
|
||||
|
||||
|
||||
## CMake subdirectory
|
||||
|
||||
The second method adds the [rippled][] project as a CMake
|
||||
[subdirectory][add_subdirectory].
|
||||
This method works well when you keep the rippled project as a Git
|
||||
[submodule][].
|
||||
It's good for when you want to make changes to libxrpl as part of your own
|
||||
project.
|
||||
Be careful, though.
|
||||
Your project will inherit all of the same CMake options,
|
||||
so watch out for name collisions.
|
||||
We still recommend using [Conan][] to download, build, and connect dependencies.
|
||||
|
||||
```
|
||||
# Add the project as a Git submodule.
|
||||
mkdir submodules
|
||||
git submodule add https://github.com/XRPLF/rippled.git submodules/rippled
|
||||
```
|
||||
|
||||
```cmake
|
||||
# Add and link the library in your CMake project.
|
||||
add_subdirectory(submodules/rippled)
|
||||
target_link_libraries(<target> PUBLIC xrpl::libxrpl)
|
||||
```
|
||||
|
||||
```
|
||||
# Download, build, and connect dependencies with Conan.
|
||||
mkdir .build
|
||||
cd .build
|
||||
conan install \
|
||||
--output-folder . \
|
||||
--build missing \
|
||||
--settings build_type=Release \
|
||||
../submodules/rippled
|
||||
cmake \
|
||||
-DCMAKE_TOOLCHAIN_FILE=build/generators/conan_toolchain.cmake \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
..
|
||||
cmake --build . --parallel
|
||||
```
|
||||
|
||||
|
||||
[add_subdirectory]: https://cmake.org/cmake/help/latest/command/add_subdirectory.html
|
||||
[submodule]: https://git-scm.com/book/en/v2/Git-Tools-Submodules
|
||||
[rippled]: https://github.com/ripple/rippled
|
||||
[Conan]: https://docs.conan.io/
|
||||
[CMake]: https://cmake.org/cmake/help/latest/
|
||||
84
docs/build/environment.md
vendored
Normal file
84
docs/build/environment.md
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
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
Normal file
159
docs/build/install.md
vendored
Normal file
@@ -0,0 +1,159 @@
|
||||
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
|
||||
24
external/snappy/conandata.yml
vendored
24
external/snappy/conandata.yml
vendored
@@ -1,4 +1,7 @@
|
||||
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"
|
||||
@@ -9,8 +12,29 @@ sources:
|
||||
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"
|
||||
|
||||
13
external/snappy/patches/1.1.10-0001-fix-inlining-failure.patch
vendored
Normal file
13
external/snappy/patches/1.1.10-0001-fix-inlining-failure.patch
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
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
|
||||
13
external/snappy/patches/1.1.10-0003-fix-clobber-list-older-llvm.patch
vendored
Normal file
13
external/snappy/patches/1.1.10-0003-fix-clobber-list-older-llvm.patch
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
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"
|
||||
12
external/soci/conandata.yml
vendored
Normal file
12
external/soci/conandata.yml
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
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
Normal file
212
external/soci/conanfile.py
vendored
Normal file
@@ -0,0 +1,212 @@
|
||||
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::boost")
|
||||
|
||||
# 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)
|
||||
39
external/soci/patches/0001-Remove-hardcoded-INSTALL_NAME_DIR-for-relocatable-li.patch
vendored
Normal file
39
external/soci/patches/0001-Remove-hardcoded-INSTALL_NAME_DIR-for-relocatable-li.patch
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
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
|
||||
|
||||
24
external/soci/patches/0002-Fix-soci_backend.patch
vendored
Normal file
24
external/soci/patches/0002-Fix-soci_backend.patch
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
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()
|
||||
|
||||
@@ -181,7 +181,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);
|
||||
@@ -325,7 +325,7 @@ RCLConsensus::Adaptor::onClose(
|
||||
tx.first->add(s);
|
||||
initialSet->addItem(
|
||||
SHAMapNodeType::tnTRANSACTION_NM,
|
||||
SHAMapItem(tx.first->getTransactionID(), s.slice()));
|
||||
make_shamapitem(tx.first->getTransactionID(), s.slice()));
|
||||
}
|
||||
|
||||
// Add pseudo-transactions to the set
|
||||
@@ -369,7 +369,8 @@ RCLConsensus::Adaptor::onClose(
|
||||
RCLCensorshipDetector<TxID, LedgerIndex>::TxIDSeqVec proposed;
|
||||
|
||||
initialSet->visitLeaves(
|
||||
[&proposed, seq](std::shared_ptr<SHAMapItem const> const& item) {
|
||||
[&proposed,
|
||||
seq](boost::intrusive_ptr<SHAMapItem const> const& item) {
|
||||
proposed.emplace_back(item->key(), seq);
|
||||
});
|
||||
|
||||
@@ -498,10 +499,11 @@ RCLConsensus::Adaptor::doAccept(
|
||||
std::make_shared<STTx const>(SerialIter{item.slice()}));
|
||||
JLOG(j_.debug()) << " Tx: " << item.key();
|
||||
}
|
||||
catch (std::exception const&)
|
||||
catch (std::exception const& ex)
|
||||
{
|
||||
failed.insert(item.key());
|
||||
JLOG(j_.warn()) << " Tx: " << item.key() << " throws!";
|
||||
JLOG(j_.warn())
|
||||
<< " Tx: " << item.key() << " throws: " << ex.what();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -528,7 +530,7 @@ RCLConsensus::Adaptor::doAccept(
|
||||
std::vector<TxID> accepted;
|
||||
|
||||
result.txns.map_->visitLeaves(
|
||||
[&accepted](std::shared_ptr<SHAMapItem const> const& item) {
|
||||
[&accepted](boost::intrusive_ptr<SHAMapItem const> const& item) {
|
||||
accepted.push_back(item->key());
|
||||
});
|
||||
|
||||
@@ -603,7 +605,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
|
||||
@@ -615,10 +617,11 @@ RCLConsensus::Adaptor::doAccept(
|
||||
|
||||
anyDisputes = true;
|
||||
}
|
||||
catch (std::exception const&)
|
||||
catch (std::exception const& ex)
|
||||
{
|
||||
JLOG(j_.debug())
|
||||
<< "Failed to apply transaction we voted NO on";
|
||||
JLOG(j_.debug()) << "Failed to apply transaction we voted "
|
||||
"NO on. Exception: "
|
||||
<< ex.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
|
||||
@param txn The transaction to wrap
|
||||
*/
|
||||
RCLCxTx(SHAMapItem const& txn) : tx_{txn}
|
||||
RCLCxTx(boost::intrusive_ptr<SHAMapItem const> txn) : tx_(std::move(txn))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -50,11 +50,11 @@ public:
|
||||
ID const&
|
||||
id() const
|
||||
{
|
||||
return tx_.key();
|
||||
return tx_->key();
|
||||
}
|
||||
|
||||
//! The SHAMapItem that represents the transaction.
|
||||
SHAMapItem const tx_;
|
||||
boost::intrusive_ptr<SHAMapItem const> tx_;
|
||||
};
|
||||
|
||||
/** Represents a set of transactions in RCLConsensus.
|
||||
@@ -90,8 +90,7 @@ public:
|
||||
bool
|
||||
insert(Tx const& t)
|
||||
{
|
||||
return map_->addItem(
|
||||
SHAMapNodeType::tnTRANSACTION_NM, SHAMapItem{t.tx_});
|
||||
return map_->addItem(SHAMapNodeType::tnTRANSACTION_NM, t.tx_);
|
||||
}
|
||||
|
||||
/** Remove a transaction from the set.
|
||||
@@ -145,7 +144,7 @@ public:
|
||||
code uses the shared_ptr semantics to know whether the find
|
||||
was successful and properly creates a Tx as needed.
|
||||
*/
|
||||
std::shared_ptr<const SHAMapItem> const&
|
||||
boost::intrusive_ptr<SHAMapItem const> const&
|
||||
find(Tx::ID const& entry) const
|
||||
{
|
||||
return map_->peekItem(entry);
|
||||
|
||||
@@ -39,7 +39,7 @@ BookListeners::removeSubscriber(std::uint64_t seq)
|
||||
|
||||
void
|
||||
BookListeners::publish(
|
||||
Json::Value const& jvObj,
|
||||
MultiApiJson const& jvObj,
|
||||
hash_set<std::uint64_t>& havePublished)
|
||||
{
|
||||
std::lock_guard sl(mLock);
|
||||
@@ -54,7 +54,8 @@ BookListeners::publish(
|
||||
// Only publish jvObj if this is the first occurence
|
||||
if (havePublished.emplace(p->getSeq()).second)
|
||||
{
|
||||
p->send(jvObj, true);
|
||||
p->send(
|
||||
jvObj.select(apiVersionSelector(p->getApiVersion())), true);
|
||||
}
|
||||
++it;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,9 @@
|
||||
#ifndef RIPPLE_APP_LEDGER_BOOKLISTENERS_H_INCLUDED
|
||||
#define RIPPLE_APP_LEDGER_BOOKLISTENERS_H_INCLUDED
|
||||
|
||||
#include <ripple/json/MultivarJson.h>
|
||||
#include <ripple/net/InfoSub.h>
|
||||
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
||||
@@ -58,7 +60,7 @@ public:
|
||||
|
||||
*/
|
||||
void
|
||||
publish(Json::Value const& jvObj, hash_set<std::uint64_t>& havePublished);
|
||||
publish(MultiApiJson const& jvObj, hash_set<std::uint64_t>& havePublished);
|
||||
|
||||
private:
|
||||
std::recursive_mutex mLock;
|
||||
|
||||
@@ -66,9 +66,11 @@ ConsensusTransSetSF::gotNode(
|
||||
pap->getOPs().submitTransaction(stx);
|
||||
});
|
||||
}
|
||||
catch (std::exception const&)
|
||||
catch (std::exception const& ex)
|
||||
{
|
||||
JLOG(j_.warn()) << "Fetched invalid transaction in proposed set";
|
||||
JLOG(j_.warn())
|
||||
<< "Fetched invalid transaction in proposed set. Exception: "
|
||||
<< ex.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,14 +197,6 @@ private:
|
||||
std::unique_ptr<PeerSet> mPeerSet;
|
||||
};
|
||||
|
||||
/** Deserialize a ledger header from a byte array. */
|
||||
LedgerInfo
|
||||
deserializeHeader(Slice data, bool hasHash = false);
|
||||
|
||||
/** Deserialize a ledger header (prefixed with 4 bytes) from a byte array. */
|
||||
LedgerInfo
|
||||
deserializePrefixedHeader(Slice data, bool hasHash = false);
|
||||
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -119,9 +119,8 @@ public:
|
||||
sles_type::value_type
|
||||
dereference() const override
|
||||
{
|
||||
auto const item = *iter_;
|
||||
SerialIter sit(item.slice());
|
||||
return std::make_shared<SLE const>(sit, item.key());
|
||||
SerialIter sit(iter_->slice());
|
||||
return std::make_shared<SLE const>(sit, iter_->key());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -168,7 +167,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};
|
||||
@@ -183,9 +182,10 @@ Ledger::Ledger(
|
||||
std::vector<uint256> const& amendments,
|
||||
Family& family)
|
||||
: mImmutable(false)
|
||||
, txMap_(std::make_shared<SHAMap>(SHAMapType::TRANSACTION, family))
|
||||
, stateMap_(std::make_shared<SHAMap>(SHAMapType::STATE, family))
|
||||
, txMap_(SHAMapType::TRANSACTION, family)
|
||||
, stateMap_(SHAMapType::STATE, family)
|
||||
, rules_{config.features}
|
||||
, j_(beast::Journal(beast::Journal::getNullSink()))
|
||||
{
|
||||
info_.seq = 1;
|
||||
info_.drops = INITIAL_XRP;
|
||||
@@ -209,8 +209,34 @@ Ledger::Ledger(
|
||||
rawInsert(sle);
|
||||
}
|
||||
|
||||
stateMap_->flushDirty(hotACCOUNT_NODE);
|
||||
setImmutable(config);
|
||||
{
|
||||
auto sle = std::make_shared<SLE>(keylet::fees());
|
||||
// Whether featureXRPFees is supported will depend on startup options.
|
||||
if (std::find(amendments.begin(), amendments.end(), featureXRPFees) !=
|
||||
amendments.end())
|
||||
{
|
||||
sle->at(sfBaseFeeDrops) = config.FEES.reference_fee;
|
||||
sle->at(sfReserveBaseDrops) = config.FEES.account_reserve;
|
||||
sle->at(sfReserveIncrementDrops) = config.FEES.owner_reserve;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (auto const f =
|
||||
config.FEES.reference_fee.dropsAs<std::uint64_t>())
|
||||
sle->at(sfBaseFee) = *f;
|
||||
if (auto const f =
|
||||
config.FEES.account_reserve.dropsAs<std::uint32_t>())
|
||||
sle->at(sfReserveBase) = *f;
|
||||
if (auto const f =
|
||||
config.FEES.owner_reserve.dropsAs<std::uint32_t>())
|
||||
sle->at(sfReserveIncrement) = *f;
|
||||
sle->at(sfReferenceFeeUnits) = Config::FEE_UNITS_DEPRECATED;
|
||||
}
|
||||
rawInsert(sle);
|
||||
}
|
||||
|
||||
stateMap_.flushDirty(hotACCOUNT_NODE);
|
||||
setImmutable();
|
||||
}
|
||||
|
||||
Ledger::Ledger(
|
||||
@@ -221,19 +247,16 @@ Ledger::Ledger(
|
||||
Family& family,
|
||||
beast::Journal j)
|
||||
: mImmutable(true)
|
||||
, txMap_(std::make_shared<SHAMap>(
|
||||
SHAMapType::TRANSACTION,
|
||||
info.txHash,
|
||||
family))
|
||||
, stateMap_(
|
||||
std::make_shared<SHAMap>(SHAMapType::STATE, info.accountHash, family))
|
||||
, txMap_(SHAMapType::TRANSACTION, info.txHash, family)
|
||||
, stateMap_(SHAMapType::STATE, info.accountHash, family)
|
||||
, rules_(config.features)
|
||||
, info_(info)
|
||||
, j_(j)
|
||||
{
|
||||
loaded = true;
|
||||
|
||||
if (info_.txHash.isNonZero() &&
|
||||
!txMap_->fetchRoot(SHAMapHash{info_.txHash}, nullptr))
|
||||
!txMap_.fetchRoot(SHAMapHash{info_.txHash}, nullptr))
|
||||
{
|
||||
if (config.reporting())
|
||||
{
|
||||
@@ -245,7 +268,7 @@ Ledger::Ledger(
|
||||
}
|
||||
|
||||
if (info_.accountHash.isNonZero() &&
|
||||
!stateMap_->fetchRoot(SHAMapHash{info_.accountHash}, nullptr))
|
||||
!stateMap_.fetchRoot(SHAMapHash{info_.accountHash}, nullptr))
|
||||
{
|
||||
if (config.reporting())
|
||||
{
|
||||
@@ -256,10 +279,11 @@ Ledger::Ledger(
|
||||
JLOG(j.warn()) << "Don't have state data root for ledger" << info_.seq;
|
||||
}
|
||||
|
||||
txMap_->setImmutable();
|
||||
stateMap_->setImmutable();
|
||||
txMap_.setImmutable();
|
||||
stateMap_.setImmutable();
|
||||
|
||||
if (!setup(config))
|
||||
defaultFees(config);
|
||||
if (!setup())
|
||||
loaded = false;
|
||||
|
||||
if (!loaded)
|
||||
@@ -273,12 +297,11 @@ Ledger::Ledger(
|
||||
// Create a new ledger that follows this one
|
||||
Ledger::Ledger(Ledger const& prevLedger, NetClock::time_point closeTime)
|
||||
: mImmutable(false)
|
||||
, txMap_(std::make_shared<SHAMap>(
|
||||
SHAMapType::TRANSACTION,
|
||||
prevLedger.stateMap_->family()))
|
||||
, stateMap_(prevLedger.stateMap_->snapShot(true))
|
||||
, txMap_(SHAMapType::TRANSACTION, prevLedger.txMap_.family())
|
||||
, stateMap_(prevLedger.stateMap_, true)
|
||||
, fees_(prevLedger.fees_)
|
||||
, rules_(prevLedger.rules_)
|
||||
, j_(beast::Journal(beast::Journal::getNullSink()))
|
||||
{
|
||||
info_.seq = prevLedger.info_.seq + 1;
|
||||
info_.parentCloseTime = prevLedger.info_.closeTime;
|
||||
@@ -304,14 +327,11 @@ Ledger::Ledger(Ledger const& prevLedger, NetClock::time_point closeTime)
|
||||
|
||||
Ledger::Ledger(LedgerInfo const& info, Config const& config, Family& family)
|
||||
: mImmutable(true)
|
||||
, txMap_(std::make_shared<SHAMap>(
|
||||
SHAMapType::TRANSACTION,
|
||||
info.txHash,
|
||||
family))
|
||||
, stateMap_(
|
||||
std::make_shared<SHAMap>(SHAMapType::STATE, info.accountHash, family))
|
||||
, txMap_(SHAMapType::TRANSACTION, info.txHash, family)
|
||||
, stateMap_(SHAMapType::STATE, info.accountHash, family)
|
||||
, rules_{config.features}
|
||||
, info_(info)
|
||||
, j_(beast::Journal(beast::Journal::getNullSink()))
|
||||
{
|
||||
info_.hash = calculateLedgerHash(info_);
|
||||
}
|
||||
@@ -322,42 +342,43 @@ Ledger::Ledger(
|
||||
Config const& config,
|
||||
Family& family)
|
||||
: mImmutable(false)
|
||||
, txMap_(std::make_shared<SHAMap>(SHAMapType::TRANSACTION, family))
|
||||
, stateMap_(std::make_shared<SHAMap>(SHAMapType::STATE, family))
|
||||
, txMap_(SHAMapType::TRANSACTION, family)
|
||||
, stateMap_(SHAMapType::STATE, family)
|
||||
, rules_{config.features}
|
||||
, j_(beast::Journal(beast::Journal::getNullSink()))
|
||||
{
|
||||
info_.seq = ledgerSeq;
|
||||
info_.closeTime = closeTime;
|
||||
info_.closeTimeResolution = ledgerDefaultTimeResolution;
|
||||
setup(config);
|
||||
defaultFees(config);
|
||||
setup();
|
||||
}
|
||||
|
||||
void
|
||||
Ledger::setImmutable(Config const& config, bool rehash)
|
||||
Ledger::setImmutable(bool rehash)
|
||||
{
|
||||
// Force update, since this is the only
|
||||
// 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();
|
||||
setup(config);
|
||||
txMap_.setImmutable();
|
||||
stateMap_.setImmutable();
|
||||
setup();
|
||||
}
|
||||
|
||||
void
|
||||
Ledger::setAccepted(
|
||||
NetClock::time_point closeTime,
|
||||
NetClock::duration closeResolution,
|
||||
bool correctCloseTime,
|
||||
Config const& config)
|
||||
bool correctCloseTime)
|
||||
{
|
||||
// Used when we witnessed the consensus.
|
||||
assert(!open());
|
||||
@@ -365,15 +386,15 @@ Ledger::setAccepted(
|
||||
info_.closeTime = closeTime;
|
||||
info_.closeTimeResolution = closeResolution;
|
||||
info_.closeFlags = correctCloseTime ? 0 : sLCF_NoConsensusTime;
|
||||
setImmutable(config);
|
||||
setImmutable();
|
||||
}
|
||||
|
||||
bool
|
||||
Ledger::addSLE(SLE const& sle)
|
||||
{
|
||||
auto const s = sle.getSerializer();
|
||||
SHAMapItem item(sle.key(), s.slice());
|
||||
return stateMap_->addItem(SHAMapNodeType::tnACCOUNT_STATE, std::move(item));
|
||||
return stateMap_.addItem(
|
||||
SHAMapNodeType::tnACCOUNT_STATE, make_shamapitem(sle.key(), s.slice()));
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -408,20 +429,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;
|
||||
@@ -436,7 +457,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());
|
||||
@@ -450,45 +471,44 @@ 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
|
||||
{
|
||||
assert(txMap_);
|
||||
auto const& item = txMap_->peekItem(key);
|
||||
auto const& item = txMap_.peekItem(key);
|
||||
if (!item)
|
||||
return {};
|
||||
if (!open())
|
||||
@@ -505,7 +525,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();
|
||||
}
|
||||
@@ -515,14 +535,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");
|
||||
}
|
||||
|
||||
@@ -531,9 +551,9 @@ Ledger::rawInsert(std::shared_ptr<SLE> const& sle)
|
||||
{
|
||||
Serializer ss;
|
||||
sle->add(ss);
|
||||
if (!stateMap_->addGiveItem(
|
||||
if (!stateMap_.addGiveItem(
|
||||
SHAMapNodeType::tnACCOUNT_STATE,
|
||||
std::make_shared<SHAMapItem const>(sle->key(), ss.slice())))
|
||||
make_shamapitem(sle->key(), ss.slice())))
|
||||
LogicError("Ledger::rawInsert: key already exists");
|
||||
}
|
||||
|
||||
@@ -542,9 +562,9 @@ Ledger::rawReplace(std::shared_ptr<SLE> const& sle)
|
||||
{
|
||||
Serializer ss;
|
||||
sle->add(ss);
|
||||
if (!stateMap_->updateGiveItem(
|
||||
if (!stateMap_.updateGiveItem(
|
||||
SHAMapNodeType::tnACCOUNT_STATE,
|
||||
std::make_shared<SHAMapItem const>(sle->key(), ss.slice())))
|
||||
make_shamapitem(sle->key(), ss.slice())))
|
||||
LogicError("Ledger::rawReplace: key not found");
|
||||
}
|
||||
|
||||
@@ -560,9 +580,8 @@ Ledger::rawTxInsert(
|
||||
Serializer s(txn->getDataLength() + metaData->getDataLength() + 16);
|
||||
s.addVL(txn->peekData());
|
||||
s.addVL(metaData->peekData());
|
||||
if (!txMap().addGiveItem(
|
||||
SHAMapNodeType::tnTRANSACTION_MD,
|
||||
std::make_shared<SHAMapItem const>(key, s.slice())))
|
||||
if (!txMap_.addGiveItem(
|
||||
SHAMapNodeType::tnTRANSACTION_MD, make_shamapitem(key, s.slice())))
|
||||
LogicError("duplicate_tx: " + to_string(key));
|
||||
}
|
||||
|
||||
@@ -578,36 +597,33 @@ Ledger::rawTxInsertWithHash(
|
||||
Serializer s(txn->getDataLength() + metaData->getDataLength() + 16);
|
||||
s.addVL(txn->peekData());
|
||||
s.addVL(metaData->peekData());
|
||||
auto item = std::make_shared<SHAMapItem const>(key, s.slice());
|
||||
auto item = make_shamapitem(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;
|
||||
}
|
||||
|
||||
bool
|
||||
Ledger::setup(Config const& config)
|
||||
Ledger::setup()
|
||||
{
|
||||
bool ret = true;
|
||||
|
||||
try
|
||||
{
|
||||
rules_ = makeRulesGivenLedger(*this, config.features);
|
||||
rules_ = makeRulesGivenLedger(*this, rules_);
|
||||
}
|
||||
catch (SHAMapMissingNode const&)
|
||||
{
|
||||
ret = false;
|
||||
}
|
||||
catch (std::exception const&)
|
||||
catch (std::exception const& ex)
|
||||
{
|
||||
JLOG(j_.error()) << "Exception in " << __func__ << ": " << ex.what();
|
||||
Rethrow();
|
||||
}
|
||||
|
||||
fees_.base = config.FEE_DEFAULT;
|
||||
fees_.reserve = config.FEE_ACCOUNT_RESERVE;
|
||||
fees_.increment = config.FEE_OWNER_RESERVE;
|
||||
|
||||
try
|
||||
{
|
||||
if (auto const sle = read(keylet::fees()))
|
||||
@@ -659,18 +675,31 @@ Ledger::setup(Config const& config)
|
||||
{
|
||||
ret = false;
|
||||
}
|
||||
catch (std::exception const&)
|
||||
catch (std::exception const& ex)
|
||||
{
|
||||
JLOG(j_.error()) << "Exception in " << __func__ << ": " << ex.what();
|
||||
Rethrow();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
Ledger::defaultFees(Config const& config)
|
||||
{
|
||||
assert(fees_.base == 0 && fees_.reserve == 0 && fees_.increment == 0);
|
||||
if (fees_.base == 0)
|
||||
fees_.base = config.FEES.reference_fee;
|
||||
if (fees_.reserve == 0)
|
||||
fees_.reserve = config.FEES.account_reserve;
|
||||
if (fees_.increment == 0)
|
||||
fees_.increment = config.FEES.owner_reserve;
|
||||
}
|
||||
|
||||
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());
|
||||
@@ -792,8 +821,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});
|
||||
@@ -801,9 +830,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())
|
||||
@@ -815,15 +844,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())
|
||||
@@ -840,9 +869,9 @@ Ledger::walkLedger(beast::Journal j, bool parallel) const
|
||||
bool
|
||||
Ledger::assertSensible(beast::Journal ledgerJ) const
|
||||
{
|
||||
if (info_.hash.isNonZero() && info_.accountHash.isNonZero() && stateMap_ &&
|
||||
txMap_ && (info_.accountHash == stateMap_->getHash().as_uint256()) &&
|
||||
(info_.txHash == txMap_->getHash().as_uint256()))
|
||||
if (info_.hash.isNonZero() && info_.accountHash.isNonZero() &&
|
||||
(info_.accountHash == stateMap_.getHash().as_uint256()) &&
|
||||
(info_.txHash == txMap_.getHash().as_uint256()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -1004,15 +1033,14 @@ 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(jobType, jobName, [&app, ledger, isCurrent]() {
|
||||
saveValidatedLedger(app, ledger, isCurrent);
|
||||
}))
|
||||
app.getJobQueue().addJob(
|
||||
isCurrent ? jtPUBLEDGER : jtPUBOLDLEDGER,
|
||||
std::to_string(ledger->seq()),
|
||||
[&app, ledger, isCurrent]() {
|
||||
saveValidatedLedger(app, ledger, isCurrent);
|
||||
}))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -1024,15 +1052,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();
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -1071,7 +1099,10 @@ finishLoadByIndexOrHash(
|
||||
if (!ledger)
|
||||
return;
|
||||
|
||||
ledger->setImmutable(config);
|
||||
assert(
|
||||
ledger->info().seq < XRP_LEDGER_EARLIEST_FEES ||
|
||||
ledger->read(keylet::fees()));
|
||||
ledger->setImmutable();
|
||||
|
||||
JLOG(j.trace()) << "Loaded ledger: " << to_string(ledger->info().hash);
|
||||
|
||||
|
||||
@@ -83,6 +83,10 @@ 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
|
||||
@@ -266,11 +270,10 @@ public:
|
||||
setAccepted(
|
||||
NetClock::time_point closeTime,
|
||||
NetClock::duration closeResolution,
|
||||
bool correctCloseTime,
|
||||
Config const& config);
|
||||
bool correctCloseTime);
|
||||
|
||||
void
|
||||
setImmutable(Config const& config, bool rehash = true);
|
||||
setImmutable(bool rehash = true);
|
||||
|
||||
bool
|
||||
isImmutable() const
|
||||
@@ -291,10 +294,10 @@ public:
|
||||
void
|
||||
setFull() const
|
||||
{
|
||||
txMap_->setFull();
|
||||
stateMap_->setFull();
|
||||
txMap_->setLedgerSeq(info_.seq);
|
||||
stateMap_->setLedgerSeq(info_.seq);
|
||||
txMap_.setFull();
|
||||
txMap_.setLedgerSeq(info_.seq);
|
||||
stateMap_.setFull();
|
||||
stateMap_.setLedgerSeq(info_.seq);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -306,25 +309,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
|
||||
@@ -395,12 +398,18 @@ private:
|
||||
class txs_iter_impl;
|
||||
|
||||
bool
|
||||
setup(Config const& config);
|
||||
setup();
|
||||
|
||||
void
|
||||
defaultFees(Config const& config);
|
||||
|
||||
bool mImmutable;
|
||||
|
||||
std::shared_ptr<SHAMap> txMap_;
|
||||
std::shared_ptr<SHAMap> stateMap_;
|
||||
// A SHAMap containing the transactions associated with this ledger.
|
||||
SHAMap mutable txMap_;
|
||||
|
||||
// A SHAMap containing the state objects for this ledger.
|
||||
SHAMap mutable stateMap_;
|
||||
|
||||
// Protects fee variables
|
||||
std::mutex mutable mutex_;
|
||||
@@ -408,6 +417,7 @@ private:
|
||||
Fees fees_;
|
||||
Rules rules_;
|
||||
LedgerInfo info_;
|
||||
beast::Journal j_;
|
||||
};
|
||||
|
||||
/** A ledger wrapped in a CachedView. */
|
||||
|
||||
@@ -51,7 +51,9 @@ LedgerHistory::LedgerHistory(
|
||||
}
|
||||
|
||||
bool
|
||||
LedgerHistory::insert(std::shared_ptr<Ledger const> ledger, bool validated)
|
||||
LedgerHistory::insert(
|
||||
std::shared_ptr<Ledger const> const& ledger,
|
||||
bool validated)
|
||||
{
|
||||
if (!ledger->isImmutable())
|
||||
LogicError("mutable Ledger in insert");
|
||||
@@ -72,12 +74,9 @@ LedgerHash
|
||||
LedgerHistory::getLedgerHash(LedgerIndex index)
|
||||
{
|
||||
std::unique_lock sl(m_ledgers_by_hash.peekMutex());
|
||||
auto it = mLedgersByIndex.find(index);
|
||||
|
||||
if (it != mLedgersByIndex.end())
|
||||
if (auto it = mLedgersByIndex.find(index); it != mLedgersByIndex.end())
|
||||
return it->second;
|
||||
|
||||
return uint256();
|
||||
return {};
|
||||
}
|
||||
|
||||
std::shared_ptr<Ledger const>
|
||||
@@ -167,19 +166,19 @@ log_metadata_difference(
|
||||
uint256 const& tx,
|
||||
beast::Journal j)
|
||||
{
|
||||
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 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 validMetaData = getMeta(validLedger, tx);
|
||||
auto builtMetaData = getMeta(builtLedger, tx);
|
||||
assert(validMetaData != nullptr || builtMetaData != nullptr);
|
||||
|
||||
if (validMetaData != nullptr && builtMetaData != nullptr)
|
||||
assert(validMetaData || builtMetaData);
|
||||
|
||||
if (validMetaData && builtMetaData)
|
||||
{
|
||||
auto const& validNodes = validMetaData->getNodes();
|
||||
auto const& builtNodes = builtMetaData->getNodes();
|
||||
@@ -280,17 +279,21 @@ log_metadata_difference(
|
||||
<< validNodes.getJson(JsonOptions::none);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
else if (validMetaData != nullptr)
|
||||
|
||||
if (validMetaData)
|
||||
{
|
||||
JLOG(j.error()) << "MISMATCH on TX " << tx
|
||||
<< ": Metadata Difference (built has none)\n"
|
||||
<< ": Metadata Difference. Valid=\n"
|
||||
<< validMetaData->getJson(JsonOptions::none);
|
||||
}
|
||||
else // builtMetaData != nullptr
|
||||
|
||||
if (builtMetaData)
|
||||
{
|
||||
JLOG(j.error()) << "MISMATCH on TX " << tx
|
||||
<< ": Metadata Difference (valid has none)\n"
|
||||
<< ": Metadata Difference. Built=\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> ledger, bool validated);
|
||||
insert(std::shared_ptr<Ledger const> const& ledger, bool validated);
|
||||
|
||||
/** Get the ledgers_by_hash cache hit rate
|
||||
@return the hit rate
|
||||
@@ -95,7 +95,7 @@ public:
|
||||
/** Repair a hash to index mapping
|
||||
@param ledgerIndex The index whose mapping is to be repaired
|
||||
@param ledgerHash The hash it is to be mapped to
|
||||
@return `true` if the mapping was repaired
|
||||
@return `false` if the mapping was repaired
|
||||
*/
|
||||
bool
|
||||
fixIndex(LedgerIndex ledgerIndex, LedgerHash const& ledgerHash);
|
||||
|
||||
@@ -215,6 +215,8 @@ public:
|
||||
void
|
||||
clearLedger(std::uint32_t seq);
|
||||
bool
|
||||
isValidated(ReadView const& ledger);
|
||||
bool
|
||||
getValidatedRange(std::uint32_t& minVal, std::uint32_t& maxVal);
|
||||
bool
|
||||
getFullValidatedRange(std::uint32_t& minVal, std::uint32_t& maxVal);
|
||||
@@ -292,6 +294,10 @@ public:
|
||||
std::optional<LedgerIndex>
|
||||
minSqlSeq();
|
||||
|
||||
// Iff a txn exists at the specified ledger and offset then return its txnid
|
||||
std::optional<uint256>
|
||||
txnIdFromIndex(uint32_t ledgerSeq, uint32_t txnIndex);
|
||||
|
||||
private:
|
||||
void
|
||||
setValidLedger(std::shared_ptr<Ledger const> const& l);
|
||||
|
||||
@@ -105,7 +105,7 @@ public:
|
||||
void
|
||||
gotSkipList(
|
||||
LedgerInfo const& info,
|
||||
std::shared_ptr<SHAMapItem const> const& data);
|
||||
boost::intrusive_ptr<SHAMapItem const> const& data);
|
||||
|
||||
/**
|
||||
* Process a ledger delta (extracted from a TMReplayDeltaResponse message)
|
||||
|
||||
@@ -21,11 +21,14 @@
|
||||
#define RIPPLE_APP_LEDGER_LEDGERTOJSON_H_INCLUDED
|
||||
|
||||
#include <ripple/app/ledger/Ledger.h>
|
||||
#include <ripple/app/ledger/LedgerMaster.h>
|
||||
#include <ripple/app/misc/TxQ.h>
|
||||
#include <ripple/basics/StringUtilities.h>
|
||||
#include <ripple/basics/chrono.h>
|
||||
#include <ripple/json/Object.h>
|
||||
#include <ripple/protocol/STTx.h>
|
||||
#include <ripple/protocol/jss.h>
|
||||
#include <ripple/protocol/serialize.h>
|
||||
#include <ripple/rpc/Context.h>
|
||||
|
||||
namespace ripple {
|
||||
@@ -40,6 +43,8 @@ struct LedgerFill
|
||||
LedgerEntryType t = ltANY)
|
||||
: ledger(l), options(o), txQueue(std::move(q)), type(t), context(ctx)
|
||||
{
|
||||
if (context)
|
||||
closeTime = context->ledgerMaster.getCloseTimeBySeq(ledger.seq());
|
||||
}
|
||||
|
||||
enum Options {
|
||||
@@ -57,6 +62,7 @@ struct LedgerFill
|
||||
std::vector<TxQ::TxDetails> txQueue;
|
||||
LedgerEntryType type;
|
||||
RPC::Context* context;
|
||||
std::optional<NetClock::time_point> closeTime;
|
||||
};
|
||||
|
||||
/** Given a Ledger and options, fill a Json::Object or Json::Value with a
|
||||
@@ -70,22 +76,6 @@ addJson(Json::Value&, LedgerFill const&);
|
||||
Json::Value
|
||||
getJson(LedgerFill const&);
|
||||
|
||||
/** Serialize an object to a blob. */
|
||||
template <class Object>
|
||||
Blob
|
||||
serializeBlob(Object const& o)
|
||||
{
|
||||
Serializer s;
|
||||
o.add(s);
|
||||
return s.peekData();
|
||||
}
|
||||
|
||||
/** Serialize an object to a hex string. */
|
||||
inline std::string
|
||||
serializeHex(STObject const& o)
|
||||
{
|
||||
return strHex(serializeBlob(o));
|
||||
}
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <ripple/app/ledger/LedgerMaster.h>
|
||||
#include <ripple/app/ledger/OrderBookDB.h>
|
||||
#include <ripple/app/main/Application.h>
|
||||
#include <ripple/app/misc/AMMUtils.h>
|
||||
#include <ripple/app/misc/NetworkOPs.h>
|
||||
#include <ripple/basics/Log.h>
|
||||
#include <ripple/core/Config.h>
|
||||
@@ -93,7 +94,7 @@ OrderBookDB::update(std::shared_ptr<ReadView const> const& ledger)
|
||||
|
||||
JLOG(j_.debug()) << "Beginning update (" << ledger->seq() << ")";
|
||||
|
||||
// walk through the entire ledger looking for orderbook entries
|
||||
// walk through the entire ledger looking for orderbook/AMM entries
|
||||
int cnt = 0;
|
||||
|
||||
try
|
||||
@@ -126,6 +127,21 @@ OrderBookDB::update(std::shared_ptr<ReadView const> const& ledger)
|
||||
|
||||
++cnt;
|
||||
}
|
||||
else if (sle->getType() == ltAMM)
|
||||
{
|
||||
auto const issue1 = (*sle)[sfAsset];
|
||||
auto const issue2 = (*sle)[sfAsset2];
|
||||
auto addBook = [&](Issue const& in, Issue const& out) {
|
||||
allBooks[in].insert(out);
|
||||
|
||||
if (isXRP(out))
|
||||
xrpBooks.insert(in);
|
||||
|
||||
++cnt;
|
||||
};
|
||||
addBook(issue1, issue2);
|
||||
addBook(issue2, issue1);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (SHAMapMissingNode const& mn)
|
||||
@@ -234,7 +250,7 @@ void
|
||||
OrderBookDB::processTxn(
|
||||
std::shared_ptr<ReadView const> const& ledger,
|
||||
const AcceptedLedgerTx& alTx,
|
||||
Json::Value const& jvObj)
|
||||
MultiApiJson const& jvObj)
|
||||
{
|
||||
std::lock_guard sl(mLock);
|
||||
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
#include <ripple/app/ledger/AcceptedLedgerTx.h>
|
||||
#include <ripple/app/ledger/BookListeners.h>
|
||||
#include <ripple/app/main/Application.h>
|
||||
#include <ripple/json/MultivarJson.h>
|
||||
|
||||
#include <mutex>
|
||||
|
||||
namespace ripple {
|
||||
@@ -63,7 +65,7 @@ public:
|
||||
processTxn(
|
||||
std::shared_ptr<ReadView const> const& ledger,
|
||||
const AcceptedLedgerTx& alTx,
|
||||
Json::Value const& jvObj);
|
||||
MultiApiJson const& jvObj);
|
||||
|
||||
private:
|
||||
Application& app_;
|
||||
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
|
||||
std::shared_ptr<STTx const>
|
||||
fetch(
|
||||
std::shared_ptr<SHAMapItem> const& item,
|
||||
boost::intrusive_ptr<SHAMapItem> const& item,
|
||||
SHAMapNodeType type,
|
||||
std::uint32_t uCommitLedger);
|
||||
|
||||
|
||||
@@ -75,8 +75,10 @@ buildLedgerImpl(
|
||||
built->unshare();
|
||||
|
||||
// Accept ledger
|
||||
built->setAccepted(
|
||||
closeTime, closeResolution, closeTimeCorrect, app.config());
|
||||
assert(
|
||||
built->info().seq < XRP_LEDGER_EARLIEST_FEES ||
|
||||
built->read(keylet::fees()));
|
||||
built->setAccepted(closeTime, closeResolution, closeTimeCorrect);
|
||||
|
||||
return built;
|
||||
}
|
||||
@@ -141,9 +143,10 @@ applyTransactions(
|
||||
++it;
|
||||
}
|
||||
}
|
||||
catch (std::exception const&)
|
||||
catch (std::exception const& ex)
|
||||
{
|
||||
JLOG(j.warn()) << "Transaction " << txid << " throws";
|
||||
JLOG(j.warn())
|
||||
<< "Transaction " << txid << " throws: " << ex.what();
|
||||
failed.insert(txid);
|
||||
it = txns.erase(it);
|
||||
}
|
||||
|
||||
@@ -155,7 +155,10 @@ InboundLedger::init(ScopedLockType& collectionLock)
|
||||
|
||||
JLOG(journal_.debug()) << "Acquiring ledger we already have in "
|
||||
<< " local store. " << hash_;
|
||||
mLedger->setImmutable(app_.config());
|
||||
assert(
|
||||
mLedger->info().seq < XRP_LEDGER_EARLIEST_FEES ||
|
||||
mLedger->read(keylet::fees()));
|
||||
mLedger->setImmutable();
|
||||
|
||||
if (mReason == Reason::HISTORY || mReason == Reason::SHARD)
|
||||
return;
|
||||
@@ -268,36 +271,6 @@ InboundLedger::neededStateHashes(int max, SHAMapSyncFilter* filter) const
|
||||
mLedger->info().accountHash, mLedger->stateMap(), max, filter);
|
||||
}
|
||||
|
||||
LedgerInfo
|
||||
deserializeHeader(Slice data, bool hasHash)
|
||||
{
|
||||
SerialIter sit(data.data(), data.size());
|
||||
|
||||
LedgerInfo info;
|
||||
|
||||
info.seq = sit.get32();
|
||||
info.drops = sit.get64();
|
||||
info.parentHash = sit.get256();
|
||||
info.txHash = sit.get256();
|
||||
info.accountHash = sit.get256();
|
||||
info.parentCloseTime =
|
||||
NetClock::time_point{NetClock::duration{sit.get32()}};
|
||||
info.closeTime = NetClock::time_point{NetClock::duration{sit.get32()}};
|
||||
info.closeTimeResolution = NetClock::duration{sit.get8()};
|
||||
info.closeFlags = sit.get8();
|
||||
|
||||
if (hasHash)
|
||||
info.hash = sit.get256();
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
LedgerInfo
|
||||
deserializePrefixedHeader(Slice data, bool hasHash)
|
||||
{
|
||||
return deserializeHeader(data + 4, hasHash);
|
||||
}
|
||||
|
||||
// See how much of the ledger data is stored locally
|
||||
// Data found in a fetch pack will be stored
|
||||
void
|
||||
@@ -416,7 +389,10 @@ InboundLedger::tryDB(NodeStore::Database& srcDB)
|
||||
{
|
||||
JLOG(journal_.debug()) << "Had everything locally";
|
||||
complete_ = true;
|
||||
mLedger->setImmutable(app_.config());
|
||||
assert(
|
||||
mLedger->info().seq < XRP_LEDGER_EARLIEST_FEES ||
|
||||
mLedger->read(keylet::fees()));
|
||||
mLedger->setImmutable();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -513,7 +489,10 @@ InboundLedger::done()
|
||||
|
||||
if (complete_ && !failed_ && mLedger)
|
||||
{
|
||||
mLedger->setImmutable(app_.config());
|
||||
assert(
|
||||
mLedger->info().seq < XRP_LEDGER_EARLIEST_FEES ||
|
||||
mLedger->read(keylet::fees()));
|
||||
mLedger->setImmutable();
|
||||
switch (mReason)
|
||||
{
|
||||
case Reason::SHARD:
|
||||
@@ -559,10 +538,9 @@ InboundLedger::trigger(std::shared_ptr<Peer> const& peer, TriggerReason reason)
|
||||
|
||||
if (auto stream = journal_.trace())
|
||||
{
|
||||
stream << "Trigger acquiring ledger " << hash_;
|
||||
if (peer)
|
||||
stream << "Trigger acquiring ledger " << hash_ << " from " << peer;
|
||||
else
|
||||
stream << "Trigger acquiring ledger " << hash_;
|
||||
stream << " from " << peer;
|
||||
|
||||
if (complete_ || failed_)
|
||||
stream << "complete=" << complete_ << " failed=" << failed_;
|
||||
|
||||
@@ -598,6 +598,54 @@ LedgerMaster::clearLedger(std::uint32_t seq)
|
||||
mCompleteLedgers.erase(seq);
|
||||
}
|
||||
|
||||
bool
|
||||
LedgerMaster::isValidated(ReadView const& ledger)
|
||||
{
|
||||
if (app_.config().reporting())
|
||||
return true; // Reporting mode only supports validated ledger
|
||||
|
||||
if (ledger.open())
|
||||
return false;
|
||||
|
||||
if (ledger.info().validated)
|
||||
return true;
|
||||
|
||||
auto const seq = ledger.info().seq;
|
||||
try
|
||||
{
|
||||
// Use the skip list in the last validated ledger to see if ledger
|
||||
// comes before the last validated ledger (and thus has been
|
||||
// validated).
|
||||
auto const hash = walkHashBySeq(seq, InboundLedger::Reason::GENERIC);
|
||||
|
||||
if (!hash || ledger.info().hash != *hash)
|
||||
{
|
||||
// This ledger's hash is not the hash of the validated ledger
|
||||
if (hash)
|
||||
{
|
||||
assert(hash->isNonZero());
|
||||
uint256 valHash =
|
||||
app_.getRelationalDatabase().getHashByIndex(seq);
|
||||
if (valHash == ledger.info().hash)
|
||||
{
|
||||
// SQL database doesn't match ledger chain
|
||||
clearLedger(seq);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (SHAMapMissingNode const& mn)
|
||||
{
|
||||
JLOG(m_journal.warn()) << "Ledger #" << seq << ": " << mn.what();
|
||||
return false;
|
||||
}
|
||||
|
||||
// Mark ledger as validated to save time if we see it again.
|
||||
ledger.info().validated = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
// returns Ledgers we have all the nodes for
|
||||
bool
|
||||
LedgerMaster::getFullValidatedRange(
|
||||
@@ -866,10 +914,11 @@ LedgerMaster::fixMismatch(ReadView const& ledger)
|
||||
{
|
||||
hash = hashOfSeq(ledger, lSeq, m_journal);
|
||||
}
|
||||
catch (std::exception const&)
|
||||
catch (std::exception const& ex)
|
||||
{
|
||||
JLOG(m_journal.warn())
|
||||
<< "fixMismatch encounters partial ledger";
|
||||
<< "fixMismatch encounters partial ledger. Exception: "
|
||||
<< ex.what();
|
||||
clearLedger(lSeq);
|
||||
return;
|
||||
}
|
||||
@@ -1407,10 +1456,11 @@ LedgerMaster::findNewLedgersToPublish(
|
||||
JLOG(m_journal.trace())
|
||||
<< "ready to publish " << ret.size() << " ledgers.";
|
||||
}
|
||||
catch (std::exception const&)
|
||||
catch (std::exception const& ex)
|
||||
{
|
||||
JLOG(m_journal.error())
|
||||
<< "Exception while trying to find ledgers to publish.";
|
||||
<< "Exception while trying to find ledgers to publish: "
|
||||
<< ex.what();
|
||||
}
|
||||
|
||||
if (app_.config().LEDGER_REPLAY)
|
||||
@@ -2009,9 +2059,10 @@ LedgerMaster::fetchForHistory(
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (std::exception const&)
|
||||
catch (std::exception const& ex)
|
||||
{
|
||||
JLOG(m_journal.warn()) << "Threw while prefetching";
|
||||
JLOG(m_journal.warn())
|
||||
<< "Threw while prefetching: " << ex.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2346,9 +2397,10 @@ LedgerMaster::makeFetchPack(
|
||||
|
||||
peer->send(msg);
|
||||
}
|
||||
catch (std::exception const&)
|
||||
catch (std::exception const& ex)
|
||||
{
|
||||
JLOG(m_journal.warn()) << "Exception building fetch pach";
|
||||
JLOG(m_journal.warn())
|
||||
<< "Exception building fetch pach. Exception: " << ex.what();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2365,4 +2417,25 @@ LedgerMaster::minSqlSeq()
|
||||
return app_.getRelationalDatabase().getMinLedgerSeq();
|
||||
}
|
||||
|
||||
std::optional<uint256>
|
||||
LedgerMaster::txnIdFromIndex(uint32_t ledgerSeq, uint32_t txnIndex)
|
||||
{
|
||||
uint32_t first = 0, last = 0;
|
||||
|
||||
if (!getValidatedRange(first, last) || last < ledgerSeq)
|
||||
return {};
|
||||
|
||||
auto const lgr = getLedgerBySeq(ledgerSeq);
|
||||
if (!lgr || lgr->txs.empty())
|
||||
return {};
|
||||
|
||||
for (auto it = lgr->txs.begin(); it != lgr->txs.end(); ++it)
|
||||
if (it->first && it->second &&
|
||||
it->second->isFieldPresent(sfTransactionIndex) &&
|
||||
it->second->getFieldU32(sfTransactionIndex) == txnIndex)
|
||||
return it->first->getTransactionID();
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
} // namespace ripple
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <ripple/app/ledger/LedgerReplayer.h>
|
||||
#include <ripple/app/ledger/impl/LedgerReplayMsgHandler.h>
|
||||
#include <ripple/app/main/Application.h>
|
||||
#include <ripple/protocol/LedgerHeader.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
@@ -163,15 +164,15 @@ LedgerReplayMsgHandler::processProofPathResponse(
|
||||
JLOG(journal_.debug()) << "Bad message: Cannot deserialize";
|
||||
return false;
|
||||
}
|
||||
auto item = static_cast<SHAMapLeafNode*>(node.get())->peekItem();
|
||||
if (!item)
|
||||
|
||||
if (auto item = static_cast<SHAMapLeafNode*>(node.get())->peekItem())
|
||||
{
|
||||
JLOG(journal_.debug()) << "Bad message: Cannot get ShaMapItem";
|
||||
return false;
|
||||
replayer_.gotSkipList(info, item);
|
||||
return true;
|
||||
}
|
||||
|
||||
replayer_.gotSkipList(info, item);
|
||||
return true;
|
||||
JLOG(journal_.debug()) << "Bad message: Cannot get ShaMapItem";
|
||||
return false;
|
||||
}
|
||||
|
||||
protocol::TMReplayDeltaResponse
|
||||
@@ -206,9 +207,10 @@ LedgerReplayMsgHandler::processReplayDeltaRequest(
|
||||
reply.set_ledgerheader(nData.getDataPtr(), nData.getLength());
|
||||
// pack transactions
|
||||
auto const& txMap = ledger->txMap();
|
||||
txMap.visitLeaves([&](std::shared_ptr<SHAMapItem const> const& txNode) {
|
||||
reply.add_transaction(txNode->data(), txNode->size());
|
||||
});
|
||||
txMap.visitLeaves(
|
||||
[&](boost::intrusive_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();
|
||||
@@ -264,10 +266,9 @@ LedgerReplayMsgHandler::processReplayDeltaResponse(
|
||||
STObject meta(metaSit, sfMetadata);
|
||||
orderedTxns.emplace(meta[sfTransactionIndex], std::move(tx));
|
||||
|
||||
auto item =
|
||||
std::make_shared<SHAMapItem const>(tid, shaMapItemData.slice());
|
||||
if (!item ||
|
||||
!txMap.addGiveItem(SHAMapNodeType::tnTRANSACTION_MD, item))
|
||||
if (!txMap.addGiveItem(
|
||||
SHAMapNodeType::tnTRANSACTION_MD,
|
||||
make_shamapitem(tid, shaMapItemData.slice())))
|
||||
{
|
||||
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,
|
||||
std::shared_ptr<SHAMapItem const> const& item)
|
||||
boost::intrusive_ptr<SHAMapItem const> const& item)
|
||||
{
|
||||
std::shared_ptr<SkipListAcquire> skipList = {};
|
||||
{
|
||||
|
||||
@@ -17,13 +17,17 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <ripple/app/ledger/LedgerMaster.h>
|
||||
#include <ripple/app/ledger/LedgerToJson.h>
|
||||
#include <ripple/app/main/Application.h>
|
||||
#include <ripple/app/misc/DeliverMax.h>
|
||||
#include <ripple/app/misc/TxQ.h>
|
||||
#include <ripple/basics/base_uint.h>
|
||||
#include <ripple/core/Pg.h>
|
||||
#include <ripple/protocol/jss.h>
|
||||
#include <ripple/rpc/Context.h>
|
||||
#include <ripple/rpc/DeliveredAmount.h>
|
||||
#include <ripple/rpc/impl/RPCHelpers.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
@@ -49,11 +53,17 @@ isBinary(LedgerFill const& fill)
|
||||
|
||||
template <class Object>
|
||||
void
|
||||
fillJson(Object& json, bool closed, LedgerInfo const& info, bool bFull)
|
||||
fillJson(
|
||||
Object& json,
|
||||
bool closed,
|
||||
LedgerInfo const& info,
|
||||
bool bFull,
|
||||
unsigned apiVersion)
|
||||
{
|
||||
json[jss::parent_hash] = to_string(info.parentHash);
|
||||
json[jss::ledger_index] = to_string(info.seq);
|
||||
json[jss::seqNum] = to_string(info.seq); // DEPRECATED
|
||||
json[jss::ledger_index] = (apiVersion > 1)
|
||||
? Json::Value(info.seq)
|
||||
: Json::Value(std::to_string(info.seq));
|
||||
|
||||
if (closed)
|
||||
{
|
||||
@@ -70,10 +80,6 @@ fillJson(Object& json, bool closed, LedgerInfo const& info, bool bFull)
|
||||
json[jss::account_hash] = to_string(info.accountHash);
|
||||
json[jss::total_coins] = to_string(info.drops);
|
||||
|
||||
// These next three are DEPRECATED.
|
||||
json[jss::hash] = to_string(info.hash);
|
||||
json[jss::totalCoins] = to_string(info.drops);
|
||||
json[jss::accepted] = closed;
|
||||
json[jss::close_flags] = info.closeFlags;
|
||||
|
||||
// Always show fields that contribute to the ledger hash
|
||||
@@ -87,6 +93,7 @@ fillJson(Object& json, bool closed, LedgerInfo const& info, bool bFull)
|
||||
json[jss::close_time_human] = to_string(info.closeTime);
|
||||
if (!getCloseAgree(info))
|
||||
json[jss::close_time_estimated] = true;
|
||||
json[jss::close_time_iso] = to_string_iso(info.closeTime);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,23 +129,67 @@ fillJsonTx(
|
||||
if (bBinary)
|
||||
{
|
||||
txJson[jss::tx_blob] = serializeHex(*txn);
|
||||
if (fill.context->apiVersion > 1)
|
||||
txJson[jss::hash] = to_string(txn->getTransactionID());
|
||||
|
||||
auto const json_meta =
|
||||
(fill.context->apiVersion > 1 ? jss::meta_blob : jss::meta);
|
||||
if (stMeta)
|
||||
txJson[jss::meta] = serializeHex(*stMeta);
|
||||
txJson[json_meta] = serializeHex(*stMeta);
|
||||
}
|
||||
else if (fill.context->apiVersion > 1)
|
||||
{
|
||||
copyFrom(
|
||||
txJson[jss::tx_json],
|
||||
txn->getJson(JsonOptions::disable_API_prior_V2, false));
|
||||
txJson[jss::hash] = to_string(txn->getTransactionID());
|
||||
RPC::insertDeliverMax(
|
||||
txJson[jss::tx_json], txnType, fill.context->apiVersion);
|
||||
|
||||
if (stMeta)
|
||||
{
|
||||
txJson[jss::meta] = stMeta->getJson(JsonOptions::none);
|
||||
|
||||
// If applicable, insert delivered amount
|
||||
if (txnType == ttPAYMENT || txnType == ttCHECK_CASH)
|
||||
RPC::insertDeliveredAmount(
|
||||
txJson[jss::meta],
|
||||
fill.ledger,
|
||||
txn,
|
||||
{txn->getTransactionID(), fill.ledger.seq(), *stMeta});
|
||||
}
|
||||
|
||||
if (!fill.ledger.open())
|
||||
txJson[jss::ledger_hash] = to_string(fill.ledger.info().hash);
|
||||
|
||||
const bool validated =
|
||||
fill.context->ledgerMaster.isValidated(fill.ledger);
|
||||
txJson[jss::validated] = validated;
|
||||
if (validated)
|
||||
{
|
||||
auto const seq = fill.ledger.seq();
|
||||
txJson[jss::ledger_index] = (fill.context->apiVersion > 1)
|
||||
? Json::Value(seq)
|
||||
: Json::Value(std::to_string(seq));
|
||||
if (fill.closeTime)
|
||||
txJson[jss::close_time_iso] = to_string_iso(*fill.closeTime);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
copyFrom(txJson, txn->getJson(JsonOptions::none));
|
||||
RPC::insertDeliverMax(txJson, txnType, fill.context->apiVersion);
|
||||
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, *txMeta);
|
||||
}
|
||||
txJson[jss::metaData],
|
||||
fill.ledger,
|
||||
txn,
|
||||
{txn->getTransactionID(), fill.ledger.seq(), *stMeta});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,9 +243,14 @@ fillJsonTx(Object& json, LedgerFill const& fill)
|
||||
appendAll(fill.ledger.txs);
|
||||
}
|
||||
}
|
||||
catch (std::exception const&)
|
||||
catch (std::exception const& ex)
|
||||
{
|
||||
// Nothing the user can do about this.
|
||||
if (fill.context)
|
||||
{
|
||||
JLOG(fill.context->j.error())
|
||||
<< "Exception in " << __func__ << ": " << ex.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -252,7 +308,11 @@ fillJsonQueue(Object& json, LedgerFill const& fill)
|
||||
if (tx.lastResult)
|
||||
txJson["last_result"] = transToken(*tx.lastResult);
|
||||
|
||||
txJson[jss::tx] = fillJsonTx(fill, bBinary, bExpanded, tx.txn, nullptr);
|
||||
auto&& temp = fillJsonTx(fill, bBinary, bExpanded, tx.txn, nullptr);
|
||||
if (fill.context->apiVersion > 1)
|
||||
copyFrom(txJson, temp);
|
||||
else
|
||||
copyFrom(txJson[jss::tx], temp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,7 +326,13 @@ fillJson(Object& json, LedgerFill const& fill)
|
||||
if (isBinary(fill))
|
||||
fillJsonBinary(json, !fill.ledger.open(), fill.ledger.info());
|
||||
else
|
||||
fillJson(json, !fill.ledger.open(), fill.ledger.info(), bFull);
|
||||
fillJson(
|
||||
json,
|
||||
!fill.ledger.open(),
|
||||
fill.ledger.info(),
|
||||
bFull,
|
||||
(fill.context ? fill.context->apiVersion
|
||||
: RPC::apiMaximumSupportedVersion));
|
||||
|
||||
if (bFull || fill.options & LedgerFill::dumpTxrp)
|
||||
fillJsonTx(json, fill);
|
||||
|
||||
@@ -206,9 +206,9 @@ debugTostr(SHAMap const& set)
|
||||
auto const tx = std::make_shared<STTx const>(sit);
|
||||
ss << debugTxstr(tx) << ", ";
|
||||
}
|
||||
catch (std::exception const&)
|
||||
catch (std::exception const& ex)
|
||||
{
|
||||
ss << "THRO, ";
|
||||
ss << "THROW:" << ex.what() << ", ";
|
||||
}
|
||||
}
|
||||
return ss.str();
|
||||
|
||||
@@ -137,7 +137,7 @@ SkipListAcquire::pmDowncast()
|
||||
void
|
||||
SkipListAcquire::processData(
|
||||
std::uint32_t ledgerSeq,
|
||||
std::shared_ptr<SHAMapItem const> const& item)
|
||||
boost::intrusive_ptr<SHAMapItem const> const& item)
|
||||
{
|
||||
assert(ledgerSeq != 0 && item);
|
||||
ScopedLockType sl(mtx_);
|
||||
|
||||
@@ -96,7 +96,7 @@ public:
|
||||
void
|
||||
processData(
|
||||
std::uint32_t ledgerSeq,
|
||||
std::shared_ptr<SHAMapItem const> const& item);
|
||||
boost::intrusive_ptr<SHAMapItem const> const& item);
|
||||
|
||||
/**
|
||||
* Add a callback that will be called when the skipList is ready or failed.
|
||||
|
||||
@@ -107,7 +107,7 @@ TransactionMaster::fetch(
|
||||
|
||||
std::shared_ptr<STTx const>
|
||||
TransactionMaster::fetch(
|
||||
std::shared_ptr<SHAMapItem> const& item,
|
||||
boost::intrusive_ptr<SHAMapItem> const& item,
|
||||
SHAMapNodeType type,
|
||||
std::uint32_t uCommitLedger)
|
||||
{
|
||||
|
||||
@@ -602,6 +602,13 @@ public:
|
||||
return *m_networkOPs;
|
||||
}
|
||||
|
||||
virtual ServerHandler&
|
||||
getServerHandler() override
|
||||
{
|
||||
assert(serverHandler_);
|
||||
return *serverHandler_;
|
||||
}
|
||||
|
||||
boost::asio::io_service&
|
||||
getIOService() override
|
||||
{
|
||||
@@ -1168,9 +1175,6 @@ ApplicationImp::setup(boost::program_options::variables_map const& cmdline)
|
||||
// Optionally turn off logging to console.
|
||||
logs_->silent(config_->silent());
|
||||
|
||||
if (!config_->standalone())
|
||||
timeKeeper_->run(config_->SNTP_SERVERS);
|
||||
|
||||
if (!initRelationalDatabase() || !initNodeStore())
|
||||
return false;
|
||||
|
||||
@@ -1272,6 +1276,12 @@ ApplicationImp::setup(boost::program_options::variables_map const& cmdline)
|
||||
}
|
||||
}
|
||||
|
||||
if (auto const& forcedRange = config().FORCED_LEDGER_RANGE_PRESENT)
|
||||
{
|
||||
m_ledgerMaster->setLedgerRangePresent(
|
||||
forcedRange->first, forcedRange->second);
|
||||
}
|
||||
|
||||
if (!config().reporting())
|
||||
m_orderBookDB.setup(getLedgerMaster().getCurrentLedger());
|
||||
|
||||
@@ -1323,6 +1333,9 @@ ApplicationImp::setup(boost::program_options::variables_map const& cmdline)
|
||||
<< "Invalid entry in [" << SECTION_VALIDATOR_LIST_SITES << "]";
|
||||
return false;
|
||||
}
|
||||
|
||||
// Tell the AmendmentTable who the trusted validators are.
|
||||
m_amendmentTable->trustChanged(validators_->getQuorumKeys().second);
|
||||
}
|
||||
//----------------------------------------------------------------------
|
||||
//
|
||||
@@ -1699,7 +1712,7 @@ ApplicationImp::fdRequired() const
|
||||
void
|
||||
ApplicationImp::startGenesisLedger()
|
||||
{
|
||||
std::vector<uint256> initialAmendments =
|
||||
std::vector<uint256> const initialAmendments =
|
||||
(config_->START_UP == Config::FRESH) ? m_amendmentTable->getDesired()
|
||||
: std::vector<uint256>{};
|
||||
|
||||
@@ -1710,7 +1723,10 @@ ApplicationImp::startGenesisLedger()
|
||||
auto const next =
|
||||
std::make_shared<Ledger>(*genesis, timeKeeper().closeTime());
|
||||
next->updateSkipList();
|
||||
next->setImmutable(*config_);
|
||||
assert(
|
||||
next->info().seq < XRP_LEDGER_EARLIEST_FEES ||
|
||||
next->read(keylet::fees()));
|
||||
next->setImmutable();
|
||||
openLedger_.emplace(next, cachedSLEs_, logs_->journal("OpenLedger"));
|
||||
m_ledgerMaster->storeLedger(next);
|
||||
m_ledgerMaster->switchLCL(next);
|
||||
@@ -1728,7 +1744,10 @@ ApplicationImp::getLastFullLedger()
|
||||
if (!ledger)
|
||||
return ledger;
|
||||
|
||||
ledger->setImmutable(*config_);
|
||||
assert(
|
||||
ledger->info().seq < XRP_LEDGER_EARLIEST_FEES ||
|
||||
ledger->read(keylet::fees()));
|
||||
ledger->setImmutable();
|
||||
|
||||
if (getLedgerMaster().haveLedger(seq))
|
||||
ledger->setValidated();
|
||||
@@ -1879,8 +1898,11 @@ ApplicationImp::loadLedgerFromFile(std::string const& name)
|
||||
|
||||
loadLedger->stateMap().flushDirty(hotACCOUNT_NODE);
|
||||
|
||||
assert(
|
||||
loadLedger->info().seq < XRP_LEDGER_EARLIEST_FEES ||
|
||||
loadLedger->read(keylet::fees()));
|
||||
loadLedger->setAccepted(
|
||||
closeTime, closeTimeResolution, !closeTimeEstimated, *config_);
|
||||
closeTime, closeTimeResolution, !closeTimeEstimated);
|
||||
|
||||
return loadLedger;
|
||||
}
|
||||
|
||||
@@ -89,6 +89,7 @@ class Overlay;
|
||||
class PathRequests;
|
||||
class PendingSaves;
|
||||
class PublicKey;
|
||||
class ServerHandler;
|
||||
class SecretKey;
|
||||
class STLedgerEntry;
|
||||
class TimeKeeper;
|
||||
@@ -231,6 +232,8 @@ public:
|
||||
getOPs() = 0;
|
||||
virtual OrderBookDB&
|
||||
getOrderBookDB() = 0;
|
||||
virtual ServerHandler&
|
||||
getServerHandler() = 0;
|
||||
virtual TransactionMaster&
|
||||
getMasterTransaction() = 0;
|
||||
virtual perf::PerfLog&
|
||||
|
||||
@@ -429,7 +429,7 @@ GRPCServerImpl::GRPCServerImpl(Application& app)
|
||||
// if present, get endpoint from config
|
||||
if (app_.config().exists("port_grpc"))
|
||||
{
|
||||
Section section = app_.config().section("port_grpc");
|
||||
const auto& section = app_.config().section("port_grpc");
|
||||
|
||||
auto const optIp = section.get("ip");
|
||||
if (!optIp)
|
||||
|
||||
@@ -125,14 +125,12 @@ printHelp(const po::options_description& desc)
|
||||
<< systemName() << "d [options] <command> <params>\n"
|
||||
<< desc << std::endl
|
||||
<< "Commands: \n"
|
||||
" account_currencies <account> [<ledger>] [strict]\n"
|
||||
" account_info <account>|<seed>|<pass_phrase>|<key> [<ledger>] "
|
||||
"[strict]\n"
|
||||
" account_currencies <account> [<ledger>]\n"
|
||||
" account_info <account>|<key> [<ledger>]\n"
|
||||
" account_lines <account> <account>|\"\" [<ledger>]\n"
|
||||
" account_channels <account> <account>|\"\" [<ledger>]\n"
|
||||
" account_objects <account> [<ledger>] [strict]\n"
|
||||
" account_offers <account>|<account_public_key> [<ledger>] "
|
||||
"[strict]\n"
|
||||
" account_objects <account> [<ledger>]\n"
|
||||
" account_offers <account>|<account_public_key> [<ledger>]\n"
|
||||
" account_tx accountID [ledger_index_min [ledger_index_max "
|
||||
"[limit "
|
||||
"]]] [binary]\n"
|
||||
@@ -171,6 +169,7 @@ printHelp(const po::options_description& desc)
|
||||
" peer_reservations_list\n"
|
||||
" ripple ...\n"
|
||||
" ripple_path_find <json> [<ledger>]\n"
|
||||
" server_definitions [<hash>]\n"
|
||||
" server_info [counters]\n"
|
||||
" server_state [counters]\n"
|
||||
" sign <private_key> <tx_json> [offline]\n"
|
||||
@@ -381,8 +380,13 @@ run(int argc, char** argv)
|
||||
"Override the minimum validation quorum.")(
|
||||
"reportingReadOnly", "Run in read-only reporting mode")(
|
||||
"silent", "No output to the console after startup.")(
|
||||
"standalone,a", "Run with no peers.")("verbose,v", "Verbose logging.")(
|
||||
"version", "Display the build version.");
|
||||
"standalone,a", "Run with no peers.")("verbose,v", "Verbose logging.")
|
||||
|
||||
("force_ledger_present_range",
|
||||
po::value<std::string>(),
|
||||
"Specify the range of present ledgers for testing purposes. Min and "
|
||||
"max values are comma separated.")(
|
||||
"version", "Display the build version.");
|
||||
|
||||
po::options_description data("Ledger/Data Options");
|
||||
data.add_options()("import", importText.c_str())(
|
||||
@@ -605,6 +609,51 @@ run(int argc, char** argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (vm.contains("force_ledger_present_range"))
|
||||
{
|
||||
try
|
||||
{
|
||||
auto const r = [&vm]() -> std::vector<std::uint32_t> {
|
||||
std::vector<std::string> strVec;
|
||||
boost::split(
|
||||
strVec,
|
||||
vm["force_ledger_present_range"].as<std::string>(),
|
||||
boost::algorithm::is_any_of(","));
|
||||
std::vector<std::uint32_t> result;
|
||||
for (auto& s : strVec)
|
||||
{
|
||||
boost::trim(s);
|
||||
if (!s.empty())
|
||||
result.push_back(std::stoi(s));
|
||||
}
|
||||
return result;
|
||||
}();
|
||||
|
||||
if (r.size() == 2)
|
||||
{
|
||||
if (r[0] > r[1])
|
||||
{
|
||||
throw std::runtime_error(
|
||||
"Invalid force_ledger_present_range parameter");
|
||||
}
|
||||
config->FORCED_LEDGER_RANGE_PRESENT.emplace(r[0], r[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error(
|
||||
"Invalid force_ledger_present_range parameter");
|
||||
}
|
||||
}
|
||||
catch (std::exception const& e)
|
||||
{
|
||||
std::cerr << "invalid 'force_ledger_present_range' parameter. The "
|
||||
"parameter must be two numbers separated by a comma. "
|
||||
"The first number must be <= the second."
|
||||
<< std::endl;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (vm.count("start"))
|
||||
{
|
||||
config->START_UP = Config::FRESH;
|
||||
@@ -755,10 +804,8 @@ run(int argc, char** argv)
|
||||
if (vm.count("debug"))
|
||||
setDebugLogSink(logs->makeSink("Debug", beast::severities::kTrace));
|
||||
|
||||
auto timeKeeper = make_TimeKeeper(logs->journal("TimeKeeper"));
|
||||
|
||||
auto app = make_Application(
|
||||
std::move(config), std::move(logs), std::move(timeKeeper));
|
||||
std::move(config), std::move(logs), std::make_unique<TimeKeeper>());
|
||||
|
||||
if (!app->setup(vm))
|
||||
return -1;
|
||||
|
||||
311
src/ripple/app/misc/AMMHelpers.h
Normal file
311
src/ripple/app/misc/AMMHelpers.h
Normal file
@@ -0,0 +1,311 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2023 Ripple Labs Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_APP_MISC_AMMHELPERS_H_INCLUDED
|
||||
#define RIPPLE_APP_MISC_AMMHELPERS_H_INCLUDED
|
||||
|
||||
#include <ripple/basics/IOUAmount.h>
|
||||
#include <ripple/basics/Number.h>
|
||||
#include <ripple/protocol/AMMCore.h>
|
||||
#include <ripple/protocol/AmountConversions.h>
|
||||
#include <ripple/protocol/Issue.h>
|
||||
#include <ripple/protocol/Quality.h>
|
||||
#include <ripple/protocol/STAccount.h>
|
||||
#include <ripple/protocol/STAmount.h>
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
/** Calculate LP Tokens given AMM pool reserves.
|
||||
* @param asset1 AMM one side of the pool reserve
|
||||
* @param asset2 AMM another side of the pool reserve
|
||||
* @return LP Tokens as IOU
|
||||
*/
|
||||
STAmount
|
||||
ammLPTokens(
|
||||
STAmount const& asset1,
|
||||
STAmount const& asset2,
|
||||
Issue const& lptIssue);
|
||||
|
||||
/** Calculate LP Tokens given asset's deposit amount.
|
||||
* @param asset1Balance current AMM asset1 balance
|
||||
* @param asset1Deposit requested asset1 deposit amount
|
||||
* @param lptAMMBalance AMM LPT balance
|
||||
* @param tfee trading fee in basis points
|
||||
* @return tokens
|
||||
*/
|
||||
STAmount
|
||||
lpTokensIn(
|
||||
STAmount const& asset1Balance,
|
||||
STAmount const& asset1Deposit,
|
||||
STAmount const& lptAMMBalance,
|
||||
std::uint16_t tfee);
|
||||
|
||||
/** Calculate asset deposit given LP Tokens.
|
||||
* @param asset1Balance current AMM asset1 balance
|
||||
* @param lpTokens LP Tokens
|
||||
* @param lptAMMBalance AMM LPT balance
|
||||
* @param tfee trading fee in basis points
|
||||
* @return
|
||||
*/
|
||||
STAmount
|
||||
ammAssetIn(
|
||||
STAmount const& asset1Balance,
|
||||
STAmount const& lptAMMBalance,
|
||||
STAmount const& lpTokens,
|
||||
std::uint16_t tfee);
|
||||
|
||||
/** Calculate LP Tokens given asset's withdraw amount. Return 0
|
||||
* if can't calculate.
|
||||
* @param asset1Balance current AMM asset1 balance
|
||||
* @param asset1Withdraw requested asset1 withdraw amount
|
||||
* @param lptAMMBalance AMM LPT balance
|
||||
* @param tfee trading fee in basis points
|
||||
* @return tokens out amount
|
||||
*/
|
||||
STAmount
|
||||
lpTokensOut(
|
||||
STAmount const& asset1Balance,
|
||||
STAmount const& asset1Withdraw,
|
||||
STAmount const& lptAMMBalance,
|
||||
std::uint16_t tfee);
|
||||
|
||||
/** Calculate asset withdrawal by tokens
|
||||
* @param assetBalance balance of the asset being withdrawn
|
||||
* @param lptAMMBalance total AMM Tokens balance
|
||||
* @param lpTokens LP Tokens balance
|
||||
* @param tfee trading fee in basis points
|
||||
* @return calculated asset amount
|
||||
*/
|
||||
STAmount
|
||||
withdrawByTokens(
|
||||
STAmount const& assetBalance,
|
||||
STAmount const& lptAMMBalance,
|
||||
STAmount const& lpTokens,
|
||||
std::uint16_t tfee);
|
||||
|
||||
/** Check if the relative distance between the qualities
|
||||
* is within the requested distance.
|
||||
* @param calcQuality calculated quality
|
||||
* @param reqQuality requested quality
|
||||
* @param dist requested relative distance
|
||||
* @return true if within dist, false otherwise
|
||||
*/
|
||||
inline bool
|
||||
withinRelativeDistance(
|
||||
Quality const& calcQuality,
|
||||
Quality const& reqQuality,
|
||||
Number const& dist)
|
||||
{
|
||||
if (calcQuality == reqQuality)
|
||||
return true;
|
||||
auto const [min, max] = std::minmax(calcQuality, reqQuality);
|
||||
// Relative distance is (max - min)/max. Can't use basic operations
|
||||
// on Quality. Have to use Quality::rate() instead, which
|
||||
// is inverse of quality: (1/max.rate - 1/min.rate)/(1/max.rate)
|
||||
return ((min.rate() - max.rate()) / min.rate()) < dist;
|
||||
}
|
||||
|
||||
/** Check if the relative distance between the amounts
|
||||
* is within the requested distance.
|
||||
* @param calc calculated amount
|
||||
* @param req requested amount
|
||||
* @param dist requested relative distance
|
||||
* @return true if within dist, false otherwise
|
||||
*/
|
||||
// clang-format off
|
||||
template <typename Amt>
|
||||
requires(
|
||||
std::is_same_v<Amt, STAmount> || std::is_same_v<Amt, IOUAmount> ||
|
||||
std::is_same_v<Amt, XRPAmount>)
|
||||
bool
|
||||
withinRelativeDistance(Amt const& calc, Amt const& req, Number const& dist)
|
||||
{
|
||||
if (calc == req)
|
||||
return true;
|
||||
auto const [min, max] = std::minmax(calc, req);
|
||||
return ((max - min) / max) < dist;
|
||||
}
|
||||
// clang-format on
|
||||
|
||||
/** Finds takerPays (i) and takerGets (o) such that given pool composition
|
||||
* poolGets(I) and poolPays(O): (O - o) / (I + i) = quality.
|
||||
* Where takerGets is calculated as the swapAssetIn (see below).
|
||||
* The above equation produces the quadratic equation:
|
||||
* i^2*(1-fee) + i*I*(2-fee) + I^2 - I*O/quality,
|
||||
* which is solved for i, and o is found with swapAssetIn().
|
||||
* @param pool AMM pool balances
|
||||
* @param quality requested quality
|
||||
* @param tfee trading fee in basis points
|
||||
* @return seated in/out amounts if the quality can be changed
|
||||
*/
|
||||
template <typename TIn, typename TOut>
|
||||
std::optional<TAmounts<TIn, TOut>>
|
||||
changeSpotPriceQuality(
|
||||
TAmounts<TIn, TOut> const& pool,
|
||||
Quality const& quality,
|
||||
std::uint16_t tfee)
|
||||
{
|
||||
auto const f = feeMult(tfee); // 1 - fee
|
||||
auto const& a = f;
|
||||
auto const b = pool.in * (1 + f);
|
||||
Number const c = pool.in * pool.in - pool.in * pool.out * quality.rate();
|
||||
if (auto const res = b * b - 4 * a * c; res < 0)
|
||||
return std::nullopt;
|
||||
else if (auto const nTakerPaysPropose = (-b + root2(res)) / (2 * a);
|
||||
nTakerPaysPropose > 0)
|
||||
{
|
||||
auto const nTakerPays = [&]() {
|
||||
// The fee might make the AMM offer quality less than CLOB quality.
|
||||
// Therefore, AMM offer has to satisfy this constraint: o / i >= q.
|
||||
// Substituting o with swapAssetIn() gives:
|
||||
// i <= O / q - I / (1 - fee).
|
||||
auto const nTakerPaysConstraint =
|
||||
pool.out * quality.rate() - pool.in / f;
|
||||
if (nTakerPaysPropose > nTakerPaysConstraint)
|
||||
return nTakerPaysConstraint;
|
||||
return nTakerPaysPropose;
|
||||
}();
|
||||
if (nTakerPays <= 0)
|
||||
return std::nullopt;
|
||||
auto const takerPays = toAmount<TIn>(
|
||||
getIssue(pool.in), nTakerPays, Number::rounding_mode::upward);
|
||||
// should not fail
|
||||
if (auto const amounts =
|
||||
TAmounts<TIn, TOut>{
|
||||
takerPays, swapAssetIn(pool, takerPays, tfee)};
|
||||
Quality{amounts} < quality &&
|
||||
!withinRelativeDistance(Quality{amounts}, quality, Number(1, -7)))
|
||||
Throw<std::runtime_error>("changeSpotPriceQuality failed");
|
||||
else
|
||||
return amounts;
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/** AMM pool invariant - the product (A * B) after swap in/out has to remain
|
||||
* at least the same: (A + in) * (B - out) >= A * B
|
||||
* XRP round-off may result in a smaller product after swap in/out.
|
||||
* To address this:
|
||||
* - if on swapIn the out is XRP then the amount is round-off
|
||||
* downward, making the product slightly larger since out
|
||||
* value is reduced.
|
||||
* - if on swapOut the in is XRP then the amount is round-off
|
||||
* upward, making the product slightly larger since in
|
||||
* value is increased.
|
||||
*/
|
||||
|
||||
/** Swap assetIn into the pool and swap out a proportional amount
|
||||
* of the other asset. Implements AMM Swap in.
|
||||
* @see [XLS30d:AMM
|
||||
* Swap](https://github.com/XRPLF/XRPL-Standards/discussions/78)
|
||||
* @param pool current AMM pool balances
|
||||
* @param assetIn amount to swap in
|
||||
* @param tfee trading fee in basis points
|
||||
* @return
|
||||
*/
|
||||
template <typename TIn, typename TOut>
|
||||
TOut
|
||||
swapAssetIn(
|
||||
TAmounts<TIn, TOut> const& pool,
|
||||
TIn const& assetIn,
|
||||
std::uint16_t tfee)
|
||||
{
|
||||
return toAmount<TOut>(
|
||||
getIssue(pool.out),
|
||||
pool.out - (pool.in * pool.out) / (pool.in + assetIn * feeMult(tfee)),
|
||||
Number::rounding_mode::downward);
|
||||
}
|
||||
|
||||
/** Swap assetOut out of the pool and swap in a proportional amount
|
||||
* of the other asset. Implements AMM Swap out.
|
||||
* @see [XLS30d:AMM
|
||||
* Swap](https://github.com/XRPLF/XRPL-Standards/discussions/78)
|
||||
* @param pool current AMM pool balances
|
||||
* @param assetOut amount to swap out
|
||||
* @param tfee trading fee in basis points
|
||||
* @return
|
||||
*/
|
||||
template <typename TIn, typename TOut>
|
||||
TIn
|
||||
swapAssetOut(
|
||||
TAmounts<TIn, TOut> const& pool,
|
||||
TOut const& assetOut,
|
||||
std::uint16_t tfee)
|
||||
{
|
||||
return toAmount<TIn>(
|
||||
getIssue(pool.in),
|
||||
((pool.in * pool.out) / (pool.out - assetOut) - pool.in) /
|
||||
feeMult(tfee),
|
||||
Number::rounding_mode::upward);
|
||||
}
|
||||
|
||||
/** Return square of n.
|
||||
*/
|
||||
Number
|
||||
square(Number const& n);
|
||||
|
||||
/** Adjust LP tokens to deposit/withdraw.
|
||||
* Amount type keeps 16 digits. Maintaining the LP balance by adding deposited
|
||||
* tokens or subtracting withdrawn LP tokens from LP balance results in
|
||||
* losing precision in LP balance. I.e. the resulting LP balance
|
||||
* is less than the actual sum of LP tokens. To adjust for this, subtract
|
||||
* old tokens balance from the new one for deposit or vice versa for withdraw
|
||||
* to cancel out the precision loss.
|
||||
* @param lptAMMBalance LPT AMM Balance
|
||||
* @param lpTokens LP tokens to deposit or withdraw
|
||||
* @param isDeposit true if deposit, false if withdraw
|
||||
*/
|
||||
STAmount
|
||||
adjustLPTokens(
|
||||
STAmount const& lptAMMBalance,
|
||||
STAmount const& lpTokens,
|
||||
bool isDeposit);
|
||||
|
||||
/** Calls adjustLPTokens() and adjusts deposit or withdraw amounts if
|
||||
* the adjusted LP tokens are less than the provided LP tokens.
|
||||
* @param amountBalance asset1 pool balance
|
||||
* @param amount asset1 to deposit or withdraw
|
||||
* @param amount2 asset2 to deposit or withdraw
|
||||
* @param lptAMMBalance LPT AMM Balance
|
||||
* @param lpTokens LP tokens to deposit or withdraw
|
||||
* @param tfee trading fee in basis points
|
||||
* @param isDeposit true if deposit, false if withdraw
|
||||
* @return
|
||||
*/
|
||||
std::tuple<STAmount, std::optional<STAmount>, STAmount>
|
||||
adjustAmountsByLPTokens(
|
||||
STAmount const& amountBalance,
|
||||
STAmount const& amount,
|
||||
std::optional<STAmount> const& amount2,
|
||||
STAmount const& lptAMMBalance,
|
||||
STAmount const& lpTokens,
|
||||
std::uint16_t tfee,
|
||||
bool isDeposit);
|
||||
|
||||
/** Positive solution for quadratic equation:
|
||||
* x = (-b + sqrt(b**2 + 4*a*c))/(2*a)
|
||||
*/
|
||||
Number
|
||||
solveQuadraticEq(Number const& a, Number const& b, Number const& c);
|
||||
|
||||
} // namespace ripple
|
||||
|
||||
#endif // RIPPLE_APP_MISC_AMMHELPERS_H_INCLUDED
|
||||
118
src/ripple/app/misc/AMMUtils.h
Normal file
118
src/ripple/app/misc/AMMUtils.h
Normal file
@@ -0,0 +1,118 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2023 Ripple Labs Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
#ifndef RIPPLE_APP_MISC_AMMUTILS_H_INLCUDED
|
||||
#define RIPPLE_APP_MISC_AMMUTILS_H_INLCUDED
|
||||
|
||||
#include <ripple/basics/Expected.h>
|
||||
#include <ripple/beast/utility/Journal.h>
|
||||
#include <ripple/ledger/View.h>
|
||||
#include <ripple/protocol/STAmount.h>
|
||||
#include <ripple/protocol/STLedgerEntry.h>
|
||||
#include <ripple/protocol/TER.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
class ReadView;
|
||||
class ApplyView;
|
||||
class Sandbox;
|
||||
class NetClock;
|
||||
|
||||
/** Get AMM pool balances.
|
||||
*/
|
||||
std::pair<STAmount, STAmount>
|
||||
ammPoolHolds(
|
||||
ReadView const& view,
|
||||
AccountID const& ammAccountID,
|
||||
Issue const& issue1,
|
||||
Issue const& issue2,
|
||||
FreezeHandling freezeHandling,
|
||||
beast::Journal const j);
|
||||
|
||||
/** Get AMM pool and LP token balances. If both optIssue are
|
||||
* provided then they are used as the AMM token pair issues.
|
||||
* Otherwise the missing issues are fetched from ammSle.
|
||||
*/
|
||||
Expected<std::tuple<STAmount, STAmount, STAmount>, TER>
|
||||
ammHolds(
|
||||
ReadView const& view,
|
||||
SLE const& ammSle,
|
||||
std::optional<Issue> const& optIssue1,
|
||||
std::optional<Issue> const& optIssue2,
|
||||
FreezeHandling freezeHandling,
|
||||
beast::Journal const j);
|
||||
|
||||
/** Get the balance of LP tokens.
|
||||
*/
|
||||
STAmount
|
||||
ammLPHolds(
|
||||
ReadView const& view,
|
||||
Currency const& cur1,
|
||||
Currency const& cur2,
|
||||
AccountID const& ammAccount,
|
||||
AccountID const& lpAccount,
|
||||
beast::Journal const j);
|
||||
|
||||
STAmount
|
||||
ammLPHolds(
|
||||
ReadView const& view,
|
||||
SLE const& ammSle,
|
||||
AccountID const& lpAccount,
|
||||
beast::Journal const j);
|
||||
|
||||
/** Get AMM trading fee for the given account. The fee is discounted
|
||||
* if the account is the auction slot owner or one of the slot's authorized
|
||||
* accounts.
|
||||
*/
|
||||
std::uint16_t
|
||||
getTradingFee(
|
||||
ReadView const& view,
|
||||
SLE const& ammSle,
|
||||
AccountID const& account);
|
||||
|
||||
/** Returns total amount held by AMM for the given token.
|
||||
*/
|
||||
STAmount
|
||||
ammAccountHolds(
|
||||
ReadView const& view,
|
||||
AccountID const& ammAccountID,
|
||||
Issue const& issue);
|
||||
|
||||
/** Delete trustlines to AMM. If all trustlines are deleted then
|
||||
* AMM object and account are deleted. Otherwise tecIMPCOMPLETE is returned.
|
||||
*/
|
||||
TER
|
||||
deleteAMMAccount(
|
||||
Sandbox& view,
|
||||
Issue const& asset,
|
||||
Issue const& asset2,
|
||||
beast::Journal j);
|
||||
|
||||
/** Initialize Auction and Voting slots and set the trading/discounted fee.
|
||||
*/
|
||||
void
|
||||
initializeFeeAuctionVote(
|
||||
ApplyView& view,
|
||||
std::shared_ptr<SLE>& ammSle,
|
||||
AccountID const& account,
|
||||
Issue const& lptIssue,
|
||||
std::uint16_t tfee);
|
||||
|
||||
} // namespace ripple
|
||||
|
||||
#endif // RIPPLE_APP_MISC_AMMUTILS_H_INLCUDED
|
||||
@@ -40,14 +40,14 @@ public:
|
||||
struct FeatureInfo
|
||||
{
|
||||
FeatureInfo() = delete;
|
||||
FeatureInfo(std::string const& n, uint256 const& f, DefaultVote v)
|
||||
FeatureInfo(std::string const& n, uint256 const& f, VoteBehavior v)
|
||||
: name(n), feature(f), vote(v)
|
||||
{
|
||||
}
|
||||
|
||||
std::string const name;
|
||||
uint256 const feature;
|
||||
DefaultVote const vote;
|
||||
VoteBehavior const vote;
|
||||
};
|
||||
|
||||
virtual ~AmendmentTable() = default;
|
||||
@@ -111,6 +111,10 @@ public:
|
||||
std::set<uint256> const& enabled,
|
||||
majorityAmendments_t const& majority) = 0;
|
||||
|
||||
// Called when the set of trusted validators changes.
|
||||
virtual void
|
||||
trustChanged(hash_set<PublicKey> const& allTrusted) = 0;
|
||||
|
||||
// Called by the consensus code when we need to
|
||||
// inject pseudo-transactions
|
||||
virtual std::map<uint256, std::uint32_t>
|
||||
@@ -172,8 +176,7 @@ public:
|
||||
|
||||
initialPosition->addGiveItem(
|
||||
SHAMapNodeType::tnTRANSACTION_NM,
|
||||
std::make_shared<SHAMapItem>(
|
||||
amendTx.getTransactionID(), s.slice()));
|
||||
make_shamapitem(amendTx.getTransactionID(), s.slice()));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
53
src/ripple/app/misc/DeliverMax.h
Normal file
53
src/ripple/app/misc/DeliverMax.h
Normal file
@@ -0,0 +1,53 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2023 Ripple Labs Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_APP_MISC_DELIVERMAX_H_INCLUDED
|
||||
#define RIPPLE_APP_MISC_DELIVERMAX_H_INCLUDED
|
||||
|
||||
#include <ripple/protocol/TxFormats.h>
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
namespace Json {
|
||||
class Value;
|
||||
}
|
||||
|
||||
namespace ripple {
|
||||
|
||||
namespace RPC {
|
||||
|
||||
/**
|
||||
Copy `Amount` field to `DeliverMax` field in transaction output JSON.
|
||||
This only applies to Payment transaction type, all others are ignored.
|
||||
|
||||
When apiVersion > 1 will also remove `Amount` field, forcing users
|
||||
to access this value using new `DeliverMax` field only.
|
||||
@{
|
||||
*/
|
||||
|
||||
void
|
||||
insertDeliverMax(Json::Value& tx_json, TxType txnType, unsigned int apiVersion);
|
||||
|
||||
/** @} */
|
||||
|
||||
} // namespace RPC
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
@@ -190,11 +190,27 @@ lower) fee to get into the same position as a reference transaction.
|
||||
|
||||
### Consensus Health
|
||||
|
||||
For consensus to be considered healthy, the consensus process must take
|
||||
less than 5 seconds. This time limit was chosen based on observed past
|
||||
behavior of the network. Note that this is not necessarily the time between
|
||||
ledger closings, as consensus usually starts some amount of time after
|
||||
a ledger opens.
|
||||
For consensus to be considered healthy, the peers on the network
|
||||
should largely remain in sync with one another. It is particularly
|
||||
important for the validators to remain in sync, because that is required
|
||||
for participation in consensus. However, the network tolerates some
|
||||
validators being out of sync. Fundamentally, network health is a
|
||||
function of validators reaching consensus on sets of recently submitted
|
||||
transactions.
|
||||
|
||||
Another factor to consider is
|
||||
the duration of the consensus process itself. This generally takes
|
||||
under 5 seconds on the main network under low volume. This is based on
|
||||
historical observations. However factors such as transaction volume
|
||||
can increase consensus duration. This is because rippled performs
|
||||
more work as transaction volume increases. Under sufficient load this
|
||||
tends to increase consensus duration. It's possible that relatively high
|
||||
consensus duration indicates a problem, but it is not appropriate to
|
||||
conclude so without investigation. The upper limit for consensus
|
||||
duration should be roughly 20 seconds. That is far above the normal.
|
||||
If the network takes this long to close ledgers, then it is almost
|
||||
certain that there is a problem with the network. This circumstance
|
||||
often coincides with new ledgers with zero transactions.
|
||||
|
||||
### Other Constants
|
||||
|
||||
|
||||
@@ -32,23 +32,6 @@ namespace ripple {
|
||||
class FeeVote
|
||||
{
|
||||
public:
|
||||
/** Fee schedule to vote for.
|
||||
During voting ledgers, the FeeVote logic will try to move towards
|
||||
these values when injecting fee-setting transactions.
|
||||
A default-constructed Setup contains recommended values.
|
||||
*/
|
||||
struct Setup
|
||||
{
|
||||
/** The cost of a reference transaction in drops. */
|
||||
XRPAmount reference_fee{10};
|
||||
|
||||
/** The account reserve requirement in drops. */
|
||||
XRPAmount account_reserve{10 * DROPS_PER_XRP};
|
||||
|
||||
/** The per-owned item reserve requirement in drops. */
|
||||
XRPAmount owner_reserve{2 * DROPS_PER_XRP};
|
||||
};
|
||||
|
||||
virtual ~FeeVote() = default;
|
||||
|
||||
/** Add local fee preference to validation.
|
||||
@@ -74,16 +57,13 @@ public:
|
||||
std::shared_ptr<SHAMap> const& initialPosition) = 0;
|
||||
};
|
||||
|
||||
/** Build FeeVote::Setup from a config section. */
|
||||
FeeVote::Setup
|
||||
setup_FeeVote(Section const& section);
|
||||
|
||||
struct FeeSetup;
|
||||
/** Create an instance of the FeeVote logic.
|
||||
@param setup The fee schedule to vote for.
|
||||
@param journal Where to log.
|
||||
*/
|
||||
std::unique_ptr<FeeVote>
|
||||
make_FeeVote(FeeVote::Setup const& setup, beast::Journal journal);
|
||||
make_FeeVote(FeeSetup const& setup, beast::Journal journal);
|
||||
|
||||
} // namespace ripple
|
||||
|
||||
|
||||
@@ -93,11 +93,11 @@ VotableValue::getVotes() const -> std::pair<value_type, bool>
|
||||
class FeeVoteImpl : public FeeVote
|
||||
{
|
||||
private:
|
||||
Setup target_;
|
||||
FeeSetup target_;
|
||||
beast::Journal const journal_;
|
||||
|
||||
public:
|
||||
FeeVoteImpl(Setup const& setup, beast::Journal journal);
|
||||
FeeVoteImpl(FeeSetup const& setup, beast::Journal journal);
|
||||
|
||||
void
|
||||
doValidation(Fees const& lastFees, Rules const& rules, STValidation& val)
|
||||
@@ -112,7 +112,7 @@ public:
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
FeeVoteImpl::FeeVoteImpl(Setup const& setup, beast::Journal journal)
|
||||
FeeVoteImpl::FeeVoteImpl(FeeSetup const& setup, beast::Journal journal)
|
||||
: target_(setup), journal_(journal)
|
||||
{
|
||||
}
|
||||
@@ -326,7 +326,7 @@ FeeVoteImpl::doVoting(
|
||||
|
||||
if (!initialPosition->addGiveItem(
|
||||
SHAMapNodeType::tnTRANSACTION_NM,
|
||||
std::make_shared<SHAMapItem>(txID, s.slice())))
|
||||
make_shamapitem(txID, s.slice())))
|
||||
{
|
||||
JLOG(journal_.warn()) << "Ledger already had fee change";
|
||||
}
|
||||
@@ -335,28 +335,8 @@ FeeVoteImpl::doVoting(
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
FeeVote::Setup
|
||||
setup_FeeVote(Section const& section)
|
||||
{
|
||||
FeeVote::Setup setup;
|
||||
{
|
||||
std::uint64_t temp;
|
||||
if (set(temp, "reference_fee", section) &&
|
||||
temp <= std::numeric_limits<XRPAmount::value_type>::max())
|
||||
setup.reference_fee = temp;
|
||||
}
|
||||
{
|
||||
std::uint32_t temp;
|
||||
if (set(temp, "account_reserve", section))
|
||||
setup.account_reserve = temp;
|
||||
if (set(temp, "owner_reserve", section))
|
||||
setup.owner_reserve = temp;
|
||||
}
|
||||
return setup;
|
||||
}
|
||||
|
||||
std::unique_ptr<FeeVote>
|
||||
make_FeeVote(FeeVote::Setup const& setup, beast::Journal journal)
|
||||
make_FeeVote(FeeSetup const& setup, beast::Journal journal)
|
||||
{
|
||||
return std::make_unique<FeeVoteImpl>(setup, journal);
|
||||
}
|
||||
|
||||
@@ -138,12 +138,14 @@ to_string(Manifest const& m);
|
||||
*/
|
||||
/** @{ */
|
||||
std::optional<Manifest>
|
||||
deserializeManifest(Slice s);
|
||||
deserializeManifest(Slice s, beast::Journal journal);
|
||||
|
||||
inline std::optional<Manifest>
|
||||
deserializeManifest(std::string const& s)
|
||||
deserializeManifest(
|
||||
std::string const& s,
|
||||
beast::Journal journal = beast::Journal(beast::Journal::getNullSink()))
|
||||
{
|
||||
return deserializeManifest(makeSlice(s));
|
||||
return deserializeManifest(makeSlice(s), journal);
|
||||
}
|
||||
|
||||
template <
|
||||
@@ -151,9 +153,11 @@ template <
|
||||
class = std::enable_if_t<
|
||||
std::is_same<T, char>::value || std::is_same<T, unsigned char>::value>>
|
||||
std::optional<Manifest>
|
||||
deserializeManifest(std::vector<T> const& v)
|
||||
deserializeManifest(
|
||||
std::vector<T> const& v,
|
||||
beast::Journal journal = beast::Journal(beast::Journal::getNullSink()))
|
||||
{
|
||||
return deserializeManifest(makeSlice(v));
|
||||
return deserializeManifest(makeSlice(v), journal);
|
||||
}
|
||||
/** @} */
|
||||
|
||||
@@ -180,7 +184,9 @@ struct ValidatorToken
|
||||
};
|
||||
|
||||
std::optional<ValidatorToken>
|
||||
loadValidatorToken(std::vector<std::string> const& blob);
|
||||
loadValidatorToken(
|
||||
std::vector<std::string> const& blob,
|
||||
beast::Journal journal = beast::Journal(beast::Journal::getNullSink()));
|
||||
|
||||
enum class ManifestDisposition {
|
||||
/// Manifest is valid
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <ripple/app/consensus/RCLValidations.h>
|
||||
#include <ripple/app/ledger/Ledger.h>
|
||||
#include <ripple/app/misc/NegativeUNLVote.h>
|
||||
#include <ripple/shamap/SHAMapItem.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
@@ -115,12 +116,11 @@ NegativeUNLVote::addTx(
|
||||
obj.setFieldVL(sfUNLModifyValidator, vp.slice());
|
||||
});
|
||||
|
||||
uint256 txID = negUnlTx.getTransactionID();
|
||||
Serializer s;
|
||||
negUnlTx.add(s);
|
||||
if (!initialSet->addGiveItem(
|
||||
SHAMapNodeType::tnTRANSACTION_NM,
|
||||
std::make_shared<SHAMapItem>(txID, s.slice())))
|
||||
make_shamapitem(negUnlTx.getTransactionID(), s.slice())))
|
||||
{
|
||||
JLOG(j_.warn()) << "N-UNL: ledger seq=" << seq
|
||||
<< ", add ttUNL_MODIFY tx failed";
|
||||
@@ -128,8 +128,8 @@ NegativeUNLVote::addTx(
|
||||
else
|
||||
{
|
||||
JLOG(j_.debug()) << "N-UNL: ledger seq=" << seq
|
||||
<< ", add a ttUNL_MODIFY Tx with txID: " << txID
|
||||
<< ", the validator to "
|
||||
<< ", add a ttUNL_MODIFY Tx with txID: "
|
||||
<< negUnlTx.getTransactionID() << ", the validator to "
|
||||
<< (modify == ToDisable ? "disable: " : "re-enable: ")
|
||||
<< vp;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user