mirror of
https://github.com/XRPLF/rippled.git
synced 2026-08-24 07:40:53 +00:00
Compare commits
33 Commits
ripple/cos
...
dangell7/m
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
36a659905f | ||
|
|
7786baf5b5 | ||
|
|
f80e72c6f7 | ||
|
|
c16f18f79b | ||
|
|
a40b88436d | ||
|
|
c65e4539f5 | ||
|
|
45ed9e4de7 | ||
|
|
5bf24c4045 | ||
|
|
8d7524f03b | ||
|
|
41d6bb5f73 | ||
|
|
a75488e5ff | ||
|
|
c3ee602002 | ||
|
|
e0de716ee6 | ||
|
|
06488c1318 | ||
|
|
b8451ffa32 | ||
|
|
765babb20d | ||
|
|
97f35add2e | ||
|
|
ecdd457f35 | ||
|
|
85e73cbd32 | ||
|
|
21cd615407 | ||
|
|
3c0659d26b | ||
|
|
532506541f | ||
|
|
8a5eded4f1 | ||
|
|
6ddad54985 | ||
|
|
86832edc70 | ||
|
|
ff7fff2cf2 | ||
|
|
2db631c915 | ||
|
|
6c9c7f0555 | ||
|
|
9466ecb5c2 | ||
|
|
e0aa50c4be | ||
|
|
29120dfcbd | ||
|
|
20801d98ac | ||
|
|
b878818e80 |
@@ -75,6 +75,8 @@ Checks: "-*,
|
||||
# readability-static-accessed-through-instance, # this check is probably unnecessary. It makes the code less readable
|
||||
# ---
|
||||
|
||||
FormatStyle: file
|
||||
|
||||
CheckOptions:
|
||||
bugprone-unsafe-functions.ReportMoreUnsafeFunctions: true
|
||||
bugprone-unused-return-value.CheckedReturnTypes: ::std::error_code;::std::error_condition;::std::errc
|
||||
@@ -83,6 +85,8 @@ CheckOptions:
|
||||
|
||||
readability-braces-around-statements.ShortStatementLines: 2
|
||||
readability-identifier-naming.MacroDefinitionCase: UPPER_CASE
|
||||
readability-identifier-naming.NamespaceCase: lower_case
|
||||
readability-identifier-naming.InlineNamespaceCase: lower_case
|
||||
readability-identifier-naming.ClassCase: CamelCase
|
||||
readability-identifier-naming.StructCase: CamelCase
|
||||
readability-identifier-naming.UnionCase: CamelCase
|
||||
|
||||
@@ -174,7 +174,6 @@ words:
|
||||
- MPTAMM
|
||||
- MPTDEX
|
||||
- Merkle
|
||||
- Metafuncton
|
||||
- misprediction
|
||||
- missingok
|
||||
- mptbalance
|
||||
|
||||
4
.github/dependabot.yml
vendored
4
.github/dependabot.yml
vendored
@@ -15,3 +15,7 @@ updates:
|
||||
commit-message:
|
||||
prefix: "ci: [DEPENDABOT] "
|
||||
target-branch: develop
|
||||
groups:
|
||||
github-actions:
|
||||
patterns:
|
||||
- "*"
|
||||
|
||||
@@ -130,12 +130,9 @@ test.ledger > xrpl.json
|
||||
test.ledger > xrpl.ledger
|
||||
test.ledger > xrpl.protocol
|
||||
test.nodestore > test.jtx
|
||||
test.nodestore > test.unit_test
|
||||
test.nodestore > xrpl.basics
|
||||
test.nodestore > xrpl.config
|
||||
test.nodestore > xrpld.core
|
||||
test.nodestore > xrpl.nodestore
|
||||
test.nodestore > xrpl.protocol
|
||||
test.nodestore > xrpl.rdb
|
||||
test.overlay > test.jtx
|
||||
test.overlay > test.unit_test
|
||||
|
||||
3
.github/scripts/rename/namespace.sh
vendored
3
.github/scripts/rename/namespace.sh
vendored
@@ -46,9 +46,6 @@ for DIRECTORY in "${DIRECTORIES[@]}"; do
|
||||
done
|
||||
done
|
||||
|
||||
# Special case for NuDBFactory that has ripple twice in the test suite name.
|
||||
${SED_COMMAND} -i -E 's/(BEAST_DEFINE_TESTSUITE.+)ripple(.+)/\1xrpl\2/g' src/test/nodestore/NuDBFactory_test.cpp
|
||||
|
||||
DIRECTORY=$1
|
||||
find "${DIRECTORY}" -type f -name "*.md" | while read -r FILE; do
|
||||
echo "Processing file: ${FILE}"
|
||||
|
||||
9
.github/scripts/strategy-matrix/generate.py
vendored
9
.github/scripts/strategy-matrix/generate.py
vendored
@@ -33,6 +33,10 @@ def get_cmake_args(build_type: str, extra_args: str) -> str:
|
||||
# Every config must declare 'minimal'. Minimal configs form the reduced matrix
|
||||
# built for pull requests by default; the full matrix adds the rest. Packaging
|
||||
# configs declare it too, but packaging is gated in the workflow, not by it.
|
||||
#
|
||||
# Configs may also opt into 'benchmark' to smoke-run the benchmarks. Note that
|
||||
# the flag applies to every entry a config expands into, so only set it on
|
||||
# configs that expand to a single combination.
|
||||
|
||||
|
||||
@dataclasses.dataclass
|
||||
@@ -43,6 +47,7 @@ class LinuxConfig:
|
||||
build_type: list[str]
|
||||
arch: list[str]
|
||||
minimal: bool
|
||||
benchmark: bool = False # if true, smoke-run the benchmarks after testing
|
||||
sanitizers: list[str] = dataclasses.field(default_factory=list)
|
||||
suffix: str = ""
|
||||
extra_cmake_args: str = ""
|
||||
@@ -81,6 +86,7 @@ class PlatformConfig:
|
||||
build_type: list[str]
|
||||
minimal: bool
|
||||
build_only: bool = False # if true, skip tests (e.g. macos/Windows Debug)
|
||||
benchmark: bool = False # if true, smoke-run the benchmarks after testing
|
||||
extra_cmake_args: str = ""
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
@@ -125,6 +131,7 @@ class MatrixEntry:
|
||||
cmake_args: str
|
||||
cmake_target: str
|
||||
build_only: bool
|
||||
benchmark: bool
|
||||
build_type: str
|
||||
architecture: Architecture
|
||||
sanitizers: str
|
||||
@@ -193,6 +200,7 @@ def expand_linux_matrix(linux: LinuxFile, minimal: bool) -> list[MatrixEntry]:
|
||||
cmake_args=get_cmake_args(build_type, cfg.extra_cmake_args),
|
||||
cmake_target="all",
|
||||
build_only=False,
|
||||
benchmark=cfg.benchmark,
|
||||
build_type=build_type,
|
||||
architecture=arch_info,
|
||||
sanitizers=sanitizer,
|
||||
@@ -245,6 +253,7 @@ def expand_platform_matrix(pf: PlatformFile, minimal: bool) -> list[MatrixEntry]
|
||||
cmake_args=get_cmake_args(build_type, cfg.extra_cmake_args),
|
||||
cmake_target="install" if is_windows else "all",
|
||||
build_only=cfg.build_only,
|
||||
benchmark=cfg.benchmark,
|
||||
build_type=build_type,
|
||||
architecture=Architecture(platform=pf.platform, runner=pf.runner),
|
||||
sanitizers="",
|
||||
|
||||
22
.github/scripts/strategy-matrix/linux.json
vendored
22
.github/scripts/strategy-matrix/linux.json
vendored
@@ -1,13 +1,23 @@
|
||||
{
|
||||
"image_tag": "sha-40cdf49",
|
||||
"image_tag": "sha-fecfc0c",
|
||||
"configs": {
|
||||
"ubuntu": [
|
||||
{
|
||||
"compiler": ["gcc"],
|
||||
"build_type": ["Debug"],
|
||||
"arch": ["amd64"],
|
||||
"minimal": true,
|
||||
"suffix": "coverage",
|
||||
"extra_cmake_args": "-DUNIT_TEST_REFERENCE_FEE=500 -Dcoverage=ON -Dcoverage_format=xml -DCODE_COVERAGE_VERBOSE=ON -DCMAKE_C_FLAGS=-O0 -DCMAKE_CXX_FLAGS=-O0"
|
||||
},
|
||||
{
|
||||
"compiler": ["clang"],
|
||||
"build_type": ["Release"],
|
||||
"arch": ["amd64"],
|
||||
"minimal": true
|
||||
"minimal": true,
|
||||
"benchmark": true
|
||||
},
|
||||
|
||||
{
|
||||
"compiler": ["gcc"],
|
||||
"build_type": ["Release"],
|
||||
@@ -29,14 +39,6 @@
|
||||
"sanitizers": ["address", "undefinedbehavior"]
|
||||
},
|
||||
|
||||
{
|
||||
"compiler": ["gcc"],
|
||||
"build_type": ["Debug"],
|
||||
"arch": ["amd64"],
|
||||
"minimal": true,
|
||||
"suffix": "coverage",
|
||||
"extra_cmake_args": "-DUNIT_TEST_REFERENCE_FEE=500 -Dcoverage=ON -Dcoverage_format=xml -DCODE_COVERAGE_VERBOSE=ON -DCMAKE_C_FLAGS=-O0 -DCMAKE_CXX_FLAGS=-O0"
|
||||
},
|
||||
{
|
||||
"compiler": ["clang"],
|
||||
"build_type": ["Debug"],
|
||||
|
||||
2
.github/workflows/check-pr-description.yml
vendored
2
.github/workflows/check-pr-description.yml
vendored
@@ -23,7 +23,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
|
||||
- name: Write PR body to file
|
||||
env:
|
||||
|
||||
6
.github/workflows/check-tools.yml
vendored
6
.github/workflows/check-tools.yml
vendored
@@ -47,7 +47,7 @@ jobs:
|
||||
tag: ${{ steps.tag.outputs.tag }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
|
||||
- name: Read nix image tag
|
||||
id: tag
|
||||
@@ -76,10 +76,10 @@ jobs:
|
||||
container: ${{ !matrix.nix_develop && format('ghcr.io/xrplf/xrpld/nix-ubuntu:{0}', needs.linux-image-tag.outputs.tag) || null }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
|
||||
- name: Prepare runner
|
||||
uses: XRPLF/actions/prepare-runner@e4b6449d55a61c002d7c3fdfa6c20f721ede0606
|
||||
uses: XRPLF/actions/prepare-runner@c00c22ada3bd6bcda48fcb0d62fbbab49fec8a0f
|
||||
with:
|
||||
enable_ccache: false
|
||||
|
||||
|
||||
2
.github/workflows/on-pr.yml
vendored
2
.github/workflows/on-pr.yml
vendored
@@ -52,7 +52,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- name: Determine changed files
|
||||
# This step checks whether any files have changed that should
|
||||
# cause the next jobs to run. We do it this way rather than
|
||||
|
||||
6
.github/workflows/publish-docs.yml
vendored
6
.github/workflows/publish-docs.yml
vendored
@@ -41,13 +41,13 @@ env:
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
container: ghcr.io/xrplf/xrpld/nix-ubuntu:sha-40cdf49
|
||||
container: ghcr.io/xrplf/xrpld/nix-ubuntu:sha-fecfc0c
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
|
||||
- name: Prepare runner
|
||||
uses: XRPLF/actions/prepare-runner@e4b6449d55a61c002d7c3fdfa6c20f721ede0606
|
||||
uses: XRPLF/actions/prepare-runner@c00c22ada3bd6bcda48fcb0d62fbbab49fec8a0f
|
||||
with:
|
||||
enable_ccache: false
|
||||
|
||||
|
||||
23
.github/workflows/reusable-build-test-config.yml
vendored
23
.github/workflows/reusable-build-test-config.yml
vendored
@@ -3,6 +3,12 @@ name: Build and test configuration
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
benchmark:
|
||||
description: "Whether to smoke-run the benchmarks after testing."
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
build_only:
|
||||
description: 'Whether to only build or to build and test the code ("true", "false").'
|
||||
required: true
|
||||
@@ -110,10 +116,10 @@ jobs:
|
||||
uses: XRPLF/actions/cleanup-workspace@c7d9ce5ebb03c752a354889ecd870cadfc2b1cd4
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
|
||||
- name: Prepare runner
|
||||
uses: XRPLF/actions/prepare-runner@e4b6449d55a61c002d7c3fdfa6c20f721ede0606
|
||||
uses: XRPLF/actions/prepare-runner@c00c22ada3bd6bcda48fcb0d62fbbab49fec8a0f
|
||||
with:
|
||||
enable_ccache: ${{ inputs.ccache_enabled }}
|
||||
|
||||
@@ -266,7 +272,7 @@ jobs:
|
||||
./xrpld --definitions | python3 -m json.tool >server_definitions.json
|
||||
|
||||
- name: Upload server definitions
|
||||
if: ${{ github.event.repository.visibility == 'public' && inputs.config_name == 'debian-gcc-release-amd64' }}
|
||||
if: ${{ github.event.repository.visibility == 'public' && inputs.config_name == 'ubuntu-gcc-debug-amd64-coverage' }}
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: server-definitions
|
||||
@@ -328,11 +334,14 @@ jobs:
|
||||
|
||||
# Smoke-run every benchmark module with a single repetition to confirm the
|
||||
# benchmarks still build and execute. This is a correctness check, not a
|
||||
# performance measurement, so it is skipped for instrumented builds
|
||||
# (sanitizers/coverage/voidstar), where it would be slow and meaningless,
|
||||
# and on Windows, where the `install` target does not build them.
|
||||
# performance measurement, so there is nothing to gain from repeating it
|
||||
# across configurations: it is opted into by a single config in the
|
||||
# strategy matrix (see the 'benchmark' flag in the JSON files), which
|
||||
# keeps it off instrumented builds (sanitizers/coverage/voidstar), where
|
||||
# it would be slow and meaningless, off Debug builds, where it is much
|
||||
# slower, and off Windows, where the `install` target does not build them.
|
||||
- name: Run the benchmarks
|
||||
if: ${{ !inputs.build_only && runner.os != 'Windows' && env.SANITIZERS_ENABLED == 'false' && env.COVERAGE_ENABLED != 'true' && env.VOIDSTAR_ENABLED != 'true' }}
|
||||
if: ${{ inputs.benchmark }}
|
||||
working-directory: ${{ env.BUILD_DIR }}
|
||||
run: |
|
||||
rc=0
|
||||
|
||||
1
.github/workflows/reusable-build-test.yml
vendored
1
.github/workflows/reusable-build-test.yml
vendored
@@ -40,6 +40,7 @@ jobs:
|
||||
fail-fast: ${{ github.event_name == 'merge_group' }}
|
||||
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
|
||||
with:
|
||||
benchmark: ${{ matrix.benchmark }}
|
||||
build_only: ${{ matrix.build_only }}
|
||||
build_type: ${{ matrix.build_type }}
|
||||
ccache_enabled: ${{ inputs.ccache_enabled }}
|
||||
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- name: Check levelization
|
||||
run: python .github/scripts/levelization/generate.py
|
||||
- name: Check for differences
|
||||
|
||||
2
.github/workflows/reusable-check-rename.yml
vendored
2
.github/workflows/reusable-check-rename.yml
vendored
@@ -18,7 +18,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- name: Check definitions
|
||||
run: .github/scripts/rename/definitions.sh .
|
||||
- name: Check copyright notices
|
||||
|
||||
8
.github/workflows/reusable-clang-tidy.yml
vendored
8
.github/workflows/reusable-clang-tidy.yml
vendored
@@ -34,16 +34,16 @@ jobs:
|
||||
needs: [determine-files]
|
||||
if: ${{ needs.determine-files.outputs.cpp_changed_files != '' || needs.determine-files.outputs.need_full_run == 'true' }}
|
||||
runs-on: ["self-hosted", "Linux", "X64", "heavy"]
|
||||
container: "ghcr.io/xrplf/xrpld/nix-debian:sha-40cdf49"
|
||||
container: "ghcr.io/xrplf/xrpld/nix-debian:sha-fecfc0c"
|
||||
permissions:
|
||||
contents: read
|
||||
issues: write
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
|
||||
- name: Prepare runner
|
||||
uses: XRPLF/actions/prepare-runner@e4b6449d55a61c002d7c3fdfa6c20f721ede0606
|
||||
uses: XRPLF/actions/prepare-runner@c00c22ada3bd6bcda48fcb0d62fbbab49fec8a0f
|
||||
with:
|
||||
enable_ccache: false
|
||||
|
||||
@@ -95,7 +95,7 @@ jobs:
|
||||
TARGETS: ${{ needs.determine-files.outputs.need_full_run != 'true' && needs.determine-files.outputs.cpp_changed_files || 'include src tests' }}
|
||||
run: |
|
||||
set -o pipefail
|
||||
run-clang-tidy -j ${{ steps.nproc.outputs.nproc }} -p "${BUILD_DIR}" -quiet -fix -allow-no-checks ${TARGETS} 2>&1 | tee "${OUTPUT_FILE}"
|
||||
run-clang-tidy -j ${{ steps.nproc.outputs.nproc }} -p "${BUILD_DIR}" -quiet -fix -format -allow-no-checks ${TARGETS} 2>&1 | tee "${OUTPUT_FILE}"
|
||||
|
||||
- name: Print filtered clang-tidy errors
|
||||
if: ${{ steps.run_clang_tidy.outcome != 'success' }}
|
||||
|
||||
4
.github/workflows/reusable-package.yml
vendored
4
.github/workflows/reusable-package.yml
vendored
@@ -27,7 +27,7 @@ jobs:
|
||||
matrix: ${{ steps.generate.outputs.matrix }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
||||
@@ -54,7 +54,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
|
||||
- name: Download pre-built binary
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
||||
|
||||
@@ -23,7 +23,7 @@ jobs:
|
||||
matrix: ${{ steps.generate.outputs.matrix }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
||||
|
||||
4
.github/workflows/reusable-upload-recipe.yml
vendored
4
.github/workflows/reusable-upload-recipe.yml
vendored
@@ -40,14 +40,14 @@ defaults:
|
||||
jobs:
|
||||
upload:
|
||||
runs-on: ubuntu-latest
|
||||
container: ghcr.io/xrplf/xrpld/nix-ubuntu:sha-40cdf49
|
||||
container: ghcr.io/xrplf/xrpld/nix-ubuntu:sha-fecfc0c
|
||||
env:
|
||||
REMOTE_NAME: ${{ inputs.remote_name }}
|
||||
CONAN_LOGIN_USERNAME_XRPLF: ${{ secrets.remote_username }}
|
||||
CONAN_PASSWORD_XRPLF: ${{ secrets.remote_password }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
|
||||
- name: Generate build version number
|
||||
id: version
|
||||
|
||||
4
.github/workflows/upload-conan-deps.yml
vendored
4
.github/workflows/upload-conan-deps.yml
vendored
@@ -65,10 +65,10 @@ jobs:
|
||||
uses: XRPLF/actions/cleanup-workspace@c7d9ce5ebb03c752a354889ecd870cadfc2b1cd4
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
|
||||
- name: Prepare runner
|
||||
uses: XRPLF/actions/prepare-runner@e4b6449d55a61c002d7c3fdfa6c20f721ede0606
|
||||
uses: XRPLF/actions/prepare-runner@c00c22ada3bd6bcda48fcb0d62fbbab49fec8a0f
|
||||
with:
|
||||
enable_ccache: false
|
||||
|
||||
|
||||
@@ -28,6 +28,8 @@ This section contains changes targeting a future version.
|
||||
|
||||
### Additions
|
||||
|
||||
- `server_info` (admin): The `node_size` field has been removed along with the deprecated `[node_size]` config setting it reported. Admin responses now include `memory_limit`, the cache memory budget in gigabytes (0 when enforcement is disabled).
|
||||
|
||||
- `account_tx`: Added an optional `delegate` request object to filter delegated transactions. The object requires `delegate_filter`, which must be either `actor` for transactions owned by the requested account but signed by another account, or `authorizer` for transactions signed by the requested account on behalf of another account. The optional `counter_party` account narrows the results to a specific signer/delegate for `actor` or a specific owner/delegator for `authorizer`. Malformed `delegate`, `delegate_filter`, and `counter_party` values return standard invalid field errors, and invalid account IDs return `actMalformed`.
|
||||
When paginating delegate-filtered queries, a marker from a delegate-filtered query includes a `delegate` flag and is only valid for follow-up requests that also supply `delegate` (mixing marker conventions returns `invalidParams`). Because filtering is applied after the ledger scan, a page may contain fewer results than `limit` (possibly zero) while still returning a marker, so callers must continue until no marker is present.
|
||||
|
||||
|
||||
2
BUILD.md
2
BUILD.md
@@ -42,6 +42,8 @@ Our Linux CI tooling is distro-independent and uses a Nix-based environment, so
|
||||
### macOS
|
||||
|
||||
Many `xrpld` engineers use macOS for development.
|
||||
The minimum supported version is macOS 15 (Sequoia).
|
||||
CI testing is done in macOS 26 (Tahoe), but the build defaults `CMAKE_OSX_DEPLOYMENT_TARGET` to 15.
|
||||
|
||||
### Windows
|
||||
|
||||
|
||||
@@ -13,6 +13,23 @@ if(DEFINED CMAKE_MODULE_PATH)
|
||||
endif()
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
|
||||
# Must be set before project() because project() consumes it when configuring the compiler and SDK.
|
||||
# A user-provided -DCMAKE_OSX_DEPLOYMENT_TARGET still takes precedence.
|
||||
#
|
||||
# CMAKE_SYSTEM_NAME can't be used before project(), so CMAKE_HOST_SYSTEM_NAME is used instead.
|
||||
#
|
||||
# When CMAKE_OSX_DEPLOYMENT_TARGET is bumped to >=26.0, FastFloat dependency won't be needed anymore
|
||||
if(
|
||||
CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin"
|
||||
AND NOT DEFINED CMAKE_OSX_DEPLOYMENT_TARGET
|
||||
)
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET
|
||||
"15.0"
|
||||
CACHE STRING
|
||||
"Minimum macOS deployment version"
|
||||
)
|
||||
endif()
|
||||
|
||||
project(xrpl)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
@@ -87,6 +104,7 @@ include(deps/Boost)
|
||||
add_subdirectory(external/antithesis-sdk)
|
||||
find_package(date REQUIRED)
|
||||
find_package(ed25519 REQUIRED)
|
||||
find_package(FastFloat REQUIRED)
|
||||
find_package(gRPC REQUIRED)
|
||||
find_package(LibArchive REQUIRED)
|
||||
find_package(lz4 REQUIRED)
|
||||
@@ -102,6 +120,7 @@ target_link_libraries(
|
||||
xrpl_libs
|
||||
INTERFACE
|
||||
ed25519::ed25519
|
||||
FastFloat::fast_float
|
||||
lz4::lz4
|
||||
mpt-crypto::mpt-crypto
|
||||
OpenSSL::Crypto
|
||||
|
||||
@@ -348,12 +348,14 @@ run-clang-tidy -p build -allow-no-checks src tests
|
||||
```
|
||||
|
||||
This will check all source files in the `src`, `include` and `tests` directories using the compile commands from your `build` directory.
|
||||
If you wish to automatically fix whatever clang-tidy finds _and_ is capable of fixing, add `-fix` to the above command:
|
||||
If you wish to automatically fix whatever clang-tidy finds _and_ is capable of fixing, add `-fix -format` to the above command:
|
||||
|
||||
```
|
||||
run-clang-tidy -p build -quiet -fix -allow-no-checks src tests
|
||||
run-clang-tidy -p build -quiet -fix -format -allow-no-checks src tests
|
||||
```
|
||||
|
||||
`-format` reformats the fixed code with [`.clang-format`](./.clang-format); without it the fixes are inserted in LLVM style and the `clang-format` hook rewrites them afterwards.
|
||||
|
||||
## Contracts and instrumentation
|
||||
|
||||
We are using [Antithesis](https://antithesis.com/) for continuous fuzzing,
|
||||
|
||||
@@ -144,7 +144,11 @@ def main():
|
||||
+ files
|
||||
)
|
||||
canonicalize_fix_paths(Path(fixes_dir))
|
||||
applied = subprocess.run([clang_apply_replacements, fixes_dir])
|
||||
# `FormatStyle` in .clang-tidy does not reach this path,
|
||||
# so ask for the repository style here.
|
||||
applied = subprocess.run(
|
||||
[clang_apply_replacements, "--format", "--style=file", fixes_dir]
|
||||
)
|
||||
|
||||
return result.returncode or applied.returncode
|
||||
|
||||
|
||||
@@ -1306,23 +1306,40 @@
|
||||
#
|
||||
# [node_size]
|
||||
#
|
||||
# Tunes the servers based on the expected load and available memory. Legal
|
||||
# sizes are "tiny", "small", "medium", "large", and "huge". We recommend
|
||||
# you start at the default and raise the setting if you have extra memory.
|
||||
# DEPRECATED. Each size is now an alias for a [memory_limit] value:
|
||||
# tiny = 4, small = 8, medium = 32, large = 64, huge = 128. Set
|
||||
# [memory_limit] instead; setting this logs a warning at startup.
|
||||
#
|
||||
# The code attempts to automatically determine the appropriate size for
|
||||
# this parameter based on the amount of RAM and the number of execution
|
||||
# cores available to the server. The current decision matrix is:
|
||||
# [memory_limit]
|
||||
#
|
||||
# | | Cores |
|
||||
# |---------|------------------------|
|
||||
# | RAM | 1 | 2 or 3 | ≥ 4 |
|
||||
# |---------|------|--------|--------|
|
||||
# | < ~8GB | tiny | tiny | tiny |
|
||||
# | < ~12GB | tiny | small | small |
|
||||
# | < ~16GB | tiny | small | medium |
|
||||
# | < ~24GB | tiny | small | large |
|
||||
# | < ~32GB | tiny | small | huge |
|
||||
# The memory budget, in gigabytes, that the server sizes its caches
|
||||
# within. Cache sizes scale with the budget; the SHAMap tree node cache
|
||||
# is capped to fit within half of it, enforced as it grows. Defaults to
|
||||
# detected physical RAM (capped by the container limit when one is set);
|
||||
# 0 selects minimal sizes with no enforcement. Values above 1024 are
|
||||
# rejected, and a value above detected RAM logs a warning.
|
||||
# Set this when xrpld shares the machine with other services or runs in
|
||||
# a container with a memory limit below the host's RAM. Thread counts
|
||||
# are unrelated: they come from the core count and the [workers] /
|
||||
# [io_workers] overrides.
|
||||
#
|
||||
# Example:
|
||||
# memory_limit = 16
|
||||
#
|
||||
# [tree_cache_age]
|
||||
#
|
||||
# Seconds a SHAMap tree node stays cached after its last use. The default
|
||||
# is 300. Accepted values are 10 to 3600.
|
||||
#
|
||||
# [ledger_cache_age]
|
||||
#
|
||||
# Seconds a full ledger stays in the ledger cache after its last use. The
|
||||
# default is 180. Accepted values are 10 to 3600.
|
||||
#
|
||||
# [ledger_fetch_size]
|
||||
#
|
||||
# How many historical ledgers to acquire per fetch pass while backfilling.
|
||||
# The default is 4. Accepted values are 1 to 16.
|
||||
#
|
||||
# [signing_support]
|
||||
#
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
include_guard()
|
||||
|
||||
include(isolate_headers)
|
||||
|
||||
# Define a benchmark executable for the module `name`.
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
"jemalloc/5.3.1#1fc58d55316041f10fbc1e8a2eae632a%1776700028.228",
|
||||
"gtest/1.17.0#5224b3b3ff3b4ce1133cbdd27d53ee7d%1782392402.791979",
|
||||
"grpc/1.81.1#f729f6d75992d20f9c72828e9142d62f%1783945160.094135",
|
||||
"fast_float/8.2.10#f6f28d6bb22112078e7dbda611caf681%1782494504.298",
|
||||
"ed25519/2015.03#ae761bdc52730a843f0809bdf6c1b1f6%1782307148.15562",
|
||||
"date/3.0.4#862e11e80030356b53c2c38599ceb32b%1782392402.538492",
|
||||
"c-ares/1.34.6#545240bb1c40e2cacd4362d6b8967650%1782392402.681654",
|
||||
@@ -34,7 +35,7 @@
|
||||
"protobuf/6.33.5#ff253ead763bd8d9904a52979cd21e81%1782392410.233933",
|
||||
"nasm/2.16.01#31e26f2ee3c4346ecd347911bd126904%1782395690.33162",
|
||||
"msys2/cci.latest#d22fe7b2808f5fd34d0a7923ace9c54f%1770657326.649",
|
||||
"m4/1.4.19#34c4bbc3eeebe98ca6edf2f52d602e7d%1777282960.259",
|
||||
"m4/1.4.19#1727f439cf74e83826ec96d0b4904eee%1784541921.659",
|
||||
"cmake/4.3.3#840cf00ea09777e05c2050a50a82c722%1782392418.696091",
|
||||
"b2/5.4.2#ffd6084a119587e70f11cd45d1a386e2%1782392402.624226",
|
||||
"automake/1.16.5#b91b7c384c3deaa9d535be02da14d04f%1755524470.56",
|
||||
|
||||
@@ -5,6 +5,13 @@
|
||||
{% if os == "Linux" %}
|
||||
{% set compiler_version = detect_api.default_compiler_version(compiler, version) %}
|
||||
{% endif %}
|
||||
{% if os == "Macos" %}
|
||||
{# Minimum macOS the dependencies target. #}
|
||||
{# Without this, Conan builds each dependency against the (possibly newer) host SDK, so the #}
|
||||
{# dependency objects target a newer macOS than the binary and the linker warns. #}
|
||||
{# Keep at or below CMAKE_OSX_DEPLOYMENT_TARGET in CMakeLists.txt. #}
|
||||
{% set min_macos_version = "15.0" %}
|
||||
{% endif %}
|
||||
|
||||
[settings]
|
||||
os={{ os }}
|
||||
@@ -18,6 +25,9 @@ compiler.runtime=static
|
||||
{% else %}
|
||||
compiler.libcxx={{ detect_api.detect_libcxx(compiler, version, compiler_exe) }}
|
||||
{% endif %}
|
||||
{% if os == "Macos" %}
|
||||
os.version={{ min_macos_version }}
|
||||
{% endif %}
|
||||
|
||||
[conf]
|
||||
{# The Boost recipe builds with b2, which doesn't use Conan's toolchain files. #}
|
||||
@@ -41,3 +51,13 @@ tools.build:compiler_executables={'c':'{{ cc_exe }}','cpp':'{{ cxx_exe }}'}
|
||||
{# More info: https://docs.conan.io/2/reference/extensions/binary_compatibility.html #}
|
||||
user.package:cppstd_version=23
|
||||
tools.info.package_id:confs+=["user.package:cppstd_version"]
|
||||
|
||||
{% if os == "Macos" %}
|
||||
[buildenv]
|
||||
{# os.version adds -mmacosx-version-min to compiler command lines, #}
|
||||
{# but Boost.Context's b2 assembly (.S) rule ignores it, #}
|
||||
{# so those objects keep the host SDK version and still warn at link time. #}
|
||||
{# clang's assembler honors this env var regardless, pinning them. #}
|
||||
{# Scoped to boost/* since it is the only gap. #}
|
||||
boost/*:MACOSX_DEPLOYMENT_TARGET={{ min_macos_version }}
|
||||
{% endif %}
|
||||
|
||||
@@ -29,6 +29,7 @@ class Xrpl(ConanFile):
|
||||
|
||||
requires = [
|
||||
"ed25519/2015.03",
|
||||
"fast_float/8.2.10",
|
||||
"grpc/1.81.1",
|
||||
"libarchive/3.8.7",
|
||||
"nudb/2.0.9",
|
||||
@@ -211,6 +212,7 @@ class Xrpl(ConanFile):
|
||||
"boost::thread",
|
||||
"date::date",
|
||||
"ed25519::ed25519",
|
||||
"fast_float::fast_float",
|
||||
"grpc::grpc++",
|
||||
"libarchive::libarchive",
|
||||
"lz4::lz4",
|
||||
|
||||
72
docs/build/nix_troubleshooting.md
vendored
72
docs/build/nix_troubleshooting.md
vendored
@@ -3,6 +3,78 @@
|
||||
Common issues encountered when using the [Nix development shell](./nix.md), and
|
||||
how to resolve them.
|
||||
|
||||
## `command not found: nix` after a macOS update
|
||||
|
||||
If a shell suddenly can't find `nix` at all:
|
||||
|
||||
```
|
||||
$ nix develop
|
||||
zsh: command not found: nix
|
||||
```
|
||||
|
||||
then Nix is almost certainly still installed — only the shell hook that puts it
|
||||
on your `PATH` is gone. Confirm that first:
|
||||
|
||||
```bash
|
||||
ls -l /nix/var/nix/profiles/default/bin/nix
|
||||
```
|
||||
|
||||
If that exists, the installation is fine and this is purely a `PATH` problem.
|
||||
|
||||
### Why it happens
|
||||
|
||||
The installer does not touch your dotfiles. Instead it sources a setup script
|
||||
from the Nix store by editing **system-wide** rc files:
|
||||
|
||||
| Shell | File the installer edits |
|
||||
| ----- | ------------------------------------- |
|
||||
| bash | `/etc/bashrc`, `/etc/bash.bashrc` |
|
||||
| zsh | `/etc/zshrc` |
|
||||
| fish | `$__fish_sysconf_dir/conf.d/nix.fish` |
|
||||
|
||||
macOS manages `/etc/zshrc`, so an OS update can replace it with the vendor copy
|
||||
and silently drop the Nix block. `/etc/bashrc` and the fish file usually survive,
|
||||
which is why the breakage often shows up in zsh only. You can verify this by
|
||||
diffing against the backup the installer left behind:
|
||||
|
||||
```bash
|
||||
diff /etc/zshrc /etc/zshrc.backup-before-nix
|
||||
```
|
||||
|
||||
If they are identical, the Nix snippet was wiped. This is upstream issue
|
||||
[NixOS/nix#3616](https://github.com/NixOS/nix/issues/3616).
|
||||
|
||||
### Fix
|
||||
|
||||
To unblock the current shell:
|
||||
|
||||
```bash
|
||||
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
|
||||
```
|
||||
|
||||
For a permanent fix, add the snippet to your **user** rc file rather than
|
||||
restoring `/etc/zshrc` — user dotfiles are not clobbered by OS updates:
|
||||
|
||||
```bash
|
||||
cat >>~/.zshrc <<'EOF'
|
||||
|
||||
# Nix
|
||||
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
|
||||
. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
|
||||
fi
|
||||
# End Nix
|
||||
EOF
|
||||
```
|
||||
|
||||
The scripts guard against double-sourcing via `__ETC_PROFILE_NIX_SOURCED`, so
|
||||
this is safe even if a system-wide hook is later restored.
|
||||
|
||||
> [!NOTE]
|
||||
> `/etc/zshrc` and `~/.zshrc` are only read by **interactive** zsh. If the
|
||||
> snippet is present but `zsh -c '…'`, a script, or an IDE terminal still can't
|
||||
> find `nix`, that shell is non-interactive — put the snippet in `~/.zshenv`
|
||||
> instead.
|
||||
|
||||
## Git worktrees
|
||||
|
||||
If `nix develop` fails with an error like:
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace xrpl {
|
||||
class Resolver
|
||||
{
|
||||
public:
|
||||
using HandlerType = std::function<void(std::string, std::vector<beast::IP::Endpoint>)>;
|
||||
using HandlerType = std::function<void(std::string, std::vector<beast::ip::Endpoint>)>;
|
||||
|
||||
virtual ~Resolver() = 0;
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
@@ -251,4 +252,11 @@ makeSlice(std::basic_string<char, Traits, Alloc> const& s)
|
||||
return Slice(s.data(), s.size());
|
||||
}
|
||||
|
||||
template <class Traits>
|
||||
Slice
|
||||
makeSlice(std::basic_string_view<char, Traits> s)
|
||||
{
|
||||
return Slice(s.data(), s.size());
|
||||
}
|
||||
|
||||
} // namespace xrpl
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <type_traits>
|
||||
@@ -74,13 +75,35 @@ public:
|
||||
using shared_pointer_type = SharedPointerType;
|
||||
|
||||
public:
|
||||
/**
|
||||
* A byte budget for the strongly-cached entries. Each entry is charged
|
||||
* `cost(ptr)` bytes when it becomes strong; growth past `bytes` evicts
|
||||
* like the entry cap. The cost should include the value's heap payload
|
||||
* plus per-entry overhead.
|
||||
*/
|
||||
struct ByteBudget
|
||||
{
|
||||
std::size_t bytes = 0;
|
||||
std::function<std::size_t(SharedPointerType const&)> cost;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param cacheHardCap When positive, a hard upper bound on the number of
|
||||
* strongly-cached entries, enforced by demoting the approximately
|
||||
* oldest entry whenever growth would exceed it. 0 disables the cap
|
||||
* (the periodic sweep alone bounds the cache).
|
||||
* @param byteBudget When set, a hard upper bound on the charged bytes of
|
||||
* strongly-cached entries, enforced the same way.
|
||||
*/
|
||||
TaggedCache(
|
||||
std::string const& name,
|
||||
int size,
|
||||
clock_type::duration expiration,
|
||||
clock_type& clock,
|
||||
beast::Journal journal,
|
||||
beast::insight::Collector::ptr const& collector = beast::insight::NullCollector::make());
|
||||
beast::insight::Collector::ptr const& collector = beast::insight::NullCollector::make(),
|
||||
int cacheHardCap = 0,
|
||||
std::optional<ByteBudget> byteBudget = std::nullopt);
|
||||
|
||||
public:
|
||||
/**
|
||||
@@ -101,6 +124,13 @@ public:
|
||||
int
|
||||
getTrackSize() const;
|
||||
|
||||
/**
|
||||
* Returns the charged bytes of strongly-cached entries; 0 unless a
|
||||
* byte budget with a cost function is configured.
|
||||
*/
|
||||
std::size_t
|
||||
getCacheBytes() const;
|
||||
|
||||
float
|
||||
getHitRate();
|
||||
|
||||
@@ -315,6 +345,10 @@ private:
|
||||
shared_weak_combo_pointer_type ptr;
|
||||
clock_type::time_point lastAccess;
|
||||
|
||||
// Bytes charged against the byte budget while strong; 0 when weak
|
||||
// or when no budget is configured.
|
||||
std::uint32_t costBytes{0};
|
||||
|
||||
ValueEntry(clock_type::time_point const& lastAccess, shared_pointer_type const& ptr)
|
||||
: ptr(ptr), lastAccess(lastAccess)
|
||||
{
|
||||
@@ -357,6 +391,13 @@ private:
|
||||
|
||||
using cache_type = hardened_partitioned_hash_map<key_type, Entry, Hash, KeyEqual>;
|
||||
|
||||
// Bounded approximate-LRU eviction from a single partition. Keeps the
|
||||
// strong-entry count at/below cacheHardCap_ as new entries are inserted, so
|
||||
// a burst can't drive the cache past its RAM budget between timer sweeps.
|
||||
// No-op unless cacheHardCap_ > 0 (opt-in); caller holds mutex_.
|
||||
void
|
||||
evictForHardCap(cache_type::map_type& partition, cache_type::map_type::iterator const& keep);
|
||||
|
||||
[[nodiscard]] std::thread
|
||||
sweepHelper(
|
||||
clock_type::time_point const& whenExpire,
|
||||
@@ -364,6 +405,7 @@ private:
|
||||
KeyValueCacheType::map_type& partition,
|
||||
SweptPointersVector& stuffToSweep,
|
||||
std::atomic<int>& allRemovals,
|
||||
std::atomic<std::uint64_t>& allBytesRemoved,
|
||||
std::scoped_lock<std::recursive_mutex> const&);
|
||||
|
||||
[[nodiscard]] std::thread
|
||||
@@ -373,6 +415,7 @@ private:
|
||||
KeyOnlyCacheType::map_type& partition,
|
||||
SweptPointersVector&,
|
||||
std::atomic<int>& allRemovals,
|
||||
std::atomic<std::uint64_t>& allBytesRemoved,
|
||||
std::scoped_lock<std::recursive_mutex> const&);
|
||||
|
||||
beast::Journal journal_;
|
||||
@@ -390,8 +433,41 @@ private:
|
||||
// Desired maximum cache age
|
||||
clock_type::duration const targetAge_;
|
||||
|
||||
// Hard upper bound on strongly-cached entries, enforced by
|
||||
// evictForHardCap whenever the strong count grows (fresh inserts and
|
||||
// weak-to-strong revivals). 0 disables it (sweep-only sizing).
|
||||
int const cacheHardCap_;
|
||||
|
||||
// Byte-denominated bound on strongly-cached entries, enforced the same
|
||||
// way; each entry is charged by the budget's cost function while strong.
|
||||
std::optional<ByteBudget> const byteBudget_;
|
||||
|
||||
// Charged bytes of strongly-cached entries (under mutex_).
|
||||
std::size_t cacheBytes_{0};
|
||||
|
||||
// Total hard-cap evictions (under mutex_); the first marks saturation
|
||||
// onset for logging.
|
||||
std::uint64_t hardCapEvictions_{0};
|
||||
|
||||
// Number of items cached
|
||||
int cacheCount_{0};
|
||||
|
||||
// Charge or release an entry's bytes against the byte budget. No-ops
|
||||
// without a configured budget; callers hold mutex_.
|
||||
void
|
||||
chargeEntry(ValueEntry& entry, SharedPointerType const& ptr);
|
||||
void
|
||||
dischargeEntry(ValueEntry& entry);
|
||||
|
||||
// True when either the entry cap or the byte budget is exceeded.
|
||||
[[nodiscard]] bool
|
||||
overHardCap() const;
|
||||
|
||||
// Rotating bucket cursor for evictForHardCap so successive over-cap
|
||||
// evictions sweep the whole partition (CLOCK hand) instead of repeatedly
|
||||
// sampling the head buckets. Advanced under mutex_.
|
||||
std::size_t evictHand_{0};
|
||||
|
||||
cache_type cache_; // Hold strong reference to recent objects
|
||||
std::uint64_t hits_{0};
|
||||
std::uint64_t misses_{0};
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <xrpl/basics/scope.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <limits>
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
@@ -57,7 +58,9 @@ inline TaggedCache<
|
||||
clock_type::duration expiration,
|
||||
clock_type& clock,
|
||||
beast::Journal journal,
|
||||
beast::insight::Collector::ptr const& collector)
|
||||
beast::insight::Collector::ptr const& collector,
|
||||
int cacheHardCap,
|
||||
std::optional<ByteBudget> byteBudget)
|
||||
: journal_(journal)
|
||||
, clock_(clock)
|
||||
, stats_(
|
||||
@@ -67,9 +70,66 @@ inline TaggedCache<
|
||||
, name_(name)
|
||||
, targetSize_(size)
|
||||
, targetAge_(expiration)
|
||||
, cacheHardCap_(cacheHardCap)
|
||||
, byteBudget_(std::move(byteBudget))
|
||||
{
|
||||
}
|
||||
|
||||
template <
|
||||
class Key,
|
||||
class T,
|
||||
bool IsKeyCache,
|
||||
class SharedWeakUnionPointer,
|
||||
class SharedPointerType,
|
||||
class Hash,
|
||||
class KeyEqual,
|
||||
class Mutex>
|
||||
inline void
|
||||
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||
chargeEntry(ValueEntry& entry, SharedPointerType const& ptr)
|
||||
{
|
||||
if (byteBudget_ && byteBudget_->cost)
|
||||
{
|
||||
entry.costBytes = static_cast<std::uint32_t>(std::min<std::size_t>(
|
||||
byteBudget_->cost(ptr), std::numeric_limits<std::uint32_t>::max()));
|
||||
cacheBytes_ += entry.costBytes;
|
||||
}
|
||||
}
|
||||
|
||||
template <
|
||||
class Key,
|
||||
class T,
|
||||
bool IsKeyCache,
|
||||
class SharedWeakUnionPointer,
|
||||
class SharedPointerType,
|
||||
class Hash,
|
||||
class KeyEqual,
|
||||
class Mutex>
|
||||
inline void
|
||||
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||
dischargeEntry(ValueEntry& entry)
|
||||
{
|
||||
cacheBytes_ -= entry.costBytes;
|
||||
entry.costBytes = 0;
|
||||
}
|
||||
|
||||
template <
|
||||
class Key,
|
||||
class T,
|
||||
bool IsKeyCache,
|
||||
class SharedWeakUnionPointer,
|
||||
class SharedPointerType,
|
||||
class Hash,
|
||||
class KeyEqual,
|
||||
class Mutex>
|
||||
inline bool
|
||||
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||
overHardCap() const
|
||||
{
|
||||
return (cacheHardCap_ > 0 && cacheCount_ > cacheHardCap_) ||
|
||||
(byteBudget_ && cacheBytes_ > byteBudget_->bytes);
|
||||
}
|
||||
|
||||
template <
|
||||
class Key,
|
||||
class T,
|
||||
@@ -120,6 +180,23 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
|
||||
return cacheCount_;
|
||||
}
|
||||
|
||||
template <
|
||||
class Key,
|
||||
class T,
|
||||
bool IsKeyCache,
|
||||
class SharedWeakUnionPointer,
|
||||
class SharedPointerType,
|
||||
class Hash,
|
||||
class KeyEqual,
|
||||
class Mutex>
|
||||
inline std::size_t
|
||||
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||
getCacheBytes() const
|
||||
{
|
||||
std::scoped_lock const lock(mutex_);
|
||||
return cacheBytes_;
|
||||
}
|
||||
|
||||
template <
|
||||
class Key,
|
||||
class T,
|
||||
@@ -171,6 +248,7 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
|
||||
std::scoped_lock const lock(mutex_);
|
||||
cache_.clear();
|
||||
cacheCount_ = 0;
|
||||
cacheBytes_ = 0;
|
||||
}
|
||||
|
||||
template <
|
||||
@@ -189,6 +267,7 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
|
||||
std::scoped_lock const lock(mutex_);
|
||||
cache_.clear();
|
||||
cacheCount_ = 0;
|
||||
cacheBytes_ = 0;
|
||||
hits_ = 0;
|
||||
misses_ = 0;
|
||||
}
|
||||
@@ -219,6 +298,102 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
|
||||
return true;
|
||||
}
|
||||
|
||||
template <
|
||||
class Key,
|
||||
class T,
|
||||
bool IsKeyCache,
|
||||
class SharedWeakUnionPointer,
|
||||
class SharedPointerType,
|
||||
class Hash,
|
||||
class KeyEqual,
|
||||
class Mutex>
|
||||
inline void
|
||||
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||
evictForHardCap(cache_type::map_type& partition, cache_type::map_type::iterator const& keep)
|
||||
{
|
||||
// Caller holds mutex_. Only value caches carry strong/weak entries; key
|
||||
// caches never enable the hard cap, so this is a no-op for them.
|
||||
if constexpr (!IsKeyCache)
|
||||
{
|
||||
std::size_t const bucketCount = partition.bucket_count();
|
||||
if (bucketCount == 0)
|
||||
return;
|
||||
|
||||
// Approximate LRU with bounded work per call: sample a window of
|
||||
// strong entries starting at the rotating bucket cursor and demote
|
||||
// the oldest, repeating until the count is back under the cap or the
|
||||
// demotion budget is spent. Growth paths raise the count by one at a
|
||||
// time, so the budget lets eviction catch up without stalling them.
|
||||
constexpr int kEvictSampleBudget = 64;
|
||||
constexpr int kMaxDemotionsPerCall = 8;
|
||||
std::size_t const maxBuckets = std::min<std::size_t>(bucketCount, 4 * kEvictSampleBudget);
|
||||
|
||||
for (int demotions = 0; overHardCap() && demotions < kMaxDemotionsPerCall; ++demotions)
|
||||
{
|
||||
int sampled = 0;
|
||||
std::size_t bucketsWalked = 0;
|
||||
key_type oldestKey{};
|
||||
bool haveOldest = false;
|
||||
clock_type::time_point oldestAccess{};
|
||||
|
||||
std::size_t b = evictHand_ % bucketCount;
|
||||
while (sampled < kEvictSampleBudget && bucketsWalked < maxBuckets)
|
||||
{
|
||||
for (auto lit = partition.begin(b); lit != partition.end(b); ++lit)
|
||||
{
|
||||
if (lit->first == keep->first || lit->second.isWeak())
|
||||
continue;
|
||||
if (!haveOldest || lit->second.lastAccess < oldestAccess)
|
||||
{
|
||||
oldestAccess = lit->second.lastAccess;
|
||||
oldestKey = lit->first;
|
||||
haveOldest = true;
|
||||
}
|
||||
if (++sampled >= kEvictSampleBudget)
|
||||
break;
|
||||
}
|
||||
b = (b + 1) % bucketCount;
|
||||
++bucketsWalked;
|
||||
}
|
||||
evictHand_ = b; // resume the scan here on the next over-cap call
|
||||
|
||||
if (!haveOldest)
|
||||
{
|
||||
JLOG(journal_.debug()) << name_ << ": over hard cap " << cacheHardCap_
|
||||
<< " but eviction sample found no strong entry to demote";
|
||||
return;
|
||||
}
|
||||
|
||||
auto oldest = partition.find(oldestKey);
|
||||
if (oldest == partition.end() || oldest == keep || oldest->second.isWeak())
|
||||
return;
|
||||
|
||||
dischargeEntry(oldest->second);
|
||||
if (oldest->second.ptr.useCount() == 1)
|
||||
{
|
||||
// Sole owner: release entirely.
|
||||
partition.erase(oldest);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Others hold it: keep it weakly tracked.
|
||||
oldest->second.ptr.convertToWeak();
|
||||
}
|
||||
--cacheCount_;
|
||||
|
||||
// First eviction marks saturation onset; then a heartbeat every
|
||||
// 100k to avoid flooding.
|
||||
++hardCapEvictions_;
|
||||
if (hardCapEvictions_ == 1 || hardCapEvictions_ % 100000 == 0)
|
||||
{
|
||||
JLOG(journal_.warn()) << name_ << ": hard-cap eviction #" << hardCapEvictions_
|
||||
<< " (cap " << cacheHardCap_ << ", strong " << cacheCount_
|
||||
<< ") - cache saturated, growth now evicts";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <
|
||||
class Key,
|
||||
class T,
|
||||
@@ -264,16 +439,24 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
|
||||
std::vector<std::thread> workers;
|
||||
workers.reserve(cache_.partitions());
|
||||
std::atomic<int> allRemovals = 0;
|
||||
std::atomic<std::uint64_t> allBytesRemoved = 0;
|
||||
|
||||
for (std::size_t p = 0; p < cache_.partitions(); ++p)
|
||||
{
|
||||
workers.push_back(sweepHelper(
|
||||
whenExpire, now, cache_.map()[p], allStuffToSweep[p], allRemovals, lock));
|
||||
whenExpire,
|
||||
now,
|
||||
cache_.map()[p],
|
||||
allStuffToSweep[p],
|
||||
allRemovals,
|
||||
allBytesRemoved,
|
||||
lock));
|
||||
}
|
||||
for (std::thread& worker : workers)
|
||||
worker.join();
|
||||
|
||||
cacheCount_ -= allRemovals;
|
||||
cacheBytes_ -= std::min<std::uint64_t>(allBytesRemoved, cacheBytes_);
|
||||
}
|
||||
// At this point allStuffToSweep will go out of scope outside the lock
|
||||
// and decrement the reference count on each strong pointer.
|
||||
@@ -312,6 +495,7 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
|
||||
if (entry.isCached())
|
||||
{
|
||||
--cacheCount_;
|
||||
dischargeEntry(entry);
|
||||
entry.ptr.convertToWeak();
|
||||
ret = true;
|
||||
}
|
||||
@@ -360,11 +544,18 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
|
||||
|
||||
if (cit == cache_.end())
|
||||
{
|
||||
cache_.emplace(
|
||||
std::piecewise_construct,
|
||||
std::forward_as_tuple(key),
|
||||
std::forward_as_tuple(clock_.now(), data));
|
||||
auto const emplacedIt = cache_
|
||||
.emplace(
|
||||
std::piecewise_construct,
|
||||
std::forward_as_tuple(key),
|
||||
std::forward_as_tuple(clock_.now(), data))
|
||||
.first;
|
||||
++cacheCount_;
|
||||
chargeEntry(emplacedIt.mit->second, data);
|
||||
// The just-inserted entry is the newest; evictForHardCap skips it
|
||||
// and drops the oldest in its partition.
|
||||
if (overHardCap())
|
||||
evictForHardCap(*emplacedIt.ait, emplacedIt.mit);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -390,7 +581,9 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
|
||||
{
|
||||
if (shouldReplaceCached())
|
||||
{
|
||||
dischargeEntry(entry);
|
||||
entry.ptr = data;
|
||||
chargeEntry(entry, data);
|
||||
}
|
||||
else if constexpr (!replaceCached)
|
||||
{
|
||||
@@ -415,11 +608,17 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
|
||||
}
|
||||
|
||||
++cacheCount_;
|
||||
chargeEntry(entry, entry.ptr.getStrong());
|
||||
if (overHardCap())
|
||||
evictForHardCap(*cit.ait, cit.mit);
|
||||
return true;
|
||||
}
|
||||
|
||||
entry.ptr = data;
|
||||
++cacheCount_;
|
||||
chargeEntry(entry, data);
|
||||
if (overHardCap())
|
||||
evictForHardCap(*cit.ait, cit.mit);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -694,8 +893,17 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
|
||||
std::scoped_lock const l(mutex_);
|
||||
++misses_;
|
||||
auto const [it, inserted] = cache_.emplace(digest, Entry(clock_.now(), std::move(sle)));
|
||||
if (!inserted)
|
||||
if (inserted)
|
||||
{
|
||||
++cacheCount_;
|
||||
chargeEntry(it.mit->second, it.mit->second.ptr.getStrong());
|
||||
if (overHardCap())
|
||||
evictForHardCap(*it.ait, it.mit);
|
||||
}
|
||||
else
|
||||
{
|
||||
it->second.touch(clock_.now());
|
||||
}
|
||||
return it->second.ptr.getStrong();
|
||||
}
|
||||
// End CachedSLEs functions.
|
||||
@@ -729,6 +937,9 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
|
||||
{
|
||||
// independent of cache size, so not counted as a hit
|
||||
++cacheCount_;
|
||||
chargeEntry(entry, entry.ptr.getStrong());
|
||||
if (overHardCap())
|
||||
evictForHardCap(*cit.ait, cit.mit);
|
||||
entry.touch(clock_.now());
|
||||
return entry.ptr.getStrong();
|
||||
}
|
||||
@@ -781,11 +992,13 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
|
||||
KeyValueCacheType::map_type& partition,
|
||||
SweptPointersVector& stuffToSweep,
|
||||
std::atomic<int>& allRemovals,
|
||||
std::atomic<std::uint64_t>& allBytesRemoved,
|
||||
std::scoped_lock<std::recursive_mutex> const&)
|
||||
{
|
||||
return std::thread([&, this]() {
|
||||
int cacheRemovals = 0;
|
||||
int mapRemovals = 0;
|
||||
std::uint64_t bytesRemoved = 0;
|
||||
|
||||
// Keep references to all the stuff we sweep
|
||||
// so that we can destroy them outside the lock.
|
||||
@@ -812,6 +1025,8 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
|
||||
{
|
||||
// strong, expired
|
||||
++cacheRemovals;
|
||||
bytesRemoved += cit->second.costBytes;
|
||||
cit->second.costBytes = 0;
|
||||
if (cit->second.ptr.useCount() == 1)
|
||||
{
|
||||
stuffToSweep.emplace_back(std::move(cit->second.ptr));
|
||||
@@ -841,6 +1056,7 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
|
||||
}
|
||||
|
||||
allRemovals += cacheRemovals;
|
||||
allBytesRemoved += bytesRemoved;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -861,6 +1077,7 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
|
||||
KeyOnlyCacheType::map_type& partition,
|
||||
SweptPointersVector&,
|
||||
std::atomic<int>& allRemovals,
|
||||
std::atomic<std::uint64_t>&,
|
||||
std::scoped_lock<std::recursive_mutex> const&)
|
||||
{
|
||||
return std::thread([&, this]() {
|
||||
|
||||
@@ -58,7 +58,7 @@ struct LexicalCast<Out, std::string_view>
|
||||
"beast::LexicalCast can only be used with integral types");
|
||||
|
||||
template <class Integral = Out>
|
||||
bool
|
||||
constexpr bool
|
||||
operator()(Integral& out, std::string_view in) const
|
||||
requires(std::is_integral_v<Integral> && !std::is_same_v<Integral, bool>)
|
||||
{
|
||||
@@ -110,7 +110,7 @@ struct LexicalCast<Out, boost::core::basic_string_view<char>>
|
||||
{
|
||||
explicit LexicalCast() = default;
|
||||
|
||||
bool
|
||||
constexpr bool
|
||||
operator()(Out& out, boost::core::basic_string_view<char> in) const
|
||||
{
|
||||
return LexicalCast<Out, std::string_view>()(out, in);
|
||||
@@ -123,7 +123,7 @@ struct LexicalCast<Out, std::string>
|
||||
{
|
||||
explicit LexicalCast() = default;
|
||||
|
||||
bool
|
||||
constexpr bool
|
||||
operator()(Out& out, std::string in) const
|
||||
{
|
||||
return LexicalCast<Out, std::string_view>()(out, in);
|
||||
@@ -136,7 +136,7 @@ struct LexicalCast<Out, char const*>
|
||||
{
|
||||
explicit LexicalCast() = default;
|
||||
|
||||
bool
|
||||
constexpr bool
|
||||
operator()(Out& out, char const* in) const
|
||||
{
|
||||
XRPL_ASSERT(in, "beast::detail::LexicalCast(char const*) : non-null input");
|
||||
@@ -151,7 +151,7 @@ struct LexicalCast<Out, char*>
|
||||
{
|
||||
explicit LexicalCast() = default;
|
||||
|
||||
bool
|
||||
constexpr bool
|
||||
operator()(Out& out, char* in) const
|
||||
{
|
||||
XRPL_ASSERT(in, "beast::detail::LexicalCast(char*) : non-null input");
|
||||
@@ -177,7 +177,7 @@ struct BadLexicalCast : public std::bad_cast
|
||||
* @return `false` if there was a parsing or range error
|
||||
*/
|
||||
template <class Out, class In>
|
||||
bool
|
||||
constexpr bool
|
||||
lexicalCastChecked(Out& out, In in)
|
||||
{
|
||||
return detail::LexicalCast<Out, In>()(out, in);
|
||||
@@ -191,7 +191,7 @@ lexicalCastChecked(Out& out, In in)
|
||||
* @return The new type.
|
||||
*/
|
||||
template <class Out, class In>
|
||||
Out
|
||||
constexpr Out
|
||||
lexicalCastThrow(In in)
|
||||
{
|
||||
if (Out out; lexicalCastChecked(out, in))
|
||||
@@ -207,7 +207,7 @@ lexicalCastThrow(In in)
|
||||
* @return The new type.
|
||||
*/
|
||||
template <class Out, class In>
|
||||
Out
|
||||
constexpr Out
|
||||
lexicalCast(In in, Out defaultValue = Out())
|
||||
{
|
||||
if (Out out; lexicalCastChecked(out, in))
|
||||
|
||||
@@ -17,14 +17,14 @@ namespace beast {
|
||||
class SemanticVersion
|
||||
{
|
||||
public:
|
||||
using identifier_list = std::vector<std::string>;
|
||||
using IdentifierList = std::vector<std::string>;
|
||||
|
||||
int majorVersion;
|
||||
int minorVersion;
|
||||
int patchVersion;
|
||||
|
||||
identifier_list preReleaseIdentifiers;
|
||||
identifier_list metaData;
|
||||
IdentifierList preReleaseIdentifiers;
|
||||
IdentifierList metaData;
|
||||
|
||||
SemanticVersion();
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
* @param journal Destination for logging output.
|
||||
*/
|
||||
static std::shared_ptr<StatsDCollector>
|
||||
make(IP::Endpoint const& address, std::string const& prefix, Journal journal);
|
||||
make(ip::Endpoint const& address, std::string const& prefix, Journal journal);
|
||||
};
|
||||
|
||||
} // namespace beast::insight
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace beast {
|
||||
namespace IP {
|
||||
namespace ip {
|
||||
|
||||
using Address = boost::asio::ip::address;
|
||||
|
||||
@@ -73,13 +73,13 @@ isPublic(Address const& addr)
|
||||
return (addr.is_v4()) ? isPublic(addr.to_v4()) : isPublic(addr.to_v6());
|
||||
}
|
||||
|
||||
} // namespace IP
|
||||
} // namespace ip
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template <class Hasher>
|
||||
void
|
||||
hash_append(Hasher& h, beast::IP::Address const& addr) noexcept
|
||||
hash_append(Hasher& h, beast::ip::Address const& addr) noexcept
|
||||
{
|
||||
using beast::hash_append;
|
||||
if (addr.is_v4())
|
||||
@@ -101,12 +101,12 @@ hash_append(Hasher& h, beast::IP::Address const& addr) noexcept
|
||||
|
||||
namespace boost {
|
||||
template <>
|
||||
struct hash<::beast::IP::Address>
|
||||
struct hash<::beast::ip::Address>
|
||||
{
|
||||
explicit hash() = default;
|
||||
|
||||
std::size_t
|
||||
operator()(::beast::IP::Address const& addr) const
|
||||
operator()(::beast::ip::Address const& addr) const
|
||||
{
|
||||
return ::beast::Uhash<>{}(addr);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
|
||||
namespace beast::IP {
|
||||
namespace beast::ip {
|
||||
|
||||
/**
|
||||
* Convert to Endpoint.
|
||||
@@ -32,7 +32,7 @@ toAsioAddress(Endpoint const& endpoint);
|
||||
boost::asio::ip::tcp::endpoint
|
||||
toAsioEndpoint(Endpoint const& endpoint);
|
||||
|
||||
} // namespace beast::IP
|
||||
} // namespace beast::ip
|
||||
|
||||
namespace beast {
|
||||
|
||||
@@ -41,25 +41,25 @@ struct IPAddressConversion
|
||||
{
|
||||
explicit IPAddressConversion() = default;
|
||||
|
||||
static IP::Endpoint
|
||||
static ip::Endpoint
|
||||
fromAsio(boost::asio::ip::address const& address)
|
||||
{
|
||||
return IP::fromAsio(address);
|
||||
return ip::fromAsio(address);
|
||||
}
|
||||
static IP::Endpoint
|
||||
static ip::Endpoint
|
||||
fromAsio(boost::asio::ip::tcp::endpoint const& endpoint)
|
||||
{
|
||||
return IP::fromAsio(endpoint);
|
||||
return ip::fromAsio(endpoint);
|
||||
}
|
||||
static boost::asio::ip::address
|
||||
toAsioAddress(IP::Endpoint const& address)
|
||||
toAsioAddress(ip::Endpoint const& address)
|
||||
{
|
||||
return IP::toAsioAddress(address);
|
||||
return ip::toAsioAddress(address);
|
||||
}
|
||||
static boost::asio::ip::tcp::endpoint
|
||||
toAsioEndpoint(IP::Endpoint const& address)
|
||||
toAsioEndpoint(ip::Endpoint const& address)
|
||||
{
|
||||
return IP::toAsioEndpoint(address);
|
||||
return ip::toAsioEndpoint(address);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include <boost/asio/ip/address_v4.hpp>
|
||||
|
||||
namespace beast::IP {
|
||||
namespace beast::ip {
|
||||
|
||||
using AddressV4 = boost::asio::ip::address_v4;
|
||||
|
||||
@@ -25,4 +25,4 @@ isPublic(AddressV4 const& addr);
|
||||
char
|
||||
getClass(AddressV4 const& address);
|
||||
|
||||
} // namespace beast::IP
|
||||
} // namespace beast::ip
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include <boost/asio/ip/address_v6.hpp>
|
||||
|
||||
namespace beast::IP {
|
||||
namespace beast::ip {
|
||||
|
||||
using AddressV6 = boost::asio::ip::address_v6;
|
||||
|
||||
@@ -18,4 +18,4 @@ isPrivate(AddressV6 const& addr);
|
||||
bool
|
||||
isPublic(AddressV6 const& addr);
|
||||
|
||||
} // namespace beast::IP
|
||||
} // namespace beast::ip
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
namespace beast::IP {
|
||||
namespace beast::ip {
|
||||
|
||||
using Port = std::uint16_t;
|
||||
|
||||
@@ -223,7 +223,7 @@ operator<<(OutputStream& os, Endpoint const& endpoint)
|
||||
std::istream&
|
||||
operator>>(std::istream& is, Endpoint& endpoint);
|
||||
|
||||
} // namespace beast::IP
|
||||
} // namespace beast::ip
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -232,12 +232,12 @@ namespace std {
|
||||
* std::hash support.
|
||||
*/
|
||||
template <>
|
||||
struct hash<::beast::IP::Endpoint>
|
||||
struct hash<::beast::ip::Endpoint>
|
||||
{
|
||||
hash() = default;
|
||||
|
||||
std::size_t
|
||||
operator()(::beast::IP::Endpoint const& endpoint) const
|
||||
operator()(::beast::ip::Endpoint const& endpoint) const
|
||||
{
|
||||
return ::beast::Uhash<>{}(endpoint);
|
||||
}
|
||||
@@ -249,12 +249,12 @@ namespace boost {
|
||||
* boost::hash support.
|
||||
*/
|
||||
template <>
|
||||
struct hash<::beast::IP::Endpoint>
|
||||
struct hash<::beast::ip::Endpoint>
|
||||
{
|
||||
hash() = default;
|
||||
|
||||
std::size_t
|
||||
operator()(::beast::IP::Endpoint const& endpoint) const
|
||||
operator()(::beast::ip::Endpoint const& endpoint) const
|
||||
{
|
||||
return ::beast::Uhash<>{}(endpoint);
|
||||
}
|
||||
|
||||
@@ -295,6 +295,20 @@ public:
|
||||
return runner_->arg();
|
||||
}
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Lets a suite compose other suites (e.g. an aggregator that reruns a
|
||||
* group of related suites under its own name) via `SuiteInfo::run`.
|
||||
*
|
||||
* @return The runner this suite is executing under.
|
||||
*/
|
||||
Runner&
|
||||
runner() const
|
||||
{
|
||||
return *runner_;
|
||||
}
|
||||
|
||||
public:
|
||||
/**
|
||||
* DEPRECATED
|
||||
* @return `true` if the test condition indicates success(a false value)
|
||||
|
||||
@@ -22,10 +22,13 @@ struct Sections
|
||||
static constexpr auto kIoWorkers = "io_workers";
|
||||
static constexpr auto kIps = "ips";
|
||||
static constexpr auto kIpsFixed = "ips_fixed";
|
||||
static constexpr auto kLedgerCacheAge = "ledger_cache_age";
|
||||
static constexpr auto kLedgerFetchSize = "ledger_fetch_size";
|
||||
static constexpr auto kLedgerHistory = "ledger_history";
|
||||
static constexpr auto kLedgerReplay = "ledger_replay";
|
||||
static constexpr auto kLedgerTxTables = "ledger_tx_tables";
|
||||
static constexpr auto kMaxTransactions = "max_transactions";
|
||||
static constexpr auto kMemoryLimit = "memory_limit";
|
||||
static constexpr auto kNetworkId = "network_id";
|
||||
static constexpr auto kNetworkQuorum = "network_quorum";
|
||||
static constexpr auto kNodeDatabase = "node_db";
|
||||
@@ -63,6 +66,7 @@ struct Sections
|
||||
static constexpr auto kSslVerifyFile = "ssl_verify_file";
|
||||
static constexpr auto kSweepInterval = "sweep_interval";
|
||||
static constexpr auto kTransactionQueue = "transaction_queue";
|
||||
static constexpr auto kTreeCacheAge = "tree_cache_age";
|
||||
static constexpr auto kValidationSeed = "validation_seed";
|
||||
static constexpr auto kValidatorKeys = "validator_keys";
|
||||
static constexpr auto kValidatorKeyRevocation = "validator_key_revocation";
|
||||
@@ -94,6 +98,7 @@ struct Keys
|
||||
static constexpr auto kBgThreads = "bg_threads";
|
||||
static constexpr auto kBlockSize = "block_size";
|
||||
static constexpr auto kCacheAge = "cache_age";
|
||||
static constexpr auto kCacheBytes = "cache_bytes";
|
||||
static constexpr auto kCacheMb = "cache_mb";
|
||||
static constexpr auto kCacheSize = "cache_size";
|
||||
static constexpr auto kClientMaxWindowBits = "client_max_window_bits";
|
||||
|
||||
@@ -15,12 +15,12 @@
|
||||
namespace xrpl {
|
||||
|
||||
// Forward declarations
|
||||
namespace NodeStore {
|
||||
namespace node_store {
|
||||
class Database;
|
||||
} // namespace NodeStore
|
||||
namespace Resource {
|
||||
} // namespace node_store
|
||||
namespace resource {
|
||||
class Manager;
|
||||
} // namespace Resource
|
||||
} // namespace resource
|
||||
namespace perf {
|
||||
class PerfLog;
|
||||
} // namespace perf
|
||||
@@ -160,11 +160,11 @@ public:
|
||||
virtual PeerReservationTable&
|
||||
getPeerReservations() = 0;
|
||||
|
||||
virtual Resource::Manager&
|
||||
virtual resource::Manager&
|
||||
getResourceManager() = 0;
|
||||
|
||||
// Storage services
|
||||
virtual NodeStore::Database&
|
||||
virtual node_store::Database&
|
||||
getNodeStore() = 0;
|
||||
|
||||
virtual SHAMapStore&
|
||||
|
||||
@@ -623,6 +623,7 @@ class ValueConstIterator : public ValueIteratorBase
|
||||
public:
|
||||
using size_t = unsigned int;
|
||||
using difference_type = int;
|
||||
using value_type = Value const;
|
||||
using reference = Value const&;
|
||||
using pointer = Value const*;
|
||||
using SelfType = ValueConstIterator;
|
||||
@@ -687,6 +688,7 @@ class ValueIterator : public ValueIteratorBase
|
||||
public:
|
||||
using size_t = unsigned int;
|
||||
using difference_type = int;
|
||||
using value_type = Value;
|
||||
using reference = Value&;
|
||||
using pointer = Value*;
|
||||
using SelfType = ValueIterator;
|
||||
|
||||
@@ -43,14 +43,7 @@ enum ApplyFlags : std::uint32_t {
|
||||
|
||||
// Transaction shouldn't be applied
|
||||
// Signatures shouldn't be checked
|
||||
TapDryRun = 0x1000,
|
||||
|
||||
// Transaction is being preflighted as the payload of a
|
||||
// TransactionProposalCreate. Its signatures are collected on-ledger
|
||||
// afterward, so signature-presence checks (e.g. Batch signer matching)
|
||||
// are skipped at proposal-creation time (On-Chain Cosigner spec
|
||||
// §5.3.1.2).
|
||||
TapProposal = 0x2000
|
||||
TapDryRun = 0x1000
|
||||
};
|
||||
|
||||
constexpr ApplyFlags
|
||||
|
||||
@@ -286,6 +286,77 @@ computeFullPaymentInterest(
|
||||
std::uint32_t startDate,
|
||||
TenthBips32 closeInterestRate);
|
||||
|
||||
// Deltas applied to Vault.AssetsTotal and LoanBroker.DebtTotal at a single
|
||||
// accounting touch point (origination, payment, impair/unimpair/default).
|
||||
struct AccountingDeltas
|
||||
{
|
||||
Number assetsTotalDelta;
|
||||
Number debtTotalDelta;
|
||||
};
|
||||
|
||||
// Whole-life (pre-LendingProtocolV1_1) recognition model: interest is
|
||||
// recognized into AssetsTotal/DebtTotal up front, at origination.
|
||||
namespace accrual {
|
||||
|
||||
// LoanSet origination: what's added to Vault.AssetsTotal and LoanBroker.DebtTotal
|
||||
AccountingDeltas
|
||||
loanOriginationDeltas(Number const& principalRequested, Number const& interestDue);
|
||||
|
||||
// LoanSet origination: would recognizing this loan's interest push
|
||||
// Vault.AssetsTotal past Vault.AssetsMaximum?
|
||||
bool
|
||||
loanOriginationExceedsVaultMaximum(
|
||||
Number const& vaultMaximum,
|
||||
Number const& vaultTotal,
|
||||
Number const& interestDue);
|
||||
|
||||
// LoanManage impair/unimpair/default: the vault's exposure to this loan
|
||||
Number
|
||||
loanVaultExposure(SLE::const_ref loanSle);
|
||||
|
||||
// LoanPay: what's added to Vault.AssetsTotal and subtracted from LoanBroker.DebtTotal for a payment
|
||||
AccountingDeltas
|
||||
loanPaymentDeltas(LoanPaymentParts const& parts);
|
||||
|
||||
} // namespace accrual
|
||||
|
||||
// Cash-basis (LendingProtocolV1_1) recognition model: AssetsTotal/DebtTotal
|
||||
// are principal-only, interest is recognized only as it's actually paid.
|
||||
namespace cash_basis {
|
||||
|
||||
AccountingDeltas
|
||||
loanOriginationDeltas(Number const& principalRequested);
|
||||
|
||||
Number
|
||||
loanVaultExposure(SLE::const_ref loanSle);
|
||||
|
||||
AccountingDeltas
|
||||
loanPaymentDeltas(LoanPaymentParts const& parts);
|
||||
|
||||
} // namespace cash_basis
|
||||
|
||||
// Public dispatchers: pick cash_basis:: if featureLendingProtocolV1_1 is
|
||||
// enabled AND the Vault's LEVersion (VaultHelpers::getVaultVersion) is
|
||||
// VaultVersion::CashBasis, else accrual::. These are the only entry points
|
||||
// transactors call.
|
||||
AccountingDeltas
|
||||
loanOriginationDeltas(
|
||||
SLE::const_ref vaultSle,
|
||||
Number const& principalRequested,
|
||||
Number const& interestDue);
|
||||
|
||||
bool
|
||||
loanOriginationExceedsVaultMaximum(
|
||||
SLE::const_ref vaultSle,
|
||||
Number const& vaultTotal,
|
||||
Number const& interestDue);
|
||||
|
||||
Number
|
||||
loanVaultExposure(SLE::const_ref vaultSle, SLE::const_ref loanSle);
|
||||
|
||||
AccountingDeltas
|
||||
loanPaymentDeltas(SLE::const_ref vaultSle, LoanPaymentParts const& parts);
|
||||
|
||||
namespace detail {
|
||||
// These classes and functions should only be accessed by LendingHelper
|
||||
// functions and unit tests
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/protocol/SField.h>
|
||||
#include <xrpl/protocol/STObject.h>
|
||||
#include <xrpl/protocol/TxFormats.h>
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace xrpl::proposal {
|
||||
|
||||
/**
|
||||
* Owner-reserve increments held by a proposal of an ordinary transaction.
|
||||
*/
|
||||
constexpr std::uint32_t kProposalOwnerCount = 5;
|
||||
|
||||
/**
|
||||
* Owner-reserve increments held by a proposal of a Batch transaction. A
|
||||
* proposed Batch stores up to eight inner transactions plus multi-account
|
||||
* signatures, so it reserves more than an ordinary proposed transaction.
|
||||
*/
|
||||
constexpr std::uint32_t kBatchProposalOwnerCount = 10;
|
||||
|
||||
/**
|
||||
* Owner-reserve increments held by a proposal of the given transaction.
|
||||
*/
|
||||
inline std::uint32_t
|
||||
proposalOwnerCount(STObject const& proposedTx)
|
||||
{
|
||||
return proposedTx.getFieldU16(sfTransactionType) == ttBATCH ? kBatchProposalOwnerCount
|
||||
: kProposalOwnerCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the proposed transaction is itself a proposal transaction, which
|
||||
* would nest one proposal inside another.
|
||||
*
|
||||
* TODO: cover ttTRANSACTION_PROPOSAL_SIGN and ttTRANSACTION_PROPOSAL_CANCEL
|
||||
* once those transactions exist.
|
||||
*/
|
||||
inline bool
|
||||
isProposalTx(STObject const& proposedTx)
|
||||
{
|
||||
return proposedTx.getFieldU16(sfTransactionType) == ttTRANSACTION_PROPOSAL_CREATE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the proposed transaction is independently submittable through the
|
||||
* ordinary multi-sign path: not a nested proposal, not a pseudo-transaction,
|
||||
* not itself flagged as someone else's inner batch transaction, and — if it
|
||||
* is a Batch — none of its own inner transactions is a nested proposal or a
|
||||
* pseudo-transaction either. A Batch inner transaction cannot itself be
|
||||
* pseudo (preflight0 rejects the pseudo/tfInnerBatchTxn combination
|
||||
* generically), but that guard lives outside this feature, so it is checked
|
||||
* again here rather than relied upon.
|
||||
*/
|
||||
bool
|
||||
isValidProposal(STObject const& proposedTx);
|
||||
|
||||
/**
|
||||
* Whether the proposed transaction carries any signature field.
|
||||
*
|
||||
* A proposal is stored in unsigned canonical form; signatures may only ever
|
||||
* arrive through TransactionProposalSign. Shared by the create-time check and
|
||||
* the invariant that guards the stored entry, so the two cannot drift apart.
|
||||
*/
|
||||
inline bool
|
||||
hasSignatureField(STObject const& proposedTx)
|
||||
{
|
||||
return proposedTx.isFieldPresent(sfTxnSignature) || proposedTx.isFieldPresent(sfSigners) ||
|
||||
proposedTx.isFieldPresent(sfBatchSigners) ||
|
||||
proposedTx.isFieldPresent(sfCounterpartySignature) ||
|
||||
proposedTx.isFieldPresent(sfSponsorSignature);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the proposed transaction's SigningPubKey is present and empty, as
|
||||
* unsigned canonical form requires. An absent field is not the same as an
|
||||
* empty one, and a populated one means the payload was already signed.
|
||||
*/
|
||||
inline bool
|
||||
hasEmptySigningPubKey(STObject const& proposedTx)
|
||||
{
|
||||
return proposedTx.isFieldPresent(sfSigningPubKey) &&
|
||||
proposedTx.getFieldVL(sfSigningPubKey).empty();
|
||||
}
|
||||
|
||||
} // namespace xrpl::proposal
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <xrpl/ledger/ReadView.h>
|
||||
#include <xrpl/protocol/AccountID.h>
|
||||
#include <xrpl/protocol/Protocol.h>
|
||||
#include <xrpl/protocol/STAmount.h>
|
||||
#include <xrpl/protocol/STLedgerEntry.h>
|
||||
|
||||
@@ -107,4 +108,19 @@ sharesToAssetsWithdraw(
|
||||
[[nodiscard]] bool
|
||||
isSoleShareholder(ReadView const& view, AccountID const& account, SLE::const_ref issuance);
|
||||
|
||||
/**
|
||||
* Resolves a Vault's LEVersion, the single point every accounting touch
|
||||
* point should call to determine which recognition model (accrual vs.
|
||||
* cash-basis) a Vault uses. Vaults created before featureLendingProtocolV1_1
|
||||
* activated never have sfLEVersion set, which resolves here to
|
||||
* VaultVersion::Legacy.
|
||||
*
|
||||
* @param vault The vault SLE.
|
||||
*
|
||||
* @return The Vault's LEVersion, or VaultVersion::Legacy if the field is
|
||||
* absent.
|
||||
*/
|
||||
[[nodiscard]] VaultVersion
|
||||
getVaultVersion(SLE::const_ref vault);
|
||||
|
||||
} // namespace xrpl
|
||||
|
||||
@@ -67,16 +67,16 @@ public:
|
||||
return socket_->next_layer();
|
||||
}
|
||||
|
||||
beast::IP::Endpoint
|
||||
beast::ip::Endpoint
|
||||
localEndpoint()
|
||||
{
|
||||
return beast::IP::fromAsio(lowestLayer().local_endpoint());
|
||||
return beast::ip::fromAsio(lowestLayer().local_endpoint());
|
||||
}
|
||||
|
||||
beast::IP::Endpoint
|
||||
beast::ip::Endpoint
|
||||
remoteEndpoint()
|
||||
{
|
||||
return beast::IP::fromAsio(lowestLayer().remote_endpoint());
|
||||
return beast::ip::fromAsio(lowestLayer().remote_endpoint());
|
||||
}
|
||||
|
||||
lowest_layer_type&
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
namespace xrpl::NodeStore {
|
||||
namespace xrpl::node_store {
|
||||
|
||||
/**
|
||||
* A backend used for the NodeStore.
|
||||
@@ -163,4 +163,4 @@ public:
|
||||
fdRequired() const = 0;
|
||||
};
|
||||
|
||||
} // namespace xrpl::NodeStore
|
||||
} // namespace xrpl::node_store
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace xrpl {
|
||||
class Section;
|
||||
} // namespace xrpl
|
||||
|
||||
namespace xrpl::NodeStore {
|
||||
namespace xrpl::node_store {
|
||||
|
||||
/**
|
||||
* Persistency layer for NodeObject
|
||||
@@ -197,7 +197,7 @@ public:
|
||||
return fetchSz_;
|
||||
}
|
||||
|
||||
void
|
||||
virtual void
|
||||
getCountsJson(json::Value& obj);
|
||||
|
||||
/**
|
||||
@@ -248,7 +248,7 @@ protected:
|
||||
void
|
||||
storeStats(std::uint64_t count, std::uint64_t sz)
|
||||
{
|
||||
XRPL_ASSERT(count <= sz, "xrpl::NodeStore::Database::storeStats : valid inputs");
|
||||
XRPL_ASSERT(count <= sz, "xrpl::node_store::Database::storeStats : valid inputs");
|
||||
storeCount_ += count;
|
||||
storeSz_ += sz;
|
||||
}
|
||||
@@ -308,4 +308,4 @@ private:
|
||||
threadEntry();
|
||||
};
|
||||
|
||||
} // namespace xrpl::NodeStore
|
||||
} // namespace xrpl::node_store
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace xrpl::NodeStore {
|
||||
namespace xrpl::node_store {
|
||||
|
||||
/* This class has two key-value store Backend objects for persisting SHAMap
|
||||
* records. This facilitates online deletion of data. New backends are
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
*/
|
||||
virtual void
|
||||
rotate(
|
||||
std::unique_ptr<NodeStore::Backend>&& newBackend,
|
||||
std::unique_ptr<node_store::Backend>&& newBackend,
|
||||
std::function<void(std::string const& writableName, std::string const& archiveName)> const&
|
||||
f) = 0;
|
||||
|
||||
@@ -56,4 +56,4 @@ public:
|
||||
setRotationInFlight(bool inFlight) = 0;
|
||||
};
|
||||
|
||||
} // namespace xrpl::NodeStore
|
||||
} // namespace xrpl::node_store
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <xrpl/nodestore/Scheduler.h>
|
||||
#include <xrpl/nodestore/Task.h>
|
||||
|
||||
namespace xrpl::NodeStore {
|
||||
namespace xrpl::node_store {
|
||||
|
||||
/**
|
||||
* Simple NodeStore Scheduler that just performs the tasks synchronously.
|
||||
@@ -21,4 +21,4 @@ public:
|
||||
onBatchWrite(BatchWriteReport const& report) override;
|
||||
};
|
||||
|
||||
} // namespace xrpl::NodeStore
|
||||
} // namespace xrpl::node_store
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace xrpl {
|
||||
class Section;
|
||||
} // namespace xrpl
|
||||
|
||||
namespace xrpl::NodeStore {
|
||||
namespace xrpl::node_store {
|
||||
|
||||
/**
|
||||
* Base class for backend factories.
|
||||
@@ -70,4 +70,4 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::NodeStore
|
||||
} // namespace xrpl::node_store
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace xrpl::NodeStore {
|
||||
namespace xrpl::node_store {
|
||||
|
||||
/**
|
||||
* Singleton for managing NodeStore factories and back ends.
|
||||
@@ -98,4 +98,4 @@ public:
|
||||
beast::Journal journal) = 0;
|
||||
};
|
||||
|
||||
} // namespace xrpl::NodeStore
|
||||
} // namespace xrpl::node_store
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
|
||||
// VFALCO NOTE Intentionally not in the NodeStore namespace
|
||||
// VFALCO NOTE Intentionally not in the node_store namespace
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include <chrono>
|
||||
|
||||
namespace xrpl::NodeStore {
|
||||
namespace xrpl::node_store {
|
||||
|
||||
enum class FetchType { Synchronous, Async };
|
||||
|
||||
@@ -71,4 +71,4 @@ public:
|
||||
onBatchWrite(BatchWriteReport const& report) = 0;
|
||||
};
|
||||
|
||||
} // namespace xrpl::NodeStore
|
||||
} // namespace xrpl::node_store
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
namespace xrpl::NodeStore {
|
||||
namespace xrpl::node_store {
|
||||
|
||||
/**
|
||||
* Derived classes perform scheduled tasks.
|
||||
@@ -17,4 +17,4 @@ struct Task
|
||||
performScheduledTask() = 0;
|
||||
};
|
||||
|
||||
} // namespace xrpl::NodeStore
|
||||
} // namespace xrpl::node_store
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace xrpl::NodeStore {
|
||||
namespace xrpl::node_store {
|
||||
|
||||
// This is only used to pre-allocate the array for
|
||||
// batch objects and does not affect the amount written.
|
||||
@@ -36,4 +36,4 @@ enum class Status {
|
||||
*/
|
||||
using Batch = std::vector<std::shared_ptr<NodeObject>>;
|
||||
|
||||
} // namespace xrpl::NodeStore
|
||||
} // namespace xrpl::node_store
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
||||
namespace xrpl::NodeStore {
|
||||
namespace xrpl::node_store {
|
||||
|
||||
/**
|
||||
* Batch-writing assist logic.
|
||||
@@ -86,4 +86,4 @@ private:
|
||||
Batch writeSet_;
|
||||
};
|
||||
|
||||
} // namespace xrpl::NodeStore
|
||||
} // namespace xrpl::node_store
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <xrpl/nodestore/Database.h>
|
||||
#include <xrpl/nodestore/NodeObject.h>
|
||||
#include <xrpl/nodestore/Scheduler.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
@@ -22,7 +23,7 @@
|
||||
#include <stdexcept>
|
||||
#include <utility>
|
||||
|
||||
namespace xrpl::NodeStore {
|
||||
namespace xrpl::node_store {
|
||||
|
||||
class DatabaseNodeImp : public Database
|
||||
{
|
||||
@@ -58,17 +59,36 @@ public:
|
||||
|
||||
if (cacheSize.has_value() || cacheAge.has_value())
|
||||
{
|
||||
cache_ = std::make_shared<TaggedCache<uint256, NodeObject>>(
|
||||
using Cache = TaggedCache<uint256, NodeObject>;
|
||||
|
||||
// Serialized sizes are exact, so bound this cache by bytes when
|
||||
// cache_bytes is set; the count target remains advisory.
|
||||
std::optional<Cache::ByteBudget> byteBudget;
|
||||
if (auto const bytes = config.exists(Keys::kCacheBytes)
|
||||
? get<std::uint64_t>(config, Keys::kCacheBytes)
|
||||
: 0)
|
||||
{
|
||||
// Charge the blob plus per-entry overhead (map node, weak
|
||||
// tracking, control block).
|
||||
byteBudget = Cache::ByteBudget{bytes, [](std::shared_ptr<NodeObject> const& obj) {
|
||||
return (obj ? obj->getData().size() : 0) + 160;
|
||||
}};
|
||||
}
|
||||
|
||||
cache_ = std::make_shared<Cache>(
|
||||
"DatabaseNodeImp",
|
||||
cacheSize.value_or(0),
|
||||
std::chrono::minutes(cacheAge.value_or(0)),
|
||||
stopwatch(),
|
||||
j);
|
||||
j,
|
||||
beast::insight::NullCollector::make(),
|
||||
0,
|
||||
std::move(byteBudget));
|
||||
}
|
||||
|
||||
XRPL_ASSERT(
|
||||
backend_,
|
||||
"xrpl::NodeStore::DatabaseNodeImp::DatabaseNodeImp : non-null "
|
||||
"xrpl::node_store::DatabaseNodeImp::DatabaseNodeImp : non-null "
|
||||
"backend");
|
||||
}
|
||||
|
||||
@@ -120,6 +140,17 @@ public:
|
||||
void
|
||||
sweep() override;
|
||||
|
||||
void
|
||||
getCountsJson(json::Value& obj) override
|
||||
{
|
||||
Database::getCountsJson(obj);
|
||||
if (cache_)
|
||||
{
|
||||
obj[jss::node_cache_size] = static_cast<json::UInt>(cache_->getCacheSize());
|
||||
obj[jss::node_cache_bytes] = std::to_string(cache_->getCacheBytes());
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
// Cache for database objects. This cache is not always initialized. Check
|
||||
// for null before using.
|
||||
@@ -138,4 +169,4 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::NodeStore
|
||||
} // namespace xrpl::node_store
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
||||
namespace xrpl::NodeStore {
|
||||
namespace xrpl::node_store {
|
||||
|
||||
class DatabaseRotatingImp : public DatabaseRotating
|
||||
{
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
|
||||
void
|
||||
rotate(
|
||||
std::unique_ptr<NodeStore::Backend>&& newBackend,
|
||||
std::unique_ptr<node_store::Backend>&& newBackend,
|
||||
std::function<void(std::string const& writableName, std::string const& archiveName)> const&
|
||||
f) override;
|
||||
|
||||
@@ -94,4 +94,4 @@ private:
|
||||
forEach(std::function<void(std::shared_ptr<NodeObject>)> f) override;
|
||||
};
|
||||
|
||||
} // namespace xrpl::NodeStore
|
||||
} // namespace xrpl::node_store
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace xrpl::NodeStore {
|
||||
namespace xrpl::node_store {
|
||||
|
||||
/**
|
||||
* Parsed key/value blob into NodeObject components.
|
||||
@@ -49,4 +49,4 @@ private:
|
||||
int dataBytes_;
|
||||
};
|
||||
|
||||
} // namespace xrpl::NodeStore
|
||||
} // namespace xrpl::node_store
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace xrpl::NodeStore {
|
||||
namespace xrpl::node_store {
|
||||
|
||||
/**
|
||||
* Convert a NodeObject from in-memory to database format.
|
||||
@@ -68,7 +68,7 @@ class EncodedBlob
|
||||
public:
|
||||
explicit EncodedBlob(std::shared_ptr<NodeObject> const& obj)
|
||||
: size_([&obj]() {
|
||||
XRPL_ASSERT(obj, "xrpl::NodeStore::EncodedBlob::EncodedBlob : non-null input");
|
||||
XRPL_ASSERT(obj, "xrpl::node_store::EncodedBlob::EncodedBlob : non-null input");
|
||||
|
||||
if (!obj)
|
||||
throw std::runtime_error("EncodedBlob: unseated std::shared_ptr used.");
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
XRPL_ASSERT(
|
||||
((ptr_ == payload_.data()) && (size_ <= payload_.size())) ||
|
||||
((ptr_ != payload_.data()) && (size_ > payload_.size())),
|
||||
"xrpl::NodeStore::EncodedBlob::~EncodedBlob : valid payload "
|
||||
"xrpl::node_store::EncodedBlob::~EncodedBlob : valid payload "
|
||||
"pointer");
|
||||
|
||||
if (ptr_ != payload_.data())
|
||||
@@ -114,4 +114,4 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xrpl::NodeStore
|
||||
} // namespace xrpl::node_store
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace xrpl::NodeStore {
|
||||
namespace xrpl::node_store {
|
||||
|
||||
class ManagerImp : public Manager
|
||||
{
|
||||
@@ -57,4 +57,4 @@ public:
|
||||
beast::Journal journal) override;
|
||||
};
|
||||
|
||||
} // namespace xrpl::NodeStore
|
||||
} // namespace xrpl::node_store
|
||||
|
||||
@@ -6,25 +6,25 @@
|
||||
#include <cstdint>
|
||||
#include <type_traits>
|
||||
|
||||
namespace xrpl::NodeStore {
|
||||
namespace xrpl::node_store {
|
||||
|
||||
// This is a variant of the base128 varint format from
|
||||
// google protocol buffers:
|
||||
// https://developers.google.com/protocol-buffers/docs/encoding#varints
|
||||
|
||||
// field tag
|
||||
struct varint;
|
||||
struct Varint;
|
||||
|
||||
// Metafuncton to return largest
|
||||
// Metafunction to return largest
|
||||
// possible size of T represented as varint.
|
||||
// T must be unsigned
|
||||
template <class T, bool = std::is_unsigned_v<T>>
|
||||
struct varint_traits;
|
||||
struct VarintTraits;
|
||||
|
||||
template <class T>
|
||||
struct varint_traits<T, true>
|
||||
struct VarintTraits<T, true>
|
||||
{
|
||||
explicit varint_traits() = default;
|
||||
explicit VarintTraits() = default;
|
||||
|
||||
static constexpr std::size_t kMax = ((8 * sizeof(T)) + 6) / 7;
|
||||
};
|
||||
@@ -104,7 +104,7 @@ writeVarint(void* p0, std::size_t v)
|
||||
template <class T>
|
||||
void
|
||||
read(nudb::detail::istream& is, std::size_t& u)
|
||||
requires(std::is_same_v<T, varint>)
|
||||
requires(std::is_same_v<T, Varint>)
|
||||
{
|
||||
auto p0 = is(1);
|
||||
auto p1 = p0;
|
||||
@@ -118,9 +118,9 @@ read(nudb::detail::istream& is, std::size_t& u)
|
||||
template <class T>
|
||||
void
|
||||
write(nudb::detail::ostream& os, std::size_t t)
|
||||
requires(std::is_same_v<T, varint>)
|
||||
requires(std::is_same_v<T, Varint>)
|
||||
{
|
||||
writeVarint(os.data(sizeVarint(t)), t);
|
||||
}
|
||||
|
||||
} // namespace xrpl::NodeStore
|
||||
} // namespace xrpl::node_store
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <xrpl/basics/contract.h>
|
||||
#include <xrpl/basics/safe_cast.h>
|
||||
#include <xrpl/nodestore/NodeObject.h>
|
||||
#include <xrpl/nodestore/detail/varint.h>
|
||||
#include <xrpl/nodestore/detail/Varint.h>
|
||||
#include <xrpl/protocol/HashPrefix.h>
|
||||
|
||||
#include <nudb/detail/field.hpp>
|
||||
@@ -21,7 +21,7 @@
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
|
||||
namespace xrpl::NodeStore {
|
||||
namespace xrpl::node_store {
|
||||
|
||||
template <class BufferFactory>
|
||||
std::pair<void const*, std::size_t>
|
||||
@@ -59,7 +59,7 @@ lz4Compress(void const* in, std::size_t inSize, BufferFactory&& bf)
|
||||
using std::runtime_error;
|
||||
using namespace nudb::detail;
|
||||
std::pair<void const*, std::size_t> result;
|
||||
std::array<std::uint8_t, varint_traits<std::size_t>::kMax> vi{};
|
||||
std::array<std::uint8_t, VarintTraits<std::size_t>::kMax> vi{};
|
||||
auto const n = writeVarint(vi.data(), inSize);
|
||||
auto const outMax = LZ4_compressBound(inSize);
|
||||
auto* out = reinterpret_cast<std::uint8_t*>(bf(n + outMax));
|
||||
@@ -240,7 +240,7 @@ nodeobjectCompress(void const* in, std::size_t inSize, BufferFactory&& bf)
|
||||
auto* out = reinterpret_cast<std::uint8_t*>(bf(result.second));
|
||||
result.first = out;
|
||||
ostream os(out, result.second);
|
||||
write<varint>(os, type);
|
||||
write<Varint>(os, type);
|
||||
write<std::uint16_t>(os, mask);
|
||||
write(os, vh.data(), n * 32);
|
||||
return result;
|
||||
@@ -252,13 +252,13 @@ nodeobjectCompress(void const* in, std::size_t inSize, BufferFactory&& bf)
|
||||
auto* out = reinterpret_cast<std::uint8_t*>(bf(result.second));
|
||||
result.first = out;
|
||||
ostream os(out, result.second);
|
||||
write<varint>(os, type);
|
||||
write<Varint>(os, type);
|
||||
write(os, vh.data(), n * 32);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
std::array<std::uint8_t, varint_traits<std::size_t>::kMax> vi{};
|
||||
std::array<std::uint8_t, VarintTraits<std::size_t>::kMax> vi{};
|
||||
|
||||
static constexpr std::size_t kCodecType = 1;
|
||||
auto const vn = writeVarint(vi.data(), kCodecType);
|
||||
@@ -269,7 +269,7 @@ nodeobjectCompress(void const* in, std::size_t inSize, BufferFactory&& bf)
|
||||
case 1: // lz4
|
||||
{
|
||||
std::uint8_t* p = nullptr;
|
||||
auto const lzr = NodeStore::lz4Compress(in, inSize, [&p, &vn, &bf](std::size_t n) {
|
||||
auto const lzr = node_store::lz4Compress(in, inSize, [&p, &vn, &bf](std::size_t n) {
|
||||
p = reinterpret_cast<std::uint8_t*>(bf(vn + n));
|
||||
return p + vn;
|
||||
});
|
||||
@@ -316,4 +316,4 @@ filterInner(void* in, std::size_t inSize)
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace xrpl::NodeStore
|
||||
} // namespace xrpl::node_store
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
namespace xrpl::PeerFinder {
|
||||
namespace xrpl::peer_finder {
|
||||
|
||||
struct PeerLimitConfig
|
||||
{
|
||||
@@ -28,7 +28,7 @@ struct Config
|
||||
* This includes both inbound and outbound, but does not include
|
||||
* fixed peers.
|
||||
*/
|
||||
std::size_t maxPeers{Tuning::kDefaultMaxPeers};
|
||||
std::size_t maxPeers{tuning::kDefaultMaxPeers};
|
||||
|
||||
/**
|
||||
* The number of automatic outbound connections to maintain.
|
||||
@@ -100,7 +100,7 @@ struct Config
|
||||
onWrite(beast::PropertyStream::Map& map) const;
|
||||
|
||||
/**
|
||||
* Make PeerFinder::Config from peer limit and server mode parameters.
|
||||
* Make peer_finder::Config from peer limit and server mode parameters.
|
||||
*/
|
||||
static Config
|
||||
makeConfig(
|
||||
@@ -160,4 +160,4 @@ to_string(Result result) noexcept
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
} // namespace xrpl::PeerFinder
|
||||
} // namespace xrpl::peer_finder
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace xrpl::PeerFinder {
|
||||
namespace xrpl::peer_finder {
|
||||
|
||||
/**
|
||||
* Maintains a set of IP addresses used for getting into the network.
|
||||
@@ -68,17 +68,17 @@ public:
|
||||
* file, along with the set of corresponding IP addresses.
|
||||
*/
|
||||
virtual void
|
||||
addFixedPeer(std::string_view name, std::vector<beast::IP::Endpoint> const& addresses) = 0;
|
||||
addFixedPeer(std::string_view name, std::vector<beast::ip::Endpoint> const& addresses) = 0;
|
||||
|
||||
/**
|
||||
* Add a set of strings as fallback IP::Endpoint sources.
|
||||
* Add a set of strings as fallback ip::Endpoint sources.
|
||||
* @param name A label used for diagnostics.
|
||||
*/
|
||||
virtual void
|
||||
addFallbackStrings(std::string const& name, std::vector<std::string> const& strings) = 0;
|
||||
|
||||
/**
|
||||
* Add a URL as a fallback location to obtain IP::Endpoint sources.
|
||||
* Add a URL as a fallback location to obtain ip::Endpoint sources.
|
||||
* @param name A label used for diagnostics.
|
||||
*/
|
||||
/* VFALCO NOTE Unimplemented
|
||||
@@ -95,8 +95,8 @@ public:
|
||||
*/
|
||||
virtual std::pair<std::shared_ptr<Slot>, Result>
|
||||
newInboundSlot(
|
||||
beast::IP::Endpoint const& localEndpoint,
|
||||
beast::IP::Endpoint const& remoteEndpoint) = 0;
|
||||
beast::ip::Endpoint const& localEndpoint,
|
||||
beast::ip::Endpoint const& remoteEndpoint) = 0;
|
||||
|
||||
/**
|
||||
* Create a new outbound slot with the specified remote endpoint.
|
||||
@@ -104,7 +104,7 @@ public:
|
||||
* Usually this is because of a duplicate connection.
|
||||
*/
|
||||
virtual std::pair<std::shared_ptr<Slot>, Result>
|
||||
newOutboundSlot(beast::IP::Endpoint const& remoteEndpoint) = 0;
|
||||
newOutboundSlot(beast::ip::Endpoint const& remoteEndpoint) = 0;
|
||||
|
||||
/**
|
||||
* Called when mtENDPOINTS is received.
|
||||
@@ -145,7 +145,7 @@ public:
|
||||
* @return `true` if the connection should be kept
|
||||
*/
|
||||
virtual bool
|
||||
onConnected(std::shared_ptr<Slot> const& slot, beast::IP::Endpoint const& localEndpoint) = 0;
|
||||
onConnected(std::shared_ptr<Slot> const& slot, beast::ip::Endpoint const& localEndpoint) = 0;
|
||||
|
||||
/**
|
||||
* Request an active slot type.
|
||||
@@ -162,7 +162,7 @@ public:
|
||||
/**
|
||||
* Return a set of addresses we should connect to.
|
||||
*/
|
||||
virtual std::vector<beast::IP::Endpoint>
|
||||
virtual std::vector<beast::ip::Endpoint>
|
||||
autoconnect() = 0;
|
||||
|
||||
virtual std::vector<std::pair<std::shared_ptr<Slot>, std::vector<Endpoint>>>
|
||||
@@ -176,4 +176,4 @@ public:
|
||||
oncePerSecond() = 0;
|
||||
};
|
||||
|
||||
} // namespace xrpl::PeerFinder
|
||||
} // namespace xrpl::peer_finder
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
|
||||
namespace xrpl::PeerFinder {
|
||||
namespace xrpl::peer_finder {
|
||||
|
||||
/**
|
||||
* Properties and state associated with a peer to peer overlay connection.
|
||||
@@ -52,13 +52,13 @@ public:
|
||||
/**
|
||||
* The remote endpoint of socket.
|
||||
*/
|
||||
[[nodiscard]] virtual beast::IP::Endpoint const&
|
||||
[[nodiscard]] virtual beast::ip::Endpoint const&
|
||||
remoteEndpoint() const = 0;
|
||||
|
||||
/**
|
||||
* The local endpoint of the socket, when known.
|
||||
*/
|
||||
[[nodiscard]] virtual std::optional<beast::IP::Endpoint> const&
|
||||
[[nodiscard]] virtual std::optional<beast::ip::Endpoint> const&
|
||||
localEndpoint() const = 0;
|
||||
|
||||
[[nodiscard]] virtual std::optional<std::uint16_t>
|
||||
@@ -72,4 +72,4 @@ public:
|
||||
publicKey() const = 0;
|
||||
};
|
||||
|
||||
} // namespace xrpl::PeerFinder
|
||||
} // namespace xrpl::peer_finder
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
namespace xrpl::PeerFinder {
|
||||
namespace xrpl::peer_finder {
|
||||
|
||||
using clock_type = beast::AbstractClock<std::chrono::steady_clock>;
|
||||
|
||||
/**
|
||||
* Represents a set of addresses.
|
||||
*/
|
||||
using IPAddresses = std::vector<beast::IP::Endpoint>;
|
||||
using IPAddresses = std::vector<beast::ip::Endpoint>;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -26,10 +26,10 @@ struct Endpoint
|
||||
{
|
||||
Endpoint() = default;
|
||||
|
||||
Endpoint(beast::IP::Endpoint ep, std::uint32_t hops);
|
||||
Endpoint(beast::ip::Endpoint ep, std::uint32_t hops);
|
||||
|
||||
std::uint32_t hops = 0;
|
||||
beast::IP::Endpoint address;
|
||||
beast::ip::Endpoint address;
|
||||
};
|
||||
|
||||
inline bool
|
||||
@@ -43,4 +43,4 @@ operator<(Endpoint const& lhs, Endpoint const& rhs)
|
||||
*/
|
||||
using Endpoints = std::vector<Endpoint>;
|
||||
|
||||
} // namespace xrpl::PeerFinder
|
||||
} // namespace xrpl::peer_finder
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
#include <functional>
|
||||
|
||||
namespace xrpl::PeerFinder {
|
||||
namespace xrpl::peer_finder {
|
||||
|
||||
/**
|
||||
* Stores IP addresses useful for gaining initial connections.
|
||||
@@ -65,7 +65,7 @@ private:
|
||||
};
|
||||
|
||||
using left_t = boost::bimaps::
|
||||
unordered_set_of<beast::IP::Endpoint, boost::hash<beast::IP::Endpoint>, std::equal_to<>>;
|
||||
unordered_set_of<beast::ip::Endpoint, boost::hash<beast::ip::Endpoint>, std::equal_to<>>;
|
||||
using right_t = boost::bimaps::multiset_of<Entry, std::less<>>;
|
||||
using map_type = boost::bimap<left_t, right_t>;
|
||||
using value_type = map_type::value_type;
|
||||
@@ -73,11 +73,11 @@ private:
|
||||
struct Transform
|
||||
{
|
||||
using first_argument_type = map_type::right_map::const_iterator::value_type const&;
|
||||
using result_type = beast::IP::Endpoint const&;
|
||||
using result_type = beast::ip::Endpoint const&;
|
||||
|
||||
explicit Transform() = default;
|
||||
|
||||
beast::IP::Endpoint const&
|
||||
beast::ip::Endpoint const&
|
||||
operator()(map_type::right_map::const_iterator::value_type const& v) const
|
||||
{
|
||||
return v.get_left();
|
||||
@@ -121,7 +121,7 @@ public:
|
||||
size() const;
|
||||
|
||||
/**
|
||||
* IP::Endpoint iterators that traverse in decreasing valence.
|
||||
* ip::Endpoint iterators that traverse in decreasing valence.
|
||||
*/
|
||||
/** @{ */
|
||||
[[nodiscard]] const_iterator
|
||||
@@ -146,25 +146,25 @@ public:
|
||||
* Add a newly-learned address to the cache.
|
||||
*/
|
||||
bool
|
||||
insert(beast::IP::Endpoint const& endpoint);
|
||||
insert(beast::ip::Endpoint const& endpoint);
|
||||
|
||||
/**
|
||||
* Add a staticallyconfigured address to the cache.
|
||||
*/
|
||||
bool
|
||||
insertStatic(beast::IP::Endpoint const& endpoint);
|
||||
insertStatic(beast::ip::Endpoint const& endpoint);
|
||||
|
||||
/**
|
||||
* Called when an outbound connection handshake completes.
|
||||
*/
|
||||
void
|
||||
onSuccess(beast::IP::Endpoint const& endpoint);
|
||||
onSuccess(beast::ip::Endpoint const& endpoint);
|
||||
|
||||
/**
|
||||
* Called when an outbound connection attempt fails to handshake.
|
||||
*/
|
||||
void
|
||||
onFailure(beast::IP::Endpoint const& endpoint);
|
||||
onFailure(beast::ip::Endpoint const& endpoint);
|
||||
|
||||
/**
|
||||
* Stores the cache in the persistent database on a timer.
|
||||
@@ -189,4 +189,4 @@ private:
|
||||
flagForUpdate();
|
||||
};
|
||||
|
||||
} // namespace xrpl::PeerFinder
|
||||
} // namespace xrpl::peer_finder
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
||||
namespace xrpl::PeerFinder {
|
||||
namespace xrpl::peer_finder {
|
||||
|
||||
/**
|
||||
* Tests remote listening sockets to make sure they are connectable.
|
||||
@@ -104,7 +104,7 @@ public:
|
||||
*/
|
||||
template <class Handler>
|
||||
void
|
||||
asyncConnect(beast::IP::Endpoint const& endpoint, Handler&& handler);
|
||||
asyncConnect(beast::ip::Endpoint const& endpoint, Handler&& handler);
|
||||
|
||||
private:
|
||||
void
|
||||
@@ -179,7 +179,7 @@ Checker<Protocol>::wait()
|
||||
template <class Protocol>
|
||||
template <class Handler>
|
||||
void
|
||||
Checker<Protocol>::asyncConnect(beast::IP::Endpoint const& endpoint, Handler&& handler)
|
||||
Checker<Protocol>::asyncConnect(beast::ip::Endpoint const& endpoint, Handler&& handler)
|
||||
{
|
||||
auto const op =
|
||||
std::make_shared<AsyncOp<Handler>>(*this, ioContext_, std::forward<Handler>(handler));
|
||||
@@ -202,4 +202,4 @@ Checker<Protocol>::remove(BasicAsyncOp& op)
|
||||
cond_.notify_all();
|
||||
}
|
||||
|
||||
} // namespace xrpl::PeerFinder
|
||||
} // namespace xrpl::peer_finder
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
namespace xrpl::PeerFinder {
|
||||
namespace xrpl::peer_finder {
|
||||
|
||||
/**
|
||||
* Direction of a slot count adjustment.
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
// Must be handshaked and in the right state
|
||||
XRPL_ASSERT(
|
||||
s.state() == Slot::State::Connected || s.state() == Slot::State::Accept,
|
||||
"xrpl::PeerFinder::Counts::can_activate : valid input state");
|
||||
"xrpl::peer_finder::Counts::can_activate : valid input state");
|
||||
|
||||
if (s.fixed() || s.reserved())
|
||||
return true;
|
||||
@@ -67,9 +67,9 @@ public:
|
||||
[[nodiscard]] std::size_t
|
||||
attemptsNeeded() const
|
||||
{
|
||||
if (attempts_ >= Tuning::kMaxConnectAttempts)
|
||||
if (attempts_ >= tuning::kMaxConnectAttempts)
|
||||
return 0;
|
||||
return Tuning::kMaxConnectAttempts - attempts_;
|
||||
return tuning::kMaxConnectAttempts - attempts_;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -295,7 +295,7 @@ private:
|
||||
switch (s.state())
|
||||
{
|
||||
case Slot::State::Accept:
|
||||
XRPL_ASSERT(s.inbound(), "xrpl::PeerFinder::Counts::adjust : input is inbound");
|
||||
XRPL_ASSERT(s.inbound(), "xrpl::peer_finder::Counts::adjust : input is inbound");
|
||||
acceptCount_ += n;
|
||||
break;
|
||||
|
||||
@@ -303,7 +303,7 @@ private:
|
||||
case Slot::State::Connected:
|
||||
XRPL_ASSERT(
|
||||
!s.inbound(),
|
||||
"xrpl::PeerFinder::Counts::adjust : input is not "
|
||||
"xrpl::peer_finder::Counts::adjust : input is not "
|
||||
"inbound");
|
||||
attempts_ += n;
|
||||
break;
|
||||
@@ -331,7 +331,7 @@ private:
|
||||
|
||||
// LCOV_EXCL_START
|
||||
default:
|
||||
UNREACHABLE("xrpl::PeerFinder::Counts::adjust : invalid input state");
|
||||
UNREACHABLE("xrpl::peer_finder::Counts::adjust : invalid input state");
|
||||
break;
|
||||
// LCOV_EXCL_STOP
|
||||
};
|
||||
@@ -391,4 +391,4 @@ private:
|
||||
int closingCount_{0};
|
||||
};
|
||||
|
||||
} // namespace xrpl::PeerFinder
|
||||
} // namespace xrpl::peer_finder
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <chrono>
|
||||
#include <cstddef>
|
||||
|
||||
namespace xrpl::PeerFinder {
|
||||
namespace xrpl::peer_finder {
|
||||
|
||||
/**
|
||||
* Metadata for a Fixed slot.
|
||||
@@ -36,8 +36,8 @@ public:
|
||||
void
|
||||
failure(clock_type::time_point const& now)
|
||||
{
|
||||
failures_ = std::min(failures_ + 1, Tuning::kConnectionBackoff.size() - 1);
|
||||
when_ = now + std::chrono::minutes(Tuning::kConnectionBackoff[failures_]);
|
||||
failures_ = std::min(failures_ + 1, tuning::kConnectionBackoff.size() - 1);
|
||||
when_ = now + std::chrono::minutes(tuning::kConnectionBackoff[failures_]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,4 +55,4 @@ private:
|
||||
std::size_t failures_{0};
|
||||
};
|
||||
|
||||
} // namespace xrpl::PeerFinder
|
||||
} // namespace xrpl::peer_finder
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace xrpl::PeerFinder {
|
||||
namespace xrpl::peer_finder {
|
||||
|
||||
namespace detail {
|
||||
|
||||
@@ -28,7 +28,7 @@ template <class Target, class HopContainer>
|
||||
std::size_t
|
||||
handoutOne(Target& t, HopContainer& h)
|
||||
{
|
||||
XRPL_ASSERT(!t.full(), "xrpl::PeerFinder::detail::handoutOne : target is not full");
|
||||
XRPL_ASSERT(!t.full(), "xrpl::peer_finder::detail::handoutOne : target is not full");
|
||||
for (auto it = h.begin(); it != h.end(); ++it)
|
||||
{
|
||||
auto const& e = *it;
|
||||
@@ -95,7 +95,7 @@ public:
|
||||
[[nodiscard]] bool
|
||||
full() const
|
||||
{
|
||||
return list_.size() >= Tuning::kRedirectEndpointCount;
|
||||
return list_.size() >= tuning::kRedirectEndpointCount;
|
||||
}
|
||||
|
||||
[[nodiscard]] SlotImp::ptr const&
|
||||
@@ -124,7 +124,7 @@ private:
|
||||
template <class>
|
||||
RedirectHandouts::RedirectHandouts(SlotImp::ptr slot) : slot_(std::move(slot))
|
||||
{
|
||||
list_.reserve(Tuning::kRedirectEndpointCount);
|
||||
list_.reserve(tuning::kRedirectEndpointCount);
|
||||
}
|
||||
|
||||
template <class>
|
||||
@@ -138,7 +138,7 @@ RedirectHandouts::tryInsert(Endpoint const& ep)
|
||||
// addresses in a peer HTTP handshake instead of
|
||||
// the tmENDPOINTS message.
|
||||
//
|
||||
if (ep.hops > Tuning::kMaxHops)
|
||||
if (ep.hops > tuning::kMaxHops)
|
||||
return false;
|
||||
|
||||
// Don't send them our address
|
||||
@@ -181,7 +181,7 @@ public:
|
||||
[[nodiscard]] bool
|
||||
full() const
|
||||
{
|
||||
return list_.size() >= Tuning::kNumberOfEndpoints;
|
||||
return list_.size() >= tuning::kNumberOfEndpoints;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -210,7 +210,7 @@ private:
|
||||
template <class>
|
||||
SlotHandouts::SlotHandouts(SlotImp::ptr slot) : slot_(std::move(slot))
|
||||
{
|
||||
list_.reserve(Tuning::kNumberOfEndpoints);
|
||||
list_.reserve(tuning::kNumberOfEndpoints);
|
||||
}
|
||||
|
||||
template <class>
|
||||
@@ -220,7 +220,7 @@ SlotHandouts::tryInsert(Endpoint const& ep)
|
||||
if (full())
|
||||
return false;
|
||||
|
||||
if (ep.hops > Tuning::kMaxHops)
|
||||
if (ep.hops > tuning::kMaxHops)
|
||||
return false;
|
||||
|
||||
if (slot_->recent.filter(ep.address, ep.hops))
|
||||
@@ -259,9 +259,9 @@ class ConnectHandouts
|
||||
public:
|
||||
// Keeps track of addresses we have made outgoing connections
|
||||
// to, for the purposes of not connecting to them too frequently.
|
||||
using Squelches = beast::aged_set<beast::IP::Address>;
|
||||
using Squelches = beast::aged_set<beast::ip::Address>;
|
||||
|
||||
using list_type = std::vector<beast::IP::Endpoint>;
|
||||
using list_type = std::vector<beast::ip::Endpoint>;
|
||||
|
||||
private:
|
||||
std::size_t needed_;
|
||||
@@ -274,7 +274,7 @@ public:
|
||||
|
||||
template <class = void>
|
||||
bool
|
||||
tryInsert(beast::IP::Endpoint const& endpoint);
|
||||
tryInsert(beast::ip::Endpoint const& endpoint);
|
||||
|
||||
[[nodiscard]] bool
|
||||
empty() const
|
||||
@@ -316,13 +316,13 @@ ConnectHandouts::ConnectHandouts(std::size_t needed, Squelches& squelches)
|
||||
|
||||
template <class>
|
||||
bool
|
||||
ConnectHandouts::tryInsert(beast::IP::Endpoint const& endpoint)
|
||||
ConnectHandouts::tryInsert(beast::ip::Endpoint const& endpoint)
|
||||
{
|
||||
if (full())
|
||||
return false;
|
||||
|
||||
// Make sure the address isn't already in our list
|
||||
if (std::ranges::any_of(list_, [&endpoint](beast::IP::Endpoint const& other) {
|
||||
if (std::ranges::any_of(list_, [&endpoint](beast::ip::Endpoint const& other) {
|
||||
// Ignore port for security reasons
|
||||
return other.address() == endpoint.address();
|
||||
}))
|
||||
@@ -341,4 +341,4 @@ ConnectHandouts::tryInsert(beast::IP::Endpoint const& endpoint)
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace xrpl::PeerFinder
|
||||
} // namespace xrpl::peer_finder
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace xrpl::PeerFinder {
|
||||
namespace xrpl::peer_finder {
|
||||
|
||||
template <class>
|
||||
class Livecache;
|
||||
@@ -188,10 +188,10 @@ class Livecache : protected detail::LivecacheBase
|
||||
{
|
||||
private:
|
||||
using cache_type = beast::aged_map<
|
||||
beast::IP::Endpoint,
|
||||
beast::ip::Endpoint,
|
||||
Element,
|
||||
std::chrono::steady_clock,
|
||||
std::less<beast::IP::Endpoint>,
|
||||
std::less<beast::ip::Endpoint>,
|
||||
Allocator>;
|
||||
|
||||
beast::Journal journal_;
|
||||
@@ -220,8 +220,8 @@ public:
|
||||
// but not given out (since they would exceed maxHops). They
|
||||
// are used for automatic connection attempts.
|
||||
//
|
||||
using Histogram = std::array<int, 1 + Tuning::kMaxHops + 1>;
|
||||
using lists_type = std::array<list_type, 1 + Tuning::kMaxHops + 1>;
|
||||
using Histogram = std::array<int, 1 + tuning::kMaxHops + 1>;
|
||||
using lists_type = std::array<list_type, 1 + tuning::kMaxHops + 1>;
|
||||
|
||||
template <bool IsConst>
|
||||
struct Transform
|
||||
@@ -400,7 +400,7 @@ Livecache<Allocator>::expire()
|
||||
{
|
||||
std::size_t n(0);
|
||||
typename cache_type::time_point const expired(
|
||||
cache_.clock().now() - Tuning::kLiveCacheSecondsToLive);
|
||||
cache_.clock().now() - tuning::kLiveCacheSecondsToLive);
|
||||
for (auto iter(cache_.chronological.begin());
|
||||
iter != cache_.chronological.end() && iter.when() <= expired;)
|
||||
{
|
||||
@@ -427,8 +427,8 @@ Livecache<Allocator>::insert(Endpoint const& ep)
|
||||
// when redirecting.
|
||||
//
|
||||
XRPL_ASSERT(
|
||||
ep.hops <= (Tuning::kMaxHops + 1),
|
||||
"xrpl::PeerFinder::Livecache::insert : maximum input hops");
|
||||
ep.hops <= (tuning::kMaxHops + 1),
|
||||
"xrpl::peer_finder::Livecache::insert : maximum input hops");
|
||||
auto result = cache_.emplace(ep.address, ep);
|
||||
Element& e(result.first->second);
|
||||
if (result.second)
|
||||
@@ -468,7 +468,7 @@ void
|
||||
Livecache<Allocator>::onWrite(beast::PropertyStream::Map& map)
|
||||
{
|
||||
typename cache_type::time_point const expired(
|
||||
cache_.clock().now() - Tuning::kLiveCacheSecondsToLive);
|
||||
cache_.clock().now() - tuning::kLiveCacheSecondsToLive);
|
||||
map["size"] = size();
|
||||
map["hist"] = hops.histogram();
|
||||
beast::PropertyStream::Set set("entries", map);
|
||||
@@ -527,8 +527,8 @@ void
|
||||
Livecache<Allocator>::HopsT::insert(Element& e)
|
||||
{
|
||||
XRPL_ASSERT(
|
||||
e.endpoint.hops <= Tuning::kMaxHops + 1,
|
||||
"xrpl::PeerFinder::Livecache::HopsT::insert : maximum input hops");
|
||||
e.endpoint.hops <= tuning::kMaxHops + 1,
|
||||
"xrpl::peer_finder::Livecache::HopsT::insert : maximum input hops");
|
||||
// This has security implications without a shuffle
|
||||
lists_[e.endpoint.hops].push_front(e);
|
||||
++hist_[e.endpoint.hops];
|
||||
@@ -539,8 +539,8 @@ void
|
||||
Livecache<Allocator>::HopsT::reinsert(Element& e, std::uint32_t numHops)
|
||||
{
|
||||
XRPL_ASSERT(
|
||||
numHops <= Tuning::kMaxHops + 1,
|
||||
"xrpl::PeerFinder::Livecache::HopsT::reinsert : maximum hops input");
|
||||
numHops <= tuning::kMaxHops + 1,
|
||||
"xrpl::peer_finder::Livecache::HopsT::reinsert : maximum hops input");
|
||||
|
||||
auto& list = lists_[e.endpoint.hops];
|
||||
list.erase(list.iterator_to(e));
|
||||
@@ -561,4 +561,4 @@ Livecache<Allocator>::HopsT::remove(Element& e)
|
||||
list.erase(list.iterator_to(e));
|
||||
}
|
||||
|
||||
} // namespace xrpl::PeerFinder
|
||||
} // namespace xrpl::peer_finder
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace xrpl::PeerFinder {
|
||||
namespace xrpl::peer_finder {
|
||||
|
||||
/**
|
||||
* The Logic for maintaining the list of Slot addresses.
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
// Maps remote endpoints to slots. Since a slot has a
|
||||
// remote endpoint upon construction, this holds all counts_.
|
||||
//
|
||||
using Slots = std::map<beast::IP::Endpoint, std::shared_ptr<SlotImp>>;
|
||||
using Slots = std::map<beast::ip::Endpoint, std::shared_ptr<SlotImp>>;
|
||||
|
||||
beast::Journal journal;
|
||||
clock_type& clock;
|
||||
@@ -81,7 +81,7 @@ private:
|
||||
Counts counts_;
|
||||
|
||||
// A list of slots that should always be connected
|
||||
std::map<beast::IP::Endpoint, Fixed> fixed_;
|
||||
std::map<beast::ip::Endpoint, Fixed> fixed_;
|
||||
|
||||
public:
|
||||
// Live livecache from mtENDPOINTS messages
|
||||
@@ -96,7 +96,7 @@ public:
|
||||
// The addresses (but not port) we are connected to. This includes
|
||||
// outgoing connection attempts. Note that this set can contain
|
||||
// duplicates (since the port is not set)
|
||||
std::multiset<beast::IP::Address> connectedAddresses;
|
||||
std::multiset<beast::ip::Address> connectedAddresses;
|
||||
|
||||
// Set of public keys belonging to active peers
|
||||
std::set<PublicKey> keys;
|
||||
@@ -170,13 +170,13 @@ public:
|
||||
}
|
||||
|
||||
void
|
||||
addFixedPeer(std::string_view name, beast::IP::Endpoint const& ep)
|
||||
addFixedPeer(std::string_view name, beast::ip::Endpoint const& ep)
|
||||
{
|
||||
addFixedPeer(name, std::vector<beast::IP::Endpoint>{ep});
|
||||
addFixedPeer(name, std::vector<beast::ip::Endpoint>{ep});
|
||||
}
|
||||
|
||||
void
|
||||
addFixedPeer(std::string_view name, std::vector<beast::IP::Endpoint> const& addresses)
|
||||
addFixedPeer(std::string_view name, std::vector<beast::ip::Endpoint> const& addresses)
|
||||
{
|
||||
std::scoped_lock const _(lock);
|
||||
|
||||
@@ -213,8 +213,8 @@ public:
|
||||
// Called when the Checker completes a connectivity test
|
||||
void
|
||||
checkComplete(
|
||||
beast::IP::Endpoint const& remoteAddress,
|
||||
beast::IP::Endpoint const& checkedAddress,
|
||||
beast::ip::Endpoint const& remoteAddress,
|
||||
beast::ip::Endpoint const& checkedAddress,
|
||||
boost::system::error_code ec)
|
||||
{
|
||||
if (ec == boost::asio::error::operation_aborted)
|
||||
@@ -256,8 +256,8 @@ public:
|
||||
|
||||
std::pair<SlotImp::ptr, Result>
|
||||
newInboundSlot(
|
||||
beast::IP::Endpoint const& localEndpoint,
|
||||
beast::IP::Endpoint const& remoteEndpoint)
|
||||
beast::ip::Endpoint const& localEndpoint,
|
||||
beast::ip::Endpoint const& remoteEndpoint)
|
||||
{
|
||||
JLOG(journal.debug()) << std::left << std::setw(18) << "Logic accept" << remoteEndpoint
|
||||
<< " on local " << localEndpoint;
|
||||
@@ -293,7 +293,7 @@ public:
|
||||
// Remote address must not already exist
|
||||
XRPL_ASSERT(
|
||||
result.second,
|
||||
"xrpl::PeerFinder::Logic::new_inbound_slot : remote endpoint "
|
||||
"xrpl::peer_finder::Logic::new_inbound_slot : remote endpoint "
|
||||
"inserted");
|
||||
// Add to the connected address list
|
||||
connectedAddresses.emplace(remoteEndpoint.address());
|
||||
@@ -306,7 +306,7 @@ public:
|
||||
|
||||
// Can't check for self-connect because we don't know the local endpoint
|
||||
std::pair<SlotImp::ptr, Result>
|
||||
newOutboundSlot(beast::IP::Endpoint const& remoteEndpoint)
|
||||
newOutboundSlot(beast::ip::Endpoint const& remoteEndpoint)
|
||||
{
|
||||
JLOG(journal.debug()) << std::left << std::setw(18) << "Logic connect " << remoteEndpoint;
|
||||
|
||||
@@ -329,7 +329,7 @@ public:
|
||||
// Remote address must not already exist
|
||||
XRPL_ASSERT(
|
||||
result.second,
|
||||
"xrpl::PeerFinder::Logic::new_outbound_slot : remote endpoint "
|
||||
"xrpl::peer_finder::Logic::new_outbound_slot : remote endpoint "
|
||||
"inserted");
|
||||
|
||||
// Add to the connected address list
|
||||
@@ -342,7 +342,7 @@ public:
|
||||
}
|
||||
|
||||
bool
|
||||
onConnected(SlotImp::ptr const& slot, beast::IP::Endpoint const& localEndpoint)
|
||||
onConnected(SlotImp::ptr const& slot, beast::ip::Endpoint const& localEndpoint)
|
||||
{
|
||||
beast::WrappedSink sink{journal.sink(), slot->prefix()};
|
||||
beast::Journal const journal{sink};
|
||||
@@ -354,7 +354,7 @@ public:
|
||||
// The object must exist in our table
|
||||
XRPL_ASSERT(
|
||||
slots.contains(slot->remoteEndpoint()),
|
||||
"xrpl::PeerFinder::Logic::onConnected : valid slot input");
|
||||
"xrpl::peer_finder::Logic::onConnected : valid slot input");
|
||||
// Assign the local endpoint now that it's known
|
||||
slot->localEndpoint(localEndpoint);
|
||||
|
||||
@@ -365,7 +365,7 @@ public:
|
||||
{
|
||||
XRPL_ASSERT(
|
||||
iter->second->localEndpoint() == slot->remoteEndpoint(),
|
||||
"xrpl::PeerFinder::Logic::onConnected : local and remote "
|
||||
"xrpl::peer_finder::Logic::onConnected : local and remote "
|
||||
"endpoints do match");
|
||||
JLOG(journal.warn()) << "Logic dropping as self connect";
|
||||
return false;
|
||||
@@ -393,11 +393,11 @@ public:
|
||||
// The object must exist in our table
|
||||
XRPL_ASSERT(
|
||||
slots.contains(slot->remoteEndpoint()),
|
||||
"xrpl::PeerFinder::Logic::activate : valid slot input");
|
||||
"xrpl::peer_finder::Logic::activate : valid slot input");
|
||||
// Must be accepted or connected
|
||||
XRPL_ASSERT(
|
||||
slot->state() == Slot::State::Accept || slot->state() == Slot::State::Connected,
|
||||
"xrpl::PeerFinder::Logic::activate : valid slot state");
|
||||
"xrpl::peer_finder::Logic::activate : valid slot state");
|
||||
|
||||
// Check for duplicate connection by key
|
||||
if (keys.contains(key))
|
||||
@@ -425,7 +425,7 @@ public:
|
||||
{
|
||||
[[maybe_unused]] bool const inserted = keys.insert(key).second;
|
||||
// Public key must not already exist
|
||||
XRPL_ASSERT(inserted, "xrpl::PeerFinder::Logic::activate : public key inserted");
|
||||
XRPL_ASSERT(inserted, "xrpl::peer_finder::Logic::activate : public key inserted");
|
||||
}
|
||||
|
||||
// Change state and update counts
|
||||
@@ -443,7 +443,7 @@ public:
|
||||
if (iter == fixed_.end())
|
||||
{
|
||||
logicError(
|
||||
"PeerFinder::Logic::activate(): remote_endpoint "
|
||||
"peer_finder::Logic::activate(): remote_endpoint "
|
||||
"missing from fixed_");
|
||||
}
|
||||
|
||||
@@ -476,10 +476,10 @@ public:
|
||||
// VFALCO TODO This should add the returned addresses to the
|
||||
// squelch list in one go once the list is built,
|
||||
// rather than having each module add to the squelch list.
|
||||
std::vector<beast::IP::Endpoint>
|
||||
std::vector<beast::ip::Endpoint>
|
||||
autoconnect()
|
||||
{
|
||||
std::vector<beast::IP::Endpoint> none;
|
||||
std::vector<beast::ip::Endpoint> none;
|
||||
|
||||
std::scoped_lock const _(lock);
|
||||
|
||||
@@ -635,7 +635,7 @@ public:
|
||||
// either. ipv6 has a slightly more compact string
|
||||
// representation of 0, so use that for self entries.
|
||||
ep.address =
|
||||
beast::IP::Endpoint(beast::IP::AddressV6()).atPort(config_.listeningPort);
|
||||
beast::ip::Endpoint(beast::ip::AddressV6()).atPort(config_.listeningPort);
|
||||
for (auto& t : targets)
|
||||
t.insert(ep);
|
||||
}
|
||||
@@ -656,7 +656,7 @@ public:
|
||||
result.emplace_back(slot, list);
|
||||
}
|
||||
|
||||
whenBroadcast = now + Tuning::kSecondsPerMessage;
|
||||
whenBroadcast = now + tuning::kSecondsPerMessage;
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -675,7 +675,7 @@ public:
|
||||
entry.second->expire();
|
||||
|
||||
// Expire the recent attempts table
|
||||
beast::expire(squelches, Tuning::kRecentAttemptDuration);
|
||||
beast::expire(squelches, tuning::kRecentAttemptDuration);
|
||||
|
||||
bootcache.periodicActivity();
|
||||
}
|
||||
@@ -692,7 +692,7 @@ public:
|
||||
Endpoint& ep(*iter);
|
||||
|
||||
// Enforce hop limit
|
||||
if (ep.hops > Tuning::kMaxHops)
|
||||
if (ep.hops > tuning::kMaxHops)
|
||||
{
|
||||
JLOG(journal.debug()) << std::left << std::setw(18) << "Endpoints drop "
|
||||
<< ep.address << " for excess hops " << ep.hops;
|
||||
@@ -754,10 +754,10 @@ public:
|
||||
beast::Journal const journal{sink};
|
||||
|
||||
// If we're sent too many endpoints, sample them at random:
|
||||
if (list.size() > Tuning::kNumberOfEndpointsMax)
|
||||
if (list.size() > tuning::kNumberOfEndpointsMax)
|
||||
{
|
||||
std::shuffle(list.begin(), list.end(), defaultPrng());
|
||||
list.resize(Tuning::kNumberOfEndpointsMax);
|
||||
list.resize(tuning::kNumberOfEndpointsMax);
|
||||
}
|
||||
|
||||
JLOG(journal.trace()) << "Endpoints contained " << list.size()
|
||||
@@ -768,12 +768,12 @@ public:
|
||||
// The object must exist in our table
|
||||
XRPL_ASSERT(
|
||||
slots.contains(slot->remoteEndpoint()),
|
||||
"xrpl::PeerFinder::Logic::onEndpoints : valid slot input");
|
||||
"xrpl::peer_finder::Logic::onEndpoints : valid slot input");
|
||||
|
||||
// Must be handshaked!
|
||||
XRPL_ASSERT(
|
||||
slot->state() == Slot::State::Active,
|
||||
"xrpl::PeerFinder::Logic::onEndpoints : valid slot state");
|
||||
"xrpl::peer_finder::Logic::onEndpoints : valid slot state");
|
||||
|
||||
clock_type::time_point const now(clock.now());
|
||||
|
||||
@@ -785,7 +785,7 @@ public:
|
||||
|
||||
for (auto const& ep : list)
|
||||
{
|
||||
XRPL_ASSERT(ep.hops, "xrpl::PeerFinder::Logic::onEndpoints : nonzero hops");
|
||||
XRPL_ASSERT(ep.hops, "xrpl::peer_finder::Logic::onEndpoints : nonzero hops");
|
||||
|
||||
slot->recent.insert(ep.address, ep.hops);
|
||||
|
||||
@@ -837,7 +837,7 @@ public:
|
||||
bootcache.insert(ep.address);
|
||||
}
|
||||
|
||||
slot->whenAcceptEndpoints = now + Tuning::kSecondsPerMessage;
|
||||
slot->whenAcceptEndpoints = now + tuning::kSecondsPerMessage;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -851,7 +851,7 @@ public:
|
||||
if (iter == slots.end())
|
||||
{
|
||||
logicError(
|
||||
"PeerFinder::Logic::remove(): remote_endpoint "
|
||||
"peer_finder::Logic::remove(): remote_endpoint "
|
||||
"missing from slots_");
|
||||
}
|
||||
|
||||
@@ -866,7 +866,7 @@ public:
|
||||
if (iter == keys.end())
|
||||
{
|
||||
logicError(
|
||||
"PeerFinder::Logic::remove(): public_key missing "
|
||||
"peer_finder::Logic::remove(): public_key missing "
|
||||
"from keys_");
|
||||
}
|
||||
|
||||
@@ -879,7 +879,7 @@ public:
|
||||
if (iter == connectedAddresses.end())
|
||||
{
|
||||
logicError(
|
||||
"PeerFinder::Logic::remove(): remote_endpoint "
|
||||
"peer_finder::Logic::remove(): remote_endpoint "
|
||||
"address missing from connectedAddresses_");
|
||||
}
|
||||
|
||||
@@ -907,7 +907,7 @@ public:
|
||||
if (iter == fixed_.end())
|
||||
{
|
||||
logicError(
|
||||
"PeerFinder::Logic::on_closed(): remote_endpoint "
|
||||
"peer_finder::Logic::on_closed(): remote_endpoint "
|
||||
"missing from fixed_");
|
||||
}
|
||||
|
||||
@@ -943,7 +943,7 @@ public:
|
||||
// LCOV_EXCL_START
|
||||
default:
|
||||
UNREACHABLE(
|
||||
"xrpl::PeerFinder::Logic::on_closed : invalid slot "
|
||||
"xrpl::peer_finder::Logic::on_closed : invalid slot "
|
||||
"state");
|
||||
break;
|
||||
// LCOV_EXCL_STOP
|
||||
@@ -968,17 +968,17 @@ public:
|
||||
// Returns `true` if the address matches a fixed slot address
|
||||
// Must have the lock held
|
||||
bool
|
||||
fixed(beast::IP::Endpoint const& endpoint) const
|
||||
fixed(beast::ip::Endpoint const& endpoint) const
|
||||
{
|
||||
return std::ranges::any_of(
|
||||
fixed_, [&endpoint](auto const& entry) { return entry.first == endpoint; });
|
||||
}
|
||||
|
||||
// Returns `true` if the address matches a fixed slot address
|
||||
// Note that this does not use the port information in the IP::Endpoint
|
||||
// Note that this does not use the port information in the ip::Endpoint
|
||||
// Must have the lock held
|
||||
bool
|
||||
fixed(beast::IP::Address const& address) const
|
||||
fixed(beast::ip::Address const& address) const
|
||||
{
|
||||
return std::ranges::any_of(
|
||||
fixed_, [&address](auto const& entry) { return entry.first.address() == address; });
|
||||
@@ -1097,9 +1097,9 @@ public:
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
// Returns true if the IP::Endpoint contains no invalid data.
|
||||
// Returns true if the ip::Endpoint contains no invalid data.
|
||||
bool
|
||||
isValidAddress(beast::IP::Endpoint const& address)
|
||||
isValidAddress(beast::ip::Endpoint const& address)
|
||||
{
|
||||
if (isUnspecified(address))
|
||||
return false;
|
||||
@@ -1220,7 +1220,7 @@ Logic<Checker>::onRedirects(
|
||||
{
|
||||
std::scoped_lock const _(lock);
|
||||
std::size_t n = 0;
|
||||
for (; first != last && n < Tuning::kMaxRedirects; ++first, ++n)
|
||||
for (; first != last && n < tuning::kMaxRedirects; ++first, ++n)
|
||||
bootcache.insert(beast::IPAddressConversion::fromAsio(*first));
|
||||
if (n > 0)
|
||||
{
|
||||
@@ -1229,4 +1229,4 @@ Logic<Checker>::onRedirects(
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace xrpl::PeerFinder
|
||||
} // namespace xrpl::peer_finder
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
namespace xrpl::PeerFinder {
|
||||
namespace xrpl::peer_finder {
|
||||
|
||||
class SlotImp : public Slot
|
||||
{
|
||||
@@ -21,13 +21,13 @@ public:
|
||||
|
||||
// inbound
|
||||
SlotImp(
|
||||
beast::IP::Endpoint const& localEndpoint,
|
||||
beast::IP::Endpoint remoteEndpoint,
|
||||
beast::ip::Endpoint const& localEndpoint,
|
||||
beast::ip::Endpoint remoteEndpoint,
|
||||
bool fixed,
|
||||
clock_type& clock);
|
||||
|
||||
// outbound
|
||||
SlotImp(beast::IP::Endpoint remoteEndpoint, bool fixed, clock_type& clock);
|
||||
SlotImp(beast::ip::Endpoint remoteEndpoint, bool fixed, clock_type& clock);
|
||||
|
||||
bool
|
||||
inbound() const override
|
||||
@@ -53,13 +53,13 @@ public:
|
||||
return state_;
|
||||
}
|
||||
|
||||
beast::IP::Endpoint const&
|
||||
beast::ip::Endpoint const&
|
||||
remoteEndpoint() const override
|
||||
{
|
||||
return remoteEndpoint_;
|
||||
}
|
||||
|
||||
std::optional<beast::IP::Endpoint> const&
|
||||
std::optional<beast::ip::Endpoint> const&
|
||||
localEndpoint() const override
|
||||
{
|
||||
return localEndpoint_;
|
||||
@@ -93,13 +93,13 @@ public:
|
||||
}
|
||||
|
||||
void
|
||||
localEndpoint(beast::IP::Endpoint const& endpoint)
|
||||
localEndpoint(beast::ip::Endpoint const& endpoint)
|
||||
{
|
||||
localEndpoint_ = endpoint;
|
||||
}
|
||||
|
||||
void
|
||||
remoteEndpoint(beast::IP::Endpoint const& endpoint)
|
||||
remoteEndpoint(beast::ip::Endpoint const& endpoint)
|
||||
{
|
||||
remoteEndpoint_ = endpoint;
|
||||
}
|
||||
@@ -140,20 +140,20 @@ public:
|
||||
* sending a slot the same address too frequently.
|
||||
*/
|
||||
void
|
||||
insert(beast::IP::Endpoint const& ep, std::uint32_t hops);
|
||||
insert(beast::ip::Endpoint const& ep, std::uint32_t hops);
|
||||
|
||||
/**
|
||||
* Returns `true` if we should not send endpoint to the slot.
|
||||
*/
|
||||
bool
|
||||
filter(beast::IP::Endpoint const& ep, std::uint32_t hops);
|
||||
filter(beast::ip::Endpoint const& ep, std::uint32_t hops);
|
||||
|
||||
private:
|
||||
void
|
||||
expire();
|
||||
|
||||
friend class SlotImp;
|
||||
beast::aged_unordered_map<beast::IP::Endpoint, std::uint32_t> cache_;
|
||||
beast::aged_unordered_map<beast::ip::Endpoint, std::uint32_t> cache_;
|
||||
} recent;
|
||||
|
||||
void
|
||||
@@ -167,8 +167,8 @@ private:
|
||||
bool const fixed_;
|
||||
bool reserved_;
|
||||
State state_;
|
||||
beast::IP::Endpoint remoteEndpoint_;
|
||||
std::optional<beast::IP::Endpoint> localEndpoint_;
|
||||
beast::ip::Endpoint remoteEndpoint_;
|
||||
std::optional<beast::ip::Endpoint> localEndpoint_;
|
||||
std::optional<PublicKey> publicKey_;
|
||||
|
||||
static std::int32_t constexpr kUnknownPort = -1;
|
||||
@@ -196,4 +196,4 @@ public:
|
||||
clock_type::time_point whenAcceptEndpoints;
|
||||
};
|
||||
|
||||
} // namespace xrpl::PeerFinder
|
||||
} // namespace xrpl::peer_finder
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace xrpl::PeerFinder {
|
||||
namespace xrpl::peer_finder {
|
||||
|
||||
/**
|
||||
* A static or dynamic source of peer addresses.
|
||||
@@ -46,4 +46,4 @@ public:
|
||||
fetch(Results& results, beast::Journal journal) = 0;
|
||||
};
|
||||
|
||||
} // namespace xrpl::PeerFinder
|
||||
} // namespace xrpl::peer_finder
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace xrpl::PeerFinder {
|
||||
namespace xrpl::peer_finder {
|
||||
|
||||
/**
|
||||
* Provides addresses from a static set of strings.
|
||||
@@ -22,4 +22,4 @@ public:
|
||||
make(std::string const& name, Strings const& strings);
|
||||
};
|
||||
|
||||
} // namespace xrpl::PeerFinder
|
||||
} // namespace xrpl::peer_finder
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
namespace xrpl::PeerFinder {
|
||||
namespace xrpl::peer_finder {
|
||||
|
||||
/**
|
||||
* Abstract persistence for PeerFinder data.
|
||||
@@ -17,7 +17,7 @@ public:
|
||||
virtual ~Store() = default;
|
||||
|
||||
// load the bootstrap cache
|
||||
using load_callback = std::function<void(beast::IP::Endpoint, int)>;
|
||||
using load_callback = std::function<void(beast::ip::Endpoint, int)>;
|
||||
virtual std::size_t
|
||||
load(load_callback const& cb) = 0;
|
||||
|
||||
@@ -26,11 +26,11 @@ public:
|
||||
{
|
||||
explicit Entry() = default;
|
||||
|
||||
beast::IP::Endpoint endpoint;
|
||||
beast::ip::Endpoint endpoint;
|
||||
int valence{};
|
||||
};
|
||||
virtual void
|
||||
save(std::vector<Entry> const& v) = 0;
|
||||
};
|
||||
|
||||
} // namespace xrpl::PeerFinder
|
||||
} // namespace xrpl::peer_finder
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* Heuristically tuned constants.
|
||||
*/
|
||||
/** @{ */
|
||||
namespace xrpl::PeerFinder::Tuning {
|
||||
namespace xrpl::peer_finder::tuning {
|
||||
|
||||
//---------------------------------------------------------
|
||||
//
|
||||
@@ -111,5 +111,5 @@ constexpr std::chrono::seconds kLiveCacheSecondsToLive(30);
|
||||
// Note that we ignore the port for purposes of comparison.
|
||||
constexpr std::chrono::seconds kRecentAttemptDuration(60);
|
||||
|
||||
} // namespace xrpl::PeerFinder::Tuning
|
||||
} // namespace xrpl::peer_finder::tuning
|
||||
/** @} */
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace xrpl::PeerFinder {
|
||||
namespace xrpl::peer_finder {
|
||||
|
||||
/**
|
||||
* @brief Create a new Manager.
|
||||
@@ -33,4 +33,4 @@ makeManager(
|
||||
Store& store,
|
||||
beast::insight::Collector::ptr const& collector);
|
||||
|
||||
} // namespace xrpl::PeerFinder
|
||||
} // namespace xrpl::peer_finder
|
||||
|
||||
@@ -246,7 +246,15 @@ message TMGetObjectByHash {
|
||||
|
||||
message TMLedgerNode {
|
||||
required bytes nodedata = 1;
|
||||
optional bytes nodeid = 2; // missing for ledger base data
|
||||
|
||||
// Used when protocol version <2.3. Not set for ledger base data.
|
||||
optional bytes nodeid = 2;
|
||||
|
||||
// Used when protocol version >=2.3. Neither value is set for ledger base data.
|
||||
oneof reference {
|
||||
bytes id = 3; // Set for inner nodes.
|
||||
uint32 depth = 4; // Set for leaf nodes.
|
||||
}
|
||||
}
|
||||
|
||||
enum TMLedgerInfoType {
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace xrpl {
|
||||
* Command line Requests use apiCommandLineVersion.
|
||||
*/
|
||||
|
||||
namespace RPC {
|
||||
namespace rpc {
|
||||
|
||||
template <unsigned int Version>
|
||||
static constexpr std::integral_constant<unsigned, Version> kApiVersion = {};
|
||||
@@ -60,7 +60,7 @@ static_assert(kApiMaximumValidVersion >= kApiMaximumSupportedVersion);
|
||||
inline void
|
||||
setVersion(json::Value& parent, unsigned int apiVersion, bool betaEnabled)
|
||||
{
|
||||
XRPL_ASSERT(apiVersion != kApiInvalidVersion, "xrpl::RPC::setVersion : input is valid");
|
||||
XRPL_ASSERT(apiVersion != kApiInvalidVersion, "xrpl::rpc::setVersion : input is valid");
|
||||
|
||||
auto& retObj = parent[jss::version] = json::ValueType::Object;
|
||||
|
||||
@@ -99,12 +99,12 @@ setVersion(json::Value& parent, unsigned int apiVersion, bool betaEnabled)
|
||||
inline unsigned int
|
||||
getAPIVersionNumber(json::Value const& jv, bool betaEnabled)
|
||||
{
|
||||
static json::Value const kMinVersion(RPC::kApiMinimumSupportedVersion);
|
||||
static json::Value const kMinVersion(rpc::kApiMinimumSupportedVersion);
|
||||
json::Value const maxVersion(
|
||||
betaEnabled ? RPC::kApiBetaVersion : RPC::kApiMaximumSupportedVersion);
|
||||
betaEnabled ? rpc::kApiBetaVersion : rpc::kApiMaximumSupportedVersion);
|
||||
|
||||
if (!jv.isObject() || !jv.isMember(jss::api_version))
|
||||
return RPC::kApiVersionIfUnspecified;
|
||||
return rpc::kApiVersionIfUnspecified;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -113,33 +113,33 @@ getAPIVersionNumber(json::Value const& jv, bool betaEnabled)
|
||||
{
|
||||
case json::ValueType::Int:
|
||||
if (rawVersion.asInt() < 0)
|
||||
return RPC::kApiInvalidVersion;
|
||||
return rpc::kApiInvalidVersion;
|
||||
[[fallthrough]];
|
||||
case json::ValueType::UInt: {
|
||||
auto const apiVersion = rawVersion.asUInt();
|
||||
if (apiVersion < kMinVersion || apiVersion > maxVersion)
|
||||
return RPC::kApiInvalidVersion;
|
||||
return rpc::kApiInvalidVersion;
|
||||
return apiVersion;
|
||||
}
|
||||
default:
|
||||
return RPC::kApiInvalidVersion;
|
||||
return rpc::kApiInvalidVersion;
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
return RPC::kApiInvalidVersion;
|
||||
return rpc::kApiInvalidVersion;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace RPC
|
||||
} // namespace rpc
|
||||
|
||||
template <unsigned MinVer, unsigned MaxVer, typename Fn, typename... Args>
|
||||
void
|
||||
forApiVersions(Fn const& fn, Args&&... args)
|
||||
requires //
|
||||
(MaxVer >= MinVer) && //
|
||||
(MinVer >= RPC::kApiMinimumSupportedVersion) && //
|
||||
(RPC::kApiMaximumValidVersion >= MaxVer) && requires {
|
||||
(MinVer >= rpc::kApiMinimumSupportedVersion) && //
|
||||
(rpc::kApiMaximumValidVersion >= MaxVer) && requires {
|
||||
fn(std::integral_constant<unsigned int, MinVer>{}, std::forward<Args>(args)...);
|
||||
fn(std::integral_constant<unsigned int, MaxVer>{}, std::forward<Args>(args)...);
|
||||
}
|
||||
@@ -158,11 +158,11 @@ template <typename Fn, typename... Args>
|
||||
void
|
||||
forAllApiVersions(Fn const& fn, Args&&... args)
|
||||
requires requires {
|
||||
forApiVersions<RPC::kApiMinimumSupportedVersion, RPC::kApiMaximumValidVersion>(
|
||||
forApiVersions<rpc::kApiMinimumSupportedVersion, rpc::kApiMaximumValidVersion>(
|
||||
fn, std::forward<Args>(args)...);
|
||||
}
|
||||
{
|
||||
forApiVersions<RPC::kApiMinimumSupportedVersion, RPC::kApiMaximumValidVersion>(
|
||||
forApiVersions<rpc::kApiMinimumSupportedVersion, rpc::kApiMaximumValidVersion>(
|
||||
fn, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* Versioning information for this build.
|
||||
*/
|
||||
// VFALCO The namespace is deprecated
|
||||
namespace xrpl::BuildInfo {
|
||||
namespace xrpl::build_info {
|
||||
|
||||
/**
|
||||
* Server version.
|
||||
@@ -84,4 +84,4 @@ isXrpldVersion(std::uint64_t version);
|
||||
bool
|
||||
isNewerVersion(std::uint64_t version);
|
||||
|
||||
} // namespace xrpl::BuildInfo
|
||||
} // namespace xrpl::build_info
|
||||
|
||||
@@ -167,7 +167,7 @@ enum WarningCodeI {
|
||||
|
||||
// VFALCO NOTE these should probably not be in the RPC namespace.
|
||||
|
||||
namespace RPC {
|
||||
namespace rpc {
|
||||
|
||||
/**
|
||||
* Maps an rpc error code to its token, default message, and HTTP status.
|
||||
@@ -337,7 +337,7 @@ containsError(json::Value const& json);
|
||||
int
|
||||
errorCodeHttpStatus(ErrorCodeI code);
|
||||
|
||||
} // namespace RPC
|
||||
} // namespace rpc
|
||||
|
||||
/**
|
||||
* Returns a single string with the contents of an RPC error.
|
||||
|
||||
@@ -187,20 +187,6 @@ check(uint256 const& key) noexcept
|
||||
}
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* A TransactionProposal
|
||||
*/
|
||||
/** @{ */
|
||||
Keylet
|
||||
txProposal(AccountID const& target, std::uint32_t ticketSequence) noexcept;
|
||||
|
||||
inline Keylet
|
||||
txProposal(uint256 const& key) noexcept
|
||||
{
|
||||
return {ltTRANSACTION_PROPOSAL, key};
|
||||
}
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* A DepositPreauth
|
||||
*/
|
||||
|
||||
@@ -188,6 +188,6 @@ struct MultiApiJson
|
||||
|
||||
// Wrapper for Json for all supported API versions.
|
||||
using MultiApiJson =
|
||||
detail::MultiApiJson<RPC::kApiMinimumSupportedVersion, RPC::kApiMaximumValidVersion>;
|
||||
detail::MultiApiJson<rpc::kApiMinimumSupportedVersion, rpc::kApiMaximumValidVersion>;
|
||||
|
||||
} // namespace xrpl
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace xrpl::RPC {
|
||||
namespace xrpl::rpc {
|
||||
|
||||
/**
|
||||
* Adds common synthetic fields to transaction-related JSON responses
|
||||
@@ -16,4 +16,4 @@ void
|
||||
insertNFTSyntheticInJson(json::Value&, std::shared_ptr<STTx const> const&, TxMeta const&);
|
||||
/** @} */
|
||||
|
||||
} // namespace xrpl::RPC
|
||||
} // namespace xrpl::rpc
|
||||
|
||||
@@ -139,7 +139,7 @@ tenthBipsOfValue(T value, TenthBips<TBips> bips)
|
||||
return value * bips.value() / kTenthBipsPerUnity.value();
|
||||
}
|
||||
|
||||
namespace Lending {
|
||||
namespace lending {
|
||||
/**
|
||||
* The maximum management fee rate allowed by a loan broker in 1/10 bips.
|
||||
*
|
||||
@@ -236,7 +236,7 @@ static constexpr int kLoanPaymentsPerFeeIncrement = 5;
|
||||
* without an amendment
|
||||
*/
|
||||
static constexpr int kLoanMaximumPaymentsPerTransaction = 100;
|
||||
} // namespace Lending
|
||||
} // namespace lending
|
||||
|
||||
/**
|
||||
* The maximum length of a URI inside an NFT
|
||||
@@ -316,6 +316,17 @@ constexpr std::uint8_t kVaultDefaultIouScale = 6;
|
||||
*/
|
||||
constexpr std::uint8_t kVaultMaximumIouScale = 18;
|
||||
|
||||
/**
|
||||
* Vault ledger-entry schema versions. Assigned to newly created
|
||||
* Vaults once featureLendingProtocolV1_1 is enabled. Vaults created before
|
||||
* activation are left without LEVersion (implicit legacy version 0,
|
||||
* accrual-basis accounting).
|
||||
*/
|
||||
enum class VaultVersion : uint8_t {
|
||||
Legacy = 0,
|
||||
CashBasis,
|
||||
};
|
||||
|
||||
/**
|
||||
* Maximum recursion depth for vault shares being put as an asset inside
|
||||
* another vault; counted from 0
|
||||
|
||||
@@ -260,7 +260,7 @@ calcAccountID(PublicKey const& pk);
|
||||
|
||||
inline std::string
|
||||
getFingerprint(
|
||||
beast::IP::Endpoint const& address,
|
||||
beast::ip::Endpoint const& address,
|
||||
std::optional<PublicKey> const& publicKey = std::nullopt,
|
||||
std::optional<std::string> const& id = std::nullopt)
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
namespace Attestations {
|
||||
namespace attestations {
|
||||
|
||||
struct AttestationBase
|
||||
{
|
||||
@@ -227,7 +227,7 @@ struct CmpByCreateCount
|
||||
}
|
||||
};
|
||||
|
||||
}; // namespace Attestations
|
||||
}; // namespace attestations
|
||||
|
||||
// Result when checking when two attestation match.
|
||||
enum class AttestationMatch {
|
||||
@@ -241,7 +241,7 @@ enum class AttestationMatch {
|
||||
|
||||
struct XChainClaimAttestation
|
||||
{
|
||||
using TSignedAttestation = Attestations::AttestationClaim;
|
||||
using TSignedAttestation = attestations::AttestationClaim;
|
||||
static SField const& arrayFieldName;
|
||||
|
||||
AccountID keyAccount;
|
||||
@@ -297,7 +297,7 @@ struct XChainClaimAttestation
|
||||
|
||||
struct XChainCreateAccountAttestation
|
||||
{
|
||||
using TSignedAttestation = Attestations::AttestationCreateAccount;
|
||||
using TSignedAttestation = attestations::AttestationCreateAccount;
|
||||
static SField const& arrayFieldName;
|
||||
|
||||
AccountID keyAccount;
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
// Add new amendments to the top of this list.
|
||||
// Keep it sorted in reverse chronological order.
|
||||
|
||||
XRPL_FEATURE(Cosign, Supported::No, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (Cleanup3_4_0, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(Sponsor, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(BatchV1_1, Supported::Yes, VoteBehavior::DefaultNo)
|
||||
|
||||
@@ -505,6 +505,7 @@ LEDGER_ENTRY(ltVAULT, 0x0084, Vault, vault, ({
|
||||
{sfShareMPTID, SoeRequired},
|
||||
{sfWithdrawalPolicy, SoeRequired},
|
||||
{sfScale, SoeDefault},
|
||||
{sfLEVersion, SoeDefault},
|
||||
// no SharesTotal ever (use MPTIssuance.sfOutstandingAmount)
|
||||
// no PermissionedDomainID ever (use MPTIssuance.sfDomainID)
|
||||
}))
|
||||
@@ -636,24 +637,5 @@ LEDGER_ENTRY(ltSPONSORSHIP, 0x0090, Sponsorship, sponsorship, ({
|
||||
{sfSponseeNode, SoeRequired},
|
||||
}))
|
||||
|
||||
/** A ledger object holding a pending transaction proposal.
|
||||
|
||||
The proposed transaction is stored unsigned in ProposedTransaction, and
|
||||
signatures accumulate on it over time. It becomes fully signed either from
|
||||
a single signature by its own Account (or that account's Delegate), or once
|
||||
the weight collected in its Signers field meets that account's quorum. At
|
||||
that point the stored transaction is one that anyone may copy and submit.
|
||||
|
||||
\sa keylet::txProposal
|
||||
*/
|
||||
LEDGER_ENTRY(ltTRANSACTION_PROPOSAL, 0x0091, TransactionProposal, transaction_proposal, ({
|
||||
{sfPreviousTxnID, SoeRequired},
|
||||
{sfPreviousTxnLgrSeq, SoeRequired},
|
||||
{sfOwner, SoeRequired},
|
||||
{sfProposedTransaction, SoeRequired},
|
||||
{sfExpiration, SoeRequired},
|
||||
{sfOwnerNode, SoeRequired},
|
||||
}))
|
||||
|
||||
#undef EXPAND
|
||||
#undef LEDGER_ENTRY_DUPLICATE
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user