mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-03 00:36:48 +00:00
Merge branch 'develop' into pratik/Retire_fixUniversalNumber_amendment
This commit is contained in:
@@ -7,6 +7,7 @@ Checks: "-*,
|
||||
bugprone-bad-signal-to-kill-thread,
|
||||
bugprone-bool-pointer-implicit-conversion,
|
||||
bugprone-casting-through-void,
|
||||
bugprone-capturing-this-in-member-variable,
|
||||
bugprone-chained-comparison,
|
||||
bugprone-compare-pointer-to-member-virtual-function,
|
||||
bugprone-copy-constructor-init,
|
||||
@@ -28,6 +29,7 @@ Checks: "-*,
|
||||
bugprone-misplaced-operator-in-strlen-in-alloc,
|
||||
bugprone-misplaced-pointer-arithmetic-in-alloc,
|
||||
bugprone-misplaced-widening-cast,
|
||||
bugprone-misleading-setter-of-reference,
|
||||
bugprone-move-forwarding-reference,
|
||||
bugprone-multi-level-implicit-pointer-conversion,
|
||||
bugprone-multiple-new-in-one-expression,
|
||||
@@ -73,7 +75,7 @@ Checks: "-*,
|
||||
bugprone-unhandled-self-assignment,
|
||||
bugprone-unique-ptr-array-mismatch,
|
||||
bugprone-unsafe-functions,
|
||||
bugprone-use-after-move, # has issues
|
||||
bugprone-use-after-move,
|
||||
bugprone-unused-raii,
|
||||
bugprone-unused-return-value,
|
||||
bugprone-unused-local-non-trivial-variable,
|
||||
@@ -85,6 +87,7 @@ Checks: "-*,
|
||||
cppcoreguidelines-pro-type-static-cast-downcast,
|
||||
cppcoreguidelines-rvalue-reference-param-not-moved,
|
||||
cppcoreguidelines-use-default-member-init,
|
||||
cppcoreguidelines-use-enum-class,
|
||||
cppcoreguidelines-virtual-class-destructor,
|
||||
hicpp-ignored-remove-result,
|
||||
misc-const-correctness,
|
||||
@@ -106,8 +109,10 @@ Checks: "-*,
|
||||
modernize-use-emplace,
|
||||
modernize-use-equals-default,
|
||||
modernize-use-equals-delete,
|
||||
modernize-use-nodiscard,
|
||||
modernize-use-override,
|
||||
modernize-use-ranges,
|
||||
modernize-use-scoped-lock,
|
||||
modernize-use-starts-ends-with,
|
||||
modernize-use-std-numbers,
|
||||
modernize-use-using,
|
||||
@@ -121,6 +126,7 @@ Checks: "-*,
|
||||
performance-move-constructor-init,
|
||||
performance-no-automatic-move,
|
||||
performance-trivially-destructible,
|
||||
readability-ambiguous-smartptr-reset-call,
|
||||
readability-avoid-nested-conditional-operator,
|
||||
readability-avoid-return-with-void-value,
|
||||
readability-braces-around-statements,
|
||||
|
||||
43
.github/actions/print-env/action.yml
vendored
43
.github/actions/print-env/action.yml
vendored
@@ -1,43 +0,0 @@
|
||||
name: Print build environment
|
||||
description: "Print environment and some tooling versions"
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Check configuration (Windows)
|
||||
if: ${{ runner.os == 'Windows' }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo 'Checking environment variables.'
|
||||
set
|
||||
|
||||
- name: Check configuration (Linux and macOS)
|
||||
if: ${{ runner.os == 'Linux' || runner.os == 'macOS' }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo 'Checking path.'
|
||||
echo ${PATH} | tr ':' '\n'
|
||||
|
||||
echo 'Checking environment variables.'
|
||||
env | sort
|
||||
|
||||
echo 'Checking compiler version.'
|
||||
${{ runner.os == 'Linux' && '${CC}' || 'clang' }} --version
|
||||
|
||||
echo 'Checking Ninja version.'
|
||||
ninja --version
|
||||
|
||||
echo 'Checking nproc version.'
|
||||
nproc --version
|
||||
|
||||
- name: Check configuration (all)
|
||||
shell: bash
|
||||
run: |
|
||||
echo 'Checking Ccache version.'
|
||||
ccache --version
|
||||
|
||||
echo 'Checking CMake version.'
|
||||
cmake --version
|
||||
|
||||
echo 'Checking Conan version.'
|
||||
conan --version
|
||||
11
.github/dependabot.yml
vendored
11
.github/dependabot.yml
vendored
@@ -33,17 +33,6 @@ updates:
|
||||
prefix: "ci: [DEPENDABOT] "
|
||||
target-branch: develop
|
||||
|
||||
- package-ecosystem: github-actions
|
||||
directory: .github/actions/print-env/
|
||||
schedule:
|
||||
interval: weekly
|
||||
day: monday
|
||||
time: "04:00"
|
||||
timezone: Etc/GMT
|
||||
commit-message:
|
||||
prefix: "ci: [DEPENDABOT] "
|
||||
target-branch: develop
|
||||
|
||||
- package-ecosystem: github-actions
|
||||
directory: .github/actions/setup-conan/
|
||||
schedule:
|
||||
|
||||
@@ -188,10 +188,16 @@ test.toplevel > xrpl.json
|
||||
test.unit_test > xrpl.basics
|
||||
test.unit_test > xrpl.protocol
|
||||
tests.libxrpl > xrpl.basics
|
||||
tests.libxrpl > xrpl.core
|
||||
tests.libxrpl > xrpl.json
|
||||
tests.libxrpl > xrpl.ledger
|
||||
tests.libxrpl > xrpl.net
|
||||
tests.libxrpl > xrpl.nodestore
|
||||
tests.libxrpl > xrpl.protocol
|
||||
tests.libxrpl > xrpl.protocol_autogen
|
||||
tests.libxrpl > xrpl.server
|
||||
tests.libxrpl > xrpl.shamap
|
||||
tests.libxrpl > xrpl.tx
|
||||
xrpl.conditions > xrpl.basics
|
||||
xrpl.conditions > xrpl.protocol
|
||||
xrpl.core > xrpl.basics
|
||||
|
||||
51
.github/scripts/strategy-matrix/generate.py
vendored
51
.github/scripts/strategy-matrix/generate.py
vendored
@@ -51,20 +51,21 @@ def generate_strategy_matrix(all: bool, config: Config) -> list:
|
||||
# Only generate a subset of configurations in PRs.
|
||||
if not all:
|
||||
# Debian:
|
||||
# - Bookworm using GCC 13: Release on linux/amd64, set the reference
|
||||
# fee to 500.
|
||||
# - Bookworm using GCC 15: Debug on linux/amd64, enable code
|
||||
# coverage (which will be done below).
|
||||
# - Bookworm using GCC 13: Debug on linux/amd64, set the reference
|
||||
# fee to 500 and enable code coverage (which will be done below).
|
||||
# - Bookworm using GCC 15: Debug on linux/amd64, enable Address and
|
||||
# UB sanitizers (which will be done below).
|
||||
# - Bookworm using Clang 16: Debug on linux/amd64, enable voidstar.
|
||||
# - Bookworm using Clang 17: Release on linux/amd64, set the
|
||||
# reference fee to 1000.
|
||||
# - Bookworm using Clang 20: Debug on linux/amd64.
|
||||
# - Bookworm using Clang 20: Debug on linux/amd64, enable Address
|
||||
# and UB sanitizers (which will be done below).
|
||||
if os["distro_name"] == "debian":
|
||||
skip = True
|
||||
if os["distro_version"] == "bookworm":
|
||||
if (
|
||||
f"{os['compiler_name']}-{os['compiler_version']}" == "gcc-13"
|
||||
and build_type == "Release"
|
||||
and build_type == "Debug"
|
||||
and architecture["platform"] == "linux/amd64"
|
||||
):
|
||||
cmake_args = f"-DUNIT_TEST_REFERENCE_FEE=500 {cmake_args}"
|
||||
@@ -193,11 +194,11 @@ def generate_strategy_matrix(all: bool, config: Config) -> list:
|
||||
):
|
||||
continue
|
||||
|
||||
# Enable code coverage for Debian Bookworm using GCC 15 in Debug on
|
||||
# linux/amd64
|
||||
# Enable code coverage for Debian Bookworm using GCC 13 in Debug on
|
||||
# linux/amd64.
|
||||
if (
|
||||
f"{os['distro_name']}-{os['distro_version']}" == "debian-bookworm"
|
||||
and f"{os['compiler_name']}-{os['compiler_version']}" == "gcc-15"
|
||||
and f"{os['compiler_name']}-{os['compiler_version']}" == "gcc-13"
|
||||
and build_type == "Debug"
|
||||
and architecture["platform"] == "linux/amd64"
|
||||
):
|
||||
@@ -234,23 +235,39 @@ def generate_strategy_matrix(all: bool, config: Config) -> list:
|
||||
# Add the configuration to the list, with the most unique fields first,
|
||||
# so that they are easier to identify in the GitHub Actions UI, as long
|
||||
# names get truncated.
|
||||
# Add Address and Thread (both coupled with UB) sanitizers for specific bookworm distros.
|
||||
# Add Address and UB sanitizers as separate configurations for specific
|
||||
# bookworm distros. Thread sanitizer is currently disabled (see below).
|
||||
# GCC-Asan xrpld-embedded tests are failing because of https://github.com/google/sanitizers/issues/856
|
||||
if (
|
||||
os["distro_version"] == "bookworm"
|
||||
and f"{os['compiler_name']}-{os['compiler_version']}" == "clang-20"
|
||||
):
|
||||
# Add ASAN + UBSAN configuration.
|
||||
if os[
|
||||
"distro_version"
|
||||
] == "bookworm" and f"{os['compiler_name']}-{os['compiler_version']}" in [
|
||||
"gcc-15",
|
||||
"clang-20",
|
||||
]:
|
||||
# Add ASAN configuration.
|
||||
configurations.append(
|
||||
{
|
||||
"config_name": config_name + "-asan-ubsan",
|
||||
"config_name": config_name + "-asan",
|
||||
"cmake_args": cmake_args,
|
||||
"cmake_target": cmake_target,
|
||||
"build_only": build_only,
|
||||
"build_type": build_type,
|
||||
"os": os,
|
||||
"architecture": architecture,
|
||||
"sanitizers": "address,undefinedbehavior",
|
||||
"sanitizers": "address",
|
||||
}
|
||||
)
|
||||
# Add UBSAN configuration.
|
||||
configurations.append(
|
||||
{
|
||||
"config_name": config_name + "-ubsan",
|
||||
"cmake_args": cmake_args,
|
||||
"cmake_target": cmake_target,
|
||||
"build_only": build_only,
|
||||
"build_type": build_type,
|
||||
"os": os,
|
||||
"architecture": architecture,
|
||||
"sanitizers": "undefinedbehavior",
|
||||
}
|
||||
)
|
||||
# TSAN is deactivated due to seg faults with latest compilers.
|
||||
|
||||
2
.github/workflows/pre-commit.yml
vendored
2
.github/workflows/pre-commit.yml
vendored
@@ -14,7 +14,7 @@ on:
|
||||
jobs:
|
||||
# Call the workflow in the XRPLF/actions repo that runs the pre-commit hooks.
|
||||
run-hooks:
|
||||
uses: XRPLF/actions/.github/workflows/pre-commit.yml@9307df762265e15c745ddcdb38a581c989f7f349
|
||||
uses: XRPLF/actions/.github/workflows/pre-commit.yml@5e942d61bf32f7557a7c159cfac4712a687b3e3a
|
||||
with:
|
||||
runs_on: ubuntu-latest
|
||||
container: '{ "image": "ghcr.io/xrplf/ci/tools-rippled-pre-commit:sha-41ec7c1" }'
|
||||
|
||||
@@ -116,7 +116,7 @@ jobs:
|
||||
run: echo "CCACHE_LOGFILE=${{ runner.temp }}/ccache.log" >> "${GITHUB_ENV}"
|
||||
|
||||
- name: Print build environment
|
||||
uses: ./.github/actions/print-env
|
||||
uses: XRPLF/actions/print-env@8f811899319ef002e7a088c77c57d95aba602a97
|
||||
|
||||
- name: Get number of processors
|
||||
uses: XRPLF/actions/get-nproc@cf0433aa74563aead044a1e395610c96d65a37cf
|
||||
|
||||
@@ -40,7 +40,7 @@ jobs:
|
||||
enable_ccache: false
|
||||
|
||||
- name: Print build environment
|
||||
uses: ./.github/actions/print-env
|
||||
uses: XRPLF/actions/print-env@8f811899319ef002e7a088c77c57d95aba602a97
|
||||
|
||||
- name: Get number of processors
|
||||
uses: XRPLF/actions/get-nproc@cf0433aa74563aead044a1e395610c96d65a37cf
|
||||
|
||||
2
.github/workflows/upload-conan-deps.yml
vendored
2
.github/workflows/upload-conan-deps.yml
vendored
@@ -75,7 +75,7 @@ jobs:
|
||||
enable_ccache: false
|
||||
|
||||
- name: Print build environment
|
||||
uses: ./.github/actions/print-env
|
||||
uses: XRPLF/actions/print-env@8f811899319ef002e7a088c77c57d95aba602a97
|
||||
|
||||
- name: Get number of processors
|
||||
uses: XRPLF/actions/get-nproc@cf0433aa74563aead044a1e395610c96d65a37cf
|
||||
|
||||
@@ -28,6 +28,8 @@ This section contains changes targeting a future version.
|
||||
|
||||
### Additions
|
||||
|
||||
- `ledger_entry`, `account_objects`: The `Delegate` ledger entry now includes an optional `DestinationNode` field, which stores the index into the authorized account's owner directory. This field is present on entries created after bidirectional directory tracking was introduced and may appear in RPC responses for those entries. ([#6681](https://github.com/XRPLF/rippled/pull/6681))
|
||||
|
||||
- `server_definitions`: Added the following new sections to the response ([#6321](https://github.com/XRPLF/rippled/pull/6321)):
|
||||
- `TRANSACTION_FORMATS`: Describes the fields and their optionality for each transaction type, including common fields shared across all transactions.
|
||||
- `LEDGER_ENTRY_FORMATS`: Describes the fields and their optionality for each ledger entry type, including common fields shared across all ledger entries.
|
||||
@@ -40,6 +42,14 @@ This section contains changes targeting a future version.
|
||||
- Peer Crawler: The `port` field in `overlay.active[]` now consistently returns an integer instead of a string for outbound peers. [#6318](https://github.com/XRPLF/rippled/pull/6318)
|
||||
- `ping`: The `ip` field is no longer returned as an empty string for proxied connections without a forwarded-for header. It is now omitted, consistent with the behavior for identified connections. [#6730](https://github.com/XRPLF/rippled/pull/6730)
|
||||
- gRPC `GetLedgerDiff`: Fixed error message that incorrectly said "base ledger not validated" when the desired ledger was not validated. [#6730](https://github.com/XRPLF/rippled/pull/6730)
|
||||
- `account_channels`: The `destination_account` field now returns an error if the value is not a string. [#6529](https://github.com/XRPLF/rippled/pull/6529)
|
||||
- `subscribe`: The `taker` field in the `books` array now returns an error if the value is not a string. [#6529](https://github.com/XRPLF/rippled/pull/6529)
|
||||
- `account_info`: The `urlgravatar` field now uses HTTPS instead of HTTP. [#6529](https://github.com/XRPLF/rippled/pull/6529)
|
||||
- `ledger`: The `full`, `accounts`, `transactions`, `expand`, `binary`, `owner_funds`, and `queue` fields now return an error if the value is not a boolean. [#6529](https://github.com/XRPLF/rippled/pull/6529)
|
||||
- `ledger_data`: The `binary` field now returns an error if the value is not a boolean. [#6529](https://github.com/XRPLF/rippled/pull/6529)
|
||||
- `submit`: The `fail_hard` field now returns an error if the value is not a boolean. [#6529](https://github.com/XRPLF/rippled/pull/6529)
|
||||
- `subscribe`: The `taker` field in the `books` array now returns `actMalformed` instead of `badIssuer` if the value is not a valid account. [#6529](https://github.com/XRPLF/rippled/pull/6529)
|
||||
- Fixed a bug in `Forwarded` HTTP header parsing where the extracted IP address could be incorrect when no comma or semicolon delimiter follows the address. This could cause the server to misidentify a client's IP address when operating behind a reverse proxy. [#6529](https://github.com/XRPLF/rippled/pull/6529)
|
||||
|
||||
## XRP Ledger server version 3.1.0
|
||||
|
||||
|
||||
113
SECURITY.md
113
SECURITY.md
@@ -22,117 +22,10 @@ Responsible investigation includes, but isn't limited to, the following:
|
||||
- Not targeting physical security measures, or attempting to use social engineering, spam, distributed denial of service (DDOS) attacks, etc.
|
||||
- Investigating bugs in a way that makes a reasonable, good faith effort not to be disruptive or harmful to the XRP Ledger and the broader ecosystem.
|
||||
|
||||
### Responsible Disclosure
|
||||
|
||||
If you discover a vulnerability or potential threat, or if you _think_
|
||||
you have, please reach out by dropping an email using the contact
|
||||
information below.
|
||||
|
||||
Your report should include the following:
|
||||
|
||||
- Your contact information (typically, an email address);
|
||||
- The description of the vulnerability;
|
||||
- The attack scenario (if any);
|
||||
- The steps to reproduce the vulnerability;
|
||||
- Any other relevant details or artifacts, including code, scripts or patches.
|
||||
|
||||
In your email, please describe the issue or potential threat. If possible, include a "repro" (code that can reproduce the issue) or describe the best way to reproduce and replicate the issue. Please make your report as detailed and comprehensive as possible.
|
||||
|
||||
For more information on responsible disclosure, please read this [Wikipedia article](https://en.wikipedia.org/wiki/Responsible_disclosure).
|
||||
|
||||
## Report Handling Process
|
||||
|
||||
Please report the bug directly to us and limit further disclosure. If you want to prove that you knew the bug as of a given time, consider using a cryptographic pre-commitment: hash the content of your report and publish the hash on a medium of your choice (e.g. on Twitter or as a memo in a transaction) as "proof" that you had written the text at a given point in time.
|
||||
|
||||
Once we receive a report, we:
|
||||
|
||||
1. Assign two people to independently evaluate the report;
|
||||
2. Consider their recommendations;
|
||||
3. If action is necessary, formulate a plan to address the issue;
|
||||
4. Communicate privately with the reporter to explain our plan.
|
||||
5. Prepare, test and release a version which fixes the issue; and
|
||||
6. Announce the vulnerability publicly.
|
||||
|
||||
We will triage and respond to your disclosure within 24 hours. Beyond that, we will work to analyze the issue in more detail, formulate, develop and test a fix.
|
||||
|
||||
While we commit to responding with 24 hours of your initial report with our triage assessment, we cannot guarantee a response time for the remaining steps. We will communicate with you throughout this process, letting you know where we are and keeping you updated on the timeframe.
|
||||
|
||||
## Bug Bounty Program
|
||||
|
||||
[Ripple](https://ripple.com) is generously sponsoring a bug bounty program for vulnerabilities in [`xrpld`](https://github.com/XRPLF/rippled) (and other related projects, like [`xrpl.js`](https://github.com/XRPLF/xrpl.js), [`xrpl-py`](https://github.com/XRPLF/xrpl-py), [`xrpl4j`](https://github.com/XRPLF/xrpl4j)).
|
||||
[Ripple](https://ripple.com) is generously sponsoring a bug bounty program for vulnerabilities in [`xrpld`](https://github.com/XRPLF/rippled) (and other related projects, like [`Clio`](https://github.com/XRPLF/clio), [`xrpl.js`](https://github.com/XRPLF/xrpl.js), [`xrpl-py`](https://github.com/XRPLF/xrpl-py), [`xrpl4j`](https://github.com/XRPLF/xrpl4j)).
|
||||
|
||||
This program allows us to recognize and reward individuals or groups that identify and report bugs. In summary, in order to qualify for a bounty, the bug must be:
|
||||
This program allows us to recognize and reward individuals or groups that identify and report bugs.
|
||||
|
||||
1. **In scope**. Only bugs in software under the scope of the program qualify. Currently, that means `xrpld`, `xrpl.js`, `xrpl-py`, `xrpl4j`.
|
||||
2. **Relevant**. A security issue, posing a danger to user funds, privacy, or the operation of the XRP Ledger.
|
||||
3. **Original and previously unknown**. Bugs that are already known and discussed in public do not qualify. Previously reported bugs, even if publicly unknown, are not eligible.
|
||||
4. **Specific**. We welcome general security advice or recommendations, but we cannot pay bounties for that.
|
||||
5. **Fixable**. There has to be something we can do to permanently fix the problem. Note that bugs in other people’s software may still qualify in some cases. For example, if you find a bug in a library that we use which can compromise the security of software that is in scope and we can get it fixed, you may qualify for a bounty.
|
||||
6. **Unused**. If you use the exploit to attack the XRP Ledger, you do not qualify for a bounty. If you report a vulnerability used in an ongoing or past attack and there is specific, concrete evidence that suggests you are the attacker we reserve the right not to pay a bounty.
|
||||
|
||||
The amount paid varies dramatically. Vulnerabilities that are harmless on their own, but could form part of a critical exploit will usually receive a bounty. Full-blown exploits can receive much higher bounties. Please don’t hold back partial vulnerabilities while trying to construct a full-blown exploit. We will pay a bounty to anyone who reports a complete chain of vulnerabilities even if they have reported each component of the exploit separately and those vulnerabilities have been fixed in the meantime. However, to qualify for a the full bounty, you must to have been the first to report each of the partial exploits.
|
||||
|
||||
### Contacting Us
|
||||
|
||||
To report a qualifying bug, please send a detailed report to:
|
||||
|
||||
| Email Address | bugs@ripple.com |
|
||||
| :-----------: | :-------------------------------------------------- |
|
||||
| Short Key ID | `0xA9F514E0` |
|
||||
| Long Key ID | `0xD900855AA9F514E0` |
|
||||
| Fingerprint | `B72C 0654 2F2A E250 2763 A268 D900 855A A9F5 14E0` |
|
||||
|
||||
The full PGP key for this address, which is also available on several key servers (e.g. on [keyserver.ubuntu.com](https://keyserver.ubuntu.com)), is:
|
||||
|
||||
```
|
||||
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
mQINBGkSZAQBEACprU199OhgdsOsygNjiQV4msuN3vDOUooehL+NwfsGfW79Tbqq
|
||||
Q2u7uQ3NZjW+M2T4nsDwuhkr7pe7xSReR5W8ssaczvtUyxkvbMClilcgZ2OSCAuC
|
||||
N9tzJsqOqkwBvXoNXkn//T2jnPz0ZU2wSF+NrEibq5FeuyGdoX3yXXBxq9pW9HzK
|
||||
HkQll63QSl6BzVSGRQq+B6lGgaZGLwf3mzmIND9Z5VGLNK2jKynyz9z091whNG/M
|
||||
kV+E7/r/bujHk7WIVId07G5/COTXmSr7kFnNEkd2Umw42dkgfiNKvlmJ9M7c1wLK
|
||||
KbL9Eb4ADuW6rRc5k4s1e6GT8R4/VPliWbCl9SE32hXH8uTkqVIFZP2eyM5WRRHs
|
||||
aKzitkQG9UK9gcb0kdgUkxOvvgPHAe5IuZlcHFzU4y0dBbU1VEFWVpiLU0q+IuNw
|
||||
5BRemeHc59YNsngkmAZ+/9zouoShRusZmC8Wzotv75C2qVBcjijPvmjWAUz0Zunm
|
||||
Lsr+O71vqHE73pERjD07wuD/ISjiYRYYE/bVrXtXLZijC7qAH4RE3nID+2ojcZyO
|
||||
/2jMQvt7un56RsGH4UBHi3aBHi9bUoDGCXKiQY981cEuNaOxpou7Mh3x/ONzzSvk
|
||||
sTV6nl1LOZHykN1JyKwaNbTSAiuyoN+7lOBqbV04DNYAHL88PrT21P83aQARAQAB
|
||||
tB1SaXBwbGUgTGFicyA8YnVnc0ByaXBwbGUuY29tPokCTgQTAQgAOBYhBLcsBlQv
|
||||
KuJQJ2OiaNkAhVqp9RTgBQJpEmQEAhsDBQsJCAcCBhUKCQgLAgQWAgMBAh4BAheA
|
||||
AAoJENkAhVqp9RTgBzgP/i7y+aDWl1maig1XMdyb+o0UGusumFSW4Hmj278wlKVv
|
||||
usgLPihYgHE0PKrv6WRyKOMC1tQEcYYN93M+OeQ1vFhS2YyURq6RCMmh4zq/awXG
|
||||
uZbG36OURB5NH8lGBOHiN/7O+nY0CgenBT2JWm+GW3nEOAVOVm4+r5GlpPlv+Dp1
|
||||
NPBThcKXFMnH73++NpSQoDzTfRYHPxhDAX3jkLi/moXfSanOLlR6l94XNNN0jBHW
|
||||
Quao0rzf4WSXq9g6AS224xhAA5JyIcFl8TX7hzj5HaFn3VWo3COoDu4U7H+BM0fl
|
||||
85yqiMQypp7EhN2gxpMMWaHY5TFM85U/bFXFYfEgihZ4/gt4uoIzsNI9jlX7mYvG
|
||||
KFdDij+oTlRsuOxdIy60B3dKcwOH9nZZCz0SPsN/zlRWgKzK4gDKdGhFkU9OlvPu
|
||||
94ZqscanoiWKDoZkF96+sjgfjkuHsDK7Lwc1Xi+T4drHG/3aVpkYabXox+lrKB/S
|
||||
yxZjeqOIQzWPhnLgCaLyvsKo5hxKzL0w3eURu8F3IS7RgOOlljv4M+Me9sEVcdNV
|
||||
aN3/tQwbaomSX1X5D5YXqhBwC3rU3wXwamsscRTGEpkV+JCX6KUqGP7nWmxCpAly
|
||||
FL05XuOd5SVHJjXLeuje0JqLUpN514uL+bThWwDbDTdAdwW3oK/2WbXz7IfJRLBj
|
||||
uQINBGkSZAQBEADdI3SL2F72qkrgFqXWE6HSRBu9bsAvTE5QrRPWk7ux6at537r4
|
||||
S4sIw2dOwLvbyIrDgKNq3LQ5wCK88NO/NeCOFm4AiCJSl3pJHXYnTDoUxTrrxx+o
|
||||
vSRI4I3fHEql/MqzgiAb0YUezjgFdh3vYheMPp/309PFbOLhiFqEcx80Mx5h06UH
|
||||
gDzu1qNj3Ec+31NLic5zwkrAkvFvD54d6bqYR3SEgMau6aYEewpGHbWBi2pLqSi2
|
||||
lQcAeOFixqGpTwDmAnYR8YtjBYepy0MojEAdTHcQQlOYSDk4q4elG+io2N8vECfU
|
||||
rD6ORecN48GXdZINYWTAdslrUeanmBdgQrYkSpce8TSghgT9P01SNaXxmyaehVUO
|
||||
lqI4pcg5G2oojAE8ncNS3TwDtt7daTaTC3bAdr4PXDVAzNAiewjMNZPB7xidkDGQ
|
||||
Y4W1LxTMXyJVWxehYOH7tsbBRKninlfRnLgYzmtIbNRAAvNcsxU6ihv3AV0WFknN
|
||||
YbSzotEv1Xq/5wk309x8zCDe+sP0cQicvbXafXmUzPAZzeqFg+VLFn7F9MP1WGlW
|
||||
B1u7VIvBF1Mp9Nd3EAGBAoLRdRu+0dVWIjPTQuPIuD9cCatJA0wVaKUrjYbBMl88
|
||||
a12LixNVGeSFS9N7ADHx0/o7GNT6l88YbaLP6zggUHpUD/bR+cDN7vllIQARAQAB
|
||||
iQI2BBgBCAAgFiEEtywGVC8q4lAnY6Jo2QCFWqn1FOAFAmkSZAQCGwwACgkQ2QCF
|
||||
Wqn1FOAfAA/8CYq4p0p4bobY20CKEMsZrkBTFJyPDqzFwMeTjgpzqbD7Y3Qq5QCK
|
||||
OBbvY02GWdiIsNOzKdBxiuam2xYP9WHZj4y7/uWEvT0qlPVmDFu+HXjoJ43oxwFd
|
||||
CUp2gMuQ4cSL3X94VRJ3BkVL+tgBm8CNY0vnTLLOO3kum/R69VsGJS1JSGUWjNM+
|
||||
4qwS3mz+73xJu1HmERyN2RZF/DGIZI2PyONQQ6aH85G1Dd2ohu2/DBAkQAMBrPbj
|
||||
FrbDaBLyFhODxU3kTWqnfLlaElSm2EGdIU2yx7n4BggEa//NZRMm5kyeo4vzhtlQ
|
||||
YIVUMLAOLZvnEqDnsLKp+22FzNR/O+htBQC4lPywl53oYSALdhz1IQlcAC1ru5KR
|
||||
XPzhIXV6IIzkcx9xNkEclZxmsuy5ERXyKEmLbIHAlzFmnrldlt2ZgXDtzaorLmxj
|
||||
klKibxd5tF50qOpOivz+oPtFo7n+HmFa1nlVAMxlDCUdM0pEVeYDKI5zfVwalyhZ
|
||||
NnjpakdZSXMwgc7NP/hH9buF35hKDp7EckT2y3JNYwHsDdy1icXN2q40XZw5tSIn
|
||||
zkPWdu3OUY8PISohN6Pw4h0RH4ZmoX97E8sEfmdKaT58U4Hf2aAv5r9IWCSrAVqY
|
||||
u5jvac29CzQR9Kal0A+8phHAXHNFD83SwzIC0syaT9ficAguwGH8X6Q=
|
||||
=nGuD
|
||||
-----END PGP PUBLIC KEY BLOCK-----
|
||||
```
|
||||
We have partnered with Bugcrowd to manage this program. It is a private program, and security researchers can participate based on invitation. If you need access to the program, please email bugs@ripple.com with your Bugcrowd handle or Bugcrowd registered email, and we will get you added to the program. Once you have been added, please submit vulnerability reports through Bugcrowd, not by email. The detailed bug bounty policy is available on the Bugcrowd website.
|
||||
|
||||
@@ -118,7 +118,7 @@ if(MSVC)
|
||||
NOMINMAX
|
||||
# TODO: Resolve these warnings, don't just silence them
|
||||
_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS
|
||||
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:Debug>,$<NOT:$<BOOL:${is_ci}>>>:_CRTDBG_MAP_ALLOC>
|
||||
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:Debug>>:_CRTDBG_MAP_ALLOC>
|
||||
)
|
||||
target_link_libraries(common INTERFACE -errorreport:none -machine:X64)
|
||||
else()
|
||||
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
explicit Section(std::string name = "");
|
||||
|
||||
/** Returns the name of this section. */
|
||||
std::string const&
|
||||
[[nodiscard]] std::string const&
|
||||
name() const
|
||||
{
|
||||
return name_;
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
/** Returns all the lines in the section.
|
||||
This includes everything.
|
||||
*/
|
||||
std::vector<std::string> const&
|
||||
[[nodiscard]] std::vector<std::string> const&
|
||||
lines() const
|
||||
{
|
||||
return lines_;
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
/** Returns all the values in the section.
|
||||
Values are non-empty lines which are not key/value pairs.
|
||||
*/
|
||||
std::vector<std::string> const&
|
||||
[[nodiscard]] std::vector<std::string> const&
|
||||
values() const
|
||||
{
|
||||
return values_;
|
||||
@@ -82,7 +82,7 @@ public:
|
||||
* @return The retrieved value. A section with an empty legacy value returns
|
||||
an empty string.
|
||||
*/
|
||||
std::string
|
||||
[[nodiscard]] std::string
|
||||
legacy() const
|
||||
{
|
||||
if (lines_.empty())
|
||||
@@ -117,11 +117,11 @@ public:
|
||||
}
|
||||
|
||||
/** Returns `true` if a key with the given name exists. */
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
exists(std::string const& name) const;
|
||||
|
||||
template <class T = std::string>
|
||||
std::optional<T>
|
||||
[[nodiscard]] std::optional<T>
|
||||
get(std::string const& name) const
|
||||
{
|
||||
auto const iter = lookup_.find(name);
|
||||
@@ -132,7 +132,7 @@ public:
|
||||
|
||||
/// Returns a value if present, else another value.
|
||||
template <class T>
|
||||
T
|
||||
[[nodiscard]] T
|
||||
value_or(std::string const& name, T const& other) const
|
||||
{
|
||||
auto const v = get<T>(name);
|
||||
@@ -141,7 +141,7 @@ public:
|
||||
|
||||
// indicates if trailing comments were seen
|
||||
// during the appending of any lines/values
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
had_trailing_comments() const
|
||||
{
|
||||
return had_trailing_comments_;
|
||||
@@ -151,42 +151,42 @@ public:
|
||||
operator<<(std::ostream&, Section const& section);
|
||||
|
||||
// Returns `true` if there are no key/value pairs.
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
empty() const
|
||||
{
|
||||
return lookup_.empty();
|
||||
}
|
||||
|
||||
// Returns the number of key/value pairs.
|
||||
std::size_t
|
||||
[[nodiscard]] std::size_t
|
||||
size() const
|
||||
{
|
||||
return lookup_.size();
|
||||
}
|
||||
|
||||
// For iteration of key/value pairs.
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
begin() const
|
||||
{
|
||||
return lookup_.cbegin();
|
||||
}
|
||||
|
||||
// For iteration of key/value pairs.
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
cbegin() const
|
||||
{
|
||||
return lookup_.cbegin();
|
||||
}
|
||||
|
||||
// For iteration of key/value pairs.
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
end() const
|
||||
{
|
||||
return lookup_.cend();
|
||||
}
|
||||
|
||||
// For iteration of key/value pairs.
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
cend() const
|
||||
{
|
||||
return lookup_.cend();
|
||||
@@ -206,7 +206,7 @@ private:
|
||||
|
||||
public:
|
||||
/** Returns `true` if a section with the given name exists. */
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
exists(std::string const& name) const;
|
||||
|
||||
/** Returns the section with the given name.
|
||||
@@ -216,7 +216,7 @@ public:
|
||||
Section&
|
||||
section(std::string const& name);
|
||||
|
||||
Section const&
|
||||
[[nodiscard]] Section const&
|
||||
section(std::string const& name) const;
|
||||
|
||||
Section const&
|
||||
@@ -264,7 +264,7 @@ public:
|
||||
* legacy value.
|
||||
* @return Contents of the legacy value.
|
||||
*/
|
||||
std::string
|
||||
[[nodiscard]] std::string
|
||||
legacy(std::string const& sectionName) const;
|
||||
|
||||
friend std::ostream&
|
||||
@@ -272,7 +272,7 @@ public:
|
||||
|
||||
// indicates if trailing comments were seen
|
||||
// in any loaded Sections
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
had_trailing_comments() const
|
||||
{
|
||||
return std::ranges::any_of(map_, [](auto s) { return s.second.had_trailing_comments(); });
|
||||
|
||||
@@ -101,13 +101,13 @@ public:
|
||||
}
|
||||
|
||||
/** Returns the number of bytes in the buffer. */
|
||||
std::size_t
|
||||
[[nodiscard]] std::size_t
|
||||
size() const noexcept
|
||||
{
|
||||
return size_;
|
||||
}
|
||||
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
empty() const noexcept
|
||||
{
|
||||
return 0 == size_;
|
||||
@@ -125,7 +125,7 @@ public:
|
||||
to a single byte, to facilitate pointer arithmetic.
|
||||
*/
|
||||
/** @{ */
|
||||
std::uint8_t const*
|
||||
[[nodiscard]] std::uint8_t const*
|
||||
data() const noexcept
|
||||
{
|
||||
return p_.get();
|
||||
@@ -169,25 +169,25 @@ public:
|
||||
return alloc(n);
|
||||
}
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
begin() const noexcept
|
||||
{
|
||||
return p_.get();
|
||||
}
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
cbegin() const noexcept
|
||||
{
|
||||
return p_.get();
|
||||
}
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
end() const noexcept
|
||||
{
|
||||
return p_.get() + size_;
|
||||
}
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
cend() const noexcept
|
||||
{
|
||||
return p_.get() + size_;
|
||||
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
using Entry = std::pair<std::string, int>;
|
||||
using List = std::vector<Entry>;
|
||||
|
||||
List
|
||||
[[nodiscard]] List
|
||||
getCounts(int minimumThreshold) const;
|
||||
|
||||
public:
|
||||
@@ -59,19 +59,19 @@ public:
|
||||
return --count_;
|
||||
}
|
||||
|
||||
int
|
||||
[[nodiscard]] int
|
||||
getCount() const noexcept
|
||||
{
|
||||
return count_.load();
|
||||
}
|
||||
|
||||
Counter*
|
||||
[[nodiscard]] Counter*
|
||||
getNext() const noexcept
|
||||
{
|
||||
return next_;
|
||||
}
|
||||
|
||||
std::string const&
|
||||
[[nodiscard]] std::string const&
|
||||
getName() const noexcept
|
||||
{
|
||||
return name_;
|
||||
|
||||
@@ -67,8 +67,10 @@ private:
|
||||
}
|
||||
else
|
||||
{
|
||||
while ((elapsed--) != 0u)
|
||||
for (; elapsed > 0; --elapsed)
|
||||
{
|
||||
m_value -= (m_value + Window - 1) / Window;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
constexpr E const&
|
||||
[[nodiscard]] constexpr E const&
|
||||
value() const&
|
||||
{
|
||||
return val_;
|
||||
@@ -91,7 +91,7 @@ public:
|
||||
return std::move(val_);
|
||||
}
|
||||
|
||||
constexpr E const&&
|
||||
[[nodiscard]] constexpr E const&&
|
||||
value() const&&
|
||||
{
|
||||
return std::move(val_);
|
||||
@@ -125,13 +125,13 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
constexpr bool
|
||||
[[nodiscard]] constexpr bool
|
||||
has_value() const
|
||||
{
|
||||
return Base::has_value();
|
||||
}
|
||||
|
||||
constexpr T const&
|
||||
[[nodiscard]] constexpr T const&
|
||||
value() const
|
||||
{
|
||||
return Base::value();
|
||||
@@ -143,7 +143,7 @@ public:
|
||||
return Base::value();
|
||||
}
|
||||
|
||||
constexpr E const&
|
||||
[[nodiscard]] constexpr E const&
|
||||
error() const
|
||||
{
|
||||
return Base::error();
|
||||
@@ -210,7 +210,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
constexpr E const&
|
||||
[[nodiscard]] constexpr E const&
|
||||
error() const
|
||||
{
|
||||
return Base::error();
|
||||
|
||||
@@ -159,11 +159,11 @@ public:
|
||||
reset();
|
||||
|
||||
/** Get the raw pointer */
|
||||
T*
|
||||
[[nodiscard]] T*
|
||||
get() const;
|
||||
|
||||
/** Return the strong count */
|
||||
std::size_t
|
||||
[[nodiscard]] std::size_t
|
||||
use_count() const;
|
||||
|
||||
template <class TT, class... Args>
|
||||
@@ -181,7 +181,7 @@ public:
|
||||
|
||||
private:
|
||||
/** Return the raw pointer held by this object. */
|
||||
T*
|
||||
[[nodiscard]] T*
|
||||
unsafeGetRawPtr() const;
|
||||
|
||||
/** Exchange the current raw pointer held by this object with the given
|
||||
@@ -260,7 +260,7 @@ public:
|
||||
lock() const;
|
||||
|
||||
/** Return true if the strong count is zero. */
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
expired() const;
|
||||
|
||||
/** Set the pointer to null and decrement the weak count.
|
||||
@@ -339,7 +339,7 @@ public:
|
||||
don't lock the weak pointer. Use the `lock` method if that's what's
|
||||
needed)
|
||||
*/
|
||||
SharedIntrusive<T>
|
||||
[[nodiscard]] SharedIntrusive<T>
|
||||
getStrong() const;
|
||||
|
||||
/** Return true if this is a strong pointer and the strong pointer is
|
||||
@@ -357,31 +357,31 @@ public:
|
||||
/** If this is a strong pointer, return the raw pointer. Otherwise
|
||||
return null.
|
||||
*/
|
||||
T*
|
||||
[[nodiscard]] T*
|
||||
get() const;
|
||||
|
||||
/** If this is a strong pointer, return the strong count. Otherwise
|
||||
* return 0
|
||||
*/
|
||||
std::size_t
|
||||
[[nodiscard]] std::size_t
|
||||
use_count() const;
|
||||
|
||||
/** Return true if there is a non-zero strong count. */
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
expired() const;
|
||||
|
||||
/** If this is a strong pointer, return the strong pointer. Otherwise
|
||||
attempt to lock the weak pointer.
|
||||
*/
|
||||
SharedIntrusive<T>
|
||||
[[nodiscard]] SharedIntrusive<T>
|
||||
lock() const;
|
||||
|
||||
/** Return true is this represents a strong pointer. */
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isStrong() const;
|
||||
|
||||
/** Return true is this represents a weak pointer. */
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isWeak() const;
|
||||
|
||||
/** If this is a weak pointer, attempt to convert it to a strong
|
||||
@@ -412,7 +412,7 @@ private:
|
||||
private:
|
||||
/** Return the raw pointer held by this object.
|
||||
*/
|
||||
T*
|
||||
[[nodiscard]] T*
|
||||
unsafeGetRawPtr() const;
|
||||
|
||||
enum class RefStrength { strong, weak };
|
||||
|
||||
@@ -207,7 +207,7 @@ private:
|
||||
RefCountPair(CountType s, CountType w) noexcept;
|
||||
|
||||
/** Convert back to the packed integer form. */
|
||||
FieldType
|
||||
[[nodiscard]] FieldType
|
||||
combinedValue() const noexcept;
|
||||
|
||||
static constexpr CountType maxStrongValue =
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
namespace xrpl {
|
||||
|
||||
// DEPRECATED use beast::severities::Severity instead
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
|
||||
enum LogSeverity {
|
||||
lsINVALID = -1, // used to indicate an invalid severity
|
||||
lsTRACE = 0, // Very low-level progress information, details inside
|
||||
@@ -76,7 +77,7 @@ private:
|
||||
@return `true` if a system file is associated and opened for
|
||||
writing.
|
||||
*/
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isOpen() const noexcept;
|
||||
|
||||
/** Associate a system file with the log.
|
||||
@@ -207,6 +208,8 @@ public:
|
||||
fromString(std::string const& s);
|
||||
|
||||
private:
|
||||
// Need to be named before converting
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
|
||||
enum {
|
||||
// Maximum line length for log messages.
|
||||
// If the message exceeds this length it will be truncated with
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
return data_;
|
||||
}
|
||||
|
||||
ProtectedDataType const&
|
||||
[[nodiscard]] ProtectedDataType const&
|
||||
get() const
|
||||
{
|
||||
return data_;
|
||||
@@ -131,7 +131,7 @@ public:
|
||||
* @tparam LockType The type of lock to use
|
||||
* @return A lock on the mutex and a reference to the protected data
|
||||
*/
|
||||
template <template <typename...> typename LockType = std::lock_guard>
|
||||
template <template <typename...> typename LockType = std::scoped_lock>
|
||||
Lock<ProtectedDataType const, LockType, MutexType>
|
||||
lock() const
|
||||
{
|
||||
@@ -144,7 +144,7 @@ public:
|
||||
* @tparam LockType The type of lock to use
|
||||
* @return A lock on the mutex and a reference to the protected data
|
||||
*/
|
||||
template <template <typename...> typename LockType = std::lock_guard>
|
||||
template <template <typename...> typename LockType = std::scoped_lock>
|
||||
Lock<ProtectedDataType, LockType, MutexType>
|
||||
lock()
|
||||
{
|
||||
|
||||
@@ -70,7 +70,7 @@ isPowerOfTen(T value)
|
||||
struct MantissaRange
|
||||
{
|
||||
using rep = std::uint64_t;
|
||||
enum mantissa_scale { small, large };
|
||||
enum class mantissa_scale { small, large };
|
||||
|
||||
explicit constexpr MantissaRange(mantissa_scale scale_)
|
||||
: min(getMin(scale_)), log(logTen(min).value_or(-1)), scale(scale_)
|
||||
@@ -88,9 +88,9 @@ private:
|
||||
{
|
||||
switch (scale_)
|
||||
{
|
||||
case small:
|
||||
case mantissa_scale::small:
|
||||
return 1'000'000'000'000'000ULL;
|
||||
case large:
|
||||
case mantissa_scale::large:
|
||||
return 1'000'000'000'000'000'000ULL;
|
||||
default:
|
||||
// Since this can never be called outside a non-constexpr
|
||||
@@ -252,9 +252,9 @@ public:
|
||||
// Assume unsigned values are... unsigned. i.e. positive
|
||||
explicit Number(internalrep mantissa, int exponent, normalized);
|
||||
|
||||
constexpr rep
|
||||
[[nodiscard]] constexpr rep
|
||||
mantissa() const noexcept;
|
||||
constexpr int
|
||||
[[nodiscard]] constexpr int
|
||||
exponent() const noexcept;
|
||||
|
||||
constexpr Number
|
||||
@@ -339,7 +339,7 @@ public:
|
||||
}
|
||||
|
||||
/** Return the sign of the amount */
|
||||
constexpr int
|
||||
[[nodiscard]] constexpr int
|
||||
signum() const noexcept
|
||||
{
|
||||
if (negative_)
|
||||
@@ -347,7 +347,7 @@ public:
|
||||
return (mantissa_ != 0u) ? 1 : 0;
|
||||
}
|
||||
|
||||
Number
|
||||
[[nodiscard]] Number
|
||||
truncate() const noexcept;
|
||||
|
||||
friend constexpr bool
|
||||
@@ -384,7 +384,7 @@ public:
|
||||
root2(Number f);
|
||||
|
||||
// Thread local rounding control. Default is to_nearest
|
||||
enum rounding_mode { to_nearest, towards_zero, downward, upward };
|
||||
enum class rounding_mode { to_nearest, towards_zero, downward, upward };
|
||||
static rounding_mode
|
||||
getround();
|
||||
// Returns previously set mode
|
||||
@@ -443,14 +443,14 @@ private:
|
||||
static thread_local rounding_mode mode_;
|
||||
// The available ranges for mantissa
|
||||
|
||||
constexpr static MantissaRange smallRange{MantissaRange::small};
|
||||
constexpr static MantissaRange smallRange{MantissaRange::mantissa_scale::small};
|
||||
static_assert(isPowerOfTen(smallRange.min));
|
||||
static_assert(smallRange.min == 1'000'000'000'000'000LL);
|
||||
static_assert(smallRange.max == 9'999'999'999'999'999LL);
|
||||
static_assert(smallRange.log == 15);
|
||||
static_assert(smallRange.min < maxRep);
|
||||
static_assert(smallRange.max < maxRep);
|
||||
constexpr static MantissaRange largeRange{MantissaRange::large};
|
||||
constexpr static MantissaRange largeRange{MantissaRange::mantissa_scale::large};
|
||||
static_assert(isPowerOfTen(largeRange.min));
|
||||
static_assert(largeRange.min == 1'000'000'000'000'000'000ULL);
|
||||
static_assert(largeRange.max == internalrep(9'999'999'999'999'999'999ULL));
|
||||
@@ -490,13 +490,13 @@ private:
|
||||
MantissaRange::rep const& minMantissa,
|
||||
MantissaRange::rep const& maxMantissa);
|
||||
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isnormal() const noexcept;
|
||||
|
||||
// Copy the number, but modify the exponent by "exponentDelta". Because the
|
||||
// mantissa doesn't change, the result will be "mostly" normalized, but the
|
||||
// exponent could go out of range, so it will be checked.
|
||||
Number
|
||||
[[nodiscard]] Number
|
||||
shiftExponent(int exponentDelta) const;
|
||||
|
||||
// Safely convert rep (int64) mantissa to internalrep (uint64). If the rep
|
||||
@@ -759,9 +759,9 @@ to_string(MantissaRange::mantissa_scale const& scale)
|
||||
{
|
||||
switch (scale)
|
||||
{
|
||||
case MantissaRange::small:
|
||||
case MantissaRange::mantissa_scale::small:
|
||||
return "small";
|
||||
case MantissaRange::large:
|
||||
case MantissaRange::mantissa_scale::large:
|
||||
return "large";
|
||||
default:
|
||||
throw std::runtime_error("Bad scale");
|
||||
|
||||
@@ -20,7 +20,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
uint256 const&
|
||||
[[nodiscard]] uint256 const&
|
||||
as_uint256() const
|
||||
{
|
||||
return hash_;
|
||||
@@ -30,17 +30,17 @@ public:
|
||||
{
|
||||
return hash_;
|
||||
}
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isZero() const
|
||||
{
|
||||
return hash_.isZero();
|
||||
}
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isNonZero() const
|
||||
{
|
||||
return hash_.isNonZero();
|
||||
}
|
||||
int
|
||||
[[nodiscard]] int
|
||||
signum() const
|
||||
{
|
||||
return hash_.signum();
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
/** Return a strong pointer if this is already a strong pointer (i.e. don't
|
||||
lock the weak pointer. Use the `lock` method if that's what's needed)
|
||||
*/
|
||||
std::shared_ptr<T> const&
|
||||
[[nodiscard]] std::shared_ptr<T> const&
|
||||
getStrong() const;
|
||||
|
||||
/** Return true if this is a strong pointer and the strong pointer is
|
||||
@@ -67,30 +67,30 @@ public:
|
||||
/** If this is a strong pointer, return the raw pointer. Otherwise return
|
||||
null.
|
||||
*/
|
||||
T*
|
||||
[[nodiscard]] T*
|
||||
get() const;
|
||||
|
||||
/** If this is a strong pointer, return the strong count. Otherwise return 0
|
||||
*/
|
||||
std::size_t
|
||||
[[nodiscard]] std::size_t
|
||||
use_count() const;
|
||||
|
||||
/** Return true if there is a non-zero strong count. */
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
expired() const;
|
||||
|
||||
/** If this is a strong pointer, return the strong pointer. Otherwise
|
||||
attempt to lock the weak pointer.
|
||||
*/
|
||||
std::shared_ptr<T>
|
||||
[[nodiscard]] std::shared_ptr<T>
|
||||
lock() const;
|
||||
|
||||
/** Return true is this represents a strong pointer. */
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isStrong() const;
|
||||
|
||||
/** Return true is this represents a weak pointer. */
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isWeak() const;
|
||||
|
||||
/** If this is a weak pointer, attempt to convert it to a strong pointer.
|
||||
|
||||
@@ -92,7 +92,7 @@ class SlabAllocator
|
||||
std::uint8_t* ret = nullptr; // NOLINT(misc-const-correctness)
|
||||
|
||||
{
|
||||
std::lock_guard const l(m_);
|
||||
std::scoped_lock const l(m_);
|
||||
|
||||
ret = l_;
|
||||
|
||||
@@ -121,7 +121,7 @@ class SlabAllocator
|
||||
{
|
||||
XRPL_ASSERT(own(ptr), "xrpl::SlabAllocator::SlabBlock::deallocate : own input");
|
||||
|
||||
std::lock_guard const l(m_);
|
||||
std::scoped_lock const l(m_);
|
||||
|
||||
// Use memcpy to avoid unaligned UB
|
||||
// (will optimize to equivalent code)
|
||||
@@ -180,7 +180,7 @@ public:
|
||||
~SlabAllocator() = default;
|
||||
|
||||
/** Returns the size of the memory block this allocator returns. */
|
||||
constexpr std::size_t
|
||||
[[nodiscard]] constexpr std::size_t
|
||||
size() const noexcept
|
||||
{
|
||||
return itemSize_;
|
||||
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
@note The return type is guaranteed to be a pointer
|
||||
to a single byte, to facilitate pointer arithmetic.
|
||||
*/
|
||||
std::uint8_t const*
|
||||
[[nodiscard]] std::uint8_t const*
|
||||
data() const noexcept
|
||||
{
|
||||
return data_;
|
||||
@@ -123,25 +123,25 @@ public:
|
||||
size_ -= n;
|
||||
}
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
begin() const noexcept
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
cbegin() const noexcept
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
end() const noexcept
|
||||
{
|
||||
return data_ + size_;
|
||||
}
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
cend() const noexcept
|
||||
{
|
||||
return data_ + size_;
|
||||
@@ -158,7 +158,7 @@ public:
|
||||
@returns The requested subslice, if the request is valid.
|
||||
@throws std::out_of_range if pos > size()
|
||||
*/
|
||||
Slice
|
||||
[[nodiscard]] Slice
|
||||
substr(std::size_t pos, std::size_t count = std::numeric_limits<std::size_t>::max()) const
|
||||
{
|
||||
if (pos > size())
|
||||
|
||||
@@ -166,7 +166,7 @@ public:
|
||||
|
||||
private:
|
||||
SharedPointerType
|
||||
initialFetch(key_type const& key, std::lock_guard<mutex_type> const& l);
|
||||
initialFetch(key_type const& key, std::scoped_lock<mutex_type> const& l);
|
||||
|
||||
void
|
||||
collect_metrics();
|
||||
@@ -222,19 +222,19 @@ private:
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isWeak() const
|
||||
{
|
||||
if (!ptr)
|
||||
return true;
|
||||
return ptr.isWeak();
|
||||
}
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isCached() const
|
||||
{
|
||||
return ptr && ptr.isStrong();
|
||||
}
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isExpired() const
|
||||
{
|
||||
return ptr.expired();
|
||||
@@ -266,7 +266,7 @@ private:
|
||||
typename KeyValueCacheType::map_type& partition,
|
||||
SweptPointersVector& stuffToSweep,
|
||||
std::atomic<int>& allRemovals,
|
||||
std::lock_guard<std::recursive_mutex> const&);
|
||||
std::scoped_lock<std::recursive_mutex> const&);
|
||||
|
||||
[[nodiscard]] std::thread
|
||||
sweepHelper(
|
||||
@@ -275,7 +275,7 @@ private:
|
||||
typename KeyOnlyCacheType::map_type& partition,
|
||||
SweptPointersVector&,
|
||||
std::atomic<int>& allRemovals,
|
||||
std::lock_guard<std::recursive_mutex> const&);
|
||||
std::scoped_lock<std::recursive_mutex> const&);
|
||||
|
||||
beast::Journal m_journal;
|
||||
clock_type& m_clock;
|
||||
|
||||
@@ -69,7 +69,7 @@ inline std::size_t
|
||||
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||
size() const
|
||||
{
|
||||
std::lock_guard lock(m_mutex);
|
||||
std::scoped_lock lock(m_mutex);
|
||||
return m_cache.size();
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ inline int
|
||||
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||
getCacheSize() const
|
||||
{
|
||||
std::lock_guard lock(m_mutex);
|
||||
std::scoped_lock lock(m_mutex);
|
||||
return m_cache_count;
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ inline int
|
||||
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||
getTrackSize() const
|
||||
{
|
||||
std::lock_guard lock(m_mutex);
|
||||
std::scoped_lock lock(m_mutex);
|
||||
return m_cache.size();
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ inline float
|
||||
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||
getHitRate()
|
||||
{
|
||||
std::lock_guard lock(m_mutex);
|
||||
std::scoped_lock lock(m_mutex);
|
||||
auto const total = static_cast<float>(m_hits + m_misses);
|
||||
return m_hits * (100.0f / std::max(1.0f, total));
|
||||
}
|
||||
@@ -138,7 +138,7 @@ inline void
|
||||
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||
clear()
|
||||
{
|
||||
std::lock_guard lock(m_mutex);
|
||||
std::scoped_lock lock(m_mutex);
|
||||
m_cache.clear();
|
||||
m_cache_count = 0;
|
||||
}
|
||||
@@ -156,7 +156,7 @@ inline void
|
||||
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||
reset()
|
||||
{
|
||||
std::lock_guard lock(m_mutex);
|
||||
std::scoped_lock lock(m_mutex);
|
||||
m_cache.clear();
|
||||
m_cache_count = 0;
|
||||
m_hits = 0;
|
||||
@@ -177,7 +177,7 @@ inline bool
|
||||
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||
touch_if_exists(KeyComparable const& key)
|
||||
{
|
||||
std::lock_guard lock(m_mutex);
|
||||
std::scoped_lock lock(m_mutex);
|
||||
auto const iter(m_cache.find(key));
|
||||
if (iter == m_cache.end())
|
||||
{
|
||||
@@ -212,7 +212,7 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
|
||||
|
||||
auto const start = std::chrono::steady_clock::now();
|
||||
{
|
||||
std::lock_guard lock(m_mutex);
|
||||
std::scoped_lock lock(m_mutex);
|
||||
|
||||
if (m_target_size == 0 || (static_cast<int>(m_cache.size()) <= m_target_size))
|
||||
{
|
||||
@@ -269,7 +269,7 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
|
||||
{
|
||||
// Remove from cache, if !valid, remove from map too. Returns true if
|
||||
// removed from cache
|
||||
std::lock_guard lock(m_mutex);
|
||||
std::scoped_lock lock(m_mutex);
|
||||
|
||||
auto cit = m_cache.find(key);
|
||||
|
||||
@@ -309,7 +309,7 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
|
||||
{
|
||||
// Return canonical value, store if needed, refresh in cache
|
||||
// Return values: true=we had the data already
|
||||
std::lock_guard lock(m_mutex);
|
||||
std::scoped_lock lock(m_mutex);
|
||||
|
||||
auto cit = m_cache.find(key);
|
||||
|
||||
@@ -423,7 +423,7 @@ inline SharedPointerType
|
||||
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||
fetch(key_type const& key)
|
||||
{
|
||||
std::lock_guard<mutex_type> l(m_mutex);
|
||||
std::scoped_lock<mutex_type> l(m_mutex);
|
||||
auto ret = initialFetch(key, l);
|
||||
if (!ret)
|
||||
++m_misses;
|
||||
@@ -474,7 +474,7 @@ inline auto
|
||||
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||
insert(key_type const& key) -> std::enable_if_t<IsKeyCache, ReturnType>
|
||||
{
|
||||
std::lock_guard lock(m_mutex);
|
||||
std::scoped_lock lock(m_mutex);
|
||||
clock_type::time_point const now(m_clock.now());
|
||||
auto [it, inserted] = m_cache.emplace(
|
||||
std::piecewise_construct, std::forward_as_tuple(key), std::forward_as_tuple(now));
|
||||
@@ -538,7 +538,7 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
|
||||
std::vector<key_type> v;
|
||||
|
||||
{
|
||||
std::lock_guard lock(m_mutex);
|
||||
std::scoped_lock lock(m_mutex);
|
||||
v.reserve(m_cache.size());
|
||||
for (auto const& _ : m_cache)
|
||||
v.push_back(_.first);
|
||||
@@ -560,7 +560,7 @@ inline double
|
||||
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||
rate() const
|
||||
{
|
||||
std::lock_guard lock(m_mutex);
|
||||
std::scoped_lock lock(m_mutex);
|
||||
auto const tot = m_hits + m_misses;
|
||||
if (tot == 0)
|
||||
return 0;
|
||||
@@ -582,7 +582,7 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
|
||||
fetch(key_type const& digest, Handler const& h)
|
||||
{
|
||||
{
|
||||
std::lock_guard l(m_mutex);
|
||||
std::scoped_lock l(m_mutex);
|
||||
if (auto ret = initialFetch(digest, l))
|
||||
return ret;
|
||||
}
|
||||
@@ -591,7 +591,7 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
|
||||
if (!sle)
|
||||
return {};
|
||||
|
||||
std::lock_guard l(m_mutex);
|
||||
std::scoped_lock l(m_mutex);
|
||||
++m_misses;
|
||||
auto const [it, inserted] = m_cache.emplace(digest, Entry(m_clock.now(), std::move(sle)));
|
||||
if (!inserted)
|
||||
@@ -611,7 +611,7 @@ template <
|
||||
class Mutex>
|
||||
inline SharedPointerType
|
||||
TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash, KeyEqual, Mutex>::
|
||||
initialFetch(key_type const& key, std::lock_guard<mutex_type> const& l)
|
||||
initialFetch(key_type const& key, std::scoped_lock<mutex_type> const& l)
|
||||
{
|
||||
auto cit = m_cache.find(key);
|
||||
if (cit == m_cache.end())
|
||||
@@ -655,7 +655,7 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
|
||||
{
|
||||
beast::insight::Gauge::value_type hit_rate(0);
|
||||
{
|
||||
std::lock_guard lock(m_mutex);
|
||||
std::scoped_lock lock(m_mutex);
|
||||
auto const total(m_hits + m_misses);
|
||||
if (total != 0)
|
||||
hit_rate = (m_hits * 100) / total;
|
||||
@@ -681,7 +681,7 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
|
||||
typename KeyValueCacheType::map_type& partition,
|
||||
SweptPointersVector& stuffToSweep,
|
||||
std::atomic<int>& allRemovals,
|
||||
std::lock_guard<std::recursive_mutex> const&)
|
||||
std::scoped_lock<std::recursive_mutex> const&)
|
||||
{
|
||||
return std::thread([&, this]() {
|
||||
int cacheRemovals = 0;
|
||||
@@ -761,7 +761,7 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
|
||||
typename KeyOnlyCacheType::map_type& partition,
|
||||
SweptPointersVector&,
|
||||
std::atomic<int>& allRemovals,
|
||||
std::lock_guard<std::recursive_mutex> const&)
|
||||
std::scoped_lock<std::recursive_mutex> const&)
|
||||
{
|
||||
return std::thread([&, this]() {
|
||||
int cacheRemovals = 0;
|
||||
|
||||
@@ -102,7 +102,7 @@ public:
|
||||
{
|
||||
return reinterpret_cast<pointer>(data_.data());
|
||||
}
|
||||
const_pointer
|
||||
[[nodiscard]] const_pointer
|
||||
data() const
|
||||
{
|
||||
return reinterpret_cast<const_pointer>(data_.data());
|
||||
@@ -118,22 +118,22 @@ public:
|
||||
{
|
||||
return data() + bytes;
|
||||
}
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
begin() const
|
||||
{
|
||||
return data();
|
||||
}
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
end() const
|
||||
{
|
||||
return data() + bytes;
|
||||
}
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
cbegin() const
|
||||
{
|
||||
return data();
|
||||
}
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
cend() const
|
||||
{
|
||||
return data() + bytes;
|
||||
@@ -310,7 +310,7 @@ public:
|
||||
return fromVoid(from.data());
|
||||
}
|
||||
|
||||
constexpr int
|
||||
[[nodiscard]] constexpr int
|
||||
signum() const
|
||||
{
|
||||
for (int i = 0; i < WIDTH; i++)
|
||||
@@ -433,14 +433,14 @@ public:
|
||||
return ret;
|
||||
}
|
||||
|
||||
base_uint
|
||||
[[nodiscard]] base_uint
|
||||
next() const
|
||||
{
|
||||
auto ret = *this;
|
||||
return ++ret;
|
||||
}
|
||||
|
||||
base_uint
|
||||
[[nodiscard]] base_uint
|
||||
prev() const
|
||||
{
|
||||
auto ret = *this;
|
||||
@@ -517,12 +517,12 @@ public:
|
||||
}
|
||||
|
||||
// Deprecated.
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isZero() const
|
||||
{
|
||||
return *this == beast::zero;
|
||||
}
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isNonZero() const
|
||||
{
|
||||
return *this != beast::zero;
|
||||
|
||||
@@ -32,7 +32,7 @@ make_seed_pair() noexcept
|
||||
// state_t& operator=(state_t const&) = delete;
|
||||
};
|
||||
static state_t state;
|
||||
std::lock_guard const lock(state.mutex);
|
||||
std::scoped_lock const lock(state.mutex);
|
||||
return {state.dist(state.gen), state.dist(state.gen)};
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ default_prng()
|
||||
thread_local beast::xor_shift_engine engine = [] {
|
||||
std::uint64_t seed = 0;
|
||||
{
|
||||
std::lock_guard const lk(m);
|
||||
std::scoped_lock const lk(m);
|
||||
std::uniform_int_distribution<std::uint64_t> distribution{1};
|
||||
seed = distribution(seeder);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
return m_ios;
|
||||
}
|
||||
|
||||
boost::asio::io_context const&
|
||||
[[nodiscard]] boost::asio::io_context const&
|
||||
get_io_context() const
|
||||
{
|
||||
return m_ios;
|
||||
@@ -83,7 +83,7 @@ public:
|
||||
void
|
||||
sample_one(Handler&& handler)
|
||||
{
|
||||
std::lock_guard const lock(m_mutex);
|
||||
std::scoped_lock const lock(m_mutex);
|
||||
if (m_cancel)
|
||||
throw std::logic_error("io_latency_probe is canceled");
|
||||
boost::asio::post(
|
||||
@@ -98,7 +98,7 @@ public:
|
||||
void
|
||||
sample(Handler&& handler)
|
||||
{
|
||||
std::lock_guard const lock(m_mutex);
|
||||
std::scoped_lock const lock(m_mutex);
|
||||
if (m_cancel)
|
||||
throw std::logic_error("io_latency_probe is canceled");
|
||||
boost::asio::post(
|
||||
@@ -122,14 +122,14 @@ private:
|
||||
void
|
||||
addref()
|
||||
{
|
||||
std::lock_guard const lock(m_mutex);
|
||||
std::scoped_lock const lock(m_mutex);
|
||||
++m_count;
|
||||
}
|
||||
|
||||
void
|
||||
release()
|
||||
{
|
||||
std::lock_guard const lock(m_mutex);
|
||||
std::scoped_lock const lock(m_mutex);
|
||||
if (--m_count == 0)
|
||||
m_cond.notify_all();
|
||||
}
|
||||
@@ -192,7 +192,7 @@ private:
|
||||
m_handler(elapsed);
|
||||
|
||||
{
|
||||
std::lock_guard const lock(m_probe->m_mutex);
|
||||
std::scoped_lock const lock(m_probe->m_mutex);
|
||||
if (m_probe->m_cancel)
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ struct abstract_clock_wrapper : public abstract_clock<Facade>
|
||||
using typename abstract_clock<Facade>::duration;
|
||||
using typename abstract_clock<Facade>::time_point;
|
||||
|
||||
time_point
|
||||
[[nodiscard]] time_point
|
||||
now() const override
|
||||
{
|
||||
return Clock::now();
|
||||
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
time_point
|
||||
[[nodiscard]] time_point
|
||||
now() const override
|
||||
{
|
||||
return now_;
|
||||
|
||||
@@ -115,7 +115,7 @@ public:
|
||||
return &m_iter->value;
|
||||
}
|
||||
|
||||
time_point const&
|
||||
[[nodiscard]] time_point const&
|
||||
when() const
|
||||
{
|
||||
return m_iter->when;
|
||||
@@ -136,7 +136,7 @@ private:
|
||||
{
|
||||
}
|
||||
|
||||
Iterator const&
|
||||
[[nodiscard]] Iterator const&
|
||||
iterator() const
|
||||
{
|
||||
return m_iter;
|
||||
|
||||
@@ -186,7 +186,7 @@ private:
|
||||
return *this;
|
||||
}
|
||||
|
||||
Compare const&
|
||||
[[nodiscard]] Compare const&
|
||||
compare() const
|
||||
{
|
||||
return *this;
|
||||
@@ -295,7 +295,7 @@ private:
|
||||
return KeyValueCompare::compare();
|
||||
}
|
||||
|
||||
Compare const&
|
||||
[[nodiscard]] Compare const&
|
||||
compare() const
|
||||
{
|
||||
return KeyValueCompare::compare();
|
||||
@@ -307,7 +307,7 @@ private:
|
||||
return *this;
|
||||
}
|
||||
|
||||
KeyValueCompare const&
|
||||
[[nodiscard]] KeyValueCompare const&
|
||||
key_compare() const
|
||||
{
|
||||
return *this;
|
||||
@@ -319,7 +319,7 @@ private:
|
||||
return beast::detail::empty_base_optimization<ElementAllocator>::member();
|
||||
}
|
||||
|
||||
ElementAllocator const&
|
||||
[[nodiscard]] ElementAllocator const&
|
||||
alloc() const
|
||||
{
|
||||
return beast::detail::empty_base_optimization<ElementAllocator>::member();
|
||||
|
||||
@@ -149,7 +149,7 @@ private:
|
||||
return *this;
|
||||
}
|
||||
|
||||
Hash const&
|
||||
[[nodiscard]] Hash const&
|
||||
hash_function() const
|
||||
{
|
||||
return *this;
|
||||
@@ -195,7 +195,7 @@ private:
|
||||
return *this;
|
||||
}
|
||||
|
||||
KeyEqual const&
|
||||
[[nodiscard]] KeyEqual const&
|
||||
key_eq() const
|
||||
{
|
||||
return *this;
|
||||
@@ -348,7 +348,7 @@ private:
|
||||
return *this;
|
||||
}
|
||||
|
||||
ValueHash const&
|
||||
[[nodiscard]] ValueHash const&
|
||||
value_hash() const
|
||||
{
|
||||
return *this;
|
||||
@@ -360,7 +360,7 @@ private:
|
||||
return ValueHash::hash_function();
|
||||
}
|
||||
|
||||
Hash const&
|
||||
[[nodiscard]] Hash const&
|
||||
hash_function() const
|
||||
{
|
||||
return ValueHash::hash_function();
|
||||
@@ -372,7 +372,7 @@ private:
|
||||
return *this;
|
||||
}
|
||||
|
||||
KeyValueEqual const&
|
||||
[[nodiscard]] KeyValueEqual const&
|
||||
key_value_equal() const
|
||||
{
|
||||
return *this;
|
||||
@@ -384,7 +384,7 @@ private:
|
||||
return key_value_equal().key_eq();
|
||||
}
|
||||
|
||||
KeyEqual const&
|
||||
[[nodiscard]] KeyEqual const&
|
||||
key_eq() const
|
||||
{
|
||||
return key_value_equal().key_eq();
|
||||
@@ -396,7 +396,7 @@ private:
|
||||
return beast::detail::empty_base_optimization<ElementAllocator>::member();
|
||||
}
|
||||
|
||||
ElementAllocator const&
|
||||
[[nodiscard]] ElementAllocator const&
|
||||
alloc() const
|
||||
{
|
||||
return beast::detail::empty_base_optimization<ElementAllocator>::member();
|
||||
@@ -433,7 +433,7 @@ private:
|
||||
m_vec.clear();
|
||||
}
|
||||
|
||||
size_type
|
||||
[[nodiscard]] size_type
|
||||
max_bucket_count() const
|
||||
{
|
||||
return m_vec.max_size();
|
||||
@@ -445,7 +445,7 @@ private:
|
||||
return m_max_load_factor;
|
||||
}
|
||||
|
||||
float const&
|
||||
[[nodiscard]] float const&
|
||||
max_load_factor() const
|
||||
{
|
||||
return m_max_load_factor;
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
T const&
|
||||
[[nodiscard]] T const&
|
||||
member() const noexcept
|
||||
{
|
||||
return *this;
|
||||
|
||||
@@ -128,7 +128,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
reference
|
||||
[[nodiscard]] reference
|
||||
dereference() const noexcept
|
||||
{
|
||||
return static_cast<reference>(*m_node);
|
||||
@@ -287,14 +287,14 @@ public:
|
||||
/** Determine if the list is empty.
|
||||
@return `true` if the list is empty.
|
||||
*/
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
empty() const noexcept
|
||||
{
|
||||
return size() == 0;
|
||||
}
|
||||
|
||||
/** Returns the number of elements in the list. */
|
||||
size_type
|
||||
[[nodiscard]] size_type
|
||||
size() const noexcept
|
||||
{
|
||||
return m_size;
|
||||
@@ -314,7 +314,7 @@ public:
|
||||
@invariant The list may not be empty.
|
||||
@return A const reference to the first element.
|
||||
*/
|
||||
const_reference
|
||||
[[nodiscard]] const_reference
|
||||
front() const noexcept
|
||||
{
|
||||
return element_from(m_head.m_next);
|
||||
@@ -334,7 +334,7 @@ public:
|
||||
@invariant The list may not be empty.
|
||||
@return A const reference to the last element.
|
||||
*/
|
||||
const_reference
|
||||
[[nodiscard]] const_reference
|
||||
back() const noexcept
|
||||
{
|
||||
return element_from(m_tail.m_prev);
|
||||
@@ -352,7 +352,7 @@ public:
|
||||
/** Obtain a const iterator to the beginning of the list.
|
||||
@return A const iterator pointing to the beginning of the list.
|
||||
*/
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
begin() const noexcept
|
||||
{
|
||||
return const_iterator(m_head.m_next);
|
||||
@@ -361,7 +361,7 @@ public:
|
||||
/** Obtain a const iterator to the beginning of the list.
|
||||
@return A const iterator pointing to the beginning of the list.
|
||||
*/
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
cbegin() const noexcept
|
||||
{
|
||||
return const_iterator(m_head.m_next);
|
||||
@@ -379,7 +379,7 @@ public:
|
||||
/** Obtain a const iterator to the end of the list.
|
||||
@return A constiterator pointing to the end of the list.
|
||||
*/
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
end() const noexcept
|
||||
{
|
||||
return const_iterator(&m_tail);
|
||||
@@ -388,7 +388,7 @@ public:
|
||||
/** Obtain a const iterator to the end of the list
|
||||
@return A constiterator pointing to the end of the list.
|
||||
*/
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
cend() const noexcept
|
||||
{
|
||||
return const_iterator(&m_tail);
|
||||
@@ -549,7 +549,7 @@ public:
|
||||
@param element The element to obtain an iterator for.
|
||||
@return A const iterator to the element.
|
||||
*/
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
const_iterator_to(T const& element) const noexcept
|
||||
{
|
||||
return const_iterator(static_cast<Node const*>(&element));
|
||||
|
||||
@@ -162,7 +162,7 @@ public:
|
||||
operator=(LockFreeStack const&) = delete;
|
||||
|
||||
/** Returns true if the stack is empty. */
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
empty() const
|
||||
{
|
||||
return m_head.load() == &m_end;
|
||||
@@ -237,25 +237,25 @@ public:
|
||||
return iterator(&m_end);
|
||||
}
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
begin() const
|
||||
{
|
||||
return const_iterator(m_head.load());
|
||||
}
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
end() const
|
||||
{
|
||||
return const_iterator(&m_end);
|
||||
}
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
cbegin() const
|
||||
{
|
||||
return const_iterator(m_head.load());
|
||||
}
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
cend() const
|
||||
{
|
||||
return const_iterator(&m_end);
|
||||
|
||||
@@ -37,15 +37,15 @@ public:
|
||||
parse(std::string_view input);
|
||||
|
||||
/** Produce a string from semantic version components. */
|
||||
std::string
|
||||
[[nodiscard]] std::string
|
||||
print() const;
|
||||
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isRelease() const noexcept
|
||||
{
|
||||
return preReleaseIdentifiers.empty();
|
||||
}
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isPreRelease() const noexcept
|
||||
{
|
||||
return !isRelease();
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
m_impl->notify(ceil<value_type>(value));
|
||||
}
|
||||
|
||||
std::shared_ptr<EventImpl> const&
|
||||
[[nodiscard]] std::shared_ptr<EventImpl> const&
|
||||
impl() const
|
||||
{
|
||||
return m_impl;
|
||||
|
||||
@@ -108,7 +108,7 @@ public:
|
||||
}
|
||||
/** @} */
|
||||
|
||||
std::shared_ptr<GaugeImpl> const&
|
||||
[[nodiscard]] std::shared_ptr<GaugeImpl> const&
|
||||
impl() const
|
||||
{
|
||||
return m_impl;
|
||||
|
||||
@@ -14,7 +14,7 @@ public:
|
||||
using ptr = std::shared_ptr<Group>;
|
||||
|
||||
/** Returns the name of this group, for diagnostics. */
|
||||
virtual std::string const&
|
||||
[[nodiscard]] virtual std::string const&
|
||||
name() const = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
std::shared_ptr<HookImpl> const&
|
||||
[[nodiscard]] std::shared_ptr<HookImpl> const&
|
||||
impl() const
|
||||
{
|
||||
return m_impl;
|
||||
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
}
|
||||
/** @} */
|
||||
|
||||
std::shared_ptr<MeterImpl> const&
|
||||
[[nodiscard]] std::shared_ptr<MeterImpl> const&
|
||||
impl() const
|
||||
{
|
||||
return m_impl;
|
||||
|
||||
@@ -32,25 +32,25 @@ public:
|
||||
from_string(std::string const& s);
|
||||
|
||||
/** Returns a string representing the endpoint. */
|
||||
std::string
|
||||
[[nodiscard]] std::string
|
||||
to_string() const;
|
||||
|
||||
/** Returns the port number on the endpoint. */
|
||||
Port
|
||||
[[nodiscard]] Port
|
||||
port() const
|
||||
{
|
||||
return m_port;
|
||||
}
|
||||
|
||||
/** Returns a new Endpoint with a different port. */
|
||||
Endpoint
|
||||
[[nodiscard]] Endpoint
|
||||
at_port(Port port) const
|
||||
{
|
||||
return Endpoint(m_addr, port);
|
||||
}
|
||||
|
||||
/** Returns the address portion of this endpoint. */
|
||||
Address const&
|
||||
[[nodiscard]] Address const&
|
||||
address() const
|
||||
{
|
||||
return m_addr;
|
||||
@@ -58,22 +58,22 @@ public:
|
||||
|
||||
/** Convenience accessors for the address part. */
|
||||
/** @{ */
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
is_v4() const
|
||||
{
|
||||
return m_addr.is_v4();
|
||||
}
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
is_v6() const
|
||||
{
|
||||
return m_addr.is_v6();
|
||||
}
|
||||
AddressV4
|
||||
[[nodiscard]] AddressV4
|
||||
to_v4() const
|
||||
{
|
||||
return m_addr.to_v4();
|
||||
}
|
||||
AddressV6
|
||||
[[nodiscard]] AddressV6
|
||||
to_v6() const
|
||||
{
|
||||
return m_addr.to_v6();
|
||||
|
||||
@@ -43,8 +43,10 @@ public:
|
||||
: work_(boost::asio::make_work_guard(ios_))
|
||||
{
|
||||
threads_.reserve(concurrency);
|
||||
while ((concurrency--) != 0u)
|
||||
for (std::size_t i = 0; i < concurrency; ++i)
|
||||
{
|
||||
threads_.emplace_back([&] { ios_.run(); });
|
||||
}
|
||||
}
|
||||
|
||||
~enable_yield_to()
|
||||
@@ -113,7 +115,7 @@ enable_yield_to::spawn(F0&& f, FN&&... fn)
|
||||
boost::context::fixedsize_stack(2 * 1024 * 1024),
|
||||
[&](yield_context yield) {
|
||||
f(yield);
|
||||
std::lock_guard const lock{m_};
|
||||
std::scoped_lock const lock{m_};
|
||||
if (--running_ == 0)
|
||||
cv_.notify_all();
|
||||
},
|
||||
|
||||
@@ -25,7 +25,7 @@ protected:
|
||||
return m_cont;
|
||||
}
|
||||
|
||||
cont_type const&
|
||||
[[nodiscard]] cont_type const&
|
||||
cont() const
|
||||
{
|
||||
return m_cont;
|
||||
@@ -39,14 +39,14 @@ public:
|
||||
using const_iterator = typename cont_type::const_iterator;
|
||||
|
||||
/** Returns `true` if the container is empty. */
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
empty() const
|
||||
{
|
||||
return m_cont.empty();
|
||||
}
|
||||
|
||||
/** Returns the number of items in the container. */
|
||||
size_type
|
||||
[[nodiscard]] size_type
|
||||
size() const
|
||||
{
|
||||
return m_cont.size();
|
||||
@@ -54,25 +54,25 @@ public:
|
||||
|
||||
/** Returns forward iterators for traversal. */
|
||||
/** @{ */
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
begin() const
|
||||
{
|
||||
return m_cont.cbegin();
|
||||
}
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
cbegin() const
|
||||
{
|
||||
return m_cont.cbegin();
|
||||
}
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
end() const
|
||||
{
|
||||
return m_cont.cend();
|
||||
}
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
cend() const
|
||||
{
|
||||
return m_cont.cend();
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace beast::unit_test {
|
||||
class selector
|
||||
{
|
||||
public:
|
||||
enum mode_t {
|
||||
enum class mode_t {
|
||||
// Run all tests except manual ones
|
||||
all,
|
||||
|
||||
@@ -53,8 +53,8 @@ public:
|
||||
template <class>
|
||||
selector::selector(mode_t mode, std::string const& pattern) : mode_(mode), pat_(pattern)
|
||||
{
|
||||
if (mode_ == automatch && pattern.empty())
|
||||
mode_ = all;
|
||||
if (mode_ == mode_t::automatch && pattern.empty())
|
||||
mode_ = mode_t::all;
|
||||
}
|
||||
|
||||
template <class>
|
||||
@@ -63,18 +63,18 @@ selector::operator()(suite_info const& s)
|
||||
{
|
||||
switch (mode_)
|
||||
{
|
||||
case automatch:
|
||||
case mode_t::automatch:
|
||||
// suite or full name
|
||||
if (s.name() == pat_ || s.full_name() == pat_)
|
||||
{
|
||||
mode_ = none;
|
||||
mode_ = mode_t::none;
|
||||
return true;
|
||||
}
|
||||
|
||||
// check module
|
||||
if (pat_ == s.module())
|
||||
{
|
||||
mode_ = module;
|
||||
mode_ = mode_t::module;
|
||||
library_ = s.library();
|
||||
return !s.manual();
|
||||
}
|
||||
@@ -82,7 +82,7 @@ selector::operator()(suite_info const& s)
|
||||
// check library
|
||||
if (pat_ == s.library())
|
||||
{
|
||||
mode_ = library;
|
||||
mode_ = mode_t::library;
|
||||
return !s.manual();
|
||||
}
|
||||
|
||||
@@ -96,19 +96,19 @@ selector::operator()(suite_info const& s)
|
||||
|
||||
return false;
|
||||
|
||||
case suite:
|
||||
case mode_t::suite:
|
||||
return pat_ == s.name();
|
||||
|
||||
case module:
|
||||
case mode_t::module:
|
||||
return pat_ == s.module() && !s.manual();
|
||||
|
||||
case library:
|
||||
case mode_t::library:
|
||||
return pat_ == s.library() && !s.manual();
|
||||
|
||||
case none:
|
||||
case mode_t::none:
|
||||
return false;
|
||||
|
||||
case all:
|
||||
case mode_t::all:
|
||||
default:
|
||||
break;
|
||||
};
|
||||
@@ -138,28 +138,28 @@ selector::operator()(suite_info const& s)
|
||||
inline selector
|
||||
match_auto(std::string const& name)
|
||||
{
|
||||
return selector(selector::automatch, name);
|
||||
return selector(selector::mode_t::automatch, name);
|
||||
}
|
||||
|
||||
/** Return a predicate that matches all suites not marked manual. */
|
||||
inline selector
|
||||
match_all()
|
||||
{
|
||||
return selector(selector::all);
|
||||
return selector(selector::mode_t::all);
|
||||
}
|
||||
|
||||
/** Returns a predicate that matches a specific suite. */
|
||||
inline selector
|
||||
match_suite(std::string const& name)
|
||||
{
|
||||
return selector(selector::suite, name);
|
||||
return selector(selector::mode_t::suite, name);
|
||||
}
|
||||
|
||||
/** Returns a predicate that matches all suites in a library. */
|
||||
inline selector
|
||||
match_library(std::string const& name)
|
||||
{
|
||||
return selector(selector::library, name);
|
||||
return selector(selector::mode_t::library, name);
|
||||
}
|
||||
|
||||
} // namespace beast::unit_test
|
||||
|
||||
@@ -21,7 +21,7 @@ public:
|
||||
recorder() = default;
|
||||
|
||||
/** Returns a report with the results of all completed suites. */
|
||||
results const&
|
||||
[[nodiscard]] results const&
|
||||
report() const
|
||||
{
|
||||
return m_results;
|
||||
|
||||
@@ -62,6 +62,8 @@ private:
|
||||
{
|
||||
using run_time = std::pair<std::string, typename clock_type::duration>;
|
||||
|
||||
// Need to be named before converting
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
|
||||
enum { max_top = 10 };
|
||||
|
||||
std::size_t suites = 0;
|
||||
|
||||
@@ -41,14 +41,14 @@ private:
|
||||
tests_t() = default;
|
||||
|
||||
/** Returns the total number of test conditions. */
|
||||
std::size_t
|
||||
[[nodiscard]] std::size_t
|
||||
total() const
|
||||
{
|
||||
return cont().size();
|
||||
}
|
||||
|
||||
/** Returns the number of failed test conditions. */
|
||||
std::size_t
|
||||
[[nodiscard]] std::size_t
|
||||
failed() const
|
||||
{
|
||||
return failed_;
|
||||
@@ -89,7 +89,7 @@ public:
|
||||
}
|
||||
|
||||
/** Returns the name of this testcase. */
|
||||
std::string const&
|
||||
[[nodiscard]] std::string const&
|
||||
name() const
|
||||
{
|
||||
return name_;
|
||||
@@ -118,21 +118,21 @@ public:
|
||||
}
|
||||
|
||||
/** Returns the name of this suite. */
|
||||
std::string const&
|
||||
[[nodiscard]] std::string const&
|
||||
name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
/** Returns the total number of test conditions. */
|
||||
std::size_t
|
||||
[[nodiscard]] std::size_t
|
||||
total() const
|
||||
{
|
||||
return total_;
|
||||
}
|
||||
|
||||
/** Returns the number of failures. */
|
||||
std::size_t
|
||||
[[nodiscard]] std::size_t
|
||||
failed() const
|
||||
{
|
||||
return failed_;
|
||||
@@ -173,21 +173,21 @@ public:
|
||||
results() = default;
|
||||
|
||||
/** Returns the total number of test cases. */
|
||||
std::size_t
|
||||
[[nodiscard]] std::size_t
|
||||
cases() const
|
||||
{
|
||||
return m_cases;
|
||||
}
|
||||
|
||||
/** Returns the total number of test conditions. */
|
||||
std::size_t
|
||||
[[nodiscard]] std::size_t
|
||||
total() const
|
||||
{
|
||||
return total_;
|
||||
}
|
||||
|
||||
/** Returns the number of failures. */
|
||||
std::size_t
|
||||
[[nodiscard]] std::size_t
|
||||
failed() const
|
||||
{
|
||||
return failed_;
|
||||
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
}
|
||||
|
||||
/** Returns the argument string. */
|
||||
std::string const&
|
||||
[[nodiscard]] std::string const&
|
||||
arg() const
|
||||
{
|
||||
return arg_;
|
||||
@@ -231,7 +231,7 @@ template <class>
|
||||
void
|
||||
runner::testcase(std::string const& name)
|
||||
{
|
||||
std::lock_guard const lock(mutex_);
|
||||
std::scoped_lock const lock(mutex_);
|
||||
// Name may not be empty
|
||||
BOOST_ASSERT(default_ || !name.empty());
|
||||
// Forgot to call pass or fail
|
||||
@@ -247,7 +247,7 @@ template <class>
|
||||
void
|
||||
runner::pass()
|
||||
{
|
||||
std::lock_guard const lock(mutex_);
|
||||
std::scoped_lock const lock(mutex_);
|
||||
if (default_)
|
||||
testcase("");
|
||||
on_pass();
|
||||
@@ -258,7 +258,7 @@ template <class>
|
||||
void
|
||||
runner::fail(std::string const& reason)
|
||||
{
|
||||
std::lock_guard const lock(mutex_);
|
||||
std::scoped_lock const lock(mutex_);
|
||||
if (default_)
|
||||
testcase("");
|
||||
on_fail(reason);
|
||||
@@ -270,7 +270,7 @@ template <class>
|
||||
void
|
||||
runner::log(std::string const& s)
|
||||
{
|
||||
std::lock_guard const lock(mutex_);
|
||||
std::scoped_lock const lock(mutex_);
|
||||
if (default_)
|
||||
testcase("");
|
||||
on_log(s);
|
||||
|
||||
@@ -37,7 +37,7 @@ make_reason(String const& reason, char const* file, int line)
|
||||
|
||||
class Thread;
|
||||
|
||||
enum abort_t { no_abort_on_fail, abort_on_fail };
|
||||
enum class abort_t { no_abort_on_fail, abort_on_fail };
|
||||
|
||||
/** A testsuite class.
|
||||
|
||||
@@ -57,7 +57,7 @@ private:
|
||||
// in the event of a failure, if the option to stop is set.
|
||||
struct abort_exception : public std::exception
|
||||
{
|
||||
char const*
|
||||
[[nodiscard]] char const*
|
||||
what() const noexcept override
|
||||
{
|
||||
return "test suite aborted";
|
||||
@@ -127,7 +127,7 @@ private:
|
||||
@param abort Determines if suite continues running after a failure.
|
||||
*/
|
||||
void
|
||||
operator()(std::string const& name, abort_t abort = no_abort_on_fail);
|
||||
operator()(std::string const& name, abort_t abort = abort_t::no_abort_on_fail);
|
||||
|
||||
scoped_testcase
|
||||
operator()(abort_t abort);
|
||||
@@ -363,14 +363,14 @@ public:
|
||||
inline void
|
||||
suite::testcase_t::operator()(std::string const& name, abort_t abort)
|
||||
{
|
||||
suite_.abort_ = abort == abort_on_fail;
|
||||
suite_.abort_ = abort == abort_t::abort_on_fail;
|
||||
suite_.runner_->testcase(name);
|
||||
}
|
||||
|
||||
inline suite::scoped_testcase
|
||||
suite::testcase_t::operator()(abort_t abort)
|
||||
{
|
||||
suite_.abort_ = abort == abort_on_fail;
|
||||
suite_.abort_ = abort == abort_t::abort_on_fail;
|
||||
return {suite_, ss_};
|
||||
}
|
||||
|
||||
|
||||
@@ -42,33 +42,33 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
std::string const&
|
||||
[[nodiscard]] std::string const&
|
||||
name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
std::string const&
|
||||
[[nodiscard]] std::string const&
|
||||
module() const
|
||||
{
|
||||
return module_;
|
||||
}
|
||||
|
||||
std::string const&
|
||||
[[nodiscard]] std::string const&
|
||||
library() const
|
||||
{
|
||||
return library_;
|
||||
}
|
||||
|
||||
/// Returns `true` if this suite only runs manually.
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
manual() const
|
||||
{
|
||||
return manual_;
|
||||
}
|
||||
|
||||
/// Return the canonical suite name as a string.
|
||||
std::string
|
||||
[[nodiscard]] std::string
|
||||
full_name() const
|
||||
{
|
||||
return library_ + "." + module_ + "." + name_;
|
||||
|
||||
@@ -47,13 +47,13 @@ public:
|
||||
t_ = std::thread(&Thread::run, this, std::move(b));
|
||||
}
|
||||
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
joinable() const
|
||||
{
|
||||
return t_.joinable();
|
||||
}
|
||||
|
||||
std::thread::id
|
||||
[[nodiscard]] std::thread::id
|
||||
get_id() const
|
||||
{
|
||||
return t_.get_id();
|
||||
|
||||
@@ -9,6 +9,8 @@ namespace beast {
|
||||
/** A namespace for easy access to logging severity values. */
|
||||
namespace severities {
|
||||
/** Severity level / threshold of a Journal message. */
|
||||
// Hundreds of usages via logging macros
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
|
||||
enum Severity {
|
||||
kAll = 0,
|
||||
|
||||
@@ -66,12 +68,12 @@ public:
|
||||
operator=(Sink const& lhs) = delete;
|
||||
|
||||
/** Returns `true` if text at the passed severity produces output. */
|
||||
virtual bool
|
||||
[[nodiscard]] virtual bool
|
||||
active(Severity level) const;
|
||||
|
||||
/** Returns `true` if a message is also written to the Output Window
|
||||
* (MSVC). */
|
||||
virtual bool
|
||||
[[nodiscard]] virtual bool
|
||||
console() const;
|
||||
|
||||
/** Set whether messages are also written to the Output Window (MSVC).
|
||||
@@ -80,7 +82,7 @@ public:
|
||||
console(bool output);
|
||||
|
||||
/** Returns the minimum severity level this sink will report. */
|
||||
virtual Severity
|
||||
[[nodiscard]] virtual Severity
|
||||
threshold() const;
|
||||
|
||||
/** Set the minimum severity this sink will report. */
|
||||
@@ -204,14 +206,14 @@ public:
|
||||
operator=(Stream const& other) = delete;
|
||||
|
||||
/** Returns the Sink that this Stream writes to. */
|
||||
Sink&
|
||||
[[nodiscard]] Sink&
|
||||
sink() const
|
||||
{
|
||||
return m_sink;
|
||||
}
|
||||
|
||||
/** Returns the Severity level of messages this Stream reports. */
|
||||
Severity
|
||||
[[nodiscard]] Severity
|
||||
level() const
|
||||
{
|
||||
return m_level;
|
||||
@@ -219,7 +221,7 @@ public:
|
||||
|
||||
/** Returns `true` if sink logs anything at this stream's level. */
|
||||
/** @{ */
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
active() const
|
||||
{
|
||||
return m_sink.active(m_level);
|
||||
@@ -267,14 +269,14 @@ public:
|
||||
}
|
||||
|
||||
/** Returns the Sink associated with this Journal. */
|
||||
Sink&
|
||||
[[nodiscard]] Sink&
|
||||
sink() const
|
||||
{
|
||||
return *m_sink;
|
||||
}
|
||||
|
||||
/** Returns a stream for this sink, with the specified severity level. */
|
||||
Stream
|
||||
[[nodiscard]] Stream
|
||||
stream(Severity level) const
|
||||
{
|
||||
return Stream(*m_sink, level);
|
||||
@@ -284,7 +286,7 @@ public:
|
||||
For a message to be logged, the severity must be at or above the
|
||||
sink's severity threshold.
|
||||
*/
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
active(Severity level) const
|
||||
{
|
||||
return m_sink->active(level);
|
||||
@@ -292,37 +294,37 @@ public:
|
||||
|
||||
/** Severity stream access functions. */
|
||||
/** @{ */
|
||||
Stream
|
||||
[[nodiscard]] Stream
|
||||
trace() const
|
||||
{
|
||||
return {*m_sink, severities::kTrace};
|
||||
}
|
||||
|
||||
Stream
|
||||
[[nodiscard]] Stream
|
||||
debug() const
|
||||
{
|
||||
return {*m_sink, severities::kDebug};
|
||||
}
|
||||
|
||||
Stream
|
||||
[[nodiscard]] Stream
|
||||
info() const
|
||||
{
|
||||
return {*m_sink, severities::kInfo};
|
||||
}
|
||||
|
||||
Stream
|
||||
[[nodiscard]] Stream
|
||||
warn() const
|
||||
{
|
||||
return {*m_sink, severities::kWarning};
|
||||
}
|
||||
|
||||
Stream
|
||||
[[nodiscard]] Stream
|
||||
error() const
|
||||
{
|
||||
return {*m_sink, severities::kError};
|
||||
}
|
||||
|
||||
Stream
|
||||
[[nodiscard]] Stream
|
||||
fatal() const
|
||||
{
|
||||
return {*m_sink, severities::kFatal};
|
||||
|
||||
@@ -149,7 +149,7 @@ class PropertyStream::Item : public List<Item>::Node
|
||||
{
|
||||
public:
|
||||
explicit Item(Source* source);
|
||||
Source&
|
||||
[[nodiscard]] Source&
|
||||
source() const;
|
||||
Source*
|
||||
operator->() const;
|
||||
@@ -217,7 +217,7 @@ public:
|
||||
|
||||
PropertyStream&
|
||||
stream();
|
||||
PropertyStream const&
|
||||
[[nodiscard]] PropertyStream const&
|
||||
stream() const;
|
||||
|
||||
template <typename Value>
|
||||
@@ -287,7 +287,7 @@ public:
|
||||
|
||||
PropertyStream&
|
||||
stream();
|
||||
PropertyStream const&
|
||||
[[nodiscard]] PropertyStream const&
|
||||
stream() const;
|
||||
|
||||
template <typename Value>
|
||||
@@ -323,7 +323,7 @@ public:
|
||||
operator=(Source const&) = delete;
|
||||
|
||||
/** Returns the name of this source. */
|
||||
std::string const&
|
||||
[[nodiscard]] std::string const&
|
||||
name() const;
|
||||
|
||||
/** Add a child source. */
|
||||
|
||||
@@ -35,13 +35,13 @@ public:
|
||||
prefix_ = s;
|
||||
}
|
||||
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
active(beast::severities::Severity level) const override
|
||||
{
|
||||
return sink_.active(level);
|
||||
}
|
||||
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
console() const override
|
||||
{
|
||||
return sink_.console();
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
sink_.console(output);
|
||||
}
|
||||
|
||||
beast::severities::Severity
|
||||
[[nodiscard]] beast::severities::Severity
|
||||
threshold() const override
|
||||
{
|
||||
return sink_.threshold();
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
}
|
||||
|
||||
/// Get the native path for the temporary directory
|
||||
std::string
|
||||
[[nodiscard]] std::string
|
||||
path() const
|
||||
{
|
||||
return path_.string();
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
|
||||
The file does not need to exist.
|
||||
*/
|
||||
std::string
|
||||
[[nodiscard]] std::string
|
||||
file(std::string const& name) const
|
||||
{
|
||||
return (path_ / name).string();
|
||||
|
||||
@@ -41,15 +41,15 @@ public:
|
||||
with respect to other conditions of the
|
||||
same type.
|
||||
*/
|
||||
virtual Buffer
|
||||
[[nodiscard]] virtual Buffer
|
||||
fingerprint() const = 0;
|
||||
|
||||
/** Returns the type of this condition. */
|
||||
virtual Type
|
||||
[[nodiscard]] virtual Type
|
||||
type() const = 0;
|
||||
|
||||
/** Validates a fulfillment. */
|
||||
virtual bool
|
||||
[[nodiscard]] virtual bool
|
||||
validate(Slice data) const = 0;
|
||||
|
||||
/** Calculates the cost associated with this fulfillment. *
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
type and properties of the condition and the fulfillment
|
||||
that the condition is generated from.
|
||||
*/
|
||||
virtual std::uint32_t
|
||||
[[nodiscard]] virtual std::uint32_t
|
||||
cost() const = 0;
|
||||
|
||||
/** Returns the condition associated with the given fulfillment.
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
will, if compliant, produce the identical condition for the
|
||||
same fulfillment.
|
||||
*/
|
||||
virtual Condition
|
||||
[[nodiscard]] virtual Condition
|
||||
condition() const = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -90,13 +90,13 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
Type
|
||||
[[nodiscard]] Type
|
||||
type() const override
|
||||
{
|
||||
return Type::preimageSha256;
|
||||
}
|
||||
|
||||
Buffer
|
||||
[[nodiscard]] Buffer
|
||||
fingerprint() const override
|
||||
{
|
||||
sha256_hasher h;
|
||||
@@ -105,19 +105,19 @@ public:
|
||||
return {d.data(), d.size()};
|
||||
}
|
||||
|
||||
std::uint32_t
|
||||
[[nodiscard]] std::uint32_t
|
||||
cost() const override
|
||||
{
|
||||
return static_cast<std::uint32_t>(payload_.size());
|
||||
}
|
||||
|
||||
Condition
|
||||
[[nodiscard]] Condition
|
||||
condition() const override
|
||||
{
|
||||
return {type(), cost(), fingerprint()};
|
||||
}
|
||||
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
validate(Slice) const override
|
||||
{
|
||||
// Perhaps counterintuitively, the message isn't
|
||||
|
||||
@@ -56,7 +56,7 @@ private:
|
||||
// a lock. This removes a small timing window that occurs if the
|
||||
// waiting thread is handling a spurious wakeup when closureCount_
|
||||
// drops to zero.
|
||||
std::lock_guard const lock{mutex_};
|
||||
std::scoped_lock const lock{mutex_};
|
||||
|
||||
// Update closureCount_. Notify if stopping and closureCount_ == 0.
|
||||
if ((--closureCount_ == 0) && waitForClosures_)
|
||||
@@ -170,7 +170,7 @@ public:
|
||||
{
|
||||
std::optional<Substitute<Closure>> ret;
|
||||
|
||||
std::lock_guard const lock{mutex_};
|
||||
std::scoped_lock const lock{mutex_};
|
||||
if (!waitForClosures_)
|
||||
ret.emplace(*this, std::forward<Closure>(closure));
|
||||
|
||||
@@ -193,7 +193,7 @@ public:
|
||||
bool
|
||||
joined() const
|
||||
{
|
||||
std::lock_guard const lock{mutex_};
|
||||
std::scoped_lock const lock{mutex_};
|
||||
return waitForClosures_;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -34,7 +34,7 @@ inline void
|
||||
JobQueue::Coro::yield() const
|
||||
{
|
||||
{
|
||||
std::lock_guard lock(jq_.m_mutex);
|
||||
std::scoped_lock lock(jq_.m_mutex);
|
||||
++jq_.nSuspend_;
|
||||
}
|
||||
(*yield_)();
|
||||
@@ -44,7 +44,7 @@ inline bool
|
||||
JobQueue::Coro::post()
|
||||
{
|
||||
{
|
||||
std::lock_guard lk(mutex_run_);
|
||||
std::scoped_lock lk(mutex_run_);
|
||||
running_ = true;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ JobQueue::Coro::post()
|
||||
}
|
||||
|
||||
// The coroutine will not run. Clean up running_.
|
||||
std::lock_guard lk(mutex_run_);
|
||||
std::scoped_lock lk(mutex_run_);
|
||||
running_ = false;
|
||||
cv_.notify_all();
|
||||
return false;
|
||||
@@ -65,16 +65,16 @@ inline void
|
||||
JobQueue::Coro::resume()
|
||||
{
|
||||
{
|
||||
std::lock_guard lk(mutex_run_);
|
||||
std::scoped_lock lk(mutex_run_);
|
||||
running_ = true;
|
||||
}
|
||||
{
|
||||
std::lock_guard lk(jq_.m_mutex);
|
||||
std::scoped_lock lk(jq_.m_mutex);
|
||||
--jq_.nSuspend_;
|
||||
}
|
||||
auto saved = detail::getLocalValues().release();
|
||||
detail::getLocalValues().reset(&lvs_);
|
||||
std::lock_guard lock(mutex_);
|
||||
std::scoped_lock lock(mutex_);
|
||||
// A late resume() can arrive after the coroutine has already completed.
|
||||
// This is an expected (if rare) outcome of the race condition documented
|
||||
// in JobQueue.h:354-377 where post() schedules a resume job before the
|
||||
@@ -89,7 +89,7 @@ JobQueue::Coro::resume()
|
||||
}
|
||||
detail::getLocalValues().release();
|
||||
detail::getLocalValues().reset(saved);
|
||||
std::lock_guard lk(mutex_run_);
|
||||
std::scoped_lock lk(mutex_run_);
|
||||
running_ = false;
|
||||
cv_.notify_all();
|
||||
}
|
||||
@@ -113,7 +113,7 @@ JobQueue::Coro::expectEarlyExit()
|
||||
//
|
||||
// That said, since we're outside the Coro's stack, we need to
|
||||
// decrement the nSuspend that the Coro's call to yield caused.
|
||||
std::lock_guard lock(jq_.m_mutex);
|
||||
std::scoped_lock lock(jq_.m_mutex);
|
||||
--jq_.nSuspend_;
|
||||
#ifndef NDEBUG
|
||||
finished_ = true;
|
||||
|
||||
@@ -118,7 +118,7 @@ private:
|
||||
peers_.insert(peer);
|
||||
}
|
||||
|
||||
HashRouterFlags
|
||||
[[nodiscard]] HashRouterFlags
|
||||
getFlags(void) const
|
||||
{
|
||||
return flags_;
|
||||
@@ -138,7 +138,7 @@ private:
|
||||
}
|
||||
|
||||
/** Return seated relay time point if the message has been relayed */
|
||||
std::optional<Stopwatch::time_point>
|
||||
[[nodiscard]] std::optional<Stopwatch::time_point>
|
||||
relayed() const
|
||||
{
|
||||
return relayed_;
|
||||
|
||||
@@ -11,6 +11,8 @@ namespace xrpl {
|
||||
// Note that this queue should only be used for CPU-bound jobs
|
||||
// It is primarily intended for signature checking
|
||||
|
||||
// Protocol-wide
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
|
||||
enum JobType {
|
||||
// Special type indicating an invalid job - will go away soon.
|
||||
jtINVALID = -1,
|
||||
@@ -98,11 +100,11 @@ public:
|
||||
LoadMonitor& lm,
|
||||
std::function<void()> const& job);
|
||||
|
||||
JobType
|
||||
[[nodiscard]] JobType
|
||||
getType() const;
|
||||
|
||||
/** Returns the time when the job was queued. */
|
||||
clock_type::time_point const&
|
||||
[[nodiscard]] clock_type::time_point const&
|
||||
queue_time() const;
|
||||
|
||||
void
|
||||
|
||||
@@ -7,8 +7,13 @@
|
||||
#include <xrpl/core/detail/Workers.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
// Include only the specific Boost.Coroutine2 headers actually used here.
|
||||
// Avoid `boost/coroutine2/all.hpp` because it transitively pulls in
|
||||
// `boost/context/pooled_fixedsize_stack.hpp`, whose `.malloc()` / `.free()`
|
||||
// member calls on `boost::pool` collide with MSVC's `_CRTDBG_MAP_ALLOC` macros
|
||||
// in Debug builds (see cmake/XrplCompiler.cmake).
|
||||
#include <boost/context/protected_fixedsize_stack.hpp>
|
||||
#include <boost/coroutine2/all.hpp>
|
||||
#include <boost/coroutine2/coroutine.hpp>
|
||||
|
||||
#include <set>
|
||||
|
||||
|
||||
@@ -54,13 +54,13 @@ public:
|
||||
JobTypeData&
|
||||
operator=(JobTypeData const& other) = delete;
|
||||
|
||||
std::string
|
||||
[[nodiscard]] std::string
|
||||
name() const
|
||||
{
|
||||
return info.name();
|
||||
}
|
||||
|
||||
JobType
|
||||
[[nodiscard]] JobType
|
||||
type() const
|
||||
{
|
||||
return info.type();
|
||||
|
||||
@@ -40,37 +40,37 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
JobType
|
||||
[[nodiscard]] JobType
|
||||
type() const
|
||||
{
|
||||
return m_type;
|
||||
}
|
||||
|
||||
std::string const&
|
||||
[[nodiscard]] std::string const&
|
||||
name() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
int
|
||||
[[nodiscard]] int
|
||||
limit() const
|
||||
{
|
||||
return m_limit;
|
||||
}
|
||||
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
special() const
|
||||
{
|
||||
return m_limit == 0;
|
||||
}
|
||||
|
||||
std::chrono::milliseconds
|
||||
[[nodiscard]] std::chrono::milliseconds
|
||||
getAverageLatency() const
|
||||
{
|
||||
return m_avgLatency;
|
||||
}
|
||||
|
||||
std::chrono::milliseconds
|
||||
[[nodiscard]] std::chrono::milliseconds
|
||||
getPeakLatency() const
|
||||
{
|
||||
return m_peakLatency;
|
||||
|
||||
@@ -113,7 +113,7 @@ public:
|
||||
return instance().get(jt).name();
|
||||
}
|
||||
|
||||
JobTypeInfo const&
|
||||
[[nodiscard]] JobTypeInfo const&
|
||||
get(JobType jt) const
|
||||
{
|
||||
Map::const_iterator const iter(m_map.find(jt));
|
||||
@@ -125,37 +125,37 @@ public:
|
||||
return m_unknown;
|
||||
}
|
||||
|
||||
JobTypeInfo const&
|
||||
[[nodiscard]] JobTypeInfo const&
|
||||
getInvalid() const
|
||||
{
|
||||
return m_unknown;
|
||||
}
|
||||
|
||||
Map::size_type
|
||||
[[nodiscard]] Map::size_type
|
||||
size() const
|
||||
{
|
||||
return m_map.size();
|
||||
}
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
begin() const
|
||||
{
|
||||
return m_map.cbegin();
|
||||
}
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
cbegin() const
|
||||
{
|
||||
return m_map.cbegin();
|
||||
}
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
end() const
|
||||
{
|
||||
return m_map.cend();
|
||||
}
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
cend() const
|
||||
{
|
||||
return m_map.cend();
|
||||
|
||||
@@ -21,15 +21,15 @@ public:
|
||||
|
||||
~LoadEvent();
|
||||
|
||||
std::string const&
|
||||
[[nodiscard]] std::string const&
|
||||
name() const;
|
||||
|
||||
// The time spent waiting.
|
||||
std::chrono::steady_clock::duration
|
||||
[[nodiscard]] std::chrono::steady_clock::duration
|
||||
waitTime() const;
|
||||
|
||||
// The time spent running.
|
||||
std::chrono::steady_clock::duration
|
||||
[[nodiscard]] std::chrono::steady_clock::duration
|
||||
runTime() const;
|
||||
|
||||
void
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
*
|
||||
* @return The network ID this server is configured for
|
||||
*/
|
||||
virtual std::uint32_t
|
||||
[[nodiscard]] virtual std::uint32_t
|
||||
getNetworkID() const noexcept = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ public:
|
||||
PublicKey nodeId;
|
||||
std::string description = {}; // NOLINT(readability-redundant-member-init)
|
||||
|
||||
auto
|
||||
[[nodiscard]] auto
|
||||
toJson() const -> Json::Value;
|
||||
|
||||
template <typename Hasher>
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
bool
|
||||
contains(PublicKey const& nodeId)
|
||||
{
|
||||
std::lock_guard const lock(this->mutex_);
|
||||
std::scoped_lock const lock(this->mutex_);
|
||||
return table_.contains({.nodeId = nodeId, .description = {}});
|
||||
}
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ public:
|
||||
*
|
||||
* @return Counters Json object
|
||||
*/
|
||||
virtual Json::Value
|
||||
[[nodiscard]] virtual Json::Value
|
||||
countersJson() const = 0;
|
||||
|
||||
/**
|
||||
@@ -129,7 +129,7 @@ public:
|
||||
*
|
||||
* @return Current executing jobs and RPC calls and durations
|
||||
*/
|
||||
virtual Json::Value
|
||||
[[nodiscard]] virtual Json::Value
|
||||
currentJson() const = 0;
|
||||
|
||||
/**
|
||||
|
||||
@@ -192,7 +192,7 @@ public:
|
||||
virtual OpenLedger&
|
||||
getOpenLedger() = 0;
|
||||
|
||||
virtual OpenLedger const&
|
||||
[[nodiscard]] virtual OpenLedger const&
|
||||
getOpenLedger() const = 0;
|
||||
|
||||
// Transaction and operation services
|
||||
@@ -219,7 +219,7 @@ public:
|
||||
getPerfLog() = 0;
|
||||
|
||||
// Configuration and state
|
||||
virtual bool
|
||||
[[nodiscard]] virtual bool
|
||||
isStopping() const = 0;
|
||||
|
||||
virtual beast::Journal
|
||||
@@ -231,7 +231,7 @@ public:
|
||||
virtual Logs&
|
||||
getLogs() = 0;
|
||||
|
||||
virtual std::optional<uint256> const&
|
||||
[[nodiscard]] virtual std::optional<uint256> const&
|
||||
getTrapTxID() const = 0;
|
||||
|
||||
/** Retrieve the "wallet database" */
|
||||
|
||||
@@ -106,7 +106,7 @@ public:
|
||||
|
||||
@note This function is not thread-safe.
|
||||
*/
|
||||
int
|
||||
[[nodiscard]] int
|
||||
getNumberOfThreads() const noexcept;
|
||||
|
||||
/** Set the desired number of threads.
|
||||
@@ -141,7 +141,7 @@ public:
|
||||
While this function is thread-safe, the value may not stay
|
||||
accurate for very long. It's mainly for diagnostic purposes.
|
||||
*/
|
||||
int
|
||||
[[nodiscard]] int
|
||||
numberOfCurrentlyRunningTasks() const noexcept;
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
void
|
||||
notify()
|
||||
{
|
||||
std::lock_guard const lock{m_mutex};
|
||||
std::scoped_lock const lock{m_mutex};
|
||||
++m_count;
|
||||
m_cond.notify_one();
|
||||
}
|
||||
@@ -76,7 +76,7 @@ public:
|
||||
bool
|
||||
try_wait()
|
||||
{
|
||||
std::lock_guard lock{m_mutex};
|
||||
std::scoped_lock lock{m_mutex};
|
||||
if (m_count == 0)
|
||||
return false;
|
||||
--m_count;
|
||||
|
||||
@@ -14,7 +14,7 @@ public:
|
||||
|
||||
public:
|
||||
JsonPropertyStream();
|
||||
Json::Value const&
|
||||
[[nodiscard]] Json::Value const&
|
||||
top() const;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace Json {
|
||||
class Writer
|
||||
{
|
||||
public:
|
||||
enum CollectionType { array, object };
|
||||
enum class CollectionType { array, object };
|
||||
|
||||
explicit Writer(Output const& output);
|
||||
Writer(Writer&&) noexcept;
|
||||
|
||||
@@ -64,12 +64,14 @@ public:
|
||||
* their location in the parsed document. An empty string is returned if no
|
||||
* error occurred during parsing.
|
||||
*/
|
||||
std::string
|
||||
[[nodiscard]] std::string
|
||||
getFormattedErrorMessages() const;
|
||||
|
||||
static constexpr unsigned nest_limit{25};
|
||||
|
||||
private:
|
||||
// 53 files, protocol-wide
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
|
||||
enum TokenType {
|
||||
tokenEndOfStream = 0,
|
||||
tokenObjectBegin,
|
||||
|
||||
@@ -15,6 +15,8 @@ namespace Json {
|
||||
|
||||
/** \brief Type of the value held by a Value object.
|
||||
*/
|
||||
// Used throughout JSON layer
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
|
||||
enum ValueType {
|
||||
nullValue = 0, ///< 'null' value
|
||||
intValue, ///< signed integer value
|
||||
@@ -53,7 +55,7 @@ public:
|
||||
return str_;
|
||||
}
|
||||
|
||||
constexpr char const*
|
||||
[[nodiscard]] constexpr char const*
|
||||
c_str() const
|
||||
{
|
||||
return str_;
|
||||
@@ -147,6 +149,8 @@ private:
|
||||
class CZString
|
||||
{
|
||||
public:
|
||||
// Stored as int field, implicit conversion
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
|
||||
enum DuplicationPolicy { noDuplication = 0, duplicate, duplicateOnCopy };
|
||||
CZString(int index);
|
||||
CZString(char const* cstr, DuplicationPolicy allocate);
|
||||
@@ -158,11 +162,11 @@ private:
|
||||
operator<(CZString const& other) const;
|
||||
bool
|
||||
operator==(CZString const& other) const;
|
||||
int
|
||||
[[nodiscard]] int
|
||||
index() const;
|
||||
char const*
|
||||
[[nodiscard]] char const*
|
||||
c_str() const;
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isStaticString() const;
|
||||
|
||||
private:
|
||||
@@ -223,60 +227,60 @@ public:
|
||||
void
|
||||
swap(Value& other) noexcept;
|
||||
|
||||
ValueType
|
||||
[[nodiscard]] ValueType
|
||||
type() const;
|
||||
|
||||
char const*
|
||||
[[nodiscard]] char const*
|
||||
asCString() const;
|
||||
/** Returns the unquoted string value. */
|
||||
std::string
|
||||
[[nodiscard]] std::string
|
||||
asString() const;
|
||||
Int
|
||||
[[nodiscard]] Int
|
||||
asInt() const;
|
||||
UInt
|
||||
[[nodiscard]] UInt
|
||||
asUInt() const;
|
||||
double
|
||||
[[nodiscard]] double
|
||||
asDouble() const;
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
asBool() const;
|
||||
|
||||
/** Correct absolute value from int or unsigned int */
|
||||
UInt
|
||||
[[nodiscard]] UInt
|
||||
asAbsUInt() const;
|
||||
|
||||
// TODO: What is the "empty()" method this docstring mentions?
|
||||
/** isNull() tests to see if this field is null. Don't use this method to
|
||||
test for emptiness: use empty(). */
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isNull() const;
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isBool() const;
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isInt() const;
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isUInt() const;
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isIntegral() const;
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isDouble() const;
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isNumeric() const;
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isString() const;
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isArray() const;
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isArrayOrNull() const;
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isObject() const;
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isObjectOrNull() const;
|
||||
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isConvertibleTo(ValueType other) const;
|
||||
|
||||
/// Number of values in array or object
|
||||
UInt
|
||||
[[nodiscard]] UInt
|
||||
size() const;
|
||||
|
||||
/** Returns false if this is an empty array, empty object, empty string,
|
||||
@@ -304,10 +308,10 @@ public:
|
||||
operator[](UInt index) const;
|
||||
/// If the array contains at least index+1 elements, returns the element
|
||||
/// value, otherwise returns defaultValue.
|
||||
Value
|
||||
[[nodiscard]] Value
|
||||
get(UInt index, Value const& defaultValue) const;
|
||||
/// Return true if index < size().
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isValidIndex(UInt index) const;
|
||||
/// \brief Append value to array at the end.
|
||||
///
|
||||
@@ -355,7 +359,7 @@ public:
|
||||
Value
|
||||
get(char const* key, Value const& defaultValue) const;
|
||||
/// Return the member named key if it exist, defaultValue otherwise.
|
||||
Value
|
||||
[[nodiscard]] Value
|
||||
get(std::string const& key, Value const& defaultValue) const;
|
||||
|
||||
/// \brief Remove and return the named member.
|
||||
@@ -374,10 +378,10 @@ public:
|
||||
bool
|
||||
isMember(char const* key) const;
|
||||
/// Return true if the object has a member named key.
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isMember(std::string const& key) const;
|
||||
/// Return true if the object has a member named key.
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isMember(StaticString const& key) const;
|
||||
|
||||
/// \brief Return a list of the member names.
|
||||
@@ -385,15 +389,15 @@ public:
|
||||
/// If null, return an empty list.
|
||||
/// \pre type() is objectValue or nullValue
|
||||
/// \post if type() was nullValue, it remains nullValue
|
||||
Members
|
||||
[[nodiscard]] Members
|
||||
getMemberNames() const;
|
||||
|
||||
std::string
|
||||
[[nodiscard]] std::string
|
||||
toStyledString() const;
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
begin() const;
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
end() const;
|
||||
|
||||
iterator
|
||||
@@ -471,6 +475,8 @@ operator>=(Value const& x, Value const& y)
|
||||
class ValueAllocator
|
||||
{
|
||||
public:
|
||||
// Need to be named before converting
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
|
||||
enum { unknown = (unsigned)-1 };
|
||||
|
||||
virtual ~ValueAllocator() = default;
|
||||
@@ -513,20 +519,20 @@ public:
|
||||
|
||||
/// Return either the index or the member name of the referenced value as a
|
||||
/// Value.
|
||||
Value
|
||||
[[nodiscard]] Value
|
||||
key() const;
|
||||
|
||||
/// Return the index of the referenced Value. -1 if it is not an arrayValue.
|
||||
UInt
|
||||
[[nodiscard]] UInt
|
||||
index() const;
|
||||
|
||||
/// Return the member name of the referenced Value. "" if it is not an
|
||||
/// objectValue.
|
||||
char const*
|
||||
[[nodiscard]] char const*
|
||||
memberName() const;
|
||||
|
||||
protected:
|
||||
Value&
|
||||
[[nodiscard]] Value&
|
||||
deref() const;
|
||||
|
||||
void
|
||||
@@ -535,10 +541,10 @@ protected:
|
||||
void
|
||||
decrement();
|
||||
|
||||
difference_type
|
||||
[[nodiscard]] difference_type
|
||||
computeDistance(SelfType const& other) const;
|
||||
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isEqual(SelfType const& other) const;
|
||||
|
||||
void
|
||||
|
||||
@@ -30,47 +30,47 @@ public:
|
||||
std::shared_ptr<STTx const> const&,
|
||||
std::shared_ptr<STObject const> const&);
|
||||
|
||||
std::shared_ptr<STTx const> const&
|
||||
[[nodiscard]] std::shared_ptr<STTx const> const&
|
||||
getTxn() const
|
||||
{
|
||||
return mTxn;
|
||||
}
|
||||
TxMeta const&
|
||||
[[nodiscard]] TxMeta const&
|
||||
getMeta() const
|
||||
{
|
||||
return mMeta;
|
||||
}
|
||||
|
||||
boost::container::flat_set<AccountID> const&
|
||||
[[nodiscard]] boost::container::flat_set<AccountID> const&
|
||||
getAffected() const
|
||||
{
|
||||
return mAffected;
|
||||
}
|
||||
|
||||
TxID
|
||||
[[nodiscard]] TxID
|
||||
getTransactionID() const
|
||||
{
|
||||
return mTxn->getTransactionID();
|
||||
}
|
||||
TxType
|
||||
[[nodiscard]] TxType
|
||||
getTxnType() const
|
||||
{
|
||||
return mTxn->getTxnType();
|
||||
}
|
||||
TER
|
||||
[[nodiscard]] TER
|
||||
getResult() const
|
||||
{
|
||||
return mMeta.getResultTER();
|
||||
}
|
||||
std::uint32_t
|
||||
[[nodiscard]] std::uint32_t
|
||||
getTxnSeq() const
|
||||
{
|
||||
return mMeta.getIndex();
|
||||
}
|
||||
std::string
|
||||
[[nodiscard]] std::string
|
||||
getEscMeta() const;
|
||||
|
||||
Json::Value const&
|
||||
[[nodiscard]] Json::Value const&
|
||||
getJson() const
|
||||
{
|
||||
return mJson;
|
||||
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
|
||||
virtual ~AmendmentTable() = default;
|
||||
|
||||
virtual uint256
|
||||
[[nodiscard]] virtual uint256
|
||||
find(std::string const& name) const = 0;
|
||||
|
||||
virtual bool
|
||||
@@ -47,9 +47,9 @@ public:
|
||||
virtual bool
|
||||
enable(uint256 const& amendment) = 0;
|
||||
|
||||
virtual bool
|
||||
[[nodiscard]] virtual bool
|
||||
isEnabled(uint256 const& amendment) const = 0;
|
||||
virtual bool
|
||||
[[nodiscard]] virtual bool
|
||||
isSupported(uint256 const& amendment) const = 0;
|
||||
|
||||
/**
|
||||
@@ -58,17 +58,17 @@ public:
|
||||
*
|
||||
* @return true if an unsupported feature is enabled on the network
|
||||
*/
|
||||
virtual bool
|
||||
[[nodiscard]] virtual bool
|
||||
hasUnsupportedEnabled() const = 0;
|
||||
|
||||
virtual std::optional<NetClock::time_point>
|
||||
[[nodiscard]] virtual std::optional<NetClock::time_point>
|
||||
firstUnsupportedExpected() const = 0;
|
||||
|
||||
virtual Json::Value
|
||||
[[nodiscard]] virtual Json::Value
|
||||
getJson(bool isAdmin) const = 0;
|
||||
|
||||
/** Returns a Json::objectValue. */
|
||||
virtual Json::Value
|
||||
[[nodiscard]] virtual Json::Value
|
||||
getJson(uint256 const& amendment, bool isAdmin) const = 0;
|
||||
|
||||
/** Called when a new fully-validated ledger is accepted. */
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
/** Called to determine whether the amendment logic needs to process
|
||||
a new validated ledger. (If it could have changed things.)
|
||||
*/
|
||||
virtual bool
|
||||
[[nodiscard]] virtual bool
|
||||
needValidatedLedger(LedgerIndex seq) const = 0;
|
||||
|
||||
virtual void
|
||||
@@ -112,14 +112,14 @@ public:
|
||||
|
||||
// Called by the consensus code when we need to
|
||||
// add feature entries to a validation
|
||||
virtual std::vector<uint256>
|
||||
[[nodiscard]] virtual std::vector<uint256>
|
||||
doValidation(std::set<uint256> const& enabled) const = 0;
|
||||
|
||||
// The set of amendments to enable in the genesis ledger
|
||||
// This will return all known, non-vetoed amendments.
|
||||
// If we ever have two amendments that should not both be
|
||||
// enabled at the same time, we should ensure one is vetoed.
|
||||
virtual std::vector<uint256>
|
||||
[[nodiscard]] virtual std::vector<uint256>
|
||||
getDesired() const = 0;
|
||||
|
||||
// The function below adapts the API callers expect to the
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
// Bitwise flag enum with existing operator overloads
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
|
||||
enum ApplyFlags : std::uint32_t {
|
||||
tapNONE = 0x00,
|
||||
|
||||
@@ -134,7 +136,7 @@ public:
|
||||
while transactions applied to the consensus
|
||||
ledger produce hard failures (and claim a fee).
|
||||
*/
|
||||
virtual ApplyFlags
|
||||
[[nodiscard]] virtual ApplyFlags
|
||||
flags() const = 0;
|
||||
|
||||
/** Prepare to modify the SLE associated with key.
|
||||
|
||||
@@ -22,10 +22,10 @@ public:
|
||||
|
||||
BookDirs(ReadView const&, Book const&);
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
begin() const;
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
end() const;
|
||||
};
|
||||
|
||||
|
||||
@@ -59,13 +59,13 @@ private:
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
uint256 const&
|
||||
[[nodiscard]] uint256 const&
|
||||
getAccount() const
|
||||
{
|
||||
return account_;
|
||||
}
|
||||
|
||||
uint256 const&
|
||||
[[nodiscard]] uint256 const&
|
||||
getTXID() const
|
||||
{
|
||||
return txId_;
|
||||
@@ -118,30 +118,30 @@ public:
|
||||
return map_.erase(it);
|
||||
}
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
begin() const
|
||||
{
|
||||
return map_.begin();
|
||||
}
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
end() const
|
||||
{
|
||||
return map_.end();
|
||||
}
|
||||
|
||||
size_t
|
||||
[[nodiscard]] size_t
|
||||
size() const
|
||||
{
|
||||
return map_.size();
|
||||
}
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
empty() const
|
||||
{
|
||||
return map_.empty();
|
||||
}
|
||||
|
||||
uint256 const&
|
||||
[[nodiscard]] uint256 const&
|
||||
key() const
|
||||
{
|
||||
return salt_;
|
||||
|
||||
@@ -31,10 +31,10 @@ public:
|
||||
|
||||
Dir(ReadView const&, Keylet const&);
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
begin() const;
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
end() const;
|
||||
};
|
||||
|
||||
|
||||
@@ -21,9 +21,8 @@ private:
|
||||
struct ValueIOU
|
||||
{
|
||||
explicit ValueIOU() = default;
|
||||
|
||||
STAmount lowAcctCredits;
|
||||
STAmount highAcctCredits;
|
||||
STAmount lowAcctDebits;
|
||||
STAmount highAcctDebits;
|
||||
STAmount lowAcctOrigBalance;
|
||||
};
|
||||
|
||||
@@ -75,10 +74,10 @@ public:
|
||||
|
||||
// Get the adjustments for the balance between main and other.
|
||||
// Returns the debits, credits and the original balance
|
||||
std::optional<AdjustmentIOU>
|
||||
[[nodiscard]] std::optional<AdjustmentIOU>
|
||||
adjustmentsIOU(AccountID const& main, AccountID const& other, Currency const& currency) const;
|
||||
|
||||
std::optional<AdjustmentMPT>
|
||||
[[nodiscard]] std::optional<AdjustmentMPT>
|
||||
adjustmentsMPT(MPTID const& mptID) const;
|
||||
|
||||
void
|
||||
@@ -105,7 +104,7 @@ public:
|
||||
// Get the adjusted owner count. Since DeferredCredits is meant to be used
|
||||
// in payments, and payments only decrease owner counts, return the max
|
||||
// remembered owner count.
|
||||
std::optional<std::uint32_t>
|
||||
[[nodiscard]] std::optional<std::uint32_t>
|
||||
ownerCount(AccountID const& id) const;
|
||||
|
||||
void
|
||||
@@ -180,15 +179,15 @@ public:
|
||||
}
|
||||
/** @} */
|
||||
|
||||
STAmount
|
||||
[[nodiscard]] STAmount
|
||||
balanceHookIOU(AccountID const& account, AccountID const& issuer, STAmount const& amount)
|
||||
const override;
|
||||
|
||||
STAmount
|
||||
[[nodiscard]] STAmount
|
||||
balanceHookMPT(AccountID const& account, MPTIssue const& issue, std::int64_t amount)
|
||||
const override;
|
||||
|
||||
STAmount
|
||||
[[nodiscard]] STAmount
|
||||
balanceHookSelfIssueMPT(MPTIssue const& issue, std::int64_t amount) const override;
|
||||
|
||||
void
|
||||
@@ -213,7 +212,7 @@ public:
|
||||
void
|
||||
adjustOwnerCountHook(AccountID const& account, std::uint32_t cur, std::uint32_t next) override;
|
||||
|
||||
std::uint32_t
|
||||
[[nodiscard]] std::uint32_t
|
||||
ownerCountHook(AccountID const& account, std::uint32_t count) const override;
|
||||
|
||||
/** Apply changes to base view.
|
||||
@@ -230,14 +229,7 @@ public:
|
||||
apply(PaymentSandbox& to);
|
||||
/** @} */
|
||||
|
||||
// Return a map of balance changes on trust lines. The low account is the
|
||||
// first account in the key. If the two accounts are equal, the map contains
|
||||
// the total changes in currency regardless of issuer. This is useful to get
|
||||
// the total change in XRP balances.
|
||||
std::map<std::tuple<AccountID, AccountID, Currency>, STAmount>
|
||||
balanceChanges(ReadView const& view) const;
|
||||
|
||||
XRPAmount
|
||||
[[nodiscard]] XRPAmount
|
||||
xrpDestroyed() const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
bool
|
||||
startWork(LedgerIndex seq)
|
||||
{
|
||||
std::lock_guard const lock(mutex_);
|
||||
std::scoped_lock const lock(mutex_);
|
||||
|
||||
auto it = map_.find(seq);
|
||||
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
void
|
||||
finishWork(LedgerIndex seq)
|
||||
{
|
||||
std::lock_guard const lock(mutex_);
|
||||
std::scoped_lock const lock(mutex_);
|
||||
|
||||
map_.erase(seq);
|
||||
await_.notify_all();
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
bool
|
||||
pending(LedgerIndex seq)
|
||||
{
|
||||
std::lock_guard const lock(mutex_);
|
||||
std::scoped_lock const lock(mutex_);
|
||||
return map_.contains(seq);
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ public:
|
||||
std::map<LedgerIndex, bool>
|
||||
getSnapshot() const
|
||||
{
|
||||
std::lock_guard const lock(mutex_);
|
||||
std::scoped_lock const lock(mutex_);
|
||||
|
||||
return map_;
|
||||
}
|
||||
|
||||
@@ -39,22 +39,22 @@ public:
|
||||
struct sles_type : detail::ReadViewFwdRange<std::shared_ptr<SLE const>>
|
||||
{
|
||||
explicit sles_type(ReadView const& view);
|
||||
iterator
|
||||
[[nodiscard]] iterator
|
||||
begin() const;
|
||||
iterator
|
||||
[[nodiscard]] iterator
|
||||
end() const;
|
||||
iterator
|
||||
[[nodiscard]] iterator
|
||||
upper_bound(key_type const& key) const;
|
||||
};
|
||||
|
||||
struct txs_type : detail::ReadViewFwdRange<tx_type>
|
||||
{
|
||||
explicit txs_type(ReadView const& view);
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
empty() const;
|
||||
iterator
|
||||
[[nodiscard]] iterator
|
||||
begin() const;
|
||||
iterator
|
||||
[[nodiscard]] iterator
|
||||
end() const;
|
||||
};
|
||||
|
||||
@@ -78,33 +78,33 @@ public:
|
||||
}
|
||||
|
||||
/** Returns information about the ledger. */
|
||||
virtual LedgerHeader const&
|
||||
[[nodiscard]] virtual LedgerHeader const&
|
||||
header() const = 0;
|
||||
|
||||
/** Returns true if this reflects an open ledger. */
|
||||
virtual bool
|
||||
[[nodiscard]] virtual bool
|
||||
open() const = 0;
|
||||
|
||||
/** Returns the close time of the previous ledger. */
|
||||
NetClock::time_point
|
||||
[[nodiscard]] NetClock::time_point
|
||||
parentCloseTime() const
|
||||
{
|
||||
return header().parentCloseTime;
|
||||
}
|
||||
|
||||
/** Returns the sequence number of the base ledger. */
|
||||
LedgerIndex
|
||||
[[nodiscard]] LedgerIndex
|
||||
seq() const
|
||||
{
|
||||
return header().seq;
|
||||
}
|
||||
|
||||
/** Returns the fees for the base ledger. */
|
||||
virtual Fees const&
|
||||
[[nodiscard]] virtual Fees const&
|
||||
fees() const = 0;
|
||||
|
||||
/** Returns the tx processing rules. */
|
||||
virtual Rules const&
|
||||
[[nodiscard]] virtual Rules const&
|
||||
rules() const = 0;
|
||||
|
||||
/** Determine if a state item exists.
|
||||
@@ -114,7 +114,7 @@ public:
|
||||
@return `true` if a SLE is associated with the
|
||||
specified key.
|
||||
*/
|
||||
virtual bool
|
||||
[[nodiscard]] virtual bool
|
||||
exists(Keylet const& k) const = 0;
|
||||
|
||||
/** Return the key of the next state item.
|
||||
@@ -127,7 +127,7 @@ public:
|
||||
the key returned would be outside the open
|
||||
interval (key, last).
|
||||
*/
|
||||
virtual std::optional<key_type>
|
||||
[[nodiscard]] virtual std::optional<key_type>
|
||||
succ(key_type const& key, std::optional<key_type> const& last = std::nullopt) const = 0;
|
||||
|
||||
/** Return the state item associated with a key.
|
||||
@@ -143,7 +143,7 @@ public:
|
||||
@return `nullptr` if the key is not present or
|
||||
if the type does not match.
|
||||
*/
|
||||
virtual std::shared_ptr<SLE const>
|
||||
[[nodiscard]] virtual std::shared_ptr<SLE const>
|
||||
read(Keylet const& k) const = 0;
|
||||
|
||||
// Accounts in a payment are not allowed to use assets acquired during that
|
||||
@@ -151,7 +151,7 @@ public:
|
||||
// changes that accounts make during a payment. `balanceHookIOU` adjusts
|
||||
// balances so newly acquired assets are not counted toward the balance.
|
||||
// This is required to support PaymentSandbox.
|
||||
virtual STAmount
|
||||
[[nodiscard]] virtual STAmount
|
||||
balanceHookIOU(AccountID const& account, AccountID const& issuer, STAmount const& amount) const
|
||||
{
|
||||
XRPL_ASSERT(amount.holds<Issue>(), "balanceHookIOU: amount is for Issue");
|
||||
@@ -161,7 +161,7 @@ public:
|
||||
|
||||
// balanceHookMPT adjusts balances so newly acquired assets are not counted
|
||||
// toward the balance.
|
||||
virtual STAmount
|
||||
[[nodiscard]] virtual STAmount
|
||||
balanceHookMPT(AccountID const& account, MPTIssue const& issue, std::int64_t amount) const
|
||||
{
|
||||
return STAmount{issue, amount};
|
||||
@@ -171,7 +171,7 @@ public:
|
||||
// funds available to issue, which are originally available funds less
|
||||
// already self sold MPT amounts (MPT sell offer). This hook is used
|
||||
// by issuerFundsToSelfIssue() function.
|
||||
virtual STAmount
|
||||
[[nodiscard]] virtual STAmount
|
||||
balanceHookSelfIssueMPT(MPTIssue const& issue, std::int64_t amount) const
|
||||
{
|
||||
return STAmount{issue, amount};
|
||||
@@ -182,30 +182,30 @@ public:
|
||||
// changes that accounts make during a payment. `ownerCountHook` adjusts the
|
||||
// ownerCount so it returns the max value of the ownerCount so far.
|
||||
// This is required to support PaymentSandbox.
|
||||
virtual std::uint32_t
|
||||
[[nodiscard]] virtual std::uint32_t
|
||||
ownerCountHook(AccountID const& account, std::uint32_t count) const
|
||||
{
|
||||
return count;
|
||||
}
|
||||
|
||||
// used by the implementation
|
||||
virtual std::unique_ptr<sles_type::iter_base>
|
||||
[[nodiscard]] virtual std::unique_ptr<sles_type::iter_base>
|
||||
slesBegin() const = 0;
|
||||
|
||||
// used by the implementation
|
||||
virtual std::unique_ptr<sles_type::iter_base>
|
||||
[[nodiscard]] virtual std::unique_ptr<sles_type::iter_base>
|
||||
slesEnd() const = 0;
|
||||
|
||||
// used by the implementation
|
||||
virtual std::unique_ptr<sles_type::iter_base>
|
||||
[[nodiscard]] virtual std::unique_ptr<sles_type::iter_base>
|
||||
slesUpperBound(key_type const& key) const = 0;
|
||||
|
||||
// used by the implementation
|
||||
virtual std::unique_ptr<txs_type::iter_base>
|
||||
[[nodiscard]] virtual std::unique_ptr<txs_type::iter_base>
|
||||
txsBegin() const = 0;
|
||||
|
||||
// used by the implementation
|
||||
virtual std::unique_ptr<txs_type::iter_base>
|
||||
[[nodiscard]] virtual std::unique_ptr<txs_type::iter_base>
|
||||
txsEnd() const = 0;
|
||||
|
||||
/** Returns `true` if a tx exists in the tx map.
|
||||
@@ -213,7 +213,7 @@ public:
|
||||
A tx exists in the map if it is part of the
|
||||
base ledger, or if it is a newly inserted tx.
|
||||
*/
|
||||
virtual bool
|
||||
[[nodiscard]] virtual bool
|
||||
txExists(key_type const& key) const = 0;
|
||||
|
||||
/** Read a transaction from the tx map.
|
||||
@@ -224,7 +224,7 @@ public:
|
||||
@return A pair of nullptr if the
|
||||
key is not found in the tx map.
|
||||
*/
|
||||
virtual tx_type
|
||||
[[nodiscard]] virtual tx_type
|
||||
txRead(key_type const& key) const = 0;
|
||||
|
||||
//
|
||||
@@ -257,7 +257,7 @@ public:
|
||||
|
||||
@return std::nullopt if the item does not exist.
|
||||
*/
|
||||
virtual std::optional<digest_type>
|
||||
[[nodiscard]] virtual std::optional<digest_type>
|
||||
digest(key_type const& key) const = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -54,19 +54,19 @@ public:
|
||||
bool isDryRun,
|
||||
beast::Journal j);
|
||||
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
exists(ReadView const& base, Keylet const& k) const;
|
||||
|
||||
std::optional<key_type>
|
||||
[[nodiscard]] std::optional<key_type>
|
||||
succ(ReadView const& base, key_type const& key, std::optional<key_type> const& last) const;
|
||||
|
||||
std::shared_ptr<SLE const>
|
||||
[[nodiscard]] std::shared_ptr<SLE const>
|
||||
read(ReadView const& base, Keylet const& k) const;
|
||||
|
||||
std::shared_ptr<SLE>
|
||||
peek(ReadView const& base, Keylet const& k);
|
||||
|
||||
std::size_t
|
||||
[[nodiscard]] std::size_t
|
||||
size() const;
|
||||
|
||||
void
|
||||
@@ -97,7 +97,7 @@ public:
|
||||
destroyXRP(XRPAmount const& fee);
|
||||
|
||||
// For debugging
|
||||
XRPAmount const&
|
||||
[[nodiscard]] XRPAmount const&
|
||||
dropsDestroyed() const
|
||||
{
|
||||
return dropsDestroyed_;
|
||||
|
||||
@@ -22,51 +22,51 @@ public:
|
||||
ApplyViewBase(ReadView const* base, ApplyFlags flags);
|
||||
|
||||
// ReadView
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
open() const override;
|
||||
|
||||
LedgerHeader const&
|
||||
[[nodiscard]] LedgerHeader const&
|
||||
header() const override;
|
||||
|
||||
Fees const&
|
||||
[[nodiscard]] Fees const&
|
||||
fees() const override;
|
||||
|
||||
Rules const&
|
||||
[[nodiscard]] Rules const&
|
||||
rules() const override;
|
||||
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
exists(Keylet const& k) const override;
|
||||
|
||||
std::optional<key_type>
|
||||
[[nodiscard]] std::optional<key_type>
|
||||
succ(key_type const& key, std::optional<key_type> const& last = std::nullopt) const override;
|
||||
|
||||
std::shared_ptr<SLE const>
|
||||
[[nodiscard]] std::shared_ptr<SLE const>
|
||||
read(Keylet const& k) const override;
|
||||
|
||||
std::unique_ptr<sles_type::iter_base>
|
||||
[[nodiscard]] std::unique_ptr<sles_type::iter_base>
|
||||
slesBegin() const override;
|
||||
|
||||
std::unique_ptr<sles_type::iter_base>
|
||||
[[nodiscard]] std::unique_ptr<sles_type::iter_base>
|
||||
slesEnd() const override;
|
||||
|
||||
std::unique_ptr<sles_type::iter_base>
|
||||
[[nodiscard]] std::unique_ptr<sles_type::iter_base>
|
||||
slesUpperBound(uint256 const& key) const override;
|
||||
|
||||
std::unique_ptr<txs_type::iter_base>
|
||||
[[nodiscard]] std::unique_ptr<txs_type::iter_base>
|
||||
txsBegin() const override;
|
||||
|
||||
std::unique_ptr<txs_type::iter_base>
|
||||
[[nodiscard]] std::unique_ptr<txs_type::iter_base>
|
||||
txsEnd() const override;
|
||||
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
txExists(key_type const& key) const override;
|
||||
|
||||
tx_type
|
||||
[[nodiscard]] tx_type
|
||||
txRead(key_type const& key) const override;
|
||||
|
||||
// ApplyView
|
||||
|
||||
ApplyFlags
|
||||
[[nodiscard]] ApplyFlags
|
||||
flags() const override;
|
||||
|
||||
std::shared_ptr<SLE>
|
||||
|
||||
@@ -42,10 +42,10 @@ public:
|
||||
void
|
||||
apply(RawView& to) const;
|
||||
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
exists(ReadView const& base, Keylet const& k) const;
|
||||
|
||||
std::optional<key_type>
|
||||
[[nodiscard]] std::optional<key_type>
|
||||
succ(ReadView const& base, key_type const& key, std::optional<key_type> const& last) const;
|
||||
|
||||
void
|
||||
@@ -57,19 +57,19 @@ public:
|
||||
void
|
||||
replace(std::shared_ptr<SLE> const& sle);
|
||||
|
||||
std::shared_ptr<SLE const>
|
||||
[[nodiscard]] std::shared_ptr<SLE const>
|
||||
read(ReadView const& base, Keylet const& k) const;
|
||||
|
||||
void
|
||||
destroyXRP(XRPAmount const& fee);
|
||||
|
||||
std::unique_ptr<ReadView::sles_type::iter_base>
|
||||
[[nodiscard]] std::unique_ptr<ReadView::sles_type::iter_base>
|
||||
slesBegin(ReadView const& base) const;
|
||||
|
||||
std::unique_ptr<ReadView::sles_type::iter_base>
|
||||
[[nodiscard]] std::unique_ptr<ReadView::sles_type::iter_base>
|
||||
slesEnd(ReadView const& base) const;
|
||||
|
||||
std::unique_ptr<ReadView::sles_type::iter_base>
|
||||
[[nodiscard]] std::unique_ptr<ReadView::sles_type::iter_base>
|
||||
slesUpperBound(ReadView const& base, uint256 const& key) const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -27,16 +27,16 @@ public:
|
||||
|
||||
virtual ~ReadViewFwdIter() = default;
|
||||
|
||||
virtual std::unique_ptr<ReadViewFwdIter>
|
||||
[[nodiscard]] virtual std::unique_ptr<ReadViewFwdIter>
|
||||
copy() const = 0;
|
||||
|
||||
virtual bool
|
||||
[[nodiscard]] virtual bool
|
||||
equal(ReadViewFwdIter const& impl) const = 0;
|
||||
|
||||
virtual void
|
||||
increment() = 0;
|
||||
|
||||
virtual value_type
|
||||
[[nodiscard]] virtual value_type
|
||||
dereference() const = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ reduceOffer(auto const& amount)
|
||||
static Number const reducedOfferPct(9999, -4);
|
||||
|
||||
// Make sure the result is always less than amount or zero.
|
||||
NumberRoundModeGuard const mg(Number::towards_zero);
|
||||
NumberRoundModeGuard const mg(Number::rounding_mode::towards_zero);
|
||||
return amount * reducedOfferPct;
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ getAMMOfferStartWithTakerGets(
|
||||
if (targetQuality.rate() == beast::zero)
|
||||
return std::nullopt;
|
||||
|
||||
NumberRoundModeGuard const mg(Number::to_nearest);
|
||||
NumberRoundModeGuard const mg(Number::rounding_mode::to_nearest);
|
||||
auto const f = feeMult(tfee);
|
||||
auto const a = 1;
|
||||
auto const b = pool.in * (1 - 1 / f) / targetQuality.rate() - 2 * pool.out;
|
||||
@@ -202,7 +202,7 @@ getAMMOfferStartWithTakerGets(
|
||||
// Round downward to minimize the offer and to maximize the quality.
|
||||
// This has the most impact when takerGets is XRP.
|
||||
auto const takerGets =
|
||||
toAmount<TOut>(getAsset(pool.out), nTakerGetsProposed, Number::downward);
|
||||
toAmount<TOut>(getAsset(pool.out), nTakerGetsProposed, Number::rounding_mode::downward);
|
||||
return TAmounts<TIn, TOut>{swapAssetOut(pool, takerGets, tfee), takerGets};
|
||||
};
|
||||
|
||||
@@ -247,7 +247,7 @@ getAMMOfferStartWithTakerPays(
|
||||
if (targetQuality.rate() == beast::zero)
|
||||
return std::nullopt;
|
||||
|
||||
NumberRoundModeGuard const mg(Number::to_nearest);
|
||||
NumberRoundModeGuard const mg(Number::rounding_mode::to_nearest);
|
||||
auto const f = feeMult(tfee);
|
||||
auto const& a = f;
|
||||
auto const b = pool.in * (1 + f);
|
||||
@@ -269,7 +269,7 @@ getAMMOfferStartWithTakerPays(
|
||||
// Round downward to minimize the offer and to maximize the quality.
|
||||
// This has the most impact when takerPays is XRP.
|
||||
auto const takerPays =
|
||||
toAmount<TIn>(getAsset(pool.in), nTakerPaysProposed, Number::downward);
|
||||
toAmount<TIn>(getAsset(pool.in), nTakerPaysProposed, Number::rounding_mode::downward);
|
||||
return TAmounts<TIn, TOut>{takerPays, swapAssetIn(pool, takerPays, tfee)};
|
||||
};
|
||||
|
||||
@@ -341,7 +341,8 @@ changeSpotPriceQuality(
|
||||
<< " " << to_string(pool.out) << " " << quality << " " << tfee;
|
||||
return std::nullopt;
|
||||
}
|
||||
auto const takerPays = toAmount<TIn>(getAsset(pool.in), nTakerPays, Number::upward);
|
||||
auto const takerPays =
|
||||
toAmount<TIn>(getAsset(pool.in), nTakerPays, Number::rounding_mode::upward);
|
||||
// should not fail
|
||||
if (auto amounts = TAmounts<TIn, TOut>{takerPays, swapAssetIn(pool, takerPays, tfee)};
|
||||
Quality{amounts} < quality &&
|
||||
@@ -447,32 +448,32 @@ swapAssetIn(TAmounts<TIn, TOut> const& pool, TIn const& assetIn, std::uint16_t t
|
||||
// fee
|
||||
saveNumberRoundMode const _{Number::getround()};
|
||||
|
||||
Number::setround(Number::upward);
|
||||
Number::setround(Number::rounding_mode::upward);
|
||||
auto const numerator = pool.in * pool.out;
|
||||
auto const fee = getFee(tfee);
|
||||
|
||||
Number::setround(Number::downward);
|
||||
Number::setround(Number::rounding_mode::downward);
|
||||
auto const denom = pool.in + assetIn * (1 - fee);
|
||||
|
||||
if (denom.signum() <= 0)
|
||||
return toAmount<TOut>(getAsset(pool.out), 0);
|
||||
|
||||
Number::setround(Number::upward);
|
||||
Number::setround(Number::rounding_mode::upward);
|
||||
auto const ratio = numerator / denom;
|
||||
|
||||
Number::setround(Number::downward);
|
||||
Number::setround(Number::rounding_mode::downward);
|
||||
auto const swapOut = pool.out - ratio;
|
||||
|
||||
if (swapOut.signum() < 0)
|
||||
return toAmount<TOut>(getAsset(pool.out), 0);
|
||||
|
||||
return toAmount<TOut>(getAsset(pool.out), swapOut, Number::downward);
|
||||
return toAmount<TOut>(getAsset(pool.out), swapOut, Number::rounding_mode::downward);
|
||||
}
|
||||
|
||||
return toAmount<TOut>(
|
||||
getAsset(pool.out),
|
||||
pool.out - (pool.in * pool.out) / (pool.in + assetIn * feeMult(tfee)),
|
||||
Number::downward);
|
||||
Number::rounding_mode::downward);
|
||||
}
|
||||
|
||||
/** Swap assetOut out of the pool and swap in a proportional amount
|
||||
@@ -509,36 +510,36 @@ swapAssetOut(TAmounts<TIn, TOut> const& pool, TOut const& assetOut, std::uint16_
|
||||
|
||||
saveNumberRoundMode const _{Number::getround()};
|
||||
|
||||
Number::setround(Number::upward);
|
||||
Number::setround(Number::rounding_mode::upward);
|
||||
auto const numerator = pool.in * pool.out;
|
||||
|
||||
Number::setround(Number::downward);
|
||||
Number::setround(Number::rounding_mode::downward);
|
||||
auto const denom = pool.out - assetOut;
|
||||
if (denom.signum() <= 0)
|
||||
{
|
||||
return toMaxAmount<TIn>(getAsset(pool.in));
|
||||
}
|
||||
|
||||
Number::setround(Number::upward);
|
||||
Number::setround(Number::rounding_mode::upward);
|
||||
auto const ratio = numerator / denom;
|
||||
auto const numerator2 = ratio - pool.in;
|
||||
auto const fee = getFee(tfee);
|
||||
|
||||
Number::setround(Number::downward);
|
||||
Number::setround(Number::rounding_mode::downward);
|
||||
auto const feeMult = 1 - fee;
|
||||
|
||||
Number::setround(Number::upward);
|
||||
Number::setround(Number::rounding_mode::upward);
|
||||
auto const swapIn = numerator2 / feeMult;
|
||||
if (swapIn.signum() < 0)
|
||||
return toAmount<TIn>(getAsset(pool.in), 0);
|
||||
|
||||
return toAmount<TIn>(getAsset(pool.in), swapIn, Number::upward);
|
||||
return toAmount<TIn>(getAsset(pool.in), swapIn, Number::rounding_mode::upward);
|
||||
}
|
||||
|
||||
return toAmount<TIn>(
|
||||
getAsset(pool.in),
|
||||
((pool.in * pool.out) / (pool.out - assetOut) - pool.in) / feeMult(tfee),
|
||||
Number::upward);
|
||||
Number::rounding_mode::upward);
|
||||
}
|
||||
|
||||
/** Return square of n.
|
||||
@@ -597,7 +598,8 @@ getLPTokenRounding(IsDeposit isDeposit)
|
||||
{
|
||||
// Minimize on deposit, maximize on withdraw to ensure
|
||||
// AMM invariant sqrt(poolAsset1 * poolAsset2) >= LPTokensBalance
|
||||
return isDeposit == IsDeposit::Yes ? Number::downward : Number::upward;
|
||||
return isDeposit == IsDeposit::Yes ? Number::rounding_mode::downward
|
||||
: Number::rounding_mode::upward;
|
||||
}
|
||||
|
||||
inline Number::rounding_mode
|
||||
@@ -605,7 +607,8 @@ getAssetRounding(IsDeposit isDeposit)
|
||||
{
|
||||
// Maximize on deposit, minimize on withdraw to ensure
|
||||
// AMM invariant sqrt(poolAsset1 * poolAsset2) >= LPTokensBalance
|
||||
return isDeposit == IsDeposit::Yes ? Number::upward : Number::downward;
|
||||
return isDeposit == IsDeposit::Yes ? Number::rounding_mode::upward
|
||||
: Number::rounding_mode::downward;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include <xrpl/ledger/View.h>
|
||||
#include <xrpl/protocol/Rules.h>
|
||||
#include <xrpl/protocol/st.h>
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
struct PreflightContext;
|
||||
|
||||
// Lending protocol has dependencies, so capture them here.
|
||||
bool
|
||||
checkLendingProtocolDependencies(PreflightContext const& ctx);
|
||||
checkLendingProtocolDependencies(Rules const& rules, STTx const& tx);
|
||||
|
||||
static constexpr std::uint32_t secondsInYear = 365 * 24 * 60 * 60;
|
||||
|
||||
@@ -20,7 +19,7 @@ loanPeriodicRate(TenthBips32 interestRate, std::uint32_t paymentInterval);
|
||||
inline Number
|
||||
roundPeriodicPayment(Asset const& asset, Number const& periodicPayment, std::int32_t scale)
|
||||
{
|
||||
return roundToAsset(asset, periodicPayment, scale, Number::upward);
|
||||
return roundToAsset(asset, periodicPayment, scale, Number::rounding_mode::upward);
|
||||
}
|
||||
|
||||
/* Represents the breakdown of amounts to be paid and changes applied to the
|
||||
@@ -105,7 +104,7 @@ struct LoanState
|
||||
Number managementFeeDue;
|
||||
|
||||
// Interest still due to be paid by the borrower.
|
||||
Number
|
||||
[[nodiscard]] Number
|
||||
interestOutstanding() const
|
||||
{
|
||||
XRPL_ASSERT_PARTS(
|
||||
@@ -267,7 +266,7 @@ struct PaymentComponents
|
||||
//
|
||||
// @return The amount of tracked interest included in this payment that
|
||||
// will be paid to the vault.
|
||||
Number
|
||||
[[nodiscard]] Number
|
||||
trackedInterestPart() const;
|
||||
};
|
||||
|
||||
@@ -341,7 +340,7 @@ struct LoanStateDeltas
|
||||
/* Calculates the total change across all components.
|
||||
* @return The sum of principal, interest, and management fee deltas.
|
||||
*/
|
||||
Number
|
||||
[[nodiscard]] Number
|
||||
total() const
|
||||
{
|
||||
return principal + interest + managementFee;
|
||||
@@ -21,13 +21,13 @@ namespace xrpl {
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** Controls the treatment of frozen account balances */
|
||||
enum FreezeHandling { fhIGNORE_FREEZE, fhZERO_IF_FROZEN };
|
||||
enum class FreezeHandling { fhIGNORE_FREEZE, fhZERO_IF_FROZEN };
|
||||
|
||||
/** Controls the treatment of unauthorized MPT balances */
|
||||
enum AuthHandling { ahIGNORE_AUTH, ahZERO_IF_UNAUTHORIZED };
|
||||
enum class AuthHandling { ahIGNORE_AUTH, ahZERO_IF_UNAUTHORIZED };
|
||||
|
||||
/** Controls whether to include the account's full spendable balance */
|
||||
enum SpendableHandling { shSIMPLE_BALANCE, shFULL_BALANCE };
|
||||
enum class SpendableHandling { shSIMPLE_BALANCE, shFULL_BALANCE };
|
||||
|
||||
enum class WaiveTransferFee : bool { No = false, Yes };
|
||||
|
||||
@@ -135,7 +135,7 @@ accountHolds(
|
||||
AccountID const& issuer,
|
||||
FreezeHandling zeroIfFrozen,
|
||||
beast::Journal j,
|
||||
SpendableHandling includeFullBalance = shSIMPLE_BALANCE);
|
||||
SpendableHandling includeFullBalance = SpendableHandling::shSIMPLE_BALANCE);
|
||||
|
||||
[[nodiscard]] STAmount
|
||||
accountHolds(
|
||||
@@ -144,7 +144,7 @@ accountHolds(
|
||||
Issue const& issue,
|
||||
FreezeHandling zeroIfFrozen,
|
||||
beast::Journal j,
|
||||
SpendableHandling includeFullBalance = shSIMPLE_BALANCE);
|
||||
SpendableHandling includeFullBalance = SpendableHandling::shSIMPLE_BALANCE);
|
||||
|
||||
[[nodiscard]] STAmount
|
||||
accountHolds(
|
||||
@@ -154,7 +154,7 @@ accountHolds(
|
||||
FreezeHandling zeroIfFrozen,
|
||||
AuthHandling zeroIfUnauthorized,
|
||||
beast::Journal j,
|
||||
SpendableHandling includeFullBalance = shSIMPLE_BALANCE);
|
||||
SpendableHandling includeFullBalance = SpendableHandling::shSIMPLE_BALANCE);
|
||||
|
||||
[[nodiscard]] STAmount
|
||||
accountHolds(
|
||||
@@ -164,7 +164,7 @@ accountHolds(
|
||||
FreezeHandling zeroIfFrozen,
|
||||
AuthHandling zeroIfUnauthorized,
|
||||
beast::Journal j,
|
||||
SpendableHandling includeFullBalance = shSIMPLE_BALANCE);
|
||||
SpendableHandling includeFullBalance = SpendableHandling::shSIMPLE_BALANCE);
|
||||
|
||||
// Returns the amount an account can spend of the currency type saDefault, or
|
||||
// returns saDefault if this account is the issuer of the currency in
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isSecure() const
|
||||
{
|
||||
return mSecure;
|
||||
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
return ssl_context_;
|
||||
}
|
||||
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
sslVerify() const
|
||||
{
|
||||
return verify_;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user