From 6c1a92fe935a226a0fcea10778bae88cb74726c3 Mon Sep 17 00:00:00 2001 From: Jingchen Date: Tue, 3 Feb 2026 19:08:27 +0000 Subject: [PATCH 01/61] refactor: Add ServiceRegistry to help modularization (#6222) Currently we're passing the `Application` object around, whereby the `Application` class acts more like a service registry that gives other classes access to other services. In order to allow modularization, we should replace `Application` with a service registry class so that modules depending on `Application` for other services can be moved easily. This change adds the `ServiceRegistry` class. --- .../scripts/levelization/results/ordering.txt | 1 + include/xrpl/core/ServiceRegistry.h | 202 ++++++++++++++++++ src/xrpld/app/main/Application.h | 83 +------ 3 files changed, 205 insertions(+), 81 deletions(-) create mode 100644 include/xrpl/core/ServiceRegistry.h diff --git a/.github/scripts/levelization/results/ordering.txt b/.github/scripts/levelization/results/ordering.txt index 8d17e1167f..88a3441fa1 100644 --- a/.github/scripts/levelization/results/ordering.txt +++ b/.github/scripts/levelization/results/ordering.txt @@ -153,6 +153,7 @@ tests.libxrpl > xrpl.json tests.libxrpl > xrpl.net xrpl.core > xrpl.basics xrpl.core > xrpl.json +xrpl.core > xrpl.ledger xrpl.json > xrpl.basics xrpl.ledger > xrpl.basics xrpl.ledger > xrpl.protocol diff --git a/include/xrpl/core/ServiceRegistry.h b/include/xrpl/core/ServiceRegistry.h new file mode 100644 index 0000000000..a70d96292c --- /dev/null +++ b/include/xrpl/core/ServiceRegistry.h @@ -0,0 +1,202 @@ +#ifndef XRPL_CORE_SERVICEREGISTRY_H_INCLUDED +#define XRPL_CORE_SERVICEREGISTRY_H_INCLUDED + +#include +#include +#include +#include + +namespace xrpl { + +// Forward declarations +namespace NodeStore { +class Database; +} +namespace Resource { +class Manager; +} +namespace perf { +class PerfLog; +} + +class AcceptedLedger; +class AmendmentTable; +class Cluster; +class CollectorManager; +class DatabaseCon; +class Family; +class HashRouter; +class InboundLedgers; +class InboundTransactions; +class JobQueue; +class LedgerCleaner; +class LedgerMaster; +class LedgerReplayer; +class LoadFeeTrack; +class LoadManager; +class ManifestCache; +class NetworkOPs; +class OpenLedger; +class OrderBookDB; +class Overlay; +class PathRequests; +class PeerReservationTable; +class PendingSaves; +class RelationalDatabase; +class ServerHandler; +class SHAMapStore; +class TimeKeeper; +class TransactionMaster; +class TxQ; +class ValidatorList; +class ValidatorSite; + +template +class Validations; +class RCLValidationsAdaptor; +using RCLValidations = Validations; + +using NodeCache = TaggedCache; + +/** Service registry for dependency injection. + + This abstract interface provides access to various services and components + used throughout the application. It separates the service locator pattern + from the Application lifecycle management. + + Components that need access to services can hold a reference to + ServiceRegistry rather than Application when they only need service + access and not lifecycle management. + +*/ +class ServiceRegistry +{ +public: + ServiceRegistry() = default; + virtual ~ServiceRegistry() = default; + + // Core infrastructure services + virtual CollectorManager& + getCollectorManager() = 0; + + virtual Family& + getNodeFamily() = 0; + + virtual TimeKeeper& + timeKeeper() = 0; + + virtual JobQueue& + getJobQueue() = 0; + + virtual NodeCache& + getTempNodeCache() = 0; + + virtual CachedSLEs& + cachedSLEs() = 0; + + // Protocol and validation services + virtual AmendmentTable& + getAmendmentTable() = 0; + + virtual HashRouter& + getHashRouter() = 0; + + virtual LoadFeeTrack& + getFeeTrack() = 0; + + virtual LoadManager& + getLoadManager() = 0; + + virtual RCLValidations& + getValidations() = 0; + + virtual ValidatorList& + validators() = 0; + + virtual ValidatorSite& + validatorSites() = 0; + + virtual ManifestCache& + validatorManifests() = 0; + + virtual ManifestCache& + publisherManifests() = 0; + + // Network services + virtual Overlay& + overlay() = 0; + + virtual Cluster& + cluster() = 0; + + virtual PeerReservationTable& + peerReservations() = 0; + + virtual Resource::Manager& + getResourceManager() = 0; + + // Storage services + virtual NodeStore::Database& + getNodeStore() = 0; + + virtual SHAMapStore& + getSHAMapStore() = 0; + + virtual RelationalDatabase& + getRelationalDatabase() = 0; + + // Ledger services + virtual InboundLedgers& + getInboundLedgers() = 0; + + virtual InboundTransactions& + getInboundTransactions() = 0; + + virtual TaggedCache& + getAcceptedLedgerCache() = 0; + + virtual LedgerMaster& + getLedgerMaster() = 0; + + virtual LedgerCleaner& + getLedgerCleaner() = 0; + + virtual LedgerReplayer& + getLedgerReplayer() = 0; + + virtual PendingSaves& + pendingSaves() = 0; + + virtual OpenLedger& + openLedger() = 0; + + virtual OpenLedger const& + openLedger() const = 0; + + // Transaction and operation services + virtual NetworkOPs& + getOPs() = 0; + + virtual OrderBookDB& + getOrderBookDB() = 0; + + virtual TransactionMaster& + getMasterTransaction() = 0; + + virtual TxQ& + getTxQ() = 0; + + virtual PathRequests& + getPathRequests() = 0; + + // Server services + virtual ServerHandler& + getServerHandler() = 0; + + virtual perf::PerfLog& + getPerfLog() = 0; +}; + +} // namespace xrpl + +#endif diff --git a/src/xrpld/app/main/Application.h b/src/xrpld/app/main/Application.h index 07edd5f558..bb8bac8bbb 100644 --- a/src/xrpld/app/main/Application.h +++ b/src/xrpld/app/main/Application.h @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -91,7 +92,7 @@ class Validations; class RCLValidationsAdaptor; using RCLValidations = Validations; -class Application : public beast::PropertyStream::Source +class Application : public ServiceRegistry, public beast::PropertyStream::Source { public: /* VFALCO NOTE @@ -146,92 +147,12 @@ public: virtual boost::asio::io_context& getIOContext() = 0; - virtual CollectorManager& - getCollectorManager() = 0; - virtual Family& - getNodeFamily() = 0; - virtual TimeKeeper& - timeKeeper() = 0; - virtual JobQueue& - getJobQueue() = 0; - virtual NodeCache& - getTempNodeCache() = 0; - virtual CachedSLEs& - cachedSLEs() = 0; - virtual AmendmentTable& - getAmendmentTable() = 0; - virtual HashRouter& - getHashRouter() = 0; - virtual LoadFeeTrack& - getFeeTrack() = 0; - virtual LoadManager& - getLoadManager() = 0; - virtual Overlay& - overlay() = 0; - virtual TxQ& - getTxQ() = 0; - virtual ValidatorList& - validators() = 0; - virtual ValidatorSite& - validatorSites() = 0; - virtual ManifestCache& - validatorManifests() = 0; - virtual ManifestCache& - publisherManifests() = 0; - virtual Cluster& - cluster() = 0; - virtual PeerReservationTable& - peerReservations() = 0; - virtual RCLValidations& - getValidations() = 0; - virtual NodeStore::Database& - getNodeStore() = 0; - virtual InboundLedgers& - getInboundLedgers() = 0; - virtual InboundTransactions& - getInboundTransactions() = 0; - - virtual TaggedCache& - getAcceptedLedgerCache() = 0; - - virtual LedgerMaster& - getLedgerMaster() = 0; - virtual LedgerCleaner& - getLedgerCleaner() = 0; - virtual LedgerReplayer& - getLedgerReplayer() = 0; - virtual NetworkOPs& - getOPs() = 0; - virtual OrderBookDB& - getOrderBookDB() = 0; - virtual ServerHandler& - getServerHandler() = 0; - virtual TransactionMaster& - getMasterTransaction() = 0; - virtual perf::PerfLog& - getPerfLog() = 0; - virtual std::pair const& nodeIdentity() = 0; virtual std::optional getValidationPublicKey() const = 0; - virtual Resource::Manager& - getResourceManager() = 0; - virtual PathRequests& - getPathRequests() = 0; - virtual SHAMapStore& - getSHAMapStore() = 0; - virtual PendingSaves& - pendingSaves() = 0; - virtual OpenLedger& - openLedger() = 0; - virtual OpenLedger const& - openLedger() const = 0; - virtual RelationalDatabase& - getRelationalDatabase() = 0; - virtual std::chrono::milliseconds getIOLatency() = 0; From 3a172301cec7a43aa7b9b170508f0f0b5be66c19 Mon Sep 17 00:00:00 2001 From: Bart Date: Tue, 3 Feb 2026 17:55:22 -0500 Subject: [PATCH 02/61] chore: Remove unity builds (#6300) Unity builds were intended to speed up builds, by bundling multiple files into compilation units. However, now that ccache is available on all platforms, there is no need for unity builds anymore, as ccache stores compiled individual build objects for reuse. This change therefore removes the ability to make unity builds. --- .github/scripts/strategy-matrix/generate.py | 61 +++++++------------- .github/scripts/strategy-matrix/linux.json | 2 +- .github/scripts/strategy-matrix/macos.json | 5 +- .github/scripts/strategy-matrix/windows.json | 2 +- BUILD.md | 37 +++++++++--- cmake/XrplAddTest.cmake | 3 - cmake/XrplCore.cmake | 13 ----- cmake/XrplSettings.cmake | 8 --- conanfile.py | 3 - include/xrpl/basics/rocksdb.h | 4 +- src/libxrpl/net/RegisterSSLCerts.cpp | 3 +- 11 files changed, 58 insertions(+), 83 deletions(-) diff --git a/.github/scripts/strategy-matrix/generate.py b/.github/scripts/strategy-matrix/generate.py index 0e44b1be54..75847b4d9d 100755 --- a/.github/scripts/strategy-matrix/generate.py +++ b/.github/scripts/strategy-matrix/generate.py @@ -51,22 +51,20 @@ 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 and Unity on linux/amd64, set - # the reference fee to 500. - # - Bookworm using GCC 15: Debug and no Unity on linux/amd64, enable - # code coverage (which will be done below). - # - Bookworm using Clang 16: Debug and no Unity on linux/arm64, - # enable voidstar. - # - Bookworm using Clang 17: Release and no Unity on linux/amd64, - # set the reference fee to 1000. - # - Bookworm using Clang 20: Debug and Unity on linux/amd64. + # - 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 Clang 16: Debug on linux/arm64, enable voidstar. + # - Bookworm using Clang 17: Release on linux/amd64, set the + # reference fee to 1000. + # - Bookworm using Clang 20: Debug on linux/amd64. 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 "-Dunity=ON" in cmake_args and architecture["platform"] == "linux/amd64" ): cmake_args = f"-DUNIT_TEST_REFERENCE_FEE=500 {cmake_args}" @@ -74,14 +72,12 @@ def generate_strategy_matrix(all: bool, config: Config) -> list: if ( f"{os['compiler_name']}-{os['compiler_version']}" == "gcc-15" and build_type == "Debug" - and "-Dunity=OFF" in cmake_args and architecture["platform"] == "linux/amd64" ): skip = False if ( f"{os['compiler_name']}-{os['compiler_version']}" == "clang-16" and build_type == "Debug" - and "-Dunity=OFF" in cmake_args and architecture["platform"] == "linux/arm64" ): cmake_args = f"-Dvoidstar=ON {cmake_args}" @@ -89,7 +85,6 @@ def generate_strategy_matrix(all: bool, config: Config) -> list: if ( f"{os['compiler_name']}-{os['compiler_version']}" == "clang-17" and build_type == "Release" - and "-Dunity=ON" in cmake_args and architecture["platform"] == "linux/amd64" ): cmake_args = f"-DUNIT_TEST_REFERENCE_FEE=1000 {cmake_args}" @@ -97,7 +92,6 @@ def generate_strategy_matrix(all: bool, config: Config) -> list: if ( f"{os['compiler_name']}-{os['compiler_version']}" == "clang-20" and build_type == "Debug" - and "-Dunity=ON" in cmake_args and architecture["platform"] == "linux/amd64" ): skip = False @@ -105,15 +99,14 @@ def generate_strategy_matrix(all: bool, config: Config) -> list: continue # RHEL: - # - 9 using GCC 12: Debug and Unity on linux/amd64. - # - 10 using Clang: Release and no Unity on linux/amd64. + # - 9 using GCC 12: Debug on linux/amd64. + # - 10 using Clang: Release on linux/amd64. if os["distro_name"] == "rhel": skip = True if os["distro_version"] == "9": if ( f"{os['compiler_name']}-{os['compiler_version']}" == "gcc-12" and build_type == "Debug" - and "-Dunity=ON" in cmake_args and architecture["platform"] == "linux/amd64" ): skip = False @@ -121,7 +114,6 @@ def generate_strategy_matrix(all: bool, config: Config) -> list: if ( f"{os['compiler_name']}-{os['compiler_version']}" == "clang-any" and build_type == "Release" - and "-Dunity=OFF" in cmake_args and architecture["platform"] == "linux/amd64" ): skip = False @@ -129,17 +121,16 @@ def generate_strategy_matrix(all: bool, config: Config) -> list: continue # Ubuntu: - # - Jammy using GCC 12: Debug and no Unity on linux/arm64. - # - Noble using GCC 14: Release and Unity on linux/amd64. - # - Noble using Clang 18: Debug and no Unity on linux/amd64. - # - Noble using Clang 19: Release and Unity on linux/arm64. + # - Jammy using GCC 12: Debug on linux/arm64. + # - Noble using GCC 14: Release on linux/amd64. + # - Noble using Clang 18: Debug on linux/amd64. + # - Noble using Clang 19: Release on linux/arm64. if os["distro_name"] == "ubuntu": skip = True if os["distro_version"] == "jammy": if ( f"{os['compiler_name']}-{os['compiler_version']}" == "gcc-12" and build_type == "Debug" - and "-Dunity=OFF" in cmake_args and architecture["platform"] == "linux/arm64" ): skip = False @@ -147,21 +138,18 @@ def generate_strategy_matrix(all: bool, config: Config) -> list: if ( f"{os['compiler_name']}-{os['compiler_version']}" == "gcc-14" and build_type == "Release" - and "-Dunity=ON" in cmake_args and architecture["platform"] == "linux/amd64" ): skip = False if ( f"{os['compiler_name']}-{os['compiler_version']}" == "clang-18" and build_type == "Debug" - and "-Dunity=OFF" in cmake_args and architecture["platform"] == "linux/amd64" ): skip = False if ( f"{os['compiler_name']}-{os['compiler_version']}" == "clang-19" and build_type == "Release" - and "-Dunity=ON" in cmake_args and architecture["platform"] == "linux/arm64" ): skip = False @@ -169,20 +157,16 @@ def generate_strategy_matrix(all: bool, config: Config) -> list: continue # MacOS: - # - Debug and no Unity on macos/arm64. + # - Debug on macos/arm64. if os["distro_name"] == "macos" and not ( - build_type == "Debug" - and "-Dunity=OFF" in cmake_args - and architecture["platform"] == "macos/arm64" + build_type == "Debug" and architecture["platform"] == "macos/arm64" ): continue # Windows: - # - Release and Unity on windows/amd64. + # - Release on windows/amd64. if os["distro_name"] == "windows" and not ( - build_type == "Release" - and "-Dunity=ON" in cmake_args - and architecture["platform"] == "windows/amd64" + build_type == "Release" and architecture["platform"] == "windows/amd64" ): continue @@ -209,18 +193,17 @@ def generate_strategy_matrix(all: bool, config: Config) -> list: ): continue - # Enable code coverage for Debian Bookworm using GCC 15 in Debug and no - # Unity on linux/amd64 + # Enable code coverage for Debian Bookworm using GCC 15 in Debug on + # linux/amd64 if ( f"{os['compiler_name']}-{os['compiler_version']}" == "gcc-15" and build_type == "Debug" - and "-Dunity=OFF" in cmake_args and architecture["platform"] == "linux/amd64" ): cmake_args = f"-Dcoverage=ON -Dcoverage_format=xml -DCODE_COVERAGE_VERBOSE=ON -DCMAKE_C_FLAGS=-O0 -DCMAKE_CXX_FLAGS=-O0 {cmake_args}" # Generate a unique name for the configuration, e.g. macos-arm64-debug - # or debian-bookworm-gcc-12-amd64-release-unity. + # or debian-bookworm-gcc-12-amd64-release. config_name = os["distro_name"] if (n := os["distro_version"]) != "": config_name += f"-{n}" @@ -234,8 +217,6 @@ def generate_strategy_matrix(all: bool, config: Config) -> list: config_name += f"-{build_type.lower()}" if "-Dcoverage=ON" in cmake_args: config_name += "-coverage" - if "-Dunity=ON" in cmake_args: - config_name += "-unity" # 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 diff --git a/.github/scripts/strategy-matrix/linux.json b/.github/scripts/strategy-matrix/linux.json index e64a05f925..4943579be8 100644 --- a/.github/scripts/strategy-matrix/linux.json +++ b/.github/scripts/strategy-matrix/linux.json @@ -208,5 +208,5 @@ } ], "build_type": ["Debug", "Release"], - "cmake_args": ["-Dunity=OFF", "-Dunity=ON"] + "cmake_args": [""] } diff --git a/.github/scripts/strategy-matrix/macos.json b/.github/scripts/strategy-matrix/macos.json index 14b6089620..6fc44d0f80 100644 --- a/.github/scripts/strategy-matrix/macos.json +++ b/.github/scripts/strategy-matrix/macos.json @@ -15,8 +15,5 @@ } ], "build_type": ["Debug", "Release"], - "cmake_args": [ - "-Dunity=OFF -DCMAKE_POLICY_VERSION_MINIMUM=3.5", - "-Dunity=ON -DCMAKE_POLICY_VERSION_MINIMUM=3.5" - ] + "cmake_args": ["-DCMAKE_POLICY_VERSION_MINIMUM=3.5"] } diff --git a/.github/scripts/strategy-matrix/windows.json b/.github/scripts/strategy-matrix/windows.json index 8637b31012..8c536c70f2 100644 --- a/.github/scripts/strategy-matrix/windows.json +++ b/.github/scripts/strategy-matrix/windows.json @@ -15,5 +15,5 @@ } ], "build_type": ["Debug", "Release"], - "cmake_args": ["-Dunity=OFF", "-Dunity=ON"] + "cmake_args": [""] } diff --git a/BUILD.md b/BUILD.md index f90aa0c148..35668aeabd 100644 --- a/BUILD.md +++ b/BUILD.md @@ -368,6 +368,36 @@ The workaround for this error is to add two lines to your profile: tools.build:cxxflags=['-DBOOST_ASIO_DISABLE_CONCEPTS'] ``` +### Set Up Ccache + +To speed up repeated compilations, we recommend that you install +[ccache](https://ccache.dev), a tool that wraps your compiler so that it can +cache build objects locally. + +#### Linux + +You can install it using the package manager, e.g. `sudo apt install ccache` +(Ubuntu) or `sudo dnf install ccache` (RHEL). + +#### macOS + +You can install it using Homebrew, i.e. `brew install ccache`. + +#### Windows + +You can install it using Chocolatey, i.e. `choco install ccache`. If you already +have Ccache installed, then `choco upgrade ccache` will update it to the latest +version. However, if you see an error such as: + +``` +terminate called after throwing an instance of 'std::bad_alloc' + what(): std::bad_alloc +C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(617,5): error MSB6006: "cl.exe" exited with code 3. +``` + +then please install a specific version of Ccache that we know works, via: `choco +install ccache --version 4.11.3 --allow-downgrade`. + ### Build and Test 1. Create a build directory and move into it. @@ -545,16 +575,10 @@ See [Sanitizers docs](./docs/build/sanitizers.md) for more details. | `assert` | OFF | Enable assertions. | | `coverage` | OFF | Prepare the coverage report. | | `tests` | OFF | Build tests. | -| `unity` | OFF | Configure a unity build. | | `xrpld` | OFF | Build the xrpld application, and not just the libxrpl library. | | `werr` | OFF | Treat compilation warnings as errors | | `wextra` | OFF | Enable additional compilation warnings | -[Unity builds][5] may be faster for the first build -(at the cost of much more memory) since they concatenate sources into fewer -translation units. Non-unity builds may be faster for incremental builds, -and can be helpful for detecting `#include` omissions. - ## Troubleshooting ### Conan @@ -621,7 +645,6 @@ If you want to experiment with a new package, follow these steps: [1]: https://github.com/conan-io/conan-center-index/issues/13168 [2]: https://en.cppreference.com/w/cpp/compiler_support/20 [3]: https://docs.conan.io/en/latest/getting_started.html -[5]: https://en.wikipedia.org/wiki/Unity_build [6]: https://github.com/boostorg/beast/issues/2648 [7]: https://github.com/boostorg/beast/issues/2661 [gcovr]: https://gcovr.com/en/stable/getting-started.html diff --git a/cmake/XrplAddTest.cmake b/cmake/XrplAddTest.cmake index 135b975a02..35189e203f 100644 --- a/cmake/XrplAddTest.cmake +++ b/cmake/XrplAddTest.cmake @@ -9,8 +9,5 @@ function (xrpl_add_test name) isolate_headers(${target} "${CMAKE_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}/tests/${name}" PRIVATE) - # Make sure the test isn't optimized away in unity builds - set_target_properties(${target} PROPERTIES UNITY_BUILD_MODE GROUP UNITY_BUILD_BATCH_SIZE 0) # Adjust as needed - add_test(NAME ${target} COMMAND ${target}) endfunction () diff --git a/cmake/XrplCore.cmake b/cmake/XrplCore.cmake index 0651b8e0d8..afefa8457d 100644 --- a/cmake/XrplCore.cmake +++ b/cmake/XrplCore.cmake @@ -4,12 +4,7 @@ include(target_protobuf_sources) -# Protocol buffers cannot participate in a unity build, -# because all the generated sources -# define a bunch of `static const` variables with the same names, -# so we just build them as a separate library. add_library(xrpl.libpb) -set_target_properties(xrpl.libpb PROPERTIES UNITY_BUILD OFF) target_protobuf_sources(xrpl.libpb xrpl/proto LANGUAGE cpp IMPORT_DIRS include/xrpl/proto PROTOS include/xrpl/proto/xrpl.proto) @@ -160,12 +155,4 @@ if (xrpld) # antithesis_instrumentation.h, which is not exported as INTERFACE target_include_directories(xrpld PRIVATE ${CMAKE_SOURCE_DIR}/external/antithesis-sdk) endif () - - # any files that don't play well with unity should be added here - if (tests) - set_source_files_properties( - # these two seem to produce conflicts in beast teardown template methods - src/test/rpc/ValidatorRPC_test.cpp src/test/ledger/Invariants_test.cpp PROPERTIES SKIP_UNITY_BUILD_INCLUSION - TRUE) - endif () endif () diff --git a/cmake/XrplSettings.cmake b/cmake/XrplSettings.cmake index 6d332be19d..0957e41918 100644 --- a/cmake/XrplSettings.cmake +++ b/cmake/XrplSettings.cmake @@ -30,14 +30,6 @@ if (tests) endif () endif () -option(unity "Creates a build using UNITY support in cmake." OFF) -if (unity) - if (NOT is_ci) - set(CMAKE_UNITY_BUILD_BATCH_SIZE 15 CACHE STRING "") - endif () - set(CMAKE_UNITY_BUILD ON CACHE BOOL "Do a unity build") -endif () - if (is_clang AND is_linux) option(voidstar "Enable Antithesis instrumentation." OFF) endif () diff --git a/conanfile.py b/conanfile.py index a7a19405de..35a461cec7 100644 --- a/conanfile.py +++ b/conanfile.py @@ -23,7 +23,6 @@ class Xrpl(ConanFile): "shared": [True, False], "static": [True, False], "tests": [True, False], - "unity": [True, False], "xrpld": [True, False], } @@ -55,7 +54,6 @@ class Xrpl(ConanFile): "shared": False, "static": True, "tests": False, - "unity": False, "xrpld": False, "date/*:header_only": True, "ed25519/*:shared": False, @@ -168,7 +166,6 @@ class Xrpl(ConanFile): tc.variables["rocksdb"] = self.options.rocksdb tc.variables["BUILD_SHARED_LIBS"] = self.options.shared tc.variables["static"] = self.options.static - tc.variables["unity"] = self.options.unity tc.variables["xrpld"] = self.options.xrpld tc.generate() diff --git a/include/xrpl/basics/rocksdb.h b/include/xrpl/basics/rocksdb.h index b9b89677f9..59a69a9b44 100644 --- a/include/xrpl/basics/rocksdb.h +++ b/include/xrpl/basics/rocksdb.h @@ -1,5 +1,5 @@ -#ifndef XRPL_UNITY_ROCKSDB_H_INCLUDED -#define XRPL_UNITY_ROCKSDB_H_INCLUDED +#ifndef XRPL_BASICS_ROCKSDB_H_INCLUDED +#define XRPL_BASICS_ROCKSDB_H_INCLUDED #if XRPL_ROCKSDB_AVAILABLE // #include diff --git a/src/libxrpl/net/RegisterSSLCerts.cpp b/src/libxrpl/net/RegisterSSLCerts.cpp index a15472969e..1b97a17e5c 100644 --- a/src/libxrpl/net/RegisterSSLCerts.cpp +++ b/src/libxrpl/net/RegisterSSLCerts.cpp @@ -85,7 +85,8 @@ registerSSLCerts(boost::asio::ssl::context& ctx, boost::system::error_code& ec, // There is a very unpleasant interaction between and // openssl x509 types (namely the former has macros that stomp // on the latter), these undefs allow this TU to be safely used in -// unity builds without messing up subsequent TUs. +// unity builds without messing up subsequent TUs. Although we +// no longer use unity builds, leaving the undefs here does no harm. #if BOOST_OS_WINDOWS #undef X509_NAME #undef X509_EXTENSIONS From 34ef577604782ca8d6e1c17df8bd7470990a52ff Mon Sep 17 00:00:00 2001 From: Bart Date: Wed, 4 Feb 2026 09:50:21 -0500 Subject: [PATCH 03/61] refactor: Replace include guards by '#pragma once' (#6322) This change replaces all include guards in the `src/` and `include/` directories by `#pragma once`. --- .github/scripts/rename/include.sh | 30 ++++ .github/workflows/reusable-check-rename.yml | 2 + convert_include_guards.py | 139 ++++++++++++++++++ include/xrpl/basics/Archive.h | 5 +- include/xrpl/basics/BasicConfig.h | 5 +- include/xrpl/basics/Blob.h | 5 +- include/xrpl/basics/Buffer.h | 5 +- include/xrpl/basics/ByteUtilities.h | 5 +- include/xrpl/basics/CompressionAlgorithms.h | 5 +- include/xrpl/basics/CountedObject.h | 5 +- include/xrpl/basics/DecayingSample.h | 5 +- include/xrpl/basics/Expected.h | 5 +- include/xrpl/basics/FileUtilities.h | 5 +- include/xrpl/basics/IntrusivePointer.h | 4 +- include/xrpl/basics/IntrusivePointer.ipp | 4 +- include/xrpl/basics/IntrusiveRefCounts.h | 4 +- include/xrpl/basics/KeyCache.h | 5 +- include/xrpl/basics/LocalValue.h | 5 +- include/xrpl/basics/Log.h | 5 +- include/xrpl/basics/MathUtilities.h | 5 +- include/xrpl/basics/Number.h | 5 +- include/xrpl/basics/RangeSet.h | 5 +- include/xrpl/basics/Resolver.h | 5 +- include/xrpl/basics/ResolverAsio.h | 5 +- include/xrpl/basics/SHAMapHash.h | 5 +- include/xrpl/basics/SharedWeakCachePointer.h | 4 +- .../xrpl/basics/SharedWeakCachePointer.ipp | 4 +- include/xrpl/basics/SlabAllocator.h | 5 +- include/xrpl/basics/Slice.h | 5 +- include/xrpl/basics/StringUtilities.h | 5 +- include/xrpl/basics/TaggedCache.h | 5 +- include/xrpl/basics/TaggedCache.ipp | 5 +- include/xrpl/basics/ToString.h | 5 +- include/xrpl/basics/UnorderedContainers.h | 5 +- include/xrpl/basics/UptimeClock.h | 5 +- include/xrpl/basics/algorithm.h | 5 +- include/xrpl/basics/base64.h | 5 +- include/xrpl/basics/base_uint.h | 5 +- include/xrpl/basics/chrono.h | 5 +- include/xrpl/basics/comparators.h | 5 +- include/xrpl/basics/contract.h | 5 +- include/xrpl/basics/hardened_hash.h | 5 +- include/xrpl/basics/join.h | 5 +- include/xrpl/basics/make_SSLContext.h | 5 +- include/xrpl/basics/mulDiv.h | 5 +- .../xrpl/basics/partitioned_unordered_map.h | 5 +- include/xrpl/basics/random.h | 5 +- include/xrpl/basics/rocksdb.h | 5 +- include/xrpl/basics/safe_cast.h | 5 +- include/xrpl/basics/scope.h | 5 +- include/xrpl/basics/spinlock.h | 5 +- include/xrpl/basics/strHex.h | 5 +- include/xrpl/basics/tagged_integer.h | 4 +- include/xrpl/beast/asio/io_latency_probe.h | 5 +- include/xrpl/beast/clock/abstract_clock.h | 5 +- .../xrpl/beast/clock/basic_seconds_clock.h | 5 +- include/xrpl/beast/clock/manual_clock.h | 5 +- include/xrpl/beast/container/aged_container.h | 5 +- .../beast/container/aged_container_utility.h | 5 +- include/xrpl/beast/container/aged_map.h | 5 +- include/xrpl/beast/container/aged_multimap.h | 5 +- include/xrpl/beast/container/aged_multiset.h | 5 +- include/xrpl/beast/container/aged_set.h | 5 +- .../xrpl/beast/container/aged_unordered_map.h | 5 +- .../beast/container/aged_unordered_multimap.h | 5 +- .../beast/container/aged_unordered_multiset.h | 5 +- .../xrpl/beast/container/aged_unordered_set.h | 5 +- .../detail/aged_associative_container.h | 5 +- .../detail/aged_container_iterator.h | 5 +- .../container/detail/aged_ordered_container.h | 5 +- .../detail/aged_unordered_container.h | 5 +- .../detail/empty_base_optimization.h | 5 +- include/xrpl/beast/core/CurrentThreadName.h | 5 +- include/xrpl/beast/core/LexicalCast.h | 5 +- include/xrpl/beast/core/List.h | 5 +- include/xrpl/beast/core/LockFreeStack.h | 5 +- include/xrpl/beast/core/SemanticVersion.h | 5 +- include/xrpl/beast/hash/hash_append.h | 5 +- include/xrpl/beast/hash/uhash.h | 5 +- include/xrpl/beast/hash/xxhasher.h | 5 +- include/xrpl/beast/insight/Collector.h | 5 +- include/xrpl/beast/insight/Counter.h | 5 +- include/xrpl/beast/insight/CounterImpl.h | 5 +- include/xrpl/beast/insight/Event.h | 5 +- include/xrpl/beast/insight/EventImpl.h | 5 +- include/xrpl/beast/insight/Gauge.h | 5 +- include/xrpl/beast/insight/GaugeImpl.h | 5 +- include/xrpl/beast/insight/Group.h | 5 +- include/xrpl/beast/insight/Groups.h | 5 +- include/xrpl/beast/insight/Hook.h | 5 +- include/xrpl/beast/insight/HookImpl.h | 5 +- include/xrpl/beast/insight/Insight.h | 5 +- include/xrpl/beast/insight/Meter.h | 5 +- include/xrpl/beast/insight/MeterImpl.h | 5 +- include/xrpl/beast/insight/NullCollector.h | 5 +- include/xrpl/beast/insight/StatsDCollector.h | 5 +- include/xrpl/beast/net/IPAddress.h | 5 +- include/xrpl/beast/net/IPAddressConversion.h | 5 +- include/xrpl/beast/net/IPAddressV4.h | 5 +- include/xrpl/beast/net/IPAddressV6.h | 5 +- include/xrpl/beast/net/IPEndpoint.h | 5 +- include/xrpl/beast/rfc2616.h | 5 +- include/xrpl/beast/test/yield_to.h | 5 +- include/xrpl/beast/type_name.h | 5 +- include/xrpl/beast/unit_test.h | 5 +- include/xrpl/beast/unit_test/amount.h | 5 +- .../beast/unit_test/detail/const_container.h | 5 +- include/xrpl/beast/unit_test/global_suites.h | 5 +- include/xrpl/beast/unit_test/match.h | 5 +- include/xrpl/beast/unit_test/recorder.h | 5 +- include/xrpl/beast/unit_test/reporter.h | 5 +- include/xrpl/beast/unit_test/results.h | 5 +- include/xrpl/beast/unit_test/runner.h | 5 +- include/xrpl/beast/unit_test/suite.h | 5 +- include/xrpl/beast/unit_test/suite_info.h | 5 +- include/xrpl/beast/unit_test/suite_list.h | 5 +- include/xrpl/beast/unit_test/thread.h | 5 +- include/xrpl/beast/utility/Journal.h | 5 +- include/xrpl/beast/utility/PropertyStream.h | 5 +- include/xrpl/beast/utility/WrappedSink.h | 5 +- include/xrpl/beast/utility/Zero.h | 5 +- include/xrpl/beast/utility/instrumentation.h | 5 +- include/xrpl/beast/utility/maybe_const.h | 5 +- include/xrpl/beast/utility/rngfill.h | 5 +- include/xrpl/beast/utility/temp_dir.h | 5 +- include/xrpl/beast/xor_shift_engine.h | 5 +- include/xrpl/core/ClosureCounter.h | 5 +- include/xrpl/core/Coro.ipp | 5 +- include/xrpl/core/Job.h | 5 +- include/xrpl/core/JobQueue.h | 5 +- include/xrpl/core/JobTypeData.h | 5 +- include/xrpl/core/JobTypeInfo.h | 5 +- include/xrpl/core/JobTypes.h | 5 +- include/xrpl/core/LoadEvent.h | 5 +- include/xrpl/core/LoadMonitor.h | 5 +- include/xrpl/core/PerfLog.h | 5 +- include/xrpl/core/ServiceRegistry.h | 5 +- include/xrpl/core/detail/Workers.h | 5 +- include/xrpl/core/detail/semaphore.h | 5 +- include/xrpl/crypto/RFC1751.h | 5 +- include/xrpl/crypto/csprng.h | 5 +- include/xrpl/crypto/secure_erase.h | 5 +- include/xrpl/json/JsonPropertyStream.h | 5 +- include/xrpl/json/Output.h | 5 +- include/xrpl/json/Writer.h | 5 +- include/xrpl/json/detail/json_assert.h | 5 +- include/xrpl/json/json_errors.h | 5 +- include/xrpl/json/json_forwards.h | 5 +- include/xrpl/json/json_reader.h | 5 +- include/xrpl/json/json_value.h | 5 +- include/xrpl/json/json_writer.h | 5 +- include/xrpl/json/to_string.h | 5 +- include/xrpl/ledger/ApplyView.h | 5 +- include/xrpl/ledger/ApplyViewImpl.h | 5 +- include/xrpl/ledger/BookDirs.h | 5 +- include/xrpl/ledger/CachedSLEs.h | 5 +- include/xrpl/ledger/CachedView.h | 5 +- include/xrpl/ledger/CredentialHelpers.h | 5 +- include/xrpl/ledger/Credit.h | 5 +- include/xrpl/ledger/Dir.h | 5 +- include/xrpl/ledger/OpenView.h | 5 +- include/xrpl/ledger/PaymentSandbox.h | 5 +- include/xrpl/ledger/RawView.h | 5 +- include/xrpl/ledger/ReadView.h | 5 +- include/xrpl/ledger/Sandbox.h | 5 +- include/xrpl/ledger/View.h | 5 +- include/xrpl/ledger/detail/ApplyStateTable.h | 5 +- include/xrpl/ledger/detail/ApplyViewBase.h | 5 +- include/xrpl/ledger/detail/RawStateTable.h | 5 +- include/xrpl/ledger/detail/ReadViewFwdRange.h | 5 +- .../xrpl/ledger/detail/ReadViewFwdRange.ipp | 5 +- include/xrpl/net/AutoSocket.h | 5 +- include/xrpl/net/HTTPClient.h | 5 +- include/xrpl/net/HTTPClientSSLContext.h | 5 +- include/xrpl/net/RegisterSSLCerts.h | 5 +- include/xrpl/nodestore/Backend.h | 5 +- include/xrpl/nodestore/Database.h | 5 +- include/xrpl/nodestore/DatabaseRotating.h | 5 +- include/xrpl/nodestore/DummyScheduler.h | 5 +- include/xrpl/nodestore/Factory.h | 5 +- include/xrpl/nodestore/Manager.h | 5 +- include/xrpl/nodestore/NodeObject.h | 5 +- include/xrpl/nodestore/Scheduler.h | 5 +- include/xrpl/nodestore/Task.h | 5 +- include/xrpl/nodestore/Types.h | 5 +- include/xrpl/nodestore/detail/BatchWriter.h | 5 +- .../xrpl/nodestore/detail/DatabaseNodeImp.h | 5 +- .../nodestore/detail/DatabaseRotatingImp.h | 5 +- include/xrpl/nodestore/detail/DecodedBlob.h | 5 +- include/xrpl/nodestore/detail/EncodedBlob.h | 5 +- include/xrpl/nodestore/detail/ManagerImp.h | 5 +- include/xrpl/nodestore/detail/codec.h | 5 +- include/xrpl/nodestore/detail/varint.h | 5 +- include/xrpl/protocol/AMMCore.h | 5 +- include/xrpl/protocol/AccountID.h | 5 +- include/xrpl/protocol/AmountConversions.h | 5 +- include/xrpl/protocol/ApiVersion.h | 5 +- include/xrpl/protocol/Asset.h | 5 +- include/xrpl/protocol/Book.h | 5 +- include/xrpl/protocol/BuildInfo.h | 5 +- include/xrpl/protocol/ErrorCodes.h | 5 +- include/xrpl/protocol/Feature.h | 5 +- include/xrpl/protocol/Fees.h | 5 +- include/xrpl/protocol/HashPrefix.h | 5 +- include/xrpl/protocol/IOUAmount.h | 5 +- include/xrpl/protocol/Indexes.h | 5 +- include/xrpl/protocol/InnerObjectFormats.h | 5 +- include/xrpl/protocol/Issue.h | 5 +- include/xrpl/protocol/KeyType.h | 5 +- include/xrpl/protocol/Keylet.h | 5 +- include/xrpl/protocol/KnownFormats.h | 5 +- include/xrpl/protocol/LedgerFormats.h | 5 +- include/xrpl/protocol/LedgerHeader.h | 5 +- include/xrpl/protocol/MPTAmount.h | 5 +- include/xrpl/protocol/MPTIssue.h | 5 +- include/xrpl/protocol/MultiApiJson.h | 5 +- .../xrpl/protocol/NFTSyntheticSerializer.h | 5 +- include/xrpl/protocol/NFTokenID.h | 5 +- include/xrpl/protocol/NFTokenOfferID.h | 5 +- include/xrpl/protocol/PayChan.h | 5 +- include/xrpl/protocol/Permissions.h | 5 +- include/xrpl/protocol/Protocol.h | 5 +- include/xrpl/protocol/PublicKey.h | 5 +- include/xrpl/protocol/Quality.h | 5 +- include/xrpl/protocol/QualityFunction.h | 5 +- include/xrpl/protocol/RPCErr.h | 5 +- include/xrpl/protocol/Rate.h | 5 +- include/xrpl/protocol/RippleLedgerHash.h | 5 +- include/xrpl/protocol/Rules.h | 4 +- include/xrpl/protocol/SField.h | 5 +- include/xrpl/protocol/SOTemplate.h | 5 +- include/xrpl/protocol/STAccount.h | 5 +- include/xrpl/protocol/STAmount.h | 4 +- include/xrpl/protocol/STArray.h | 5 +- include/xrpl/protocol/STBase.h | 5 +- include/xrpl/protocol/STBitString.h | 5 +- include/xrpl/protocol/STBlob.h | 5 +- include/xrpl/protocol/STCurrency.h | 5 +- include/xrpl/protocol/STExchange.h | 5 +- include/xrpl/protocol/STInteger.h | 5 +- include/xrpl/protocol/STIssue.h | 5 +- include/xrpl/protocol/STLedgerEntry.h | 5 +- include/xrpl/protocol/STNumber.h | 5 +- include/xrpl/protocol/STObject.h | 5 +- include/xrpl/protocol/STParsedJSON.h | 5 +- include/xrpl/protocol/STPathSet.h | 5 +- include/xrpl/protocol/STTakesAsset.h | 5 +- include/xrpl/protocol/STTx.h | 5 +- include/xrpl/protocol/STValidation.h | 5 +- include/xrpl/protocol/STVector256.h | 5 +- include/xrpl/protocol/STXChainBridge.h | 5 +- include/xrpl/protocol/SecretKey.h | 5 +- include/xrpl/protocol/Seed.h | 5 +- include/xrpl/protocol/SeqProxy.h | 5 +- include/xrpl/protocol/Serializer.h | 5 +- include/xrpl/protocol/Sign.h | 5 +- include/xrpl/protocol/SystemParameters.h | 5 +- include/xrpl/protocol/TER.h | 5 +- include/xrpl/protocol/TxFlags.h | 5 +- include/xrpl/protocol/TxFormats.h | 5 +- include/xrpl/protocol/TxMeta.h | 5 +- include/xrpl/protocol/UintTypes.h | 5 +- include/xrpl/protocol/Units.h | 5 +- include/xrpl/protocol/XChainAttestations.h | 5 +- include/xrpl/protocol/XRPAmount.h | 5 +- include/xrpl/protocol/detail/STVar.h | 5 +- include/xrpl/protocol/detail/b58_utils.h | 4 +- include/xrpl/protocol/detail/secp256k1.h | 5 +- include/xrpl/protocol/detail/token_errors.h | 4 +- include/xrpl/protocol/digest.h | 5 +- include/xrpl/protocol/json_get_or_throw.h | 5 +- include/xrpl/protocol/jss.h | 5 +- include/xrpl/protocol/messages.h | 5 +- include/xrpl/protocol/nft.h | 5 +- include/xrpl/protocol/nftPageMask.h | 5 +- include/xrpl/protocol/serialize.h | 5 +- include/xrpl/protocol/st.h | 5 +- include/xrpl/protocol/tokens.h | 5 +- include/xrpl/resource/Charge.h | 5 +- include/xrpl/resource/Consumer.h | 5 +- include/xrpl/resource/Disposition.h | 5 +- include/xrpl/resource/Fees.h | 5 +- include/xrpl/resource/Gossip.h | 5 +- include/xrpl/resource/ResourceManager.h | 5 +- include/xrpl/resource/Types.h | 5 +- include/xrpl/resource/detail/Entry.h | 5 +- include/xrpl/resource/detail/Import.h | 5 +- include/xrpl/resource/detail/Key.h | 5 +- include/xrpl/resource/detail/Kind.h | 5 +- include/xrpl/resource/detail/Logic.h | 5 +- include/xrpl/resource/detail/Tuning.h | 5 +- include/xrpl/server/Handoff.h | 5 +- include/xrpl/server/Port.h | 5 +- include/xrpl/server/Server.h | 5 +- include/xrpl/server/Session.h | 5 +- include/xrpl/server/SimpleWriter.h | 5 +- include/xrpl/server/WSSession.h | 5 +- include/xrpl/server/Writer.h | 5 +- include/xrpl/server/detail/BaseHTTPPeer.h | 5 +- include/xrpl/server/detail/BasePeer.h | 5 +- include/xrpl/server/detail/BaseWSPeer.h | 5 +- include/xrpl/server/detail/Door.h | 5 +- include/xrpl/server/detail/JSONRPCUtil.h | 5 +- include/xrpl/server/detail/LowestLayer.h | 5 +- include/xrpl/server/detail/PlainHTTPPeer.h | 5 +- include/xrpl/server/detail/PlainWSPeer.h | 5 +- include/xrpl/server/detail/SSLHTTPPeer.h | 5 +- include/xrpl/server/detail/SSLWSPeer.h | 5 +- include/xrpl/server/detail/ServerImpl.h | 5 +- include/xrpl/server/detail/Spawn.h | 5 +- include/xrpl/server/detail/io_list.h | 5 +- include/xrpl/shamap/Family.h | 5 +- include/xrpl/shamap/FullBelowCache.h | 5 +- include/xrpl/shamap/SHAMap.h | 5 +- .../xrpl/shamap/SHAMapAccountStateLeafNode.h | 5 +- include/xrpl/shamap/SHAMapAddNode.h | 5 +- include/xrpl/shamap/SHAMapInnerNode.h | 4 +- include/xrpl/shamap/SHAMapItem.h | 5 +- include/xrpl/shamap/SHAMapLeafNode.h | 5 +- include/xrpl/shamap/SHAMapMissingNode.h | 5 +- include/xrpl/shamap/SHAMapNodeID.h | 5 +- include/xrpl/shamap/SHAMapSyncFilter.h | 5 +- include/xrpl/shamap/SHAMapTreeNode.h | 5 +- include/xrpl/shamap/SHAMapTxLeafNode.h | 5 +- .../xrpl/shamap/SHAMapTxPlusMetaLeafNode.h | 5 +- include/xrpl/shamap/TreeNodeCache.h | 5 +- include/xrpl/shamap/detail/TaggedPointer.h | 5 +- src/test/csf/BasicNetwork.h | 5 +- src/test/csf/CollectorRef.h | 5 +- src/test/csf/Digraph.h | 4 +- src/test/csf/Histogram.h | 5 +- src/test/csf/Peer.h | 4 +- src/test/csf/PeerGroup.h | 4 +- src/test/csf/Proposal.h | 5 +- src/test/csf/Scheduler.h | 5 +- src/test/csf/Sim.h | 5 +- src/test/csf/SimTime.h | 5 +- src/test/csf/TrustGraph.h | 5 +- src/test/csf/Tx.h | 5 +- src/test/csf/Validation.h | 5 +- src/test/csf/collectors.h | 5 +- src/test/csf/events.h | 5 +- src/test/csf/ledgers.h | 5 +- src/test/csf/random.h | 5 +- src/test/csf/submitters.h | 5 +- src/test/csf/timers.h | 5 +- src/test/json/TestOutputSuite.h | 5 +- src/test/jtx.h | 5 +- src/test/jtx/AMM.h | 5 +- src/test/jtx/AMMTest.h | 5 +- src/test/jtx/AbstractClient.h | 5 +- src/test/jtx/Account.h | 5 +- src/test/jtx/CaptureLogs.h | 5 +- src/test/jtx/CheckMessageLogs.h | 5 +- src/test/jtx/Env.h | 5 +- src/test/jtx/Env_ss.h | 5 +- src/test/jtx/JSONRPCClient.h | 5 +- src/test/jtx/JTx.h | 5 +- src/test/jtx/ManualTimeKeeper.h | 5 +- src/test/jtx/Oracle.h | 5 +- src/test/jtx/PathSet.h | 5 +- src/test/jtx/SignerUtils.h | 5 +- src/test/jtx/TestHelpers.h | 5 +- src/test/jtx/TestSuite.h | 5 +- src/test/jtx/TrustedPublisherServer.h | 4 +- src/test/jtx/WSClient.h | 5 +- src/test/jtx/account_txn_id.h | 4 +- src/test/jtx/acctdelete.h | 5 +- src/test/jtx/amount.h | 5 +- src/test/jtx/attester.h | 5 +- src/test/jtx/balance.h | 5 +- src/test/jtx/basic_prop.h | 5 +- src/test/jtx/batch.h | 5 +- src/test/jtx/check.h | 5 +- src/test/jtx/credentials.h | 5 +- src/test/jtx/delivermin.h | 5 +- src/test/jtx/deposit.h | 5 +- src/test/jtx/did.h | 5 +- src/test/jtx/directory.h | 5 +- src/test/jtx/envconfig.h | 5 +- src/test/jtx/escrow.h | 5 +- src/test/jtx/fee.h | 5 +- src/test/jtx/flags.h | 5 +- src/test/jtx/invoice_id.h | 4 +- src/test/jtx/jtx_json.h | 5 +- src/test/jtx/last_ledger_sequence.h | 5 +- src/test/jtx/ledgerStateFix.h | 5 +- src/test/jtx/memo.h | 5 +- src/test/jtx/mpt.h | 5 +- src/test/jtx/multisign.h | 5 +- src/test/jtx/noop.h | 5 +- src/test/jtx/offer.h | 5 +- src/test/jtx/owners.h | 5 +- src/test/jtx/paths.h | 5 +- src/test/jtx/pay.h | 5 +- src/test/jtx/permissioned_domains.h | 5 +- src/test/jtx/prop.h | 5 +- src/test/jtx/quality.h | 5 +- src/test/jtx/rate.h | 5 +- src/test/jtx/regkey.h | 5 +- src/test/jtx/require.h | 5 +- src/test/jtx/requires.h | 5 +- src/test/jtx/rpc.h | 5 +- src/test/jtx/sendmax.h | 5 +- src/test/jtx/seq.h | 5 +- src/test/jtx/sig.h | 5 +- src/test/jtx/tag.h | 5 +- src/test/jtx/tags.h | 5 +- src/test/jtx/ter.h | 5 +- src/test/jtx/testline.h | 5 +- src/test/jtx/ticket.h | 5 +- src/test/jtx/token.h | 5 +- src/test/jtx/trust.h | 5 +- src/test/jtx/txflags.h | 5 +- src/test/jtx/utility.h | 5 +- src/test/jtx/vault.h | 5 +- src/test/jtx/xchain_bridge.h | 5 +- src/test/nodestore/TestBase.h | 5 +- src/test/protocol/Issue_test.cpp | 8 - src/test/rpc/GRPCTestClientBase.h | 4 +- src/test/shamap/common.h | 5 +- src/test/unit_test/FileDirGuard.h | 5 +- src/test/unit_test/SuiteJournal.h | 5 +- src/test/unit_test/multi_runner.h | 5 +- src/tests/libxrpl/helpers/TestSink.h | 4 +- .../app/consensus/RCLCensorshipDetector.h | 5 +- src/xrpld/app/consensus/RCLConsensus.h | 5 +- src/xrpld/app/consensus/RCLCxLedger.h | 4 +- src/xrpld/app/consensus/RCLCxPeerPos.h | 5 +- src/xrpld/app/consensus/RCLCxTx.h | 4 +- src/xrpld/app/consensus/RCLValidations.h | 5 +- .../app/ledger/AbstractFetchPackContainer.h | 5 +- src/xrpld/app/ledger/AcceptedLedger.h | 5 +- src/xrpld/app/ledger/AcceptedLedgerTx.h | 5 +- src/xrpld/app/ledger/AccountStateSF.h | 5 +- src/xrpld/app/ledger/BookListeners.h | 5 +- src/xrpld/app/ledger/BuildLedger.h | 4 +- src/xrpld/app/ledger/ConsensusTransSetSF.h | 5 +- src/xrpld/app/ledger/InboundLedger.h | 5 +- src/xrpld/app/ledger/InboundLedgers.h | 5 +- src/xrpld/app/ledger/InboundTransactions.h | 5 +- src/xrpld/app/ledger/Ledger.h | 5 +- src/xrpld/app/ledger/LedgerCleaner.h | 5 +- src/xrpld/app/ledger/LedgerHistory.h | 5 +- src/xrpld/app/ledger/LedgerHolder.h | 5 +- src/xrpld/app/ledger/LedgerMaster.h | 5 +- src/xrpld/app/ledger/LedgerReplay.h | 5 +- src/xrpld/app/ledger/LedgerReplayTask.h | 5 +- src/xrpld/app/ledger/LedgerReplayer.h | 5 +- src/xrpld/app/ledger/LedgerToJson.h | 5 +- src/xrpld/app/ledger/LocalTxs.h | 5 +- src/xrpld/app/ledger/OpenLedger.h | 5 +- src/xrpld/app/ledger/OrderBookDB.h | 5 +- src/xrpld/app/ledger/PendingSaves.h | 5 +- src/xrpld/app/ledger/TransactionMaster.h | 5 +- src/xrpld/app/ledger/TransactionStateSF.h | 5 +- .../app/ledger/detail/LedgerDeltaAcquire.h | 5 +- .../ledger/detail/LedgerReplayMsgHandler.h | 5 +- src/xrpld/app/ledger/detail/SkipListAcquire.h | 5 +- src/xrpld/app/ledger/detail/TimeoutCounter.h | 5 +- .../app/ledger/detail/TransactionAcquire.h | 5 +- src/xrpld/app/main/Application.h | 5 +- src/xrpld/app/main/BasicApp.h | 5 +- src/xrpld/app/main/CollectorManager.h | 5 +- src/xrpld/app/main/DBInit.h | 5 +- src/xrpld/app/main/GRPCServer.h | 4 +- src/xrpld/app/main/LoadManager.h | 5 +- src/xrpld/app/main/NodeIdentity.h | 5 +- src/xrpld/app/main/NodeStoreScheduler.h | 5 +- src/xrpld/app/main/Tuning.h | 5 +- src/xrpld/app/misc/AMMHelpers.h | 5 +- src/xrpld/app/misc/AMMUtils.h | 5 +- src/xrpld/app/misc/AmendmentTable.h | 5 +- src/xrpld/app/misc/CanonicalTXSet.h | 5 +- src/xrpld/app/misc/DelegateUtils.h | 5 +- src/xrpld/app/misc/DeliverMax.h | 5 +- src/xrpld/app/misc/FeeVote.h | 5 +- src/xrpld/app/misc/HashRouter.h | 5 +- src/xrpld/app/misc/LendingHelpers.h | 5 +- src/xrpld/app/misc/LoadFeeTrack.h | 5 +- src/xrpld/app/misc/Manifest.h | 5 +- src/xrpld/app/misc/NegativeUNLVote.h | 5 +- src/xrpld/app/misc/NetworkOPs.h | 5 +- src/xrpld/app/misc/SHAMapStore.h | 5 +- src/xrpld/app/misc/SHAMapStoreImp.h | 5 +- src/xrpld/app/misc/Transaction.h | 5 +- src/xrpld/app/misc/TxQ.h | 5 +- src/xrpld/app/misc/ValidatorKeys.h | 5 +- src/xrpld/app/misc/ValidatorList.h | 5 +- src/xrpld/app/misc/ValidatorSite.h | 5 +- src/xrpld/app/misc/detail/AccountTxPaging.h | 5 +- src/xrpld/app/misc/detail/Work.h | 5 +- src/xrpld/app/misc/detail/WorkBase.h | 5 +- src/xrpld/app/misc/detail/WorkFile.h | 5 +- src/xrpld/app/misc/detail/WorkPlain.h | 5 +- src/xrpld/app/misc/detail/WorkSSL.h | 5 +- src/xrpld/app/paths/AMMContext.h | 5 +- src/xrpld/app/paths/AMMLiquidity.h | 5 +- src/xrpld/app/paths/AMMOffer.h | 5 +- src/xrpld/app/paths/AccountCurrencies.h | 5 +- src/xrpld/app/paths/Flow.h | 5 +- src/xrpld/app/paths/PathRequest.h | 5 +- src/xrpld/app/paths/PathRequests.h | 5 +- src/xrpld/app/paths/Pathfinder.h | 5 +- src/xrpld/app/paths/RippleCalc.h | 5 +- src/xrpld/app/paths/RippleLineCache.h | 5 +- src/xrpld/app/paths/TrustLine.h | 5 +- src/xrpld/app/paths/detail/AmountSpec.h | 5 +- src/xrpld/app/paths/detail/FlatSets.h | 5 +- src/xrpld/app/paths/detail/FlowDebugInfo.h | 4 +- src/xrpld/app/paths/detail/PathfinderUtils.h | 5 +- src/xrpld/app/paths/detail/StepChecks.h | 5 +- src/xrpld/app/paths/detail/Steps.h | 5 +- src/xrpld/app/paths/detail/StrandFlow.h | 5 +- src/xrpld/app/rdb/PeerFinder.h | 5 +- src/xrpld/app/rdb/RelationalDatabase.h | 5 +- src/xrpld/app/rdb/State.h | 5 +- src/xrpld/app/rdb/Vacuum.h | 5 +- src/xrpld/app/rdb/Wallet.h | 5 +- src/xrpld/app/rdb/backend/SQLiteDatabase.h | 5 +- src/xrpld/app/rdb/backend/detail/Node.h | 5 +- src/xrpld/app/tx/apply.h | 5 +- src/xrpld/app/tx/applySteps.h | 5 +- src/xrpld/app/tx/detail/AMMBid.h | 5 +- src/xrpld/app/tx/detail/AMMClawback.h | 5 +- src/xrpld/app/tx/detail/AMMCreate.h | 5 +- src/xrpld/app/tx/detail/AMMDelete.h | 5 +- src/xrpld/app/tx/detail/AMMDeposit.h | 5 +- src/xrpld/app/tx/detail/AMMVote.h | 5 +- src/xrpld/app/tx/detail/AMMWithdraw.h | 5 +- src/xrpld/app/tx/detail/ApplyContext.h | 5 +- src/xrpld/app/tx/detail/Batch.h | 5 +- src/xrpld/app/tx/detail/BookTip.h | 5 +- src/xrpld/app/tx/detail/CancelCheck.h | 5 +- src/xrpld/app/tx/detail/CancelOffer.h | 5 +- src/xrpld/app/tx/detail/CashCheck.h | 5 +- src/xrpld/app/tx/detail/Change.h | 5 +- src/xrpld/app/tx/detail/Clawback.h | 5 +- src/xrpld/app/tx/detail/CreateCheck.h | 5 +- src/xrpld/app/tx/detail/CreateOffer.h | 5 +- src/xrpld/app/tx/detail/CreateTicket.h | 5 +- src/xrpld/app/tx/detail/Credentials.h | 5 +- src/xrpld/app/tx/detail/DID.h | 5 +- src/xrpld/app/tx/detail/DelegateSet.h | 5 +- src/xrpld/app/tx/detail/DeleteAccount.h | 5 +- src/xrpld/app/tx/detail/DeleteOracle.h | 5 +- src/xrpld/app/tx/detail/DepositPreauth.h | 5 +- src/xrpld/app/tx/detail/Escrow.h | 5 +- src/xrpld/app/tx/detail/InvariantCheck.h | 5 +- src/xrpld/app/tx/detail/LedgerStateFix.h | 5 +- .../app/tx/detail/LoanBrokerCoverClawback.h | 5 +- .../app/tx/detail/LoanBrokerCoverDeposit.h | 5 +- .../app/tx/detail/LoanBrokerCoverWithdraw.h | 5 +- src/xrpld/app/tx/detail/LoanBrokerDelete.h | 5 +- src/xrpld/app/tx/detail/LoanBrokerSet.h | 5 +- src/xrpld/app/tx/detail/LoanDelete.h | 5 +- src/xrpld/app/tx/detail/LoanManage.h | 5 +- src/xrpld/app/tx/detail/LoanPay.h | 5 +- src/xrpld/app/tx/detail/LoanSet.h | 5 +- src/xrpld/app/tx/detail/MPTokenAuthorize.h | 5 +- .../app/tx/detail/MPTokenIssuanceCreate.h | 5 +- .../app/tx/detail/MPTokenIssuanceDestroy.h | 5 +- src/xrpld/app/tx/detail/MPTokenIssuanceSet.h | 5 +- src/xrpld/app/tx/detail/NFTokenAcceptOffer.h | 5 +- src/xrpld/app/tx/detail/NFTokenBurn.h | 5 +- src/xrpld/app/tx/detail/NFTokenCancelOffer.h | 5 +- src/xrpld/app/tx/detail/NFTokenCreateOffer.h | 5 +- src/xrpld/app/tx/detail/NFTokenMint.h | 5 +- src/xrpld/app/tx/detail/NFTokenModify.h | 5 +- src/xrpld/app/tx/detail/NFTokenUtils.h | 5 +- src/xrpld/app/tx/detail/Offer.h | 5 +- src/xrpld/app/tx/detail/OfferStream.h | 5 +- src/xrpld/app/tx/detail/PayChan.h | 5 +- src/xrpld/app/tx/detail/Payment.h | 5 +- .../app/tx/detail/PermissionedDomainDelete.h | 5 +- .../app/tx/detail/PermissionedDomainSet.h | 5 +- src/xrpld/app/tx/detail/SetAccount.h | 5 +- src/xrpld/app/tx/detail/SetOracle.h | 5 +- src/xrpld/app/tx/detail/SetRegularKey.h | 5 +- src/xrpld/app/tx/detail/SetSignerList.h | 5 +- src/xrpld/app/tx/detail/SetTrust.h | 5 +- src/xrpld/app/tx/detail/SignerEntries.h | 5 +- src/xrpld/app/tx/detail/Transactor.h | 5 +- src/xrpld/app/tx/detail/VaultClawback.h | 5 +- src/xrpld/app/tx/detail/VaultCreate.h | 5 +- src/xrpld/app/tx/detail/VaultDelete.h | 5 +- src/xrpld/app/tx/detail/VaultDeposit.h | 5 +- src/xrpld/app/tx/detail/VaultSet.h | 5 +- src/xrpld/app/tx/detail/VaultWithdraw.h | 5 +- src/xrpld/app/tx/detail/XChainBridge.h | 5 +- src/xrpld/conditions/Condition.h | 5 +- src/xrpld/conditions/Fulfillment.h | 5 +- src/xrpld/conditions/detail/PreimageSha256.h | 5 +- src/xrpld/conditions/detail/error.h | 5 +- src/xrpld/conditions/detail/utils.h | 5 +- src/xrpld/consensus/Consensus.h | 5 +- src/xrpld/consensus/ConsensusParms.h | 4 +- src/xrpld/consensus/ConsensusProposal.h | 4 +- src/xrpld/consensus/ConsensusTypes.h | 5 +- src/xrpld/consensus/DisputedTx.h | 5 +- src/xrpld/consensus/LedgerTiming.h | 4 +- src/xrpld/consensus/LedgerTrie.h | 4 +- src/xrpld/consensus/Validations.h | 4 +- src/xrpld/core/Config.h | 5 +- src/xrpld/core/ConfigSections.h | 5 +- src/xrpld/core/DatabaseCon.h | 5 +- src/xrpld/core/SociDB.h | 5 +- src/xrpld/core/TimeKeeper.h | 5 +- src/xrpld/overlay/Cluster.h | 5 +- src/xrpld/overlay/ClusterNode.h | 5 +- src/xrpld/overlay/Compression.h | 5 +- src/xrpld/overlay/Message.h | 5 +- src/xrpld/overlay/Overlay.h | 5 +- src/xrpld/overlay/Peer.h | 5 +- src/xrpld/overlay/PeerReservationTable.h | 5 +- src/xrpld/overlay/PeerSet.h | 5 +- src/xrpld/overlay/ReduceRelayCommon.h | 5 +- src/xrpld/overlay/Slot.h | 5 +- src/xrpld/overlay/Squelch.h | 5 +- src/xrpld/overlay/detail/ConnectAttempt.h | 5 +- src/xrpld/overlay/detail/Handshake.h | 5 +- src/xrpld/overlay/detail/OverlayImpl.h | 5 +- src/xrpld/overlay/detail/PeerImp.h | 5 +- src/xrpld/overlay/detail/ProtocolMessage.h | 5 +- src/xrpld/overlay/detail/ProtocolVersion.h | 5 +- src/xrpld/overlay/detail/TrafficCount.h | 4 +- src/xrpld/overlay/detail/Tuning.h | 5 +- src/xrpld/overlay/detail/TxMetrics.h | 5 +- src/xrpld/overlay/detail/ZeroCopyStream.h | 5 +- src/xrpld/overlay/make_Overlay.h | 5 +- src/xrpld/overlay/predicates.h | 5 +- src/xrpld/peerfinder/PeerfinderManager.h | 5 +- src/xrpld/peerfinder/Slot.h | 5 +- src/xrpld/peerfinder/detail/Bootcache.h | 5 +- src/xrpld/peerfinder/detail/Checker.h | 5 +- src/xrpld/peerfinder/detail/Counts.h | 5 +- src/xrpld/peerfinder/detail/Fixed.h | 5 +- src/xrpld/peerfinder/detail/Handouts.h | 5 +- src/xrpld/peerfinder/detail/Livecache.h | 5 +- src/xrpld/peerfinder/detail/Logic.h | 5 +- src/xrpld/peerfinder/detail/SlotImp.h | 5 +- src/xrpld/peerfinder/detail/Source.h | 5 +- src/xrpld/peerfinder/detail/SourceStrings.h | 5 +- src/xrpld/peerfinder/detail/Store.h | 5 +- src/xrpld/peerfinder/detail/StoreSqdb.h | 5 +- src/xrpld/peerfinder/detail/Tuning.h | 5 +- src/xrpld/peerfinder/detail/iosformat.h | 5 +- src/xrpld/peerfinder/make_Manager.h | 5 +- src/xrpld/perflog/detail/PerfLogImp.h | 5 +- src/xrpld/rpc/BookChanges.h | 5 +- src/xrpld/rpc/CTID.h | 5 +- src/xrpld/rpc/Context.h | 5 +- src/xrpld/rpc/DeliveredAmount.h | 5 +- src/xrpld/rpc/GRPCHandlers.h | 5 +- src/xrpld/rpc/InfoSub.h | 5 +- src/xrpld/rpc/MPTokenIssuanceID.h | 5 +- src/xrpld/rpc/Output.h | 5 +- src/xrpld/rpc/RPCCall.h | 5 +- src/xrpld/rpc/RPCHandler.h | 5 +- src/xrpld/rpc/RPCSub.h | 5 +- src/xrpld/rpc/Request.h | 5 +- src/xrpld/rpc/Role.h | 5 +- src/xrpld/rpc/ServerHandler.h | 5 +- src/xrpld/rpc/Status.h | 5 +- src/xrpld/rpc/detail/Handler.h | 5 +- src/xrpld/rpc/detail/LegacyPathFind.h | 5 +- src/xrpld/rpc/detail/RPCHelpers.h | 5 +- src/xrpld/rpc/detail/RPCLedgerHelpers.h | 5 +- src/xrpld/rpc/detail/TransactionSign.h | 5 +- src/xrpld/rpc/detail/Tuning.h | 5 +- src/xrpld/rpc/detail/WSInfoSub.h | 5 +- src/xrpld/rpc/handlers/GetCounts.h | 5 +- src/xrpld/rpc/handlers/Handlers.h | 5 +- src/xrpld/rpc/handlers/LedgerHandler.h | 5 +- src/xrpld/rpc/handlers/Version.h | 5 +- src/xrpld/rpc/handlers/WalletPropose.h | 5 +- src/xrpld/rpc/json_body.h | 5 +- src/xrpld/shamap/NodeFamily.h | 5 +- 678 files changed, 845 insertions(+), 2674 deletions(-) create mode 100755 .github/scripts/rename/include.sh create mode 100644 convert_include_guards.py diff --git a/.github/scripts/rename/include.sh b/.github/scripts/rename/include.sh new file mode 100755 index 0000000000..fbf165b975 --- /dev/null +++ b/.github/scripts/rename/include.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# Exit the script as soon as an error occurs. +set -e + +# This script checks whether there are no new include guards introduced by a new +# PR, as header files should use "#pragma once" instead. The script assumes any +# include guards will use "XRPL_" as prefix. +# Usage: .github/scripts/rename/include.sh + +if [ "$#" -ne 1 ]; then + echo "Usage: $0 " + exit 1 +fi + +DIRECTORY=$1 +echo "Processing directory: ${DIRECTORY}" +if [ ! -d "${DIRECTORY}" ]; then + echo "Error: Directory '${DIRECTORY}' does not exist." + exit 1 +fi + +find "${DIRECTORY}" -type f \( -name "*.h" -o -name "*.hpp" -o -name "*.ipp" \) | while read -r FILE; do + echo "Processing file: ${FILE}" + if grep -q "#ifndef XRPL_" "${FILE}"; then + echo "Please replace all include guards by #pragma once." + exit 1 + fi +done +echo "Checking complete." diff --git a/.github/workflows/reusable-check-rename.yml b/.github/workflows/reusable-check-rename.yml index af55084405..a73ac49b7d 100644 --- a/.github/workflows/reusable-check-rename.yml +++ b/.github/workflows/reusable-check-rename.yml @@ -31,6 +31,8 @@ jobs: run: .github/scripts/rename/namespace.sh . - name: Check config name run: .github/scripts/rename/config.sh . + - name: Check include guards + run: .github/scripts/rename/include.sh . - name: Check for differences env: MESSAGE: | diff --git a/convert_include_guards.py b/convert_include_guards.py new file mode 100644 index 0000000000..c4f06ecc54 --- /dev/null +++ b/convert_include_guards.py @@ -0,0 +1,139 @@ +#!/usr/bin/env python3 +""" +Script to replace include guards with #pragma once +Handles guards starting with XRPL_, BEAST_, or TEST_ +""" + +import sys +from pathlib import Path + + +def convert_file(file_path, prefixes=None): + """ + Convert a file from include guards to #pragma once + + Args: + file_path: Path to the file to convert + prefixes: List of prefixes to match (e.g., ['XRPL_', 'BEAST_', 'TEST_']) + If None, defaults to ['XRPL_', 'BEAST_', 'TEST_'] + + Returns True if the file was modified, False otherwise + """ + if prefixes is None: + prefixes = ["XRPL_", "BEAST_", "TEST_"] + + try: + with open(file_path, "r", encoding="utf-8") as f: + lines = f.readlines() + except Exception as e: + print(f"Error reading {file_path}: {e}", file=sys.stderr) + return False + + if len(lines) < 3: + print(f"Skipping {file_path}: too few lines", file=sys.stderr) + return False + + # Find the #ifndef with any of the specified prefixes + ifndef_idx = -1 + define_idx = -1 + found_prefix = None + + for i, line in enumerate(lines): + stripped = line.strip() + for prefix in prefixes: + if stripped.startswith(f"#ifndef {prefix}"): + ifndef_idx = i + found_prefix = prefix + # The #define should be the next line + if i + 1 < len(lines) and lines[i + 1].strip().startswith( + f"#define {prefix}" + ): + define_idx = i + 1 + break + if ifndef_idx != -1: + break + + if ifndef_idx == -1 or define_idx == -1: + print( + f"No include guard with prefixes {prefixes} found in {file_path}", + file=sys.stderr, + ) + return False + + # Find the last #endif line + endif_idx = -1 + for i in range(len(lines) - 1, -1, -1): + stripped = lines[i].strip() + if stripped.startswith("#endif"): + endif_idx = i + break + + if endif_idx == -1: + print(f"No closing #endif found in {file_path}", file=sys.stderr) + return False + + # Build the new content + new_lines = [] + + # Add everything before the #ifndef + new_lines.extend(lines[:ifndef_idx]) + + # Add #pragma once with exactly one empty line after it + new_lines.append("#pragma once\n") + new_lines.append("\n") + + # Add everything between #define and #endif, but skip leading empty lines + content_lines = lines[define_idx + 1 : endif_idx] + # Skip leading empty lines + start_idx = 0 + while start_idx < len(content_lines) and content_lines[start_idx].strip() == "": + start_idx += 1 + new_lines.extend(content_lines[start_idx:]) + + # Add everything after #endif (usually just empty lines, but include it) + new_lines.extend(lines[endif_idx + 1 :]) + + # Remove trailing empty lines at the end, then ensure exactly one newline at end + while new_lines and new_lines[-1].strip() == "": + new_lines.pop() + + if new_lines and not new_lines[-1].endswith("\n"): + new_lines[-1] += "\n" + else: + new_lines.append("\n") + + # Write the file + try: + with open(file_path, "w", encoding="utf-8") as f: + f.writelines(new_lines) + print(f"Converted: {file_path}") + return True + except Exception as e: + print(f"Error writing {file_path}: {e}", file=sys.stderr) + return False + + +def main(): + if len(sys.argv) < 2: + print("Usage: python convert_include_guards.py [file2 ...]") + sys.exit(1) + + files = sys.argv[1:] + success_count = 0 + fail_count = 0 + + for file_path in files: + if convert_file(file_path): + success_count += 1 + else: + fail_count += 1 + + print( + f"\nSummary: {success_count} files converted, {fail_count} files failed/unchanged" + ) + + return 0 if fail_count == 0 else 1 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/include/xrpl/basics/Archive.h b/include/xrpl/basics/Archive.h index 84af8a7c7d..58e12bbb71 100644 --- a/include/xrpl/basics/Archive.h +++ b/include/xrpl/basics/Archive.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_ARCHIVE_H_INCLUDED -#define XRPL_BASICS_ARCHIVE_H_INCLUDED +#pragma once #include @@ -16,5 +15,3 @@ void extractTarLz4(boost::filesystem::path const& src, boost::filesystem::path const& dst); } // namespace xrpl - -#endif diff --git a/include/xrpl/basics/BasicConfig.h b/include/xrpl/basics/BasicConfig.h index 9aa7f3e612..d18019fa9f 100644 --- a/include/xrpl/basics/BasicConfig.h +++ b/include/xrpl/basics/BasicConfig.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_BASICCONFIG_H_INCLUDED -#define XRPL_BASICS_BASICCONFIG_H_INCLUDED +#pragma once #include @@ -369,5 +368,3 @@ get_if_exists(Section const& section, std::string const& name, bool& v) } } // namespace xrpl - -#endif diff --git a/include/xrpl/basics/Blob.h b/include/xrpl/basics/Blob.h index 986f829371..ee0d6cf3b5 100644 --- a/include/xrpl/basics/Blob.h +++ b/include/xrpl/basics/Blob.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_BLOB_H_INCLUDED -#define XRPL_BASICS_BLOB_H_INCLUDED +#pragma once #include @@ -11,5 +10,3 @@ namespace xrpl { using Blob = std::vector; } // namespace xrpl - -#endif diff --git a/include/xrpl/basics/Buffer.h b/include/xrpl/basics/Buffer.h index b7e0878477..5192daf632 100644 --- a/include/xrpl/basics/Buffer.h +++ b/include/xrpl/basics/Buffer.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_BUFFER_H_INCLUDED -#define XRPL_BASICS_BUFFER_H_INCLUDED +#pragma once #include #include @@ -213,5 +212,3 @@ operator!=(Buffer const& lhs, Buffer const& rhs) noexcept } } // namespace xrpl - -#endif diff --git a/include/xrpl/basics/ByteUtilities.h b/include/xrpl/basics/ByteUtilities.h index 88bb297346..cd10611a50 100644 --- a/include/xrpl/basics/ByteUtilities.h +++ b/include/xrpl/basics/ByteUtilities.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_BYTEUTILITIES_H_INCLUDED -#define XRPL_BASICS_BYTEUTILITIES_H_INCLUDED +#pragma once namespace xrpl { @@ -20,5 +19,3 @@ megabytes(T value) noexcept static_assert(kilobytes(2) == 2048, "kilobytes(2) == 2048"); static_assert(megabytes(3) == 3145728, "megabytes(3) == 3145728"); } // namespace xrpl - -#endif diff --git a/include/xrpl/basics/CompressionAlgorithms.h b/include/xrpl/basics/CompressionAlgorithms.h index 52dc406d5d..b8fe4c8018 100644 --- a/include/xrpl/basics/CompressionAlgorithms.h +++ b/include/xrpl/basics/CompressionAlgorithms.h @@ -1,5 +1,4 @@ -#ifndef XRPL_COMPRESSIONALGORITHMS_H_INCLUDED -#define XRPL_COMPRESSIONALGORITHMS_H_INCLUDED +#pragma once #include @@ -133,5 +132,3 @@ lz4Decompress(InputStream& in, std::size_t inSize, std::uint8_t* decompressed, s } // namespace compression_algorithms } // namespace xrpl - -#endif // XRPL_COMPRESSIONALGORITHMS_H_INCLUDED diff --git a/include/xrpl/basics/CountedObject.h b/include/xrpl/basics/CountedObject.h index e464e470af..55a895dbb1 100644 --- a/include/xrpl/basics/CountedObject.h +++ b/include/xrpl/basics/CountedObject.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_COUNTEDOBJECT_H_INCLUDED -#define XRPL_BASICS_COUNTEDOBJECT_H_INCLUDED +#pragma once #include @@ -134,5 +133,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/basics/DecayingSample.h b/include/xrpl/basics/DecayingSample.h index 3b5e947f1f..e4c9ad5d7a 100644 --- a/include/xrpl/basics/DecayingSample.h +++ b/include/xrpl/basics/DecayingSample.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_DECAYINGSAMPLE_H_INCLUDED -#define XRPL_BASICS_DECAYINGSAMPLE_H_INCLUDED +#pragma once #include #include @@ -130,5 +129,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/basics/Expected.h b/include/xrpl/basics/Expected.h index 9ce771dc23..7c98e72107 100644 --- a/include/xrpl/basics/Expected.h +++ b/include/xrpl/basics/Expected.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_EXPECTED_H_INCLUDED -#define XRPL_BASICS_EXPECTED_H_INCLUDED +#pragma once #include @@ -229,5 +228,3 @@ public: }; } // namespace xrpl - -#endif // XRPL_BASICS_EXPECTED_H_INCLUDED diff --git a/include/xrpl/basics/FileUtilities.h b/include/xrpl/basics/FileUtilities.h index 03013da63a..299269703a 100644 --- a/include/xrpl/basics/FileUtilities.h +++ b/include/xrpl/basics/FileUtilities.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_FILEUTILITIES_H_INCLUDED -#define XRPL_BASICS_FILEUTILITIES_H_INCLUDED +#pragma once #include #include @@ -18,5 +17,3 @@ void writeFileContents(boost::system::error_code& ec, boost::filesystem::path const& destPath, std::string const& contents); } // namespace xrpl - -#endif diff --git a/include/xrpl/basics/IntrusivePointer.h b/include/xrpl/basics/IntrusivePointer.h index 366392885b..4464c37dc5 100644 --- a/include/xrpl/basics/IntrusivePointer.h +++ b/include/xrpl/basics/IntrusivePointer.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_INTRUSIVEPOINTER_H_INCLUDED -#define XRPL_BASICS_INTRUSIVEPOINTER_H_INCLUDED +#pragma once #include #include @@ -485,4 +484,3 @@ dynamic_pointer_cast(TT const& v) } } // namespace intr_ptr } // namespace xrpl -#endif diff --git a/include/xrpl/basics/IntrusivePointer.ipp b/include/xrpl/basics/IntrusivePointer.ipp index 85eda5cb16..d52aa6299f 100644 --- a/include/xrpl/basics/IntrusivePointer.ipp +++ b/include/xrpl/basics/IntrusivePointer.ipp @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_INTRUSIVEPOINTER_IPP_INCLUDED -#define XRPL_BASICS_INTRUSIVEPOINTER_IPP_INCLUDED +#pragma once #include #include @@ -703,4 +702,3 @@ SharedWeakUnion::unsafeReleaseNoStore() } } // namespace xrpl -#endif diff --git a/include/xrpl/basics/IntrusiveRefCounts.h b/include/xrpl/basics/IntrusiveRefCounts.h index e9214a5adc..0273ed4647 100644 --- a/include/xrpl/basics/IntrusiveRefCounts.h +++ b/include/xrpl/basics/IntrusiveRefCounts.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_INTRUSIVEREFCOUNTS_H_INCLUDED -#define XRPL_BASICS_INTRUSIVEREFCOUNTS_H_INCLUDED +#pragma once #include @@ -461,4 +460,3 @@ partialDestructorFinished(T** o) //------------------------------------------------------------------------------ } // namespace xrpl -#endif diff --git a/include/xrpl/basics/KeyCache.h b/include/xrpl/basics/KeyCache.h index 038bf7b9b7..4f2ca20cca 100644 --- a/include/xrpl/basics/KeyCache.h +++ b/include/xrpl/basics/KeyCache.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_KEYCACHE_H -#define XRPL_BASICS_KEYCACHE_H +#pragma once #include #include @@ -9,5 +8,3 @@ namespace xrpl { using KeyCache = TaggedCache; } // namespace xrpl - -#endif // XRPL_BASICS_KEYCACHE_H diff --git a/include/xrpl/basics/LocalValue.h b/include/xrpl/basics/LocalValue.h index 8c664116c3..94af41a41d 100644 --- a/include/xrpl/basics/LocalValue.h +++ b/include/xrpl/basics/LocalValue.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_LOCALVALUE_H_INCLUDED -#define XRPL_BASICS_LOCALVALUE_H_INCLUDED +#pragma once #include @@ -107,5 +106,3 @@ LocalValue::operator*() lvs->values.emplace(this, std::make_unique>(t_)).first->second->get()); } } // namespace xrpl - -#endif diff --git a/include/xrpl/basics/Log.h b/include/xrpl/basics/Log.h index 92fd2c0e9c..786fbc5da2 100644 --- a/include/xrpl/basics/Log.h +++ b/include/xrpl/basics/Log.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_LOG_H_INCLUDED -#define XRPL_BASICS_LOG_H_INCLUDED +#pragma once #include #include @@ -258,5 +257,3 @@ beast::Journal debugLog(); } // namespace xrpl - -#endif diff --git a/include/xrpl/basics/MathUtilities.h b/include/xrpl/basics/MathUtilities.h index bd8ea883fb..4552b335e1 100644 --- a/include/xrpl/basics/MathUtilities.h +++ b/include/xrpl/basics/MathUtilities.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_MATHUTILITIES_H_INCLUDED -#define XRPL_BASICS_MATHUTILITIES_H_INCLUDED +#pragma once #include #include @@ -45,5 +44,3 @@ static_assert(calculatePercent(50'000'001, 100'000'000) == 51); static_assert(calculatePercent(99'999'999, 100'000'000) == 100); } // namespace xrpl - -#endif diff --git a/include/xrpl/basics/Number.h b/include/xrpl/basics/Number.h index cdd971d8b0..c269d27781 100644 --- a/include/xrpl/basics/Number.h +++ b/include/xrpl/basics/Number.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_NUMBER_H_INCLUDED -#define XRPL_BASICS_NUMBER_H_INCLUDED +#pragma once #include @@ -819,5 +818,3 @@ public: }; } // namespace xrpl - -#endif // XRPL_BASICS_NUMBER_H_INCLUDED diff --git a/include/xrpl/basics/RangeSet.h b/include/xrpl/basics/RangeSet.h index ee95577271..f6e03cac79 100644 --- a/include/xrpl/basics/RangeSet.h +++ b/include/xrpl/basics/RangeSet.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_RANGESET_H_INCLUDED -#define XRPL_BASICS_RANGESET_H_INCLUDED +#pragma once #include @@ -173,5 +172,3 @@ prevMissing(RangeSet const& rs, T t, T minVal = 0) } } // namespace xrpl - -#endif diff --git a/include/xrpl/basics/Resolver.h b/include/xrpl/basics/Resolver.h index b66f4a5ed5..5bfa6796d2 100644 --- a/include/xrpl/basics/Resolver.h +++ b/include/xrpl/basics/Resolver.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_RESOLVER_H_INCLUDED -#define XRPL_BASICS_RESOLVER_H_INCLUDED +#pragma once #include @@ -45,5 +44,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/basics/ResolverAsio.h b/include/xrpl/basics/ResolverAsio.h index f2a3da0d58..d0dcc9f185 100644 --- a/include/xrpl/basics/ResolverAsio.h +++ b/include/xrpl/basics/ResolverAsio.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_RESOLVERASIO_H_INCLUDED -#define XRPL_BASICS_RESOLVERASIO_H_INCLUDED +#pragma once #include #include @@ -18,5 +17,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/basics/SHAMapHash.h b/include/xrpl/basics/SHAMapHash.h index eb635b516c..22f8505912 100644 --- a/include/xrpl/basics/SHAMapHash.h +++ b/include/xrpl/basics/SHAMapHash.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_SHAMAP_HASH_H_INCLUDED -#define XRPL_BASICS_SHAMAP_HASH_H_INCLUDED +#pragma once #include #include @@ -98,5 +97,3 @@ extract(SHAMapHash const& key) } } // namespace xrpl - -#endif // XRPL_BASICS_SHAMAP_HASH_H_INCLUDED diff --git a/include/xrpl/basics/SharedWeakCachePointer.h b/include/xrpl/basics/SharedWeakCachePointer.h index 49369265eb..afc701ed5a 100644 --- a/include/xrpl/basics/SharedWeakCachePointer.h +++ b/include/xrpl/basics/SharedWeakCachePointer.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_SHAREDWEAKCACHEPOINTER_H_INCLUDED -#define XRPL_BASICS_SHAREDWEAKCACHEPOINTER_H_INCLUDED +#pragma once #include #include @@ -113,4 +112,3 @@ private: std::variant, std::weak_ptr> combo_; }; } // namespace xrpl -#endif diff --git a/include/xrpl/basics/SharedWeakCachePointer.ipp b/include/xrpl/basics/SharedWeakCachePointer.ipp index eeb1a1927b..6e7514ffae 100644 --- a/include/xrpl/basics/SharedWeakCachePointer.ipp +++ b/include/xrpl/basics/SharedWeakCachePointer.ipp @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_SHAREDWEAKCACHEPOINTER_IPP_INCLUDED -#define XRPL_BASICS_SHAREDWEAKCACHEPOINTER_IPP_INCLUDED +#pragma once #include @@ -164,4 +163,3 @@ SharedWeakCachePointer::convertToWeak() return false; } } // namespace xrpl -#endif diff --git a/include/xrpl/basics/SlabAllocator.h b/include/xrpl/basics/SlabAllocator.h index 199eaf3bcc..2578afdc5a 100644 --- a/include/xrpl/basics/SlabAllocator.h +++ b/include/xrpl/basics/SlabAllocator.h @@ -1,7 +1,6 @@ // Copyright (c) 2022, Nikolaos D. Bougalis -#ifndef XRPL_BASICS_SLABALLOCATOR_H_INCLUDED -#define XRPL_BASICS_SLABALLOCATOR_H_INCLUDED +#pragma once #include #include @@ -386,5 +385,3 @@ public: }; } // namespace xrpl - -#endif // XRPL_BASICS_SLABALLOCATOR_H_INCLUDED diff --git a/include/xrpl/basics/Slice.h b/include/xrpl/basics/Slice.h index b8990cb1bb..2f6081760f 100644 --- a/include/xrpl/basics/Slice.h +++ b/include/xrpl/basics/Slice.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_SLICE_H_INCLUDED -#define XRPL_BASICS_SLICE_H_INCLUDED +#pragma once #include #include @@ -231,5 +230,3 @@ makeSlice(std::basic_string const& s) } } // namespace xrpl - -#endif diff --git a/include/xrpl/basics/StringUtilities.h b/include/xrpl/basics/StringUtilities.h index 3d5a18f120..9b1cf4892d 100644 --- a/include/xrpl/basics/StringUtilities.h +++ b/include/xrpl/basics/StringUtilities.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_STRINGUTILITIES_H_INCLUDED -#define XRPL_BASICS_STRINGUTILITIES_H_INCLUDED +#pragma once #include #include @@ -132,5 +131,3 @@ bool isProperlyFormedTomlDomain(std::string_view domain); } // namespace xrpl - -#endif diff --git a/include/xrpl/basics/TaggedCache.h b/include/xrpl/basics/TaggedCache.h index 2b82f63a00..78c4ea7aeb 100644 --- a/include/xrpl/basics/TaggedCache.h +++ b/include/xrpl/basics/TaggedCache.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_TAGGEDCACHE_H_INCLUDED -#define XRPL_BASICS_TAGGEDCACHE_H_INCLUDED +#pragma once #include #include @@ -298,5 +297,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/basics/TaggedCache.ipp b/include/xrpl/basics/TaggedCache.ipp index 837db67c32..3d0c0342cc 100644 --- a/include/xrpl/basics/TaggedCache.ipp +++ b/include/xrpl/basics/TaggedCache.ipp @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_TAGGEDCACHE_IPP_INCLUDED -#define XRPL_BASICS_TAGGEDCACHE_IPP_INCLUDED +#pragma once #include #include @@ -784,5 +783,3 @@ TaggedCache #include @@ -44,5 +43,3 @@ to_string(char const* s) } } // namespace xrpl - -#endif diff --git a/include/xrpl/basics/UnorderedContainers.h b/include/xrpl/basics/UnorderedContainers.h index 75d1fdb8da..c614f9ea80 100644 --- a/include/xrpl/basics/UnorderedContainers.h +++ b/include/xrpl/basics/UnorderedContainers.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_UNORDEREDCONTAINERS_H_INCLUDED -#define XRPL_BASICS_UNORDEREDCONTAINERS_H_INCLUDED +#pragma once #include #include @@ -99,5 +98,3 @@ template < using hardened_hash_multiset = std::unordered_multiset; } // namespace xrpl - -#endif diff --git a/include/xrpl/basics/UptimeClock.h b/include/xrpl/basics/UptimeClock.h index 9e1ef10d19..4edd38d274 100644 --- a/include/xrpl/basics/UptimeClock.h +++ b/include/xrpl/basics/UptimeClock.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_UPTIMETIMER_H_INCLUDED -#define XRPL_BASICS_UPTIMETIMER_H_INCLUDED +#pragma once #include #include @@ -46,5 +45,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/basics/algorithm.h b/include/xrpl/basics/algorithm.h index 1f536764db..2378c695df 100644 --- a/include/xrpl/basics/algorithm.h +++ b/include/xrpl/basics/algorithm.h @@ -1,5 +1,4 @@ -#ifndef XRPL_ALGORITHM_H_INCLUDED -#define XRPL_ALGORITHM_H_INCLUDED +#pragma once #include @@ -90,5 +89,3 @@ remove_if_intersect_or_match(FwdIter1 first1, FwdIter1 last1, InputIter2 first2, } } // namespace xrpl - -#endif diff --git a/include/xrpl/basics/base64.h b/include/xrpl/basics/base64.h index 508196cf11..1725ee42f6 100644 --- a/include/xrpl/basics/base64.h +++ b/include/xrpl/basics/base64.h @@ -32,8 +32,7 @@ */ -#ifndef XRPL_BASICS_BASE64_H_INCLUDED -#define XRPL_BASICS_BASE64_H_INCLUDED +#pragma once #include #include @@ -53,5 +52,3 @@ std::string base64_decode(std::string_view data); } // namespace xrpl - -#endif diff --git a/include/xrpl/basics/base_uint.h b/include/xrpl/basics/base_uint.h index 32d6ad20fc..745cb7ab40 100644 --- a/include/xrpl/basics/base_uint.h +++ b/include/xrpl/basics/base_uint.h @@ -3,8 +3,7 @@ // Distributed under the MIT/X11 software license, see the accompanying // file license.txt or http://www.opensource.org/licenses/mit-license.php. -#ifndef XRPL_BASICS_BASE_UINT_H_INCLUDED -#define XRPL_BASICS_BASE_UINT_H_INCLUDED +#pragma once #include #include @@ -644,5 +643,3 @@ struct is_uniquely_represented> : public std::true_ty }; } // namespace beast - -#endif diff --git a/include/xrpl/basics/chrono.h b/include/xrpl/basics/chrono.h index b542d1ded2..bcf988b45e 100644 --- a/include/xrpl/basics/chrono.h +++ b/include/xrpl/basics/chrono.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_CHRONO_H_INCLUDED -#define XRPL_BASICS_CHRONO_H_INCLUDED +#pragma once #include #include @@ -99,5 +98,3 @@ stopwatch() } } // namespace xrpl - -#endif diff --git a/include/xrpl/basics/comparators.h b/include/xrpl/basics/comparators.h index 7c848f0b3b..0e21d38d6b 100644 --- a/include/xrpl/basics/comparators.h +++ b/include/xrpl/basics/comparators.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_COMPARATORS_H_INCLUDED -#define XRPL_BASICS_COMPARATORS_H_INCLUDED +#pragma once #include @@ -53,5 +52,3 @@ using equal_to = std::equal_to; #endif } // namespace xrpl - -#endif diff --git a/include/xrpl/basics/contract.h b/include/xrpl/basics/contract.h index bd2025dd17..8be257bb02 100644 --- a/include/xrpl/basics/contract.h +++ b/include/xrpl/basics/contract.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_CONTRACT_H_INCLUDED -#define XRPL_BASICS_CONTRACT_H_INCLUDED +#pragma once #include @@ -48,5 +47,3 @@ Throw(Args&&... args) LogicError(std::string const& how) noexcept; } // namespace xrpl - -#endif diff --git a/include/xrpl/basics/hardened_hash.h b/include/xrpl/basics/hardened_hash.h index a25dcb3c34..b05ecda7a6 100644 --- a/include/xrpl/basics/hardened_hash.h +++ b/include/xrpl/basics/hardened_hash.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_HARDENED_HASH_H_INCLUDED -#define XRPL_BASICS_HARDENED_HASH_H_INCLUDED +#pragma once #include #include @@ -93,5 +92,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/basics/join.h b/include/xrpl/basics/join.h index 890b6fdc10..16fae4ff87 100644 --- a/include/xrpl/basics/join.h +++ b/include/xrpl/basics/join.h @@ -1,5 +1,4 @@ -#ifndef JOIN_H_INCLUDED -#define JOIN_H_INCLUDED +#pragma once #include @@ -80,5 +79,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/basics/make_SSLContext.h b/include/xrpl/basics/make_SSLContext.h index fb91dd40a9..1714d3e58c 100644 --- a/include/xrpl/basics/make_SSLContext.h +++ b/include/xrpl/basics/make_SSLContext.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_MAKE_SSLCONTEXT_H_INCLUDED -#define XRPL_BASICS_MAKE_SSLCONTEXT_H_INCLUDED +#pragma once #include @@ -20,5 +19,3 @@ make_SSLContextAuthed( std::string const& cipherList); } // namespace xrpl - -#endif diff --git a/include/xrpl/basics/mulDiv.h b/include/xrpl/basics/mulDiv.h index fb38d0cd63..2495f07728 100644 --- a/include/xrpl/basics/mulDiv.h +++ b/include/xrpl/basics/mulDiv.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_MULDIV_H_INCLUDED -#define XRPL_BASICS_MULDIV_H_INCLUDED +#pragma once #include #include @@ -22,5 +21,3 @@ std::optional mulDiv(std::uint64_t value, std::uint64_t mul, std::uint64_t div); } // namespace xrpl - -#endif diff --git a/include/xrpl/basics/partitioned_unordered_map.h b/include/xrpl/basics/partitioned_unordered_map.h index f011fb9508..181597ca69 100644 --- a/include/xrpl/basics/partitioned_unordered_map.h +++ b/include/xrpl/basics/partitioned_unordered_map.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_PARTITIONED_UNORDERED_MAP_H -#define XRPL_BASICS_PARTITIONED_UNORDERED_MAP_H +#pragma once #include #include @@ -393,5 +392,3 @@ private: }; } // namespace xrpl - -#endif // XRPL_BASICS_PARTITIONED_UNORDERED_MAP_H diff --git a/include/xrpl/basics/random.h b/include/xrpl/basics/random.h index 74ec14c742..34e460fd8a 100644 --- a/include/xrpl/basics/random.h +++ b/include/xrpl/basics/random.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_RANDOM_H_INCLUDED -#define XRPL_BASICS_RANDOM_H_INCLUDED +#pragma once #include #include @@ -174,5 +173,3 @@ rand_bool() /** @} */ } // namespace xrpl - -#endif // XRPL_BASICS_RANDOM_H_INCLUDED diff --git a/include/xrpl/basics/rocksdb.h b/include/xrpl/basics/rocksdb.h index 59a69a9b44..3d468b0f1b 100644 --- a/include/xrpl/basics/rocksdb.h +++ b/include/xrpl/basics/rocksdb.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_ROCKSDB_H_INCLUDED -#define XRPL_BASICS_ROCKSDB_H_INCLUDED +#pragma once #if XRPL_ROCKSDB_AVAILABLE // #include @@ -28,5 +27,3 @@ #include #endif - -#endif diff --git a/include/xrpl/basics/safe_cast.h b/include/xrpl/basics/safe_cast.h index 903f916194..285d76782a 100644 --- a/include/xrpl/basics/safe_cast.h +++ b/include/xrpl/basics/safe_cast.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_SAFE_CAST_H_INCLUDED -#define XRPL_BASICS_SAFE_CAST_H_INCLUDED +#pragma once #include @@ -69,5 +68,3 @@ unsafe_cast(Src s) noexcept } } // namespace xrpl - -#endif diff --git a/include/xrpl/basics/scope.h b/include/xrpl/basics/scope.h index f0643c420c..797a7d3fdc 100644 --- a/include/xrpl/basics/scope.h +++ b/include/xrpl/basics/scope.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_SCOPE_H_INCLUDED -#define XRPL_BASICS_SCOPE_H_INCLUDED +#pragma once #include @@ -220,5 +219,3 @@ template scope_unlock(std::unique_lock&) -> scope_unlock; } // namespace xrpl - -#endif diff --git a/include/xrpl/basics/spinlock.h b/include/xrpl/basics/spinlock.h index f612aaf548..7b05b7c339 100644 --- a/include/xrpl/basics/spinlock.h +++ b/include/xrpl/basics/spinlock.h @@ -1,7 +1,6 @@ // Copyright (c) 2022, Nikolaos D. Bougalis -#ifndef XRPL_BASICS_SPINLOCK_H_INCLUDED -#define XRPL_BASICS_SPINLOCK_H_INCLUDED +#pragma once #include @@ -201,5 +200,3 @@ public: /** @} */ } // namespace xrpl - -#endif diff --git a/include/xrpl/basics/strHex.h b/include/xrpl/basics/strHex.h index 38b9a15668..76a3d86ff3 100644 --- a/include/xrpl/basics/strHex.h +++ b/include/xrpl/basics/strHex.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_STRHEX_H_INCLUDED -#define XRPL_BASICS_STRHEX_H_INCLUDED +#pragma once #include #include @@ -27,5 +26,3 @@ strHex(T const& from) } } // namespace xrpl - -#endif diff --git a/include/xrpl/basics/tagged_integer.h b/include/xrpl/basics/tagged_integer.h index a44daf1342..439cc537e2 100644 --- a/include/xrpl/basics/tagged_integer.h +++ b/include/xrpl/basics/tagged_integer.h @@ -1,7 +1,6 @@ // Copyright (c) 2014, Nikolaos D. Bougalis -#ifndef BEAST_UTILITY_TAGGED_INTEGER_H_INCLUDED -#define BEAST_UTILITY_TAGGED_INTEGER_H_INCLUDED +#pragma once #include @@ -202,4 +201,3 @@ struct is_contiguously_hashable, HashAlgorithm> }; } // namespace beast -#endif diff --git a/include/xrpl/beast/asio/io_latency_probe.h b/include/xrpl/beast/asio/io_latency_probe.h index 8ee4fdb89a..347203acb3 100644 --- a/include/xrpl/beast/asio/io_latency_probe.h +++ b/include/xrpl/beast/asio/io_latency_probe.h @@ -1,5 +1,4 @@ -#ifndef BEAST_ASIO_IO_LATENCY_PROBE_H_INCLUDED -#define BEAST_ASIO_IO_LATENCY_PROBE_H_INCLUDED +#pragma once #include @@ -226,5 +225,3 @@ private: }; } // namespace beast - -#endif diff --git a/include/xrpl/beast/clock/abstract_clock.h b/include/xrpl/beast/clock/abstract_clock.h index 6f71529fda..41b57fdd2c 100644 --- a/include/xrpl/beast/clock/abstract_clock.h +++ b/include/xrpl/beast/clock/abstract_clock.h @@ -1,5 +1,4 @@ -#ifndef BEAST_CHRONO_ABSTRACT_CLOCK_H_INCLUDED -#define BEAST_CHRONO_ABSTRACT_CLOCK_H_INCLUDED +#pragma once namespace beast { @@ -89,5 +88,3 @@ get_abstract_clock() } } // namespace beast - -#endif diff --git a/include/xrpl/beast/clock/basic_seconds_clock.h b/include/xrpl/beast/clock/basic_seconds_clock.h index 65dbe5abc7..5205d92fef 100644 --- a/include/xrpl/beast/clock/basic_seconds_clock.h +++ b/include/xrpl/beast/clock/basic_seconds_clock.h @@ -1,5 +1,4 @@ -#ifndef BEAST_CHRONO_BASIC_SECONDS_CLOCK_H_INCLUDED -#define BEAST_CHRONO_BASIC_SECONDS_CLOCK_H_INCLUDED +#pragma once #include @@ -33,5 +32,3 @@ public: }; } // namespace beast - -#endif diff --git a/include/xrpl/beast/clock/manual_clock.h b/include/xrpl/beast/clock/manual_clock.h index 975656cf63..a301b4e1fe 100644 --- a/include/xrpl/beast/clock/manual_clock.h +++ b/include/xrpl/beast/clock/manual_clock.h @@ -1,5 +1,4 @@ -#ifndef BEAST_CHRONO_MANUAL_CLOCK_H_INCLUDED -#define BEAST_CHRONO_MANUAL_CLOCK_H_INCLUDED +#pragma once #include #include @@ -75,5 +74,3 @@ public: }; } // namespace beast - -#endif diff --git a/include/xrpl/beast/container/aged_container.h b/include/xrpl/beast/container/aged_container.h index 6051db7f69..dd622fcd9a 100644 --- a/include/xrpl/beast/container/aged_container.h +++ b/include/xrpl/beast/container/aged_container.h @@ -1,5 +1,4 @@ -#ifndef BEAST_CONTAINER_AGED_CONTAINER_H_INCLUDED -#define BEAST_CONTAINER_AGED_CONTAINER_H_INCLUDED +#pragma once #include @@ -12,5 +11,3 @@ struct is_aged_container : std::false_type }; } // namespace beast - -#endif diff --git a/include/xrpl/beast/container/aged_container_utility.h b/include/xrpl/beast/container/aged_container_utility.h index 8847fcb321..fd5d481aa5 100644 --- a/include/xrpl/beast/container/aged_container_utility.h +++ b/include/xrpl/beast/container/aged_container_utility.h @@ -1,5 +1,4 @@ -#ifndef BEAST_CONTAINER_AGED_CONTAINER_UTILITY_H_INCLUDED -#define BEAST_CONTAINER_AGED_CONTAINER_UTILITY_H_INCLUDED +#pragma once #include @@ -24,5 +23,3 @@ expire(AgedContainer& c, std::chrono::duration const& age) } } // namespace beast - -#endif diff --git a/include/xrpl/beast/container/aged_map.h b/include/xrpl/beast/container/aged_map.h index f3bc59943d..e9505f2763 100644 --- a/include/xrpl/beast/container/aged_map.h +++ b/include/xrpl/beast/container/aged_map.h @@ -1,5 +1,4 @@ -#ifndef BEAST_CONTAINER_AGED_MAP_H_INCLUDED -#define BEAST_CONTAINER_AGED_MAP_H_INCLUDED +#pragma once #include @@ -18,5 +17,3 @@ template < using aged_map = detail::aged_ordered_container; } - -#endif diff --git a/include/xrpl/beast/container/aged_multimap.h b/include/xrpl/beast/container/aged_multimap.h index 3602996602..7625694f66 100644 --- a/include/xrpl/beast/container/aged_multimap.h +++ b/include/xrpl/beast/container/aged_multimap.h @@ -1,5 +1,4 @@ -#ifndef BEAST_CONTAINER_AGED_MULTIMAP_H_INCLUDED -#define BEAST_CONTAINER_AGED_MULTIMAP_H_INCLUDED +#pragma once #include @@ -18,5 +17,3 @@ template < using aged_multimap = detail::aged_ordered_container; } - -#endif diff --git a/include/xrpl/beast/container/aged_multiset.h b/include/xrpl/beast/container/aged_multiset.h index 851dd8fa6e..2ad09344e5 100644 --- a/include/xrpl/beast/container/aged_multiset.h +++ b/include/xrpl/beast/container/aged_multiset.h @@ -1,5 +1,4 @@ -#ifndef BEAST_CONTAINER_AGED_MULTISET_H_INCLUDED -#define BEAST_CONTAINER_AGED_MULTISET_H_INCLUDED +#pragma once #include @@ -17,5 +16,3 @@ template < using aged_multiset = detail::aged_ordered_container; } - -#endif diff --git a/include/xrpl/beast/container/aged_set.h b/include/xrpl/beast/container/aged_set.h index 99b2c58bf6..2c601f5f41 100644 --- a/include/xrpl/beast/container/aged_set.h +++ b/include/xrpl/beast/container/aged_set.h @@ -1,5 +1,4 @@ -#ifndef BEAST_CONTAINER_AGED_SET_H_INCLUDED -#define BEAST_CONTAINER_AGED_SET_H_INCLUDED +#pragma once #include @@ -17,5 +16,3 @@ template < using aged_set = detail::aged_ordered_container; } - -#endif diff --git a/include/xrpl/beast/container/aged_unordered_map.h b/include/xrpl/beast/container/aged_unordered_map.h index 26e41534d3..116d5669a1 100644 --- a/include/xrpl/beast/container/aged_unordered_map.h +++ b/include/xrpl/beast/container/aged_unordered_map.h @@ -1,5 +1,4 @@ -#ifndef BEAST_CONTAINER_AGED_UNORDERED_MAP_H_INCLUDED -#define BEAST_CONTAINER_AGED_UNORDERED_MAP_H_INCLUDED +#pragma once #include @@ -19,5 +18,3 @@ template < using aged_unordered_map = detail::aged_unordered_container; } - -#endif diff --git a/include/xrpl/beast/container/aged_unordered_multimap.h b/include/xrpl/beast/container/aged_unordered_multimap.h index 3202aef27d..4c3333a099 100644 --- a/include/xrpl/beast/container/aged_unordered_multimap.h +++ b/include/xrpl/beast/container/aged_unordered_multimap.h @@ -1,5 +1,4 @@ -#ifndef BEAST_CONTAINER_AGED_UNORDERED_MULTIMAP_H_INCLUDED -#define BEAST_CONTAINER_AGED_UNORDERED_MULTIMAP_H_INCLUDED +#pragma once #include @@ -19,5 +18,3 @@ template < using aged_unordered_multimap = detail::aged_unordered_container; } - -#endif diff --git a/include/xrpl/beast/container/aged_unordered_multiset.h b/include/xrpl/beast/container/aged_unordered_multiset.h index b42cad6a2f..b251f20077 100644 --- a/include/xrpl/beast/container/aged_unordered_multiset.h +++ b/include/xrpl/beast/container/aged_unordered_multiset.h @@ -1,5 +1,4 @@ -#ifndef BEAST_CONTAINER_AGED_UNORDERED_MULTISET_H_INCLUDED -#define BEAST_CONTAINER_AGED_UNORDERED_MULTISET_H_INCLUDED +#pragma once #include @@ -19,5 +18,3 @@ using aged_unordered_multiset = detail::aged_unordered_container; } - -#endif diff --git a/include/xrpl/beast/container/aged_unordered_set.h b/include/xrpl/beast/container/aged_unordered_set.h index d095408849..a8ee61f1f5 100644 --- a/include/xrpl/beast/container/aged_unordered_set.h +++ b/include/xrpl/beast/container/aged_unordered_set.h @@ -1,5 +1,4 @@ -#ifndef BEAST_CONTAINER_AGED_UNORDERED_SET_H_INCLUDED -#define BEAST_CONTAINER_AGED_UNORDERED_SET_H_INCLUDED +#pragma once #include @@ -18,5 +17,3 @@ template < using aged_unordered_set = detail::aged_unordered_container; } - -#endif diff --git a/include/xrpl/beast/container/detail/aged_associative_container.h b/include/xrpl/beast/container/detail/aged_associative_container.h index ab08484aa3..34e9560cbb 100644 --- a/include/xrpl/beast/container/detail/aged_associative_container.h +++ b/include/xrpl/beast/container/detail/aged_associative_container.h @@ -1,5 +1,4 @@ -#ifndef BEAST_CONTAINER_DETAIL_AGED_ASSOCIATIVE_CONTAINER_H_INCLUDED -#define BEAST_CONTAINER_DETAIL_AGED_ASSOCIATIVE_CONTAINER_H_INCLUDED +#pragma once namespace beast { namespace detail { @@ -33,5 +32,3 @@ struct aged_associative_container_extract_t } // namespace detail } // namespace beast - -#endif diff --git a/include/xrpl/beast/container/detail/aged_container_iterator.h b/include/xrpl/beast/container/detail/aged_container_iterator.h index 5cee583d74..12cd15f677 100644 --- a/include/xrpl/beast/container/detail/aged_container_iterator.h +++ b/include/xrpl/beast/container/detail/aged_container_iterator.h @@ -1,5 +1,4 @@ -#ifndef BEAST_CONTAINER_DETAIL_AGED_CONTAINER_ITERATOR_H_INCLUDED -#define BEAST_CONTAINER_DETAIL_AGED_CONTAINER_ITERATOR_H_INCLUDED +#pragma once #include #include @@ -146,5 +145,3 @@ private: } // namespace detail } // namespace beast - -#endif diff --git a/include/xrpl/beast/container/detail/aged_ordered_container.h b/include/xrpl/beast/container/detail/aged_ordered_container.h index d4ba81f0b8..2f3d8973e9 100644 --- a/include/xrpl/beast/container/detail/aged_ordered_container.h +++ b/include/xrpl/beast/container/detail/aged_ordered_container.h @@ -1,5 +1,4 @@ -#ifndef BEAST_CONTAINER_DETAIL_AGED_ORDERED_CONTAINER_H_INCLUDED -#define BEAST_CONTAINER_DETAIL_AGED_ORDERED_CONTAINER_H_INCLUDED +#pragma once #include #include @@ -1687,5 +1686,3 @@ expire( } } // namespace beast - -#endif diff --git a/include/xrpl/beast/container/detail/aged_unordered_container.h b/include/xrpl/beast/container/detail/aged_unordered_container.h index 96dd196f32..a73ec107a7 100644 --- a/include/xrpl/beast/container/detail/aged_unordered_container.h +++ b/include/xrpl/beast/container/detail/aged_unordered_container.h @@ -1,5 +1,4 @@ -#ifndef BEAST_CONTAINER_DETAIL_AGED_UNORDERED_CONTAINER_H_INCLUDED -#define BEAST_CONTAINER_DETAIL_AGED_UNORDERED_CONTAINER_H_INCLUDED +#pragma once #include #include @@ -2226,5 +2225,3 @@ expire( } } // namespace beast - -#endif diff --git a/include/xrpl/beast/container/detail/empty_base_optimization.h b/include/xrpl/beast/container/detail/empty_base_optimization.h index 9f3a2ffdf2..21a9d13ce8 100644 --- a/include/xrpl/beast/container/detail/empty_base_optimization.h +++ b/include/xrpl/beast/container/detail/empty_base_optimization.h @@ -4,8 +4,7 @@ // Official repository: https://github.com/boostorg/beast // -#ifndef BEAST_CONTAINER_DETAIL_EMPTY_BASE_OPTIMIZATION_H_INCLUDED -#define BEAST_CONTAINER_DETAIL_EMPTY_BASE_OPTIMIZATION_H_INCLUDED +#pragma once #include @@ -89,5 +88,3 @@ public: } // namespace detail } // namespace beast - -#endif diff --git a/include/xrpl/beast/core/CurrentThreadName.h b/include/xrpl/beast/core/CurrentThreadName.h index 87fa042f81..8e99ee90da 100644 --- a/include/xrpl/beast/core/CurrentThreadName.h +++ b/include/xrpl/beast/core/CurrentThreadName.h @@ -2,8 +2,7 @@ // Copyright (c) 2013 - Raw Material Software Ltd. // Please visit http://www.juce.com -#ifndef BEAST_CORE_CURRENT_THREAD_NAME_H_INCLUDED -#define BEAST_CORE_CURRENT_THREAD_NAME_H_INCLUDED +#pragma once #include @@ -53,5 +52,3 @@ std::string getCurrentThreadName(); } // namespace beast - -#endif diff --git a/include/xrpl/beast/core/LexicalCast.h b/include/xrpl/beast/core/LexicalCast.h index b0322614b5..a7c135f23f 100644 --- a/include/xrpl/beast/core/LexicalCast.h +++ b/include/xrpl/beast/core/LexicalCast.h @@ -1,5 +1,4 @@ -#ifndef BEAST_MODULE_CORE_TEXT_LEXICALCAST_H_INCLUDED -#define BEAST_MODULE_CORE_TEXT_LEXICALCAST_H_INCLUDED +#pragma once #include @@ -208,5 +207,3 @@ lexicalCast(In in, Out defaultValue = Out()) } } // namespace beast - -#endif diff --git a/include/xrpl/beast/core/List.h b/include/xrpl/beast/core/List.h index edd1b4530f..75c981ea1b 100644 --- a/include/xrpl/beast/core/List.h +++ b/include/xrpl/beast/core/List.h @@ -1,5 +1,4 @@ -#ifndef BEAST_INTRUSIVE_LIST_H_INCLUDED -#define BEAST_INTRUSIVE_LIST_H_INCLUDED +#pragma once #include @@ -574,5 +573,3 @@ private: }; } // namespace beast - -#endif diff --git a/include/xrpl/beast/core/LockFreeStack.h b/include/xrpl/beast/core/LockFreeStack.h index 7e358dccbd..bb32698dd8 100644 --- a/include/xrpl/beast/core/LockFreeStack.h +++ b/include/xrpl/beast/core/LockFreeStack.h @@ -1,5 +1,4 @@ -#ifndef BEAST_INTRUSIVE_LOCKFREESTACK_H_INCLUDED -#define BEAST_INTRUSIVE_LOCKFREESTACK_H_INCLUDED +#pragma once #include #include @@ -268,5 +267,3 @@ private: }; } // namespace beast - -#endif diff --git a/include/xrpl/beast/core/SemanticVersion.h b/include/xrpl/beast/core/SemanticVersion.h index fabda8290f..1d3525de25 100644 --- a/include/xrpl/beast/core/SemanticVersion.h +++ b/include/xrpl/beast/core/SemanticVersion.h @@ -1,5 +1,4 @@ -#ifndef BEAST_MODULE_CORE_DIAGNOSTIC_SEMANTICVERSION_H_INCLUDED -#define BEAST_MODULE_CORE_DIAGNOSTIC_SEMANTICVERSION_H_INCLUDED +#pragma once #include #include @@ -95,5 +94,3 @@ operator<(SemanticVersion const& lhs, SemanticVersion const& rhs) } } // namespace beast - -#endif diff --git a/include/xrpl/beast/hash/hash_append.h b/include/xrpl/beast/hash/hash_append.h index f69931cb96..e4d646e532 100644 --- a/include/xrpl/beast/hash/hash_append.h +++ b/include/xrpl/beast/hash/hash_append.h @@ -1,5 +1,4 @@ -#ifndef BEAST_HASH_HASH_APPEND_H_INCLUDED -#define BEAST_HASH_HASH_APPEND_H_INCLUDED +#pragma once #include #include @@ -440,5 +439,3 @@ hash_append(HashAlgorithm& h, std::error_code const& ec) } } // namespace beast - -#endif diff --git a/include/xrpl/beast/hash/uhash.h b/include/xrpl/beast/hash/uhash.h index c167412e3a..4f66f058a8 100644 --- a/include/xrpl/beast/hash/uhash.h +++ b/include/xrpl/beast/hash/uhash.h @@ -1,5 +1,4 @@ -#ifndef BEAST_HASH_UHASH_H_INCLUDED -#define BEAST_HASH_UHASH_H_INCLUDED +#pragma once #include #include @@ -25,5 +24,3 @@ struct uhash }; } // namespace beast - -#endif diff --git a/include/xrpl/beast/hash/xxhasher.h b/include/xrpl/beast/hash/xxhasher.h index 098551f02e..473907ea89 100644 --- a/include/xrpl/beast/hash/xxhasher.h +++ b/include/xrpl/beast/hash/xxhasher.h @@ -1,5 +1,4 @@ -#ifndef BEAST_HASH_XXHASHER_H_INCLUDED -#define BEAST_HASH_XXHASHER_H_INCLUDED +#pragma once #include @@ -152,5 +151,3 @@ public: }; } // namespace beast - -#endif diff --git a/include/xrpl/beast/insight/Collector.h b/include/xrpl/beast/insight/Collector.h index 045d9003a9..89aa8c1cb5 100644 --- a/include/xrpl/beast/insight/Collector.h +++ b/include/xrpl/beast/insight/Collector.h @@ -1,5 +1,4 @@ -#ifndef BEAST_INSIGHT_COLLECTOR_H_INCLUDED -#define BEAST_INSIGHT_COLLECTOR_H_INCLUDED +#pragma once #include #include @@ -120,5 +119,3 @@ public: } // namespace insight } // namespace beast - -#endif diff --git a/include/xrpl/beast/insight/Counter.h b/include/xrpl/beast/insight/Counter.h index e1b8c36545..f6722c4e03 100644 --- a/include/xrpl/beast/insight/Counter.h +++ b/include/xrpl/beast/insight/Counter.h @@ -1,5 +1,4 @@ -#ifndef BEAST_INSIGHT_COUNTER_H_INCLUDED -#define BEAST_INSIGHT_COUNTER_H_INCLUDED +#pragma once #include @@ -94,5 +93,3 @@ private: } // namespace insight } // namespace beast - -#endif diff --git a/include/xrpl/beast/insight/CounterImpl.h b/include/xrpl/beast/insight/CounterImpl.h index 409cfe07a7..199315dcb8 100644 --- a/include/xrpl/beast/insight/CounterImpl.h +++ b/include/xrpl/beast/insight/CounterImpl.h @@ -1,5 +1,4 @@ -#ifndef BEAST_INSIGHT_COUNTERIMPL_H_INCLUDED -#define BEAST_INSIGHT_COUNTERIMPL_H_INCLUDED +#pragma once #include #include @@ -21,5 +20,3 @@ public: } // namespace insight } // namespace beast - -#endif diff --git a/include/xrpl/beast/insight/Event.h b/include/xrpl/beast/insight/Event.h index c375c34f9c..bc0c0dd403 100644 --- a/include/xrpl/beast/insight/Event.h +++ b/include/xrpl/beast/insight/Event.h @@ -1,5 +1,4 @@ -#ifndef BEAST_INSIGHT_EVENT_H_INCLUDED -#define BEAST_INSIGHT_EVENT_H_INCLUDED +#pragma once #include @@ -61,5 +60,3 @@ private: } // namespace insight } // namespace beast - -#endif diff --git a/include/xrpl/beast/insight/EventImpl.h b/include/xrpl/beast/insight/EventImpl.h index cec378e71e..abd9741511 100644 --- a/include/xrpl/beast/insight/EventImpl.h +++ b/include/xrpl/beast/insight/EventImpl.h @@ -1,5 +1,4 @@ -#ifndef BEAST_INSIGHT_EVENTIMPL_H_INCLUDED -#define BEAST_INSIGHT_EVENTIMPL_H_INCLUDED +#pragma once #include #include @@ -21,5 +20,3 @@ public: } // namespace insight } // namespace beast - -#endif diff --git a/include/xrpl/beast/insight/Gauge.h b/include/xrpl/beast/insight/Gauge.h index c9c1b64cda..f2a88deda2 100644 --- a/include/xrpl/beast/insight/Gauge.h +++ b/include/xrpl/beast/insight/Gauge.h @@ -1,5 +1,4 @@ -#ifndef BEAST_INSIGHT_GAUGE_H_INCLUDED -#define BEAST_INSIGHT_GAUGE_H_INCLUDED +#pragma once #include @@ -124,5 +123,3 @@ private: } // namespace insight } // namespace beast - -#endif diff --git a/include/xrpl/beast/insight/GaugeImpl.h b/include/xrpl/beast/insight/GaugeImpl.h index c20d93744d..29afbe6a4d 100644 --- a/include/xrpl/beast/insight/GaugeImpl.h +++ b/include/xrpl/beast/insight/GaugeImpl.h @@ -1,5 +1,4 @@ -#ifndef BEAST_INSIGHT_GAUGEIMPL_H_INCLUDED -#define BEAST_INSIGHT_GAUGEIMPL_H_INCLUDED +#pragma once #include #include @@ -24,5 +23,3 @@ public: } // namespace insight } // namespace beast - -#endif diff --git a/include/xrpl/beast/insight/Group.h b/include/xrpl/beast/insight/Group.h index 8119b4004f..c85fd1bfb6 100644 --- a/include/xrpl/beast/insight/Group.h +++ b/include/xrpl/beast/insight/Group.h @@ -1,5 +1,4 @@ -#ifndef BEAST_INSIGHT_GROUP_H_INCLUDED -#define BEAST_INSIGHT_GROUP_H_INCLUDED +#pragma once #include @@ -22,5 +21,3 @@ public: } // namespace insight } // namespace beast - -#endif diff --git a/include/xrpl/beast/insight/Groups.h b/include/xrpl/beast/insight/Groups.h index 2fc996fcf8..8ac93454d3 100644 --- a/include/xrpl/beast/insight/Groups.h +++ b/include/xrpl/beast/insight/Groups.h @@ -1,5 +1,4 @@ -#ifndef BEAST_INSIGHT_GROUPS_H_INCLUDED -#define BEAST_INSIGHT_GROUPS_H_INCLUDED +#pragma once #include #include @@ -35,5 +34,3 @@ make_Groups(Collector::ptr const& collector); } // namespace insight } // namespace beast - -#endif diff --git a/include/xrpl/beast/insight/Hook.h b/include/xrpl/beast/insight/Hook.h index 1dc4cd0c74..ea511862d9 100644 --- a/include/xrpl/beast/insight/Hook.h +++ b/include/xrpl/beast/insight/Hook.h @@ -1,5 +1,4 @@ -#ifndef BEAST_INSIGHT_HOOK_H_INCLUDED -#define BEAST_INSIGHT_HOOK_H_INCLUDED +#pragma once #include @@ -40,5 +39,3 @@ private: } // namespace insight } // namespace beast - -#endif diff --git a/include/xrpl/beast/insight/HookImpl.h b/include/xrpl/beast/insight/HookImpl.h index dadbc6d106..18208b554a 100644 --- a/include/xrpl/beast/insight/HookImpl.h +++ b/include/xrpl/beast/insight/HookImpl.h @@ -1,5 +1,4 @@ -#ifndef BEAST_INSIGHT_HOOKIMPL_H_INCLUDED -#define BEAST_INSIGHT_HOOKIMPL_H_INCLUDED +#pragma once #include #include @@ -17,5 +16,3 @@ public: } // namespace insight } // namespace beast - -#endif diff --git a/include/xrpl/beast/insight/Insight.h b/include/xrpl/beast/insight/Insight.h index c298510291..bf3743cfd8 100644 --- a/include/xrpl/beast/insight/Insight.h +++ b/include/xrpl/beast/insight/Insight.h @@ -1,5 +1,4 @@ -#ifndef BEAST_INSIGHT_H_INCLUDED -#define BEAST_INSIGHT_H_INCLUDED +#pragma once #include #include @@ -14,5 +13,3 @@ #include #include #include - -#endif diff --git a/include/xrpl/beast/insight/Meter.h b/include/xrpl/beast/insight/Meter.h index 34aa4c59d4..193a1f1003 100644 --- a/include/xrpl/beast/insight/Meter.h +++ b/include/xrpl/beast/insight/Meter.h @@ -1,5 +1,4 @@ -#ifndef BEAST_INSIGHT_METER_H_INCLUDED -#define BEAST_INSIGHT_METER_H_INCLUDED +#pragma once #include @@ -79,5 +78,3 @@ private: } // namespace insight } // namespace beast - -#endif diff --git a/include/xrpl/beast/insight/MeterImpl.h b/include/xrpl/beast/insight/MeterImpl.h index c50dc07295..22efdbe647 100644 --- a/include/xrpl/beast/insight/MeterImpl.h +++ b/include/xrpl/beast/insight/MeterImpl.h @@ -1,5 +1,4 @@ -#ifndef BEAST_INSIGHT_METERIMPL_H_INCLUDED -#define BEAST_INSIGHT_METERIMPL_H_INCLUDED +#pragma once #include #include @@ -21,5 +20,3 @@ public: } // namespace insight } // namespace beast - -#endif diff --git a/include/xrpl/beast/insight/NullCollector.h b/include/xrpl/beast/insight/NullCollector.h index 6c4413007b..1d16a11e17 100644 --- a/include/xrpl/beast/insight/NullCollector.h +++ b/include/xrpl/beast/insight/NullCollector.h @@ -1,5 +1,4 @@ -#ifndef BEAST_INSIGHT_NULLCOLLECTOR_H_INCLUDED -#define BEAST_INSIGHT_NULLCOLLECTOR_H_INCLUDED +#pragma once #include @@ -18,5 +17,3 @@ public: } // namespace insight } // namespace beast - -#endif diff --git a/include/xrpl/beast/insight/StatsDCollector.h b/include/xrpl/beast/insight/StatsDCollector.h index 9c63ab4ed9..ab09967483 100644 --- a/include/xrpl/beast/insight/StatsDCollector.h +++ b/include/xrpl/beast/insight/StatsDCollector.h @@ -1,5 +1,4 @@ -#ifndef BEAST_INSIGHT_STATSDCOLLECTOR_H_INCLUDED -#define BEAST_INSIGHT_STATSDCOLLECTOR_H_INCLUDED +#pragma once #include #include @@ -28,5 +27,3 @@ public: } // namespace insight } // namespace beast - -#endif diff --git a/include/xrpl/beast/net/IPAddress.h b/include/xrpl/beast/net/IPAddress.h index c3c7ee3d56..2ac4c3bc43 100644 --- a/include/xrpl/beast/net/IPAddress.h +++ b/include/xrpl/beast/net/IPAddress.h @@ -1,5 +1,4 @@ -#ifndef BEAST_NET_IPADDRESS_H_INCLUDED -#define BEAST_NET_IPADDRESS_H_INCLUDED +#pragma once #include #include @@ -96,5 +95,3 @@ struct hash<::beast::IP::Address> } }; } // namespace boost - -#endif diff --git a/include/xrpl/beast/net/IPAddressConversion.h b/include/xrpl/beast/net/IPAddressConversion.h index e05ae8541f..2ebd0a6eef 100644 --- a/include/xrpl/beast/net/IPAddressConversion.h +++ b/include/xrpl/beast/net/IPAddressConversion.h @@ -1,5 +1,4 @@ -#ifndef BEAST_NET_IPADDRESSCONVERSION_H_INCLUDED -#define BEAST_NET_IPADDRESSCONVERSION_H_INCLUDED +#pragma once #include @@ -61,5 +60,3 @@ struct IPAddressConversion }; } // namespace beast - -#endif diff --git a/include/xrpl/beast/net/IPAddressV4.h b/include/xrpl/beast/net/IPAddressV4.h index c654db85c0..0d586716d8 100644 --- a/include/xrpl/beast/net/IPAddressV4.h +++ b/include/xrpl/beast/net/IPAddressV4.h @@ -1,5 +1,4 @@ -#ifndef BEAST_NET_IPADDRESSV4_H_INCLUDED -#define BEAST_NET_IPADDRESSV4_H_INCLUDED +#pragma once #include @@ -26,5 +25,3 @@ get_class(AddressV4 const& address); } // namespace IP } // namespace beast - -#endif diff --git a/include/xrpl/beast/net/IPAddressV6.h b/include/xrpl/beast/net/IPAddressV6.h index a4f9c20f16..2f9dedb748 100644 --- a/include/xrpl/beast/net/IPAddressV6.h +++ b/include/xrpl/beast/net/IPAddressV6.h @@ -1,5 +1,4 @@ -#ifndef BEAST_NET_IPADDRESSV6_H_INCLUDED -#define BEAST_NET_IPADDRESSV6_H_INCLUDED +#pragma once #include @@ -20,5 +19,3 @@ is_public(AddressV6 const& addr); } // namespace IP } // namespace beast - -#endif diff --git a/include/xrpl/beast/net/IPEndpoint.h b/include/xrpl/beast/net/IPEndpoint.h index 3d09e7f8e6..7a0394cbd1 100644 --- a/include/xrpl/beast/net/IPEndpoint.h +++ b/include/xrpl/beast/net/IPEndpoint.h @@ -1,5 +1,4 @@ -#ifndef BEAST_NET_IPENDPOINT_H_INCLUDED -#define BEAST_NET_IPENDPOINT_H_INCLUDED +#pragma once #include #include @@ -219,5 +218,3 @@ struct hash<::beast::IP::Endpoint> } }; } // namespace boost - -#endif diff --git a/include/xrpl/beast/rfc2616.h b/include/xrpl/beast/rfc2616.h index 922e4a7dc4..2ff770c011 100644 --- a/include/xrpl/beast/rfc2616.h +++ b/include/xrpl/beast/rfc2616.h @@ -1,5 +1,4 @@ -#ifndef BEAST_RFC2616_HPP -#define BEAST_RFC2616_HPP +#pragma once #include #include @@ -363,5 +362,3 @@ is_keep_alive(boost::beast::http::message const& m) } // namespace rfc2616 } // namespace beast - -#endif diff --git a/include/xrpl/beast/test/yield_to.h b/include/xrpl/beast/test/yield_to.h index b20661bdca..b10530c0d3 100644 --- a/include/xrpl/beast/test/yield_to.h +++ b/include/xrpl/beast/test/yield_to.h @@ -2,8 +2,7 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#ifndef BEAST_TEST_YIELD_TO_HPP -#define BEAST_TEST_YIELD_TO_HPP +#pragma once #include #include @@ -127,5 +126,3 @@ enable_yield_to::spawn(F0&& f, FN&&... fn) } // namespace test } // namespace beast - -#endif diff --git a/include/xrpl/beast/type_name.h b/include/xrpl/beast/type_name.h index 1534af5eda..99b90d1757 100644 --- a/include/xrpl/beast/type_name.h +++ b/include/xrpl/beast/type_name.h @@ -1,5 +1,4 @@ -#ifndef BEAST_TYPE_NAME_H_INCLUDED -#define BEAST_TYPE_NAME_H_INCLUDED +#pragma once #include #include @@ -41,5 +40,3 @@ type_name() } } // namespace beast - -#endif diff --git a/include/xrpl/beast/unit_test.h b/include/xrpl/beast/unit_test.h index 721faef6f0..51ac96cacb 100644 --- a/include/xrpl/beast/unit_test.h +++ b/include/xrpl/beast/unit_test.h @@ -1,5 +1,4 @@ -#ifndef BEAST_UNIT_TEST_H_INCLUDED -#define BEAST_UNIT_TEST_H_INCLUDED +#pragma once #include #include @@ -19,5 +18,3 @@ //__LINE__);}while(false){} #define BEAST_EXPECT(cond) expect(cond, __FILE__ ":" BEAST_EXPECT_S2(__LINE__)) #endif - -#endif diff --git a/include/xrpl/beast/unit_test/amount.h b/include/xrpl/beast/unit_test/amount.h index 5082361fa6..aedced15a7 100644 --- a/include/xrpl/beast/unit_test/amount.h +++ b/include/xrpl/beast/unit_test/amount.h @@ -2,8 +2,7 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#ifndef BEAST_UNIT_TEST_AMOUNT_HPP -#define BEAST_UNIT_TEST_AMOUNT_HPP +#pragma once #include #include @@ -45,5 +44,3 @@ operator<<(std::ostream& s, amount const& t) } // namespace unit_test } // namespace beast - -#endif diff --git a/include/xrpl/beast/unit_test/detail/const_container.h b/include/xrpl/beast/unit_test/detail/const_container.h index c1e8c03a27..7c52e0e1ec 100644 --- a/include/xrpl/beast/unit_test/detail/const_container.h +++ b/include/xrpl/beast/unit_test/detail/const_container.h @@ -2,8 +2,7 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#ifndef BEAST_UNIT_TEST_DETAIL_CONST_CONTAINER_HPP -#define BEAST_UNIT_TEST_DETAIL_CONST_CONTAINER_HPP +#pragma once namespace beast { namespace unit_test { @@ -86,5 +85,3 @@ public: } // namespace detail } // namespace unit_test } // namespace beast - -#endif diff --git a/include/xrpl/beast/unit_test/global_suites.h b/include/xrpl/beast/unit_test/global_suites.h index 0492d5fb4b..68b4e2ced8 100644 --- a/include/xrpl/beast/unit_test/global_suites.h +++ b/include/xrpl/beast/unit_test/global_suites.h @@ -2,8 +2,7 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#ifndef BEAST_UNIT_TEST_GLOBAL_SUITES_HPP -#define BEAST_UNIT_TEST_GLOBAL_SUITES_HPP +#pragma once #include @@ -40,5 +39,3 @@ global_suites() } // namespace unit_test } // namespace beast - -#endif diff --git a/include/xrpl/beast/unit_test/match.h b/include/xrpl/beast/unit_test/match.h index d88ccb7497..38816bb5c7 100644 --- a/include/xrpl/beast/unit_test/match.h +++ b/include/xrpl/beast/unit_test/match.h @@ -2,8 +2,7 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#ifndef BEAST_UNIT_TEST_MATCH_HPP -#define BEAST_UNIT_TEST_MATCH_HPP +#pragma once #include @@ -166,5 +165,3 @@ match_library(std::string const& name) } // namespace unit_test } // namespace beast - -#endif diff --git a/include/xrpl/beast/unit_test/recorder.h b/include/xrpl/beast/unit_test/recorder.h index 78b376f519..8f956fda88 100644 --- a/include/xrpl/beast/unit_test/recorder.h +++ b/include/xrpl/beast/unit_test/recorder.h @@ -2,8 +2,7 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#ifndef BEAST_UNIT_TEST_RECORDER_HPP -#define BEAST_UNIT_TEST_RECORDER_HPP +#pragma once #include #include @@ -76,5 +75,3 @@ private: } // namespace unit_test } // namespace beast - -#endif diff --git a/include/xrpl/beast/unit_test/reporter.h b/include/xrpl/beast/unit_test/reporter.h index adec49c8d4..ee7168d039 100644 --- a/include/xrpl/beast/unit_test/reporter.h +++ b/include/xrpl/beast/unit_test/reporter.h @@ -2,8 +2,7 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#ifndef BEAST_UNIT_TEST_REPORTER_HPP -#define BEAST_UNIT_TEST_REPORTER_HPP +#pragma once #include #include @@ -248,5 +247,3 @@ using reporter = detail::reporter<>; } // namespace unit_test } // namespace beast - -#endif diff --git a/include/xrpl/beast/unit_test/results.h b/include/xrpl/beast/unit_test/results.h index 478812eff9..cbd0a71057 100644 --- a/include/xrpl/beast/unit_test/results.h +++ b/include/xrpl/beast/unit_test/results.h @@ -2,8 +2,7 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#ifndef BEAST_UNIT_TEST_RESULTS_HPP -#define BEAST_UNIT_TEST_RESULTS_HPP +#pragma once #include @@ -222,5 +221,3 @@ public: } // namespace unit_test } // namespace beast - -#endif diff --git a/include/xrpl/beast/unit_test/runner.h b/include/xrpl/beast/unit_test/runner.h index f91cc92c91..90d8a2f4b5 100644 --- a/include/xrpl/beast/unit_test/runner.h +++ b/include/xrpl/beast/unit_test/runner.h @@ -2,8 +2,7 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#ifndef BEAST_UNIT_TEST_RUNNER_H_INCLUDED -#define BEAST_UNIT_TEST_RUNNER_H_INCLUDED +#pragma once #include @@ -276,5 +275,3 @@ runner::log(std::string const& s) } // namespace unit_test } // namespace beast - -#endif diff --git a/include/xrpl/beast/unit_test/suite.h b/include/xrpl/beast/unit_test/suite.h index 70c2d49fbd..0e6b592a87 100644 --- a/include/xrpl/beast/unit_test/suite.h +++ b/include/xrpl/beast/unit_test/suite.h @@ -2,8 +2,7 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#ifndef BEAST_UNIT_TEST_SUITE_HPP -#define BEAST_UNIT_TEST_SUITE_HPP +#pragma once #include @@ -642,5 +641,3 @@ suite::run(runner& r) #endif //------------------------------------------------------------------------------ - -#endif diff --git a/include/xrpl/beast/unit_test/suite_info.h b/include/xrpl/beast/unit_test/suite_info.h index 5297c0e807..019251b0c4 100644 --- a/include/xrpl/beast/unit_test/suite_info.h +++ b/include/xrpl/beast/unit_test/suite_info.h @@ -2,8 +2,7 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#ifndef BEAST_UNIT_TEST_SUITE_INFO_HPP -#define BEAST_UNIT_TEST_SUITE_INFO_HPP +#pragma once #include #include @@ -100,5 +99,3 @@ make_suite_info(std::string name, std::string module, std::string library, bool } // namespace unit_test } // namespace beast - -#endif diff --git a/include/xrpl/beast/unit_test/suite_list.h b/include/xrpl/beast/unit_test/suite_list.h index 49bf37cbc6..4412883e31 100644 --- a/include/xrpl/beast/unit_test/suite_list.h +++ b/include/xrpl/beast/unit_test/suite_list.h @@ -2,8 +2,7 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#ifndef BEAST_UNIT_TEST_SUITE_LIST_HPP -#define BEAST_UNIT_TEST_SUITE_LIST_HPP +#pragma once #include #include @@ -60,5 +59,3 @@ suite_list::insert(char const* name, char const* module, char const* library, bo } // namespace unit_test } // namespace beast - -#endif diff --git a/include/xrpl/beast/unit_test/thread.h b/include/xrpl/beast/unit_test/thread.h index 27c3f85920..b49f8ed36e 100644 --- a/include/xrpl/beast/unit_test/thread.h +++ b/include/xrpl/beast/unit_test/thread.h @@ -2,8 +2,7 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#ifndef BEAST_UNIT_TEST_THREAD_HPP -#define BEAST_UNIT_TEST_THREAD_HPP +#pragma once #include @@ -111,5 +110,3 @@ private: } // namespace unit_test } // namespace beast - -#endif diff --git a/include/xrpl/beast/utility/Journal.h b/include/xrpl/beast/utility/Journal.h index 7eaf4a627a..dff88826ce 100644 --- a/include/xrpl/beast/utility/Journal.h +++ b/include/xrpl/beast/utility/Journal.h @@ -1,5 +1,4 @@ -#ifndef BEAST_UTILITY_JOURNAL_H_INCLUDED -#define BEAST_UTILITY_JOURNAL_H_INCLUDED +#pragma once #include @@ -431,5 +430,3 @@ using logstream = basic_logstream; using logwstream = basic_logstream; } // namespace beast - -#endif diff --git a/include/xrpl/beast/utility/PropertyStream.h b/include/xrpl/beast/utility/PropertyStream.h index de1fc567f3..3d29138a12 100644 --- a/include/xrpl/beast/utility/PropertyStream.h +++ b/include/xrpl/beast/utility/PropertyStream.h @@ -1,5 +1,4 @@ -#ifndef BEAST_UTILITY_PROPERTYSTREAM_H_INCLUDED -#define BEAST_UTILITY_PROPERTYSTREAM_H_INCLUDED +#pragma once #include @@ -408,5 +407,3 @@ public: }; } // namespace beast - -#endif diff --git a/include/xrpl/beast/utility/WrappedSink.h b/include/xrpl/beast/utility/WrappedSink.h index 7819134e01..bb8a1a6994 100644 --- a/include/xrpl/beast/utility/WrappedSink.h +++ b/include/xrpl/beast/utility/WrappedSink.h @@ -1,5 +1,4 @@ -#ifndef BEAST_UTILITY_WRAPPEDSINK_H_INCLUDED -#define BEAST_UTILITY_WRAPPEDSINK_H_INCLUDED +#pragma once #include @@ -80,5 +79,3 @@ public: }; } // namespace beast - -#endif diff --git a/include/xrpl/beast/utility/Zero.h b/include/xrpl/beast/utility/Zero.h index fbafc59a81..00e91a1a47 100644 --- a/include/xrpl/beast/utility/Zero.h +++ b/include/xrpl/beast/utility/Zero.h @@ -1,7 +1,6 @@ // Copyright (c) 2014, Tom Ritchford -#ifndef BEAST_UTILITY_ZERO_H_INCLUDED -#define BEAST_UTILITY_ZERO_H_INCLUDED +#pragma once namespace beast { @@ -144,5 +143,3 @@ operator<=(Zero, T const& t) } } // namespace beast - -#endif diff --git a/include/xrpl/beast/utility/instrumentation.h b/include/xrpl/beast/utility/instrumentation.h index b2dcd23a3a..0d0b2ce415 100644 --- a/include/xrpl/beast/utility/instrumentation.h +++ b/include/xrpl/beast/utility/instrumentation.h @@ -1,5 +1,4 @@ -#ifndef BEAST_UTILITY_INSTRUMENTATION_H_INCLUDED -#define BEAST_UTILITY_INSTRUMENTATION_H_INCLUDED +#pragma once #include @@ -51,5 +50,3 @@ // instrumentation macros - its name describes the condition which was _not_ // meant to happen, while name in other macros describes the condition that is // meant to happen (e.g. as in "assert that this happens"). - -#endif diff --git a/include/xrpl/beast/utility/maybe_const.h b/include/xrpl/beast/utility/maybe_const.h index 6c577d3c76..4aac7f018e 100644 --- a/include/xrpl/beast/utility/maybe_const.h +++ b/include/xrpl/beast/utility/maybe_const.h @@ -1,5 +1,4 @@ -#ifndef BEAST_UTILITY_MAYBE_CONST_H_INCLUDED -#define BEAST_UTILITY_MAYBE_CONST_H_INCLUDED +#pragma once #include @@ -19,5 +18,3 @@ template using maybe_const_t = typename maybe_const::type; } // namespace beast - -#endif diff --git a/include/xrpl/beast/utility/rngfill.h b/include/xrpl/beast/utility/rngfill.h index ba596b789b..7c694aac4f 100644 --- a/include/xrpl/beast/utility/rngfill.h +++ b/include/xrpl/beast/utility/rngfill.h @@ -1,5 +1,4 @@ -#ifndef BEAST_RANDOM_RNGFILL_H_INCLUDED -#define BEAST_RANDOM_RNGFILL_H_INCLUDED +#pragma once #include @@ -48,5 +47,3 @@ rngfill(std::array& a, Generator& g) } } // namespace beast - -#endif diff --git a/include/xrpl/beast/utility/temp_dir.h b/include/xrpl/beast/utility/temp_dir.h index 37f26b7fec..5aa7b28ac2 100644 --- a/include/xrpl/beast/utility/temp_dir.h +++ b/include/xrpl/beast/utility/temp_dir.h @@ -1,5 +1,4 @@ -#ifndef BEAST_UTILITY_TEMP_DIR_H_INCLUDED -#define BEAST_UTILITY_TEMP_DIR_H_INCLUDED +#pragma once #include @@ -62,5 +61,3 @@ public: }; } // namespace beast - -#endif diff --git a/include/xrpl/beast/xor_shift_engine.h b/include/xrpl/beast/xor_shift_engine.h index 7eab82ff43..d49cb08fc0 100644 --- a/include/xrpl/beast/xor_shift_engine.h +++ b/include/xrpl/beast/xor_shift_engine.h @@ -1,5 +1,4 @@ -#ifndef BEAST_RANDOM_XOR_SHIFT_ENGINE_H_INCLUDED -#define BEAST_RANDOM_XOR_SHIFT_ENGINE_H_INCLUDED +#pragma once #include #include @@ -95,5 +94,3 @@ xor_shift_engine<_>::murmurhash3(result_type x) -> result_type using xor_shift_engine = detail::xor_shift_engine<>; } // namespace beast - -#endif diff --git a/include/xrpl/core/ClosureCounter.h b/include/xrpl/core/ClosureCounter.h index 4127960276..6802a03f3d 100644 --- a/include/xrpl/core/ClosureCounter.h +++ b/include/xrpl/core/ClosureCounter.h @@ -1,5 +1,4 @@ -#ifndef XRPL_CORE_CLOSURE_COUNTER_H_INCLUDED -#define XRPL_CORE_CLOSURE_COUNTER_H_INCLUDED +#pragma once #include @@ -198,5 +197,3 @@ public: }; } // namespace xrpl - -#endif // XRPL_CORE_CLOSURE_COUNTER_H_INCLUDED diff --git a/include/xrpl/core/Coro.ipp b/include/xrpl/core/Coro.ipp index 40067a77e9..2853adf0de 100644 --- a/include/xrpl/core/Coro.ipp +++ b/include/xrpl/core/Coro.ipp @@ -1,5 +1,4 @@ -#ifndef XRPL_CORE_COROINL_H_INCLUDED -#define XRPL_CORE_COROINL_H_INCLUDED +#pragma once #include @@ -120,5 +119,3 @@ JobQueue::Coro::join() } } // namespace xrpl - -#endif diff --git a/include/xrpl/core/Job.h b/include/xrpl/core/Job.h index dd60391635..61651fd673 100644 --- a/include/xrpl/core/Job.h +++ b/include/xrpl/core/Job.h @@ -1,5 +1,4 @@ -#ifndef XRPL_CORE_JOB_H_INCLUDED -#define XRPL_CORE_JOB_H_INCLUDED +#pragma once #include #include @@ -128,5 +127,3 @@ private: using JobCounter = ClosureCounter; } // namespace xrpl - -#endif diff --git a/include/xrpl/core/JobQueue.h b/include/xrpl/core/JobQueue.h index 48c92146f2..b410e200e1 100644 --- a/include/xrpl/core/JobQueue.h +++ b/include/xrpl/core/JobQueue.h @@ -1,5 +1,4 @@ -#ifndef XRPL_CORE_JOBQUEUE_H_INCLUDED -#define XRPL_CORE_JOBQUEUE_H_INCLUDED +#pragma once #include #include @@ -402,5 +401,3 @@ JobQueue::postCoro(JobType t, std::string const& name, F&& f) } } // namespace xrpl - -#endif diff --git a/include/xrpl/core/JobTypeData.h b/include/xrpl/core/JobTypeData.h index e15e161e0e..cdcb19c316 100644 --- a/include/xrpl/core/JobTypeData.h +++ b/include/xrpl/core/JobTypeData.h @@ -1,5 +1,4 @@ -#ifndef XRPL_CORE_JOBTYPEDATA_H_INCLUDED -#define XRPL_CORE_JOBTYPEDATA_H_INCLUDED +#pragma once #include #include @@ -75,5 +74,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/core/JobTypeInfo.h b/include/xrpl/core/JobTypeInfo.h index e9525fed81..d4daa1ec68 100644 --- a/include/xrpl/core/JobTypeInfo.h +++ b/include/xrpl/core/JobTypeInfo.h @@ -1,5 +1,4 @@ -#ifndef XRPL_CORE_JOBTYPEINFO_H_INCLUDED -#define XRPL_CORE_JOBTYPEINFO_H_INCLUDED +#pragma once #include @@ -75,5 +74,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/core/JobTypes.h b/include/xrpl/core/JobTypes.h index 4a779507f1..88f98aad66 100644 --- a/include/xrpl/core/JobTypes.h +++ b/include/xrpl/core/JobTypes.h @@ -1,5 +1,4 @@ -#ifndef XRPL_CORE_JOBTYPES_H_INCLUDED -#define XRPL_CORE_JOBTYPES_H_INCLUDED +#pragma once #include #include @@ -160,5 +159,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/core/LoadEvent.h b/include/xrpl/core/LoadEvent.h index 8422fe883e..f94e1020bf 100644 --- a/include/xrpl/core/LoadEvent.h +++ b/include/xrpl/core/LoadEvent.h @@ -1,5 +1,4 @@ -#ifndef XRPL_CORE_LOADEVENT_H_INCLUDED -#define XRPL_CORE_LOADEVENT_H_INCLUDED +#pragma once #include #include @@ -66,5 +65,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/core/LoadMonitor.h b/include/xrpl/core/LoadMonitor.h index 3b79a0ea23..71fbf75d68 100644 --- a/include/xrpl/core/LoadMonitor.h +++ b/include/xrpl/core/LoadMonitor.h @@ -1,5 +1,4 @@ -#ifndef XRPL_CORE_LOADMONITOR_H_INCLUDED -#define XRPL_CORE_LOADMONITOR_H_INCLUDED +#pragma once #include #include @@ -66,5 +65,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/core/PerfLog.h b/include/xrpl/core/PerfLog.h index bc788f86b8..eebd41ae09 100644 --- a/include/xrpl/core/PerfLog.h +++ b/include/xrpl/core/PerfLog.h @@ -1,5 +1,4 @@ -#ifndef XRPL_CORE_PERFLOG_H -#define XRPL_CORE_PERFLOG_H +#pragma once #include #include @@ -178,5 +177,3 @@ measureDurationAndLog( } // namespace perf } // namespace xrpl - -#endif // XRPL_CORE_PERFLOG_H diff --git a/include/xrpl/core/ServiceRegistry.h b/include/xrpl/core/ServiceRegistry.h index a70d96292c..7147242339 100644 --- a/include/xrpl/core/ServiceRegistry.h +++ b/include/xrpl/core/ServiceRegistry.h @@ -1,5 +1,4 @@ -#ifndef XRPL_CORE_SERVICEREGISTRY_H_INCLUDED -#define XRPL_CORE_SERVICEREGISTRY_H_INCLUDED +#pragma once #include #include @@ -198,5 +197,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/core/detail/Workers.h b/include/xrpl/core/detail/Workers.h index 185586e859..c5df622fa1 100644 --- a/include/xrpl/core/detail/Workers.h +++ b/include/xrpl/core/detail/Workers.h @@ -1,5 +1,4 @@ -#ifndef XRPL_CORE_WORKERS_H_INCLUDED -#define XRPL_CORE_WORKERS_H_INCLUDED +#pragma once #include #include @@ -208,5 +207,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/core/detail/semaphore.h b/include/xrpl/core/detail/semaphore.h index 4249b3b860..fad3bf5e29 100644 --- a/include/xrpl/core/detail/semaphore.h +++ b/include/xrpl/core/detail/semaphore.h @@ -26,8 +26,7 @@ * version is updated. */ -#ifndef XRPL_CORE_SEMAPHORE_H_INCLUDED -#define XRPL_CORE_SEMAPHORE_H_INCLUDED +#pragma once #include #include @@ -88,5 +87,3 @@ public: using semaphore = basic_semaphore; } // namespace xrpl - -#endif diff --git a/include/xrpl/crypto/RFC1751.h b/include/xrpl/crypto/RFC1751.h index a413c2ac8a..64b3e08813 100644 --- a/include/xrpl/crypto/RFC1751.h +++ b/include/xrpl/crypto/RFC1751.h @@ -1,5 +1,4 @@ -#ifndef XRPL_CRYPTO_RFC1751_H_INCLUDED -#define XRPL_CRYPTO_RFC1751_H_INCLUDED +#pragma once #include #include @@ -43,5 +42,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/crypto/csprng.h b/include/xrpl/crypto/csprng.h index dc89da4f61..e5135c96d7 100644 --- a/include/xrpl/crypto/csprng.h +++ b/include/xrpl/crypto/csprng.h @@ -1,5 +1,4 @@ -#ifndef XRPL_CRYPTO_RANDOM_H_INCLUDED -#define XRPL_CRYPTO_RANDOM_H_INCLUDED +#pragma once #include @@ -71,5 +70,3 @@ csprng_engine& crypto_prng(); } // namespace xrpl - -#endif diff --git a/include/xrpl/crypto/secure_erase.h b/include/xrpl/crypto/secure_erase.h index 3ecde0c7fa..2815a8531a 100644 --- a/include/xrpl/crypto/secure_erase.h +++ b/include/xrpl/crypto/secure_erase.h @@ -1,5 +1,4 @@ -#ifndef XRPL_CRYPTO_SECURE_ERASE_H_INCLUDED -#define XRPL_CRYPTO_SECURE_ERASE_H_INCLUDED +#pragma once #include @@ -23,5 +22,3 @@ void secure_erase(void* dest, std::size_t bytes); } // namespace xrpl - -#endif diff --git a/include/xrpl/json/JsonPropertyStream.h b/include/xrpl/json/JsonPropertyStream.h index 54cfcbfa04..510ed72950 100644 --- a/include/xrpl/json/JsonPropertyStream.h +++ b/include/xrpl/json/JsonPropertyStream.h @@ -1,5 +1,4 @@ -#ifndef XRPL_JSON_JSONPROPERTYSTREAM_H_INCLUDED -#define XRPL_JSON_JSONPROPERTYSTREAM_H_INCLUDED +#pragma once #include #include @@ -67,5 +66,3 @@ protected: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/json/Output.h b/include/xrpl/json/Output.h index db990ab364..b0ba3fa6d4 100644 --- a/include/xrpl/json/Output.h +++ b/include/xrpl/json/Output.h @@ -1,5 +1,4 @@ -#ifndef XRPL_JSON_OUTPUT_H_INCLUDED -#define XRPL_JSON_OUTPUT_H_INCLUDED +#pragma once #include @@ -35,5 +34,3 @@ std::string jsonAsString(Json::Value const&); } // namespace Json - -#endif diff --git a/include/xrpl/json/Writer.h b/include/xrpl/json/Writer.h index ab52427a5b..e348e57825 100644 --- a/include/xrpl/json/Writer.h +++ b/include/xrpl/json/Writer.h @@ -1,5 +1,4 @@ -#ifndef XRPL_JSON_WRITER_H_INCLUDED -#define XRPL_JSON_WRITER_H_INCLUDED +#pragma once #include #include @@ -238,5 +237,3 @@ check(bool condition, std::string const& message) } } // namespace Json - -#endif diff --git a/include/xrpl/json/detail/json_assert.h b/include/xrpl/json/detail/json_assert.h index 3092b65452..e9a66ccef1 100644 --- a/include/xrpl/json/detail/json_assert.h +++ b/include/xrpl/json/detail/json_assert.h @@ -1,5 +1,4 @@ -#ifndef XRPL_JSON_JSON_ASSERT_H_INCLUDED -#define XRPL_JSON_JSON_ASSERT_H_INCLUDED +#pragma once #include #include @@ -7,5 +6,3 @@ #define JSON_ASSERT_MESSAGE(condition, message) \ if (!(condition)) \ xrpl::Throw(message); - -#endif diff --git a/include/xrpl/json/json_errors.h b/include/xrpl/json/json_errors.h index a63637b116..5cbf3bd2a5 100644 --- a/include/xrpl/json/json_errors.h +++ b/include/xrpl/json/json_errors.h @@ -1,5 +1,4 @@ -#ifndef XRPL_JSON_JSON_ERRORS_H_INCLUDED -#define XRPL_JSON_JSON_ERRORS_H_INCLUDED +#pragma once #include @@ -11,5 +10,3 @@ struct error : std::runtime_error }; } // namespace Json - -#endif // JSON_FORWARDS_H_INCLUDED diff --git a/include/xrpl/json/json_forwards.h b/include/xrpl/json/json_forwards.h index 7a6c444660..612648a5f4 100644 --- a/include/xrpl/json/json_forwards.h +++ b/include/xrpl/json/json_forwards.h @@ -1,5 +1,4 @@ -#ifndef XRPL_JSON_JSON_FORWARDS_H_INCLUDED -#define XRPL_JSON_JSON_FORWARDS_H_INCLUDED +#pragma once namespace Json { @@ -13,5 +12,3 @@ class ValueIterator; class ValueConstIterator; } // namespace Json - -#endif // JSON_FORWARDS_H_INCLUDED diff --git a/include/xrpl/json/json_reader.h b/include/xrpl/json/json_reader.h index 814d62dd88..3a1bc38929 100644 --- a/include/xrpl/json/json_reader.h +++ b/include/xrpl/json/json_reader.h @@ -1,5 +1,4 @@ -#ifndef XRPL_JSON_JSON_READER_H_INCLUDED -#define XRPL_JSON_JSON_READER_H_INCLUDED +#pragma once #include #include @@ -217,5 +216,3 @@ std::istream& operator>>(std::istream&, Value&); } // namespace Json - -#endif // XRPL_JSON_JSON_READER_H_INCLUDED diff --git a/include/xrpl/json/json_value.h b/include/xrpl/json/json_value.h index 4a7b1d869a..5895c94065 100644 --- a/include/xrpl/json/json_value.h +++ b/include/xrpl/json/json_value.h @@ -1,5 +1,4 @@ -#ifndef XRPL_JSON_JSON_VALUE_H_INCLUDED -#define XRPL_JSON_JSON_VALUE_H_INCLUDED +#pragma once #include #include @@ -677,5 +676,3 @@ public: }; } // namespace Json - -#endif // XRPL_JSON_JSON_VALUE_H_INCLUDED diff --git a/include/xrpl/json/json_writer.h b/include/xrpl/json/json_writer.h index 9049520a98..9455d4abd9 100644 --- a/include/xrpl/json/json_writer.h +++ b/include/xrpl/json/json_writer.h @@ -1,5 +1,4 @@ -#ifndef XRPL_JSON_JSON_WRITER_H_INCLUDED -#define XRPL_JSON_JSON_WRITER_H_INCLUDED +#pragma once #include #include @@ -322,5 +321,3 @@ public: }; } // namespace Json - -#endif // JSON_WRITER_H_INCLUDED diff --git a/include/xrpl/json/to_string.h b/include/xrpl/json/to_string.h index a930c29231..fb379f5759 100644 --- a/include/xrpl/json/to_string.h +++ b/include/xrpl/json/to_string.h @@ -1,5 +1,4 @@ -#ifndef XRPL_JSON_TO_STRING_H_INCLUDED -#define XRPL_JSON_TO_STRING_H_INCLUDED +#pragma once #include #include @@ -21,5 +20,3 @@ std::ostream& operator<<(std::ostream&, Value const& root); } // namespace Json - -#endif // JSON_TO_STRING_H_INCLUDED diff --git a/include/xrpl/ledger/ApplyView.h b/include/xrpl/ledger/ApplyView.h index c2eabf00bd..2de5f79452 100644 --- a/include/xrpl/ledger/ApplyView.h +++ b/include/xrpl/ledger/ApplyView.h @@ -1,5 +1,4 @@ -#ifndef XRPL_LEDGER_APPLYVIEW_H_INCLUDED -#define XRPL_LEDGER_APPLYVIEW_H_INCLUDED +#pragma once #include #include @@ -382,5 +381,3 @@ insertPage( } // namespace directory } // namespace xrpl - -#endif diff --git a/include/xrpl/ledger/ApplyViewImpl.h b/include/xrpl/ledger/ApplyViewImpl.h index c2b824f196..f6c83462f2 100644 --- a/include/xrpl/ledger/ApplyViewImpl.h +++ b/include/xrpl/ledger/ApplyViewImpl.h @@ -1,5 +1,4 @@ -#ifndef XRPL_LEDGER_APPLYVIEWIMPL_H_INCLUDED -#define XRPL_LEDGER_APPLYVIEWIMPL_H_INCLUDED +#pragma once #include #include @@ -70,5 +69,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/ledger/BookDirs.h b/include/xrpl/ledger/BookDirs.h index 23b9557f37..eb1cbcbfa7 100644 --- a/include/xrpl/ledger/BookDirs.h +++ b/include/xrpl/ledger/BookDirs.h @@ -1,5 +1,4 @@ -#ifndef XRPL_LEDGER_BOOK_DIRS_H_INCLUDED -#define XRPL_LEDGER_BOOK_DIRS_H_INCLUDED +#pragma once #include #include @@ -87,5 +86,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/ledger/CachedSLEs.h b/include/xrpl/ledger/CachedSLEs.h index b478b78b7d..2909501b1d 100644 --- a/include/xrpl/ledger/CachedSLEs.h +++ b/include/xrpl/ledger/CachedSLEs.h @@ -1,5 +1,4 @@ -#ifndef XRPL_LEDGER_CACHEDSLES_H_INCLUDED -#define XRPL_LEDGER_CACHEDSLES_H_INCLUDED +#pragma once #include #include @@ -8,5 +7,3 @@ namespace xrpl { using CachedSLEs = TaggedCache; } - -#endif // XRPL_LEDGER_CACHEDSLES_H_INCLUDED diff --git a/include/xrpl/ledger/CachedView.h b/include/xrpl/ledger/CachedView.h index 9a93c5f743..7cab1dc1b3 100644 --- a/include/xrpl/ledger/CachedView.h +++ b/include/xrpl/ledger/CachedView.h @@ -1,5 +1,4 @@ -#ifndef XRPL_LEDGER_CACHEDVIEW_H_INCLUDED -#define XRPL_LEDGER_CACHEDVIEW_H_INCLUDED +#pragma once #include #include @@ -162,5 +161,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/ledger/CredentialHelpers.h b/include/xrpl/ledger/CredentialHelpers.h index 09b4d63da0..3744ff47eb 100644 --- a/include/xrpl/ledger/CredentialHelpers.h +++ b/include/xrpl/ledger/CredentialHelpers.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_MISC_CREDENTIALHELPERS_H_INCLUDED -#define XRPL_APP_MISC_CREDENTIALHELPERS_H_INCLUDED +#pragma once #include #include @@ -79,5 +78,3 @@ verifyDepositPreauth( beast::Journal j); } // namespace xrpl - -#endif diff --git a/include/xrpl/ledger/Credit.h b/include/xrpl/ledger/Credit.h index e64c6015aa..58ec23a86a 100644 --- a/include/xrpl/ledger/Credit.h +++ b/include/xrpl/ledger/Credit.h @@ -1,5 +1,4 @@ -#ifndef XRPL_LEDGER_CREDIT_H_INCLUDED -#define XRPL_LEDGER_CREDIT_H_INCLUDED +#pragma once #include #include @@ -34,5 +33,3 @@ creditBalance(ReadView const& view, AccountID const& account, AccountID const& i /** @} */ } // namespace xrpl - -#endif diff --git a/include/xrpl/ledger/Dir.h b/include/xrpl/ledger/Dir.h index 4b7327a015..0c2f1e3765 100644 --- a/include/xrpl/ledger/Dir.h +++ b/include/xrpl/ledger/Dir.h @@ -1,5 +1,4 @@ -#ifndef XRPL_LEDGER_DIR_H_INCLUDED -#define XRPL_LEDGER_DIR_H_INCLUDED +#pragma once #include #include @@ -109,5 +108,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/ledger/OpenView.h b/include/xrpl/ledger/OpenView.h index 5441d35a0e..42f62d5bca 100644 --- a/include/xrpl/ledger/OpenView.h +++ b/include/xrpl/ledger/OpenView.h @@ -1,5 +1,4 @@ -#ifndef XRPL_LEDGER_OPENVIEW_H_INCLUDED -#define XRPL_LEDGER_OPENVIEW_H_INCLUDED +#pragma once #include #include @@ -240,5 +239,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/ledger/PaymentSandbox.h b/include/xrpl/ledger/PaymentSandbox.h index fd77d154d8..fe62d753ec 100644 --- a/include/xrpl/ledger/PaymentSandbox.h +++ b/include/xrpl/ledger/PaymentSandbox.h @@ -1,5 +1,4 @@ -#ifndef XRPL_LEDGER_PAYMENTSANDBOX_H_INCLUDED -#define XRPL_LEDGER_PAYMENTSANDBOX_H_INCLUDED +#pragma once #include #include @@ -172,5 +171,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/ledger/RawView.h b/include/xrpl/ledger/RawView.h index c0e81fb833..cfcf807e13 100644 --- a/include/xrpl/ledger/RawView.h +++ b/include/xrpl/ledger/RawView.h @@ -1,5 +1,4 @@ -#ifndef XRPL_LEDGER_RAWVIEW_H_INCLUDED -#define XRPL_LEDGER_RAWVIEW_H_INCLUDED +#pragma once #include #include @@ -88,5 +87,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/ledger/ReadView.h b/include/xrpl/ledger/ReadView.h index 5e33e7b4ba..faec10993a 100644 --- a/include/xrpl/ledger/ReadView.h +++ b/include/xrpl/ledger/ReadView.h @@ -1,5 +1,4 @@ -#ifndef XRPL_LEDGER_READVIEW_H_INCLUDED -#define XRPL_LEDGER_READVIEW_H_INCLUDED +#pragma once #include #include @@ -253,5 +252,3 @@ makeRulesGivenLedger(DigestAwareReadView const& ledger, std::unordered_set - -#endif diff --git a/include/xrpl/ledger/Sandbox.h b/include/xrpl/ledger/Sandbox.h index 1e4a816529..dc80df5ba2 100644 --- a/include/xrpl/ledger/Sandbox.h +++ b/include/xrpl/ledger/Sandbox.h @@ -1,5 +1,4 @@ -#ifndef XRPL_LEDGER_SANDBOX_H_INCLUDED -#define XRPL_LEDGER_SANDBOX_H_INCLUDED +#pragma once #include #include @@ -40,5 +39,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/ledger/View.h b/include/xrpl/ledger/View.h index 7bf833fbad..fa16e16006 100644 --- a/include/xrpl/ledger/View.h +++ b/include/xrpl/ledger/View.h @@ -1,5 +1,4 @@ -#ifndef XRPL_LEDGER_VIEW_H_INCLUDED -#define XRPL_LEDGER_VIEW_H_INCLUDED +#pragma once #include #include @@ -996,5 +995,3 @@ bool after(NetClock::time_point now, std::uint32_t mark); } // namespace xrpl - -#endif diff --git a/include/xrpl/ledger/detail/ApplyStateTable.h b/include/xrpl/ledger/detail/ApplyStateTable.h index 9fb7b64fe8..07af5247f6 100644 --- a/include/xrpl/ledger/detail/ApplyStateTable.h +++ b/include/xrpl/ledger/detail/ApplyStateTable.h @@ -1,5 +1,4 @@ -#ifndef XRPL_LEDGER_APPLYSTATETABLE_H_INCLUDED -#define XRPL_LEDGER_APPLYSTATETABLE_H_INCLUDED +#pragma once #include #include @@ -128,5 +127,3 @@ private: } // namespace detail } // namespace xrpl - -#endif diff --git a/include/xrpl/ledger/detail/ApplyViewBase.h b/include/xrpl/ledger/detail/ApplyViewBase.h index 9c048c6d90..b3ec3c0fea 100644 --- a/include/xrpl/ledger/detail/ApplyViewBase.h +++ b/include/xrpl/ledger/detail/ApplyViewBase.h @@ -1,5 +1,4 @@ -#ifndef XRPL_LEDGER_APPLYVIEWBASE_H_INCLUDED -#define XRPL_LEDGER_APPLYVIEWBASE_H_INCLUDED +#pragma once #include #include @@ -105,5 +104,3 @@ protected: } // namespace detail } // namespace xrpl - -#endif diff --git a/include/xrpl/ledger/detail/RawStateTable.h b/include/xrpl/ledger/detail/RawStateTable.h index 881d00be53..e09f2f0e44 100644 --- a/include/xrpl/ledger/detail/RawStateTable.h +++ b/include/xrpl/ledger/detail/RawStateTable.h @@ -1,5 +1,4 @@ -#ifndef XRPL_LEDGER_RAWSTATETABLE_H_INCLUDED -#define XRPL_LEDGER_RAWSTATETABLE_H_INCLUDED +#pragma once #include #include @@ -109,5 +108,3 @@ private: } // namespace detail } // namespace xrpl - -#endif diff --git a/include/xrpl/ledger/detail/ReadViewFwdRange.h b/include/xrpl/ledger/detail/ReadViewFwdRange.h index 05d2b79a50..bf40b04a6a 100644 --- a/include/xrpl/ledger/detail/ReadViewFwdRange.h +++ b/include/xrpl/ledger/detail/ReadViewFwdRange.h @@ -1,5 +1,4 @@ -#ifndef XRPL_LEDGER_READVIEWFWDRANGE_H_INCLUDED -#define XRPL_LEDGER_READVIEWFWDRANGE_H_INCLUDED +#pragma once #include #include @@ -129,5 +128,3 @@ protected: } // namespace detail } // namespace xrpl - -#endif diff --git a/include/xrpl/ledger/detail/ReadViewFwdRange.ipp b/include/xrpl/ledger/detail/ReadViewFwdRange.ipp index 6978d3abad..212be52432 100644 --- a/include/xrpl/ledger/detail/ReadViewFwdRange.ipp +++ b/include/xrpl/ledger/detail/ReadViewFwdRange.ipp @@ -1,5 +1,4 @@ -#ifndef XRPL_LEDGER_READVIEWFWDRANGEINL_H_INCLUDED -#define XRPL_LEDGER_READVIEWFWDRANGEINL_H_INCLUDED +#pragma once namespace xrpl { namespace detail { @@ -108,5 +107,3 @@ ReadViewFwdRange::iterator::operator++(int) -> iterator } // namespace detail } // namespace xrpl - -#endif diff --git a/include/xrpl/net/AutoSocket.h b/include/xrpl/net/AutoSocket.h index da4d3c30e5..85a3adb456 100644 --- a/include/xrpl/net/AutoSocket.h +++ b/include/xrpl/net/AutoSocket.h @@ -1,5 +1,4 @@ -#ifndef XRPL_WEBSOCKET_AUTOSOCKET_AUTOSOCKET_H_INCLUDED -#define XRPL_WEBSOCKET_AUTOSOCKET_AUTOSOCKET_H_INCLUDED +#pragma once #include #include @@ -268,5 +267,3 @@ private: std::vector mBuffer; beast::Journal j_; }; - -#endif diff --git a/include/xrpl/net/HTTPClient.h b/include/xrpl/net/HTTPClient.h index 0e1a56e42d..289ce8f6e3 100644 --- a/include/xrpl/net/HTTPClient.h +++ b/include/xrpl/net/HTTPClient.h @@ -1,5 +1,4 @@ -#ifndef XRPL_NET_HTTPCLIENT_H_INCLUDED -#define XRPL_NET_HTTPCLIENT_H_INCLUDED +#pragma once #include #include @@ -69,5 +68,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/net/HTTPClientSSLContext.h b/include/xrpl/net/HTTPClientSSLContext.h index f195b031da..1033b9a22b 100644 --- a/include/xrpl/net/HTTPClientSSLContext.h +++ b/include/xrpl/net/HTTPClientSSLContext.h @@ -1,5 +1,4 @@ -#ifndef XRPL_NET_HTTPCLIENTSSLCONTEXT_H_INCLUDED -#define XRPL_NET_HTTPCLIENTSSLCONTEXT_H_INCLUDED +#pragma once #include #include @@ -148,5 +147,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/net/RegisterSSLCerts.h b/include/xrpl/net/RegisterSSLCerts.h index 273d1966d1..e313b1cb06 100644 --- a/include/xrpl/net/RegisterSSLCerts.h +++ b/include/xrpl/net/RegisterSSLCerts.h @@ -1,5 +1,4 @@ -#ifndef XRPL_NET_REGISTER_SSL_CERTS_H_INCLUDED -#define XRPL_NET_REGISTER_SSL_CERTS_H_INCLUDED +#pragma once #include @@ -17,5 +16,3 @@ void registerSSLCerts(boost::asio::ssl::context&, boost::system::error_code&, beast::Journal j); } // namespace xrpl - -#endif diff --git a/include/xrpl/nodestore/Backend.h b/include/xrpl/nodestore/Backend.h index d3b995b6ed..6af292d5b3 100644 --- a/include/xrpl/nodestore/Backend.h +++ b/include/xrpl/nodestore/Backend.h @@ -1,5 +1,4 @@ -#ifndef XRPL_NODESTORE_BACKEND_H_INCLUDED -#define XRPL_NODESTORE_BACKEND_H_INCLUDED +#pragma once #include @@ -142,5 +141,3 @@ public: } // namespace NodeStore } // namespace xrpl - -#endif diff --git a/include/xrpl/nodestore/Database.h b/include/xrpl/nodestore/Database.h index a1de865241..d3dafff85d 100644 --- a/include/xrpl/nodestore/Database.h +++ b/include/xrpl/nodestore/Database.h @@ -1,5 +1,4 @@ -#ifndef XRPL_NODESTORE_DATABASE_H_INCLUDED -#define XRPL_NODESTORE_DATABASE_H_INCLUDED +#pragma once #include #include @@ -274,5 +273,3 @@ private: } // namespace NodeStore } // namespace xrpl - -#endif diff --git a/include/xrpl/nodestore/DatabaseRotating.h b/include/xrpl/nodestore/DatabaseRotating.h index 89e2ae8c0c..e20b49805c 100644 --- a/include/xrpl/nodestore/DatabaseRotating.h +++ b/include/xrpl/nodestore/DatabaseRotating.h @@ -1,5 +1,4 @@ -#ifndef XRPL_NODESTORE_DATABASEROTATING_H_INCLUDED -#define XRPL_NODESTORE_DATABASEROTATING_H_INCLUDED +#pragma once #include @@ -34,5 +33,3 @@ public: } // namespace NodeStore } // namespace xrpl - -#endif diff --git a/include/xrpl/nodestore/DummyScheduler.h b/include/xrpl/nodestore/DummyScheduler.h index b31613480f..9fce4a6100 100644 --- a/include/xrpl/nodestore/DummyScheduler.h +++ b/include/xrpl/nodestore/DummyScheduler.h @@ -1,5 +1,4 @@ -#ifndef XRPL_NODESTORE_DUMMYSCHEDULER_H_INCLUDED -#define XRPL_NODESTORE_DUMMYSCHEDULER_H_INCLUDED +#pragma once #include @@ -22,5 +21,3 @@ public: } // namespace NodeStore } // namespace xrpl - -#endif diff --git a/include/xrpl/nodestore/Factory.h b/include/xrpl/nodestore/Factory.h index d6d33c4b64..e01bdfabf2 100644 --- a/include/xrpl/nodestore/Factory.h +++ b/include/xrpl/nodestore/Factory.h @@ -1,5 +1,4 @@ -#ifndef XRPL_NODESTORE_FACTORY_H_INCLUDED -#define XRPL_NODESTORE_FACTORY_H_INCLUDED +#pragma once #include #include @@ -62,5 +61,3 @@ public: } // namespace NodeStore } // namespace xrpl - -#endif diff --git a/include/xrpl/nodestore/Manager.h b/include/xrpl/nodestore/Manager.h index e6d62fbc4a..9553407881 100644 --- a/include/xrpl/nodestore/Manager.h +++ b/include/xrpl/nodestore/Manager.h @@ -1,5 +1,4 @@ -#ifndef XRPL_NODESTORE_MANAGER_H_INCLUDED -#define XRPL_NODESTORE_MANAGER_H_INCLUDED +#pragma once #include #include @@ -80,5 +79,3 @@ public: } // namespace NodeStore } // namespace xrpl - -#endif diff --git a/include/xrpl/nodestore/NodeObject.h b/include/xrpl/nodestore/NodeObject.h index 1926d1791c..2274fc8c38 100644 --- a/include/xrpl/nodestore/NodeObject.h +++ b/include/xrpl/nodestore/NodeObject.h @@ -1,5 +1,4 @@ -#ifndef XRPL_NODESTORE_NODEOBJECT_H_INCLUDED -#define XRPL_NODESTORE_NODEOBJECT_H_INCLUDED +#pragma once #include #include @@ -78,5 +77,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/nodestore/Scheduler.h b/include/xrpl/nodestore/Scheduler.h index 0835e08fa2..6e01533930 100644 --- a/include/xrpl/nodestore/Scheduler.h +++ b/include/xrpl/nodestore/Scheduler.h @@ -1,5 +1,4 @@ -#ifndef XRPL_NODESTORE_SCHEDULER_H_INCLUDED -#define XRPL_NODESTORE_SCHEDULER_H_INCLUDED +#pragma once #include @@ -67,5 +66,3 @@ public: } // namespace NodeStore } // namespace xrpl - -#endif diff --git a/include/xrpl/nodestore/Task.h b/include/xrpl/nodestore/Task.h index bd21e61975..4bfc88bd13 100644 --- a/include/xrpl/nodestore/Task.h +++ b/include/xrpl/nodestore/Task.h @@ -1,5 +1,4 @@ -#ifndef XRPL_NODESTORE_TASK_H_INCLUDED -#define XRPL_NODESTORE_TASK_H_INCLUDED +#pragma once namespace xrpl { namespace NodeStore { @@ -18,5 +17,3 @@ struct Task } // namespace NodeStore } // namespace xrpl - -#endif diff --git a/include/xrpl/nodestore/Types.h b/include/xrpl/nodestore/Types.h index 6763196860..5adbc40f70 100644 --- a/include/xrpl/nodestore/Types.h +++ b/include/xrpl/nodestore/Types.h @@ -1,5 +1,4 @@ -#ifndef XRPL_NODESTORE_TYPES_H_INCLUDED -#define XRPL_NODESTORE_TYPES_H_INCLUDED +#pragma once #include @@ -38,5 +37,3 @@ using Batch = std::vector>; } // namespace NodeStore } // namespace xrpl - -#endif diff --git a/include/xrpl/nodestore/detail/BatchWriter.h b/include/xrpl/nodestore/detail/BatchWriter.h index f1faf0a612..1820435133 100644 --- a/include/xrpl/nodestore/detail/BatchWriter.h +++ b/include/xrpl/nodestore/detail/BatchWriter.h @@ -1,5 +1,4 @@ -#ifndef XRPL_NODESTORE_BATCHWRITER_H_INCLUDED -#define XRPL_NODESTORE_BATCHWRITER_H_INCLUDED +#pragma once #include #include @@ -79,5 +78,3 @@ private: } // namespace NodeStore } // namespace xrpl - -#endif diff --git a/include/xrpl/nodestore/detail/DatabaseNodeImp.h b/include/xrpl/nodestore/detail/DatabaseNodeImp.h index 900d6a5a59..dd6b8f9ddd 100644 --- a/include/xrpl/nodestore/detail/DatabaseNodeImp.h +++ b/include/xrpl/nodestore/detail/DatabaseNodeImp.h @@ -1,5 +1,4 @@ -#ifndef XRPL_NODESTORE_DATABASENODEIMP_H_INCLUDED -#define XRPL_NODESTORE_DATABASENODEIMP_H_INCLUDED +#pragma once #include #include @@ -126,5 +125,3 @@ private: } // namespace NodeStore } // namespace xrpl - -#endif diff --git a/include/xrpl/nodestore/detail/DatabaseRotatingImp.h b/include/xrpl/nodestore/detail/DatabaseRotatingImp.h index 31c9ebbaec..e49c195d67 100644 --- a/include/xrpl/nodestore/detail/DatabaseRotatingImp.h +++ b/include/xrpl/nodestore/detail/DatabaseRotatingImp.h @@ -1,5 +1,4 @@ -#ifndef XRPL_NODESTORE_DATABASEROTATINGIMP_H_INCLUDED -#define XRPL_NODESTORE_DATABASEROTATINGIMP_H_INCLUDED +#pragma once #include @@ -73,5 +72,3 @@ private: } // namespace NodeStore } // namespace xrpl - -#endif diff --git a/include/xrpl/nodestore/detail/DecodedBlob.h b/include/xrpl/nodestore/detail/DecodedBlob.h index 0eaa169269..dc6704a08d 100644 --- a/include/xrpl/nodestore/detail/DecodedBlob.h +++ b/include/xrpl/nodestore/detail/DecodedBlob.h @@ -1,5 +1,4 @@ -#ifndef XRPL_NODESTORE_DECODEDBLOB_H_INCLUDED -#define XRPL_NODESTORE_DECODEDBLOB_H_INCLUDED +#pragma once #include @@ -44,5 +43,3 @@ private: } // namespace NodeStore } // namespace xrpl - -#endif diff --git a/include/xrpl/nodestore/detail/EncodedBlob.h b/include/xrpl/nodestore/detail/EncodedBlob.h index a4c553cf71..78e7153f73 100644 --- a/include/xrpl/nodestore/detail/EncodedBlob.h +++ b/include/xrpl/nodestore/detail/EncodedBlob.h @@ -1,5 +1,4 @@ -#ifndef XRPL_NODESTORE_ENCODEDBLOB_H_INCLUDED -#define XRPL_NODESTORE_ENCODEDBLOB_H_INCLUDED +#pragma once #include #include @@ -107,5 +106,3 @@ public: } // namespace NodeStore } // namespace xrpl - -#endif diff --git a/include/xrpl/nodestore/detail/ManagerImp.h b/include/xrpl/nodestore/detail/ManagerImp.h index eb3ee21db4..f46a7d56d0 100644 --- a/include/xrpl/nodestore/detail/ManagerImp.h +++ b/include/xrpl/nodestore/detail/ManagerImp.h @@ -1,5 +1,4 @@ -#ifndef XRPL_NODESTORE_MANAGERIMP_H_INCLUDED -#define XRPL_NODESTORE_MANAGERIMP_H_INCLUDED +#pragma once #include @@ -48,5 +47,3 @@ public: } // namespace NodeStore } // namespace xrpl - -#endif diff --git a/include/xrpl/nodestore/detail/codec.h b/include/xrpl/nodestore/detail/codec.h index adbf214ce5..1d08beff59 100644 --- a/include/xrpl/nodestore/detail/codec.h +++ b/include/xrpl/nodestore/detail/codec.h @@ -1,5 +1,4 @@ -#ifndef XRPL_NODESTORE_CODEC_H_INCLUDED -#define XRPL_NODESTORE_CODEC_H_INCLUDED +#pragma once // Disable lz4 deprecation warning due to incompatibility with clang attributes #define LZ4_DISABLE_DEPRECATE_WARNINGS @@ -305,5 +304,3 @@ filter_inner(void* in, std::size_t in_size) } // namespace NodeStore } // namespace xrpl - -#endif diff --git a/include/xrpl/nodestore/detail/varint.h b/include/xrpl/nodestore/detail/varint.h index 7cf9fbaf4b..98f8d8ff08 100644 --- a/include/xrpl/nodestore/detail/varint.h +++ b/include/xrpl/nodestore/detail/varint.h @@ -1,5 +1,4 @@ -#ifndef BEAST_NUDB_VARINT_H_INCLUDED -#define BEAST_NUDB_VARINT_H_INCLUDED +#pragma once #include @@ -119,5 +118,3 @@ write(nudb::detail::ostream& os, std::size_t t) } // namespace NodeStore } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/AMMCore.h b/include/xrpl/protocol/AMMCore.h index cdd99c65eb..a2c531f361 100644 --- a/include/xrpl/protocol/AMMCore.h +++ b/include/xrpl/protocol/AMMCore.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_AMMCORE_H_INCLUDED -#define XRPL_PROTOCOL_AMMCORE_H_INCLUDED +#pragma once #include #include @@ -97,5 +96,3 @@ feeMultHalf(std::uint16_t tfee) } } // namespace xrpl - -#endif // XRPL_PROTOCOL_AMMCORE_H_INCLUDED diff --git a/include/xrpl/protocol/AccountID.h b/include/xrpl/protocol/AccountID.h index d61938e2a7..bc57058d9e 100644 --- a/include/xrpl/protocol/AccountID.h +++ b/include/xrpl/protocol/AccountID.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_ACCOUNTID_H_INCLUDED -#define XRPL_PROTOCOL_ACCOUNTID_H_INCLUDED +#pragma once #include // VFALCO Uncomment when the header issues are resolved @@ -133,5 +132,3 @@ struct hash : xrpl::AccountID::hasher }; } // namespace std - -#endif diff --git a/include/xrpl/protocol/AmountConversions.h b/include/xrpl/protocol/AmountConversions.h index d4a66c5d94..0807e96c49 100644 --- a/include/xrpl/protocol/AmountConversions.h +++ b/include/xrpl/protocol/AmountConversions.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_AMOUNTCONVERSION_H_INCLUDED -#define XRPL_PROTOCOL_AMOUNTCONVERSION_H_INCLUDED +#pragma once #include #include @@ -184,5 +183,3 @@ get(STAmount const& a) } } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/ApiVersion.h b/include/xrpl/protocol/ApiVersion.h index b8dc8ecb20..756a41d25e 100644 --- a/include/xrpl/protocol/ApiVersion.h +++ b/include/xrpl/protocol/ApiVersion.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_APIVERSION_H_INCLUDED -#define XRPL_PROTOCOL_APIVERSION_H_INCLUDED +#pragma once #include #include @@ -151,5 +150,3 @@ forAllApiVersions(Fn const& fn, Args&&... args) } } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/Asset.h b/include/xrpl/protocol/Asset.h index e7852cdefe..d48bc94b50 100644 --- a/include/xrpl/protocol/Asset.h +++ b/include/xrpl/protocol/Asset.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_ASSET_H_INCLUDED -#define XRPL_PROTOCOL_ASSET_H_INCLUDED +#pragma once #include #include @@ -225,5 +224,3 @@ Asset assetFromJson(Json::Value const& jv); } // namespace xrpl - -#endif // XRPL_PROTOCOL_ASSET_H_INCLUDED diff --git a/include/xrpl/protocol/Book.h b/include/xrpl/protocol/Book.h index 9e26af9f79..83965cf701 100644 --- a/include/xrpl/protocol/Book.h +++ b/include/xrpl/protocol/Book.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_BOOK_H_INCLUDED -#define XRPL_PROTOCOL_BOOK_H_INCLUDED +#pragma once #include #include @@ -171,5 +170,3 @@ struct hash : std::hash }; } // namespace boost - -#endif diff --git a/include/xrpl/protocol/BuildInfo.h b/include/xrpl/protocol/BuildInfo.h index 0b75f8b0a1..3c42a4323f 100644 --- a/include/xrpl/protocol/BuildInfo.h +++ b/include/xrpl/protocol/BuildInfo.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_BUILDINFO_H_INCLUDED -#define XRPL_PROTOCOL_BUILDINFO_H_INCLUDED +#pragma once #include #include @@ -80,5 +79,3 @@ isNewerVersion(std::uint64_t version); } // namespace BuildInfo } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/ErrorCodes.h b/include/xrpl/protocol/ErrorCodes.h index 172c3fd57f..08c034e38f 100644 --- a/include/xrpl/protocol/ErrorCodes.h +++ b/include/xrpl/protocol/ErrorCodes.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_ERRORCODES_H_INCLUDED -#define XRPL_PROTOCOL_ERRORCODES_H_INCLUDED +#pragma once #include #include @@ -324,5 +323,3 @@ std::string rpcErrorString(Json::Value const& jv); } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/Feature.h b/include/xrpl/protocol/Feature.h index fac6627b1c..6d674fbef2 100644 --- a/include/xrpl/protocol/Feature.h +++ b/include/xrpl/protocol/Feature.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_FEATURE_H_INCLUDED -#define XRPL_PROTOCOL_FEATURE_H_INCLUDED +#pragma once #include @@ -361,5 +360,3 @@ foreachFeature(FeatureBitset bs, F&& f) #pragma pop_macro("XRPL_FEATURE") } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/Fees.h b/include/xrpl/protocol/Fees.h index 8c7cb51777..84c8ffe81f 100644 --- a/include/xrpl/protocol/Fees.h +++ b/include/xrpl/protocol/Fees.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_FEES_H_INCLUDED -#define XRPL_PROTOCOL_FEES_H_INCLUDED +#pragma once #include @@ -34,5 +33,3 @@ struct Fees }; } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/HashPrefix.h b/include/xrpl/protocol/HashPrefix.h index babba3f7bd..305b4bfd49 100644 --- a/include/xrpl/protocol/HashPrefix.h +++ b/include/xrpl/protocol/HashPrefix.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_HASHPREFIX_H_INCLUDED -#define XRPL_PROTOCOL_HASHPREFIX_H_INCLUDED +#pragma once #include @@ -79,5 +78,3 @@ hash_append(Hasher& h, HashPrefix const& hp) noexcept } } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/IOUAmount.h b/include/xrpl/protocol/IOUAmount.h index 960f8c4521..52c2272da0 100644 --- a/include/xrpl/protocol/IOUAmount.h +++ b/include/xrpl/protocol/IOUAmount.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_IOUAMOUNT_H_INCLUDED -#define XRPL_BASICS_IOUAMOUNT_H_INCLUDED +#pragma once #include #include @@ -208,5 +207,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/Indexes.h b/include/xrpl/protocol/Indexes.h index 2ce3b7ad6b..f1e0b1655a 100644 --- a/include/xrpl/protocol/Indexes.h +++ b/include/xrpl/protocol/Indexes.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_INDEXES_H_INCLUDED -#define XRPL_PROTOCOL_INDEXES_H_INCLUDED +#pragma once #include #include @@ -385,5 +384,3 @@ MPTID makeMptID(std::uint32_t sequence, AccountID const& account); } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/InnerObjectFormats.h b/include/xrpl/protocol/InnerObjectFormats.h index 6d656d0065..a00e6e120b 100644 --- a/include/xrpl/protocol/InnerObjectFormats.h +++ b/include/xrpl/protocol/InnerObjectFormats.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_INNER_OBJECT_FORMATS_H_INCLUDED -#define XRPL_PROTOCOL_INNER_OBJECT_FORMATS_H_INCLUDED +#pragma once #include @@ -24,5 +23,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/Issue.h b/include/xrpl/protocol/Issue.h index f7da457986..c8e598a540 100644 --- a/include/xrpl/protocol/Issue.h +++ b/include/xrpl/protocol/Issue.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_ISSUE_H_INCLUDED -#define XRPL_PROTOCOL_ISSUE_H_INCLUDED +#pragma once #include #include @@ -116,5 +115,3 @@ isXRP(Issue const& issue) } } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/KeyType.h b/include/xrpl/protocol/KeyType.h index 454c88780d..d05e421e4b 100644 --- a/include/xrpl/protocol/KeyType.h +++ b/include/xrpl/protocol/KeyType.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_KEYTYPE_H_INCLUDED -#define XRPL_PROTOCOL_KEYTYPE_H_INCLUDED +#pragma once #include #include @@ -43,5 +42,3 @@ operator<<(Stream& s, KeyType type) } } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/Keylet.h b/include/xrpl/protocol/Keylet.h index 4380fdfdac..2931486ac0 100644 --- a/include/xrpl/protocol/Keylet.h +++ b/include/xrpl/protocol/Keylet.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_KEYLET_H_INCLUDED -#define XRPL_PROTOCOL_KEYLET_H_INCLUDED +#pragma once #include #include @@ -31,5 +30,3 @@ struct Keylet }; } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/KnownFormats.h b/include/xrpl/protocol/KnownFormats.h index 58a2710bef..67701c91ca 100644 --- a/include/xrpl/protocol/KnownFormats.h +++ b/include/xrpl/protocol/KnownFormats.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_KNOWNFORMATS_H_INCLUDED -#define XRPL_PROTOCOL_KNOWNFORMATS_H_INCLUDED +#pragma once #include #include @@ -180,5 +179,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/LedgerFormats.h b/include/xrpl/protocol/LedgerFormats.h index b52a25af17..fa39c15843 100644 --- a/include/xrpl/protocol/LedgerFormats.h +++ b/include/xrpl/protocol/LedgerFormats.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_LEDGERFORMATS_H_INCLUDED -#define XRPL_PROTOCOL_LEDGERFORMATS_H_INCLUDED +#pragma once #include @@ -211,5 +210,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/LedgerHeader.h b/include/xrpl/protocol/LedgerHeader.h index 641f794cdb..1dc67cada5 100644 --- a/include/xrpl/protocol/LedgerHeader.h +++ b/include/xrpl/protocol/LedgerHeader.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_LEDGERHEADER_H_INCLUDED -#define XRPL_PROTOCOL_LEDGERHEADER_H_INCLUDED +#pragma once #include #include @@ -74,5 +73,3 @@ LedgerHeader deserializePrefixedHeader(Slice data, bool hasHash = false); } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/MPTAmount.h b/include/xrpl/protocol/MPTAmount.h index be24d4de7f..66027185b3 100644 --- a/include/xrpl/protocol/MPTAmount.h +++ b/include/xrpl/protocol/MPTAmount.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_MPTAMOUNT_H_INCLUDED -#define XRPL_PROTOCOL_MPTAMOUNT_H_INCLUDED +#pragma once #include #include @@ -147,5 +146,3 @@ mulRatio(MPTAmount const& amt, std::uint32_t num, std::uint32_t den, bool roundU } } // namespace xrpl - -#endif // XRPL_BASICS_MPTAMOUNT_H_INCLUDED diff --git a/include/xrpl/protocol/MPTIssue.h b/include/xrpl/protocol/MPTIssue.h index ca81548a29..d84a610418 100644 --- a/include/xrpl/protocol/MPTIssue.h +++ b/include/xrpl/protocol/MPTIssue.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_MPTISSUE_H_INCLUDED -#define XRPL_PROTOCOL_MPTISSUE_H_INCLUDED +#pragma once #include #include @@ -84,5 +83,3 @@ MPTIssue mptIssueFromJson(Json::Value const& jv); } // namespace xrpl - -#endif // XRPL_PROTOCOL_MPTISSUE_H_INCLUDED diff --git a/include/xrpl/protocol/MultiApiJson.h b/include/xrpl/protocol/MultiApiJson.h index 9fdb85f648..ad7a6b8f0d 100644 --- a/include/xrpl/protocol/MultiApiJson.h +++ b/include/xrpl/protocol/MultiApiJson.h @@ -1,5 +1,4 @@ -#ifndef XRPL_JSON_MULTIAPIJSON_H_INCLUDED -#define XRPL_JSON_MULTIAPIJSON_H_INCLUDED +#pragma once #include #include @@ -173,5 +172,3 @@ struct MultiApiJson using MultiApiJson = detail::MultiApiJson; } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/NFTSyntheticSerializer.h b/include/xrpl/protocol/NFTSyntheticSerializer.h index 5f7e061454..c33a6edc7d 100644 --- a/include/xrpl/protocol/NFTSyntheticSerializer.h +++ b/include/xrpl/protocol/NFTSyntheticSerializer.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_NFTSYNTHETICSERIALIZER_H_INCLUDED -#define XRPL_PROTOCOL_NFTSYNTHETICSERIALIZER_H_INCLUDED +#pragma once #include #include @@ -22,5 +21,3 @@ insertNFTSyntheticInJson(Json::Value&, std::shared_ptr const&, TxMet } // namespace RPC } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/NFTokenID.h b/include/xrpl/protocol/NFTokenID.h index 0cddfa6d55..f3635d6fac 100644 --- a/include/xrpl/protocol/NFTokenID.h +++ b/include/xrpl/protocol/NFTokenID.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_NFTOKENID_H_INCLUDED -#define XRPL_PROTOCOL_NFTOKENID_H_INCLUDED +#pragma once #include #include @@ -34,5 +33,3 @@ insertNFTokenID(Json::Value& response, std::shared_ptr const& transa /** @} */ } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/NFTokenOfferID.h b/include/xrpl/protocol/NFTokenOfferID.h index da358a9b84..c3117db197 100644 --- a/include/xrpl/protocol/NFTokenOfferID.h +++ b/include/xrpl/protocol/NFTokenOfferID.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_NFTOKENOFFERID_H_INCLUDED -#define XRPL_PROTOCOL_NFTOKENOFFERID_H_INCLUDED +#pragma once #include #include @@ -32,5 +31,3 @@ insertNFTokenOfferID( /** @} */ } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/PayChan.h b/include/xrpl/protocol/PayChan.h index a991f124ff..0a1496ca8e 100644 --- a/include/xrpl/protocol/PayChan.h +++ b/include/xrpl/protocol/PayChan.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_PAYCHAN_H_INCLUDED -#define XRPL_PROTOCOL_PAYCHAN_H_INCLUDED +#pragma once #include #include @@ -17,5 +16,3 @@ serializePayChanAuthorization(Serializer& msg, uint256 const& key, XRPAmount con } } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/Permissions.h b/include/xrpl/protocol/Permissions.h index 0e3bb970bd..e8800a41d2 100644 --- a/include/xrpl/protocol/Permissions.h +++ b/include/xrpl/protocol/Permissions.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_PERMISSION_H_INCLUDED -#define XRPL_PROTOCOL_PERMISSION_H_INCLUDED +#pragma once #include #include @@ -82,5 +81,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/Protocol.h b/include/xrpl/protocol/Protocol.h index 99e224cb91..dfb2b9dfe8 100644 --- a/include/xrpl/protocol/Protocol.h +++ b/include/xrpl/protocol/Protocol.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_PROTOCOL_H_INCLUDED -#define XRPL_PROTOCOL_PROTOCOL_H_INCLUDED +#pragma once #include #include @@ -298,5 +297,3 @@ std::size_t constexpr permissionMaxSize = 10; std::size_t constexpr maxBatchTxCount = 8; } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/PublicKey.h b/include/xrpl/protocol/PublicKey.h index 0d95fa5818..eff2af6839 100644 --- a/include/xrpl/protocol/PublicKey.h +++ b/include/xrpl/protocol/PublicKey.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_PUBLICKEY_H_INCLUDED -#define XRPL_PROTOCOL_PUBLICKEY_H_INCLUDED +#pragma once #include #include @@ -279,5 +278,3 @@ getOrThrow(Json::Value const& v, xrpl::SField const& field) Throw(field.getJsonName(), "PublicKey"); } } // namespace Json - -#endif diff --git a/include/xrpl/protocol/Quality.h b/include/xrpl/protocol/Quality.h index d8101d7c1e..4d3fcbfcc0 100644 --- a/include/xrpl/protocol/Quality.h +++ b/include/xrpl/protocol/Quality.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_QUALITY_H_INCLUDED -#define XRPL_PROTOCOL_QUALITY_H_INCLUDED +#pragma once #include #include @@ -358,5 +357,3 @@ Quality composed_quality(Quality const& lhs, Quality const& rhs); } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/QualityFunction.h b/include/xrpl/protocol/QualityFunction.h index 2414d86583..4f76f4df0a 100644 --- a/include/xrpl/protocol/QualityFunction.h +++ b/include/xrpl/protocol/QualityFunction.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_QUALITYFUNCTION_H_INCLUDED -#define XRPL_PROTOCOL_QUALITYFUNCTION_H_INCLUDED +#pragma once #include #include @@ -78,5 +77,3 @@ QualityFunction::QualityFunction(TAmounts const& amounts, std::uint32 } } // namespace xrpl - -#endif // XRPL_PROTOCOL_QUALITYFUNCTION_H_INCLUDED diff --git a/include/xrpl/protocol/RPCErr.h b/include/xrpl/protocol/RPCErr.h index fcca15747e..34c4bf8f99 100644 --- a/include/xrpl/protocol/RPCErr.h +++ b/include/xrpl/protocol/RPCErr.h @@ -1,5 +1,4 @@ -#ifndef XRPL_NET_RPCERR_H_INCLUDED -#define XRPL_NET_RPCERR_H_INCLUDED +#pragma once #include @@ -12,5 +11,3 @@ Json::Value rpcError(error_code_i iError); } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/Rate.h b/include/xrpl/protocol/Rate.h index 86033e9a38..e57d7e3a99 100644 --- a/include/xrpl/protocol/Rate.h +++ b/include/xrpl/protocol/Rate.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_RATE_H_INCLUDED -#define XRPL_PROTOCOL_RATE_H_INCLUDED +#pragma once #include #include @@ -76,5 +75,3 @@ transferFeeAsRate(std::uint16_t fee); extern Rate const parityRate; } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/RippleLedgerHash.h b/include/xrpl/protocol/RippleLedgerHash.h index 516ab49029..2a51298d3d 100644 --- a/include/xrpl/protocol/RippleLedgerHash.h +++ b/include/xrpl/protocol/RippleLedgerHash.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_RIPPLELEDGERHASH_H_INCLUDED -#define XRPL_PROTOCOL_RIPPLELEDGERHASH_H_INCLUDED +#pragma once #include @@ -8,5 +7,3 @@ namespace xrpl { using LedgerHash = uint256; } - -#endif diff --git a/include/xrpl/protocol/Rules.h b/include/xrpl/protocol/Rules.h index 8f622c3f1d..7d4a458fce 100644 --- a/include/xrpl/protocol/Rules.h +++ b/include/xrpl/protocol/Rules.h @@ -1,5 +1,4 @@ -#ifndef XRPL_LEDGER_RULES_H_INCLUDED -#define XRPL_LEDGER_RULES_H_INCLUDED +#pragma once #include #include @@ -107,4 +106,3 @@ private: }; } // namespace xrpl -#endif diff --git a/include/xrpl/protocol/SField.h b/include/xrpl/protocol/SField.h index 3ca8dbf898..7a864b1b58 100644 --- a/include/xrpl/protocol/SField.h +++ b/include/xrpl/protocol/SField.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_SFIELD_H_INCLUDED -#define XRPL_PROTOCOL_SFIELD_H_INCLUDED +#pragma once #include #include @@ -374,5 +373,3 @@ extern SField const sfGeneric; #pragma pop_macro("UNTYPED_SFIELD") } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/SOTemplate.h b/include/xrpl/protocol/SOTemplate.h index 35be09c5d5..794fc86c11 100644 --- a/include/xrpl/protocol/SOTemplate.h +++ b/include/xrpl/protocol/SOTemplate.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_SOTEMPLATE_H_INCLUDED -#define XRPL_PROTOCOL_SOTEMPLATE_H_INCLUDED +#pragma once #include #include @@ -148,5 +147,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/STAccount.h b/include/xrpl/protocol/STAccount.h index 7c193d3425..3fdb2e015e 100644 --- a/include/xrpl/protocol/STAccount.h +++ b/include/xrpl/protocol/STAccount.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_STACCOUNT_H_INCLUDED -#define XRPL_PROTOCOL_STACCOUNT_H_INCLUDED +#pragma once #include #include @@ -113,5 +112,3 @@ operator<(AccountID const& lhs, STAccount const& rhs) } } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/STAmount.h b/include/xrpl/protocol/STAmount.h index c678205882..df2b1c19a0 100644 --- a/include/xrpl/protocol/STAmount.h +++ b/include/xrpl/protocol/STAmount.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_STAMOUNT_H_INCLUDED -#define XRPL_PROTOCOL_STAMOUNT_H_INCLUDED +#pragma once #include #include @@ -735,4 +734,3 @@ getOrThrow(Json::Value const& v, xrpl::SField const& field) return amountFromJson(field, inner); } } // namespace Json -#endif diff --git a/include/xrpl/protocol/STArray.h b/include/xrpl/protocol/STArray.h index d413e7bdc0..d9c5306d14 100644 --- a/include/xrpl/protocol/STArray.h +++ b/include/xrpl/protocol/STArray.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_STARRAY_H_INCLUDED -#define XRPL_PROTOCOL_STARRAY_H_INCLUDED +#pragma once #include #include @@ -287,5 +286,3 @@ STArray::erase(const_iterator first, const_iterator last) } } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/STBase.h b/include/xrpl/protocol/STBase.h index f100b52426..7f06b01ca4 100644 --- a/include/xrpl/protocol/STBase.h +++ b/include/xrpl/protocol/STBase.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_STBASE_H_INCLUDED -#define XRPL_PROTOCOL_STBASE_H_INCLUDED +#pragma once #include #include @@ -220,5 +219,3 @@ STBase::emplace(std::size_t n, void* buf, T&& val) } } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/STBitString.h b/include/xrpl/protocol/STBitString.h index 0229d99698..e8b6e7282b 100644 --- a/include/xrpl/protocol/STBitString.h +++ b/include/xrpl/protocol/STBitString.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_STBITSTRING_H_INCLUDED -#define XRPL_PROTOCOL_STBITSTRING_H_INCLUDED +#pragma once #include #include @@ -183,5 +182,3 @@ STBitString::isDefault() const } } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/STBlob.h b/include/xrpl/protocol/STBlob.h index bb9b8a44f8..15a9bd5f78 100644 --- a/include/xrpl/protocol/STBlob.h +++ b/include/xrpl/protocol/STBlob.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_STBLOB_H_INCLUDED -#define XRPL_PROTOCOL_STBLOB_H_INCLUDED +#pragma once #include #include @@ -124,5 +123,3 @@ STBlob::setValue(Buffer&& b) } } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/STCurrency.h b/include/xrpl/protocol/STCurrency.h index 1c59d48beb..dc5b079c6d 100644 --- a/include/xrpl/protocol/STCurrency.h +++ b/include/xrpl/protocol/STCurrency.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_STCURRENCY_H_INCLUDED -#define XRPL_PROTOCOL_STCURRENCY_H_INCLUDED +#pragma once #include #include @@ -115,5 +114,3 @@ operator<(STCurrency const& lhs, Currency const& rhs) } } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/STExchange.h b/include/xrpl/protocol/STExchange.h index daf5a0e1f2..4b576991b7 100644 --- a/include/xrpl/protocol/STExchange.h +++ b/include/xrpl/protocol/STExchange.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_STEXCHANGE_H_INCLUDED -#define XRPL_PROTOCOL_STEXCHANGE_H_INCLUDED +#pragma once #include #include @@ -152,5 +151,3 @@ erase(STObject& st, TypedField const& f) } } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/STInteger.h b/include/xrpl/protocol/STInteger.h index e79f88808e..b5c4dbf6cf 100644 --- a/include/xrpl/protocol/STInteger.h +++ b/include/xrpl/protocol/STInteger.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_STINTEGER_H_INCLUDED -#define XRPL_PROTOCOL_STINTEGER_H_INCLUDED +#pragma once #include #include @@ -141,5 +140,3 @@ inline STInteger::operator Integer() const } } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/STIssue.h b/include/xrpl/protocol/STIssue.h index 404e60578c..7491e3b3ff 100644 --- a/include/xrpl/protocol/STIssue.h +++ b/include/xrpl/protocol/STIssue.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_STISSUE_H_INCLUDED -#define XRPL_PROTOCOL_STISSUE_H_INCLUDED +#pragma once #include #include @@ -148,5 +147,3 @@ operator<=>(STIssue const& lhs, Asset const& rhs) } } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/STLedgerEntry.h b/include/xrpl/protocol/STLedgerEntry.h index 24efab5f86..6ba3b36c6b 100644 --- a/include/xrpl/protocol/STLedgerEntry.h +++ b/include/xrpl/protocol/STLedgerEntry.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_STLEDGERENTRY_H_INCLUDED -#define XRPL_PROTOCOL_STLEDGERENTRY_H_INCLUDED +#pragma once #include #include @@ -103,5 +102,3 @@ STLedgerEntry::getType() const } } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/STNumber.h b/include/xrpl/protocol/STNumber.h index 39b0c3b042..137016dfe7 100644 --- a/include/xrpl/protocol/STNumber.h +++ b/include/xrpl/protocol/STNumber.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_STNUMBER_H_INCLUDED -#define XRPL_PROTOCOL_STNUMBER_H_INCLUDED +#pragma once #include #include @@ -100,5 +99,3 @@ STNumber numberFromJson(SField const& field, Json::Value const& value); } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/STObject.h b/include/xrpl/protocol/STObject.h index 0a2c37356a..5d5d829c99 100644 --- a/include/xrpl/protocol/STObject.h +++ b/include/xrpl/protocol/STObject.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_STOBJECT_H_INCLUDED -#define XRPL_PROTOCOL_STOBJECT_H_INCLUDED +#pragma once #include #include @@ -1244,5 +1243,3 @@ STObject::peekField(SField const& field) } } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/STParsedJSON.h b/include/xrpl/protocol/STParsedJSON.h index 4be10840bd..772785fd70 100644 --- a/include/xrpl/protocol/STParsedJSON.h +++ b/include/xrpl/protocol/STParsedJSON.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_STPARSEDJSON_H_INCLUDED -#define XRPL_PROTOCOL_STPARSEDJSON_H_INCLUDED +#pragma once #include @@ -36,5 +35,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/STPathSet.h b/include/xrpl/protocol/STPathSet.h index 55e2aebe2d..1bab654d3f 100644 --- a/include/xrpl/protocol/STPathSet.h +++ b/include/xrpl/protocol/STPathSet.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_STPATHSET_H_INCLUDED -#define XRPL_PROTOCOL_STPATHSET_H_INCLUDED +#pragma once #include #include @@ -484,5 +483,3 @@ STPathSet::emplace_back(Args&&... args) } } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/STTakesAsset.h b/include/xrpl/protocol/STTakesAsset.h index 767223b97d..bf75ffccf7 100644 --- a/include/xrpl/protocol/STTakesAsset.h +++ b/include/xrpl/protocol/STTakesAsset.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_STTAKESASSET_H_INCLUDED -#define XRPL_PROTOCOL_STTAKESASSET_H_INCLUDED +#pragma once #include #include @@ -59,5 +58,3 @@ void associateAsset(STLedgerEntry& sle, Asset const& asset); } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/STTx.h b/include/xrpl/protocol/STTx.h index f6ee91623f..a12c658dc2 100644 --- a/include/xrpl/protocol/STTx.h +++ b/include/xrpl/protocol/STTx.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_STTX_H_INCLUDED -#define XRPL_PROTOCOL_STTX_H_INCLUDED +#pragma once #include #include @@ -196,5 +195,3 @@ STTx::getTransactionID() const } } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/STValidation.h b/include/xrpl/protocol/STValidation.h index 6f071acda1..aa48161f68 100644 --- a/include/xrpl/protocol/STValidation.h +++ b/include/xrpl/protocol/STValidation.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_STVALIDATION_H_INCLUDED -#define XRPL_PROTOCOL_STVALIDATION_H_INCLUDED +#pragma once #include #include @@ -245,5 +244,3 @@ STValidation::setSeen(NetClock::time_point s) } } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/STVector256.h b/include/xrpl/protocol/STVector256.h index 884fd70c7c..c83d981bfc 100644 --- a/include/xrpl/protocol/STVector256.h +++ b/include/xrpl/protocol/STVector256.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_STVECTOR256_H_INCLUDED -#define XRPL_PROTOCOL_STVECTOR256_H_INCLUDED +#pragma once #include #include @@ -232,5 +231,3 @@ STVector256::clear() noexcept } } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/STXChainBridge.h b/include/xrpl/protocol/STXChainBridge.h index fdaed22594..709d3886b7 100644 --- a/include/xrpl/protocol/STXChainBridge.h +++ b/include/xrpl/protocol/STXChainBridge.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_STXCHAINBRIDGE_H_INCLUDED -#define XRPL_PROTOCOL_STXCHAINBRIDGE_H_INCLUDED +#pragma once #include #include @@ -197,5 +196,3 @@ STXChainBridge::dstChain(bool wasLockingChainSend) } } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/SecretKey.h b/include/xrpl/protocol/SecretKey.h index 146e9a7105..a59b1150c1 100644 --- a/include/xrpl/protocol/SecretKey.h +++ b/include/xrpl/protocol/SecretKey.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_SECRETKEY_H_INCLUDED -#define XRPL_PROTOCOL_SECRETKEY_H_INCLUDED +#pragma once #include #include @@ -162,5 +161,3 @@ sign(KeyType type, SecretKey const& sk, Slice const& message) /** @} */ } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/Seed.h b/include/xrpl/protocol/Seed.h index 36b2bbfee3..1fad94e2bd 100644 --- a/include/xrpl/protocol/Seed.h +++ b/include/xrpl/protocol/Seed.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_SEED_H_INCLUDED -#define XRPL_PROTOCOL_SEED_H_INCLUDED +#pragma once #include #include @@ -118,5 +117,3 @@ toBase58(Seed const& seed) } } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/SeqProxy.h b/include/xrpl/protocol/SeqProxy.h index 8dde232e75..563292f8b3 100644 --- a/include/xrpl/protocol/SeqProxy.h +++ b/include/xrpl/protocol/SeqProxy.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_SEQ_PROXY_H_INCLUDED -#define XRPL_PROTOCOL_SEQ_PROXY_H_INCLUDED +#pragma once #include #include @@ -147,5 +146,3 @@ public: } }; } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/Serializer.h b/include/xrpl/protocol/Serializer.h index 7e294bd3a8..98cefb4d08 100644 --- a/include/xrpl/protocol/Serializer.h +++ b/include/xrpl/protocol/Serializer.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_SERIALIZER_H_INCLUDED -#define XRPL_PROTOCOL_SERIALIZER_H_INCLUDED +#pragma once #include #include @@ -447,5 +446,3 @@ SerialIter::getBitString() } } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/Sign.h b/include/xrpl/protocol/Sign.h index d9af89b774..9f0bf2f1ca 100644 --- a/include/xrpl/protocol/Sign.h +++ b/include/xrpl/protocol/Sign.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_SIGN_H_INCLUDED -#define XRPL_PROTOCOL_SIGN_H_INCLUDED +#pragma once #include #include @@ -59,5 +58,3 @@ finishMultiSigningData(AccountID const& signingID, Serializer& s) } } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/SystemParameters.h b/include/xrpl/protocol/SystemParameters.h index c2f66e9ea1..70ab67c56f 100644 --- a/include/xrpl/protocol/SystemParameters.h +++ b/include/xrpl/protocol/SystemParameters.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_SYSTEMPARAMETERS_H_INCLUDED -#define XRPL_PROTOCOL_SYSTEMPARAMETERS_H_INCLUDED +#pragma once #include #include @@ -66,5 +65,3 @@ constexpr std::chrono::seconds const defaultAmendmentMajorityTime = weeks{2}; /** Default peer port (IANA registered) */ inline std::uint16_t constexpr DEFAULT_PEER_PORT{2459}; - -#endif diff --git a/include/xrpl/protocol/TER.h b/include/xrpl/protocol/TER.h index 65a339231d..52001ce72b 100644 --- a/include/xrpl/protocol/TER.h +++ b/include/xrpl/protocol/TER.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_TER_H_INCLUDED -#define XRPL_PROTOCOL_TER_H_INCLUDED +#pragma once #include #include @@ -675,5 +674,3 @@ std::optional transCode(std::string const& token); } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/TxFlags.h b/include/xrpl/protocol/TxFlags.h index 5527a264e4..6c6ef5e369 100644 --- a/include/xrpl/protocol/TxFlags.h +++ b/include/xrpl/protocol/TxFlags.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_TXFLAGS_H_INCLUDED -#define XRPL_PROTOCOL_TXFLAGS_H_INCLUDED +#pragma once #include @@ -295,5 +294,3 @@ constexpr std::uint32_t const tfLoanManageMask = ~(tfUniversal | tfLoanDefault | // clang-format on } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/TxFormats.h b/include/xrpl/protocol/TxFormats.h index 05f03c5cdc..b76eef7585 100644 --- a/include/xrpl/protocol/TxFormats.h +++ b/include/xrpl/protocol/TxFormats.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_TXFORMATS_H_INCLUDED -#define XRPL_PROTOCOL_TXFORMATS_H_INCLUDED +#pragma once #include @@ -77,5 +76,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/TxMeta.h b/include/xrpl/protocol/TxMeta.h index 5b6716e380..a295eb4569 100644 --- a/include/xrpl/protocol/TxMeta.h +++ b/include/xrpl/protocol/TxMeta.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_TX_TRANSACTIONMETA_H_INCLUDED -#define XRPL_APP_TX_TRANSACTIONMETA_H_INCLUDED +#pragma once #include #include @@ -118,5 +117,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/UintTypes.h b/include/xrpl/protocol/UintTypes.h index daa66e8286..fd48244d89 100644 --- a/include/xrpl/protocol/UintTypes.h +++ b/include/xrpl/protocol/UintTypes.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_UINTTYPES_H_INCLUDED -#define XRPL_PROTOCOL_UINTTYPES_H_INCLUDED +#pragma once #include #include @@ -125,5 +124,3 @@ struct hash : xrpl::uint256::hasher }; } // namespace std - -#endif diff --git a/include/xrpl/protocol/Units.h b/include/xrpl/protocol/Units.h index e52fbefe46..ecf0bf7798 100644 --- a/include/xrpl/protocol/Units.h +++ b/include/xrpl/protocol/Units.h @@ -1,5 +1,4 @@ -#ifndef PROTOCOL_UNITS_H_INCLUDED -#define PROTOCOL_UNITS_H_INCLUDED +#pragma once #include #include @@ -516,5 +515,3 @@ unsafe_cast(Src s) noexcept } } // namespace xrpl - -#endif // PROTOCOL_UNITS_H_INCLUDED diff --git a/include/xrpl/protocol/XChainAttestations.h b/include/xrpl/protocol/XChainAttestations.h index c5415e518b..fc3c464b92 100644 --- a/include/xrpl/protocol/XChainAttestations.h +++ b/include/xrpl/protocol/XChainAttestations.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_STXATTESTATIONS_H_INCLUDED -#define XRPL_PROTOCOL_STXATTESTATIONS_H_INCLUDED +#pragma once #include #include @@ -464,5 +463,3 @@ class XChainCreateAccountAttestations final : public XChainAttestationsBase #include @@ -282,5 +281,3 @@ mulRatio(XRPAmount const& amt, std::uint32_t num, std::uint32_t den, bool roundU } } // namespace xrpl - -#endif // XRPL_BASICS_XRPAMOUNT_H_INCLUDED diff --git a/include/xrpl/protocol/detail/STVar.h b/include/xrpl/protocol/detail/STVar.h index 219d1ed738..b5373d1a4a 100644 --- a/include/xrpl/protocol/detail/STVar.h +++ b/include/xrpl/protocol/detail/STVar.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_STVAR_H_INCLUDED -#define XRPL_PROTOCOL_STVAR_H_INCLUDED +#pragma once #include #include @@ -163,5 +162,3 @@ operator!=(STVar const& lhs, STVar const& rhs) } // namespace detail } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/detail/b58_utils.h b/include/xrpl/protocol/detail/b58_utils.h index 1dce148aed..a34104555e 100644 --- a/include/xrpl/protocol/detail/b58_utils.h +++ b/include/xrpl/protocol/detail/b58_utils.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_B58_UTILS_H_INCLUDED -#define XRPL_PROTOCOL_B58_UTILS_H_INCLUDED +#pragma once #include #include @@ -175,4 +174,3 @@ b58_10_to_b58_be(std::uint64_t input) #endif } // namespace xrpl -#endif // XRPL_PROTOCOL_B58_UTILS_H_INCLUDED diff --git a/include/xrpl/protocol/detail/secp256k1.h b/include/xrpl/protocol/detail/secp256k1.h index 0a2d5fcd8f..0ac810fd80 100644 --- a/include/xrpl/protocol/detail/secp256k1.h +++ b/include/xrpl/protocol/detail/secp256k1.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_SECP256K1_H_INCLUDED -#define XRPL_PROTOCOL_SECP256K1_H_INCLUDED +#pragma once #include @@ -26,5 +25,3 @@ secp256k1Context() } } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/detail/token_errors.h b/include/xrpl/protocol/detail/token_errors.h index 1d5276e78b..686851f508 100644 --- a/include/xrpl/protocol/detail/token_errors.h +++ b/include/xrpl/protocol/detail/token_errors.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_TOKEN_ERRORS_H_INCLUDED -#define XRPL_PROTOCOL_TOKEN_ERRORS_H_INCLUDED +#pragma once #include @@ -80,4 +79,3 @@ make_error_code(xrpl::TokenCodecErrc e) return {static_cast(e), TokenCodecErrcCategory()}; } } // namespace xrpl -#endif // TOKEN_ERRORS_H_ diff --git a/include/xrpl/protocol/digest.h b/include/xrpl/protocol/digest.h index bafac699f5..b5ec277e7b 100644 --- a/include/xrpl/protocol/digest.h +++ b/include/xrpl/protocol/digest.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_DIGEST_H_INCLUDED -#define XRPL_PROTOCOL_DIGEST_H_INCLUDED +#pragma once #include #include @@ -227,5 +226,3 @@ sha512Half_s(Args const&... args) } } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/json_get_or_throw.h b/include/xrpl/protocol/json_get_or_throw.h index 8bc89805d3..7cdf481ad3 100644 --- a/include/xrpl/protocol/json_get_or_throw.h +++ b/include/xrpl/protocol/json_get_or_throw.h @@ -1,5 +1,4 @@ -#ifndef PROTOCOL_GET_OR_THROW_H_ -#define PROTOCOL_GET_OR_THROW_H_ +#pragma once #include #include @@ -152,5 +151,3 @@ getOptional(Json::Value const& v, xrpl::SField const& field) } } // namespace Json - -#endif // PROTOCOL_GET_OR_THROW_H_ diff --git a/include/xrpl/protocol/jss.h b/include/xrpl/protocol/jss.h index d86ca9bf1f..0264f625eb 100644 --- a/include/xrpl/protocol/jss.h +++ b/include/xrpl/protocol/jss.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_JSONFIELDS_H_INCLUDED -#define XRPL_PROTOCOL_JSONFIELDS_H_INCLUDED +#pragma once #include @@ -726,5 +725,3 @@ JSS(write_load); // out: GetCounts } // namespace jss } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/messages.h b/include/xrpl/protocol/messages.h index d14739d532..e6654cc183 100644 --- a/include/xrpl/protocol/messages.h +++ b/include/xrpl/protocol/messages.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_MESSAGES_H_INCLUDED -#define XRPL_PROTOCOL_MESSAGES_H_INCLUDED +#pragma once // Some versions of protobuf generate code that will produce errors during // compilation. See https://github.com/google/protobuf/issues/549 for more @@ -13,5 +12,3 @@ #endif #include - -#endif diff --git a/include/xrpl/protocol/nft.h b/include/xrpl/protocol/nft.h index 3a8cdcd6e2..4be58c381c 100644 --- a/include/xrpl/protocol/nft.h +++ b/include/xrpl/protocol/nft.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_NFT_H_INCLUDED -#define XRPL_PROTOCOL_NFT_H_INCLUDED +#pragma once #include #include @@ -105,5 +104,3 @@ getIssuer(uint256 const& id) } // namespace nft } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/nftPageMask.h b/include/xrpl/protocol/nftPageMask.h index 0877d4976d..05a42ce294 100644 --- a/include/xrpl/protocol/nftPageMask.h +++ b/include/xrpl/protocol/nftPageMask.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_NFT_PAGE_MASK_H_INCLUDED -#define XRPL_PROTOCOL_NFT_PAGE_MASK_H_INCLUDED +#pragma once #include @@ -14,5 +13,3 @@ uint256 constexpr pageMask(std::string_view("00000000000000000000000000000000000 } // namespace nft } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/serialize.h b/include/xrpl/protocol/serialize.h index eedf041baa..5b84a28b5d 100644 --- a/include/xrpl/protocol/serialize.h +++ b/include/xrpl/protocol/serialize.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_SERIALIZE_H_INCLUDED -#define XRPL_PROTOCOL_SERIALIZE_H_INCLUDED +#pragma once #include #include @@ -25,5 +24,3 @@ serializeHex(STObject const& o) } } // namespace xrpl - -#endif diff --git a/include/xrpl/protocol/st.h b/include/xrpl/protocol/st.h index 115c373c7f..61571196f2 100644 --- a/include/xrpl/protocol/st.h +++ b/include/xrpl/protocol/st.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_ST_H_INCLUDED -#define XRPL_PROTOCOL_ST_H_INCLUDED +#pragma once #include #include @@ -17,5 +16,3 @@ #include #include #include - -#endif diff --git a/include/xrpl/protocol/tokens.h b/include/xrpl/protocol/tokens.h index 96b311a366..8cda8efc86 100644 --- a/include/xrpl/protocol/tokens.h +++ b/include/xrpl/protocol/tokens.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PROTOCOL_TOKENS_H_INCLUDED -#define XRPL_PROTOCOL_TOKENS_H_INCLUDED +#pragma once #include #include @@ -100,5 +99,3 @@ b58_to_b256_be(std::string_view input, std::span out); } // namespace b58_fast #endif // _MSC_VER } // namespace xrpl - -#endif diff --git a/include/xrpl/resource/Charge.h b/include/xrpl/resource/Charge.h index 1edaca28b4..55b13731b9 100644 --- a/include/xrpl/resource/Charge.h +++ b/include/xrpl/resource/Charge.h @@ -1,5 +1,4 @@ -#ifndef XRPL_RESOURCE_CHARGE_H_INCLUDED -#define XRPL_RESOURCE_CHARGE_H_INCLUDED +#pragma once #include @@ -50,5 +49,3 @@ operator<<(std::ostream& os, Charge const& v); } // namespace Resource } // namespace xrpl - -#endif diff --git a/include/xrpl/resource/Consumer.h b/include/xrpl/resource/Consumer.h index 6e973d824c..45cc221212 100644 --- a/include/xrpl/resource/Consumer.h +++ b/include/xrpl/resource/Consumer.h @@ -1,5 +1,4 @@ -#ifndef XRPL_RESOURCE_CONSUMER_H_INCLUDED -#define XRPL_RESOURCE_CONSUMER_H_INCLUDED +#pragma once #include #include @@ -82,5 +81,3 @@ operator<<(std::ostream& os, Consumer const& v); } // namespace Resource } // namespace xrpl - -#endif diff --git a/include/xrpl/resource/Disposition.h b/include/xrpl/resource/Disposition.h index 81675e8376..096afb6a6f 100644 --- a/include/xrpl/resource/Disposition.h +++ b/include/xrpl/resource/Disposition.h @@ -1,5 +1,4 @@ -#ifndef XRPL_RESOURCE_DISPOSITION_H_INCLUDED -#define XRPL_RESOURCE_DISPOSITION_H_INCLUDED +#pragma once namespace xrpl { namespace Resource { @@ -20,5 +19,3 @@ enum Disposition { } // namespace Resource } // namespace xrpl - -#endif diff --git a/include/xrpl/resource/Fees.h b/include/xrpl/resource/Fees.h index 643a8e624c..0ba083d4fe 100644 --- a/include/xrpl/resource/Fees.h +++ b/include/xrpl/resource/Fees.h @@ -1,5 +1,4 @@ -#ifndef XRPL_RESOURCE_FEES_H_INCLUDED -#define XRPL_RESOURCE_FEES_H_INCLUDED +#pragma once #include @@ -41,5 +40,3 @@ extern Charge const feeDrop; // The cost of being dropped for } // namespace Resource } // namespace xrpl - -#endif diff --git a/include/xrpl/resource/Gossip.h b/include/xrpl/resource/Gossip.h index dfd04288fc..e581145149 100644 --- a/include/xrpl/resource/Gossip.h +++ b/include/xrpl/resource/Gossip.h @@ -1,5 +1,4 @@ -#ifndef XRPL_RESOURCE_GOSSIP_H_INCLUDED -#define XRPL_RESOURCE_GOSSIP_H_INCLUDED +#pragma once #include @@ -27,5 +26,3 @@ struct Gossip } // namespace Resource } // namespace xrpl - -#endif diff --git a/include/xrpl/resource/ResourceManager.h b/include/xrpl/resource/ResourceManager.h index 4f331913ef..c04e7bb79b 100644 --- a/include/xrpl/resource/ResourceManager.h +++ b/include/xrpl/resource/ResourceManager.h @@ -1,5 +1,4 @@ -#ifndef XRPL_RESOURCE_MANAGER_H_INCLUDED -#define XRPL_RESOURCE_MANAGER_H_INCLUDED +#pragma once #include #include @@ -62,5 +61,3 @@ make_Manager(beast::insight::Collector::ptr const& collector, beast::Journal jou } // namespace Resource } // namespace xrpl - -#endif diff --git a/include/xrpl/resource/Types.h b/include/xrpl/resource/Types.h index 8923933f0f..fb71cffe37 100644 --- a/include/xrpl/resource/Types.h +++ b/include/xrpl/resource/Types.h @@ -1,5 +1,4 @@ -#ifndef XRPL_RESOURCE_TYPES_H_INCLUDED -#define XRPL_RESOURCE_TYPES_H_INCLUDED +#pragma once namespace xrpl { namespace Resource { @@ -9,5 +8,3 @@ struct Entry; } // namespace Resource } // namespace xrpl - -#endif diff --git a/include/xrpl/resource/detail/Entry.h b/include/xrpl/resource/detail/Entry.h index 11f8a08511..ecff8828af 100644 --- a/include/xrpl/resource/detail/Entry.h +++ b/include/xrpl/resource/detail/Entry.h @@ -1,5 +1,4 @@ -#ifndef XRPL_RESOURCE_ENTRY_H_INCLUDED -#define XRPL_RESOURCE_ENTRY_H_INCLUDED +#pragma once #include #include @@ -90,5 +89,3 @@ operator<<(std::ostream& os, Entry const& v) } // namespace Resource } // namespace xrpl - -#endif diff --git a/include/xrpl/resource/detail/Import.h b/include/xrpl/resource/detail/Import.h index d33bd5f156..790fc0596a 100644 --- a/include/xrpl/resource/detail/Import.h +++ b/include/xrpl/resource/detail/Import.h @@ -1,5 +1,4 @@ -#ifndef XRPL_RESOURCE_IMPORT_H_INCLUDED -#define XRPL_RESOURCE_IMPORT_H_INCLUDED +#pragma once #include #include @@ -32,5 +31,3 @@ struct Import } // namespace Resource } // namespace xrpl - -#endif diff --git a/include/xrpl/resource/detail/Key.h b/include/xrpl/resource/detail/Key.h index e63d2827ea..0c5164a7d8 100644 --- a/include/xrpl/resource/detail/Key.h +++ b/include/xrpl/resource/detail/Key.h @@ -1,5 +1,4 @@ -#ifndef XRPL_RESOURCE_KEY_H_INCLUDED -#define XRPL_RESOURCE_KEY_H_INCLUDED +#pragma once #include #include @@ -48,5 +47,3 @@ struct Key } // namespace Resource } // namespace xrpl - -#endif diff --git a/include/xrpl/resource/detail/Kind.h b/include/xrpl/resource/detail/Kind.h index 0e55b65780..fbb6b65e25 100644 --- a/include/xrpl/resource/detail/Kind.h +++ b/include/xrpl/resource/detail/Kind.h @@ -1,5 +1,4 @@ -#ifndef XRPL_RESOURCE_KIND_H_INCLUDED -#define XRPL_RESOURCE_KIND_H_INCLUDED +#pragma once namespace xrpl { namespace Resource { @@ -16,5 +15,3 @@ enum Kind { kindInbound, kindOutbound, kindUnlimited }; } // namespace Resource } // namespace xrpl - -#endif diff --git a/include/xrpl/resource/detail/Logic.h b/include/xrpl/resource/detail/Logic.h index e12d02b996..066e416550 100644 --- a/include/xrpl/resource/detail/Logic.h +++ b/include/xrpl/resource/detail/Logic.h @@ -1,5 +1,4 @@ -#ifndef XRPL_RESOURCE_LOGIC_H_INCLUDED -#define XRPL_RESOURCE_LOGIC_H_INCLUDED +#pragma once #include #include @@ -548,5 +547,3 @@ public: } // namespace Resource } // namespace xrpl - -#endif diff --git a/include/xrpl/resource/detail/Tuning.h b/include/xrpl/resource/detail/Tuning.h index 9d7ba31303..d5be5cf0b6 100644 --- a/include/xrpl/resource/detail/Tuning.h +++ b/include/xrpl/resource/detail/Tuning.h @@ -1,5 +1,4 @@ -#ifndef XRPL_RESOURCE_TUNING_H_INCLUDED -#define XRPL_RESOURCE_TUNING_H_INCLUDED +#pragma once #include @@ -33,5 +32,3 @@ std::chrono::seconds constexpr gossipExpirationSeconds{30}; } // namespace Resource } // namespace xrpl - -#endif diff --git a/include/xrpl/server/Handoff.h b/include/xrpl/server/Handoff.h index 2edb6e2203..60ed16def4 100644 --- a/include/xrpl/server/Handoff.h +++ b/include/xrpl/server/Handoff.h @@ -1,5 +1,4 @@ -#ifndef XRPL_SERVER_HANDOFF_H_INCLUDED -#define XRPL_SERVER_HANDOFF_H_INCLUDED +#pragma once #include @@ -35,5 +34,3 @@ struct Handoff }; } // namespace xrpl - -#endif diff --git a/include/xrpl/server/Port.h b/include/xrpl/server/Port.h index 995401f8fd..1dfa93b0a7 100644 --- a/include/xrpl/server/Port.h +++ b/include/xrpl/server/Port.h @@ -1,5 +1,4 @@ -#ifndef XRPL_SERVER_PORT_H_INCLUDED -#define XRPL_SERVER_PORT_H_INCLUDED +#pragma once #include #include @@ -105,5 +104,3 @@ void parse_Port(ParsedPort& port, Section const& section, std::ostream& log); } // namespace xrpl - -#endif diff --git a/include/xrpl/server/Server.h b/include/xrpl/server/Server.h index 7bc7765cea..52340ac900 100644 --- a/include/xrpl/server/Server.h +++ b/include/xrpl/server/Server.h @@ -1,5 +1,4 @@ -#ifndef XRPL_SERVER_SERVER_H_INCLUDED -#define XRPL_SERVER_SERVER_H_INCLUDED +#pragma once #include #include @@ -19,5 +18,3 @@ make_Server(Handler& handler, boost::asio::io_context& io_context, beast::Journa } } // namespace xrpl - -#endif diff --git a/include/xrpl/server/Session.h b/include/xrpl/server/Session.h index e2c640b827..37cbf59775 100644 --- a/include/xrpl/server/Session.h +++ b/include/xrpl/server/Session.h @@ -1,5 +1,4 @@ -#ifndef XRPL_SERVER_SESSION_H_INCLUDED -#define XRPL_SERVER_SESSION_H_INCLUDED +#pragma once #include #include @@ -110,5 +109,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/server/SimpleWriter.h b/include/xrpl/server/SimpleWriter.h index 75af7169fc..87b94507a4 100644 --- a/include/xrpl/server/SimpleWriter.h +++ b/include/xrpl/server/SimpleWriter.h @@ -1,5 +1,4 @@ -#ifndef XRPL_SERVER_SIMPLEWRITER_H_INCLUDED -#define XRPL_SERVER_SIMPLEWRITER_H_INCLUDED +#pragma once #include @@ -55,5 +54,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/server/WSSession.h b/include/xrpl/server/WSSession.h index b2d116bb45..56105739e9 100644 --- a/include/xrpl/server/WSSession.h +++ b/include/xrpl/server/WSSession.h @@ -1,5 +1,4 @@ -#ifndef XRPL_SERVER_WSSESSION_H_INCLUDED -#define XRPL_SERVER_WSSESSION_H_INCLUDED +#pragma once #include #include @@ -125,5 +124,3 @@ struct WSSession }; } // namespace xrpl - -#endif diff --git a/include/xrpl/server/Writer.h b/include/xrpl/server/Writer.h index 7e0c304ea9..05fea863be 100644 --- a/include/xrpl/server/Writer.h +++ b/include/xrpl/server/Writer.h @@ -1,5 +1,4 @@ -#ifndef XRPL_SERVER_WRITER_H_INCLUDED -#define XRPL_SERVER_WRITER_H_INCLUDED +#pragma once #include @@ -38,5 +37,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/server/detail/BaseHTTPPeer.h b/include/xrpl/server/detail/BaseHTTPPeer.h index 2a2c523e2b..ab85cb7c89 100644 --- a/include/xrpl/server/detail/BaseHTTPPeer.h +++ b/include/xrpl/server/detail/BaseHTTPPeer.h @@ -1,5 +1,4 @@ -#ifndef XRPL_SERVER_BASEHTTPPEER_H_INCLUDED -#define XRPL_SERVER_BASEHTTPPEER_H_INCLUDED +#pragma once #include #include @@ -457,5 +456,3 @@ BaseHTTPPeer::close(bool graceful) } } // namespace xrpl - -#endif diff --git a/include/xrpl/server/detail/BasePeer.h b/include/xrpl/server/detail/BasePeer.h index cbd8ac2c8d..afa1ceb993 100644 --- a/include/xrpl/server/detail/BasePeer.h +++ b/include/xrpl/server/detail/BasePeer.h @@ -1,5 +1,4 @@ -#ifndef XRPL_SERVER_BASEPEER_H_INCLUDED -#define XRPL_SERVER_BASEPEER_H_INCLUDED +#pragma once #include #include @@ -88,5 +87,3 @@ BasePeer::close() } } // namespace xrpl - -#endif diff --git a/include/xrpl/server/detail/BaseWSPeer.h b/include/xrpl/server/detail/BaseWSPeer.h index 435930e476..ab985dfac5 100644 --- a/include/xrpl/server/detail/BaseWSPeer.h +++ b/include/xrpl/server/detail/BaseWSPeer.h @@ -1,5 +1,4 @@ -#ifndef XRPL_SERVER_BASEWSPEER_H_INCLUDED -#define XRPL_SERVER_BASEWSPEER_H_INCLUDED +#pragma once #include #include @@ -451,5 +450,3 @@ BaseWSPeer::fail(error_code ec, String const& what) } } // namespace xrpl - -#endif diff --git a/include/xrpl/server/detail/Door.h b/include/xrpl/server/detail/Door.h index 9177d373bc..e41049f203 100644 --- a/include/xrpl/server/detail/Door.h +++ b/include/xrpl/server/detail/Door.h @@ -1,5 +1,4 @@ -#ifndef XRPL_SERVER_DOOR_H_INCLUDED -#define XRPL_SERVER_DOOR_H_INCLUDED +#pragma once #include #include @@ -424,5 +423,3 @@ Door::should_throttle_for_fds() } } // namespace xrpl - -#endif diff --git a/include/xrpl/server/detail/JSONRPCUtil.h b/include/xrpl/server/detail/JSONRPCUtil.h index 2d4f6a6771..934085f8e6 100644 --- a/include/xrpl/server/detail/JSONRPCUtil.h +++ b/include/xrpl/server/detail/JSONRPCUtil.h @@ -1,5 +1,4 @@ -#ifndef XRPL_SERVER_JSONRPCUTIL_H_INCLUDED -#define XRPL_SERVER_JSONRPCUTIL_H_INCLUDED +#pragma once #include #include @@ -11,5 +10,3 @@ void HTTPReply(int nStatus, std::string const& strMsg, Json::Output const&, beast::Journal j); } // namespace xrpl - -#endif diff --git a/include/xrpl/server/detail/LowestLayer.h b/include/xrpl/server/detail/LowestLayer.h index c45d948241..b8b0d46180 100644 --- a/include/xrpl/server/detail/LowestLayer.h +++ b/include/xrpl/server/detail/LowestLayer.h @@ -1,5 +1,4 @@ -#ifndef XRPL_SERVER_LOWESTLAYER_H_INCLUDED -#define XRPL_SERVER_LOWESTLAYER_H_INCLUDED +#pragma once #if BOOST_VERSION >= 107000 #include @@ -22,5 +21,3 @@ get_lowest_layer(T& t) noexcept } } // namespace xrpl - -#endif diff --git a/include/xrpl/server/detail/PlainHTTPPeer.h b/include/xrpl/server/detail/PlainHTTPPeer.h index 834a99aae8..94c84336f9 100644 --- a/include/xrpl/server/detail/PlainHTTPPeer.h +++ b/include/xrpl/server/detail/PlainHTTPPeer.h @@ -1,5 +1,4 @@ -#ifndef XRPL_SERVER_PLAINHTTPPEER_H_INCLUDED -#define XRPL_SERVER_PLAINHTTPPEER_H_INCLUDED +#pragma once #include #include @@ -140,5 +139,3 @@ PlainHTTPPeer::do_close() } } // namespace xrpl - -#endif diff --git a/include/xrpl/server/detail/PlainWSPeer.h b/include/xrpl/server/detail/PlainWSPeer.h index 4d5c57533b..9196d5ea49 100644 --- a/include/xrpl/server/detail/PlainWSPeer.h +++ b/include/xrpl/server/detail/PlainWSPeer.h @@ -1,5 +1,4 @@ -#ifndef XRPL_SERVER_PLAINWSPEER_H_INCLUDED -#define XRPL_SERVER_PLAINWSPEER_H_INCLUDED +#pragma once #include @@ -59,5 +58,3 @@ PlainWSPeer::PlainWSPeer( } } // namespace xrpl - -#endif diff --git a/include/xrpl/server/detail/SSLHTTPPeer.h b/include/xrpl/server/detail/SSLHTTPPeer.h index b0102ac24b..138145544e 100644 --- a/include/xrpl/server/detail/SSLHTTPPeer.h +++ b/include/xrpl/server/detail/SSLHTTPPeer.h @@ -1,5 +1,4 @@ -#ifndef XRPL_SERVER_SSLHTTPPEER_H_INCLUDED -#define XRPL_SERVER_SSLHTTPPEER_H_INCLUDED +#pragma once #include #include @@ -175,5 +174,3 @@ SSLHTTPPeer::on_shutdown(error_code ec) } } // namespace xrpl - -#endif diff --git a/include/xrpl/server/detail/SSLWSPeer.h b/include/xrpl/server/detail/SSLWSPeer.h index bb5da1c6e7..b80312e55f 100644 --- a/include/xrpl/server/detail/SSLWSPeer.h +++ b/include/xrpl/server/detail/SSLWSPeer.h @@ -1,5 +1,4 @@ -#ifndef XRPL_SERVER_SSLWSPEER_H_INCLUDED -#define XRPL_SERVER_SSLWSPEER_H_INCLUDED +#pragma once #include #include @@ -68,5 +67,3 @@ SSLWSPeer::SSLWSPeer( } } // namespace xrpl - -#endif diff --git a/include/xrpl/server/detail/ServerImpl.h b/include/xrpl/server/detail/ServerImpl.h index e341eac849..e836b964d2 100644 --- a/include/xrpl/server/detail/ServerImpl.h +++ b/include/xrpl/server/detail/ServerImpl.h @@ -1,5 +1,4 @@ -#ifndef XRPL_SERVER_SERVERIMPL_H_INCLUDED -#define XRPL_SERVER_SERVERIMPL_H_INCLUDED +#pragma once #include #include @@ -180,5 +179,3 @@ ServerImpl::closed() return ios_.closed(); } } // namespace xrpl - -#endif diff --git a/include/xrpl/server/detail/Spawn.h b/include/xrpl/server/detail/Spawn.h index 1fbf9e7003..d94fb4fa05 100644 --- a/include/xrpl/server/detail/Spawn.h +++ b/include/xrpl/server/detail/Spawn.h @@ -1,5 +1,4 @@ -#ifndef XRPL_SERVER_SPAWN_H_INCLUDED -#define XRPL_SERVER_SPAWN_H_INCLUDED +#pragma once #include @@ -79,5 +78,3 @@ spawn(Ctx&& ctx, F&& func) } } // namespace xrpl::util - -#endif diff --git a/include/xrpl/server/detail/io_list.h b/include/xrpl/server/detail/io_list.h index e60c33d084..5b1a02e039 100644 --- a/include/xrpl/server/detail/io_list.h +++ b/include/xrpl/server/detail/io_list.h @@ -1,5 +1,4 @@ -#ifndef XRPL_SERVER_IO_LIST_H_INCLUDED -#define XRPL_SERVER_IO_LIST_H_INCLUDED +#pragma once #include @@ -243,5 +242,3 @@ io_list::join() } } // namespace xrpl - -#endif diff --git a/include/xrpl/shamap/Family.h b/include/xrpl/shamap/Family.h index 6638d67df8..73887fb2dc 100644 --- a/include/xrpl/shamap/Family.h +++ b/include/xrpl/shamap/Family.h @@ -1,5 +1,4 @@ -#ifndef XRPL_SHAMAP_FAMILY_H_INCLUDED -#define XRPL_SHAMAP_FAMILY_H_INCLUDED +#pragma once #include #include @@ -66,5 +65,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/shamap/FullBelowCache.h b/include/xrpl/shamap/FullBelowCache.h index 4b7a9aae67..6a6da1463a 100644 --- a/include/xrpl/shamap/FullBelowCache.h +++ b/include/xrpl/shamap/FullBelowCache.h @@ -1,5 +1,4 @@ -#ifndef XRPL_SHAMAP_FULLBELOWCACHE_H_INCLUDED -#define XRPL_SHAMAP_FULLBELOWCACHE_H_INCLUDED +#pragma once #include #include @@ -129,5 +128,3 @@ private: using FullBelowCache = detail::BasicFullBelowCache; } // namespace xrpl - -#endif diff --git a/include/xrpl/shamap/SHAMap.h b/include/xrpl/shamap/SHAMap.h index 9013b3cc9c..cd084ab48b 100644 --- a/include/xrpl/shamap/SHAMap.h +++ b/include/xrpl/shamap/SHAMap.h @@ -1,5 +1,4 @@ -#ifndef XRPL_SHAMAP_SHAMAP_H_INCLUDED -#define XRPL_SHAMAP_SHAMAP_H_INCLUDED +#pragma once #include #include @@ -678,5 +677,3 @@ SHAMap::end() const } } // namespace xrpl - -#endif diff --git a/include/xrpl/shamap/SHAMapAccountStateLeafNode.h b/include/xrpl/shamap/SHAMapAccountStateLeafNode.h index c622d68a1f..552d2b4692 100644 --- a/include/xrpl/shamap/SHAMapAccountStateLeafNode.h +++ b/include/xrpl/shamap/SHAMapAccountStateLeafNode.h @@ -1,5 +1,4 @@ -#ifndef XRPL_SHAMAP_SHAMAPACCOUNTSTATELEAFNODE_H_INCLUDED -#define XRPL_SHAMAP_SHAMAPACCOUNTSTATELEAFNODE_H_INCLUDED +#pragma once #include #include @@ -60,5 +59,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/shamap/SHAMapAddNode.h b/include/xrpl/shamap/SHAMapAddNode.h index 2dc3d15486..7d0aaf3be4 100644 --- a/include/xrpl/shamap/SHAMapAddNode.h +++ b/include/xrpl/shamap/SHAMapAddNode.h @@ -1,5 +1,4 @@ -#ifndef XRPL_SHAMAP_SHAMAPADDNODE_H_INCLUDED -#define XRPL_SHAMAP_SHAMAPADDNODE_H_INCLUDED +#pragma once #include @@ -161,5 +160,3 @@ SHAMapAddNode::get() const } } // namespace xrpl - -#endif diff --git a/include/xrpl/shamap/SHAMapInnerNode.h b/include/xrpl/shamap/SHAMapInnerNode.h index eab60f0348..73d59cc1fe 100644 --- a/include/xrpl/shamap/SHAMapInnerNode.h +++ b/include/xrpl/shamap/SHAMapInnerNode.h @@ -1,5 +1,4 @@ -#ifndef XRPL_SHAMAP_SHAMAPINNERNODE_H_INCLUDED -#define XRPL_SHAMAP_SHAMAPINNERNODE_H_INCLUDED +#pragma once #include #include @@ -200,4 +199,3 @@ SHAMapInnerNode::setFullBelowGen(std::uint32_t gen) } } // namespace xrpl -#endif diff --git a/include/xrpl/shamap/SHAMapItem.h b/include/xrpl/shamap/SHAMapItem.h index a67dfd866c..ab9cf74dc8 100644 --- a/include/xrpl/shamap/SHAMapItem.h +++ b/include/xrpl/shamap/SHAMapItem.h @@ -1,5 +1,4 @@ -#ifndef XRPL_SHAMAP_SHAMAPITEM_H_INCLUDED -#define XRPL_SHAMAP_SHAMAPITEM_H_INCLUDED +#pragma once #include #include @@ -163,5 +162,3 @@ make_shamapitem(SHAMapItem const& other) } } // namespace xrpl - -#endif diff --git a/include/xrpl/shamap/SHAMapLeafNode.h b/include/xrpl/shamap/SHAMapLeafNode.h index 4d18fc9108..aedcb3b79c 100644 --- a/include/xrpl/shamap/SHAMapLeafNode.h +++ b/include/xrpl/shamap/SHAMapLeafNode.h @@ -1,5 +1,4 @@ -#ifndef XRPL_SHAMAP_SHAMAPLEAFNODE_H_INCLUDED -#define XRPL_SHAMAP_SHAMAPLEAFNODE_H_INCLUDED +#pragma once #include #include @@ -55,5 +54,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/shamap/SHAMapMissingNode.h b/include/xrpl/shamap/SHAMapMissingNode.h index 2b9e71dfed..f1670587eb 100644 --- a/include/xrpl/shamap/SHAMapMissingNode.h +++ b/include/xrpl/shamap/SHAMapMissingNode.h @@ -1,5 +1,4 @@ -#ifndef XRPL_SHAMAP_SHAMAPMISSINGNODE_H_INCLUDED -#define XRPL_SHAMAP_SHAMAPMISSINGNODE_H_INCLUDED +#pragma once #include #include @@ -48,5 +47,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/shamap/SHAMapNodeID.h b/include/xrpl/shamap/SHAMapNodeID.h index 9155b6db39..3517246f90 100644 --- a/include/xrpl/shamap/SHAMapNodeID.h +++ b/include/xrpl/shamap/SHAMapNodeID.h @@ -1,5 +1,4 @@ -#ifndef XRPL_SHAMAP_SHAMAPNODEID_H_INCLUDED -#define XRPL_SHAMAP_SHAMAPNODEID_H_INCLUDED +#pragma once #include #include @@ -139,5 +138,3 @@ deserializeSHAMapNodeID(std::string const& s) selectBranch(SHAMapNodeID const& id, uint256 const& hash); } // namespace xrpl - -#endif diff --git a/include/xrpl/shamap/SHAMapSyncFilter.h b/include/xrpl/shamap/SHAMapSyncFilter.h index 32923c741a..219f9ac558 100644 --- a/include/xrpl/shamap/SHAMapSyncFilter.h +++ b/include/xrpl/shamap/SHAMapSyncFilter.h @@ -1,5 +1,4 @@ -#ifndef XRPL_SHAMAP_SHAMAPSYNCFILTER_H_INCLUDED -#define XRPL_SHAMAP_SHAMAPSYNCFILTER_H_INCLUDED +#pragma once #include @@ -27,5 +26,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/shamap/SHAMapTreeNode.h b/include/xrpl/shamap/SHAMapTreeNode.h index 91adc8a88e..668f658754 100644 --- a/include/xrpl/shamap/SHAMapTreeNode.h +++ b/include/xrpl/shamap/SHAMapTreeNode.h @@ -1,5 +1,4 @@ -#ifndef XRPL_SHAMAP_SHAMAPTREENODE_H_INCLUDED -#define XRPL_SHAMAP_SHAMAPTREENODE_H_INCLUDED +#pragma once #include #include @@ -168,5 +167,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/shamap/SHAMapTxLeafNode.h b/include/xrpl/shamap/SHAMapTxLeafNode.h index 0552a86759..0a44380b9b 100644 --- a/include/xrpl/shamap/SHAMapTxLeafNode.h +++ b/include/xrpl/shamap/SHAMapTxLeafNode.h @@ -1,5 +1,4 @@ -#ifndef XRPL_SHAMAP_SHAMAPTXLEAFNODE_H_INCLUDED -#define XRPL_SHAMAP_SHAMAPTXLEAFNODE_H_INCLUDED +#pragma once #include #include @@ -58,5 +57,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/shamap/SHAMapTxPlusMetaLeafNode.h b/include/xrpl/shamap/SHAMapTxPlusMetaLeafNode.h index 4d1dbf0a3a..d11cc87ff7 100644 --- a/include/xrpl/shamap/SHAMapTxPlusMetaLeafNode.h +++ b/include/xrpl/shamap/SHAMapTxPlusMetaLeafNode.h @@ -1,5 +1,4 @@ -#ifndef XRPL_SHAMAP_SHAMAPLEAFTXPLUSMETANODE_H_INCLUDED -#define XRPL_SHAMAP_SHAMAPLEAFTXPLUSMETANODE_H_INCLUDED +#pragma once #include #include @@ -60,5 +59,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/include/xrpl/shamap/TreeNodeCache.h b/include/xrpl/shamap/TreeNodeCache.h index bf9797c745..4edb6348ec 100644 --- a/include/xrpl/shamap/TreeNodeCache.h +++ b/include/xrpl/shamap/TreeNodeCache.h @@ -1,5 +1,4 @@ -#ifndef XRPL_SHAMAP_TREENODECACHE_H_INCLUDED -#define XRPL_SHAMAP_TREENODECACHE_H_INCLUDED +#pragma once #include #include @@ -14,5 +13,3 @@ using TreeNodeCache = TaggedCache< intr_ptr::SharedWeakUnionPtr, intr_ptr::SharedPtr>; } // namespace xrpl - -#endif diff --git a/include/xrpl/shamap/detail/TaggedPointer.h b/include/xrpl/shamap/detail/TaggedPointer.h index e66568035b..217cd93d0a 100644 --- a/include/xrpl/shamap/detail/TaggedPointer.h +++ b/include/xrpl/shamap/detail/TaggedPointer.h @@ -1,5 +1,4 @@ -#ifndef XRPL_SHAMAP_TAGGEDPOINTER_H_INCLUDED -#define XRPL_SHAMAP_TAGGEDPOINTER_H_INCLUDED +#pragma once #include #include @@ -221,5 +220,3 @@ popcnt16(std::uint16_t a) } } // namespace xrpl - -#endif diff --git a/src/test/csf/BasicNetwork.h b/src/test/csf/BasicNetwork.h index 24d762deb0..697b20c2c7 100644 --- a/src/test/csf/BasicNetwork.h +++ b/src/test/csf/BasicNetwork.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_CSF_BASICNETWORK_H_INCLUDED -#define XRPL_TEST_CSF_BASICNETWORK_H_INCLUDED +#pragma once #include #include @@ -228,5 +227,3 @@ BasicNetwork::send(Peer const& from, Peer const& to, Function&& f) } // namespace csf } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/csf/CollectorRef.h b/src/test/csf/CollectorRef.h index 022db01008..735a42ab16 100644 --- a/src/test/csf/CollectorRef.h +++ b/src/test/csf/CollectorRef.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_CSF_COLLECTOREF_H_INCLUDED -#define XRPL_TEST_CSF_COLLECTOREF_H_INCLUDED +#pragma once #include #include @@ -328,5 +327,3 @@ public: } // namespace csf } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/csf/Digraph.h b/src/test/csf/Digraph.h index 85baecc813..672445ca95 100644 --- a/src/test/csf/Digraph.h +++ b/src/test/csf/Digraph.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_CSF_DIGRAPH_H_INCLUDED -#define XRPL_TEST_CSF_DIGRAPH_H_INCLUDED +#pragma once #include #include @@ -228,4 +227,3 @@ public: } // namespace csf } // namespace test } // namespace xrpl -#endif diff --git a/src/test/csf/Histogram.h b/src/test/csf/Histogram.h index 61ec680939..9e7b471a2b 100644 --- a/src/test/csf/Histogram.h +++ b/src/test/csf/Histogram.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_CSF_HISTOGRAM_H_INCLUDED -#define XRPL_TEST_CSF_HISTOGRAM_H_INCLUDED +#pragma once #include #include @@ -112,5 +111,3 @@ public: } // namespace csf } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/csf/Peer.h b/src/test/csf/Peer.h index e0bc7059a2..7b19c977d6 100644 --- a/src/test/csf/Peer.h +++ b/src/test/csf/Peer.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_CSF_PEER_H_INCLUDED -#define XRPL_TEST_CSF_PEER_H_INCLUDED +#pragma once #include #include @@ -937,4 +936,3 @@ struct Peer } // namespace csf } // namespace test } // namespace xrpl -#endif diff --git a/src/test/csf/PeerGroup.h b/src/test/csf/PeerGroup.h index 35a4983e4e..ce7325f659 100644 --- a/src/test/csf/PeerGroup.h +++ b/src/test/csf/PeerGroup.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_CSF_PEERGROUP_H_INCLUDED -#define XRPL_TEST_CSF_PEERGROUP_H_INCLUDED +#pragma once #include #include @@ -340,4 +339,3 @@ randomRankedConnect( } // namespace csf } // namespace test } // namespace xrpl -#endif diff --git a/src/test/csf/Proposal.h b/src/test/csf/Proposal.h index 0bcf838080..641fd2010a 100644 --- a/src/test/csf/Proposal.h +++ b/src/test/csf/Proposal.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_CSF_PROPOSAL_H_INCLUDED -#define XRPL_TEST_CSF_PROPOSAL_H_INCLUDED +#pragma once #include #include @@ -18,5 +17,3 @@ using Proposal = ConsensusProposal; } // namespace csf } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/csf/Scheduler.h b/src/test/csf/Scheduler.h index e6d53f045b..2f7535ef16 100644 --- a/src/test/csf/Scheduler.h +++ b/src/test/csf/Scheduler.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_CSF_SCHEDULER_H_INCLUDED -#define XRPL_TEST_CSF_SCHEDULER_H_INCLUDED +#pragma once #include #include @@ -428,5 +427,3 @@ Scheduler::step_for(std::chrono::duration const& amount) } // namespace csf } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/csf/Sim.h b/src/test/csf/Sim.h index ff99896e99..709226b216 100644 --- a/src/test/csf/Sim.h +++ b/src/test/csf/Sim.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_CSF_SIM_H_INCLUDED -#define XRPL_TEST_CSF_SIM_H_INCLUDED +#pragma once #include #include @@ -148,5 +147,3 @@ public: } // namespace csf } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/csf/SimTime.h b/src/test/csf/SimTime.h index 5d8c67b8f8..2131de9b41 100644 --- a/src/test/csf/SimTime.h +++ b/src/test/csf/SimTime.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_CSF_SIMTIME_H_INCLUDED -#define XRPL_TEST_CSF_SIMTIME_H_INCLUDED +#pragma once #include @@ -20,5 +19,3 @@ using SimTime = typename SimClock::time_point; } // namespace csf } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/csf/TrustGraph.h b/src/test/csf/TrustGraph.h index 2eb8dac418..d25925ad38 100644 --- a/src/test/csf/TrustGraph.h +++ b/src/test/csf/TrustGraph.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_CSF_UNL_H_INCLUDED -#define XRPL_TEST_CSF_UNL_H_INCLUDED +#pragma once #include @@ -150,5 +149,3 @@ public: } // namespace csf } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/csf/Tx.h b/src/test/csf/Tx.h index 1f355829c8..20c90cbac5 100644 --- a/src/test/csf/Tx.h +++ b/src/test/csf/Tx.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_CSF_TX_H_INCLUDED -#define XRPL_TEST_CSF_TX_H_INCLUDED +#pragma once #include #include @@ -207,5 +206,3 @@ hash_append(Hasher& h, Tx const& tx) } // namespace csf } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/csf/Validation.h b/src/test/csf/Validation.h index 3ec720e7d2..5ebbcf3ae5 100644 --- a/src/test/csf/Validation.h +++ b/src/test/csf/Validation.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_CSF_VALIDATION_H_INCLUDED -#define XRPL_TEST_CSF_VALIDATION_H_INCLUDED +#pragma once #include @@ -176,5 +175,3 @@ public: } // namespace csf } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/csf/collectors.h b/src/test/csf/collectors.h index 5669b8a380..20fc31a01f 100644 --- a/src/test/csf/collectors.h +++ b/src/test/csf/collectors.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_CSF_COLLECTORS_H_INCLUDED -#define XRPL_TEST_CSF_COLLECTORS_H_INCLUDED +#pragma once #include #include @@ -641,5 +640,3 @@ struct JumpCollector } // namespace csf } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/csf/events.h b/src/test/csf/events.h index 29f434f4ad..2aae22d125 100644 --- a/src/test/csf/events.h +++ b/src/test/csf/events.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_CSF_EVENTS_H_INCLUDED -#define XRPL_TEST_CSF_EVENTS_H_INCLUDED +#pragma once #include #include @@ -130,5 +129,3 @@ struct FullyValidateLedger } // namespace csf } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/csf/ledgers.h b/src/test/csf/ledgers.h index d28abeed4b..d78c7c29fa 100644 --- a/src/test/csf/ledgers.h +++ b/src/test/csf/ledgers.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_CSF_LEDGERS_H_INCLUDED -#define XRPL_TEST_CSF_LEDGERS_H_INCLUDED +#pragma once #include @@ -330,5 +329,3 @@ struct LedgerHistoryHelper } // namespace csf } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/csf/random.h b/src/test/csf/random.h index 12ff03cd64..fc5098af32 100644 --- a/src/test/csf/random.h +++ b/src/test/csf/random.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_CSF_RANDOM_H_INCLUDED -#define XRPL_TEST_CSF_RANDOM_H_INCLUDED +#pragma once #include #include @@ -153,5 +152,3 @@ public: } // namespace csf } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/csf/submitters.h b/src/test/csf/submitters.h index fce5562014..2300b91388 100644 --- a/src/test/csf/submitters.h +++ b/src/test/csf/submitters.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_CSF_SUBMITTERS_H_INCLUDED -#define XRPL_TEST_CSF_SUBMITTERS_H_INCLUDED +#pragma once #include #include @@ -97,5 +96,3 @@ makeSubmitter(Distribution dist, SimTime start, SimTime end, Selector& sel, Sche } // namespace csf } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/csf/timers.h b/src/test/csf/timers.h index 0823dbe9b9..a071844a41 100644 --- a/src/test/csf/timers.h +++ b/src/test/csf/timers.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_CSF_TIMERS_H_INCLUDED -#define XRPL_TEST_CSF_TIMERS_H_INCLUDED +#pragma once #include #include @@ -61,5 +60,3 @@ public: } // namespace csf } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/json/TestOutputSuite.h b/src/test/json/TestOutputSuite.h index 934fe1de81..88b7e22580 100644 --- a/src/test/json/TestOutputSuite.h +++ b/src/test/json/TestOutputSuite.h @@ -1,5 +1,4 @@ -#ifndef XRPL_RPC_TESTOUTPUTSUITE_H_INCLUDED -#define XRPL_RPC_TESTOUTPUTSUITE_H_INCLUDED +#pragma once #include @@ -35,5 +34,3 @@ protected: } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx.h b/src/test/jtx.h index 1d7f38ff54..903b029f29 100644 --- a/src/test/jtx.h +++ b/src/test/jtx.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_H_INCLUDED -#define XRPL_TEST_JTX_H_INCLUDED +#pragma once // Convenience header that includes everything @@ -60,5 +59,3 @@ #include #include - -#endif diff --git a/src/test/jtx/AMM.h b/src/test/jtx/AMM.h index 54f5e94d03..4d8059d172 100644 --- a/src/test/jtx/AMM.h +++ b/src/test/jtx/AMM.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_AMM_H_INCLUDED -#define XRPL_TEST_JTX_AMM_H_INCLUDED +#pragma once #include #include @@ -415,5 +414,3 @@ ammClawback( } // namespace jtx } // namespace test } // namespace xrpl - -#endif // XRPL_TEST_JTX_AMM_H_INCLUDED diff --git a/src/test/jtx/AMMTest.h b/src/test/jtx/AMMTest.h index f468b0ebad..be6e228c0a 100644 --- a/src/test/jtx/AMMTest.h +++ b/src/test/jtx/AMMTest.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_AMMTEST_H_INCLUDED -#define XRPL_TEST_JTX_AMMTEST_H_INCLUDED +#pragma once #include #include @@ -159,5 +158,3 @@ protected: } // namespace jtx } // namespace test } // namespace xrpl - -#endif // XRPL_TEST_JTX_AMMTEST_H_INCLUDED diff --git a/src/test/jtx/AbstractClient.h b/src/test/jtx/AbstractClient.h index 0bdfbd67de..9b1ef178ca 100644 --- a/src/test/jtx/AbstractClient.h +++ b/src/test/jtx/AbstractClient.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_ABSTRACTCLIENT_H_INCLUDED -#define XRPL_TEST_ABSTRACTCLIENT_H_INCLUDED +#pragma once #include @@ -41,5 +40,3 @@ public: } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/Account.h b/src/test/jtx/Account.h index 2f35d71a5c..6f796e08b3 100644 --- a/src/test/jtx/Account.h +++ b/src/test/jtx/Account.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_ACCOUNT_H_INCLUDED -#define XRPL_TEST_JTX_ACCOUNT_H_INCLUDED +#pragma once #include #include @@ -147,5 +146,3 @@ operator<=>(Account const& lhs, Account const& rhs) noexcept } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/CaptureLogs.h b/src/test/jtx/CaptureLogs.h index 89f207a2fc..f8d0449977 100644 --- a/src/test/jtx/CaptureLogs.h +++ b/src/test/jtx/CaptureLogs.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_CAPTURELOGS_H_INCLUDED -#define XRPL_TEST_JTX_CAPTURELOGS_H_INCLUDED +#pragma once #include @@ -66,5 +65,3 @@ public: } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/CheckMessageLogs.h b/src/test/jtx/CheckMessageLogs.h index 83aa73a337..286cfa1844 100644 --- a/src/test/jtx/CheckMessageLogs.h +++ b/src/test/jtx/CheckMessageLogs.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_CHECKMESSAGELOGS_H_INCLUDED -#define XRPL_TEST_JTX_CHECKMESSAGELOGS_H_INCLUDED +#pragma once #include @@ -58,5 +57,3 @@ public: } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/Env.h b/src/test/jtx/Env.h index 1c07ac2d00..ef6240d48a 100644 --- a/src/test/jtx/Env.h +++ b/src/test/jtx/Env.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_ENV_H_INCLUDED -#define XRPL_TEST_JTX_ENV_H_INCLUDED +#pragma once #include #include @@ -779,5 +778,3 @@ Env::rpc(std::string const& cmd, Args&&... args) } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/Env_ss.h b/src/test/jtx/Env_ss.h index 734eca5819..78146a04a4 100644 --- a/src/test/jtx/Env_ss.h +++ b/src/test/jtx/Env_ss.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_ENV_SS_H_INCLUDED -#define XRPL_TEST_JTX_ENV_SS_H_INCLUDED +#pragma once #include @@ -60,5 +59,3 @@ public: } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/JSONRPCClient.h b/src/test/jtx/JSONRPCClient.h index 0513b43a93..41129a36ec 100644 --- a/src/test/jtx/JSONRPCClient.h +++ b/src/test/jtx/JSONRPCClient.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_HTTPCLIENT_H_INCLUDED -#define XRPL_TEST_HTTPCLIENT_H_INCLUDED +#pragma once #include @@ -16,5 +15,3 @@ makeJSONRPCClient(Config const& cfg, unsigned rpc_version = 2); } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/JTx.h b/src/test/jtx/JTx.h index 1568df5f18..90fbb8a6b6 100644 --- a/src/test/jtx/JTx.h +++ b/src/test/jtx/JTx.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_JTX_H_INCLUDED -#define XRPL_TEST_JTX_JTX_H_INCLUDED +#pragma once #include #include @@ -159,5 +158,3 @@ private: } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/ManualTimeKeeper.h b/src/test/jtx/ManualTimeKeeper.h index df3c7ff89a..d5fdd467e1 100644 --- a/src/test/jtx/ManualTimeKeeper.h +++ b/src/test/jtx/ManualTimeKeeper.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_MANUALTIMEKEEPER_H_INCLUDED -#define XRPL_TEST_MANUALTIMEKEEPER_H_INCLUDED +#pragma once #include @@ -31,5 +30,3 @@ public: } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/Oracle.h b/src/test/jtx/Oracle.h index 6d993c436e..da241c0ce8 100644 --- a/src/test/jtx/Oracle.h +++ b/src/test/jtx/Oracle.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_ORACLE_H_INCLUDED -#define XRPL_TEST_JTX_ORACLE_H_INCLUDED +#pragma once #include @@ -181,5 +180,3 @@ public: } // namespace jtx } // namespace test } // namespace xrpl - -#endif // XRPL_TEST_JTX_ORACLE_H_INCLUDED diff --git a/src/test/jtx/PathSet.h b/src/test/jtx/PathSet.h index fe96a9884a..3f30d7193f 100644 --- a/src/test/jtx/PathSet.h +++ b/src/test/jtx/PathSet.h @@ -1,5 +1,4 @@ -#ifndef XRPL_LEDGER_TESTS_PATHSET_H_INCLUDED -#define XRPL_LEDGER_TESTS_PATHSET_H_INCLUDED +#pragma once #include @@ -159,5 +158,3 @@ private: } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/SignerUtils.h b/src/test/jtx/SignerUtils.h index 4c0218f6b4..37b1d85ec7 100644 --- a/src/test/jtx/SignerUtils.h +++ b/src/test/jtx/SignerUtils.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_SIGNERUTILS_H_INCLUDED -#define XRPL_TEST_JTX_SIGNERUTILS_H_INCLUDED +#pragma once #include @@ -47,5 +46,3 @@ sortSigners(std::vector& signers) } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/TestHelpers.h b/src/test/jtx/TestHelpers.h index ccf270867c..aea9edeb93 100644 --- a/src/test/jtx/TestHelpers.h +++ b/src/test/jtx/TestHelpers.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_TESTHELPERS_H_INCLUDED -#define XRPL_TEST_JTX_TESTHELPERS_H_INCLUDED +#pragma once #include @@ -735,5 +734,3 @@ pay(AccountID const& account, uint256 const& loanID, STAmount const& amount, std } // namespace jtx } // namespace test } // namespace xrpl - -#endif // XRPL_TEST_JTX_TESTHELPERS_H_INCLUDED diff --git a/src/test/jtx/TestSuite.h b/src/test/jtx/TestSuite.h index e54bc7d131..1558f68d39 100644 --- a/src/test/jtx/TestSuite.h +++ b/src/test/jtx/TestSuite.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_TESTSUITE_H_INCLUDED -#define XRPL_BASICS_TESTSUITE_H_INCLUDED +#pragma once #include @@ -112,5 +111,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/src/test/jtx/TrustedPublisherServer.h b/src/test/jtx/TrustedPublisherServer.h index 2d5b98417b..a46e98ad50 100644 --- a/src/test/jtx/TrustedPublisherServer.h +++ b/src/test/jtx/TrustedPublisherServer.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_TRUSTED_PUBLISHER_SERVER_H_INCLUDED -#define XRPL_TEST_TRUSTED_PUBLISHER_SERVER_H_INCLUDED +#pragma once #include @@ -647,4 +646,3 @@ make_TrustedPublisherServer( } // namespace test } // namespace xrpl -#endif diff --git a/src/test/jtx/WSClient.h b/src/test/jtx/WSClient.h index 9e9fb60bfc..86b81ac0ac 100644 --- a/src/test/jtx/WSClient.h +++ b/src/test/jtx/WSClient.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_WSCLIENT_H_INCLUDED -#define XRPL_TEST_WSCLIENT_H_INCLUDED +#pragma once #include @@ -34,5 +33,3 @@ makeWSClient( } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/account_txn_id.h b/src/test/jtx/account_txn_id.h index fb48941925..71ac606418 100644 --- a/src/test/jtx/account_txn_id.h +++ b/src/test/jtx/account_txn_id.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_ACCOUNT_TXN_ID_H_INCLUDED -#define XRPL_TEST_JTX_ACCOUNT_TXN_ID_H_INCLUDED +#pragma once #include @@ -23,4 +22,3 @@ public: } // namespace jtx } // namespace test } // namespace xrpl -#endif diff --git a/src/test/jtx/acctdelete.h b/src/test/jtx/acctdelete.h index f5d1f7d869..c081eb92a5 100644 --- a/src/test/jtx/acctdelete.h +++ b/src/test/jtx/acctdelete.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_ACCTDELETE_H_INCLUDED -#define XRPL_TEST_JTX_ACCTDELETE_H_INCLUDED +#pragma once #include #include @@ -24,5 +23,3 @@ incLgrSeqForAccDel(jtx::Env& env, jtx::Account const& acc, std::uint32_t margin } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/amount.h b/src/test/jtx/amount.h index 958160224d..c7b66504d3 100644 --- a/src/test/jtx/amount.h +++ b/src/test/jtx/amount.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_AMOUNT_H_INCLUDED -#define XRPL_TEST_JTX_AMOUNT_H_INCLUDED +#pragma once #include #include @@ -588,5 +587,3 @@ extern any_t const any; } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/attester.h b/src/test/jtx/attester.h index 345002f90a..6904135f21 100644 --- a/src/test/jtx/attester.h +++ b/src/test/jtx/attester.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_ATTESTER_H_INCLUDED -#define XRPL_TEST_JTX_ATTESTER_H_INCLUDED +#pragma once #include #include @@ -44,5 +43,3 @@ sign_create_account_attestation( } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/balance.h b/src/test/jtx/balance.h index 741bbcb195..83e2e3ea03 100644 --- a/src/test/jtx/balance.h +++ b/src/test/jtx/balance.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_BALANCE_H_INCLUDED -#define XRPL_TEST_JTX_BALANCE_H_INCLUDED +#pragma once #include #include @@ -43,5 +42,3 @@ public: } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/basic_prop.h b/src/test/jtx/basic_prop.h index 32655e9f52..080eecd34b 100644 --- a/src/test/jtx/basic_prop.h +++ b/src/test/jtx/basic_prop.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_BASIC_PROP_H_INCLUDED -#define XRPL_TEST_JTX_BASIC_PROP_H_INCLUDED +#pragma once #include @@ -42,5 +41,3 @@ struct prop_type : basic_prop } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/batch.h b/src/test/jtx/batch.h index 51ded4ee1b..c11a9fe17e 100644 --- a/src/test/jtx/batch.h +++ b/src/test/jtx/batch.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_BATCH_H_INCLUDED -#define XRPL_TEST_JTX_BATCH_H_INCLUDED +#pragma once #include #include @@ -133,5 +132,3 @@ public: } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/check.h b/src/test/jtx/check.h index 61ae5033e4..9a1c6b2d2c 100644 --- a/src/test/jtx/check.h +++ b/src/test/jtx/check.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_CHECK_H_INCLUDED -#define XRPL_TEST_JTX_CHECK_H_INCLUDED +#pragma once #include #include @@ -42,5 +41,3 @@ using checks = owner_count; } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/credentials.h b/src/test/jtx/credentials.h index 96b3fcf103..29ecacb11b 100644 --- a/src/test/jtx/credentials.h +++ b/src/test/jtx/credentials.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_CREDENTIALS_H_INCLUDED -#define XRPL_TEST_JTX_CREDENTIALS_H_INCLUDED +#pragma once #include #include @@ -74,5 +73,3 @@ ledgerEntry(jtx::Env& env, std::string const& credIdx); } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/delivermin.h b/src/test/jtx/delivermin.h index 033b3f20b8..3edb38ffef 100644 --- a/src/test/jtx/delivermin.h +++ b/src/test/jtx/delivermin.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_DELIVERMIN_H_INCLUDED -#define XRPL_TEST_JTX_DELIVERMIN_H_INCLUDED +#pragma once #include @@ -27,5 +26,3 @@ public: } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/deposit.h b/src/test/jtx/deposit.h index 579a7bafb9..d7762e9ae3 100644 --- a/src/test/jtx/deposit.h +++ b/src/test/jtx/deposit.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_DEPOSIT_H_INCLUDED -#define XRPL_TEST_JTX_DEPOSIT_H_INCLUDED +#pragma once #include #include @@ -59,5 +58,3 @@ unauthCredentials(jtx::Account const& account, std::vector } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/did.h b/src/test/jtx/did.h index 65407028eb..9cd98a1324 100644 --- a/src/test/jtx/did.h +++ b/src/test/jtx/did.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_DID_H_INCLUDED -#define XRPL_TEST_JTX_DID_H_INCLUDED +#pragma once #include #include @@ -81,5 +80,3 @@ del(jtx::Account const& account); } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/directory.h b/src/test/jtx/directory.h index 25ec202cec..e9fff35434 100644 --- a/src/test/jtx/directory.h +++ b/src/test/jtx/directory.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_DIRECTORY_H_INCLUDED -#define XRPL_TEST_JTX_DIRECTORY_H_INCLUDED +#pragma once #include @@ -57,5 +56,3 @@ maximumPageIndex(Env const& env) -> std::uint64_t } // namespace directory } // namespace xrpl::test::jtx - -#endif diff --git a/src/test/jtx/envconfig.h b/src/test/jtx/envconfig.h index 9cf5cff146..dc0c48e064 100644 --- a/src/test/jtx/envconfig.h +++ b/src/test/jtx/envconfig.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_ENVCONFIG_H_INCLUDED -#define XRPL_TEST_JTX_ENVCONFIG_H_INCLUDED +#pragma once #include @@ -112,5 +111,3 @@ makeConfig(std::map extraTxQ = {}, std::map #include @@ -86,5 +85,3 @@ auto const fulfillment = JTxFieldWrapper(sfFulfillment); } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/fee.h b/src/test/jtx/fee.h index 3ede9680f8..281066f0aa 100644 --- a/src/test/jtx/fee.h +++ b/src/test/jtx/fee.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_FEE_H_INCLUDED -#define XRPL_TEST_JTX_FEE_H_INCLUDED +#pragma once #include #include @@ -51,5 +50,3 @@ public: } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/flags.h b/src/test/jtx/flags.h index 3f1f8f71a3..3dde1fa414 100644 --- a/src/test/jtx/flags.h +++ b/src/test/jtx/flags.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_FLAGS_H_INCLUDED -#define XRPL_TEST_JTX_FLAGS_H_INCLUDED +#pragma once #include @@ -139,5 +138,3 @@ public: } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/invoice_id.h b/src/test/jtx/invoice_id.h index bdf1aa4250..fd1b7ae45b 100644 --- a/src/test/jtx/invoice_id.h +++ b/src/test/jtx/invoice_id.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_INVOICE_ID_H_INCLUDED -#define XRPL_TEST_JTX_INVOICE_ID_H_INCLUDED +#pragma once #include @@ -23,4 +22,3 @@ public: } // namespace jtx } // namespace test } // namespace xrpl -#endif diff --git a/src/test/jtx/jtx_json.h b/src/test/jtx/jtx_json.h index 32fd3c8d30..c7f52fe283 100644 --- a/src/test/jtx/jtx_json.h +++ b/src/test/jtx/jtx_json.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_JSON_H_INCLUDED -#define XRPL_TEST_JTX_JSON_H_INCLUDED +#pragma once #include @@ -41,5 +40,3 @@ public: } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/last_ledger_sequence.h b/src/test/jtx/last_ledger_sequence.h index 6544294bd6..540d6ff384 100644 --- a/src/test/jtx/last_ledger_sequence.h +++ b/src/test/jtx/last_ledger_sequence.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_LAST_LEDGER_SEQUENCE_H_INCLUDED -#define XRPL_TEST_JTX_LAST_LEDGER_SEQUENCE_H_INCLUDED +#pragma once #include @@ -24,5 +23,3 @@ public: } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/ledgerStateFix.h b/src/test/jtx/ledgerStateFix.h index f93c1bc3d8..7adc863cb4 100644 --- a/src/test/jtx/ledgerStateFix.h +++ b/src/test/jtx/ledgerStateFix.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_LEDGER_STATE_FIX_H_INCLUDED -#define XRPL_TEST_JTX_LEDGER_STATE_FIX_H_INCLUDED +#pragma once #include #include @@ -21,5 +20,3 @@ nftPageLinks(jtx::Account const& acct, jtx::Account const& owner); } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/memo.h b/src/test/jtx/memo.h index c0f8ae5f27..2371490b30 100644 --- a/src/test/jtx/memo.h +++ b/src/test/jtx/memo.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_MEMO_H_INCLUDED -#define XRPL_TEST_JTX_MEMO_H_INCLUDED +#pragma once #include @@ -74,5 +73,3 @@ public: } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/mpt.h b/src/test/jtx/mpt.h index fc66b50a1e..792d43056f 100644 --- a/src/test/jtx/mpt.h +++ b/src/test/jtx/mpt.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_MPT_H_INCLUDED -#define XRPL_TEST_JTX_MPT_H_INCLUDED +#pragma once #include #include @@ -299,5 +298,3 @@ private: } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/multisign.h b/src/test/jtx/multisign.h index f1a50728b9..3bbf43bb05 100644 --- a/src/test/jtx/multisign.h +++ b/src/test/jtx/multisign.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_MULTISIGN_H_INCLUDED -#define XRPL_TEST_JTX_MULTISIGN_H_INCLUDED +#pragma once #include #include @@ -97,5 +96,3 @@ using siglists = owner_count; } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/noop.h b/src/test/jtx/noop.h index 3ef3a57c4b..47d12fb9af 100644 --- a/src/test/jtx/noop.h +++ b/src/test/jtx/noop.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_NOOP_H_INCLUDED -#define XRPL_TEST_JTX_NOOP_H_INCLUDED +#pragma once #include @@ -17,5 +16,3 @@ noop(Account const& account) } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/offer.h b/src/test/jtx/offer.h index 22bc14a09d..dab15a4c8c 100644 --- a/src/test/jtx/offer.h +++ b/src/test/jtx/offer.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_OFFER_H_INCLUDED -#define XRPL_TEST_JTX_OFFER_H_INCLUDED +#pragma once #include @@ -21,5 +20,3 @@ offer_cancel(Account const& account, std::uint32_t offerSeq); } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/owners.h b/src/test/jtx/owners.h index 73a244185f..87fa26417a 100644 --- a/src/test/jtx/owners.h +++ b/src/test/jtx/owners.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_OWNERS_H_INCLUDED -#define XRPL_TEST_JTX_OWNERS_H_INCLUDED +#pragma once #include @@ -69,5 +68,3 @@ using offers = owner_count; } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/paths.h b/src/test/jtx/paths.h index a1e5ee0294..c4e69fe3f3 100644 --- a/src/test/jtx/paths.h +++ b/src/test/jtx/paths.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_PATHS_H_INCLUDED -#define XRPL_TEST_JTX_PATHS_H_INCLUDED +#pragma once #include @@ -94,5 +93,3 @@ path::append(T const& t, Args const&... args) } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/pay.h b/src/test/jtx/pay.h index 4ef13d72a3..a155d7bdc8 100644 --- a/src/test/jtx/pay.h +++ b/src/test/jtx/pay.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_PAY_H_INCLUDED -#define XRPL_TEST_JTX_PAY_H_INCLUDED +#pragma once #include #include @@ -19,5 +18,3 @@ pay(Account const& account, Account const& to, AnyAmount amount); } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/permissioned_domains.h b/src/test/jtx/permissioned_domains.h index de015775ce..ff8ab129ae 100644 --- a/src/test/jtx/permissioned_domains.h +++ b/src/test/jtx/permissioned_domains.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_PERMISSIONED_DOMAINS_H_INCLUDED -#define XRPL_TEST_JTX_PERMISSIONED_DOMAINS_H_INCLUDED +#pragma once #include #include @@ -47,5 +46,3 @@ getNewDomain(std::shared_ptr const& meta); } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/prop.h b/src/test/jtx/prop.h index 5c4687f88b..b1f8cb5ffc 100644 --- a/src/test/jtx/prop.h +++ b/src/test/jtx/prop.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_PROP_H_INCLUDED -#define XRPL_TEST_JTX_PROP_H_INCLUDED +#pragma once #include @@ -30,5 +29,3 @@ struct prop } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/quality.h b/src/test/jtx/quality.h index c112ad9934..34c960224f 100644 --- a/src/test/jtx/quality.h +++ b/src/test/jtx/quality.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_QUALITY_H_INCLUDED -#define XRPL_TEST_JTX_QUALITY_H_INCLUDED +#pragma once #include @@ -66,5 +65,3 @@ public: } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/rate.h b/src/test/jtx/rate.h index 2ed8cec6f2..a92bd2364a 100644 --- a/src/test/jtx/rate.h +++ b/src/test/jtx/rate.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_RATE_H_INCLUDED -#define XRPL_TEST_JTX_RATE_H_INCLUDED +#pragma once #include @@ -16,5 +15,3 @@ rate(Account const& account, double multiplier); } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/regkey.h b/src/test/jtx/regkey.h index b3ab9a0ed9..2c95baacc3 100644 --- a/src/test/jtx/regkey.h +++ b/src/test/jtx/regkey.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_REGKEY_H_INCLUDED -#define XRPL_TEST_JTX_REGKEY_H_INCLUDED +#pragma once #include #include @@ -21,5 +20,3 @@ regkey(Account const& account, Account const& signer); } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/require.h b/src/test/jtx/require.h index 21ff8a29ec..7d712e8ab7 100644 --- a/src/test/jtx/require.h +++ b/src/test/jtx/require.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_REQUIRE_H_INCLUDED -#define XRPL_TEST_JTX_REQUIRE_H_INCLUDED +#pragma once #include @@ -64,5 +63,3 @@ public: } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/requires.h b/src/test/jtx/requires.h index 379c5ad67d..2411d040c6 100644 --- a/src/test/jtx/requires.h +++ b/src/test/jtx/requires.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_REQUIRES_H_INCLUDED -#define XRPL_TEST_JTX_REQUIRES_H_INCLUDED +#pragma once #include #include @@ -16,5 +15,3 @@ using requires_t = std::vector; } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/rpc.h b/src/test/jtx/rpc.h index 30b4f4b1fd..6946cbc4e1 100644 --- a/src/test/jtx/rpc.h +++ b/src/test/jtx/rpc.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_RPC_H_INCLUDED -#define XRPL_TEST_JTX_RPC_H_INCLUDED +#pragma once #include @@ -59,5 +58,3 @@ public: } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/sendmax.h b/src/test/jtx/sendmax.h index 9082ef9ddd..8a471be3cd 100644 --- a/src/test/jtx/sendmax.h +++ b/src/test/jtx/sendmax.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_SENDMAX_H_INCLUDED -#define XRPL_TEST_JTX_SENDMAX_H_INCLUDED +#pragma once #include @@ -27,5 +26,3 @@ public: } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/seq.h b/src/test/jtx/seq.h index 102961db0e..b861800ac9 100644 --- a/src/test/jtx/seq.h +++ b/src/test/jtx/seq.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_SEQ_H_INCLUDED -#define XRPL_TEST_JTX_SEQ_H_INCLUDED +#pragma once #include #include @@ -37,5 +36,3 @@ public: } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/sig.h b/src/test/jtx/sig.h index 1397e5fc71..ab22a46c69 100644 --- a/src/test/jtx/sig.h +++ b/src/test/jtx/sig.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_SIG_H_INCLUDED -#define XRPL_TEST_JTX_SIG_H_INCLUDED +#pragma once #include @@ -59,5 +58,3 @@ public: } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/tag.h b/src/test/jtx/tag.h index 688d2e92c1..c8d5723754 100644 --- a/src/test/jtx/tag.h +++ b/src/test/jtx/tag.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_TAG_H_INCLUDED -#define XRPL_TEST_JTX_TAG_H_INCLUDED +#pragma once #include @@ -42,5 +41,3 @@ public: } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/tags.h b/src/test/jtx/tags.h index 445bdebcb4..c8a6170048 100644 --- a/src/test/jtx/tags.h +++ b/src/test/jtx/tags.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_TAGS_H_INCLUDED -#define XRPL_TEST_JTX_TAGS_H_INCLUDED +#pragma once namespace xrpl { namespace test { @@ -44,5 +43,3 @@ static increment_t const increment; } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/ter.h b/src/test/jtx/ter.h index f13c2a90e6..074ba307cb 100644 --- a/src/test/jtx/ter.h +++ b/src/test/jtx/ter.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_TER_H_INCLUDED -#define XRPL_TEST_JTX_TER_H_INCLUDED +#pragma once #include @@ -36,5 +35,3 @@ public: } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/testline.h b/src/test/jtx/testline.h index beda870345..e2be1f0276 100644 --- a/src/test/jtx/testline.h +++ b/src/test/jtx/testline.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_TESTLINE_H_INCLUDED -#define XRPL_TEST_JTX_TESTLINE_H_INCLUDED +#pragma once #include @@ -30,5 +29,3 @@ public: } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/ticket.h b/src/test/jtx/ticket.h index 10cb772bbd..dca16ac7c6 100644 --- a/src/test/jtx/ticket.h +++ b/src/test/jtx/ticket.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_TICKET_H_INCLUDED -#define XRPL_TEST_JTX_TICKET_H_INCLUDED +#pragma once #include #include @@ -48,5 +47,3 @@ using tickets = owner_count; } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/token.h b/src/test/jtx/token.h index 2c9ecc8393..f6d562587a 100644 --- a/src/test/jtx/token.h +++ b/src/test/jtx/token.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_NFT_H_INCLUDED -#define XRPL_TEST_JTX_NFT_H_INCLUDED +#pragma once #include #include @@ -218,5 +217,3 @@ modify(jtx::Account const& account, uint256 const& nftokenID); } // namespace test } // namespace xrpl - -#endif // XRPL_TEST_JTX_NFT_H_INCLUDED diff --git a/src/test/jtx/trust.h b/src/test/jtx/trust.h index 34eba0a63b..462538854b 100644 --- a/src/test/jtx/trust.h +++ b/src/test/jtx/trust.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_TRUST_H_INCLUDED -#define XRPL_TEST_JTX_TRUST_H_INCLUDED +#pragma once #include @@ -24,5 +23,3 @@ claw(Account const& account, STAmount const& amount, std::optional cons } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/txflags.h b/src/test/jtx/txflags.h index 75a0d2740b..f51c26d035 100644 --- a/src/test/jtx/txflags.h +++ b/src/test/jtx/txflags.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_TXFLAGS_H_INCLUDED -#define XRPL_TEST_JTX_TXFLAGS_H_INCLUDED +#pragma once #include @@ -25,5 +24,3 @@ public: } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/utility.h b/src/test/jtx/utility.h index b28868af65..895d00f12b 100644 --- a/src/test/jtx/utility.h +++ b/src/test/jtx/utility.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_UTILITY_H_INCLUDED -#define XRPL_TEST_JTX_UTILITY_H_INCLUDED +#pragma once #include @@ -58,5 +57,3 @@ cmdToJSONRPC(std::vector const& args, beast::Journal j, unsigned in } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/vault.h b/src/test/jtx/vault.h index 485940f9f4..65a5706354 100644 --- a/src/test/jtx/vault.h +++ b/src/test/jtx/vault.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_VAULT_H_INCLUDED -#define XRPL_TEST_JTX_VAULT_H_INCLUDED +#pragma once #include #include @@ -86,5 +85,3 @@ struct Vault } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/jtx/xchain_bridge.h b/src/test/jtx/xchain_bridge.h index f7c1f019c9..cdacede234 100644 --- a/src/test/jtx/xchain_bridge.h +++ b/src/test/jtx/xchain_bridge.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TEST_JTX_XCHAINBRIDGE_H_INCLUDED -#define XRPL_TEST_JTX_XCHAINBRIDGE_H_INCLUDED +#pragma once #include #include @@ -219,5 +218,3 @@ struct XChainBridgeObjects } // namespace jtx } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/nodestore/TestBase.h b/src/test/nodestore/TestBase.h index c08559de36..dfa2b05642 100644 --- a/src/test/nodestore/TestBase.h +++ b/src/test/nodestore/TestBase.h @@ -1,5 +1,4 @@ -#ifndef XRPL_NODESTORE_BASE_H_INCLUDED -#define XRPL_NODESTORE_BASE_H_INCLUDED +#pragma once #include #include @@ -197,5 +196,3 @@ public: } // namespace NodeStore } // namespace xrpl - -#endif diff --git a/src/test/protocol/Issue_test.cpp b/src/test/protocol/Issue_test.cpp index 661a8c912b..2321da4a6e 100644 --- a/src/test/protocol/Issue_test.cpp +++ b/src/test/protocol/Issue_test.cpp @@ -17,14 +17,6 @@ #define STL_SET_HAS_EMPLACE 0 #endif -#ifndef XRPL_ASSETS_ENABLE_STD_HASH -#if BEAST_MAC || BEAST_IOS -#define XRPL_ASSETS_ENABLE_STD_HASH 0 -#else -#define XRPL_ASSETS_ENABLE_STD_HASH 1 -#endif -#endif - namespace xrpl { class Issue_test : public beast::unit_test::suite diff --git a/src/test/rpc/GRPCTestClientBase.h b/src/test/rpc/GRPCTestClientBase.h index 5e547b1dfb..3c39cd1747 100644 --- a/src/test/rpc/GRPCTestClientBase.h +++ b/src/test/rpc/GRPCTestClientBase.h @@ -1,5 +1,4 @@ -#ifndef XRPL_GRPCTESTCLIENTBASE_H -#define XRPL_GRPCTESTCLIENTBASE_H +#pragma once #include @@ -26,4 +25,3 @@ struct GRPCTestClientBase } // namespace test } // namespace xrpl -#endif // XRPL_GRPCTESTCLIENTBASE_H diff --git a/src/test/shamap/common.h b/src/test/shamap/common.h index 1779755619..fe2a1884da 100644 --- a/src/test/shamap/common.h +++ b/src/test/shamap/common.h @@ -1,5 +1,4 @@ -#ifndef XRPL_SHAMAP_TESTS_COMMON_H_INCLUDED -#define XRPL_SHAMAP_TESTS_COMMON_H_INCLUDED +#pragma once #include #include @@ -100,5 +99,3 @@ public: } // namespace tests } // namespace xrpl - -#endif diff --git a/src/test/unit_test/FileDirGuard.h b/src/test/unit_test/FileDirGuard.h index 90765f7029..cf2eab7adb 100644 --- a/src/test/unit_test/FileDirGuard.h +++ b/src/test/unit_test/FileDirGuard.h @@ -1,5 +1,4 @@ -#ifndef TEST_UNIT_TEST_DIRGUARD_H -#define TEST_UNIT_TEST_DIRGUARD_H +#pragma once #include @@ -154,5 +153,3 @@ public: } // namespace detail } // namespace xrpl - -#endif // TEST_UNIT_TEST_DIRGUARD_H diff --git a/src/test/unit_test/SuiteJournal.h b/src/test/unit_test/SuiteJournal.h index 0b87706056..ad5f298b74 100644 --- a/src/test/unit_test/SuiteJournal.h +++ b/src/test/unit_test/SuiteJournal.h @@ -1,5 +1,4 @@ -#ifndef TEST_UNIT_TEST_SUITE_JOURNAL_H -#define TEST_UNIT_TEST_SUITE_JOURNAL_H +#pragma once #include #include @@ -133,5 +132,3 @@ public: } // namespace test } // namespace xrpl - -#endif diff --git a/src/test/unit_test/multi_runner.h b/src/test/unit_test/multi_runner.h index 25649d917f..28ecaf85f9 100644 --- a/src/test/unit_test/multi_runner.h +++ b/src/test/unit_test/multi_runner.h @@ -1,5 +1,4 @@ -#ifndef TEST_UNIT_TEST_MULTI_RUNNER_H -#define TEST_UNIT_TEST_MULTI_RUNNER_H +#pragma once #include #include @@ -334,5 +333,3 @@ multi_runner_child::run_multi(Pred pred) } // namespace test } // namespace xrpl - -#endif diff --git a/src/tests/libxrpl/helpers/TestSink.h b/src/tests/libxrpl/helpers/TestSink.h index aa34e16838..daa40d014f 100644 --- a/src/tests/libxrpl/helpers/TestSink.h +++ b/src/tests/libxrpl/helpers/TestSink.h @@ -1,5 +1,4 @@ -#ifndef XRPL_DEBUGSINK_H -#define XRPL_DEBUGSINK_H +#pragma once #include @@ -23,4 +22,3 @@ public: writeAlways(beast::severities::Severity level, std::string const& text) override; }; } // namespace xrpl -#endif // XRPL_DEBUGSINK_H diff --git a/src/xrpld/app/consensus/RCLCensorshipDetector.h b/src/xrpld/app/consensus/RCLCensorshipDetector.h index 671337c118..fbdc6c2397 100644 --- a/src/xrpld/app/consensus/RCLCensorshipDetector.h +++ b/src/xrpld/app/consensus/RCLCensorshipDetector.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_CONSENSUS_RCLCENSORSHIPDETECTOR_H_INCLUDED -#define XRPL_APP_CONSENSUS_RCLCENSORSHIPDETECTOR_H_INCLUDED +#pragma once #include #include @@ -122,5 +121,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/consensus/RCLConsensus.h b/src/xrpld/app/consensus/RCLConsensus.h index 476cb25715..3e1b27cd9c 100644 --- a/src/xrpld/app/consensus/RCLConsensus.h +++ b/src/xrpld/app/consensus/RCLConsensus.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_CONSENSUS_RCLCONSENSUS_H_INCLUDED -#define XRPL_APP_CONSENSUS_RCLCONSENSUS_H_INCLUDED +#pragma once #include #include @@ -524,5 +523,3 @@ public: } }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/consensus/RCLCxLedger.h b/src/xrpld/app/consensus/RCLCxLedger.h index 4413fee7fc..6b96fc8af3 100644 --- a/src/xrpld/app/consensus/RCLCxLedger.h +++ b/src/xrpld/app/consensus/RCLCxLedger.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_CONSENSUS_RCLCXLEDGER_H_INCLUDED -#define XRPL_APP_CONSENSUS_RCLCXLEDGER_H_INCLUDED +#pragma once #include #include @@ -101,4 +100,3 @@ public: std::shared_ptr ledger_; }; } // namespace xrpl -#endif diff --git a/src/xrpld/app/consensus/RCLCxPeerPos.h b/src/xrpld/app/consensus/RCLCxPeerPos.h index 78a8bfde1e..b9ef492aae 100644 --- a/src/xrpld/app/consensus/RCLCxPeerPos.h +++ b/src/xrpld/app/consensus/RCLCxPeerPos.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_CONSENSUS_RCLCXPEERPOS_H_INCLUDED -#define XRPL_APP_CONSENSUS_RCLCXPEERPOS_H_INCLUDED +#pragma once #include @@ -125,5 +124,3 @@ proposalUniqueId( Slice const& signature); } // namespace xrpl - -#endif diff --git a/src/xrpld/app/consensus/RCLCxTx.h b/src/xrpld/app/consensus/RCLCxTx.h index a0cefcf199..b7bde11a3b 100644 --- a/src/xrpld/app/consensus/RCLCxTx.h +++ b/src/xrpld/app/consensus/RCLCxTx.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_CONSENSUS_RCLCXTX_H_INCLUDED -#define XRPL_APP_CONSENSUS_RCLCXTX_H_INCLUDED +#pragma once #include @@ -167,4 +166,3 @@ public: std::shared_ptr map_; }; } // namespace xrpl -#endif diff --git a/src/xrpld/app/consensus/RCLValidations.h b/src/xrpld/app/consensus/RCLValidations.h index 97ccb727fe..35c1686f9e 100644 --- a/src/xrpld/app/consensus/RCLValidations.h +++ b/src/xrpld/app/consensus/RCLValidations.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_CONSENSUSS_VALIDATIONS_H_INCLUDED -#define XRPL_APP_CONSENSUSS_VALIDATIONS_H_INCLUDED +#pragma once #include #include @@ -237,5 +236,3 @@ handleNewValidation( std::optional j = std::nullopt); } // namespace xrpl - -#endif diff --git a/src/xrpld/app/ledger/AbstractFetchPackContainer.h b/src/xrpld/app/ledger/AbstractFetchPackContainer.h index d2cdd1e920..3adc435bd6 100644 --- a/src/xrpld/app/ledger/AbstractFetchPackContainer.h +++ b/src/xrpld/app/ledger/AbstractFetchPackContainer.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_LEDGER_ABSTRACTFETCHPACKCONTAINER_H_INCLUDED -#define XRPL_APP_LEDGER_ABSTRACTFETCHPACKCONTAINER_H_INCLUDED +#pragma once #include #include @@ -27,5 +26,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/ledger/AcceptedLedger.h b/src/xrpld/app/ledger/AcceptedLedger.h index 37e5d01a26..c0f186c781 100644 --- a/src/xrpld/app/ledger/AcceptedLedger.h +++ b/src/xrpld/app/ledger/AcceptedLedger.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_LEDGER_ACCEPTEDLEDGER_H_INCLUDED -#define XRPL_APP_LEDGER_ACCEPTEDLEDGER_H_INCLUDED +#pragma once #include @@ -56,5 +55,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/ledger/AcceptedLedgerTx.h b/src/xrpld/app/ledger/AcceptedLedgerTx.h index efea5b9162..6c936bbcf2 100644 --- a/src/xrpld/app/ledger/AcceptedLedgerTx.h +++ b/src/xrpld/app/ledger/AcceptedLedgerTx.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_LEDGER_ACCEPTEDLEDGERTX_H_INCLUDED -#define XRPL_APP_LEDGER_ACCEPTEDLEDGERTX_H_INCLUDED +#pragma once #include @@ -86,5 +85,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/ledger/AccountStateSF.h b/src/xrpld/app/ledger/AccountStateSF.h index 40f40ac8a1..fb9da3a616 100644 --- a/src/xrpld/app/ledger/AccountStateSF.h +++ b/src/xrpld/app/ledger/AccountStateSF.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_LEDGER_ACCOUNTSTATESF_H_INCLUDED -#define XRPL_APP_LEDGER_ACCOUNTSTATESF_H_INCLUDED +#pragma once #include @@ -30,5 +29,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/ledger/BookListeners.h b/src/xrpld/app/ledger/BookListeners.h index 784172974e..036e988749 100644 --- a/src/xrpld/app/ledger/BookListeners.h +++ b/src/xrpld/app/ledger/BookListeners.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_LEDGER_BOOKLISTENERS_H_INCLUDED -#define XRPL_APP_LEDGER_BOOKLISTENERS_H_INCLUDED +#pragma once #include @@ -51,5 +50,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/ledger/BuildLedger.h b/src/xrpld/app/ledger/BuildLedger.h index 24b9e988ff..7b4b85c4aa 100644 --- a/src/xrpld/app/ledger/BuildLedger.h +++ b/src/xrpld/app/ledger/BuildLedger.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_LEDGER_BUILD_LEDGER_H_INCLUDED -#define XRPL_APP_LEDGER_BUILD_LEDGER_H_INCLUDED +#pragma once #include #include @@ -54,4 +53,3 @@ std::shared_ptr buildLedger(LedgerReplay const& replayData, ApplyFlags applyFlags, Application& app, beast::Journal j); } // namespace xrpl -#endif diff --git a/src/xrpld/app/ledger/ConsensusTransSetSF.h b/src/xrpld/app/ledger/ConsensusTransSetSF.h index 1e9acefc38..855577ecee 100644 --- a/src/xrpld/app/ledger/ConsensusTransSetSF.h +++ b/src/xrpld/app/ledger/ConsensusTransSetSF.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_LEDGER_CONSENSUSTRANSSETSF_H_INCLUDED -#define XRPL_APP_LEDGER_CONSENSUSTRANSSETSF_H_INCLUDED +#pragma once #include @@ -35,5 +34,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/ledger/InboundLedger.h b/src/xrpld/app/ledger/InboundLedger.h index c062b83143..46a8cf19b5 100644 --- a/src/xrpld/app/ledger/InboundLedger.h +++ b/src/xrpld/app/ledger/InboundLedger.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_LEDGER_INBOUNDLEDGER_H_INCLUDED -#define XRPL_APP_LEDGER_INBOUNDLEDGER_H_INCLUDED +#pragma once #include #include @@ -173,5 +172,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/ledger/InboundLedgers.h b/src/xrpld/app/ledger/InboundLedgers.h index 6b4b1a6ef0..30eb69ab7a 100644 --- a/src/xrpld/app/ledger/InboundLedgers.h +++ b/src/xrpld/app/ledger/InboundLedgers.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_LEDGER_INBOUNDLEDGERS_H_INCLUDED -#define XRPL_APP_LEDGER_INBOUNDLEDGERS_H_INCLUDED +#pragma once #include @@ -79,5 +78,3 @@ make_InboundLedgers( beast::insight::Collector::ptr const& collector); } // namespace xrpl - -#endif diff --git a/src/xrpld/app/ledger/InboundTransactions.h b/src/xrpld/app/ledger/InboundTransactions.h index e905fb1846..7b85f56c5f 100644 --- a/src/xrpld/app/ledger/InboundTransactions.h +++ b/src/xrpld/app/ledger/InboundTransactions.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_LEDGER_INBOUNDTRANSACTIONS_H_INCLUDED -#define XRPL_APP_LEDGER_INBOUNDTRANSACTIONS_H_INCLUDED +#pragma once #include @@ -73,5 +72,3 @@ make_InboundTransactions( std::function const&, bool)> gotSet); } // namespace xrpl - -#endif diff --git a/src/xrpld/app/ledger/Ledger.h b/src/xrpld/app/ledger/Ledger.h index a8c9b91342..cbfbc0030f 100644 --- a/src/xrpld/app/ledger/Ledger.h +++ b/src/xrpld/app/ledger/Ledger.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_LEDGER_LEDGER_H_INCLUDED -#define XRPL_APP_LEDGER_LEDGER_H_INCLUDED +#pragma once #include #include @@ -444,5 +443,3 @@ uint256 calculateLedgerHash(LedgerHeader const& info); } // namespace xrpl - -#endif diff --git a/src/xrpld/app/ledger/LedgerCleaner.h b/src/xrpld/app/ledger/LedgerCleaner.h index 2377485f22..aa8d042c24 100644 --- a/src/xrpld/app/ledger/LedgerCleaner.h +++ b/src/xrpld/app/ledger/LedgerCleaner.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_LEDGER_LEDGERCLEANER_H_INCLUDED -#define XRPL_APP_LEDGER_LEDGERCLEANER_H_INCLUDED +#pragma once #include @@ -44,5 +43,3 @@ std::unique_ptr make_LedgerCleaner(Application& app, beast::Journal journal); } // namespace xrpl - -#endif diff --git a/src/xrpld/app/ledger/LedgerHistory.h b/src/xrpld/app/ledger/LedgerHistory.h index 68007546b6..e8784eb599 100644 --- a/src/xrpld/app/ledger/LedgerHistory.h +++ b/src/xrpld/app/ledger/LedgerHistory.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_LEDGER_LEDGERHISTORY_H_INCLUDED -#define XRPL_APP_LEDGER_LEDGERHISTORY_H_INCLUDED +#pragma once #include #include @@ -129,5 +128,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/ledger/LedgerHolder.h b/src/xrpld/app/ledger/LedgerHolder.h index c0a81778ae..8d2ac9f308 100644 --- a/src/xrpld/app/ledger/LedgerHolder.h +++ b/src/xrpld/app/ledger/LedgerHolder.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_LEDGER_LEDGERHOLDER_H_INCLUDED -#define XRPL_APP_LEDGER_LEDGERHOLDER_H_INCLUDED +#pragma once #include #include @@ -54,5 +53,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/ledger/LedgerMaster.h b/src/xrpld/app/ledger/LedgerMaster.h index 5db8806534..ceb9fa9045 100644 --- a/src/xrpld/app/ledger/LedgerMaster.h +++ b/src/xrpld/app/ledger/LedgerMaster.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_LEDGER_LEDGERMASTER_H_INCLUDED -#define XRPL_APP_LEDGER_LEDGERMASTER_H_INCLUDED +#pragma once #include #include @@ -391,5 +390,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/ledger/LedgerReplay.h b/src/xrpld/app/ledger/LedgerReplay.h index 9051bb414c..f4cbf9c69e 100644 --- a/src/xrpld/app/ledger/LedgerReplay.h +++ b/src/xrpld/app/ledger/LedgerReplay.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_LEDGER_LEDGERREPLAY_H_INCLUDED -#define XRPL_APP_LEDGER_LEDGERREPLAY_H_INCLUDED +#pragma once #include @@ -51,5 +50,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/ledger/LedgerReplayTask.h b/src/xrpld/app/ledger/LedgerReplayTask.h index 40995430db..94eeee5f51 100644 --- a/src/xrpld/app/ledger/LedgerReplayTask.h +++ b/src/xrpld/app/ledger/LedgerReplayTask.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_LEDGER_LEDGERREPLAYTASK_H_INCLUDED -#define XRPL_APP_LEDGER_LEDGERREPLAYTASK_H_INCLUDED +#pragma once #include #include @@ -152,5 +151,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/ledger/LedgerReplayer.h b/src/xrpld/app/ledger/LedgerReplayer.h index ff67a43e87..0d08e5a76f 100644 --- a/src/xrpld/app/ledger/LedgerReplayer.h +++ b/src/xrpld/app/ledger/LedgerReplayer.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_LEDGER_LEDGERREPLAYER_H_INCLUDED -#define XRPL_APP_LEDGER_LEDGERREPLAYER_H_INCLUDED +#pragma once #include #include @@ -132,5 +131,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/ledger/LedgerToJson.h b/src/xrpld/app/ledger/LedgerToJson.h index 1d77c4dc39..8cde134d23 100644 --- a/src/xrpld/app/ledger/LedgerToJson.h +++ b/src/xrpld/app/ledger/LedgerToJson.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_LEDGER_LEDGERTOJSON_H_INCLUDED -#define XRPL_APP_LEDGER_LEDGERTOJSON_H_INCLUDED +#pragma once #include #include @@ -44,5 +43,3 @@ void copyFrom(Json::Value& to, Json::Value const& from); } // namespace xrpl - -#endif diff --git a/src/xrpld/app/ledger/LocalTxs.h b/src/xrpld/app/ledger/LocalTxs.h index d02e1027a0..34dfede40f 100644 --- a/src/xrpld/app/ledger/LocalTxs.h +++ b/src/xrpld/app/ledger/LocalTxs.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_LEDGER_LOCALTXS_H_INCLUDED -#define XRPL_APP_LEDGER_LOCALTXS_H_INCLUDED +#pragma once #include @@ -43,5 +42,3 @@ std::unique_ptr make_LocalTxs(); } // namespace xrpl - -#endif diff --git a/src/xrpld/app/ledger/OpenLedger.h b/src/xrpld/app/ledger/OpenLedger.h index 498e140b4b..187086862c 100644 --- a/src/xrpld/app/ledger/OpenLedger.h +++ b/src/xrpld/app/ledger/OpenLedger.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_LEDGER_OPENLEDGER_H_INCLUDED -#define XRPL_APP_LEDGER_OPENLEDGER_H_INCLUDED +#pragma once #include #include @@ -262,5 +261,3 @@ std::string debugTostr(std::shared_ptr const& view); } // namespace xrpl - -#endif diff --git a/src/xrpld/app/ledger/OrderBookDB.h b/src/xrpld/app/ledger/OrderBookDB.h index 601b2d38e4..da604d7e22 100644 --- a/src/xrpld/app/ledger/OrderBookDB.h +++ b/src/xrpld/app/ledger/OrderBookDB.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_LEDGER_ORDERBOOKDB_H_INCLUDED -#define XRPL_APP_LEDGER_ORDERBOOKDB_H_INCLUDED +#pragma once #include #include @@ -74,5 +73,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/ledger/PendingSaves.h b/src/xrpld/app/ledger/PendingSaves.h index 24eb50e568..76958fc78a 100644 --- a/src/xrpld/app/ledger/PendingSaves.h +++ b/src/xrpld/app/ledger/PendingSaves.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_PENDINGSAVES_H_INCLUDED -#define XRPL_APP_PENDINGSAVES_H_INCLUDED +#pragma once #include @@ -125,5 +124,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/ledger/TransactionMaster.h b/src/xrpld/app/ledger/TransactionMaster.h index ceba55a85a..039ff5cb99 100644 --- a/src/xrpld/app/ledger/TransactionMaster.h +++ b/src/xrpld/app/ledger/TransactionMaster.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_LEDGER_TRANSACTIONMASTER_H_INCLUDED -#define XRPL_APP_LEDGER_TRANSACTIONMASTER_H_INCLUDED +#pragma once #include @@ -64,5 +63,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/ledger/TransactionStateSF.h b/src/xrpld/app/ledger/TransactionStateSF.h index 0ea8d7fb2d..2851884cfd 100644 --- a/src/xrpld/app/ledger/TransactionStateSF.h +++ b/src/xrpld/app/ledger/TransactionStateSF.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_LEDGER_TRANSACTIONSTATESF_H_INCLUDED -#define XRPL_APP_LEDGER_TRANSACTIONSTATESF_H_INCLUDED +#pragma once #include @@ -30,5 +29,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/ledger/detail/LedgerDeltaAcquire.h b/src/xrpld/app/ledger/detail/LedgerDeltaAcquire.h index 7b4d478c13..66b8f27b85 100644 --- a/src/xrpld/app/ledger/detail/LedgerDeltaAcquire.h +++ b/src/xrpld/app/ledger/detail/LedgerDeltaAcquire.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_LEDGER_LEDGERDELTAACQUIRE_H_INCLUDED -#define XRPL_APP_LEDGER_LEDGERDELTAACQUIRE_H_INCLUDED +#pragma once #include #include @@ -137,5 +136,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/ledger/detail/LedgerReplayMsgHandler.h b/src/xrpld/app/ledger/detail/LedgerReplayMsgHandler.h index 7cd231e59a..260f1ff753 100644 --- a/src/xrpld/app/ledger/detail/LedgerReplayMsgHandler.h +++ b/src/xrpld/app/ledger/detail/LedgerReplayMsgHandler.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_LEDGER_LEDGERREPLAYMSGHANDLER_H_INCLUDED -#define XRPL_APP_LEDGER_LEDGERREPLAYMSGHANDLER_H_INCLUDED +#pragma once #include #include @@ -51,5 +50,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/ledger/detail/SkipListAcquire.h b/src/xrpld/app/ledger/detail/SkipListAcquire.h index 587f6c19fd..f3bfb60bee 100644 --- a/src/xrpld/app/ledger/detail/SkipListAcquire.h +++ b/src/xrpld/app/ledger/detail/SkipListAcquire.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_LEDGER_SKIPLISTACQUIRE_H_INCLUDED -#define XRPL_APP_LEDGER_SKIPLISTACQUIRE_H_INCLUDED +#pragma once #include #include @@ -134,5 +133,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/ledger/detail/TimeoutCounter.h b/src/xrpld/app/ledger/detail/TimeoutCounter.h index c228d50aac..5f5ccb2f43 100644 --- a/src/xrpld/app/ledger/detail/TimeoutCounter.h +++ b/src/xrpld/app/ledger/detail/TimeoutCounter.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_LEDGER_TIMEOUTCOUNTER_H_INCLUDED -#define XRPL_APP_LEDGER_TIMEOUTCOUNTER_H_INCLUDED +#pragma once #include @@ -131,5 +130,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/ledger/detail/TransactionAcquire.h b/src/xrpld/app/ledger/detail/TransactionAcquire.h index dd12e8afb0..4345c74fc6 100644 --- a/src/xrpld/app/ledger/detail/TransactionAcquire.h +++ b/src/xrpld/app/ledger/detail/TransactionAcquire.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_LEDGER_TRANSACTIONACQUIRE_H_INCLUDED -#define XRPL_APP_LEDGER_TRANSACTIONACQUIRE_H_INCLUDED +#pragma once #include @@ -49,5 +48,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/main/Application.h b/src/xrpld/app/main/Application.h index bb8bac8bbb..53cc264ad4 100644 --- a/src/xrpld/app/main/Application.h +++ b/src/xrpld/app/main/Application.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_MAIN_APPLICATION_H_INCLUDED -#define XRPL_APP_MAIN_APPLICATION_H_INCLUDED +#pragma once #include #include @@ -183,5 +182,3 @@ std::unique_ptr make_Application(std::unique_ptr config, std::unique_ptr logs, std::unique_ptr timeKeeper); } // namespace xrpl - -#endif diff --git a/src/xrpld/app/main/BasicApp.h b/src/xrpld/app/main/BasicApp.h index 0d38260e43..278c255af3 100644 --- a/src/xrpld/app/main/BasicApp.h +++ b/src/xrpld/app/main/BasicApp.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_BASICAPP_H_INCLUDED -#define XRPL_APP_BASICAPP_H_INCLUDED +#pragma once #include @@ -25,5 +24,3 @@ public: return io_context_; } }; - -#endif diff --git a/src/xrpld/app/main/CollectorManager.h b/src/xrpld/app/main/CollectorManager.h index d0d202625c..15785ec292 100644 --- a/src/xrpld/app/main/CollectorManager.h +++ b/src/xrpld/app/main/CollectorManager.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_MAIN_COLLECTORMANAGER_H_INCLUDED -#define XRPL_APP_MAIN_COLLECTORMANAGER_H_INCLUDED +#pragma once #include #include @@ -23,5 +22,3 @@ std::unique_ptr make_CollectorManager(Section const& params, beast::Journal journal); } // namespace xrpl - -#endif diff --git a/src/xrpld/app/main/DBInit.h b/src/xrpld/app/main/DBInit.h index 60ff4b498b..56bc752343 100644 --- a/src/xrpld/app/main/DBInit.h +++ b/src/xrpld/app/main/DBInit.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_DATA_DBINIT_H_INCLUDED -#define XRPL_APP_DATA_DBINIT_H_INCLUDED +#pragma once #include #include @@ -117,5 +116,3 @@ inline constexpr std::array WalletDBInit{ "END TRANSACTION;"}}; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/main/GRPCServer.h b/src/xrpld/app/main/GRPCServer.h index 67748c359d..fdac2b6484 100644 --- a/src/xrpld/app/main/GRPCServer.h +++ b/src/xrpld/app/main/GRPCServer.h @@ -1,5 +1,4 @@ -#ifndef XRPL_CORE_GRPCSERVER_H_INCLUDED -#define XRPL_CORE_GRPCSERVER_H_INCLUDED +#pragma once #include #include @@ -300,4 +299,3 @@ private: bool running_ = false; }; } // namespace xrpl -#endif diff --git a/src/xrpld/app/main/LoadManager.h b/src/xrpld/app/main/LoadManager.h index 15caa9b0f0..c36afb1804 100644 --- a/src/xrpld/app/main/LoadManager.h +++ b/src/xrpld/app/main/LoadManager.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_MAIN_LOADMANAGER_H_INCLUDED -#define XRPL_APP_MAIN_LOADMANAGER_H_INCLUDED +#pragma once #include @@ -95,5 +94,3 @@ std::unique_ptr make_LoadManager(Application& app, beast::Journal journal); } // namespace xrpl - -#endif diff --git a/src/xrpld/app/main/NodeIdentity.h b/src/xrpld/app/main/NodeIdentity.h index ca47ae72ae..bebd5c261d 100644 --- a/src/xrpld/app/main/NodeIdentity.h +++ b/src/xrpld/app/main/NodeIdentity.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_MAIN_NODEIDENTITY_H_INCLUDED -#define XRPL_APP_MAIN_NODEIDENTITY_H_INCLUDED +#pragma once #include @@ -19,5 +18,3 @@ std::pair getNodeIdentity(Application& app, boost::program_options::variables_map const& cmdline); } // namespace xrpl - -#endif diff --git a/src/xrpld/app/main/NodeStoreScheduler.h b/src/xrpld/app/main/NodeStoreScheduler.h index 0214b76660..19e8d9d212 100644 --- a/src/xrpld/app/main/NodeStoreScheduler.h +++ b/src/xrpld/app/main/NodeStoreScheduler.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_MAIN_NODESTORESCHEDULER_H_INCLUDED -#define XRPL_APP_MAIN_NODESTORESCHEDULER_H_INCLUDED +#pragma once #include #include @@ -24,5 +23,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/main/Tuning.h b/src/xrpld/app/main/Tuning.h index 25cc2ef75d..0f612b1b1c 100644 --- a/src/xrpld/app/main/Tuning.h +++ b/src/xrpld/app/main/Tuning.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_MAIN_TUNING_H_INCLUDED -#define XRPL_APP_MAIN_TUNING_H_INCLUDED +#pragma once #include @@ -11,5 +10,3 @@ constexpr std::chrono::seconds fullBelowExpiration = std::chrono::minutes{10}; constexpr std::size_t maxPoppedTransactions = 10; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/misc/AMMHelpers.h b/src/xrpld/app/misc/AMMHelpers.h index e54eea2f01..cde485f5dc 100644 --- a/src/xrpld/app/misc/AMMHelpers.h +++ b/src/xrpld/app/misc/AMMHelpers.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_MISC_AMMHELPERS_H_INCLUDED -#define XRPL_APP_MISC_AMMHELPERS_H_INCLUDED +#pragma once #include #include @@ -688,5 +687,3 @@ Number adjustFracByTokens(Rules const& rules, STAmount const& lptAMMBalance, STAmount const& tokens, Number const& frac); } // namespace xrpl - -#endif // XRPL_APP_MISC_AMMHELPERS_H_INCLUDED diff --git a/src/xrpld/app/misc/AMMUtils.h b/src/xrpld/app/misc/AMMUtils.h index 5ed03d51f7..c97397a141 100644 --- a/src/xrpld/app/misc/AMMUtils.h +++ b/src/xrpld/app/misc/AMMUtils.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_MISC_AMMUTILS_H_INCLUDED -#define XRPL_APP_MISC_AMMUTILS_H_INCLUDED +#pragma once #include #include @@ -100,5 +99,3 @@ verifyAndAdjustLPTokenBalance( AccountID const& account); } // namespace xrpl - -#endif // XRPL_APP_MISC_AMMUTILS_H_INCLUDED diff --git a/src/xrpld/app/misc/AmendmentTable.h b/src/xrpld/app/misc/AmendmentTable.h index d6cb3d7bce..94ac9608a7 100644 --- a/src/xrpld/app/misc/AmendmentTable.h +++ b/src/xrpld/app/misc/AmendmentTable.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_MISC_AMENDMENTTABLE_H_INCLUDED -#define XRPL_APP_MISC_AMENDMENTTABLE_H_INCLUDED +#pragma once #include #include @@ -172,5 +171,3 @@ make_AmendmentTable( beast::Journal journal); } // namespace xrpl - -#endif diff --git a/src/xrpld/app/misc/CanonicalTXSet.h b/src/xrpld/app/misc/CanonicalTXSet.h index 15fb656403..45f58b5701 100644 --- a/src/xrpld/app/misc/CanonicalTXSet.h +++ b/src/xrpld/app/misc/CanonicalTXSet.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_MISC_CANONICALTXSET_H_INCLUDED -#define XRPL_APP_MISC_CANONICALTXSET_H_INCLUDED +#pragma once #include #include @@ -156,5 +155,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/misc/DelegateUtils.h b/src/xrpld/app/misc/DelegateUtils.h index 37d9195a82..78ccc46d0b 100644 --- a/src/xrpld/app/misc/DelegateUtils.h +++ b/src/xrpld/app/misc/DelegateUtils.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_MISC_DELEGATEUTILS_H_INCLUDED -#define XRPL_APP_MISC_DELEGATEUTILS_H_INCLUDED +#pragma once #include #include @@ -34,5 +33,3 @@ loadGranularPermission( std::unordered_set& granularPermissions); } // namespace xrpl - -#endif // XRPL_APP_MISC_DELEGATEUTILS_H_INCLUDED diff --git a/src/xrpld/app/misc/DeliverMax.h b/src/xrpld/app/misc/DeliverMax.h index e9455354f8..1b4241f091 100644 --- a/src/xrpld/app/misc/DeliverMax.h +++ b/src/xrpld/app/misc/DeliverMax.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_MISC_DELIVERMAX_H_INCLUDED -#define XRPL_APP_MISC_DELIVERMAX_H_INCLUDED +#pragma once #include @@ -27,5 +26,3 @@ insertDeliverMax(Json::Value& tx_json, TxType txnType, unsigned int apiVersion); } // namespace RPC } // namespace xrpl - -#endif diff --git a/src/xrpld/app/misc/FeeVote.h b/src/xrpld/app/misc/FeeVote.h index 4b7f7f8409..3ecf474867 100644 --- a/src/xrpld/app/misc/FeeVote.h +++ b/src/xrpld/app/misc/FeeVote.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_MISC_FEEVOTE_H_INCLUDED -#define XRPL_APP_MISC_FEEVOTE_H_INCLUDED +#pragma once #include #include @@ -42,5 +41,3 @@ std::unique_ptr make_FeeVote(FeeSetup const& setup, beast::Journal journal); } // namespace xrpl - -#endif diff --git a/src/xrpld/app/misc/HashRouter.h b/src/xrpld/app/misc/HashRouter.h index d4ff8629f3..ad6da520bd 100644 --- a/src/xrpld/app/misc/HashRouter.h +++ b/src/xrpld/app/misc/HashRouter.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_MISC_HASHROUTER_H_INCLUDED -#define XRPL_APP_MISC_HASHROUTER_H_INCLUDED +#pragma once #include #include @@ -256,5 +255,3 @@ HashRouter::Setup setup_HashRouter(Config const&); } // namespace xrpl - -#endif diff --git a/src/xrpld/app/misc/LendingHelpers.h b/src/xrpld/app/misc/LendingHelpers.h index 0e04f0f793..f8297dfdf7 100644 --- a/src/xrpld/app/misc/LendingHelpers.h +++ b/src/xrpld/app/misc/LendingHelpers.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_MISC_LENDINGHELPERS_H_INCLUDED -#define XRPL_APP_MISC_LENDINGHELPERS_H_INCLUDED +#pragma once #include #include @@ -466,5 +465,3 @@ loanMakePayment( beast::Journal j); } // namespace xrpl - -#endif // XRPL_APP_MISC_LENDINGHELPERS_H_INCLUDED diff --git a/src/xrpld/app/misc/LoadFeeTrack.h b/src/xrpld/app/misc/LoadFeeTrack.h index 3c6932fa41..8eb53187ce 100644 --- a/src/xrpld/app/misc/LoadFeeTrack.h +++ b/src/xrpld/app/misc/LoadFeeTrack.h @@ -1,5 +1,4 @@ -#ifndef XRPL_CORE_LOADFEETRACK_H_INCLUDED -#define XRPL_CORE_LOADFEETRACK_H_INCLUDED +#pragma once #include #include @@ -136,5 +135,3 @@ XRPAmount scaleFeeLoad(XRPAmount fee, LoadFeeTrack const& feeTrack, Fees const& fees, bool bUnlimited); } // namespace xrpl - -#endif diff --git a/src/xrpld/app/misc/Manifest.h b/src/xrpld/app/misc/Manifest.h index a41e16dbf9..79426a1a46 100644 --- a/src/xrpld/app/misc/Manifest.h +++ b/src/xrpld/app/misc/Manifest.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_MISC_MANIFEST_H_INCLUDED -#define XRPL_APP_MISC_MANIFEST_H_INCLUDED +#pragma once #include #include @@ -427,5 +426,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/misc/NegativeUNLVote.h b/src/xrpld/app/misc/NegativeUNLVote.h index 68daa0e57b..4019d32f13 100644 --- a/src/xrpld/app/misc/NegativeUNLVote.h +++ b/src/xrpld/app/misc/NegativeUNLVote.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_MISC_NEGATIVEUNLVOTE_H_INCLUDED -#define XRPL_APP_MISC_NEGATIVEUNLVOTE_H_INCLUDED +#pragma once #include @@ -188,5 +187,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/misc/NetworkOPs.h b/src/xrpld/app/misc/NetworkOPs.h index 7e230510a8..66c915008a 100644 --- a/src/xrpld/app/misc/NetworkOPs.h +++ b/src/xrpld/app/misc/NetworkOPs.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_MISC_NETWORKOPS_H_INCLUDED -#define XRPL_APP_MISC_NETWORKOPS_H_INCLUDED +#pragma once #include #include @@ -263,5 +262,3 @@ make_NetworkOPs( beast::insight::Collector::ptr const& collector); } // namespace xrpl - -#endif diff --git a/src/xrpld/app/misc/SHAMapStore.h b/src/xrpld/app/misc/SHAMapStore.h index 30253d92a5..67477593cb 100644 --- a/src/xrpld/app/misc/SHAMapStore.h +++ b/src/xrpld/app/misc/SHAMapStore.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_MISC_SHAMAPSTORE_H_INCLUDED -#define XRPL_APP_MISC_SHAMAPSTORE_H_INCLUDED +#pragma once #include @@ -86,5 +85,3 @@ public: std::unique_ptr make_SHAMapStore(Application& app, NodeStore::Scheduler& scheduler, beast::Journal journal); } // namespace xrpl - -#endif diff --git a/src/xrpld/app/misc/SHAMapStoreImp.h b/src/xrpld/app/misc/SHAMapStoreImp.h index 05faae5bd4..a0475e80d6 100644 --- a/src/xrpld/app/misc/SHAMapStoreImp.h +++ b/src/xrpld/app/misc/SHAMapStoreImp.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_MISC_SHAMAPSTOREIMP_H_INCLUDED -#define XRPL_APP_MISC_SHAMAPSTOREIMP_H_INCLUDED +#pragma once #include #include @@ -221,5 +220,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/misc/Transaction.h b/src/xrpld/app/misc/Transaction.h index c902d4a4f3..22f3e9d1fd 100644 --- a/src/xrpld/app/misc/Transaction.h +++ b/src/xrpld/app/misc/Transaction.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_MISC_TRANSACTION_H_INCLUDED -#define XRPL_APP_MISC_TRANSACTION_H_INCLUDED +#pragma once #include #include @@ -386,5 +385,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/misc/TxQ.h b/src/xrpld/app/misc/TxQ.h index 004cd085fc..b50ff1a0b5 100644 --- a/src/xrpld/app/misc/TxQ.h +++ b/src/xrpld/app/misc/TxQ.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TXQ_H_INCLUDED -#define XRPL_TXQ_H_INCLUDED +#pragma once #include @@ -825,5 +824,3 @@ toFeeLevel(XRPAmount const& drops, XRPAmount const& baseFee) } } // namespace xrpl - -#endif diff --git a/src/xrpld/app/misc/ValidatorKeys.h b/src/xrpld/app/misc/ValidatorKeys.h index 3a9aaf6d2c..296c63e09e 100644 --- a/src/xrpld/app/misc/ValidatorKeys.h +++ b/src/xrpld/app/misc/ValidatorKeys.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_MISC_VALIDATOR_KEYS_H_INCLUDED -#define XRPL_APP_MISC_VALIDATOR_KEYS_H_INCLUDED +#pragma once #include #include @@ -55,5 +54,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/misc/ValidatorList.h b/src/xrpld/app/misc/ValidatorList.h index 3b15af00dc..4fd610be04 100644 --- a/src/xrpld/app/misc/ValidatorList.h +++ b/src/xrpld/app/misc/ValidatorList.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_MISC_VALIDATORLIST_H_INCLUDED -#define XRPL_APP_MISC_VALIDATORLIST_H_INCLUDED +#pragma once #include #include @@ -926,5 +925,3 @@ hash_append(Hasher& h, TMValidatorListCollection const& msg) } } // namespace protocol - -#endif diff --git a/src/xrpld/app/misc/ValidatorSite.h b/src/xrpld/app/misc/ValidatorSite.h index 075722bca6..dc44e28bcb 100644 --- a/src/xrpld/app/misc/ValidatorSite.h +++ b/src/xrpld/app/misc/ValidatorSite.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_MISC_VALIDATORSITE_H_INCLUDED -#define XRPL_APP_MISC_VALIDATORSITE_H_INCLUDED +#pragma once #include #include @@ -227,5 +226,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/misc/detail/AccountTxPaging.h b/src/xrpld/app/misc/detail/AccountTxPaging.h index cbfe8c89bb..6dff5c481b 100644 --- a/src/xrpld/app/misc/detail/AccountTxPaging.h +++ b/src/xrpld/app/misc/detail/AccountTxPaging.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_MISC_IMPL_ACCOUNTTXPAGING_H_INCLUDED -#define XRPL_APP_MISC_IMPL_ACCOUNTTXPAGING_H_INCLUDED +#pragma once #include @@ -22,5 +21,3 @@ void saveLedgerAsync(Application& app, std::uint32_t seq); } // namespace xrpl - -#endif diff --git a/src/xrpld/app/misc/detail/Work.h b/src/xrpld/app/misc/detail/Work.h index 90e81b7bbf..5261cf3bd7 100644 --- a/src/xrpld/app/misc/detail/Work.h +++ b/src/xrpld/app/misc/detail/Work.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_MISC_DETAIL_WORK_H_INCLUDED -#define XRPL_APP_MISC_DETAIL_WORK_H_INCLUDED +#pragma once #include #include @@ -25,5 +24,3 @@ public: } // namespace detail } // namespace xrpl - -#endif diff --git a/src/xrpld/app/misc/detail/WorkBase.h b/src/xrpld/app/misc/detail/WorkBase.h index 1e519c7b2f..e5fd72f118 100644 --- a/src/xrpld/app/misc/detail/WorkBase.h +++ b/src/xrpld/app/misc/detail/WorkBase.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_MISC_DETAIL_WORKBASE_H_INCLUDED -#define XRPL_APP_MISC_DETAIL_WORKBASE_H_INCLUDED +#pragma once #include @@ -258,5 +257,3 @@ WorkBase::close() } // namespace detail } // namespace xrpl - -#endif diff --git a/src/xrpld/app/misc/detail/WorkFile.h b/src/xrpld/app/misc/detail/WorkFile.h index cce7fd410e..8d2d4edb50 100644 --- a/src/xrpld/app/misc/detail/WorkFile.h +++ b/src/xrpld/app/misc/detail/WorkFile.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_MISC_DETAIL_WORKFILE_H_INCLUDED -#define XRPL_APP_MISC_DETAIL_WORKFILE_H_INCLUDED +#pragma once #include @@ -80,5 +79,3 @@ WorkFile::cancel() } // namespace detail } // namespace xrpl - -#endif diff --git a/src/xrpld/app/misc/detail/WorkPlain.h b/src/xrpld/app/misc/detail/WorkPlain.h index cac6d76a62..d1df5b4b3b 100644 --- a/src/xrpld/app/misc/detail/WorkPlain.h +++ b/src/xrpld/app/misc/detail/WorkPlain.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_MISC_DETAIL_WORKPLAIN_H_INCLUDED -#define XRPL_APP_MISC_DETAIL_WORKPLAIN_H_INCLUDED +#pragma once #include @@ -60,5 +59,3 @@ WorkPlain::onConnect(error_code const& ec) } // namespace detail } // namespace xrpl - -#endif diff --git a/src/xrpld/app/misc/detail/WorkSSL.h b/src/xrpld/app/misc/detail/WorkSSL.h index bed963d8ec..b12c774f6e 100644 --- a/src/xrpld/app/misc/detail/WorkSSL.h +++ b/src/xrpld/app/misc/detail/WorkSSL.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_MISC_DETAIL_WORKSSL_H_INCLUDED -#define XRPL_APP_MISC_DETAIL_WORKSSL_H_INCLUDED +#pragma once #include #include @@ -57,5 +56,3 @@ private: } // namespace detail } // namespace xrpl - -#endif diff --git a/src/xrpld/app/paths/AMMContext.h b/src/xrpld/app/paths/AMMContext.h index 9e82a7394a..b0ff44c5ec 100644 --- a/src/xrpld/app/paths/AMMContext.h +++ b/src/xrpld/app/paths/AMMContext.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_PATHS_AMMCONTEXT_H_INCLUDED -#define XRPL_APP_PATHS_AMMCONTEXT_H_INCLUDED +#pragma once #include @@ -95,5 +94,3 @@ public: }; } // namespace xrpl - -#endif // XRPL_APP_PATHS_AMMCONTEXT_H_INCLUDED diff --git a/src/xrpld/app/paths/AMMLiquidity.h b/src/xrpld/app/paths/AMMLiquidity.h index c22901b28e..441c3b6e3d 100644 --- a/src/xrpld/app/paths/AMMLiquidity.h +++ b/src/xrpld/app/paths/AMMLiquidity.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_TX_AMMLIQUIDITY_H_INCLUDED -#define XRPL_APP_TX_AMMLIQUIDITY_H_INCLUDED +#pragma once #include #include @@ -131,5 +130,3 @@ private: }; } // namespace xrpl - -#endif // XRPL_APP_TX_AMMLIQUIDITY_H_INCLUDED diff --git a/src/xrpld/app/paths/AMMOffer.h b/src/xrpld/app/paths/AMMOffer.h index 893938f0f2..ebaa7311c0 100644 --- a/src/xrpld/app/paths/AMMOffer.h +++ b/src/xrpld/app/paths/AMMOffer.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_AMMOFFER_H_INCLUDED -#define XRPL_APP_AMMOFFER_H_INCLUDED +#pragma once #include #include @@ -124,5 +123,3 @@ public: }; } // namespace xrpl - -#endif // XRPL_APP_AMMOFFER_H_INCLUDED diff --git a/src/xrpld/app/paths/AccountCurrencies.h b/src/xrpld/app/paths/AccountCurrencies.h index f0fa1bc504..eb8cc92aec 100644 --- a/src/xrpld/app/paths/AccountCurrencies.h +++ b/src/xrpld/app/paths/AccountCurrencies.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_PATHS_ACCOUNTCURRENCIES_H_INCLUDED -#define XRPL_APP_PATHS_ACCOUNTCURRENCIES_H_INCLUDED +#pragma once #include @@ -14,5 +13,3 @@ hash_set accountSourceCurrencies(AccountID const& account, std::shared_ptr const& lrLedger, bool includeXRP); } // namespace xrpl - -#endif diff --git a/src/xrpld/app/paths/Flow.h b/src/xrpld/app/paths/Flow.h index 5fafe294db..1a46ce221a 100644 --- a/src/xrpld/app/paths/Flow.h +++ b/src/xrpld/app/paths/Flow.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_PATHS_FLOW_H_INCLUDED -#define XRPL_APP_PATHS_FLOW_H_INCLUDED +#pragma once #include #include @@ -52,5 +51,3 @@ flow( path::detail::FlowDebugInfo* flowDebugInfo = nullptr); } // namespace xrpl - -#endif diff --git a/src/xrpld/app/paths/PathRequest.h b/src/xrpld/app/paths/PathRequest.h index edeab4dc88..864d2cb932 100644 --- a/src/xrpld/app/paths/PathRequest.h +++ b/src/xrpld/app/paths/PathRequest.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_PATHS_PATHREQUEST_H_INCLUDED -#define XRPL_APP_PATHS_PATHREQUEST_H_INCLUDED +#pragma once #include #include @@ -155,5 +154,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/paths/PathRequests.h b/src/xrpld/app/paths/PathRequests.h index 33b817f8c0..f89ca3c4da 100644 --- a/src/xrpld/app/paths/PathRequests.h +++ b/src/xrpld/app/paths/PathRequests.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_PATHS_PATHREQUESTS_H_INCLUDED -#define XRPL_APP_PATHS_PATHREQUESTS_H_INCLUDED +#pragma once #include #include @@ -96,5 +95,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/paths/Pathfinder.h b/src/xrpld/app/paths/Pathfinder.h index 131e9420c1..03f2d6f038 100644 --- a/src/xrpld/app/paths/Pathfinder.h +++ b/src/xrpld/app/paths/Pathfinder.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_PATHS_PATHFINDER_H_INCLUDED -#define XRPL_APP_PATHS_PATHFINDER_H_INCLUDED +#pragma once #include #include @@ -211,5 +210,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/paths/RippleCalc.h b/src/xrpld/app/paths/RippleCalc.h index 0ef2641e36..a5cecc18bf 100644 --- a/src/xrpld/app/paths/RippleCalc.h +++ b/src/xrpld/app/paths/RippleCalc.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_PATHS_RIPPLECALC_H_INCLUDED -#define XRPL_APP_PATHS_RIPPLECALC_H_INCLUDED +#pragma once #include #include @@ -108,5 +107,3 @@ public: } // namespace path } // namespace xrpl - -#endif diff --git a/src/xrpld/app/paths/RippleLineCache.h b/src/xrpld/app/paths/RippleLineCache.h index 8307fb8b4b..5dbdb414ee 100644 --- a/src/xrpld/app/paths/RippleLineCache.h +++ b/src/xrpld/app/paths/RippleLineCache.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_PATHS_RIPPLELINECACHE_H_INCLUDED -#define XRPL_APP_PATHS_RIPPLELINECACHE_H_INCLUDED +#pragma once #include #include @@ -99,5 +98,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/paths/TrustLine.h b/src/xrpld/app/paths/TrustLine.h index 45cc797cb4..a0fce8847a 100644 --- a/src/xrpld/app/paths/TrustLine.h +++ b/src/xrpld/app/paths/TrustLine.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_PATHS_RIPPLESTATE_H_INCLUDED -#define XRPL_APP_PATHS_RIPPLESTATE_H_INCLUDED +#pragma once #include #include @@ -217,5 +216,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/paths/detail/AmountSpec.h b/src/xrpld/app/paths/detail/AmountSpec.h index 3ebe5fde91..690e67ae22 100644 --- a/src/xrpld/app/paths/detail/AmountSpec.h +++ b/src/xrpld/app/paths/detail/AmountSpec.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PATH_IMPL_AMOUNTSPEC_H_INCLUDED -#define XRPL_PATH_IMPL_AMOUNTSPEC_H_INCLUDED +#pragma once #include #include @@ -197,5 +196,3 @@ toAmountSpec(EitherAmount const& ea, std::optional const& c) } } // namespace xrpl - -#endif diff --git a/src/xrpld/app/paths/detail/FlatSets.h b/src/xrpld/app/paths/detail/FlatSets.h index a14db370fa..a7546cc514 100644 --- a/src/xrpld/app/paths/detail/FlatSets.h +++ b/src/xrpld/app/paths/detail/FlatSets.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_PATHS_IMPL_FLAT_SETS_H_INCLUDED -#define XRPL_APP_PATHS_IMPL_FLAT_SETS_H_INCLUDED +#pragma once #include @@ -23,5 +22,3 @@ SetUnion(boost::container::flat_set& dst, boost::container::flat_set const } } // namespace xrpl - -#endif diff --git a/src/xrpld/app/paths/detail/FlowDebugInfo.h b/src/xrpld/app/paths/detail/FlowDebugInfo.h index a38ab7864f..d7b97a49d4 100644 --- a/src/xrpld/app/paths/detail/FlowDebugInfo.h +++ b/src/xrpld/app/paths/detail/FlowDebugInfo.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PATH_IMPL_FLOWDEBUGINFO_H_INCLUDED -#define XRPL_PATH_IMPL_FLOWDEBUGINFO_H_INCLUDED +#pragma once #include @@ -329,4 +328,3 @@ balanceDiffsToString(std::optional const& bd) } // namespace detail } // namespace path } // namespace xrpl -#endif diff --git a/src/xrpld/app/paths/detail/PathfinderUtils.h b/src/xrpld/app/paths/detail/PathfinderUtils.h index 5571cd4732..560deca2d6 100644 --- a/src/xrpld/app/paths/detail/PathfinderUtils.h +++ b/src/xrpld/app/paths/detail/PathfinderUtils.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PATH_IMPL_PATHFINDERUTILS_H_INCLUDED -#define XRPL_PATH_IMPL_PATHFINDERUTILS_H_INCLUDED +#pragma once #include @@ -30,5 +29,3 @@ convertAllCheck(STAmount const& a) } } // namespace xrpl - -#endif diff --git a/src/xrpld/app/paths/detail/StepChecks.h b/src/xrpld/app/paths/detail/StepChecks.h index b72461fc43..479f1298d3 100644 --- a/src/xrpld/app/paths/detail/StepChecks.h +++ b/src/xrpld/app/paths/detail/StepChecks.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_PATHS_IMPL_STEP_CHECKS_H_INCLUDED -#define XRPL_APP_PATHS_IMPL_STEP_CHECKS_H_INCLUDED +#pragma once #include #include @@ -84,5 +83,3 @@ checkNoRipple( } } // namespace xrpl - -#endif diff --git a/src/xrpld/app/paths/detail/Steps.h b/src/xrpld/app/paths/detail/Steps.h index 7fc4d8b3b4..580b8c487e 100644 --- a/src/xrpld/app/paths/detail/Steps.h +++ b/src/xrpld/app/paths/detail/Steps.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_PATHS_IMPL_PAYSTEPS_H_INCLUDED -#define XRPL_APP_PATHS_IMPL_PAYSTEPS_H_INCLUDED +#pragma once #include @@ -591,5 +590,3 @@ isDirectXrpToXrp(Strand const& strand); /// @endcond } // namespace xrpl - -#endif diff --git a/src/xrpld/app/paths/detail/StrandFlow.h b/src/xrpld/app/paths/detail/StrandFlow.h index ebb9257ed4..aa3d00a822 100644 --- a/src/xrpld/app/paths/detail/StrandFlow.h +++ b/src/xrpld/app/paths/detail/StrandFlow.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_PATHS_IMPL_STRANDFLOW_H_INCLUDED -#define XRPL_APP_PATHS_IMPL_STRANDFLOW_H_INCLUDED +#pragma once #include #include @@ -784,5 +783,3 @@ flow( } } // namespace xrpl - -#endif diff --git a/src/xrpld/app/rdb/PeerFinder.h b/src/xrpld/app/rdb/PeerFinder.h index a6dfde1f65..2b4080255f 100644 --- a/src/xrpld/app/rdb/PeerFinder.h +++ b/src/xrpld/app/rdb/PeerFinder.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_RDB_PEERFINDER_H_INCLUDED -#define XRPL_APP_RDB_PEERFINDER_H_INCLUDED +#pragma once #include #include @@ -43,5 +42,3 @@ void savePeerFinderDB(soci::session& session, std::vector const& v); } // namespace xrpl - -#endif diff --git a/src/xrpld/app/rdb/RelationalDatabase.h b/src/xrpld/app/rdb/RelationalDatabase.h index cb43c8c95d..c0cc61f757 100644 --- a/src/xrpld/app/rdb/RelationalDatabase.h +++ b/src/xrpld/app/rdb/RelationalDatabase.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_RDB_RELATIONALDATABASE_H_INCLUDED -#define XRPL_APP_RDB_RELATIONALDATABASE_H_INCLUDED +#pragma once #include #include @@ -225,5 +224,3 @@ rangeCheckedCast(C c) } } // namespace xrpl - -#endif diff --git a/src/xrpld/app/rdb/State.h b/src/xrpld/app/rdb/State.h index 4c68154645..52118b3cf8 100644 --- a/src/xrpld/app/rdb/State.h +++ b/src/xrpld/app/rdb/State.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_RDB_STATE_H_INCLUDED -#define XRPL_APP_RDB_STATE_H_INCLUDED +#pragma once #include #include @@ -72,5 +71,3 @@ void setLastRotated(soci::session& session, LedgerIndex seq); } // namespace xrpl - -#endif diff --git a/src/xrpld/app/rdb/Vacuum.h b/src/xrpld/app/rdb/Vacuum.h index d7ca5f8bce..f592b4537e 100644 --- a/src/xrpld/app/rdb/Vacuum.h +++ b/src/xrpld/app/rdb/Vacuum.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_RDB_VACUUM_H_INCLUDED -#define XRPL_APP_RDB_VACUUM_H_INCLUDED +#pragma once #include @@ -15,5 +14,3 @@ bool doVacuumDB(DatabaseCon::Setup const& setup, beast::Journal j); } // namespace xrpl - -#endif diff --git a/src/xrpld/app/rdb/Wallet.h b/src/xrpld/app/rdb/Wallet.h index 3a967fd339..141ef53f27 100644 --- a/src/xrpld/app/rdb/Wallet.h +++ b/src/xrpld/app/rdb/Wallet.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_RDB_WALLET_H_INCLUDED -#define XRPL_APP_RDB_WALLET_H_INCLUDED +#pragma once #include #include @@ -145,5 +144,3 @@ void voteAmendment(soci::session& session, uint256 const& amendment, std::string const& name, AmendmentVote vote); } // namespace xrpl - -#endif diff --git a/src/xrpld/app/rdb/backend/SQLiteDatabase.h b/src/xrpld/app/rdb/backend/SQLiteDatabase.h index 6e3ec7d311..b6dcb2534b 100644 --- a/src/xrpld/app/rdb/backend/SQLiteDatabase.h +++ b/src/xrpld/app/rdb/backend/SQLiteDatabase.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_RDB_BACKEND_SQLITEDATABASE_H_INCLUDED -#define XRPL_APP_RDB_BACKEND_SQLITEDATABASE_H_INCLUDED +#pragma once #include @@ -285,5 +284,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/rdb/backend/detail/Node.h b/src/xrpld/app/rdb/backend/detail/Node.h index a1bfd84567..69c4894bbc 100644 --- a/src/xrpld/app/rdb/backend/detail/Node.h +++ b/src/xrpld/app/rdb/backend/detail/Node.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_RDB_BACKEND_DETAIL_NODE_H_INCLUDED -#define XRPL_APP_RDB_BACKEND_DETAIL_NODE_H_INCLUDED +#pragma once #include #include @@ -404,5 +403,3 @@ dbHasSpace(soci::session& session, Config const& config, beast::Journal j); } // namespace detail } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/apply.h b/src/xrpld/app/tx/apply.h index db60097200..c3ff4f905e 100644 --- a/src/xrpld/app/tx/apply.h +++ b/src/xrpld/app/tx/apply.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_APPLY_H_INCLUDED -#define XRPL_TX_APPLY_H_INCLUDED +#pragma once #include #include @@ -130,5 +129,3 @@ applyTransaction( beast::Journal journal); } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/applySteps.h b/src/xrpld/app/tx/applySteps.h index ffb9fda5b5..ef87d352f3 100644 --- a/src/xrpld/app/tx/applySteps.h +++ b/src/xrpld/app/tx/applySteps.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_APPLYSTEPS_H_INCLUDED -#define XRPL_TX_APPLYSTEPS_H_INCLUDED +#pragma once #include #include @@ -337,5 +336,3 @@ ApplyResult doApply(PreclaimResult const& preclaimResult, Application& app, OpenView& view); } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/AMMBid.h b/src/xrpld/app/tx/detail/AMMBid.h index b402e82f9d..83ea6e0729 100644 --- a/src/xrpld/app/tx/detail/AMMBid.h +++ b/src/xrpld/app/tx/detail/AMMBid.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_AMMBID_H_INCLUDED -#define XRPL_TX_AMMBID_H_INCLUDED +#pragma once #include @@ -66,5 +65,3 @@ public: }; } // namespace xrpl - -#endif // XRPL_TX_AMMBID_H_INCLUDED diff --git a/src/xrpld/app/tx/detail/AMMClawback.h b/src/xrpld/app/tx/detail/AMMClawback.h index 0615234ffa..3da3c44605 100644 --- a/src/xrpld/app/tx/detail/AMMClawback.h +++ b/src/xrpld/app/tx/detail/AMMClawback.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_AMMCLAWBACK_H_INCLUDED -#define XRPL_TX_AMMCLAWBACK_H_INCLUDED +#pragma once #include @@ -55,5 +54,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/AMMCreate.h b/src/xrpld/app/tx/detail/AMMCreate.h index da77f79c5e..6f9fd77a2f 100644 --- a/src/xrpld/app/tx/detail/AMMCreate.h +++ b/src/xrpld/app/tx/detail/AMMCreate.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_AMMCREATE_H_INCLUDED -#define XRPL_TX_AMMCREATE_H_INCLUDED +#pragma once #include @@ -62,5 +61,3 @@ public: }; } // namespace xrpl - -#endif // XRPL_TX_AMMCREATE_H_INCLUDED diff --git a/src/xrpld/app/tx/detail/AMMDelete.h b/src/xrpld/app/tx/detail/AMMDelete.h index a09b855c7c..20c8f87262 100644 --- a/src/xrpld/app/tx/detail/AMMDelete.h +++ b/src/xrpld/app/tx/detail/AMMDelete.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_AMMDELETE_H_INCLUDED -#define XRPL_TX_AMMDELETE_H_INCLUDED +#pragma once #include @@ -34,5 +33,3 @@ public: }; } // namespace xrpl - -#endif // XRPL_TX_AMMDELETE_H_INCLUDED diff --git a/src/xrpld/app/tx/detail/AMMDeposit.h b/src/xrpld/app/tx/detail/AMMDeposit.h index 7fd50c4c4d..45c7995438 100644 --- a/src/xrpld/app/tx/detail/AMMDeposit.h +++ b/src/xrpld/app/tx/detail/AMMDeposit.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_AMMDEPOSIT_H_INCLUDED -#define XRPL_TX_AMMDEPOSIT_H_INCLUDED +#pragma once #include @@ -230,5 +229,3 @@ private: }; } // namespace xrpl - -#endif // XRPL_TX_AMMDEPOSIT_H_INCLUDED diff --git a/src/xrpld/app/tx/detail/AMMVote.h b/src/xrpld/app/tx/detail/AMMVote.h index 1dec046c29..2bc3da2301 100644 --- a/src/xrpld/app/tx/detail/AMMVote.h +++ b/src/xrpld/app/tx/detail/AMMVote.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_AMMVOTE_H_INCLUDED -#define XRPL_TX_AMMVOTE_H_INCLUDED +#pragma once #include @@ -51,5 +50,3 @@ public: }; } // namespace xrpl - -#endif // XRPL_TX_AMMVOTE_H_INCLUDED diff --git a/src/xrpld/app/tx/detail/AMMWithdraw.h b/src/xrpld/app/tx/detail/AMMWithdraw.h index 916621a5d0..246c66100c 100644 --- a/src/xrpld/app/tx/detail/AMMWithdraw.h +++ b/src/xrpld/app/tx/detail/AMMWithdraw.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_AMMWITHDRAW_H_INCLUDED -#define XRPL_TX_AMMWITHDRAW_H_INCLUDED +#pragma once #include @@ -294,5 +293,3 @@ private: }; } // namespace xrpl - -#endif // XRPL_TX_AMMWITHDRAW_H_INCLUDED diff --git a/src/xrpld/app/tx/detail/ApplyContext.h b/src/xrpld/app/tx/detail/ApplyContext.h index b4e91ff76c..45345df265 100644 --- a/src/xrpld/app/tx/detail/ApplyContext.h +++ b/src/xrpld/app/tx/detail/ApplyContext.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_APPLYCONTEXT_H_INCLUDED -#define XRPL_TX_APPLYCONTEXT_H_INCLUDED +#pragma once #include #include @@ -129,5 +128,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/Batch.h b/src/xrpld/app/tx/detail/Batch.h index a8cfeadc6b..8af8b2e020 100644 --- a/src/xrpld/app/tx/detail/Batch.h +++ b/src/xrpld/app/tx/detail/Batch.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_BATCH_H_INCLUDED -#define XRPL_TX_BATCH_H_INCLUDED +#pragma once #include #include @@ -56,5 +55,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/BookTip.h b/src/xrpld/app/tx/detail/BookTip.h index 51dc252835..69d3ec70d8 100644 --- a/src/xrpld/app/tx/detail/BookTip.h +++ b/src/xrpld/app/tx/detail/BookTip.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_BOOK_BOOKTIP_H_INCLUDED -#define XRPL_APP_BOOK_BOOKTIP_H_INCLUDED +#pragma once #include #include @@ -62,5 +61,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/CancelCheck.h b/src/xrpld/app/tx/detail/CancelCheck.h index 4be696520d..f125b9af5b 100644 --- a/src/xrpld/app/tx/detail/CancelCheck.h +++ b/src/xrpld/app/tx/detail/CancelCheck.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_CANCELCHECK_H_INCLUDED -#define XRPL_TX_CANCELCHECK_H_INCLUDED +#pragma once #include @@ -27,5 +26,3 @@ public: using CheckCancel = CancelCheck; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/CancelOffer.h b/src/xrpld/app/tx/detail/CancelOffer.h index 33af365c4d..30a7129fb4 100644 --- a/src/xrpld/app/tx/detail/CancelOffer.h +++ b/src/xrpld/app/tx/detail/CancelOffer.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_CANCELOFFER_H_INCLUDED -#define XRPL_TX_CANCELOFFER_H_INCLUDED +#pragma once #include @@ -29,5 +28,3 @@ public: using OfferCancel = CancelOffer; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/CashCheck.h b/src/xrpld/app/tx/detail/CashCheck.h index f27a45a0c4..50a4f8a63a 100644 --- a/src/xrpld/app/tx/detail/CashCheck.h +++ b/src/xrpld/app/tx/detail/CashCheck.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_CASHCHECK_H_INCLUDED -#define XRPL_TX_CASHCHECK_H_INCLUDED +#pragma once #include @@ -27,5 +26,3 @@ public: using CheckCash = CashCheck; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/Change.h b/src/xrpld/app/tx/detail/Change.h index 4d7b76ed78..683b054ccb 100644 --- a/src/xrpld/app/tx/detail/Change.h +++ b/src/xrpld/app/tx/detail/Change.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_CHANGE_H_INCLUDED -#define XRPL_TX_CHANGE_H_INCLUDED +#pragma once #include @@ -44,5 +43,3 @@ using SetFee = Change; using UNLModify = Change; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/Clawback.h b/src/xrpld/app/tx/detail/Clawback.h index 8db93fcc01..427edb25b4 100644 --- a/src/xrpld/app/tx/detail/Clawback.h +++ b/src/xrpld/app/tx/detail/Clawback.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_CLAWBACK_H_INCLUDED -#define XRPL_TX_CLAWBACK_H_INCLUDED +#pragma once #include @@ -28,5 +27,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/CreateCheck.h b/src/xrpld/app/tx/detail/CreateCheck.h index ac735eecb0..b80536fe02 100644 --- a/src/xrpld/app/tx/detail/CreateCheck.h +++ b/src/xrpld/app/tx/detail/CreateCheck.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_CREATECHECK_H_INCLUDED -#define XRPL_TX_CREATECHECK_H_INCLUDED +#pragma once #include @@ -27,5 +26,3 @@ public: using CheckCreate = CreateCheck; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/CreateOffer.h b/src/xrpld/app/tx/detail/CreateOffer.h index 5aaa60c20e..14f82c501e 100644 --- a/src/xrpld/app/tx/detail/CreateOffer.h +++ b/src/xrpld/app/tx/detail/CreateOffer.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_CREATEOFFER_H_INCLUDED -#define XRPL_TX_CREATEOFFER_H_INCLUDED +#pragma once #include @@ -79,5 +78,3 @@ private: using OfferCreate = CreateOffer; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/CreateTicket.h b/src/xrpld/app/tx/detail/CreateTicket.h index a41c7e2b1f..2a6e1bb8cc 100644 --- a/src/xrpld/app/tx/detail/CreateTicket.h +++ b/src/xrpld/app/tx/detail/CreateTicket.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_CREATETICKET_H_INCLUDED -#define XRPL_TX_CREATETICKET_H_INCLUDED +#pragma once #include #include @@ -66,5 +65,3 @@ public: using TicketCreate = CreateTicket; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/Credentials.h b/src/xrpld/app/tx/detail/Credentials.h index 6723a2f0e4..02bccde198 100644 --- a/src/xrpld/app/tx/detail/Credentials.h +++ b/src/xrpld/app/tx/detail/Credentials.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_CREDENTIALS_H_INCLUDED -#define XRPL_TX_CREDENTIALS_H_INCLUDED +#pragma once #include @@ -76,5 +75,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/DID.h b/src/xrpld/app/tx/detail/DID.h index b8d0889add..a00039a999 100644 --- a/src/xrpld/app/tx/detail/DID.h +++ b/src/xrpld/app/tx/detail/DID.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_DID_H_INCLUDED -#define XRPL_TX_DID_H_INCLUDED +#pragma once #include @@ -46,5 +45,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/DelegateSet.h b/src/xrpld/app/tx/detail/DelegateSet.h index 568b16410e..2120674557 100644 --- a/src/xrpld/app/tx/detail/DelegateSet.h +++ b/src/xrpld/app/tx/detail/DelegateSet.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_DELEGATESET_H_INCLUDED -#define XRPL_TX_DELEGATESET_H_INCLUDED +#pragma once #include @@ -29,5 +28,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/DeleteAccount.h b/src/xrpld/app/tx/detail/DeleteAccount.h index 357f87d566..742d1f4257 100644 --- a/src/xrpld/app/tx/detail/DeleteAccount.h +++ b/src/xrpld/app/tx/detail/DeleteAccount.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_DELETEACCOUNT_H_INCLUDED -#define XRPL_TX_DELETEACCOUNT_H_INCLUDED +#pragma once #include @@ -33,5 +32,3 @@ public: using AccountDelete = DeleteAccount; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/DeleteOracle.h b/src/xrpld/app/tx/detail/DeleteOracle.h index d59699cdfb..7d7cc340cb 100644 --- a/src/xrpld/app/tx/detail/DeleteOracle.h +++ b/src/xrpld/app/tx/detail/DeleteOracle.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_DELETEORACLE_H_INCLUDED -#define XRPL_TX_DELETEORACLE_H_INCLUDED +#pragma once #include @@ -39,5 +38,3 @@ public: using OracleDelete = DeleteOracle; } // namespace xrpl - -#endif // XRPL_TX_DELETEORACLE_H_INCLUDED diff --git a/src/xrpld/app/tx/detail/DepositPreauth.h b/src/xrpld/app/tx/detail/DepositPreauth.h index 693b321580..f1afac3b18 100644 --- a/src/xrpld/app/tx/detail/DepositPreauth.h +++ b/src/xrpld/app/tx/detail/DepositPreauth.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_DEPOSIT_PREAUTH_H_INCLUDED -#define XRPL_TX_DEPOSIT_PREAUTH_H_INCLUDED +#pragma once #include @@ -32,5 +31,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/Escrow.h b/src/xrpld/app/tx/detail/Escrow.h index 935fb27cd0..cb99dcae06 100644 --- a/src/xrpld/app/tx/detail/Escrow.h +++ b/src/xrpld/app/tx/detail/Escrow.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_ESCROW_H_INCLUDED -#define XRPL_TX_ESCROW_H_INCLUDED +#pragma once #include @@ -79,5 +78,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/InvariantCheck.h b/src/xrpld/app/tx/detail/InvariantCheck.h index e941db4eff..9a20e372ba 100644 --- a/src/xrpld/app/tx/detail/InvariantCheck.h +++ b/src/xrpld/app/tx/detail/InvariantCheck.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_TX_INVARIANTCHECK_H_INCLUDED -#define XRPL_APP_TX_INVARIANTCHECK_H_INCLUDED +#pragma once #include #include @@ -720,5 +719,3 @@ getInvariantChecks() } } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/LedgerStateFix.h b/src/xrpld/app/tx/detail/LedgerStateFix.h index e1a7f85ecc..66fe124cff 100644 --- a/src/xrpld/app/tx/detail/LedgerStateFix.h +++ b/src/xrpld/app/tx/detail/LedgerStateFix.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_LEDGER_STATE_FIX_H_INCLUDED -#define XRPL_TX_LEDGER_STATE_FIX_H_INCLUDED +#pragma once #include @@ -32,5 +31,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/LoanBrokerCoverClawback.h b/src/xrpld/app/tx/detail/LoanBrokerCoverClawback.h index 3c4f997d95..139d50696a 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerCoverClawback.h +++ b/src/xrpld/app/tx/detail/LoanBrokerCoverClawback.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_LOANBROKERCOVERCLAWBACK_H_INCLUDED -#define XRPL_TX_LOANBROKERCOVERCLAWBACK_H_INCLUDED +#pragma once #include @@ -30,5 +29,3 @@ public: //------------------------------------------------------------------------------ } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/LoanBrokerCoverDeposit.h b/src/xrpld/app/tx/detail/LoanBrokerCoverDeposit.h index d2f17b1f1c..3f683c6a62 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerCoverDeposit.h +++ b/src/xrpld/app/tx/detail/LoanBrokerCoverDeposit.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_LOANBROKERCOVERDEPOSIT_H_INCLUDED -#define XRPL_TX_LOANBROKERCOVERDEPOSIT_H_INCLUDED +#pragma once #include @@ -30,5 +29,3 @@ public: //------------------------------------------------------------------------------ } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/LoanBrokerCoverWithdraw.h b/src/xrpld/app/tx/detail/LoanBrokerCoverWithdraw.h index e0a9a2e51b..50d0b98fa5 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerCoverWithdraw.h +++ b/src/xrpld/app/tx/detail/LoanBrokerCoverWithdraw.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_LOANBROKERCOVERWITHDRAW_H_INCLUDED -#define XRPL_TX_LOANBROKERCOVERWITHDRAW_H_INCLUDED +#pragma once #include @@ -30,5 +29,3 @@ public: //------------------------------------------------------------------------------ } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/LoanBrokerDelete.h b/src/xrpld/app/tx/detail/LoanBrokerDelete.h index aaea2af81a..cb44277f55 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerDelete.h +++ b/src/xrpld/app/tx/detail/LoanBrokerDelete.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_LOANBROKERDELETE_H_INCLUDED -#define XRPL_TX_LOANBROKERDELETE_H_INCLUDED +#pragma once #include @@ -30,5 +29,3 @@ public: //------------------------------------------------------------------------------ } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/LoanBrokerSet.h b/src/xrpld/app/tx/detail/LoanBrokerSet.h index 57170b9cb9..cda452bebe 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerSet.h +++ b/src/xrpld/app/tx/detail/LoanBrokerSet.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_LOANBROKERSET_H_INCLUDED -#define XRPL_TX_LOANBROKERSET_H_INCLUDED +#pragma once #include @@ -33,5 +32,3 @@ public: //------------------------------------------------------------------------------ } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/LoanDelete.h b/src/xrpld/app/tx/detail/LoanDelete.h index a1ebad340c..37889d31fb 100644 --- a/src/xrpld/app/tx/detail/LoanDelete.h +++ b/src/xrpld/app/tx/detail/LoanDelete.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_LOANDELETE_H_INCLUDED -#define XRPL_TX_LOANDELETE_H_INCLUDED +#pragma once #include @@ -30,5 +29,3 @@ public: //------------------------------------------------------------------------------ } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/LoanManage.h b/src/xrpld/app/tx/detail/LoanManage.h index c55380d869..44b2b62b3d 100644 --- a/src/xrpld/app/tx/detail/LoanManage.h +++ b/src/xrpld/app/tx/detail/LoanManage.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_LOANMANAGE_H_INCLUDED -#define XRPL_TX_LOANMANAGE_H_INCLUDED +#pragma once #include @@ -54,5 +53,3 @@ public: //------------------------------------------------------------------------------ } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/LoanPay.h b/src/xrpld/app/tx/detail/LoanPay.h index f951fdad5f..c947b1b6f8 100644 --- a/src/xrpld/app/tx/detail/LoanPay.h +++ b/src/xrpld/app/tx/detail/LoanPay.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_LOANPAY_H_INCLUDED -#define XRPL_TX_LOANPAY_H_INCLUDED +#pragma once #include @@ -36,5 +35,3 @@ public: //------------------------------------------------------------------------------ } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/LoanSet.h b/src/xrpld/app/tx/detail/LoanSet.h index d3853fbbdd..e4bb79a36d 100644 --- a/src/xrpld/app/tx/detail/LoanSet.h +++ b/src/xrpld/app/tx/detail/LoanSet.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_LOANSET_H_INCLUDED -#define XRPL_TX_LOANSET_H_INCLUDED +#pragma once #include #include @@ -55,5 +54,3 @@ public: //------------------------------------------------------------------------------ } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/MPTokenAuthorize.h b/src/xrpld/app/tx/detail/MPTokenAuthorize.h index bf9a384743..c887b70fa8 100644 --- a/src/xrpld/app/tx/detail/MPTokenAuthorize.h +++ b/src/xrpld/app/tx/detail/MPTokenAuthorize.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_MPTOKENAUTHORIZE_H_INCLUDED -#define XRPL_TX_MPTOKENAUTHORIZE_H_INCLUDED +#pragma once #include @@ -40,5 +39,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/MPTokenIssuanceCreate.h b/src/xrpld/app/tx/detail/MPTokenIssuanceCreate.h index 5b5268265c..56c20ed551 100644 --- a/src/xrpld/app/tx/detail/MPTokenIssuanceCreate.h +++ b/src/xrpld/app/tx/detail/MPTokenIssuanceCreate.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_MPTOKENISSUANCECREATE_H_INCLUDED -#define XRPL_TX_MPTOKENISSUANCECREATE_H_INCLUDED +#pragma once #include @@ -48,5 +47,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/MPTokenIssuanceDestroy.h b/src/xrpld/app/tx/detail/MPTokenIssuanceDestroy.h index 5f59c9b1bd..89243944d0 100644 --- a/src/xrpld/app/tx/detail/MPTokenIssuanceDestroy.h +++ b/src/xrpld/app/tx/detail/MPTokenIssuanceDestroy.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_MPTOKENISSUANCEDESTROY_H_INCLUDED -#define XRPL_TX_MPTOKENISSUANCEDESTROY_H_INCLUDED +#pragma once #include @@ -28,5 +27,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/MPTokenIssuanceSet.h b/src/xrpld/app/tx/detail/MPTokenIssuanceSet.h index a687a37b47..68794ca48c 100644 --- a/src/xrpld/app/tx/detail/MPTokenIssuanceSet.h +++ b/src/xrpld/app/tx/detail/MPTokenIssuanceSet.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_MPTOKENISSUANCESET_H_INCLUDED -#define XRPL_TX_MPTOKENISSUANCESET_H_INCLUDED +#pragma once #include @@ -34,5 +33,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/NFTokenAcceptOffer.h b/src/xrpld/app/tx/detail/NFTokenAcceptOffer.h index 8eeede3d95..549c38d33b 100644 --- a/src/xrpld/app/tx/detail/NFTokenAcceptOffer.h +++ b/src/xrpld/app/tx/detail/NFTokenAcceptOffer.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_NFTOKENACCEPTOFFER_H_INCLUDED -#define XRPL_TX_NFTOKENACCEPTOFFER_H_INCLUDED +#pragma once #include @@ -41,5 +40,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/NFTokenBurn.h b/src/xrpld/app/tx/detail/NFTokenBurn.h index 5425f0902d..c2bc300ab8 100644 --- a/src/xrpld/app/tx/detail/NFTokenBurn.h +++ b/src/xrpld/app/tx/detail/NFTokenBurn.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_BURNNFT_H_INCLUDED -#define XRPL_TX_BURNNFT_H_INCLUDED +#pragma once #include @@ -25,5 +24,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/NFTokenCancelOffer.h b/src/xrpld/app/tx/detail/NFTokenCancelOffer.h index 13a6ecc065..b1801ede25 100644 --- a/src/xrpld/app/tx/detail/NFTokenCancelOffer.h +++ b/src/xrpld/app/tx/detail/NFTokenCancelOffer.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_NFTOKENCANCELOFFER_H_INCLUDED -#define XRPL_TX_NFTOKENCANCELOFFER_H_INCLUDED +#pragma once #include @@ -28,5 +27,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/NFTokenCreateOffer.h b/src/xrpld/app/tx/detail/NFTokenCreateOffer.h index 704b253924..ed54338f49 100644 --- a/src/xrpld/app/tx/detail/NFTokenCreateOffer.h +++ b/src/xrpld/app/tx/detail/NFTokenCreateOffer.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_NFTOKENOFFERCREATE_H_INCLUDED -#define XRPL_TX_NFTOKENOFFERCREATE_H_INCLUDED +#pragma once #include @@ -28,5 +27,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/NFTokenMint.h b/src/xrpld/app/tx/detail/NFTokenMint.h index a3b43b8269..52981ef467 100644 --- a/src/xrpld/app/tx/detail/NFTokenMint.h +++ b/src/xrpld/app/tx/detail/NFTokenMint.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_NFTTOKENMINT_H_INCLUDED -#define XRPL_TX_NFTTOKENMINT_H_INCLUDED +#pragma once #include #include @@ -43,5 +42,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/NFTokenModify.h b/src/xrpld/app/tx/detail/NFTokenModify.h index 4353c3d58b..f755746f1f 100644 --- a/src/xrpld/app/tx/detail/NFTokenModify.h +++ b/src/xrpld/app/tx/detail/NFTokenModify.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_NFTOKENMODIFY_H_INCLUDED -#define XRPL_TX_NFTOKENMODIFY_H_INCLUDED +#pragma once #include @@ -25,5 +24,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/NFTokenUtils.h b/src/xrpld/app/tx/detail/NFTokenUtils.h index 97ff744d71..44d3cfb956 100644 --- a/src/xrpld/app/tx/detail/NFTokenUtils.h +++ b/src/xrpld/app/tx/detail/NFTokenUtils.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_IMPL_DETAILS_NFTOKENUTILS_H_INCLUDED -#define XRPL_TX_IMPL_DETAILS_NFTOKENUTILS_H_INCLUDED +#pragma once #include @@ -128,5 +127,3 @@ checkTrustlineDeepFrozen(ReadView const& view, AccountID const id, beast::Journa } // namespace nft } // namespace xrpl - -#endif // XRPL_TX_IMPL_DETAILS_NFTOKENUTILS_H_INCLUDED diff --git a/src/xrpld/app/tx/detail/Offer.h b/src/xrpld/app/tx/detail/Offer.h index 7972d5dcca..7c783233f1 100644 --- a/src/xrpld/app/tx/detail/Offer.h +++ b/src/xrpld/app/tx/detail/Offer.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_BOOK_OFFER_H_INCLUDED -#define XRPL_APP_BOOK_OFFER_H_INCLUDED +#pragma once #include #include @@ -301,5 +300,3 @@ operator<<(std::ostream& os, TOffer const& offer) } } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/OfferStream.h b/src/xrpld/app/tx/detail/OfferStream.h index d7e30f018c..2f6bda3fab 100644 --- a/src/xrpld/app/tx/detail/OfferStream.h +++ b/src/xrpld/app/tx/detail/OfferStream.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_BOOK_OFFERSTREAM_H_INCLUDED -#define XRPL_APP_BOOK_OFFERSTREAM_H_INCLUDED +#pragma once #include #include @@ -174,5 +173,3 @@ public: } }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/PayChan.h b/src/xrpld/app/tx/detail/PayChan.h index f42e9549b3..8748ec9383 100644 --- a/src/xrpld/app/tx/detail/PayChan.h +++ b/src/xrpld/app/tx/detail/PayChan.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_PAYCHAN_H_INCLUDED -#define XRPL_TX_PAYCHAN_H_INCLUDED +#pragma once #include @@ -82,5 +81,3 @@ public: using PaymentChannelClaim = PayChanClaim; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/Payment.h b/src/xrpld/app/tx/detail/Payment.h index 30c9a9e326..192f2b0edb 100644 --- a/src/xrpld/app/tx/detail/Payment.h +++ b/src/xrpld/app/tx/detail/Payment.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_PAYMENT_H_INCLUDED -#define XRPL_TX_PAYMENT_H_INCLUDED +#pragma once #include @@ -43,5 +42,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/PermissionedDomainDelete.h b/src/xrpld/app/tx/detail/PermissionedDomainDelete.h index 3ae10a739f..294fb794ae 100644 --- a/src/xrpld/app/tx/detail/PermissionedDomainDelete.h +++ b/src/xrpld/app/tx/detail/PermissionedDomainDelete.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_PERMISSIONEDDOMAINDELETE_H_INCLUDED -#define XRPL_TX_PERMISSIONEDDOMAINDELETE_H_INCLUDED +#pragma once #include @@ -26,5 +25,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/PermissionedDomainSet.h b/src/xrpld/app/tx/detail/PermissionedDomainSet.h index fde06232a5..824104e50d 100644 --- a/src/xrpld/app/tx/detail/PermissionedDomainSet.h +++ b/src/xrpld/app/tx/detail/PermissionedDomainSet.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_PERMISSIONEDDOMAINSET_H_INCLUDED -#define XRPL_TX_PERMISSIONEDDOMAINSET_H_INCLUDED +#pragma once #include @@ -29,5 +28,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/SetAccount.h b/src/xrpld/app/tx/detail/SetAccount.h index fb8b4a0ccd..db59826347 100644 --- a/src/xrpld/app/tx/detail/SetAccount.h +++ b/src/xrpld/app/tx/detail/SetAccount.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_SETACCOUNT_H_INCLUDED -#define XRPL_TX_SETACCOUNT_H_INCLUDED +#pragma once #include @@ -38,5 +37,3 @@ public: using AccountSet = SetAccount; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/SetOracle.h b/src/xrpld/app/tx/detail/SetOracle.h index c1c9a3d3fb..6b47a5397e 100644 --- a/src/xrpld/app/tx/detail/SetOracle.h +++ b/src/xrpld/app/tx/detail/SetOracle.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_SETORACLE_H_INCLUDED -#define XRPL_TX_SETORACLE_H_INCLUDED +#pragma once #include @@ -36,5 +35,3 @@ public: using OracleSet = SetOracle; } // namespace xrpl - -#endif // XRPL_TX_SETORACLE_H_INCLUDED diff --git a/src/xrpld/app/tx/detail/SetRegularKey.h b/src/xrpld/app/tx/detail/SetRegularKey.h index 735ac522fd..bc712b319a 100644 --- a/src/xrpld/app/tx/detail/SetRegularKey.h +++ b/src/xrpld/app/tx/detail/SetRegularKey.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_SETREGULARKEY_H_INCLUDED -#define XRPL_TX_SETREGULARKEY_H_INCLUDED +#pragma once #include @@ -25,5 +24,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/SetSignerList.h b/src/xrpld/app/tx/detail/SetSignerList.h index 9fbf459728..efd8e508f9 100644 --- a/src/xrpld/app/tx/detail/SetSignerList.h +++ b/src/xrpld/app/tx/detail/SetSignerList.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_SETSIGNERLIST_H_INCLUDED -#define XRPL_TX_SETSIGNERLIST_H_INCLUDED +#pragma once #include #include @@ -71,5 +70,3 @@ private: using SignerListSet = SetSignerList; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/SetTrust.h b/src/xrpld/app/tx/detail/SetTrust.h index b5776c6d33..1081567a66 100644 --- a/src/xrpld/app/tx/detail/SetTrust.h +++ b/src/xrpld/app/tx/detail/SetTrust.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_SETTRUST_H_INCLUDED -#define XRPL_TX_SETTRUST_H_INCLUDED +#pragma once #include @@ -35,5 +34,3 @@ public: using TrustSet = SetTrust; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/SignerEntries.h b/src/xrpld/app/tx/detail/SignerEntries.h index d4b8382ab6..fe01d6b1ee 100644 --- a/src/xrpld/app/tx/detail/SignerEntries.h +++ b/src/xrpld/app/tx/detail/SignerEntries.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_IMPL_SIGNER_ENTRIES_H_INCLUDED -#define XRPL_TX_IMPL_SIGNER_ENTRIES_H_INCLUDED +#pragma once #include // NotTEC @@ -64,5 +63,3 @@ public: }; } // namespace xrpl - -#endif // XRPL_TX_IMPL_SIGNER_ENTRIES_H_INCLUDED diff --git a/src/xrpld/app/tx/detail/Transactor.h b/src/xrpld/app/tx/detail/Transactor.h index 13c0a39201..e06086a55d 100644 --- a/src/xrpld/app/tx/detail/Transactor.h +++ b/src/xrpld/app/tx/detail/Transactor.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_TX_TRANSACTOR_H_INCLUDED -#define XRPL_APP_TX_TRANSACTOR_H_INCLUDED +#pragma once #include #include @@ -419,5 +418,3 @@ Transactor::validNumericMinimum(std::optional value, unit::ValueUnit } } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/VaultClawback.h b/src/xrpld/app/tx/detail/VaultClawback.h index d05f280e75..c93289e641 100644 --- a/src/xrpld/app/tx/detail/VaultClawback.h +++ b/src/xrpld/app/tx/detail/VaultClawback.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_VAULTCLAWBACK_H_INCLUDED -#define XRPL_TX_VAULTCLAWBACK_H_INCLUDED +#pragma once #include @@ -33,5 +32,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/VaultCreate.h b/src/xrpld/app/tx/detail/VaultCreate.h index 78593eb491..20b18f5cc2 100644 --- a/src/xrpld/app/tx/detail/VaultCreate.h +++ b/src/xrpld/app/tx/detail/VaultCreate.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_VAULTCREATE_H_INCLUDED -#define XRPL_TX_VAULTCREATE_H_INCLUDED +#pragma once #include @@ -31,5 +30,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/VaultDelete.h b/src/xrpld/app/tx/detail/VaultDelete.h index e7c71b408c..8d1f214885 100644 --- a/src/xrpld/app/tx/detail/VaultDelete.h +++ b/src/xrpld/app/tx/detail/VaultDelete.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_VAULTDELETE_H_INCLUDED -#define XRPL_TX_VAULTDELETE_H_INCLUDED +#pragma once #include @@ -25,5 +24,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/VaultDeposit.h b/src/xrpld/app/tx/detail/VaultDeposit.h index 1fd62b95ff..6c63308407 100644 --- a/src/xrpld/app/tx/detail/VaultDeposit.h +++ b/src/xrpld/app/tx/detail/VaultDeposit.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_VAULTDEPOSIT_H_INCLUDED -#define XRPL_TX_VAULTDEPOSIT_H_INCLUDED +#pragma once #include @@ -25,5 +24,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/VaultSet.h b/src/xrpld/app/tx/detail/VaultSet.h index bfa38e5284..1e8a15291e 100644 --- a/src/xrpld/app/tx/detail/VaultSet.h +++ b/src/xrpld/app/tx/detail/VaultSet.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_VAULTSET_H_INCLUDED -#define XRPL_TX_VAULTSET_H_INCLUDED +#pragma once #include @@ -28,5 +27,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/VaultWithdraw.h b/src/xrpld/app/tx/detail/VaultWithdraw.h index 33463831e5..f832c206f8 100644 --- a/src/xrpld/app/tx/detail/VaultWithdraw.h +++ b/src/xrpld/app/tx/detail/VaultWithdraw.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_VAULTWITHDRAW_H_INCLUDED -#define XRPL_TX_VAULTWITHDRAW_H_INCLUDED +#pragma once #include @@ -25,5 +24,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/app/tx/detail/XChainBridge.h b/src/xrpld/app/tx/detail/XChainBridge.h index 0c39cbb690..3d0c250f24 100644 --- a/src/xrpld/app/tx/detail/XChainBridge.h +++ b/src/xrpld/app/tx/detail/XChainBridge.h @@ -1,5 +1,4 @@ -#ifndef XRPL_TX_XCHAINBRIDGE_H_INCLUDED -#define XRPL_TX_XCHAINBRIDGE_H_INCLUDED +#pragma once #include @@ -239,5 +238,3 @@ using XChainAccountCreateCommit = XChainCreateAccountCommit; //------------------------------------------------------------------------------ } // namespace xrpl - -#endif diff --git a/src/xrpld/conditions/Condition.h b/src/xrpld/conditions/Condition.h index 55a6fc1e7c..50872e75ef 100644 --- a/src/xrpld/conditions/Condition.h +++ b/src/xrpld/conditions/Condition.h @@ -1,5 +1,4 @@ -#ifndef XRPL_CONDITIONS_CONDITION_H -#define XRPL_CONDITIONS_CONDITION_H +#pragma once #include @@ -93,5 +92,3 @@ operator!=(Condition const& lhs, Condition const& rhs) } // namespace cryptoconditions } // namespace xrpl - -#endif diff --git a/src/xrpld/conditions/Fulfillment.h b/src/xrpld/conditions/Fulfillment.h index 5d31fd64ac..840e9f9993 100644 --- a/src/xrpld/conditions/Fulfillment.h +++ b/src/xrpld/conditions/Fulfillment.h @@ -1,5 +1,4 @@ -#ifndef XRPL_CONDITIONS_FULFILLMENT_H -#define XRPL_CONDITIONS_FULFILLMENT_H +#pragma once #include @@ -122,5 +121,3 @@ validate(Fulfillment const& f, Condition const& c); } // namespace cryptoconditions } // namespace xrpl - -#endif diff --git a/src/xrpld/conditions/detail/PreimageSha256.h b/src/xrpld/conditions/detail/PreimageSha256.h index f495885794..f3ce1a03e0 100644 --- a/src/xrpld/conditions/detail/PreimageSha256.h +++ b/src/xrpld/conditions/detail/PreimageSha256.h @@ -1,5 +1,4 @@ -#ifndef XRPL_CONDITIONS_PREIMAGE_SHA256_H -#define XRPL_CONDITIONS_PREIMAGE_SHA256_H +#pragma once #include #include @@ -131,5 +130,3 @@ public: } // namespace cryptoconditions } // namespace xrpl - -#endif diff --git a/src/xrpld/conditions/detail/error.h b/src/xrpld/conditions/detail/error.h index 65584e974a..fdeed3d9ac 100644 --- a/src/xrpld/conditions/detail/error.h +++ b/src/xrpld/conditions/detail/error.h @@ -1,5 +1,4 @@ -#ifndef XRPL_CONDITIONS_ERROR_H -#define XRPL_CONDITIONS_ERROR_H +#pragma once #include @@ -43,5 +42,3 @@ struct is_error_code_enum }; } // namespace std - -#endif diff --git a/src/xrpld/conditions/detail/utils.h b/src/xrpld/conditions/detail/utils.h index b07b7b29e0..2a4187718b 100644 --- a/src/xrpld/conditions/detail/utils.h +++ b/src/xrpld/conditions/detail/utils.h @@ -1,5 +1,4 @@ -#ifndef XRPL_CONDITIONS_UTILS_H -#define XRPL_CONDITIONS_UTILS_H +#pragma once #include @@ -209,5 +208,3 @@ parseInteger(Slice& s, std::size_t count, std::error_code& ec) } // namespace der } // namespace cryptoconditions } // namespace xrpl - -#endif diff --git a/src/xrpld/consensus/Consensus.h b/src/xrpld/consensus/Consensus.h index cdff9aa5ac..e02ec927a4 100644 --- a/src/xrpld/consensus/Consensus.h +++ b/src/xrpld/consensus/Consensus.h @@ -1,5 +1,4 @@ -#ifndef XRPL_CONSENSUS_CONSENSUS_H_INCLUDED -#define XRPL_CONSENSUS_CONSENSUS_H_INCLUDED +#pragma once #include #include @@ -1774,5 +1773,3 @@ Consensus::asCloseTime(NetClock::time_point raw) const } } // namespace xrpl - -#endif diff --git a/src/xrpld/consensus/ConsensusParms.h b/src/xrpld/consensus/ConsensusParms.h index 94e0d16f27..8839b95c8b 100644 --- a/src/xrpld/consensus/ConsensusParms.h +++ b/src/xrpld/consensus/ConsensusParms.h @@ -1,5 +1,4 @@ -#ifndef XRPL_CONSENSUS_CONSENSUS_PARMS_H_INCLUDED -#define XRPL_CONSENSUS_CONSENSUS_PARMS_H_INCLUDED +#pragma once #include @@ -174,4 +173,3 @@ getNeededWeight( } } // namespace xrpl -#endif diff --git a/src/xrpld/consensus/ConsensusProposal.h b/src/xrpld/consensus/ConsensusProposal.h index b91af6832a..f2b891cdd6 100644 --- a/src/xrpld/consensus/ConsensusProposal.h +++ b/src/xrpld/consensus/ConsensusProposal.h @@ -1,5 +1,4 @@ -#ifndef XRPL_CONSENSUS_CONSENSUSPROPOSAL_H_INCLUDED -#define XRPL_CONSENSUS_CONSENSUSPROPOSAL_H_INCLUDED +#pragma once #include #include @@ -256,4 +255,3 @@ operator==( a.position() == b.position() && a.closeTime() == b.closeTime() && a.seenTime() == b.seenTime(); } } // namespace xrpl -#endif diff --git a/src/xrpld/consensus/ConsensusTypes.h b/src/xrpld/consensus/ConsensusTypes.h index f54e11228b..2331c9dfbf 100644 --- a/src/xrpld/consensus/ConsensusTypes.h +++ b/src/xrpld/consensus/ConsensusTypes.h @@ -1,5 +1,4 @@ -#ifndef XRPL_CONSENSUS_CONSENSUS_TYPES_H_INCLUDED -#define XRPL_CONSENSUS_CONSENSUS_TYPES_H_INCLUDED +#pragma once #include #include @@ -220,5 +219,3 @@ struct ConsensusResult std::size_t proposers = 0; }; } // namespace xrpl - -#endif diff --git a/src/xrpld/consensus/DisputedTx.h b/src/xrpld/consensus/DisputedTx.h index 44e9f94793..a1e8d84fa3 100644 --- a/src/xrpld/consensus/DisputedTx.h +++ b/src/xrpld/consensus/DisputedTx.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_CONSENSUS_IMPL_DISPUTEDTX_H_INCLUDED -#define XRPL_APP_CONSENSUS_IMPL_DISPUTEDTX_H_INCLUDED +#pragma once #include @@ -327,5 +326,3 @@ DisputedTx::getJson() const } } // namespace xrpl - -#endif diff --git a/src/xrpld/consensus/LedgerTiming.h b/src/xrpld/consensus/LedgerTiming.h index 7bca012460..416c3bc165 100644 --- a/src/xrpld/consensus/LedgerTiming.h +++ b/src/xrpld/consensus/LedgerTiming.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_LEDGER_LEDGERTIMING_H_INCLUDED -#define XRPL_APP_LEDGER_LEDGERTIMING_H_INCLUDED +#pragma once #include #include @@ -137,4 +136,3 @@ effCloseTime( } } // namespace xrpl -#endif diff --git a/src/xrpld/consensus/LedgerTrie.h b/src/xrpld/consensus/LedgerTrie.h index b823079a8b..e5f9f1ce2d 100644 --- a/src/xrpld/consensus/LedgerTrie.h +++ b/src/xrpld/consensus/LedgerTrie.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_CONSENSUS_LEDGERS_TRIE_H_INCLUDED -#define XRPL_APP_CONSENSUS_LEDGERS_TRIE_H_INCLUDED +#pragma once #include #include @@ -809,4 +808,3 @@ public: }; } // namespace xrpl -#endif diff --git a/src/xrpld/consensus/Validations.h b/src/xrpld/consensus/Validations.h index 6de74b4f4d..92892ff1f6 100644 --- a/src/xrpld/consensus/Validations.h +++ b/src/xrpld/consensus/Validations.h @@ -1,5 +1,4 @@ -#ifndef XRPL_CONSENSUS_VALIDATIONS_H_INCLUDED -#define XRPL_CONSENSUS_VALIDATIONS_H_INCLUDED +#pragma once #include @@ -1093,4 +1092,3 @@ public: }; } // namespace xrpl -#endif diff --git a/src/xrpld/core/Config.h b/src/xrpld/core/Config.h index e2e16bcd98..86b663a212 100644 --- a/src/xrpld/core/Config.h +++ b/src/xrpld/core/Config.h @@ -1,5 +1,4 @@ -#ifndef XRPL_CORE_CONFIG_H_INCLUDED -#define XRPL_CORE_CONFIG_H_INCLUDED +#pragma once #include #include @@ -357,5 +356,3 @@ FeeSetup setup_FeeVote(Section const& section); } // namespace xrpl - -#endif diff --git a/src/xrpld/core/ConfigSections.h b/src/xrpld/core/ConfigSections.h index 6f8a13a145..7f22dd59c1 100644 --- a/src/xrpld/core/ConfigSections.h +++ b/src/xrpld/core/ConfigSections.h @@ -1,5 +1,4 @@ -#ifndef XRPL_CORE_CONFIGSECTIONS_H_INCLUDED -#define XRPL_CORE_CONFIGSECTIONS_H_INCLUDED +#pragma once #include @@ -79,5 +78,3 @@ struct ConfigSection #define SECTION_WORKERS "workers" } // namespace xrpl - -#endif diff --git a/src/xrpld/core/DatabaseCon.h b/src/xrpld/core/DatabaseCon.h index 854cfc827f..89d582257b 100644 --- a/src/xrpld/core/DatabaseCon.h +++ b/src/xrpld/core/DatabaseCon.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_DATA_DATABASECON_H_INCLUDED -#define XRPL_APP_DATA_DATABASECON_H_INCLUDED +#pragma once #include #include @@ -234,5 +233,3 @@ DatabaseCon::Setup setup_DatabaseCon(Config const& c, std::optional j = std::nullopt); } // namespace xrpl - -#endif diff --git a/src/xrpld/core/SociDB.h b/src/xrpld/core/SociDB.h index b5b6db92bc..acfc183076 100644 --- a/src/xrpld/core/SociDB.h +++ b/src/xrpld/core/SociDB.h @@ -1,5 +1,4 @@ -#ifndef XRPL_SOCIDB_H_INCLUDED -#define XRPL_SOCIDB_H_INCLUDED +#pragma once /** An embedded database wrapper with an intuitive, type-safe interface. @@ -119,5 +118,3 @@ makeCheckpointer(std::uintptr_t id, std::weak_ptr, JobQueue&, Log #if defined(__clang__) #pragma clang diagnostic pop #endif - -#endif diff --git a/src/xrpld/core/TimeKeeper.h b/src/xrpld/core/TimeKeeper.h index 8c04d0a625..bb6ab3ec23 100644 --- a/src/xrpld/core/TimeKeeper.h +++ b/src/xrpld/core/TimeKeeper.h @@ -1,5 +1,4 @@ -#ifndef XRPL_CORE_TIMEKEEPER_H_INCLUDED -#define XRPL_CORE_TIMEKEEPER_H_INCLUDED +#pragma once #include #include @@ -97,5 +96,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/overlay/Cluster.h b/src/xrpld/overlay/Cluster.h index 30627f90ae..7783d96100 100644 --- a/src/xrpld/overlay/Cluster.h +++ b/src/xrpld/overlay/Cluster.h @@ -1,5 +1,4 @@ -#ifndef XRPL_OVERLAY_CLUSTER_H_INCLUDED -#define XRPL_OVERLAY_CLUSTER_H_INCLUDED +#pragma once #include @@ -95,5 +94,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/overlay/ClusterNode.h b/src/xrpld/overlay/ClusterNode.h index 03c294c736..c6ab208383 100644 --- a/src/xrpld/overlay/ClusterNode.h +++ b/src/xrpld/overlay/ClusterNode.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_PEERS_CLUSTERNODESTATUS_H_INCLUDED -#define XRPL_APP_PEERS_CLUSTERNODESTATUS_H_INCLUDED +#pragma once #include #include @@ -55,5 +54,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/overlay/Compression.h b/src/xrpld/overlay/Compression.h index b13a0a8661..2bfc366e30 100644 --- a/src/xrpld/overlay/Compression.h +++ b/src/xrpld/overlay/Compression.h @@ -1,5 +1,4 @@ -#ifndef XRPL_COMPRESSION_H_INCLUDED -#define XRPL_COMPRESSION_H_INCLUDED +#pragma once #include #include @@ -89,5 +88,3 @@ compress(void const* in, std::size_t inSize, BufferFactory&& bf, Algorithm algor } // namespace compression } // namespace xrpl - -#endif // XRPL_COMPRESSION_H_INCLUDED diff --git a/src/xrpld/overlay/Message.h b/src/xrpld/overlay/Message.h index 550c24eef3..30650d384c 100644 --- a/src/xrpld/overlay/Message.h +++ b/src/xrpld/overlay/Message.h @@ -1,5 +1,4 @@ -#ifndef XRPL_OVERLAY_MESSAGE_H_INCLUDED -#define XRPL_OVERLAY_MESSAGE_H_INCLUDED +#pragma once #include @@ -118,5 +117,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/overlay/Overlay.h b/src/xrpld/overlay/Overlay.h index 7642614232..f1d1104d4e 100644 --- a/src/xrpld/overlay/Overlay.h +++ b/src/xrpld/overlay/Overlay.h @@ -1,5 +1,4 @@ -#ifndef XRPL_OVERLAY_OVERLAY_H_INCLUDED -#define XRPL_OVERLAY_OVERLAY_H_INCLUDED +#pragma once #include @@ -210,5 +209,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/overlay/Peer.h b/src/xrpld/overlay/Peer.h index 35feb05271..a0e4c040fd 100644 --- a/src/xrpld/overlay/Peer.h +++ b/src/xrpld/overlay/Peer.h @@ -1,5 +1,4 @@ -#ifndef XRPL_OVERLAY_PEER_H_INCLUDED -#define XRPL_OVERLAY_PEER_H_INCLUDED +#pragma once #include @@ -120,5 +119,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/overlay/PeerReservationTable.h b/src/xrpld/overlay/PeerReservationTable.h index 7c66ad6e2d..8f187bf324 100644 --- a/src/xrpld/overlay/PeerReservationTable.h +++ b/src/xrpld/overlay/PeerReservationTable.h @@ -1,5 +1,4 @@ -#ifndef XRPL_OVERLAY_PEER_RESERVATION_TABLE_H_INCLUDED -#define XRPL_OVERLAY_PEER_RESERVATION_TABLE_H_INCLUDED +#pragma once #include #include @@ -97,5 +96,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/overlay/PeerSet.h b/src/xrpld/overlay/PeerSet.h index 850ba21c53..b69d139b4f 100644 --- a/src/xrpld/overlay/PeerSet.h +++ b/src/xrpld/overlay/PeerSet.h @@ -1,5 +1,4 @@ -#ifndef XRPL_APP_PEERS_PEERSET_H_INCLUDED -#define XRPL_APP_PEERS_PEERSET_H_INCLUDED +#pragma once #include #include @@ -74,5 +73,3 @@ std::unique_ptr make_DummyPeerSet(Application& app); } // namespace xrpl - -#endif diff --git a/src/xrpld/overlay/ReduceRelayCommon.h b/src/xrpld/overlay/ReduceRelayCommon.h index 990e4b51d2..9ddde335e6 100644 --- a/src/xrpld/overlay/ReduceRelayCommon.h +++ b/src/xrpld/overlay/ReduceRelayCommon.h @@ -1,5 +1,4 @@ -#ifndef XRPL_OVERLAY_REDUCERELAYCOMMON_H_INCLUDED -#define XRPL_OVERLAY_REDUCERELAYCOMMON_H_INCLUDED +#pragma once #include @@ -42,5 +41,3 @@ static constexpr std::size_t MAX_TX_QUEUE_SIZE = 10000; } // namespace reduce_relay } // namespace xrpl - -#endif // XRPL_REDUCERELAYCOMMON_H_INCLUDED diff --git a/src/xrpld/overlay/Slot.h b/src/xrpld/overlay/Slot.h index db2ff69910..f3fd919648 100644 --- a/src/xrpld/overlay/Slot.h +++ b/src/xrpld/overlay/Slot.h @@ -1,5 +1,4 @@ -#ifndef XRPL_OVERLAY_SLOT_H_INCLUDED -#define XRPL_OVERLAY_SLOT_H_INCLUDED +#pragma once #include #include @@ -765,5 +764,3 @@ Slots::deleteIdlePeers() } // namespace reduce_relay } // namespace xrpl - -#endif // XRPL_OVERLAY_SLOT_H_INCLUDED diff --git a/src/xrpld/overlay/Squelch.h b/src/xrpld/overlay/Squelch.h index a225f39998..cca5dfeff1 100644 --- a/src/xrpld/overlay/Squelch.h +++ b/src/xrpld/overlay/Squelch.h @@ -1,5 +1,4 @@ -#ifndef XRPL_OVERLAY_SQUELCH_H_INCLUDED -#define XRPL_OVERLAY_SQUELCH_H_INCLUDED +#pragma once #include @@ -100,5 +99,3 @@ Squelch::expireSquelch(PublicKey const& validator) } // namespace reduce_relay } // namespace xrpl - -#endif // XRPL_SQUELCH_H diff --git a/src/xrpld/overlay/detail/ConnectAttempt.h b/src/xrpld/overlay/detail/ConnectAttempt.h index e750541561..4cd8c357db 100644 --- a/src/xrpld/overlay/detail/ConnectAttempt.h +++ b/src/xrpld/overlay/detail/ConnectAttempt.h @@ -1,5 +1,4 @@ -#ifndef XRPL_OVERLAY_CONNECTATTEMPT_H_INCLUDED -#define XRPL_OVERLAY_CONNECTATTEMPT_H_INCLUDED +#pragma once #include @@ -270,5 +269,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/overlay/detail/Handshake.h b/src/xrpld/overlay/detail/Handshake.h index 7e1ba07fca..4a8e81d6f9 100644 --- a/src/xrpld/overlay/detail/Handshake.h +++ b/src/xrpld/overlay/detail/Handshake.h @@ -1,5 +1,4 @@ -#ifndef XRPL_OVERLAY_HANDSHAKE_H_INCLUDED -#define XRPL_OVERLAY_HANDSHAKE_H_INCLUDED +#pragma once #include #include @@ -217,5 +216,3 @@ makeFeaturesResponseHeader( bool vpReduceRelayEnabled); } // namespace xrpl - -#endif diff --git a/src/xrpld/overlay/detail/OverlayImpl.h b/src/xrpld/overlay/detail/OverlayImpl.h index 03b3b31da0..19fff6a29a 100644 --- a/src/xrpld/overlay/detail/OverlayImpl.h +++ b/src/xrpld/overlay/detail/OverlayImpl.h @@ -1,5 +1,4 @@ -#ifndef XRPL_OVERLAY_OVERLAYIMPL_H_INCLUDED -#define XRPL_OVERLAY_OVERLAYIMPL_H_INCLUDED +#pragma once #include #include @@ -592,5 +591,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/overlay/detail/PeerImp.h b/src/xrpld/overlay/detail/PeerImp.h index 3b6cfe4b4b..65a6112159 100644 --- a/src/xrpld/overlay/detail/PeerImp.h +++ b/src/xrpld/overlay/detail/PeerImp.h @@ -1,5 +1,4 @@ -#ifndef XRPL_OVERLAY_PEERIMP_H_INCLUDED -#define XRPL_OVERLAY_PEERIMP_H_INCLUDED +#pragma once #include #include @@ -864,5 +863,3 @@ PeerImp::sendEndpoints(FwdIt first, FwdIt last) } } // namespace xrpl - -#endif diff --git a/src/xrpld/overlay/detail/ProtocolMessage.h b/src/xrpld/overlay/detail/ProtocolMessage.h index 03514b6d60..9a0e63744d 100644 --- a/src/xrpld/overlay/detail/ProtocolMessage.h +++ b/src/xrpld/overlay/detail/ProtocolMessage.h @@ -1,5 +1,4 @@ -#ifndef XRPL_OVERLAY_PROTOCOLMESSAGE_H_INCLUDED -#define XRPL_OVERLAY_PROTOCOLMESSAGE_H_INCLUDED +#pragma once #include #include @@ -424,5 +423,3 @@ invokeProtocolMessage(Buffers const& buffers, Handler& handler, std::size_t& hin } } // namespace xrpl - -#endif diff --git a/src/xrpld/overlay/detail/ProtocolVersion.h b/src/xrpld/overlay/detail/ProtocolVersion.h index 9499cd1c1b..5b3a1b3302 100644 --- a/src/xrpld/overlay/detail/ProtocolVersion.h +++ b/src/xrpld/overlay/detail/ProtocolVersion.h @@ -1,5 +1,4 @@ -#ifndef XRPL_OVERLAY_PROTOCOLVERSION_H_INCLUDED -#define XRPL_OVERLAY_PROTOCOLVERSION_H_INCLUDED +#pragma once #include @@ -59,5 +58,3 @@ bool isProtocolSupported(ProtocolVersion const& v); } // namespace xrpl - -#endif diff --git a/src/xrpld/overlay/detail/TrafficCount.h b/src/xrpld/overlay/detail/TrafficCount.h index f760c6076e..bb9f5686e6 100644 --- a/src/xrpld/overlay/detail/TrafficCount.h +++ b/src/xrpld/overlay/detail/TrafficCount.h @@ -1,5 +1,4 @@ -#ifndef XRPL_OVERLAY_TRAFFIC_H_INCLUDED -#define XRPL_OVERLAY_TRAFFIC_H_INCLUDED +#pragma once #include #include @@ -350,4 +349,3 @@ protected: }; } // namespace xrpl -#endif diff --git a/src/xrpld/overlay/detail/Tuning.h b/src/xrpld/overlay/detail/Tuning.h index c18d17c359..bd62cd2a03 100644 --- a/src/xrpld/overlay/detail/Tuning.h +++ b/src/xrpld/overlay/detail/Tuning.h @@ -1,5 +1,4 @@ -#ifndef XRPL_OVERLAY_TUNING_H_INCLUDED -#define XRPL_OVERLAY_TUNING_H_INCLUDED +#pragma once #include @@ -48,5 +47,3 @@ std::size_t constexpr readBufferBytes = 16384; } // namespace Tuning } // namespace xrpl - -#endif diff --git a/src/xrpld/overlay/detail/TxMetrics.h b/src/xrpld/overlay/detail/TxMetrics.h index 5bbf1a9731..37194c34e3 100644 --- a/src/xrpld/overlay/detail/TxMetrics.h +++ b/src/xrpld/overlay/detail/TxMetrics.h @@ -1,5 +1,4 @@ -#ifndef XRPL_OVERLAY_TXMETRICS_H_INCLUDED -#define XRPL_OVERLAY_TXMETRICS_H_INCLUDED +#pragma once #include #include @@ -115,5 +114,3 @@ struct TxMetrics } // namespace metrics } // namespace xrpl - -#endif diff --git a/src/xrpld/overlay/detail/ZeroCopyStream.h b/src/xrpld/overlay/detail/ZeroCopyStream.h index ac814ebbad..112217b737 100644 --- a/src/xrpld/overlay/detail/ZeroCopyStream.h +++ b/src/xrpld/overlay/detail/ZeroCopyStream.h @@ -1,5 +1,4 @@ -#ifndef XRPL_OVERLAY_ZEROCOPYSTREAM_H_INCLUDED -#define XRPL_OVERLAY_ZEROCOPYSTREAM_H_INCLUDED +#pragma once #include @@ -188,5 +187,3 @@ ZeroCopyOutputStream::BackUp(int count) } } // namespace xrpl - -#endif diff --git a/src/xrpld/overlay/make_Overlay.h b/src/xrpld/overlay/make_Overlay.h index 6c37c1c825..936d3abc0f 100644 --- a/src/xrpld/overlay/make_Overlay.h +++ b/src/xrpld/overlay/make_Overlay.h @@ -1,5 +1,4 @@ -#ifndef XRPL_OVERLAY_MAKE_OVERLAY_H_INCLUDED -#define XRPL_OVERLAY_MAKE_OVERLAY_H_INCLUDED +#pragma once #include #include @@ -26,5 +25,3 @@ make_Overlay( beast::insight::Collector::ptr const& collector); } // namespace xrpl - -#endif diff --git a/src/xrpld/overlay/predicates.h b/src/xrpld/overlay/predicates.h index 7b7baa0a8a..3adecf7c6a 100644 --- a/src/xrpld/overlay/predicates.h +++ b/src/xrpld/overlay/predicates.h @@ -1,5 +1,4 @@ -#ifndef XRPL_OVERLAY_PREDICATES_H_INCLUDED -#define XRPL_OVERLAY_PREDICATES_H_INCLUDED +#pragma once #include #include @@ -155,5 +154,3 @@ struct peer_in_set }; } // namespace xrpl - -#endif diff --git a/src/xrpld/peerfinder/PeerfinderManager.h b/src/xrpld/peerfinder/PeerfinderManager.h index 098702d2d3..ca82c0bdf9 100644 --- a/src/xrpld/peerfinder/PeerfinderManager.h +++ b/src/xrpld/peerfinder/PeerfinderManager.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PEERFINDER_MANAGER_H_INCLUDED -#define XRPL_PEERFINDER_MANAGER_H_INCLUDED +#pragma once #include #include @@ -281,5 +280,3 @@ public: } // namespace PeerFinder } // namespace xrpl - -#endif diff --git a/src/xrpld/peerfinder/Slot.h b/src/xrpld/peerfinder/Slot.h index 1d5d58884a..d0fce0626d 100644 --- a/src/xrpld/peerfinder/Slot.h +++ b/src/xrpld/peerfinder/Slot.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PEERFINDER_SLOT_H_INCLUDED -#define XRPL_PEERFINDER_SLOT_H_INCLUDED +#pragma once #include #include @@ -61,5 +60,3 @@ public: } // namespace PeerFinder } // namespace xrpl - -#endif diff --git a/src/xrpld/peerfinder/detail/Bootcache.h b/src/xrpld/peerfinder/detail/Bootcache.h index 8aa2feaf88..8517bde049 100644 --- a/src/xrpld/peerfinder/detail/Bootcache.h +++ b/src/xrpld/peerfinder/detail/Bootcache.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PEERFINDER_BOOTCACHE_H_INCLUDED -#define XRPL_PEERFINDER_BOOTCACHE_H_INCLUDED +#pragma once #include #include @@ -172,5 +171,3 @@ private: } // namespace PeerFinder } // namespace xrpl - -#endif diff --git a/src/xrpld/peerfinder/detail/Checker.h b/src/xrpld/peerfinder/detail/Checker.h index b0c38693ed..42987f3ec0 100644 --- a/src/xrpld/peerfinder/detail/Checker.h +++ b/src/xrpld/peerfinder/detail/Checker.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PEERFINDER_CHECKER_H_INCLUDED -#define XRPL_PEERFINDER_CHECKER_H_INCLUDED +#pragma once #include @@ -196,5 +195,3 @@ Checker::remove(basic_async_op& op) } // namespace PeerFinder } // namespace xrpl - -#endif diff --git a/src/xrpld/peerfinder/detail/Counts.h b/src/xrpld/peerfinder/detail/Counts.h index 15ae42fcbb..3d687711d1 100644 --- a/src/xrpld/peerfinder/detail/Counts.h +++ b/src/xrpld/peerfinder/detail/Counts.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PEERFINDER_COUNTS_H_INCLUDED -#define XRPL_PEERFINDER_COUNTS_H_INCLUDED +#pragma once #include #include @@ -319,5 +318,3 @@ private: } // namespace PeerFinder } // namespace xrpl - -#endif diff --git a/src/xrpld/peerfinder/detail/Fixed.h b/src/xrpld/peerfinder/detail/Fixed.h index 007ee1698d..75b5ed9062 100644 --- a/src/xrpld/peerfinder/detail/Fixed.h +++ b/src/xrpld/peerfinder/detail/Fixed.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PEERFINDER_FIXED_H_INCLUDED -#define XRPL_PEERFINDER_FIXED_H_INCLUDED +#pragma once #include @@ -46,5 +45,3 @@ private: } // namespace PeerFinder } // namespace xrpl - -#endif diff --git a/src/xrpld/peerfinder/detail/Handouts.h b/src/xrpld/peerfinder/detail/Handouts.h index 85cce2fef3..afc2bddb40 100644 --- a/src/xrpld/peerfinder/detail/Handouts.h +++ b/src/xrpld/peerfinder/detail/Handouts.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PEERFINDER_HANDOUTS_H_INCLUDED -#define XRPL_PEERFINDER_HANDOUTS_H_INCLUDED +#pragma once #include #include @@ -331,5 +330,3 @@ ConnectHandouts::try_insert(beast::IP::Endpoint const& endpoint) } // namespace PeerFinder } // namespace xrpl - -#endif diff --git a/src/xrpld/peerfinder/detail/Livecache.h b/src/xrpld/peerfinder/detail/Livecache.h index c4052967ab..548db4e34e 100644 --- a/src/xrpld/peerfinder/detail/Livecache.h +++ b/src/xrpld/peerfinder/detail/Livecache.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PEERFINDER_LIVECACHE_H_INCLUDED -#define XRPL_PEERFINDER_LIVECACHE_H_INCLUDED +#pragma once #include #include @@ -513,5 +512,3 @@ Livecache::hops_t::remove(Element& e) } // namespace PeerFinder } // namespace xrpl - -#endif diff --git a/src/xrpld/peerfinder/detail/Logic.h b/src/xrpld/peerfinder/detail/Logic.h index f437a7c3a7..7e2b4f0015 100644 --- a/src/xrpld/peerfinder/detail/Logic.h +++ b/src/xrpld/peerfinder/detail/Logic.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PEERFINDER_LOGIC_H_INCLUDED -#define XRPL_PEERFINDER_LOGIC_H_INCLUDED +#pragma once #include #include @@ -1168,5 +1167,3 @@ Logic::onRedirects(FwdIter first, FwdIter last, boost::asio::ip::tcp::e } // namespace PeerFinder } // namespace xrpl - -#endif diff --git a/src/xrpld/peerfinder/detail/SlotImp.h b/src/xrpld/peerfinder/detail/SlotImp.h index bcfd968228..f18410d214 100644 --- a/src/xrpld/peerfinder/detail/SlotImp.h +++ b/src/xrpld/peerfinder/detail/SlotImp.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PEERFINDER_SLOTIMP_H_INCLUDED -#define XRPL_PEERFINDER_SLOTIMP_H_INCLUDED +#pragma once #include #include @@ -193,5 +192,3 @@ public: } // namespace PeerFinder } // namespace xrpl - -#endif diff --git a/src/xrpld/peerfinder/detail/Source.h b/src/xrpld/peerfinder/detail/Source.h index 1fe33e053a..8fc97b639f 100644 --- a/src/xrpld/peerfinder/detail/Source.h +++ b/src/xrpld/peerfinder/detail/Source.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PEERFINDER_SOURCE_H_INCLUDED -#define XRPL_PEERFINDER_SOURCE_H_INCLUDED +#pragma once #include @@ -46,5 +45,3 @@ public: } // namespace PeerFinder } // namespace xrpl - -#endif diff --git a/src/xrpld/peerfinder/detail/SourceStrings.h b/src/xrpld/peerfinder/detail/SourceStrings.h index 2babe1d616..1cf6d81040 100644 --- a/src/xrpld/peerfinder/detail/SourceStrings.h +++ b/src/xrpld/peerfinder/detail/SourceStrings.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PEERFINDER_SOURCESTRINGS_H_INCLUDED -#define XRPL_PEERFINDER_SOURCESTRINGS_H_INCLUDED +#pragma once #include @@ -22,5 +21,3 @@ public: } // namespace PeerFinder } // namespace xrpl - -#endif diff --git a/src/xrpld/peerfinder/detail/Store.h b/src/xrpld/peerfinder/detail/Store.h index d3b283eabf..dab50b3ce0 100644 --- a/src/xrpld/peerfinder/detail/Store.h +++ b/src/xrpld/peerfinder/detail/Store.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PEERFINDER_STORE_H_INCLUDED -#define XRPL_PEERFINDER_STORE_H_INCLUDED +#pragma once namespace xrpl { namespace PeerFinder { @@ -31,5 +30,3 @@ public: } // namespace PeerFinder } // namespace xrpl - -#endif diff --git a/src/xrpld/peerfinder/detail/StoreSqdb.h b/src/xrpld/peerfinder/detail/StoreSqdb.h index 63ba03e913..f5461d489a 100644 --- a/src/xrpld/peerfinder/detail/StoreSqdb.h +++ b/src/xrpld/peerfinder/detail/StoreSqdb.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PEERFINDER_STORESQDB_H_INCLUDED -#define XRPL_PEERFINDER_STORESQDB_H_INCLUDED +#pragma once #include #include @@ -86,5 +85,3 @@ private: } // namespace PeerFinder } // namespace xrpl - -#endif diff --git a/src/xrpld/peerfinder/detail/Tuning.h b/src/xrpld/peerfinder/detail/Tuning.h index ff93e5ee76..910d251dff 100644 --- a/src/xrpld/peerfinder/detail/Tuning.h +++ b/src/xrpld/peerfinder/detail/Tuning.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PEERFINDER_TUNING_H_INCLUDED -#define XRPL_PEERFINDER_TUNING_H_INCLUDED +#pragma once #include @@ -115,5 +114,3 @@ std::chrono::seconds constexpr recentAttemptDuration(60); } // namespace PeerFinder } // namespace xrpl - -#endif diff --git a/src/xrpld/peerfinder/detail/iosformat.h b/src/xrpld/peerfinder/detail/iosformat.h index 0a0b18fba0..d05db42d23 100644 --- a/src/xrpld/peerfinder/detail/iosformat.h +++ b/src/xrpld/peerfinder/detail/iosformat.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PEERFINDER_IOSFORMAT_H_INCLUDED -#define XRPL_PEERFINDER_IOSFORMAT_H_INCLUDED +#pragma once #include #include @@ -174,5 +173,3 @@ rField(T const& t, int width = 8, int pad = 0) /** @} */ } // namespace beast - -#endif diff --git a/src/xrpld/peerfinder/make_Manager.h b/src/xrpld/peerfinder/make_Manager.h index a86e6d4ccb..846907e08c 100644 --- a/src/xrpld/peerfinder/make_Manager.h +++ b/src/xrpld/peerfinder/make_Manager.h @@ -1,5 +1,4 @@ -#ifndef XRPL_PEERFINDER_MAKE_MANAGER_H_INCLUDED -#define XRPL_PEERFINDER_MAKE_MANAGER_H_INCLUDED +#pragma once #include @@ -21,5 +20,3 @@ make_Manager( } // namespace PeerFinder } // namespace xrpl - -#endif diff --git a/src/xrpld/perflog/detail/PerfLogImp.h b/src/xrpld/perflog/detail/PerfLogImp.h index 598f711cda..6e58aeb16e 100644 --- a/src/xrpld/perflog/detail/PerfLogImp.h +++ b/src/xrpld/perflog/detail/PerfLogImp.h @@ -1,5 +1,4 @@ -#ifndef XRPL_BASICS_PERFLOGIMP_H -#define XRPL_BASICS_PERFLOGIMP_H +#pragma once #include @@ -175,5 +174,3 @@ public: } // namespace perf } // namespace xrpl - -#endif // XRPL_BASICS_PERFLOGIMP_H diff --git a/src/xrpld/rpc/BookChanges.h b/src/xrpld/rpc/BookChanges.h index 68ad094dc9..a2ea9cabf7 100644 --- a/src/xrpld/rpc/BookChanges.h +++ b/src/xrpld/rpc/BookChanges.h @@ -1,5 +1,4 @@ -#ifndef XRPL_RPC_BOOKCHANGES_H_INCLUDED -#define XRPL_RPC_BOOKCHANGES_H_INCLUDED +#pragma once #include #include @@ -193,5 +192,3 @@ computeBookChanges(std::shared_ptr const& lpAccepted) } // namespace RPC } // namespace xrpl - -#endif diff --git a/src/xrpld/rpc/CTID.h b/src/xrpld/rpc/CTID.h index aad8c0f5c1..ba96236a7f 100644 --- a/src/xrpld/rpc/CTID.h +++ b/src/xrpld/rpc/CTID.h @@ -1,5 +1,4 @@ -#ifndef XRPL_RPC_CTID_H_INCLUDED -#define XRPL_RPC_CTID_H_INCLUDED +#pragma once #include @@ -111,5 +110,3 @@ decodeCTID(T const ctid) noexcept } // namespace RPC } // namespace xrpl - -#endif diff --git a/src/xrpld/rpc/Context.h b/src/xrpld/rpc/Context.h index 8bb0bd3cbc..7ff02a9e8b 100644 --- a/src/xrpld/rpc/Context.h +++ b/src/xrpld/rpc/Context.h @@ -1,5 +1,4 @@ -#ifndef XRPL_RPC_CONTEXT_H_INCLUDED -#define XRPL_RPC_CONTEXT_H_INCLUDED +#pragma once #include #include @@ -54,5 +53,3 @@ struct GRPCContext : public Context } // namespace RPC } // namespace xrpl - -#endif diff --git a/src/xrpld/rpc/DeliveredAmount.h b/src/xrpld/rpc/DeliveredAmount.h index f201d4b6cc..54e3476683 100644 --- a/src/xrpld/rpc/DeliveredAmount.h +++ b/src/xrpld/rpc/DeliveredAmount.h @@ -1,5 +1,4 @@ -#ifndef XRPL_RPC_DELIVEREDAMOUNT_H_INCLUDED -#define XRPL_RPC_DELIVEREDAMOUNT_H_INCLUDED +#pragma once #include #include @@ -55,5 +54,3 @@ getDeliveredAmount( } // namespace RPC } // namespace xrpl - -#endif diff --git a/src/xrpld/rpc/GRPCHandlers.h b/src/xrpld/rpc/GRPCHandlers.h index 603d26c055..ac419c18ee 100644 --- a/src/xrpld/rpc/GRPCHandlers.h +++ b/src/xrpld/rpc/GRPCHandlers.h @@ -1,5 +1,4 @@ -#ifndef XRPL_RPC_GRPCHANDLER_H_INCLUDED -#define XRPL_RPC_GRPCHANDLER_H_INCLUDED +#pragma once #include @@ -30,5 +29,3 @@ std::pair doLedgerDiffGrpc(RPC::GRPCContext& context); } // namespace xrpl - -#endif diff --git a/src/xrpld/rpc/InfoSub.h b/src/xrpld/rpc/InfoSub.h index 2816a1637c..7d4d4f06c8 100644 --- a/src/xrpld/rpc/InfoSub.h +++ b/src/xrpld/rpc/InfoSub.h @@ -1,5 +1,4 @@ -#ifndef XRPL_NET_INFOSUB_H_INCLUDED -#define XRPL_NET_INFOSUB_H_INCLUDED +#pragma once #include @@ -223,5 +222,3 @@ private: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/rpc/MPTokenIssuanceID.h b/src/xrpld/rpc/MPTokenIssuanceID.h index 1cd1e173f4..2b2eef3b38 100644 --- a/src/xrpld/rpc/MPTokenIssuanceID.h +++ b/src/xrpld/rpc/MPTokenIssuanceID.h @@ -1,5 +1,4 @@ -#ifndef XRPL_RPC_MPTOKENISSUANCEID_H_INCLUDED -#define XRPL_RPC_MPTOKENISSUANCEID_H_INCLUDED +#pragma once #include #include @@ -36,5 +35,3 @@ insertMPTokenIssuanceID( } // namespace RPC } // namespace xrpl - -#endif diff --git a/src/xrpld/rpc/Output.h b/src/xrpld/rpc/Output.h index 431cbb6bbf..1c74562842 100644 --- a/src/xrpld/rpc/Output.h +++ b/src/xrpld/rpc/Output.h @@ -1,5 +1,4 @@ -#ifndef XRPL_RPC_OUTPUT_H_INCLUDED -#define XRPL_RPC_OUTPUT_H_INCLUDED +#pragma once #include @@ -16,5 +15,3 @@ stringOutput(std::string& s) } // namespace RPC } // namespace xrpl - -#endif diff --git a/src/xrpld/rpc/RPCCall.h b/src/xrpld/rpc/RPCCall.h index e54816a749..30f50f8f72 100644 --- a/src/xrpld/rpc/RPCCall.h +++ b/src/xrpld/rpc/RPCCall.h @@ -1,5 +1,4 @@ -#ifndef XRPL_NET_RPCCALL_H_INCLUDED -#define XRPL_NET_RPCCALL_H_INCLUDED +#pragma once #include @@ -59,5 +58,3 @@ rpcClient( std::unordered_map const& headers = {}); } // namespace xrpl - -#endif diff --git a/src/xrpld/rpc/RPCHandler.h b/src/xrpld/rpc/RPCHandler.h index 0b91528605..519740b75d 100644 --- a/src/xrpld/rpc/RPCHandler.h +++ b/src/xrpld/rpc/RPCHandler.h @@ -1,5 +1,4 @@ -#ifndef XRPL_RPC_RPCHANDLER_H_INCLUDED -#define XRPL_RPC_RPCHANDLER_H_INCLUDED +#pragma once #include #include @@ -18,5 +17,3 @@ roleRequired(unsigned int version, bool betaEnabled, std::string const& method); } // namespace RPC } // namespace xrpl - -#endif diff --git a/src/xrpld/rpc/RPCSub.h b/src/xrpld/rpc/RPCSub.h index b6bb32aaf3..53c46139cb 100644 --- a/src/xrpld/rpc/RPCSub.h +++ b/src/xrpld/rpc/RPCSub.h @@ -1,5 +1,4 @@ -#ifndef XRPL_NET_RPCSUB_H_INCLUDED -#define XRPL_NET_RPCSUB_H_INCLUDED +#pragma once #include @@ -34,5 +33,3 @@ make_RPCSub( Logs& logs); } // namespace xrpl - -#endif diff --git a/src/xrpld/rpc/Request.h b/src/xrpld/rpc/Request.h index 80e83802b5..233f45185b 100644 --- a/src/xrpld/rpc/Request.h +++ b/src/xrpld/rpc/Request.h @@ -1,5 +1,4 @@ -#ifndef XRPL_RPC_REQUEST_H_INCLUDED -#define XRPL_RPC_REQUEST_H_INCLUDED +#pragma once #include #include @@ -44,5 +43,3 @@ private: } // namespace RPC } // namespace xrpl - -#endif diff --git a/src/xrpld/rpc/Role.h b/src/xrpld/rpc/Role.h index 04b288600a..554f9c1765 100644 --- a/src/xrpld/rpc/Role.h +++ b/src/xrpld/rpc/Role.h @@ -1,5 +1,4 @@ -#ifndef XRPL_SERVER_ROLE_H_INCLUDED -#define XRPL_SERVER_ROLE_H_INCLUDED +#pragma once #include #include @@ -71,5 +70,3 @@ std::string_view forwardedFor(http_request_type const& request); } // namespace xrpl - -#endif diff --git a/src/xrpld/rpc/ServerHandler.h b/src/xrpld/rpc/ServerHandler.h index 59ef9444c1..0810b303e9 100644 --- a/src/xrpld/rpc/ServerHandler.h +++ b/src/xrpld/rpc/ServerHandler.h @@ -1,5 +1,4 @@ -#ifndef XRPL_RPC_SERVERHANDLER_H_INCLUDED -#define XRPL_RPC_SERVERHANDLER_H_INCLUDED +#pragma once #include #include @@ -200,5 +199,3 @@ make_ServerHandler( CollectorManager& cm); } // namespace xrpl - -#endif diff --git a/src/xrpld/rpc/Status.h b/src/xrpld/rpc/Status.h index 8ff969181d..34d621a3bb 100644 --- a/src/xrpld/rpc/Status.h +++ b/src/xrpld/rpc/Status.h @@ -1,5 +1,4 @@ -#ifndef XRPL_RPC_STATUS_H_INCLUDED -#define XRPL_RPC_STATUS_H_INCLUDED +#pragma once #include #include @@ -130,5 +129,3 @@ private: } // namespace RPC } // namespace xrpl - -#endif diff --git a/src/xrpld/rpc/detail/Handler.h b/src/xrpld/rpc/detail/Handler.h index 504b447774..f6fadd9cbd 100644 --- a/src/xrpld/rpc/detail/Handler.h +++ b/src/xrpld/rpc/detail/Handler.h @@ -1,5 +1,4 @@ -#ifndef XRPL_RPC_HANDLER_H_INCLUDED -#define XRPL_RPC_HANDLER_H_INCLUDED +#pragma once #include #include @@ -112,5 +111,3 @@ conditionMet(Condition condition_required, T& context) } // namespace RPC } // namespace xrpl - -#endif diff --git a/src/xrpld/rpc/detail/LegacyPathFind.h b/src/xrpld/rpc/detail/LegacyPathFind.h index d175e7c532..139075b53d 100644 --- a/src/xrpld/rpc/detail/LegacyPathFind.h +++ b/src/xrpld/rpc/detail/LegacyPathFind.h @@ -1,5 +1,4 @@ -#ifndef XRPL_RPC_LEGACYPATHFIND_H_INCLUDED -#define XRPL_RPC_LEGACYPATHFIND_H_INCLUDED +#pragma once #include @@ -29,5 +28,3 @@ private: } // namespace RPC } // namespace xrpl - -#endif diff --git a/src/xrpld/rpc/detail/RPCHelpers.h b/src/xrpld/rpc/detail/RPCHelpers.h index 65cec14925..1b5e06ce42 100644 --- a/src/xrpld/rpc/detail/RPCHelpers.h +++ b/src/xrpld/rpc/detail/RPCHelpers.h @@ -1,5 +1,4 @@ -#ifndef XRPL_RPC_RPCHELPERS_H_INCLUDED -#define XRPL_RPC_RPCHELPERS_H_INCLUDED +#pragma once #include #include @@ -152,5 +151,3 @@ keypairForSignature(Json::Value const& params, Json::Value& error, unsigned int } // namespace RPC } // namespace xrpl - -#endif diff --git a/src/xrpld/rpc/detail/RPCLedgerHelpers.h b/src/xrpld/rpc/detail/RPCLedgerHelpers.h index 37ec66b584..6ea6e3cb78 100644 --- a/src/xrpld/rpc/detail/RPCLedgerHelpers.h +++ b/src/xrpld/rpc/detail/RPCLedgerHelpers.h @@ -1,5 +1,4 @@ -#ifndef XRPL_RPC_RPCLEDGERHELPERS_H_INCLUDED -#define XRPL_RPC_RPCLEDGERHELPERS_H_INCLUDED +#pragma once #include #include @@ -171,5 +170,3 @@ getOrAcquireLedger(RPC::JsonContext const& context); } // namespace RPC } // namespace xrpl - -#endif diff --git a/src/xrpld/rpc/detail/TransactionSign.h b/src/xrpld/rpc/detail/TransactionSign.h index 2e3c21651e..cc85d67815 100644 --- a/src/xrpld/rpc/detail/TransactionSign.h +++ b/src/xrpld/rpc/detail/TransactionSign.h @@ -1,5 +1,4 @@ -#ifndef XRPL_RPC_TRANSACTIONSIGN_H_INCLUDED -#define XRPL_RPC_TRANSACTIONSIGN_H_INCLUDED +#pragma once #include #include @@ -121,5 +120,3 @@ transactionSubmitMultiSigned( } // namespace RPC } // namespace xrpl - -#endif diff --git a/src/xrpld/rpc/detail/Tuning.h b/src/xrpld/rpc/detail/Tuning.h index c0b939a4fe..e9dd2c37d7 100644 --- a/src/xrpld/rpc/detail/Tuning.h +++ b/src/xrpld/rpc/detail/Tuning.h @@ -1,5 +1,4 @@ -#ifndef XRPL_RPC_TUNING_H_INCLUDED -#define XRPL_RPC_TUNING_H_INCLUDED +#pragma once namespace xrpl { namespace RPC { @@ -72,5 +71,3 @@ static int constexpr max_auto_src_cur = 88; } // namespace RPC } // namespace xrpl - -#endif diff --git a/src/xrpld/rpc/detail/WSInfoSub.h b/src/xrpld/rpc/detail/WSInfoSub.h index fd791cbce7..8ed5ff8d6d 100644 --- a/src/xrpld/rpc/detail/WSInfoSub.h +++ b/src/xrpld/rpc/detail/WSInfoSub.h @@ -1,5 +1,4 @@ -#ifndef XRPL_RPC_WSINFOSUB_H -#define XRPL_RPC_WSINFOSUB_H +#pragma once #include #include @@ -63,5 +62,3 @@ public: }; } // namespace xrpl - -#endif diff --git a/src/xrpld/rpc/handlers/GetCounts.h b/src/xrpld/rpc/handlers/GetCounts.h index de2c4f2f96..60c7a3b693 100644 --- a/src/xrpld/rpc/handlers/GetCounts.h +++ b/src/xrpld/rpc/handlers/GetCounts.h @@ -1,5 +1,4 @@ -#ifndef XRPL_RPC_HANDLERS_GETCOUNTS_H_INCLUDED -#define XRPL_RPC_HANDLERS_GETCOUNTS_H_INCLUDED +#pragma once #include @@ -9,5 +8,3 @@ Json::Value getCountsJson(Application& app, int minObjectCount); } - -#endif diff --git a/src/xrpld/rpc/handlers/Handlers.h b/src/xrpld/rpc/handlers/Handlers.h index 773186237b..a5a96baa31 100644 --- a/src/xrpld/rpc/handlers/Handlers.h +++ b/src/xrpld/rpc/handlers/Handlers.h @@ -1,5 +1,4 @@ -#ifndef XRPL_RPC_HANDLERS_HANDLERS_H_INCLUDED -#define XRPL_RPC_HANDLERS_HANDLERS_H_INCLUDED +#pragma once #include @@ -150,5 +149,3 @@ doValidatorInfo(RPC::JsonContext&); Json::Value doVaultInfo(RPC::JsonContext&); } // namespace xrpl - -#endif diff --git a/src/xrpld/rpc/handlers/LedgerHandler.h b/src/xrpld/rpc/handlers/LedgerHandler.h index 3285118d11..418958e9f1 100644 --- a/src/xrpld/rpc/handlers/LedgerHandler.h +++ b/src/xrpld/rpc/handlers/LedgerHandler.h @@ -1,5 +1,4 @@ -#ifndef XRPL_RPC_HANDLERS_LEDGER_H_INCLUDED -#define XRPL_RPC_HANDLERS_LEDGER_H_INCLUDED +#pragma once #include #include @@ -59,5 +58,3 @@ private: } // namespace RPC } // namespace xrpl - -#endif diff --git a/src/xrpld/rpc/handlers/Version.h b/src/xrpld/rpc/handlers/Version.h index b1383511ed..ed80bf3729 100644 --- a/src/xrpld/rpc/handlers/Version.h +++ b/src/xrpld/rpc/handlers/Version.h @@ -1,5 +1,4 @@ -#ifndef XRPL_XRPL_RPC_HANDLERS_VERSION_H -#define XRPL_XRPL_RPC_HANDLERS_VERSION_H +#pragma once #include @@ -42,5 +41,3 @@ private: } // namespace RPC } // namespace xrpl - -#endif diff --git a/src/xrpld/rpc/handlers/WalletPropose.h b/src/xrpld/rpc/handlers/WalletPropose.h index 42c7973055..4eb72c7e46 100644 --- a/src/xrpld/rpc/handlers/WalletPropose.h +++ b/src/xrpld/rpc/handlers/WalletPropose.h @@ -1,5 +1,4 @@ -#ifndef XRPL_XRPL_RPC_HANDLERS_WALLETPROPOSE_H -#define XRPL_XRPL_RPC_HANDLERS_WALLETPROPOSE_H +#pragma once #include @@ -9,5 +8,3 @@ Json::Value walletPropose(Json::Value const& params); } // namespace xrpl - -#endif diff --git a/src/xrpld/rpc/json_body.h b/src/xrpld/rpc/json_body.h index cadae1c024..6f8025d876 100644 --- a/src/xrpld/rpc/json_body.h +++ b/src/xrpld/rpc/json_body.h @@ -1,5 +1,4 @@ -#ifndef XRPL_RPC_JSON_BODY_H -#define XRPL_RPC_JSON_BODY_H +#pragma once #include #include @@ -85,5 +84,3 @@ struct json_body }; } // namespace xrpl - -#endif diff --git a/src/xrpld/shamap/NodeFamily.h b/src/xrpld/shamap/NodeFamily.h index 14c2ebb093..ab555919ac 100644 --- a/src/xrpld/shamap/NodeFamily.h +++ b/src/xrpld/shamap/NodeFamily.h @@ -1,5 +1,4 @@ -#ifndef XRPL_SHAMAP_NODEFAMILY_H_INCLUDED -#define XRPL_SHAMAP_NODEFAMILY_H_INCLUDED +#pragma once #include @@ -84,5 +83,3 @@ private: }; } // namespace xrpl - -#endif From b449a6ee84f002f77f414ef9317c937f3de78a0b Mon Sep 17 00:00:00 2001 From: Bart Date: Wed, 4 Feb 2026 11:30:16 -0500 Subject: [PATCH 04/61] chore: Remove unnecessary script (#6326) --- convert_include_guards.py | 139 -------------------------------------- 1 file changed, 139 deletions(-) delete mode 100644 convert_include_guards.py diff --git a/convert_include_guards.py b/convert_include_guards.py deleted file mode 100644 index c4f06ecc54..0000000000 --- a/convert_include_guards.py +++ /dev/null @@ -1,139 +0,0 @@ -#!/usr/bin/env python3 -""" -Script to replace include guards with #pragma once -Handles guards starting with XRPL_, BEAST_, or TEST_ -""" - -import sys -from pathlib import Path - - -def convert_file(file_path, prefixes=None): - """ - Convert a file from include guards to #pragma once - - Args: - file_path: Path to the file to convert - prefixes: List of prefixes to match (e.g., ['XRPL_', 'BEAST_', 'TEST_']) - If None, defaults to ['XRPL_', 'BEAST_', 'TEST_'] - - Returns True if the file was modified, False otherwise - """ - if prefixes is None: - prefixes = ["XRPL_", "BEAST_", "TEST_"] - - try: - with open(file_path, "r", encoding="utf-8") as f: - lines = f.readlines() - except Exception as e: - print(f"Error reading {file_path}: {e}", file=sys.stderr) - return False - - if len(lines) < 3: - print(f"Skipping {file_path}: too few lines", file=sys.stderr) - return False - - # Find the #ifndef with any of the specified prefixes - ifndef_idx = -1 - define_idx = -1 - found_prefix = None - - for i, line in enumerate(lines): - stripped = line.strip() - for prefix in prefixes: - if stripped.startswith(f"#ifndef {prefix}"): - ifndef_idx = i - found_prefix = prefix - # The #define should be the next line - if i + 1 < len(lines) and lines[i + 1].strip().startswith( - f"#define {prefix}" - ): - define_idx = i + 1 - break - if ifndef_idx != -1: - break - - if ifndef_idx == -1 or define_idx == -1: - print( - f"No include guard with prefixes {prefixes} found in {file_path}", - file=sys.stderr, - ) - return False - - # Find the last #endif line - endif_idx = -1 - for i in range(len(lines) - 1, -1, -1): - stripped = lines[i].strip() - if stripped.startswith("#endif"): - endif_idx = i - break - - if endif_idx == -1: - print(f"No closing #endif found in {file_path}", file=sys.stderr) - return False - - # Build the new content - new_lines = [] - - # Add everything before the #ifndef - new_lines.extend(lines[:ifndef_idx]) - - # Add #pragma once with exactly one empty line after it - new_lines.append("#pragma once\n") - new_lines.append("\n") - - # Add everything between #define and #endif, but skip leading empty lines - content_lines = lines[define_idx + 1 : endif_idx] - # Skip leading empty lines - start_idx = 0 - while start_idx < len(content_lines) and content_lines[start_idx].strip() == "": - start_idx += 1 - new_lines.extend(content_lines[start_idx:]) - - # Add everything after #endif (usually just empty lines, but include it) - new_lines.extend(lines[endif_idx + 1 :]) - - # Remove trailing empty lines at the end, then ensure exactly one newline at end - while new_lines and new_lines[-1].strip() == "": - new_lines.pop() - - if new_lines and not new_lines[-1].endswith("\n"): - new_lines[-1] += "\n" - else: - new_lines.append("\n") - - # Write the file - try: - with open(file_path, "w", encoding="utf-8") as f: - f.writelines(new_lines) - print(f"Converted: {file_path}") - return True - except Exception as e: - print(f"Error writing {file_path}: {e}", file=sys.stderr) - return False - - -def main(): - if len(sys.argv) < 2: - print("Usage: python convert_include_guards.py [file2 ...]") - sys.exit(1) - - files = sys.argv[1:] - success_count = 0 - fail_count = 0 - - for file_path in files: - if convert_file(file_path): - success_count += 1 - else: - fail_count += 1 - - print( - f"\nSummary: {success_count} files converted, {fail_count} files failed/unchanged" - ) - - return 0 if fail_count == 0 else 1 - - -if __name__ == "__main__": - sys.exit(main()) From 7f41012e599fde6d8c3985c954db57181c720a53 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Wed, 4 Feb 2026 18:27:10 +0000 Subject: [PATCH 05/61] chore: Update secp256k1 and openssl (#6327) --- conan.lock | 8 ++++---- conanfile.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/conan.lock b/conan.lock index 64def2e916..3b4d835564 100644 --- a/conan.lock +++ b/conan.lock @@ -6,11 +6,11 @@ "sqlite3/3.49.1#8631739a4c9b93bd3d6b753bac548a63%1765850149.926", "soci/4.0.3#a9f8d773cd33e356b5879a4b0564f287%1765850149.46", "snappy/1.1.10#968fef506ff261592ec30c574d4a7809%1765850147.878", - "secp256k1/0.7.0#9c4ab67bdc3860c16ea5b36aed8f74ea%1765850147.928", + "secp256k1/0.7.0#0fda78daa3b864deb8a2fbc083398356%1770226294.524", "rocksdb/10.5.1#4a197eca381a3e5ae8adf8cffa5aacd0%1765850186.86", "re2/20230301#ca3b241baec15bd31ea9187150e0b333%1765850148.103", "protobuf/6.32.1#f481fd276fc23a33b85a3ed1e898b693%1765850161.038", - "openssl/3.5.4#1b986e61b38fdfda3b40bebc1b234393%1768312656.257", + "openssl/3.5.5#05a4ac5b7323f7a329b2db1391d9941f%1769599205.414", "nudb/2.0.9#0432758a24204da08fee953ec9ea03cb%1769436073.32", "lz4/1.10.0#59fc63cac7f10fbe8e05c7e62c2f3504%1765850143.914", "libiconv/1.17#1e65319e945f2d31941a9d28cc13c058%1765842973.492", @@ -23,7 +23,7 @@ "date/3.0.4#862e11e80030356b53c2c38599ceb32b%1765850143.772", "c-ares/1.34.5#5581c2b62a608b40bb85d965ab3ec7c8%1765850144.336", "bzip2/1.0.8#c470882369c2d95c5c77e970c0c7e321%1765850143.837", - "boost/1.90.0#d5e8defe7355494953be18524a7f135b%1765955095.179", + "boost/1.90.0#d5e8defe7355494953be18524a7f135b%1769454080.269", "abseil/20250127.0#99262a368bd01c0ccca8790dfced9719%1766517936.993" ], "build_requires": [ @@ -31,7 +31,7 @@ "strawberryperl/5.32.1.1#707032463aa0620fa17ec0d887f5fe41%1765850165.196", "protobuf/6.32.1#f481fd276fc23a33b85a3ed1e898b693%1765850161.038", "nasm/2.16.01#31e26f2ee3c4346ecd347911bd126904%1765850144.707", - "msys2/cci.latest#1996656c3c98e5765b25b60ff5cf77b4%1764840888.758", + "msys2/cci.latest#eea83308ad7e9023f7318c60d5a9e6cb%1770199879.083", "m4/1.4.19#70dc8bbb33e981d119d2acc0175cf381%1763158052.846", "cmake/4.2.0#ae0a44f44a1ef9ab68fd4b3e9a1f8671%1765850153.937", "cmake/3.31.10#313d16a1aa16bbdb2ca0792467214b76%1765850153.479", diff --git a/conanfile.py b/conanfile.py index 35a461cec7..4fb2deeec8 100644 --- a/conanfile.py +++ b/conanfile.py @@ -31,7 +31,7 @@ class Xrpl(ConanFile): "grpc/1.72.0", "libarchive/3.8.1", "nudb/2.0.9", - "openssl/3.5.4", + "openssl/3.5.5", "secp256k1/0.7.0", "soci/4.0.3", "zlib/1.3.1", From e79673cf40cd4bbdb29e4f56fa2c3fd9e80edea4 Mon Sep 17 00:00:00 2001 From: Vito Tumas <5780819+Tapanito@users.noreply.github.com> Date: Thu, 5 Feb 2026 11:23:44 +0100 Subject: [PATCH 06/61] fix typo in LendingHelpers unit-test (#6215) --- src/test/app/LendingHelpers_test.cpp | 132 ++++++++++++--------------- 1 file changed, 60 insertions(+), 72 deletions(-) diff --git a/src/test/app/LendingHelpers_test.cpp b/src/test/app/LendingHelpers_test.cpp index ee829550e1..58e4c5aaa4 100644 --- a/src/test/app/LendingHelpers_test.cpp +++ b/src/test/app/LendingHelpers_test.cpp @@ -592,20 +592,18 @@ class LendingHelpers_test : public beast::unit_test::suite auto const periodicRate = loanPeriodicRate(loanInterestRate, paymentInterval); Number const overpaymentAmount{50}; - ExtendedPaymentComponents const overpaymentComponents = computeOverpaymentComponents( + auto const overpaymentComponents = computeOverpaymentComponents( asset, loanScale, overpaymentAmount, TenthBips32(0), TenthBips32(0), managementFeeRate); - auto const loanProperites = computeLoanProperties( + auto const loanProperties = computeLoanProperties( asset, loanPrincipal, loanInterestRate, paymentInterval, paymentsRemaining, managementFeeRate, loanScale); - Number const periodicPayment = loanProperites.periodicPayment; - auto const ret = tryOverpayment( asset, loanScale, overpaymentComponents, - loanProperites.loanState, - periodicPayment, + loanProperties.loanState, + loanProperties.periodicPayment, periodicRate, paymentsRemaining, managementFeeRate, @@ -636,20 +634,20 @@ class LendingHelpers_test : public beast::unit_test::suite // =========== VALIDATE STATE CHANGES =========== BEAST_EXPECTS( - loanProperites.loanState.interestDue - newState.interestDue == 0, + loanProperties.loanState.interestDue - newState.interestDue == 0, " interest change mismatch: expected 0, got " + - to_string(loanProperites.loanState.interestDue - newState.interestDue)); + to_string(loanProperties.loanState.interestDue - newState.interestDue)); BEAST_EXPECTS( - loanProperites.loanState.managementFeeDue - newState.managementFeeDue == 0, + loanProperties.loanState.managementFeeDue - newState.managementFeeDue == 0, " management fee change mismatch: expected 0, got " + - to_string(loanProperites.loanState.managementFeeDue - newState.managementFeeDue)); + to_string(loanProperties.loanState.managementFeeDue - newState.managementFeeDue)); BEAST_EXPECTS( actualPaymentParts.principalPaid == - loanProperites.loanState.principalOutstanding - newState.principalOutstanding, + loanProperties.loanState.principalOutstanding - newState.principalOutstanding, " principalPaid mismatch: expected " + - to_string(loanProperites.loanState.principalOutstanding - newState.principalOutstanding) + ", got " + + to_string(loanProperties.loanState.principalOutstanding - newState.principalOutstanding) + ", got " + to_string(actualPaymentParts.principalPaid)); } @@ -672,7 +670,7 @@ class LendingHelpers_test : public beast::unit_test::suite std::uint32_t const paymentsRemaining = 10; auto const periodicRate = loanPeriodicRate(loanInterestRate, paymentInterval); - ExtendedPaymentComponents const overpaymentComponents = computeOverpaymentComponents( + auto const overpaymentComponents = computeOverpaymentComponents( asset, loanScale, Number{50, 0}, @@ -680,17 +678,15 @@ class LendingHelpers_test : public beast::unit_test::suite TenthBips32(10'000), // 10% overpayment fee managementFeeRate); - auto const loanProperites = computeLoanProperties( + auto const loanProperties = computeLoanProperties( asset, loanPrincipal, loanInterestRate, paymentInterval, paymentsRemaining, managementFeeRate, loanScale); - Number const periodicPayment = loanProperites.periodicPayment; - auto const ret = tryOverpayment( asset, loanScale, overpaymentComponents, - loanProperites.loanState, - periodicPayment, + loanProperties.loanState, + loanProperties.periodicPayment, periodicRate, paymentsRemaining, managementFeeRate, @@ -721,21 +717,21 @@ class LendingHelpers_test : public beast::unit_test::suite // =========== VALIDATE STATE CHANGES =========== // With no Loan interest, interest outstanding should not change BEAST_EXPECTS( - loanProperites.loanState.interestDue - newState.interestDue == 0, + loanProperties.loanState.interestDue - newState.interestDue == 0, " interest change mismatch: expected 0, got " + - to_string(loanProperites.loanState.interestDue - newState.interestDue)); + to_string(loanProperties.loanState.interestDue - newState.interestDue)); // With no Loan management fee, management fee due should not change BEAST_EXPECTS( - loanProperites.loanState.managementFeeDue - newState.managementFeeDue == 0, + loanProperties.loanState.managementFeeDue - newState.managementFeeDue == 0, " management fee change mismatch: expected 0, got " + - to_string(loanProperites.loanState.managementFeeDue - newState.managementFeeDue)); + to_string(loanProperties.loanState.managementFeeDue - newState.managementFeeDue)); BEAST_EXPECTS( actualPaymentParts.principalPaid == - loanProperites.loanState.principalOutstanding - newState.principalOutstanding, + loanProperties.loanState.principalOutstanding - newState.principalOutstanding, " principalPaid mismatch: expected " + - to_string(loanProperites.loanState.principalOutstanding - newState.principalOutstanding) + ", got " + + to_string(loanProperties.loanState.principalOutstanding - newState.principalOutstanding) + ", got " + to_string(actualPaymentParts.principalPaid)); } @@ -758,7 +754,7 @@ class LendingHelpers_test : public beast::unit_test::suite std::uint32_t const paymentsRemaining = 10; auto const periodicRate = loanPeriodicRate(loanInterestRate, paymentInterval); - ExtendedPaymentComponents const overpaymentComponents = computeOverpaymentComponents( + auto const overpaymentComponents = computeOverpaymentComponents( asset, loanScale, Number{50, 0}, @@ -766,17 +762,15 @@ class LendingHelpers_test : public beast::unit_test::suite TenthBips32(0), // 0% overpayment fee managementFeeRate); - auto const loanProperites = computeLoanProperties( + auto const loanProperties = computeLoanProperties( asset, loanPrincipal, loanInterestRate, paymentInterval, paymentsRemaining, managementFeeRate, loanScale); - Number const periodicPayment = loanProperites.periodicPayment; - auto const ret = tryOverpayment( asset, loanScale, overpaymentComponents, - loanProperites.loanState, - periodicPayment, + loanProperties.loanState, + loanProperties.periodicPayment, periodicRate, paymentsRemaining, managementFeeRate, @@ -812,22 +806,22 @@ class LendingHelpers_test : public beast::unit_test::suite // =========== VALIDATE STATE CHANGES =========== BEAST_EXPECTS( actualPaymentParts.principalPaid == - loanProperites.loanState.principalOutstanding - newState.principalOutstanding, + loanProperties.loanState.principalOutstanding - newState.principalOutstanding, " principalPaid mismatch: expected " + - to_string(loanProperites.loanState.principalOutstanding - newState.principalOutstanding) + ", got " + + to_string(loanProperties.loanState.principalOutstanding - newState.principalOutstanding) + ", got " + to_string(actualPaymentParts.principalPaid)); BEAST_EXPECTS( - actualPaymentParts.valueChange == newState.interestDue - loanProperites.loanState.interestDue, + actualPaymentParts.valueChange == newState.interestDue - loanProperties.loanState.interestDue, " valueChange mismatch: expected " + - to_string(newState.interestDue - loanProperites.loanState.interestDue) + ", got " + + to_string(newState.interestDue - loanProperties.loanState.interestDue) + ", got " + to_string(actualPaymentParts.valueChange)); // With no Loan management fee, management fee due should not change BEAST_EXPECTS( - loanProperites.loanState.managementFeeDue - newState.managementFeeDue == 0, + loanProperties.loanState.managementFeeDue - newState.managementFeeDue == 0, " management fee change mismatch: expected 0, got " + - to_string(loanProperites.loanState.managementFeeDue - newState.managementFeeDue)); + to_string(loanProperties.loanState.managementFeeDue - newState.managementFeeDue)); } void @@ -849,7 +843,7 @@ class LendingHelpers_test : public beast::unit_test::suite std::uint32_t const paymentsRemaining = 10; auto const periodicRate = loanPeriodicRate(loanInterestRate, paymentInterval); - ExtendedPaymentComponents const overpaymentComponents = computeOverpaymentComponents( + auto const overpaymentComponents = computeOverpaymentComponents( asset, loanScale, Number{50, 0}, @@ -857,17 +851,15 @@ class LendingHelpers_test : public beast::unit_test::suite TenthBips32(0), // 0% overpayment fee managementFeeRate); - auto const loanProperites = computeLoanProperties( + auto const loanProperties = computeLoanProperties( asset, loanPrincipal, loanInterestRate, paymentInterval, paymentsRemaining, managementFeeRate, loanScale); - Number const periodicPayment = loanProperites.periodicPayment; - auto const ret = tryOverpayment( asset, loanScale, overpaymentComponents, - loanProperites.loanState, - periodicPayment, + loanProperties.loanState, + loanProperties.periodicPayment, periodicRate, paymentsRemaining, managementFeeRate, @@ -904,26 +896,26 @@ class LendingHelpers_test : public beast::unit_test::suite // =========== VALIDATE STATE CHANGES =========== BEAST_EXPECTS( actualPaymentParts.principalPaid == - loanProperites.loanState.principalOutstanding - newState.principalOutstanding, + loanProperties.loanState.principalOutstanding - newState.principalOutstanding, " principalPaid mismatch: expected " + - to_string(loanProperites.loanState.principalOutstanding - newState.principalOutstanding) + ", got " + + to_string(loanProperties.loanState.principalOutstanding - newState.principalOutstanding) + ", got " + to_string(actualPaymentParts.principalPaid)); // The change in interest is equal to the value change sans the // overpayment interest BEAST_EXPECTS( actualPaymentParts.valueChange - actualPaymentParts.interestPaid == - newState.interestDue - loanProperites.loanState.interestDue, + newState.interestDue - loanProperties.loanState.interestDue, " valueChange mismatch: expected " + to_string( - newState.interestDue - loanProperites.loanState.interestDue + actualPaymentParts.interestPaid) + + newState.interestDue - loanProperties.loanState.interestDue + actualPaymentParts.interestPaid) + ", got " + to_string(actualPaymentParts.valueChange)); // With no Loan management fee, management fee due should not change BEAST_EXPECTS( - loanProperites.loanState.managementFeeDue - newState.managementFeeDue == 0, + loanProperties.loanState.managementFeeDue - newState.managementFeeDue == 0, " management fee change mismatch: expected 0, got " + - to_string(loanProperites.loanState.managementFeeDue - newState.managementFeeDue)); + to_string(loanProperties.loanState.managementFeeDue - newState.managementFeeDue)); } void @@ -947,7 +939,7 @@ class LendingHelpers_test : public beast::unit_test::suite std::uint32_t const paymentsRemaining = 10; auto const periodicRate = loanPeriodicRate(loanInterestRate, paymentInterval); - ExtendedPaymentComponents const overpaymentComponents = computeOverpaymentComponents( + auto const overpaymentComponents = computeOverpaymentComponents( asset, loanScale, Number{50, 0}, @@ -955,17 +947,15 @@ class LendingHelpers_test : public beast::unit_test::suite TenthBips32(0), // 0% overpayment fee managementFeeRate); - auto const loanProperites = computeLoanProperties( + auto const loanProperties = computeLoanProperties( asset, loanPrincipal, loanInterestRate, paymentInterval, paymentsRemaining, managementFeeRate, loanScale); - Number const periodicPayment = loanProperites.periodicPayment; - auto const ret = tryOverpayment( asset, loanScale, overpaymentComponents, - loanProperites.loanState, - periodicPayment, + loanProperties.loanState, + loanProperties.periodicPayment, periodicRate, paymentsRemaining, managementFeeRate, @@ -1004,23 +994,23 @@ class LendingHelpers_test : public beast::unit_test::suite // =========== VALIDATE STATE CHANGES =========== BEAST_EXPECTS( actualPaymentParts.principalPaid == - loanProperites.loanState.principalOutstanding - newState.principalOutstanding, + loanProperties.loanState.principalOutstanding - newState.principalOutstanding, " principalPaid mismatch: expected " + - to_string(loanProperites.loanState.principalOutstanding - newState.principalOutstanding) + ", got " + + to_string(loanProperties.loanState.principalOutstanding - newState.principalOutstanding) + ", got " + to_string(actualPaymentParts.principalPaid)); // Note that the management fee value change is not captured, as this // value is not needed to correctly update the Vault state. BEAST_EXPECTS( - (newState.managementFeeDue - loanProperites.loanState.managementFeeDue == Number{-20592, -5}), + (newState.managementFeeDue - loanProperties.loanState.managementFeeDue == Number{-20592, -5}), " management fee change mismatch: expected " + to_string(Number{-20592, -5}) + ", got " + - to_string(newState.managementFeeDue - loanProperites.loanState.managementFeeDue)); + to_string(newState.managementFeeDue - loanProperties.loanState.managementFeeDue)); BEAST_EXPECTS( actualPaymentParts.valueChange - actualPaymentParts.interestPaid == - newState.interestDue - loanProperites.loanState.interestDue, + newState.interestDue - loanProperties.loanState.interestDue, " valueChange mismatch: expected " + - to_string(newState.interestDue - loanProperites.loanState.interestDue) + ", got " + + to_string(newState.interestDue - loanProperties.loanState.interestDue) + ", got " + to_string(actualPaymentParts.valueChange - actualPaymentParts.interestPaid)); } @@ -1043,7 +1033,7 @@ class LendingHelpers_test : public beast::unit_test::suite std::uint32_t const paymentsRemaining = 10; auto const periodicRate = loanPeriodicRate(loanInterestRate, paymentInterval); - ExtendedPaymentComponents const overpaymentComponents = computeOverpaymentComponents( + auto const overpaymentComponents = computeOverpaymentComponents( asset, loanScale, Number{50, 0}, @@ -1051,17 +1041,15 @@ class LendingHelpers_test : public beast::unit_test::suite TenthBips32(10'000), // 10% overpayment fee managementFeeRate); - auto const loanProperites = computeLoanProperties( + auto const loanProperties = computeLoanProperties( asset, loanPrincipal, loanInterestRate, paymentInterval, paymentsRemaining, managementFeeRate, loanScale); - Number const periodicPayment = loanProperites.periodicPayment; - auto const ret = tryOverpayment( asset, loanScale, overpaymentComponents, - loanProperites.loanState, - periodicPayment, + loanProperties.loanState, + loanProperties.periodicPayment, periodicRate, paymentsRemaining, managementFeeRate, @@ -1101,23 +1089,23 @@ class LendingHelpers_test : public beast::unit_test::suite BEAST_EXPECTS( actualPaymentParts.principalPaid == - loanProperites.loanState.principalOutstanding - newState.principalOutstanding, + loanProperties.loanState.principalOutstanding - newState.principalOutstanding, " principalPaid mismatch: expected " + - to_string(loanProperites.loanState.principalOutstanding - newState.principalOutstanding) + ", got " + + to_string(loanProperties.loanState.principalOutstanding - newState.principalOutstanding) + ", got " + to_string(actualPaymentParts.principalPaid)); // Note that the management fee value change is not captured, as this // value is not needed to correctly update the Vault state. BEAST_EXPECTS( - (newState.managementFeeDue - loanProperites.loanState.managementFeeDue == Number{-18304, -5}), + (newState.managementFeeDue - loanProperties.loanState.managementFeeDue == Number{-18304, -5}), " management fee change mismatch: expected " + to_string(Number{-18304, -5}) + ", got " + - to_string(newState.managementFeeDue - loanProperites.loanState.managementFeeDue)); + to_string(newState.managementFeeDue - loanProperties.loanState.managementFeeDue)); BEAST_EXPECTS( actualPaymentParts.valueChange - actualPaymentParts.interestPaid == - newState.interestDue - loanProperites.loanState.interestDue, + newState.interestDue - loanProperties.loanState.interestDue, " valueChange mismatch: expected " + - to_string(newState.interestDue - loanProperites.loanState.interestDue) + ", got " + + to_string(newState.interestDue - loanProperties.loanState.interestDue) + ", got " + to_string(actualPaymentParts.valueChange - actualPaymentParts.interestPaid)); } From fd5381374612f37eb50350dd4c3cf32d58ca4a8e Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Thu, 5 Feb 2026 13:40:26 +0000 Subject: [PATCH 07/61] more ASAN fixes Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> --- include/xrpl/basics/LocalValue.h | 8 ++---- include/xrpl/beast/utility/Journal.h | 30 +++++++++++++++++++++ src/libxrpl/basics/LocalValue.cpp | 14 ++++++++++ src/libxrpl/beast/utility/beast_Journal.cpp | 8 ++++++ src/libxrpl/shamap/SHAMapNodeID.cpp | 2 +- 5 files changed, 55 insertions(+), 7 deletions(-) create mode 100644 src/libxrpl/basics/LocalValue.cpp diff --git a/include/xrpl/basics/LocalValue.h b/include/xrpl/basics/LocalValue.h index 99538a0ff2..9357b736a8 100644 --- a/include/xrpl/basics/LocalValue.h +++ b/include/xrpl/basics/LocalValue.h @@ -54,12 +54,8 @@ struct LocalValuesHolder } }; -inline LocalValuesHolder& -getLocalValuesHolder() -{ - thread_local LocalValuesHolder holder; - return holder; -} +LocalValuesHolder& +getLocalValuesHolder(); inline LocalValues*& getLocalValuesPtr() diff --git a/include/xrpl/beast/utility/Journal.h b/include/xrpl/beast/utility/Journal.h index 7eaf4a627a..6d84e41f75 100644 --- a/include/xrpl/beast/utility/Journal.h +++ b/include/xrpl/beast/utility/Journal.h @@ -139,6 +139,13 @@ public: template ScopedStream(Stream const& stream, T const& t); + /** Overload for const char* to ensure immediate copy. + This prevents stack-use-after-scope issues when the source + pointer becomes invalid before the stream buffer operations + complete (e.g., during buffer reallocation). + */ + ScopedStream(Stream const& stream, char const* t); + ScopedStream(Stream const& stream, std::ostream& manip(std::ostream&)); ScopedStream& @@ -159,6 +166,18 @@ public: std::ostream& operator<<(T const& t) const; + /** Overload for const char* to ensure immediate copy. + This prevents stack-use-after-scope issues when the source + pointer becomes invalid before the stream buffer operations + complete (e.g., during buffer reallocation). + */ + std::ostream& + operator<<(char const* t) const + { + m_ostream << std::string(t); + return m_ostream; + } + private: Sink& m_sink; Severity const m_level; @@ -239,6 +258,17 @@ public: template ScopedStream operator<<(T const& t) const; + + /** Overload for const char* to ensure immediate copy. + This prevents stack-use-after-scope issues when the source + pointer becomes invalid before the stream buffer operations + complete (e.g., during buffer reallocation). + */ + ScopedStream + operator<<(char const* t) const + { + return ScopedStream(*this, t); + } /** @} */ private: diff --git a/src/libxrpl/basics/LocalValue.cpp b/src/libxrpl/basics/LocalValue.cpp new file mode 100644 index 0000000000..47f2d8c258 --- /dev/null +++ b/src/libxrpl/basics/LocalValue.cpp @@ -0,0 +1,14 @@ +#include + +namespace xrpl { +namespace detail { + +LocalValuesHolder& +getLocalValuesHolder() +{ + thread_local LocalValuesHolder holder; + return holder; +} + +} // namespace detail +} // namespace xrpl diff --git a/src/libxrpl/beast/utility/beast_Journal.cpp b/src/libxrpl/beast/utility/beast_Journal.cpp index f9ee0cdb73..e3e309ff1c 100644 --- a/src/libxrpl/beast/utility/beast_Journal.cpp +++ b/src/libxrpl/beast/utility/beast_Journal.cpp @@ -118,6 +118,14 @@ Journal::ScopedStream::ScopedStream(Stream const& stream, std::ostream& manip(st m_ostream << manip; } +Journal::ScopedStream::ScopedStream(Stream const& stream, char const* t) : ScopedStream(stream.sink(), stream.level()) +{ + // Convert to std::string immediately to ensure the data is copied. + // This prevents stack-use-after-scope issues when the source pointer + // becomes invalid before stream buffer operations(like reallocation) complete. + m_ostream << std::string(t); +} + Journal::ScopedStream::~ScopedStream() { std::string const& s(m_ostream.str()); diff --git a/src/libxrpl/shamap/SHAMapNodeID.cpp b/src/libxrpl/shamap/SHAMapNodeID.cpp index 84150272d6..6d6811cd63 100644 --- a/src/libxrpl/shamap/SHAMapNodeID.cpp +++ b/src/libxrpl/shamap/SHAMapNodeID.cpp @@ -6,7 +6,7 @@ namespace xrpl { -static uint256 const& +static uint256 const depthMask(unsigned int depth) { enum { mask_size = 65 }; From 413aee0752093232d5c3fb0804159a6c4b6a434a Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Thu, 5 Feb 2026 15:10:36 +0000 Subject: [PATCH 08/61] silence stack-buffer-overflow Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> --- sanitizers/suppressions/runtime-asan-options.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/sanitizers/suppressions/runtime-asan-options.txt b/sanitizers/suppressions/runtime-asan-options.txt index 95a0d7ec7f..35b323271d 100644 --- a/sanitizers/suppressions/runtime-asan-options.txt +++ b/sanitizers/suppressions/runtime-asan-options.txt @@ -1,4 +1,5 @@ detect_container_overflow=0 detect_stack_use_after_return=0 +detect_stack-buffer-overflow=0 debug=true halt_on_error=false From 6006c281e22b8a907a3e3c993449ad42e598ed32 Mon Sep 17 00:00:00 2001 From: Niq Dudfield Date: Thu, 5 Feb 2026 22:40:27 +0700 Subject: [PATCH 09/61] fix: Increment sequence when accepting new manifests (#6059) The `ManifestCache::applyManifest` function was returning early without incrementing `seq_`. `OverlayImpl `uses this sequence to identify/invalidate a cached `TMManifests` message, which is exchanged with peers on connection. Depending on network size, startup sequencing, and topology, this can cause syncing issues. This change therefore increments `seq_` when a new manifest is accepted. --- src/test/app/Manifest_test.cpp | 5 +++++ src/xrpld/app/misc/detail/Manifest.cpp | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/src/test/app/Manifest_test.cpp b/src/test/app/Manifest_test.cpp index f5004a3200..598949f662 100644 --- a/src/test/app/Manifest_test.cpp +++ b/src/test/app/Manifest_test.cpp @@ -827,8 +827,13 @@ public: // applyManifest should accept new manifests with // higher sequence numbers + auto const seq0 = cache.sequence(); BEAST_EXPECT(cache.applyManifest(clone(s_a0)) == ManifestDisposition::accepted); + BEAST_EXPECT(cache.sequence() > seq0); + + auto const seq1 = cache.sequence(); BEAST_EXPECT(cache.applyManifest(clone(s_a0)) == ManifestDisposition::stale); + BEAST_EXPECT(cache.sequence() == seq1); BEAST_EXPECT(cache.applyManifest(clone(s_a1)) == ManifestDisposition::accepted); BEAST_EXPECT(cache.applyManifest(clone(s_a1)) == ManifestDisposition::stale); diff --git a/src/xrpld/app/misc/detail/Manifest.cpp b/src/xrpld/app/misc/detail/Manifest.cpp index c226407231..952814656b 100644 --- a/src/xrpld/app/misc/detail/Manifest.cpp +++ b/src/xrpld/app/misc/detail/Manifest.cpp @@ -459,6 +459,10 @@ ManifestCache::applyManifest(Manifest m) auto masterKey = m.masterKey; map_.emplace(std::move(masterKey), std::move(m)); + + // Something has changed. Keep track of it. + seq_++; + return ManifestDisposition::accepted; } From be28f4d4891f25e9cd3a1a1be3913c7e3ffc7085 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Thu, 5 Feb 2026 16:14:43 +0000 Subject: [PATCH 10/61] fixing issue with ScopedStream stack-use-after-scope Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> --- include/xrpl/beast/utility/Journal.h | 22 +++++++------------ .../suppressions/runtime-asan-options.txt | 13 +++++++++-- src/libxrpl/beast/utility/beast_Journal.cpp | 8 ------- src/libxrpl/shamap/SHAMapNodeID.cpp | 4 ++++ 4 files changed, 23 insertions(+), 24 deletions(-) diff --git a/include/xrpl/beast/utility/Journal.h b/include/xrpl/beast/utility/Journal.h index 7bbbb81f2a..6ce3f0a4da 100644 --- a/include/xrpl/beast/utility/Journal.h +++ b/include/xrpl/beast/utility/Journal.h @@ -3,6 +3,7 @@ #include #include +#include namespace beast { @@ -138,13 +139,6 @@ public: template ScopedStream(Stream const& stream, T const& t); - /** Overload for const char* to ensure immediate copy. - This prevents stack-use-after-scope issues when the source - pointer becomes invalid before the stream buffer operations - complete (e.g., during buffer reallocation). - */ - ScopedStream(Stream const& stream, char const* t); - ScopedStream(Stream const& stream, std::ostream& manip(std::ostream&)); ScopedStream& @@ -165,10 +159,9 @@ public: std::ostream& operator<<(T const& t) const; - /** Overload for const char* to ensure immediate copy. - This prevents stack-use-after-scope issues when the source - pointer becomes invalid before the stream buffer operations - complete (e.g., during buffer reallocation). + /** Overload for const char* for chained operations. + Handles cases like: stream << "text1" << "text2" + Converts to std::string to prevent stack-use-after-scope issues. */ std::ostream& operator<<(char const* t) const @@ -260,13 +253,14 @@ public: /** Overload for const char* to ensure immediate copy. This prevents stack-use-after-scope issues when the source - pointer becomes invalid before the stream buffer operations - complete (e.g., during buffer reallocation). + pointer becomes invalid due to coroutine context switches or + stack unwinding. Converts to std::string immediately to copy + the data before constructing ScopedStream. */ ScopedStream operator<<(char const* t) const { - return ScopedStream(*this, t); + return t ? ScopedStream(*this, std::string(t)) : ScopedStream(*this, std::string()); } /** @} */ diff --git a/sanitizers/suppressions/runtime-asan-options.txt b/sanitizers/suppressions/runtime-asan-options.txt index 35b323271d..f5decde9ad 100644 --- a/sanitizers/suppressions/runtime-asan-options.txt +++ b/sanitizers/suppressions/runtime-asan-options.txt @@ -1,5 +1,14 @@ detect_container_overflow=0 detect_stack_use_after_return=0 -detect_stack-buffer-overflow=0 debug=true -halt_on_error=false +halt_on_error=0 +# Extra verbosity and details for debugging +verbosity=1 +print_stats=true +print_legend=true +symbolize=true +print_cmdline=true +print_summary=true +# Deep stack traces (default is shallow/fast unwinding) +malloc_context_size=30 +fast_unwind_on_malloc=0 diff --git a/src/libxrpl/beast/utility/beast_Journal.cpp b/src/libxrpl/beast/utility/beast_Journal.cpp index e3e309ff1c..f9ee0cdb73 100644 --- a/src/libxrpl/beast/utility/beast_Journal.cpp +++ b/src/libxrpl/beast/utility/beast_Journal.cpp @@ -118,14 +118,6 @@ Journal::ScopedStream::ScopedStream(Stream const& stream, std::ostream& manip(st m_ostream << manip; } -Journal::ScopedStream::ScopedStream(Stream const& stream, char const* t) : ScopedStream(stream.sink(), stream.level()) -{ - // Convert to std::string immediately to ensure the data is copied. - // This prevents stack-use-after-scope issues when the source pointer - // becomes invalid before stream buffer operations(like reallocation) complete. - m_ostream << std::string(t); -} - Journal::ScopedStream::~ScopedStream() { std::string const& s(m_ostream.str()); diff --git a/src/libxrpl/shamap/SHAMapNodeID.cpp b/src/libxrpl/shamap/SHAMapNodeID.cpp index 6d6811cd63..a83c36813e 100644 --- a/src/libxrpl/shamap/SHAMapNodeID.cpp +++ b/src/libxrpl/shamap/SHAMapNodeID.cpp @@ -6,6 +6,10 @@ namespace xrpl { +// Returns a depth mask by value to avoid potential lifetime issues in +// multi-threaded contexts. Returning by const reference to a static member +// could trigger stack-use-after-scope errors when the reference is used in +// temporary expressions with operator& in concurrent coroutine scenarios. static uint256 const depthMask(unsigned int depth) { From 4600c381b9f0d4bb2a226fad1704ee97333fb08e Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Thu, 5 Feb 2026 16:34:45 +0000 Subject: [PATCH 11/61] stack-buffer-overflow in coroutines. Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> --- include/xrpl/core/Coro.ipp | 10 +++++++++- src/libxrpl/protocol/STAmount.cpp | 5 +++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/include/xrpl/core/Coro.ipp b/include/xrpl/core/Coro.ipp index eccb2c04cb..e0d88cb21e 100644 --- a/include/xrpl/core/Coro.ipp +++ b/include/xrpl/core/Coro.ipp @@ -4,6 +4,14 @@ namespace xrpl { +// Coroutine stack size is set to 2MB to provide sufficient headroom for +// deep call stacks in RPC operations. With 1MB, stack exhaustion occurred +// in production scenarios, particularly in: +// - RPC handlers processing complex JSON (ServerHandler::processRequest) +// - Transaction validation with deep parsing (TransactionSign::getCurrentNetworkFee) +// - Amount parsing with boost::split operations (amountFromJson) +// The 2MB stack provides ~50% safety margin even for the deepest observed +// call chains while keeping memory overhead reasonable (~2MB per coroutine). template JobQueue::Coro::Coro(Coro_create_t, JobQueue& jq, JobType type, std::string const& name, F&& f) : jq_(jq) @@ -19,7 +27,7 @@ JobQueue::Coro::Coro(Coro_create_t, JobQueue& jq, JobType type, std::string cons finished_ = true; #endif }, - boost::coroutines::attributes(megabytes(1))) + boost::coroutines::attributes(megabytes(2))) // 2MB stack (increased from 1MB) { } diff --git a/src/libxrpl/protocol/STAmount.cpp b/src/libxrpl/protocol/STAmount.cpp index b7c33bb907..f9ccbb85c3 100644 --- a/src/libxrpl/protocol/STAmount.cpp +++ b/src/libxrpl/protocol/STAmount.cpp @@ -984,7 +984,12 @@ amountFromJson(SField const& name, Json::Value const& v) else if (v.isString()) { std::string val = v.asString(); + // Pre-allocate to avoid reallocation during split. This function is often + // called deep in the RPC stack (via JSON parsing) where stack space is + // limited. ASAN detected stack-buffer-overflow here at ~95% coroutine + // stack usage (1001376/1048576 bytes). Coroutine stack increased to 2MB. std::vector elements; + elements.reserve(3); boost::split(elements, val, boost::is_any_of("\t\n\r ,/")); if (elements.size() > 3) From 0a626d95f435f603b89ba5bf95fe201c71088e7a Mon Sep 17 00:00:00 2001 From: Bart Date: Thu, 5 Feb 2026 11:45:57 -0500 Subject: [PATCH 12/61] refactor: Update secp256k1 to 0.7.1 (#6331) The latest secp256k1 release, 0.7.1, contains bug fixes that we may benefit from, see https://github.com/bitcoin-core/secp256k1/blob/master/CHANGELOG.md. --- conan.lock | 2 +- conanfile.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conan.lock b/conan.lock index 3b4d835564..900d3526e1 100644 --- a/conan.lock +++ b/conan.lock @@ -6,7 +6,7 @@ "sqlite3/3.49.1#8631739a4c9b93bd3d6b753bac548a63%1765850149.926", "soci/4.0.3#a9f8d773cd33e356b5879a4b0564f287%1765850149.46", "snappy/1.1.10#968fef506ff261592ec30c574d4a7809%1765850147.878", - "secp256k1/0.7.0#0fda78daa3b864deb8a2fbc083398356%1770226294.524", + "secp256k1/0.7.1#3a61e95e220062ef32c48d019e9c81f7%1770306721.686", "rocksdb/10.5.1#4a197eca381a3e5ae8adf8cffa5aacd0%1765850186.86", "re2/20230301#ca3b241baec15bd31ea9187150e0b333%1765850148.103", "protobuf/6.32.1#f481fd276fc23a33b85a3ed1e898b693%1765850161.038", diff --git a/conanfile.py b/conanfile.py index 4fb2deeec8..85406bf570 100644 --- a/conanfile.py +++ b/conanfile.py @@ -32,7 +32,7 @@ class Xrpl(ConanFile): "libarchive/3.8.1", "nudb/2.0.9", "openssl/3.5.5", - "secp256k1/0.7.0", + "secp256k1/0.7.1", "soci/4.0.3", "zlib/1.3.1", ] From 567433d2725a2e430c94c14f437892f3f8572d48 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Thu, 5 Feb 2026 16:47:20 +0000 Subject: [PATCH 13/61] removing comments from the asan options Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> --- sanitizers/suppressions/runtime-asan-options.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/sanitizers/suppressions/runtime-asan-options.txt b/sanitizers/suppressions/runtime-asan-options.txt index f5decde9ad..e339c79eca 100644 --- a/sanitizers/suppressions/runtime-asan-options.txt +++ b/sanitizers/suppressions/runtime-asan-options.txt @@ -2,13 +2,11 @@ detect_container_overflow=0 detect_stack_use_after_return=0 debug=true halt_on_error=0 -# Extra verbosity and details for debugging verbosity=1 print_stats=true print_legend=true symbolize=true print_cmdline=true print_summary=true -# Deep stack traces (default is shallow/fast unwinding) malloc_context_size=30 fast_unwind_on_malloc=0 From acca1c73cf6a2449cb50bb70c84b0108a1b79258 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Thu, 5 Feb 2026 17:24:01 +0000 Subject: [PATCH 14/61] reset verbosity back to 0 Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> --- sanitizers/suppressions/runtime-asan-options.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/sanitizers/suppressions/runtime-asan-options.txt b/sanitizers/suppressions/runtime-asan-options.txt index e339c79eca..3a75354278 100644 --- a/sanitizers/suppressions/runtime-asan-options.txt +++ b/sanitizers/suppressions/runtime-asan-options.txt @@ -2,7 +2,6 @@ detect_container_overflow=0 detect_stack_use_after_return=0 debug=true halt_on_error=0 -verbosity=1 print_stats=true print_legend=true symbolize=true From 127f44a40b36e2db45049d37ee6ae50cebea0b65 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Thu, 5 Feb 2026 18:19:32 +0000 Subject: [PATCH 15/61] fix stack-use-after-scope issue Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> --- src/libxrpl/protocol/STParsedJSON.cpp | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/libxrpl/protocol/STParsedJSON.cpp b/src/libxrpl/protocol/STParsedJSON.cpp index 1c25e6d94a..3fb2825581 100644 --- a/src/libxrpl/protocol/STParsedJSON.cpp +++ b/src/libxrpl/protocol/STParsedJSON.cpp @@ -69,13 +69,16 @@ make_name(std::string const& object, std::string const& field) if (field.empty()) return object; - return {object + "." + field}; + return object + "." + field; } +// Note: Store make_name() result in a local variable before string concatenation +// to prevent stack-use-after-scope when the temporary is used in chained operations static inline Json::Value not_an_object(std::string const& object, std::string const& field) { - return RPC::make_error(rpcINVALID_PARAMS, "Field '" + make_name(object, field) + "' is not a JSON object."); + auto const fieldName = make_name(object, field); + return RPC::make_error(rpcINVALID_PARAMS, "Field '" + fieldName + "' is not a JSON object."); } static inline Json::Value @@ -93,25 +96,29 @@ not_an_array(std::string const& object) static inline Json::Value unknown_field(std::string const& object, std::string const& field) { - return RPC::make_error(rpcINVALID_PARAMS, "Field '" + make_name(object, field) + "' is unknown."); + auto const fieldName = make_name(object, field); + return RPC::make_error(rpcINVALID_PARAMS, "Field '" + fieldName + "' is unknown."); } static inline Json::Value out_of_range(std::string const& object, std::string const& field) { - return RPC::make_error(rpcINVALID_PARAMS, "Field '" + make_name(object, field) + "' is out of range."); + auto const fieldName = make_name(object, field); + return RPC::make_error(rpcINVALID_PARAMS, "Field '" + fieldName + "' is out of range."); } static inline Json::Value bad_type(std::string const& object, std::string const& field) { - return RPC::make_error(rpcINVALID_PARAMS, "Field '" + make_name(object, field) + "' has bad type."); + auto const fieldName = make_name(object, field); + return RPC::make_error(rpcINVALID_PARAMS, "Field '" + fieldName + "' has bad type."); } static inline Json::Value invalid_data(std::string const& object, std::string const& field) { - return RPC::make_error(rpcINVALID_PARAMS, "Field '" + make_name(object, field) + "' has invalid data."); + auto const fieldName = make_name(object, field); + return RPC::make_error(rpcINVALID_PARAMS, "Field '" + fieldName + "' has invalid data."); } static inline Json::Value @@ -123,13 +130,15 @@ invalid_data(std::string const& object) static inline Json::Value array_expected(std::string const& object, std::string const& field) { - return RPC::make_error(rpcINVALID_PARAMS, "Field '" + make_name(object, field) + "' must be a JSON array."); + auto const fieldName = make_name(object, field); + return RPC::make_error(rpcINVALID_PARAMS, "Field '" + fieldName + "' must be a JSON array."); } static inline Json::Value string_expected(std::string const& object, std::string const& field) { - return RPC::make_error(rpcINVALID_PARAMS, "Field '" + make_name(object, field) + "' must be a string."); + auto const fieldName = make_name(object, field); + return RPC::make_error(rpcINVALID_PARAMS, "Field '" + fieldName + "' must be a string."); } static inline Json::Value From 1a14b813b818cef2c901ad7746b77301df884ad1 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Thu, 5 Feb 2026 19:08:34 +0000 Subject: [PATCH 16/61] removed malloc_context_size=30, fast_unwind_on_malloc=0 because they were slowing down the runs Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> --- sanitizers/suppressions/runtime-asan-options.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/sanitizers/suppressions/runtime-asan-options.txt b/sanitizers/suppressions/runtime-asan-options.txt index 3a75354278..04a1d36d03 100644 --- a/sanitizers/suppressions/runtime-asan-options.txt +++ b/sanitizers/suppressions/runtime-asan-options.txt @@ -7,5 +7,3 @@ print_legend=true symbolize=true print_cmdline=true print_summary=true -malloc_context_size=30 -fast_unwind_on_malloc=0 From 14e3e098d58aaec62a6021037cca08181cf11810 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Fri, 6 Feb 2026 11:57:52 +0000 Subject: [PATCH 17/61] change coroutine stack size to 4MB. Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> --- include/xrpl/core/Coro.ipp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/xrpl/core/Coro.ipp b/include/xrpl/core/Coro.ipp index e0d88cb21e..70e4681043 100644 --- a/include/xrpl/core/Coro.ipp +++ b/include/xrpl/core/Coro.ipp @@ -27,7 +27,7 @@ JobQueue::Coro::Coro(Coro_create_t, JobQueue& jq, JobType type, std::string cons finished_ = true; #endif }, - boost::coroutines::attributes(megabytes(2))) // 2MB stack (increased from 1MB) + boost::coroutines::attributes(megabytes(4))) // 4MB stack (increased from 1MB) { } From 65ba439117d769114b17f3c67adf0ecd308d8ff5 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Fri, 6 Feb 2026 12:30:17 +0000 Subject: [PATCH 18/61] cache strings to solve stack-use-after-scope Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> --- src/libxrpl/protocol/STParsedJSON.cpp | 21 ++++++++++++++------- src/xrpld/app/paths/detail/AMMLiquidity.cpp | 10 ++++++++-- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/libxrpl/protocol/STParsedJSON.cpp b/src/libxrpl/protocol/STParsedJSON.cpp index 3fb2825581..b928f0dbd8 100644 --- a/src/libxrpl/protocol/STParsedJSON.cpp +++ b/src/libxrpl/protocol/STParsedJSON.cpp @@ -78,7 +78,8 @@ static inline Json::Value not_an_object(std::string const& object, std::string const& field) { auto const fieldName = make_name(object, field); - return RPC::make_error(rpcINVALID_PARAMS, "Field '" + fieldName + "' is not a JSON object."); + std::string const msg = "Field '" + fieldName + "' is not a JSON object."; + return RPC::make_error(rpcINVALID_PARAMS, msg); } static inline Json::Value @@ -97,28 +98,32 @@ static inline Json::Value unknown_field(std::string const& object, std::string const& field) { auto const fieldName = make_name(object, field); - return RPC::make_error(rpcINVALID_PARAMS, "Field '" + fieldName + "' is unknown."); + std::string const msg = "Field '" + fieldName + "' is unknown."; + return RPC::make_error(rpcINVALID_PARAMS, msg); } static inline Json::Value out_of_range(std::string const& object, std::string const& field) { auto const fieldName = make_name(object, field); - return RPC::make_error(rpcINVALID_PARAMS, "Field '" + fieldName + "' is out of range."); + std::string const msg = "Field '" + fieldName + "' is out of range."; + return RPC::make_error(rpcINVALID_PARAMS, msg); } static inline Json::Value bad_type(std::string const& object, std::string const& field) { auto const fieldName = make_name(object, field); - return RPC::make_error(rpcINVALID_PARAMS, "Field '" + fieldName + "' has bad type."); + std::string const msg = "Field '" + fieldName + "' has bad type."; + return RPC::make_error(rpcINVALID_PARAMS, msg); } static inline Json::Value invalid_data(std::string const& object, std::string const& field) { auto const fieldName = make_name(object, field); - return RPC::make_error(rpcINVALID_PARAMS, "Field '" + fieldName + "' has invalid data."); + std::string const msg = "Field '" + fieldName + "' has invalid data."; + return RPC::make_error(rpcINVALID_PARAMS, msg); } static inline Json::Value @@ -131,14 +136,16 @@ static inline Json::Value array_expected(std::string const& object, std::string const& field) { auto const fieldName = make_name(object, field); - return RPC::make_error(rpcINVALID_PARAMS, "Field '" + fieldName + "' must be a JSON array."); + std::string const msg = "Field '" + fieldName + "' must be a JSON array."; + return RPC::make_error(rpcINVALID_PARAMS, msg); } static inline Json::Value string_expected(std::string const& object, std::string const& field) { auto const fieldName = make_name(object, field); - return RPC::make_error(rpcINVALID_PARAMS, "Field '" + fieldName + "' must be a string."); + std::string const msg = "Field '" + fieldName + "' must be a string."; + return RPC::make_error(rpcINVALID_PARAMS, msg); } static inline Json::Value diff --git a/src/xrpld/app/paths/detail/AMMLiquidity.cpp b/src/xrpld/app/paths/detail/AMMLiquidity.cpp index ebbb51ce25..97c4ea7c47 100644 --- a/src/xrpld/app/paths/detail/AMMLiquidity.cpp +++ b/src/xrpld/app/paths/detail/AMMLiquidity.cpp @@ -179,7 +179,10 @@ AMMLiquidity::getOffer(ReadView const& view, std::optional c } catch (std::overflow_error const& e) { - JLOG(j_.error()) << "AMMLiquidity::getOffer overflow " << e.what(); + // Store e.what() in a local variable to prevent stack-use-after-scope + // when the exception's internal storage becomes invalid in coroutine context + std::string const errorMsg = e.what(); + JLOG(j_.error()) << "AMMLiquidity::getOffer overflow " << errorMsg; if (!view.rules().enabled(fixAMMOverflowOffer)) return maxOffer(balances, view.rules()); else @@ -187,7 +190,10 @@ AMMLiquidity::getOffer(ReadView const& view, std::optional c } catch (std::exception const& e) { - JLOG(j_.error()) << "AMMLiquidity::getOffer exception " << e.what(); + // Store e.what() in a local variable to prevent stack-use-after-scope + // when the exception's internal storage becomes invalid in coroutine context + std::string const errorMsg = e.what(); + JLOG(j_.error()) << "AMMLiquidity::getOffer exception " << errorMsg; } return std::nullopt; }(); From 69597e4b3bbbc14c37a7a5b86a04b8d02c969382 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Fri, 6 Feb 2026 13:46:04 +0000 Subject: [PATCH 19/61] switch to coroutine2 and remove string caching Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> --- cmake/XrplConfig.cmake | 2 +- cmake/XrplInterface.cmake | 2 +- cmake/deps/Boost.cmake | 5 ++- conanfile.py | 9 +++++- include/xrpl/beast/utility/Journal.h | 24 -------------- include/xrpl/core/Coro.ipp | 14 ++++---- include/xrpl/core/JobQueue.h | 6 ++-- .../suppressions/runtime-asan-options.txt | 3 +- src/libxrpl/protocol/STParsedJSON.cpp | 32 +++++-------------- src/xrpld/app/paths/detail/AMMLiquidity.cpp | 10 ++---- 10 files changed, 33 insertions(+), 74 deletions(-) diff --git a/cmake/XrplConfig.cmake b/cmake/XrplConfig.cmake index bf6aa475ba..b1cfeac387 100644 --- a/cmake/XrplConfig.cmake +++ b/cmake/XrplConfig.cmake @@ -17,7 +17,7 @@ find_dependency(Boost chrono container context - coroutine + coroutine2 date_time filesystem program_options diff --git a/cmake/XrplInterface.cmake b/cmake/XrplInterface.cmake index f471b37dd7..b89b1f7060 100644 --- a/cmake/XrplInterface.cmake +++ b/cmake/XrplInterface.cmake @@ -22,7 +22,7 @@ target_compile_definitions( BOOST_FILESYSTEM_NO_DEPRECATED > $<$>: - BOOST_COROUTINES_NO_DEPRECATION_WARNING + BOOST_COROUTINES2_NO_DEPRECATION_WARNING BOOST_BEAST_ALLOW_DEPRECATED BOOST_FILESYSTEM_DEPRECATED > diff --git a/cmake/deps/Boost.cmake b/cmake/deps/Boost.cmake index dc3c835cae..fca1bc26e3 100644 --- a/cmake/deps/Boost.cmake +++ b/cmake/deps/Boost.cmake @@ -4,13 +4,12 @@ include(XrplSanitizers) find_package(Boost REQUIRED COMPONENTS chrono container - coroutine + context date_time filesystem json program_options regex - system thread) add_library(xrpl_boost INTERFACE) @@ -21,7 +20,7 @@ target_link_libraries( INTERFACE Boost::headers Boost::chrono Boost::container - Boost::coroutine + Boost::context Boost::date_time Boost::filesystem Boost::json diff --git a/conanfile.py b/conanfile.py index 22f7721e1f..d582471ef5 100644 --- a/conanfile.py +++ b/conanfile.py @@ -56,6 +56,9 @@ class Xrpl(ConanFile): "static": True, "tests": False, "xrpld": False, + "boost/*:without_context": False, + "boost/*:without_coroutine": True, + "boost/*:without_coroutine2": False, "date/*:header_only": True, "ed25519/*:shared": False, "grpc/*:shared": False, @@ -124,6 +127,9 @@ class Xrpl(ConanFile): self.options["boost"].visibility = "global" if self.settings.compiler in ["clang", "gcc"]: self.options["boost"].without_cobalt = True + self.options["boost"].without_context = False + self.options["boost"].without_coroutine = True + self.options["boost"].without_coroutine2 = False # Check if environment variable exists if "SANITIZERS" in os.environ: @@ -200,7 +206,8 @@ class Xrpl(ConanFile): "boost::headers", "boost::chrono", "boost::container", - "boost::coroutine", + "boost::context", + "boost::coroutine2", "boost::date_time", "boost::filesystem", "boost::json", diff --git a/include/xrpl/beast/utility/Journal.h b/include/xrpl/beast/utility/Journal.h index 6ce3f0a4da..dff88826ce 100644 --- a/include/xrpl/beast/utility/Journal.h +++ b/include/xrpl/beast/utility/Journal.h @@ -3,7 +3,6 @@ #include #include -#include namespace beast { @@ -159,17 +158,6 @@ public: std::ostream& operator<<(T const& t) const; - /** Overload for const char* for chained operations. - Handles cases like: stream << "text1" << "text2" - Converts to std::string to prevent stack-use-after-scope issues. - */ - std::ostream& - operator<<(char const* t) const - { - m_ostream << std::string(t); - return m_ostream; - } - private: Sink& m_sink; Severity const m_level; @@ -250,18 +238,6 @@ public: template ScopedStream operator<<(T const& t) const; - - /** Overload for const char* to ensure immediate copy. - This prevents stack-use-after-scope issues when the source - pointer becomes invalid due to coroutine context switches or - stack unwinding. Converts to std::string immediately to copy - the data before constructing ScopedStream. - */ - ScopedStream - operator<<(char const* t) const - { - return t ? ScopedStream(*this, std::string(t)) : ScopedStream(*this, std::string()); - } /** @} */ private: diff --git a/include/xrpl/core/Coro.ipp b/include/xrpl/core/Coro.ipp index 70e4681043..2f794995a8 100644 --- a/include/xrpl/core/Coro.ipp +++ b/include/xrpl/core/Coro.ipp @@ -18,16 +18,14 @@ JobQueue::Coro::Coro(Coro_create_t, JobQueue& jq, JobType type, std::string cons , type_(type) , name_(name) , running_(false) - , coro_( - [this, fn = std::forward(f)](boost::coroutines::asymmetric_coroutine::push_type& do_yield) { - yield_ = &do_yield; - yield(); - fn(shared_from_this()); + , coro_([this, fn = std::forward(f)](boost::coroutines2::asymmetric_coroutine::push_type& do_yield) { + yield_ = &do_yield; + yield(); + fn(shared_from_this()); #ifndef NDEBUG - finished_ = true; + finished_ = true; #endif - }, - boost::coroutines::attributes(megabytes(4))) // 4MB stack (increased from 1MB) + }) { } diff --git a/include/xrpl/core/JobQueue.h b/include/xrpl/core/JobQueue.h index b410e200e1..c290f52f91 100644 --- a/include/xrpl/core/JobQueue.h +++ b/include/xrpl/core/JobQueue.h @@ -7,7 +7,7 @@ #include #include -#include +#include #include @@ -48,8 +48,8 @@ public: std::mutex mutex_; std::mutex mutex_run_; std::condition_variable cv_; - boost::coroutines::asymmetric_coroutine::pull_type coro_; - boost::coroutines::asymmetric_coroutine::push_type* yield_; + boost::coroutines2::asymmetric_coroutine::pull_type coro_; + boost::coroutines2::asymmetric_coroutine::push_type* yield_; #ifndef NDEBUG bool finished_ = false; #endif diff --git a/sanitizers/suppressions/runtime-asan-options.txt b/sanitizers/suppressions/runtime-asan-options.txt index 04a1d36d03..9cfe04e2d1 100644 --- a/sanitizers/suppressions/runtime-asan-options.txt +++ b/sanitizers/suppressions/runtime-asan-options.txt @@ -1,7 +1,8 @@ detect_container_overflow=0 detect_stack_use_after_return=0 +detect_stack-buffer-overflow=0 debug=true -halt_on_error=0 +halt_on_error=false print_stats=true print_legend=true symbolize=true diff --git a/src/libxrpl/protocol/STParsedJSON.cpp b/src/libxrpl/protocol/STParsedJSON.cpp index b928f0dbd8..1c25e6d94a 100644 --- a/src/libxrpl/protocol/STParsedJSON.cpp +++ b/src/libxrpl/protocol/STParsedJSON.cpp @@ -69,17 +69,13 @@ make_name(std::string const& object, std::string const& field) if (field.empty()) return object; - return object + "." + field; + return {object + "." + field}; } -// Note: Store make_name() result in a local variable before string concatenation -// to prevent stack-use-after-scope when the temporary is used in chained operations static inline Json::Value not_an_object(std::string const& object, std::string const& field) { - auto const fieldName = make_name(object, field); - std::string const msg = "Field '" + fieldName + "' is not a JSON object."; - return RPC::make_error(rpcINVALID_PARAMS, msg); + return RPC::make_error(rpcINVALID_PARAMS, "Field '" + make_name(object, field) + "' is not a JSON object."); } static inline Json::Value @@ -97,33 +93,25 @@ not_an_array(std::string const& object) static inline Json::Value unknown_field(std::string const& object, std::string const& field) { - auto const fieldName = make_name(object, field); - std::string const msg = "Field '" + fieldName + "' is unknown."; - return RPC::make_error(rpcINVALID_PARAMS, msg); + return RPC::make_error(rpcINVALID_PARAMS, "Field '" + make_name(object, field) + "' is unknown."); } static inline Json::Value out_of_range(std::string const& object, std::string const& field) { - auto const fieldName = make_name(object, field); - std::string const msg = "Field '" + fieldName + "' is out of range."; - return RPC::make_error(rpcINVALID_PARAMS, msg); + return RPC::make_error(rpcINVALID_PARAMS, "Field '" + make_name(object, field) + "' is out of range."); } static inline Json::Value bad_type(std::string const& object, std::string const& field) { - auto const fieldName = make_name(object, field); - std::string const msg = "Field '" + fieldName + "' has bad type."; - return RPC::make_error(rpcINVALID_PARAMS, msg); + return RPC::make_error(rpcINVALID_PARAMS, "Field '" + make_name(object, field) + "' has bad type."); } static inline Json::Value invalid_data(std::string const& object, std::string const& field) { - auto const fieldName = make_name(object, field); - std::string const msg = "Field '" + fieldName + "' has invalid data."; - return RPC::make_error(rpcINVALID_PARAMS, msg); + return RPC::make_error(rpcINVALID_PARAMS, "Field '" + make_name(object, field) + "' has invalid data."); } static inline Json::Value @@ -135,17 +123,13 @@ invalid_data(std::string const& object) static inline Json::Value array_expected(std::string const& object, std::string const& field) { - auto const fieldName = make_name(object, field); - std::string const msg = "Field '" + fieldName + "' must be a JSON array."; - return RPC::make_error(rpcINVALID_PARAMS, msg); + return RPC::make_error(rpcINVALID_PARAMS, "Field '" + make_name(object, field) + "' must be a JSON array."); } static inline Json::Value string_expected(std::string const& object, std::string const& field) { - auto const fieldName = make_name(object, field); - std::string const msg = "Field '" + fieldName + "' must be a string."; - return RPC::make_error(rpcINVALID_PARAMS, msg); + return RPC::make_error(rpcINVALID_PARAMS, "Field '" + make_name(object, field) + "' must be a string."); } static inline Json::Value diff --git a/src/xrpld/app/paths/detail/AMMLiquidity.cpp b/src/xrpld/app/paths/detail/AMMLiquidity.cpp index 97c4ea7c47..ebbb51ce25 100644 --- a/src/xrpld/app/paths/detail/AMMLiquidity.cpp +++ b/src/xrpld/app/paths/detail/AMMLiquidity.cpp @@ -179,10 +179,7 @@ AMMLiquidity::getOffer(ReadView const& view, std::optional c } catch (std::overflow_error const& e) { - // Store e.what() in a local variable to prevent stack-use-after-scope - // when the exception's internal storage becomes invalid in coroutine context - std::string const errorMsg = e.what(); - JLOG(j_.error()) << "AMMLiquidity::getOffer overflow " << errorMsg; + JLOG(j_.error()) << "AMMLiquidity::getOffer overflow " << e.what(); if (!view.rules().enabled(fixAMMOverflowOffer)) return maxOffer(balances, view.rules()); else @@ -190,10 +187,7 @@ AMMLiquidity::getOffer(ReadView const& view, std::optional c } catch (std::exception const& e) { - // Store e.what() in a local variable to prevent stack-use-after-scope - // when the exception's internal storage becomes invalid in coroutine context - std::string const errorMsg = e.what(); - JLOG(j_.error()) << "AMMLiquidity::getOffer exception " << errorMsg; + JLOG(j_.error()) << "AMMLiquidity::getOffer exception " << e.what(); } return std::nullopt; }(); From 25d7c2c4ec7580db602145c258ff49463a58f14a Mon Sep 17 00:00:00 2001 From: Bart Date: Fri, 6 Feb 2026 09:12:45 -0500 Subject: [PATCH 20/61] chore: Restore unity builds (#6328) In certain cases, such as when modifying headers used by many compilation units, performing a unity build is slower than when performing a regular build with `ccache` enabled. There is also a benefit to a unity build in that it can detect things such as macro redefinitions within the group of files that are compiled together as a unit. This change therefore restores the ability to perform unity builds. However, instead of running every configuration with and without unity enabled, it is now only enabled for a single configuration to maintain lower computational use. As part of restoring the code, it became clear that currently two configurations have coverage enabled, since the check doesn't focus specifically on Debian Bookworm so it also applies to Debian Trixie. This has been fixed too in this change. --- .github/scripts/strategy-matrix/generate.py | 17 +++++++++++++++-- BUILD.md | 7 +++++++ cmake/XrplCore.cmake | 5 +++++ cmake/XrplSettings.cmake | 8 ++++++++ conanfile.py | 3 +++ src/libxrpl/net/RegisterSSLCerts.cpp | 3 +-- 6 files changed, 39 insertions(+), 4 deletions(-) diff --git a/.github/scripts/strategy-matrix/generate.py b/.github/scripts/strategy-matrix/generate.py index 75847b4d9d..27eb60c005 100755 --- a/.github/scripts/strategy-matrix/generate.py +++ b/.github/scripts/strategy-matrix/generate.py @@ -196,11 +196,22 @@ def generate_strategy_matrix(all: bool, config: Config) -> list: # Enable code coverage for Debian Bookworm using GCC 15 in Debug on # linux/amd64 if ( - f"{os['compiler_name']}-{os['compiler_version']}" == "gcc-15" + f"{os['distro_name']}-{os['distro_version']}" == "debian-bookworm" + and f"{os['compiler_name']}-{os['compiler_version']}" == "gcc-15" and build_type == "Debug" and architecture["platform"] == "linux/amd64" ): - cmake_args = f"-Dcoverage=ON -Dcoverage_format=xml -DCODE_COVERAGE_VERBOSE=ON -DCMAKE_C_FLAGS=-O0 -DCMAKE_CXX_FLAGS=-O0 {cmake_args}" + cmake_args = f"{cmake_args} -Dcoverage=ON -Dcoverage_format=xml -DCODE_COVERAGE_VERBOSE=ON -DCMAKE_C_FLAGS=-O0 -DCMAKE_CXX_FLAGS=-O0" + + # Enable unity build for Ubuntu Jammy using GCC 12 in Debug on + # linux/amd64. + if ( + f"{os['distro_name']}-{os['distro_version']}" == "ubuntu-jammy" + and f"{os['compiler_name']}-{os['compiler_version']}" == "gcc-12" + and build_type == "Debug" + and architecture["platform"] == "linux/amd64" + ): + cmake_args = f"{cmake_args} -Dunity=ON" # Generate a unique name for the configuration, e.g. macos-arm64-debug # or debian-bookworm-gcc-12-amd64-release. @@ -217,6 +228,8 @@ def generate_strategy_matrix(all: bool, config: Config) -> list: config_name += f"-{build_type.lower()}" if "-Dcoverage=ON" in cmake_args: config_name += "-coverage" + if "-Dunity=ON" in cmake_args: + config_name += "-unity" # 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 diff --git a/BUILD.md b/BUILD.md index 35668aeabd..4d01700a61 100644 --- a/BUILD.md +++ b/BUILD.md @@ -575,10 +575,16 @@ See [Sanitizers docs](./docs/build/sanitizers.md) for more details. | `assert` | OFF | Enable assertions. | | `coverage` | OFF | Prepare the coverage report. | | `tests` | OFF | Build tests. | +| `unity` | OFF | Configure a unity build. | | `xrpld` | OFF | Build the xrpld application, and not just the libxrpl library. | | `werr` | OFF | Treat compilation warnings as errors | | `wextra` | OFF | Enable additional compilation warnings | +[Unity builds][5] may be faster for the first build (at the cost of much more +memory) since they concatenate sources into fewer translation units. Non-unity +builds may be faster for incremental builds, and can be helpful for detecting +`#include` omissions. + ## Troubleshooting ### Conan @@ -645,6 +651,7 @@ If you want to experiment with a new package, follow these steps: [1]: https://github.com/conan-io/conan-center-index/issues/13168 [2]: https://en.cppreference.com/w/cpp/compiler_support/20 [3]: https://docs.conan.io/en/latest/getting_started.html +[5]: https://en.wikipedia.org/wiki/Unity_build [6]: https://github.com/boostorg/beast/issues/2648 [7]: https://github.com/boostorg/beast/issues/2661 [gcovr]: https://gcovr.com/en/stable/getting-started.html diff --git a/cmake/XrplCore.cmake b/cmake/XrplCore.cmake index afefa8457d..57d0e83348 100644 --- a/cmake/XrplCore.cmake +++ b/cmake/XrplCore.cmake @@ -4,7 +4,12 @@ include(target_protobuf_sources) +# Protocol buffers cannot participate in a unity build, +# because all the generated sources +# define a bunch of `static const` variables with the same names, +# so we just build them as a separate library. add_library(xrpl.libpb) +set_target_properties(xrpl.libpb PROPERTIES UNITY_BUILD OFF) target_protobuf_sources(xrpl.libpb xrpl/proto LANGUAGE cpp IMPORT_DIRS include/xrpl/proto PROTOS include/xrpl/proto/xrpl.proto) diff --git a/cmake/XrplSettings.cmake b/cmake/XrplSettings.cmake index 0957e41918..6d332be19d 100644 --- a/cmake/XrplSettings.cmake +++ b/cmake/XrplSettings.cmake @@ -30,6 +30,14 @@ if (tests) endif () endif () +option(unity "Creates a build using UNITY support in cmake." OFF) +if (unity) + if (NOT is_ci) + set(CMAKE_UNITY_BUILD_BATCH_SIZE 15 CACHE STRING "") + endif () + set(CMAKE_UNITY_BUILD ON CACHE BOOL "Do a unity build") +endif () + if (is_clang AND is_linux) option(voidstar "Enable Antithesis instrumentation." OFF) endif () diff --git a/conanfile.py b/conanfile.py index 85406bf570..7300b537d9 100644 --- a/conanfile.py +++ b/conanfile.py @@ -23,6 +23,7 @@ class Xrpl(ConanFile): "shared": [True, False], "static": [True, False], "tests": [True, False], + "unity": [True, False], "xrpld": [True, False], } @@ -54,6 +55,7 @@ class Xrpl(ConanFile): "shared": False, "static": True, "tests": False, + "unity": False, "xrpld": False, "date/*:header_only": True, "ed25519/*:shared": False, @@ -166,6 +168,7 @@ class Xrpl(ConanFile): tc.variables["rocksdb"] = self.options.rocksdb tc.variables["BUILD_SHARED_LIBS"] = self.options.shared tc.variables["static"] = self.options.static + tc.variables["unity"] = self.options.unity tc.variables["xrpld"] = self.options.xrpld tc.generate() diff --git a/src/libxrpl/net/RegisterSSLCerts.cpp b/src/libxrpl/net/RegisterSSLCerts.cpp index 1b97a17e5c..a15472969e 100644 --- a/src/libxrpl/net/RegisterSSLCerts.cpp +++ b/src/libxrpl/net/RegisterSSLCerts.cpp @@ -85,8 +85,7 @@ registerSSLCerts(boost::asio::ssl::context& ctx, boost::system::error_code& ec, // There is a very unpleasant interaction between and // openssl x509 types (namely the former has macros that stomp // on the latter), these undefs allow this TU to be safely used in -// unity builds without messing up subsequent TUs. Although we -// no longer use unity builds, leaving the undefs here does no harm. +// unity builds without messing up subsequent TUs. #if BOOST_OS_WINDOWS #undef X509_NAME #undef X509_EXTENSIONS From 677758b1cc9d8afc190582a75160425096708f54 Mon Sep 17 00:00:00 2001 From: Bart Date: Fri, 6 Feb 2026 09:42:35 -0500 Subject: [PATCH 21/61] perf: Remove unnecessary caches (#5439) This change removes the cache in `DatabaseNodeImp` and simplifies the caching logic in `SHAMapStoreImp`. As NuDB and RocksDB internally already use caches, additional caches in the code are not very valuable or may even be unnecessary, as also confirmed during preliminary performance analyses. --- cfg/xrpld-example.cfg | 20 +-- include/xrpl/nodestore/Database.h | 4 - .../xrpl/nodestore/detail/DatabaseNodeImp.h | 32 ---- .../nodestore/detail/DatabaseRotatingImp.h | 3 - src/libxrpl/nodestore/DatabaseNodeImp.cpp | 148 +++++------------- src/libxrpl/nodestore/DatabaseRotatingImp.cpp | 6 - src/test/app/SHAMapStore_test.cpp | 18 +-- src/xrpld/app/main/Application.cpp | 4 - src/xrpld/app/misc/SHAMapStoreImp.cpp | 21 +-- src/xrpld/app/misc/SHAMapStoreImp.h | 2 - 10 files changed, 47 insertions(+), 211 deletions(-) diff --git a/cfg/xrpld-example.cfg b/cfg/xrpld-example.cfg index 93fab4a9ba..995d4e65ff 100644 --- a/cfg/xrpld-example.cfg +++ b/cfg/xrpld-example.cfg @@ -940,23 +940,7 @@ # # path Location to store the database # -# Optional keys -# -# cache_size Size of cache for database records. Default is 16384. -# Setting this value to 0 will use the default value. -# -# cache_age Length of time in minutes to keep database records -# cached. Default is 5 minutes. Setting this value to -# 0 will use the default value. -# -# Note: if neither cache_size nor cache_age is -# specified, the cache for database records will not -# be created. If only one of cache_size or cache_age -# is specified, the cache will be created using the -# default value for the unspecified parameter. -# -# Note: the cache will not be created if online_delete -# is specified. +# Optional keys for NuDB and RocksDB: # # fast_load Boolean. If set, load the last persisted ledger # from disk upon process start before syncing to @@ -964,8 +948,6 @@ # if sufficient IOPS capacity is available. # Default 0. # -# Optional keys for NuDB or RocksDB: -# # earliest_seq The default is 32570 to match the XRP ledger # network's earliest allowed sequence. Alternate # networks may set this value. Minimum value of 1. diff --git a/include/xrpl/nodestore/Database.h b/include/xrpl/nodestore/Database.h index d3dafff85d..d1f5b1bda2 100644 --- a/include/xrpl/nodestore/Database.h +++ b/include/xrpl/nodestore/Database.h @@ -133,10 +133,6 @@ public: std::uint32_t ledgerSeq, std::function const&)>&& callback); - /** Remove expired entries from the positive and negative caches. */ - virtual void - sweep() = 0; - /** Gather statistics pertaining to read and write activities. * * @param obj Json object reference into which to place counters. diff --git a/include/xrpl/nodestore/detail/DatabaseNodeImp.h b/include/xrpl/nodestore/detail/DatabaseNodeImp.h index dd6b8f9ddd..94859c4d22 100644 --- a/include/xrpl/nodestore/detail/DatabaseNodeImp.h +++ b/include/xrpl/nodestore/detail/DatabaseNodeImp.h @@ -23,32 +23,6 @@ public: beast::Journal j) : Database(scheduler, readThreads, config, j), backend_(std::move(backend)) { - std::optional cacheSize, cacheAge; - - if (config.exists("cache_size")) - { - cacheSize = get(config, "cache_size"); - if (cacheSize.value() < 0) - { - Throw("Specified negative value for cache_size"); - } - } - - if (config.exists("cache_age")) - { - cacheAge = get(config, "cache_age"); - if (cacheAge.value() < 0) - { - Throw("Specified negative value for cache_age"); - } - } - - if (cacheSize != 0 || cacheAge != 0) - { - cache_ = std::make_shared>( - "DatabaseNodeImp", cacheSize.value_or(0), std::chrono::minutes(cacheAge.value_or(0)), stopwatch(), j); - } - XRPL_ASSERT( backend_, "xrpl::NodeStore::DatabaseNodeImp::DatabaseNodeImp : non-null " @@ -103,13 +77,7 @@ public: std::uint32_t ledgerSeq, std::function const&)>&& callback) override; - void - sweep() override; - private: - // Cache for database objects. This cache is not always initialized. Check - // for null before using. - std::shared_ptr> cache_; // Persistent key/value storage std::shared_ptr backend_; diff --git a/include/xrpl/nodestore/detail/DatabaseRotatingImp.h b/include/xrpl/nodestore/detail/DatabaseRotatingImp.h index e49c195d67..1a378c54c7 100644 --- a/include/xrpl/nodestore/detail/DatabaseRotatingImp.h +++ b/include/xrpl/nodestore/detail/DatabaseRotatingImp.h @@ -55,9 +55,6 @@ public: void sync() override; - void - sweep() override; - private: std::shared_ptr writableBackend_; std::shared_ptr archiveBackend_; diff --git a/src/libxrpl/nodestore/DatabaseNodeImp.cpp b/src/libxrpl/nodestore/DatabaseNodeImp.cpp index f49867514c..11152a2027 100644 --- a/src/libxrpl/nodestore/DatabaseNodeImp.cpp +++ b/src/libxrpl/nodestore/DatabaseNodeImp.cpp @@ -10,11 +10,6 @@ DatabaseNodeImp::store(NodeObjectType type, Blob&& data, uint256 const& hash, st auto obj = NodeObject::createObject(type, std::move(data), hash); backend_->store(obj); - if (cache_) - { - // After the store, replace a negative cache entry if there is one - cache_->canonicalize(hash, obj, [](std::shared_ptr const& n) { return n->getType() == hotDUMMY; }); - } } void @@ -23,77 +18,36 @@ DatabaseNodeImp::asyncFetch( std::uint32_t ledgerSeq, std::function const&)>&& callback) { - if (cache_) - { - std::shared_ptr obj = cache_->fetch(hash); - if (obj) - { - callback(obj->getType() == hotDUMMY ? nullptr : obj); - return; - } - } Database::asyncFetch(hash, ledgerSeq, std::move(callback)); } -void -DatabaseNodeImp::sweep() -{ - if (cache_) - cache_->sweep(); -} - std::shared_ptr DatabaseNodeImp::fetchNodeObject(uint256 const& hash, std::uint32_t, FetchReport& fetchReport, bool duplicate) { - std::shared_ptr nodeObject = cache_ ? cache_->fetch(hash) : nullptr; + std::shared_ptr nodeObject = nullptr; + Status status; - if (!nodeObject) + try { - JLOG(j_.trace()) << "fetchNodeObject " << hash << ": record not " << (cache_ ? "cached" : "found"); - - Status status; - - try - { - status = backend_->fetch(hash.data(), &nodeObject); - } - catch (std::exception const& e) - { - JLOG(j_.fatal()) << "fetchNodeObject " << hash << ": Exception fetching from backend: " << e.what(); - Rethrow(); - } - - switch (status) - { - case ok: - if (cache_) - { - if (nodeObject) - cache_->canonicalize_replace_client(hash, nodeObject); - else - { - auto notFound = NodeObject::createObject(hotDUMMY, {}, hash); - cache_->canonicalize_replace_client(hash, notFound); - if (notFound->getType() != hotDUMMY) - nodeObject = notFound; - } - } - break; - case notFound: - break; - case dataCorrupt: - JLOG(j_.fatal()) << "fetchNodeObject " << hash << ": nodestore data is corrupted"; - break; - default: - JLOG(j_.warn()) << "fetchNodeObject " << hash << ": backend returns unknown result " << status; - break; - } + status = backend_->fetch(hash.data(), &nodeObject); } - else + catch (std::exception const& e) { - JLOG(j_.trace()) << "fetchNodeObject " << hash << ": record found in cache"; - if (nodeObject->getType() == hotDUMMY) - nodeObject.reset(); + JLOG(j_.fatal()) << "fetchNodeObject " << hash << ": Exception fetching from backend: " << e.what(); + Rethrow(); + } + + switch (status) + { + case ok: + case notFound: + break; + case dataCorrupt: + JLOG(j_.fatal()) << "fetchNodeObject " << hash << ": nodestore data is corrupted"; + break; + default: + JLOG(j_.warn()) << "fetchNodeObject " << hash << ": backend returns unknown result " << status; + break; } if (nodeObject) @@ -105,66 +59,36 @@ DatabaseNodeImp::fetchNodeObject(uint256 const& hash, std::uint32_t, FetchReport std::vector> DatabaseNodeImp::fetchBatch(std::vector const& hashes) { - std::vector> results{hashes.size()}; using namespace std::chrono; auto const before = steady_clock::now(); - std::unordered_map indexMap; - std::vector cacheMisses; - uint64_t hits = 0; - uint64_t fetches = 0; + + std::vector batch{}; + batch.reserve(hashes.size()); for (size_t i = 0; i < hashes.size(); ++i) { auto const& hash = hashes[i]; - // See if the object already exists in the cache - auto nObj = cache_ ? cache_->fetch(hash) : nullptr; - ++fetches; - if (!nObj) - { - // Try the database - indexMap[&hash] = i; - cacheMisses.push_back(&hash); - } - else - { - results[i] = nObj->getType() == hotDUMMY ? nullptr : nObj; - // It was in the cache. - ++hits; - } + batch.push_back(&hash); } - JLOG(j_.debug()) << "fetchBatch - cache hits = " << (hashes.size() - cacheMisses.size()) - << " - cache misses = " << cacheMisses.size(); - auto dbResults = backend_->fetchBatch(cacheMisses).first; - - for (size_t i = 0; i < dbResults.size(); ++i) + // Get the node objects that match the hashes from the backend. To protect + // against the backends returning fewer or more results than expected, the + // container is resized to the number of hashes. + auto results = backend_->fetchBatch(batch).first; + XRPL_ASSERT( + results.size() == hashes.size() || results.empty(), + "number of output objects either matches number of input hashes or is empty"); + results.resize(hashes.size()); + for (size_t i = 0; i < results.size(); ++i) { - auto nObj = std::move(dbResults[i]); - size_t index = indexMap[cacheMisses[i]]; - auto const& hash = hashes[index]; - - if (nObj) - { - // Ensure all threads get the same object - if (cache_) - cache_->canonicalize_replace_client(hash, nObj); - } - else + if (!results[i]) { JLOG(j_.error()) << "fetchBatch - " - << "record not found in db or cache. hash = " << strHex(hash); - if (cache_) - { - auto notFound = NodeObject::createObject(hotDUMMY, {}, hash); - cache_->canonicalize_replace_client(hash, notFound); - if (notFound->getType() != hotDUMMY) - nObj = std::move(notFound); - } + << "record not found in db. hash = " << strHex(hashes[i]); } - results[index] = std::move(nObj); } auto fetchDurationUs = std::chrono::duration_cast(steady_clock::now() - before).count(); - updateFetchMetrics(fetches, hits, fetchDurationUs); + updateFetchMetrics(hashes.size(), 0, fetchDurationUs); return results; } diff --git a/src/libxrpl/nodestore/DatabaseRotatingImp.cpp b/src/libxrpl/nodestore/DatabaseRotatingImp.cpp index 2e72dca969..f25b9d068e 100644 --- a/src/libxrpl/nodestore/DatabaseRotatingImp.cpp +++ b/src/libxrpl/nodestore/DatabaseRotatingImp.cpp @@ -93,12 +93,6 @@ DatabaseRotatingImp::store(NodeObjectType type, Blob&& data, uint256 const& hash storeStats(1, nObj->getData().size()); } -void -DatabaseRotatingImp::sweep() -{ - // nothing to do -} - std::shared_ptr DatabaseRotatingImp::fetchNodeObject(uint256 const& hash, std::uint32_t, FetchReport& fetchReport, bool duplicate) { diff --git a/src/test/app/SHAMapStore_test.cpp b/src/test/app/SHAMapStore_test.cpp index 91845709c5..7951da26d1 100644 --- a/src/test/app/SHAMapStore_test.cpp +++ b/src/test/app/SHAMapStore_test.cpp @@ -490,19 +490,8 @@ public: Env env(*this, envconfig(onlineDelete)); ///////////////////////////////////////////////////////////// - // Create the backend. Normally, SHAMapStoreImp handles all these - // details - auto nscfg = env.app().config().section(ConfigSection::nodeDatabase()); - - // Provide default values: - if (!nscfg.exists("cache_size")) - nscfg.set( - "cache_size", std::to_string(env.app().config().getValueFor(SizedItem::treeCacheSize, std::nullopt))); - - if (!nscfg.exists("cache_age")) - nscfg.set( - "cache_age", std::to_string(env.app().config().getValueFor(SizedItem::treeCacheAge, std::nullopt))); - + // Create NodeStore with two backends to allow online deletion of data. + // Normally, SHAMapStoreImp handles all these details. NodeStoreScheduler scheduler(env.app().getJobQueue()); std::string const writableDb = "write"; @@ -510,9 +499,8 @@ public: auto writableBackend = makeBackendRotating(env, scheduler, writableDb); auto archiveBackend = makeBackendRotating(env, scheduler, archiveDb); - // Create NodeStore with two backends to allow online deletion of - // data constexpr int readThreads = 4; + auto nscfg = env.app().config().section(ConfigSection::nodeDatabase()); auto dbr = std::make_unique( scheduler, readThreads, diff --git a/src/xrpld/app/main/Application.cpp b/src/xrpld/app/main/Application.cpp index 3045097e4a..2c0d3c2b82 100644 --- a/src/xrpld/app/main/Application.cpp +++ b/src/xrpld/app/main/Application.cpp @@ -908,10 +908,6 @@ public: JLOG(m_journal.debug()) << "MasterTransaction sweep. Size before: " << oldMasterTxSize << "; size after: " << masterTxCache.size(); } - { - // Does not appear to have an associated cache. - getNodeStore().sweep(); - } { std::size_t const oldLedgerMasterCacheSize = getLedgerMaster().getFetchPackCacheSize(); diff --git a/src/xrpld/app/misc/SHAMapStoreImp.cpp b/src/xrpld/app/misc/SHAMapStoreImp.cpp index 0ed3b8a3fc..dbdd682ef8 100644 --- a/src/xrpld/app/misc/SHAMapStoreImp.cpp +++ b/src/xrpld/app/misc/SHAMapStoreImp.cpp @@ -130,14 +130,6 @@ std::unique_ptr SHAMapStoreImp::makeNodeStore(int readThreads) { auto nscfg = app_.config().section(ConfigSection::nodeDatabase()); - - // Provide default values: - if (!nscfg.exists("cache_size")) - nscfg.set("cache_size", std::to_string(app_.config().getValueFor(SizedItem::treeCacheSize, std::nullopt))); - - if (!nscfg.exists("cache_age")) - nscfg.set("cache_age", std::to_string(app_.config().getValueFor(SizedItem::treeCacheAge, std::nullopt))); - std::unique_ptr db; if (deleteInterval_) @@ -226,8 +218,6 @@ SHAMapStoreImp::run() LedgerIndex lastRotated = state_db_.getState().lastRotated; netOPs_ = &app_.getOPs(); ledgerMaster_ = &app_.getLedgerMaster(); - fullBelowCache_ = &(*app_.getNodeFamily().getFullBelowCache()); - treeNodeCache_ = &(*app_.getNodeFamily().getTreeNodeCache()); if (advisoryDelete_) canDelete_ = state_db_.getCanDelete(); @@ -490,16 +480,19 @@ void SHAMapStoreImp::clearCaches(LedgerIndex validatedSeq) { ledgerMaster_->clearLedgerCachePrior(validatedSeq); - fullBelowCache_->clear(); + // Also clear the FullBelowCache so its generation counter is bumped. + // This prevents stale "full below" markers from persisting across + // backend rotation/online deletion and interfering with SHAMap sync. + app_.getNodeFamily().getFullBelowCache()->clear(); } void SHAMapStoreImp::freshenCaches() { - if (freshenCache(*treeNodeCache_)) - return; - if (freshenCache(app_.getMasterTransaction().getCache())) + if (freshenCache(*app_.getNodeFamily().getTreeNodeCache())) return; + + freshenCache(app_.getMasterTransaction().getCache()); } void diff --git a/src/xrpld/app/misc/SHAMapStoreImp.h b/src/xrpld/app/misc/SHAMapStoreImp.h index a0475e80d6..b046a78979 100644 --- a/src/xrpld/app/misc/SHAMapStoreImp.h +++ b/src/xrpld/app/misc/SHAMapStoreImp.h @@ -93,8 +93,6 @@ private: // as of run() or before NetworkOPs* netOPs_ = nullptr; LedgerMaster* ledgerMaster_ = nullptr; - FullBelowCache* fullBelowCache_ = nullptr; - TreeNodeCache* treeNodeCache_ = nullptr; static constexpr auto nodeStoreName_ = "NodeStore"; From 2305bc98a4c51550504060460d14aa43046379a1 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Fri, 6 Feb 2026 16:39:23 +0000 Subject: [PATCH 22/61] chore: Remove CODEOWNERS (#6337) --- .github/CODEOWNERS | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS deleted file mode 100644 index bc4fe2febd..0000000000 --- a/.github/CODEOWNERS +++ /dev/null @@ -1,8 +0,0 @@ -# Allow anyone to review any change by default. -* - -# Require the rpc-reviewers team to review changes to the rpc code. -include/xrpl/protocol/ @xrplf/rpc-reviewers -src/libxrpl/protocol/ @xrplf/rpc-reviewers -src/xrpld/rpc/ @xrplf/rpc-reviewers -src/xrpld/app/misc/ @xrplf/rpc-reviewers From f5208fc85020eb96de6a2b625ccb7f53c744d07a Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Fri, 6 Feb 2026 13:37:01 -0500 Subject: [PATCH 23/61] test: Add file and line location to Env (#6276) This change uses `std::source_location` to output the file and line location of the call that triggered a failed transaction. --- src/test/app/LedgerReplay_test.cpp | 3 +- src/test/jtx/Env.h | 62 +++++++++++++++++++++++++----- src/test/jtx/Env_ss.h | 21 +++++++--- src/test/jtx/impl/Env.cpp | 33 ++++++++-------- src/test/rpc/Subscribe_test.cpp | 3 +- 5 files changed, 88 insertions(+), 34 deletions(-) diff --git a/src/test/app/LedgerReplay_test.cpp b/src/test/app/LedgerReplay_test.cpp index 8bf1a8f668..229cad21c9 100644 --- a/src/test/app/LedgerReplay_test.cpp +++ b/src/test/app/LedgerReplay_test.cpp @@ -491,8 +491,7 @@ struct LedgerServer for (int i = 0; i < newTxes; ++i) { updateIdx(); - env.apply( - pay(accounts[fromIdx], + env(pay(accounts[fromIdx], accounts[toIdx], jtx::drops(ledgerMaster.getClosedLedger()->fees().base) + jtx::XRP(param.txAmount)), jtx::seq(jtx::autofill), diff --git a/src/test/jtx/Env.h b/src/test/jtx/Env.h index ef6240d48a..7d7dcd2cb8 100644 --- a/src/test/jtx/Env.h +++ b/src/test/jtx/Env.h @@ -31,6 +31,7 @@ #include #include +#include #include #include #include @@ -42,6 +43,27 @@ namespace xrpl { namespace test { namespace jtx { +/** Wrapper that captures std::source_location when implicitly constructed. + This solves the problem of combining std::source_location with variadic + templates. The std::source_location default argument is evaluated at the + call site when the wrapper is constructed via implicit conversion. + + This is a template struct that holds the value directly, allowing implicit + conversion without template argument deduction issues via CTAD. +*/ +template +struct WithSourceLocation +{ + T value; + std::source_location loc; + + // Non-explicit constructor allows implicit conversion. + // The default argument for loc is evaluated at the call site. + WithSourceLocation(T v, std::source_location l = std::source_location::current()) : value(std::move(v)), loc(l) + { + } +}; + /** Designate accounts as no-ripple in Env::fund */ template std::array @@ -522,35 +544,57 @@ public: This calls postconditions. */ virtual void - submit(JTx const& jt); + submit(JTx const& jt, std::source_location const& loc = std::source_location::current()); /** Use the submit RPC command with a provided JTx object. This calls postconditions. */ void - sign_and_submit(JTx const& jt, Json::Value params = Json::nullValue); + sign_and_submit( + JTx const& jt, + Json::Value params = Json::nullValue, + std::source_location const& loc = std::source_location::current()); /** Check expected postconditions of JTx submission. */ void - postconditions(JTx const& jt, ParsedResult const& parsed, Json::Value const& jr = Json::Value()); + postconditions( + JTx const& jt, + ParsedResult const& parsed, + Json::Value const& jr = Json::Value(), + std::source_location const& loc = std::source_location::current()); /** Apply funclets and submit. */ /** @{ */ - template + template Env& - apply(JsonValue&& jv, FN const&... fN) + apply(WithSourceLocation jv, FN const&... fN) { - submit(jt(std::forward(jv), fN...)); + submit(jt(std::move(jv.value), fN...), jv.loc); return *this; } - template + template Env& - operator()(JsonValue&& jv, FN const&... fN) + apply(WithSourceLocation jv, FN const&... fN) { - return apply(std::forward(jv), fN...); + submit(jt(std::move(jv.value), fN...), jv.loc); + return *this; + } + + template + Env& + operator()(WithSourceLocation jv, FN const&... fN) + { + return apply(std::move(jv), fN...); + } + + template + Env& + operator()(WithSourceLocation jv, FN const&... fN) + { + return apply(std::move(jv), fN...); } /** @} */ diff --git a/src/test/jtx/Env_ss.h b/src/test/jtx/Env_ss.h index 78146a04a4..9c178a1c13 100644 --- a/src/test/jtx/Env_ss.h +++ b/src/test/jtx/Env_ss.h @@ -23,19 +23,20 @@ private: SignSubmitRunner& operator=(SignSubmitRunner&&) = delete; - SignSubmitRunner(Env& env, JTx&& jt) : env_(env), jt_(jt) + SignSubmitRunner(Env& env, JTx&& jt, std::source_location loc) : env_(env), jt_(jt), loc_(loc) { } void operator()(Json::Value const& params = Json::nullValue) { - env_.sign_and_submit(jt_, params); + env_.sign_and_submit(jt_, params, loc_); } private: Env& env_; JTx const jt_; + std::source_location const loc_; }; public: @@ -47,12 +48,20 @@ public: { } - template + template SignSubmitRunner - operator()(JsonValue&& jv, FN const&... fN) + operator()(WithSourceLocation jv, FN const&... fN) { - auto jtx = env_.jt(std::forward(jv), fN...); - return SignSubmitRunner(env_, std::move(jtx)); + auto jtx = env_.jt(std::move(jv.value), fN...); + return SignSubmitRunner(env_, std::move(jtx), jv.loc); + } + + template + SignSubmitRunner + operator()(WithSourceLocation jv, FN const&... fN) + { + auto jtx = env_.jt(std::move(jv.value), fN...); + return SignSubmitRunner(env_, std::move(jtx), jv.loc); } }; diff --git a/src/test/jtx/impl/Env.cpp b/src/test/jtx/impl/Env.cpp index 9971da05c4..d8bcec84ee 100644 --- a/src/test/jtx/impl/Env.cpp +++ b/src/test/jtx/impl/Env.cpp @@ -27,6 +27,7 @@ #include #include +#include namespace xrpl { namespace test { @@ -330,7 +331,7 @@ Env::parseResult(Json::Value const& jr) } void -Env::submit(JTx const& jt) +Env::submit(JTx const& jt, std::source_location const& loc) { ParsedResult parsedResult; auto const jr = [&]() { @@ -356,11 +357,11 @@ Env::submit(JTx const& jt) return Json::Value(); } }(); - return postconditions(jt, parsedResult, jr); + return postconditions(jt, parsedResult, jr, loc); } void -Env::sign_and_submit(JTx const& jt, Json::Value params) +Env::sign_and_submit(JTx const& jt, Json::Value params, std::source_location const& loc) { auto const account = lookup(jt.jv[jss::Account].asString()); auto const& passphrase = account.name(); @@ -393,25 +394,26 @@ Env::sign_and_submit(JTx const& jt, Json::Value params) test.expect(parsedResult.ter, "ter uninitialized!"); ter_ = parsedResult.ter.value_or(telENV_RPC_FAILED); - return postconditions(jt, parsedResult, jr); + return postconditions(jt, parsedResult, jr, loc); } void -Env::postconditions(JTx const& jt, ParsedResult const& parsed, Json::Value const& jr) +Env::postconditions(JTx const& jt, ParsedResult const& parsed, Json::Value const& jr, std::source_location const& loc) { auto const line = jt.testLine ? " (" + to_string(*jt.testLine) + ")" : ""; - bool bad = !test.expect(parsed.ter, "apply: No ter result!" + line); + auto const locStr = std::string("(") + loc.file_name() + ":" + to_string(loc.line()) + ")"; + bool bad = !test.expect(parsed.ter, "apply " + locStr + ": No ter result!" + line); bad = (jt.ter && parsed.ter && !test.expect( *parsed.ter == *jt.ter, - "apply: Got " + transToken(*parsed.ter) + " (" + transHuman(*parsed.ter) + "); Expected " + + "apply " + locStr + ": Got " + transToken(*parsed.ter) + " (" + transHuman(*parsed.ter) + "); Expected " + transToken(*jt.ter) + " (" + transHuman(*jt.ter) + ")" + line)); using namespace std::string_literals; bad = (jt.rpcCode && !test.expect( parsed.rpcCode == jt.rpcCode->first && parsed.rpcMessage == jt.rpcCode->second, - "apply: Got RPC result "s + + "apply " + locStr + ": Got RPC result "s + (parsed.rpcCode ? RPC::get_error_info(*parsed.rpcCode).token.c_str() : "NO RESULT") + " (" + parsed.rpcMessage + "); Expected " + RPC::get_error_info(jt.rpcCode->first).token.c_str() + " (" + jt.rpcCode->second + ")" + line)) || @@ -419,13 +421,14 @@ Env::postconditions(JTx const& jt, ParsedResult const& parsed, Json::Value const // If we have an rpcCode (just checked), then the rpcException check is // optional - the 'error' field may not be defined, but if it is, it must // match rpcError. - bad = (jt.rpcException && - !test.expect( - (jt.rpcCode && parsed.rpcError.empty()) || - (parsed.rpcError == jt.rpcException->first && - (!jt.rpcException->second || parsed.rpcException == *jt.rpcException->second)), - "apply: Got RPC result "s + parsed.rpcError + " (" + parsed.rpcException + "); Expected " + - jt.rpcException->first + " (" + jt.rpcException->second.value_or("n/a") + ")" + line)) || + bad = + (jt.rpcException && + !test.expect( + (jt.rpcCode && parsed.rpcError.empty()) || + (parsed.rpcError == jt.rpcException->first && + (!jt.rpcException->second || parsed.rpcException == *jt.rpcException->second)), + "apply " + locStr + ": Got RPC result "s + parsed.rpcError + " (" + parsed.rpcException + "); Expected " + + jt.rpcException->first + " (" + jt.rpcException->second.value_or("n/a") + ")" + line)) || bad; if (bad) { diff --git a/src/test/rpc/Subscribe_test.cpp b/src/test/rpc/Subscribe_test.cpp index 4f83f81da5..cce45fb4ef 100644 --- a/src/test/rpc/Subscribe_test.cpp +++ b/src/test/rpc/Subscribe_test.cpp @@ -835,8 +835,7 @@ public: { auto& from = (i % 2 == 0) ? a : b; auto& to = (i % 2 == 0) ? b : a; - env.apply( - pay(from, to, jtx::XRP(numXRP)), + env(pay(from, to, jtx::XRP(numXRP)), jtx::seq(jtx::autofill), jtx::fee(jtx::autofill), jtx::sig(jtx::autofill)); From bf4674f42b0515f0fe81d4b523c98d68fd7269b3 Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Fri, 6 Feb 2026 15:30:22 -0500 Subject: [PATCH 24/61] refactor: Fix spelling issues in tests (#6199) This change removes the `src/tests` exception from the `cspell` config and fixes all the issues that arise as a result. No functionality/test change. --- .../cspell.config.yaml => cspell.config.yaml | 35 +++++--- include/xrpl/proto/xrpl.proto | 6 +- src/test/app/AMMCalc_test.cpp | 30 +++---- src/test/app/AMMExtended_test.cpp | 8 +- src/test/app/AMM_test.cpp | 32 +++---- src/test/app/Batch_test.cpp | 2 +- src/test/app/CrossingLimits_test.cpp | 22 ++--- src/test/app/DepositAuth_test.cpp | 6 +- src/test/app/EscrowToken_test.cpp | 12 +-- src/test/app/FixNFTokenPageLinks_test.cpp | 2 +- src/test/app/LPTokenTransfer_test.cpp | 2 +- src/test/app/LoanBroker_test.cpp | 2 +- src/test/app/Loan_test.cpp | 1 + src/test/app/MPToken_test.cpp | 2 +- src/test/app/NFToken_test.cpp | 18 ++-- src/test/app/Offer_test.cpp | 86 +++++++++---------- src/test/app/PayStrand_test.cpp | 6 +- src/test/app/ReducedOffer_test.cpp | 36 ++++---- src/test/app/SHAMapStore_test.cpp | 6 +- src/test/app/TrustAndBalance_test.cpp | 10 +-- src/test/app/Vault_test.cpp | 2 +- src/test/app/XChain_test.cpp | 5 +- src/test/core/Config_test.cpp | 36 ++++---- src/test/jtx/TestHelpers.h | 2 +- src/test/jtx/impl/AMM.cpp | 42 ++++----- src/test/jtx/impl/TestHelpers.cpp | 2 +- src/test/jtx/impl/mpt.cpp | 28 +++--- src/test/jtx/mpt.h | 8 +- src/test/ledger/Directory_test.cpp | 2 +- src/test/ledger/View_test.cpp | 10 +-- src/test/overlay/compression_test.cpp | 10 +-- src/test/protocol/STAmount_test.cpp | 4 +- src/test/rpc/AccountLines_test.cpp | 2 +- src/test/rpc/AccountObjects_test.cpp | 4 +- src/test/rpc/Handler_test.cpp | 1 + src/test/rpc/LedgerEntry_test.cpp | 4 +- src/test/rpc/NoRipple_test.cpp | 4 +- src/test/rpc/Transaction_test.cpp | 4 +- 38 files changed, 256 insertions(+), 238 deletions(-) rename .config/cspell.config.yaml => cspell.config.yaml (79%) diff --git a/.config/cspell.config.yaml b/cspell.config.yaml similarity index 79% rename from .config/cspell.config.yaml rename to cspell.config.yaml index a9c621f567..b2f4a33769 100644 --- a/.config/cspell.config.yaml +++ b/cspell.config.yaml @@ -1,14 +1,13 @@ ignorePaths: - build/** - src/libxrpl/crypto - - src/test/** # Will be removed in the future - CMakeUserPresets.json - Doxyfile - docs/**/*.puml - cmake/** - LICENSE.md language: en -allowCompoundWords: true +allowCompoundWords: true # TODO (#6334) ignoreRandomStrings: true minWordLength: 5 dictionaries: @@ -16,20 +15,29 @@ dictionaries: - en_US - en_GB ignoreRegExpList: - - /[rs][1-9A-HJ-NP-Za-km-z]{25,34}/g # addresses and seeds - - /(XRPL|BEAST)_[A-Z_0-9]+_H_INCLUDED+/g # include guards - - /(XRPL|BEAST)_[A-Z_0-9]+_H+/g # include guards + - /\b[rs][1-9A-HJ-NP-Za-km-z]{25,34}/g # addresses and seeds + - /\bC[A-Z0-9]{15}/g # CTIDs + - /\b(XRPL|BEAST)_[A-Z_0-9]+_H_INCLUDED+/g # include guards + - /\b(XRPL|BEAST)_[A-Z_0-9]+_H+/g # include guards - /::[a-z:_]+/g # things from other namespaces - - /lib[a-z]+/g # libraries - - /[0-9]{4}-[0-9]{2}-[0-9]{2}[,:][A-Za-zÀ-ÖØ-öø-ÿ.\s]+/g # copyright dates - - /[0-9]{4}[,:]?\s*[A-Za-zÀ-ÖØ-öø-ÿ.\s]+/g # copyright years + - /\blib[a-z]+/g # libraries + - /\b[0-9]{4}-[0-9]{2}-[0-9]{2}[,:][A-Za-zÀ-ÖØ-öø-ÿ.\s]+/g # copyright dates + - /\b[0-9]{4}[,:]?\s*[A-Za-zÀ-ÖØ-öø-ÿ.\s]+/g # copyright years - /\[[A-Za-z0-9-]+\]\(https:\/\/github.com\/[A-Za-z0-9-]+\)/g # Github usernames - /-[DWw][a-zA-Z0-9_-]+=/g # compile flags - /[\['"`]-[DWw][a-zA-Z0-9_-]+['"`\]]/g # compile flags + - ABCDEFGHIJKLMNOPQRSTUVWXYZ + - ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +overrides: + - filename: "**/*_test.cpp" # all test files + ignoreRegExpList: + - /"[^"]*"/g # double-quoted strings + - /'[^']*'/g # single-quoted strings + - /`[^`]*`/g # backtick strings suggestWords: - xprl->xrpl - - xprld->xrpld - - unsynched->unsynced + - xprld->xrpld # cspell: disable-line not sure what this problem is.... + - unsynched->unsynced # cspell: disable-line not sure what this problem is.... - synched->synced - synch->sync words: @@ -51,6 +59,7 @@ words: - Britto - Btrfs - canonicality + - changespq - checkme - choco - chrono @@ -106,12 +115,14 @@ words: - inequation - insuf - insuff + - invasively - iou - ious - isrdc - itype - jemalloc - jlog + - jtnofill - keylet - keylets - keyvadb @@ -138,6 +149,7 @@ words: - Metafuncton - misprediction - mptbalance + - MPTDEX - mptflags - mptid - mptissuance @@ -147,6 +159,7 @@ words: - mptokenissuance - mptokens - mpts + - mtgox - multisig - multisign - multisigned @@ -174,6 +187,7 @@ words: - perminute - permissioned - pointee + - populator - preauth - preauthorization - preauthorize @@ -182,6 +196,7 @@ words: - protobuf - protos - ptrs + - pushd - pyenv - qalloc - queuable diff --git a/include/xrpl/proto/xrpl.proto b/include/xrpl/proto/xrpl.proto index 613ef70a1f..0af7deb35d 100644 --- a/include/xrpl/proto/xrpl.proto +++ b/include/xrpl/proto/xrpl.proto @@ -86,9 +86,9 @@ message TMPublicKey { // you must first combine coins from one address to another. enum TransactionStatus { - tsNEW = 1; // origin node did/could not validate - tsCURRENT = 2; // scheduled to go in this ledger - tsCOMMITED = 3; // in a closed ledger + tsNEW = 1; // origin node did/could not validate + tsCURRENT = 2; // scheduled to go in this ledger + tsCOMMITTED = 3; // in a closed ledger tsREJECT_CONFLICT = 4; tsREJECT_INVALID = 5; tsREJECT_FUNDS = 6; diff --git a/src/test/app/AMMCalc_test.cpp b/src/test/app/AMMCalc_test.cpp index 7d735c2575..bc50f02d3d 100644 --- a/src/test/app/AMMCalc_test.cpp +++ b/src/test/app/AMMCalc_test.cpp @@ -23,8 +23,8 @@ class AMMCalc_test : public beast::unit_test::suite { using token_iter = boost::sregex_token_iterator; using steps = std::vector>; - using trates = std::map; - using swapargs = std::tuple; + using transfer_rates = std::map; + using swapargs = std::tuple; jtx::Account const gw{jtx::Account("gw")}; token_iter const end_; @@ -101,10 +101,10 @@ class AMMCalc_test : public beast::unit_test::suite return {{{*a1, *a2}, amm}}; } - std::optional + std::optional getTransferRate(token_iter& p) { - trates rates{}; + transfer_rates rates{}; if (p == end_) return rates; std::string str = *p; @@ -115,8 +115,8 @@ class AMMCalc_test : public beast::unit_test::suite { if (auto const rate = getRate(p++)) { - auto const [currency, trate, delimited] = *rate; - rates[currency] = trate; + auto const [currency, transferRate, delimited] = *rate; + rates[currency] = transferRate; if (delimited) break; } @@ -180,13 +180,13 @@ class AMMCalc_test : public beast::unit_test::suite auto const vp = std::get(args); STAmount sout = std::get(args); auto const fee = std::get(args); - auto const rates = std::get(args); + auto const rates = std::get(args); STAmount resultOut = sout; STAmount resultIn{}; STAmount sin{}; int limitingStep = vp.size(); STAmount limitStepOut{}; - auto trate = [&](auto const& amt) { + auto transferRate = [&](auto const& amt) { auto const currency = to_string(amt.issue().currency); return rates.find(currency) != rates.end() ? rates.at(currency) : QUALITY_ONE; }; @@ -194,7 +194,7 @@ class AMMCalc_test : public beast::unit_test::suite sin = sout; for (auto it = vp.rbegin(); it != vp.rend(); ++it) { - sout = mulratio(sin, trate(sin), QUALITY_ONE, true); + sout = mulratio(sin, transferRate(sin), QUALITY_ONE, true); auto const [amts, amm] = *it; // assume no amm limit if (amm) @@ -221,7 +221,7 @@ class AMMCalc_test : public beast::unit_test::suite for (int i = limitingStep + 1; i < vp.size(); ++i) { auto const [amts, amm] = vp[i]; - sin = mulratio(sin, QUALITY_ONE, trate(sin), false); + sin = mulratio(sin, QUALITY_ONE, transferRate(sin), false); if (amm) { sout = swapAssetIn(amts, sin, fee); @@ -243,13 +243,13 @@ class AMMCalc_test : public beast::unit_test::suite auto const vp = std::get(args); STAmount sin = std::get(args); auto const fee = std::get(args); - auto const rates = std::get(args); + auto const rates = std::get(args); STAmount resultIn = sin; STAmount resultOut{}; STAmount sout{}; int limitingStep = 0; STAmount limitStepIn{}; - auto trate = [&](auto const& amt) { + auto transferRate = [&](auto const& amt) { auto const currency = to_string(amt.issue().currency); return rates.find(currency) != rates.end() ? rates.at(currency) : QUALITY_ONE; }; @@ -257,7 +257,7 @@ class AMMCalc_test : public beast::unit_test::suite for (auto it = vp.begin(); it != vp.end(); ++it) { auto const [amts, amm] = *it; - sin = mulratio(sin, QUALITY_ONE, trate(sin), + sin = mulratio(sin, QUALITY_ONE, transferRate(sin), false); // out of the next step // assume no amm limit if (amm) @@ -283,7 +283,7 @@ class AMMCalc_test : public beast::unit_test::suite // swap out if limiting step for (int i = limitingStep - 1; i >= 0; --i) { - sout = mulratio(sin, trate(sin), QUALITY_ONE, false); + sout = mulratio(sin, transferRate(sin), QUALITY_ONE, false); auto const [amts, amm] = vp[i]; if (amm) { @@ -296,7 +296,7 @@ class AMMCalc_test : public beast::unit_test::suite } resultIn = sin; } - resultOut = mulratio(resultOut, QUALITY_ONE, trate(resultOut), true); + resultOut = mulratio(resultOut, QUALITY_ONE, transferRate(resultOut), true); std::cout << "in: " << toString(resultIn) << " out: " << toString(resultOut) << std::endl; } diff --git a/src/test/app/AMMExtended_test.cpp b/src/test/app/AMMExtended_test.cpp index 3cc48787d5..4eecb05905 100644 --- a/src/test/app/AMMExtended_test.cpp +++ b/src/test/app/AMMExtended_test.cpp @@ -1701,8 +1701,8 @@ private: // This removes no ripple for carol, // different from the original test fund(env, gw, {carol}, XRP(10'000), {}, Fund::Acct); - auto const AMMXRPPool = env.current()->fees().increment * 2; - env.fund(reserve(env, 5) + ammCrtFee(env) + AMMXRPPool, bob); + auto const ammXrpPool = env.current()->fees().increment * 2; + env.fund(reserve(env, 5) + ammCrtFee(env) + ammXrpPool, bob); env.close(); env.trust(USD(1'000), alice, bob, carol); env.trust(EUR(1'000), alice, bob, carol); @@ -1718,7 +1718,7 @@ private: // tecPATH_DRY, but the entire path should not be marked as dry. // This is the second error case to test (when flowV1 is used). env(offer(bob, EUR(50), XRP(50))); - AMM ammBob(env, bob, AMMXRPPool, USD(150)); + AMM ammBob(env, bob, ammXrpPool, USD(150)); env(pay(alice, carol, USD(1'000'000)), path(~XRP, ~USD), @@ -3248,7 +3248,7 @@ private: Path const p = [&] { Path result; - result.push_back(allpe(gw, BobUSD)); + result.push_back(allPathElements(gw, BobUSD)); result.push_back(cpe(EUR.currency)); return result; }(); diff --git a/src/test/app/AMM_test.cpp b/src/test/app/AMM_test.cpp index 14b97f30f1..8a60e5f667 100644 --- a/src/test/app/AMM_test.cpp +++ b/src/test/app/AMM_test.cpp @@ -975,7 +975,7 @@ private: .tokens = IOUAmount{1, -10}, .asset1In = STAmount{USD, 1, -15}, .err = ter(tecAMM_INVALID_TOKENS)}); }); - // Single deposit with eprice, tokens rounded to 0 + // Single deposit with EPrice, tokens rounded to 0 testAMM([&](AMM& amm, Env& env) { amm.deposit(DepositArg{ .asset1In = STAmount{USD, 1, -15}, .maxEP = STAmount{USD, 1, -1}, .err = ter(tecAMM_INVALID_TOKENS)}); @@ -4204,8 +4204,8 @@ private: Account const chris("chris"); Account const simon("simon"); Account const ben("ben"); - Account const nataly("nataly"); - fund(env, gw, {bob, ed, paul, dan, chris, simon, ben, nataly}, {USD(1'500'000)}, Fund::Acct); + Account const natalie("natalie"); + fund(env, gw, {bob, ed, paul, dan, chris, simon, ben, natalie}, {USD(1'500'000)}, Fund::Acct); for (int i = 0; i < 10; ++i) { ammAlice.deposit(ben, STAmount{USD, 1, -10}); @@ -4224,8 +4224,8 @@ private: ammAlice.withdrawAll(ed, USD(0)); ammAlice.deposit(paul, USD(100'000)); ammAlice.withdrawAll(paul, USD(0)); - ammAlice.deposit(nataly, USD(1'000'000)); - ammAlice.withdrawAll(nataly, USD(0)); + ammAlice.deposit(natalie, USD(1'000'000)); + ammAlice.withdrawAll(natalie, USD(0)); } // Due to round off some accounts have a tiny gain, while // other have a tiny loss. The last account to withdraw @@ -4251,11 +4251,11 @@ private: BEAST_EXPECT(expectHolding(env, ed, USD(1'500'000))); BEAST_EXPECT(expectHolding(env, paul, USD(1'500'000))); if (!features[fixAMMv1_1] && !features[fixAMMv1_3]) - BEAST_EXPECT(expectHolding(env, nataly, STAmount{USD, UINT64_C(1'500'000'000000002), -9})); + BEAST_EXPECT(expectHolding(env, natalie, STAmount{USD, UINT64_C(1'500'000'000000002), -9})); else if (features[fixAMMv1_1] && !features[fixAMMv1_3]) - BEAST_EXPECT(expectHolding(env, nataly, STAmount{USD, UINT64_C(1'500'000'000000005), -9})); + BEAST_EXPECT(expectHolding(env, natalie, STAmount{USD, UINT64_C(1'500'000'000000005), -9})); else - BEAST_EXPECT(expectHolding(env, nataly, USD(1'500'000))); + BEAST_EXPECT(expectHolding(env, natalie, USD(1'500'000))); ammAlice.withdrawAll(alice); BEAST_EXPECT(!ammAlice.ammExists()); if (!features[fixAMMv1_1]) @@ -4264,7 +4264,7 @@ private: BEAST_EXPECT(expectHolding(env, alice, STAmount{USD, UINT64_C(30'000'0000000003), -10})); else BEAST_EXPECT(expectHolding(env, alice, USD(30'000))); - // alice XRP balance is 30,000initial - 50 ammcreate fee - + // alice XRP balance is 30,000 initial - 50 AMMCreate fee - // 10drops fee BEAST_EXPECT( accountBalance(env, alice) == std::to_string(29950000000 - env.current()->fees().base.drops())); @@ -4284,8 +4284,8 @@ private: Account const chris("chris"); Account const simon("simon"); Account const ben("ben"); - Account const nataly("nataly"); - fund(env, gw, {bob, ed, paul, dan, chris, simon, ben, nataly}, XRP(2'000'000), {}, Fund::Acct); + Account const natalie("natalie"); + fund(env, gw, {bob, ed, paul, dan, chris, simon, ben, natalie}, XRP(2'000'000), {}, Fund::Acct); for (int i = 0; i < 10; ++i) { ammAlice.deposit(ben, XRPAmount{1}); @@ -4304,8 +4304,8 @@ private: ammAlice.withdrawAll(ed, XRP(0)); ammAlice.deposit(paul, XRP(100'000)); ammAlice.withdrawAll(paul, XRP(0)); - ammAlice.deposit(nataly, XRP(1'000'000)); - ammAlice.withdrawAll(nataly, XRP(0)); + ammAlice.deposit(natalie, XRP(1'000'000)); + ammAlice.withdrawAll(natalie, XRP(0)); } auto const baseFee = env.current()->fees().base.drops(); if (!features[fixAMMv1_3]) @@ -4325,8 +4325,8 @@ private: BEAST_EXPECT(accountBalance(env, carol) == std::to_string(30'000'000'000 - 20 * baseFee)); BEAST_EXPECT(accountBalance(env, ed) == xrpBalance); BEAST_EXPECT(accountBalance(env, paul) == xrpBalance); - BEAST_EXPECT(accountBalance(env, nataly) == xrpBalance); - // 30,000 initial - 50 ammcreate fee - 10drops withdraw fee + BEAST_EXPECT(accountBalance(env, natalie) == xrpBalance); + // 30,000 initial - 50 AMMCreate fee - 10drops withdraw fee BEAST_EXPECT(accountBalance(env, alice) == std::to_string(29'950'000'000 - baseFee)); } else @@ -4346,7 +4346,7 @@ private: BEAST_EXPECT(accountBalance(env, carol) == std::to_string(30'000'000'000 - 20 * baseFee - 10)); BEAST_EXPECT(accountBalance(env, ed) == (xrpBalance + drops(2)).getText()); BEAST_EXPECT(accountBalance(env, paul) == (xrpBalance + drops(3)).getText()); - BEAST_EXPECT(accountBalance(env, nataly) == (xrpBalance + drops(5)).getText()); + BEAST_EXPECT(accountBalance(env, natalie) == (xrpBalance + drops(5)).getText()); BEAST_EXPECT(accountBalance(env, alice) == std::to_string(29'950'000'000 - baseFee + 80)); } }, diff --git a/src/test/app/Batch_test.cpp b/src/test/app/Batch_test.cpp index 035a1f8a6f..72f3677e3b 100644 --- a/src/test/app/Batch_test.cpp +++ b/src/test/app/Batch_test.cpp @@ -3618,7 +3618,7 @@ class Batch_test : public beast::unit_test::suite // another transaction is part of the batch, the batch might fail // because the sequence is out of order. This is because the canonical // order of transactions is determined by the account first. So in this - // case, alice's batch comes after bobs self submitted transaction even + // case, alice's batch comes after bob's self submitted transaction even // though the payment was submitted after the batch. using namespace test::jtx; diff --git a/src/test/app/CrossingLimits_test.cpp b/src/test/app/CrossingLimits_test.cpp index e1974adee1..0451822492 100644 --- a/src/test/app/CrossingLimits_test.cpp +++ b/src/test/app/CrossingLimits_test.cpp @@ -64,15 +64,15 @@ public: int const maxConsumed = 1000; env.fund(XRP(100000000), gw, "alice", "bob", "carol"); - int const bobsOfferCount = maxConsumed + 150; - env.trust(USD(bobsOfferCount), "bob"); - env(pay(gw, "bob", USD(bobsOfferCount))); + int const bobOfferCount = maxConsumed + 150; + env.trust(USD(bobOfferCount), "bob"); + env(pay(gw, "bob", USD(bobOfferCount))); env.close(); - n_offers(env, bobsOfferCount, "bob", XRP(1), USD(1)); + n_offers(env, bobOfferCount, "bob", XRP(1), USD(1)); // Alice offers to buy Bob's offers. However she hits the offer // crossing limit, so she can't buy them all at once. - env(offer("alice", USD(bobsOfferCount), XRP(bobsOfferCount))); + env(offer("alice", USD(bobOfferCount), XRP(bobOfferCount))); env.close(); env.require(balance("alice", USD(maxConsumed))); env.require(balance("bob", USD(150))); @@ -103,19 +103,19 @@ public: // The payment engine allows 1000 offers to cross. int const maxConsumed = 1000; - int const evitasOfferCount{maxConsumed + 49}; + int const evitaOfferCount{maxConsumed + 49}; env.trust(USD(1000), "alice"); env(pay(gw, "alice", USD(1000))); env.trust(USD(1000), "carol"); env(pay(gw, "carol", USD(1))); - env.trust(USD(evitasOfferCount + 1), "evita"); - env(pay(gw, "evita", USD(evitasOfferCount + 1))); + env.trust(USD(evitaOfferCount + 1), "evita"); + env(pay(gw, "evita", USD(evitaOfferCount + 1))); // The payment engine has a limit of 1000 funded or unfunded offers. int const carolsOfferCount{700}; n_offers(env, 400, "alice", XRP(1), USD(1)); n_offers(env, carolsOfferCount, "carol", XRP(1), USD(1)); - n_offers(env, evitasOfferCount, "evita", XRP(1), USD(1)); + n_offers(env, evitaOfferCount, "evita", XRP(1), USD(1)); // Bob offers to buy 1000 XRP for 1000 USD. He takes all 400 USD from // Alice's offers, 1 USD from Carol's and then removes 599 of Carol's @@ -126,8 +126,8 @@ public: env.require(owners("alice", 1)); env.require(balance("carol", USD(0))); env.require(owners("carol", carolsOfferCount - 599)); - env.require(balance("evita", USD(evitasOfferCount + 1))); - env.require(owners("evita", evitasOfferCount + 1)); + env.require(balance("evita", USD(evitaOfferCount + 1))); + env.require(owners("evita", evitaOfferCount + 1)); // Dan offers to buy maxConsumed + 50 XRP USD. He removes all of // Carol's remaining offers as unfunded, then takes diff --git a/src/test/app/DepositAuth_test.cpp b/src/test/app/DepositAuth_test.cpp index 535abc6af8..0cd7e7449c 100644 --- a/src/test/app/DepositAuth_test.cpp +++ b/src/test/app/DepositAuth_test.cpp @@ -1237,17 +1237,17 @@ struct DepositPreauth_test : public beast::unit_test::suite auto const dp = ledgerEntryDepositPreauth(env, stock, credentials); auto const& authCred(dp[jss::result][jss::node]["AuthorizeCredentials"]); BEAST_EXPECT(authCred.isArray() && authCred.size() == credentials.size()); - std::vector> readedCreds; + std::vector> readCreds; for (auto const& o : authCred) { auto const& c(o[jss::Credential]); auto issuer = c[jss::Issuer].asString(); if (BEAST_EXPECT(pubKey2Acc.contains(issuer))) - readedCreds.emplace_back(pubKey2Acc.at(issuer), c["CredentialType"].asString()); + readCreds.emplace_back(pubKey2Acc.at(issuer), c["CredentialType"].asString()); } - BEAST_EXPECT(std::ranges::is_sorted(readedCreds)); + BEAST_EXPECT(std::ranges::is_sorted(readCreds)); env(deposit::unauthCredentials(stock, credentials)); env.close(); diff --git a/src/test/app/EscrowToken_test.cpp b/src/test/app/EscrowToken_test.cpp index b5088f247a..1f3b3bab70 100644 --- a/src/test/app/EscrowToken_test.cpp +++ b/src/test/app/EscrowToken_test.cpp @@ -752,7 +752,7 @@ struct EscrowToken_test : public beast::unit_test::suite env.trust(USD(1), bob); env.close(); - // alice cannot finish because bobs limit is too low + // alice cannot finish because bob's limit is too low env(escrow::finish(alice, alice, seq1), escrow::condition(escrow::cb1), escrow::fulfillment(escrow::fb1), @@ -789,7 +789,7 @@ struct EscrowToken_test : public beast::unit_test::suite env.trust(USD(1), bob); env.close(); - // bob can finish even if bobs limit is too low + // bob can finish even if bob's limit is too low auto const bobPreLimit = env.limit(bob, USD); env(escrow::finish(bob, alice, seq1), @@ -799,7 +799,7 @@ struct EscrowToken_test : public beast::unit_test::suite ter(tesSUCCESS)); env.close(); - // bobs limit is not changed + // bob's limit is not changed BEAST_EXPECT(env.limit(bob, USD) == bobPreLimit); } } @@ -1606,7 +1606,7 @@ struct EscrowToken_test : public beast::unit_test::suite fee(baseFee * 150)); env.close(); auto const postBobLimit = env.limit(bob, USD); - // bobs limit is NOT changed + // bob's limit is NOT changed BEAST_EXPECT(postBobLimit == preBobLimit); } } @@ -1912,7 +1912,7 @@ struct EscrowToken_test : public beast::unit_test::suite } } void - testIOUINSF(FeatureBitset features) + testIOUInsufficientFunds(FeatureBitset features) { testcase("IOU Insufficient Funds"); using namespace test::jtx; @@ -3671,7 +3671,7 @@ struct EscrowToken_test : public beast::unit_test::suite testIOULimitAmount(features); testIOURequireAuth(features); testIOUFreeze(features); - testIOUINSF(features); + testIOUInsufficientFunds(features); testIOUPrecisionLoss(features); } diff --git a/src/test/app/FixNFTokenPageLinks_test.cpp b/src/test/app/FixNFTokenPageLinks_test.cpp index 8a3b51bbf1..88f368e9cf 100644 --- a/src/test/app/FixNFTokenPageLinks_test.cpp +++ b/src/test/app/FixNFTokenPageLinks_test.cpp @@ -442,7 +442,7 @@ class FixNFTokenPageLinks_test : public beast::unit_test::suite env(ledgerStateFix::nftPageLinks(daria, alice), fee(linkFixFee)); env.close(); - // alices's last page should now be present and include no links. + // alice's last page should now be present and include no links. { auto aliceLastNFTokenPage = env.le(keylet::nftpage_max(alice)); if (!BEAST_EXPECT(aliceLastNFTokenPage)) diff --git a/src/test/app/LPTokenTransfer_test.cpp b/src/test/app/LPTokenTransfer_test.cpp index f9cfc4d5ce..055b72ebe6 100644 --- a/src/test/app/LPTokenTransfer_test.cpp +++ b/src/test/app/LPTokenTransfer_test.cpp @@ -355,7 +355,7 @@ class LPTokenTransfer_test : public jtx::AMMTest env(token::acceptSellOffer(carol, sellOfferIndex)); env.close(); - // gateway freezes bobs's USD + // gateway freezes bob's USD env(trust(gw, bob["USD"](0), tfSetFreeze)); env.close(); diff --git a/src/test/app/LoanBroker_test.cpp b/src/test/app/LoanBroker_test.cpp index 139350a881..58052e3fb1 100644 --- a/src/test/app/LoanBroker_test.cpp +++ b/src/test/app/LoanBroker_test.cpp @@ -905,7 +905,7 @@ class LoanBroker_test : public beast::unit_test::suite if (asset.holds()) { - // preclaim: AllowTrustLineClaback is not set + // preclaim: AllowTrustLineClawback is not set env(coverClawback(issuer), loanBrokerID(brokerKeylet.key), amount(vaultInfo.asset(2)), diff --git a/src/test/app/Loan_test.cpp b/src/test/app/Loan_test.cpp index f02ceddb69..5deb1f179c 100644 --- a/src/test/app/Loan_test.cpp +++ b/src/test/app/Loan_test.cpp @@ -10,6 +10,7 @@ #include #include +// cspell: words LOANTODO #include diff --git a/src/test/app/MPToken_test.cpp b/src/test/app/MPToken_test.cpp index f8d736c257..965dd86475 100644 --- a/src/test/app/MPToken_test.cpp +++ b/src/test/app/MPToken_test.cpp @@ -670,7 +670,7 @@ class MPToken_test : public beast::unit_test::suite mptAlice.set({.account = alice, .holder = bob, .flags = tfMPTLock}); if (!features[featureSingleAssetVault]) { - // Delete bobs' mptoken even though it is locked + // Delete bob's mptoken even though it is locked mptAlice.authorize({.account = bob, .flags = tfMPTUnauthorize}); mptAlice.set({.account = alice, .holder = bob, .flags = tfMPTUnlock, .err = tecOBJECT_NOT_FOUND}); diff --git a/src/test/app/NFToken_test.cpp b/src/test/app/NFToken_test.cpp index 2ab2e2a94c..1b9ce82d4a 100644 --- a/src/test/app/NFToken_test.cpp +++ b/src/test/app/NFToken_test.cpp @@ -1383,28 +1383,28 @@ class NFTokenBaseUtil_test : public beast::unit_test::suite // Set flagOnlyXRP and offers using IOUs are rejected. { - uint256 const nftOnlyXRPID{token::getNextID(env, alice, 0u, tfOnlyXRP | tfTransferable)}; + uint256 const nftOnlyXrpID{token::getNextID(env, alice, 0u, tfOnlyXRP | tfTransferable)}; env(token::mint(alice, 0u), txflags(tfOnlyXRP | tfTransferable)); env.close(); BEAST_EXPECT(ownerCount(env, alice) == 2); - env(token::createOffer(alice, nftOnlyXRPID, gwAUD(50)), txflags(tfSellNFToken), ter(temBAD_AMOUNT)); + env(token::createOffer(alice, nftOnlyXrpID, gwAUD(50)), txflags(tfSellNFToken), ter(temBAD_AMOUNT)); env.close(); BEAST_EXPECT(ownerCount(env, alice) == 2); BEAST_EXPECT(ownerCount(env, buyer) == 1); - env(token::createOffer(buyer, nftOnlyXRPID, gwAUD(50)), token::owner(alice), ter(temBAD_AMOUNT)); + env(token::createOffer(buyer, nftOnlyXrpID, gwAUD(50)), token::owner(alice), ter(temBAD_AMOUNT)); env.close(); BEAST_EXPECT(ownerCount(env, buyer) == 1); // However offers for XRP are okay. BEAST_EXPECT(ownerCount(env, alice) == 2); - env(token::createOffer(alice, nftOnlyXRPID, XRP(60)), txflags(tfSellNFToken)); + env(token::createOffer(alice, nftOnlyXrpID, XRP(60)), txflags(tfSellNFToken)); env.close(); BEAST_EXPECT(ownerCount(env, alice) == 3); BEAST_EXPECT(ownerCount(env, buyer) == 1); - env(token::createOffer(buyer, nftOnlyXRPID, XRP(60)), token::owner(alice)); + env(token::createOffer(buyer, nftOnlyXrpID, XRP(60)), token::owner(alice)); env.close(); BEAST_EXPECT(ownerCount(env, buyer) == 2); } @@ -5155,8 +5155,8 @@ class NFTokenBaseUtil_test : public beast::unit_test::suite // bob now has a buy offer and a sell offer on the books. A broker // spots this and swoops in to make a profit. BEAST_EXPECT(nftCount(env, bob) == 1); - auto const bobsPriorBalance = env.balance(bob); - auto const brokersPriorBalance = env.balance(broker); + auto const bobPriorBalance = env.balance(bob); + auto const brokerPriorBalance = env.balance(broker); env(token::brokerOffers(broker, bobBuyOfferIndex, bobSellOfferIndex), token::brokerFee(XRP(1)), ter(tecCANT_ACCEPT_OWN_NFTOKEN_OFFER)); @@ -5165,8 +5165,8 @@ class NFTokenBaseUtil_test : public beast::unit_test::suite // A tec result was returned, so no state should change other // than the broker burning their transaction fee. BEAST_EXPECT(nftCount(env, bob) == 1); - BEAST_EXPECT(env.balance(bob) == bobsPriorBalance); - BEAST_EXPECT(env.balance(broker) == brokersPriorBalance - baseFee); + BEAST_EXPECT(env.balance(bob) == bobPriorBalance); + BEAST_EXPECT(env.balance(broker) == brokerPriorBalance - baseFee); } void diff --git a/src/test/app/Offer_test.cpp b/src/test/app/Offer_test.cpp index 09d7e41141..4847b7edb0 100644 --- a/src/test/app/Offer_test.cpp +++ b/src/test/app/Offer_test.cpp @@ -1878,14 +1878,14 @@ public: BEAST_EXPECT(jrr[jss::node][sfBalance.fieldName][jss::value] == "49.96666666666667"); jrr = ledgerEntryState(env, bob, gw, "USD"); - Json::Value const bobsUSD = jrr[jss::node][sfBalance.fieldName][jss::value]; + Json::Value const bobUSD = jrr[jss::node][sfBalance.fieldName][jss::value]; if (!NumberSwitchOver) { - BEAST_EXPECT(bobsUSD == "-0.966500000033334"); + BEAST_EXPECT(bobUSD == "-0.966500000033334"); } else { - BEAST_EXPECT(bobsUSD == "-0.9665000000333333"); + BEAST_EXPECT(bobUSD == "-0.9665000000333333"); } } } @@ -2265,8 +2265,8 @@ public: // The scenario: // o alice has USD but wants XRP. // o bob has XRP but wants USD. - auto const alicesXRP = env.balance(alice); - auto const bobsXRP = env.balance(bob); + auto const aliceXRP = env.balance(alice); + auto const bobXRP = env.balance(bob); env(offer(alice, xrpOffer, usdOffer)); env.close(); @@ -2276,8 +2276,8 @@ public: env.require( balance(alice, USD(0)), balance(bob, usdOffer), - balance(alice, alicesXRP + xrpOffer - fee), - balance(bob, bobsXRP - xrpOffer - fee), + balance(alice, aliceXRP + xrpOffer - fee), + balance(bob, bobXRP - xrpOffer - fee), offers(alice, 0), offers(bob, 0)); @@ -2293,13 +2293,13 @@ public: env.require(offers(alice, 0)); verifyDefaultTrustline(env, bob, USD(1)); { - auto const bobsOffers = offersOnAccount(env, bob); - BEAST_EXPECT(bobsOffers.size() == 1); - auto const& bobsOffer = *(bobsOffers.front()); + auto const bobOffers = offersOnAccount(env, bob); + BEAST_EXPECT(bobOffers.size() == 1); + auto const& bobOffer = *(bobOffers.front()); - BEAST_EXPECT(bobsOffer[sfLedgerEntryType] == ltOFFER); - BEAST_EXPECT(bobsOffer[sfTakerGets] == USD(1)); - BEAST_EXPECT(bobsOffer[sfTakerPays] == XRP(1)); + BEAST_EXPECT(bobOffer[sfLedgerEntryType] == ltOFFER); + BEAST_EXPECT(bobOffer[sfTakerGets] == USD(1)); + BEAST_EXPECT(bobOffer[sfTakerPays] == XRP(1)); } } @@ -2375,13 +2375,13 @@ public: env.require(balance(bob, EUR(999))); { - auto bobsOffers = offersOnAccount(env, bob); - if (BEAST_EXPECT(bobsOffers.size() == 1)) + auto bobOffers = offersOnAccount(env, bob); + if (BEAST_EXPECT(bobOffers.size() == 1)) { - auto const& bobsOffer = *(bobsOffers.front()); + auto const& bobOffer = *(bobOffers.front()); - BEAST_EXPECT(bobsOffer[sfTakerGets] == USD(1)); - BEAST_EXPECT(bobsOffer[sfTakerPays] == EUR(1)); + BEAST_EXPECT(bobOffer[sfTakerGets] == USD(1)); + BEAST_EXPECT(bobOffer[sfTakerPays] == EUR(1)); } } @@ -2470,22 +2470,22 @@ public: verifyDefaultTrustline(env, bob, EUR(400)); verifyDefaultTrustline(env, carol, USD(400)); { - auto const alicesOffers = offersOnAccount(env, alice); - BEAST_EXPECT(alicesOffers.size() == 1); - auto const& alicesOffer = *(alicesOffers.front()); + auto const aliceOffers = offersOnAccount(env, alice); + BEAST_EXPECT(aliceOffers.size() == 1); + auto const& aliceOffer = *(aliceOffers.front()); - BEAST_EXPECT(alicesOffer[sfLedgerEntryType] == ltOFFER); - BEAST_EXPECT(alicesOffer[sfTakerGets] == USD(600)); - BEAST_EXPECT(alicesOffer[sfTakerPays] == XRP(600)); + BEAST_EXPECT(aliceOffer[sfLedgerEntryType] == ltOFFER); + BEAST_EXPECT(aliceOffer[sfTakerGets] == USD(600)); + BEAST_EXPECT(aliceOffer[sfTakerPays] == XRP(600)); } { - auto const bobsOffers = offersOnAccount(env, bob); - BEAST_EXPECT(bobsOffers.size() == 1); - auto const& bobsOffer = *(bobsOffers.front()); + auto const bobOffers = offersOnAccount(env, bob); + BEAST_EXPECT(bobOffers.size() == 1); + auto const& bobOffer = *(bobOffers.front()); - BEAST_EXPECT(bobsOffer[sfLedgerEntryType] == ltOFFER); - BEAST_EXPECT(bobsOffer[sfTakerGets] == XRP(600)); - BEAST_EXPECT(bobsOffer[sfTakerPays] == EUR(600)); + BEAST_EXPECT(bobOffer[sfLedgerEntryType] == ltOFFER); + BEAST_EXPECT(bobOffer[sfTakerGets] == XRP(600)); + BEAST_EXPECT(bobOffer[sfTakerPays] == EUR(600)); } // carol makes an offer that exactly consumes alice and bob's offers. @@ -2503,15 +2503,15 @@ public: verifyDefaultTrustline(env, carol, USD(1000)); // In pre-flow code alice's offer is left empty in the ledger. - auto const alicesOffers = offersOnAccount(env, alice); - if (alicesOffers.size() != 0) + auto const aliceOffers = offersOnAccount(env, alice); + if (aliceOffers.size() != 0) { - BEAST_EXPECT(alicesOffers.size() == 1); - auto const& alicesOffer = *(alicesOffers.front()); + BEAST_EXPECT(aliceOffers.size() == 1); + auto const& aliceOffer = *(aliceOffers.front()); - BEAST_EXPECT(alicesOffer[sfLedgerEntryType] == ltOFFER); - BEAST_EXPECT(alicesOffer[sfTakerGets] == USD(0)); - BEAST_EXPECT(alicesOffer[sfTakerPays] == XRP(0)); + BEAST_EXPECT(aliceOffer[sfLedgerEntryType] == ltOFFER); + BEAST_EXPECT(aliceOffer[sfTakerGets] == USD(0)); + BEAST_EXPECT(aliceOffer[sfTakerPays] == XRP(0)); } } @@ -3679,16 +3679,16 @@ public: // Place alice's tiny offer in the book first. Let's see what happens // when a reasonable offer crosses it. - STAmount const alicesCnyOffer{ + STAmount const aliceCnyOffer{ CNY.issue(), std::uint64_t(4926000000000000), -23}; - env(offer(alice, alicesCnyOffer, drops(1), tfPassive)); + env(offer(alice, aliceCnyOffer, drops(1), tfPassive)); env.close(); // bob places an ordinary offer - STAmount const bobsCnyStartBalance{ + STAmount const bobCnyStartBalance{ CNY.issue(), std::uint64_t(3767479960090235), -15}; - env(pay(gw, bob, bobsCnyStartBalance)); + env(pay(gw, bob, bobCnyStartBalance)); env.close(); env(offer( @@ -3697,9 +3697,9 @@ public: STAmount{CNY.issue(), std::uint64_t(1000000000000000), -20})); env.close(); - env.require(balance(alice, alicesCnyOffer)); + env.require(balance(alice, aliceCnyOffer)); env.require(balance(alice, startXrpBalance - fee - drops(1))); - env.require(balance(bob, bobsCnyStartBalance - alicesCnyOffer)); + env.require(balance(bob, bobCnyStartBalance - aliceCnyOffer)); env.require(balance(bob, startXrpBalance - (fee * 2) + drops(1))); } diff --git a/src/test/app/PayStrand_test.cpp b/src/test/app/PayStrand_test.cpp index 2f3b36eae5..9b534d9284 100644 --- a/src/test/app/PayStrand_test.cpp +++ b/src/test/app/PayStrand_test.cpp @@ -73,11 +73,11 @@ equal(std::unique_ptr const& s1, DirectStepInfo const& dsi) } bool -equal(std::unique_ptr const& s1, XRPEndpointStepInfo const& xrpsi) +equal(std::unique_ptr const& s1, XRPEndpointStepInfo const& xrpStepInfo) { if (!s1) return false; - return test::xrpEndpointStepEqual(*s1, xrpsi.acc); + return test::xrpEndpointStepEqual(*s1, xrpStepInfo.acc); } bool @@ -970,7 +970,7 @@ struct PayStrand_test : public beast::unit_test::suite Path const p = [&] { Path result; - result.push_back(allpe(gw, bob["USD"])); + result.push_back(allPathElements(gw, bob["USD"])); result.push_back(cpe(EUR.currency)); return result; }(); diff --git a/src/test/app/ReducedOffer_test.cpp b/src/test/app/ReducedOffer_test.cpp index aa1473d2ee..b967096eb8 100644 --- a/src/test/app/ReducedOffer_test.cpp +++ b/src/test/app/ReducedOffer_test.cpp @@ -79,8 +79,8 @@ public: STAmount const initialRate = Quality(newOffer).rate(); std::uint32_t const bobOfferSeq = env.seq(bob); STAmount const bobInitialBalance = env.balance(bob); - STAmount const bobsFee = env.current()->fees().base; - env(offer(bob, newOffer.in, newOffer.out, tfSell), fee(bobsFee)); + STAmount const bobFee = env.current()->fees().base; + env(offer(bob, newOffer.in, newOffer.out, tfSell), fee(bobFee)); env.close(); STAmount const bobFinalBalance = env.balance(bob); @@ -100,7 +100,7 @@ public: amountFromJson(sfTakerGets, bobOffer[jss::node][sfTakerGets.jsonName]); STAmount const reducedTakerPays = amountFromJson(sfTakerPays, bobOffer[jss::node][sfTakerPays.jsonName]); - STAmount const bobGot = env.balance(bob) + bobsFee - bobInitialBalance; + STAmount const bobGot = env.balance(bob) + bobFee - bobInitialBalance; BEAST_EXPECT(reducedTakerPays < newOffer.in); BEAST_EXPECT(reducedTakerGets < newOffer.out); STAmount const inLedgerRate = Quality(Amounts{reducedTakerPays, reducedTakerGets}).rate(); @@ -141,7 +141,7 @@ public: }; // bob's offer (the new offer) is the same every time: - Amounts const bobsOffer{STAmount(XRP(1)), STAmount(USD.issue(), 1, 0)}; + Amounts const bobOffer{STAmount(XRP(1)), STAmount(USD.issue(), 1, 0)}; // alice's offer has a slightly smaller TakerPays with each // iteration. This should mean that the size of the offer bob @@ -151,10 +151,10 @@ public: mantissaReduce += 20'000'000ull) { STAmount aliceUSD{ - bobsOffer.out.issue(), bobsOffer.out.mantissa() - mantissaReduce, bobsOffer.out.exponent()}; - STAmount aliceXRP{bobsOffer.in.issue(), bobsOffer.in.mantissa() - 1}; - Amounts alicesOffer{aliceUSD, aliceXRP}; - blockedCount += exerciseOfferPair(alicesOffer, bobsOffer); + bobOffer.out.issue(), bobOffer.out.mantissa() - mantissaReduce, bobOffer.out.exponent()}; + STAmount aliceXRP{bobOffer.in.issue(), bobOffer.in.mantissa() - 1}; + Amounts aliceOffer{aliceUSD, aliceXRP}; + blockedCount += exerciseOfferPair(aliceOffer, bobOffer); } // None of the test cases should produce a potentially blocking @@ -279,9 +279,9 @@ public: STAmount bobUSD{ aliceOffer.out.issue(), aliceOffer.out.mantissa() - mantissaReduce, aliceOffer.out.exponent()}; STAmount bobXRP{aliceOffer.in.issue(), aliceOffer.in.mantissa() - 1}; - Amounts bobsOffer{bobUSD, bobXRP}; + Amounts bobOffer{bobUSD, bobXRP}; - blockedCount += exerciseOfferPair(aliceOffer, bobsOffer); + blockedCount += exerciseOfferPair(aliceOffer, bobOffer); } // None of the test cases should produce a potentially blocking @@ -333,7 +333,7 @@ public: // then we use that as evidence that bob's offer blocked the // order book. { - bool const bobsOfferGone = !offerInLedger(env, bob, bobOfferSeq); + bool const bobOfferGone = !offerInLedger(env, bob, bobOfferSeq); STAmount const aliceBalanceUSD = env.balance(alice, USD); // Sanity check the ledger if alice got USD. @@ -341,11 +341,11 @@ public: { BEAST_EXPECT(aliceBalanceUSD == initialBobUSD); BEAST_EXPECT(env.balance(bob, USD) == USD(0)); - BEAST_EXPECT(bobsOfferGone); + BEAST_EXPECT(bobOfferGone); } // Track occurrences of order book blocking. - if (!bobsOfferGone && aliceBalanceUSD.signum() == 0) + if (!bobOfferGone && aliceBalanceUSD.signum() == 0) { ++blockedOrderBookCount; } @@ -423,13 +423,13 @@ public: // Examine the aftermath of alice's offer. { - bool const bobsOfferGone = !offerInLedger(env, bob, bobOfferSeq); + bool const bobOfferGone = !offerInLedger(env, bob, bobOfferSeq); STAmount aliceBalanceUSD = env.balance(alice, USD); #if 0 std::cout - << "bobs initial: " << initialBobUSD + << "bob initial: " << initialBobUSD << "; alice final: " << aliceBalanceUSD - << "; bobs offer: " << bobsOfferJson.toStyledString() + << "; bob offer: " << bobOfferJson.toStyledString() << std::endl; #endif // Sanity check the ledger if alice got USD. @@ -437,11 +437,11 @@ public: { BEAST_EXPECT(aliceBalanceUSD == initialBobUSD); BEAST_EXPECT(env.balance(bob, USD) == USD(0)); - BEAST_EXPECT(bobsOfferGone); + BEAST_EXPECT(bobOfferGone); } // Track occurrences of order book blocking. - if (!bobsOfferGone && aliceBalanceUSD.signum() == 0) + if (!bobOfferGone && aliceBalanceUSD.signum() == 0) { ++blockedOrderBookCount; } diff --git a/src/test/app/SHAMapStore_test.cpp b/src/test/app/SHAMapStore_test.cpp index 7951da26d1..c671d6fc27 100644 --- a/src/test/app/SHAMapStore_test.cpp +++ b/src/test/app/SHAMapStore_test.cpp @@ -44,10 +44,10 @@ class SHAMapStore_test : public beast::unit_test::suite auto const seq = json[jss::result][jss::ledger_index].asUInt(); - std::optional oinfo = env.app().getRelationalDatabase().getLedgerInfoByIndex(seq); - if (!oinfo) + std::optional outInfo = env.app().getRelationalDatabase().getLedgerInfoByIndex(seq); + if (!outInfo) return false; - LedgerHeader const& info = oinfo.value(); + LedgerHeader const& info = outInfo.value(); std::string const outHash = to_string(info.hash); LedgerIndex const outSeq = info.seq; diff --git a/src/test/app/TrustAndBalance_test.cpp b/src/test/app/TrustAndBalance_test.cpp index b695430c7f..aa06ccbdf1 100644 --- a/src/test/app/TrustAndBalance_test.cpp +++ b/src/test/app/TrustAndBalance_test.cpp @@ -383,20 +383,20 @@ class TrustAndBalance_test : public beast::unit_test::suite jvs[jss::streams].append("transactions"); BEAST_EXPECT(wsc->invoke("subscribe", jvs)[jss::status] == "success"); - char const* invoiceid = "243F6A8885A308D313198A2E03707344A4093822299F31D0082EFA98EC4E6C89"; + char const* invoiceId = "243F6A8885A308D313198A2E03707344A4093822299F31D0082EFA98EC4E6C89"; Json::Value jv; - auto tx = env.jt(pay(env.master, alice, XRP(10000)), json(sfInvoiceID.fieldName, invoiceid)); + auto tx = env.jt(pay(env.master, alice, XRP(10000)), json(sfInvoiceID.fieldName, invoiceId)); jv[jss::tx_blob] = strHex(tx.stx->getSerializer().slice()); auto jrr = wsc->invoke("submit", jv)[jss::result]; BEAST_EXPECT(jrr[jss::status] == "success"); - BEAST_EXPECT(jrr[jss::tx_json][sfInvoiceID.fieldName] == invoiceid); + BEAST_EXPECT(jrr[jss::tx_json][sfInvoiceID.fieldName] == invoiceId); env.close(); using namespace std::chrono_literals; - BEAST_EXPECT(wsc->findMsg(2s, [invoiceid](auto const& jval) { + BEAST_EXPECT(wsc->findMsg(2s, [invoiceId](auto const& jval) { auto const& t = jval[jss::transaction]; - return t[jss::TransactionType] == jss::Payment && t[sfInvoiceID.fieldName] == invoiceid; + return t[jss::TransactionType] == jss::Payment && t[sfInvoiceID.fieldName] == invoiceId; })); BEAST_EXPECT(wsc->invoke("unsubscribe", jv)[jss::status] == "success"); diff --git a/src/test/app/Vault_test.cpp b/src/test/app/Vault_test.cpp index e39f665711..5d31c674c0 100644 --- a/src/test/app/Vault_test.cpp +++ b/src/test/app/Vault_test.cpp @@ -4578,7 +4578,7 @@ class Vault_test : public beast::unit_test::suite { testcase("VaultClawback (asset) - " + prefix + " issuer XRP clawback fails"); auto [vault, vaultKeylet] = setupVault(asset, owner, depositor, issuer); - // If the asset is XRP, clawback with amount fails as malfored + // If the asset is XRP, clawback with amount fails as malformed // when asset is specified. env(vault.clawback({ .issuer = issuer, diff --git a/src/test/app/XChain_test.cpp b/src/test/app/XChain_test.cpp index e074e03d97..2921e10ae4 100644 --- a/src/test/app/XChain_test.cpp +++ b/src/test/app/XChain_test.cpp @@ -2149,7 +2149,7 @@ struct XChain_test : public beast::unit_test::suite, public jtx::XChainBridgeObj } void - testXChainAddAccountCreateNonBatchAttestation() + testXChainAddAccountCreateNonBatchAttestation() // cspell: disable-line { using namespace jtx; @@ -3417,7 +3417,7 @@ struct XChain_test : public beast::unit_test::suite, public jtx::XChainBridgeObj testXChainCommit(); testXChainAddAttestation(); testXChainAddClaimNonBatchAttestation(); - testXChainAddAccountCreateNonBatchAttestation(); + testXChainAddAccountCreateNonBatchAttestation(); // cspell: disable-line testXChainClaim(); testXChainCreateAccount(); testFeeDipsIntoReserve(); @@ -3535,6 +3535,7 @@ private: do { callback_called = false; + // cspell: ignore attns for (size_t i = 0; i < signers_attns.size(); ++i) { for (auto& [bridge, claims] : signers_attns[i]) diff --git a/src/test/core/Config_test.cpp b/src/test/core/Config_test.cpp index 1035be6fc0..d5f3bb556c 100644 --- a/src/test/core/Config_test.cpp +++ b/src/test/core/Config_test.cpp @@ -634,8 +634,8 @@ nHBu9PTL9dn2GuZtdW4U2WzBwffyX9qsQCd9CNU4Z5YG3PQfViM8 Config c; std::string toLoad(R"xrpldConfig( [validator_list_sites] -xrplvalidators.com -trustthesevalidators.gov +xrpl-validators.com +trust-these-validators.gov [validator_list_keys] 021A99A537FDEBC34E4FCA03B39BEADD04299BB19E85097EC92B15A3518801E566 @@ -645,8 +645,8 @@ trustthesevalidators.gov )xrpldConfig"); c.loadFromString(toLoad); BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_SITES).values().size() == 2); - BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_SITES).values()[0] == "xrplvalidators.com"); - BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_SITES).values()[1] == "trustthesevalidators.gov"); + BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_SITES).values()[0] == "xrpl-validators.com"); + BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_SITES).values()[1] == "trust-these-validators.gov"); BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_KEYS).values().size() == 1); BEAST_EXPECT( c.section(SECTION_VALIDATOR_LIST_KEYS).values()[0] == @@ -661,8 +661,8 @@ trustthesevalidators.gov Config c; std::string toLoad(R"xrpldConfig( [validator_list_sites] -xrplvalidators.com -trustthesevalidators.gov +xrpl-validators.com +trust-these-validators.gov [validator_list_keys] 021A99A537FDEBC34E4FCA03B39BEADD04299BB19E85097EC92B15A3518801E566 @@ -672,8 +672,8 @@ trustthesevalidators.gov )xrpldConfig"); c.loadFromString(toLoad); BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_SITES).values().size() == 2); - BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_SITES).values()[0] == "xrplvalidators.com"); - BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_SITES).values()[1] == "trustthesevalidators.gov"); + BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_SITES).values()[0] == "xrpl-validators.com"); + BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_SITES).values()[1] == "trust-these-validators.gov"); BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_KEYS).values().size() == 1); BEAST_EXPECT( c.section(SECTION_VALIDATOR_LIST_KEYS).values()[0] == @@ -689,8 +689,8 @@ trustthesevalidators.gov Config c; std::string toLoad(R"xrpldConfig( [validator_list_sites] -xrplvalidators.com -trustthesevalidators.gov +xrpl-validators.com +trust-these-validators.gov [validator_list_keys] 021A99A537FDEBC34E4FCA03B39BEADD04299BB19E85097EC92B15A3518801E566 @@ -718,8 +718,8 @@ trustthesevalidators.gov Config c; std::string toLoad(R"xrpldConfig( [validator_list_sites] -xrplvalidators.com -trustthesevalidators.gov +xrpl-validators.com +trust-these-validators.gov [validator_list_keys] 021A99A537FDEBC34E4FCA03B39BEADD04299BB19E85097EC92B15A3518801E566 @@ -747,8 +747,8 @@ value = 2 Config c; std::string toLoad(R"xrpldConfig( [validator_list_sites] -xrplvalidators.com -trustthesevalidators.gov +xrpl-validators.com +trust-these-validators.gov [validator_list_keys] 021A99A537FDEBC34E4FCA03B39BEADD04299BB19E85097EC92B15A3518801E566 @@ -774,8 +774,8 @@ trustthesevalidators.gov Config c; std::string toLoad(R"xrpldConfig( [validator_list_sites] -xrplvalidators.com -trustthesevalidators.gov +xrpl-validators.com +trust-these-validators.gov )xrpldConfig"); std::string error; auto const expectedError = "[validator_list_keys] config section is missing"; @@ -887,8 +887,8 @@ nHB1X37qrniVugfQcuBTAjswphC1drx7QjFFojJPZwKHHnt8kU7v nHUkAWDR4cB8AgPg7VXMX6et8xRTQb2KJfgv1aBEXozwrawRKgMB [validator_list_sites] -xrplvalidators.com -trustthesevalidators.gov +xrpl-validators.com +trust-these-validators.gov [validator_list_keys] 021A99A537FDEBC34E4FCA03B39BEADD04299BB19E85097EC92B15A3518801E566 diff --git a/src/test/jtx/TestHelpers.h b/src/test/jtx/TestHelpers.h index aea9edeb93..c0e54900f6 100644 --- a/src/test/jtx/TestHelpers.h +++ b/src/test/jtx/TestHelpers.h @@ -535,7 +535,7 @@ cpe(Currency const& c); // All path element STPathElement -allpe(AccountID const& a, Issue const& iss); +allPathElements(AccountID const& a, Issue const& iss); /***************************************************************/ /* Check */ diff --git a/src/test/jtx/impl/AMM.cpp b/src/test/jtx/impl/AMM.cpp index 4d27ddf740..f920858ea5 100644 --- a/src/test/jtx/impl/AMM.cpp +++ b/src/test/jtx/impl/AMM.cpp @@ -253,12 +253,12 @@ AMM::expectAmmRpcInfo( } bool -AMM::expectAmmInfo(STAmount const& asset1, STAmount const& asset2, IOUAmount const& balance, Json::Value const& jvres) +AMM::expectAmmInfo(STAmount const& asset1, STAmount const& asset2, IOUAmount const& balance, Json::Value const& jvRes) const { - if (!jvres.isMember(jss::amm)) + if (!jvRes.isMember(jss::amm)) return false; - auto const& jv = jvres[jss::amm]; + auto const& jv = jvRes[jss::amm]; if (!jv.isMember(jss::amount) || !jv.isMember(jss::amount2) || !jv.isMember(jss::lp_token)) return false; STAmount asset1Info; @@ -360,26 +360,26 @@ AMM::deposit( maxEP->setJson(jv[jss::EPrice]); if (tfee) jv[jss::TradingFee] = *tfee; - std::uint32_t jvflags = 0; + std::uint32_t jvFlags = 0; if (flags) - jvflags = *flags; + jvFlags = *flags; // If including asset1In and asset2In or tokens as // deposit min amounts then must set the flags // explicitly instead of relying on this logic. - if (!(jvflags & tfDepositSubTx)) + if (!(jvFlags & tfDepositSubTx)) { if (tokens && !asset1In) - jvflags |= tfLPToken; + jvFlags |= tfLPToken; else if (tokens && asset1In) - jvflags |= tfOneAssetLPToken; + jvFlags |= tfOneAssetLPToken; else if (asset1In && asset2In) - jvflags |= tfTwoAsset; + jvFlags |= tfTwoAsset; else if (maxEP && asset1In) - jvflags |= tfLimitLPToken; + jvFlags |= tfLimitLPToken; else if (asset1In) - jvflags |= tfSingleAsset; + jvFlags |= tfSingleAsset; } - jv[jss::Flags] = jvflags; + jv[jss::Flags] = jvFlags; return deposit(account, jv, assets, seq, ter); } @@ -465,23 +465,23 @@ AMM::withdraw( STAmount const saMaxEP{*maxEP, lptIssue_}; saMaxEP.setJson(jv[jss::EPrice]); } - std::uint32_t jvflags = 0; + std::uint32_t jvFlags = 0; if (flags) - jvflags = *flags; - if (!(jvflags & tfWithdrawSubTx)) + jvFlags = *flags; + if (!(jvFlags & tfWithdrawSubTx)) { if (tokens && !asset1Out) - jvflags |= tfLPToken; + jvFlags |= tfLPToken; else if (asset1Out && asset2Out) - jvflags |= tfTwoAsset; + jvFlags |= tfTwoAsset; else if (tokens && asset1Out) - jvflags |= tfOneAssetLPToken; + jvFlags |= tfOneAssetLPToken; else if (asset1Out && maxEP) - jvflags |= tfLimitLPToken; + jvFlags |= tfLimitLPToken; else if (asset1Out) - jvflags |= tfSingleAsset; + jvFlags |= tfSingleAsset; } - jv[jss::Flags] = jvflags; + jv[jss::Flags] = jvFlags; return withdraw(account, jv, seq, assets, ter); } diff --git a/src/test/jtx/impl/TestHelpers.cpp b/src/test/jtx/impl/TestHelpers.cpp index 7155c8fd0a..d89dec456b 100644 --- a/src/test/jtx/impl/TestHelpers.cpp +++ b/src/test/jtx/impl/TestHelpers.cpp @@ -304,7 +304,7 @@ cpe(Currency const& c) // All path element STPathElement -allpe(AccountID const& a, Issue const& iss) +allPathElements(AccountID const& a, Issue const& iss) { return STPathElement( STPathElement::typeAccount | STPathElement::typeCurrency | STPathElement::typeIssuer, diff --git a/src/test/jtx/impl/mpt.cpp b/src/test/jtx/impl/mpt.cpp index 90378fae90..f505bff740 100644 --- a/src/test/jtx/impl/mpt.cpp +++ b/src/test/jtx/impl/mpt.cpp @@ -99,10 +99,10 @@ MPTTester::operator MPT() const } Json::Value -MPTTester::createjv(MPTCreate const& arg) +MPTTester::createJV(MPTCreate const& arg) { if (!arg.issuer) - Throw("MPTTester::createjv: issuer is not set"); + Throw("MPTTester::createJV: issuer is not set"); Json::Value jv; jv[sfAccount] = arg.issuer->human(); if (arg.assetScale) @@ -128,7 +128,7 @@ MPTTester::create(MPTCreate const& arg) if (id_) Throw("MPT can't be reused"); id_ = makeMptID(env_.seq(issuer_), issuer_); - Json::Value jv = createjv( + Json::Value jv = createJV( {.issuer = issuer_, .maxAmt = arg.maxAmt, .assetScale = arg.assetScale, @@ -179,11 +179,11 @@ MPTTester::create(MPTCreate const& arg) } Json::Value -MPTTester::destroyjv(MPTDestroy const& arg) +MPTTester::destroyJV(MPTDestroy const& arg) { Json::Value jv; if (!arg.issuer || !arg.id) - Throw("MPTTester::destroyjv: issuer/id is not set"); + Throw("MPTTester::destroyJV: issuer/id is not set"); jv[sfAccount] = arg.issuer->human(); jv[sfMPTokenIssuanceID] = to_string(*arg.id); jv[sfTransactionType] = jss::MPTokenIssuanceDestroy; @@ -196,7 +196,7 @@ MPTTester::destroy(MPTDestroy const& arg) { if (!arg.id && !id_) Throw("MPT has not been created"); - Json::Value jv = destroyjv({.issuer = arg.issuer ? arg.issuer : issuer_, .id = arg.id ? arg.id : id_}); + Json::Value jv = destroyJV({.issuer = arg.issuer ? arg.issuer : issuer_, .id = arg.id ? arg.id : id_}); submit(arg, jv); } @@ -210,11 +210,11 @@ MPTTester::holder(std::string const& holder_) const } Json::Value -MPTTester::authorizejv(MPTAuthorize const& arg) +MPTTester::authorizeJV(MPTAuthorize const& arg) { Json::Value jv; if (!arg.account || !arg.id) - Throw("MPTTester::authorizejv: issuer/id is not set"); + Throw("MPTTester::authorizeJV: account/id is not set"); jv[sfAccount] = arg.account->human(); jv[sfMPTokenIssuanceID] = to_string(*arg.id); if (arg.holder) @@ -229,7 +229,7 @@ MPTTester::authorize(MPTAuthorize const& arg) { if (!arg.id && !id_) Throw("MPT has not been created"); - Json::Value jv = authorizejv({ + Json::Value jv = authorizeJV({ .account = arg.account ? arg.account : issuer_, .holder = arg.holder, .id = arg.id ? arg.id : id_, @@ -289,11 +289,11 @@ MPTTester::authorizeHolders(Holders const& holders) } Json::Value -MPTTester::setjv(MPTSet const& arg) +MPTTester::setJV(MPTSet const& arg) { Json::Value jv; if (!arg.account || !arg.id) - Throw("MPTTester::setjv: issuer/id is not set"); + Throw("MPTTester::setJV: account and/or id is not set"); jv[sfAccount] = arg.account->human(); jv[sfMPTokenIssuanceID] = to_string(*arg.id); if (arg.holder) @@ -328,7 +328,7 @@ MPTTester::set(MPTSet const& arg) { if (!arg.id && !id_) Throw("MPT has not been created"); - Json::Value jv = setjv( + Json::Value jv = setJV( {.account = arg.account ? arg.account : issuer_, .holder = arg.holder, .id = arg.id ? arg.id : id_, @@ -476,7 +476,7 @@ MPTTester::pay( Throw("MPT has not been created"); auto const srcAmt = getBalance(src); auto const destAmt = getBalance(dest); - auto const outstnAmt = getBalance(issuer_); + auto const outstandingAmt = getBalance(issuer_); if (credentials) env_(jtx::pay(src, dest, mpt(amount)), ter(err.value_or(tesSUCCESS)), credentials::ids(*credentials)); @@ -505,7 +505,7 @@ MPTTester::pay( env_.require(mptbalance(*this, src, srcAmt - actual)); env_.require(mptbalance(*this, dest, destAmt + amount)); // Outstanding amount is reduced by the transfer fee if any - env_.require(mptbalance(*this, issuer_, outstnAmt - (actual - amount))); + env_.require(mptbalance(*this, issuer_, outstandingAmt - (actual - amount))); } } diff --git a/src/test/jtx/mpt.h b/src/test/jtx/mpt.h index 792d43056f..510248240d 100644 --- a/src/test/jtx/mpt.h +++ b/src/test/jtx/mpt.h @@ -177,19 +177,19 @@ public: create(MPTCreate const& arg = MPTCreate{}); static Json::Value - createjv(MPTCreate const& arg = MPTCreate{}); + createJV(MPTCreate const& arg = MPTCreate{}); void destroy(MPTDestroy const& arg = MPTDestroy{}); static Json::Value - destroyjv(MPTDestroy const& arg = MPTDestroy{}); + destroyJV(MPTDestroy const& arg = MPTDestroy{}); void authorize(MPTAuthorize const& arg = MPTAuthorize{}); static Json::Value - authorizejv(MPTAuthorize const& arg = MPTAuthorize{}); + authorizeJV(MPTAuthorize const& arg = MPTAuthorize{}); void authorizeHolders(Holders const& holders); @@ -198,7 +198,7 @@ public: set(MPTSet const& set = {}); static Json::Value - setjv(MPTSet const& set = {}); + setJV(MPTSet const& set = {}); [[nodiscard]] bool checkDomainID(std::optional expected) const; diff --git a/src/test/ledger/Directory_test.cpp b/src/test/ledger/Directory_test.cpp index 16d319671c..0774390490 100644 --- a/src/test/ledger/Directory_test.cpp +++ b/src/test/ledger/Directory_test.cpp @@ -164,7 +164,7 @@ struct Directory_test : public beast::unit_test::suite return c; }(); - // First, Alices creates a lot of trustlines, and then + // First, Alice creates a lot of trustlines, and then // deletes them in a different order: { auto cl = currencies; diff --git a/src/test/ledger/View_test.cpp b/src/test/ledger/View_test.cpp index b2cc8d7057..33813e135e 100644 --- a/src/test/ledger/View_test.cpp +++ b/src/test/ledger/View_test.cpp @@ -982,8 +982,8 @@ class GetAmendments_test : public beast::unit_test::suite BEAST_EXPECT(majorities.size() >= 2); // None of the amendments should be enabled yet. - auto enableds = getEnabledAmendments(*env.closed()); - BEAST_EXPECT(enableds.empty()); + auto enabledAmendments = getEnabledAmendments(*env.closed()); + BEAST_EXPECT(enabledAmendments.empty()); // Now wait 2 weeks modulo 256 ledgers for the amendments to be // enabled. Speed the process by closing ledgers every 80 minutes, @@ -992,12 +992,12 @@ class GetAmendments_test : public beast::unit_test::suite { using namespace std::chrono_literals; env.close(80min); - enableds = getEnabledAmendments(*env.closed()); - if (!enableds.empty()) + enabledAmendments = getEnabledAmendments(*env.closed()); + if (!enabledAmendments.empty()) break; } BEAST_EXPECT(i == 255); - BEAST_EXPECT(enableds.size() >= 2); + BEAST_EXPECT(enabledAmendments.size() >= 2); } void diff --git a/src/test/overlay/compression_test.cpp b/src/test/overlay/compression_test.cpp index 6dffe4e5c9..19876809d2 100644 --- a/src/test/overlay/compression_test.cpp +++ b/src/test/overlay/compression_test.cpp @@ -172,12 +172,12 @@ public: std::string usdTxBlob = ""; auto wsc = makeWSClient(env.app().config()); { - Json::Value jrequestUsd; - jrequestUsd[jss::secret] = toBase58(generateSeed("bob")); - jrequestUsd[jss::tx_json] = pay("bob", "alice", bob["USD"](fund / 2)); - Json::Value jreply_usd = wsc->invoke("sign", jrequestUsd); + Json::Value requestUSD; + requestUSD[jss::secret] = toBase58(generateSeed("bob")); + requestUSD[jss::tx_json] = pay("bob", "alice", bob["USD"](fund / 2)); + Json::Value replyUSD = wsc->invoke("sign", requestUSD); - usdTxBlob = toBinary(jreply_usd[jss::result][jss::tx_blob].asString()); + usdTxBlob = toBinary(replyUSD[jss::result][jss::tx_blob].asString()); } auto transaction = std::make_shared(); diff --git a/src/test/protocol/STAmount_test.cpp b/src/test/protocol/STAmount_test.cpp index 10e159dd8d..98bcc7b1bc 100644 --- a/src/test/protocol/STAmount_test.cpp +++ b/src/test/protocol/STAmount_test.cpp @@ -441,9 +441,9 @@ public: STAmount smallValue(noIssue(), (STAmount::cMinValue + STAmount::cMaxValue) / 2, STAmount::cMinOffset + 1); STAmount zeroSt(noIssue(), 0); - STAmount smallXsmall = multiply(smallValue, smallValue, noIssue()); + STAmount smallXSmall = multiply(smallValue, smallValue, noIssue()); - BEAST_EXPECT(smallXsmall == beast::zero); + BEAST_EXPECT(smallXSmall == beast::zero); STAmount bigDsmall = divide(smallValue, bigValue, noIssue()); diff --git a/src/test/rpc/AccountLines_test.cpp b/src/test/rpc/AccountLines_test.cpp index 337da27ea0..1f5f190cfa 100644 --- a/src/test/rpc/AccountLines_test.cpp +++ b/src/test/rpc/AccountLines_test.cpp @@ -380,7 +380,7 @@ public: BEAST_EXPECT(aliceLines2[jss::result][jss::lines].size() == 1); BEAST_EXPECT(!aliceLines2[jss::result].isMember(jss::marker)); - // Get account lines for beckys account, using alices SignerList as a + // Get account lines for becky's account, using alice's SignerList as a // marker. This should cause an error. Json::Value beckyLinesParams; beckyLinesParams[jss::account] = becky.human(); diff --git a/src/test/rpc/AccountObjects_test.cpp b/src/test/rpc/AccountObjects_test.cpp index e9c877b421..0dec2bde7f 100644 --- a/src/test/rpc/AccountObjects_test.cpp +++ b/src/test/rpc/AccountObjects_test.cpp @@ -17,7 +17,7 @@ namespace xrpl { namespace test { -static char const* bobs_account_objects[] = { +static char const* bob_account_objects[] = { R"json({ "Account" : "rPMh7Pi9ct699iZUTWaytJUoHcJ7cgyziK", "BookDirectory" : "50AD0A9E54D2B381288D535EB724E4275FFBF41580D28A925D038D7EA4C68000", @@ -254,7 +254,7 @@ public: Json::Value bobj[4]; for (int i = 0; i < 4; ++i) - Json::Reader{}.parse(bobs_account_objects[i], bobj[i]); + Json::Reader{}.parse(bob_account_objects[i], bobj[i]); // test 'unstepped' // i.e. request account objects without explicit limit/marker paging diff --git a/src/test/rpc/Handler_test.cpp b/src/test/rpc/Handler_test.cpp index 189949d92c..7aeb059f56 100644 --- a/src/test/rpc/Handler_test.cpp +++ b/src/test/rpc/Handler_test.cpp @@ -8,6 +8,7 @@ #include #include #include +// cspell: words stdev namespace xrpl::test { diff --git a/src/test/rpc/LedgerEntry_test.cpp b/src/test/rpc/LedgerEntry_test.cpp index a7ae547272..aa959629b1 100644 --- a/src/test/rpc/LedgerEntry_test.cpp +++ b/src/test/rpc/LedgerEntry_test.cpp @@ -501,7 +501,7 @@ class LedgerEntry_test : public beast::unit_test::suite accountRootIndex = jrr[jss::index].asString(); } { - constexpr char alicesAcctRootBinary[]{ + constexpr char aliceAcctRootBinary[]{ "1100612200800000240000000425000000032D00000000559CE54C3B934E4" "73A995B477E92EC229F99CED5B62BF4D2ACE4DC42719103AE2F6240000002" "540BE4008114AE123A8556F3CF91154711376AFB0F894F832B3D"}; @@ -513,7 +513,7 @@ class LedgerEntry_test : public beast::unit_test::suite jvParams[jss::ledger_hash] = ledgerHash; Json::Value const jrr = env.rpc("json", "ledger_entry", to_string(jvParams))[jss::result]; BEAST_EXPECT(jrr.isMember(jss::node_binary)); - BEAST_EXPECT(jrr[jss::node_binary] == alicesAcctRootBinary); + BEAST_EXPECT(jrr[jss::node_binary] == aliceAcctRootBinary); } { // Request alice's account root using the index. diff --git a/src/test/rpc/NoRipple_test.cpp b/src/test/rpc/NoRipple_test.cpp index 07b0c95e92..9cfc69ccd5 100644 --- a/src/test/rpc/NoRipple_test.cpp +++ b/src/test/rpc/NoRipple_test.cpp @@ -38,8 +38,8 @@ public: // Check no-ripple flag on sender 'gateway' Json::Value lines{env.rpc("json", "account_lines", to_string(account_gw))}; - auto const& gline0 = lines[jss::result][jss::lines][0u]; - BEAST_EXPECT(gline0[jss::no_ripple].asBool() == SetOrClear); + auto const& gwLine0 = lines[jss::result][jss::lines][0u]; + BEAST_EXPECT(gwLine0[jss::no_ripple].asBool() == SetOrClear); // Check no-ripple peer flag on destination 'alice' lines = env.rpc("json", "account_lines", to_string(account_alice)); diff --git a/src/test/rpc/Transaction_test.cpp b/src/test/rpc/Transaction_test.cpp index 0e212afb21..3b289d73ca 100644 --- a/src/test/rpc/Transaction_test.cpp +++ b/src/test/rpc/Transaction_test.cpp @@ -512,7 +512,7 @@ class Transaction_test : public beast::unit_test::suite } void - testCTIDRPC(FeatureBitset features) + testRPCsForCTID(FeatureBitset features) { testcase("CTID RPC"); @@ -804,7 +804,7 @@ public: testRangeRequest(features); testRangeCTIDRequest(features); testCTIDValidation(features); - testCTIDRPC(features); + testRPCsForCTID(features); forAllApiVersions(std::bind_front(&Transaction_test::testRequest, this, features)); } }; From db2734cbc96329f64c23ea68fadc2fc898696510 Mon Sep 17 00:00:00 2001 From: Valentin Balaschenko <13349202+vlntb@users.noreply.github.com> Date: Fri, 6 Feb 2026 21:33:42 +0000 Subject: [PATCH 25/61] refactor: Change main thread name to `xrpld-main` (#6336) This change builds on the thread-renaming PR (#6212), by renaming the main thread name to reduce ambiguity in performance monitoring tools. --- src/xrpld/app/main/Main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xrpld/app/main/Main.cpp b/src/xrpld/app/main/Main.cpp index 031daeb5e9..aaf7af95ab 100644 --- a/src/xrpld/app/main/Main.cpp +++ b/src/xrpld/app/main/Main.cpp @@ -323,7 +323,7 @@ run(int argc, char** argv) { using namespace std; - beast::setCurrentThreadName("main"); + beast::setCurrentThreadName("xrpld-main"); po::variables_map vm; From 68c9b20f2d767608598683feb9f60094ba7b6c54 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Tue, 10 Feb 2026 12:46:23 +0000 Subject: [PATCH 26/61] Force build boost with asan Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> --- cmake/XrplConfig.cmake | 3 +-- cmake/XrplInterface.cmake | 2 +- cmake/deps/Boost.cmake | 15 +++++++++++++-- conan/profiles/sanitizers | 4 ++++ conanfile.py | 14 ++++---------- include/xrpl/core/Coro.ipp | 14 ++++++++------ include/xrpl/core/JobQueue.h | 6 +++--- sanitizers/suppressions/runtime-asan-options.txt | 2 -- 8 files changed, 34 insertions(+), 26 deletions(-) diff --git a/cmake/XrplConfig.cmake b/cmake/XrplConfig.cmake index b1cfeac387..6a28d2635d 100644 --- a/cmake/XrplConfig.cmake +++ b/cmake/XrplConfig.cmake @@ -16,8 +16,7 @@ find_dependency(Boost COMPONENTS chrono container - context - coroutine2 + coroutine date_time filesystem program_options diff --git a/cmake/XrplInterface.cmake b/cmake/XrplInterface.cmake index b89b1f7060..f471b37dd7 100644 --- a/cmake/XrplInterface.cmake +++ b/cmake/XrplInterface.cmake @@ -22,7 +22,7 @@ target_compile_definitions( BOOST_FILESYSTEM_NO_DEPRECATED > $<$>: - BOOST_COROUTINES2_NO_DEPRECATION_WARNING + BOOST_COROUTINES_NO_DEPRECATION_WARNING BOOST_BEAST_ALLOW_DEPRECATED BOOST_FILESYSTEM_DEPRECATED > diff --git a/cmake/deps/Boost.cmake b/cmake/deps/Boost.cmake index fca1bc26e3..f8193f7a95 100644 --- a/cmake/deps/Boost.cmake +++ b/cmake/deps/Boost.cmake @@ -4,12 +4,13 @@ include(XrplSanitizers) find_package(Boost REQUIRED COMPONENTS chrono container - context + coroutine date_time filesystem json program_options regex + system thread) add_library(xrpl_boost INTERFACE) @@ -20,7 +21,7 @@ target_link_libraries( INTERFACE Boost::headers Boost::chrono Boost::container - Boost::context + Boost::coroutine Boost::date_time Boost::filesystem Boost::json @@ -31,6 +32,16 @@ target_link_libraries( if (Boost_COMPILER) target_link_libraries(xrpl_boost INTERFACE Boost::disable_autolinking) endif () + +# Boost.Context's ucontext backend has ASAN fiber-switching annotations +# (start/finish_switch_fiber) that are compiled in when BOOST_USE_ASAN is defined. +# This tells ASAN about coroutine stack switches, preventing false positive +# stack-use-after-scope errors. BOOST_USE_UCONTEXT ensures the ucontext backend +# is selected (fcontext does not support ASAN annotations). +# These defines must match what Boost was compiled with (see conan/profiles/sanitizers). +if (enable_asan) + target_compile_definitions(xrpl_boost INTERFACE BOOST_USE_ASAN BOOST_USE_UCONTEXT) +endif () # if (SANITIZERS_ENABLED AND is_clang) # # TODO: gcc does not support -fsanitize-blacklist...can we do something else for gcc ? # if (NOT Boost_INCLUDE_DIRS AND TARGET Boost::headers) diff --git a/conan/profiles/sanitizers b/conan/profiles/sanitizers index d7a622359a..a90aca50c0 100644 --- a/conan/profiles/sanitizers +++ b/conan/profiles/sanitizers @@ -13,6 +13,8 @@ include(default) {% if "address" in sanitizers %} {% set _ = sanitizer_list.append("address") %} {% set model_code = "-mcmodel=large" %} + {% set _ = extra_cxxflags.append("-DBOOST_USE_ASAN") %} + {% set _ = extra_cxxflags.append("-DBOOST_USE_UCONTEXT") %} {% elif "thread" in sanitizers %} {% set _ = sanitizer_list.append("thread") %} {% set model_code = "-mcmodel=medium" %} @@ -37,6 +39,8 @@ include(default) {% if "address" in sanitizers %} {% set _ = sanitizer_list.append("address") %} + {% set _ = extra_cxxflags.append("-DBOOST_USE_ASAN") %} + {% set _ = extra_cxxflags.append("-DBOOST_USE_UCONTEXT") %} {% elif "thread" in sanitizers %} {% set _ = sanitizer_list.append("thread") %} {% endif %} diff --git a/conanfile.py b/conanfile.py index d582471ef5..a5aef0264b 100644 --- a/conanfile.py +++ b/conanfile.py @@ -56,9 +56,6 @@ class Xrpl(ConanFile): "static": True, "tests": False, "xrpld": False, - "boost/*:without_context": False, - "boost/*:without_coroutine": True, - "boost/*:without_coroutine2": False, "date/*:header_only": True, "ed25519/*:shared": False, "grpc/*:shared": False, @@ -127,15 +124,13 @@ class Xrpl(ConanFile): self.options["boost"].visibility = "global" if self.settings.compiler in ["clang", "gcc"]: self.options["boost"].without_cobalt = True - self.options["boost"].without_context = False - self.options["boost"].without_coroutine = True - self.options["boost"].without_coroutine2 = False - # Check if environment variable exists if "SANITIZERS" in os.environ: sanitizers = os.environ["SANITIZERS"] - if "Address" in sanitizers: + if "address" in sanitizers.lower(): self.default_options["fPIC"] = False + # Boost stacktrace fails to build with some sanitizers + self.options["boost"].without_stacktrace = True def requirements(self): # Conan 2 requires transitive headers to be specified @@ -206,8 +201,7 @@ class Xrpl(ConanFile): "boost::headers", "boost::chrono", "boost::container", - "boost::context", - "boost::coroutine2", + "boost::coroutine", "boost::date_time", "boost::filesystem", "boost::json", diff --git a/include/xrpl/core/Coro.ipp b/include/xrpl/core/Coro.ipp index 2f794995a8..d8269d6f47 100644 --- a/include/xrpl/core/Coro.ipp +++ b/include/xrpl/core/Coro.ipp @@ -18,14 +18,16 @@ JobQueue::Coro::Coro(Coro_create_t, JobQueue& jq, JobType type, std::string cons , type_(type) , name_(name) , running_(false) - , coro_([this, fn = std::forward(f)](boost::coroutines2::asymmetric_coroutine::push_type& do_yield) { - yield_ = &do_yield; - yield(); - fn(shared_from_this()); + , coro_( + [this, fn = std::forward(f)](boost::coroutines::asymmetric_coroutine::push_type& do_yield) { + yield_ = &do_yield; + yield(); + fn(shared_from_this()); #ifndef NDEBUG - finished_ = true; + finished_ = true; #endif - }) + }, + boost::coroutines::attributes(megabytes(4))) // 4MB stack { } diff --git a/include/xrpl/core/JobQueue.h b/include/xrpl/core/JobQueue.h index c290f52f91..b410e200e1 100644 --- a/include/xrpl/core/JobQueue.h +++ b/include/xrpl/core/JobQueue.h @@ -7,7 +7,7 @@ #include #include -#include +#include #include @@ -48,8 +48,8 @@ public: std::mutex mutex_; std::mutex mutex_run_; std::condition_variable cv_; - boost::coroutines2::asymmetric_coroutine::pull_type coro_; - boost::coroutines2::asymmetric_coroutine::push_type* yield_; + boost::coroutines::asymmetric_coroutine::pull_type coro_; + boost::coroutines::asymmetric_coroutine::push_type* yield_; #ifndef NDEBUG bool finished_ = false; #endif diff --git a/sanitizers/suppressions/runtime-asan-options.txt b/sanitizers/suppressions/runtime-asan-options.txt index 9cfe04e2d1..44df59945f 100644 --- a/sanitizers/suppressions/runtime-asan-options.txt +++ b/sanitizers/suppressions/runtime-asan-options.txt @@ -1,6 +1,4 @@ detect_container_overflow=0 -detect_stack_use_after_return=0 -detect_stack-buffer-overflow=0 debug=true halt_on_error=false print_stats=true From 654829294e9a3b017788d8f13042990b5c82d5ff Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Tue, 10 Feb 2026 13:34:29 +0000 Subject: [PATCH 27/61] moved settings to profle Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> --- .config/cspell.config.yaml | 1 + conan/profiles/sanitizers | 12 ++++++++++++ conanfile.py | 2 -- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.config/cspell.config.yaml b/.config/cspell.config.yaml index 566a800b15..a1fd8f45d0 100644 --- a/.config/cspell.config.yaml +++ b/.config/cspell.config.yaml @@ -162,6 +162,7 @@ words: - nftpage - nikb - nonxrp + - norecover - noripple - nudb - nullptr diff --git a/conan/profiles/sanitizers b/conan/profiles/sanitizers index a90aca50c0..4c859b939b 100644 --- a/conan/profiles/sanitizers +++ b/conan/profiles/sanitizers @@ -61,3 +61,15 @@ include(default) {% endif %} tools.info.package_id:confs+=["tools.build:cxxflags", "tools.build:exelinkflags", "tools.build:sharedlinkflags"] + +[options] +{% if sanitizers %} + {% if "address" in sanitizers %} +# Build Boost.Context with ucontext backend (not fcontext) so that +# ASAN fiber-switching annotations (__sanitizer_start/finish_switch_fiber) +# are compiled into the library. fcontext (assembly) has no ASAN support. +boost/*:extra_b2_flags=context-impl=ucontext address-sanitizer=norecover +# Boost stacktrace fails to build with some sanitizers +boost/*:without_stacktrace=True + {% endif %} +{% endif %} diff --git a/conanfile.py b/conanfile.py index a5aef0264b..a8802172ed 100644 --- a/conanfile.py +++ b/conanfile.py @@ -129,8 +129,6 @@ class Xrpl(ConanFile): sanitizers = os.environ["SANITIZERS"] if "address" in sanitizers.lower(): self.default_options["fPIC"] = False - # Boost stacktrace fails to build with some sanitizers - self.options["boost"].without_stacktrace = True def requirements(self): # Conan 2 requires transitive headers to be specified From d5a4f366324aede8dcc8e155d6cd311e5ed9e28f Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Tue, 10 Feb 2026 15:31:13 +0000 Subject: [PATCH 28/61] ucontext, coroutine2 and for boost asan build Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> --- cmake/XrplConfig.cmake | 4 ++-- cmake/XrplInterface.cmake | 2 +- cmake/deps/Boost.cmake | 5 ++--- conan/profiles/sanitizers | 15 +++++++++------ conanfile.py | 9 ++++++++- include/xrpl/core/Coro.ipp | 24 ++++++------------------ include/xrpl/core/JobQueue.h | 6 +++--- 7 files changed, 31 insertions(+), 34 deletions(-) diff --git a/cmake/XrplConfig.cmake b/cmake/XrplConfig.cmake index 6a28d2635d..930320ac2f 100644 --- a/cmake/XrplConfig.cmake +++ b/cmake/XrplConfig.cmake @@ -16,12 +16,12 @@ find_dependency(Boost COMPONENTS chrono container - coroutine + context + coroutine2 date_time filesystem program_options regex - system thread) #[=========================================================[ OpenSSL diff --git a/cmake/XrplInterface.cmake b/cmake/XrplInterface.cmake index f471b37dd7..b89b1f7060 100644 --- a/cmake/XrplInterface.cmake +++ b/cmake/XrplInterface.cmake @@ -22,7 +22,7 @@ target_compile_definitions( BOOST_FILESYSTEM_NO_DEPRECATED > $<$>: - BOOST_COROUTINES_NO_DEPRECATION_WARNING + BOOST_COROUTINES2_NO_DEPRECATION_WARNING BOOST_BEAST_ALLOW_DEPRECATED BOOST_FILESYSTEM_DEPRECATED > diff --git a/cmake/deps/Boost.cmake b/cmake/deps/Boost.cmake index f8193f7a95..9506693a8d 100644 --- a/cmake/deps/Boost.cmake +++ b/cmake/deps/Boost.cmake @@ -4,13 +4,12 @@ include(XrplSanitizers) find_package(Boost REQUIRED COMPONENTS chrono container - coroutine + context date_time filesystem json program_options regex - system thread) add_library(xrpl_boost INTERFACE) @@ -21,7 +20,7 @@ target_link_libraries( INTERFACE Boost::headers Boost::chrono Boost::container - Boost::coroutine + Boost::context Boost::date_time Boost::filesystem Boost::json diff --git a/conan/profiles/sanitizers b/conan/profiles/sanitizers index 4c859b939b..40871240bf 100644 --- a/conan/profiles/sanitizers +++ b/conan/profiles/sanitizers @@ -65,11 +65,14 @@ tools.info.package_id:confs+=["tools.build:cxxflags", "tools.build:exelinkflags" [options] {% if sanitizers %} {% if "address" in sanitizers %} -# Build Boost.Context with ucontext backend (not fcontext) so that -# ASAN fiber-switching annotations (__sanitizer_start/finish_switch_fiber) -# are compiled into the library. fcontext (assembly) has no ASAN support. -boost/*:extra_b2_flags=context-impl=ucontext address-sanitizer=norecover -# Boost stacktrace fails to build with some sanitizers -boost/*:without_stacktrace=True + # Build Boost.Context with ucontext backend (not fcontext) so that + # ASAN fiber-switching annotations (__sanitizer_start/finish_switch_fiber) + # are compiled into the library. fcontext (assembly) has no ASAN support. + # define=BOOST_USE_ASAN=1 is critical: it must be defined when building + # Boost.Context itself so the ucontext backend compiles in the ASAN annotations. + boost/*:extra_b2_flags=context-impl=ucontext address-sanitizer=on define=BOOST_USE_ASAN=1 + boost/*:without_context=False + # Boost stacktrace fails to build with some sanitizers + boost/*:without_stacktrace=True {% endif %} {% endif %} diff --git a/conanfile.py b/conanfile.py index 866d853b03..25a5352b66 100644 --- a/conanfile.py +++ b/conanfile.py @@ -58,6 +58,9 @@ class Xrpl(ConanFile): "tests": False, "unity": False, "xrpld": False, + "boost/*:without_context": False, + "boost/*:without_coroutine": True, + "boost/*:without_coroutine2": False, "date/*:header_only": True, "ed25519/*:shared": False, "grpc/*:shared": False, @@ -126,6 +129,9 @@ class Xrpl(ConanFile): self.options["boost"].visibility = "global" if self.settings.compiler in ["clang", "gcc"]: self.options["boost"].without_cobalt = True + self.options["boost"].without_context = False + self.options["boost"].without_coroutine = True + self.options["boost"].without_coroutine2 = False # Check if environment variable exists if "SANITIZERS" in os.environ: sanitizers = os.environ["SANITIZERS"] @@ -202,7 +208,8 @@ class Xrpl(ConanFile): "boost::headers", "boost::chrono", "boost::container", - "boost::coroutine", + "boost::context", + "boost::coroutine2", "boost::date_time", "boost::filesystem", "boost::json", diff --git a/include/xrpl/core/Coro.ipp b/include/xrpl/core/Coro.ipp index d8269d6f47..8829880829 100644 --- a/include/xrpl/core/Coro.ipp +++ b/include/xrpl/core/Coro.ipp @@ -1,33 +1,21 @@ #pragma once -#include - namespace xrpl { -// Coroutine stack size is set to 2MB to provide sufficient headroom for -// deep call stacks in RPC operations. With 1MB, stack exhaustion occurred -// in production scenarios, particularly in: -// - RPC handlers processing complex JSON (ServerHandler::processRequest) -// - Transaction validation with deep parsing (TransactionSign::getCurrentNetworkFee) -// - Amount parsing with boost::split operations (amountFromJson) -// The 2MB stack provides ~50% safety margin even for the deepest observed -// call chains while keeping memory overhead reasonable (~2MB per coroutine). template JobQueue::Coro::Coro(Coro_create_t, JobQueue& jq, JobType type, std::string const& name, F&& f) : jq_(jq) , type_(type) , name_(name) , running_(false) - , coro_( - [this, fn = std::forward(f)](boost::coroutines::asymmetric_coroutine::push_type& do_yield) { - yield_ = &do_yield; - yield(); - fn(shared_from_this()); + , coro_([this, fn = std::forward(f)](boost::coroutines2::coroutine::push_type& do_yield) { + yield_ = &do_yield; + yield(); + fn(shared_from_this()); #ifndef NDEBUG - finished_ = true; + finished_ = true; #endif - }, - boost::coroutines::attributes(megabytes(4))) // 4MB stack + }) { } diff --git a/include/xrpl/core/JobQueue.h b/include/xrpl/core/JobQueue.h index b410e200e1..e95952d399 100644 --- a/include/xrpl/core/JobQueue.h +++ b/include/xrpl/core/JobQueue.h @@ -7,7 +7,7 @@ #include #include -#include +#include #include @@ -48,8 +48,8 @@ public: std::mutex mutex_; std::mutex mutex_run_; std::condition_variable cv_; - boost::coroutines::asymmetric_coroutine::pull_type coro_; - boost::coroutines::asymmetric_coroutine::push_type* yield_; + boost::coroutines2::coroutine::pull_type coro_; + boost::coroutines2::coroutine::push_type* yield_; #ifndef NDEBUG bool finished_ = false; #endif From 5b4c49f47baa76020d0e9bdfedf20cfbf1315b53 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Tue, 10 Feb 2026 16:19:11 +0000 Subject: [PATCH 29/61] remove coroutine2 from cmake dependency since it is a header lib Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> --- cmake/XrplConfig.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/cmake/XrplConfig.cmake b/cmake/XrplConfig.cmake index 930320ac2f..d922b568c1 100644 --- a/cmake/XrplConfig.cmake +++ b/cmake/XrplConfig.cmake @@ -17,7 +17,6 @@ find_dependency(Boost chrono container context - coroutine2 date_time filesystem program_options From e11f6190b74599737f9f554da3b141f269e43803 Mon Sep 17 00:00:00 2001 From: Olek <115580134+oleks-rip@users.noreply.github.com> Date: Tue, 10 Feb 2026 14:02:53 -0500 Subject: [PATCH 30/61] fix: Update invariant checks for Permissioned Domains (#6134) --- include/xrpl/protocol/detail/features.macro | 2 +- src/test/app/Invariants_test.cpp | 636 ++++++++++++++------ src/test/app/PermissionedDomains_test.cpp | 32 +- src/test/jtx/impl/balance.cpp | 24 +- src/xrpld/app/tx/detail/InvariantCheck.cpp | 102 +++- src/xrpld/app/tx/detail/InvariantCheck.h | 6 +- 6 files changed, 555 insertions(+), 247 deletions(-) diff --git a/include/xrpl/protocol/detail/features.macro b/include/xrpl/protocol/detail/features.macro index d8498ffa2f..961bc6e44c 100644 --- a/include/xrpl/protocol/detail/features.macro +++ b/include/xrpl/protocol/detail/features.macro @@ -15,7 +15,7 @@ // Add new amendments to the top of this list. // Keep it sorted in reverse chronological order. - +XRPL_FIX (PermissionedDomainInvariant, Supported::yes, VoteBehavior::DefaultNo) XRPL_FIX (ExpiredNFTokenOfferRemoval, Supported::yes, VoteBehavior::DefaultNo) XRPL_FIX (BatchInnerSigs, Supported::yes, VoteBehavior::DefaultNo) XRPL_FEATURE(LendingProtocol, Supported::yes, VoteBehavior::DefaultNo) diff --git a/src/test/app/Invariants_test.cpp b/src/test/app/Invariants_test.cpp index b3fa027753..7558c951b0 100644 --- a/src/test/app/Invariants_test.cpp +++ b/src/test/app/Invariants_test.cpp @@ -36,6 +36,12 @@ class Invariants_test : public beast::unit_test::suite // changes that will cause the check to fail. using Precheck = std::function; + static FeatureBitset + defaultAmendments() + { + return xrpl::test::jtx::testable_amendments() | featureInvariantsV1_1 | featureSingleAssetVault; + } + /** Run a specific test case to put the ledger into a state that will be * detected by an invariant. Simulates the actions of a transaction that * would violate an invariant. @@ -62,10 +68,23 @@ class Invariants_test : public beast::unit_test::suite std::initializer_list ters = {tecINVARIANT_FAILED, tefINVARIANT_FAILED}, Preclose const& preclose = {}, TxAccount setTxAccount = TxAccount::None) + { + return doInvariantCheck( + test::jtx::Env(*this, defaultAmendments()), expect_logs, precheck, fee, tx, ters, preclose, setTxAccount); + } + + void + doInvariantCheck( + test::jtx::Env&& env, + std::vector const& expect_logs, + Precheck const& precheck, + XRPAmount fee = XRPAmount{}, + STTx tx = STTx{ttACCOUNT_SET, [](STObject&) {}}, + std::initializer_list ters = {tecINVARIANT_FAILED, tefINVARIANT_FAILED}, + Preclose const& preclose = {}, + TxAccount setTxAccount = TxAccount::None) { using namespace test::jtx; - FeatureBitset amendments = testable_amendments() | featureInvariantsV1_1 | featureSingleAssetVault; - Env env{*this, amendments}; Account const A1{"A1"}; Account const A2{"A2"}; @@ -74,11 +93,28 @@ class Invariants_test : public beast::unit_test::suite BEAST_EXPECT(preclose(A1, A2, env)); env.close(); + if (setTxAccount != TxAccount::None) + tx.setAccountID(sfAccount, setTxAccount == TxAccount::A1 ? A1.id() : A2.id()); + + return doInvariantCheck(std::move(env), A1, A2, expect_logs, precheck, fee, tx, ters); + } + + void + doInvariantCheck( + test::jtx::Env&& env, + test::jtx::Account const& A1, + test::jtx::Account const& A2, + std::vector const& expect_logs, + Precheck const& precheck, + XRPAmount fee = XRPAmount{}, + STTx tx = STTx{ttACCOUNT_SET, [](STObject&) {}}, + std::initializer_list ters = {tecINVARIANT_FAILED, tefINVARIANT_FAILED}) + { + using namespace test::jtx; + OpenView ov{*env.current()}; test::StreamSink sink{beast::severities::kWarning}; beast::Journal jlog{sink}; - if (setTxAccount != TxAccount::None) - tx.setAccountID(sfAccount, setTxAccount == TxAccount::A1 ? A1.id() : A2.id()); ApplyContext ac{env.app(), ov, tx, tesSUCCESS, env.current()->fees().base, tapNONE, jlog}; BEAST_EXPECT(precheck(A1, A2, ac)); @@ -91,19 +127,21 @@ class Invariants_test : public beast::unit_test::suite for (TER const& terExpect : ters) { terActual = ac.checkInvariants(terActual, fee); - BEAST_EXPECT(terExpect == terActual); + BEAST_EXPECTS(terExpect == terActual, std::to_string(TERtoInt(terActual))); auto const messages = sink.messages().str(); - BEAST_EXPECT( - messages.starts_with("Invariant failed:") || messages.starts_with("Transaction caused an exception")); + + if (terActual != tesSUCCESS) + { + BEAST_EXPECTS( + messages.starts_with("Invariant failed:") || + messages.starts_with("Transaction caused an exception"), + messages); + } + // std::cerr << messages << '\n'; for (auto const& m : expect_logs) { - if (messages.find(m) == std::string::npos) - { - // uncomment if you want to log the invariant failure - // std::cerr << " --> " << m << std::endl; - fail(); - } + BEAST_EXPECTS(messages.find(m) != std::string::npos, m); } } } @@ -1119,86 +1157,80 @@ class Invariants_test : public beast::unit_test::suite }); } - void + static std::shared_ptr createPermissionedDomain( ApplyContext& ac, - std::shared_ptr& sle, test::jtx::Account const& A1, - test::jtx::Account const& A2) + test::jtx::Account const& A2, + std::uint32_t numCreds = 2, + std::uint32_t seq = 10) { - sle->setAccountID(sfOwner, A1); - sle->setFieldU32(sfSequence, 10); + Keylet const pdKeylet = keylet::permissionedDomain(A1.id(), seq); + auto sle = std::make_shared(pdKeylet); - STArray credentials(sfAcceptedCredentials, 2); - for (std::size_t n = 0; n < 2; ++n) + sle->setAccountID(sfOwner, A1); + sle->setFieldU32(sfSequence, seq); + + if (numCreds) { - auto cred = STObject::makeInnerObject(sfCredential); - cred.setAccountID(sfIssuer, A2); - auto credType = "cred_type" + std::to_string(n); - cred.setFieldVL(sfCredentialType, Slice(credType.c_str(), credType.size())); - credentials.push_back(std::move(cred)); + // This array is sorted naturally, but if you willing to change this + // behavior don't forget to use credentials::makeSorted + STArray credentials(sfAcceptedCredentials, numCreds); + for (std::size_t n = 0; n < numCreds; ++n) + { + auto cred = STObject::makeInnerObject(sfCredential); + cred.setAccountID(sfIssuer, A2); + auto credType = "cred_type" + std::to_string(n); + cred.setFieldVL(sfCredentialType, Slice(credType.c_str(), credType.size())); + credentials.push_back(std::move(cred)); + } + sle->setFieldArray(sfAcceptedCredentials, credentials); } - sle->setFieldArray(sfAcceptedCredentials, credentials); + ac.view().insert(sle); + return sle; }; void - testPermissionedDomainInvariants() + testPermissionedDomainInvariants(FeatureBitset features) { using namespace test::jtx; - testcase << "PermissionedDomain"; - doInvariantCheck( - {{"permissioned domain with no rules."}}, - [](Account const& A1, Account const&, ApplyContext& ac) { - Keylet const pdKeylet = keylet::permissionedDomain(A1.id(), 10); - auto slePd = std::make_shared(pdKeylet); - slePd->setAccountID(sfOwner, A1); - slePd->setFieldU32(sfSequence, 10); + bool const fixPDEnabled = features[fixPermissionedDomainInvariant]; + std::initializer_list badTers = {tecINVARIANT_FAILED, tecINVARIANT_FAILED}; + std::initializer_list failTers = {tecINVARIANT_FAILED, tefINVARIANT_FAILED}; - ac.view().insert(slePd); - return true; + testcase << "PermissionedDomain" + std::string(fixPDEnabled ? " fix" : ""); + + doInvariantCheck( + Env(*this, features), + {{"permissioned domain with no rules."}}, + [](Account const& A1, Account const& A2, ApplyContext& ac) { + return createPermissionedDomain(ac, A1, A2, 0).get(); }, XRPAmount{}, - STTx{ttPERMISSIONED_DOMAIN_SET, [](STObject& tx) {}}, - {tecINVARIANT_FAILED, tecINVARIANT_FAILED}); + STTx{ttPERMISSIONED_DOMAIN_SET, [](STObject&) {}}, + fixPDEnabled ? failTers : badTers); testcase << "PermissionedDomain 2"; auto constexpr tooBig = maxPermissionedDomainCredentialsArraySize + 1; doInvariantCheck( + Env(*this, features), {{"permissioned domain bad credentials size " + std::to_string(tooBig)}}, [](Account const& A1, Account const& A2, ApplyContext& ac) { - Keylet const pdKeylet = keylet::permissionedDomain(A1.id(), 10); - auto slePd = std::make_shared(pdKeylet); - slePd->setAccountID(sfOwner, A1); - slePd->setFieldU32(sfSequence, 10); - - STArray credentials(sfAcceptedCredentials, tooBig); - for (std::size_t n = 0; n < tooBig; ++n) - { - auto cred = STObject::makeInnerObject(sfCredential); - cred.setAccountID(sfIssuer, A2); - auto credType = std::string("cred_type") + std::to_string(n); - cred.setFieldVL(sfCredentialType, Slice(credType.c_str(), credType.size())); - credentials.push_back(std::move(cred)); - } - slePd->setFieldArray(sfAcceptedCredentials, credentials); - ac.view().insert(slePd); - return true; + return !!createPermissionedDomain(ac, A1, A2, tooBig); }, XRPAmount{}, STTx{ttPERMISSIONED_DOMAIN_SET, [](STObject&) {}}, - {tecINVARIANT_FAILED, tecINVARIANT_FAILED}); + fixPDEnabled ? failTers : badTers); testcase << "PermissionedDomain 3"; doInvariantCheck( + Env(*this, features), {{"permissioned domain credentials aren't sorted"}}, [](Account const& A1, Account const& A2, ApplyContext& ac) { - Keylet const pdKeylet = keylet::permissionedDomain(A1.id(), 10); - auto slePd = std::make_shared(pdKeylet); - slePd->setAccountID(sfOwner, A1); - slePd->setFieldU32(sfSequence, 10); + auto slePd = createPermissionedDomain(ac, A1, A2, 0); STArray credentials(sfAcceptedCredentials, 2); for (std::size_t n = 0; n < 2; ++n) @@ -1210,21 +1242,19 @@ class Invariants_test : public beast::unit_test::suite credentials.push_back(std::move(cred)); } slePd->setFieldArray(sfAcceptedCredentials, credentials); - ac.view().insert(slePd); + ac.view().update(slePd); return true; }, XRPAmount{}, STTx{ttPERMISSIONED_DOMAIN_SET, [](STObject&) {}}, - {tecINVARIANT_FAILED, tecINVARIANT_FAILED}); + fixPDEnabled ? failTers : badTers); testcase << "PermissionedDomain 4"; doInvariantCheck( + Env(*this, features), {{"permissioned domain credentials aren't unique"}}, [](Account const& A1, Account const& A2, ApplyContext& ac) { - Keylet const pdKeylet = keylet::permissionedDomain(A1.id(), 10); - auto slePd = std::make_shared(pdKeylet); - slePd->setAccountID(sfOwner, A1); - slePd->setFieldU32(sfSequence, 10); + auto slePd = createPermissionedDomain(ac, A1, A2, 0); STArray credentials(sfAcceptedCredentials, 2); for (std::size_t n = 0; n < 2; ++n) @@ -1235,22 +1265,20 @@ class Invariants_test : public beast::unit_test::suite credentials.push_back(std::move(cred)); } slePd->setFieldArray(sfAcceptedCredentials, credentials); - ac.view().insert(slePd); + ac.view().update(slePd); return true; }, XRPAmount{}, - STTx{ttPERMISSIONED_DOMAIN_SET, [](STObject& tx) {}}, - {tecINVARIANT_FAILED, tecINVARIANT_FAILED}); + STTx{ttPERMISSIONED_DOMAIN_SET, [](STObject&) {}}, + fixPDEnabled ? failTers : badTers); testcase << "PermissionedDomain Set 1"; doInvariantCheck( + Env(*this, features), {{"permissioned domain with no rules."}}, [&](Account const& A1, Account const& A2, ApplyContext& ac) { - Keylet const pdKeylet = keylet::permissionedDomain(A1.id(), 10); - auto slePd = std::make_shared(pdKeylet); - // create PD - createPermissionedDomain(ac, slePd, A1, A2); + auto slePd = createPermissionedDomain(ac, A1, A2); // update PD with empty rules { @@ -1262,18 +1290,16 @@ class Invariants_test : public beast::unit_test::suite return true; }, XRPAmount{}, - STTx{ttPERMISSIONED_DOMAIN_SET, [](STObject& tx) {}}, - {tecINVARIANT_FAILED, tecINVARIANT_FAILED}); + STTx{ttPERMISSIONED_DOMAIN_SET, [](STObject&) {}}, + fixPDEnabled ? failTers : badTers); testcase << "PermissionedDomain Set 2"; doInvariantCheck( + Env(*this, features), {{"permissioned domain bad credentials size " + std::to_string(tooBig)}}, [&](Account const& A1, Account const& A2, ApplyContext& ac) { - Keylet const pdKeylet = keylet::permissionedDomain(A1.id(), 10); - auto slePd = std::make_shared(pdKeylet); - // create PD - createPermissionedDomain(ac, slePd, A1, A2); + auto slePd = createPermissionedDomain(ac, A1, A2); // update PD { @@ -1295,18 +1321,16 @@ class Invariants_test : public beast::unit_test::suite return true; }, XRPAmount{}, - STTx{ttPERMISSIONED_DOMAIN_SET, [](STObject& tx) {}}, - {tecINVARIANT_FAILED, tecINVARIANT_FAILED}); + STTx{ttPERMISSIONED_DOMAIN_SET, [](STObject&) {}}, + fixPDEnabled ? failTers : badTers); testcase << "PermissionedDomain Set 3"; doInvariantCheck( + Env(*this, features), {{"permissioned domain credentials aren't sorted"}}, [&](Account const& A1, Account const& A2, ApplyContext& ac) { - Keylet const pdKeylet = keylet::permissionedDomain(A1.id(), 10); - auto slePd = std::make_shared(pdKeylet); - // create PD - createPermissionedDomain(ac, slePd, A1, A2); + auto slePd = createPermissionedDomain(ac, A1, A2); // update PD { @@ -1327,18 +1351,16 @@ class Invariants_test : public beast::unit_test::suite return true; }, XRPAmount{}, - STTx{ttPERMISSIONED_DOMAIN_SET, [](STObject& tx) {}}, - {tecINVARIANT_FAILED, tecINVARIANT_FAILED}); + STTx{ttPERMISSIONED_DOMAIN_SET, [](STObject&) {}}, + fixPDEnabled ? failTers : badTers); testcase << "PermissionedDomain Set 4"; doInvariantCheck( + Env(*this, features), {{"permissioned domain credentials aren't unique"}}, [&](Account const& A1, Account const& A2, ApplyContext& ac) { - Keylet const pdKeylet = keylet::permissionedDomain(A1.id(), 10); - auto slePd = std::make_shared(pdKeylet); - // create PD - createPermissionedDomain(ac, slePd, A1, A2); + auto slePd = createPermissionedDomain(ac, A1, A2); // update PD { @@ -1357,8 +1379,155 @@ class Invariants_test : public beast::unit_test::suite return true; }, XRPAmount{}, - STTx{ttPERMISSIONED_DOMAIN_SET, [](STObject& tx) {}}, - {tecINVARIANT_FAILED, tecINVARIANT_FAILED}); + STTx{ttPERMISSIONED_DOMAIN_SET, [](STObject&) {}}, + fixPDEnabled ? failTers : badTers); + + std::initializer_list goodTers = {tesSUCCESS, tesSUCCESS}; + + std::vector badMoreThan1{{"transaction affected more than 1 permissioned domain entry."}}; + std::vector emptyV; + std::vector badNoDomains{{"no domain objects affected by"}}; + std::vector badNotDeleted{{"domain object modified, but not deleted by "}}; + std::vector badDeleted{{"domain object deleted by"}}; + std::vector badTx{{"domain object(s) affected by an unauthorized transaction."}}; + + { + testcase << "PermissionedDomain set 2 domains "; + doInvariantCheck( + Env(*this, features), + fixPDEnabled ? badMoreThan1 : emptyV, + [](Account const& A1, Account const& A2, ApplyContext& ac) { + createPermissionedDomain(ac, A1, A2); + createPermissionedDomain(ac, A1, A2, 2, 11); + return true; + }, + XRPAmount{}, + STTx{ttPERMISSIONED_DOMAIN_SET, [](STObject&) {}}, + fixPDEnabled ? failTers : goodTers); + } + + { + testcase << "PermissionedDomain del 2 domains"; + + Env env1(*this, features); + + Account const A1{"A1"}; + Account const A2{"A2"}; + env1.fund(XRP(1000), A1, A2); + env1.close(); + + [[maybe_unused]] auto [seq1, pd1] = createPermissionedDomainEnv(env1, A1, A2); + [[maybe_unused]] auto [seq2, pd2] = createPermissionedDomainEnv(env1, A1, A2); + env1.close(); + + doInvariantCheck( + std::move(env1), + A1, + A2, + fixPDEnabled ? badMoreThan1 : emptyV, + [&pd1, &pd2](Account const&, Account const&, ApplyContext& ac) { + auto sle1 = ac.view().peek({ltPERMISSIONED_DOMAIN, pd1}); + auto sle2 = ac.view().peek({ltPERMISSIONED_DOMAIN, pd2}); + ac.view().erase(sle1); + ac.view().erase(sle2); + return true; + }, + XRPAmount{}, + STTx{ttPERMISSIONED_DOMAIN_DELETE, [](STObject&) {}}, + fixPDEnabled ? failTers : goodTers); + } + + { + testcase << "PermissionedDomain set 0 domains "; + doInvariantCheck( + Env(*this, features), + fixPDEnabled ? badNoDomains : emptyV, + [](Account const&, Account const&, ApplyContext&) { return true; }, + XRPAmount{}, + STTx{ttPERMISSIONED_DOMAIN_SET, [](STObject&) {}}, + fixPDEnabled ? badTers : goodTers); + } + + { + testcase << "PermissionedDomain del 0 domains"; + + Env env1(*this, features); + + Account const A1{"A1"}; + Account const A2{"A2"}; + env1.fund(XRP(1000), A1, A2); + env1.close(); + + [[maybe_unused]] auto [seq1, pd1] = createPermissionedDomainEnv(env1, A1, A2); + [[maybe_unused]] auto [seq2, pd2] = createPermissionedDomainEnv(env1, A1, A2); + env1.close(); + + doInvariantCheck( + Env(*this, features), + A1, + A2, + fixPDEnabled ? badNoDomains : emptyV, + [](Account const&, Account const&, ApplyContext&) { return true; }, + XRPAmount{}, + STTx{ttPERMISSIONED_DOMAIN_DELETE, [](STObject&) {}}, + fixPDEnabled ? badTers : goodTers); + } + + { + testcase << "PermissionedDomain set, delete domain"; + + Env env1(*this, features); + + Account const A1{"A1"}; + Account const A2{"A2"}; + env1.fund(XRP(1000), A1, A2); + env1.close(); + + [[maybe_unused]] auto [seq1, pd1] = createPermissionedDomainEnv(env1, A1, A2); + env1.close(); + + doInvariantCheck( + std::move(env1), + A1, + A2, + fixPDEnabled ? badDeleted : emptyV, + [&pd1](Account const&, Account const&, ApplyContext& ac) { + auto sle1 = ac.view().peek({ltPERMISSIONED_DOMAIN, pd1}); + ac.view().erase(sle1); + return true; + }, + XRPAmount{}, + STTx{ttPERMISSIONED_DOMAIN_SET, [](STObject&) {}}, + fixPDEnabled ? failTers : goodTers); + } + + { + testcase << "PermissionedDomain del, create domain "; + doInvariantCheck( + Env(*this, features), + fixPDEnabled ? badNotDeleted : emptyV, + [](Account const& A1, Account const& A2, ApplyContext& ac) { + createPermissionedDomain(ac, A1, A2); + return true; + }, + XRPAmount{}, + STTx{ttPERMISSIONED_DOMAIN_DELETE, [](STObject&) {}}, + fixPDEnabled ? failTers : goodTers); + } + + { + testcase << "PermissionedDomain invalid tx"; + + doInvariantCheck( + fixPDEnabled ? badTx : emptyV, + [&](Account const& A1, Account const& A2, ApplyContext& ac) { + createPermissionedDomain(ac, A1, A2); + return true; + }, + XRPAmount{}, + STTx{ttPAYMENT, [](STObject&) {}}, + failTers); + } } void @@ -1478,13 +1647,43 @@ class Invariants_test : public beast::unit_test::suite }); } - void - testPermissionedDEX() + static std::pair + createPermissionedDomainEnv( + test::jtx::Env& env, + test::jtx::Account const& A1, + test::jtx::Account const& A2, + std::uint32_t numCreds = 2) { using namespace test::jtx; - testcase << "PermissionedDEX"; + + pdomain::Credentials credentials; + + for (std::size_t n = 0; n < numCreds; ++n) + { + auto credType = "cred_type" + std::to_string(n); + credentials.push_back({A2, credType}); + } + + std::uint32_t const seq = env.seq(A1); + env(pdomain::setTx(A1, credentials)); + uint256 key = pdomain::getNewDomain(env.meta()); + + // std::cout << "PD, acc: " << A1.id() << ", seq: " << seq << ", k: " << + // key << std::endl; + return {seq, key}; + } + + void + testPermissionedDEX(FeatureBitset features) + { + using namespace test::jtx; + + bool const fixPDEnabled = features[fixPermissionedDomainInvariant]; + + testcase << "PermissionedDEX" + std::string(fixPDEnabled ? " fix" : ""); doInvariantCheck( + Env(*this, features), {{"domain doesn't exist"}}, [](Account const& A1, Account const&, ApplyContext& ac) { Keylet const offerKey = keylet::offer(A1.id(), 10); @@ -1511,12 +1710,9 @@ class Invariants_test : public beast::unit_test::suite // missing domain ID in offer object doInvariantCheck( + Env(*this, features), {{"hybrid offer is malformed"}}, [&](Account const& A1, Account const& A2, ApplyContext& ac) { - Keylet const pdKeylet = keylet::permissionedDomain(A1.id(), 10); - auto slePd = std::make_shared(pdKeylet); - createPermissionedDomain(ac, slePd, A1, A2); - Keylet const offerKey = keylet::offer(A2.id(), 10); auto sleOffer = std::make_shared(offerKey); sleOffer->setAccountID(sfAccount, A2); @@ -1531,116 +1727,154 @@ class Invariants_test : public beast::unit_test::suite return true; }, XRPAmount{}, - STTx{ttOFFER_CREATE, [&](STObject& tx) {}}, + STTx{ttOFFER_CREATE, [&](STObject&) {}}, {tecINVARIANT_FAILED, tecINVARIANT_FAILED}); // more than one entry in sfAdditionalBooks - doInvariantCheck( - {{"hybrid offer is malformed"}}, - [&](Account const& A1, Account const& A2, ApplyContext& ac) { - Keylet const pdKeylet = keylet::permissionedDomain(A1.id(), 10); - auto slePd = std::make_shared(pdKeylet); - createPermissionedDomain(ac, slePd, A1, A2); + { + Env env1(*this, features); - Keylet const offerKey = keylet::offer(A2.id(), 10); - auto sleOffer = std::make_shared(offerKey); - sleOffer->setAccountID(sfAccount, A2); - sleOffer->setFieldAmount(sfTakerPays, A1["USD"](10)); - sleOffer->setFieldAmount(sfTakerGets, XRP(1)); - sleOffer->setFlag(lsfHybrid); - sleOffer->setFieldH256(sfDomainID, pdKeylet.key); + Account const A1{"A1"}; + Account const A2{"A2"}; + env1.fund(XRP(1000), A1, A2); + env1.close(); - STArray bookArr; - bookArr.push_back(STObject::makeInnerObject(sfBook)); - bookArr.push_back(STObject::makeInnerObject(sfBook)); - sleOffer->setFieldArray(sfAdditionalBooks, bookArr); - ac.view().insert(sleOffer); - return true; - }, - XRPAmount{}, - STTx{ttOFFER_CREATE, [&](STObject& tx) {}}, - {tecINVARIANT_FAILED, tecINVARIANT_FAILED}); + [[maybe_unused]] auto [seq1, pd1] = createPermissionedDomainEnv(env1, A1, A2); + env1.close(); + + doInvariantCheck( + std::move(env1), + A1, + A2, + {{"hybrid offer is malformed"}}, + [&pd1](Account const& A1, Account const& A2, ApplyContext& ac) { + Keylet const offerKey = keylet::offer(A2.id(), 10); + auto sleOffer = std::make_shared(offerKey); + sleOffer->setAccountID(sfAccount, A2); + sleOffer->setFieldAmount(sfTakerPays, A1["USD"](10)); + sleOffer->setFieldAmount(sfTakerGets, XRP(1)); + sleOffer->setFlag(lsfHybrid); + sleOffer->setFieldH256(sfDomainID, pd1); + + STArray bookArr; + bookArr.push_back(STObject::makeInnerObject(sfBook)); + bookArr.push_back(STObject::makeInnerObject(sfBook)); + sleOffer->setFieldArray(sfAdditionalBooks, bookArr); + ac.view().insert(sleOffer); + return true; + }, + XRPAmount{}, + STTx{ttOFFER_CREATE, [&](STObject&) {}}, + {tecINVARIANT_FAILED, tecINVARIANT_FAILED}); + } // hybrid offer missing sfAdditionalBooks - doInvariantCheck( - {{"hybrid offer is malformed"}}, - [&](Account const& A1, Account const& A2, ApplyContext& ac) { - Keylet const pdKeylet = keylet::permissionedDomain(A1.id(), 10); - auto slePd = std::make_shared(pdKeylet); - createPermissionedDomain(ac, slePd, A1, A2); + { + Env env1(*this, features); - Keylet const offerKey = keylet::offer(A2.id(), 10); - auto sleOffer = std::make_shared(offerKey); - sleOffer->setAccountID(sfAccount, A2); - sleOffer->setFieldAmount(sfTakerPays, A1["USD"](10)); - sleOffer->setFieldAmount(sfTakerGets, XRP(1)); - sleOffer->setFlag(lsfHybrid); - sleOffer->setFieldH256(sfDomainID, pdKeylet.key); - ac.view().insert(sleOffer); - return true; - }, - XRPAmount{}, - STTx{ttOFFER_CREATE, [&](STObject& tx) {}}, - {tecINVARIANT_FAILED, tecINVARIANT_FAILED}); + Account const A1{"A1"}; + Account const A2{"A2"}; + env1.fund(XRP(1000), A1, A2); + env1.close(); - doInvariantCheck( - {{"transaction consumed wrong domains"}}, - [&](Account const& A1, Account const& A2, ApplyContext& ac) { - Keylet const pdKeylet = keylet::permissionedDomain(A1.id(), 10); - auto slePd = std::make_shared(pdKeylet); - createPermissionedDomain(ac, slePd, A1, A2); + [[maybe_unused]] auto [seq1, pd1] = createPermissionedDomainEnv(env1, A1, A2); + env1.close(); - Keylet const badDomainKeylet = keylet::permissionedDomain(A1.id(), 20); - auto sleBadPd = std::make_shared(badDomainKeylet); - createPermissionedDomain(ac, sleBadPd, A1, A2); + doInvariantCheck( + std::move(env1), + A1, + A2, + {{"hybrid offer is malformed"}}, + [&pd1](Account const& A1, Account const& A2, ApplyContext& ac) { + Keylet const offerKey = keylet::offer(A2.id(), 10); + auto sleOffer = std::make_shared(offerKey); + sleOffer->setAccountID(sfAccount, A2); + sleOffer->setFieldAmount(sfTakerPays, A1["USD"](10)); + sleOffer->setFieldAmount(sfTakerGets, XRP(1)); + sleOffer->setFlag(lsfHybrid); + sleOffer->setFieldH256(sfDomainID, pd1); + ac.view().insert(sleOffer); + return true; + }, + XRPAmount{}, + STTx{ttOFFER_CREATE, [&](STObject&) {}}, + {tecINVARIANT_FAILED, tecINVARIANT_FAILED}); + } - Keylet const offerKey = keylet::offer(A2.id(), 10); - auto sleOffer = std::make_shared(offerKey); - sleOffer->setAccountID(sfAccount, A2); - sleOffer->setFieldAmount(sfTakerPays, A1["USD"](10)); - sleOffer->setFieldAmount(sfTakerGets, XRP(1)); - sleOffer->setFieldH256(sfDomainID, pdKeylet.key); - ac.view().insert(sleOffer); - return true; - }, - XRPAmount{}, - STTx{ - ttOFFER_CREATE, - [&](STObject& tx) { - Account const A1{"A1"}; - Keylet const badDomainKey = keylet::permissionedDomain(A1.id(), 20); - tx.setFieldH256(sfDomainID, badDomainKey.key); - tx.setFieldAmount(sfTakerPays, A1["USD"](10)); - tx.setFieldAmount(sfTakerGets, XRP(1)); - }}, - {tecINVARIANT_FAILED, tecINVARIANT_FAILED}); + { + Env env1(*this, features); - doInvariantCheck( - {{"domain transaction affected regular offers"}}, - [&](Account const& A1, Account const& A2, ApplyContext& ac) { - Keylet const pdKeylet = keylet::permissionedDomain(A1.id(), 10); - auto slePd = std::make_shared(pdKeylet); - createPermissionedDomain(ac, slePd, A1, A2); + Account const A1{"A1"}; + Account const A2{"A2"}; + env1.fund(XRP(1000), A1, A2); + env1.close(); - Keylet const offerKey = keylet::offer(A2.id(), 10); - auto sleOffer = std::make_shared(offerKey); - sleOffer->setAccountID(sfAccount, A2); - sleOffer->setFieldAmount(sfTakerPays, A1["USD"](10)); - sleOffer->setFieldAmount(sfTakerGets, XRP(1)); - ac.view().insert(sleOffer); - return true; - }, - XRPAmount{}, - STTx{ - ttOFFER_CREATE, - [&](STObject& tx) { - Account const A1{"A1"}; - Keylet const domainKey = keylet::permissionedDomain(A1.id(), 10); - tx.setFieldH256(sfDomainID, domainKey.key); - tx.setFieldAmount(sfTakerPays, A1["USD"](10)); - tx.setFieldAmount(sfTakerGets, XRP(1)); - }}, - {tecINVARIANT_FAILED, tecINVARIANT_FAILED}); + [[maybe_unused]] auto [seq1, pd1] = createPermissionedDomainEnv(env1, A1, A2); + [[maybe_unused]] auto [seq2, pd2] = createPermissionedDomainEnv(env1, A1, A2); + env1.close(); + + doInvariantCheck( + std::move(env1), + A1, + A2, + {{"transaction consumed wrong domains"}}, + [&pd1](Account const& A1, Account const& A2, ApplyContext& ac) { + Keylet const offerKey = keylet::offer(A2.id(), 10); + auto sleOffer = std::make_shared(offerKey); + sleOffer->setAccountID(sfAccount, A2); + sleOffer->setFieldAmount(sfTakerPays, A1["USD"](10)); + sleOffer->setFieldAmount(sfTakerGets, XRP(1)); + sleOffer->setFieldH256(sfDomainID, pd1); + ac.view().insert(sleOffer); + return true; + }, + XRPAmount{}, + STTx{ + ttOFFER_CREATE, + [&pd2, &A1](STObject& tx) { + tx.setFieldH256(sfDomainID, pd2); + tx.setFieldAmount(sfTakerPays, A1["USD"](10)); + tx.setFieldAmount(sfTakerGets, XRP(1)); + }}, + {tecINVARIANT_FAILED, tecINVARIANT_FAILED}); + } + + { + Env env1(*this, features); + + Account const A1{"A1"}; + Account const A2{"A2"}; + env1.fund(XRP(1000), A1, A2); + env1.close(); + + [[maybe_unused]] auto [seq1, pd1] = createPermissionedDomainEnv(env1, A1, A2); + env1.close(); + + doInvariantCheck( + std::move(env1), + A1, + A2, + {{"domain transaction affected regular offers"}}, + [&](Account const& A1, Account const& A2, ApplyContext& ac) { + Keylet const offerKey = keylet::offer(A2.id(), 10); + auto sleOffer = std::make_shared(offerKey); + sleOffer->setAccountID(sfAccount, A2); + sleOffer->setFieldAmount(sfTakerPays, A1["USD"](10)); + sleOffer->setFieldAmount(sfTakerGets, XRP(1)); + ac.view().insert(sleOffer); + return true; + }, + XRPAmount{}, + STTx{ + ttOFFER_CREATE, + [&](STObject& tx) { + Account const A1{"A1"}; + tx.setFieldH256(sfDomainID, pd1); + tx.setFieldAmount(sfTakerPays, A1["USD"](10)); + tx.setFieldAmount(sfTakerGets, XRP(1)); + }}, + {tecINVARIANT_FAILED, tecINVARIANT_FAILED}); + } } Keylet @@ -3490,8 +3724,10 @@ public: testNoZeroEscrow(); testValidNewAccountRoot(); testNFTokenPageInvariants(); - testPermissionedDomainInvariants(); - testPermissionedDEX(); + testPermissionedDomainInvariants(defaultAmendments() | fixPermissionedDomainInvariant); + testPermissionedDomainInvariants(defaultAmendments() - fixPermissionedDomainInvariant); + testPermissionedDEX(defaultAmendments() | fixPermissionedDomainInvariant); + testPermissionedDEX(defaultAmendments() - fixPermissionedDomainInvariant); testNoModifiedUnmodifiableFields(); testValidPseudoAccounts(); testValidLoanBroker(); diff --git a/src/test/app/PermissionedDomains_test.cpp b/src/test/app/PermissionedDomains_test.cpp index 1a1fe9a9eb..8485202144 100644 --- a/src/test/app/PermissionedDomains_test.cpp +++ b/src/test/app/PermissionedDomains_test.cpp @@ -38,13 +38,17 @@ class PermissionedDomains_test : public beast::unit_test::suite testable_amendments() // | featurePermissionedDomains | featureCredentials}; + FeatureBitset withFix_{ + testable_amendments() // + | featurePermissionedDomains | featureCredentials}; + // Verify that each tx type can execute if the feature is enabled. void - testEnabled() + testEnabled(FeatureBitset features) { testcase("Enabled"); Account const alice("alice"); - Env env(*this, withFeature_); + Env env(*this, features); env.fund(XRP(1000), alice); pdomain::Credentials credentials{{alice, "first credential"}}; env(pdomain::setTx(alice, credentials)); @@ -237,10 +241,10 @@ class PermissionedDomains_test : public beast::unit_test::suite // Test PermissionedDomainSet void - testSet() + testSet(FeatureBitset features) { testcase("Set"); - Env env(*this, withFeature_); + Env env(*this, features); env.set_parse_failure_expected(true); int const accNum = 12; @@ -395,10 +399,10 @@ class PermissionedDomains_test : public beast::unit_test::suite // Test PermissionedDomainDelete void - testDelete() + testDelete(FeatureBitset features) { testcase("Delete"); - Env env(*this, withFeature_); + Env env(*this, features); Account const alice("alice"); env.fund(XRP(1000), alice); @@ -448,14 +452,14 @@ class PermissionedDomains_test : public beast::unit_test::suite } void - testAccountReserve() + testAccountReserve(FeatureBitset features) { // Verify that the reserve behaves as expected for creating. testcase("Account Reserve"); using namespace test::jtx; - Env env(*this, withFeature_); + Env env(*this, features); Account const alice("alice"); // Fund alice enough to exist, but not enough to meet @@ -500,12 +504,16 @@ public: void run() override { - testEnabled(); + testEnabled(withFeature_); + testEnabled(withFix_); testCredentialsDisabled(); testDisabled(); - testSet(); - testDelete(); - testAccountReserve(); + testSet(withFeature_); + testSet(withFix_); + testDelete(withFeature_); + testDelete(withFix_); + testAccountReserve(withFeature_); + testAccountReserve(withFix_); } }; diff --git a/src/test/jtx/impl/balance.cpp b/src/test/jtx/impl/balance.cpp index 9d6f5c6124..1ebeeed437 100644 --- a/src/test/jtx/impl/balance.cpp +++ b/src/test/jtx/impl/balance.cpp @@ -4,6 +4,10 @@ namespace xrpl { namespace test { namespace jtx { +#define TEST_EXPECT(cond) env.test.expect(cond, __FILE__, __LINE__) +#define TEST_EXPECTS(cond, reason) \ + ((cond) ? (env.test.pass(), true) : (env.test.fail((reason), __FILE__, __LINE__), false)) + void doBalance(Env& env, AccountID const& account, bool none, STAmount const& value, Issue const& issue) { @@ -12,11 +16,13 @@ doBalance(Env& env, AccountID const& account, bool none, STAmount const& value, auto const sle = env.le(keylet::account(account)); if (none) { - env.test.expect(!sle); + TEST_EXPECT(!sle); } - else if (env.test.expect(sle)) + else if (TEST_EXPECT(sle)) { - env.test.expect(sle->getFieldAmount(sfBalance) == value); + TEST_EXPECTS( + sle->getFieldAmount(sfBalance) == value, + sle->getFieldAmount(sfBalance).getText() + " / " + value.getText()); } } else @@ -24,15 +30,15 @@ doBalance(Env& env, AccountID const& account, bool none, STAmount const& value, auto const sle = env.le(keylet::line(account, issue)); if (none) { - env.test.expect(!sle); + TEST_EXPECT(!sle); } - else if (env.test.expect(sle)) + else if (TEST_EXPECT(sle)) { auto amount = sle->getFieldAmount(sfBalance); amount.setIssuer(issue.account); if (account > issue.account) amount.negate(); - env.test.expect(amount == value); + TEST_EXPECTS(amount == value, amount.getText()); } } } @@ -43,12 +49,12 @@ doBalance(Env& env, AccountID const& account, bool none, STAmount const& value, auto const sle = env.le(keylet::mptoken(mptIssue.getMptID(), account)); if (none) { - env.test.expect(!sle); + TEST_EXPECT(!sle); } - else if (env.test.expect(sle)) + else if (TEST_EXPECT(sle)) { STAmount const amount{mptIssue, sle->getFieldU64(sfMPTAmount)}; - env.test.expect(amount == value); + TEST_EXPECT(amount == value); } } diff --git a/src/xrpld/app/tx/detail/InvariantCheck.cpp b/src/xrpld/app/tx/detail/InvariantCheck.cpp index fe47449c36..24a37270ce 100644 --- a/src/xrpld/app/tx/detail/InvariantCheck.cpp +++ b/src/xrpld/app/tx/detail/InvariantCheck.cpp @@ -1507,7 +1507,7 @@ ValidMPTIssuance::finalize( void ValidPermissionedDomain::visitEntry( - bool, + bool isDel, std::shared_ptr const& before, std::shared_ptr const& after) { @@ -1516,39 +1516,29 @@ ValidPermissionedDomain::visitEntry( if (after && after->getType() != ltPERMISSIONED_DOMAIN) return; - auto check = [](SleStatus& sleStatus, std::shared_ptr const& sle) { + auto check = [isDel](std::vector& sleStatus, std::shared_ptr const& sle) { auto const& credentials = sle->getFieldArray(sfAcceptedCredentials); - sleStatus.credentialsSize_ = credentials.size(); auto const sorted = credentials::makeSorted(credentials); - sleStatus.isUnique_ = !sorted.empty(); + + SleStatus ss{credentials.size(), false, !sorted.empty(), isDel}; // If array have duplicates then all the other checks are invalid - sleStatus.isSorted_ = false; - - if (sleStatus.isUnique_) + if (ss.isUnique_) { unsigned i = 0; for (auto const& cred : sorted) { auto const& credTx = credentials[i++]; - sleStatus.isSorted_ = (cred.first == credTx[sfIssuer]) && (cred.second == credTx[sfCredentialType]); - if (!sleStatus.isSorted_) + ss.isSorted_ = (cred.first == credTx[sfIssuer]) && (cred.second == credTx[sfCredentialType]); + if (!ss.isSorted_) break; } } + sleStatus.emplace_back(std::move(ss)); }; - if (before) - { - sleStatus_[0] = SleStatus(); - check(*sleStatus_[0], after); - } - if (after) - { - sleStatus_[1] = SleStatus(); - check(*sleStatus_[1], after); - } + check(sleStatus_, after); } bool @@ -1559,9 +1549,6 @@ ValidPermissionedDomain::finalize( ReadView const& view, beast::Journal const& j) { - if (tx.getTxnType() != ttPERMISSIONED_DOMAIN_SET || result != tesSUCCESS) - return true; - auto check = [](SleStatus const& sleStatus, beast::Journal const& j) { if (!sleStatus.credentialsSize_) { @@ -1595,7 +1582,76 @@ ValidPermissionedDomain::finalize( return true; }; - return (sleStatus_[0] ? check(*sleStatus_[0], j) : true) && (sleStatus_[1] ? check(*sleStatus_[1], j) : true); + if (view.rules().enabled(fixPermissionedDomainInvariant)) + { + // No permissioned domains should be affected if the transaction failed + if (result != tesSUCCESS) + // If nothing changed, all is good. If there were changes, that's + // bad. + return sleStatus_.empty(); + + if (sleStatus_.size() > 1) + { + JLOG(j.fatal()) << "Invariant failed: transaction affected more " + "than 1 permissioned domain entry."; + return false; + } + + switch (tx.getTxnType()) + { + case ttPERMISSIONED_DOMAIN_SET: { + if (sleStatus_.empty()) + { + JLOG(j.fatal()) << "Invariant failed: no domain objects affected by " + "PermissionedDomainSet"; + return false; + } + + auto const& sleStatus = sleStatus_[0]; + if (sleStatus.isDelete_) + { + JLOG(j.fatal()) << "Invariant failed: domain object " + "deleted by PermissionedDomainSet"; + return false; + } + return check(sleStatus, j); + } + case ttPERMISSIONED_DOMAIN_DELETE: { + if (sleStatus_.empty()) + { + JLOG(j.fatal()) << "Invariant failed: no domain objects affected by " + "PermissionedDomainDelete"; + return false; + } + + if (!sleStatus_[0].isDelete_) + { + JLOG(j.fatal()) << "Invariant failed: domain object " + "modified, but not deleted by " + "PermissionedDomainDelete"; + return false; + } + return true; + } + default: { + if (!sleStatus_.empty()) + { + JLOG(j.fatal()) << "Invariant failed: " << sleStatus_.size() + << " domain object(s) affected by an " + "unauthorized transaction. " + << tx.getTxnType(); + return false; + } + return true; + } + } + } + else + { + if (tx.getTxnType() != ttPERMISSIONED_DOMAIN_SET || result != tesSUCCESS || sleStatus_.empty()) + return true; + return check(sleStatus_[0], j); + } } //------------------------------------------------------------------------------ diff --git a/src/xrpld/app/tx/detail/InvariantCheck.h b/src/xrpld/app/tx/detail/InvariantCheck.h index 9a20e372ba..7e9a62d9e2 100644 --- a/src/xrpld/app/tx/detail/InvariantCheck.h +++ b/src/xrpld/app/tx/detail/InvariantCheck.h @@ -449,9 +449,11 @@ class ValidPermissionedDomain struct SleStatus { std::size_t credentialsSize_{0}; - bool isSorted_ = false, isUnique_ = false; + bool isSorted_ = false; + bool isUnique_ = false; + bool isDelete_ = false; }; - std::optional sleStatus_[2]; + std::vector sleStatus_; public: void From ef284692db4588082eac8106b1f5262bf1ad7534 Mon Sep 17 00:00:00 2001 From: Jingchen Date: Wed, 11 Feb 2026 13:42:31 +0000 Subject: [PATCH 31/61] refactor: Modularize WalletDB and Manifest (#6223) This change modularizes the `WalletDB` and `Manifest`. Note that the wallet db has nothing to do with account wallets and it stores node configuration, which is why it depends on the manifest code. --- .../scripts/levelization/results/loops.txt | 5 +- .../scripts/levelization/results/ordering.txt | 18 +- cmake/XrplCore.cmake | 21 +- cmake/XrplInstall.cmake | 1 + .../xrpl/core}/PeerReservationTable.h | 0 include/xrpl/core/ServiceRegistry.h | 24 ++ include/xrpl/core/StartUpType.h | 16 ++ .../app/main => include/xrpl/rdb}/DBInit.h | 0 .../core => include/xrpl/rdb}/DatabaseCon.h | 16 +- {src/xrpld/core => include/xrpl/rdb}/SociDB.h | 0 .../misc => include/xrpl/server}/Manifest.h | 0 .../app/rdb => include/xrpl/server}/State.h | 8 +- .../app/rdb => include/xrpl/server}/Vacuum.h | 2 +- .../app/rdb => include/xrpl/server}/Wallet.h | 7 +- src/libxrpl/rdb/DatabaseCon.cpp | 92 +++++++ .../core/detail => libxrpl/rdb}/SociDB.cpp | 6 +- .../rdb/detail => libxrpl/server}/State.cpp | 2 +- .../rdb/detail => libxrpl/server}/Vacuum.cpp | 4 +- .../rdb/detail => libxrpl/server}/Wallet.cpp | 3 +- src/test/app/LedgerLoad_test.cpp | 22 +- src/test/app/Manifest_test.cpp | 6 +- src/test/app/ValidatorKeys_test.cpp | 2 +- src/test/core/SociDB_test.cpp | 3 +- src/test/nodestore/Database_test.cpp | 3 +- src/test/rpc/LedgerEntry_test.cpp | 4 +- src/xrpld/app/ledger/Ledger.cpp | 1 - src/xrpld/app/main/Application.cpp | 26 +- src/xrpld/app/main/Application.h | 14 +- src/xrpld/app/main/Main.cpp | 16 +- src/xrpld/app/main/NodeIdentity.cpp | 3 +- src/xrpld/app/misc/SHAMapStoreImp.cpp | 2 +- src/xrpld/app/misc/SHAMapStoreImp.h | 4 +- src/xrpld/app/misc/ValidatorList.h | 2 +- src/xrpld/app/misc/detail/AmendmentTable.cpp | 2 +- src/xrpld/app/misc/detail/Manifest.cpp | 7 +- src/xrpld/app/misc/detail/ValidatorKeys.cpp | 2 +- src/xrpld/app/rdb/PeerFinder.h | 3 +- src/xrpld/app/rdb/RelationalDatabase.h | 8 +- src/xrpld/app/rdb/backend/detail/Node.cpp | 8 +- .../app/rdb/backend/detail/SQLiteDatabase.cpp | 48 ++-- .../app/rdb/detail/RelationalDatabase.cpp | 7 +- src/xrpld/core/Config.h | 8 +- src/xrpld/core/detail/Config.cpp | 146 +++++++++++ src/xrpld/core/detail/DatabaseCon.cpp | 242 ------------------ src/xrpld/overlay/detail/OverlayImpl.cpp | 2 +- .../overlay/detail/PeerReservationTable.cpp | 4 +- src/xrpld/peerfinder/detail/StoreSqdb.h | 3 +- src/xrpld/rpc/InfoSub.h | 3 +- 48 files changed, 435 insertions(+), 391 deletions(-) rename {src/xrpld/overlay => include/xrpl/core}/PeerReservationTable.h (100%) create mode 100644 include/xrpl/core/StartUpType.h rename {src/xrpld/app/main => include/xrpl/rdb}/DBInit.h (100%) rename {src/xrpld/core => include/xrpl/rdb}/DatabaseCon.h (93%) rename {src/xrpld/core => include/xrpl/rdb}/SociDB.h (100%) rename {src/xrpld/app/misc => include/xrpl/server}/Manifest.h (100%) rename {src/xrpld/app/rdb => include/xrpl/server}/State.h (91%) rename {src/xrpld/app/rdb => include/xrpl/server}/Vacuum.h (90%) rename {src/xrpld/app/rdb => include/xrpl/server}/Wallet.h (96%) create mode 100644 src/libxrpl/rdb/DatabaseCon.cpp rename src/{xrpld/core/detail => libxrpl/rdb}/SociDB.cpp (98%) rename src/{xrpld/app/rdb/detail => libxrpl/server}/State.cpp (98%) rename src/{xrpld/app/rdb/detail => libxrpl/server}/Vacuum.cpp (96%) rename src/{xrpld/app/rdb/detail => libxrpl/server}/Wallet.cpp (99%) delete mode 100644 src/xrpld/core/detail/DatabaseCon.cpp diff --git a/.github/scripts/levelization/results/loops.txt b/.github/scripts/levelization/results/loops.txt index d15843ceb0..34842d7f48 100644 --- a/.github/scripts/levelization/results/loops.txt +++ b/.github/scripts/levelization/results/loops.txt @@ -4,14 +4,11 @@ Loop: test.jtx test.toplevel Loop: test.jtx test.unit_test test.unit_test == test.jtx -Loop: xrpld.app xrpld.core - xrpld.app > xrpld.core - Loop: xrpld.app xrpld.overlay xrpld.overlay > xrpld.app Loop: xrpld.app xrpld.peerfinder - xrpld.peerfinder ~= xrpld.app + xrpld.peerfinder == xrpld.app Loop: xrpld.app xrpld.rpc xrpld.rpc > xrpld.app diff --git a/.github/scripts/levelization/results/ordering.txt b/.github/scripts/levelization/results/ordering.txt index 88a3441fa1..fabc7b49ca 100644 --- a/.github/scripts/levelization/results/ordering.txt +++ b/.github/scripts/levelization/results/ordering.txt @@ -17,12 +17,15 @@ libxrpl.nodestore > xrpl.protocol libxrpl.protocol > xrpl.basics libxrpl.protocol > xrpl.json libxrpl.protocol > xrpl.protocol +libxrpl.rdb > xrpl.basics +libxrpl.rdb > xrpl.rdb libxrpl.resource > xrpl.basics libxrpl.resource > xrpl.json libxrpl.resource > xrpl.resource libxrpl.server > xrpl.basics libxrpl.server > xrpl.json libxrpl.server > xrpl.protocol +libxrpl.server > xrpl.rdb libxrpl.server > xrpl.server libxrpl.shamap > xrpl.basics libxrpl.shamap > xrpl.protocol @@ -41,7 +44,9 @@ test.app > xrpl.json test.app > xrpl.ledger test.app > xrpl.nodestore test.app > xrpl.protocol +test.app > xrpl.rdb test.app > xrpl.resource +test.app > xrpl.server test.basics > test.jtx test.basics > test.unit_test test.basics > xrpl.basics @@ -67,6 +72,7 @@ test.core > xrpl.basics test.core > xrpl.core test.core > xrpld.core test.core > xrpl.json +test.core > xrpl.rdb test.core > xrpl.server test.csf > xrpl.basics test.csf > xrpld.consensus @@ -95,8 +101,8 @@ test.nodestore > test.jtx test.nodestore > test.toplevel test.nodestore > test.unit_test test.nodestore > xrpl.basics -test.nodestore > xrpld.core test.nodestore > xrpl.nodestore +test.nodestore > xrpl.rdb test.overlay > test.jtx test.overlay > test.toplevel test.overlay > test.unit_test @@ -154,6 +160,7 @@ tests.libxrpl > xrpl.net xrpl.core > xrpl.basics xrpl.core > xrpl.json xrpl.core > xrpl.ledger +xrpl.core > xrpl.protocol xrpl.json > xrpl.basics xrpl.ledger > xrpl.basics xrpl.ledger > xrpl.protocol @@ -162,12 +169,16 @@ xrpl.nodestore > xrpl.basics xrpl.nodestore > xrpl.protocol xrpl.protocol > xrpl.basics xrpl.protocol > xrpl.json +xrpl.rdb > xrpl.basics +xrpl.rdb > xrpl.core xrpl.resource > xrpl.basics xrpl.resource > xrpl.json xrpl.resource > xrpl.protocol xrpl.server > xrpl.basics +xrpl.server > xrpl.core xrpl.server > xrpl.json xrpl.server > xrpl.protocol +xrpl.server > xrpl.rdb xrpl.shamap > xrpl.basics xrpl.shamap > xrpl.nodestore xrpl.shamap > xrpl.protocol @@ -176,12 +187,15 @@ xrpld.app > xrpl.basics xrpld.app > xrpl.core xrpld.app > xrpld.conditions xrpld.app > xrpld.consensus +xrpld.app > xrpld.core xrpld.app > xrpl.json xrpld.app > xrpl.ledger xrpld.app > xrpl.net xrpld.app > xrpl.nodestore xrpld.app > xrpl.protocol +xrpld.app > xrpl.rdb xrpld.app > xrpl.resource +xrpld.app > xrpl.server xrpld.app > xrpl.shamap xrpld.conditions > xrpl.basics xrpld.conditions > xrpl.protocol @@ -193,6 +207,7 @@ xrpld.core > xrpl.core xrpld.core > xrpl.json xrpld.core > xrpl.net xrpld.core > xrpl.protocol +xrpld.core > xrpl.rdb xrpld.overlay > xrpl.basics xrpld.overlay > xrpl.core xrpld.overlay > xrpld.core @@ -204,6 +219,7 @@ xrpld.overlay > xrpl.server xrpld.peerfinder > xrpl.basics xrpld.peerfinder > xrpld.core xrpld.peerfinder > xrpl.protocol +xrpld.peerfinder > xrpl.rdb xrpld.perflog > xrpl.basics xrpld.perflog > xrpl.core xrpld.perflog > xrpld.rpc diff --git a/cmake/XrplCore.cmake b/cmake/XrplCore.cmake index 57d0e83348..cea19db9bc 100644 --- a/cmake/XrplCore.cmake +++ b/cmake/XrplCore.cmake @@ -84,9 +84,6 @@ add_module(xrpl net) target_link_libraries(xrpl.libxrpl.net PUBLIC xrpl.libxrpl.basics xrpl.libxrpl.json xrpl.libxrpl.protocol xrpl.libxrpl.resource) -add_module(xrpl server) -target_link_libraries(xrpl.libxrpl.server PUBLIC xrpl.libxrpl.protocol) - add_module(xrpl nodestore) target_link_libraries(xrpl.libxrpl.nodestore PUBLIC xrpl.libxrpl.basics xrpl.libxrpl.json xrpl.libxrpl.protocol) @@ -94,8 +91,15 @@ add_module(xrpl shamap) target_link_libraries(xrpl.libxrpl.shamap PUBLIC xrpl.libxrpl.basics xrpl.libxrpl.crypto xrpl.libxrpl.protocol xrpl.libxrpl.nodestore) +add_module(xrpl rdb) +target_link_libraries(xrpl.libxrpl.rdb PUBLIC xrpl.libxrpl.basics xrpl.libxrpl.core) + +add_module(xrpl server) +target_link_libraries(xrpl.libxrpl.server PUBLIC xrpl.libxrpl.protocol xrpl.libxrpl.core xrpl.libxrpl.rdb) + add_module(xrpl ledger) -target_link_libraries(xrpl.libxrpl.ledger PUBLIC xrpl.libxrpl.basics xrpl.libxrpl.json xrpl.libxrpl.protocol) +target_link_libraries(xrpl.libxrpl.ledger PUBLIC xrpl.libxrpl.basics xrpl.libxrpl.json xrpl.libxrpl.protocol + xrpl.libxrpl.rdb) add_library(xrpl.libxrpl) set_target_properties(xrpl.libxrpl PROPERTIES OUTPUT_NAME xrpl) @@ -113,13 +117,14 @@ target_link_modules( core crypto json + ledger + net + nodestore protocol + rdb resource server - nodestore - shamap - net - ledger) + shamap) # All headers in libxrpl are in modules. # Uncomment this stanza if you have not yet moved new headers into a module. diff --git a/cmake/XrplInstall.cmake b/cmake/XrplInstall.cmake index 141dc56089..340dca553b 100644 --- a/cmake/XrplInstall.cmake +++ b/cmake/XrplInstall.cmake @@ -23,6 +23,7 @@ install(TARGETS common xrpl.libxrpl.core xrpl.libxrpl.crypto xrpl.libxrpl.json + xrpl.libxrpl.rdb xrpl.libxrpl.ledger xrpl.libxrpl.net xrpl.libxrpl.nodestore diff --git a/src/xrpld/overlay/PeerReservationTable.h b/include/xrpl/core/PeerReservationTable.h similarity index 100% rename from src/xrpld/overlay/PeerReservationTable.h rename to include/xrpl/core/PeerReservationTable.h diff --git a/include/xrpl/core/ServiceRegistry.h b/include/xrpl/core/ServiceRegistry.h index 7147242339..86591a815f 100644 --- a/include/xrpl/core/ServiceRegistry.h +++ b/include/xrpl/core/ServiceRegistry.h @@ -5,6 +5,8 @@ #include #include +#include + namespace xrpl { // Forward declarations @@ -18,6 +20,10 @@ namespace perf { class PerfLog; } +// This is temporary until we migrate all code to use ServiceRegistry. +class Application; + +// Forward declarations class AcceptedLedger; class AmendmentTable; class Cluster; @@ -194,6 +200,24 @@ public: virtual perf::PerfLog& getPerfLog() = 0; + + // Configuration and state + virtual bool + isStopping() const = 0; + + virtual beast::Journal + journal(std::string const& name) = 0; + + virtual boost::asio::io_context& + getIOContext() = 0; + + virtual Logs& + logs() = 0; + + // Temporary: Get the underlying Application for functions that haven't + // been migrated yet. This should be removed once all code is migrated. + virtual Application& + app() = 0; }; } // namespace xrpl diff --git a/include/xrpl/core/StartUpType.h b/include/xrpl/core/StartUpType.h new file mode 100644 index 0000000000..74a1898806 --- /dev/null +++ b/include/xrpl/core/StartUpType.h @@ -0,0 +1,16 @@ +#pragma once + +#include +#include + +namespace xrpl { + +enum class StartUpType { FRESH, NORMAL, LOAD, LOAD_FILE, REPLAY, NETWORK }; + +inline std::ostream& +operator<<(std::ostream& os, StartUpType const& type) +{ + return os << static_cast>(type); +} + +} // namespace xrpl diff --git a/src/xrpld/app/main/DBInit.h b/include/xrpl/rdb/DBInit.h similarity index 100% rename from src/xrpld/app/main/DBInit.h rename to include/xrpl/rdb/DBInit.h diff --git a/src/xrpld/core/DatabaseCon.h b/include/xrpl/rdb/DatabaseCon.h similarity index 93% rename from src/xrpld/core/DatabaseCon.h rename to include/xrpl/rdb/DatabaseCon.h index 89d582257b..37a53044e4 100644 --- a/src/xrpld/core/DatabaseCon.h +++ b/include/xrpl/rdb/DatabaseCon.h @@ -1,10 +1,9 @@ #pragma once -#include -#include -#include - #include +#include +#include +#include #include @@ -68,7 +67,7 @@ public: { explicit Setup() = default; - Config::StartUpType startUp = Config::NORMAL; + StartUpType startUp = StartUpType::NORMAL; bool standAlone = false; boost::filesystem::path dataDir; // Indicates whether or not to return the `globalPragma` @@ -105,8 +104,8 @@ public: beast::Journal journal) // Use temporary files or regular DB files? : DatabaseCon( - setup.standAlone && setup.startUp != Config::LOAD && setup.startUp != Config::LOAD_FILE && - setup.startUp != Config::REPLAY + setup.standAlone && setup.startUp != StartUpType::LOAD && setup.startUp != StartUpType::LOAD_FILE && + setup.startUp != StartUpType::REPLAY ? "" : (setup.dataDir / dbName), setup.commonPragma(), @@ -229,7 +228,4 @@ private: std::shared_ptr checkpointerFromId(std::uintptr_t id); -DatabaseCon::Setup -setup_DatabaseCon(Config const& c, std::optional j = std::nullopt); - } // namespace xrpl diff --git a/src/xrpld/core/SociDB.h b/include/xrpl/rdb/SociDB.h similarity index 100% rename from src/xrpld/core/SociDB.h rename to include/xrpl/rdb/SociDB.h diff --git a/src/xrpld/app/misc/Manifest.h b/include/xrpl/server/Manifest.h similarity index 100% rename from src/xrpld/app/misc/Manifest.h rename to include/xrpl/server/Manifest.h diff --git a/src/xrpld/app/rdb/State.h b/include/xrpl/server/State.h similarity index 91% rename from src/xrpld/app/rdb/State.h rename to include/xrpl/server/State.h index 52118b3cf8..48e11869f4 100644 --- a/src/xrpld/app/rdb/State.h +++ b/include/xrpl/server/State.h @@ -1,10 +1,8 @@ #pragma once -#include -#include -#include -#include -#include +#include +#include +#include #include diff --git a/src/xrpld/app/rdb/Vacuum.h b/include/xrpl/server/Vacuum.h similarity index 90% rename from src/xrpld/app/rdb/Vacuum.h rename to include/xrpl/server/Vacuum.h index f592b4537e..5f80eced87 100644 --- a/src/xrpld/app/rdb/Vacuum.h +++ b/include/xrpl/server/Vacuum.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/rdb/Wallet.h b/include/xrpl/server/Wallet.h similarity index 96% rename from src/xrpld/app/rdb/Wallet.h rename to include/xrpl/server/Wallet.h index 141ef53f27..dcfbada8eb 100644 --- a/src/xrpld/app/rdb/Wallet.h +++ b/include/xrpl/server/Wallet.h @@ -1,9 +1,8 @@ #pragma once -#include -#include -#include -#include +#include +#include +#include namespace xrpl { diff --git a/src/libxrpl/rdb/DatabaseCon.cpp b/src/libxrpl/rdb/DatabaseCon.cpp new file mode 100644 index 0000000000..344df85b4a --- /dev/null +++ b/src/libxrpl/rdb/DatabaseCon.cpp @@ -0,0 +1,92 @@ +#include +#include +#include +#include + +#include +#include + +#include +#include + +namespace xrpl { + +class CheckpointersCollection +{ + std::uintptr_t nextId_{0}; + // Mutex protects the CheckpointersCollection + std::mutex mutex_; + // Each checkpointer is given a unique id. All the checkpointers that are + // part of a DatabaseCon are part of this collection. When the DatabaseCon + // is destroyed, its checkpointer is removed from the collection + std::unordered_map> checkpointers_; + +public: + std::shared_ptr + fromId(std::uintptr_t id) + { + std::lock_guard l{mutex_}; + auto it = checkpointers_.find(id); + if (it != checkpointers_.end()) + return it->second; + return {}; + } + + void + erase(std::uintptr_t id) + { + std::lock_guard lock{mutex_}; + checkpointers_.erase(id); + } + + std::shared_ptr + create(std::shared_ptr const& session, JobQueue& jobQueue, Logs& logs) + { + std::lock_guard lock{mutex_}; + auto const id = nextId_++; + auto const r = makeCheckpointer(id, session, jobQueue, logs); + checkpointers_[id] = r; + return r; + } +}; + +CheckpointersCollection checkpointers; + +std::shared_ptr +checkpointerFromId(std::uintptr_t id) +{ + return checkpointers.fromId(id); +} + +DatabaseCon::~DatabaseCon() +{ + if (checkpointer_) + { + checkpointers.erase(checkpointer_->id()); + + std::weak_ptr wk(checkpointer_); + checkpointer_.reset(); + + // The references to our Checkpointer held by 'checkpointer_' and + // 'checkpointers' have been removed, so if the use count is nonzero, a + // checkpoint is currently in progress. Wait for it to end, otherwise + // creating a new DatabaseCon to the same database may fail due to the + // database being locked by our (now old) Checkpointer. + while (wk.use_count()) + { + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + } + } +} + +std::unique_ptr const> DatabaseCon::Setup::globalPragma; + +void +DatabaseCon::setupCheckpointing(JobQueue* q, Logs& l) +{ + if (!q) + Throw("No JobQueue"); + checkpointer_ = checkpointers.create(session_, *q, l); +} + +} // namespace xrpl diff --git a/src/xrpld/core/detail/SociDB.cpp b/src/libxrpl/rdb/SociDB.cpp similarity index 98% rename from src/xrpld/core/detail/SociDB.cpp rename to src/libxrpl/rdb/SociDB.cpp index ff2fa1d9c1..2f8c5f1ac6 100644 --- a/src/xrpld/core/detail/SociDB.cpp +++ b/src/libxrpl/rdb/SociDB.cpp @@ -3,12 +3,10 @@ #pragma clang diagnostic ignored "-Wdeprecated" #endif -#include -#include -#include - #include #include +#include +#include #include diff --git a/src/xrpld/app/rdb/detail/State.cpp b/src/libxrpl/server/State.cpp similarity index 98% rename from src/xrpld/app/rdb/detail/State.cpp rename to src/libxrpl/server/State.cpp index ad8944e54d..4e3a1584c2 100644 --- a/src/xrpld/app/rdb/detail/State.cpp +++ b/src/libxrpl/server/State.cpp @@ -1,4 +1,4 @@ -#include +#include namespace xrpl { diff --git a/src/xrpld/app/rdb/detail/Vacuum.cpp b/src/libxrpl/server/Vacuum.cpp similarity index 96% rename from src/xrpld/app/rdb/detail/Vacuum.cpp rename to src/libxrpl/server/Vacuum.cpp index 5aaa04f040..cb31c6fa7a 100644 --- a/src/xrpld/app/rdb/detail/Vacuum.cpp +++ b/src/libxrpl/server/Vacuum.cpp @@ -1,7 +1,9 @@ -#include +#include #include +#include + namespace xrpl { bool diff --git a/src/xrpld/app/rdb/detail/Wallet.cpp b/src/libxrpl/server/Wallet.cpp similarity index 99% rename from src/xrpld/app/rdb/detail/Wallet.cpp rename to src/libxrpl/server/Wallet.cpp index 88a5dcf985..51f1326674 100644 --- a/src/xrpld/app/rdb/detail/Wallet.cpp +++ b/src/libxrpl/server/Wallet.cpp @@ -1,4 +1,5 @@ -#include +#include +#include #include diff --git a/src/test/app/LedgerLoad_test.cpp b/src/test/app/LedgerLoad_test.cpp index f27edadd58..b4e84a3123 100644 --- a/src/test/app/LedgerLoad_test.cpp +++ b/src/test/app/LedgerLoad_test.cpp @@ -21,7 +21,7 @@ class LedgerLoad_test : public beast::unit_test::suite std::unique_ptr cfg, std::string const& dbPath, std::string const& ledger, - Config::StartUpType type, + StartUpType type, std::optional trapTxHash) { cfg->START_LEDGER = ledger; @@ -105,7 +105,7 @@ class LedgerLoad_test : public beast::unit_test::suite // create a new env with the ledger file specified for startup Env env( *this, - envconfig(ledgerConfig, sd.dbPath, sd.ledgerFile, Config::LOAD_FILE, std::nullopt), + envconfig(ledgerConfig, sd.dbPath, sd.ledgerFile, StartUpType::LOAD_FILE, std::nullopt), nullptr, beast::severities::kDisabled); auto jrb = env.rpc("ledger", "current", "full")[jss::result]; @@ -123,7 +123,7 @@ class LedgerLoad_test : public beast::unit_test::suite except([&] { Env env( *this, - envconfig(ledgerConfig, sd.dbPath, "", Config::LOAD_FILE, std::nullopt), + envconfig(ledgerConfig, sd.dbPath, "", StartUpType::LOAD_FILE, std::nullopt), nullptr, beast::severities::kDisabled); }); @@ -132,7 +132,7 @@ class LedgerLoad_test : public beast::unit_test::suite except([&] { Env env( *this, - envconfig(ledgerConfig, sd.dbPath, "badfile.json", Config::LOAD_FILE, std::nullopt), + envconfig(ledgerConfig, sd.dbPath, "badfile.json", StartUpType::LOAD_FILE, std::nullopt), nullptr, beast::severities::kDisabled); }); @@ -153,7 +153,7 @@ class LedgerLoad_test : public beast::unit_test::suite except([&] { Env env( *this, - envconfig(ledgerConfig, sd.dbPath, ledgerFileCorrupt.string(), Config::LOAD_FILE, std::nullopt), + envconfig(ledgerConfig, sd.dbPath, ledgerFileCorrupt.string(), StartUpType::LOAD_FILE, std::nullopt), nullptr, beast::severities::kDisabled); }); @@ -170,7 +170,7 @@ class LedgerLoad_test : public beast::unit_test::suite boost::erase_all(ledgerHash, "\""); Env env( *this, - envconfig(ledgerConfig, sd.dbPath, ledgerHash, Config::LOAD, std::nullopt), + envconfig(ledgerConfig, sd.dbPath, ledgerHash, StartUpType::LOAD, std::nullopt), nullptr, beast::severities::kDisabled); auto jrb = env.rpc("ledger", "current", "full")[jss::result]; @@ -189,7 +189,7 @@ class LedgerLoad_test : public beast::unit_test::suite boost::erase_all(ledgerHash, "\""); Env env( *this, - envconfig(ledgerConfig, sd.dbPath, ledgerHash, Config::REPLAY, std::nullopt), + envconfig(ledgerConfig, sd.dbPath, ledgerHash, StartUpType::REPLAY, std::nullopt), nullptr, beast::severities::kDisabled); auto const jrb = env.rpc("ledger", "current", "full")[jss::result]; @@ -213,7 +213,7 @@ class LedgerLoad_test : public beast::unit_test::suite boost::erase_all(ledgerHash, "\""); Env env( *this, - envconfig(ledgerConfig, sd.dbPath, ledgerHash, Config::REPLAY, sd.trapTxHash), + envconfig(ledgerConfig, sd.dbPath, ledgerHash, StartUpType::REPLAY, sd.trapTxHash), nullptr, beast::severities::kDisabled); auto const jrb = env.rpc("ledger", "current", "full")[jss::result]; @@ -241,7 +241,7 @@ class LedgerLoad_test : public beast::unit_test::suite // replay when trapTxHash is set to an invalid transaction Env env( *this, - envconfig(ledgerConfig, sd.dbPath, ledgerHash, Config::REPLAY, ~sd.trapTxHash), + envconfig(ledgerConfig, sd.dbPath, ledgerHash, StartUpType::REPLAY, ~sd.trapTxHash), nullptr, beast::severities::kDisabled); BEAST_EXPECT(false); @@ -265,7 +265,7 @@ class LedgerLoad_test : public beast::unit_test::suite // create a new env with the ledger "latest" specified for startup Env env( *this, - envconfig(ledgerConfig, sd.dbPath, "latest", Config::LOAD, std::nullopt), + envconfig(ledgerConfig, sd.dbPath, "latest", StartUpType::LOAD, std::nullopt), nullptr, beast::severities::kDisabled); auto jrb = env.rpc("ledger", "current", "full")[jss::result]; @@ -281,7 +281,7 @@ class LedgerLoad_test : public beast::unit_test::suite // create a new env with specific ledger index at startup Env env( *this, - envconfig(ledgerConfig, sd.dbPath, "43", Config::LOAD, std::nullopt), + envconfig(ledgerConfig, sd.dbPath, "43", StartUpType::LOAD, std::nullopt), nullptr, beast::severities::kDisabled); auto jrb = env.rpc("ledger", "current", "full")[jss::result]; diff --git a/src/test/app/Manifest_test.cpp b/src/test/app/Manifest_test.cpp index 598949f662..5b7e34ad5b 100644 --- a/src/test/app/Manifest_test.cpp +++ b/src/test/app/Manifest_test.cpp @@ -1,15 +1,15 @@ #include -#include -#include #include -#include #include #include #include #include #include +#include +#include +#include #include #include diff --git a/src/test/app/ValidatorKeys_test.cpp b/src/test/app/ValidatorKeys_test.cpp index fac8a4bb7e..c688b2661f 100644 --- a/src/test/app/ValidatorKeys_test.cpp +++ b/src/test/app/ValidatorKeys_test.cpp @@ -1,12 +1,12 @@ #include -#include #include #include #include #include #include +#include #include diff --git a/src/test/core/SociDB_test.cpp b/src/test/core/SociDB_test.cpp index 001022aa95..fe73d42b0a 100644 --- a/src/test/core/SociDB_test.cpp +++ b/src/test/core/SociDB_test.cpp @@ -1,9 +1,8 @@ #include -#include - #include #include +#include #include #include diff --git a/src/test/nodestore/Database_test.cpp b/src/test/nodestore/Database_test.cpp index 03f0c11990..1229923e7d 100644 --- a/src/test/nodestore/Database_test.cpp +++ b/src/test/nodestore/Database_test.cpp @@ -4,11 +4,10 @@ #include #include -#include - #include #include #include +#include namespace xrpl { diff --git a/src/test/rpc/LedgerEntry_test.cpp b/src/test/rpc/LedgerEntry_test.cpp index aa959629b1..5d12e7bb83 100644 --- a/src/test/rpc/LedgerEntry_test.cpp +++ b/src/test/rpc/LedgerEntry_test.cpp @@ -2050,7 +2050,7 @@ class LedgerEntry_test : public beast::unit_test::suite Account const bob{"bob"}; Env env{*this, envconfig([](auto cfg) { - cfg->START_UP = Config::FRESH; + cfg->START_UP = StartUpType::FRESH; return cfg; })}; @@ -2241,7 +2241,7 @@ class LedgerEntry_test : public beast::unit_test::suite Account const bob{"bob"}; Env env{*this, envconfig([](auto cfg) { - cfg->START_UP = Config::FRESH; + cfg->START_UP = StartUpType::FRESH; return cfg; })}; diff --git a/src/xrpld/app/ledger/Ledger.cpp b/src/xrpld/app/ledger/Ledger.cpp index 9ad08f9894..0f1b81d53d 100644 --- a/src/xrpld/app/ledger/Ledger.cpp +++ b/src/xrpld/app/ledger/Ledger.cpp @@ -7,7 +7,6 @@ #include #include #include -#include #include #include diff --git a/src/xrpld/app/main/Application.cpp b/src/xrpld/app/main/Application.cpp index 2c0d3c2b82..5f7a86e2c2 100644 --- a/src/xrpld/app/main/Application.cpp +++ b/src/xrpld/app/main/Application.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -26,11 +25,8 @@ #include #include #include -#include #include -#include #include -#include #include #include #include @@ -40,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -49,7 +46,9 @@ #include #include #include +#include #include +#include #include #include @@ -1021,6 +1020,12 @@ private: void setMaxDisallowedLedger(); + + Application& + app() override + { + return *this; + } }; //------------------------------------------------------------------------------ @@ -1116,18 +1121,21 @@ ApplicationImp::setup(boost::program_options::variables_map const& cmdline) auto const startUp = config_->START_UP; JLOG(m_journal.debug()) << "startUp: " << startUp; - if (startUp == Config::FRESH) + if (startUp == StartUpType::FRESH) { JLOG(m_journal.info()) << "Starting new Ledger"; startGenesisLedger(); } - else if (startUp == Config::LOAD || startUp == Config::LOAD_FILE || startUp == Config::REPLAY) + else if (startUp == StartUpType::LOAD || startUp == StartUpType::LOAD_FILE || startUp == StartUpType::REPLAY) { JLOG(m_journal.info()) << "Loading specified Ledger"; if (!loadOldLedger( - config_->START_LEDGER, startUp == Config::REPLAY, startUp == Config::LOAD_FILE, config_->TRAP_TX_HASH)) + config_->START_LEDGER, + startUp == StartUpType::REPLAY, + startUp == StartUpType::LOAD_FILE, + config_->TRAP_TX_HASH)) { JLOG(m_journal.error()) << "The specified ledger could not be loaded."; if (config_->FAST_LOAD) @@ -1142,7 +1150,7 @@ ApplicationImp::setup(boost::program_options::variables_map const& cmdline) } } } - else if (startUp == Config::NETWORK) + else if (startUp == StartUpType::NETWORK) { // This should probably become the default once we have a stable // network. @@ -1529,7 +1537,7 @@ void ApplicationImp::startGenesisLedger() { std::vector const initialAmendments = - (config_->START_UP == Config::FRESH) ? m_amendmentTable->getDesired() : std::vector{}; + (config_->START_UP == StartUpType::FRESH) ? m_amendmentTable->getDesired() : std::vector{}; std::shared_ptr const genesis = std::make_shared(create_genesis, *config_, initialAmendments, nodeFamily_); diff --git a/src/xrpld/app/main/Application.h b/src/xrpld/app/main/Application.h index 53cc264ad4..5ecc84c11c 100644 --- a/src/xrpld/app/main/Application.h +++ b/src/xrpld/app/main/Application.h @@ -1,10 +1,10 @@ #pragma once #include -#include #include #include +#include #include #include #include @@ -112,8 +112,6 @@ public: public: Application(); - virtual ~Application() = default; - virtual bool setup(boost::program_options::variables_map const& options) = 0; @@ -127,8 +125,6 @@ public: checkSigs() const = 0; virtual void checkSigs(bool) = 0; - virtual bool - isStopping() const = 0; // // --- @@ -138,14 +134,9 @@ public: virtual std::uint64_t instanceID() const = 0; - virtual Logs& - logs() = 0; virtual Config& config() = 0; - virtual boost::asio::io_context& - getIOContext() = 0; - virtual std::pair const& nodeIdentity() = 0; @@ -158,9 +149,6 @@ public: virtual bool serverOkay(std::string& reason) = 0; - virtual beast::Journal - journal(std::string const& name) = 0; - /* Returns the number of file descriptors the application needs */ virtual int fdRequired() const = 0; diff --git a/src/xrpld/app/main/Main.cpp b/src/xrpld/app/main/Main.cpp index aaf7af95ab..7bdccd12a7 100644 --- a/src/xrpld/app/main/Main.cpp +++ b/src/xrpld/app/main/Main.cpp @@ -1,5 +1,4 @@ #include -#include #include #include #include @@ -8,6 +7,7 @@ #include #include #include +#include #include #include @@ -601,7 +601,7 @@ run(int argc, char** argv) if (vm.count("start")) { - config->START_UP = Config::FRESH; + config->START_UP = StartUpType::FRESH; } if (vm.count("import")) @@ -612,7 +612,7 @@ run(int argc, char** argv) config->START_LEDGER = vm["ledger"].as(); if (vm.count("replay")) { - config->START_UP = Config::REPLAY; + config->START_UP = StartUpType::REPLAY; if (vm.count("trap_tx_hash")) { uint256 tmp = {}; @@ -631,16 +631,16 @@ run(int argc, char** argv) } } else - config->START_UP = Config::LOAD; + config->START_UP = StartUpType::LOAD; } else if (vm.count("ledgerfile")) { config->START_LEDGER = vm["ledgerfile"].as(); - config->START_UP = Config::LOAD_FILE; + config->START_UP = StartUpType::LOAD_FILE; } else if (vm.count("load") || config->FAST_LOAD) { - config->START_UP = Config::LOAD; + config->START_UP = StartUpType::LOAD; } if (vm.count("trap_tx_hash") && vm.count("replay") == 0) @@ -651,13 +651,13 @@ run(int argc, char** argv) if (vm.count("net") && !config->FAST_LOAD) { - if ((config->START_UP == Config::LOAD) || (config->START_UP == Config::REPLAY)) + if ((config->START_UP == StartUpType::LOAD) || (config->START_UP == StartUpType::REPLAY)) { std::cerr << "Net and load/replay options are incompatible" << std::endl; return -1; } - config->START_UP = Config::NETWORK; + config->START_UP = StartUpType::NETWORK; } if (vm.count("valid")) diff --git a/src/xrpld/app/main/NodeIdentity.cpp b/src/xrpld/app/main/NodeIdentity.cpp index b585b80b5b..3019caeb31 100644 --- a/src/xrpld/app/main/NodeIdentity.cpp +++ b/src/xrpld/app/main/NodeIdentity.cpp @@ -1,9 +1,10 @@ #include #include -#include #include #include +#include + namespace xrpl { std::pair diff --git a/src/xrpld/app/misc/SHAMapStoreImp.cpp b/src/xrpld/app/misc/SHAMapStoreImp.cpp index dbdd682ef8..7f276ca2d8 100644 --- a/src/xrpld/app/misc/SHAMapStoreImp.cpp +++ b/src/xrpld/app/misc/SHAMapStoreImp.cpp @@ -1,13 +1,13 @@ #include #include #include -#include #include #include #include #include #include +#include #include #include diff --git a/src/xrpld/app/misc/SHAMapStoreImp.h b/src/xrpld/app/misc/SHAMapStoreImp.h index b046a78979..df3c16b24f 100644 --- a/src/xrpld/app/misc/SHAMapStoreImp.h +++ b/src/xrpld/app/misc/SHAMapStoreImp.h @@ -2,11 +2,11 @@ #include #include -#include -#include #include #include +#include +#include #include #include diff --git a/src/xrpld/app/misc/ValidatorList.h b/src/xrpld/app/misc/ValidatorList.h index 4fd610be04..f93ac8a32f 100644 --- a/src/xrpld/app/misc/ValidatorList.h +++ b/src/xrpld/app/misc/ValidatorList.h @@ -1,6 +1,5 @@ #pragma once -#include #include #include @@ -9,6 +8,7 @@ #include #include #include +#include #include diff --git a/src/xrpld/app/misc/detail/AmendmentTable.cpp b/src/xrpld/app/misc/detail/AmendmentTable.cpp index 2942c8bde6..3addfd2235 100644 --- a/src/xrpld/app/misc/detail/AmendmentTable.cpp +++ b/src/xrpld/app/misc/detail/AmendmentTable.cpp @@ -1,12 +1,12 @@ #include #include -#include #include #include #include #include #include +#include #include #include diff --git a/src/xrpld/app/misc/detail/Manifest.cpp b/src/xrpld/app/misc/detail/Manifest.cpp index 952814656b..dfcbdbb3ad 100644 --- a/src/xrpld/app/misc/detail/Manifest.cpp +++ b/src/xrpld/app/misc/detail/Manifest.cpp @@ -1,13 +1,12 @@ -#include -#include -#include - #include #include #include #include #include #include +#include +#include +#include #include diff --git a/src/xrpld/app/misc/detail/ValidatorKeys.cpp b/src/xrpld/app/misc/detail/ValidatorKeys.cpp index 675ce4ac6f..8f24f14b40 100644 --- a/src/xrpld/app/misc/detail/ValidatorKeys.cpp +++ b/src/xrpld/app/misc/detail/ValidatorKeys.cpp @@ -1,10 +1,10 @@ -#include #include #include #include #include #include +#include namespace xrpl { ValidatorKeys::ValidatorKeys(Config const& config, beast::Journal j) diff --git a/src/xrpld/app/rdb/PeerFinder.h b/src/xrpld/app/rdb/PeerFinder.h index 2b4080255f..e5ac6dda8c 100644 --- a/src/xrpld/app/rdb/PeerFinder.h +++ b/src/xrpld/app/rdb/PeerFinder.h @@ -1,9 +1,10 @@ #pragma once #include -#include #include +#include + namespace xrpl { /** diff --git a/src/xrpld/app/rdb/RelationalDatabase.h b/src/xrpld/app/rdb/RelationalDatabase.h index c0cc61f757..078b8fe8db 100644 --- a/src/xrpld/app/rdb/RelationalDatabase.h +++ b/src/xrpld/app/rdb/RelationalDatabase.h @@ -1,13 +1,13 @@ #pragma once #include -#include #include #include -#include #include #include +#include +#include #include #include @@ -93,13 +93,13 @@ public: /** * @brief init Creates and returns an appropriate RelationalDatabase * instance based on configuration. - * @param app Application object. + * @param registry The service registry. * @param config Config object. * @param jobQueue JobQueue object. * @return Unique pointer to the interface. */ static std::unique_ptr - init(Application& app, Config const& config, JobQueue& jobQueue); + init(ServiceRegistry& registry, Config const& config, JobQueue& jobQueue); virtual ~RelationalDatabase() = default; diff --git a/src/xrpld/app/rdb/backend/detail/Node.cpp b/src/xrpld/app/rdb/backend/detail/Node.cpp index 90c95f3a2d..1e814c3589 100644 --- a/src/xrpld/app/rdb/backend/detail/Node.cpp +++ b/src/xrpld/app/rdb/backend/detail/Node.cpp @@ -5,12 +5,12 @@ #include #include #include -#include -#include #include #include #include +#include +#include #include @@ -64,8 +64,8 @@ makeLedgerDBs( tx->getSession() << boost::str( boost::format("PRAGMA cache_size=-%d;") % kilobytes(config.getValueFor(SizedItem::txnDBCache))); - if (!setup.standAlone || setup.startUp == Config::LOAD || setup.startUp == Config::LOAD_FILE || - setup.startUp == Config::REPLAY) + if (!setup.standAlone || setup.startUp == StartUpType::LOAD || setup.startUp == StartUpType::LOAD_FILE || + setup.startUp == StartUpType::REPLAY) { // Check if AccountTransactions has primary key std::string cid, name, type; diff --git a/src/xrpld/app/rdb/backend/detail/SQLiteDatabase.cpp b/src/xrpld/app/rdb/backend/detail/SQLiteDatabase.cpp index d65b12dc7f..4f1430ee4c 100644 --- a/src/xrpld/app/rdb/backend/detail/SQLiteDatabase.cpp +++ b/src/xrpld/app/rdb/backend/detail/SQLiteDatabase.cpp @@ -3,21 +3,21 @@ #include #include #include -#include -#include #include +#include +#include namespace xrpl { class SQLiteDatabaseImp final : public SQLiteDatabase { public: - SQLiteDatabaseImp(Application& app, Config const& config, JobQueue& jobQueue) - : app_(app), useTxTables_(config.useTxTables()), j_(app_.journal("SQLiteDatabaseImp")) + SQLiteDatabaseImp(ServiceRegistry& registry, Config const& config, JobQueue& jobQueue) + : registry_(registry), useTxTables_(config.useTxTables()), j_(registry.journal("SQLiteDatabaseImp")) { DatabaseCon::Setup const setup = setup_DatabaseCon(config, j_); - if (!makeLedgerDBs(config, setup, DatabaseCon::CheckpointerSetup{&jobQueue, &app_.logs()})) + if (!makeLedgerDBs(config, setup, DatabaseCon::CheckpointerSetup{&jobQueue, ®istry_.logs()})) { std::string_view constexpr error = "Failed to create ledger databases"; @@ -139,7 +139,7 @@ public: closeTransactionDB() override; private: - Application& app_; + ServiceRegistry& registry_; bool const useTxTables_; beast::Journal j_; std::unique_ptr ledgerDb_, txdb_; @@ -370,7 +370,7 @@ SQLiteDatabaseImp::saveValidatedLedger(std::shared_ptr const& ledg { if (existsLedger()) { - if (!detail::saveValidatedLedger(*ledgerDb_, txdb_, app_, ledger, current)) + if (!detail::saveValidatedLedger(*ledgerDb_, txdb_, registry_.app(), ledger, current)) return false; } @@ -506,7 +506,7 @@ SQLiteDatabaseImp::getTxHistory(LedgerIndex startIndex) if (existsTransaction()) { auto db = checkoutTransaction(); - auto const res = detail::getTxHistory(*db, app_, startIndex, 20).first; + auto const res = detail::getTxHistory(*db, registry_.app(), startIndex, 20).first; if (!res.empty()) return res; @@ -521,12 +521,12 @@ SQLiteDatabaseImp::getOldestAccountTxs(AccountTxOptions const& options) if (!useTxTables_) return {}; - LedgerMaster& ledgerMaster = app_.getLedgerMaster(); + LedgerMaster& ledgerMaster = registry_.getLedgerMaster(); if (existsTransaction()) { auto db = checkoutTransaction(); - return detail::getOldestAccountTxs(*db, app_, ledgerMaster, options, j_).first; + return detail::getOldestAccountTxs(*db, registry_.app(), ledgerMaster, options, j_).first; } return {}; @@ -538,12 +538,12 @@ SQLiteDatabaseImp::getNewestAccountTxs(AccountTxOptions const& options) if (!useTxTables_) return {}; - LedgerMaster& ledgerMaster = app_.getLedgerMaster(); + LedgerMaster& ledgerMaster = registry_.getLedgerMaster(); if (existsTransaction()) { auto db = checkoutTransaction(); - return detail::getNewestAccountTxs(*db, app_, ledgerMaster, options, j_).first; + return detail::getNewestAccountTxs(*db, registry_.app(), ledgerMaster, options, j_).first; } return {}; @@ -558,7 +558,7 @@ SQLiteDatabaseImp::getOldestAccountTxsB(AccountTxOptions const& options) if (existsTransaction()) { auto db = checkoutTransaction(); - return detail::getOldestAccountTxsB(*db, app_, options, j_).first; + return detail::getOldestAccountTxsB(*db, registry_.app(), options, j_).first; } return {}; @@ -573,7 +573,7 @@ SQLiteDatabaseImp::getNewestAccountTxsB(AccountTxOptions const& options) if (existsTransaction()) { auto db = checkoutTransaction(); - return detail::getNewestAccountTxsB(*db, app_, options, j_).first; + return detail::getNewestAccountTxsB(*db, registry_.app(), options, j_).first; } return {}; @@ -586,10 +586,9 @@ SQLiteDatabaseImp::oldestAccountTxPage(AccountTxPageOptions const& options) return {}; static std::uint32_t const page_length(200); - auto onUnsavedLedger = std::bind(saveLedgerAsync, std::ref(app_), std::placeholders::_1); + auto onUnsavedLedger = std::bind(saveLedgerAsync, std::ref(registry_.app()), std::placeholders::_1); AccountTxs ret; - Application& app = app_; - auto onTransaction = [&ret, &app]( + auto onTransaction = [&ret, &app = registry_.app()]( std::uint32_t ledger_index, std::string const& status, Blob&& rawTxn, Blob&& rawMeta) { convertBlobsToTxResult(ret, ledger_index, status, rawTxn, rawMeta, app); }; @@ -611,10 +610,9 @@ SQLiteDatabaseImp::newestAccountTxPage(AccountTxPageOptions const& options) return {}; static std::uint32_t const page_length(200); - auto onUnsavedLedger = std::bind(saveLedgerAsync, std::ref(app_), std::placeholders::_1); + auto onUnsavedLedger = std::bind(saveLedgerAsync, std::ref(registry_.app()), std::placeholders::_1); AccountTxs ret; - Application& app = app_; - auto onTransaction = [&ret, &app]( + auto onTransaction = [&ret, &app = registry_.app()]( std::uint32_t ledger_index, std::string const& status, Blob&& rawTxn, Blob&& rawMeta) { convertBlobsToTxResult(ret, ledger_index, status, rawTxn, rawMeta, app); }; @@ -636,7 +634,7 @@ SQLiteDatabaseImp::oldestAccountTxPageB(AccountTxPageOptions const& options) return {}; static std::uint32_t const page_length(500); - auto onUnsavedLedger = std::bind(saveLedgerAsync, std::ref(app_), std::placeholders::_1); + auto onUnsavedLedger = std::bind(saveLedgerAsync, std::ref(registry_.app()), std::placeholders::_1); MetaTxsList ret; auto onTransaction = [&ret](std::uint32_t ledgerIndex, std::string const& status, Blob&& rawTxn, Blob&& rawMeta) { ret.emplace_back(std::move(rawTxn), std::move(rawMeta), ledgerIndex); @@ -659,7 +657,7 @@ SQLiteDatabaseImp::newestAccountTxPageB(AccountTxPageOptions const& options) return {}; static std::uint32_t const page_length(500); - auto onUnsavedLedger = std::bind(saveLedgerAsync, std::ref(app_), std::placeholders::_1); + auto onUnsavedLedger = std::bind(saveLedgerAsync, std::ref(registry_.app()), std::placeholders::_1); MetaTxsList ret; auto onTransaction = [&ret](std::uint32_t ledgerIndex, std::string const& status, Blob&& rawTxn, Blob&& rawMeta) { ret.emplace_back(std::move(rawTxn), std::move(rawMeta), ledgerIndex); @@ -687,7 +685,7 @@ SQLiteDatabaseImp::getTransaction( if (existsTransaction()) { auto db = checkoutTransaction(); - return detail::getTransaction(*db, app_, id, range, ec); + return detail::getTransaction(*db, registry_.app(), id, range, ec); } return TxSearched::unknown; @@ -769,9 +767,9 @@ SQLiteDatabaseImp::closeTransactionDB() } std::unique_ptr -getSQLiteDatabase(Application& app, Config const& config, JobQueue& jobQueue) +getSQLiteDatabase(ServiceRegistry& registry, Config const& config, JobQueue& jobQueue) { - return std::make_unique(app, config, jobQueue); + return std::make_unique(registry, config, jobQueue); } } // namespace xrpl diff --git a/src/xrpld/app/rdb/detail/RelationalDatabase.cpp b/src/xrpld/app/rdb/detail/RelationalDatabase.cpp index 2ceb15d1e7..bc65a817a4 100644 --- a/src/xrpld/app/rdb/detail/RelationalDatabase.cpp +++ b/src/xrpld/app/rdb/detail/RelationalDatabase.cpp @@ -1,14 +1,13 @@ -#include #include #include namespace xrpl { extern std::unique_ptr -getSQLiteDatabase(Application& app, Config const& config, JobQueue& jobQueue); +getSQLiteDatabase(ServiceRegistry& registry, Config const& config, JobQueue& jobQueue); std::unique_ptr -RelationalDatabase::init(Application& app, Config const& config, JobQueue& jobQueue) +RelationalDatabase::init(ServiceRegistry& registry, Config const& config, JobQueue& jobQueue) { bool use_sqlite = false; @@ -31,7 +30,7 @@ RelationalDatabase::init(Application& app, Config const& config, JobQueue& jobQu if (use_sqlite) { - return getSQLiteDatabase(app, config, jobQueue); + return getSQLiteDatabase(registry, config, jobQueue); } return std::unique_ptr(); diff --git a/src/xrpld/core/Config.h b/src/xrpld/core/Config.h index 86b663a212..c40d13c83a 100644 --- a/src/xrpld/core/Config.h +++ b/src/xrpld/core/Config.h @@ -4,7 +4,9 @@ #include #include #include +#include #include // VFALCO Breaks levelization +#include #include // VFALCO FIX: This include should not be here @@ -124,8 +126,7 @@ public: // Entries from [ips_fixed] config stanza std::vector IPS_FIXED; - enum StartUpType { FRESH, NORMAL, LOAD, LOAD_FILE, REPLAY, NETWORK }; - StartUpType START_UP = NORMAL; + StartUpType START_UP = StartUpType::NORMAL; bool START_VALID = false; @@ -355,4 +356,7 @@ public: FeeSetup setup_FeeVote(Section const& section); +DatabaseCon::Setup +setup_DatabaseCon(Config const& c, std::optional j = std::nullopt); + } // namespace xrpl diff --git a/src/xrpld/core/detail/Config.cpp b/src/xrpld/core/detail/Config.cpp index 0a60416af7..4a2bae7c27 100644 --- a/src/xrpld/core/detail/Config.cpp +++ b/src/xrpld/core/detail/Config.cpp @@ -1039,4 +1039,150 @@ setup_FeeVote(Section const& section) return setup; } +DatabaseCon::Setup +setup_DatabaseCon(Config const& c, std::optional j) +{ + DatabaseCon::Setup setup; + + setup.startUp = c.START_UP; + setup.standAlone = c.standalone(); + setup.dataDir = c.legacy("database_path"); + if (!setup.standAlone && setup.dataDir.empty()) + { + Throw("database_path must be set."); + } + + if (!setup.globalPragma) + { + auto const& sqlite = c.section("sqlite"); + auto result = std::make_unique>(); + result->reserve(3); + + // defaults + std::string safety_level; + std::string journal_mode = "wal"; + std::string synchronous = "normal"; + std::string temp_store = "file"; + bool showRiskWarning = false; + + if (set(safety_level, "safety_level", sqlite)) + { + if (boost::iequals(safety_level, "low")) + { + // low safety defaults + journal_mode = "memory"; + synchronous = "off"; + temp_store = "memory"; + showRiskWarning = true; + } + else if (!boost::iequals(safety_level, "high")) + { + Throw("Invalid safety_level value: " + safety_level); + } + } + + { + // #journal_mode Valid values : delete, truncate, persist, + // memory, wal, off + if (set(journal_mode, "journal_mode", sqlite) && !safety_level.empty()) + { + Throw( + "Configuration file may not define both " + "\"safety_level\" and \"journal_mode\""); + } + bool higherRisk = boost::iequals(journal_mode, "memory") || boost::iequals(journal_mode, "off"); + showRiskWarning = showRiskWarning || higherRisk; + if (higherRisk || boost::iequals(journal_mode, "delete") || boost::iequals(journal_mode, "truncate") || + boost::iequals(journal_mode, "persist") || boost::iequals(journal_mode, "wal")) + { + result->emplace_back(boost::str(boost::format(CommonDBPragmaJournal) % journal_mode)); + } + else + { + Throw("Invalid journal_mode value: " + journal_mode); + } + } + + { + // #synchronous Valid values : off, normal, full, extra + if (set(synchronous, "synchronous", sqlite) && !safety_level.empty()) + { + Throw( + "Configuration file may not define both " + "\"safety_level\" and \"synchronous\""); + } + bool higherRisk = boost::iequals(synchronous, "off"); + showRiskWarning = showRiskWarning || higherRisk; + if (higherRisk || boost::iequals(synchronous, "normal") || boost::iequals(synchronous, "full") || + boost::iequals(synchronous, "extra")) + { + result->emplace_back(boost::str(boost::format(CommonDBPragmaSync) % synchronous)); + } + else + { + Throw("Invalid synchronous value: " + synchronous); + } + } + + { + // #temp_store Valid values : default, file, memory + if (set(temp_store, "temp_store", sqlite) && !safety_level.empty()) + { + Throw( + "Configuration file may not define both " + "\"safety_level\" and \"temp_store\""); + } + bool higherRisk = boost::iequals(temp_store, "memory"); + showRiskWarning = showRiskWarning || higherRisk; + if (higherRisk || boost::iequals(temp_store, "default") || boost::iequals(temp_store, "file")) + { + result->emplace_back(boost::str(boost::format(CommonDBPragmaTemp) % temp_store)); + } + else + { + Throw("Invalid temp_store value: " + temp_store); + } + } + + if (showRiskWarning && j && c.LEDGER_HISTORY > SQLITE_TUNING_CUTOFF) + { + JLOG(j->warn()) << "reducing the data integrity guarantees from the " + "default [sqlite] behavior is not recommended for " + "nodes storing large amounts of history, because of the " + "difficulty inherent in rebuilding corrupted data."; + } + XRPL_ASSERT(result->size() == 3, "xrpl::setup_DatabaseCon::globalPragma : result size is 3"); + setup.globalPragma = std::move(result); + } + setup.useGlobalPragma = true; + + auto setPragma = [](std::string& pragma, std::string const& key, int64_t value) { + pragma = "PRAGMA " + key + "=" + std::to_string(value) + ";"; + }; + + // Lgr Pragma + setPragma(setup.lgrPragma[0], "journal_size_limit", 1582080); + + // TX Pragma + int64_t page_size = 4096; + int64_t journal_size_limit = 1582080; + if (c.exists("sqlite")) + { + auto& s = c.section("sqlite"); + set(journal_size_limit, "journal_size_limit", s); + set(page_size, "page_size", s); + if (page_size < 512 || page_size > 65536) + Throw("Invalid page_size. Must be between 512 and 65536."); + + if (page_size & (page_size - 1)) + Throw("Invalid page_size. Must be a power of 2."); + } + + setPragma(setup.txPragma[0], "page_size", page_size); + setPragma(setup.txPragma[1], "journal_size_limit", journal_size_limit); + setPragma(setup.txPragma[2], "max_page_count", 4294967294); + setPragma(setup.txPragma[3], "mmap_size", 17179869184); + + return setup; +} } // namespace xrpl diff --git a/src/xrpld/core/detail/DatabaseCon.cpp b/src/xrpld/core/detail/DatabaseCon.cpp deleted file mode 100644 index 64f87f7a39..0000000000 --- a/src/xrpld/core/detail/DatabaseCon.cpp +++ /dev/null @@ -1,242 +0,0 @@ -#include -#include - -#include -#include - -#include -#include - -#include -#include - -namespace xrpl { - -class CheckpointersCollection -{ - std::uintptr_t nextId_{0}; - // Mutex protects the CheckpointersCollection - std::mutex mutex_; - // Each checkpointer is given a unique id. All the checkpointers that are - // part of a DatabaseCon are part of this collection. When the DatabaseCon - // is destroyed, its checkpointer is removed from the collection - std::unordered_map> checkpointers_; - -public: - std::shared_ptr - fromId(std::uintptr_t id) - { - std::lock_guard l{mutex_}; - auto it = checkpointers_.find(id); - if (it != checkpointers_.end()) - return it->second; - return {}; - } - - void - erase(std::uintptr_t id) - { - std::lock_guard lock{mutex_}; - checkpointers_.erase(id); - } - - std::shared_ptr - create(std::shared_ptr const& session, JobQueue& jobQueue, Logs& logs) - { - std::lock_guard lock{mutex_}; - auto const id = nextId_++; - auto const r = makeCheckpointer(id, session, jobQueue, logs); - checkpointers_[id] = r; - return r; - } -}; - -CheckpointersCollection checkpointers; - -std::shared_ptr -checkpointerFromId(std::uintptr_t id) -{ - return checkpointers.fromId(id); -} - -DatabaseCon::~DatabaseCon() -{ - if (checkpointer_) - { - checkpointers.erase(checkpointer_->id()); - - std::weak_ptr wk(checkpointer_); - checkpointer_.reset(); - - // The references to our Checkpointer held by 'checkpointer_' and - // 'checkpointers' have been removed, so if the use count is nonzero, a - // checkpoint is currently in progress. Wait for it to end, otherwise - // creating a new DatabaseCon to the same database may fail due to the - // database being locked by our (now old) Checkpointer. - while (wk.use_count()) - { - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - } - } -} - -DatabaseCon::Setup -setup_DatabaseCon(Config const& c, std::optional j) -{ - DatabaseCon::Setup setup; - - setup.startUp = c.START_UP; - setup.standAlone = c.standalone(); - setup.dataDir = c.legacy("database_path"); - if (!setup.standAlone && setup.dataDir.empty()) - { - Throw("database_path must be set."); - } - - if (!setup.globalPragma) - { - setup.globalPragma = [&c, &j]() { - auto const& sqlite = c.section("sqlite"); - auto result = std::make_unique>(); - result->reserve(3); - - // defaults - std::string safety_level; - std::string journal_mode = "wal"; - std::string synchronous = "normal"; - std::string temp_store = "file"; - bool showRiskWarning = false; - - if (set(safety_level, "safety_level", sqlite)) - { - if (boost::iequals(safety_level, "low")) - { - // low safety defaults - journal_mode = "memory"; - synchronous = "off"; - temp_store = "memory"; - showRiskWarning = true; - } - else if (!boost::iequals(safety_level, "high")) - { - Throw("Invalid safety_level value: " + safety_level); - } - } - - { - // #journal_mode Valid values : delete, truncate, persist, - // memory, wal, off - if (set(journal_mode, "journal_mode", sqlite) && !safety_level.empty()) - { - Throw( - "Configuration file may not define both " - "\"safety_level\" and \"journal_mode\""); - } - bool higherRisk = boost::iequals(journal_mode, "memory") || boost::iequals(journal_mode, "off"); - showRiskWarning = showRiskWarning || higherRisk; - if (higherRisk || boost::iequals(journal_mode, "delete") || boost::iequals(journal_mode, "truncate") || - boost::iequals(journal_mode, "persist") || boost::iequals(journal_mode, "wal")) - { - result->emplace_back(boost::str(boost::format(CommonDBPragmaJournal) % journal_mode)); - } - else - { - Throw("Invalid journal_mode value: " + journal_mode); - } - } - - { - // #synchronous Valid values : off, normal, full, extra - if (set(synchronous, "synchronous", sqlite) && !safety_level.empty()) - { - Throw( - "Configuration file may not define both " - "\"safety_level\" and \"synchronous\""); - } - bool higherRisk = boost::iequals(synchronous, "off"); - showRiskWarning = showRiskWarning || higherRisk; - if (higherRisk || boost::iequals(synchronous, "normal") || boost::iequals(synchronous, "full") || - boost::iequals(synchronous, "extra")) - { - result->emplace_back(boost::str(boost::format(CommonDBPragmaSync) % synchronous)); - } - else - { - Throw("Invalid synchronous value: " + synchronous); - } - } - - { - // #temp_store Valid values : default, file, memory - if (set(temp_store, "temp_store", sqlite) && !safety_level.empty()) - { - Throw( - "Configuration file may not define both " - "\"safety_level\" and \"temp_store\""); - } - bool higherRisk = boost::iequals(temp_store, "memory"); - showRiskWarning = showRiskWarning || higherRisk; - if (higherRisk || boost::iequals(temp_store, "default") || boost::iequals(temp_store, "file")) - { - result->emplace_back(boost::str(boost::format(CommonDBPragmaTemp) % temp_store)); - } - else - { - Throw("Invalid temp_store value: " + temp_store); - } - } - - if (showRiskWarning && j && c.LEDGER_HISTORY > SQLITE_TUNING_CUTOFF) - { - JLOG(j->warn()) << "reducing the data integrity guarantees from the " - "default [sqlite] behavior is not recommended for " - "nodes storing large amounts of history, because of the " - "difficulty inherent in rebuilding corrupted data."; - } - XRPL_ASSERT(result->size() == 3, "xrpl::setup_DatabaseCon::globalPragma : result size is 3"); - return result; - }(); - } - setup.useGlobalPragma = true; - - auto setPragma = [](std::string& pragma, std::string const& key, int64_t value) { - pragma = "PRAGMA " + key + "=" + std::to_string(value) + ";"; - }; - - // Lgr Pragma - setPragma(setup.lgrPragma[0], "journal_size_limit", 1582080); - - // TX Pragma - int64_t page_size = 4096; - int64_t journal_size_limit = 1582080; - if (c.exists("sqlite")) - { - auto& s = c.section("sqlite"); - set(journal_size_limit, "journal_size_limit", s); - set(page_size, "page_size", s); - if (page_size < 512 || page_size > 65536) - Throw("Invalid page_size. Must be between 512 and 65536."); - - if (page_size & (page_size - 1)) - Throw("Invalid page_size. Must be a power of 2."); - } - - setPragma(setup.txPragma[0], "page_size", page_size); - setPragma(setup.txPragma[1], "journal_size_limit", journal_size_limit); - setPragma(setup.txPragma[2], "max_page_count", 4294967294); - setPragma(setup.txPragma[3], "mmap_size", 17179869184); - - return setup; -} - -std::unique_ptr const> DatabaseCon::Setup::globalPragma; - -void -DatabaseCon::setupCheckpointing(JobQueue* q, Logs& l) -{ - if (!q) - Throw("No JobQueue"); - checkpointer_ = checkpointers.create(session_, *q, l); -} - -} // namespace xrpl diff --git a/src/xrpld/overlay/detail/OverlayImpl.cpp b/src/xrpld/overlay/detail/OverlayImpl.cpp index 350631b8e6..6ac6e454d2 100644 --- a/src/xrpld/overlay/detail/OverlayImpl.cpp +++ b/src/xrpld/overlay/detail/OverlayImpl.cpp @@ -3,7 +3,6 @@ #include #include #include -#include #include #include #include @@ -20,6 +19,7 @@ #include #include #include +#include #include #include diff --git a/src/xrpld/overlay/detail/PeerReservationTable.cpp b/src/xrpld/overlay/detail/PeerReservationTable.cpp index 1e3452ca17..27d9df1129 100644 --- a/src/xrpld/overlay/detail/PeerReservationTable.cpp +++ b/src/xrpld/overlay/detail/PeerReservationTable.cpp @@ -1,10 +1,10 @@ #include -#include -#include +#include #include #include #include +#include #include #include diff --git a/src/xrpld/peerfinder/detail/StoreSqdb.h b/src/xrpld/peerfinder/detail/StoreSqdb.h index f5461d489a..b945ae970b 100644 --- a/src/xrpld/peerfinder/detail/StoreSqdb.h +++ b/src/xrpld/peerfinder/detail/StoreSqdb.h @@ -1,9 +1,10 @@ #pragma once #include -#include #include +#include + namespace xrpl { namespace PeerFinder { diff --git a/src/xrpld/rpc/InfoSub.h b/src/xrpld/rpc/InfoSub.h index 7d4d4f06c8..d49e401bd3 100644 --- a/src/xrpld/rpc/InfoSub.h +++ b/src/xrpld/rpc/InfoSub.h @@ -1,12 +1,11 @@ #pragma once -#include - #include #include #include #include #include +#include namespace xrpl { From 8dd147d5e885acd2f8310e31d8cdec7ecf87ec6e Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Wed, 11 Feb 2026 14:00:33 +0000 Subject: [PATCH 32/61] set defines Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> --- conan/profiles/sanitizers | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/conan/profiles/sanitizers b/conan/profiles/sanitizers index 40871240bf..e231a15776 100644 --- a/conan/profiles/sanitizers +++ b/conan/profiles/sanitizers @@ -7,18 +7,21 @@ include(default) {% if compiler == "gcc" %} {% if "address" in sanitizers or "thread" in sanitizers or "undefinedbehavior" in sanitizers %} {% set sanitizer_list = [] %} + {% set defines = [] %} {% set model_code = "" %} {% set extra_cxxflags = ["-fno-omit-frame-pointer", "-O1", "-Wno-stringop-overflow"] %} {% if "address" in sanitizers %} {% set _ = sanitizer_list.append("address") %} {% set model_code = "-mcmodel=large" %} - {% set _ = extra_cxxflags.append("-DBOOST_USE_ASAN") %} - {% set _ = extra_cxxflags.append("-DBOOST_USE_UCONTEXT") %} + {% set _ = defines.append("BOOST_USE_ASAN")%} + {% set _ = defines.append("BOOST_USE_UCONTEXT")%} {% elif "thread" in sanitizers %} {% set _ = sanitizer_list.append("thread") %} {% set model_code = "-mcmodel=medium" %} {% set _ = extra_cxxflags.append("-Wno-tsan") %} + {% set _ = defines.append("BOOST_USE_TSAN")%} + {% set _ = defines.append("BOOST_USE_UCONTEXT")%} {% endif %} {% if "undefinedbehavior" in sanitizers %} @@ -31,6 +34,7 @@ include(default) tools.build:cxxflags+=['{{sanitizer_flags}} {{" ".join(extra_cxxflags)}}'] tools.build:sharedlinkflags+=['{{sanitizer_flags}}'] tools.build:exelinkflags+=['{{sanitizer_flags}}'] + tools.build:defines+=['{{defines}}'] {% endif %} {% elif compiler == "apple-clang" or compiler == "clang" %} {% if "address" in sanitizers or "thread" in sanitizers or "undefinedbehavior" in sanitizers %} @@ -39,10 +43,12 @@ include(default) {% if "address" in sanitizers %} {% set _ = sanitizer_list.append("address") %} - {% set _ = extra_cxxflags.append("-DBOOST_USE_ASAN") %} - {% set _ = extra_cxxflags.append("-DBOOST_USE_UCONTEXT") %} + {% set _ = defines.append("BOOST_USE_ASAN")%} + {% set _ = defines.append("BOOST_USE_UCONTEXT")%} {% elif "thread" in sanitizers %} {% set _ = sanitizer_list.append("thread") %} + {% set _ = defines.append("BOOST_USE_TSAN")%} + {% set _ = defines.append("BOOST_USE_UCONTEXT")%} {% endif %} {% if "undefinedbehavior" in sanitizers %} @@ -56,11 +62,12 @@ include(default) tools.build:cxxflags+=['{{sanitizer_flags}} {{" ".join(extra_cxxflags)}}'] tools.build:sharedlinkflags+=['{{sanitizer_flags}}'] tools.build:exelinkflags+=['{{sanitizer_flags}}'] + tools.build:defines+=['{{defines}}'] {% endif %} {% endif %} {% endif %} -tools.info.package_id:confs+=["tools.build:cxxflags", "tools.build:exelinkflags", "tools.build:sharedlinkflags"] +tools.info.package_id:confs+=["tools.build:cxxflags", "tools.build:exelinkflags", "tools.build:sharedlinkflags", "tools.build:defines"] [options] {% if sanitizers %} From 5982519fe020029d54b682542bbe7fd091ec8efe Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Wed, 11 Feb 2026 14:39:01 +0000 Subject: [PATCH 33/61] minor correction Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> --- conan/profiles/sanitizers | 1 + 1 file changed, 1 insertion(+) diff --git a/conan/profiles/sanitizers b/conan/profiles/sanitizers index e231a15776..65143dd953 100644 --- a/conan/profiles/sanitizers +++ b/conan/profiles/sanitizers @@ -39,6 +39,7 @@ include(default) {% elif compiler == "apple-clang" or compiler == "clang" %} {% if "address" in sanitizers or "thread" in sanitizers or "undefinedbehavior" in sanitizers %} {% set sanitizer_list = [] %} + {% set defines = [] %} {% set extra_cxxflags = ["-fno-omit-frame-pointer", "-O1"] %} {% if "address" in sanitizers %} From 52c7d980d438d7ebc2afa27d97972daaf50e2050 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Wed, 11 Feb 2026 15:00:12 +0000 Subject: [PATCH 34/61] fix to the list issue Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> --- conan/profiles/sanitizers | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conan/profiles/sanitizers b/conan/profiles/sanitizers index 65143dd953..6d37425f43 100644 --- a/conan/profiles/sanitizers +++ b/conan/profiles/sanitizers @@ -34,7 +34,7 @@ include(default) tools.build:cxxflags+=['{{sanitizer_flags}} {{" ".join(extra_cxxflags)}}'] tools.build:sharedlinkflags+=['{{sanitizer_flags}}'] tools.build:exelinkflags+=['{{sanitizer_flags}}'] - tools.build:defines+=['{{defines}}'] + tools.build:defines+={{defines}} {% endif %} {% elif compiler == "apple-clang" or compiler == "clang" %} {% if "address" in sanitizers or "thread" in sanitizers or "undefinedbehavior" in sanitizers %} @@ -63,7 +63,7 @@ include(default) tools.build:cxxflags+=['{{sanitizer_flags}} {{" ".join(extra_cxxflags)}}'] tools.build:sharedlinkflags+=['{{sanitizer_flags}}'] tools.build:exelinkflags+=['{{sanitizer_flags}}'] - tools.build:defines+=['{{defines}}'] + tools.build:defines+={{defines}} {% endif %} {% endif %} {% endif %} From 9f17d103480182c785ee4f76458728cb987f1178 Mon Sep 17 00:00:00 2001 From: Jingchen Date: Wed, 11 Feb 2026 16:22:01 +0000 Subject: [PATCH 35/61] refactor: Modularize RelationalDB (#6224) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The rdb module was not properly designed, which is fixed in this change. The module had three classes: 1) The abstract class `RelationalDB`. 2) The abstract class `SQLiteDatabase`, which inherited from `RelationalDB` and added some pure virtual methods. 3) The concrete class `SQLiteDatabaseImp`, which inherited from `SQLiteDatabase` and implemented all methods. The updated code simplifies this as follows: * The `SQLiteDatabaseImp` has become `SQLiteDatabase`, and * The former `SQLiteDatabase `has merged with `RelationalDatabase`. --- .../scripts/levelization/results/ordering.txt | 3 + include/xrpl/protocol/LedgerShortcut.h | 22 + include/xrpl/protocol/TxSearched.h | 7 + include/xrpl/rdb/RelationalDatabase.h | 475 ++++++++++++++++++ src/test/app/SHAMapStore_test.cpp | 8 +- src/test/rpc/Transaction_test.cpp | 6 +- src/xrpld/app/ledger/Ledger.cpp | 8 +- src/xrpld/app/ledger/detail/LedgerMaster.cpp | 2 +- src/xrpld/app/main/Application.cpp | 13 +- src/xrpld/app/misc/SHAMapStoreImp.cpp | 17 +- src/xrpld/app/misc/Transaction.h | 3 +- src/xrpld/app/misc/detail/AccountTxPaging.h | 2 +- src/xrpld/app/misc/detail/Transaction.cpp | 11 +- src/xrpld/app/rdb/RelationalDatabase.h | 226 --------- src/xrpld/app/rdb/backend/SQLiteDatabase.h | 298 +++++++++-- src/xrpld/app/rdb/backend/detail/Node.cpp | 2 +- src/xrpld/app/rdb/backend/detail/Node.h | 3 +- .../app/rdb/backend/detail/SQLiteDatabase.cpp | 296 +++-------- .../app/rdb/detail/RelationalDatabase.cpp | 39 -- src/xrpld/overlay/detail/OverlayImpl.cpp | 2 +- .../overlay/detail/PeerReservationTable.cpp | 3 +- src/xrpld/rpc/detail/RPCHelpers.cpp | 2 +- src/xrpld/rpc/detail/RPCLedgerHelpers.h | 3 +- src/xrpld/rpc/handlers/AccountTx.cpp | 16 +- src/xrpld/rpc/handlers/GetCounts.cpp | 11 +- src/xrpld/rpc/handlers/Tx.cpp | 3 +- src/xrpld/rpc/handlers/TxHistory.cpp | 2 +- 27 files changed, 862 insertions(+), 621 deletions(-) create mode 100644 include/xrpl/protocol/LedgerShortcut.h create mode 100644 include/xrpl/protocol/TxSearched.h create mode 100644 include/xrpl/rdb/RelationalDatabase.h delete mode 100644 src/xrpld/app/rdb/RelationalDatabase.h diff --git a/.github/scripts/levelization/results/ordering.txt b/.github/scripts/levelization/results/ordering.txt index fabc7b49ca..85f2457ea3 100644 --- a/.github/scripts/levelization/results/ordering.txt +++ b/.github/scripts/levelization/results/ordering.txt @@ -171,6 +171,7 @@ xrpl.protocol > xrpl.basics xrpl.protocol > xrpl.json xrpl.rdb > xrpl.basics xrpl.rdb > xrpl.core +xrpl.rdb > xrpl.protocol xrpl.resource > xrpl.basics xrpl.resource > xrpl.json xrpl.resource > xrpl.protocol @@ -214,6 +215,7 @@ xrpld.overlay > xrpld.core xrpld.overlay > xrpld.peerfinder xrpld.overlay > xrpl.json xrpld.overlay > xrpl.protocol +xrpld.overlay > xrpl.rdb xrpld.overlay > xrpl.resource xrpld.overlay > xrpl.server xrpld.peerfinder > xrpl.basics @@ -232,6 +234,7 @@ xrpld.rpc > xrpl.ledger xrpld.rpc > xrpl.net xrpld.rpc > xrpl.nodestore xrpld.rpc > xrpl.protocol +xrpld.rpc > xrpl.rdb xrpld.rpc > xrpl.resource xrpld.rpc > xrpl.server xrpld.shamap > xrpl.shamap diff --git a/include/xrpl/protocol/LedgerShortcut.h b/include/xrpl/protocol/LedgerShortcut.h new file mode 100644 index 0000000000..68c31c4c3c --- /dev/null +++ b/include/xrpl/protocol/LedgerShortcut.h @@ -0,0 +1,22 @@ +#pragma once + +namespace xrpl { + +/** + * @brief Enumeration of ledger shortcuts for specifying which ledger to use. + * + * These shortcuts provide a convenient way to reference commonly used ledgers + * without needing to specify their exact hash or sequence number. + */ +enum class LedgerShortcut { + /** The current working ledger (open, not yet closed) */ + Current, + + /** The most recently closed ledger (may not be validated) */ + Closed, + + /** The most recently validated ledger */ + Validated +}; + +} // namespace xrpl diff --git a/include/xrpl/protocol/TxSearched.h b/include/xrpl/protocol/TxSearched.h new file mode 100644 index 0000000000..e085bff315 --- /dev/null +++ b/include/xrpl/protocol/TxSearched.h @@ -0,0 +1,7 @@ +#pragma once + +namespace xrpl { + +enum class TxSearched { all, some, unknown }; + +} diff --git a/include/xrpl/rdb/RelationalDatabase.h b/include/xrpl/rdb/RelationalDatabase.h new file mode 100644 index 0000000000..b80c6c8331 --- /dev/null +++ b/include/xrpl/rdb/RelationalDatabase.h @@ -0,0 +1,475 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +namespace xrpl { + +class Transaction; +class Ledger; + +struct LedgerHashPair +{ + uint256 ledgerHash; + uint256 parentHash; +}; + +struct LedgerRange +{ + uint32_t min; + uint32_t max; +}; + +class RelationalDatabase +{ +public: + struct CountMinMax + { + std::size_t numberOfRows; + LedgerIndex minLedgerSequence; + LedgerIndex maxLedgerSequence; + }; + + struct AccountTxMarker + { + std::uint32_t ledgerSeq = 0; + std::uint32_t txnSeq = 0; + }; + + struct AccountTxOptions + { + AccountID const& account; + std::uint32_t minLedger; + std::uint32_t maxLedger; + std::uint32_t offset; + std::uint32_t limit; + bool bUnlimited; + }; + + struct AccountTxPageOptions + { + AccountID const& account; + std::uint32_t minLedger; + std::uint32_t maxLedger; + std::optional marker; + std::uint32_t limit; + bool bAdmin; + }; + + using AccountTx = std::pair, std::shared_ptr>; + using AccountTxs = std::vector; + using txnMetaLedgerType = std::tuple; + using MetaTxsList = std::vector; + + using LedgerSequence = uint32_t; + using LedgerHash = uint256; + using LedgerSpecifier = std::variant; + + struct AccountTxArgs + { + AccountID account; + std::optional ledger; + bool binary = false; + bool forward = false; + uint32_t limit = 0; + std::optional marker; + }; + + struct AccountTxResult + { + std::variant transactions; + LedgerRange ledgerRange; + uint32_t limit; + std::optional marker; + }; + + virtual ~RelationalDatabase() = default; + + /** + * @brief getMinLedgerSeq Returns the minimum ledger sequence in the Ledgers + * table. + * @return Ledger sequence or no value if no ledgers exist. + */ + virtual std::optional + getMinLedgerSeq() = 0; + + /** + * @brief getMaxLedgerSeq Returns the maximum ledger sequence in the Ledgers + * table. + * @return Ledger sequence or none if no ledgers exist. + */ + virtual std::optional + getMaxLedgerSeq() = 0; + + /** + * @brief getLedgerInfoByIndex Returns a ledger by its sequence. + * @param ledgerSeq Ledger sequence. + * @return The ledger if found, otherwise no value. + */ + virtual std::optional + getLedgerInfoByIndex(LedgerIndex ledgerSeq) = 0; + + /** + * @brief getNewestLedgerInfo Returns the info of the newest saved ledger. + * @return Ledger info if found, otherwise no value. + */ + virtual std::optional + getNewestLedgerInfo() = 0; + + /** + * @brief getLedgerInfoByHash Returns the info of the ledger with given + * hash. + * @param ledgerHash Hash of the ledger. + * @return Ledger if found, otherwise no value. + */ + virtual std::optional + getLedgerInfoByHash(uint256 const& ledgerHash) = 0; + + /** + * @brief getHashByIndex Returns the hash of the ledger with the given + * sequence. + * @param ledgerIndex Ledger sequence. + * @return Hash of the ledger. + */ + virtual uint256 + getHashByIndex(LedgerIndex ledgerIndex) = 0; + + /** + * @brief getHashesByIndex Returns the hashes of the ledger and its parent + * as specified by the ledgerIndex. + * @param ledgerIndex Ledger sequence. + * @return Struct LedgerHashPair which contains hashes of the ledger and + * its parent. + */ + virtual std::optional + getHashesByIndex(LedgerIndex ledgerIndex) = 0; + + /** + * @brief getHashesByIndex Returns hashes of each ledger and its parent for + * all ledgers within the provided range. + * @param minSeq Minimum ledger sequence. + * @param maxSeq Maximum ledger sequence. + * @return Container that maps the sequence number of a found ledger to the + * struct LedgerHashPair which contains the hashes of the ledger and + * its parent. + */ + virtual std::map + getHashesByIndex(LedgerIndex minSeq, LedgerIndex maxSeq) = 0; + + /** + * @brief getTxHistory Returns the 20 most recent transactions starting from + * the given number. + * @param startIndex First number of returned entry. + * @return Vector of shared pointers to transactions sorted in + * descending order by ledger sequence. + */ + virtual std::vector> + getTxHistory(LedgerIndex startIndex) = 0; + + /** + * @brief getTransactionsMinLedgerSeq Returns the minimum ledger sequence + * stored in the Transactions table. + * @return Ledger sequence or no value if no ledgers exist. + */ + virtual std::optional + getTransactionsMinLedgerSeq() = 0; + + /** + * @brief getAccountTransactionsMinLedgerSeq Returns the minimum ledger + * sequence stored in the AccountTransactions table. + * @return Ledger sequence or no value if no ledgers exist. + */ + virtual std::optional + getAccountTransactionsMinLedgerSeq() = 0; + + /** + * @brief deleteTransactionByLedgerSeq Deletes transactions from the ledger + * with the given sequence. + * @param ledgerSeq Ledger sequence. + */ + virtual void + deleteTransactionByLedgerSeq(LedgerIndex ledgerSeq) = 0; + + /** + * @brief deleteBeforeLedgerSeq Deletes all ledgers with a sequence number + * less than or equal to the given ledger sequence. + * @param ledgerSeq Ledger sequence. + */ + virtual void + deleteBeforeLedgerSeq(LedgerIndex ledgerSeq) = 0; + + /** + * @brief deleteTransactionsBeforeLedgerSeq Deletes all transactions with + * a sequence number less than or equal to the given ledger + * sequence. + * @param ledgerSeq Ledger sequence. + */ + virtual void + deleteTransactionsBeforeLedgerSeq(LedgerIndex ledgerSeq) = 0; + + /** + * @brief deleteAccountTransactionsBeforeLedgerSeq Deletes all account + * transactions with a sequence number less than or equal to the + * given ledger sequence. + * @param ledgerSeq Ledger sequence. + */ + virtual void + deleteAccountTransactionsBeforeLedgerSeq(LedgerIndex ledgerSeq) = 0; + + /** + * @brief getTransactionCount Returns the number of transactions. + * @return Number of transactions. + */ + virtual std::size_t + getTransactionCount() = 0; + + /** + * @brief getAccountTransactionCount Returns the number of account + * transactions. + * @return Number of account transactions. + */ + virtual std::size_t + getAccountTransactionCount() = 0; + + /** + * @brief getLedgerCountMinMax Returns the minimum ledger sequence, + * maximum ledger sequence and total number of saved ledgers. + * @return Struct CountMinMax which contains the minimum sequence, + * maximum sequence and number of ledgers. + */ + virtual struct CountMinMax + getLedgerCountMinMax() = 0; + + /** + * @brief saveValidatedLedger Saves a ledger into the database. + * @param ledger The ledger. + * @param current True if the ledger is current. + * @return True if saving was successful. + */ + virtual bool + saveValidatedLedger(std::shared_ptr const& ledger, bool current) = 0; + + /** + * @brief getLimitedOldestLedgerInfo Returns the info of the oldest ledger + * whose sequence number is greater than or equal to the given + * sequence number. + * @param ledgerFirstIndex Minimum ledger sequence. + * @return Ledger info if found, otherwise no value. + */ + virtual std::optional + getLimitedOldestLedgerInfo(LedgerIndex ledgerFirstIndex) = 0; + + /** + * @brief getLimitedNewestLedgerInfo Returns the info of the newest ledger + * whose sequence number is greater than or equal to the given + * sequence number. + * @param ledgerFirstIndex Minimum ledger sequence. + * @return Ledger info if found, otherwise no value. + */ + virtual std::optional + getLimitedNewestLedgerInfo(LedgerIndex ledgerFirstIndex) = 0; + + /** + * @brief getOldestAccountTxs Returns the oldest transactions for the + * account that matches the given criteria starting from the provided + * offset. + * @param options Struct AccountTxOptions which contains the criteria to + * match: the account, ledger search range, the offset of the first + * entry to return, the number of transactions to return, a flag if + * this number is unlimited. + * @return Vector of pairs of found transactions and their metadata + * sorted in ascending order by account sequence. + */ + virtual AccountTxs + getOldestAccountTxs(AccountTxOptions const& options) = 0; + + /** + * @brief getNewestAccountTxs Returns the newest transactions for the + * account that matches the given criteria starting from the provided + * offset. + * @param options Struct AccountTxOptions which contains the criteria to + * match: the account, the ledger search range, the offset of the + * first entry to return, the number of transactions to return, a + * flag if this number unlimited. + * @return Vector of pairs of found transactions and their metadata + * sorted in descending order by account sequence. + */ + virtual AccountTxs + getNewestAccountTxs(AccountTxOptions const& options) = 0; + + /** + * @brief getOldestAccountTxsB Returns the oldest transactions in binary + * form for the account that matches the given criteria starting from + * the provided offset. + * @param options Struct AccountTxOptions which contains the criteria to + * match: the account, the ledger search range, the offset of the + * first entry to return, the number of transactions to return, a + * flag if this number unlimited. + * @return Vector of tuples of found transactions, their metadata and + * account sequences sorted in ascending order by account sequence. + */ + virtual MetaTxsList + getOldestAccountTxsB(AccountTxOptions const& options) = 0; + + /** + * @brief getNewestAccountTxsB Returns the newest transactions in binary + * form for the account that matches the given criteria starting from + * the provided offset. + * @param options Struct AccountTxOptions which contains the criteria to + * match: the account, the ledger search range, the offset of the + * first entry to return, the number of transactions to return, a + * flag if this number is unlimited. + * @return Vector of tuples of found transactions, their metadata and + * account sequences sorted in descending order by account + * sequence. + */ + virtual MetaTxsList + getNewestAccountTxsB(AccountTxOptions const& options) = 0; + + /** + * @brief oldestAccountTxPage Returns the oldest transactions for the + * account that matches the given criteria starting from the + * provided marker. + * @param options Struct AccountTxPageOptions which contains the criteria to + * match: the account, the ledger search range, the marker of first + * returned entry, the number of transactions to return, a flag if + * this number is unlimited. + * @return Vector of pairs of found transactions and their metadata + * sorted in ascending order by account sequence and a marker + * for the next search if the search was not finished. + */ + virtual std::pair> + oldestAccountTxPage(AccountTxPageOptions const& options) = 0; + + /** + * @brief newestAccountTxPage Returns the newest transactions for the + * account that matches the given criteria starting from the provided + * marker. + * @param options Struct AccountTxPageOptions which contains the criteria to + * match: the account, the ledger search range, the marker of the + * first returned entry, the number of transactions to return, a flag + * if this number unlimited. + * @return Vector of pairs of found transactions and their metadata + * sorted in descending order by account sequence and a marker + * for the next search if the search was not finished. + */ + virtual std::pair> + newestAccountTxPage(AccountTxPageOptions const& options) = 0; + + /** + * @brief oldestAccountTxPageB Returns the oldest transactions in binary + * form for the account that matches the given criteria starting from + * the provided marker. + * @param options Struct AccountTxPageOptions which contains criteria to + * match: the account, the ledger search range, the marker of the + * first returned entry, the number of transactions to return, a flag + * if this number unlimited. + * @return Vector of tuples of found transactions, their metadata and + * account sequences sorted in ascending order by account + * sequence and a marker for the next search if the search was not + * finished. + */ + virtual std::pair> + oldestAccountTxPageB(AccountTxPageOptions const& options) = 0; + + /** + * @brief newestAccountTxPageB Returns the newest transactions in binary + * form for the account that matches the given criteria starting from + * the provided marker. + * @param options Struct AccountTxPageOptions which contains the criteria to + * match: the account, the ledger search range, the marker of the + * first returned entry, the number of transactions to return, a flag + * if this number is unlimited. + * @return Vector of tuples of found transactions, their metadata and + * account sequences sorted in descending order by account + * sequence and a marker for the next search if the search was not + * finished. + */ + virtual std::pair> + newestAccountTxPageB(AccountTxPageOptions const& options) = 0; + + /** + * @brief getTransaction Returns the transaction with the given hash. If a + * range is provided but the transaction is not found, then check if + * all ledgers in the range are present in the database. + * @param id Hash of the transaction. + * @param range Range of ledgers to check, if present. + * @param ec Default error code value. + * @return Transaction and its metadata if found, otherwise TxSearched::all + * if a range is provided and all ledgers from the range are present + * in the database, TxSearched::some if a range is provided and not + * all ledgers are present, TxSearched::unknown if the range is not + * provided or a deserializing error occurred. In the last case the + * error code is returned via the ec parameter, in other cases the + * default error code is not changed. + */ + virtual std::variant + getTransaction(uint256 const& id, std::optional> const& range, error_code_i& ec) = 0; + + /** + * @brief getKBUsedAll Returns the amount of space used by all databases. + * @return Space in kilobytes. + */ + virtual uint32_t + getKBUsedAll() = 0; + + /** + * @brief getKBUsedLedger Returns the amount of space space used by the + * ledger database. + * @return Space in kilobytes. + */ + virtual uint32_t + getKBUsedLedger() = 0; + + /** + * @brief getKBUsedTransaction Returns the amount of space used by the + * transaction database. + * @return Space in kilobytes. + */ + virtual uint32_t + getKBUsedTransaction() = 0; + + /** + * @brief Closes the ledger database + */ + virtual void + closeLedgerDB() = 0; + + /** + * @brief Closes the transaction database + */ + virtual void + closeTransactionDB() = 0; +}; + +template +T +rangeCheckedCast(C c) +{ + if ((c > std::numeric_limits::max()) || (!std::numeric_limits::is_signed && c < 0) || + (std::numeric_limits::is_signed && std::numeric_limits::is_signed && + c < std::numeric_limits::lowest())) + { + // This should never happen + // LCOV_EXCL_START + UNREACHABLE("xrpl::rangeCheckedCast : domain error"); + JLOG(debugLog().error()) << "rangeCheckedCast domain error:" + << " value = " << c << " min = " << std::numeric_limits::lowest() + << " max: " << std::numeric_limits::max(); + // LCOV_EXCL_STOP + } + + return static_cast(c); +} + +} // namespace xrpl diff --git a/src/test/app/SHAMapStore_test.cpp b/src/test/app/SHAMapStore_test.cpp index c671d6fc27..9e0a971685 100644 --- a/src/test/app/SHAMapStore_test.cpp +++ b/src/test/app/SHAMapStore_test.cpp @@ -91,8 +91,7 @@ class SHAMapStore_test : public beast::unit_test::suite void ledgerCheck(jtx::Env& env, int const rows, int const first) { - auto const [actualRows, actualFirst, actualLast] = - dynamic_cast(&env.app().getRelationalDatabase())->getLedgerCountMinMax(); + auto const [actualRows, actualFirst, actualLast] = env.app().getRelationalDatabase().getLedgerCountMinMax(); BEAST_EXPECT(actualRows == rows); BEAST_EXPECT(actualFirst == first); @@ -102,14 +101,13 @@ class SHAMapStore_test : public beast::unit_test::suite void transactionCheck(jtx::Env& env, int const rows) { - BEAST_EXPECT(dynamic_cast(&env.app().getRelationalDatabase())->getTransactionCount() == rows); + BEAST_EXPECT(env.app().getRelationalDatabase().getTransactionCount() == rows); } void accountTransactionCheck(jtx::Env& env, int const rows) { - BEAST_EXPECT( - dynamic_cast(&env.app().getRelationalDatabase())->getAccountTransactionCount() == rows); + BEAST_EXPECT(env.app().getRelationalDatabase().getAccountTransactionCount() == rows); } int diff --git a/src/test/rpc/Transaction_test.cpp b/src/test/rpc/Transaction_test.cpp index 3b289d73ca..acc8bccf61 100644 --- a/src/test/rpc/Transaction_test.cpp +++ b/src/test/rpc/Transaction_test.cpp @@ -108,8 +108,7 @@ class Transaction_test : public beast::unit_test::suite auto const deletedLedger = (startLegSeq + endLegSeq) / 2; { // Remove one of the ledgers from the database directly - dynamic_cast(&env.app().getRelationalDatabase()) - ->deleteTransactionByLedgerSeq(deletedLedger); + env.app().getRelationalDatabase().deleteTransactionByLedgerSeq(deletedLedger); } for (int deltaEndSeq = 0; deltaEndSeq < 2; ++deltaEndSeq) @@ -320,8 +319,7 @@ class Transaction_test : public beast::unit_test::suite auto const deletedLedger = (startLegSeq + endLegSeq) / 2; { // Remove one of the ledgers from the database directly - dynamic_cast(&env.app().getRelationalDatabase()) - ->deleteTransactionByLedgerSeq(deletedLedger); + env.app().getRelationalDatabase().deleteTransactionByLedgerSeq(deletedLedger); } for (int deltaEndSeq = 0; deltaEndSeq < 2; ++deltaEndSeq) diff --git a/src/xrpld/app/ledger/Ledger.cpp b/src/xrpld/app/ledger/Ledger.cpp index 0f1b81d53d..0f44601679 100644 --- a/src/xrpld/app/ledger/Ledger.cpp +++ b/src/xrpld/app/ledger/Ledger.cpp @@ -4,7 +4,6 @@ #include #include #include -#include #include #include @@ -22,6 +21,7 @@ #include #include #include +#include #include #include @@ -904,11 +904,9 @@ saveValidatedLedger(Application& app, std::shared_ptr const& ledge return true; } - auto const db = dynamic_cast(&app.getRelationalDatabase()); - if (!db) - Throw("Failed to get relational database"); + auto& db = app.getRelationalDatabase(); - auto const res = db->saveValidatedLedger(ledger, current); + auto const res = db.saveValidatedLedger(ledger, current); // Clients can now trust the database for // information about this ledger sequence. diff --git a/src/xrpld/app/ledger/detail/LedgerMaster.cpp b/src/xrpld/app/ledger/detail/LedgerMaster.cpp index c4299c1b63..1fd1a8a8b2 100644 --- a/src/xrpld/app/ledger/detail/LedgerMaster.cpp +++ b/src/xrpld/app/ledger/detail/LedgerMaster.cpp @@ -14,7 +14,6 @@ #include #include #include -#include #include #include #include @@ -29,6 +28,7 @@ #include #include #include +#include #include #include diff --git a/src/xrpld/app/main/Application.cpp b/src/xrpld/app/main/Application.cpp index 5f7a86e2c2..7a59d586e0 100644 --- a/src/xrpld/app/main/Application.cpp +++ b/src/xrpld/app/main/Application.cpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include #include @@ -191,7 +191,7 @@ public: boost::asio::steady_timer sweepTimer_; boost::asio::steady_timer entropyTimer_; - std::unique_ptr mRelationalDatabase; + std::optional relationalDatabase_; std::unique_ptr mWalletDB; std::unique_ptr overlay_; std::optional trapTxID_; @@ -730,10 +730,10 @@ public: getRelationalDatabase() override { XRPL_ASSERT( - mRelationalDatabase, + relationalDatabase_, "xrpl::ApplicationImp::getRelationalDatabase : non-null " "relational database"); - return *mRelationalDatabase; + return *relationalDatabase_; } DatabaseCon& @@ -761,7 +761,7 @@ public: try { - mRelationalDatabase = RelationalDatabase::init(*this, *config_, *m_jobQueue); + relationalDatabase_.emplace(setup_RelationalDatabase(*this, *config_, *m_jobQueue)); // wallet database auto setup = setup_DatabaseCon(*config_, m_journal); @@ -872,7 +872,8 @@ public: void doSweep() { - if (!config_->standalone() && !getRelationalDatabase().transactionDbHasSpace(*config_)) + XRPL_ASSERT(relationalDatabase_, "xrpl::ApplicationImp::doSweep : non-null relational database"); + if (!config_->standalone() && !relationalDatabase_->transactionDbHasSpace(*config_)) { signalStop("Out of transaction DB space"); } diff --git a/src/xrpld/app/misc/SHAMapStoreImp.cpp b/src/xrpld/app/misc/SHAMapStoreImp.cpp index 7f276ca2d8..c963d18d2c 100644 --- a/src/xrpld/app/misc/SHAMapStoreImp.cpp +++ b/src/xrpld/app/misc/SHAMapStoreImp.cpp @@ -507,16 +507,13 @@ SHAMapStoreImp::clearPrior(LedgerIndex lastRotated) if (healthWait() == stopping) return; - SQLiteDatabase* const db = dynamic_cast(&app_.getRelationalDatabase()); - - if (!db) - Throw("Failed to get relational database"); + auto& db = app_.getRelationalDatabase(); clearSql( lastRotated, "Ledgers", - [db]() -> std::optional { return db->getMinLedgerSeq(); }, - [db](LedgerIndex min) -> void { db->deleteBeforeLedgerSeq(min); }); + [&db]() -> std::optional { return db.getMinLedgerSeq(); }, + [&db](LedgerIndex min) -> void { db.deleteBeforeLedgerSeq(min); }); if (healthWait() == stopping) return; @@ -526,16 +523,16 @@ SHAMapStoreImp::clearPrior(LedgerIndex lastRotated) clearSql( lastRotated, "Transactions", - [&db]() -> std::optional { return db->getTransactionsMinLedgerSeq(); }, - [&db](LedgerIndex min) -> void { db->deleteTransactionsBeforeLedgerSeq(min); }); + [&db]() -> std::optional { return db.getTransactionsMinLedgerSeq(); }, + [&db](LedgerIndex min) -> void { db.deleteTransactionsBeforeLedgerSeq(min); }); if (healthWait() == stopping) return; clearSql( lastRotated, "AccountTransactions", - [&db]() -> std::optional { return db->getAccountTransactionsMinLedgerSeq(); }, - [&db](LedgerIndex min) -> void { db->deleteAccountTransactionsBeforeLedgerSeq(min); }); + [&db]() -> std::optional { return db.getAccountTransactionsMinLedgerSeq(); }, + [&db](LedgerIndex min) -> void { db.deleteAccountTransactionsBeforeLedgerSeq(min); }); if (healthWait() == stopping) return; } diff --git a/src/xrpld/app/misc/Transaction.h b/src/xrpld/app/misc/Transaction.h index 22f3e9d1fd..0a51e1c021 100644 --- a/src/xrpld/app/misc/Transaction.h +++ b/src/xrpld/app/misc/Transaction.h @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -35,8 +36,6 @@ enum TransStatus { INCOMPLETE = 8 // needs more signatures }; -enum class TxSearched { all, some, unknown }; - // This class is for constructing and examining transactions. // Transactions are static so manipulation functions are unnecessary. class Transaction : public std::enable_shared_from_this, public CountedObject diff --git a/src/xrpld/app/misc/detail/AccountTxPaging.h b/src/xrpld/app/misc/detail/AccountTxPaging.h index 6dff5c481b..209ca67ab6 100644 --- a/src/xrpld/app/misc/detail/AccountTxPaging.h +++ b/src/xrpld/app/misc/detail/AccountTxPaging.h @@ -1,6 +1,6 @@ #pragma once -#include +#include #include diff --git a/src/xrpld/app/misc/detail/Transaction.cpp b/src/xrpld/app/misc/detail/Transaction.cpp index 61a2a36695..8ffbc47b08 100644 --- a/src/xrpld/app/misc/detail/Transaction.cpp +++ b/src/xrpld/app/misc/detail/Transaction.cpp @@ -2,13 +2,13 @@ #include #include #include -#include #include #include #include #include #include +#include namespace xrpl { @@ -113,14 +113,9 @@ Transaction::load( std::optional> const& range, error_code_i& ec) { - auto const db = dynamic_cast(&app.getRelationalDatabase()); + auto& db = app.getRelationalDatabase(); - if (!db) - { - Throw("Failed to get relational database"); - } - - return db->getTransaction(id, range, ec); + return db.getTransaction(id, range, ec); } // options 1 to include the date of the transaction diff --git a/src/xrpld/app/rdb/RelationalDatabase.h b/src/xrpld/app/rdb/RelationalDatabase.h deleted file mode 100644 index 078b8fe8db..0000000000 --- a/src/xrpld/app/rdb/RelationalDatabase.h +++ /dev/null @@ -1,226 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -#include -#include -#include - -#include -#include - -namespace xrpl { - -struct LedgerHashPair -{ - uint256 ledgerHash; - uint256 parentHash; -}; - -struct LedgerRange -{ - uint32_t min; - uint32_t max; -}; - -class RelationalDatabase -{ -public: - struct CountMinMax - { - std::size_t numberOfRows; - LedgerIndex minLedgerSequence; - LedgerIndex maxLedgerSequence; - }; - - struct AccountTxMarker - { - std::uint32_t ledgerSeq = 0; - std::uint32_t txnSeq = 0; - }; - - struct AccountTxOptions - { - AccountID const& account; - std::uint32_t minLedger; - std::uint32_t maxLedger; - std::uint32_t offset; - std::uint32_t limit; - bool bUnlimited; - }; - - struct AccountTxPageOptions - { - AccountID const& account; - std::uint32_t minLedger; - std::uint32_t maxLedger; - std::optional marker; - std::uint32_t limit; - bool bAdmin; - }; - - using AccountTx = std::pair, std::shared_ptr>; - using AccountTxs = std::vector; - using txnMetaLedgerType = std::tuple; - using MetaTxsList = std::vector; - - using LedgerSequence = uint32_t; - using LedgerHash = uint256; - using LedgerShortcut = RPC::LedgerShortcut; - using LedgerSpecifier = std::variant; - - struct AccountTxArgs - { - AccountID account; - std::optional ledger; - bool binary = false; - bool forward = false; - uint32_t limit = 0; - std::optional marker; - }; - - struct AccountTxResult - { - std::variant transactions; - LedgerRange ledgerRange; - uint32_t limit; - std::optional marker; - }; - - /** - * @brief init Creates and returns an appropriate RelationalDatabase - * instance based on configuration. - * @param registry The service registry. - * @param config Config object. - * @param jobQueue JobQueue object. - * @return Unique pointer to the interface. - */ - static std::unique_ptr - init(ServiceRegistry& registry, Config const& config, JobQueue& jobQueue); - - virtual ~RelationalDatabase() = default; - - /** - * @brief getMinLedgerSeq Returns the minimum ledger sequence in the Ledgers - * table. - * @return Ledger sequence or no value if no ledgers exist. - */ - virtual std::optional - getMinLedgerSeq() = 0; - - /** - * @brief getMaxLedgerSeq Returns the maximum ledger sequence in the Ledgers - * table. - * @return Ledger sequence or none if no ledgers exist. - */ - virtual std::optional - getMaxLedgerSeq() = 0; - - /** - * @brief getLedgerInfoByIndex Returns a ledger by its sequence. - * @param ledgerSeq Ledger sequence. - * @return The ledger if found, otherwise no value. - */ - virtual std::optional - getLedgerInfoByIndex(LedgerIndex ledgerSeq) = 0; - - /** - * @brief getNewestLedgerInfo Returns the info of the newest saved ledger. - * @return Ledger info if found, otherwise no value. - */ - virtual std::optional - getNewestLedgerInfo() = 0; - - /** - * @brief getLedgerInfoByHash Returns the info of the ledger with given - * hash. - * @param ledgerHash Hash of the ledger. - * @return Ledger if found, otherwise no value. - */ - virtual std::optional - getLedgerInfoByHash(uint256 const& ledgerHash) = 0; - - /** - * @brief getHashByIndex Returns the hash of the ledger with the given - * sequence. - * @param ledgerIndex Ledger sequence. - * @return Hash of the ledger. - */ - virtual uint256 - getHashByIndex(LedgerIndex ledgerIndex) = 0; - - /** - * @brief getHashesByIndex Returns the hashes of the ledger and its parent - * as specified by the ledgerIndex. - * @param ledgerIndex Ledger sequence. - * @return Struct LedgerHashPair which contains hashes of the ledger and - * its parent. - */ - virtual std::optional - getHashesByIndex(LedgerIndex ledgerIndex) = 0; - - /** - * @brief getHashesByIndex Returns hashes of each ledger and its parent for - * all ledgers within the provided range. - * @param minSeq Minimum ledger sequence. - * @param maxSeq Maximum ledger sequence. - * @return Container that maps the sequence number of a found ledger to the - * struct LedgerHashPair which contains the hashes of the ledger and - * its parent. - */ - virtual std::map - getHashesByIndex(LedgerIndex minSeq, LedgerIndex maxSeq) = 0; - - /** - * @brief getTxHistory Returns the 20 most recent transactions starting from - * the given number. - * @param startIndex First number of returned entry. - * @return Vector of shared pointers to transactions sorted in - * descending order by ledger sequence. - */ - virtual std::vector> - getTxHistory(LedgerIndex startIndex) = 0; - - /** - * @brief ledgerDbHasSpace Checks if the ledger database has available - * space. - * @param config Config object. - * @return True if space is available. - */ - virtual bool - ledgerDbHasSpace(Config const& config) = 0; - - /** - * @brief transactionDbHasSpace Checks if the transaction database has - * available space. - * @param config Config object. - * @return True if space is available. - */ - virtual bool - transactionDbHasSpace(Config const& config) = 0; -}; - -template -T -rangeCheckedCast(C c) -{ - if ((c > std::numeric_limits::max()) || (!std::numeric_limits::is_signed && c < 0) || - (std::numeric_limits::is_signed && std::numeric_limits::is_signed && - c < std::numeric_limits::lowest())) - { - // This should never happen - // LCOV_EXCL_START - UNREACHABLE("xrpl::rangeCheckedCast : domain error"); - JLOG(debugLog().error()) << "rangeCheckedCast domain error:" - << " value = " << c << " min = " << std::numeric_limits::lowest() - << " max: " << std::numeric_limits::max(); - // LCOV_EXCL_STOP - } - - return static_cast(c); -} - -} // namespace xrpl diff --git a/src/xrpld/app/rdb/backend/SQLiteDatabase.h b/src/xrpld/app/rdb/backend/SQLiteDatabase.h index b6dcb2534b..b79b66787e 100644 --- a/src/xrpld/app/rdb/backend/SQLiteDatabase.h +++ b/src/xrpld/app/rdb/backend/SQLiteDatabase.h @@ -1,43 +1,130 @@ #pragma once -#include +#include + +#include namespace xrpl { -class SQLiteDatabase : public RelationalDatabase +class Config; +class JobQueue; +class ServiceRegistry; + +class SQLiteDatabase final : public RelationalDatabase { public: + /** + * @brief getMinLedgerSeq Returns the minimum ledger sequence in the Ledgers + * table. + * @return Ledger sequence or no value if no ledgers exist. + */ + std::optional + getMinLedgerSeq() override; + + /** + * @brief getMaxLedgerSeq Returns the maximum ledger sequence in the Ledgers + * table. + * @return Ledger sequence or none if no ledgers exist. + */ + std::optional + getMaxLedgerSeq() override; + + /** + * @brief getLedgerInfoByIndex Returns a ledger by its sequence. + * @param ledgerSeq Ledger sequence. + * @return The ledger if found, otherwise no value. + */ + std::optional + getLedgerInfoByIndex(LedgerIndex ledgerSeq) override; + + /** + * @brief getNewestLedgerInfo Returns the info of the newest saved ledger. + * @return Ledger info if found, otherwise no value. + */ + std::optional + getNewestLedgerInfo() override; + + /** + * @brief getLedgerInfoByHash Returns the info of the ledger with given + * hash. + * @param ledgerHash Hash of the ledger. + * @return Ledger if found, otherwise no value. + */ + std::optional + getLedgerInfoByHash(uint256 const& ledgerHash) override; + + /** + * @brief getHashByIndex Returns the hash of the ledger with the given + * sequence. + * @param ledgerIndex Ledger sequence. + * @return Hash of the ledger. + */ + uint256 + getHashByIndex(LedgerIndex ledgerIndex) override; + + /** + * @brief getHashesByIndex Returns the hashes of the ledger and its parent + * as specified by the ledgerIndex. + * @param ledgerIndex Ledger sequence. + * @return Struct LedgerHashPair which contains hashes of the ledger and + * its parent. + */ + std::optional + getHashesByIndex(LedgerIndex ledgerIndex) override; + + /** + * @brief getHashesByIndex Returns hashes of each ledger and its parent for + * all ledgers within the provided range. + * @param minSeq Minimum ledger sequence. + * @param maxSeq Maximum ledger sequence. + * @return Container that maps the sequence number of a found ledger to the + * struct LedgerHashPair which contains the hashes of the ledger and + * its parent. + */ + std::map + getHashesByIndex(LedgerIndex minSeq, LedgerIndex maxSeq) override; + + /** + * @brief getTxHistory Returns the 20 most recent transactions starting from + * the given number. + * @param startIndex First number of returned entry. + * @return Vector of shared pointers to transactions sorted in + * descending order by ledger sequence. + */ + std::vector> + getTxHistory(LedgerIndex startIndex) override; + /** * @brief getTransactionsMinLedgerSeq Returns the minimum ledger sequence * stored in the Transactions table. * @return Ledger sequence or no value if no ledgers exist. */ - virtual std::optional - getTransactionsMinLedgerSeq() = 0; + std::optional + getTransactionsMinLedgerSeq() override; /** * @brief getAccountTransactionsMinLedgerSeq Returns the minimum ledger * sequence stored in the AccountTransactions table. * @return Ledger sequence or no value if no ledgers exist. */ - virtual std::optional - getAccountTransactionsMinLedgerSeq() = 0; + std::optional + getAccountTransactionsMinLedgerSeq() override; /** * @brief deleteTransactionByLedgerSeq Deletes transactions from the ledger * with the given sequence. * @param ledgerSeq Ledger sequence. */ - virtual void - deleteTransactionByLedgerSeq(LedgerIndex ledgerSeq) = 0; + void + deleteTransactionByLedgerSeq(LedgerIndex ledgerSeq) override; /** * @brief deleteBeforeLedgerSeq Deletes all ledgers with a sequence number * less than or equal to the given ledger sequence. * @param ledgerSeq Ledger sequence. */ - virtual void - deleteBeforeLedgerSeq(LedgerIndex ledgerSeq) = 0; + void + deleteBeforeLedgerSeq(LedgerIndex ledgerSeq) override; /** * @brief deleteTransactionsBeforeLedgerSeq Deletes all transactions with @@ -45,8 +132,8 @@ public: * sequence. * @param ledgerSeq Ledger sequence. */ - virtual void - deleteTransactionsBeforeLedgerSeq(LedgerIndex ledgerSeq) = 0; + void + deleteTransactionsBeforeLedgerSeq(LedgerIndex ledgerSeq) override; /** * @brief deleteAccountTransactionsBeforeLedgerSeq Deletes all account @@ -54,23 +141,23 @@ public: * given ledger sequence. * @param ledgerSeq Ledger sequence. */ - virtual void - deleteAccountTransactionsBeforeLedgerSeq(LedgerIndex ledgerSeq) = 0; + void + deleteAccountTransactionsBeforeLedgerSeq(LedgerIndex ledgerSeq) override; /** * @brief getTransactionCount Returns the number of transactions. * @return Number of transactions. */ - virtual std::size_t - getTransactionCount() = 0; + std::size_t + getTransactionCount() override; /** * @brief getAccountTransactionCount Returns the number of account * transactions. * @return Number of account transactions. */ - virtual std::size_t - getAccountTransactionCount() = 0; + std::size_t + getAccountTransactionCount() override; /** * @brief getLedgerCountMinMax Returns the minimum ledger sequence, @@ -78,8 +165,8 @@ public: * @return Struct CountMinMax which contains the minimum sequence, * maximum sequence and number of ledgers. */ - virtual struct CountMinMax - getLedgerCountMinMax() = 0; + CountMinMax + getLedgerCountMinMax() override; /** * @brief saveValidatedLedger Saves a ledger into the database. @@ -87,8 +174,8 @@ public: * @param current True if the ledger is current. * @return True if saving was successful. */ - virtual bool - saveValidatedLedger(std::shared_ptr const& ledger, bool current) = 0; + bool + saveValidatedLedger(std::shared_ptr const& ledger, bool current) override; /** * @brief getLimitedOldestLedgerInfo Returns the info of the oldest ledger @@ -97,8 +184,8 @@ public: * @param ledgerFirstIndex Minimum ledger sequence. * @return Ledger info if found, otherwise no value. */ - virtual std::optional - getLimitedOldestLedgerInfo(LedgerIndex ledgerFirstIndex) = 0; + std::optional + getLimitedOldestLedgerInfo(LedgerIndex ledgerFirstIndex) override; /** * @brief getLimitedNewestLedgerInfo Returns the info of the newest ledger @@ -107,8 +194,8 @@ public: * @param ledgerFirstIndex Minimum ledger sequence. * @return Ledger info if found, otherwise no value. */ - virtual std::optional - getLimitedNewestLedgerInfo(LedgerIndex ledgerFirstIndex) = 0; + std::optional + getLimitedNewestLedgerInfo(LedgerIndex ledgerFirstIndex) override; /** * @brief getOldestAccountTxs Returns the oldest transactions for the @@ -121,8 +208,8 @@ public: * @return Vector of pairs of found transactions and their metadata * sorted in ascending order by account sequence. */ - virtual AccountTxs - getOldestAccountTxs(AccountTxOptions const& options) = 0; + AccountTxs + getOldestAccountTxs(AccountTxOptions const& options) override; /** * @brief getNewestAccountTxs Returns the newest transactions for the @@ -135,8 +222,8 @@ public: * @return Vector of pairs of found transactions and their metadata * sorted in descending order by account sequence. */ - virtual AccountTxs - getNewestAccountTxs(AccountTxOptions const& options) = 0; + AccountTxs + getNewestAccountTxs(AccountTxOptions const& options) override; /** * @brief getOldestAccountTxsB Returns the oldest transactions in binary @@ -149,8 +236,8 @@ public: * @return Vector of tuples of found transactions, their metadata and * account sequences sorted in ascending order by account sequence. */ - virtual MetaTxsList - getOldestAccountTxsB(AccountTxOptions const& options) = 0; + MetaTxsList + getOldestAccountTxsB(AccountTxOptions const& options) override; /** * @brief getNewestAccountTxsB Returns the newest transactions in binary @@ -164,8 +251,8 @@ public: * account sequences sorted in descending order by account * sequence. */ - virtual MetaTxsList - getNewestAccountTxsB(AccountTxOptions const& options) = 0; + MetaTxsList + getNewestAccountTxsB(AccountTxOptions const& options) override; /** * @brief oldestAccountTxPage Returns the oldest transactions for the @@ -179,8 +266,8 @@ public: * sorted in ascending order by account sequence and a marker * for the next search if the search was not finished. */ - virtual std::pair> - oldestAccountTxPage(AccountTxPageOptions const& options) = 0; + std::pair> + oldestAccountTxPage(AccountTxPageOptions const& options) override; /** * @brief newestAccountTxPage Returns the newest transactions for the @@ -194,8 +281,8 @@ public: * sorted in descending order by account sequence and a marker * for the next search if the search was not finished. */ - virtual std::pair> - newestAccountTxPage(AccountTxPageOptions const& options) = 0; + std::pair> + newestAccountTxPage(AccountTxPageOptions const& options) override; /** * @brief oldestAccountTxPageB Returns the oldest transactions in binary @@ -210,8 +297,8 @@ public: * sequence and a marker for the next search if the search was not * finished. */ - virtual std::pair> - oldestAccountTxPageB(AccountTxPageOptions const& options) = 0; + std::pair> + oldestAccountTxPageB(AccountTxPageOptions const& options) override; /** * @brief newestAccountTxPageB Returns the newest transactions in binary @@ -226,8 +313,8 @@ public: * sequence and a marker for the next search if the search was not * finished. */ - virtual std::pair> - newestAccountTxPageB(AccountTxPageOptions const& options) = 0; + std::pair> + newestAccountTxPageB(AccountTxPageOptions const& options) override; /** * @brief getTransaction Returns the transaction with the given hash. If a @@ -244,43 +331,146 @@ public: * error code is returned via the ec parameter, in other cases the * default error code is not changed. */ - virtual std::variant - getTransaction(uint256 const& id, std::optional> const& range, error_code_i& ec) = 0; + std::variant + getTransaction(uint256 const& id, std::optional> const& range, error_code_i& ec) + override; /** * @brief getKBUsedAll Returns the amount of space used by all databases. * @return Space in kilobytes. */ - virtual uint32_t - getKBUsedAll() = 0; + std::uint32_t + getKBUsedAll() override; /** * @brief getKBUsedLedger Returns the amount of space space used by the * ledger database. * @return Space in kilobytes. */ - virtual uint32_t - getKBUsedLedger() = 0; + std::uint32_t + getKBUsedLedger() override; /** * @brief getKBUsedTransaction Returns the amount of space used by the * transaction database. * @return Space in kilobytes. */ - virtual uint32_t - getKBUsedTransaction() = 0; + std::uint32_t + getKBUsedTransaction() override; /** * @brief Closes the ledger database */ - virtual void - closeLedgerDB() = 0; + void + closeLedgerDB() override; /** * @brief Closes the transaction database */ - virtual void - closeTransactionDB() = 0; + void + closeTransactionDB() override; + + SQLiteDatabase(ServiceRegistry& registry, Config const& config, JobQueue& jobQueue); + + SQLiteDatabase(SQLiteDatabase const&) = delete; + SQLiteDatabase(SQLiteDatabase&& rhs) noexcept; + + SQLiteDatabase& + operator=(SQLiteDatabase const&) = delete; + SQLiteDatabase& + operator=(SQLiteDatabase&& rhs) = delete; + + /** + * @brief ledgerDbHasSpace Checks if the ledger database has available + * space. + * @param config Config object. + * @return True if space is available. + */ + bool + ledgerDbHasSpace(Config const& config); + + /** + * @brief transactionDbHasSpace Checks if the transaction database has + * available space. + * @param config Config object. + * @return True if space is available. + */ + bool + transactionDbHasSpace(Config const& config); + +private: + ServiceRegistry& registry_; + bool const useTxTables_; + beast::Journal j_; + std::unique_ptr ledgerDb_, txdb_; + + /** + * @brief makeLedgerDBs Opens ledger and transaction databases for the node + * store, and stores their descriptors in private member variables. + * @param config Config object. + * @param setup Path to the databases and other opening parameters. + * @param checkpointerSetup Checkpointer parameters. + * @return True if node databases opened successfully. + */ + bool + makeLedgerDBs( + Config const& config, + DatabaseCon::Setup const& setup, + DatabaseCon::CheckpointerSetup const& checkpointerSetup); + + /** + * @brief existsLedger Checks if the node store ledger database exists. + * @return True if the node store ledger database exists. + */ + bool + existsLedger() + { + return static_cast(ledgerDb_); + } + + /** + * @brief existsTransaction Checks if the node store transaction database + * exists. + * @return True if the node store transaction database exists. + */ + bool + existsTransaction() + { + return static_cast(txdb_); + } + + /** + * @brief checkoutTransaction Checks out and returns node store ledger + * database. + * @return Session to the node store ledger database. + */ + auto + checkoutLedger() + { + return ledgerDb_->checkoutDb(); + } + + /** + * @brief checkoutTransaction Checks out and returns the node store + * transaction database. + * @return Session to the node store transaction database. + */ + auto + checkoutTransaction() + { + return txdb_->checkoutDb(); + } }; +/** + * @brief setup_RelationalDatabase Creates and returns a SQLiteDatabase + * instance based on configuration. + * @param registry The service registry. + * @param config Config object. + * @param jobQueue JobQueue object. + * @return SQLiteDatabase instance. + */ +SQLiteDatabase +setup_RelationalDatabase(ServiceRegistry& registry, Config const& config, JobQueue& jobQueue); + } // namespace xrpl diff --git a/src/xrpld/app/rdb/backend/detail/Node.cpp b/src/xrpld/app/rdb/backend/detail/Node.cpp index 1e814c3589..328d07c0ab 100644 --- a/src/xrpld/app/rdb/backend/detail/Node.cpp +++ b/src/xrpld/app/rdb/backend/detail/Node.cpp @@ -3,13 +3,13 @@ #include #include #include -#include #include #include #include #include #include +#include #include #include diff --git a/src/xrpld/app/rdb/backend/detail/Node.h b/src/xrpld/app/rdb/backend/detail/Node.h index 69c4894bbc..cb49a373bd 100644 --- a/src/xrpld/app/rdb/backend/detail/Node.h +++ b/src/xrpld/app/rdb/backend/detail/Node.h @@ -1,9 +1,10 @@ #pragma once #include -#include #include +#include + namespace xrpl { namespace detail { diff --git a/src/xrpld/app/rdb/backend/detail/SQLiteDatabase.cpp b/src/xrpld/app/rdb/backend/detail/SQLiteDatabase.cpp index 4f1430ee4c..6c3e76a86f 100644 --- a/src/xrpld/app/rdb/backend/detail/SQLiteDatabase.cpp +++ b/src/xrpld/app/rdb/backend/detail/SQLiteDatabase.cpp @@ -10,200 +10,8 @@ namespace xrpl { -class SQLiteDatabaseImp final : public SQLiteDatabase -{ -public: - SQLiteDatabaseImp(ServiceRegistry& registry, Config const& config, JobQueue& jobQueue) - : registry_(registry), useTxTables_(config.useTxTables()), j_(registry.journal("SQLiteDatabaseImp")) - { - DatabaseCon::Setup const setup = setup_DatabaseCon(config, j_); - if (!makeLedgerDBs(config, setup, DatabaseCon::CheckpointerSetup{&jobQueue, ®istry_.logs()})) - { - std::string_view constexpr error = "Failed to create ledger databases"; - - JLOG(j_.fatal()) << error; - Throw(error.data()); - } - } - - std::optional - getMinLedgerSeq() override; - - std::optional - getTransactionsMinLedgerSeq() override; - - std::optional - getAccountTransactionsMinLedgerSeq() override; - - std::optional - getMaxLedgerSeq() override; - - void - deleteTransactionByLedgerSeq(LedgerIndex ledgerSeq) override; - - void - deleteBeforeLedgerSeq(LedgerIndex ledgerSeq) override; - - void - deleteTransactionsBeforeLedgerSeq(LedgerIndex ledgerSeq) override; - - void - deleteAccountTransactionsBeforeLedgerSeq(LedgerIndex ledgerSeq) override; - - std::size_t - getTransactionCount() override; - - std::size_t - getAccountTransactionCount() override; - - RelationalDatabase::CountMinMax - getLedgerCountMinMax() override; - - bool - saveValidatedLedger(std::shared_ptr const& ledger, bool current) override; - - std::optional - getLedgerInfoByIndex(LedgerIndex ledgerSeq) override; - - std::optional - getNewestLedgerInfo() override; - - std::optional - getLimitedOldestLedgerInfo(LedgerIndex ledgerFirstIndex) override; - - std::optional - getLimitedNewestLedgerInfo(LedgerIndex ledgerFirstIndex) override; - - std::optional - getLedgerInfoByHash(uint256 const& ledgerHash) override; - - uint256 - getHashByIndex(LedgerIndex ledgerIndex) override; - - std::optional - getHashesByIndex(LedgerIndex ledgerIndex) override; - - std::map - getHashesByIndex(LedgerIndex minSeq, LedgerIndex maxSeq) override; - - std::vector> - getTxHistory(LedgerIndex startIndex) override; - - AccountTxs - getOldestAccountTxs(AccountTxOptions const& options) override; - - AccountTxs - getNewestAccountTxs(AccountTxOptions const& options) override; - - MetaTxsList - getOldestAccountTxsB(AccountTxOptions const& options) override; - - MetaTxsList - getNewestAccountTxsB(AccountTxOptions const& options) override; - - std::pair> - oldestAccountTxPage(AccountTxPageOptions const& options) override; - - std::pair> - newestAccountTxPage(AccountTxPageOptions const& options) override; - - std::pair> - oldestAccountTxPageB(AccountTxPageOptions const& options) override; - - std::pair> - newestAccountTxPageB(AccountTxPageOptions const& options) override; - - std::variant - getTransaction(uint256 const& id, std::optional> const& range, error_code_i& ec) - override; - - bool - ledgerDbHasSpace(Config const& config) override; - - bool - transactionDbHasSpace(Config const& config) override; - - std::uint32_t - getKBUsedAll() override; - - std::uint32_t - getKBUsedLedger() override; - - std::uint32_t - getKBUsedTransaction() override; - - void - closeLedgerDB() override; - - void - closeTransactionDB() override; - -private: - ServiceRegistry& registry_; - bool const useTxTables_; - beast::Journal j_; - std::unique_ptr ledgerDb_, txdb_; - - /** - * @brief makeLedgerDBs Opens ledger and transaction databases for the node - * store, and stores their descriptors in private member variables. - * @param config Config object. - * @param setup Path to the databases and other opening parameters. - * @param checkpointerSetup Checkpointer parameters. - * @return True if node databases opened successfully. - */ - bool - makeLedgerDBs( - Config const& config, - DatabaseCon::Setup const& setup, - DatabaseCon::CheckpointerSetup const& checkpointerSetup); - - /** - * @brief existsLedger Checks if the node store ledger database exists. - * @return True if the node store ledger database exists. - */ - bool - existsLedger() - { - return static_cast(ledgerDb_); - } - - /** - * @brief existsTransaction Checks if the node store transaction database - * exists. - * @return True if the node store transaction database exists. - */ - bool - existsTransaction() - { - return static_cast(txdb_); - } - - /** - * @brief checkoutTransaction Checks out and returns node store ledger - * database. - * @return Session to the node store ledger database. - */ - auto - checkoutLedger() - { - return ledgerDb_->checkoutDb(); - } - - /** - * @brief checkoutTransaction Checks out and returns the node store - * transaction database. - * @return Session to the node store transaction database. - */ - auto - checkoutTransaction() - { - return txdb_->checkoutDb(); - } -}; - bool -SQLiteDatabaseImp::makeLedgerDBs( +SQLiteDatabase::makeLedgerDBs( Config const& config, DatabaseCon::Setup const& setup, DatabaseCon::CheckpointerSetup const& checkpointerSetup) @@ -215,7 +23,7 @@ SQLiteDatabaseImp::makeLedgerDBs( } std::optional -SQLiteDatabaseImp::getMinLedgerSeq() +SQLiteDatabase::getMinLedgerSeq() { /* if databases exists, use it */ if (existsLedger()) @@ -229,7 +37,7 @@ SQLiteDatabaseImp::getMinLedgerSeq() } std::optional -SQLiteDatabaseImp::getTransactionsMinLedgerSeq() +SQLiteDatabase::getTransactionsMinLedgerSeq() { if (!useTxTables_) return {}; @@ -244,7 +52,7 @@ SQLiteDatabaseImp::getTransactionsMinLedgerSeq() } std::optional -SQLiteDatabaseImp::getAccountTransactionsMinLedgerSeq() +SQLiteDatabase::getAccountTransactionsMinLedgerSeq() { if (!useTxTables_) return {}; @@ -259,7 +67,7 @@ SQLiteDatabaseImp::getAccountTransactionsMinLedgerSeq() } std::optional -SQLiteDatabaseImp::getMaxLedgerSeq() +SQLiteDatabase::getMaxLedgerSeq() { if (existsLedger()) { @@ -271,7 +79,7 @@ SQLiteDatabaseImp::getMaxLedgerSeq() } void -SQLiteDatabaseImp::deleteTransactionByLedgerSeq(LedgerIndex ledgerSeq) +SQLiteDatabase::deleteTransactionByLedgerSeq(LedgerIndex ledgerSeq) { if (!useTxTables_) return; @@ -285,7 +93,7 @@ SQLiteDatabaseImp::deleteTransactionByLedgerSeq(LedgerIndex ledgerSeq) } void -SQLiteDatabaseImp::deleteBeforeLedgerSeq(LedgerIndex ledgerSeq) +SQLiteDatabase::deleteBeforeLedgerSeq(LedgerIndex ledgerSeq) { if (existsLedger()) { @@ -296,7 +104,7 @@ SQLiteDatabaseImp::deleteBeforeLedgerSeq(LedgerIndex ledgerSeq) } void -SQLiteDatabaseImp::deleteTransactionsBeforeLedgerSeq(LedgerIndex ledgerSeq) +SQLiteDatabase::deleteTransactionsBeforeLedgerSeq(LedgerIndex ledgerSeq) { if (!useTxTables_) return; @@ -310,7 +118,7 @@ SQLiteDatabaseImp::deleteTransactionsBeforeLedgerSeq(LedgerIndex ledgerSeq) } void -SQLiteDatabaseImp::deleteAccountTransactionsBeforeLedgerSeq(LedgerIndex ledgerSeq) +SQLiteDatabase::deleteAccountTransactionsBeforeLedgerSeq(LedgerIndex ledgerSeq) { if (!useTxTables_) return; @@ -324,7 +132,7 @@ SQLiteDatabaseImp::deleteAccountTransactionsBeforeLedgerSeq(LedgerIndex ledgerSe } std::size_t -SQLiteDatabaseImp::getTransactionCount() +SQLiteDatabase::getTransactionCount() { if (!useTxTables_) return 0; @@ -339,7 +147,7 @@ SQLiteDatabaseImp::getTransactionCount() } std::size_t -SQLiteDatabaseImp::getAccountTransactionCount() +SQLiteDatabase::getAccountTransactionCount() { if (!useTxTables_) return 0; @@ -354,7 +162,7 @@ SQLiteDatabaseImp::getAccountTransactionCount() } RelationalDatabase::CountMinMax -SQLiteDatabaseImp::getLedgerCountMinMax() +SQLiteDatabase::getLedgerCountMinMax() { if (existsLedger()) { @@ -366,7 +174,7 @@ SQLiteDatabaseImp::getLedgerCountMinMax() } bool -SQLiteDatabaseImp::saveValidatedLedger(std::shared_ptr const& ledger, bool current) +SQLiteDatabase::saveValidatedLedger(std::shared_ptr const& ledger, bool current) { if (existsLedger()) { @@ -378,7 +186,7 @@ SQLiteDatabaseImp::saveValidatedLedger(std::shared_ptr const& ledg } std::optional -SQLiteDatabaseImp::getLedgerInfoByIndex(LedgerIndex ledgerSeq) +SQLiteDatabase::getLedgerInfoByIndex(LedgerIndex ledgerSeq) { if (existsLedger()) { @@ -393,7 +201,7 @@ SQLiteDatabaseImp::getLedgerInfoByIndex(LedgerIndex ledgerSeq) } std::optional -SQLiteDatabaseImp::getNewestLedgerInfo() +SQLiteDatabase::getNewestLedgerInfo() { if (existsLedger()) { @@ -408,7 +216,7 @@ SQLiteDatabaseImp::getNewestLedgerInfo() } std::optional -SQLiteDatabaseImp::getLimitedOldestLedgerInfo(LedgerIndex ledgerFirstIndex) +SQLiteDatabase::getLimitedOldestLedgerInfo(LedgerIndex ledgerFirstIndex) { if (existsLedger()) { @@ -423,7 +231,7 @@ SQLiteDatabaseImp::getLimitedOldestLedgerInfo(LedgerIndex ledgerFirstIndex) } std::optional -SQLiteDatabaseImp::getLimitedNewestLedgerInfo(LedgerIndex ledgerFirstIndex) +SQLiteDatabase::getLimitedNewestLedgerInfo(LedgerIndex ledgerFirstIndex) { if (existsLedger()) { @@ -438,7 +246,7 @@ SQLiteDatabaseImp::getLimitedNewestLedgerInfo(LedgerIndex ledgerFirstIndex) } std::optional -SQLiteDatabaseImp::getLedgerInfoByHash(uint256 const& ledgerHash) +SQLiteDatabase::getLedgerInfoByHash(uint256 const& ledgerHash) { if (existsLedger()) { @@ -453,7 +261,7 @@ SQLiteDatabaseImp::getLedgerInfoByHash(uint256 const& ledgerHash) } uint256 -SQLiteDatabaseImp::getHashByIndex(LedgerIndex ledgerIndex) +SQLiteDatabase::getHashByIndex(LedgerIndex ledgerIndex) { if (existsLedger()) { @@ -468,7 +276,7 @@ SQLiteDatabaseImp::getHashByIndex(LedgerIndex ledgerIndex) } std::optional -SQLiteDatabaseImp::getHashesByIndex(LedgerIndex ledgerIndex) +SQLiteDatabase::getHashesByIndex(LedgerIndex ledgerIndex) { if (existsLedger()) { @@ -483,7 +291,7 @@ SQLiteDatabaseImp::getHashesByIndex(LedgerIndex ledgerIndex) } std::map -SQLiteDatabaseImp::getHashesByIndex(LedgerIndex minSeq, LedgerIndex maxSeq) +SQLiteDatabase::getHashesByIndex(LedgerIndex minSeq, LedgerIndex maxSeq) { if (existsLedger()) { @@ -498,7 +306,7 @@ SQLiteDatabaseImp::getHashesByIndex(LedgerIndex minSeq, LedgerIndex maxSeq) } std::vector> -SQLiteDatabaseImp::getTxHistory(LedgerIndex startIndex) +SQLiteDatabase::getTxHistory(LedgerIndex startIndex) { if (!useTxTables_) return {}; @@ -516,7 +324,7 @@ SQLiteDatabaseImp::getTxHistory(LedgerIndex startIndex) } RelationalDatabase::AccountTxs -SQLiteDatabaseImp::getOldestAccountTxs(AccountTxOptions const& options) +SQLiteDatabase::getOldestAccountTxs(AccountTxOptions const& options) { if (!useTxTables_) return {}; @@ -533,7 +341,7 @@ SQLiteDatabaseImp::getOldestAccountTxs(AccountTxOptions const& options) } RelationalDatabase::AccountTxs -SQLiteDatabaseImp::getNewestAccountTxs(AccountTxOptions const& options) +SQLiteDatabase::getNewestAccountTxs(AccountTxOptions const& options) { if (!useTxTables_) return {}; @@ -550,7 +358,7 @@ SQLiteDatabaseImp::getNewestAccountTxs(AccountTxOptions const& options) } RelationalDatabase::MetaTxsList -SQLiteDatabaseImp::getOldestAccountTxsB(AccountTxOptions const& options) +SQLiteDatabase::getOldestAccountTxsB(AccountTxOptions const& options) { if (!useTxTables_) return {}; @@ -565,7 +373,7 @@ SQLiteDatabaseImp::getOldestAccountTxsB(AccountTxOptions const& options) } RelationalDatabase::MetaTxsList -SQLiteDatabaseImp::getNewestAccountTxsB(AccountTxOptions const& options) +SQLiteDatabase::getNewestAccountTxsB(AccountTxOptions const& options) { if (!useTxTables_) return {}; @@ -580,7 +388,7 @@ SQLiteDatabaseImp::getNewestAccountTxsB(AccountTxOptions const& options) } std::pair> -SQLiteDatabaseImp::oldestAccountTxPage(AccountTxPageOptions const& options) +SQLiteDatabase::oldestAccountTxPage(AccountTxPageOptions const& options) { if (!useTxTables_) return {}; @@ -604,7 +412,7 @@ SQLiteDatabaseImp::oldestAccountTxPage(AccountTxPageOptions const& options) } std::pair> -SQLiteDatabaseImp::newestAccountTxPage(AccountTxPageOptions const& options) +SQLiteDatabase::newestAccountTxPage(AccountTxPageOptions const& options) { if (!useTxTables_) return {}; @@ -628,7 +436,7 @@ SQLiteDatabaseImp::newestAccountTxPage(AccountTxPageOptions const& options) } std::pair> -SQLiteDatabaseImp::oldestAccountTxPageB(AccountTxPageOptions const& options) +SQLiteDatabase::oldestAccountTxPageB(AccountTxPageOptions const& options) { if (!useTxTables_) return {}; @@ -651,7 +459,7 @@ SQLiteDatabaseImp::oldestAccountTxPageB(AccountTxPageOptions const& options) } std::pair> -SQLiteDatabaseImp::newestAccountTxPageB(AccountTxPageOptions const& options) +SQLiteDatabase::newestAccountTxPageB(AccountTxPageOptions const& options) { if (!useTxTables_) return {}; @@ -674,7 +482,7 @@ SQLiteDatabaseImp::newestAccountTxPageB(AccountTxPageOptions const& options) } std::variant -SQLiteDatabaseImp::getTransaction( +SQLiteDatabase::getTransaction( uint256 const& id, std::optional> const& range, error_code_i& ec) @@ -692,7 +500,7 @@ SQLiteDatabaseImp::getTransaction( } bool -SQLiteDatabaseImp::ledgerDbHasSpace(Config const& config) +SQLiteDatabase::ledgerDbHasSpace(Config const& config) { if (existsLedger()) { @@ -704,7 +512,7 @@ SQLiteDatabaseImp::ledgerDbHasSpace(Config const& config) } bool -SQLiteDatabaseImp::transactionDbHasSpace(Config const& config) +SQLiteDatabase::transactionDbHasSpace(Config const& config) { if (!useTxTables_) return true; @@ -719,7 +527,7 @@ SQLiteDatabaseImp::transactionDbHasSpace(Config const& config) } std::uint32_t -SQLiteDatabaseImp::getKBUsedAll() +SQLiteDatabase::getKBUsedAll() { if (existsLedger()) { @@ -730,7 +538,7 @@ SQLiteDatabaseImp::getKBUsedAll() } std::uint32_t -SQLiteDatabaseImp::getKBUsedLedger() +SQLiteDatabase::getKBUsedLedger() { if (existsLedger()) { @@ -741,7 +549,7 @@ SQLiteDatabaseImp::getKBUsedLedger() } std::uint32_t -SQLiteDatabaseImp::getKBUsedTransaction() +SQLiteDatabase::getKBUsedTransaction() { if (!useTxTables_) return 0; @@ -755,21 +563,43 @@ SQLiteDatabaseImp::getKBUsedTransaction() } void -SQLiteDatabaseImp::closeLedgerDB() +SQLiteDatabase::closeLedgerDB() { ledgerDb_.reset(); } void -SQLiteDatabaseImp::closeTransactionDB() +SQLiteDatabase::closeTransactionDB() { txdb_.reset(); } -std::unique_ptr -getSQLiteDatabase(ServiceRegistry& registry, Config const& config, JobQueue& jobQueue) +SQLiteDatabase::SQLiteDatabase(ServiceRegistry& registry, Config const& config, JobQueue& jobQueue) + : registry_(registry), useTxTables_(config.useTxTables()), j_(registry.journal("SQLiteDatabase")) { - return std::make_unique(registry, config, jobQueue); + DatabaseCon::Setup const setup = setup_DatabaseCon(config, j_); + if (!makeLedgerDBs(config, setup, DatabaseCon::CheckpointerSetup{&jobQueue, ®istry_.logs()})) + { + std::string_view constexpr error = "Failed to create ledger databases"; + + JLOG(j_.fatal()) << error; + Throw(error.data()); + } +} + +SQLiteDatabase::SQLiteDatabase(SQLiteDatabase&& rhs) noexcept + : registry_(rhs.registry_) + , useTxTables_(rhs.useTxTables_) + , j_(rhs.j_) + , ledgerDb_(std::move(rhs.ledgerDb_)) + , txdb_(std::move(rhs.txdb_)) +{ +} + +SQLiteDatabase +setup_RelationalDatabase(ServiceRegistry& registry, Config const& config, JobQueue& jobQueue) +{ + return {registry, config, jobQueue}; } } // namespace xrpl diff --git a/src/xrpld/app/rdb/detail/RelationalDatabase.cpp b/src/xrpld/app/rdb/detail/RelationalDatabase.cpp index bc65a817a4..e69de29bb2 100644 --- a/src/xrpld/app/rdb/detail/RelationalDatabase.cpp +++ b/src/xrpld/app/rdb/detail/RelationalDatabase.cpp @@ -1,39 +0,0 @@ -#include -#include - -namespace xrpl { - -extern std::unique_ptr -getSQLiteDatabase(ServiceRegistry& registry, Config const& config, JobQueue& jobQueue); - -std::unique_ptr -RelationalDatabase::init(ServiceRegistry& registry, Config const& config, JobQueue& jobQueue) -{ - bool use_sqlite = false; - - Section const& rdb_section{config.section(SECTION_RELATIONAL_DB)}; - if (!rdb_section.empty()) - { - if (boost::iequals(get(rdb_section, "backend"), "sqlite")) - { - use_sqlite = true; - } - else - { - Throw("Invalid rdb_section backend value: " + get(rdb_section, "backend")); - } - } - else - { - use_sqlite = true; - } - - if (use_sqlite) - { - return getSQLiteDatabase(registry, config, jobQueue); - } - - return std::unique_ptr(); -} - -} // namespace xrpl diff --git a/src/xrpld/overlay/detail/OverlayImpl.cpp b/src/xrpld/overlay/detail/OverlayImpl.cpp index 6ac6e454d2..549bff024e 100644 --- a/src/xrpld/overlay/detail/OverlayImpl.cpp +++ b/src/xrpld/overlay/detail/OverlayImpl.cpp @@ -2,7 +2,6 @@ #include #include #include -#include #include #include #include @@ -18,6 +17,7 @@ #include #include #include +#include #include #include diff --git a/src/xrpld/overlay/detail/PeerReservationTable.cpp b/src/xrpld/overlay/detail/PeerReservationTable.cpp index 27d9df1129..78f29ad155 100644 --- a/src/xrpld/overlay/detail/PeerReservationTable.cpp +++ b/src/xrpld/overlay/detail/PeerReservationTable.cpp @@ -1,9 +1,8 @@ -#include - #include #include #include #include +#include #include #include diff --git a/src/xrpld/rpc/detail/RPCHelpers.cpp b/src/xrpld/rpc/detail/RPCHelpers.cpp index 0c4cffd8ac..4a0339b763 100644 --- a/src/xrpld/rpc/detail/RPCHelpers.cpp +++ b/src/xrpld/rpc/detail/RPCHelpers.cpp @@ -1,6 +1,5 @@ #include #include -#include #include #include #include @@ -10,6 +9,7 @@ #include #include #include +#include #include #include diff --git a/src/xrpld/rpc/detail/RPCLedgerHelpers.h b/src/xrpld/rpc/detail/RPCLedgerHelpers.h index 6ea6e3cb78..b2d9df809f 100644 --- a/src/xrpld/rpc/detail/RPCLedgerHelpers.h +++ b/src/xrpld/rpc/detail/RPCLedgerHelpers.h @@ -7,6 +7,7 @@ #include #include +#include #include @@ -19,8 +20,6 @@ namespace RPC { struct JsonContext; -enum class LedgerShortcut { Current, Closed, Validated }; - /** * @brief Retrieves a ledger by its hash. * diff --git a/src/xrpld/rpc/handlers/AccountTx.cpp b/src/xrpld/rpc/handlers/AccountTx.cpp index fbd1a4d08d..8fe43433d3 100644 --- a/src/xrpld/rpc/handlers/AccountTx.cpp +++ b/src/xrpld/rpc/handlers/AccountTx.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -26,8 +27,6 @@ using TxnsDataBinary = RelationalDatabase::MetaTxsList; using TxnDataBinary = RelationalDatabase::txnMetaLedgerType; using AccountTxArgs = RelationalDatabase::AccountTxArgs; using AccountTxResult = RelationalDatabase::AccountTxResult; - -using LedgerShortcut = RelationalDatabase::LedgerShortcut; using LedgerSpecifier = RelationalDatabase::LedgerSpecifier; // parses args into a ledger specifier, or returns a Json object on error @@ -208,22 +207,19 @@ doAccountTxHelp(RPC::Context& context, AccountTxArgs const& args) args.limit, isUnlimited(context.role)}; - auto const db = dynamic_cast(&context.app.getRelationalDatabase()); - - if (!db) - Throw("Failed to get relational database"); + auto& db = context.app.getRelationalDatabase(); if (args.binary) { if (args.forward) { - auto [tx, marker] = db->oldestAccountTxPageB(options); + auto [tx, marker] = db.oldestAccountTxPageB(options); result.transactions = tx; result.marker = marker; } else { - auto [tx, marker] = db->newestAccountTxPageB(options); + auto [tx, marker] = db.newestAccountTxPageB(options); result.transactions = tx; result.marker = marker; } @@ -232,13 +228,13 @@ doAccountTxHelp(RPC::Context& context, AccountTxArgs const& args) { if (args.forward) { - auto [tx, marker] = db->oldestAccountTxPage(options); + auto [tx, marker] = db.oldestAccountTxPage(options); result.transactions = tx; result.marker = marker; } else { - auto [tx, marker] = db->newestAccountTxPage(options); + auto [tx, marker] = db.newestAccountTxPage(options); result.transactions = tx; result.marker = marker; } diff --git a/src/xrpld/rpc/handlers/GetCounts.cpp b/src/xrpld/rpc/handlers/GetCounts.cpp index 2a59be2747..360389ba3a 100644 --- a/src/xrpld/rpc/handlers/GetCounts.cpp +++ b/src/xrpld/rpc/handlers/GetCounts.cpp @@ -49,22 +49,19 @@ getCountsJson(Application& app, int minObjectCount) if (app.config().useTxTables()) { - auto const db = dynamic_cast(&app.getRelationalDatabase()); + auto& db = app.getRelationalDatabase(); - if (!db) - Throw("Failed to get relational database"); - - auto dbKB = db->getKBUsedAll(); + auto dbKB = db.getKBUsedAll(); if (dbKB > 0) ret[jss::dbKBTotal] = dbKB; - dbKB = db->getKBUsedLedger(); + dbKB = db.getKBUsedLedger(); if (dbKB > 0) ret[jss::dbKBLedger] = dbKB; - dbKB = db->getKBUsedTransaction(); + dbKB = db.getKBUsedTransaction(); if (dbKB > 0) ret[jss::dbKBTransaction] = dbKB; diff --git a/src/xrpld/rpc/handlers/Tx.cpp b/src/xrpld/rpc/handlers/Tx.cpp index 5d8778d619..2f8d71c2c8 100644 --- a/src/xrpld/rpc/handlers/Tx.cpp +++ b/src/xrpld/rpc/handlers/Tx.cpp @@ -3,18 +3,19 @@ #include #include #include -#include #include #include #include #include #include +#include #include #include #include #include #include +#include #include diff --git a/src/xrpld/rpc/handlers/TxHistory.cpp b/src/xrpld/rpc/handlers/TxHistory.cpp index 00894647eb..02ff6fb43c 100644 --- a/src/xrpld/rpc/handlers/TxHistory.cpp +++ b/src/xrpld/rpc/handlers/TxHistory.cpp @@ -2,13 +2,13 @@ #include #include #include -#include #include #include #include #include #include +#include #include namespace xrpl { From 11e8d1f8a206f0c5379ba78bc3aa044adf5a63d7 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Thu, 12 Feb 2026 11:11:26 +0000 Subject: [PATCH 36/61] chore: Fix `gcov` lib coverage build failure on macOS (#6350) For coverage builds, we try to link against the `gcov` library (specific to the environment). But as macOS doesn't have this library and thus doesn't have the coverage tools to generate reports, the coverage builds on that platform were failing on linking. We actually don't need to explicitly force this linking, as the `CodeCoverage` file already has correct detection logic (currently on lines 177-193), which is invoked when the `--coverage` flag is provided: * AppleClang: Uses `xcrun -f llvm-cov` to set `GCOV_TOOL="llvm-cov gcov"`. * Clang: Finds `llvm-cov` to set `GCOV_TOOL="llvm-cov gcov"`. * GCC: Finds `gcov` to set `GCOV_TOOL="gcov"`. The `GCOV_TOOL` is then passed to `gcovr` on line 416, so the correct tool is used for processing coverage data. This change therefore removes the `gcov` suffix from lines 473 and 475 in the `CodeCoverage.cmake` file. --- cmake/CodeCoverage.cmake | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/cmake/CodeCoverage.cmake b/cmake/CodeCoverage.cmake index 0178d68cc0..fcc4d44133 100644 --- a/cmake/CodeCoverage.cmake +++ b/cmake/CodeCoverage.cmake @@ -466,11 +466,6 @@ function (add_code_coverage_to_target name scope) target_compile_options(${name} ${scope} $<$:${COVERAGE_CXX_COMPILER_FLAGS}> $<$:${COVERAGE_C_COMPILER_FLAGS}>) - target_link_libraries( - ${name} - ${scope} - $<$:${COVERAGE_CXX_LINKER_FLAGS} - gcov> - $<$:${COVERAGE_C_LINKER_FLAGS} - gcov>) + target_link_libraries(${name} ${scope} $<$:${COVERAGE_CXX_LINKER_FLAGS}> + $<$:${COVERAGE_C_LINKER_FLAGS}>) endfunction () # add_code_coverage_to_target From 6029c65aa19098d1e826ba65cf03f42667a52cf9 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Thu, 12 Feb 2026 12:18:05 +0000 Subject: [PATCH 37/61] revert the LocalValue change Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> --- cmake/deps/Boost.cmake | 1 + include/xrpl/basics/LocalValue.h | 75 ++++++++++--------------------- include/xrpl/core/Coro.ipp | 10 ++--- src/libxrpl/basics/LocalValue.cpp | 7 --- 4 files changed, 29 insertions(+), 64 deletions(-) diff --git a/cmake/deps/Boost.cmake b/cmake/deps/Boost.cmake index 9506693a8d..3f6eaa64e3 100644 --- a/cmake/deps/Boost.cmake +++ b/cmake/deps/Boost.cmake @@ -51,3 +51,4 @@ endif () # target_compile_options(opts INTERFACE # ignore boost headers for sanitizing # -fsanitize-blacklist=${CMAKE_CURRENT_BINARY_DIR}/san_bl.txt) # endif () +target_compile_options(opts INTERFACE -flarge-source-files) diff --git a/include/xrpl/basics/LocalValue.h b/include/xrpl/basics/LocalValue.h index 69256d683b..94af41a41d 100644 --- a/include/xrpl/basics/LocalValue.h +++ b/include/xrpl/basics/LocalValue.h @@ -1,5 +1,7 @@ #pragma once +#include + #include #include @@ -39,59 +41,21 @@ struct LocalValues // Keys are the address of a LocalValue. std::unordered_map> values; -}; -// Wrapper to ensure proper cleanup when thread exits -struct LocalValuesHolder -{ - LocalValues* ptr = nullptr; - - ~LocalValuesHolder() + static inline void + cleanup(LocalValues* lvs) { - if (ptr && !ptr->onCoro) - delete ptr; + if (lvs && !lvs->onCoro) + delete lvs; } }; -LocalValuesHolder& -getLocalValuesHolder(); - -inline LocalValues*& -getLocalValuesPtr() +template +boost::thread_specific_ptr& +getLocalValues() { - return getLocalValuesHolder().ptr; -} - -inline LocalValues* -getOrCreateLocalValues() -{ - auto& ptr = getLocalValuesPtr(); - if (!ptr) - { - ptr = new LocalValues(); - ptr->onCoro = false; - } - return ptr; -} - -// For coroutine support, we need explicit swap functions -inline LocalValues* -releaseLocalValues() -{ - auto& ptr = getLocalValuesPtr(); - auto* result = ptr; - ptr = nullptr; - return result; -} - -inline void -resetLocalValues(LocalValues* lvs) -{ - auto& ptr = getLocalValuesPtr(); - // Clean up old value if it's not a coroutine's LocalValues - if (ptr && !ptr->onCoro) - delete ptr; - ptr = lvs; + static boost::thread_specific_ptr tsp(&detail::LocalValues::cleanup); + return tsp; } } // namespace detail @@ -124,10 +88,19 @@ template T& LocalValue::operator*() { - auto lvs = detail::getOrCreateLocalValues(); - auto const iter = lvs->values.find(this); - if (iter != lvs->values.end()) - return *reinterpret_cast(iter->second->get()); + auto lvs = detail::getLocalValues().get(); + if (!lvs) + { + lvs = new detail::LocalValues(); + lvs->onCoro = false; + detail::getLocalValues().reset(lvs); + } + else + { + auto const iter = lvs->values.find(this); + if (iter != lvs->values.end()) + return *reinterpret_cast(iter->second->get()); + } return *reinterpret_cast( lvs->values.emplace(this, std::make_unique>(t_)).first->second->get()); diff --git a/include/xrpl/core/Coro.ipp b/include/xrpl/core/Coro.ipp index 8829880829..b397fcd65c 100644 --- a/include/xrpl/core/Coro.ipp +++ b/include/xrpl/core/Coro.ipp @@ -68,15 +68,13 @@ JobQueue::Coro::resume() std::lock_guard lock(jq_.m_mutex); --jq_.nSuspend_; } - auto saved = detail::releaseLocalValues(); - detail::resetLocalValues(&lvs_); + auto saved = detail::getLocalValues().release(); + detail::getLocalValues().reset(&lvs_); std::lock_guard lock(mutex_); XRPL_ASSERT(static_cast(coro_), "xrpl::JobQueue::Coro::resume : is runnable"); coro_(); - - // Restore the thread's original LocalValues - detail::releaseLocalValues(); - detail::resetLocalValues(saved); + detail::getLocalValues().release(); + detail::getLocalValues().reset(saved); std::lock_guard lk(mutex_run_); running_ = false; diff --git a/src/libxrpl/basics/LocalValue.cpp b/src/libxrpl/basics/LocalValue.cpp index 47f2d8c258..4e277f81f8 100644 --- a/src/libxrpl/basics/LocalValue.cpp +++ b/src/libxrpl/basics/LocalValue.cpp @@ -3,12 +3,5 @@ namespace xrpl { namespace detail { -LocalValuesHolder& -getLocalValuesHolder() -{ - thread_local LocalValuesHolder holder; - return holder; -} - } // namespace detail } // namespace xrpl From 253fbf6e83f74cd637cfe037d660f2ad189d72ac Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Thu, 12 Feb 2026 12:30:44 +0000 Subject: [PATCH 38/61] removed -flarge-source-files flag Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> --- cmake/deps/Boost.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/cmake/deps/Boost.cmake b/cmake/deps/Boost.cmake index 3f6eaa64e3..9506693a8d 100644 --- a/cmake/deps/Boost.cmake +++ b/cmake/deps/Boost.cmake @@ -51,4 +51,3 @@ endif () # target_compile_options(opts INTERFACE # ignore boost headers for sanitizing # -fsanitize-blacklist=${CMAKE_CURRENT_BINARY_DIR}/san_bl.txt) # endif () -target_compile_options(opts INTERFACE -flarge-source-files) From d6e9986502cbb89c7a05d36234387f088c340ee7 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Thu, 12 Feb 2026 12:42:35 +0000 Subject: [PATCH 39/61] Silent uninitialized warning in gcc-14 Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> --- cmake/deps/Boost.cmake | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmake/deps/Boost.cmake b/cmake/deps/Boost.cmake index 9506693a8d..5f32e06d91 100644 --- a/cmake/deps/Boost.cmake +++ b/cmake/deps/Boost.cmake @@ -32,6 +32,16 @@ if (Boost_COMPILER) target_link_libraries(xrpl_boost INTERFACE Boost::disable_autolinking) endif () +# GCC 14+ has a false positive -Wuninitialized warning in Boost.Coroutine2's +# state.hpp when compiled with -O3. This is due to GCC's intentional behavior +# change (Bug #98871, #119388) where warnings from inlined system header code +# are no longer suppressed by -isystem. The warning occurs in operator|= in +# boost/coroutine2/detail/state.hpp when inlined from push_control_block::destroy(). +# See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119388 +if (is_gcc AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 14) + target_compile_options(xrpl_boost INTERFACE -Wno-uninitialized) +endif () + # Boost.Context's ucontext backend has ASAN fiber-switching annotations # (start/finish_switch_fiber) that are compiled in when BOOST_USE_ASAN is defined. # This tells ASAN about coroutine stack switches, preventing false positive From 1a737ebb49c9441b6b439ed99382af0f197fe715 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Thu, 12 Feb 2026 14:46:32 +0000 Subject: [PATCH 40/61] remove recursion from the ApplyStateTable::read and add flat call ApplyStateTable::readLocal Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> --- include/xrpl/ledger/detail/ApplyStateTable.h | 5 +++++ src/libxrpl/ledger/ApplyStateTable.cpp | 22 ++++++++++++++++++++ src/libxrpl/ledger/ApplyViewBase.cpp | 15 ++++++++++++- 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/include/xrpl/ledger/detail/ApplyStateTable.h b/include/xrpl/ledger/detail/ApplyStateTable.h index 07af5247f6..88703e0d4f 100644 --- a/include/xrpl/ledger/detail/ApplyStateTable.h +++ b/include/xrpl/ledger/detail/ApplyStateTable.h @@ -64,6 +64,11 @@ public: std::shared_ptr read(ReadView const& base, Keylet const& k) const; + /** Check only local items without delegating to base. + Returns std::nullopt if key not found locally. */ + std::optional> + readLocal(Keylet const& k) const; + std::shared_ptr peek(ReadView const& base, Keylet const& k); diff --git a/src/libxrpl/ledger/ApplyStateTable.cpp b/src/libxrpl/ledger/ApplyStateTable.cpp index 9892951e15..6c6b2055ad 100644 --- a/src/libxrpl/ledger/ApplyStateTable.cpp +++ b/src/libxrpl/ledger/ApplyStateTable.cpp @@ -330,6 +330,28 @@ ApplyStateTable::read(ReadView const& base, Keylet const& k) const return sle; } +std::optional> +ApplyStateTable::readLocal(Keylet const& k) const +{ + auto const iter = items_.find(k.key); + if (iter == items_.end()) + return std::nullopt; + auto const& item = iter->second; + auto const& sle = item.second; + switch (item.first) + { + case Action::erase: + return nullptr; + case Action::cache: + case Action::insert: + case Action::modify: + break; + }; + if (!k.check(*sle)) + return nullptr; + return sle; +} + std::shared_ptr ApplyStateTable::peek(ReadView const& base, Keylet const& k) { diff --git a/src/libxrpl/ledger/ApplyViewBase.cpp b/src/libxrpl/ledger/ApplyViewBase.cpp index ecb5180557..b54ed39848 100644 --- a/src/libxrpl/ledger/ApplyViewBase.cpp +++ b/src/libxrpl/ledger/ApplyViewBase.cpp @@ -48,7 +48,20 @@ ApplyViewBase::succ(key_type const& key, std::optional const& last) co std::shared_ptr ApplyViewBase::read(Keylet const& k) const { - return items_.read(*base_, k); + // Iteratively walk up the chain of ApplyViewBase layers + // instead of recursing through items_.read(*base_, k). + auto const* current = this; + while (current) + { + if (auto result = current->items_.readLocal(k)) + return *result; + + // Check if the base is another ApplyViewBase layer + auto const* next = dynamic_cast(current->base_); + if (!next) + return current->base_->read(k); + current = next; + } } auto From eb2b421cd6eecbc4739878ae608836522125c61f Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Thu, 12 Feb 2026 15:21:20 +0000 Subject: [PATCH 41/61] unreachable return Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> --- src/libxrpl/ledger/ApplyViewBase.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libxrpl/ledger/ApplyViewBase.cpp b/src/libxrpl/ledger/ApplyViewBase.cpp index b54ed39848..2299decc32 100644 --- a/src/libxrpl/ledger/ApplyViewBase.cpp +++ b/src/libxrpl/ledger/ApplyViewBase.cpp @@ -62,6 +62,10 @@ ApplyViewBase::read(Keylet const& k) const return current->base_->read(k); current = next; } + // Unreachable: current starts as `this` (non-null) and the loop + // always returns before current could become null. + UNREACHABLE("xrpl::ApplyViewBase::read : unreachable"); + return nullptr; } auto From 496354f1c983edd3ecf7b2dda1d66b5cec7f861e Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Thu, 12 Feb 2026 16:38:57 +0000 Subject: [PATCH 42/61] increase stack size of coroutine Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> --- include/xrpl/core/Coro.ipp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/include/xrpl/core/Coro.ipp b/include/xrpl/core/Coro.ipp index b397fcd65c..36b1ce9a71 100644 --- a/include/xrpl/core/Coro.ipp +++ b/include/xrpl/core/Coro.ipp @@ -8,14 +8,16 @@ JobQueue::Coro::Coro(Coro_create_t, JobQueue& jq, JobType type, std::string cons , type_(type) , name_(name) , running_(false) - , coro_([this, fn = std::forward(f)](boost::coroutines2::coroutine::push_type& do_yield) { - yield_ = &do_yield; - yield(); - fn(shared_from_this()); + , coro_( + boost::context::fixedsize_stack(4 * 1024 * 1024), + [this, fn = std::forward(f)](boost::coroutines2::coroutine::push_type& do_yield) { + yield_ = &do_yield; + yield(); + fn(shared_from_this()); #ifndef NDEBUG - finished_ = true; + finished_ = true; #endif - }) + }) { } From d70ac27f0cdf58b29788651b2050c60da708d1af Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Thu, 12 Feb 2026 18:03:13 +0000 Subject: [PATCH 43/61] increase timeout for sanitizer builds, since we are seeing timeouts Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> --- .github/workflows/reusable-build-test-config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/reusable-build-test-config.yml b/.github/workflows/reusable-build-test-config.yml index 1826d752c2..aeac78d6eb 100644 --- a/.github/workflows/reusable-build-test-config.yml +++ b/.github/workflows/reusable-build-test-config.yml @@ -76,7 +76,8 @@ jobs: name: ${{ inputs.config_name }} runs-on: ${{ fromJSON(inputs.runs_on) }} container: ${{ inputs.image != '' && inputs.image || null }} - timeout-minutes: 60 + # Sanitizer builds on GCC are taking longer than 60mins. Hence increasing the timeout to 90mins. + timeout-minutes: ${{ inputs.sanitizers != '' && 90 || 60 }} env: # Use a namespace to keep the objects separate for each configuration. CCACHE_NAMESPACE: ${{ inputs.config_name }} From 81a18efb9e9d35976a231302ba2b71e9da72cb5e Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Thu, 12 Feb 2026 18:10:37 +0000 Subject: [PATCH 44/61] removing timeout changes Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> --- .github/workflows/reusable-build-test-config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/reusable-build-test-config.yml b/.github/workflows/reusable-build-test-config.yml index aeac78d6eb..d9f936a598 100644 --- a/.github/workflows/reusable-build-test-config.yml +++ b/.github/workflows/reusable-build-test-config.yml @@ -77,7 +77,7 @@ jobs: runs-on: ${{ fromJSON(inputs.runs_on) }} container: ${{ inputs.image != '' && inputs.image || null }} # Sanitizer builds on GCC are taking longer than 60mins. Hence increasing the timeout to 90mins. - timeout-minutes: ${{ inputs.sanitizers != '' && 90 || 60 }} + timeout-minutes: 60 env: # Use a namespace to keep the objects separate for each configuration. CCACHE_NAMESPACE: ${{ inputs.config_name }} From 5edd3566f7c971f7e2a26668eee6edc34c7519b7 Mon Sep 17 00:00:00 2001 From: Jingchen Date: Thu, 12 Feb 2026 18:15:03 +0000 Subject: [PATCH 45/61] refactor: Modularize the NetworkOPs interface (#6225) This change moves the NetworkOPs interface into `libxrpl` and it leaves its implementation in `xrpld`. --- .../scripts/levelization/results/loops.txt | 2 +- .../scripts/levelization/results/ordering.txt | 4 + cmake/XrplCore.cmake | 3 +- .../rpc => include/xrpl/server}/InfoSub.h | 1 + .../misc => include/xrpl/server}/NetworkOPs.h | 25 +- .../rpc/detail => libxrpl/server}/InfoSub.cpp | 2 +- src/test/app/Batch_test.cpp | 2 +- src/test/jtx/Env_test.cpp | 2 +- src/test/jtx/impl/Env.cpp | 2 +- src/test/rpc/AmendmentBlocked_test.cpp | 2 +- src/test/rpc/ServerInfo_test.cpp | 2 +- src/test/rpc/Subscribe_test.cpp | 2 +- src/test/server/ServerStatus_test.cpp | 2 +- src/xrpld/app/consensus/RCLConsensus.cpp | 2 +- src/xrpld/app/ledger/BookListeners.h | 3 +- src/xrpld/app/ledger/ConsensusTransSetSF.cpp | 2 +- src/xrpld/app/ledger/OrderBookDB.cpp | 2 +- .../app/ledger/detail/InboundLedgers.cpp | 2 +- .../app/ledger/detail/InboundTransactions.cpp | 2 +- src/xrpld/app/ledger/detail/LedgerMaster.cpp | 2 +- .../app/ledger/detail/TransactionAcquire.cpp | 3 +- src/xrpld/app/main/Application.cpp | 2 +- src/xrpld/app/main/GRPCServer.h | 2 +- src/xrpld/app/main/LoadManager.cpp | 2 +- src/xrpld/app/misc/NetworkOPs.cpp | 286 +++++++++--------- src/xrpld/app/misc/SHAMapStoreImp.cpp | 2 +- src/xrpld/app/misc/detail/ValidatorList.cpp | 2 +- src/xrpld/app/misc/make_NetworkOPs.h | 32 ++ src/xrpld/app/paths/PathRequest.cpp | 2 +- src/xrpld/app/paths/PathRequest.h | 2 +- src/xrpld/app/rdb/backend/SQLiteDatabase.h | 12 +- .../app/rdb/backend/detail/SQLiteDatabase.cpp | 16 +- .../app/rdb/detail/RelationalDatabase.cpp | 0 src/xrpld/app/tx/detail/Change.cpp | 2 +- src/xrpld/overlay/detail/OverlayImpl.cpp | 2 +- src/xrpld/overlay/detail/PeerImp.cpp | 2 +- src/xrpld/rpc/Context.h | 2 +- src/xrpld/rpc/RPCSub.h | 3 +- src/xrpld/rpc/detail/Handler.h | 2 +- src/xrpld/rpc/detail/RPCHandler.cpp | 4 +- src/xrpld/rpc/detail/RPCHelpers.h | 2 +- src/xrpld/rpc/detail/RPCLedgerHelpers.h | 3 +- src/xrpld/rpc/detail/ServerHandler.cpp | 2 +- src/xrpld/rpc/detail/TransactionSign.h | 3 +- src/xrpld/rpc/detail/WSInfoSub.h | 2 +- src/xrpld/rpc/handlers/BookOffers.cpp | 2 +- src/xrpld/rpc/handlers/ConsensusInfo.cpp | 2 +- src/xrpld/rpc/handlers/FetchInfo.cpp | 2 +- src/xrpld/rpc/handlers/GetCounts.cpp | 2 +- src/xrpld/rpc/handlers/LedgerAccept.cpp | 2 +- src/xrpld/rpc/handlers/LedgerClosed.cpp | 2 +- src/xrpld/rpc/handlers/LedgerCurrent.cpp | 2 +- src/xrpld/rpc/handlers/OwnerInfo.cpp | 2 +- src/xrpld/rpc/handlers/ServerInfo.cpp | 2 +- src/xrpld/rpc/handlers/ServerState.cpp | 2 +- src/xrpld/rpc/handlers/Subscribe.cpp | 2 +- src/xrpld/rpc/handlers/Tx.cpp | 2 +- src/xrpld/rpc/handlers/Unsubscribe.cpp | 2 +- 58 files changed, 260 insertions(+), 224 deletions(-) rename {src/xrpld/rpc => include/xrpl/server}/InfoSub.h (99%) rename {src/xrpld/app/misc => include/xrpl/server}/NetworkOPs.h (92%) rename src/{xrpld/rpc/detail => libxrpl/server}/InfoSub.cpp (98%) create mode 100644 src/xrpld/app/misc/make_NetworkOPs.h delete mode 100644 src/xrpld/app/rdb/detail/RelationalDatabase.cpp diff --git a/.github/scripts/levelization/results/loops.txt b/.github/scripts/levelization/results/loops.txt index 34842d7f48..7914704f9d 100644 --- a/.github/scripts/levelization/results/loops.txt +++ b/.github/scripts/levelization/results/loops.txt @@ -5,7 +5,7 @@ Loop: test.jtx test.unit_test test.unit_test == test.jtx Loop: xrpld.app xrpld.overlay - xrpld.overlay > xrpld.app + xrpld.overlay ~= xrpld.app Loop: xrpld.app xrpld.peerfinder xrpld.peerfinder == xrpld.app diff --git a/.github/scripts/levelization/results/ordering.txt b/.github/scripts/levelization/results/ordering.txt index 85f2457ea3..1de6f803f3 100644 --- a/.github/scripts/levelization/results/ordering.txt +++ b/.github/scripts/levelization/results/ordering.txt @@ -137,6 +137,7 @@ test.rpc > xrpld.rpc test.rpc > xrpl.json test.rpc > xrpl.protocol test.rpc > xrpl.resource +test.rpc > xrpl.server test.server > test.jtx test.server > test.toplevel test.server > test.unit_test @@ -178,8 +179,11 @@ xrpl.resource > xrpl.protocol xrpl.server > xrpl.basics xrpl.server > xrpl.core xrpl.server > xrpl.json +xrpl.server > xrpl.ledger xrpl.server > xrpl.protocol xrpl.server > xrpl.rdb +xrpl.server > xrpl.resource +xrpl.server > xrpl.shamap xrpl.shamap > xrpl.basics xrpl.shamap > xrpl.nodestore xrpl.shamap > xrpl.protocol diff --git a/cmake/XrplCore.cmake b/cmake/XrplCore.cmake index cea19db9bc..ba14899bd9 100644 --- a/cmake/XrplCore.cmake +++ b/cmake/XrplCore.cmake @@ -95,7 +95,8 @@ add_module(xrpl rdb) target_link_libraries(xrpl.libxrpl.rdb PUBLIC xrpl.libxrpl.basics xrpl.libxrpl.core) add_module(xrpl server) -target_link_libraries(xrpl.libxrpl.server PUBLIC xrpl.libxrpl.protocol xrpl.libxrpl.core xrpl.libxrpl.rdb) +target_link_libraries(xrpl.libxrpl.server PUBLIC xrpl.libxrpl.protocol xrpl.libxrpl.core xrpl.libxrpl.rdb + xrpl.libxrpl.resource) add_module(xrpl ledger) target_link_libraries(xrpl.libxrpl.ledger PUBLIC xrpl.libxrpl.basics xrpl.libxrpl.json xrpl.libxrpl.protocol diff --git a/src/xrpld/rpc/InfoSub.h b/include/xrpl/server/InfoSub.h similarity index 99% rename from src/xrpld/rpc/InfoSub.h rename to include/xrpl/server/InfoSub.h index d49e401bd3..1a7222bf5d 100644 --- a/src/xrpld/rpc/InfoSub.h +++ b/include/xrpl/server/InfoSub.h @@ -131,6 +131,7 @@ public: virtual bool subPeerStatus(ref ispListener) = 0; + virtual bool unsubPeerStatus(std::uint64_t uListener) = 0; virtual void diff --git a/src/xrpld/app/misc/NetworkOPs.h b/include/xrpl/server/NetworkOPs.h similarity index 92% rename from src/xrpld/app/misc/NetworkOPs.h rename to include/xrpl/server/NetworkOPs.h index 66c915008a..cfe0021c07 100644 --- a/src/xrpld/app/misc/NetworkOPs.h +++ b/include/xrpl/server/NetworkOPs.h @@ -1,13 +1,13 @@ #pragma once -#include -#include -#include - #include +#include #include #include +#include #include +#include +#include #include @@ -23,6 +23,7 @@ class LedgerMaster; class Transaction; class ValidatorKeys; class CanonicalTXSet; +class RCLCxPeerPos; // This is the primary interface into the "client" portion of the program. // Code that wants to do normal operations on the network such as @@ -245,20 +246,4 @@ public: stateAccounting(Json::Value& obj) = 0; }; -//------------------------------------------------------------------------------ - -std::unique_ptr -make_NetworkOPs( - Application& app, - NetworkOPs::clock_type& clock, - bool standalone, - std::size_t minPeerCount, - bool start_valid, - JobQueue& job_queue, - LedgerMaster& ledgerMaster, - ValidatorKeys const& validatorKeys, - boost::asio::io_context& io_svc, - beast::Journal journal, - beast::insight::Collector::ptr const& collector); - } // namespace xrpl diff --git a/src/xrpld/rpc/detail/InfoSub.cpp b/src/libxrpl/server/InfoSub.cpp similarity index 98% rename from src/xrpld/rpc/detail/InfoSub.cpp rename to src/libxrpl/server/InfoSub.cpp index 27e3a65b2f..c413f5d257 100644 --- a/src/xrpld/rpc/detail/InfoSub.cpp +++ b/src/libxrpl/server/InfoSub.cpp @@ -1,4 +1,4 @@ -#include +#include namespace xrpl { diff --git a/src/test/app/Batch_test.cpp b/src/test/app/Batch_test.cpp index 72f3677e3b..133f10cd28 100644 --- a/src/test/app/Batch_test.cpp +++ b/src/test/app/Batch_test.cpp @@ -3,7 +3,6 @@ #include #include -#include #include #include #include @@ -14,6 +13,7 @@ #include #include #include +#include namespace xrpl { namespace test { diff --git a/src/test/jtx/Env_test.cpp b/src/test/jtx/Env_test.cpp index 0f43691b86..f0a46ba55c 100644 --- a/src/test/jtx/Env_test.cpp +++ b/src/test/jtx/Env_test.cpp @@ -1,6 +1,5 @@ #include -#include #include #include @@ -8,6 +7,7 @@ #include #include #include +#include #include diff --git a/src/test/jtx/impl/Env.cpp b/src/test/jtx/impl/Env.cpp index d8bcec84ee..3fdfa2bf2a 100644 --- a/src/test/jtx/impl/Env.cpp +++ b/src/test/jtx/impl/Env.cpp @@ -10,7 +10,6 @@ #include #include -#include #include #include @@ -25,6 +24,7 @@ #include #include #include +#include #include #include diff --git a/src/test/rpc/AmendmentBlocked_test.cpp b/src/test/rpc/AmendmentBlocked_test.cpp index 73a8c6d299..fc1e21a0b6 100644 --- a/src/test/rpc/AmendmentBlocked_test.cpp +++ b/src/test/rpc/AmendmentBlocked_test.cpp @@ -1,10 +1,10 @@ #include #include -#include #include #include +#include namespace xrpl { diff --git a/src/test/rpc/ServerInfo_test.cpp b/src/test/rpc/ServerInfo_test.cpp index 054c3e563a..c38844e8a6 100644 --- a/src/test/rpc/ServerInfo_test.cpp +++ b/src/test/rpc/ServerInfo_test.cpp @@ -1,10 +1,10 @@ #include -#include #include #include #include +#include #include diff --git a/src/test/rpc/Subscribe_test.cpp b/src/test/rpc/Subscribe_test.cpp index cce45fb4ef..759b02dcc7 100644 --- a/src/test/rpc/Subscribe_test.cpp +++ b/src/test/rpc/Subscribe_test.cpp @@ -4,13 +4,13 @@ #include #include -#include #include #include #include #include #include +#include #include diff --git a/src/test/server/ServerStatus_test.cpp b/src/test/server/ServerStatus_test.cpp index ccfdf2fd2b..5a91ad4b03 100644 --- a/src/test/server/ServerStatus_test.cpp +++ b/src/test/server/ServerStatus_test.cpp @@ -5,12 +5,12 @@ #include #include -#include #include #include #include #include +#include #include #include diff --git a/src/xrpld/app/consensus/RCLConsensus.cpp b/src/xrpld/app/consensus/RCLConsensus.cpp index 35f8eec1a3..4ebd1a502f 100644 --- a/src/xrpld/app/consensus/RCLConsensus.cpp +++ b/src/xrpld/app/consensus/RCLConsensus.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -25,6 +24,7 @@ #include #include #include +#include #include #include diff --git a/src/xrpld/app/ledger/BookListeners.h b/src/xrpld/app/ledger/BookListeners.h index 036e988749..3ed267448b 100644 --- a/src/xrpld/app/ledger/BookListeners.h +++ b/src/xrpld/app/ledger/BookListeners.h @@ -1,8 +1,7 @@ #pragma once -#include - #include +#include #include #include diff --git a/src/xrpld/app/ledger/ConsensusTransSetSF.cpp b/src/xrpld/app/ledger/ConsensusTransSetSF.cpp index 6a8dbd3d7d..a99960fd3a 100644 --- a/src/xrpld/app/ledger/ConsensusTransSetSF.cpp +++ b/src/xrpld/app/ledger/ConsensusTransSetSF.cpp @@ -1,6 +1,5 @@ #include #include -#include #include #include @@ -8,6 +7,7 @@ #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/ledger/OrderBookDB.cpp b/src/xrpld/app/ledger/OrderBookDB.cpp index 81a3bf5e4a..6450544f92 100644 --- a/src/xrpld/app/ledger/OrderBookDB.cpp +++ b/src/xrpld/app/ledger/OrderBookDB.cpp @@ -2,12 +2,12 @@ #include #include #include -#include #include #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/ledger/detail/InboundLedgers.cpp b/src/xrpld/app/ledger/detail/InboundLedgers.cpp index 626f58b686..5441e2dc95 100644 --- a/src/xrpld/app/ledger/detail/InboundLedgers.cpp +++ b/src/xrpld/app/ledger/detail/InboundLedgers.cpp @@ -1,7 +1,6 @@ #include #include #include -#include #include #include @@ -10,6 +9,7 @@ #include #include #include +#include #include #include diff --git a/src/xrpld/app/ledger/detail/InboundTransactions.cpp b/src/xrpld/app/ledger/detail/InboundTransactions.cpp index 36ebb7bd9e..9e877465a5 100644 --- a/src/xrpld/app/ledger/detail/InboundTransactions.cpp +++ b/src/xrpld/app/ledger/detail/InboundTransactions.cpp @@ -2,12 +2,12 @@ #include #include #include -#include #include #include #include #include +#include #include #include diff --git a/src/xrpld/app/ledger/detail/LedgerMaster.cpp b/src/xrpld/app/ledger/detail/LedgerMaster.cpp index 1fd1a8a8b2..f8ef91a83f 100644 --- a/src/xrpld/app/ledger/detail/LedgerMaster.cpp +++ b/src/xrpld/app/ledger/detail/LedgerMaster.cpp @@ -8,7 +8,6 @@ #include #include #include -#include #include #include #include @@ -30,6 +29,7 @@ #include #include #include +#include #include #include diff --git a/src/xrpld/app/ledger/detail/TransactionAcquire.cpp b/src/xrpld/app/ledger/detail/TransactionAcquire.cpp index f838a912eb..06cd6a2696 100644 --- a/src/xrpld/app/ledger/detail/TransactionAcquire.cpp +++ b/src/xrpld/app/ledger/detail/TransactionAcquire.cpp @@ -3,7 +3,8 @@ #include #include #include -#include + +#include #include diff --git a/src/xrpld/app/main/Application.cpp b/src/xrpld/app/main/Application.cpp index 7a59d586e0..3f7b6c5596 100644 --- a/src/xrpld/app/main/Application.cpp +++ b/src/xrpld/app/main/Application.cpp @@ -18,11 +18,11 @@ #include #include #include -#include #include #include #include #include +#include #include #include #include diff --git a/src/xrpld/app/main/GRPCServer.h b/src/xrpld/app/main/GRPCServer.h index fdac2b6484..1b41722fff 100644 --- a/src/xrpld/app/main/GRPCServer.h +++ b/src/xrpld/app/main/GRPCServer.h @@ -3,13 +3,13 @@ #include #include #include -#include #include #include #include #include #include +#include #include diff --git a/src/xrpld/app/main/LoadManager.cpp b/src/xrpld/app/main/LoadManager.cpp index d1336b20d9..5e3b572e1d 100644 --- a/src/xrpld/app/main/LoadManager.cpp +++ b/src/xrpld/app/main/LoadManager.cpp @@ -1,10 +1,10 @@ #include #include #include -#include #include #include +#include #include #include diff --git a/src/xrpld/app/misc/NetworkOPs.cpp b/src/xrpld/app/misc/NetworkOPs.cpp index 7da26ada40..9e60a8bdc0 100644 --- a/src/xrpld/app/misc/NetworkOPs.cpp +++ b/src/xrpld/app/misc/NetworkOPs.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -14,12 +15,12 @@ #include #include #include -#include #include #include #include #include #include +#include #include #include #include @@ -197,7 +198,7 @@ class NetworkOPsImp final : public NetworkOPs public: NetworkOPsImp( - Application& app, + ServiceRegistry& registry, NetworkOPs::clock_type& clock, bool standalone, std::size_t minPeerCount, @@ -208,7 +209,7 @@ public: boost::asio::io_context& io_svc, beast::Journal journal, beast::insight::Collector::ptr const& collector) - : app_(app) + : registry_(registry) , m_journal(journal) , m_localTX(make_LocalTxs()) , mMode(start_valid ? OperatingMode::FULL : OperatingMode::DISCONNECTED) @@ -216,14 +217,16 @@ public: , clusterTimer_(io_svc) , accountHistoryTxTimer_(io_svc) , mConsensus( - app, - make_FeeVote(setup_FeeVote(app_.config().section("voting")), app_.logs().journal("FeeVote")), + registry_.app(), + make_FeeVote( + setup_FeeVote(registry_.app().config().section("voting")), + registry_.logs().journal("FeeVote")), ledgerMaster, *m_localTX, - app.getInboundTransactions(), + registry.getInboundTransactions(), beast::get_abstract_clock(), validatorKeys, - app_.logs().journal("LedgerConsensus")) + registry_.logs().journal("LedgerConsensus")) , validatorPK_(validatorKeys.keys ? validatorKeys.keys->publicKey : decltype(validatorPK_){}) , validatorMasterPK_(validatorKeys.keys ? validatorKeys.keys->masterPublicKey : decltype(validatorMasterPK_){}) , m_ledgerMaster(ledgerMaster) @@ -665,7 +668,7 @@ private: void setAccountHistoryJobTimer(SubAccountHistoryInfoWeak subInfo); - Application& app_; + ServiceRegistry& registry_; beast::Journal m_journal; std::unique_ptr m_localTX; @@ -847,7 +850,7 @@ NetworkOPsImp::getHostId(bool forAdmin) // For non-admin uses hash the node public key into a // single RFC1751 word: static std::string const shroudedHostId = [this]() { - auto const& id = app_.nodeIdentity(); + auto const& id = registry_.app().nodeIdentity(); return RFC1751::getWordFromBlob(id.first.data(), id.first.size()); }(); @@ -861,7 +864,7 @@ NetworkOPsImp::setStateTimer() setHeartbeatTimer(); // Only do this work if a cluster is configured - if (app_.cluster().size() != 0) + if (registry_.cluster().size() != 0) setClusterTimer(); } @@ -932,13 +935,13 @@ NetworkOPsImp::processHeartbeatTimer() { RclConsensusLogger clog("Heartbeat Timer", mConsensus.validating(), m_journal); { - std::unique_lock lock{app_.getMasterMutex()}; + std::unique_lock lock{registry_.app().getMasterMutex()}; // VFALCO NOTE This is for diagnosing a crash on exit - LoadManager& mgr(app_.getLoadManager()); + LoadManager& mgr(registry_.getLoadManager()); mgr.heartbeat(); - std::size_t const numPeers = app_.overlay().size(); + std::size_t const numPeers = registry_.overlay().size(); // do we have sufficient peers? If not, we are disconnected. if (numPeers < minPeerCount_) @@ -990,7 +993,7 @@ NetworkOPsImp::processHeartbeatTimer() CLOG(clog.ss()) << ". "; } - mConsensus.timerEntry(app_.timeKeeper().closeTime(), clog.ss()); + mConsensus.timerEntry(registry_.timeKeeper().closeTime(), clog.ss()); CLOG(clog.ss()) << "consensus phase " << to_string(mLastConsensusPhase); ConsensusPhase const currPhase = mConsensus.phase(); @@ -1008,16 +1011,16 @@ NetworkOPsImp::processHeartbeatTimer() void NetworkOPsImp::processClusterTimer() { - if (app_.cluster().size() == 0) + if (registry_.cluster().size() == 0) return; using namespace std::chrono_literals; - bool const update = app_.cluster().update( - app_.nodeIdentity().first, + bool const update = registry_.cluster().update( + registry_.app().nodeIdentity().first, "", - (m_ledgerMaster.getValidatedLedgerAge() <= 4min) ? app_.getFeeTrack().getLocalFee() : 0, - app_.timeKeeper().now()); + (m_ledgerMaster.getValidatedLedgerAge() <= 4min) ? registry_.getFeeTrack().getLocalFee() : 0, + registry_.timeKeeper().now()); if (!update) { @@ -1027,7 +1030,7 @@ NetworkOPsImp::processClusterTimer() } protocol::TMCluster cluster; - app_.cluster().for_each([&cluster](ClusterNode const& node) { + registry_.cluster().for_each([&cluster](ClusterNode const& node) { protocol::TMClusterNode& n = *cluster.add_clusternodes(); n.set_publickey(toBase58(TokenType::NodePublic, node.identity())); n.set_reporttime(node.getReportTime().time_since_epoch().count()); @@ -1036,14 +1039,14 @@ NetworkOPsImp::processClusterTimer() n.set_nodename(node.name()); }); - Resource::Gossip gossip = app_.getResourceManager().exportConsumers(); + Resource::Gossip gossip = registry_.getResourceManager().exportConsumers(); for (auto& item : gossip.items) { protocol::TMLoadSource& node = *cluster.add_loadsources(); node.set_name(to_string(item.address)); node.set_cost(item.balance); } - app_.overlay().foreach(send_if(std::make_shared(cluster, protocol::mtCLUSTER), peer_in_cluster())); + registry_.overlay().foreach(send_if(std::make_shared(cluster, protocol::mtCLUSTER), peer_in_cluster())); setClusterTimer(); } @@ -1088,7 +1091,7 @@ NetworkOPsImp::submitTransaction(std::shared_ptr const& iTrans) auto const trans = sterilize(*iTrans); auto const txid = trans->getTransactionID(); - auto const flags = app_.getHashRouter().getFlags(txid); + auto const flags = registry_.getHashRouter().getFlags(txid); if ((flags & HashRouterFlags::BAD) != HashRouterFlags::UNDEFINED) { @@ -1098,8 +1101,8 @@ NetworkOPsImp::submitTransaction(std::shared_ptr const& iTrans) try { - auto const [validity, reason] = - checkValidity(app_.getHashRouter(), *trans, m_ledgerMaster.getValidatedRules(), app_.config()); + auto const [validity, reason] = checkValidity( + registry_.getHashRouter(), *trans, m_ledgerMaster.getValidatedRules(), registry_.app().config()); if (validity != Validity::Valid) { @@ -1116,7 +1119,7 @@ NetworkOPsImp::submitTransaction(std::shared_ptr const& iTrans) std::string reason; - auto tx = std::make_shared(trans, reason, app_); + auto tx = std::make_shared(trans, reason, registry_.app()); m_job_queue.addJob(jtTRANSACTION, "SubmitTxn", [this, tx]() { auto t = tx; @@ -1127,7 +1130,7 @@ NetworkOPsImp::submitTransaction(std::shared_ptr const& iTrans) bool NetworkOPsImp::preProcessTransaction(std::shared_ptr& transaction) { - auto const newFlags = app_.getHashRouter().getFlags(transaction->getID()); + auto const newFlags = registry_.getHashRouter().getFlags(transaction->getID()); if ((newFlags & HashRouterFlags::BAD) != HashRouterFlags::UNDEFINED) { @@ -1148,14 +1151,15 @@ NetworkOPsImp::preProcessTransaction(std::shared_ptr& transaction) { transaction->setStatus(INVALID); transaction->setResult(temINVALID_FLAG); - app_.getHashRouter().setFlags(transaction->getID(), HashRouterFlags::BAD); + registry_.getHashRouter().setFlags(transaction->getID(), HashRouterFlags::BAD); return false; } // NOTE ximinez - I think this check is redundant, // but I'm not 100% sure yet. // If so, only cost is looking up HashRouter flags. - auto const [validity, reason] = checkValidity(app_.getHashRouter(), sttx, view->rules(), app_.config()); + auto const [validity, reason] = + checkValidity(registry_.getHashRouter(), sttx, view->rules(), registry_.app().config()); XRPL_ASSERT(validity == Validity::Valid, "xrpl::NetworkOPsImp::processTransaction : valid validity"); // Not concerned with local checks at this point. @@ -1164,12 +1168,12 @@ NetworkOPsImp::preProcessTransaction(std::shared_ptr& transaction) JLOG(m_journal.info()) << "Transaction has bad signature: " << reason; transaction->setStatus(INVALID); transaction->setResult(temBAD_SIGNATURE); - app_.getHashRouter().setFlags(transaction->getID(), HashRouterFlags::BAD); + registry_.getHashRouter().setFlags(transaction->getID(), HashRouterFlags::BAD); return false; } // canonicalize can change our pointer - app_.getMasterTransaction().canonicalize(&transaction); + registry_.getMasterTransaction().canonicalize(&transaction); return true; } @@ -1265,7 +1269,7 @@ NetworkOPsImp::processTransactionSet(CanonicalTXSet const& set) for (auto const& [_, tx] : set) { std::string reason; - auto transaction = std::make_shared(tx, reason, app_); + auto transaction = std::make_shared(tx, reason, registry_.app()); if (transaction->getStatus() == INVALID) { @@ -1273,7 +1277,7 @@ NetworkOPsImp::processTransactionSet(CanonicalTXSet const& set) { JLOG(m_journal.trace()) << "Exception checking transaction: " << reason; } - app_.getHashRouter().setFlags(tx->getTransactionID(), HashRouterFlags::BAD); + registry_.getHashRouter().setFlags(tx->getTransactionID(), HashRouterFlags::BAD); continue; } @@ -1347,13 +1351,13 @@ NetworkOPsImp::apply(std::unique_lock& batchLock) batchLock.unlock(); { - std::unique_lock masterLock{app_.getMasterMutex(), std::defer_lock}; + std::unique_lock masterLock{registry_.app().getMasterMutex(), std::defer_lock}; bool changed = false; { std::unique_lock ledgerLock{m_ledgerMaster.peekMutex(), std::defer_lock}; std::lock(masterLock, ledgerLock); - app_.openLedger().modify([&](OpenView& view, beast::Journal j) { + registry_.openLedger().modify([&](OpenView& view, beast::Journal j) { for (TransactionStatus& e : transactions) { // we check before adding to the batch @@ -1364,7 +1368,8 @@ NetworkOPsImp::apply(std::unique_lock& batchLock) if (e.failType == FailHard::yes) flags |= tapFAIL_HARD; - auto const result = app_.getTxQ().apply(app_, view, e.transaction->getSTransaction(), flags, j); + auto const result = + registry_.getTxQ().apply(registry_.app(), view, e.transaction->getSTransaction(), flags, j); e.result = result.ter; e.applied = result.applied; changed = changed || result.applied; @@ -1379,7 +1384,7 @@ NetworkOPsImp::apply(std::unique_lock& batchLock) if (auto const l = m_ledgerMaster.getValidatedLedger()) validatedLedgerIndex = l->header().seq; - auto newOL = app_.openLedger().current(); + auto newOL = registry_.openLedger().current(); for (TransactionStatus& e : transactions) { e.transaction->clearSubmitResult(); @@ -1393,7 +1398,7 @@ NetworkOPsImp::apply(std::unique_lock& batchLock) e.transaction->setResult(e.result); if (isTemMalformed(e.result)) - app_.getHashRouter().setFlags(e.transaction->getID(), HashRouterFlags::BAD); + registry_.getHashRouter().setFlags(e.transaction->getID(), HashRouterFlags::BAD); #ifdef DEBUG if (e.result != tesSUCCESS) @@ -1427,7 +1432,7 @@ NetworkOPsImp::apply(std::unique_lock& batchLock) batchLock.lock(); std::string reason; auto const trans = sterilize(*txNext); - auto t = std::make_shared(trans, reason, app_); + auto t = std::make_shared(trans, reason, registry_.app()); if (t->getApplying()) break; submit_held.emplace_back(t, false, false, FailHard::no); @@ -1479,7 +1484,7 @@ NetworkOPsImp::apply(std::unique_lock& batchLock) // up!) // if (e.local || (ledgersLeft && ledgersLeft <= LocalTxs::holdLedgers) || - app_.getHashRouter().setFlags(e.transaction->getID(), HashRouterFlags::HELD)) + registry_.getHashRouter().setFlags(e.transaction->getID(), HashRouterFlags::HELD)) { // transaction should be held JLOG(m_journal.debug()) << "Transaction should be held: " << e.result; @@ -1513,7 +1518,7 @@ NetworkOPsImp::apply(std::unique_lock& batchLock) (e.result == terQUEUED)) && !enforceFailHard) { - auto const toSkip = app_.getHashRouter().shouldRelay(e.transaction->getID()); + auto const toSkip = registry_.getHashRouter().shouldRelay(e.transaction->getID()); if (auto const sttx = *(e.transaction->getSTransaction()); toSkip && // Skip relaying if it's an inner batch txn. The flag should // only be set if the Batch feature is enabled. If Batch is @@ -1527,10 +1532,10 @@ NetworkOPsImp::apply(std::unique_lock& batchLock) sttx.add(s); tx.set_rawtransaction(s.data(), s.size()); tx.set_status(protocol::tsCURRENT); - tx.set_receivetimestamp(app_.timeKeeper().now().time_since_epoch().count()); + tx.set_receivetimestamp(registry_.timeKeeper().now().time_since_epoch().count()); tx.set_deferred(e.result == terQUEUED); // FIXME: This should be when we received it - app_.overlay().relay(e.transaction->getID(), tx, *toSkip); + registry_.overlay().relay(e.transaction->getID(), tx, *toSkip); e.transaction->setBroadcast(); } } @@ -1538,7 +1543,7 @@ NetworkOPsImp::apply(std::unique_lock& batchLock) if (validatedLedgerIndex) { auto [fee, accountSeq, availableSeq] = - app_.getTxQ().getTxRequiredFeeAndSeq(*newOL, e.transaction->getSTransaction()); + registry_.getTxQ().getTxRequiredFeeAndSeq(*newOL, e.transaction->getSTransaction()); e.transaction->setCurrentLedgerState(*validatedLedgerIndex, fee, accountSeq, availableSeq); } } @@ -1713,7 +1718,7 @@ NetworkOPsImp::checkLastClosedLedger(Overlay::PeerSequence const& peerList, uint //------------------------------------------------------------------------- // Determine preferred last closed ledger - auto& validations = app_.getValidations(); + auto& validations = registry_.getValidations(); JLOG(m_journal.debug()) << "ValidationTrie " << Json::Compact(validations.getJsonTrie()); // Will rely on peer LCL if no trusted validations exist @@ -1758,7 +1763,7 @@ NetworkOPsImp::checkLastClosedLedger(Overlay::PeerSequence const& peerList, uint auto consensus = m_ledgerMaster.getLedgerByHash(closedLedger); if (!consensus) - consensus = app_.getInboundLedgers().acquire(closedLedger, 0, InboundLedger::Reason::CONSENSUS); + consensus = registry_.getInboundLedgers().acquire(closedLedger, 0, InboundLedger::Reason::CONSENSUS); if (consensus && (!m_ledgerMaster.canBeCurrent(consensus) || @@ -1799,7 +1804,7 @@ NetworkOPsImp::switchLastClosedLedger(std::shared_ptr const& newLC clearNeedNetworkLedger(); // Update fee computations. - app_.getTxQ().processClosedLedger(app_, *newLCL, true); + registry_.getTxQ().processClosedLedger(registry_.app(), *newLCL, true); // Caller must own master lock { @@ -1807,14 +1812,14 @@ NetworkOPsImp::switchLastClosedLedger(std::shared_ptr const& newLC // open ledger. Then apply local tx. auto retries = m_localTX->getTxSet(); - auto const lastVal = app_.getLedgerMaster().getValidatedLedger(); + auto const lastVal = registry_.getLedgerMaster().getValidatedLedger(); std::optional rules; if (lastVal) - rules = makeRulesGivenLedger(*lastVal, app_.config().features); + rules = makeRulesGivenLedger(*lastVal, registry_.app().config().features); else - rules.emplace(app_.config().features); - app_.openLedger().accept( - app_, + rules.emplace(registry_.app().config().features); + registry_.openLedger().accept( + registry_.app(), *rules, newLCL, OrderedTxs({}), @@ -1824,7 +1829,7 @@ NetworkOPsImp::switchLastClosedLedger(std::shared_ptr const& newLC "jump", [&](OpenView& view, beast::Journal j) { // Stuff the ledger with transactions from the queue. - return app_.getTxQ().accept(app_, view); + return registry_.getTxQ().accept(registry_.app(), view); }); } @@ -1833,11 +1838,11 @@ NetworkOPsImp::switchLastClosedLedger(std::shared_ptr const& newLC protocol::TMStatusChange s; s.set_newevent(protocol::neSWITCHED_LEDGER); s.set_ledgerseq(newLCL->header().seq); - s.set_networktime(app_.timeKeeper().now().time_since_epoch().count()); + s.set_networktime(registry_.timeKeeper().now().time_since_epoch().count()); s.set_ledgerhashprevious(newLCL->header().parentHash.begin(), newLCL->header().parentHash.size()); s.set_ledgerhash(newLCL->header().hash.begin(), newLCL->header().hash.size()); - app_.overlay().foreach(send_always(std::make_shared(s, protocol::mtSTATUS_CHANGE))); + registry_.overlay().foreach(send_always(std::make_shared(s, protocol::mtSTATUS_CHANGE))); } bool @@ -1874,23 +1879,23 @@ NetworkOPsImp::beginConsensus(uint256 const& networkClosed, std::unique_ptrnegativeUNL()); - TrustChanges const changes = app_.validators().updateTrusted( - app_.getValidations().getCurrentNodeIDs(), + registry_.validators().setNegativeUNL(prevLedger->negativeUNL()); + TrustChanges const changes = registry_.validators().updateTrusted( + registry_.getValidations().getCurrentNodeIDs(), closingInfo.parentCloseTime, *this, - app_.overlay(), - app_.getHashRouter()); + registry_.overlay(), + registry_.getHashRouter()); if (!changes.added.empty() || !changes.removed.empty()) { - app_.getValidations().trustChanged(changes.added, changes.removed); + registry_.getValidations().trustChanged(changes.added, changes.removed); // Update the AmendmentTable so it tracks the current validators. - app_.getAmendmentTable().trustChanged(app_.validators().getQuorumKeys().second); + registry_.getAmendmentTable().trustChanged(registry_.validators().getQuorumKeys().second); } mConsensus.startRound( - app_.timeKeeper().closeTime(), networkClosed, prevLedger, changes.removed, changes.added, clog); + registry_.timeKeeper().closeTime(), networkClosed, prevLedger, changes.removed, changes.added, clog); ConsensusPhase const currPhase = mConsensus.phase(); if (mLastConsensusPhase != currPhase) @@ -1925,7 +1930,7 @@ NetworkOPsImp::processTrustedProposal(RCLCxPeerPos peerPos) return false; } - return mConsensus.peerProposal(app_.timeKeeper().closeTime(), peerPos); + return mConsensus.peerProposal(registry_.timeKeeper().closeTime(), peerPos); } void @@ -1939,11 +1944,11 @@ NetworkOPsImp::mapComplete(std::shared_ptr const& map, bool fromAcquire) protocol::TMHaveTransactionSet msg; msg.set_hash(map->getHash().as_uint256().begin(), 256 / 8); msg.set_status(protocol::tsHAVE); - app_.overlay().foreach(send_always(std::make_shared(msg, protocol::mtHAVE_SET))); + registry_.overlay().foreach(send_always(std::make_shared(msg, protocol::mtHAVE_SET))); // We acquired it because consensus asked us to if (fromAcquire) - mConsensus.gotTxSet(app_.timeKeeper().closeTime(), RCLTxSet{map}); + mConsensus.gotTxSet(registry_.timeKeeper().closeTime(), RCLTxSet{map}); } void @@ -1951,7 +1956,7 @@ NetworkOPsImp::endConsensus(std::unique_ptr const& clog) { uint256 deadLedger = m_ledgerMaster.getClosedLedger()->header().parentHash; - for (auto const& it : app_.overlay().getActivePeers()) + for (auto const& it : registry_.overlay().getActivePeers()) { if (it && (it->getClosedLedgerHash() == deadLedger)) { @@ -1961,7 +1966,7 @@ NetworkOPsImp::endConsensus(std::unique_ptr const& clog) } uint256 networkClosed; - bool ledgerChange = checkLastClosedLedger(app_.overlay().getActivePeers(), networkClosed); + bool ledgerChange = checkLastClosedLedger(registry_.overlay().getActivePeers(), networkClosed); if (networkClosed.isZero()) { @@ -1990,7 +1995,8 @@ NetworkOPsImp::endConsensus(std::unique_ptr const& clog) // Note: Do not go to FULL if we don't have the previous ledger // check if the ledger is bad enough to go to CONNECTED -- TODO auto current = m_ledgerMaster.getCurrentLedger(); - if (app_.timeKeeper().now() < (current->header().parentCloseTime + 2 * current->header().closeTimeResolution)) + if (registry_.timeKeeper().now() < + (current->header().parentCloseTime + 2 * current->header().closeTimeResolution)) { setMode(OperatingMode::FULL); } @@ -2096,9 +2102,9 @@ NetworkOPsImp::pubServer() Json::Value jvObj(Json::objectValue); ServerFeeSummary f{ - app_.openLedger().current()->fees().base, - app_.getTxQ().getMetrics(*app_.openLedger().current()), - app_.getFeeTrack()}; + registry_.openLedger().current()->fees().base, + registry_.getTxQ().getMetrics(*registry_.openLedger().current()), + registry_.getFeeTrack()}; jvObj[jss::type] = "serverStatus"; jvObj[jss::server_status] = strOperatingMode(); @@ -2189,7 +2195,7 @@ NetworkOPsImp::pubValidation(std::shared_ptr const& val) jvObj[jss::flags] = val->getFlags(); jvObj[jss::signing_time] = *(*val)[~sfSigningTime]; jvObj[jss::data] = strHex(val->getSerializer().slice()); - jvObj[jss::network_id] = app_.config().NETWORK_ID; + jvObj[jss::network_id] = registry_.app().config().NETWORK_ID; if (auto version = (*val)[~sfServerVersion]) jvObj[jss::server_version] = std::to_string(*version); @@ -2200,7 +2206,7 @@ NetworkOPsImp::pubValidation(std::shared_ptr const& val) if (auto hash = (*val)[~sfValidatedHash]) jvObj[jss::validated_hash] = strHex(*hash); - auto const masterKey = app_.validatorManifests().getMasterKey(signerPublic); + auto const masterKey = registry_.validatorManifests().getMasterKey(signerPublic); if (masterKey != signerPublic) jvObj[jss::master_key] = toBase58(TokenType::NodePublic, masterKey); @@ -2307,12 +2313,12 @@ NetworkOPsImp::setMode(OperatingMode om) using namespace std::chrono_literals; if (om == OperatingMode::CONNECTED) { - if (app_.getLedgerMaster().getValidatedLedgerAge() < 1min) + if (registry_.getLedgerMaster().getValidatedLedgerAge() < 1min) om = OperatingMode::SYNCING; } else if (om == OperatingMode::SYNCING) { - if (app_.getLedgerMaster().getValidatedLedgerAge() >= 1min) + if (registry_.getLedgerMaster().getValidatedLedgerAge() >= 1min) om = OperatingMode::CONNECTED; } @@ -2344,7 +2350,7 @@ NetworkOPsImp::recvValidation(std::shared_ptr const& val, std::str else pendingValidations_.insert(val->getLedgerHash()); scope_unlock unlock(lock); - handleNewValidation(app_, val, source, bypassAccept, m_journal); + handleNewValidation(registry_.app(), val, source, bypassAccept, m_journal); } catch (std::exception const& e) { @@ -2366,7 +2372,7 @@ NetworkOPsImp::recvValidation(std::shared_ptr const& val, std::str JLOG(m_journal.debug()) << [this, &val]() -> auto { std::stringstream ss; ss << "VALIDATION: " << val->render() << " master_key: "; - auto master = app_.validators().getTrustedKey(val->getSignerPublic()); + auto master = registry_.validators().getTrustedKey(val->getSignerPublic()); if (master) { ss << toBase58(TokenType::NodePublic, *master); @@ -2380,7 +2386,7 @@ NetworkOPsImp::recvValidation(std::shared_ptr const& val, std::str // We will always relay trusted validations; if configured, we will // also relay all untrusted validations. - return app_.config().RELAY_UNTRUSTED_VALIDATIONS == 1 || val->isTrusted(); + return registry_.app().config().RELAY_UNTRUSTED_VALIDATIONS == 1 || val->isTrusted(); } Json::Value @@ -2422,7 +2428,7 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters) "One or more unsupported amendments have reached majority. " "Upgrade to the latest version before they are activated " "to avoid being amendment blocked."; - if (auto const expected = app_.getAmendmentTable().firstUnsupportedExpected()) + if (auto const expected = registry_.getAmendmentTable().firstUnsupportedExpected()) { auto& d = w[jss::details] = Json::objectValue; d[jss::expected_date] = expected->time_since_epoch().count(); @@ -2439,8 +2445,8 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters) info[jss::hostid] = getHostId(admin); // domain: if configured with a domain, report it: - if (!app_.config().SERVER_DOMAIN.empty()) - info[jss::server_domain] = app_.config().SERVER_DOMAIN; + if (!registry_.app().config().SERVER_DOMAIN.empty()) + info[jss::server_domain] = registry_.app().config().SERVER_DOMAIN; info[jss::build_version] = BuildInfo::getVersionString(); @@ -2451,11 +2457,11 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters) if (needNetworkLedger_) info[jss::network_ledger] = "waiting"; - info[jss::validation_quorum] = static_cast(app_.validators().quorum()); + info[jss::validation_quorum] = static_cast(registry_.validators().quorum()); if (admin) { - switch (app_.config().NODE_SIZE) + switch (registry_.app().config().NODE_SIZE) { case 0: info[jss::node_size] = "tiny"; @@ -2474,7 +2480,7 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters) break; } - auto when = app_.validators().expires(); + auto when = registry_.validators().expires(); if (!human) { @@ -2487,7 +2493,7 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters) { auto& x = (info[jss::validator_list] = Json::objectValue); - x[jss::count] = static_cast(app_.validators().count()); + x[jss::count] = static_cast(registry_.validators().count()); if (when) { @@ -2500,7 +2506,7 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters) { x[jss::expiration] = to_string(*when); - if (*when > app_.timeKeeper().now()) + if (*when > registry_.timeKeeper().now()) x[jss::status] = "active"; else x[jss::status] = "expired"; @@ -2525,11 +2531,12 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters) } #endif } - info[jss::io_latency_ms] = static_cast(app_.getIOLatency().count()); + info[jss::io_latency_ms] = static_cast(registry_.app().getIOLatency().count()); if (admin) { - if (auto const localPubKey = app_.validators().localPublicKey(); localPubKey && app_.getValidationPublicKey()) + if (auto const localPubKey = registry_.validators().localPublicKey(); + localPubKey && registry_.app().getValidationPublicKey()) { info[jss::pubkey_validator] = toBase58(TokenType::NodePublic, localPubKey.value()); } @@ -2541,17 +2548,17 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters) if (counters) { - info[jss::counters] = app_.getPerfLog().countersJson(); + info[jss::counters] = registry_.getPerfLog().countersJson(); Json::Value nodestore(Json::objectValue); - app_.getNodeStore().getCountsJson(nodestore); + registry_.getNodeStore().getCountsJson(nodestore); info[jss::counters][jss::nodestore] = nodestore; - info[jss::current_activities] = app_.getPerfLog().currentJson(); + info[jss::current_activities] = registry_.getPerfLog().currentJson(); } - info[jss::pubkey_node] = toBase58(TokenType::NodePublic, app_.nodeIdentity().first); + info[jss::pubkey_node] = toBase58(TokenType::NodePublic, registry_.app().nodeIdentity().first); - info[jss::complete_ledgers] = app_.getLedgerMaster().getCompleteLedgers(); + info[jss::complete_ledgers] = registry_.getLedgerMaster().getCompleteLedgers(); if (amendmentBlocked_) info[jss::amendment_blocked] = true; @@ -2561,7 +2568,7 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters) if (fp != 0) info[jss::fetch_pack] = Json::UInt(fp); - info[jss::peers] = Json::UInt(app_.overlay().size()); + info[jss::peers] = Json::UInt(registry_.overlay().size()); Json::Value lastClose = Json::objectValue; lastClose[jss::proposers] = Json::UInt(mConsensus.prevProposers()); @@ -2582,13 +2589,13 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters) if (admin) info[jss::load] = m_job_queue.getJson(); - if (auto const netid = app_.overlay().networkID()) + if (auto const netid = registry_.overlay().networkID()) info[jss::network_id] = static_cast(*netid); - auto const escalationMetrics = app_.getTxQ().getMetrics(*app_.openLedger().current()); + auto const escalationMetrics = registry_.getTxQ().getMetrics(*registry_.openLedger().current()); - auto const loadFactorServer = app_.getFeeTrack().getLoadFactor(); - auto const loadBaseServer = app_.getFeeTrack().getLoadBase(); + auto const loadFactorServer = registry_.getFeeTrack().getLoadFactor(); + auto const loadBaseServer = registry_.getFeeTrack().getLoadBase(); /* Scale the escalated fee level to unitless "load factor". In practice, this just strips the units, but it will continue to work correctly if either base value ever changes. */ @@ -2622,13 +2629,13 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters) if (admin) { - std::uint32_t fee = app_.getFeeTrack().getLocalFee(); + std::uint32_t fee = registry_.getFeeTrack().getLocalFee(); if (fee != loadBaseServer) info[jss::load_factor_local] = static_cast(fee) / loadBaseServer; - fee = app_.getFeeTrack().getRemoteFee(); + fee = registry_.getFeeTrack().getRemoteFee(); if (fee != loadBaseServer) info[jss::load_factor_net] = static_cast(fee) / loadBaseServer; - fee = app_.getFeeTrack().getClusterFee(); + fee = registry_.getFeeTrack().getClusterFee(); if (fee != loadBaseServer) info[jss::load_factor_cluster] = static_cast(fee) / loadBaseServer; } @@ -2669,7 +2676,7 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters) l[jss::reserve_base_xrp] = lpClosed->fees().reserve.decimalXRP(); l[jss::reserve_inc_xrp] = lpClosed->fees().increment.decimalXRP(); - if (auto const closeOffset = app_.timeKeeper().closeOffset(); std::abs(closeOffset.count()) >= 60) + if (auto const closeOffset = registry_.timeKeeper().closeOffset(); std::abs(closeOffset.count()) >= 60) l[jss::close_time_offset] = static_cast(closeOffset.count()); constexpr std::chrono::seconds highAgeThreshold{1000000}; @@ -2681,7 +2688,7 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters) else { auto lCloseTime = lpClosed->header().closeTime; - auto closeTime = app_.timeKeeper().closeTime(); + auto closeTime = registry_.timeKeeper().closeTime(); if (lCloseTime <= closeTime) { using namespace std::chrono_literals; @@ -2705,16 +2712,16 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters) accounting_.json(info); info[jss::uptime] = UptimeClock::now().time_since_epoch().count(); - info[jss::jq_trans_overflow] = std::to_string(app_.overlay().getJqTransOverflow()); - info[jss::peer_disconnects] = std::to_string(app_.overlay().getPeerDisconnect()); - info[jss::peer_disconnects_resources] = std::to_string(app_.overlay().getPeerDisconnectCharges()); + info[jss::jq_trans_overflow] = std::to_string(registry_.overlay().getJqTransOverflow()); + info[jss::peer_disconnects] = std::to_string(registry_.overlay().getPeerDisconnect()); + info[jss::peer_disconnects_resources] = std::to_string(registry_.overlay().getPeerDisconnectCharges()); // This array must be sorted in increasing order. static constexpr std::array protocols{"http", "https", "peer", "ws", "ws2", "wss", "wss2"}; static_assert(std::is_sorted(std::begin(protocols), std::end(protocols))); { Json::Value ports{Json::arrayValue}; - for (auto const& port : app_.getServerHandler().setup().ports) + for (auto const& port : registry_.getServerHandler().setup().ports) { // Don't publish admin ports for non-admin users if (!admin && @@ -2738,9 +2745,9 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters) } } - if (app_.config().exists(SECTION_PORT_GRPC)) + if (registry_.app().config().exists(SECTION_PORT_GRPC)) { - auto const& grpcSection = app_.config().section(SECTION_PORT_GRPC); + auto const& grpcSection = registry_.app().config().section(SECTION_PORT_GRPC); auto const optPort = grpcSection.get("port"); if (optPort && grpcSection.get("ip")) { @@ -2759,13 +2766,13 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters) void NetworkOPsImp::clearLedgerFetch() { - app_.getInboundLedgers().clearFailures(); + registry_.getInboundLedgers().clearFailures(); } Json::Value NetworkOPsImp::getLedgerFetchInfo() { - return app_.getInboundLedgers().getInfo(); + return registry_.getInboundLedgers().getInfo(); } void @@ -2814,11 +2821,11 @@ NetworkOPsImp::pubLedger(std::shared_ptr const& lpAccepted) // Ledgers are published only when they acquire sufficient validations // Holes are filled across connection loss or other catastrophe - std::shared_ptr alpAccepted = app_.getAcceptedLedgerCache().fetch(lpAccepted->header().hash); + std::shared_ptr alpAccepted = registry_.getAcceptedLedgerCache().fetch(lpAccepted->header().hash); if (!alpAccepted) { - alpAccepted = std::make_shared(lpAccepted, app_); - app_.getAcceptedLedgerCache().canonicalize_replace_client(lpAccepted->header().hash, alpAccepted); + alpAccepted = std::make_shared(lpAccepted, registry_.app()); + registry_.getAcceptedLedgerCache().canonicalize_replace_client(lpAccepted->header().hash, alpAccepted); } XRPL_ASSERT(alpAccepted->getLedger().get() == lpAccepted.get(), "xrpl::NetworkOPsImp::pubLedger : accepted input"); @@ -2837,7 +2844,7 @@ NetworkOPsImp::pubLedger(std::shared_ptr const& lpAccepted) jvObj[jss::ledger_hash] = to_string(lpAccepted->header().hash); jvObj[jss::ledger_time] = Json::Value::UInt(lpAccepted->header().closeTime.time_since_epoch().count()); - jvObj[jss::network_id] = app_.config().NETWORK_ID; + jvObj[jss::network_id] = registry_.app().config().NETWORK_ID; if (!lpAccepted->rules().enabled(featureXRPFees)) jvObj[jss::fee_ref] = Config::FEE_UNITS_DEPRECATED; @@ -2849,7 +2856,7 @@ NetworkOPsImp::pubLedger(std::shared_ptr const& lpAccepted) if (mMode >= OperatingMode::SYNCING) { - jvObj[jss::validated_ledgers] = app_.getLedgerMaster().getCompleteLedgers(); + jvObj[jss::validated_ledgers] = registry_.getLedgerMaster().getCompleteLedgers(); } auto it = mStreamMaps[sLedger].begin(); @@ -2917,9 +2924,9 @@ void NetworkOPsImp::reportFeeChange() { ServerFeeSummary f{ - app_.openLedger().current()->fees().base, - app_.getTxQ().getMetrics(*app_.openLedger().current()), - app_.getFeeTrack()}; + registry_.openLedger().current()->fees().base, + registry_.getTxQ().getMetrics(*registry_.openLedger().current()), + registry_.getFeeTrack()}; // only schedule the job if something has changed if (f != mLastFeeSummary) @@ -2980,7 +2987,7 @@ NetworkOPsImp::transJson( lookup.second && lookup.second->isFieldPresent(sfTransactionIndex)) { uint32_t const txnSeq = lookup.second->getFieldU32(sfTransactionIndex); - uint32_t netID = app_.config().NETWORK_ID; + uint32_t netID = registry_.app().config().NETWORK_ID; if (transaction->isFieldPresent(sfNetworkID)) netID = transaction->getFieldU32(sfNetworkID); @@ -3018,7 +3025,7 @@ NetworkOPsImp::transJson( // If the offer create is not self funded then add the owner balance if (account != amount.issue().account) { - auto const ownerFunds = accountFunds(*ledger, account, amount, fhIGNORE_FREEZE, app_.journal("View")); + auto const ownerFunds = accountFunds(*ledger, account, amount, fhIGNORE_FREEZE, registry_.journal("View")); jvObj[jss::transaction][jss::owner_funds] = ownerFunds.getText(); } } @@ -3095,7 +3102,7 @@ NetworkOPsImp::pubValidatedTransaction( } if (transaction.getResult() == tesSUCCESS) - app_.getOrderBookDB().processTxn(ledger, transaction, jvObj); + registry_.getOrderBookDB().processTxn(ledger, transaction, jvObj); pubAccountTransaction(ledger, transaction, last); } @@ -3381,7 +3388,7 @@ NetworkOPsImp::addAccountHistoryJob(SubAccountHistoryInfoWeak subInfo) static auto const databaseType = [&]() -> DatabaseType { // Use a dynamic_cast to return DatabaseType::None // on failure. - if (dynamic_cast(&app_.getRelationalDatabase())) + if (dynamic_cast(®istry_.getRelationalDatabase())) { return DatabaseType::Sqlite; } @@ -3403,7 +3410,7 @@ NetworkOPsImp::addAccountHistoryJob(SubAccountHistoryInfoWeak subInfo) // LCOV_EXCL_STOP } - app_.getJobQueue().addJob(jtCLIENT_ACCT_HIST, "HistTxStream", [this, dbType = databaseType, subInfo]() { + registry_.getJobQueue().addJob(jtCLIENT_ACCT_HIST, "HistTxStream", [this, dbType = databaseType, subInfo]() { auto const& accountId = subInfo.index_->accountId_; auto& lastLedgerSeq = subInfo.index_->historyLastLedgerSeq_; auto& txHistoryIndex = subInfo.index_->historyTxIndex_; @@ -3478,7 +3485,7 @@ NetworkOPsImp::addAccountHistoryJob(SubAccountHistoryInfoWeak subInfo) switch (dbType) { case Sqlite: { - auto db = static_cast(&app_.getRelationalDatabase()); + auto db = static_cast(®istry_.getRelationalDatabase()); RelationalDatabase::AccountTxPageOptions options{accountId, minLedger, maxLedger, marker, 0, true}; return db->newestAccountTxPage(options); } @@ -3519,7 +3526,8 @@ NetworkOPsImp::addAccountHistoryJob(SubAccountHistoryInfoWeak subInfo) auto haveRange = [&]() -> bool { std::uint32_t validatedMin = UINT_MAX; std::uint32_t validatedMax = 0; - auto haveSomeValidatedLedgers = app_.getLedgerMaster().getValidatedRange(validatedMin, validatedMax); + auto haveSomeValidatedLedgers = + registry_.getLedgerMaster().getValidatedRange(validatedMin, validatedMax); return haveSomeValidatedLedgers && validatedMin <= startLedgerSeq && lastLedgerSeq <= validatedMax; }(); @@ -3564,7 +3572,7 @@ NetworkOPsImp::addAccountHistoryJob(SubAccountHistoryInfoWeak subInfo) send(rpcError(rpcINTERNAL), true); return; } - auto curTxLedger = app_.getLedgerMaster().getLedgerBySeq(tx->getLedger()); + auto curTxLedger = registry_.getLedgerMaster().getLedgerBySeq(tx->getLedger()); if (!curTxLedger) { // LCOV_EXCL_START @@ -3704,7 +3712,7 @@ NetworkOPsImp::subAccountHistory(InfoSub::ref isrListener, AccountID const& acco simIterator->second.emplace(isrListener->getSeq(), ahi); } - auto const ledger = app_.getLedgerMaster().getValidatedLedger(); + auto const ledger = registry_.getLedgerMaster().getValidatedLedger(); if (ledger) { subAccountHistoryStart(ledger, ahi); @@ -3758,7 +3766,7 @@ NetworkOPsImp::unsubAccountHistoryInternal(std::uint64_t seq, AccountID const& a bool NetworkOPsImp::subBook(InfoSub::ref isrListener, Book const& book) { - if (auto listeners = app_.getOrderBookDB().makeBookListeners(book)) + if (auto listeners = registry_.getOrderBookDB().makeBookListeners(book)) listeners->addSubscriber(isrListener); else { @@ -3772,7 +3780,7 @@ NetworkOPsImp::subBook(InfoSub::ref isrListener, Book const& book) bool NetworkOPsImp::unsubBook(std::uint64_t uSeq, Book const& book) { - if (auto listeners = app_.getOrderBookDB().getBookListeners(book)) + if (auto listeners = registry_.getOrderBookDB().getBookListeners(book)) listeners->removeSubscriber(uSeq); return true; @@ -3791,7 +3799,7 @@ NetworkOPsImp::acceptLedger(std::optional consensusDe // FIXME Could we improve on this and remove the need for a specialized // API in Consensus? beginConsensus(m_ledgerMaster.getClosedLedger()->header().hash, {}); - mConsensus.simulate(app_.timeKeeper().closeTime(), consensusDelay); + mConsensus.simulate(registry_.timeKeeper().closeTime(), consensusDelay); return m_ledgerMaster.getCurrentLedger()->header().seq; } @@ -3809,12 +3817,12 @@ NetworkOPsImp::subLedger(InfoSub::ref isrListener, Json::Value& jvResult) jvResult[jss::fee_base] = lpClosed->fees().base.jsonClipped(); jvResult[jss::reserve_base] = lpClosed->fees().reserve.jsonClipped(); jvResult[jss::reserve_inc] = lpClosed->fees().increment.jsonClipped(); - jvResult[jss::network_id] = app_.config().NETWORK_ID; + jvResult[jss::network_id] = registry_.app().config().NETWORK_ID; } if ((mMode >= OperatingMode::SYNCING) && !isNeedNetworkLedger()) { - jvResult[jss::validated_ledgers] = app_.getLedgerMaster().getCompleteLedgers(); + jvResult[jss::validated_ledgers] = registry_.getLedgerMaster().getCompleteLedgers(); } std::lock_guard sl(mSubLock); @@ -3873,13 +3881,13 @@ NetworkOPsImp::subServer(InfoSub::ref isrListener, Json::Value& jvResult, bool a // CHECKME: is it necessary to provide a random number here? beast::rngfill(uRandom.begin(), uRandom.size(), crypto_prng()); - auto const& feeTrack = app_.getFeeTrack(); + auto const& feeTrack = registry_.getFeeTrack(); jvResult[jss::random] = to_string(uRandom); jvResult[jss::server_status] = strOperatingMode(admin); jvResult[jss::load_base] = feeTrack.getLoadBase(); jvResult[jss::load_factor] = feeTrack.getLoadFactor(); jvResult[jss::hostid] = getHostId(admin); - jvResult[jss::pubkey_node] = toBase58(TokenType::NodePublic, app_.nodeIdentity().first); + jvResult[jss::pubkey_node] = toBase58(TokenType::NodePublic, registry_.app().nodeIdentity().first); std::lock_guard sl(mSubLock); return mStreamMaps[sServer].emplace(isrListener->getSeq(), isrListener).second; @@ -4065,7 +4073,7 @@ NetworkOPsImp::getBookPage( STAmount saDirRate; auto const rate = transferRate(view, book.out.account); - auto viewJ = app_.journal("View"); + auto viewJ = registry_.journal("View"); while (!bDone && iLimit-- > 0) { @@ -4413,7 +4421,7 @@ NetworkOPsImp::StateAccounting::json(Json::Value& obj) const std::unique_ptr make_NetworkOPs( - Application& app, + ServiceRegistry& registry, NetworkOPs::clock_type& clock, bool standalone, std::size_t minPeerCount, @@ -4426,7 +4434,7 @@ make_NetworkOPs( beast::insight::Collector::ptr const& collector) { return std::make_unique( - app, + registry, clock, standalone, minPeerCount, diff --git a/src/xrpld/app/misc/SHAMapStoreImp.cpp b/src/xrpld/app/misc/SHAMapStoreImp.cpp index c963d18d2c..8de47207a6 100644 --- a/src/xrpld/app/misc/SHAMapStoreImp.cpp +++ b/src/xrpld/app/misc/SHAMapStoreImp.cpp @@ -1,5 +1,4 @@ #include -#include #include #include #include @@ -7,6 +6,7 @@ #include #include #include +#include #include #include diff --git a/src/xrpld/app/misc/detail/ValidatorList.cpp b/src/xrpld/app/misc/detail/ValidatorList.cpp index 0edd0de9be..3a46d2baa1 100644 --- a/src/xrpld/app/misc/detail/ValidatorList.cpp +++ b/src/xrpld/app/misc/detail/ValidatorList.cpp @@ -1,5 +1,4 @@ #include -#include #include #include @@ -13,6 +12,7 @@ #include #include #include +#include #include diff --git a/src/xrpld/app/misc/make_NetworkOPs.h b/src/xrpld/app/misc/make_NetworkOPs.h new file mode 100644 index 0000000000..7dce966f04 --- /dev/null +++ b/src/xrpld/app/misc/make_NetworkOPs.h @@ -0,0 +1,32 @@ +#pragma once + +#include +#include +#include +#include +#include + +#include + +#include + +namespace xrpl { + +class LedgerMaster; +class ValidatorKeys; + +std::unique_ptr +make_NetworkOPs( + ServiceRegistry& registry, + NetworkOPs::clock_type& clock, + bool standalone, + std::size_t minPeerCount, + bool start_valid, + JobQueue& job_queue, + LedgerMaster& ledgerMaster, + ValidatorKeys const& validatorKeys, + boost::asio::io_context& io_svc, + beast::Journal journal, + beast::insight::Collector::ptr const& collector); + +} // namespace xrpl diff --git a/src/xrpld/app/paths/PathRequest.cpp b/src/xrpld/app/paths/PathRequest.cpp index e2a3e14485..53a4e03752 100644 --- a/src/xrpld/app/paths/PathRequest.cpp +++ b/src/xrpld/app/paths/PathRequest.cpp @@ -1,6 +1,5 @@ #include #include -#include #include #include #include @@ -14,6 +13,7 @@ #include #include #include +#include #include #include diff --git a/src/xrpld/app/paths/PathRequest.h b/src/xrpld/app/paths/PathRequest.h index 864d2cb932..09e97e4497 100644 --- a/src/xrpld/app/paths/PathRequest.h +++ b/src/xrpld/app/paths/PathRequest.h @@ -3,11 +3,11 @@ #include #include #include -#include #include #include #include +#include #include #include diff --git a/src/xrpld/app/rdb/backend/SQLiteDatabase.h b/src/xrpld/app/rdb/backend/SQLiteDatabase.h index b79b66787e..963ec1da72 100644 --- a/src/xrpld/app/rdb/backend/SQLiteDatabase.h +++ b/src/xrpld/app/rdb/backend/SQLiteDatabase.h @@ -2,7 +2,11 @@ #include +#include #include +#include +#include +#include namespace xrpl { @@ -378,7 +382,7 @@ public: SQLiteDatabase& operator=(SQLiteDatabase const&) = delete; SQLiteDatabase& - operator=(SQLiteDatabase&& rhs) = delete; + operator=(SQLiteDatabase&&) = delete; /** * @brief ledgerDbHasSpace Checks if the ledger database has available @@ -400,7 +404,7 @@ public: private: ServiceRegistry& registry_; - bool const useTxTables_; + bool useTxTables_; beast::Journal j_; std::unique_ptr ledgerDb_, txdb_; @@ -464,7 +468,9 @@ private: /** * @brief setup_RelationalDatabase Creates and returns a SQLiteDatabase - * instance based on configuration. + * instance based on configuration. It's recommended to use it as + * a singleton, but it's not enforced (e.g. if you have more than one + * database). * @param registry The service registry. * @param config Config object. * @param jobQueue JobQueue object. diff --git a/src/xrpld/app/rdb/backend/detail/SQLiteDatabase.cpp b/src/xrpld/app/rdb/backend/detail/SQLiteDatabase.cpp index 6c3e76a86f..93d7662917 100644 --- a/src/xrpld/app/rdb/backend/detail/SQLiteDatabase.cpp +++ b/src/xrpld/app/rdb/backend/detail/SQLiteDatabase.cpp @@ -499,6 +499,13 @@ SQLiteDatabase::getTransaction( return TxSearched::unknown; } +SQLiteDatabase::SQLiteDatabase(SQLiteDatabase&& rhs) noexcept + : registry_(rhs.registry_), useTxTables_(rhs.useTxTables_), j_(rhs.j_) +{ + std::exchange(ledgerDb_, std::move(rhs.ledgerDb_)); + std::exchange(txdb_, std::move(rhs.txdb_)); +} + bool SQLiteDatabase::ledgerDbHasSpace(Config const& config) { @@ -587,15 +594,6 @@ SQLiteDatabase::SQLiteDatabase(ServiceRegistry& registry, Config const& config, } } -SQLiteDatabase::SQLiteDatabase(SQLiteDatabase&& rhs) noexcept - : registry_(rhs.registry_) - , useTxTables_(rhs.useTxTables_) - , j_(rhs.j_) - , ledgerDb_(std::move(rhs.ledgerDb_)) - , txdb_(std::move(rhs.txdb_)) -{ -} - SQLiteDatabase setup_RelationalDatabase(ServiceRegistry& registry, Config const& config, JobQueue& jobQueue) { diff --git a/src/xrpld/app/rdb/detail/RelationalDatabase.cpp b/src/xrpld/app/rdb/detail/RelationalDatabase.cpp deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/xrpld/app/tx/detail/Change.cpp b/src/xrpld/app/tx/detail/Change.cpp index dbef2eadf9..67c7db68c5 100644 --- a/src/xrpld/app/tx/detail/Change.cpp +++ b/src/xrpld/app/tx/detail/Change.cpp @@ -1,7 +1,6 @@ #include #include #include -#include #include #include @@ -9,6 +8,7 @@ #include #include #include +#include #include diff --git a/src/xrpld/overlay/detail/OverlayImpl.cpp b/src/xrpld/overlay/detail/OverlayImpl.cpp index 549bff024e..ceefab24f1 100644 --- a/src/xrpld/overlay/detail/OverlayImpl.cpp +++ b/src/xrpld/overlay/detail/OverlayImpl.cpp @@ -1,5 +1,4 @@ #include -#include #include #include #include @@ -18,6 +17,7 @@ #include #include #include +#include #include #include diff --git a/src/xrpld/overlay/detail/PeerImp.cpp b/src/xrpld/overlay/detail/PeerImp.cpp index 0664f64256..d66a57bae6 100644 --- a/src/xrpld/overlay/detail/PeerImp.cpp +++ b/src/xrpld/overlay/detail/PeerImp.cpp @@ -5,7 +5,6 @@ #include #include #include -#include #include #include #include @@ -20,6 +19,7 @@ #include #include #include +#include #include #include diff --git a/src/xrpld/rpc/Context.h b/src/xrpld/rpc/Context.h index 7ff02a9e8b..e77d9adeb3 100644 --- a/src/xrpld/rpc/Context.h +++ b/src/xrpld/rpc/Context.h @@ -1,10 +1,10 @@ #pragma once -#include #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/rpc/RPCSub.h b/src/xrpld/rpc/RPCSub.h index 53c46139cb..e89f8f34e4 100644 --- a/src/xrpld/rpc/RPCSub.h +++ b/src/xrpld/rpc/RPCSub.h @@ -1,8 +1,7 @@ #pragma once -#include - #include +#include #include diff --git a/src/xrpld/rpc/detail/Handler.h b/src/xrpld/rpc/detail/Handler.h index f6fadd9cbd..664fd04ab8 100644 --- a/src/xrpld/rpc/detail/Handler.h +++ b/src/xrpld/rpc/detail/Handler.h @@ -1,12 +1,12 @@ #pragma once #include -#include #include #include #include #include +#include namespace Json { class Object; diff --git a/src/xrpld/rpc/detail/RPCHandler.cpp b/src/xrpld/rpc/detail/RPCHandler.cpp index 93cb58a117..159649e6d7 100644 --- a/src/xrpld/rpc/detail/RPCHandler.cpp +++ b/src/xrpld/rpc/detail/RPCHandler.cpp @@ -2,10 +2,8 @@ #include #include #include -#include #include #include -#include #include #include #include @@ -18,6 +16,8 @@ #include #include #include +#include +#include #include #include diff --git a/src/xrpld/rpc/detail/RPCHelpers.h b/src/xrpld/rpc/detail/RPCHelpers.h index 1b5e06ce42..b0dc839404 100644 --- a/src/xrpld/rpc/detail/RPCHelpers.h +++ b/src/xrpld/rpc/detail/RPCHelpers.h @@ -1,6 +1,5 @@ #pragma once -#include #include #include #include @@ -9,6 +8,7 @@ #include #include #include +#include #include diff --git a/src/xrpld/rpc/detail/RPCLedgerHelpers.h b/src/xrpld/rpc/detail/RPCLedgerHelpers.h index b2d9df809f..81877e6f49 100644 --- a/src/xrpld/rpc/detail/RPCLedgerHelpers.h +++ b/src/xrpld/rpc/detail/RPCLedgerHelpers.h @@ -1,6 +1,6 @@ #pragma once -#include +#include #include #include #include @@ -8,6 +8,7 @@ #include #include +#include #include diff --git a/src/xrpld/rpc/detail/ServerHandler.cpp b/src/xrpld/rpc/detail/ServerHandler.cpp index d40965ec79..9c18143eb4 100644 --- a/src/xrpld/rpc/detail/ServerHandler.cpp +++ b/src/xrpld/rpc/detail/ServerHandler.cpp @@ -1,5 +1,4 @@ #include -#include #include #include #include @@ -23,6 +22,7 @@ #include #include #include +#include #include #include #include diff --git a/src/xrpld/rpc/detail/TransactionSign.h b/src/xrpld/rpc/detail/TransactionSign.h index cc85d67815..8d064d65d5 100644 --- a/src/xrpld/rpc/detail/TransactionSign.h +++ b/src/xrpld/rpc/detail/TransactionSign.h @@ -1,10 +1,11 @@ #pragma once #include -#include #include #include +#include + namespace xrpl { // Forward declarations diff --git a/src/xrpld/rpc/detail/WSInfoSub.h b/src/xrpld/rpc/detail/WSInfoSub.h index 8ed5ff8d6d..4042cd5479 100644 --- a/src/xrpld/rpc/detail/WSInfoSub.h +++ b/src/xrpld/rpc/detail/WSInfoSub.h @@ -1,10 +1,10 @@ #pragma once -#include #include #include #include +#include #include #include diff --git a/src/xrpld/rpc/handlers/BookOffers.cpp b/src/xrpld/rpc/handlers/BookOffers.cpp index 1a79bdcdd2..ff49bf2290 100644 --- a/src/xrpld/rpc/handlers/BookOffers.cpp +++ b/src/xrpld/rpc/handlers/BookOffers.cpp @@ -1,5 +1,4 @@ #include -#include #include #include #include @@ -12,6 +11,7 @@ #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/rpc/handlers/ConsensusInfo.cpp b/src/xrpld/rpc/handlers/ConsensusInfo.cpp index 386ff99458..f9c5a97785 100644 --- a/src/xrpld/rpc/handlers/ConsensusInfo.cpp +++ b/src/xrpld/rpc/handlers/ConsensusInfo.cpp @@ -1,9 +1,9 @@ -#include #include #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/rpc/handlers/FetchInfo.cpp b/src/xrpld/rpc/handlers/FetchInfo.cpp index 0a54042820..f25f18acf7 100644 --- a/src/xrpld/rpc/handlers/FetchInfo.cpp +++ b/src/xrpld/rpc/handlers/FetchInfo.cpp @@ -1,9 +1,9 @@ -#include #include #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/rpc/handlers/GetCounts.cpp b/src/xrpld/rpc/handlers/GetCounts.cpp index 360389ba3a..54600d4761 100644 --- a/src/xrpld/rpc/handlers/GetCounts.cpp +++ b/src/xrpld/rpc/handlers/GetCounts.cpp @@ -2,7 +2,6 @@ #include #include #include -#include #include #include @@ -11,6 +10,7 @@ #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/rpc/handlers/LedgerAccept.cpp b/src/xrpld/rpc/handlers/LedgerAccept.cpp index abf5780629..c7a828863a 100644 --- a/src/xrpld/rpc/handlers/LedgerAccept.cpp +++ b/src/xrpld/rpc/handlers/LedgerAccept.cpp @@ -1,11 +1,11 @@ #include #include -#include #include #include #include #include +#include #include diff --git a/src/xrpld/rpc/handlers/LedgerClosed.cpp b/src/xrpld/rpc/handlers/LedgerClosed.cpp index 3b93e0734f..e26019cca6 100644 --- a/src/xrpld/rpc/handlers/LedgerClosed.cpp +++ b/src/xrpld/rpc/handlers/LedgerClosed.cpp @@ -1,9 +1,9 @@ #include -#include #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/rpc/handlers/LedgerCurrent.cpp b/src/xrpld/rpc/handlers/LedgerCurrent.cpp index c5ca962751..861080c5f2 100644 --- a/src/xrpld/rpc/handlers/LedgerCurrent.cpp +++ b/src/xrpld/rpc/handlers/LedgerCurrent.cpp @@ -1,9 +1,9 @@ #include -#include #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/rpc/handlers/OwnerInfo.cpp b/src/xrpld/rpc/handlers/OwnerInfo.cpp index bbab938cfb..b92d3c7d0a 100644 --- a/src/xrpld/rpc/handlers/OwnerInfo.cpp +++ b/src/xrpld/rpc/handlers/OwnerInfo.cpp @@ -1,11 +1,11 @@ #include -#include #include #include #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/rpc/handlers/ServerInfo.cpp b/src/xrpld/rpc/handlers/ServerInfo.cpp index 70b92c99bd..1086760bf6 100644 --- a/src/xrpld/rpc/handlers/ServerInfo.cpp +++ b/src/xrpld/rpc/handlers/ServerInfo.cpp @@ -1,10 +1,10 @@ -#include #include #include #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/rpc/handlers/ServerState.cpp b/src/xrpld/rpc/handlers/ServerState.cpp index e2adbc8ff2..603b9f9c51 100644 --- a/src/xrpld/rpc/handlers/ServerState.cpp +++ b/src/xrpld/rpc/handlers/ServerState.cpp @@ -1,9 +1,9 @@ -#include #include #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/rpc/handlers/Subscribe.cpp b/src/xrpld/rpc/handlers/Subscribe.cpp index c1f506e623..574da255d2 100644 --- a/src/xrpld/rpc/handlers/Subscribe.cpp +++ b/src/xrpld/rpc/handlers/Subscribe.cpp @@ -1,6 +1,5 @@ #include #include -#include #include #include #include @@ -12,6 +11,7 @@ #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/rpc/handlers/Tx.cpp b/src/xrpld/rpc/handlers/Tx.cpp index 2f8d71c2c8..d2d7bed04d 100644 --- a/src/xrpld/rpc/handlers/Tx.cpp +++ b/src/xrpld/rpc/handlers/Tx.cpp @@ -1,7 +1,6 @@ #include #include #include -#include #include #include #include @@ -16,6 +15,7 @@ #include #include #include +#include #include diff --git a/src/xrpld/rpc/handlers/Unsubscribe.cpp b/src/xrpld/rpc/handlers/Unsubscribe.cpp index 24c4cd51a5..da5cd8eecb 100644 --- a/src/xrpld/rpc/handlers/Unsubscribe.cpp +++ b/src/xrpld/rpc/handlers/Unsubscribe.cpp @@ -1,4 +1,3 @@ -#include #include #include #include @@ -7,6 +6,7 @@ #include #include #include +#include namespace xrpl { From cd218346ff561f531871dc45e49927fa2d19903c Mon Sep 17 00:00:00 2001 From: nuxtreact Date: Fri, 13 Feb 2026 03:55:27 +0800 Subject: [PATCH 46/61] chore: Fix minor issues in comments (#6346) --- docs/CodingStyle.md | 4 ++-- src/xrpld/app/tx/detail/XChainBridge.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/CodingStyle.md b/docs/CodingStyle.md index 3c26709047..2788f7b210 100644 --- a/docs/CodingStyle.md +++ b/docs/CodingStyle.md @@ -17,8 +17,8 @@ guideline is to maintain the standards that are used in those libraries. ## Guidelines If you want to do something contrary to these guidelines, understand -why you're doing it. Think, use common sense, and consider that this -your changes will probably need to be maintained long after you've +why you're doing it. Think, use common sense, and consider that these +changes will probably need to be maintained long after you've moved on to other projects. - Use white space and blank lines to guide the eye and keep your intent clear. diff --git a/src/xrpld/app/tx/detail/XChainBridge.cpp b/src/xrpld/app/tx/detail/XChainBridge.cpp index beeab41f67..f4abb9145b 100644 --- a/src/xrpld/app/tx/detail/XChainBridge.cpp +++ b/src/xrpld/app/tx/detail/XChainBridge.cpp @@ -556,7 +556,7 @@ struct FinalizeClaimHelperResult the fields mean. The individual ters need to be returned instead of an overall ter because the caller needs this information if the attestation list changed or not. - */ +*/ FinalizeClaimHelperResult finalizeClaimHelper( From 484fc4ce9ae5be2e16830795616bdb02822f4a0b Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Fri, 13 Feb 2026 12:32:38 +0000 Subject: [PATCH 47/61] increase timeout for sanitizer jobs Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> --- .github/workflows/reusable-build-test-config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/reusable-build-test-config.yml b/.github/workflows/reusable-build-test-config.yml index d9f936a598..aeac78d6eb 100644 --- a/.github/workflows/reusable-build-test-config.yml +++ b/.github/workflows/reusable-build-test-config.yml @@ -77,7 +77,7 @@ jobs: runs-on: ${{ fromJSON(inputs.runs_on) }} container: ${{ inputs.image != '' && inputs.image || null }} # Sanitizer builds on GCC are taking longer than 60mins. Hence increasing the timeout to 90mins. - timeout-minutes: 60 + timeout-minutes: ${{ inputs.sanitizers != '' && 90 || 60 }} env: # Use a namespace to keep the objects separate for each configuration. CCACHE_NAMESPACE: ${{ inputs.config_name }} From ac0ad3627f8fbcf5b2e9147405f7eff94d02976a Mon Sep 17 00:00:00 2001 From: Jingchen Date: Fri, 13 Feb 2026 15:34:37 +0000 Subject: [PATCH 48/61] refactor: Modularize `HashRouter`, `Conditions`, and `OrderBookDB` (#6226) This change modularizes additional components by moving code to `libxrpl`. --- .../scripts/levelization/results/ordering.txt | 12 ++- cmake/XrplCore.cmake | 14 ++- cmake/XrplInstall.cmake | 1 + .../xrpl}/conditions/Condition.h | 3 +- .../xrpl}/conditions/Fulfillment.h | 3 +- .../xrpl}/conditions/detail/PreimageSha256.h | 7 +- .../xrpl}/conditions/detail/error.h | 0 .../xrpl}/conditions/detail/utils.h | 3 +- .../misc => include/xrpl/core}/HashRouter.h | 3 - include/xrpl/core/ServiceRegistry.h | 7 ++ .../xrpl}/ledger/AcceptedLedgerTx.h | 8 +- .../xrpl}/ledger/BookListeners.h | 0 include/xrpl/ledger/OrderBookDB.h | 93 +++++++++++++++++++ include/xrpl/server/NetworkOPs.h | 3 +- .../conditions}/Condition.cpp | 6 +- .../conditions}/Fulfillment.cpp | 9 +- .../detail => libxrpl/conditions}/error.cpp | 3 +- .../app/misc => libxrpl/core}/HashRouter.cpp | 37 +------- .../ledger/AcceptedLedgerTx.cpp | 4 +- .../app => libxrpl}/ledger/BookListeners.cpp | 2 +- src/test/app/Batch_test.cpp | 2 +- src/test/app/HashRouter_test.cpp | 3 +- src/test/app/NetworkOPs_test.cpp | 2 +- src/test/conditions/PreimageSha256_test.cpp | 7 +- src/xrpld/app/consensus/RCLConsensus.cpp | 2 +- src/xrpld/app/ledger/AcceptedLedger.cpp | 2 +- src/xrpld/app/ledger/AcceptedLedger.h | 6 +- src/xrpld/app/ledger/Ledger.cpp | 2 +- src/xrpld/app/ledger/OrderBookDB.h | 75 --------------- .../{OrderBookDB.cpp => OrderBookDBImpl.cpp} | 51 ++++++---- src/xrpld/app/ledger/OrderBookDBImpl.h | 93 +++++++++++++++++++ src/xrpld/app/ledger/detail/LedgerMaster.cpp | 2 +- src/xrpld/app/ledger/detail/OpenLedger.cpp | 2 +- src/xrpld/app/main/Application.cpp | 14 +-- src/xrpld/app/main/Application.h | 7 -- src/xrpld/app/misc/AmendmentTable.h | 3 +- src/xrpld/app/misc/NetworkOPs.cpp | 6 +- src/xrpld/app/misc/detail/AmendmentTable.cpp | 16 ++-- src/xrpld/app/misc/detail/Transaction.cpp | 2 +- src/xrpld/app/misc/detail/ValidatorList.cpp | 2 +- .../app/misc/detail/setup_HashRouter.cpp | 42 +++++++++ src/xrpld/app/misc/setup_HashRouter.h | 17 ++++ src/xrpld/app/paths/Pathfinder.cpp | 2 +- src/xrpld/app/rdb/backend/detail/Node.cpp | 2 +- src/xrpld/app/tx/detail/AMMCreate.cpp | 2 +- src/xrpld/app/tx/detail/Batch.cpp | 1 + src/xrpld/app/tx/detail/Batch.h | 1 - src/xrpld/app/tx/detail/CancelCheck.cpp | 2 +- src/xrpld/app/tx/detail/CashCheck.cpp | 2 +- src/xrpld/app/tx/detail/CreateOffer.cpp | 2 +- src/xrpld/app/tx/detail/CreateTicket.cpp | 1 + src/xrpld/app/tx/detail/CreateTicket.h | 1 - src/xrpld/app/tx/detail/Escrow.cpp | 6 +- src/xrpld/app/tx/detail/SetAccount.cpp | 1 - src/xrpld/app/tx/detail/Transactor.cpp | 3 +- src/xrpld/app/tx/detail/apply.cpp | 3 +- src/xrpld/overlay/detail/OverlayImpl.cpp | 2 +- src/xrpld/overlay/detail/PeerImp.cpp | 2 +- src/xrpld/overlay/detail/PeerImp.h | 2 +- src/xrpld/rpc/handlers/Simulate.cpp | 2 +- 60 files changed, 385 insertions(+), 228 deletions(-) rename {src/xrpld => include/xrpl}/conditions/Condition.h (98%) rename {src/xrpld => include/xrpl}/conditions/Fulfillment.h (98%) rename {src/xrpld => include/xrpl}/conditions/detail/PreimageSha256.h (95%) rename {src/xrpld => include/xrpl}/conditions/detail/error.h (100%) rename {src/xrpld => include/xrpl}/conditions/detail/utils.h (98%) rename {src/xrpld/app/misc => include/xrpl/core}/HashRouter.h (99%) rename {src/xrpld/app => include/xrpl}/ledger/AcceptedLedgerTx.h (92%) rename {src/xrpld/app => include/xrpl}/ledger/BookListeners.h (100%) create mode 100644 include/xrpl/ledger/OrderBookDB.h rename src/{xrpld/conditions/detail => libxrpl/conditions}/Condition.cpp (97%) rename src/{xrpld/conditions/detail => libxrpl/conditions}/Fulfillment.cpp (94%) rename src/{xrpld/conditions/detail => libxrpl/conditions}/error.cpp (98%) rename src/{xrpld/app/misc => libxrpl/core}/HashRouter.cpp (69%) rename src/{xrpld/app => libxrpl}/ledger/AcceptedLedgerTx.cpp (96%) rename src/{xrpld/app => libxrpl}/ledger/BookListeners.cpp (95%) delete mode 100644 src/xrpld/app/ledger/OrderBookDB.h rename src/xrpld/app/ledger/{OrderBookDB.cpp => OrderBookDBImpl.cpp} (84%) create mode 100644 src/xrpld/app/ledger/OrderBookDBImpl.h create mode 100644 src/xrpld/app/misc/detail/setup_HashRouter.cpp create mode 100644 src/xrpld/app/misc/setup_HashRouter.h diff --git a/.github/scripts/levelization/results/ordering.txt b/.github/scripts/levelization/results/ordering.txt index 1de6f803f3..5f8812c49b 100644 --- a/.github/scripts/levelization/results/ordering.txt +++ b/.github/scripts/levelization/results/ordering.txt @@ -1,4 +1,6 @@ libxrpl.basics > xrpl.basics +libxrpl.conditions > xrpl.basics +libxrpl.conditions > xrpl.conditions libxrpl.core > xrpl.basics libxrpl.core > xrpl.core libxrpl.crypto > xrpl.basics @@ -56,7 +58,7 @@ test.basics > xrpl.json test.basics > xrpl.protocol test.beast > xrpl.basics test.conditions > xrpl.basics -test.conditions > xrpld.conditions +test.conditions > xrpl.conditions test.consensus > test.csf test.consensus > test.toplevel test.consensus > test.unit_test @@ -158,6 +160,8 @@ test.unit_test > xrpl.basics tests.libxrpl > xrpl.basics tests.libxrpl > xrpl.json tests.libxrpl > xrpl.net +xrpl.conditions > xrpl.basics +xrpl.conditions > xrpl.protocol xrpl.core > xrpl.basics xrpl.core > xrpl.json xrpl.core > xrpl.ledger @@ -165,6 +169,7 @@ xrpl.core > xrpl.protocol xrpl.json > xrpl.basics xrpl.ledger > xrpl.basics xrpl.ledger > xrpl.protocol +xrpl.ledger > xrpl.server xrpl.net > xrpl.basics xrpl.nodestore > xrpl.basics xrpl.nodestore > xrpl.protocol @@ -179,7 +184,6 @@ xrpl.resource > xrpl.protocol xrpl.server > xrpl.basics xrpl.server > xrpl.core xrpl.server > xrpl.json -xrpl.server > xrpl.ledger xrpl.server > xrpl.protocol xrpl.server > xrpl.rdb xrpl.server > xrpl.resource @@ -189,8 +193,8 @@ xrpl.shamap > xrpl.nodestore xrpl.shamap > xrpl.protocol xrpld.app > test.unit_test xrpld.app > xrpl.basics +xrpld.app > xrpl.conditions xrpld.app > xrpl.core -xrpld.app > xrpld.conditions xrpld.app > xrpld.consensus xrpld.app > xrpld.core xrpld.app > xrpl.json @@ -202,8 +206,6 @@ xrpld.app > xrpl.rdb xrpld.app > xrpl.resource xrpld.app > xrpl.server xrpld.app > xrpl.shamap -xrpld.conditions > xrpl.basics -xrpld.conditions > xrpl.protocol xrpld.consensus > xrpl.basics xrpld.consensus > xrpl.json xrpld.consensus > xrpl.protocol diff --git a/cmake/XrplCore.cmake b/cmake/XrplCore.cmake index ba14899bd9..3380ca85cd 100644 --- a/cmake/XrplCore.cmake +++ b/cmake/XrplCore.cmake @@ -98,9 +98,18 @@ add_module(xrpl server) target_link_libraries(xrpl.libxrpl.server PUBLIC xrpl.libxrpl.protocol xrpl.libxrpl.core xrpl.libxrpl.rdb xrpl.libxrpl.resource) +add_module(xrpl conditions) +target_link_libraries(xrpl.libxrpl.conditions PUBLIC xrpl.libxrpl.server) + add_module(xrpl ledger) -target_link_libraries(xrpl.libxrpl.ledger PUBLIC xrpl.libxrpl.basics xrpl.libxrpl.json xrpl.libxrpl.protocol - xrpl.libxrpl.rdb) +target_link_libraries( + xrpl.libxrpl.ledger + PUBLIC xrpl.libxrpl.basics + xrpl.libxrpl.json + xrpl.libxrpl.protocol + xrpl.libxrpl.rdb + xrpl.libxrpl.server + xrpl.libxrpl.conditions) add_library(xrpl.libxrpl) set_target_properties(xrpl.libxrpl PROPERTIES OUTPUT_NAME xrpl) @@ -115,6 +124,7 @@ target_link_modules( PUBLIC basics beast + conditions core crypto json diff --git a/cmake/XrplInstall.cmake b/cmake/XrplInstall.cmake index 340dca553b..d2fef5d488 100644 --- a/cmake/XrplInstall.cmake +++ b/cmake/XrplInstall.cmake @@ -20,6 +20,7 @@ install(TARGETS common xrpl.libxrpl xrpl.libxrpl.basics xrpl.libxrpl.beast + xrpl.libxrpl.conditions xrpl.libxrpl.core xrpl.libxrpl.crypto xrpl.libxrpl.json diff --git a/src/xrpld/conditions/Condition.h b/include/xrpl/conditions/Condition.h similarity index 98% rename from src/xrpld/conditions/Condition.h rename to include/xrpl/conditions/Condition.h index 50872e75ef..6b306a3982 100644 --- a/src/xrpld/conditions/Condition.h +++ b/include/xrpl/conditions/Condition.h @@ -1,9 +1,8 @@ #pragma once -#include - #include #include +#include #include #include diff --git a/src/xrpld/conditions/Fulfillment.h b/include/xrpl/conditions/Fulfillment.h similarity index 98% rename from src/xrpld/conditions/Fulfillment.h rename to include/xrpl/conditions/Fulfillment.h index 840e9f9993..04d0b2aa1e 100644 --- a/src/xrpld/conditions/Fulfillment.h +++ b/include/xrpl/conditions/Fulfillment.h @@ -1,9 +1,8 @@ #pragma once -#include - #include #include +#include namespace xrpl { namespace cryptoconditions { diff --git a/src/xrpld/conditions/detail/PreimageSha256.h b/include/xrpl/conditions/detail/PreimageSha256.h similarity index 95% rename from src/xrpld/conditions/detail/PreimageSha256.h rename to include/xrpl/conditions/detail/PreimageSha256.h index f3ce1a03e0..8726473c2d 100644 --- a/src/xrpld/conditions/detail/PreimageSha256.h +++ b/include/xrpl/conditions/detail/PreimageSha256.h @@ -1,11 +1,10 @@ #pragma once -#include -#include -#include - #include #include +#include +#include +#include #include #include diff --git a/src/xrpld/conditions/detail/error.h b/include/xrpl/conditions/detail/error.h similarity index 100% rename from src/xrpld/conditions/detail/error.h rename to include/xrpl/conditions/detail/error.h diff --git a/src/xrpld/conditions/detail/utils.h b/include/xrpl/conditions/detail/utils.h similarity index 98% rename from src/xrpld/conditions/detail/utils.h rename to include/xrpl/conditions/detail/utils.h index 2a4187718b..17d93d43b5 100644 --- a/src/xrpld/conditions/detail/utils.h +++ b/include/xrpl/conditions/detail/utils.h @@ -1,9 +1,8 @@ #pragma once -#include - #include #include +#include #include diff --git a/src/xrpld/app/misc/HashRouter.h b/include/xrpl/core/HashRouter.h similarity index 99% rename from src/xrpld/app/misc/HashRouter.h rename to include/xrpl/core/HashRouter.h index ad6da520bd..dfc57081ee 100644 --- a/src/xrpld/app/misc/HashRouter.h +++ b/include/xrpl/core/HashRouter.h @@ -251,7 +251,4 @@ private: beast::aged_unordered_map> suppressionMap_; }; -HashRouter::Setup -setup_HashRouter(Config const&); - } // namespace xrpl diff --git a/include/xrpl/core/ServiceRegistry.h b/include/xrpl/core/ServiceRegistry.h index 86591a815f..fabf61f9e4 100644 --- a/include/xrpl/core/ServiceRegistry.h +++ b/include/xrpl/core/ServiceRegistry.h @@ -214,6 +214,13 @@ public: virtual Logs& logs() = 0; + virtual std::optional const& + trapTxID() const = 0; + + /** Retrieve the "wallet database" */ + virtual DatabaseCon& + getWalletDB() = 0; + // Temporary: Get the underlying Application for functions that haven't // been migrated yet. This should be removed once all code is migrated. virtual Application& diff --git a/src/xrpld/app/ledger/AcceptedLedgerTx.h b/include/xrpl/ledger/AcceptedLedgerTx.h similarity index 92% rename from src/xrpld/app/ledger/AcceptedLedgerTx.h rename to include/xrpl/ledger/AcceptedLedgerTx.h index 6c936bbcf2..d07016b860 100644 --- a/src/xrpld/app/ledger/AcceptedLedgerTx.h +++ b/include/xrpl/ledger/AcceptedLedgerTx.h @@ -1,15 +1,15 @@ #pragma once -#include - +#include +#include #include +#include +#include #include namespace xrpl { -class Logs; - /** A transaction that is in a closed ledger. diff --git a/src/xrpld/app/ledger/BookListeners.h b/include/xrpl/ledger/BookListeners.h similarity index 100% rename from src/xrpld/app/ledger/BookListeners.h rename to include/xrpl/ledger/BookListeners.h diff --git a/include/xrpl/ledger/OrderBookDB.h b/include/xrpl/ledger/OrderBookDB.h new file mode 100644 index 0000000000..3d689607bf --- /dev/null +++ b/include/xrpl/ledger/OrderBookDB.h @@ -0,0 +1,93 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace xrpl { + +/** Tracks order books in the ledger. + + This interface provides access to order book information, including: + - Which order books exist in the ledger + - Querying order books by issue + - Managing order book subscriptions + + The order book database is updated as ledgers are accepted and provides + efficient lookup of order book information for pathfinding and client + subscriptions. +*/ +class OrderBookDB +{ +public: + virtual ~OrderBookDB() = default; + + /** Initialize or update the order book database with a new ledger. + + This method should be called when a new ledger is accepted to update + the order book database with the current state of all order books. + + @param ledger The ledger to scan for order books + */ + virtual void + setup(std::shared_ptr const& ledger) = 0; + + /** Add an order book to track. + + @param book The order book to add + */ + virtual void + addOrderBook(Book const& book) = 0; + + /** Get all order books that want a specific issue. + + Returns a list of all order books where the taker pays the specified + issue. This is useful for pathfinding to find all possible next hops + from a given currency. + + @param issue The issue to search for + @param domain Optional domain restriction for the order book + @return Vector of books that want this issue + */ + virtual std::vector + getBooksByTakerPays(Issue const& issue, std::optional const& domain = std::nullopt) = 0; + + /** Get the count of order books that want a specific issue. + + @param issue The issue to search for + @param domain Optional domain restriction for the order book + @return Number of books that want this issue + */ + virtual int + getBookSize(Issue const& issue, std::optional const& domain = std::nullopt) = 0; + + /** Check if an order book to XRP exists for the given issue. + + @param issue The issue to check + @param domain Optional domain restriction for the order book + @return true if a book from this issue to XRP exists + */ + virtual bool + isBookToXRP(Issue const& issue, std::optional domain = std::nullopt) = 0; + + virtual void + processTxn( + std::shared_ptr const& ledger, + AcceptedLedgerTx const& alTx, + MultiApiJson const& jvObj) = 0; + + virtual BookListeners::pointer + getBookListeners(Book const&) = 0; + virtual BookListeners::pointer + makeBookListeners(Book const&) = 0; +}; + +} // namespace xrpl diff --git a/include/xrpl/server/NetworkOPs.h b/include/xrpl/server/NetworkOPs.h index cfe0021c07..ce55f667f7 100644 --- a/include/xrpl/server/NetworkOPs.h +++ b/include/xrpl/server/NetworkOPs.h @@ -2,7 +2,6 @@ #include #include -#include #include #include #include @@ -19,6 +18,8 @@ namespace xrpl { // Master operational handler, server sequencer, network tracker class Peer; +class STTx; +class ReadView; class LedgerMaster; class Transaction; class ValidatorKeys; diff --git a/src/xrpld/conditions/detail/Condition.cpp b/src/libxrpl/conditions/Condition.cpp similarity index 97% rename from src/xrpld/conditions/detail/Condition.cpp rename to src/libxrpl/conditions/Condition.cpp index 9cac75121d..30beba3402 100644 --- a/src/xrpld/conditions/detail/Condition.cpp +++ b/src/libxrpl/conditions/Condition.cpp @@ -1,6 +1,6 @@ -#include -#include -#include +#include +#include +#include namespace xrpl { namespace cryptoconditions { diff --git a/src/xrpld/conditions/detail/Fulfillment.cpp b/src/libxrpl/conditions/Fulfillment.cpp similarity index 94% rename from src/xrpld/conditions/detail/Fulfillment.cpp rename to src/libxrpl/conditions/Fulfillment.cpp index 9ecaa44ab8..11581a8705 100644 --- a/src/xrpld/conditions/detail/Fulfillment.cpp +++ b/src/libxrpl/conditions/Fulfillment.cpp @@ -1,9 +1,8 @@ -#include -#include -#include -#include - #include +#include +#include +#include +#include namespace xrpl { namespace cryptoconditions { diff --git a/src/xrpld/conditions/detail/error.cpp b/src/libxrpl/conditions/error.cpp similarity index 98% rename from src/xrpld/conditions/detail/error.cpp rename to src/libxrpl/conditions/error.cpp index 04c8d03fbb..3124be6fdd 100644 --- a/src/xrpld/conditions/detail/error.cpp +++ b/src/libxrpl/conditions/error.cpp @@ -1,6 +1,5 @@ -#include - #include +#include #include diff --git a/src/xrpld/app/misc/HashRouter.cpp b/src/libxrpl/core/HashRouter.cpp similarity index 69% rename from src/xrpld/app/misc/HashRouter.cpp rename to src/libxrpl/core/HashRouter.cpp index eca46c9872..dff1394f77 100644 --- a/src/xrpld/app/misc/HashRouter.cpp +++ b/src/libxrpl/core/HashRouter.cpp @@ -1,5 +1,4 @@ -#include -#include +#include namespace xrpl { @@ -108,38 +107,4 @@ HashRouter::shouldRelay(uint256 const& key) -> std::optional( - "HashRouter hold time must be at least 12 seconds (the " - "approximate validation time for three ledgers)."); - setup.holdTime = seconds(tmp); - } - if (set(tmp, "relay_time", section)) - { - if (tmp < 8) - Throw( - "HashRouter relay time must be at least 8 seconds (the " - "approximate validation time for two ledgers)."); - setup.relayTime = seconds(tmp); - } - if (setup.relayTime > setup.holdTime) - { - Throw("HashRouter relay time must be less than or equal to hold time"); - } - - return setup; -} - } // namespace xrpl diff --git a/src/xrpld/app/ledger/AcceptedLedgerTx.cpp b/src/libxrpl/ledger/AcceptedLedgerTx.cpp similarity index 96% rename from src/xrpld/app/ledger/AcceptedLedgerTx.cpp rename to src/libxrpl/ledger/AcceptedLedgerTx.cpp index 2ef05e511d..3f35f7cbc2 100644 --- a/src/xrpld/app/ledger/AcceptedLedgerTx.cpp +++ b/src/libxrpl/ledger/AcceptedLedgerTx.cpp @@ -1,7 +1,7 @@ -#include - #include #include +#include +#include #include #include diff --git a/src/xrpld/app/ledger/BookListeners.cpp b/src/libxrpl/ledger/BookListeners.cpp similarity index 95% rename from src/xrpld/app/ledger/BookListeners.cpp rename to src/libxrpl/ledger/BookListeners.cpp index 4d72c6f3b3..9ba25b783a 100644 --- a/src/xrpld/app/ledger/BookListeners.cpp +++ b/src/libxrpl/ledger/BookListeners.cpp @@ -1,4 +1,4 @@ -#include +#include namespace xrpl { diff --git a/src/test/app/Batch_test.cpp b/src/test/app/Batch_test.cpp index 133f10cd28..a4e00f26db 100644 --- a/src/test/app/Batch_test.cpp +++ b/src/test/app/Batch_test.cpp @@ -2,11 +2,11 @@ #include #include -#include #include #include #include +#include #include #include #include diff --git a/src/test/app/HashRouter_test.cpp b/src/test/app/HashRouter_test.cpp index 03bb28e35a..753922a67d 100644 --- a/src/test/app/HashRouter_test.cpp +++ b/src/test/app/HashRouter_test.cpp @@ -1,8 +1,9 @@ -#include +#include #include #include #include +#include namespace xrpl { namespace test { diff --git a/src/test/app/NetworkOPs_test.cpp b/src/test/app/NetworkOPs_test.cpp index ffca1ed79d..a4bdae9101 100644 --- a/src/test/app/NetworkOPs_test.cpp +++ b/src/test/app/NetworkOPs_test.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include namespace xrpl { namespace test { diff --git a/src/test/conditions/PreimageSha256_test.cpp b/src/test/conditions/PreimageSha256_test.cpp index 71ba526be3..c3508758a7 100644 --- a/src/test/conditions/PreimageSha256_test.cpp +++ b/src/test/conditions/PreimageSha256_test.cpp @@ -1,12 +1,11 @@ -#include -#include -#include - #include #include #include #include #include +#include +#include +#include #include #include diff --git a/src/xrpld/app/consensus/RCLConsensus.cpp b/src/xrpld/app/consensus/RCLConsensus.cpp index 4ebd1a502f..ad581585b1 100644 --- a/src/xrpld/app/consensus/RCLConsensus.cpp +++ b/src/xrpld/app/consensus/RCLConsensus.cpp @@ -8,7 +8,6 @@ #include #include #include -#include #include #include #include @@ -21,6 +20,7 @@ #include #include #include +#include #include #include #include diff --git a/src/xrpld/app/ledger/AcceptedLedger.cpp b/src/xrpld/app/ledger/AcceptedLedger.cpp index 89806c2337..7ad43b2d81 100644 --- a/src/xrpld/app/ledger/AcceptedLedger.cpp +++ b/src/xrpld/app/ledger/AcceptedLedger.cpp @@ -4,7 +4,7 @@ namespace xrpl { -AcceptedLedger::AcceptedLedger(std::shared_ptr const& ledger, Application& app) : mLedger(ledger) +AcceptedLedger::AcceptedLedger(std::shared_ptr const& ledger) : mLedger(ledger) { transactions_.reserve(256); diff --git a/src/xrpld/app/ledger/AcceptedLedger.h b/src/xrpld/app/ledger/AcceptedLedger.h index c0f186c781..23cee6ce35 100644 --- a/src/xrpld/app/ledger/AcceptedLedger.h +++ b/src/xrpld/app/ledger/AcceptedLedger.h @@ -1,6 +1,8 @@ #pragma once -#include +#include +#include +#include namespace xrpl { @@ -23,7 +25,7 @@ namespace xrpl { class AcceptedLedger : public CountedObject { public: - AcceptedLedger(std::shared_ptr const& ledger, Application& app); + AcceptedLedger(std::shared_ptr const& ledger); std::shared_ptr const& getLedger() const diff --git a/src/xrpld/app/ledger/Ledger.cpp b/src/xrpld/app/ledger/Ledger.cpp index 0f44601679..d75e4dd22e 100644 --- a/src/xrpld/app/ledger/Ledger.cpp +++ b/src/xrpld/app/ledger/Ledger.cpp @@ -3,13 +3,13 @@ #include #include #include -#include #include #include #include #include #include +#include #include #include #include diff --git a/src/xrpld/app/ledger/OrderBookDB.h b/src/xrpld/app/ledger/OrderBookDB.h deleted file mode 100644 index da604d7e22..0000000000 --- a/src/xrpld/app/ledger/OrderBookDB.h +++ /dev/null @@ -1,75 +0,0 @@ -#pragma once - -#include -#include -#include - -#include -#include - -#include -#include - -namespace xrpl { - -class OrderBookDB -{ -public: - explicit OrderBookDB(Application& app); - - void - setup(std::shared_ptr const& ledger); - void - update(std::shared_ptr const& ledger); - - void - addOrderBook(Book const&); - - /** @return a list of all orderbooks that want this issuerID and currencyID. - */ - std::vector - getBooksByTakerPays(Issue const&, std::optional const& domain = std::nullopt); - - /** @return a count of all orderbooks that want this issuerID and - currencyID. */ - int - getBookSize(Issue const&, std::optional const& domain = std::nullopt); - - bool - isBookToXRP(Issue const&, std::optional domain = std::nullopt); - - BookListeners::pointer - getBookListeners(Book const&); - BookListeners::pointer - makeBookListeners(Book const&); - - // see if this txn effects any orderbook - void - processTxn(std::shared_ptr const& ledger, AcceptedLedgerTx const& alTx, MultiApiJson const& jvObj); - -private: - Application& app_; - - // Maps order books by "issue in" to "issue out": - hardened_hash_map> allBooks_; - - hardened_hash_map, hardened_hash_set> domainBooks_; - - // does an order book to XRP exist - hash_set xrpBooks_; - - // does an order book to XRP exist - hash_set> xrpDomainBooks_; - - std::recursive_mutex mLock; - - using BookToListenersMap = hash_map; - - BookToListenersMap mListeners; - - std::atomic seq_; - - beast::Journal const j_; -}; - -} // namespace xrpl diff --git a/src/xrpld/app/ledger/OrderBookDB.cpp b/src/xrpld/app/ledger/OrderBookDBImpl.cpp similarity index 84% rename from src/xrpld/app/ledger/OrderBookDB.cpp rename to src/xrpld/app/ledger/OrderBookDBImpl.cpp index 6450544f92..62c03fb7ca 100644 --- a/src/xrpld/app/ledger/OrderBookDB.cpp +++ b/src/xrpld/app/ledger/OrderBookDBImpl.cpp @@ -1,6 +1,5 @@ #include -#include -#include +#include #include #include @@ -11,14 +10,25 @@ namespace xrpl { -OrderBookDB::OrderBookDB(Application& app) : app_(app), seq_(0), j_(app.journal("OrderBookDB")) +OrderBookDBImpl::OrderBookDBImpl(ServiceRegistry& registry, OrderBookDBConfig const& config) + : registry_(registry) + , pathSearchMax_(config.pathSearchMax) + , standalone_(config.standalone) + , seq_(0) + , j_(registry.journal("OrderBookDB")) { } -void -OrderBookDB::setup(std::shared_ptr const& ledger) +std::unique_ptr +make_OrderBookDB(ServiceRegistry& registry, OrderBookDBConfig const& config) { - if (!app_.config().standalone() && app_.getOPs().isNeedNetworkLedger()) + return std::make_unique(registry, config); +} + +void +OrderBookDBImpl::setup(std::shared_ptr const& ledger) +{ + if (!standalone_ && registry_.getOPs().isNeedNetworkLedger()) { JLOG(j_.warn()) << "Eliding full order book update: no ledger"; return; @@ -40,19 +50,20 @@ OrderBookDB::setup(std::shared_ptr const& ledger) JLOG(j_.debug()) << "Full order book update: " << seq << " to " << ledger->seq(); - if (app_.config().PATH_SEARCH_MAX != 0) + if (pathSearchMax_ != 0) { - if (app_.config().standalone()) + if (standalone_) update(ledger); else - app_.getJobQueue().addJob(jtUPDATE_PF, "OrderBookUpd", [this, ledger]() { update(ledger); }); + registry_.getJobQueue().addJob( + jtUPDATE_PF, "OrderBookUpd" + std::to_string(ledger->seq()), [this, ledger]() { update(ledger); }); } } void -OrderBookDB::update(std::shared_ptr const& ledger) +OrderBookDBImpl::update(std::shared_ptr const& ledger) { - if (app_.config().PATH_SEARCH_MAX == 0) + if (pathSearchMax_ == 0) return; // pathfinding has been disabled // A newer full update job is pending @@ -79,7 +90,7 @@ OrderBookDB::update(std::shared_ptr const& ledger) { for (auto& sle : ledger->sles) { - if (app_.isStopping()) + if (registry_.isStopping()) { JLOG(j_.info()) << "Update halted because the process is stopping"; seq_.store(0); @@ -143,11 +154,11 @@ OrderBookDB::update(std::shared_ptr const& ledger) xrpDomainBooks_.swap(xrpDomainBooks); } - app_.getLedgerMaster().newOrderBookDB(); + registry_.getLedgerMaster().newOrderBookDB(); } void -OrderBookDB::addOrderBook(Book const& book) +OrderBookDBImpl::addOrderBook(Book const& book) { bool toXRP = isXRP(book.out); @@ -166,7 +177,7 @@ OrderBookDB::addOrderBook(Book const& book) // return list of all orderbooks that want this issuerID and currencyID std::vector -OrderBookDB::getBooksByTakerPays(Issue const& issue, std::optional const& domain) +OrderBookDBImpl::getBooksByTakerPays(Issue const& issue, std::optional const& domain) { std::vector ret; @@ -194,7 +205,7 @@ OrderBookDB::getBooksByTakerPays(Issue const& issue, std::optional cons } int -OrderBookDB::getBookSize(Issue const& issue, std::optional const& domain) +OrderBookDBImpl::getBookSize(Issue const& issue, std::optional const& domain) { std::lock_guard sl(mLock); @@ -213,7 +224,7 @@ OrderBookDB::getBookSize(Issue const& issue, std::optional const& domai } bool -OrderBookDB::isBookToXRP(Issue const& issue, std::optional domain) +OrderBookDBImpl::isBookToXRP(Issue const& issue, std::optional domain) { std::lock_guard sl(mLock); if (domain) @@ -222,7 +233,7 @@ OrderBookDB::isBookToXRP(Issue const& issue, std::optional domain) } BookListeners::pointer -OrderBookDB::makeBookListeners(Book const& book) +OrderBookDBImpl::makeBookListeners(Book const& book) { std::lock_guard sl(mLock); auto ret = getBookListeners(book); @@ -242,7 +253,7 @@ OrderBookDB::makeBookListeners(Book const& book) } BookListeners::pointer -OrderBookDB::getBookListeners(Book const& book) +OrderBookDBImpl::getBookListeners(Book const& book) { BookListeners::pointer ret; std::lock_guard sl(mLock); @@ -257,7 +268,7 @@ OrderBookDB::getBookListeners(Book const& book) // Based on the meta, send the meta to the streams that are listening. // We need to determine which streams a given meta effects. void -OrderBookDB::processTxn( +OrderBookDBImpl::processTxn( std::shared_ptr const& ledger, AcceptedLedgerTx const& alTx, MultiApiJson const& jvObj) diff --git a/src/xrpld/app/ledger/OrderBookDBImpl.h b/src/xrpld/app/ledger/OrderBookDBImpl.h new file mode 100644 index 0000000000..69739451c4 --- /dev/null +++ b/src/xrpld/app/ledger/OrderBookDBImpl.h @@ -0,0 +1,93 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +#include +#include + +namespace xrpl { + +/** Configuration for OrderBookDB */ +struct OrderBookDBConfig +{ + int pathSearchMax; + bool standalone; +}; + +/** Create an OrderBookDB instance. + + @param registry Service registry for accessing other services + @param config Configuration parameters + @return A new OrderBookDB instance +*/ +std::unique_ptr +make_OrderBookDB(ServiceRegistry& registry, OrderBookDBConfig const& config); + +class OrderBookDBImpl final : public OrderBookDB +{ +public: + OrderBookDBImpl(ServiceRegistry& registry, OrderBookDBConfig const& config); + + // OrderBookDB interface implementation + void + setup(std::shared_ptr const& ledger) override; + + void + addOrderBook(Book const& book) override; + + std::vector + getBooksByTakerPays(Issue const& issue, std::optional const& domain = std::nullopt) override; + + int + getBookSize(Issue const& issue, std::optional const& domain = std::nullopt) override; + + bool + isBookToXRP(Issue const& issue, std::optional domain = std::nullopt) override; + + // OrderBookDBImpl-specific methods + void + update(std::shared_ptr const& ledger); + + // see if this txn effects any orderbook + void + processTxn(std::shared_ptr const& ledger, AcceptedLedgerTx const& alTx, MultiApiJson const& jvObj) + override; + + BookListeners::pointer + getBookListeners(Book const&) override; + BookListeners::pointer + makeBookListeners(Book const&) override; + +private: + ServiceRegistry& registry_; + int const pathSearchMax_; + bool const standalone_; + + // Maps order books by "issue in" to "issue out": + hardened_hash_map> allBooks_; + + hardened_hash_map, hardened_hash_set> domainBooks_; + + // does an order book to XRP exist + hash_set xrpBooks_; + + // does an order book to XRP exist + hash_set> xrpDomainBooks_; + + std::recursive_mutex mLock; + + using BookToListenersMap = hash_map; + + BookToListenersMap mListeners; + + std::atomic seq_; + + beast::Journal const j_; +}; + +} // namespace xrpl diff --git a/src/xrpld/app/ledger/detail/LedgerMaster.cpp b/src/xrpld/app/ledger/detail/LedgerMaster.cpp index f8ef91a83f..5538ebcb96 100644 --- a/src/xrpld/app/ledger/detail/LedgerMaster.cpp +++ b/src/xrpld/app/ledger/detail/LedgerMaster.cpp @@ -3,7 +3,6 @@ #include #include #include -#include #include #include #include @@ -24,6 +23,7 @@ #include #include #include +#include #include #include #include diff --git a/src/xrpld/app/ledger/detail/OpenLedger.cpp b/src/xrpld/app/ledger/detail/OpenLedger.cpp index 698862d4da..d621285619 100644 --- a/src/xrpld/app/ledger/detail/OpenLedger.cpp +++ b/src/xrpld/app/ledger/detail/OpenLedger.cpp @@ -1,11 +1,11 @@ #include #include -#include #include #include #include #include +#include #include #include diff --git a/src/xrpld/app/main/Application.cpp b/src/xrpld/app/main/Application.cpp index 3f7b6c5596..4612479b78 100644 --- a/src/xrpld/app/main/Application.cpp +++ b/src/xrpld/app/main/Application.cpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include #include #include @@ -16,13 +16,13 @@ #include #include #include -#include #include #include #include #include #include #include +#include #include #include #include @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -164,8 +165,7 @@ public: std::unique_ptr m_nodeStore; NodeFamily nodeFamily_; - // VFALCO TODO Make OrderBookDB abstract - OrderBookDB m_orderBookDB; + std::unique_ptr m_orderBookDB; std::unique_ptr m_pathRequests; std::unique_ptr m_ledgerMaster; std::unique_ptr ledgerCleaner_; @@ -296,7 +296,7 @@ public: , nodeFamily_(*this, *m_collectorManager) - , m_orderBookDB(*this) + , m_orderBookDB(make_OrderBookDB(*this, {config_->PATH_SEARCH_MAX, config_->standalone()})) , m_pathRequests( std::make_unique(*this, logs_->journal("PathRequest"), m_collectorManager->collector())) @@ -613,7 +613,7 @@ public: OrderBookDB& getOrderBookDB() override { - return m_orderBookDB; + return *m_orderBookDB; } PathRequests& @@ -1170,7 +1170,7 @@ ApplicationImp::setup(boost::program_options::variables_map const& cmdline) m_ledgerMaster->setLedgerRangePresent(forcedRange->first, forcedRange->second); } - m_orderBookDB.setup(getLedgerMaster().getCurrentLedger()); + m_orderBookDB->setup(getLedgerMaster().getCurrentLedger()); nodeIdentity_ = getNodeIdentity(*this, cmdline); diff --git a/src/xrpld/app/main/Application.h b/src/xrpld/app/main/Application.h index 5ecc84c11c..a0fea69171 100644 --- a/src/xrpld/app/main/Application.h +++ b/src/xrpld/app/main/Application.h @@ -153,17 +153,10 @@ public: virtual int fdRequired() const = 0; - /** Retrieve the "wallet database" */ - virtual DatabaseCon& - getWalletDB() = 0; - /** Ensure that a newly-started validator does not sign proposals older * than the last ledger it persisted. */ virtual LedgerIndex getMaxDisallowedLedger() = 0; - - virtual std::optional const& - trapTxID() const = 0; }; std::unique_ptr diff --git a/src/xrpld/app/misc/AmendmentTable.h b/src/xrpld/app/misc/AmendmentTable.h index 94ac9608a7..bfef818b0a 100644 --- a/src/xrpld/app/misc/AmendmentTable.h +++ b/src/xrpld/app/misc/AmendmentTable.h @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -163,7 +164,7 @@ public: std::unique_ptr make_AmendmentTable( - Application& app, + ServiceRegistry& registry, std::chrono::seconds majorityTime, std::vector const& supported, Section const& enabled, diff --git a/src/xrpld/app/misc/NetworkOPs.cpp b/src/xrpld/app/misc/NetworkOPs.cpp index 9e60a8bdc0..8732f9610d 100644 --- a/src/xrpld/app/misc/NetworkOPs.cpp +++ b/src/xrpld/app/misc/NetworkOPs.cpp @@ -7,13 +7,11 @@ #include #include #include -#include #include #include #include #include #include -#include #include #include #include @@ -39,9 +37,11 @@ #include #include #include +#include #include #include #include +#include #include #include #include @@ -2824,7 +2824,7 @@ NetworkOPsImp::pubLedger(std::shared_ptr const& lpAccepted) std::shared_ptr alpAccepted = registry_.getAcceptedLedgerCache().fetch(lpAccepted->header().hash); if (!alpAccepted) { - alpAccepted = std::make_shared(lpAccepted, registry_.app()); + alpAccepted = std::make_shared(lpAccepted); registry_.getAcceptedLedgerCache().canonicalize_replace_client(lpAccepted->header().hash, alpAccepted); } diff --git a/src/xrpld/app/misc/detail/AmendmentTable.cpp b/src/xrpld/app/misc/detail/AmendmentTable.cpp index 3addfd2235..767a3d87f9 100644 --- a/src/xrpld/app/misc/detail/AmendmentTable.cpp +++ b/src/xrpld/app/misc/detail/AmendmentTable.cpp @@ -1,7 +1,7 @@ -#include #include #include +#include #include #include #include @@ -400,7 +400,7 @@ private: public: AmendmentTableImpl( - Application& app, + ServiceRegistry& registry, std::chrono::seconds majorityTime, std::vector const& supported, Section const& enabled, @@ -461,13 +461,17 @@ public: //------------------------------------------------------------------------------ AmendmentTableImpl::AmendmentTableImpl( - Application& app, + ServiceRegistry& registry, std::chrono::seconds majorityTime, std::vector const& supported, Section const& enabled, Section const& vetoed, beast::Journal journal) - : lastUpdateSeq_(0), majorityTime_(majorityTime), unsupportedEnabled_(false), j_(journal), db_(app.getWalletDB()) + : lastUpdateSeq_(0) + , majorityTime_(majorityTime) + , unsupportedEnabled_(false) + , j_(journal) + , db_(registry.getWalletDB()) { std::lock_guard lock(mutex_); @@ -957,14 +961,14 @@ AmendmentTableImpl::getJson(uint256 const& amendmentID, bool isAdmin) const std::unique_ptr make_AmendmentTable( - Application& app, + ServiceRegistry& registry, std::chrono::seconds majorityTime, std::vector const& supported, Section const& enabled, Section const& vetoed, beast::Journal journal) { - return std::make_unique(app, majorityTime, supported, enabled, vetoed, journal); + return std::make_unique(registry, majorityTime, supported, enabled, vetoed, journal); } } // namespace xrpl diff --git a/src/xrpld/app/misc/detail/Transaction.cpp b/src/xrpld/app/misc/detail/Transaction.cpp index 8ffbc47b08..d45c49c3c4 100644 --- a/src/xrpld/app/misc/detail/Transaction.cpp +++ b/src/xrpld/app/misc/detail/Transaction.cpp @@ -1,11 +1,11 @@ #include #include -#include #include #include #include #include +#include #include #include #include diff --git a/src/xrpld/app/misc/detail/ValidatorList.cpp b/src/xrpld/app/misc/detail/ValidatorList.cpp index 3a46d2baa1..4730df4983 100644 --- a/src/xrpld/app/misc/detail/ValidatorList.cpp +++ b/src/xrpld/app/misc/detail/ValidatorList.cpp @@ -1,4 +1,3 @@ -#include #include #include @@ -6,6 +5,7 @@ #include #include #include +#include #include #include #include diff --git a/src/xrpld/app/misc/detail/setup_HashRouter.cpp b/src/xrpld/app/misc/detail/setup_HashRouter.cpp new file mode 100644 index 0000000000..a0e63dd67e --- /dev/null +++ b/src/xrpld/app/misc/detail/setup_HashRouter.cpp @@ -0,0 +1,42 @@ +#include +#include + +#include + +namespace xrpl { + +HashRouter::Setup +setup_HashRouter(Config const& config) +{ + using namespace std::chrono; + + HashRouter::Setup setup; + auto const& section = config.section("hashrouter"); + + std::int32_t tmp{}; + + if (set(tmp, "hold_time", section)) + { + if (tmp < 12) + Throw( + "HashRouter hold time must be at least 12 seconds (the " + "approximate validation time for three ledgers)."); + setup.holdTime = seconds(tmp); + } + if (set(tmp, "relay_time", section)) + { + if (tmp < 8) + Throw( + "HashRouter relay time must be at least 8 seconds (the " + "approximate validation time for two ledgers)."); + setup.relayTime = seconds(tmp); + } + if (setup.relayTime > setup.holdTime) + { + Throw("HashRouter relay time must be less than or equal to hold time"); + } + + return setup; +} + +} // namespace xrpl diff --git a/src/xrpld/app/misc/setup_HashRouter.h b/src/xrpld/app/misc/setup_HashRouter.h new file mode 100644 index 0000000000..3054233b89 --- /dev/null +++ b/src/xrpld/app/misc/setup_HashRouter.h @@ -0,0 +1,17 @@ +#ifndef XRPLD_APP_MISC_SETUP_HASHROUTER_H_INCLUDED +#define XRPLD_APP_MISC_SETUP_HASHROUTER_H_INCLUDED + +#include + +namespace xrpl { + +// Forward declaration +class Config; + +/** Create HashRouter setup from configuration */ +HashRouter::Setup +setup_HashRouter(Config const& config); + +} // namespace xrpl + +#endif diff --git a/src/xrpld/app/paths/Pathfinder.cpp b/src/xrpld/app/paths/Pathfinder.cpp index b64ce0cc20..ea4fa2013a 100644 --- a/src/xrpld/app/paths/Pathfinder.cpp +++ b/src/xrpld/app/paths/Pathfinder.cpp @@ -1,4 +1,3 @@ -#include #include #include #include @@ -9,6 +8,7 @@ #include #include #include +#include #include #include diff --git a/src/xrpld/app/rdb/backend/detail/Node.cpp b/src/xrpld/app/rdb/backend/detail/Node.cpp index 328d07c0ab..01e036731c 100644 --- a/src/xrpld/app/rdb/backend/detail/Node.cpp +++ b/src/xrpld/app/rdb/backend/detail/Node.cpp @@ -203,7 +203,7 @@ saveValidatedLedger( aLedger = app.getAcceptedLedgerCache().fetch(ledger->header().hash); if (!aLedger) { - aLedger = std::make_shared(ledger, app); + aLedger = std::make_shared(ledger); app.getAcceptedLedgerCache().canonicalize_replace_client(ledger->header().hash, aLedger); } } diff --git a/src/xrpld/app/tx/detail/AMMCreate.cpp b/src/xrpld/app/tx/detail/AMMCreate.cpp index 4634ac79e0..aa75a18e30 100644 --- a/src/xrpld/app/tx/detail/AMMCreate.cpp +++ b/src/xrpld/app/tx/detail/AMMCreate.cpp @@ -1,8 +1,8 @@ -#include #include #include #include +#include #include #include #include diff --git a/src/xrpld/app/tx/detail/Batch.cpp b/src/xrpld/app/tx/detail/Batch.cpp index 34b08beb2f..81f39193cb 100644 --- a/src/xrpld/app/tx/detail/Batch.cpp +++ b/src/xrpld/app/tx/detail/Batch.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include diff --git a/src/xrpld/app/tx/detail/Batch.h b/src/xrpld/app/tx/detail/Batch.h index 8af8b2e020..17abec38c3 100644 --- a/src/xrpld/app/tx/detail/Batch.h +++ b/src/xrpld/app/tx/detail/Batch.h @@ -1,7 +1,6 @@ #pragma once #include -#include #include #include diff --git a/src/xrpld/app/tx/detail/CancelCheck.cpp b/src/xrpld/app/tx/detail/CancelCheck.cpp index 4ac04e9ffb..086a126eb4 100644 --- a/src/xrpld/app/tx/detail/CancelCheck.cpp +++ b/src/xrpld/app/tx/detail/CancelCheck.cpp @@ -1,8 +1,8 @@ -#include #include #include #include +#include #include #include #include diff --git a/src/xrpld/app/tx/detail/CashCheck.cpp b/src/xrpld/app/tx/detail/CashCheck.cpp index 9deee006d9..2cc25924a1 100644 --- a/src/xrpld/app/tx/detail/CashCheck.cpp +++ b/src/xrpld/app/tx/detail/CashCheck.cpp @@ -1,9 +1,9 @@ -#include #include #include #include #include +#include #include #include #include diff --git a/src/xrpld/app/tx/detail/CreateOffer.cpp b/src/xrpld/app/tx/detail/CreateOffer.cpp index fab406189b..666023233d 100644 --- a/src/xrpld/app/tx/detail/CreateOffer.cpp +++ b/src/xrpld/app/tx/detail/CreateOffer.cpp @@ -1,10 +1,10 @@ -#include #include #include #include #include #include +#include #include #include #include diff --git a/src/xrpld/app/tx/detail/CreateTicket.cpp b/src/xrpld/app/tx/detail/CreateTicket.cpp index e6965ca1cf..eb42904a0b 100644 --- a/src/xrpld/app/tx/detail/CreateTicket.cpp +++ b/src/xrpld/app/tx/detail/CreateTicket.cpp @@ -1,6 +1,7 @@ #include #include +#include #include #include #include diff --git a/src/xrpld/app/tx/detail/CreateTicket.h b/src/xrpld/app/tx/detail/CreateTicket.h index 2a6e1bb8cc..dd424e3756 100644 --- a/src/xrpld/app/tx/detail/CreateTicket.h +++ b/src/xrpld/app/tx/detail/CreateTicket.h @@ -1,6 +1,5 @@ #pragma once -#include #include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/Escrow.cpp b/src/xrpld/app/tx/detail/Escrow.cpp index 80d1f6c9da..dea9d3aa2b 100644 --- a/src/xrpld/app/tx/detail/Escrow.cpp +++ b/src/xrpld/app/tx/detail/Escrow.cpp @@ -1,11 +1,11 @@ -#include #include #include -#include -#include #include #include +#include +#include +#include #include #include #include diff --git a/src/xrpld/app/tx/detail/SetAccount.cpp b/src/xrpld/app/tx/detail/SetAccount.cpp index beca60c06b..41804c9211 100644 --- a/src/xrpld/app/tx/detail/SetAccount.cpp +++ b/src/xrpld/app/tx/detail/SetAccount.cpp @@ -1,6 +1,5 @@ #include #include -#include #include #include diff --git a/src/xrpld/app/tx/detail/Transactor.cpp b/src/xrpld/app/tx/detail/Transactor.cpp index b3b5d8b9bc..a7bb7992fb 100644 --- a/src/xrpld/app/tx/detail/Transactor.cpp +++ b/src/xrpld/app/tx/detail/Transactor.cpp @@ -1,11 +1,9 @@ -#include #include #include #include #include #include #include -#include #include #include @@ -15,6 +13,7 @@ #include #include #include +#include #include #include diff --git a/src/xrpld/app/tx/detail/apply.cpp b/src/xrpld/app/tx/detail/apply.cpp index 7babc415d5..1c7a509007 100644 --- a/src/xrpld/app/tx/detail/apply.cpp +++ b/src/xrpld/app/tx/detail/apply.cpp @@ -1,8 +1,9 @@ -#include #include #include #include +#include +#include #include #include diff --git a/src/xrpld/overlay/detail/OverlayImpl.cpp b/src/xrpld/overlay/detail/OverlayImpl.cpp index ceefab24f1..5b9f142001 100644 --- a/src/xrpld/overlay/detail/OverlayImpl.cpp +++ b/src/xrpld/overlay/detail/OverlayImpl.cpp @@ -1,4 +1,3 @@ -#include #include #include #include @@ -15,6 +14,7 @@ #include #include #include +#include #include #include #include diff --git a/src/xrpld/overlay/detail/PeerImp.cpp b/src/xrpld/overlay/detail/PeerImp.cpp index d66a57bae6..ec641487a8 100644 --- a/src/xrpld/overlay/detail/PeerImp.cpp +++ b/src/xrpld/overlay/detail/PeerImp.cpp @@ -3,7 +3,6 @@ #include #include #include -#include #include #include #include @@ -16,6 +15,7 @@ #include #include #include +#include #include #include #include diff --git a/src/xrpld/overlay/detail/PeerImp.h b/src/xrpld/overlay/detail/PeerImp.h index 65a6112159..d88314a9a5 100644 --- a/src/xrpld/overlay/detail/PeerImp.h +++ b/src/xrpld/overlay/detail/PeerImp.h @@ -2,7 +2,6 @@ #include #include -#include #include #include #include @@ -11,6 +10,7 @@ #include #include #include +#include #include #include #include diff --git a/src/xrpld/rpc/handlers/Simulate.cpp b/src/xrpld/rpc/handlers/Simulate.cpp index f44fc57261..58b40e2048 100644 --- a/src/xrpld/rpc/handlers/Simulate.cpp +++ b/src/xrpld/rpc/handlers/Simulate.cpp @@ -1,6 +1,5 @@ #include #include -#include #include #include #include @@ -10,6 +9,7 @@ #include #include +#include #include #include #include From 358c6d95bf3319689a2e35815614636aee384aad Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Fri, 13 Feb 2026 16:07:11 +0000 Subject: [PATCH 49/61] run sanitizer tests in parallel Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> --- .github/workflows/reusable-build-test-config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/reusable-build-test-config.yml b/.github/workflows/reusable-build-test-config.yml index aeac78d6eb..7b076400e9 100644 --- a/.github/workflows/reusable-build-test-config.yml +++ b/.github/workflows/reusable-build-test-config.yml @@ -233,7 +233,7 @@ jobs: working-directory: ${{ runner.os == 'Windows' && format('{0}/{1}', env.BUILD_DIR, inputs.build_type) || env.BUILD_DIR }} env: BUILD_NPROC: ${{ steps.nproc.outputs.nproc }} - PARALLELISM: ${{ env.SANITIZERS_ENABLED == 'true' && '1' || steps.nproc.outputs.nproc }} + PARALLELISM: ${{ env.SANITIZERS_ENABLED == 'true' && steps.nproc.outputs.nproc || steps.nproc.outputs.nproc }} run: | ./xrpld --unittest --unittest-jobs "${PARALLELISM}" From ea2ab17b95a3835d77e134de23f1d4d7b5a3a75d Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Fri, 13 Feb 2026 16:53:08 +0000 Subject: [PATCH 50/61] supp. coro releated asan errors Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> --- cspell.config.yaml | 1 + sanitizers/suppressions/asan.supp | 12 ++---------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/cspell.config.yaml b/cspell.config.yaml index b50dd82ebf..098a191988 100644 --- a/cspell.config.yaml +++ b/cspell.config.yaml @@ -101,6 +101,7 @@ words: - fcontext - finalizers - firewalled + - flackiness - fmtdur - fsanitize - funclets diff --git a/sanitizers/suppressions/asan.supp b/sanitizers/suppressions/asan.supp index 68e8de9f53..256c77f32b 100644 --- a/sanitizers/suppressions/asan.supp +++ b/sanitizers/suppressions/asan.supp @@ -9,17 +9,9 @@ # - stack-buffer-overflow errors in seemingly unrelated code (e.g., std::chrono::steady_clock::now()) # - stack-buffer-underflow errors in seemingly unrelated code (e.g., xxhasher::retrieveHash(), clock_gettime) # -# These are suppressed via: -# 1. Runtime option: detect_stack_use_after_return=0 (in ASAN_OPTIONS in CI workflow) -# 2. Compile-time flag: -fno-sanitize-address-use-after-scope (in cmake/XrplSanitizers.cmake) -# -# Note: stack-buffer-overflow false positives from coroutines cannot be fully suppressed -# without disabling ASAN entirely for Boost. Clang builds use -fsanitize-blacklist to -# exclude Boost headers, but GCC does not support this feature. -# -# See: https://github.com/google/sanitizers/issues/189 +# These are now handled by using coroutine2 and ucontext backend. -# Boost - false positives from stackful coroutines interceptor_name:clock_gettime interceptor_name:__bzero interceptor_name:nudb +interceptor_name:coro # Suppress any flackiness From e75ffc7c258bd0ccc0486e9b380f0463ec368bf6 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Sun, 15 Feb 2026 13:46:51 +0000 Subject: [PATCH 51/61] only run asan --- .github/scripts/strategy-matrix/generate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/scripts/strategy-matrix/generate.py b/.github/scripts/strategy-matrix/generate.py index f6a8cddadc..302994aeb2 100755 --- a/.github/scripts/strategy-matrix/generate.py +++ b/.github/scripts/strategy-matrix/generate.py @@ -245,14 +245,14 @@ def generate_strategy_matrix(all: bool, config: Config) -> list: # Add ASAN + UBSAN 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", } ) # TSAN is deactivated due to seg faults with latest compilers. From b08b14c2cd218cce6aa9b7472386bebb1e860b89 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Mon, 16 Feb 2026 16:14:29 +0000 Subject: [PATCH 52/61] remove symbolize option from asan Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> --- sanitizers/suppressions/runtime-asan-options.txt | 1 - sanitizers/suppressions/runtime-tsan-options.txt | 1 - 2 files changed, 2 deletions(-) diff --git a/sanitizers/suppressions/runtime-asan-options.txt b/sanitizers/suppressions/runtime-asan-options.txt index 44df59945f..f13718c886 100644 --- a/sanitizers/suppressions/runtime-asan-options.txt +++ b/sanitizers/suppressions/runtime-asan-options.txt @@ -3,6 +3,5 @@ debug=true halt_on_error=false print_stats=true print_legend=true -symbolize=true print_cmdline=true print_summary=true diff --git a/sanitizers/suppressions/runtime-tsan-options.txt b/sanitizers/suppressions/runtime-tsan-options.txt index aafe997ea4..ad0d04de3e 100644 --- a/sanitizers/suppressions/runtime-tsan-options.txt +++ b/sanitizers/suppressions/runtime-tsan-options.txt @@ -1,3 +1,2 @@ halt_on_error=false -verbosity=1 second_deadlock_stack=1 From 4d43f2e083b4fc5855fd3857b85167a7fdf2375c Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Mon, 16 Feb 2026 17:44:27 +0000 Subject: [PATCH 53/61] remove printXXX from asan rt args Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> --- sanitizers/suppressions/runtime-asan-options.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/sanitizers/suppressions/runtime-asan-options.txt b/sanitizers/suppressions/runtime-asan-options.txt index f13718c886..ba00d38bba 100644 --- a/sanitizers/suppressions/runtime-asan-options.txt +++ b/sanitizers/suppressions/runtime-asan-options.txt @@ -1,7 +1,4 @@ detect_container_overflow=0 debug=true halt_on_error=false -print_stats=true -print_legend=true -print_cmdline=true print_summary=true From eebdb581075316a3a0e31fff3b6f84acd476c184 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Mon, 16 Feb 2026 17:50:36 +0000 Subject: [PATCH 54/61] halt on error = 0 Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> --- sanitizers/suppressions/runtime-asan-options.txt | 2 +- sanitizers/suppressions/runtime-lsan-options.txt | 2 +- sanitizers/suppressions/runtime-tsan-options.txt | 2 +- sanitizers/suppressions/runtime-ubsan-options.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sanitizers/suppressions/runtime-asan-options.txt b/sanitizers/suppressions/runtime-asan-options.txt index ba00d38bba..880c7fbb67 100644 --- a/sanitizers/suppressions/runtime-asan-options.txt +++ b/sanitizers/suppressions/runtime-asan-options.txt @@ -1,4 +1,4 @@ detect_container_overflow=0 debug=true -halt_on_error=false +halt_on_error=0 print_summary=true diff --git a/sanitizers/suppressions/runtime-lsan-options.txt b/sanitizers/suppressions/runtime-lsan-options.txt index fcfccf7bae..e1ca163aa0 100644 --- a/sanitizers/suppressions/runtime-lsan-options.txt +++ b/sanitizers/suppressions/runtime-lsan-options.txt @@ -1 +1 @@ -halt_on_error=false +halt_on_error=0 diff --git a/sanitizers/suppressions/runtime-tsan-options.txt b/sanitizers/suppressions/runtime-tsan-options.txt index ad0d04de3e..ef3099d948 100644 --- a/sanitizers/suppressions/runtime-tsan-options.txt +++ b/sanitizers/suppressions/runtime-tsan-options.txt @@ -1,2 +1,2 @@ -halt_on_error=false +halt_on_error=0 second_deadlock_stack=1 diff --git a/sanitizers/suppressions/runtime-ubsan-options.txt b/sanitizers/suppressions/runtime-ubsan-options.txt index fcfccf7bae..e1ca163aa0 100644 --- a/sanitizers/suppressions/runtime-ubsan-options.txt +++ b/sanitizers/suppressions/runtime-ubsan-options.txt @@ -1 +1 @@ -halt_on_error=false +halt_on_error=0 From ac7ddd0cefacddde6bd5bcc674e8618addb51ee4 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Mon, 16 Feb 2026 18:39:14 +0000 Subject: [PATCH 55/61] reverted change in Number Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> --- include/xrpl/basics/Number.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/include/xrpl/basics/Number.h b/include/xrpl/basics/Number.h index 46bb35541d..c269d27781 100644 --- a/include/xrpl/basics/Number.h +++ b/include/xrpl/basics/Number.h @@ -698,12 +698,8 @@ Number::normalizeToRange(T minMantissa, T maxMantissa) const XRPL_ASSERT_PARTS(!negative, "xrpl::Number::normalizeToRange", "Number is non-negative for unsigned range."); Number::normalize(negative, mantissa, exponent, minMantissa, maxMantissa); - // Cast mantissa to signed type first to avoid unsigned integer overflow - // when multiplying by negative sign - T signedMantissa = static_cast(mantissa); - if (negative) - signedMantissa = -signedMantissa; - return std::make_pair(signedMantissa, exponent); + auto const sign = negative ? -1 : 1; + return std::make_pair(static_cast(sign * mantissa), exponent); } inline constexpr Number From 958d8f375453d80bb1aa4c293b5102c045a3e4b4 Mon Sep 17 00:00:00 2001 From: Sergey Kuznetsov Date: Mon, 16 Feb 2026 19:31:18 +0000 Subject: [PATCH 56/61] chore: Update clang-format to 21.1.8 (#6352) --- .gitignore | 3 + .pre-commit-config.yaml | 2 +- CONTRIBUTING.md | 2 +- include/xrpl/basics/IntrusivePointer.ipp | 6 +- .../xrpl/basics/SharedWeakCachePointer.ipp | 3 +- include/xrpl/basics/SlabAllocator.h | 2 +- include/xrpl/protocol/Feature.h | 2 +- include/xrpl/protocol/IOUAmount.h | 6 +- include/xrpl/protocol/MPTAmount.h | 3 +- include/xrpl/protocol/MultiApiJson.h | 4 +- include/xrpl/protocol/STAmount.h | 6 +- include/xrpl/protocol/STBitString.h | 3 +- include/xrpl/protocol/STInteger.h | 3 +- include/xrpl/protocol/STObject.h | 18 +- include/xrpl/protocol/STVector256.h | 3 +- include/xrpl/protocol/TER.h | 42 ++- include/xrpl/server/detail/BaseHTTPPeer.h | 4 +- include/xrpl/server/detail/BaseWSPeer.h | 5 +- src/libxrpl/basics/Number.cpp | 3 +- src/libxrpl/json/json_value.cpp | 3 +- src/libxrpl/protocol/Feature.cpp | 2 +- src/libxrpl/protocol/digest.cpp | 9 +- src/libxrpl/server/JSONRPCUtil.cpp | 4 +- src/libxrpl/server/Wallet.cpp | 5 +- src/libxrpl/shamap/SHAMapDelta.cpp | 65 ++-- src/test/app/AMM_test.cpp | 63 ++-- src/test/app/LedgerMaster_test.cpp | 10 +- src/test/app/Manifest_test.cpp | 11 +- src/test/app/Oracle_test.cpp | 304 ++++++++++-------- src/test/app/Vault_test.cpp | 30 +- src/test/beast/IPEndpoint_test.cpp | 6 +- src/test/core/Config_test.cpp | 38 +-- src/test/jtx/impl/amount.cpp | 3 +- src/test/jtx/impl/mpt.cpp | 6 +- src/test/overlay/compression_test.cpp | 5 +- src/test/protocol/STParsedJSON_test.cpp | 75 +++-- src/test/rpc/AccountObjects_test.cpp | 5 +- src/test/rpc/Feature_test.cpp | 6 +- src/test/rpc/GRPCTestClientBase.h | 9 +- src/test/rpc/LedgerEntry_test.cpp | 37 ++- src/test/shamap/SHAMap_test.cpp | 120 ++++--- .../app/ledger/detail/LedgerReplayTask.cpp | 7 +- src/xrpld/app/main/Application.cpp | 82 ++--- src/xrpld/app/main/GRPCServer.cpp | 84 ++--- src/xrpld/app/misc/CanonicalTXSet.cpp | 5 +- src/xrpld/app/misc/ValidatorList.h | 15 +- src/xrpld/app/misc/detail/LendingHelpers.cpp | 29 +- src/xrpld/app/misc/detail/Manifest.cpp | 11 +- src/xrpld/app/misc/detail/ValidatorList.cpp | 15 +- src/xrpld/app/rdb/backend/detail/Node.cpp | 25 +- src/xrpld/app/tx/detail/ApplyContext.h | 11 +- src/xrpld/app/tx/detail/DepositPreauth.cpp | 5 +- src/xrpld/overlay/Slot.h | 25 +- src/xrpld/overlay/detail/ConnectAttempt.cpp | 10 +- src/xrpld/overlay/detail/OverlayImpl.cpp | 5 +- src/xrpld/overlay/detail/OverlayImpl.h | 3 +- src/xrpld/overlay/detail/PeerImp.cpp | 3 +- src/xrpld/rpc/detail/RPCLedgerHelpers.cpp | 5 +- src/xrpld/rpc/handlers/LedgerEntry.cpp | 14 +- src/xrpld/shamap/NodeFamily.cpp | 28 +- 60 files changed, 741 insertions(+), 577 deletions(-) diff --git a/.gitignore b/.gitignore index 2692d707e7..a1c2f034d1 100644 --- a/.gitignore +++ b/.gitignore @@ -71,3 +71,6 @@ DerivedData /.augment /.claude /CLAUDE.md + +# clangd cache +/.cache diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 79a3e4e7ec..9117fe0d3e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,7 +20,7 @@ repos: args: [--assume-in-merge] - repo: https://github.com/pre-commit/mirrors-clang-format - rev: 7d85583be209cb547946c82fbe51f4bc5dd1d017 # frozen: v18.1.8 + rev: 75ca4ad908dc4a99f57921f29b7e6c1521e10b26 # frozen: v21.1.8 hooks: - id: clang-format args: [--style=file] diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 808d553e17..a928065ef2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -219,7 +219,7 @@ coherent rather than a set of _thou shalt not_ commandments. ## Formatting -All code must conform to `clang-format` version 18, +All code must conform to `clang-format` version 21, according to the settings in [`.clang-format`](./.clang-format), unless the result would be unreasonably difficult to read or maintain. To demarcate lines that should be left as-is, surround them with comments like diff --git a/include/xrpl/basics/IntrusivePointer.ipp b/include/xrpl/basics/IntrusivePointer.ipp index d52aa6299f..de57e61ba6 100644 --- a/include/xrpl/basics/IntrusivePointer.ipp +++ b/include/xrpl/basics/IntrusivePointer.ipp @@ -208,7 +208,8 @@ SharedIntrusive::operator->() const noexcept } template -SharedIntrusive::operator bool() const noexcept +SharedIntrusive:: +operator bool() const noexcept { return bool(unsafeGetRawPtr()); } @@ -503,7 +504,8 @@ SharedWeakUnion::getStrong() const } template -SharedWeakUnion::operator bool() const noexcept +SharedWeakUnion:: +operator bool() const noexcept { return bool(get()); } diff --git a/include/xrpl/basics/SharedWeakCachePointer.ipp b/include/xrpl/basics/SharedWeakCachePointer.ipp index 6e7514ffae..7eb3789de5 100644 --- a/include/xrpl/basics/SharedWeakCachePointer.ipp +++ b/include/xrpl/basics/SharedWeakCachePointer.ipp @@ -63,7 +63,8 @@ SharedWeakCachePointer::getStrong() const } template -SharedWeakCachePointer::operator bool() const noexcept +SharedWeakCachePointer:: +operator bool() const noexcept { return !!std::get_if>(&combo_); } diff --git a/include/xrpl/basics/SlabAllocator.h b/include/xrpl/basics/SlabAllocator.h index 2578afdc5a..84beef2d20 100644 --- a/include/xrpl/basics/SlabAllocator.h +++ b/include/xrpl/basics/SlabAllocator.h @@ -215,7 +215,7 @@ public: // clang-format off if (!buf) [[unlikely]] return nullptr; - // clang-format on + // clang-format on #if BOOST_OS_LINUX // When allocating large blocks, attempt to leverage Linux's diff --git a/include/xrpl/protocol/Feature.h b/include/xrpl/protocol/Feature.h index 6d674fbef2..34d78fc50b 100644 --- a/include/xrpl/protocol/Feature.h +++ b/include/xrpl/protocol/Feature.h @@ -296,7 +296,7 @@ public: friend FeatureBitset operator^(FeatureBitset const& lhs, uint256 const& rhs) { - return lhs ^ FeatureBitset { rhs }; + return lhs ^ FeatureBitset{rhs}; } friend FeatureBitset diff --git a/include/xrpl/protocol/IOUAmount.h b/include/xrpl/protocol/IOUAmount.h index 52c2272da0..608c80d982 100644 --- a/include/xrpl/protocol/IOUAmount.h +++ b/include/xrpl/protocol/IOUAmount.h @@ -110,7 +110,8 @@ IOUAmount::operator=(beast::Zero) return *this; } -inline IOUAmount::operator Number() const +inline IOUAmount:: +operator Number() const { return Number{mantissa_, exponent_}; } @@ -140,7 +141,8 @@ IOUAmount::operator<(IOUAmount const& other) const return Number{*this} < Number{other}; } -inline IOUAmount::operator bool() const noexcept +inline IOUAmount:: +operator bool() const noexcept { return mantissa_ != 0; } diff --git a/include/xrpl/protocol/MPTAmount.h b/include/xrpl/protocol/MPTAmount.h index 66027185b3..5c1642ae5c 100644 --- a/include/xrpl/protocol/MPTAmount.h +++ b/include/xrpl/protocol/MPTAmount.h @@ -93,7 +93,8 @@ MPTAmount::operator=(beast::Zero) } /** Returns true if the amount is not zero */ -constexpr MPTAmount::operator bool() const noexcept +constexpr MPTAmount:: +operator bool() const noexcept { return value_ != 0; } diff --git a/include/xrpl/protocol/MultiApiJson.h b/include/xrpl/protocol/MultiApiJson.h index ad7a6b8f0d..b884771b50 100644 --- a/include/xrpl/protocol/MultiApiJson.h +++ b/include/xrpl/protocol/MultiApiJson.h @@ -107,7 +107,7 @@ struct MultiApiJson // unsigned int version, extra arguments template requires(!some_integral_constant) && std::convertible_to && - std::same_as, MultiApiJson> + std::same_as, MultiApiJson> auto operator()(Json& json, Version version, Fn fn, Args&&... args) const -> std::invoke_result_t @@ -122,7 +122,7 @@ struct MultiApiJson // unsigned int version, Json only template requires(!some_integral_constant) && std::convertible_to && - std::same_as, MultiApiJson> + std::same_as, MultiApiJson> auto operator()(Json& json, Version version, Fn fn) const -> std::invoke_result_t { diff --git a/include/xrpl/protocol/STAmount.h b/include/xrpl/protocol/STAmount.h index df2b1c19a0..ea727d02e3 100644 --- a/include/xrpl/protocol/STAmount.h +++ b/include/xrpl/protocol/STAmount.h @@ -480,12 +480,14 @@ STAmount::zeroed() const return STAmount(mAsset); } -inline STAmount::operator bool() const noexcept +inline STAmount:: +operator bool() const noexcept { return *this != beast::zero; } -inline STAmount::operator Number() const +inline STAmount:: +operator Number() const { if (native()) return xrp(); diff --git a/include/xrpl/protocol/STBitString.h b/include/xrpl/protocol/STBitString.h index e8b6e7282b..dca2670ffc 100644 --- a/include/xrpl/protocol/STBitString.h +++ b/include/xrpl/protocol/STBitString.h @@ -169,7 +169,8 @@ STBitString::value() const } template -STBitString::operator value_type() const +STBitString:: +operator value_type() const { return value_; } diff --git a/include/xrpl/protocol/STInteger.h b/include/xrpl/protocol/STInteger.h index b5c4dbf6cf..f4bbd6e73d 100644 --- a/include/xrpl/protocol/STInteger.h +++ b/include/xrpl/protocol/STInteger.h @@ -134,7 +134,8 @@ STInteger::setValue(Integer v) } template -inline STInteger::operator Integer() const +inline STInteger:: +operator Integer() const { return value_; } diff --git a/include/xrpl/protocol/STObject.h b/include/xrpl/protocol/STObject.h index 5d5d829c99..c9102f2470 100644 --- a/include/xrpl/protocol/STObject.h +++ b/include/xrpl/protocol/STObject.h @@ -147,9 +147,12 @@ public: int getCount() const; - bool setFlag(std::uint32_t); - bool clearFlag(std::uint32_t); - bool isFlag(std::uint32_t) const; + bool + setFlag(std::uint32_t); + bool + clearFlag(std::uint32_t); + bool + isFlag(std::uint32_t) const; std::uint32_t getFlags() const; @@ -799,7 +802,8 @@ STObject::ValueProxy::operator-=(U const& u) } template -STObject::ValueProxy::operator value_type() const +STObject::ValueProxy:: +operator value_type() const { return this->value(); } @@ -812,13 +816,15 @@ STObject::ValueProxy::ValueProxy(STObject* st, TypedField const* f) : Prox //------------------------------------------------------------------------------ template -STObject::OptionalProxy::operator bool() const noexcept +STObject::OptionalProxy:: +operator bool() const noexcept { return engaged(); } template -STObject::OptionalProxy::operator typename STObject::OptionalProxy::optional_type() const +STObject::OptionalProxy:: +operator typename STObject::OptionalProxy::optional_type() const { return optional_value(); } diff --git a/include/xrpl/protocol/STVector256.h b/include/xrpl/protocol/STVector256.h index c83d981bfc..8e63953e22 100644 --- a/include/xrpl/protocol/STVector256.h +++ b/include/xrpl/protocol/STVector256.h @@ -135,7 +135,8 @@ STVector256::setValue(STVector256 const& v) } /** Retrieve a copy of the vector we contain */ -inline STVector256::operator std::vector() const +inline STVector256:: +operator std::vector() const { return mValue; } diff --git a/include/xrpl/protocol/TER.h b/include/xrpl/protocol/TER.h index 52001ce72b..3c1faccf6d 100644 --- a/include/xrpl/protocol/TER.h +++ b/include/xrpl/protocol/TER.h @@ -484,60 +484,54 @@ public: // Only enabled if both arguments return int if TERtiInt is called with them. template constexpr auto -operator==(L const& lhs, R const& rhs) - -> std::enable_if_t< - std::is_same::value && std::is_same::value, - bool> +operator==(L const& lhs, R const& rhs) -> std::enable_if_t< + std::is_same::value && std::is_same::value, + bool> { return TERtoInt(lhs) == TERtoInt(rhs); } template constexpr auto -operator!=(L const& lhs, R const& rhs) - -> std::enable_if_t< - std::is_same::value && std::is_same::value, - bool> +operator!=(L const& lhs, R const& rhs) -> std::enable_if_t< + std::is_same::value && std::is_same::value, + bool> { return TERtoInt(lhs) != TERtoInt(rhs); } template constexpr auto -operator<(L const& lhs, R const& rhs) - -> std::enable_if_t< - std::is_same::value && std::is_same::value, - bool> +operator<(L const& lhs, R const& rhs) -> std::enable_if_t< + std::is_same::value && std::is_same::value, + bool> { return TERtoInt(lhs) < TERtoInt(rhs); } template constexpr auto -operator<=(L const& lhs, R const& rhs) - -> std::enable_if_t< - std::is_same::value && std::is_same::value, - bool> +operator<=(L const& lhs, R const& rhs) -> std::enable_if_t< + std::is_same::value && std::is_same::value, + bool> { return TERtoInt(lhs) <= TERtoInt(rhs); } template constexpr auto -operator>(L const& lhs, R const& rhs) - -> std::enable_if_t< - std::is_same::value && std::is_same::value, - bool> +operator>(L const& lhs, R const& rhs) -> std::enable_if_t< + std::is_same::value && std::is_same::value, + bool> { return TERtoInt(lhs) > TERtoInt(rhs); } template constexpr auto -operator>=(L const& lhs, R const& rhs) - -> std::enable_if_t< - std::is_same::value && std::is_same::value, - bool> +operator>=(L const& lhs, R const& rhs) -> std::enable_if_t< + std::is_same::value && std::is_same::value, + bool> { return TERtoInt(lhs) >= TERtoInt(rhs); } diff --git a/include/xrpl/server/detail/BaseHTTPPeer.h b/include/xrpl/server/detail/BaseHTTPPeer.h index ab85cb7c89..78ad4cff4f 100644 --- a/include/xrpl/server/detail/BaseHTTPPeer.h +++ b/include/xrpl/server/detail/BaseHTTPPeer.h @@ -218,7 +218,7 @@ void BaseHTTPPeer::close() { if (!strand_.running_in_this_thread()) - return post(strand_, std::bind((void(BaseHTTPPeer::*)(void)) & BaseHTTPPeer::close, impl().shared_from_this())); + return post(strand_, std::bind((void (BaseHTTPPeer::*)(void))&BaseHTTPPeer::close, impl().shared_from_this())); boost::beast::get_lowest_layer(impl().stream_).close(); } @@ -436,7 +436,7 @@ BaseHTTPPeer::close(bool graceful) return post( strand_, std::bind( - (void(BaseHTTPPeer::*)(bool)) & BaseHTTPPeer::close, + (void (BaseHTTPPeer::*)(bool))&BaseHTTPPeer::close, impl().shared_from_this(), graceful)); diff --git a/include/xrpl/server/detail/BaseWSPeer.h b/include/xrpl/server/detail/BaseWSPeer.h index ab985dfac5..723e48d950 100644 --- a/include/xrpl/server/detail/BaseWSPeer.h +++ b/include/xrpl/server/detail/BaseWSPeer.h @@ -178,8 +178,9 @@ BaseWSPeer::run() impl().ws_.control_callback(control_callback_); start_timer(); close_on_timer_ = true; - impl().ws_.set_option(boost::beast::websocket::stream_base::decorator( - [](auto& res) { res.set(boost::beast::http::field::server, BuildInfo::getFullVersionString()); })); + impl().ws_.set_option(boost::beast::websocket::stream_base::decorator([](auto& res) { + res.set(boost::beast::http::field::server, BuildInfo::getFullVersionString()); + })); impl().ws_.async_accept( request_, bind_executor( diff --git a/src/libxrpl/basics/Number.cpp b/src/libxrpl/basics/Number.cpp index 1651e8aba2..30dd60698e 100644 --- a/src/libxrpl/basics/Number.cpp +++ b/src/libxrpl/basics/Number.cpp @@ -773,7 +773,8 @@ Number::operator/=(Number const& y) return *this; } -Number::operator rep() const +Number:: +operator rep() const { rep drops = mantissa(); int offset = exponent(); diff --git a/src/libxrpl/json/json_value.cpp b/src/libxrpl/json/json_value.cpp index edbbafc1eb..a7692c7683 100644 --- a/src/libxrpl/json/json_value.cpp +++ b/src/libxrpl/json/json_value.cpp @@ -777,7 +777,8 @@ Value::size() const return 0; // unreachable; } -Value::operator bool() const +Value:: +operator bool() const { if (isNull()) return false; diff --git a/src/libxrpl/protocol/Feature.cpp b/src/libxrpl/protocol/Feature.cpp index 834341f8d6..149888a3a8 100644 --- a/src/libxrpl/protocol/Feature.cpp +++ b/src/libxrpl/protocol/Feature.cpp @@ -89,7 +89,7 @@ class FeatureCollections }; // Intermediate types to help with readability - template + template using feature_hashed_unique = boost::multi_index:: hashed_unique, boost::multi_index::member>; diff --git a/src/libxrpl/protocol/digest.cpp b/src/libxrpl/protocol/digest.cpp index aa5600dde0..0e03882c3c 100644 --- a/src/libxrpl/protocol/digest.cpp +++ b/src/libxrpl/protocol/digest.cpp @@ -21,7 +21,8 @@ openssl_ripemd160_hasher::operator()(void const* data, std::size_t size) noexcep RIPEMD160_Update(ctx, data, size); } -openssl_ripemd160_hasher::operator result_type() noexcept +openssl_ripemd160_hasher:: +operator result_type() noexcept { auto const ctx = reinterpret_cast(ctx_); result_type digest; @@ -45,7 +46,8 @@ openssl_sha512_hasher::operator()(void const* data, std::size_t size) noexcept SHA512_Update(ctx, data, size); } -openssl_sha512_hasher::operator result_type() noexcept +openssl_sha512_hasher:: +operator result_type() noexcept { auto const ctx = reinterpret_cast(ctx_); result_type digest; @@ -69,7 +71,8 @@ openssl_sha256_hasher::operator()(void const* data, std::size_t size) noexcept SHA256_Update(ctx, data, size); } -openssl_sha256_hasher::operator result_type() noexcept +openssl_sha256_hasher:: +operator result_type() noexcept { auto const ctx = reinterpret_cast(ctx_); result_type digest; diff --git a/src/libxrpl/server/JSONRPCUtil.cpp b/src/libxrpl/server/JSONRPCUtil.cpp index 634bb07850..d32a579d8d 100644 --- a/src/libxrpl/server/JSONRPCUtil.cpp +++ b/src/libxrpl/server/JSONRPCUtil.cpp @@ -19,9 +19,7 @@ getHTTPHeaderTimestamp() char buffer[96]; time_t now; time(&now); - struct tm now_gmt - { - }; + struct tm now_gmt{}; #ifndef _MSC_VER gmtime_r(&now, &now_gmt); #else diff --git a/src/libxrpl/server/Wallet.cpp b/src/libxrpl/server/Wallet.cpp index 51f1326674..6b7c285b3e 100644 --- a/src/libxrpl/server/Wallet.cpp +++ b/src/libxrpl/server/Wallet.cpp @@ -124,8 +124,9 @@ getNodeIdentity(soci::session& session) auto [newpublicKey, newsecretKey] = randomKeyPair(KeyType::secp256k1); session << str( - boost::format("INSERT INTO NodeIdentity (PublicKey,PrivateKey) " - "VALUES ('%s','%s');") % + boost::format( + "INSERT INTO NodeIdentity (PublicKey,PrivateKey) " + "VALUES ('%s','%s');") % toBase58(TokenType::NodePublic, newpublicKey) % toBase58(TokenType::NodePrivate, newsecretKey)); return {newpublicKey, newsecretKey}; diff --git a/src/libxrpl/shamap/SHAMapDelta.cpp b/src/libxrpl/shamap/SHAMapDelta.cpp index d8aabcc67c..1335fd0532 100644 --- a/src/libxrpl/shamap/SHAMapDelta.cpp +++ b/src/libxrpl/shamap/SHAMapDelta.cpp @@ -276,45 +276,46 @@ SHAMap::walkMapParallel(std::vector& missingNodes, int maxMis nodeStacks[rootChildIndex].push(intr_ptr::static_pointer_cast(child)); JLOG(journal_.debug()) << "starting worker " << rootChildIndex; - workers.push_back(std::thread( - [&m, &missingNodes, &maxMissing, &exceptions, this]( - std::stack> nodeStack) { - try - { - while (!nodeStack.empty()) + workers.push_back( + std::thread( + [&m, &missingNodes, &maxMissing, &exceptions, this]( + std::stack> nodeStack) { + try { - intr_ptr::SharedPtr node = std::move(nodeStack.top()); - XRPL_ASSERT(node, "xrpl::SHAMap::walkMapParallel : non-null node"); - nodeStack.pop(); - - for (int i = 0; i < 16; ++i) + while (!nodeStack.empty()) { - if (node->isEmptyBranch(i)) - continue; - intr_ptr::SharedPtr nextNode = descendNoStore(*node, i); + intr_ptr::SharedPtr node = std::move(nodeStack.top()); + XRPL_ASSERT(node, "xrpl::SHAMap::walkMapParallel : non-null node"); + nodeStack.pop(); - if (nextNode) + for (int i = 0; i < 16; ++i) { - if (nextNode->isInner()) - nodeStack.push(intr_ptr::static_pointer_cast(nextNode)); - } - else - { - std::lock_guard l{m}; - missingNodes.emplace_back(type_, node->getChildHash(i)); - if (--maxMissing <= 0) - return; + if (node->isEmptyBranch(i)) + continue; + intr_ptr::SharedPtr nextNode = descendNoStore(*node, i); + + if (nextNode) + { + if (nextNode->isInner()) + nodeStack.push(intr_ptr::static_pointer_cast(nextNode)); + } + else + { + std::lock_guard l{m}; + missingNodes.emplace_back(type_, node->getChildHash(i)); + if (--maxMissing <= 0) + return; + } } } } - } - catch (SHAMapMissingNode const& e) - { - std::lock_guard l(m); - exceptions.push_back(e); - } - }, - std::move(nodeStacks[rootChildIndex]))); + catch (SHAMapMissingNode const& e) + { + std::lock_guard l(m); + exceptions.push_back(e); + } + }, + std::move(nodeStacks[rootChildIndex]))); } for (std::thread& worker : workers) diff --git a/src/test/app/AMM_test.cpp b/src/test/app/AMM_test.cpp index 8a60e5f667..82ea2f6f70 100644 --- a/src/test/app/AMM_test.cpp +++ b/src/test/app/AMM_test.cpp @@ -955,13 +955,17 @@ private: // Equal deposit limit, tokens rounded to 0 testAMM( [&](AMM& amm, Env& env) { - amm.deposit(DepositArg{ - .asset1In = STAmount{USD, 1, -15}, .asset2In = XRPAmount{1}, .err = ter(tecAMM_INVALID_TOKENS)}); + amm.deposit( + DepositArg{ + .asset1In = STAmount{USD, 1, -15}, + .asset2In = XRPAmount{1}, + .err = ter(tecAMM_INVALID_TOKENS)}); }, {.pool = {{USD(1'000'000), XRP(1'000'000)}}, .features = {features - fixAMMv1_3}}); testAMM([&](AMM& amm, Env& env) { - amm.deposit(DepositArg{ - .asset1In = STAmount{USD, 1, -15}, .asset2In = XRPAmount{1}, .err = ter(tecAMM_INVALID_TOKENS)}); + amm.deposit( + DepositArg{ + .asset1In = STAmount{USD, 1, -15}, .asset2In = XRPAmount{1}, .err = ter(tecAMM_INVALID_TOKENS)}); }); // Single deposit by asset, tokens rounded to 0 @@ -971,14 +975,18 @@ private: // Single deposit by tokens, tokens rounded to 0 testAMM([&](AMM& amm, Env& env) { - amm.deposit(DepositArg{ - .tokens = IOUAmount{1, -10}, .asset1In = STAmount{USD, 1, -15}, .err = ter(tecAMM_INVALID_TOKENS)}); + amm.deposit( + DepositArg{ + .tokens = IOUAmount{1, -10}, .asset1In = STAmount{USD, 1, -15}, .err = ter(tecAMM_INVALID_TOKENS)}); }); // Single deposit with EPrice, tokens rounded to 0 testAMM([&](AMM& amm, Env& env) { - amm.deposit(DepositArg{ - .asset1In = STAmount{USD, 1, -15}, .maxEP = STAmount{USD, 1, -1}, .err = ter(tecAMM_INVALID_TOKENS)}); + amm.deposit( + DepositArg{ + .asset1In = STAmount{USD, 1, -15}, + .maxEP = STAmount{USD, 1, -1}, + .err = ter(tecAMM_INVALID_TOKENS)}); }); } @@ -1556,10 +1564,14 @@ private: ammAlice.withdraw(carol, std::nullopt, STAmount{USD, 1, -9}, std::nullopt, ter(tecAMM_INVALID_TOKENS)); ammAlice.withdraw(carol, std::nullopt, XRPAmount{1}, std::nullopt, ter(tecAMM_INVALID_TOKENS)); ammAlice.withdraw(WithdrawArg{.tokens = IOUAmount{1, -10}, .err = ter(tecAMM_INVALID_TOKENS)}); - ammAlice.withdraw(WithdrawArg{ - .asset1Out = STAmount{USD, 1, -15}, .asset2Out = XRPAmount{1}, .err = ter(tecAMM_INVALID_TOKENS)}); - ammAlice.withdraw(WithdrawArg{ - .tokens = IOUAmount{1, -10}, .asset1Out = STAmount{USD, 1, -15}, .err = ter(tecAMM_INVALID_TOKENS)}); + ammAlice.withdraw( + WithdrawArg{ + .asset1Out = STAmount{USD, 1, -15}, .asset2Out = XRPAmount{1}, .err = ter(tecAMM_INVALID_TOKENS)}); + ammAlice.withdraw( + WithdrawArg{ + .tokens = IOUAmount{1, -10}, + .asset1Out = STAmount{USD, 1, -15}, + .err = ter(tecAMM_INVALID_TOKENS)}); }); } @@ -6150,11 +6162,12 @@ private: // tfTwoAsset withdraw mode testAMM( [&](AMM& ammAlice, Env& env) { - ammAlice.withdraw(WithdrawArg{ - .account = alice, - .asset1Out = STAmount{GBP, 3'500}, - .asset2Out = STAmount{EUR, 15'000}, - .flags = tfTwoAsset}); + ammAlice.withdraw( + WithdrawArg{ + .account = alice, + .asset1Out = STAmount{GBP, 3'500}, + .asset2Out = STAmount{EUR, 15'000}, + .flags = tfTwoAsset}); invariant(ammAlice, env, "with3", false); }, {{GBP(7'000), EUR(30'000)}}, @@ -6198,8 +6211,12 @@ private: // tfOneAssetLPToken mode testAMM( [&](AMM& ammAlice, Env& env) { - ammAlice.withdraw(WithdrawArg{ - .account = alice, .tokens = 1'000, .asset1Out = STAmount{GBP, 100}, .flags = tfOneAssetLPToken}); + ammAlice.withdraw( + WithdrawArg{ + .account = alice, + .tokens = 1'000, + .asset1Out = STAmount{GBP, 100}, + .flags = tfOneAssetLPToken}); invariant(ammAlice, env, "with6", false); }, {{GBP(7'000), EUR(30'000)}}, @@ -6210,8 +6227,12 @@ private: // tfLimitLPToken mode testAMM( [&](AMM& ammAlice, Env& env) { - ammAlice.withdraw(WithdrawArg{ - .account = alice, .asset1Out = STAmount{GBP, 100}, .maxEP = IOUAmount{2}, .flags = tfLimitLPToken}); + ammAlice.withdraw( + WithdrawArg{ + .account = alice, + .asset1Out = STAmount{GBP, 100}, + .maxEP = IOUAmount{2}, + .flags = tfLimitLPToken}); invariant(ammAlice, env, "with7", true); }, {{GBP(7'000), EUR(30'000)}}, diff --git a/src/test/app/LedgerMaster_test.cpp b/src/test/app/LedgerMaster_test.cpp index eb346288c2..50a8a2ed02 100644 --- a/src/test/app/LedgerMaster_test.cpp +++ b/src/test/app/LedgerMaster_test.cpp @@ -79,8 +79,9 @@ class LedgerMaster_test : public beast::unit_test::suite auto result = env.app().getLedgerMaster().txnIdFromIndex(startLegSeq, txnIndex); BEAST_EXPECT( *result == - uint256("277F4FD89C20B92457FEF05FF63F6405563AD0563C73D967A29727" - "72679ADC65")); + uint256( + "277F4FD89C20B92457FEF05FF63F6405563AD0563C73D967A29727" + "72679ADC65")); } // success (second tx) { @@ -88,8 +89,9 @@ class LedgerMaster_test : public beast::unit_test::suite auto result = env.app().getLedgerMaster().txnIdFromIndex(startLegSeq + 1, txnIndex); BEAST_EXPECT( *result == - uint256("293DF7335EBBAF4420D52E70ABF470EB4C5792CAEA2F91F76193C2" - "819F538FDE")); + uint256( + "293DF7335EBBAF4420D52E70ABF470EB4C5792CAEA2F91F76193C2" + "819F538FDE")); } } diff --git a/src/test/app/Manifest_test.cpp b/src/test/app/Manifest_test.cpp index 5b7e34ad5b..5adb677152 100644 --- a/src/test/app/Manifest_test.cpp +++ b/src/test/app/Manifest_test.cpp @@ -250,11 +250,12 @@ public: if (inManifests.size() == loadedManifests.size()) { - BEAST_EXPECT(std::equal( - inManifests.begin(), - inManifests.end(), - loadedManifests.begin(), - [](Manifest const* lhs, Manifest const* rhs) { return *lhs == *rhs; })); + BEAST_EXPECT( + std::equal( + inManifests.begin(), + inManifests.end(), + loadedManifests.begin(), + [](Manifest const* lhs, Manifest const* rhs) { return *lhs == *rhs; })); } else { diff --git a/src/test/app/Oracle_test.cpp b/src/test/app/Oracle_test.cpp index 66a8969164..d3bf8a885a 100644 --- a/src/test/app/Oracle_test.cpp +++ b/src/test/app/Oracle_test.cpp @@ -47,17 +47,18 @@ private: env.fund(env.current()->fees().accountReserve(1) + env.current()->fees().base * 2, owner); Oracle oracle(env, {.owner = owner, .fee = static_cast(env.current()->fees().base.drops())}); BEAST_EXPECT(oracle.exists()); - oracle.set(UpdateArg{ - .series = - { - {"XRP", "EUR", 740, 1}, - {"XRP", "GBP", 740, 1}, - {"XRP", "CNY", 740, 1}, - {"XRP", "CAD", 740, 1}, - {"XRP", "AUD", 740, 1}, - }, - .fee = static_cast(env.current()->fees().base.drops()), - .err = ter(tecINSUFFICIENT_RESERVE)}); + oracle.set( + UpdateArg{ + .series = + { + {"XRP", "EUR", 740, 1}, + {"XRP", "GBP", 740, 1}, + {"XRP", "CNY", 740, 1}, + {"XRP", "CAD", 740, 1}, + {"XRP", "AUD", 740, 1}, + }, + .fee = static_cast(env.current()->fees().base.drops()), + .err = ter(tecINSUFFICIENT_RESERVE)}); } { @@ -70,42 +71,49 @@ private: oracle.set(CreateArg{.flags = tfSellNFToken, .fee = baseFee, .err = ter(temINVALID_FLAG)}); // Duplicate token pair - oracle.set(CreateArg{ - .series = {{"XRP", "USD", 740, 1}, {"XRP", "USD", 750, 1}}, .fee = baseFee, .err = ter(temMALFORMED)}); + oracle.set( + CreateArg{ + .series = {{"XRP", "USD", 740, 1}, {"XRP", "USD", 750, 1}}, + .fee = baseFee, + .err = ter(temMALFORMED)}); // Price is not included - oracle.set(CreateArg{ - .series = {{"XRP", "USD", 740, 1}, {"XRP", "EUR", std::nullopt, 1}}, - .fee = baseFee, - .err = ter(temMALFORMED)}); + oracle.set( + CreateArg{ + .series = {{"XRP", "USD", 740, 1}, {"XRP", "EUR", std::nullopt, 1}}, + .fee = baseFee, + .err = ter(temMALFORMED)}); // Token pair is in update and delete - oracle.set(CreateArg{ - .series = {{"XRP", "USD", 740, 1}, {"XRP", "USD", std::nullopt, 1}}, - .fee = baseFee, - .err = ter(temMALFORMED)}); + oracle.set( + CreateArg{ + .series = {{"XRP", "USD", 740, 1}, {"XRP", "USD", std::nullopt, 1}}, + .fee = baseFee, + .err = ter(temMALFORMED)}); // Token pair is in add and delete - oracle.set(CreateArg{ - .series = {{"XRP", "EUR", 740, 1}, {"XRP", "EUR", std::nullopt, 1}}, - .fee = baseFee, - .err = ter(temMALFORMED)}); + oracle.set( + CreateArg{ + .series = {{"XRP", "EUR", 740, 1}, {"XRP", "EUR", std::nullopt, 1}}, + .fee = baseFee, + .err = ter(temMALFORMED)}); // Array of token pair is 0 or exceeds 10 - oracle.set(CreateArg{ - .series = - {{"XRP", "US1", 740, 1}, - {"XRP", "US2", 750, 1}, - {"XRP", "US3", 740, 1}, - {"XRP", "US4", 750, 1}, - {"XRP", "US5", 740, 1}, - {"XRP", "US6", 750, 1}, - {"XRP", "US7", 740, 1}, - {"XRP", "US8", 750, 1}, - {"XRP", "US9", 740, 1}, - {"XRP", "U10", 750, 1}, - {"XRP", "U11", 740, 1}}, - .fee = baseFee, - .err = ter(temARRAY_TOO_LARGE)}); + oracle.set( + CreateArg{ + .series = + {{"XRP", "US1", 740, 1}, + {"XRP", "US2", 750, 1}, + {"XRP", "US3", 740, 1}, + {"XRP", "US4", 750, 1}, + {"XRP", "US5", 740, 1}, + {"XRP", "US6", 750, 1}, + {"XRP", "US7", 740, 1}, + {"XRP", "US8", 750, 1}, + {"XRP", "US9", 740, 1}, + {"XRP", "U10", 750, 1}, + {"XRP", "U11", 740, 1}}, + .fee = baseFee, + .err = ter(temARRAY_TOO_LARGE)}); oracle.set(CreateArg{.series = {}, .fee = baseFee, .err = ter(temARRAY_EMPTY)}); } @@ -116,22 +124,23 @@ private: env.fund(XRP(1'000), owner); Oracle oracle(env, CreateArg{.owner = owner, .series = {{{"XRP", "USD", 740, 1}}}, .fee = baseFee}); - oracle.set(UpdateArg{ - .series = - { - {"XRP", "US1", 740, 1}, - {"XRP", "US2", 750, 1}, - {"XRP", "US3", 740, 1}, - {"XRP", "US4", 750, 1}, - {"XRP", "US5", 740, 1}, - {"XRP", "US6", 750, 1}, - {"XRP", "US7", 740, 1}, - {"XRP", "US8", 750, 1}, - {"XRP", "US9", 740, 1}, - {"XRP", "U10", 750, 1}, - }, - .fee = baseFee, - .err = ter(tecARRAY_TOO_LARGE)}); + oracle.set( + UpdateArg{ + .series = + { + {"XRP", "US1", 740, 1}, + {"XRP", "US2", 750, 1}, + {"XRP", "US3", 740, 1}, + {"XRP", "US4", 750, 1}, + {"XRP", "US5", 740, 1}, + {"XRP", "US6", 750, 1}, + {"XRP", "US7", 740, 1}, + {"XRP", "US8", 750, 1}, + {"XRP", "US9", 740, 1}, + {"XRP", "U10", 750, 1}, + }, + .fee = baseFee, + .err = ter(tecARRAY_TOO_LARGE)}); } { @@ -141,26 +150,33 @@ private: Oracle oracle(env, {.owner = owner, .fee = baseFee}, false); // Asset class or provider not included on create - oracle.set(CreateArg{ - .assetClass = std::nullopt, .provider = "provider", .fee = baseFee, .err = ter(temMALFORMED)}); - oracle.set(CreateArg{ - .assetClass = "currency", - .provider = std::nullopt, - .uri = "URI", - .fee = baseFee, - .err = ter(temMALFORMED)}); + oracle.set( + CreateArg{ + .assetClass = std::nullopt, .provider = "provider", .fee = baseFee, .err = ter(temMALFORMED)}); + oracle.set( + CreateArg{ + .assetClass = "currency", + .provider = std::nullopt, + .uri = "URI", + .fee = baseFee, + .err = ter(temMALFORMED)}); // Asset class or provider are included on update // and don't match the current values oracle.set(CreateArg{.fee = static_cast(env.current()->fees().base.drops())}); BEAST_EXPECT(oracle.exists()); - oracle.set(UpdateArg{ - .series = {{"XRP", "USD", 740, 1}}, .provider = "provider1", .fee = baseFee, .err = ter(temMALFORMED)}); - oracle.set(UpdateArg{ - .series = {{"XRP", "USD", 740, 1}}, - .assetClass = "currency1", - .fee = baseFee, - .err = ter(temMALFORMED)}); + oracle.set( + UpdateArg{ + .series = {{"XRP", "USD", 740, 1}}, + .provider = "provider1", + .fee = baseFee, + .err = ter(temMALFORMED)}); + oracle.set( + UpdateArg{ + .series = {{"XRP", "USD", 740, 1}}, + .assetClass = "currency1", + .fee = baseFee, + .err = ter(temMALFORMED)}); } { @@ -214,31 +230,35 @@ private: BEAST_EXPECT(oracle.exists()); env.close(seconds(400)); // Less than the last close time - 300s - oracle.set(UpdateArg{ - .series = {{"XRP", "USD", 740, 1}}, - .lastUpdateTime = static_cast(closeTime() - 301), - .fee = baseFee, - .err = ter(tecINVALID_UPDATE_TIME)}); + oracle.set( + UpdateArg{ + .series = {{"XRP", "USD", 740, 1}}, + .lastUpdateTime = static_cast(closeTime() - 301), + .fee = baseFee, + .err = ter(tecINVALID_UPDATE_TIME)}); // Greater than last close time + 300s - oracle.set(UpdateArg{ - .series = {{"XRP", "USD", 740, 1}}, - .lastUpdateTime = static_cast(closeTime() + 311), - .fee = baseFee, - .err = ter(tecINVALID_UPDATE_TIME)}); + oracle.set( + UpdateArg{ + .series = {{"XRP", "USD", 740, 1}}, + .lastUpdateTime = static_cast(closeTime() + 311), + .fee = baseFee, + .err = ter(tecINVALID_UPDATE_TIME)}); oracle.set(UpdateArg{.series = {{"XRP", "USD", 740, 1}}, .fee = baseFee}); BEAST_EXPECT(oracle.expectLastUpdateTime(static_cast(testStartTime.count() + 450))); // Less than the previous lastUpdateTime - oracle.set(UpdateArg{ - .series = {{"XRP", "USD", 740, 1}}, - .lastUpdateTime = static_cast(449), - .fee = baseFee, - .err = ter(tecINVALID_UPDATE_TIME)}); + oracle.set( + UpdateArg{ + .series = {{"XRP", "USD", 740, 1}}, + .lastUpdateTime = static_cast(449), + .fee = baseFee, + .err = ter(tecINVALID_UPDATE_TIME)}); // Less than the epoch time - oracle.set(UpdateArg{ - .series = {{"XRP", "USD", 740, 1}}, - .lastUpdateTime = static_cast(epoch_offset.count() - 1), - .fee = baseFee, - .err = ter(tecINVALID_UPDATE_TIME)}); + oracle.set( + UpdateArg{ + .series = {{"XRP", "USD", 740, 1}}, + .lastUpdateTime = static_cast(epoch_offset.count() - 1), + .fee = baseFee, + .err = ter(tecINVALID_UPDATE_TIME)}); } { @@ -248,13 +268,17 @@ private: env.fund(XRP(1'000), owner); Oracle oracle(env, {.owner = owner, .fee = baseFee}); BEAST_EXPECT(oracle.exists()); - oracle.set(UpdateArg{ - .series = {{"XRP", "EUR", std::nullopt, std::nullopt}}, - .fee = baseFee, - .err = ter(tecTOKEN_PAIR_NOT_FOUND)}); + oracle.set( + UpdateArg{ + .series = {{"XRP", "EUR", std::nullopt, std::nullopt}}, + .fee = baseFee, + .err = ter(tecTOKEN_PAIR_NOT_FOUND)}); // delete all token pairs - oracle.set(UpdateArg{ - .series = {{"XRP", "USD", std::nullopt, std::nullopt}}, .fee = baseFee, .err = ter(tecARRAY_EMPTY)}); + oracle.set( + UpdateArg{ + .series = {{"XRP", "USD", std::nullopt, std::nullopt}}, + .fee = baseFee, + .err = ter(tecARRAY_EMPTY)}); } { @@ -285,21 +309,24 @@ private: auto const baseFee = static_cast(env.current()->fees().base.drops()); env.fund(XRP(1'000), owner); Oracle oracle(env, {.owner = owner, .fee = baseFee}); - oracle.set(UpdateArg{ - .series = {{"XRP", "EUR", std::nullopt, std::nullopt}, {"XRP", "EUR", 740, 1}}, - .fee = baseFee, - .err = ter(temMALFORMED)}); + oracle.set( + UpdateArg{ + .series = {{"XRP", "EUR", std::nullopt, std::nullopt}, {"XRP", "EUR", 740, 1}}, + .fee = baseFee, + .err = ter(temMALFORMED)}); // Delete token pair that doesn't exist in this oracle - oracle.set(UpdateArg{ - .series = {{"XRP", "EUR", std::nullopt, std::nullopt}}, - .fee = baseFee, - .err = ter(tecTOKEN_PAIR_NOT_FOUND)}); + oracle.set( + UpdateArg{ + .series = {{"XRP", "EUR", std::nullopt, std::nullopt}}, + .fee = baseFee, + .err = ter(tecTOKEN_PAIR_NOT_FOUND)}); // Delete token pair in oracle, which is not in the ledger - oracle.set(UpdateArg{ - .documentID = 10, - .series = {{"XRP", "EUR", std::nullopt, std::nullopt}}, - .fee = baseFee, - .err = ter(temMALFORMED)}); + oracle.set( + UpdateArg{ + .documentID = 10, + .series = {{"XRP", "EUR", std::nullopt, std::nullopt}}, + .fee = baseFee, + .err = ter(temMALFORMED)}); } { @@ -521,28 +548,30 @@ private: BEAST_EXPECT(ownerCount(env, owner) == count); // owner count is increased by 1 since the number of pairs is 6 - oracle.set(UpdateArg{ - .series = - { - {"BTC", "USD", 741, 2}, - {"ETH", "EUR", 710, 2}, - {"YAN", "EUR", 710, 2}, - {"CAN", "EUR", 710, 2}, - }, - .fee = baseFee}); + oracle.set( + UpdateArg{ + .series = + { + {"BTC", "USD", 741, 2}, + {"ETH", "EUR", 710, 2}, + {"YAN", "EUR", 710, 2}, + {"CAN", "EUR", 710, 2}, + }, + .fee = baseFee}); count += 1; BEAST_EXPECT(ownerCount(env, owner) == count); // update two pairs and delete four oracle.set(UpdateArg{.series = {{"BTC", "USD", std::nullopt, std::nullopt}}, .fee = baseFee}); - oracle.set(UpdateArg{ - .series = - {{"XRP", "USD", 742, 2}, - {"XRP", "EUR", 711, 2}, - {"ETH", "EUR", std::nullopt, std::nullopt}, - {"YAN", "EUR", std::nullopt, std::nullopt}, - {"CAN", "EUR", std::nullopt, std::nullopt}}, - .fee = baseFee}); + oracle.set( + UpdateArg{ + .series = + {{"XRP", "USD", 742, 2}, + {"XRP", "EUR", 711, 2}, + {"ETH", "EUR", std::nullopt, std::nullopt}, + {"YAN", "EUR", std::nullopt, std::nullopt}, + {"CAN", "EUR", std::nullopt, std::nullopt}}, + .fee = baseFee}); BEAST_EXPECT(oracle.expectPrice({{"XRP", "USD", 742, 2}, {"XRP", "EUR", 711, 2}})); // owner count is decreased by 1 since the number of pairs is 2 count -= 1; @@ -638,10 +667,12 @@ private: BEAST_EXPECT(oracle.exists()); // Update - oracle.set(UpdateArg{ - .series = {{"XRP", "USD", 740, 1}}, .msig = msig(becky), .fee = baseFee, .err = ter(tefBAD_QUORUM)}); - oracle.set(UpdateArg{ - .series = {{"XRP", "USD", 740, 1}}, .msig = msig(zelda), .fee = baseFee, .err = ter(tefBAD_SIGNATURE)}); + oracle.set( + UpdateArg{ + .series = {{"XRP", "USD", 740, 1}}, .msig = msig(becky), .fee = baseFee, .err = ter(tefBAD_QUORUM)}); + oracle.set( + UpdateArg{ + .series = {{"XRP", "USD", 740, 1}}, .msig = msig(zelda), .fee = baseFee, .err = ter(tefBAD_SIGNATURE)}); oracle.set(UpdateArg{.series = {{"XRP", "USD", 741, 1}}, .msig = msig(becky, bogie), .fee = baseFee}); BEAST_EXPECT(oracle.expectPrice({{"XRP", "USD", 741, 1}})); // remove the signer list @@ -652,11 +683,12 @@ private: env(signers(alice, 2, {{zelda, 1}, {bob, 1}, {ed, 2}}), sig(alie)); env.close(); // old list fails - oracle.set(UpdateArg{ - .series = {{"XRP", "USD", 740, 1}}, - .msig = msig(becky, bogie), - .fee = baseFee, - .err = ter(tefBAD_SIGNATURE)}); + oracle.set( + UpdateArg{ + .series = {{"XRP", "USD", 740, 1}}, + .msig = msig(becky, bogie), + .fee = baseFee, + .err = ter(tefBAD_SIGNATURE)}); // updated list succeeds oracle.set(UpdateArg{.series = {{"XRP", "USD", 7412, 2}}, .msig = msig(zelda, bob), .fee = baseFee}); BEAST_EXPECT(oracle.expectPrice({{"XRP", "USD", 7412, 2}})); diff --git a/src/test/app/Vault_test.cpp b/src/test/app/Vault_test.cpp index 5d31c674c0..cf86ab6033 100644 --- a/src/test/app/Vault_test.cpp +++ b/src/test/app/Vault_test.cpp @@ -969,13 +969,14 @@ class Vault_test : public beast::unit_test::suite { using namespace test::jtx; - auto testCase = [this](std::function test) { + auto testCase = [this]( + std::function test) { Env env{*this, testable_amendments() | featureSingleAssetVault}; Account issuer{"issuer"}; Account owner{"owner"}; @@ -1255,13 +1256,14 @@ class Vault_test : public beast::unit_test::suite { using namespace test::jtx; - auto testCase = [this](std::function test) { + auto testCase = [this]( + std::function test) { Env env{*this, testable_amendments() | featureSingleAssetVault}; Account issuer{"issuer"}; Account owner{"owner"}; diff --git a/src/test/beast/IPEndpoint_test.cpp b/src/test/beast/IPEndpoint_test.cpp index 67e3f8ed7d..7ce5271383 100644 --- a/src/test/beast/IPEndpoint_test.cpp +++ b/src/test/beast/IPEndpoint_test.cpp @@ -334,9 +334,9 @@ public: #if BOOST_OS_WINDOWS // windows asio bugs...false positives - shouldParseEPV4("255", {{ 0, 0, 0, 255 }}, 0, "0.0.0.255"); - shouldParseEPV4("512", {{ 0, 0, 2, 0 }}, 0, "0.0.2.0"); - shouldParseEPV4("1.2.3:80", {{ 1, 2, 0, 3 }}, 80, "1.2.0.3:80"); + shouldParseEPV4("255", {{0, 0, 0, 255}}, 0, "0.0.0.255"); + shouldParseEPV4("512", {{0, 0, 2, 0}}, 0, "0.0.2.0"); + shouldParseEPV4("1.2.3:80", {{1, 2, 0, 3}}, 80, "1.2.0.3:80"); #else failParseEP("255"); failParseEP("512"); diff --git a/src/test/core/Config_test.cpp b/src/test/core/Config_test.cpp index d5f3bb556c..2e7fc8635f 100644 --- a/src/test/core/Config_test.cpp +++ b/src/test/core/Config_test.cpp @@ -1116,23 +1116,24 @@ trust-these-validators.gov Config cfg; /* NOTE: this string includes some explicit * space chars in order to verify proper trimming */ - std::string toLoad(R"( + std::string toLoad( + R"( [port_rpc])" - "\x20" - R"( + "\x20" + R"( # comment # indented comment )" - "\x20\x20" - R"( + "\x20\x20" + R"( [ips])" - "\x20" - R"( + "\x20" + R"( r.ripple.com 51235 [ips_fixed])" - "\x20\x20" - R"( + "\x20\x20" + R"( # COMMENT s1.ripple.com 51235 s2.ripple.com 51235 @@ -1156,23 +1157,24 @@ r.ripple.com 51235 Config cfg; /* NOTE: this string includes some explicit * space chars in order to verify proper trimming */ - std::string toLoad(R"( + std::string toLoad( + R"( [port_rpc])" - "\x20" - R"( + "\x20" + R"( # comment # indented comment )" - "\x20\x20" - R"( + "\x20\x20" + R"( [ips])" - "\x20" - R"( + "\x20" + R"( r.ripple.com:51235 [ips_fixed])" - "\x20\x20" - R"( + "\x20\x20" + R"( # COMMENT s1.ripple.com:51235 s2.ripple.com 51235 diff --git a/src/test/jtx/impl/amount.cpp b/src/test/jtx/impl/amount.cpp index 73dad7f48e..258b948967 100644 --- a/src/test/jtx/impl/amount.cpp +++ b/src/test/jtx/impl/amount.cpp @@ -28,7 +28,8 @@ operator<<(std::ostream&& os, } #endif -PrettyAmount::operator AnyAmount() const +PrettyAmount:: +operator AnyAmount() const { return {amount_}; } diff --git a/src/test/jtx/impl/mpt.cpp b/src/test/jtx/impl/mpt.cpp index f505bff740..c934d21ff5 100644 --- a/src/test/jtx/impl/mpt.cpp +++ b/src/test/jtx/impl/mpt.cpp @@ -91,7 +91,8 @@ MPTTester::MPTTester(MPTInitDef const& arg) { } -MPTTester::operator MPT() const +MPTTester:: +operator MPT() const { if (!id_) Throw("MPT has not been created"); @@ -534,7 +535,8 @@ MPTTester::mpt(std::int64_t amount) const return xrpl::test::jtx::MPT(issuer_.name(), *id_)(amount); } -MPTTester::operator Asset() const +MPTTester:: +operator Asset() const { if (!id_) Throw("MPT has not been created"); diff --git a/src/test/overlay/compression_test.cpp b/src/test/overlay/compression_test.cpp index 19876809d2..a5fbef69cf 100644 --- a/src/test/overlay/compression_test.cpp +++ b/src/test/overlay/compression_test.cpp @@ -108,8 +108,9 @@ public: BEAST_EXPECT(proto1->ParseFromArray(decompressed.data(), decompressedSize)); auto uncompressed = m.getBuffer(Compressed::Off); - BEAST_EXPECT(std::equal( - uncompressed.begin() + xrpl::compression::headerBytes, uncompressed.end(), decompressed.begin())); + BEAST_EXPECT( + std::equal( + uncompressed.begin() + xrpl::compression::headerBytes, uncompressed.end(), decompressed.begin())); } std::shared_ptr diff --git a/src/test/protocol/STParsedJSON_test.cpp b/src/test/protocol/STParsedJSON_test.cpp index 0ef7878cdc..5b8be83499 100644 --- a/src/test/protocol/STParsedJSON_test.cpp +++ b/src/test/protocol/STParsedJSON_test.cpp @@ -2003,8 +2003,9 @@ class STParsedJSON_test : public beast::unit_test::suite } { - std::string const goodJson(R"({"CloseResolution":19,"Method":250,)" - R"("TransactionResult":"tecFROZEN"})"); + std::string const goodJson( + R"({"CloseResolution":19,"Method":250,)" + R"("TransactionResult":"tecFROZEN"})"); Json::Value jv; if (BEAST_EXPECT(parseJSONString(goodJson, jv))) @@ -2019,10 +2020,12 @@ class STParsedJSON_test : public beast::unit_test::suite } { - std::string const goodJson(R"({"CloseResolution":19,"Method":"250",)" - R"("TransactionResult":"tecFROZEN"})"); - std::string const expectedJson(R"({"CloseResolution":19,"Method":250,)" - R"("TransactionResult":"tecFROZEN"})"); + std::string const goodJson( + R"({"CloseResolution":19,"Method":"250",)" + R"("TransactionResult":"tecFROZEN"})"); + std::string const expectedJson( + R"({"CloseResolution":19,"Method":250,)" + R"("TransactionResult":"tecFROZEN"})"); Json::Value jv; if (BEAST_EXPECT(parseJSONString(goodJson, jv))) @@ -2040,10 +2043,12 @@ class STParsedJSON_test : public beast::unit_test::suite } { - std::string const goodJson(R"({"CloseResolution":"19","Method":"250",)" - R"("TransactionResult":"tecFROZEN"})"); - std::string const expectedJson(R"({"CloseResolution":19,"Method":250,)" - R"("TransactionResult":"tecFROZEN"})"); + std::string const goodJson( + R"({"CloseResolution":"19","Method":"250",)" + R"("TransactionResult":"tecFROZEN"})"); + std::string const expectedJson( + R"({"CloseResolution":19,"Method":250,)" + R"("TransactionResult":"tecFROZEN"})"); Json::Value jv; if (BEAST_EXPECT(parseJSONString(goodJson, jv))) @@ -2061,8 +2066,9 @@ class STParsedJSON_test : public beast::unit_test::suite } { - std::string const json(R"({"CloseResolution":19,"Method":250,)" - R"("TransactionResult":"terQUEUED"})"); + std::string const json( + R"({"CloseResolution":19,"Method":250,)" + R"("TransactionResult":"terQUEUED"})"); Json::Value jv; if (BEAST_EXPECT(parseJSONString(json, jv))) @@ -2076,8 +2082,9 @@ class STParsedJSON_test : public beast::unit_test::suite } { - std::string const json(R"({"CloseResolution":19,"Method":"pony",)" - R"("TransactionResult":"tesSUCCESS"})"); + std::string const json( + R"({"CloseResolution":19,"Method":"pony",)" + R"("TransactionResult":"tesSUCCESS"})"); Json::Value jv; if (BEAST_EXPECT(parseJSONString(json, jv))) @@ -2091,8 +2098,9 @@ class STParsedJSON_test : public beast::unit_test::suite } { - std::string const json(R"({"CloseResolution":19,"Method":3294967296,)" - R"("TransactionResult":"tesSUCCESS"})"); + std::string const json( + R"({"CloseResolution":19,"Method":3294967296,)" + R"("TransactionResult":"tesSUCCESS"})"); Json::Value jv; if (BEAST_EXPECT(parseJSONString(json, jv))) @@ -2106,8 +2114,9 @@ class STParsedJSON_test : public beast::unit_test::suite } { - std::string const json(R"({"CloseResolution":-10,"Method":42,)" - R"("TransactionResult":"tesSUCCESS"})"); + std::string const json( + R"({"CloseResolution":-10,"Method":42,)" + R"("TransactionResult":"tesSUCCESS"})"); Json::Value jv; if (BEAST_EXPECT(parseJSONString(json, jv))) @@ -2121,8 +2130,9 @@ class STParsedJSON_test : public beast::unit_test::suite } { - std::string const json(R"({"CloseResolution":19,"Method":3.141592653,)" - R"("TransactionResult":"tesSUCCESS"})"); + std::string const json( + R"({"CloseResolution":19,"Method":3.141592653,)" + R"("TransactionResult":"tesSUCCESS"})"); Json::Value jv; if (BEAST_EXPECT(parseJSONString(json, jv))) @@ -2136,10 +2146,12 @@ class STParsedJSON_test : public beast::unit_test::suite } { - std::string const goodJson(R"({"CloseResolution":19,"Method":250,)" - R"("TransferFee":"65535"})"); - std::string const expectedJson(R"({"CloseResolution":19,"Method":250,)" - R"("TransferFee":65535})"); + std::string const goodJson( + R"({"CloseResolution":19,"Method":250,)" + R"("TransferFee":"65535"})"); + std::string const expectedJson( + R"({"CloseResolution":19,"Method":250,)" + R"("TransferFee":65535})"); Json::Value jv; if (BEAST_EXPECT(parseJSONString(goodJson, jv))) @@ -2154,8 +2166,9 @@ class STParsedJSON_test : public beast::unit_test::suite } { - std::string const json(R"({"CloseResolution":19,"Method":250,)" - R"("TransferFee":"65536"})"); + std::string const json( + R"({"CloseResolution":19,"Method":250,)" + R"("TransferFee":"65536"})"); Json::Value jv; if (BEAST_EXPECT(parseJSONString(json, jv))) @@ -2169,8 +2182,9 @@ class STParsedJSON_test : public beast::unit_test::suite } { - std::string const json(R"({"CloseResolution":19,"Method":250,)" - R"("TransferFee":"Payment"})"); + std::string const json( + R"({"CloseResolution":19,"Method":250,)" + R"("TransferFee":"Payment"})"); Json::Value jv; if (BEAST_EXPECT(parseJSONString(json, jv))) @@ -2184,8 +2198,9 @@ class STParsedJSON_test : public beast::unit_test::suite } { - std::string const json(R"({"CloseResolution":19,"Method":250,)" - R"("TransferFee":true})"); + std::string const json( + R"({"CloseResolution":19,"Method":250,)" + R"("TransferFee":true})"); Json::Value jv; if (BEAST_EXPECT(parseJSONString(json, jv))) diff --git a/src/test/rpc/AccountObjects_test.cpp b/src/test/rpc/AccountObjects_test.cpp index 0dec2bde7f..ab9fcf084e 100644 --- a/src/test/rpc/AccountObjects_test.cpp +++ b/src/test/rpc/AccountObjects_test.cpp @@ -769,8 +769,9 @@ public: // xchain_create_account_claim_id should be present on the door // account (Account::master) to collect the signatures until a // quorum is reached - scEnv(test::jtx::create_account_attestation( - x.scAttester, x.jvb, x.mcCarol, amt, x.reward, x.payees[0], true, 1, x.scuAlice, x.signers[0])); + scEnv( + test::jtx::create_account_attestation( + x.scAttester, x.jvb, x.mcCarol, amt, x.reward, x.payees[0], true, 1, x.scuAlice, x.signers[0])); scEnv.close(); auto scEnvAcctObjs = [&](Account const& acct, char const* type) { diff --git a/src/test/rpc/Feature_test.cpp b/src/test/rpc/Feature_test.cpp index 21596634e3..c12988816e 100644 --- a/src/test/rpc/Feature_test.cpp +++ b/src/test/rpc/Feature_test.cpp @@ -162,9 +162,9 @@ class Feature_test : public beast::unit_test::suite BEAST_EXPECTS(jrr[jss::status] == jss::success, "status"); jrr.removeMember(jss::status); BEAST_EXPECT(jrr.size() == 1); - BEAST_EXPECT( - jrr.isMember("12523DF04B553A0B1AD74F42DDB741DE8DC06A03FC089A0EF197E" - "2A87F1D8107")); + BEAST_EXPECT(jrr.isMember( + "12523DF04B553A0B1AD74F42DDB741DE8DC06A03FC089A0EF197E" + "2A87F1D8107")); auto feature = *(jrr.begin()); BEAST_EXPECTS(feature[jss::name] == "fixAMMOverflowOffer", "name"); diff --git a/src/test/rpc/GRPCTestClientBase.h b/src/test/rpc/GRPCTestClientBase.h index 3c39cd1747..475c9da43b 100644 --- a/src/test/rpc/GRPCTestClientBase.h +++ b/src/test/rpc/GRPCTestClientBase.h @@ -12,9 +12,12 @@ namespace test { struct GRPCTestClientBase { explicit GRPCTestClientBase(std::string const& port) - : stub_(org::xrpl::rpc::v1::XRPLedgerAPIService::NewStub(grpc::CreateChannel( - beast::IP::Endpoint(boost::asio::ip::make_address(getEnvLocalhostAddr()), std::stoi(port)).to_string(), - grpc::InsecureChannelCredentials()))) + : stub_( + org::xrpl::rpc::v1::XRPLedgerAPIService::NewStub( + grpc::CreateChannel( + beast::IP::Endpoint(boost::asio::ip::make_address(getEnvLocalhostAddr()), std::stoi(port)) + .to_string(), + grpc::InsecureChannelCredentials()))) { } diff --git a/src/test/rpc/LedgerEntry_test.cpp b/src/test/rpc/LedgerEntry_test.cpp index 5d12e7bb83..a66badf54b 100644 --- a/src/test/rpc/LedgerEntry_test.cpp +++ b/src/test/rpc/LedgerEntry_test.cpp @@ -581,17 +581,21 @@ class LedgerEntry_test : public beast::unit_test::suite // Create Amendments vector (enabled amendments) std::vector enabledAmendments; enabledAmendments.push_back( - uint256::fromVoid("42426C4D4F1009EE67080A9B7965B44656D7" - "714D104A72F9B4369F97ABF044EE")); + uint256::fromVoid( + "42426C4D4F1009EE67080A9B7965B44656D7" + "714D104A72F9B4369F97ABF044EE")); enabledAmendments.push_back( - uint256::fromVoid("4C97EBA926031A7CF7D7B36FDE3ED66DDA54" - "21192D63DE53FFB46E43B9DC8373")); + uint256::fromVoid( + "4C97EBA926031A7CF7D7B36FDE3ED66DDA54" + "21192D63DE53FFB46E43B9DC8373")); enabledAmendments.push_back( - uint256::fromVoid("03BDC0099C4E14163ADA272C1B6F6FABB448" - "CC3E51F522F978041E4B57D9158C")); + uint256::fromVoid( + "03BDC0099C4E14163ADA272C1B6F6FABB448" + "CC3E51F522F978041E4B57D9158C")); enabledAmendments.push_back( - uint256::fromVoid("35291ADD2D79EB6991343BDA0912269C817D" - "0F094B02226C1C14AD2858962ED4")); + uint256::fromVoid( + "35291ADD2D79EB6991343BDA0912269C817D" + "0F094B02226C1C14AD2858962ED4")); sle->setFieldV256(sfAmendments, STVector256(enabledAmendments)); // Create Majorities array @@ -600,16 +604,18 @@ class LedgerEntry_test : public beast::unit_test::suite auto majority1 = STObject::makeInnerObject(sfMajority); majority1.setFieldH256( sfAmendment, - uint256::fromVoid("7BB62DC13EC72B775091E9C71BF8CF97E122" - "647693B50C5E87A80DFD6FCFAC50")); + uint256::fromVoid( + "7BB62DC13EC72B775091E9C71BF8CF97E122" + "647693B50C5E87A80DFD6FCFAC50")); majority1.setFieldU32(sfCloseTime, 779561310); majorities.push_back(std::move(majority1)); auto majority2 = STObject::makeInnerObject(sfMajority); majority2.setFieldH256( sfAmendment, - uint256::fromVoid("755C971C29971C9F20C6F080F2ED96F87884" - "E40AD19554A5EBECDCEC8A1F77FE")); + uint256::fromVoid( + "755C971C29971C9F20C6F080F2ED96F87884" + "E40AD19554A5EBECDCEC8A1F77FE")); majority2.setFieldU32(sfCloseTime, 779561310); majorities.push_back(std::move(majority2)); @@ -1449,9 +1455,10 @@ class LedgerEntry_test : public beast::unit_test::suite sle->setFieldArray(sfDisabledValidators, disabledValidators); sle->setFieldH256( sfPreviousTxnID, - uint256::fromVoid("8D47FFE664BE6C335108DF689537625855A6" - "A95160CC6D351341B9" - "2624D9C5E3")); + uint256::fromVoid( + "8D47FFE664BE6C335108DF689537625855A6" + "A95160CC6D351341B9" + "2624D9C5E3")); sle->setFieldU32(sfPreviousTxnLgrSeq, 91442944); view.rawInsert(sle); diff --git a/src/test/shamap/SHAMap_test.cpp b/src/test/shamap/SHAMap_test.cpp index c91cc63749..d33a53b9b3 100644 --- a/src/test/shamap/SHAMap_test.cpp +++ b/src/test/shamap/SHAMap_test.cpp @@ -196,40 +196,56 @@ public: testcase("build/tear unbacked"); { constexpr std::array keys{ - uint256("b92891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" - "5a772c6ca8"), - uint256("b92881fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" - "5a772c6ca8"), - uint256("b92691fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" - "5a772c6ca8"), - uint256("b92791fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" - "5a772c6ca8"), - uint256("b91891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" - "5a772c6ca8"), - uint256("b99891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" - "5a772c6ca8"), - uint256("f22891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" - "5a772c6ca8"), - uint256("292891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" - "5a772c6ca8")}; + uint256( + "b92891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" + "5a772c6ca8"), + uint256( + "b92881fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" + "5a772c6ca8"), + uint256( + "b92691fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" + "5a772c6ca8"), + uint256( + "b92791fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" + "5a772c6ca8"), + uint256( + "b91891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" + "5a772c6ca8"), + uint256( + "b99891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" + "5a772c6ca8"), + uint256( + "f22891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" + "5a772c6ca8"), + uint256( + "292891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" + "5a772c6ca8")}; constexpr std::array hashes{ - uint256("B7387CFEA0465759ADC718E8C42B52D2309D179B326E239EB5075C" - "64B6281F7F"), - uint256("FBC195A9592A54AB44010274163CB6BA95F497EC5BA0A883184546" - "7FB2ECE266"), - uint256("4E7D2684B65DFD48937FFB775E20175C43AF0C94066F7D5679F51A" - "E756795B75"), - uint256("7A2F312EB203695FFD164E038E281839EEF06A1B99BFC263F3CECC" - "6C74F93E07"), - uint256("395A6691A372387A703FB0F2C6D2C405DAF307D0817F8F0E207596" - "462B0E3A3E"), - uint256("D044C0A696DE3169CC70AE216A1564D69DE96582865796142CE7D9" - "8A84D9DDE4"), - uint256("76DCC77C4027309B5A91AD164083264D70B77B5E43E08AEDA5EBF9" - "4361143615"), - uint256("DF4220E93ADC6F5569063A01B4DC79F8DB9553B6A3222ADE23DEA0" - "2BBE7230E5")}; + uint256( + "B7387CFEA0465759ADC718E8C42B52D2309D179B326E239EB5075C" + "64B6281F7F"), + uint256( + "FBC195A9592A54AB44010274163CB6BA95F497EC5BA0A883184546" + "7FB2ECE266"), + uint256( + "4E7D2684B65DFD48937FFB775E20175C43AF0C94066F7D5679F51A" + "E756795B75"), + uint256( + "7A2F312EB203695FFD164E038E281839EEF06A1B99BFC263F3CECC" + "6C74F93E07"), + uint256( + "395A6691A372387A703FB0F2C6D2C405DAF307D0817F8F0E207596" + "462B0E3A3E"), + uint256( + "D044C0A696DE3169CC70AE216A1564D69DE96582865796142CE7D9" + "8A84D9DDE4"), + uint256( + "76DCC77C4027309B5A91AD164083264D70B77B5E43E08AEDA5EBF9" + "4361143615"), + uint256( + "DF4220E93ADC6F5569063A01B4DC79F8DB9553B6A3222ADE23DEA0" + "2BBE7230E5")}; SHAMap map(SHAMapType::FREE, f); if (!backed) @@ -258,22 +274,30 @@ public: { constexpr std::array keys{ - uint256("f22891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" - "5a772c6ca8"), - uint256("b99891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" - "5a772c6ca8"), - uint256("b92891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" - "5a772c6ca8"), - uint256("b92881fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" - "5a772c6ca8"), - uint256("b92791fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" - "5a772c6ca8"), - uint256("b92691fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" - "5a772c6ca8"), - uint256("b91891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" - "5a772c6ca8"), - uint256("292891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" - "5a772c6ca8")}; + uint256( + "f22891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" + "5a772c6ca8"), + uint256( + "b99891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" + "5a772c6ca8"), + uint256( + "b92891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" + "5a772c6ca8"), + uint256( + "b92881fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" + "5a772c6ca8"), + uint256( + "b92791fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" + "5a772c6ca8"), + uint256( + "b92691fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" + "5a772c6ca8"), + uint256( + "b91891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" + "5a772c6ca8"), + uint256( + "292891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" + "5a772c6ca8")}; tests::TestNodeFamily tf{journal}; SHAMap map{SHAMapType::FREE, tf}; diff --git a/src/xrpld/app/ledger/detail/LedgerReplayTask.cpp b/src/xrpld/app/ledger/detail/LedgerReplayTask.cpp index b7d788e15a..273e3792d3 100644 --- a/src/xrpld/app/ledger/detail/LedgerReplayTask.cpp +++ b/src/xrpld/app/ledger/detail/LedgerReplayTask.cpp @@ -72,9 +72,10 @@ LedgerReplayTask::LedgerReplayTask( , inboundLedgers_(inboundLedgers) , replayer_(replayer) , parameter_(parameter) - , maxTimeouts_(std::max( - LedgerReplayParameters::TASK_MAX_TIMEOUTS_MINIMUM, - parameter.totalLedgers_ * LedgerReplayParameters::TASK_MAX_TIMEOUTS_MULTIPLIER)) + , maxTimeouts_( + std::max( + LedgerReplayParameters::TASK_MAX_TIMEOUTS_MINIMUM, + parameter.totalLedgers_ * LedgerReplayParameters::TASK_MAX_TIMEOUTS_MULTIPLIER)) , skipListAcquirer_(skipListAcquirer) { JLOG(journal_.trace()) << "Create " << hash_; diff --git a/src/xrpld/app/main/Application.cpp b/src/xrpld/app/main/Application.cpp index 4612479b78..c2a5437b70 100644 --- a/src/xrpld/app/main/Application.cpp +++ b/src/xrpld/app/main/Application.cpp @@ -243,42 +243,44 @@ public: , m_journal(logs_->journal("Application")) // PerfLog must be started before any other threads are launched. - , perfLog_(perf::make_PerfLog( - perf::setup_PerfLog(config_->section("perf"), config_->CONFIG_DIR), - *this, - logs_->journal("PerfLog"), - [this] { signalStop("PerfLog"); })) + , perfLog_( + perf::make_PerfLog( + perf::setup_PerfLog(config_->section("perf"), config_->CONFIG_DIR), + *this, + logs_->journal("PerfLog"), + [this] { signalStop("PerfLog"); })) , m_txMaster(*this) , m_collectorManager(make_CollectorManager(config_->section(SECTION_INSIGHT), logs_->journal("Collector"))) - , m_jobQueue(std::make_unique( - [](std::unique_ptr const& config) { - if (config->standalone() && !config->FORCE_MULTI_THREAD) - return 1; + , m_jobQueue( + std::make_unique( + [](std::unique_ptr const& config) { + if (config->standalone() && !config->FORCE_MULTI_THREAD) + return 1; - if (config->WORKERS) - return config->WORKERS; + if (config->WORKERS) + return config->WORKERS; - auto count = static_cast(std::thread::hardware_concurrency()); + auto count = static_cast(std::thread::hardware_concurrency()); - // Be more aggressive about the number of threads to use - // for the job queue if the server is configured as - // "large" or "huge" if there are enough cores. - if (config->NODE_SIZE >= 4 && count >= 16) - count = 6 + std::min(count, 8); - else if (config->NODE_SIZE >= 3 && count >= 8) - count = 4 + std::min(count, 6); - else - count = 2 + std::min(count, 4); + // Be more aggressive about the number of threads to use + // for the job queue if the server is configured as + // "large" or "huge" if there are enough cores. + if (config->NODE_SIZE >= 4 && count >= 16) + count = 6 + std::min(count, 8); + else if (config->NODE_SIZE >= 3 && count >= 8) + count = 4 + std::min(count, 6); + else + count = 2 + std::min(count, 4); - return count; - }(config_), - m_collectorManager->group("jobq"), - logs_->journal("JobQueue"), - *logs_, - *perfLog_)) + return count; + }(config_), + m_collectorManager->group("jobq"), + logs_->journal("JobQueue"), + *logs_, + *perfLog_)) , m_nodeStoreScheduler(*m_jobQueue) @@ -301,11 +303,12 @@ public: , m_pathRequests( std::make_unique(*this, logs_->journal("PathRequest"), m_collectorManager->collector())) - , m_ledgerMaster(std::make_unique( - *this, - stopwatch(), - m_collectorManager->collector(), - logs_->journal("LedgerMaster"))) + , m_ledgerMaster( + std::make_unique( + *this, + stopwatch(), + m_collectorManager->collector(), + logs_->journal("LedgerMaster"))) , ledgerCleaner_(make_LedgerCleaner(*this, logs_->journal("LedgerCleaner"))) @@ -349,13 +352,14 @@ public: , publisherManifests_(std::make_unique(logs_->journal("ManifestCache"))) - , validators_(std::make_unique( - *validatorManifests_, - *publisherManifests_, - *timeKeeper_, - config_->legacy("database_path"), - logs_->journal("ValidatorList"), - config_->VALIDATION_QUORUM)) + , validators_( + std::make_unique( + *validatorManifests_, + *publisherManifests_, + *timeKeeper_, + config_->legacy("database_path"), + logs_->journal("ValidatorList"), + config_->VALIDATION_QUORUM)) , validatorSites_(std::make_unique(*this)) diff --git a/src/xrpld/app/main/GRPCServer.cpp b/src/xrpld/app/main/GRPCServer.cpp index 9b07728eb8..5160a6779e 100644 --- a/src/xrpld/app/main/GRPCServer.cpp +++ b/src/xrpld/app/main/GRPCServer.cpp @@ -430,58 +430,62 @@ GRPCServerImpl::setupListeners() { using cd = CallData; - addToRequests(std::make_shared( - service_, - *cq_, - app_, - &org::xrpl::rpc::v1::XRPLedgerAPIService::AsyncService::RequestGetLedger, - doLedgerGrpc, - &org::xrpl::rpc::v1::XRPLedgerAPIService::Stub::GetLedger, - RPC::NO_CONDITION, - Resource::feeMediumBurdenRPC, - secureGatewayIPs_)); + addToRequests( + std::make_shared( + service_, + *cq_, + app_, + &org::xrpl::rpc::v1::XRPLedgerAPIService::AsyncService::RequestGetLedger, + doLedgerGrpc, + &org::xrpl::rpc::v1::XRPLedgerAPIService::Stub::GetLedger, + RPC::NO_CONDITION, + Resource::feeMediumBurdenRPC, + secureGatewayIPs_)); } { using cd = CallData; - addToRequests(std::make_shared( - service_, - *cq_, - app_, - &org::xrpl::rpc::v1::XRPLedgerAPIService::AsyncService::RequestGetLedgerData, - doLedgerDataGrpc, - &org::xrpl::rpc::v1::XRPLedgerAPIService::Stub::GetLedgerData, - RPC::NO_CONDITION, - Resource::feeMediumBurdenRPC, - secureGatewayIPs_)); + addToRequests( + std::make_shared( + service_, + *cq_, + app_, + &org::xrpl::rpc::v1::XRPLedgerAPIService::AsyncService::RequestGetLedgerData, + doLedgerDataGrpc, + &org::xrpl::rpc::v1::XRPLedgerAPIService::Stub::GetLedgerData, + RPC::NO_CONDITION, + Resource::feeMediumBurdenRPC, + secureGatewayIPs_)); } { using cd = CallData; - addToRequests(std::make_shared( - service_, - *cq_, - app_, - &org::xrpl::rpc::v1::XRPLedgerAPIService::AsyncService::RequestGetLedgerDiff, - doLedgerDiffGrpc, - &org::xrpl::rpc::v1::XRPLedgerAPIService::Stub::GetLedgerDiff, - RPC::NO_CONDITION, - Resource::feeMediumBurdenRPC, - secureGatewayIPs_)); + addToRequests( + std::make_shared( + service_, + *cq_, + app_, + &org::xrpl::rpc::v1::XRPLedgerAPIService::AsyncService::RequestGetLedgerDiff, + doLedgerDiffGrpc, + &org::xrpl::rpc::v1::XRPLedgerAPIService::Stub::GetLedgerDiff, + RPC::NO_CONDITION, + Resource::feeMediumBurdenRPC, + secureGatewayIPs_)); } { using cd = CallData; - addToRequests(std::make_shared( - service_, - *cq_, - app_, - &org::xrpl::rpc::v1::XRPLedgerAPIService::AsyncService::RequestGetLedgerEntry, - doLedgerEntryGrpc, - &org::xrpl::rpc::v1::XRPLedgerAPIService::Stub::GetLedgerEntry, - RPC::NO_CONDITION, - Resource::feeMediumBurdenRPC, - secureGatewayIPs_)); + addToRequests( + std::make_shared( + service_, + *cq_, + app_, + &org::xrpl::rpc::v1::XRPLedgerAPIService::AsyncService::RequestGetLedgerEntry, + doLedgerEntryGrpc, + &org::xrpl::rpc::v1::XRPLedgerAPIService::Stub::GetLedgerEntry, + RPC::NO_CONDITION, + Resource::feeMediumBurdenRPC, + secureGatewayIPs_)); } return requests; } diff --git a/src/xrpld/app/misc/CanonicalTXSet.cpp b/src/xrpld/app/misc/CanonicalTXSet.cpp index 6e6102afe7..b9d1a45aa0 100644 --- a/src/xrpld/app/misc/CanonicalTXSet.cpp +++ b/src/xrpld/app/misc/CanonicalTXSet.cpp @@ -32,8 +32,9 @@ CanonicalTXSet::accountKey(AccountID const& account) void CanonicalTXSet::insert(std::shared_ptr const& txn) { - map_.insert(std::make_pair( - Key(accountKey(txn->getAccountID(sfAccount)), txn->getSeqProxy(), txn->getTransactionID()), txn)); + map_.insert( + std::make_pair( + Key(accountKey(txn->getAccountID(sfAccount)), txn->getSeqProxy(), txn->getTransactionID()), txn)); } std::shared_ptr diff --git a/src/xrpld/app/misc/ValidatorList.h b/src/xrpld/app/misc/ValidatorList.h index f93ac8a32f..dd8eecc259 100644 --- a/src/xrpld/app/misc/ValidatorList.h +++ b/src/xrpld/app/misc/ValidatorList.h @@ -596,13 +596,14 @@ public: May be called concurrently */ void - for_each_available(std::function const& blobInfos, - PublicKey const& pubKey, - std::size_t maxSequence, - uint256 const& hash)> func) const; + for_each_available( + std::function const& blobInfos, + PublicKey const& pubKey, + std::size_t maxSequence, + uint256 const& hash)> func) const; /** Returns the current valid list for the given publisher key, if available, as a Json object. diff --git a/src/xrpld/app/misc/detail/LendingHelpers.cpp b/src/xrpld/app/misc/detail/LendingHelpers.cpp index 106eeb9301..c0fd4c36d8 100644 --- a/src/xrpld/app/misc/detail/LendingHelpers.cpp +++ b/src/xrpld/app/misc/detail/LendingHelpers.cpp @@ -328,23 +328,24 @@ doPayment( "xrpl::detail::doPayment", "fee outstanding stays valid"); - return LoanPaymentParts{// Principal paid is straightforward - it's the tracked delta - .principalPaid = payment.trackedPrincipalDelta, + return LoanPaymentParts{ + // Principal paid is straightforward - it's the tracked delta + .principalPaid = payment.trackedPrincipalDelta, - // Interest paid combines: - // 1. Tracked interest from the amortization schedule - // (derived from the tracked deltas) - // 2. Untracked interest (e.g., late payment penalties) - .interestPaid = payment.trackedInterestPart() + payment.untrackedInterest, + // Interest paid combines: + // 1. Tracked interest from the amortization schedule + // (derived from the tracked deltas) + // 2. Untracked interest (e.g., late payment penalties) + .interestPaid = payment.trackedInterestPart() + payment.untrackedInterest, - // Value change represents how the loan's total value changed beyond - // normal amortization. - .valueChange = payment.untrackedInterest, + // Value change represents how the loan's total value changed beyond + // normal amortization. + .valueChange = payment.untrackedInterest, - // Fee paid combines: - // 1. Tracked management fees from the amortization schedule - // 2. Untracked fees (e.g., late payment fees, service fees) - .feePaid = payment.trackedManagementFeeDelta + payment.untrackedManagementFee}; + // Fee paid combines: + // 1. Tracked management fees from the amortization schedule + // 2. Untracked fees (e.g., late payment fees, service fees) + .feePaid = payment.trackedManagementFeeDelta + payment.untrackedManagementFee}; } /* Simulates an overpayment to validate it won't break the loan's amortization. diff --git a/src/xrpld/app/misc/detail/Manifest.cpp b/src/xrpld/app/misc/detail/Manifest.cpp index dfcbdbb3ad..12c76d50e8 100644 --- a/src/xrpld/app/misc/detail/Manifest.cpp +++ b/src/xrpld/app/misc/detail/Manifest.cpp @@ -523,11 +523,12 @@ ManifestCache::load( if (!configRevocation.empty()) { std::string revocationStr; - revocationStr.reserve(std::accumulate( - configRevocation.cbegin(), - configRevocation.cend(), - std::size_t(0), - [](std::size_t init, std::string const& s) { return init + s.size(); })); + revocationStr.reserve( + std::accumulate( + configRevocation.cbegin(), + configRevocation.cend(), + std::size_t(0), + [](std::size_t init, std::string const& s) { return init + s.size(); })); for (auto const& line : configRevocation) revocationStr += boost::algorithm::trim_copy(line); diff --git a/src/xrpld/app/misc/detail/ValidatorList.cpp b/src/xrpld/app/misc/detail/ValidatorList.cpp index 4730df4983..eb47e7eaf3 100644 --- a/src/xrpld/app/misc/detail/ValidatorList.cpp +++ b/src/xrpld/app/misc/detail/ValidatorList.cpp @@ -1595,13 +1595,14 @@ ValidatorList::for_each_listed(std::function func) } void -ValidatorList::for_each_available(std::function const& blobInfos, - PublicKey const& pubKey, - std::size_t maxSequence, - uint256 const& hash)> func) const +ValidatorList::for_each_available( + std::function const& blobInfos, + PublicKey const& pubKey, + std::size_t maxSequence, + uint256 const& hash)> func) const { std::shared_lock read_lock{mutex_}; diff --git a/src/xrpld/app/rdb/backend/detail/Node.cpp b/src/xrpld/app/rdb/backend/detail/Node.cpp index 01e036731c..7680689e0a 100644 --- a/src/xrpld/app/rdb/backend/detail/Node.cpp +++ b/src/xrpld/app/rdb/backend/detail/Node.cpp @@ -555,8 +555,9 @@ std::pair>, int> getTxHistory(soci::session& session, Application& app, LedgerIndex startIndex, int quantity) { std::string sql = boost::str( - boost::format("SELECT LedgerSeq, Status, RawTxn " - "FROM Transactions ORDER BY LedgerSeq DESC LIMIT %u,%u;") % + boost::format( + "SELECT LedgerSeq, Status, RawTxn " + "FROM Transactions ORDER BY LedgerSeq DESC LIMIT %u,%u;") % startIndex % quantity); std::vector> txs; @@ -658,18 +659,20 @@ transactionsSQL( if (count) sql = boost::str( - boost::format("SELECT %s FROM AccountTransactions " - "WHERE Account = '%s' %s %s LIMIT %u, %u;") % + boost::format( + "SELECT %s FROM AccountTransactions " + "WHERE Account = '%s' %s %s LIMIT %u, %u;") % selection % toBase58(options.account) % maxClause % minClause % options.offset % numberOfResults); else sql = boost::str( - boost::format("SELECT %s FROM " - "AccountTransactions INNER JOIN Transactions " - "ON Transactions.TransID = AccountTransactions.TransID " - "WHERE Account = '%s' %s %s " - "ORDER BY AccountTransactions.LedgerSeq %s, " - "AccountTransactions.TxnSeq %s, AccountTransactions.TransID %s " - "LIMIT %u, %u;") % + boost::format( + "SELECT %s FROM " + "AccountTransactions INNER JOIN Transactions " + "ON Transactions.TransID = AccountTransactions.TransID " + "WHERE Account = '%s' %s %s " + "ORDER BY AccountTransactions.LedgerSeq %s, " + "AccountTransactions.TxnSeq %s, AccountTransactions.TransID %s " + "LIMIT %u, %u;") % selection % toBase58(options.account) % maxClause % minClause % (descending ? "DESC" : "ASC") % (descending ? "DESC" : "ASC") % (descending ? "DESC" : "ASC") % options.offset % numberOfResults); JLOG(j.trace()) << "txSQL query: " << sql; diff --git a/src/xrpld/app/tx/detail/ApplyContext.h b/src/xrpld/app/tx/detail/ApplyContext.h index 45345df265..d2208c13a1 100644 --- a/src/xrpld/app/tx/detail/ApplyContext.h +++ b/src/xrpld/app/tx/detail/ApplyContext.h @@ -90,11 +90,12 @@ public: /** Visit unapplied changes. */ void - visit(std::function const& before, - std::shared_ptr const& after)> const& func); + visit( + std::function const& before, + std::shared_ptr const& after)> const& func); void destroyXRP(XRPAmount const& fee) diff --git a/src/xrpld/app/tx/detail/DepositPreauth.cpp b/src/xrpld/app/tx/detail/DepositPreauth.cpp index 4636bdb359..023833212c 100644 --- a/src/xrpld/app/tx/detail/DepositPreauth.cpp +++ b/src/xrpld/app/tx/detail/DepositPreauth.cpp @@ -120,8 +120,9 @@ DepositPreauth::preclaim(PreclaimContext const& ctx) else if (ctx.tx.isFieldPresent(sfUnauthorizeCredentials)) { // Verify that the Preauth entry is in the ledger. - if (!ctx.view.exists(keylet::depositPreauth( - account, credentials::makeSorted(ctx.tx.getFieldArray(sfUnauthorizeCredentials))))) + if (!ctx.view.exists( + keylet::depositPreauth( + account, credentials::makeSorted(ctx.tx.getFieldArray(sfUnauthorizeCredentials))))) return tecNO_ENTRY; } return tesSUCCESS; diff --git a/src/xrpld/overlay/Slot.h b/src/xrpld/overlay/Slot.h index f3fd919648..d0f2c62174 100644 --- a/src/xrpld/overlay/Slot.h +++ b/src/xrpld/overlay/Slot.h @@ -492,13 +492,15 @@ Slot::getPeers() const auto r = std::unordered_map>(); for (auto const& [id, info] : peers_) - r.emplace(std::make_pair( - id, - std::move(std::make_tuple( - info.state, - info.count, - epoch(info.expire).count(), - epoch(info.lastMessage).count())))); + r.emplace( + std::make_pair( + id, + std::move( + std::make_tuple( + info.state, + info.count, + epoch(info.expire).count(), + epoch(info.lastMessage).count())))); return r; } @@ -724,10 +726,11 @@ Slots::updateSlotAndSquelch( if (it == slots_.end()) { JLOG(journal_.trace()) << "updateSlotAndSquelch: new slot " << Slice(validator); - auto it = slots_ - .emplace(std::make_pair( - validator, Slot(handler_, logs_.journal("Slot"), maxSelectedPeers_))) - .first; + auto it = + slots_ + .emplace( + std::make_pair(validator, Slot(handler_, logs_.journal("Slot"), maxSelectedPeers_))) + .first; it->second.update(validator, id, type, callback); } else diff --git a/src/xrpld/overlay/detail/ConnectAttempt.cpp b/src/xrpld/overlay/detail/ConnectAttempt.cpp index 8de737f46d..61fb9d704a 100644 --- a/src/xrpld/overlay/detail/ConnectAttempt.cpp +++ b/src/xrpld/overlay/detail/ConnectAttempt.cpp @@ -180,8 +180,9 @@ ConnectAttempt::setTimer(ConnectionStep step) try { timer_.expires_after(connectTimeout); - timer_.async_wait(boost::asio::bind_executor( - strand_, std::bind(&ConnectAttempt::onTimer, shared_from_this(), std::placeholders::_1))); + timer_.async_wait( + boost::asio::bind_executor( + strand_, std::bind(&ConnectAttempt::onTimer, shared_from_this(), std::placeholders::_1))); } catch (std::exception const& ex) { @@ -218,8 +219,9 @@ ConnectAttempt::setTimer(ConnectionStep step) // call to expires_after cancels previous timer stepTimer_.expires_after(stepTimeout); - stepTimer_.async_wait(boost::asio::bind_executor( - strand_, std::bind(&ConnectAttempt::onTimer, shared_from_this(), std::placeholders::_1))); + stepTimer_.async_wait( + boost::asio::bind_executor( + strand_, std::bind(&ConnectAttempt::onTimer, shared_from_this(), std::placeholders::_1))); JLOG(journal_.trace()) << "setTimer: " << stepToString(step) << " timeout=" << stepTimeout.count() << "s"; } diff --git a/src/xrpld/overlay/detail/OverlayImpl.cpp b/src/xrpld/overlay/detail/OverlayImpl.cpp index 5b9f142001..29cab0ee6d 100644 --- a/src/xrpld/overlay/detail/OverlayImpl.cpp +++ b/src/xrpld/overlay/detail/OverlayImpl.cpp @@ -60,8 +60,9 @@ void OverlayImpl::Timer::async_wait() { timer_.expires_after(std::chrono::seconds(1)); - timer_.async_wait(boost::asio::bind_executor( - overlay_.strand_, std::bind(&Timer::on_timer, shared_from_this(), std::placeholders::_1))); + timer_.async_wait( + boost::asio::bind_executor( + overlay_.strand_, std::bind(&Timer::on_timer, shared_from_this(), std::placeholders::_1))); } void diff --git a/src/xrpld/overlay/detail/OverlayImpl.h b/src/xrpld/overlay/detail/OverlayImpl.h index 19fff6a29a..ca20ed6733 100644 --- a/src/xrpld/overlay/detail/OverlayImpl.h +++ b/src/xrpld/overlay/detail/OverlayImpl.h @@ -191,7 +191,8 @@ public: std::size_t& disabled, std::size_t& enabledInSkip) const; - void checkTracking(std::uint32_t) override; + void + checkTracking(std::uint32_t) override; std::shared_ptr findPeerByShortID(Peer::id_t const& id) const override; diff --git a/src/xrpld/overlay/detail/PeerImp.cpp b/src/xrpld/overlay/detail/PeerImp.cpp index ec641487a8..20f68a215b 100644 --- a/src/xrpld/overlay/detail/PeerImp.cpp +++ b/src/xrpld/overlay/detail/PeerImp.cpp @@ -532,8 +532,7 @@ void PeerImp::fail(std::string const& reason) { if (!strand_.running_in_this_thread()) - return post( - strand_, std::bind((void(Peer::*)(std::string const&)) & PeerImp::fail, shared_from_this(), reason)); + return post(strand_, std::bind((void (Peer::*)(std::string const&))&PeerImp::fail, shared_from_this(), reason)); if (!socket_.is_open()) return; diff --git a/src/xrpld/rpc/detail/RPCLedgerHelpers.cpp b/src/xrpld/rpc/detail/RPCLedgerHelpers.cpp index 2f3326a8e1..18acdd3fe1 100644 --- a/src/xrpld/rpc/detail/RPCLedgerHelpers.cpp +++ b/src/xrpld/rpc/detail/RPCLedgerHelpers.cpp @@ -355,8 +355,9 @@ getOrAcquireLedger(RPC::JsonContext const& context) if ((hasHash + hasIndex) != 1) { return Unexpected( - RPC::make_param_error("Exactly one of 'ledger_hash' or " - "'ledger_index' can be specified.")); + RPC::make_param_error( + "Exactly one of 'ledger_hash' or " + "'ledger_index' can be specified.")); } if (hasHash) diff --git a/src/xrpld/rpc/handlers/LedgerEntry.cpp b/src/xrpld/rpc/handlers/LedgerEntry.cpp index 440ed11c18..489e0c87ca 100644 --- a/src/xrpld/rpc/handlers/LedgerEntry.cpp +++ b/src/xrpld/rpc/handlers/LedgerEntry.cpp @@ -200,16 +200,18 @@ parseAuthorizeCredentials(Json::Value const& jv) std::uint32_t const n = jv.size(); if (n > maxCredentialsArraySize) { - return Unexpected(LedgerEntryHelpers::malformedError( - "malformedAuthorizedCredentials", - "Invalid field '" + std::string(jss::authorized_credentials) + "', array too long.")); + return Unexpected( + LedgerEntryHelpers::malformedError( + "malformedAuthorizedCredentials", + "Invalid field '" + std::string(jss::authorized_credentials) + "', array too long.")); } if (n == 0) { - return Unexpected(LedgerEntryHelpers::malformedError( - "malformedAuthorizedCredentials", - "Invalid field '" + std::string(jss::authorized_credentials) + "', array empty.")); + return Unexpected( + LedgerEntryHelpers::malformedError( + "malformedAuthorizedCredentials", + "Invalid field '" + std::string(jss::authorized_credentials) + "', array empty.")); } STArray arr(sfAuthorizeCredentials, n); diff --git a/src/xrpld/shamap/NodeFamily.cpp b/src/xrpld/shamap/NodeFamily.cpp index a05e89dc84..a0821ea202 100644 --- a/src/xrpld/shamap/NodeFamily.cpp +++ b/src/xrpld/shamap/NodeFamily.cpp @@ -10,19 +10,21 @@ NodeFamily::NodeFamily(Application& app, CollectorManager& cm) : app_(app) , db_(app.getNodeStore()) , j_(app.journal("NodeFamily")) - , fbCache_(std::make_shared( - "Node family full below cache", - stopwatch(), - app.journal("NodeFamilyFulLBelowCache"), - cm.collector(), - fullBelowTargetSize, - fullBelowExpiration)) - , tnCache_(std::make_shared( - "Node family tree node cache", - app.config().getValueFor(SizedItem::treeCacheSize), - std::chrono::seconds(app.config().getValueFor(SizedItem::treeCacheAge)), - stopwatch(), - j_)) + , fbCache_( + std::make_shared( + "Node family full below cache", + stopwatch(), + app.journal("NodeFamilyFulLBelowCache"), + cm.collector(), + fullBelowTargetSize, + fullBelowExpiration)) + , tnCache_( + std::make_shared( + "Node family tree node cache", + app.config().getValueFor(SizedItem::treeCacheSize), + std::chrono::seconds(app.config().getValueFor(SizedItem::treeCacheAge)), + stopwatch(), + j_)) { } From 5e3342c48d5af6213585a9e2d39de44f965aca4b Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Tue, 17 Feb 2026 13:23:10 +0000 Subject: [PATCH 57/61] increase timeout Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> --- .github/workflows/reusable-build-test-config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/reusable-build-test-config.yml b/.github/workflows/reusable-build-test-config.yml index 7b076400e9..0a6db6c199 100644 --- a/.github/workflows/reusable-build-test-config.yml +++ b/.github/workflows/reusable-build-test-config.yml @@ -77,7 +77,7 @@ jobs: runs-on: ${{ fromJSON(inputs.runs_on) }} container: ${{ inputs.image != '' && inputs.image || null }} # Sanitizer builds on GCC are taking longer than 60mins. Hence increasing the timeout to 90mins. - timeout-minutes: ${{ inputs.sanitizers != '' && 90 || 60 }} + timeout-minutes: ${{ inputs.sanitizers != '' && 150 || 60 }} env: # Use a namespace to keep the objects separate for each configuration. CCACHE_NAMESPACE: ${{ inputs.config_name }} From 36240116a540c8e52b92bd186641bffda147e4c1 Mon Sep 17 00:00:00 2001 From: Jingchen Date: Tue, 17 Feb 2026 16:29:53 +0000 Subject: [PATCH 58/61] refactor: Decouple app/tx from `Application` and `Config` (#6227) This change decouples app/tx from `Application` and `Config` to clear the way to moving transactors to `libxrpl`. --- .../scripts/levelization/results/ordering.txt | 1 + include/xrpl/core/NetworkIDService.h | 33 +++++++++++++++++++ include/xrpl/core/ServiceRegistry.h | 4 +++ src/test/app/NetworkID_test.cpp | 7 ++-- src/test/app/tx/apply_test.cpp | 8 ++--- src/test/jtx/impl/Env.cpp | 3 +- src/test/rpc/Subscribe_test.cpp | 13 +++++--- src/test/rpc/Transaction_test.cpp | 11 ++++--- src/xrpld/app/ledger/detail/BuildLedger.cpp | 1 + src/xrpld/app/main/Application.cpp | 10 ++++++ src/xrpld/app/misc/NetworkOPs.cpp | 16 ++++----- src/xrpld/app/misc/detail/AccountTxPaging.cpp | 3 +- src/xrpld/app/misc/setup_HashRouter.h | 5 +-- src/xrpld/app/rdb/backend/detail/Node.cpp | 3 +- src/xrpld/app/tx/apply.h | 8 ++--- src/xrpld/app/tx/applySteps.h | 12 +++---- src/xrpld/app/tx/detail/AMMCreate.cpp | 2 +- src/xrpld/app/tx/detail/ApplyContext.cpp | 4 +-- src/xrpld/app/tx/detail/ApplyContext.h | 12 +++---- src/xrpld/app/tx/detail/Batch.cpp | 2 +- src/xrpld/app/tx/detail/CancelCheck.cpp | 2 +- src/xrpld/app/tx/detail/CancelOffer.cpp | 2 +- src/xrpld/app/tx/detail/CashCheck.cpp | 2 +- src/xrpld/app/tx/detail/Change.cpp | 10 +++--- src/xrpld/app/tx/detail/CreateCheck.cpp | 2 +- src/xrpld/app/tx/detail/CreateOffer.cpp | 8 ++--- src/xrpld/app/tx/detail/CreateTicket.cpp | 2 +- src/xrpld/app/tx/detail/DeleteAccount.cpp | 24 +++++++------- src/xrpld/app/tx/detail/Escrow.cpp | 6 ++-- src/xrpld/app/tx/detail/PayChan.cpp | 6 ++-- src/xrpld/app/tx/detail/Payment.cpp | 2 +- src/xrpld/app/tx/detail/SetRegularKey.cpp | 2 +- src/xrpld/app/tx/detail/SetSignerList.cpp | 17 +++++----- src/xrpld/app/tx/detail/SetSignerList.h | 2 +- src/xrpld/app/tx/detail/SetTrust.cpp | 2 +- src/xrpld/app/tx/detail/Transactor.cpp | 21 ++++++------ src/xrpld/app/tx/detail/Transactor.h | 24 +++++++------- src/xrpld/app/tx/detail/apply.cpp | 27 +++++++-------- src/xrpld/app/tx/detail/applySteps.cpp | 23 ++++++------- src/xrpld/core/NetworkIDServiceImpl.h | 32 ++++++++++++++++++ .../core/detail/NetworkIDServiceImpl.cpp | 16 +++++++++ src/xrpld/overlay/detail/PeerImp.cpp | 4 +-- src/xrpld/rpc/detail/TransactionSign.cpp | 5 +-- src/xrpld/rpc/handlers/Simulate.cpp | 3 +- src/xrpld/rpc/handlers/Submit.cpp | 4 +-- src/xrpld/rpc/handlers/Tx.cpp | 5 +-- 46 files changed, 256 insertions(+), 155 deletions(-) create mode 100644 include/xrpl/core/NetworkIDService.h create mode 100644 src/xrpld/core/NetworkIDServiceImpl.h create mode 100644 src/xrpld/core/detail/NetworkIDServiceImpl.cpp diff --git a/.github/scripts/levelization/results/ordering.txt b/.github/scripts/levelization/results/ordering.txt index 5f8812c49b..30dc2be043 100644 --- a/.github/scripts/levelization/results/ordering.txt +++ b/.github/scripts/levelization/results/ordering.txt @@ -83,6 +83,7 @@ test.csf > xrpl.protocol test.json > test.jtx test.json > xrpl.json test.jtx > xrpl.basics +test.jtx > xrpl.core test.jtx > xrpld.app test.jtx > xrpld.core test.jtx > xrpld.rpc diff --git a/include/xrpl/core/NetworkIDService.h b/include/xrpl/core/NetworkIDService.h new file mode 100644 index 0000000000..d12fa42055 --- /dev/null +++ b/include/xrpl/core/NetworkIDService.h @@ -0,0 +1,33 @@ +#pragma once + +#include + +namespace xrpl { + +/** Service that provides access to the network ID. + + This service provides read-only access to the network ID configured + for this server. The network ID identifies which network (mainnet, + testnet, devnet, or custom network) this server is configured to + connect to. + + Well-known network IDs: + - 0: Mainnet + - 1: Testnet + - 2: Devnet + - 1025+: Custom networks (require NetworkID field in transactions) +*/ +class NetworkIDService +{ +public: + virtual ~NetworkIDService() = default; + + /** Get the configured network ID + * + * @return The network ID this server is configured for + */ + virtual std::uint32_t + getNetworkID() const noexcept = 0; +}; + +} // namespace xrpl diff --git a/include/xrpl/core/ServiceRegistry.h b/include/xrpl/core/ServiceRegistry.h index fabf61f9e4..1a2e33d5ee 100644 --- a/include/xrpl/core/ServiceRegistry.h +++ b/include/xrpl/core/ServiceRegistry.h @@ -41,6 +41,7 @@ class LoadFeeTrack; class LoadManager; class ManifestCache; class NetworkOPs; +class NetworkIDService; class OpenLedger; class OrderBookDB; class Overlay; @@ -99,6 +100,9 @@ public: virtual CachedSLEs& cachedSLEs() = 0; + virtual NetworkIDService& + getNetworkIDService() = 0; + // Protocol and validation services virtual AmendmentTable& getAmendmentTable() = 0; diff --git a/src/test/app/NetworkID_test.cpp b/src/test/app/NetworkID_test.cpp index 5fddc8f641..6b306f63fb 100644 --- a/src/test/app/NetworkID_test.cpp +++ b/src/test/app/NetworkID_test.cpp @@ -3,6 +3,7 @@ #include #include +#include #include namespace xrpl { @@ -58,7 +59,7 @@ public: // test mainnet { test::jtx::Env env{*this, makeNetworkConfig(0)}; - BEAST_EXPECT(env.app().config().NETWORK_ID == 0); + BEAST_EXPECT(env.app().getNetworkIDService().getNetworkID() == 0); // try to submit a txn without network id, this should work Json::Value jv; @@ -81,7 +82,7 @@ public: // NetworkID { test::jtx::Env env{*this, makeNetworkConfig(1024)}; - BEAST_EXPECT(env.app().config().NETWORK_ID == 1024); + BEAST_EXPECT(env.app().getNetworkIDService().getNetworkID() == 1024); // try to submit a txn without network id, this should work Json::Value jv; @@ -101,7 +102,7 @@ public: // absent networkid { test::jtx::Env env{*this, makeNetworkConfig(1025)}; - BEAST_EXPECT(env.app().config().NETWORK_ID == 1025); + BEAST_EXPECT(env.app().getNetworkIDService().getNetworkID() == 1025); { env.fund(XRP(200), alice); // try to submit a txn without network id, this should not work diff --git a/src/test/app/tx/apply_test.cpp b/src/test/app/tx/apply_test.cpp index fada168112..eb684175de 100644 --- a/src/test/app/tx/apply_test.cpp +++ b/src/test/app/tx/apply_test.cpp @@ -38,12 +38,8 @@ public: { test::jtx::Env fully_canonical(*this, test::jtx::testable_amendments()); - Validity valid = checkValidity( - fully_canonical.app().getHashRouter(), - tx, - fully_canonical.current()->rules(), - fully_canonical.app().config()) - .first; + Validity valid = + checkValidity(fully_canonical.app().getHashRouter(), tx, fully_canonical.current()->rules()).first; if (valid == Validity::Valid) fail("Non-Fully canonical signature was permitted"); } diff --git a/src/test/jtx/impl/Env.cpp b/src/test/jtx/impl/Env.cpp index 3fdfa2bf2a..636894c0d5 100644 --- a/src/test/jtx/impl/Env.cpp +++ b/src/test/jtx/impl/Env.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -526,7 +527,7 @@ Env::autofill(JTx& jt) if (jt.fill_netid) { - uint32_t networkID = app().config().NETWORK_ID; + uint32_t networkID = app().getNetworkIDService().getNetworkID(); if (!jv.isMember(jss::NetworkID) && networkID > 1024) jv[jss::NetworkID] = std::to_string(networkID); } diff --git a/src/test/rpc/Subscribe_test.cpp b/src/test/rpc/Subscribe_test.cpp index 759b02dcc7..99f664f42e 100644 --- a/src/test/rpc/Subscribe_test.cpp +++ b/src/test/rpc/Subscribe_test.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -106,7 +107,7 @@ public: BEAST_EXPECT(jv.isMember(jss::id) && jv[jss::id] == 5); } BEAST_EXPECT(jv[jss::result][jss::ledger_index] == 2); - BEAST_EXPECT(jv[jss::result][jss::network_id] == env.app().config().NETWORK_ID); + BEAST_EXPECT(jv[jss::result][jss::network_id] == env.app().getNetworkIDService().getNetworkID()); } { @@ -115,7 +116,8 @@ public: // Check stream update BEAST_EXPECT(wsc->findMsg(5s, [&](auto const& jv) { - return jv[jss::ledger_index] == 3 && jv[jss::network_id] == env.app().config().NETWORK_ID; + return jv[jss::ledger_index] == 3 && + jv[jss::network_id] == env.app().getNetworkIDService().getNetworkID(); })); } @@ -125,7 +127,8 @@ public: // Check stream update BEAST_EXPECT(wsc->findMsg(5s, [&](auto const& jv) { - return jv[jss::ledger_index] == 4 && jv[jss::network_id] == env.app().config().NETWORK_ID; + return jv[jss::ledger_index] == 4 && + jv[jss::network_id] == env.app().getNetworkIDService().getNetworkID(); })); } @@ -451,7 +454,7 @@ public: if (!jv.isMember(jss::validated_hash)) return false; - uint32_t netID = env.app().config().NETWORK_ID; + uint32_t netID = env.app().getNetworkIDService().getNetworkID(); if (!jv.isMember(jss::network_id) || jv[jss::network_id] != netID) return false; @@ -510,7 +513,7 @@ public: jv[jss::streams][0u] = "ledger"; jr = env.rpc("json", "subscribe", to_string(jv))[jss::result]; BEAST_EXPECT(jr[jss::status] == "success"); - BEAST_EXPECT(jr[jss::network_id] == env.app().config().NETWORK_ID); + BEAST_EXPECT(jr[jss::network_id] == env.app().getNetworkIDService().getNetworkID()); jr = env.rpc("json", "unsubscribe", to_string(jv))[jss::result]; BEAST_EXPECT(jr[jss::status] == "success"); diff --git a/src/test/rpc/Transaction_test.cpp b/src/test/rpc/Transaction_test.cpp index acc8bccf61..731caee429 100644 --- a/src/test/rpc/Transaction_test.cpp +++ b/src/test/rpc/Transaction_test.cpp @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -247,7 +248,7 @@ class Transaction_test : public beast::unit_test::suite char const* EXCESSIVE = RPC::get_error_info(rpcEXCESSIVE_LGR_RANGE).token; Env env{*this, makeNetworkConfig(11111)}; - uint32_t netID = env.app().config().NETWORK_ID; + uint32_t netID = env.app().getNetworkIDService().getNetworkID(); auto const alice = Account("alice"); env.fund(XRP(1000), alice); @@ -520,7 +521,7 @@ class Transaction_test : public beast::unit_test::suite for (uint32_t netID : {11111, 65535, 65536}) { Env env{*this, makeNetworkConfig(netID)}; - BEAST_EXPECT(netID == env.app().config().NETWORK_ID); + BEAST_EXPECT(netID == env.app().getNetworkIDService().getNetworkID()); auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -550,7 +551,7 @@ class Transaction_test : public beast::unit_test::suite // test querying with mixed case ctid { Env env{*this, makeNetworkConfig(11111)}; - std::uint32_t const netID = env.app().config().NETWORK_ID; + std::uint32_t const netID = env.app().getNetworkIDService().getNetworkID(); Account const alice = Account("alice"); Account const bob = Account("bob"); @@ -591,7 +592,7 @@ class Transaction_test : public beast::unit_test::suite for (uint32_t netID : {2, 1024, 65535, 65536}) { Env env{*this, makeNetworkConfig(netID)}; - BEAST_EXPECT(netID == env.app().config().NETWORK_ID); + BEAST_EXPECT(netID == env.app().getNetworkIDService().getNetworkID()); auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -623,7 +624,7 @@ class Transaction_test : public beast::unit_test::suite // test the wrong network ID was submitted { Env env{*this, makeNetworkConfig(21337)}; - uint32_t netID = env.app().config().NETWORK_ID; + uint32_t netID = env.app().getNetworkIDService().getNetworkID(); auto const alice = Account("alice"); auto const bob = Account("bob"); diff --git a/src/xrpld/app/ledger/detail/BuildLedger.cpp b/src/xrpld/app/ledger/detail/BuildLedger.cpp index 1414441b35..8321190add 100644 --- a/src/xrpld/app/ledger/detail/BuildLedger.cpp +++ b/src/xrpld/app/ledger/detail/BuildLedger.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include #include diff --git a/src/xrpld/app/main/Application.cpp b/src/xrpld/app/main/Application.cpp index c2a5437b70..f53ca9e36b 100644 --- a/src/xrpld/app/main/Application.cpp +++ b/src/xrpld/app/main/Application.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -158,6 +159,7 @@ public: NodeCache m_tempNodeCache; CachedSLEs cachedSLEs_; + std::unique_ptr networkIDService_; std::optional> nodeIdentity_; ValidatorKeys const validatorKeys_; @@ -290,6 +292,8 @@ public: , cachedSLEs_("Cached SLEs", 0, std::chrono::minutes(1), stopwatch(), logs_->journal("CachedSLEs")) + , networkIDService_(std::make_unique(config_->NETWORK_ID)) + , validatorKeys_(*config_, m_journal) , m_resourceManager(Resource::make_Manager(m_collectorManager->collector(), logs_->journal("Resource"))) @@ -632,6 +636,12 @@ public: return cachedSLEs_; } + NetworkIDService& + getNetworkIDService() override + { + return *networkIDService_; + } + AmendmentTable& getAmendmentTable() override { diff --git a/src/xrpld/app/misc/NetworkOPs.cpp b/src/xrpld/app/misc/NetworkOPs.cpp index 8732f9610d..44543e8910 100644 --- a/src/xrpld/app/misc/NetworkOPs.cpp +++ b/src/xrpld/app/misc/NetworkOPs.cpp @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -1101,8 +1102,8 @@ NetworkOPsImp::submitTransaction(std::shared_ptr const& iTrans) try { - auto const [validity, reason] = checkValidity( - registry_.getHashRouter(), *trans, m_ledgerMaster.getValidatedRules(), registry_.app().config()); + auto const [validity, reason] = + checkValidity(registry_.getHashRouter(), *trans, m_ledgerMaster.getValidatedRules()); if (validity != Validity::Valid) { @@ -1158,8 +1159,7 @@ NetworkOPsImp::preProcessTransaction(std::shared_ptr& transaction) // NOTE ximinez - I think this check is redundant, // but I'm not 100% sure yet. // If so, only cost is looking up HashRouter flags. - auto const [validity, reason] = - checkValidity(registry_.getHashRouter(), sttx, view->rules(), registry_.app().config()); + auto const [validity, reason] = checkValidity(registry_.getHashRouter(), sttx, view->rules()); XRPL_ASSERT(validity == Validity::Valid, "xrpl::NetworkOPsImp::processTransaction : valid validity"); // Not concerned with local checks at this point. @@ -2195,7 +2195,7 @@ NetworkOPsImp::pubValidation(std::shared_ptr const& val) jvObj[jss::flags] = val->getFlags(); jvObj[jss::signing_time] = *(*val)[~sfSigningTime]; jvObj[jss::data] = strHex(val->getSerializer().slice()); - jvObj[jss::network_id] = registry_.app().config().NETWORK_ID; + jvObj[jss::network_id] = registry_.getNetworkIDService().getNetworkID(); if (auto version = (*val)[~sfServerVersion]) jvObj[jss::server_version] = std::to_string(*version); @@ -2844,7 +2844,7 @@ NetworkOPsImp::pubLedger(std::shared_ptr const& lpAccepted) jvObj[jss::ledger_hash] = to_string(lpAccepted->header().hash); jvObj[jss::ledger_time] = Json::Value::UInt(lpAccepted->header().closeTime.time_since_epoch().count()); - jvObj[jss::network_id] = registry_.app().config().NETWORK_ID; + jvObj[jss::network_id] = registry_.getNetworkIDService().getNetworkID(); if (!lpAccepted->rules().enabled(featureXRPFees)) jvObj[jss::fee_ref] = Config::FEE_UNITS_DEPRECATED; @@ -2987,7 +2987,7 @@ NetworkOPsImp::transJson( lookup.second && lookup.second->isFieldPresent(sfTransactionIndex)) { uint32_t const txnSeq = lookup.second->getFieldU32(sfTransactionIndex); - uint32_t netID = registry_.app().config().NETWORK_ID; + uint32_t netID = registry_.getNetworkIDService().getNetworkID(); if (transaction->isFieldPresent(sfNetworkID)) netID = transaction->getFieldU32(sfNetworkID); @@ -3817,7 +3817,7 @@ NetworkOPsImp::subLedger(InfoSub::ref isrListener, Json::Value& jvResult) jvResult[jss::fee_base] = lpClosed->fees().base.jsonClipped(); jvResult[jss::reserve_base] = lpClosed->fees().reserve.jsonClipped(); jvResult[jss::reserve_inc] = lpClosed->fees().increment.jsonClipped(); - jvResult[jss::network_id] = registry_.app().config().NETWORK_ID; + jvResult[jss::network_id] = registry_.getNetworkIDService().getNetworkID(); } if ((mMode >= OperatingMode::SYNCING) && !isNeedNetworkLedger()) diff --git a/src/xrpld/app/misc/detail/AccountTxPaging.cpp b/src/xrpld/app/misc/detail/AccountTxPaging.cpp index e3fc2de4f8..63457f00ac 100644 --- a/src/xrpld/app/misc/detail/AccountTxPaging.cpp +++ b/src/xrpld/app/misc/detail/AccountTxPaging.cpp @@ -3,6 +3,7 @@ #include #include +#include #include namespace xrpl { @@ -30,7 +31,7 @@ convertBlobsToTxResult( Transaction::sqlTransactionStatus(status), ledger_index, metaset->getAsObject().getFieldU32(sfTransactionIndex), - app.config().NETWORK_ID); + app.getNetworkIDService().getNetworkID()); else tr->setStatus(Transaction::sqlTransactionStatus(status), ledger_index); diff --git a/src/xrpld/app/misc/setup_HashRouter.h b/src/xrpld/app/misc/setup_HashRouter.h index 3054233b89..9b767d0170 100644 --- a/src/xrpld/app/misc/setup_HashRouter.h +++ b/src/xrpld/app/misc/setup_HashRouter.h @@ -1,5 +1,4 @@ -#ifndef XRPLD_APP_MISC_SETUP_HASHROUTER_H_INCLUDED -#define XRPLD_APP_MISC_SETUP_HASHROUTER_H_INCLUDED +#pragma once #include @@ -13,5 +12,3 @@ HashRouter::Setup setup_HashRouter(Config const& config); } // namespace xrpl - -#endif diff --git a/src/xrpld/app/rdb/backend/detail/Node.cpp b/src/xrpld/app/rdb/backend/detail/Node.cpp index 7680689e0a..e6e8062674 100644 --- a/src/xrpld/app/rdb/backend/detail/Node.cpp +++ b/src/xrpld/app/rdb/backend/detail/Node.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -306,7 +307,7 @@ saveValidatedLedger( acceptedLedgerTx->getTxn()->getMetaSQL(seq, acceptedLedgerTx->getEscMeta()) + ";"); app.getMasterTransaction().inLedger( - transactionID, seq, acceptedLedgerTx->getTxnSeq(), app.config().NETWORK_ID); + transactionID, seq, acceptedLedgerTx->getTxnSeq(), app.getNetworkIDService().getNetworkID()); } tr.commit(); diff --git a/src/xrpld/app/tx/apply.h b/src/xrpld/app/tx/apply.h index c3ff4f905e..c21e7c1925 100644 --- a/src/xrpld/app/tx/apply.h +++ b/src/xrpld/app/tx/apply.h @@ -11,8 +11,8 @@ namespace xrpl { -class Application; class HashRouter; +class ServiceRegistry; /** Describes the pre-processing validity of a transaction. @@ -41,7 +41,7 @@ enum class Validity { @see Validity */ std::pair -checkValidity(HashRouter& router, STTx const& tx, Rules const& rules, Config const& config); +checkValidity(HashRouter& router, STTx const& tx, Rules const& rules); /** Sets the validity of a given transaction in the cache. @@ -97,7 +97,7 @@ forceValidity(HashRouter& router, uint256 const& txid, Validity validity); whether or not the transaction was applied. */ ApplyResult -apply(Application& app, OpenView& view, STTx const& tx, ApplyFlags flags, beast::Journal journal); +apply(ServiceRegistry& registry, OpenView& view, STTx const& tx, ApplyFlags flags, beast::Journal journal); /** Enum class for return value from `applyTransaction` @@ -121,7 +121,7 @@ enum class ApplyTransactionResult { */ ApplyTransactionResult applyTransaction( - Application& app, + ServiceRegistry& registry, OpenView& view, STTx const& tx, bool retryAssured, diff --git a/src/xrpld/app/tx/applySteps.h b/src/xrpld/app/tx/applySteps.h index ef87d352f3..7699ed2493 100644 --- a/src/xrpld/app/tx/applySteps.h +++ b/src/xrpld/app/tx/applySteps.h @@ -5,7 +5,7 @@ namespace xrpl { -class Application; +class ServiceRegistry; class STTx; class TxQ; @@ -240,11 +240,11 @@ public: */ /** @{ */ PreflightResult -preflight(Application& app, Rules const& rules, STTx const& tx, ApplyFlags flags, beast::Journal j); +preflight(ServiceRegistry& registry, Rules const& rules, STTx const& tx, ApplyFlags flags, beast::Journal j); PreflightResult preflight( - Application& app, + ServiceRegistry& registry, Rules const& rules, uint256 const& parentBatchId, STTx const& tx, @@ -281,7 +281,7 @@ preflight( this transaction. */ PreclaimResult -preclaim(PreflightResult const& preflightResult, Application& app, OpenView const& view); +preclaim(PreflightResult const& preflightResult, ServiceRegistry& registry, OpenView const& view); /** Compute only the expected base fee for a transaction. @@ -323,7 +323,7 @@ calculateDefaultBaseFee(ReadView const& view, STTx const& tx); @param preclaimResult The result of a previous call to `preclaim` for the transaction. - @param app The current running `Application`. + @param registry The service registry. @param view The open ledger that the transaction will attempt to be applied to. @@ -333,6 +333,6 @@ calculateDefaultBaseFee(ReadView const& view, STTx const& tx); whether or not the transaction was applied. */ ApplyResult -doApply(PreclaimResult const& preclaimResult, Application& app, OpenView& view); +doApply(PreclaimResult const& preclaimResult, ServiceRegistry& registry, OpenView& view); } // namespace xrpl diff --git a/src/xrpld/app/tx/detail/AMMCreate.cpp b/src/xrpld/app/tx/detail/AMMCreate.cpp index aa75a18e30..1131d21fd2 100644 --- a/src/xrpld/app/tx/detail/AMMCreate.cpp +++ b/src/xrpld/app/tx/detail/AMMCreate.cpp @@ -272,7 +272,7 @@ applyCreate(ApplyContext& ctx_, Sandbox& sb, AccountID const& account_, beast::J Book const book{issueIn, issueOut, std::nullopt}; auto const dir = keylet::quality(keylet::book(book), uRate); if (auto const bookExisted = static_cast(sb.read(dir)); !bookExisted) - ctx_.app.getOrderBookDB().addOrderBook(book); + ctx_.registry.getOrderBookDB().addOrderBook(book); }; addOrderBook(amount.issue(), amount2.issue(), getRate(amount2, amount)); addOrderBook(amount2.issue(), amount.issue(), getRate(amount, amount2)); diff --git a/src/xrpld/app/tx/detail/ApplyContext.cpp b/src/xrpld/app/tx/detail/ApplyContext.cpp index c5b4d31cec..71cb5cd936 100644 --- a/src/xrpld/app/tx/detail/ApplyContext.cpp +++ b/src/xrpld/app/tx/detail/ApplyContext.cpp @@ -8,7 +8,7 @@ namespace xrpl { ApplyContext::ApplyContext( - Application& app_, + ServiceRegistry& registry_, OpenView& base, std::optional const& parentBatchId, STTx const& tx_, @@ -16,7 +16,7 @@ ApplyContext::ApplyContext( XRPAmount baseFee_, ApplyFlags flags, beast::Journal journal_) - : app(app_) + : registry(registry_) , tx(tx_) , preclaimResult(preclaimResult_) , baseFee(baseFee_) diff --git a/src/xrpld/app/tx/detail/ApplyContext.h b/src/xrpld/app/tx/detail/ApplyContext.h index d2208c13a1..9e382556c2 100644 --- a/src/xrpld/app/tx/detail/ApplyContext.h +++ b/src/xrpld/app/tx/detail/ApplyContext.h @@ -1,9 +1,7 @@ #pragma once -#include -#include - #include +#include #include #include #include @@ -17,7 +15,7 @@ class ApplyContext { public: explicit ApplyContext( - Application& app, + ServiceRegistry& registry, OpenView& base, std::optional const& parentBatchId, STTx const& tx, @@ -27,19 +25,19 @@ public: beast::Journal journal = beast::Journal{beast::Journal::getNullSink()}); explicit ApplyContext( - Application& app, + ServiceRegistry& registry, OpenView& base, STTx const& tx, TER preclaimResult, XRPAmount baseFee, ApplyFlags flags, beast::Journal journal = beast::Journal{beast::Journal::getNullSink()}) - : ApplyContext(app, base, std::nullopt, tx, preclaimResult, baseFee, flags, journal) + : ApplyContext(registry, base, std::nullopt, tx, preclaimResult, baseFee, flags, journal) { XRPL_ASSERT((flags & tapBATCH) == 0, "Batch apply flag should not be set"); } - Application& app; + ServiceRegistry& registry; STTx const& tx; TER const preclaimResult; XRPAmount const baseFee; diff --git a/src/xrpld/app/tx/detail/Batch.cpp b/src/xrpld/app/tx/detail/Batch.cpp index 81f39193cb..f7f0d7ac60 100644 --- a/src/xrpld/app/tx/detail/Batch.cpp +++ b/src/xrpld/app/tx/detail/Batch.cpp @@ -296,7 +296,7 @@ Batch::preflight(PreflightContext const& ctx) } auto const innerAccount = stx.getAccountID(sfAccount); - if (auto const preflightResult = xrpl::preflight(ctx.app, ctx.rules, parentBatchId, stx, tapBATCH, ctx.j); + if (auto const preflightResult = xrpl::preflight(ctx.registry, ctx.rules, parentBatchId, stx, tapBATCH, ctx.j); preflightResult.ter != tesSUCCESS) { JLOG(ctx.j.debug()) << "BatchTrace[" << parentBatchId << "]: " diff --git a/src/xrpld/app/tx/detail/CancelCheck.cpp b/src/xrpld/app/tx/detail/CancelCheck.cpp index 086a126eb4..7936b3b9ed 100644 --- a/src/xrpld/app/tx/detail/CancelCheck.cpp +++ b/src/xrpld/app/tx/detail/CancelCheck.cpp @@ -62,7 +62,7 @@ CancelCheck::doApply() AccountID const srcId{sleCheck->getAccountID(sfAccount)}; AccountID const dstId{sleCheck->getAccountID(sfDestination)}; - auto viewJ = ctx_.app.journal("View"); + auto viewJ = ctx_.registry.journal("View"); // If the check is not written to self (and it shouldn't be), remove the // check from the destination account root. diff --git a/src/xrpld/app/tx/detail/CancelOffer.cpp b/src/xrpld/app/tx/detail/CancelOffer.cpp index 1dc9ad0bde..3b690cb730 100644 --- a/src/xrpld/app/tx/detail/CancelOffer.cpp +++ b/src/xrpld/app/tx/detail/CancelOffer.cpp @@ -54,7 +54,7 @@ CancelOffer::doApply() if (auto sleOffer = view().peek(keylet::offer(account_, offerSequence))) { JLOG(j_.debug()) << "Trying to cancel offer #" << offerSequence; - return offerDelete(view(), sleOffer, ctx_.app.journal("View")); + return offerDelete(view(), sleOffer, ctx_.registry.journal("View")); } JLOG(j_.debug()) << "Offer #" << offerSequence << " can't be found."; diff --git a/src/xrpld/app/tx/detail/CashCheck.cpp b/src/xrpld/app/tx/detail/CashCheck.cpp index 2cc25924a1..633ab1133a 100644 --- a/src/xrpld/app/tx/detail/CashCheck.cpp +++ b/src/xrpld/app/tx/detail/CashCheck.cpp @@ -228,7 +228,7 @@ CashCheck::doApply() // // If it is not a check to self (as should be the case), then there's // work to do... - auto viewJ = ctx_.app.journal("View"); + auto viewJ = ctx_.registry.journal("View"); auto const optDeliverMin = ctx_.tx[~sfDeliverMin]; if (srcId != account_) diff --git a/src/xrpld/app/tx/detail/Change.cpp b/src/xrpld/app/tx/detail/Change.cpp index 67c7db68c5..478377a818 100644 --- a/src/xrpld/app/tx/detail/Change.cpp +++ b/src/xrpld/app/tx/detail/Change.cpp @@ -1,5 +1,3 @@ -#include -#include #include #include @@ -195,7 +193,7 @@ Change::applyAmendment() entry[sfAmendment] = amendment; entry[sfCloseTime] = view().parentCloseTime().time_since_epoch().count(); - if (!ctx_.app.getAmendmentTable().isSupported(amendment)) + if (!ctx_.registry.getAmendmentTable().isSupported(amendment)) { JLOG(j_.warn()) << "Unsupported amendment " << amendment << " received a majority."; } @@ -206,12 +204,12 @@ Change::applyAmendment() amendments.push_back(amendment); amendmentObject->setFieldV256(sfAmendments, amendments); - ctx_.app.getAmendmentTable().enable(amendment); + ctx_.registry.getAmendmentTable().enable(amendment); - if (!ctx_.app.getAmendmentTable().isSupported(amendment)) + if (!ctx_.registry.getAmendmentTable().isSupported(amendment)) { JLOG(j_.error()) << "Unsupported amendment " << amendment << " activated: server blocked."; - ctx_.app.getOPs().setAmendmentBlocked(); + ctx_.registry.getOPs().setAmendmentBlocked(); } } diff --git a/src/xrpld/app/tx/detail/CreateCheck.cpp b/src/xrpld/app/tx/detail/CreateCheck.cpp index d10863df46..7511f2df2e 100644 --- a/src/xrpld/app/tx/detail/CreateCheck.cpp +++ b/src/xrpld/app/tx/detail/CreateCheck.cpp @@ -164,7 +164,7 @@ CreateCheck::doApply() view().insert(sleCheck); - auto viewJ = ctx_.app.journal("View"); + auto viewJ = ctx_.registry.journal("View"); // If it's not a self-send (and it shouldn't be), add Check to the // destination's owner directory. if (dstAccountId != account_) diff --git a/src/xrpld/app/tx/detail/CreateOffer.cpp b/src/xrpld/app/tx/detail/CreateOffer.cpp index 666023233d..d40109f571 100644 --- a/src/xrpld/app/tx/detail/CreateOffer.cpp +++ b/src/xrpld/app/tx/detail/CreateOffer.cpp @@ -144,7 +144,7 @@ CreateOffer::preclaim(PreclaimContext const& ctx) std::uint32_t const uAccountSequence = sleCreator->getFieldU32(sfSequence); - auto viewJ = ctx.app.journal("View"); + auto viewJ = ctx.registry.journal("View"); if (isGlobalFrozen(ctx.view, uPaysIssuerID) || isGlobalFrozen(ctx.view, uGetsIssuerID)) { @@ -489,7 +489,7 @@ CreateOffer::applyHybrid( bookArr.push_back(std::move(bookInfo)); if (!bookExists) - ctx_.app.getOrderBookDB().addOrderBook(book); + ctx_.registry.getOrderBookDB().addOrderBook(book); sleOffer->setFieldArray(sfAdditionalBooks, bookArr); return tesSUCCESS; @@ -523,7 +523,7 @@ CreateOffer::applyGuts(Sandbox& sb, Sandbox& sbCancel) // end up on the books. auto uRate = getRate(saTakerGets, saTakerPays); - auto viewJ = ctx_.app.journal("View"); + auto viewJ = ctx_.registry.journal("View"); TER result = tesSUCCESS; @@ -825,7 +825,7 @@ CreateOffer::applyGuts(Sandbox& sb, Sandbox& sbCancel) sb.insert(sleOffer); if (!bookExisted) - ctx_.app.getOrderBookDB().addOrderBook(book); + ctx_.registry.getOrderBookDB().addOrderBook(book); JLOG(j_.debug()) << "final result: success"; diff --git a/src/xrpld/app/tx/detail/CreateTicket.cpp b/src/xrpld/app/tx/detail/CreateTicket.cpp index eb42904a0b..1ce067087c 100644 --- a/src/xrpld/app/tx/detail/CreateTicket.cpp +++ b/src/xrpld/app/tx/detail/CreateTicket.cpp @@ -68,7 +68,7 @@ CreateTicket::doApply() return tecINSUFFICIENT_RESERVE; } - beast::Journal viewJ{ctx_.app.journal("View")}; + beast::Journal viewJ{ctx_.registry.journal("View")}; // The starting ticket sequence is the same as the current account // root sequence. Before we got here to doApply(), the transaction diff --git a/src/xrpld/app/tx/detail/DeleteAccount.cpp b/src/xrpld/app/tx/detail/DeleteAccount.cpp index 18961469a3..5d2d2e85a7 100644 --- a/src/xrpld/app/tx/detail/DeleteAccount.cpp +++ b/src/xrpld/app/tx/detail/DeleteAccount.cpp @@ -51,7 +51,7 @@ DeleteAccount::calculateBaseFee(ReadView const& view, STTx const& tx) namespace { // Define a function pointer type that can be used to delete ledger node types. using DeleterFuncPtr = TER (*)( - Application& app, + ServiceRegistry& registry, ApplyView& view, AccountID const& account, uint256 const& delIndex, @@ -61,7 +61,7 @@ using DeleterFuncPtr = TER (*)( // Local function definitions that provides signature compatibility. TER offerDelete( - Application& app, + ServiceRegistry&, ApplyView& view, AccountID const& account, uint256 const& delIndex, @@ -73,19 +73,19 @@ offerDelete( TER removeSignersFromLedger( - Application& app, + ServiceRegistry& registry, ApplyView& view, AccountID const& account, uint256 const& delIndex, std::shared_ptr const& sleDel, beast::Journal j) { - return SetSignerList::removeFromLedger(app, view, account, j); + return SetSignerList::removeFromLedger(registry, view, account, j); } TER removeTicketFromLedger( - Application&, + ServiceRegistry&, ApplyView& view, AccountID const& account, uint256 const& delIndex, @@ -97,7 +97,7 @@ removeTicketFromLedger( TER removeDepositPreauthFromLedger( - Application&, + ServiceRegistry&, ApplyView& view, AccountID const&, uint256 const& delIndex, @@ -109,7 +109,7 @@ removeDepositPreauthFromLedger( TER removeNFTokenOfferFromLedger( - Application& app, + ServiceRegistry&, ApplyView& view, AccountID const& account, uint256 const& delIndex, @@ -124,7 +124,7 @@ removeNFTokenOfferFromLedger( TER removeDIDFromLedger( - Application& app, + ServiceRegistry&, ApplyView& view, AccountID const& account, uint256 const& delIndex, @@ -136,7 +136,7 @@ removeDIDFromLedger( TER removeOracleFromLedger( - Application&, + ServiceRegistry&, ApplyView& view, AccountID const& account, uint256 const&, @@ -148,7 +148,7 @@ removeOracleFromLedger( TER removeCredentialFromLedger( - Application&, + ServiceRegistry&, ApplyView& view, AccountID const&, uint256 const&, @@ -160,7 +160,7 @@ removeCredentialFromLedger( TER removeDelegateFromLedger( - Application& app, + ServiceRegistry&, ApplyView& view, AccountID const& account, uint256 const& delIndex, @@ -351,7 +351,7 @@ DeleteAccount::doApply() std::shared_ptr& sleItem) -> std::pair { if (auto deleter = nonObligationDeleter(nodeType)) { - TER const result{deleter(ctx_.app, view(), account_, dirEntry, sleItem, j_)}; + TER const result{deleter(ctx_.registry, view(), account_, dirEntry, sleItem, j_)}; return {result, SkipEntry::No}; } diff --git a/src/xrpld/app/tx/detail/Escrow.cpp b/src/xrpld/app/tx/detail/Escrow.cpp index dea9d3aa2b..2014dcc926 100644 --- a/src/xrpld/app/tx/detail/Escrow.cpp +++ b/src/xrpld/app/tx/detail/Escrow.cpp @@ -544,7 +544,7 @@ EscrowFinish::preflightSigValidated(PreflightContext const& ctx) if (cb && fb) { - auto& router = ctx.app.getHashRouter(); + auto& router = ctx.registry.getHashRouter(); auto const id = ctx.tx.getTransactionID(); auto const flags = router.getFlags(id); @@ -900,7 +900,7 @@ EscrowFinish::doApply() // Check cryptocondition fulfillment { auto const id = ctx_.tx.getTransactionID(); - auto flags = ctx_.app.getHashRouter().getFlags(id); + auto flags = ctx_.registry.getHashRouter().getFlags(id); auto const cb = ctx_.tx[~sfCondition]; @@ -920,7 +920,7 @@ EscrowFinish::doApply() else flags = SF_CF_INVALID; - ctx_.app.getHashRouter().setFlags(id, flags); + ctx_.registry.getHashRouter().setFlags(id, flags); // LCOV_EXCL_STOP } diff --git a/src/xrpld/app/tx/detail/PayChan.cpp b/src/xrpld/app/tx/detail/PayChan.cpp index baa8770e53..860784ecba 100644 --- a/src/xrpld/app/tx/detail/PayChan.cpp +++ b/src/xrpld/app/tx/detail/PayChan.cpp @@ -310,7 +310,7 @@ PayChanFund::doApply() auto const cancelAfter = (*slep)[~sfCancelAfter]; auto const closeTime = ctx_.view().header().parentCloseTime.time_since_epoch().count(); if ((cancelAfter && closeTime >= *cancelAfter) || (expiration && closeTime >= *expiration)) - return closeChannel(slep, ctx_.view(), k.key, ctx_.app.journal("View")); + return closeChannel(slep, ctx_.view(), k.key, ctx_.registry.journal("View")); } if (src != txAccount) @@ -456,7 +456,7 @@ PayChanClaim::doApply() auto const cancelAfter = (*slep)[~sfCancelAfter]; auto const closeTime = ctx_.view().header().parentCloseTime.time_since_epoch().count(); if ((cancelAfter && closeTime >= *cancelAfter) || (curExpiration && closeTime >= *curExpiration)) - return closeChannel(slep, ctx_.view(), k.key, ctx_.app.journal("View")); + return closeChannel(slep, ctx_.view(), k.key, ctx_.registry.journal("View")); } if (txAccount != src && txAccount != dst) @@ -513,7 +513,7 @@ PayChanClaim::doApply() { // Channel will close immediately if dry or the receiver closes if (dst == txAccount || (*slep)[sfBalance] == (*slep)[sfAmount]) - return closeChannel(slep, ctx_.view(), k.key, ctx_.app.journal("View")); + return closeChannel(slep, ctx_.view(), k.key, ctx_.registry.journal("View")); auto const settleExpiration = ctx_.view().header().parentCloseTime.time_since_epoch().count() + (*slep)[sfSettleDelay]; diff --git a/src/xrpld/app/tx/detail/Payment.cpp b/src/xrpld/app/tx/detail/Payment.cpp index 390548b7ef..19b2d8acc2 100644 --- a/src/xrpld/app/tx/detail/Payment.cpp +++ b/src/xrpld/app/tx/detail/Payment.cpp @@ -414,7 +414,7 @@ Payment::doApply() account_, ctx_.tx.getFieldPathSet(sfPaths), ctx_.tx[~sfDomainID], - ctx_.app.logs(), + ctx_.registry.logs(), &rcInput); // VFALCO NOTE We might not need to apply, depending // on the TER. But always applying *should* diff --git a/src/xrpld/app/tx/detail/SetRegularKey.cpp b/src/xrpld/app/tx/detail/SetRegularKey.cpp index 14302c67c4..a7f2acfbfe 100644 --- a/src/xrpld/app/tx/detail/SetRegularKey.cpp +++ b/src/xrpld/app/tx/detail/SetRegularKey.cpp @@ -47,7 +47,7 @@ SetRegularKey::doApply() if (!sle) return tefINTERNAL; // LCOV_EXCL_LINE - if (!minimumFee(ctx_.app, ctx_.baseFee, view().fees(), view().flags())) + if (!minimumFee(ctx_.registry, ctx_.baseFee, view().fees(), view().flags())) sle->setFlag(lsfPasswordSpent); if (ctx_.tx.isFieldPresent(sfRegularKey)) diff --git a/src/xrpld/app/tx/detail/SetSignerList.cpp b/src/xrpld/app/tx/detail/SetSignerList.cpp index 1864e82b99..f6a65d2711 100644 --- a/src/xrpld/app/tx/detail/SetSignerList.cpp +++ b/src/xrpld/app/tx/detail/SetSignerList.cpp @@ -1,8 +1,8 @@ -#include #include #include #include +#include #include #include #include @@ -151,7 +151,7 @@ signerCountBasedOwnerCountDelta(std::size_t entryCount, Rules const& rules) static TER removeSignersFromLedger( - Application& app, + ServiceRegistry& registry, ApplyView& view, Keylet const& accountKeylet, Keylet const& ownerDirKeylet, @@ -187,7 +187,7 @@ removeSignersFromLedger( // LCOV_EXCL_STOP } - adjustOwnerCount(view, view.peek(accountKeylet), removeFromOwnerCount, app.journal("View")); + adjustOwnerCount(view, view.peek(accountKeylet), removeFromOwnerCount, registry.journal("View")); view.erase(signers); @@ -195,13 +195,13 @@ removeSignersFromLedger( } TER -SetSignerList::removeFromLedger(Application& app, ApplyView& view, AccountID const& account, beast::Journal j) +SetSignerList::removeFromLedger(ServiceRegistry& registry, ApplyView& view, AccountID const& account, beast::Journal j) { auto const accountKeylet = keylet::account(account); auto const ownerDirKeylet = keylet::ownerDir(account); auto const signerListKeylet = keylet::signers(account); - return removeSignersFromLedger(app, view, accountKeylet, ownerDirKeylet, signerListKeylet, j); + return removeSignersFromLedger(registry, view, accountKeylet, ownerDirKeylet, signerListKeylet, j); } NotTEC @@ -273,7 +273,8 @@ SetSignerList::replaceSignerList() // This may be either a create or a replace. Preemptively remove any // old signer list. May reduce the reserve, so this is done before // checking the reserve. - if (TER const ter = removeSignersFromLedger(ctx_.app, view(), accountKeylet, ownerDirKeylet, signerListKeylet, j_)) + if (TER const ter = + removeSignersFromLedger(ctx_.registry, view(), accountKeylet, ownerDirKeylet, signerListKeylet, j_)) return ter; auto const sle = view().peek(accountKeylet); @@ -299,7 +300,7 @@ SetSignerList::replaceSignerList() view().insert(signerList); writeSignersToSLE(signerList, flags); - auto viewJ = ctx_.app.journal("View"); + auto viewJ = ctx_.registry.journal("View"); // Add the signer list to the account's directory. auto const page = ctx_.view().dirInsert(ownerDirKeylet, signerListKeylet, describeOwnerDir(account_)); @@ -332,7 +333,7 @@ SetSignerList::destroySignerList() auto const ownerDirKeylet = keylet::ownerDir(account_); auto const signerListKeylet = keylet::signers(account_); - return removeSignersFromLedger(ctx_.app, view(), accountKeylet, ownerDirKeylet, signerListKeylet, j_); + return removeSignersFromLedger(ctx_.registry, view(), accountKeylet, ownerDirKeylet, signerListKeylet, j_); } void diff --git a/src/xrpld/app/tx/detail/SetSignerList.h b/src/xrpld/app/tx/detail/SetSignerList.h index efd8e508f9..cac9ce1288 100644 --- a/src/xrpld/app/tx/detail/SetSignerList.h +++ b/src/xrpld/app/tx/detail/SetSignerList.h @@ -44,7 +44,7 @@ public: // Interface used by DeleteAccount static TER - removeFromLedger(Application& app, ApplyView& view, AccountID const& account, beast::Journal j); + removeFromLedger(ServiceRegistry& registry, ApplyView& view, AccountID const& account, beast::Journal j); private: static std::tuple, Operation> diff --git a/src/xrpld/app/tx/detail/SetTrust.cpp b/src/xrpld/app/tx/detail/SetTrust.cpp index ce8ca05a09..ada6524008 100644 --- a/src/xrpld/app/tx/detail/SetTrust.cpp +++ b/src/xrpld/app/tx/detail/SetTrust.cpp @@ -352,7 +352,7 @@ SetTrust::doApply() bool const bSetDeepFreeze = (uTxFlags & tfSetDeepFreeze); bool const bClearDeepFreeze = (uTxFlags & tfClearDeepFreeze); - auto viewJ = ctx_.app.journal("View"); + auto viewJ = ctx_.registry.journal("View"); SLE::pointer sleDst = view().peek(keylet::account(uDstAccountID)); diff --git a/src/xrpld/app/tx/detail/Transactor.cpp b/src/xrpld/app/tx/detail/Transactor.cpp index a7bb7992fb..129c06fdd5 100644 --- a/src/xrpld/app/tx/detail/Transactor.cpp +++ b/src/xrpld/app/tx/detail/Transactor.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -32,7 +33,7 @@ preflight0(PreflightContext const& ctx, std::uint32_t flagMask) if (!isPseudoTx(ctx.tx) || ctx.tx.isFieldPresent(sfNetworkID)) { - uint32_t nodeNID = ctx.app.config().NETWORK_ID; + uint32_t nodeNID = ctx.registry.getNetworkIDService().getNetworkID(); std::optional txNID = ctx.tx[~sfNetworkID]; if (nodeNID <= 1024) @@ -204,7 +205,7 @@ Transactor::preflight2(PreflightContext const& ctx) // Do not add any checks after this point that are relevant for // batch inner transactions. They will be skipped. - auto const sigValid = checkValidity(ctx.app.getHashRouter(), ctx.tx, ctx.rules, ctx.app.config()); + auto const sigValid = checkValidity(ctx.registry.getHashRouter(), ctx.tx, ctx.rules); if (sigValid.first == Validity::SigBad) { // LCOV_EXCL_START JLOG(ctx.j.debug()) << "preflight2: bad signature. " << sigValid.second; @@ -303,9 +304,9 @@ Transactor::calculateOwnerReserveFee(ReadView const& view, STTx const& tx) } XRPAmount -Transactor::minimumFee(Application& app, XRPAmount baseFee, Fees const& fees, ApplyFlags flags) +Transactor::minimumFee(ServiceRegistry& registry, XRPAmount baseFee, Fees const& fees, ApplyFlags flags) { - return scaleFeeLoad(baseFee, app.getFeeTrack(), fees, flags & tapUNLIMITED); + return scaleFeeLoad(baseFee, registry.getFeeTrack(), fees, flags & tapUNLIMITED); } TER @@ -331,7 +332,7 @@ Transactor::checkFee(PreclaimContext const& ctx, XRPAmount baseFee) // Only check fee is sufficient when the ledger is open. if (ctx.view.open()) { - auto const feeDue = minimumFee(ctx.app, baseFee, ctx.view.fees(), ctx.flags); + auto const feeDue = minimumFee(ctx.registry, baseFee, ctx.view.fees(), ctx.flags); if (feePaid < feeDue) { @@ -1071,7 +1072,7 @@ Transactor::operator()() } #endif - if (auto const& trap = ctx_.app.trapTxID(); trap && *trap == ctx_.tx.getTransactionID()) + if (auto const& trap = ctx_.registry.trapTxID(); trap && *trap == ctx_.tx.getTransactionID()) { trapTransaction(*trap); } @@ -1172,16 +1173,16 @@ Transactor::operator()() // If necessary, remove any offers found unfunded during processing if ((result == tecOVERSIZE) || (result == tecKILLED)) - removeUnfundedOffers(view(), removedOffers, ctx_.app.journal("View")); + removeUnfundedOffers(view(), removedOffers, ctx_.registry.journal("View")); if (result == tecEXPIRED) - removeExpiredNFTokenOffers(view(), expiredNFTokenOffers, ctx_.app.journal("View")); + removeExpiredNFTokenOffers(view(), expiredNFTokenOffers, ctx_.registry.journal("View")); if (result == tecINCOMPLETE) - removeDeletedTrustLines(view(), removedTrustLines, ctx_.app.journal("View")); + removeDeletedTrustLines(view(), removedTrustLines, ctx_.registry.journal("View")); if (result == tecEXPIRED) - removeExpiredCredentials(view(), expiredCredentials, ctx_.app.journal("View")); + removeExpiredCredentials(view(), expiredCredentials, ctx_.registry.journal("View")); applied = isTecClaim(result); } diff --git a/src/xrpld/app/tx/detail/Transactor.h b/src/xrpld/app/tx/detail/Transactor.h index e06086a55d..5cb95843d5 100644 --- a/src/xrpld/app/tx/detail/Transactor.h +++ b/src/xrpld/app/tx/detail/Transactor.h @@ -14,7 +14,7 @@ namespace xrpl { struct PreflightContext { public: - Application& app; + ServiceRegistry& registry; STTx const& tx; Rules const rules; ApplyFlags flags; @@ -22,24 +22,24 @@ public: beast::Journal const j; PreflightContext( - Application& app_, + ServiceRegistry& registry_, STTx const& tx_, uint256 parentBatchId_, Rules const& rules_, ApplyFlags flags_, beast::Journal j_ = beast::Journal{beast::Journal::getNullSink()}) - : app(app_), tx(tx_), rules(rules_), flags(flags_), parentBatchId(parentBatchId_), j(j_) + : registry(registry_), tx(tx_), rules(rules_), flags(flags_), parentBatchId(parentBatchId_), j(j_) { XRPL_ASSERT((flags_ & tapBATCH) == tapBATCH, "Batch apply flag should be set"); } PreflightContext( - Application& app_, + ServiceRegistry& registry_, STTx const& tx_, Rules const& rules_, ApplyFlags flags_, beast::Journal j_ = beast::Journal{beast::Journal::getNullSink()}) - : app(app_), tx(tx_), rules(rules_), flags(flags_), j(j_) + : registry(registry_), tx(tx_), rules(rules_), flags(flags_), j(j_) { XRPL_ASSERT((flags_ & tapBATCH) == 0, "Batch apply flag should not be set"); } @@ -52,7 +52,7 @@ public: struct PreclaimContext { public: - Application& app; + ServiceRegistry& registry; ReadView const& view; TER preflightResult; ApplyFlags flags; @@ -61,14 +61,14 @@ public: beast::Journal const j; PreclaimContext( - Application& app_, + ServiceRegistry& registry_, ReadView const& view_, TER preflightResult_, STTx const& tx_, ApplyFlags flags_, std::optional parentBatchId_, beast::Journal j_ = beast::Journal{beast::Journal::getNullSink()}) - : app(app_) + : registry(registry_) , view(view_) , preflightResult(preflightResult_) , flags(flags_) @@ -82,13 +82,13 @@ public: } PreclaimContext( - Application& app_, + ServiceRegistry& registry_, ReadView const& view_, TER preflightResult_, STTx const& tx_, ApplyFlags flags_, beast::Journal j_ = beast::Journal{beast::Journal::getNullSink()}) - : PreclaimContext(app_, view_, preflightResult_, tx_, flags_, std::nullopt, j_) + : PreclaimContext(registry_, view_, preflightResult_, tx_, flags_, std::nullopt, j_) { XRPL_ASSERT((flags_ & tapBATCH) == 0, "Batch apply flag should not be set"); } @@ -225,14 +225,14 @@ protected: /** Compute the minimum fee required to process a transaction with a given baseFee based on the current server load. - @param app The application hosting the server + @param registry The service registry. @param baseFee The base fee of a candidate transaction @see xrpl::calculateBaseFee @param fees Fee settings from the current ledger @param flags Transaction processing fees */ static XRPAmount - minimumFee(Application& app, XRPAmount baseFee, Fees const& fees, ApplyFlags flags); + minimumFee(ServiceRegistry& registry, XRPAmount baseFee, Fees const& fees, ApplyFlags flags); // Returns the fee in fee units, not scaled for load. static XRPAmount diff --git a/src/xrpld/app/tx/detail/apply.cpp b/src/xrpld/app/tx/detail/apply.cpp index 1c7a509007..0f7d2eb2a3 100644 --- a/src/xrpld/app/tx/detail/apply.cpp +++ b/src/xrpld/app/tx/detail/apply.cpp @@ -19,7 +19,7 @@ constexpr HashRouterFlags SF_LOCALGOOD = HashRouterFlags::PRIVATE4; // Local ch //------------------------------------------------------------------------------ std::pair -checkValidity(HashRouter& router, STTx const& tx, Rules const& rules, Config const& config) +checkValidity(HashRouter& router, STTx const& tx, Rules const& rules) { auto const id = tx.getTransactionID(); auto const flags = router.getFlags(id); @@ -108,32 +108,33 @@ forceValidity(HashRouter& router, uint256 const& txid, Validity validity) template ApplyResult -apply(Application& app, OpenView& view, PreflightChecks&& preflightChecks) +apply(ServiceRegistry& registry, OpenView& view, PreflightChecks&& preflightChecks) { NumberSO stNumberSO{view.rules().enabled(fixUniversalNumber)}; - return doApply(preclaim(preflightChecks(), app, view), app, view); + return doApply(preclaim(preflightChecks(), registry, view), registry, view); } ApplyResult -apply(Application& app, OpenView& view, STTx const& tx, ApplyFlags flags, beast::Journal j) +apply(ServiceRegistry& registry, OpenView& view, STTx const& tx, ApplyFlags flags, beast::Journal j) { - return apply(app, view, [&]() mutable { return preflight(app, view.rules(), tx, flags, j); }); + return apply(registry, view, [&]() mutable { return preflight(registry, view.rules(), tx, flags, j); }); } ApplyResult apply( - Application& app, + ServiceRegistry& registry, OpenView& view, uint256 const& parentBatchId, STTx const& tx, ApplyFlags flags, beast::Journal j) { - return apply(app, view, [&]() mutable { return preflight(app, view.rules(), parentBatchId, tx, flags, j); }); + return apply( + registry, view, [&]() mutable { return preflight(registry, view.rules(), parentBatchId, tx, flags, j); }); } static bool -applyBatchTransactions(Application& app, OpenView& batchView, STTx const& batchTxn, beast::Journal j) +applyBatchTransactions(ServiceRegistry& registry, OpenView& batchView, STTx const& batchTxn, beast::Journal j) { XRPL_ASSERT( batchTxn.getTxnType() == ttBATCH && batchTxn.getFieldArray(sfRawTransactions).size() != 0, @@ -142,10 +143,10 @@ applyBatchTransactions(Application& app, OpenView& batchView, STTx const& batchT auto const parentBatchId = batchTxn.getTransactionID(); auto const mode = batchTxn.getFlags(); - auto applyOneTransaction = [&app, &j, &parentBatchId, &batchView](STTx&& tx) { + auto applyOneTransaction = [®istry, &j, &parentBatchId, &batchView](STTx&& tx) { OpenView perTxBatchView(batch_view, batchView); - auto const ret = apply(app, perTxBatchView, parentBatchId, tx, tapBATCH, j); + auto const ret = apply(registry, perTxBatchView, parentBatchId, tx, tapBATCH, j); XRPL_ASSERT( ret.applied == (isTesSuccess(ret.ter) || isTecClaim(ret.ter)), "Inner transaction should not be applied"); @@ -189,7 +190,7 @@ applyBatchTransactions(Application& app, OpenView& batchView, STTx const& batchT ApplyTransactionResult applyTransaction( - Application& app, + ServiceRegistry& registry, OpenView& view, STTx const& txn, bool retryAssured, @@ -204,7 +205,7 @@ applyTransaction( try { - auto const result = apply(app, view, txn, flags, j); + auto const result = apply(registry, view, txn, flags, j); if (result.applied) { @@ -216,7 +217,7 @@ applyTransaction( { OpenView wholeBatchView(batch_view, view); - if (applyBatchTransactions(app, wholeBatchView, txn, j)) + if (applyBatchTransactions(registry, wholeBatchView, txn, j)) wholeBatchView.apply(view); } diff --git a/src/xrpld/app/tx/detail/applySteps.cpp b/src/xrpld/app/tx/detail/applySteps.cpp index 06f0db1a79..412b717428 100644 --- a/src/xrpld/app/tx/detail/applySteps.cpp +++ b/src/xrpld/app/tx/detail/applySteps.cpp @@ -14,6 +14,7 @@ // DO NOT INCLUDE TRANSACTOR HEADER FILES HERE. // See the instructions at the top of transactions.macro instead. +#include #include #include @@ -292,9 +293,9 @@ invoke_apply(ApplyContext& ctx) } PreflightResult -preflight(Application& app, Rules const& rules, STTx const& tx, ApplyFlags flags, beast::Journal j) +preflight(ServiceRegistry& registry, Rules const& rules, STTx const& tx, ApplyFlags flags, beast::Journal j) { - PreflightContext const pfCtx(app, tx, rules, flags, j); + PreflightContext const pfCtx(registry, tx, rules, flags, j); try { return {pfCtx, invoke_preflight(pfCtx)}; @@ -308,14 +309,14 @@ preflight(Application& app, Rules const& rules, STTx const& tx, ApplyFlags flags PreflightResult preflight( - Application& app, + ServiceRegistry& registry, Rules const& rules, uint256 const& parentBatchId, STTx const& tx, ApplyFlags flags, beast::Journal j) { - PreflightContext const pfCtx(app, tx, parentBatchId, rules, flags, j); + PreflightContext const pfCtx(registry, tx, parentBatchId, rules, flags, j); try { return {pfCtx, invoke_preflight(pfCtx)}; @@ -328,7 +329,7 @@ preflight( } PreclaimResult -preclaim(PreflightResult const& preflightResult, Application& app, OpenView const& view) +preclaim(PreflightResult const& preflightResult, ServiceRegistry& registry, OpenView const& view) { std::optional ctx; if (preflightResult.rules != view.rules()) @@ -336,18 +337,18 @@ preclaim(PreflightResult const& preflightResult, Application& app, OpenView cons auto secondFlight = [&]() { if (preflightResult.parentBatchId) return preflight( - app, + registry, view.rules(), preflightResult.parentBatchId.value(), preflightResult.tx, preflightResult.flags, preflightResult.j); - return preflight(app, view.rules(), preflightResult.tx, preflightResult.flags, preflightResult.j); + return preflight(registry, view.rules(), preflightResult.tx, preflightResult.flags, preflightResult.j); }(); ctx.emplace( - app, + registry, view, secondFlight.ter, secondFlight.tx, @@ -358,7 +359,7 @@ preclaim(PreflightResult const& preflightResult, Application& app, OpenView cons else { ctx.emplace( - app, + registry, view, preflightResult.ter, preflightResult.tx, @@ -393,7 +394,7 @@ calculateDefaultBaseFee(ReadView const& view, STTx const& tx) } ApplyResult -doApply(PreclaimResult const& preclaimResult, Application& app, OpenView& view) +doApply(PreclaimResult const& preclaimResult, ServiceRegistry& registry, OpenView& view) { if (preclaimResult.view.seq() != view.seq()) { @@ -406,7 +407,7 @@ doApply(PreclaimResult const& preclaimResult, Application& app, OpenView& view) if (!preclaimResult.likelyToClaimFee) return {preclaimResult.ter, false}; ApplyContext ctx( - app, + registry, view, preclaimResult.parentBatchId, preclaimResult.tx, diff --git a/src/xrpld/core/NetworkIDServiceImpl.h b/src/xrpld/core/NetworkIDServiceImpl.h new file mode 100644 index 0000000000..1176f8d4ac --- /dev/null +++ b/src/xrpld/core/NetworkIDServiceImpl.h @@ -0,0 +1,32 @@ +#pragma once + +#include + +#include + +namespace xrpl { + +// Forward declaration +class Config; + +/** Implementation of NetworkIDService that reads from Config. + + This class provides a NetworkIDService interface that wraps + the network ID from the application Config. It caches the + network ID at construction time. +*/ +class NetworkIDServiceImpl final : public NetworkIDService +{ +public: + explicit NetworkIDServiceImpl(std::uint32_t networkID); + + ~NetworkIDServiceImpl() override = default; + + std::uint32_t + getNetworkID() const noexcept override; + +private: + std::uint32_t networkID_; +}; + +} // namespace xrpl diff --git a/src/xrpld/core/detail/NetworkIDServiceImpl.cpp b/src/xrpld/core/detail/NetworkIDServiceImpl.cpp new file mode 100644 index 0000000000..839eb0c464 --- /dev/null +++ b/src/xrpld/core/detail/NetworkIDServiceImpl.cpp @@ -0,0 +1,16 @@ +#include +#include + +namespace xrpl { + +NetworkIDServiceImpl::NetworkIDServiceImpl(std::uint32_t networkID) : networkID_(networkID) +{ +} + +std::uint32_t +NetworkIDServiceImpl::getNetworkID() const noexcept +{ + return networkID_; +} + +} // namespace xrpl diff --git a/src/xrpld/overlay/detail/PeerImp.cpp b/src/xrpld/overlay/detail/PeerImp.cpp index 20f68a215b..ca7364c756 100644 --- a/src/xrpld/overlay/detail/PeerImp.cpp +++ b/src/xrpld/overlay/detail/PeerImp.cpp @@ -2722,8 +2722,8 @@ PeerImp::checkTransaction( if (checkSignature) { // Check the signature before handing off to the job queue. - if (auto [valid, validReason] = checkValidity( - app_.getHashRouter(), *stx, app_.getLedgerMaster().getValidatedRules(), app_.config()); + if (auto [valid, validReason] = + checkValidity(app_.getHashRouter(), *stx, app_.getLedgerMaster().getValidatedRules()); valid != Validity::Valid) { if (!validReason.empty()) diff --git a/src/xrpld/rpc/detail/TransactionSign.cpp b/src/xrpld/rpc/detail/TransactionSign.cpp index 5e71d2c427..6f7d80b2a6 100644 --- a/src/xrpld/rpc/detail/TransactionSign.cpp +++ b/src/xrpld/rpc/detail/TransactionSign.cpp @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -466,7 +467,7 @@ transactionPreProcessImpl( if (!tx_json.isMember(jss::NetworkID)) { - auto const networkId = app.config().NETWORK_ID; + auto const networkId = app.getNetworkIDService().getNetworkID(); if (networkId > 1024) tx_json[jss::NetworkID] = to_string(networkId); } @@ -637,7 +638,7 @@ transactionConstructImpl(std::shared_ptr const& stTx, Rules const& r auto sttxNew = std::make_shared(sit); if (!app.checkSigs()) forceValidity(app.getHashRouter(), sttxNew->getTransactionID(), Validity::SigGoodOnly); - if (checkValidity(app.getHashRouter(), *sttxNew, rules, app.config()).first != Validity::Valid) + if (checkValidity(app.getHashRouter(), *sttxNew, rules).first != Validity::Valid) { ret.first = RPC::make_error(rpcINTERNAL, "Invalid signature."); return ret; diff --git a/src/xrpld/rpc/handlers/Simulate.cpp b/src/xrpld/rpc/handlers/Simulate.cpp index 58b40e2048..120dbfa2e5 100644 --- a/src/xrpld/rpc/handlers/Simulate.cpp +++ b/src/xrpld/rpc/handlers/Simulate.cpp @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -128,7 +129,7 @@ autofillTx(Json::Value& tx_json, RPC::JsonContext& context) if (!tx_json.isMember(jss::NetworkID)) { - auto const networkId = context.app.config().NETWORK_ID; + auto const networkId = context.app.getNetworkIDService().getNetworkID(); if (networkId > 1024) tx_json[jss::NetworkID] = to_string(networkId); } diff --git a/src/xrpld/rpc/handlers/Submit.cpp b/src/xrpld/rpc/handlers/Submit.cpp index 577501d581..5b29d35f50 100644 --- a/src/xrpld/rpc/handlers/Submit.cpp +++ b/src/xrpld/rpc/handlers/Submit.cpp @@ -76,8 +76,8 @@ doSubmit(RPC::JsonContext& context) { if (!context.app.checkSigs()) forceValidity(context.app.getHashRouter(), stTx->getTransactionID(), Validity::SigGoodOnly); - auto [validity, reason] = checkValidity( - context.app.getHashRouter(), *stTx, context.ledgerMaster.getCurrentLedger()->rules(), context.app.config()); + auto [validity, reason] = + checkValidity(context.app.getHashRouter(), *stTx, context.ledgerMaster.getCurrentLedger()->rules()); if (validity != Validity::Valid) { jvResult[jss::error] = "invalidTransaction"; diff --git a/src/xrpld/rpc/handlers/Tx.cpp b/src/xrpld/rpc/handlers/Tx.cpp index d2d7bed04d..e78a31d73c 100644 --- a/src/xrpld/rpc/handlers/Tx.cpp +++ b/src/xrpld/rpc/handlers/Tx.cpp @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -147,7 +148,7 @@ doTxHelp(RPC::Context& context, TxArgs args) { uint32_t lgrSeq = ledger->header().seq; uint32_t txnIdx = meta->getAsObject().getFieldU32(sfTransactionIndex); - uint32_t netID = context.app.config().NETWORK_ID; + uint32_t netID = context.app.getNetworkIDService().getNetworkID(); if (txnIdx <= 0xFFFFU && netID < 0xFFFFU && lgrSeq < 0x0FFF'FFFFUL) result.ctid = RPC::encodeCTID(lgrSeq, (uint32_t)txnIdx, (uint32_t)netID); @@ -267,7 +268,7 @@ doTxJson(RPC::JsonContext& context) return rpcError(rpcINVALID_PARAMS); auto const [lgr_seq, txn_idx, net_id] = *ctid; - if (net_id != context.app.config().NETWORK_ID) + if (net_id != context.app.getNetworkIDService().getNetworkID()) { std::stringstream out; out << "Wrong network. You should submit this request to a node " From c4a94bb00040632c46f9c3b0e732ddc17d75e278 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Tue, 17 Feb 2026 17:20:17 +0000 Subject: [PATCH 59/61] do not fix the stack size Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> --- include/xrpl/core/Coro.ipp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/include/xrpl/core/Coro.ipp b/include/xrpl/core/Coro.ipp index 36b1ce9a71..b397fcd65c 100644 --- a/include/xrpl/core/Coro.ipp +++ b/include/xrpl/core/Coro.ipp @@ -8,16 +8,14 @@ JobQueue::Coro::Coro(Coro_create_t, JobQueue& jq, JobType type, std::string cons , type_(type) , name_(name) , running_(false) - , coro_( - boost::context::fixedsize_stack(4 * 1024 * 1024), - [this, fn = std::forward(f)](boost::coroutines2::coroutine::push_type& do_yield) { - yield_ = &do_yield; - yield(); - fn(shared_from_this()); + , coro_([this, fn = std::forward(f)](boost::coroutines2::coroutine::push_type& do_yield) { + yield_ = &do_yield; + yield(); + fn(shared_from_this()); #ifndef NDEBUG - finished_ = true; + finished_ = true; #endif - }) + }) { } From 0976b2b68b64972af8e6e7c497900b5bce9fe22f Mon Sep 17 00:00:00 2001 From: Jingchen Date: Tue, 17 Feb 2026 18:10:07 +0000 Subject: [PATCH 60/61] refactor: Modularize app/tx (#6228) --- .../scripts/levelization/results/ordering.txt | 22 +++- cmake/XrplCore.cmake | 7 +- cmake/XrplInstall.cmake | 1 + .../xrpl/ledger}/AmendmentTable.h | 9 +- include/xrpl/protocol/Protocol.h | 10 ++ .../xrpl/protocol/detail/transactions.macro | 124 +++++++++--------- .../xrpl/server}/LoadFeeTrack.h | 0 .../detail => include/xrpl/tx}/ApplyContext.h | 0 .../xrpl/tx}/InvariantCheck.h | 0 .../xrpl/tx}/SignerEntries.h | 3 +- .../detail => include/xrpl/tx}/Transactor.h | 5 +- {src/xrpld/app => include/xrpl}/tx/apply.h | 4 +- .../app => include/xrpl}/tx/applySteps.h | 0 .../xrpl/tx/paths}/BookTip.h | 0 .../app => include/xrpl/tx}/paths/Flow.h | 5 +- .../detail => include/xrpl/tx/paths}/Offer.h | 0 .../xrpl/tx/paths}/OfferStream.h | 5 +- .../xrpl/tx}/paths/RippleCalc.h | 0 .../xrpl/tx}/paths/detail/AmountSpec.h | 0 .../xrpl/tx}/paths/detail/FlatSets.h | 0 .../xrpl/tx}/paths/detail/FlowDebugInfo.h | 3 +- .../xrpl/tx}/paths/detail/Steps.h | 3 +- .../xrpl/tx}/paths/detail/StrandFlow.h | 15 +-- .../xrpl/tx/transactors/AMM}/AMMBid.h | 2 +- .../xrpl/tx/transactors/AMM}/AMMClawback.h | 2 +- .../xrpl/tx/transactors/AMM}/AMMContext.h | 0 .../xrpl/tx/transactors/AMM}/AMMCreate.h | 2 +- .../xrpl/tx/transactors/AMM}/AMMDelete.h | 2 +- .../xrpl/tx/transactors/AMM}/AMMDeposit.h | 2 +- .../xrpl/tx/transactors/AMM}/AMMHelpers.h | 0 .../xrpl/tx/transactors/AMM}/AMMUtils.h | 0 .../xrpl/tx/transactors/AMM}/AMMVote.h | 2 +- .../xrpl/tx/transactors/AMM}/AMMWithdraw.h | 3 +- .../xrpl/tx/transactors}/Batch.h | 3 +- .../xrpl/tx/transactors}/Change.h | 2 +- .../xrpl/tx/transactors/Check}/CancelCheck.h | 2 +- .../xrpl/tx/transactors/Check}/CashCheck.h | 2 +- .../xrpl/tx/transactors/Check}/CreateCheck.h | 2 +- .../xrpl/tx/transactors}/Clawback.h | 2 +- .../xrpl/tx/transactors}/CreateTicket.h | 2 +- .../xrpl/tx/transactors}/Credentials.h | 2 +- .../xrpl/tx/transactors}/DID.h | 2 +- .../tx/transactors/Delegate}/DelegateSet.h | 2 +- .../tx/transactors/Delegate}/DelegateUtils.h | 0 .../xrpl/tx/transactors}/DeleteAccount.h | 2 +- .../xrpl/tx/transactors}/DeleteOracle.h | 2 +- .../xrpl/tx/transactors}/DepositPreauth.h | 2 +- .../xrpl/tx/transactors}/Escrow.h | 2 +- .../xrpl/tx/transactors}/LedgerStateFix.h | 2 +- .../tx/transactors/Lending}/LendingHelpers.h | 0 .../Lending}/LoanBrokerCoverClawback.h | 2 +- .../Lending}/LoanBrokerCoverDeposit.h | 2 +- .../Lending}/LoanBrokerCoverWithdraw.h | 2 +- .../transactors/Lending}/LoanBrokerDelete.h | 2 +- .../tx/transactors/Lending}/LoanBrokerSet.h | 2 +- .../xrpl/tx/transactors/Lending}/LoanDelete.h | 2 +- .../xrpl/tx/transactors/Lending}/LoanManage.h | 2 +- .../xrpl/tx/transactors/Lending}/LoanPay.h | 2 +- .../xrpl/tx/transactors/Lending}/LoanSet.h | 4 +- .../tx/transactors/MPT}/MPTokenAuthorize.h | 2 +- .../transactors/MPT}/MPTokenIssuanceCreate.h | 3 +- .../transactors/MPT}/MPTokenIssuanceDestroy.h | 2 +- .../tx/transactors/MPT}/MPTokenIssuanceSet.h | 2 +- .../tx/transactors/NFT}/NFTokenAcceptOffer.h | 2 +- .../xrpl/tx/transactors/NFT}/NFTokenBurn.h | 2 +- .../tx/transactors/NFT}/NFTokenCancelOffer.h | 2 +- .../tx/transactors/NFT}/NFTokenCreateOffer.h | 2 +- .../xrpl/tx/transactors/NFT}/NFTokenMint.h | 5 +- .../xrpl/tx/transactors/NFT}/NFTokenModify.h | 2 +- .../xrpl/tx/transactors/NFT}/NFTokenUtils.h | 3 +- .../xrpl/tx/transactors/Offer}/CancelOffer.h | 3 +- .../xrpl/tx/transactors/Offer}/CreateOffer.h | 3 +- .../xrpl/tx/transactors}/PayChan.h | 2 +- .../xrpl/tx/transactors}/Payment.h | 2 +- .../tx/transactors}/PermissionedDEXHelpers.h | 0 .../PermissionedDomainDelete.h | 2 +- .../PermissionedDomainSet.h | 2 +- .../xrpl/tx/transactors}/SetAccount.h | 3 +- .../xrpl/tx/transactors}/SetOracle.h | 2 +- .../xrpl/tx/transactors}/SetRegularKey.h | 2 +- .../xrpl/tx/transactors}/SetSignerList.h | 5 +- .../xrpl/tx/transactors}/SetTrust.h | 3 +- .../tx/transactors/Vault}/VaultClawback.h | 2 +- .../xrpl/tx/transactors/Vault}/VaultCreate.h | 2 +- .../xrpl/tx/transactors/Vault}/VaultDelete.h | 2 +- .../xrpl/tx/transactors/Vault}/VaultDeposit.h | 2 +- .../xrpl/tx/transactors/Vault}/VaultSet.h | 2 +- .../tx/transactors/Vault}/VaultWithdraw.h | 2 +- .../xrpl/tx/transactors}/XChainBridge.h | 3 +- src/libxrpl/protocol/Protocol.cpp | 15 +++ .../server}/LoadFeeTrack.cpp | 3 +- .../tx/detail => libxrpl/tx}/ApplyContext.cpp | 5 +- .../detail => libxrpl/tx}/InvariantCheck.cpp | 11 +- .../detail => libxrpl/tx}/SignerEntries.cpp | 4 +- .../tx/detail => libxrpl/tx}/Transactor.cpp | 13 +- .../app/tx/detail => libxrpl/tx}/apply.cpp | 5 +- .../tx/detail => libxrpl/tx}/applySteps.cpp | 2 +- .../detail => libxrpl/tx/paths}/BookTip.cpp | 2 +- src/{xrpld/app => libxrpl/tx}/paths/Flow.cpp | 11 +- .../tx/paths}/OfferStream.cpp | 5 +- .../app => libxrpl/tx}/paths/RippleCalc.cpp | 7 +- .../tx/transactors/AMM}/AMMBid.cpp | 7 +- .../tx/transactors/AMM}/AMMClawback.cpp | 9 +- .../tx/transactors/AMM}/AMMCreate.cpp | 7 +- .../tx/transactors/AMM}/AMMDelete.cpp | 5 +- .../tx/transactors/AMM}/AMMDeposit.cpp | 7 +- .../tx/transactors/AMM}/AMMHelpers.cpp | 2 +- .../tx/transactors/AMM}/AMMUtils.cpp | 5 +- .../tx/transactors/AMM}/AMMVote.cpp | 5 +- .../tx/transactors/AMM}/AMMWithdraw.cpp | 7 +- .../tx/transactors}/Batch.cpp | 5 +- .../tx/transactors}/Change.cpp | 5 +- .../tx/transactors/Check}/CancelCheck.cpp | 3 +- .../tx/transactors/Check}/CashCheck.cpp | 5 +- .../tx/transactors/Check}/CreateCheck.cpp | 3 +- .../tx/transactors}/Clawback.cpp | 3 +- .../tx/transactors}/CreateTicket.cpp | 3 +- .../tx/transactors}/Credentials.cpp | 3 +- .../detail => libxrpl/tx/transactors}/DID.cpp | 3 +- .../tx/transactors/Delegate}/DelegateSet.cpp | 3 +- .../transactors/Delegate}/DelegateUtils.cpp | 3 +- .../tx/transactors}/DeleteAccount.cpp | 15 +-- .../tx/transactors}/DeleteOracle.cpp | 3 +- .../tx/transactors}/DepositPreauth.cpp | 3 +- .../tx/transactors}/Escrow.cpp | 5 +- .../tx/transactors}/LedgerStateFix.cpp | 5 +- .../transactors/Lending}/LendingHelpers.cpp | 4 +- .../Lending}/LoanBrokerCoverClawback.cpp | 5 +- .../Lending}/LoanBrokerCoverDeposit.cpp | 5 +- .../Lending}/LoanBrokerCoverWithdraw.cpp | 7 +- .../transactors/Lending}/LoanBrokerDelete.cpp | 5 +- .../tx/transactors/Lending}/LoanBrokerSet.cpp | 5 +- .../tx/transactors/Lending}/LoanDelete.cpp | 5 +- .../tx/transactors/Lending}/LoanManage.cpp | 5 +- .../tx/transactors/Lending}/LoanPay.cpp | 7 +- .../tx/transactors/Lending}/LoanSet.cpp | 5 +- .../tx/transactors/MPT}/MPTokenAuthorize.cpp | 3 +- .../MPT}/MPTokenIssuanceCreate.cpp | 3 +- .../MPT}/MPTokenIssuanceDestroy.cpp | 3 +- .../transactors/MPT}/MPTokenIssuanceSet.cpp | 5 +- .../transactors/NFT}/NFTokenAcceptOffer.cpp | 5 +- .../tx/transactors/NFT}/NFTokenBurn.cpp | 5 +- .../transactors/NFT}/NFTokenCancelOffer.cpp | 5 +- .../transactors/NFT}/NFTokenCreateOffer.cpp | 5 +- .../tx/transactors/NFT}/NFTokenMint.cpp | 3 +- .../tx/transactors/NFT}/NFTokenModify.cpp | 5 +- .../tx/transactors/NFT}/NFTokenUtils.cpp | 3 +- .../tx/transactors/Offer}/CancelOffer.cpp | 3 +- .../tx/transactors/Offer}/CreateOffer.cpp | 7 +- .../tx/transactors}/PayChan.cpp | 3 +- .../tx/transactors}/Payment.cpp | 9 +- .../PermissionedDEXHelpers.cpp | 3 +- .../PermissionedDomainDelete.cpp | 3 +- .../PermissionedDomainSet.cpp | 3 +- .../tx/transactors}/SetAccount.cpp | 5 +- .../tx/transactors}/SetOracle.cpp | 3 +- .../tx/transactors}/SetRegularKey.cpp | 3 +- .../tx/transactors}/SetSignerList.cpp | 3 +- .../tx/transactors}/SetTrust.cpp | 5 +- .../tx/transactors/Vault}/VaultClawback.cpp | 4 +- .../tx/transactors/Vault}/VaultCreate.cpp | 7 +- .../tx/transactors/Vault}/VaultDelete.cpp | 3 +- .../tx/transactors/Vault}/VaultDeposit.cpp | 5 +- .../tx/transactors/Vault}/VaultSet.cpp | 3 +- .../tx/transactors/Vault}/VaultWithdraw.cpp | 3 +- .../tx/transactors}/XChainBridge.cpp | 9 +- src/test/app/AMMCalc_test.cpp | 3 +- src/test/app/AMMClawback_test.cpp | 3 +- src/test/app/AMMExtended_test.cpp | 8 +- src/test/app/AMM_test.cpp | 9 +- src/test/app/AmendmentTable_test.cpp | 2 +- src/test/app/Batch_test.cpp | 4 +- src/test/app/EscrowToken_test.cpp | 3 +- src/test/app/Escrow_test.cpp | 3 +- src/test/app/FeeVote_test.cpp | 2 +- src/test/app/FixNFTokenPageLinks_test.cpp | 5 +- src/test/app/Flow_test.cpp | 4 +- src/test/app/Invariants_test.cpp | 5 +- src/test/app/LedgerHistory_test.cpp | 2 +- src/test/app/LendingHelpers_test.cpp | 9 +- src/test/app/LoadFeeTrack_test.cpp | 2 +- src/test/app/LoanBroker_test.cpp | 3 +- src/test/app/Loan_test.cpp | 10 +- src/test/app/NFTokenAuth_test.cpp | 2 +- src/test/app/NFTokenBurn_test.cpp | 3 +- src/test/app/NFTokenDir_test.cpp | 3 +- src/test/app/NFToken_test.cpp | 3 +- src/test/app/OfferStream_test.cpp | 3 +- src/test/app/PayStrand_test.cpp | 6 +- src/test/app/PermissionedDEX_test.cpp | 3 +- src/test/app/PermissionedDomains_test.cpp | 3 +- src/test/app/PseudoTx_test.cpp | 3 +- src/test/app/Regression_test.cpp | 2 +- src/test/app/TheoreticalQuality_test.cpp | 9 +- src/test/app/TxQ_test.cpp | 4 +- src/test/app/tx/apply_test.cpp | 3 +- src/test/consensus/NegativeUNL_test.cpp | 2 +- src/test/jtx/impl/AMM.cpp | 5 +- src/test/jtx/impl/ledgerStateFixes.cpp | 3 +- src/test/jtx/impl/token.cpp | 3 +- src/test/rpc/AccountObjects_test.cpp | 3 +- src/test/rpc/AccountSet_test.cpp | 3 +- src/test/rpc/Feature_test.cpp | 3 +- src/test/rpc/JSONRPC_test.cpp | 2 +- src/test/rpc/LedgerEntry_test.cpp | 3 +- src/test/rpc/Subscribe_test.cpp | 2 +- src/test/server/ServerStatus_test.cpp | 2 +- src/xrpld/app/consensus/RCLConsensus.cpp | 4 +- src/xrpld/app/ledger/Ledger.cpp | 10 +- src/xrpld/app/ledger/Ledger.h | 5 - src/xrpld/app/ledger/OrderBookDBImpl.cpp | 3 +- src/xrpld/app/ledger/detail/BuildLedger.cpp | 2 +- src/xrpld/app/ledger/detail/LedgerCleaner.cpp | 2 +- src/xrpld/app/ledger/detail/LedgerMaster.cpp | 4 +- src/xrpld/app/ledger/detail/OpenLedger.cpp | 2 +- src/xrpld/app/main/Application.cpp | 7 +- src/xrpld/app/main/LoadManager.cpp | 2 +- src/xrpld/app/misc/AmendmentTableImpl.h | 18 +++ src/xrpld/app/misc/NetworkOPs.cpp | 7 +- src/xrpld/app/misc/TxQ.h | 3 +- src/xrpld/app/misc/detail/AmendmentTable.cpp | 4 +- src/xrpld/app/misc/detail/Transaction.cpp | 2 +- src/xrpld/app/misc/detail/TxQ.cpp | 2 +- src/xrpld/app/paths/AMMLiquidity.h | 7 +- src/xrpld/app/paths/PathRequest.cpp | 4 +- src/xrpld/app/paths/Pathfinder.cpp | 2 +- src/xrpld/app/paths/detail/BookStep.cpp | 8 +- src/xrpld/app/paths/detail/DirectStep.cpp | 2 +- src/xrpld/app/paths/detail/PaySteps.cpp | 3 +- .../app/paths/detail/XRPEndpointStep.cpp | 4 +- src/xrpld/overlay/detail/PeerImp.cpp | 4 +- src/xrpld/rpc/detail/LegacyPathFind.cpp | 2 +- src/xrpld/rpc/detail/RPCHelpers.cpp | 2 +- src/xrpld/rpc/detail/TransactionSign.cpp | 4 +- src/xrpld/rpc/detail/TransactionSign.h | 2 +- src/xrpld/rpc/handlers/AMMInfo.cpp | 2 +- src/xrpld/rpc/handlers/AccountObjects.cpp | 2 +- src/xrpld/rpc/handlers/Feature1.cpp | 2 +- src/xrpld/rpc/handlers/LedgerHandler.cpp | 2 +- src/xrpld/rpc/handlers/NoRippleCheck.cpp | 2 +- src/xrpld/rpc/handlers/Peers.cpp | 2 +- src/xrpld/rpc/handlers/Simulate.cpp | 2 +- src/xrpld/rpc/handlers/Submit.cpp | 2 +- 243 files changed, 486 insertions(+), 548 deletions(-) rename {src/xrpld/app/misc => include/xrpl/ledger}/AmendmentTable.h (97%) rename {src/xrpld/app/misc => include/xrpl/server}/LoadFeeTrack.h (100%) rename {src/xrpld/app/tx/detail => include/xrpl/tx}/ApplyContext.h (100%) rename {src/xrpld/app/tx/detail => include/xrpl/tx}/InvariantCheck.h (100%) rename {src/xrpld/app/tx/detail => include/xrpl/tx}/SignerEntries.h (97%) rename {src/xrpld/app/tx/detail => include/xrpl/tx}/Transactor.h (99%) rename {src/xrpld/app => include/xrpl}/tx/apply.h (98%) rename {src/xrpld/app => include/xrpl}/tx/applySteps.h (100%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/paths}/BookTip.h (100%) rename {src/xrpld/app => include/xrpl/tx}/paths/Flow.h (95%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/paths}/Offer.h (100%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/paths}/OfferStream.h (98%) rename {src/xrpld/app => include/xrpl/tx}/paths/RippleCalc.h (100%) rename {src/xrpld/app => include/xrpl/tx}/paths/detail/AmountSpec.h (100%) rename {src/xrpld/app => include/xrpl/tx}/paths/detail/FlatSets.h (100%) rename {src/xrpld/app => include/xrpl/tx}/paths/detail/FlowDebugInfo.h (99%) rename {src/xrpld/app => include/xrpl/tx}/paths/detail/Steps.h (99%) rename {src/xrpld/app => include/xrpl/tx}/paths/detail/StrandFlow.h (98%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/AMM}/AMMBid.h (98%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/AMM}/AMMClawback.h (97%) rename {src/xrpld/app/paths => include/xrpl/tx/transactors/AMM}/AMMContext.h (100%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/AMM}/AMMCreate.h (98%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/AMM}/AMMDelete.h (94%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/AMM}/AMMDeposit.h (99%) rename {src/xrpld/app/misc => include/xrpl/tx/transactors/AMM}/AMMHelpers.h (100%) rename {src/xrpld/app/misc => include/xrpl/tx/transactors/AMM}/AMMUtils.h (100%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/AMM}/AMMVote.h (97%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/AMM}/AMMWithdraw.h (99%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors}/Batch.h (96%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors}/Change.h (93%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/Check}/CancelCheck.h (90%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/Check}/CashCheck.h (90%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/Check}/CreateCheck.h (90%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors}/Clawback.h (91%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors}/CreateTicket.h (98%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors}/Credentials.h (97%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors}/DID.h (95%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/Delegate}/DelegateSet.h (92%) rename {src/xrpld/app/misc => include/xrpl/tx/transactors/Delegate}/DelegateUtils.h (100%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors}/DeleteAccount.h (93%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors}/DeleteOracle.h (95%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors}/DepositPreauth.h (93%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors}/Escrow.h (97%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors}/LedgerStateFix.h (92%) rename {src/xrpld/app/misc => include/xrpl/tx/transactors/Lending}/LendingHelpers.h (100%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/Lending}/LoanBrokerCoverClawback.h (93%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/Lending}/LoanBrokerCoverDeposit.h (92%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/Lending}/LoanBrokerCoverWithdraw.h (93%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/Lending}/LoanBrokerDelete.h (92%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/Lending}/LoanBrokerSet.h (93%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/Lending}/LoanDelete.h (92%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/Lending}/LoanManage.h (96%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/Lending}/LoanPay.h (94%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/Lending}/LoanSet.h (93%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/MPT}/MPTokenAuthorize.h (94%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/MPT}/MPTokenIssuanceCreate.h (96%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/MPT}/MPTokenIssuanceDestroy.h (91%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/MPT}/MPTokenIssuanceSet.h (93%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/NFT}/NFTokenAcceptOffer.h (95%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/NFT}/NFTokenBurn.h (90%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/NFT}/NFTokenCancelOffer.h (91%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/NFT}/NFTokenCreateOffer.h (91%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/NFT}/NFTokenMint.h (89%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/NFT}/NFTokenModify.h (90%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/NFT}/NFTokenUtils.h (98%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/Offer}/CancelOffer.h (91%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/Offer}/CreateOffer.h (97%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors}/PayChan.h (97%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors}/Payment.h (95%) rename {src/xrpld/app/misc => include/xrpl/tx/transactors}/PermissionedDEXHelpers.h (100%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/PermissionedDomain}/PermissionedDomainDelete.h (91%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/PermissionedDomain}/PermissionedDomainSet.h (92%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors}/SetAccount.h (94%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors}/SetOracle.h (94%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors}/SetRegularKey.h (90%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors}/SetSignerList.h (94%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors}/SetTrust.h (93%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/Vault}/VaultClawback.h (93%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/Vault}/VaultCreate.h (92%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/Vault}/VaultDelete.h (90%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/Vault}/VaultDeposit.h (90%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/Vault}/VaultSet.h (91%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors/Vault}/VaultWithdraw.h (90%) rename {src/xrpld/app/tx/detail => include/xrpl/tx/transactors}/XChainBridge.h (99%) create mode 100644 src/libxrpl/protocol/Protocol.cpp rename src/{xrpld/app/misc/detail => libxrpl/server}/LoadFeeTrack.cpp (98%) rename src/{xrpld/app/tx/detail => libxrpl/tx}/ApplyContext.cpp (97%) rename src/{xrpld/app/tx/detail => libxrpl/tx}/InvariantCheck.cpp (99%) rename src/{xrpld/app/tx/detail => libxrpl/tx}/SignerEntries.cpp (95%) rename src/{xrpld/app/tx/detail => libxrpl/tx}/Transactor.cpp (99%) rename src/{xrpld/app/tx/detail => libxrpl/tx}/apply.cpp (99%) rename src/{xrpld/app/tx/detail => libxrpl/tx}/applySteps.cpp (99%) rename src/{xrpld/app/tx/detail => libxrpl/tx/paths}/BookTip.cpp (97%) rename src/{xrpld/app => libxrpl/tx}/paths/Flow.cpp (95%) rename src/{xrpld/app/tx/detail => libxrpl/tx/paths}/OfferStream.cpp (99%) rename src/{xrpld/app => libxrpl/tx}/paths/RippleCalc.cpp (96%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/AMM}/AMMBid.cpp (98%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/AMM}/AMMClawback.cpp (97%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/AMM}/AMMCreate.cpp (98%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/AMM}/AMMDelete.cpp (92%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/AMM}/AMMDeposit.cpp (99%) rename src/{xrpld/app/misc/detail => libxrpl/tx/transactors/AMM}/AMMHelpers.cpp (99%) rename src/{xrpld/app/misc/detail => libxrpl/tx/transactors/AMM}/AMMUtils.cpp (99%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/AMM}/AMMVote.cpp (98%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/AMM}/AMMWithdraw.cpp (99%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors}/Batch.cpp (99%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors}/Change.cpp (99%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/Check}/CancelCheck.cpp (98%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/Check}/CashCheck.cpp (99%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/Check}/CreateCheck.cpp (99%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors}/Clawback.cpp (99%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors}/CreateTicket.cpp (98%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors}/Credentials.cpp (99%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors}/DID.cpp (99%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/Delegate}/DelegateSet.cpp (98%) rename src/{xrpld/app/misc/detail => libxrpl/tx/transactors/Delegate}/DelegateUtils.cpp (95%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors}/DeleteAccount.cpp (97%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors}/DeleteOracle.cpp (97%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors}/DepositPreauth.cpp (99%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors}/Escrow.cpp (99%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors}/LedgerStateFix.cpp (94%) rename src/{xrpld/app/misc/detail => libxrpl/tx/transactors/Lending}/LendingHelpers.cpp (99%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/Lending}/LoanBrokerCoverClawback.cpp (98%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/Lending}/LoanBrokerCoverDeposit.cpp (96%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/Lending}/LoanBrokerCoverWithdraw.cpp (97%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/Lending}/LoanBrokerDelete.cpp (97%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/Lending}/LoanBrokerSet.cpp (98%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/Lending}/LoanDelete.cpp (97%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/Lending}/LoanManage.cpp (99%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/Lending}/LoanPay.cpp (99%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/Lending}/LoanSet.cpp (99%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/MPT}/MPTokenAuthorize.cpp (98%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/MPT}/MPTokenIssuanceCreate.cpp (98%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/MPT}/MPTokenIssuanceDestroy.cpp (96%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/MPT}/MPTokenIssuanceSet.cpp (98%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/NFT}/NFTokenAcceptOffer.cpp (99%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/NFT}/NFTokenBurn.cpp (96%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/NFT}/NFTokenCancelOffer.cpp (95%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/NFT}/NFTokenCreateOffer.cpp (94%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/NFT}/NFTokenMint.cpp (99%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/NFT}/NFTokenModify.cpp (93%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/NFT}/NFTokenUtils.cpp (99%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/Offer}/CancelOffer.cpp (96%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/Offer}/CreateOffer.cpp (99%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors}/PayChan.cpp (99%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors}/Payment.cpp (99%) rename src/{xrpld/app/misc => libxrpl/tx/transactors/PermissionedDomain}/PermissionedDEXHelpers.cpp (97%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/PermissionedDomain}/PermissionedDomainDelete.cpp (95%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/PermissionedDomain}/PermissionedDomainSet.cpp (98%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors}/SetAccount.cpp (99%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors}/SetOracle.cpp (99%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors}/SetRegularKey.cpp (97%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors}/SetSignerList.cpp (99%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors}/SetTrust.cpp (99%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/Vault}/VaultClawback.cpp (99%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/Vault}/VaultCreate.cpp (97%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/Vault}/VaultDelete.cpp (99%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/Vault}/VaultDeposit.cpp (98%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/Vault}/VaultSet.cpp (99%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors/Vault}/VaultWithdraw.cpp (99%) rename src/{xrpld/app/tx/detail => libxrpl/tx/transactors}/XChainBridge.cpp (99%) create mode 100644 src/xrpld/app/misc/AmendmentTableImpl.h diff --git a/.github/scripts/levelization/results/ordering.txt b/.github/scripts/levelization/results/ordering.txt index 30dc2be043..d4d07eee94 100644 --- a/.github/scripts/levelization/results/ordering.txt +++ b/.github/scripts/levelization/results/ordering.txt @@ -32,6 +32,14 @@ libxrpl.server > xrpl.server libxrpl.shamap > xrpl.basics libxrpl.shamap > xrpl.protocol libxrpl.shamap > xrpl.shamap +libxrpl.tx > xrpl.basics +libxrpl.tx > xrpl.conditions +libxrpl.tx > xrpl.core +libxrpl.tx > xrpl.json +libxrpl.tx > xrpl.ledger +libxrpl.tx > xrpl.protocol +libxrpl.tx > xrpl.server +libxrpl.tx > xrpl.tx test.app > test.jtx test.app > test.rpc test.app > test.toplevel @@ -49,6 +57,7 @@ test.app > xrpl.protocol test.app > xrpl.rdb test.app > xrpl.resource test.app > xrpl.server +test.app > xrpl.tx test.basics > test.jtx test.basics > test.unit_test test.basics > xrpl.basics @@ -67,6 +76,7 @@ test.consensus > xrpld.app test.consensus > xrpld.consensus test.consensus > xrpl.json test.consensus > xrpl.ledger +test.consensus > xrpl.tx test.core > test.jtx test.core > test.toplevel test.core > test.unit_test @@ -93,6 +103,7 @@ test.jtx > xrpl.net test.jtx > xrpl.protocol test.jtx > xrpl.resource test.jtx > xrpl.server +test.jtx > xrpl.tx test.ledger > test.jtx test.ledger > test.toplevel test.ledger > xrpl.basics @@ -138,9 +149,11 @@ test.rpc > xrpld.core test.rpc > xrpld.overlay test.rpc > xrpld.rpc test.rpc > xrpl.json +test.rpc > xrpl.ledger test.rpc > xrpl.protocol test.rpc > xrpl.resource test.rpc > xrpl.server +test.rpc > xrpl.tx test.server > test.jtx test.server > test.toplevel test.server > test.unit_test @@ -171,6 +184,7 @@ xrpl.json > xrpl.basics xrpl.ledger > xrpl.basics xrpl.ledger > xrpl.protocol xrpl.ledger > xrpl.server +xrpl.ledger > xrpl.shamap xrpl.net > xrpl.basics xrpl.nodestore > xrpl.basics xrpl.nodestore > xrpl.protocol @@ -192,9 +206,12 @@ xrpl.server > xrpl.shamap xrpl.shamap > xrpl.basics xrpl.shamap > xrpl.nodestore xrpl.shamap > xrpl.protocol +xrpl.tx > xrpl.basics +xrpl.tx > xrpl.core +xrpl.tx > xrpl.ledger +xrpl.tx > xrpl.protocol xrpld.app > test.unit_test xrpld.app > xrpl.basics -xrpld.app > xrpl.conditions xrpld.app > xrpl.core xrpld.app > xrpld.consensus xrpld.app > xrpld.core @@ -207,6 +224,7 @@ xrpld.app > xrpl.rdb xrpld.app > xrpl.resource xrpld.app > xrpl.server xrpld.app > xrpl.shamap +xrpld.app > xrpl.tx xrpld.consensus > xrpl.basics xrpld.consensus > xrpl.json xrpld.consensus > xrpl.protocol @@ -225,6 +243,7 @@ xrpld.overlay > xrpl.protocol xrpld.overlay > xrpl.rdb xrpld.overlay > xrpl.resource xrpld.overlay > xrpl.server +xrpld.overlay > xrpl.tx xrpld.peerfinder > xrpl.basics xrpld.peerfinder > xrpld.core xrpld.peerfinder > xrpl.protocol @@ -244,4 +263,5 @@ xrpld.rpc > xrpl.protocol xrpld.rpc > xrpl.rdb xrpld.rpc > xrpl.resource xrpld.rpc > xrpl.server +xrpld.rpc > xrpl.tx xrpld.shamap > xrpl.shamap diff --git a/cmake/XrplCore.cmake b/cmake/XrplCore.cmake index 3380ca85cd..9a847bfcb9 100644 --- a/cmake/XrplCore.cmake +++ b/cmake/XrplCore.cmake @@ -109,8 +109,12 @@ target_link_libraries( xrpl.libxrpl.protocol xrpl.libxrpl.rdb xrpl.libxrpl.server + xrpl.libxrpl.shamap xrpl.libxrpl.conditions) +add_module(xrpl tx) +target_link_libraries(xrpl.libxrpl.tx PUBLIC xrpl.libxrpl.ledger) + add_library(xrpl.libxrpl) set_target_properties(xrpl.libxrpl PROPERTIES OUTPUT_NAME xrpl) @@ -135,7 +139,8 @@ target_link_modules( rdb resource server - shamap) + shamap + tx) # All headers in libxrpl are in modules. # Uncomment this stanza if you have not yet moved new headers into a module. diff --git a/cmake/XrplInstall.cmake b/cmake/XrplInstall.cmake index d2fef5d488..b8cf4fd32f 100644 --- a/cmake/XrplInstall.cmake +++ b/cmake/XrplInstall.cmake @@ -32,6 +32,7 @@ install(TARGETS common xrpl.libxrpl.resource xrpl.libxrpl.server xrpl.libxrpl.shamap + xrpl.libxrpl.tx antithesis-sdk-cpp EXPORT XrplExports LIBRARY DESTINATION lib diff --git a/src/xrpld/app/misc/AmendmentTable.h b/include/xrpl/ledger/AmendmentTable.h similarity index 97% rename from src/xrpld/app/misc/AmendmentTable.h rename to include/xrpl/ledger/AmendmentTable.h index bfef818b0a..017fcd3846 100644 --- a/src/xrpld/app/misc/AmendmentTable.h +++ b/include/xrpl/ledger/AmendmentTable.h @@ -1,17 +1,18 @@ #pragma once -#include -#include - -#include +#include +#include #include #include #include +#include #include namespace xrpl { +class ServiceRegistry; + /** The amendment table stores the list of enabled and potential amendments. Individuals amendments are voted on by validators during the consensus process. diff --git a/include/xrpl/protocol/Protocol.h b/include/xrpl/protocol/Protocol.h index dfb2b9dfe8..2879aecda9 100644 --- a/include/xrpl/protocol/Protocol.h +++ b/include/xrpl/protocol/Protocol.h @@ -253,6 +253,16 @@ std::uint8_t constexpr maxAssetCheckDepth = 5; /** A ledger index. */ using LedgerIndex = std::uint32_t; +std::uint32_t constexpr FLAG_LEDGER_INTERVAL = 256; + +/** Returns true if the given ledgerIndex is a voting ledgerIndex */ +bool +isVotingLedger(LedgerIndex seq); + +/** Returns true if the given ledgerIndex is a flag ledgerIndex */ +bool +isFlagLedger(LedgerIndex seq); + /** A transaction identifier. The value is computed as the hash of the canonicalized, serialized transaction object. diff --git a/include/xrpl/protocol/detail/transactions.macro b/include/xrpl/protocol/detail/transactions.macro index bc7eefedb5..b696a1d1c2 100644 --- a/include/xrpl/protocol/detail/transactions.macro +++ b/include/xrpl/protocol/detail/transactions.macro @@ -8,11 +8,11 @@ * To ease maintenance, you may replace any unneeded values with "..." * e.g. #define TRANSACTION(tag, value, name, ...) * - * You must define a transactor class in the `ripple` namespace named `name`, + * You must define a transactor class in the `xrpl` namespace named `name`, * and include its header alongside the TRANSACTOR definition using this * format: * #if TRANSACTION_INCLUDE - * # include + * # include * #endif * * The `privileges` parameter of the TRANSACTION macro is a bitfield @@ -22,7 +22,7 @@ /** This transaction type executes a payment. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttPAYMENT, 0, Payment, Delegation::delegable, @@ -42,7 +42,7 @@ TRANSACTION(ttPAYMENT, 0, Payment, /** This transaction type creates an escrow object. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttESCROW_CREATE, 1, EscrowCreate, Delegation::delegable, @@ -73,7 +73,7 @@ TRANSACTION(ttESCROW_FINISH, 2, EscrowFinish, /** This transaction type adjusts various account settings. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttACCOUNT_SET, 3, AccountSet, Delegation::notDelegable, @@ -94,7 +94,7 @@ TRANSACTION(ttACCOUNT_SET, 3, AccountSet, /** This transaction type cancels an existing escrow. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttESCROW_CANCEL, 4, EscrowCancel, Delegation::delegable, @@ -107,7 +107,7 @@ TRANSACTION(ttESCROW_CANCEL, 4, EscrowCancel, /** This transaction type sets or clears an account's "regular key". */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttREGULAR_KEY_SET, 5, SetRegularKey, Delegation::notDelegable, @@ -121,7 +121,7 @@ TRANSACTION(ttREGULAR_KEY_SET, 5, SetRegularKey, /** This transaction type creates an offer to trade one asset for another. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttOFFER_CREATE, 7, OfferCreate, Delegation::delegable, @@ -137,7 +137,7 @@ TRANSACTION(ttOFFER_CREATE, 7, OfferCreate, /** This transaction type cancels existing offers to trade one asset for another. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttOFFER_CANCEL, 8, OfferCancel, Delegation::delegable, @@ -151,7 +151,7 @@ TRANSACTION(ttOFFER_CANCEL, 8, OfferCancel, /** This transaction type creates a new set of tickets. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttTICKET_CREATE, 10, TicketCreate, Delegation::delegable, @@ -167,7 +167,7 @@ TRANSACTION(ttTICKET_CREATE, 10, TicketCreate, // The SignerEntries are optional because a SignerList is deleted by // setting the SignerQuorum to zero and omitting SignerEntries. #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttSIGNER_LIST_SET, 12, SignerListSet, Delegation::notDelegable, @@ -180,7 +180,7 @@ TRANSACTION(ttSIGNER_LIST_SET, 12, SignerListSet, /** This transaction type creates a new unidirectional XRP payment channel. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttPAYCHAN_CREATE, 13, PaymentChannelCreate, Delegation::delegable, @@ -222,7 +222,7 @@ TRANSACTION(ttPAYCHAN_CLAIM, 15, PaymentChannelClaim, /** This transaction type creates a new check. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttCHECK_CREATE, 16, CheckCreate, Delegation::delegable, @@ -238,7 +238,7 @@ TRANSACTION(ttCHECK_CREATE, 16, CheckCreate, /** This transaction type cashes an existing check. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttCHECK_CASH, 17, CheckCash, Delegation::delegable, @@ -252,7 +252,7 @@ TRANSACTION(ttCHECK_CASH, 17, CheckCash, /** This transaction type cancels an existing check. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttCHECK_CANCEL, 18, CheckCancel, Delegation::delegable, @@ -264,7 +264,7 @@ TRANSACTION(ttCHECK_CANCEL, 18, CheckCancel, /** This transaction type grants or revokes authorization to transfer funds. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttDEPOSIT_PREAUTH, 19, DepositPreauth, Delegation::delegable, @@ -279,7 +279,7 @@ TRANSACTION(ttDEPOSIT_PREAUTH, 19, DepositPreauth, /** This transaction type modifies a trustline between two accounts. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttTRUST_SET, 20, TrustSet, Delegation::delegable, @@ -293,7 +293,7 @@ TRANSACTION(ttTRUST_SET, 20, TrustSet, /** This transaction type deletes an existing account. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttACCOUNT_DELETE, 21, AccountDelete, Delegation::notDelegable, @@ -309,7 +309,7 @@ TRANSACTION(ttACCOUNT_DELETE, 21, AccountDelete, /** This transaction mints a new NFT. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttNFTOKEN_MINT, 25, NFTokenMint, Delegation::delegable, @@ -327,7 +327,7 @@ TRANSACTION(ttNFTOKEN_MINT, 25, NFTokenMint, /** This transaction burns (i.e. destroys) an existing NFT. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttNFTOKEN_BURN, 26, NFTokenBurn, Delegation::delegable, @@ -340,7 +340,7 @@ TRANSACTION(ttNFTOKEN_BURN, 26, NFTokenBurn, /** This transaction creates a new offer to buy or sell an NFT. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttNFTOKEN_CREATE_OFFER, 27, NFTokenCreateOffer, Delegation::delegable, @@ -356,7 +356,7 @@ TRANSACTION(ttNFTOKEN_CREATE_OFFER, 27, NFTokenCreateOffer, /** This transaction cancels an existing offer to buy or sell an existing NFT. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttNFTOKEN_CANCEL_OFFER, 28, NFTokenCancelOffer, Delegation::delegable, @@ -368,7 +368,7 @@ TRANSACTION(ttNFTOKEN_CANCEL_OFFER, 28, NFTokenCancelOffer, /** This transaction accepts an existing offer to buy or sell an existing NFT. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttNFTOKEN_ACCEPT_OFFER, 29, NFTokenAcceptOffer, Delegation::delegable, @@ -382,7 +382,7 @@ TRANSACTION(ttNFTOKEN_ACCEPT_OFFER, 29, NFTokenAcceptOffer, /** This transaction claws back issued tokens. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttCLAWBACK, 30, Clawback, Delegation::delegable, @@ -395,7 +395,7 @@ TRANSACTION(ttCLAWBACK, 30, Clawback, /** This transaction claws back tokens from an AMM pool. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttAMM_CLAWBACK, 31, AMMClawback, Delegation::delegable, @@ -410,7 +410,7 @@ TRANSACTION(ttAMM_CLAWBACK, 31, AMMClawback, /** This transaction type creates an AMM instance */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttAMM_CREATE, 35, AMMCreate, Delegation::delegable, @@ -424,7 +424,7 @@ TRANSACTION(ttAMM_CREATE, 35, AMMCreate, /** This transaction type deposits into an AMM instance */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttAMM_DEPOSIT, 36, AMMDeposit, Delegation::delegable, @@ -442,7 +442,7 @@ TRANSACTION(ttAMM_DEPOSIT, 36, AMMDeposit, /** This transaction type withdraws from an AMM instance */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttAMM_WITHDRAW, 37, AMMWithdraw, Delegation::delegable, @@ -459,7 +459,7 @@ TRANSACTION(ttAMM_WITHDRAW, 37, AMMWithdraw, /** This transaction type votes for the trading fee */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttAMM_VOTE, 38, AMMVote, Delegation::delegable, @@ -473,7 +473,7 @@ TRANSACTION(ttAMM_VOTE, 38, AMMVote, /** This transaction type bids for the auction slot */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttAMM_BID, 39, AMMBid, Delegation::delegable, @@ -489,7 +489,7 @@ TRANSACTION(ttAMM_BID, 39, AMMBid, /** This transaction type deletes AMM in the empty state */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttAMM_DELETE, 40, AMMDelete, Delegation::delegable, @@ -502,7 +502,7 @@ TRANSACTION(ttAMM_DELETE, 40, AMMDelete, /** This transactions creates a crosschain sequence number */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttXCHAIN_CREATE_CLAIM_ID, 41, XChainCreateClaimID, Delegation::delegable, @@ -617,7 +617,7 @@ TRANSACTION(ttXCHAIN_CREATE_BRIDGE, 48, XChainCreateBridge, /** This transaction type creates or updates a DID */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttDID_SET, 49, DIDSet, Delegation::delegable, @@ -638,7 +638,7 @@ TRANSACTION(ttDID_DELETE, 50, DIDDelete, /** This transaction type creates an Oracle instance */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttORACLE_SET, 51, OracleSet, Delegation::delegable, @@ -655,7 +655,7 @@ TRANSACTION(ttORACLE_SET, 51, OracleSet, /** This transaction type deletes an Oracle instance */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttORACLE_DELETE, 52, OracleDelete, Delegation::delegable, @@ -667,7 +667,7 @@ TRANSACTION(ttORACLE_DELETE, 52, OracleDelete, /** This transaction type fixes a problem in the ledger state */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttLEDGER_STATE_FIX, 53, LedgerStateFix, Delegation::delegable, @@ -680,7 +680,7 @@ TRANSACTION(ttLEDGER_STATE_FIX, 53, LedgerStateFix, /** This transaction type creates a MPTokensIssuance instance */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttMPTOKEN_ISSUANCE_CREATE, 54, MPTokenIssuanceCreate, Delegation::delegable, @@ -697,7 +697,7 @@ TRANSACTION(ttMPTOKEN_ISSUANCE_CREATE, 54, MPTokenIssuanceCreate, /** This transaction type destroys a MPTokensIssuance instance */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttMPTOKEN_ISSUANCE_DESTROY, 55, MPTokenIssuanceDestroy, Delegation::delegable, @@ -709,7 +709,7 @@ TRANSACTION(ttMPTOKEN_ISSUANCE_DESTROY, 55, MPTokenIssuanceDestroy, /** This transaction type sets flags on a MPTokensIssuance or MPToken instance */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttMPTOKEN_ISSUANCE_SET, 56, MPTokenIssuanceSet, Delegation::delegable, @@ -726,7 +726,7 @@ TRANSACTION(ttMPTOKEN_ISSUANCE_SET, 56, MPTokenIssuanceSet, /** This transaction type authorizes a MPToken instance */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttMPTOKEN_AUTHORIZE, 57, MPTokenAuthorize, Delegation::delegable, @@ -739,7 +739,7 @@ TRANSACTION(ttMPTOKEN_AUTHORIZE, 57, MPTokenAuthorize, /** This transaction type create an Credential instance */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttCREDENTIAL_CREATE, 58, CredentialCreate, Delegation::delegable, @@ -775,7 +775,7 @@ TRANSACTION(ttCREDENTIAL_DELETE, 60, CredentialDelete, /** This transaction type modify a NFToken */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttNFTOKEN_MODIFY, 61, NFTokenModify, Delegation::delegable, @@ -789,7 +789,7 @@ TRANSACTION(ttNFTOKEN_MODIFY, 61, NFTokenModify, /** This transaction type creates or modifies a Permissioned Domain */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttPERMISSIONED_DOMAIN_SET, 62, PermissionedDomainSet, Delegation::delegable, @@ -802,7 +802,7 @@ TRANSACTION(ttPERMISSIONED_DOMAIN_SET, 62, PermissionedDomainSet, /** This transaction type deletes a Permissioned Domain */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttPERMISSIONED_DOMAIN_DELETE, 63, PermissionedDomainDelete, Delegation::delegable, @@ -814,7 +814,7 @@ TRANSACTION(ttPERMISSIONED_DOMAIN_DELETE, 63, PermissionedDomainDelete, /** This transaction type delegates authorized account specified permissions */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttDELEGATE_SET, 64, DelegateSet, Delegation::notDelegable, @@ -827,7 +827,7 @@ TRANSACTION(ttDELEGATE_SET, 64, DelegateSet, /** This transaction creates a single asset vault. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttVAULT_CREATE, 65, VaultCreate, Delegation::delegable, @@ -845,7 +845,7 @@ TRANSACTION(ttVAULT_CREATE, 65, VaultCreate, /** This transaction updates a single asset vault. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttVAULT_SET, 66, VaultSet, Delegation::delegable, @@ -860,7 +860,7 @@ TRANSACTION(ttVAULT_SET, 66, VaultSet, /** This transaction deletes a single asset vault. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttVAULT_DELETE, 67, VaultDelete, Delegation::delegable, @@ -872,7 +872,7 @@ TRANSACTION(ttVAULT_DELETE, 67, VaultDelete, /** This transaction trades assets for shares with a vault. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttVAULT_DEPOSIT, 68, VaultDeposit, Delegation::delegable, @@ -885,7 +885,7 @@ TRANSACTION(ttVAULT_DEPOSIT, 68, VaultDeposit, /** This transaction trades shares for assets with a vault. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttVAULT_WITHDRAW, 69, VaultWithdraw, Delegation::delegable, @@ -900,7 +900,7 @@ TRANSACTION(ttVAULT_WITHDRAW, 69, VaultWithdraw, /** This transaction claws back tokens from a vault. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttVAULT_CLAWBACK, 70, VaultClawback, Delegation::delegable, @@ -914,7 +914,7 @@ TRANSACTION(ttVAULT_CLAWBACK, 70, VaultClawback, /** This transaction type batches together transactions. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttBATCH, 71, Batch, Delegation::notDelegable, @@ -929,7 +929,7 @@ TRANSACTION(ttBATCH, 71, Batch, /** This transaction creates and updates a Loan Broker */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttLOAN_BROKER_SET, 74, LoanBrokerSet, Delegation::delegable, @@ -946,7 +946,7 @@ TRANSACTION(ttLOAN_BROKER_SET, 74, LoanBrokerSet, /** This transaction deletes a Loan Broker */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttLOAN_BROKER_DELETE, 75, LoanBrokerDelete, Delegation::delegable, @@ -957,7 +957,7 @@ TRANSACTION(ttLOAN_BROKER_DELETE, 75, LoanBrokerDelete, /** This transaction deposits First Loss Capital into a Loan Broker */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttLOAN_BROKER_COVER_DEPOSIT, 76, LoanBrokerCoverDeposit, Delegation::delegable, @@ -969,7 +969,7 @@ TRANSACTION(ttLOAN_BROKER_COVER_DEPOSIT, 76, LoanBrokerCoverDeposit, /** This transaction withdraws First Loss Capital from a Loan Broker */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttLOAN_BROKER_COVER_WITHDRAW, 77, LoanBrokerCoverWithdraw, Delegation::delegable, @@ -984,7 +984,7 @@ TRANSACTION(ttLOAN_BROKER_COVER_WITHDRAW, 77, LoanBrokerCoverWithdraw, /** This transaction claws back First Loss Capital from a Loan Broker to the issuer of the capital */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttLOAN_BROKER_COVER_CLAWBACK, 78, LoanBrokerCoverClawback, Delegation::delegable, @@ -996,7 +996,7 @@ TRANSACTION(ttLOAN_BROKER_COVER_CLAWBACK, 78, LoanBrokerCoverClawback, /** This transaction creates a Loan */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttLOAN_SET, 80, LoanSet, Delegation::delegable, @@ -1023,7 +1023,7 @@ TRANSACTION(ttLOAN_SET, 80, LoanSet, /** This transaction deletes an existing Loan */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttLOAN_DELETE, 81, LoanDelete, Delegation::delegable, @@ -1034,7 +1034,7 @@ TRANSACTION(ttLOAN_DELETE, 81, LoanDelete, /** This transaction is used to change the delinquency status of an existing Loan */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttLOAN_MANAGE, 82, LoanManage, Delegation::delegable, @@ -1048,7 +1048,7 @@ TRANSACTION(ttLOAN_MANAGE, 82, LoanManage, /** The Borrower uses this transaction to make a Payment on the Loan. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttLOAN_PAY, 84, LoanPay, Delegation::delegable, @@ -1063,7 +1063,7 @@ TRANSACTION(ttLOAN_PAY, 84, LoanPay, For details, see: https://xrpl.org/amendments.html */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttAMENDMENT, 100, EnableAmendment, Delegation::notDelegable, diff --git a/src/xrpld/app/misc/LoadFeeTrack.h b/include/xrpl/server/LoadFeeTrack.h similarity index 100% rename from src/xrpld/app/misc/LoadFeeTrack.h rename to include/xrpl/server/LoadFeeTrack.h diff --git a/src/xrpld/app/tx/detail/ApplyContext.h b/include/xrpl/tx/ApplyContext.h similarity index 100% rename from src/xrpld/app/tx/detail/ApplyContext.h rename to include/xrpl/tx/ApplyContext.h diff --git a/src/xrpld/app/tx/detail/InvariantCheck.h b/include/xrpl/tx/InvariantCheck.h similarity index 100% rename from src/xrpld/app/tx/detail/InvariantCheck.h rename to include/xrpl/tx/InvariantCheck.h diff --git a/src/xrpld/app/tx/detail/SignerEntries.h b/include/xrpl/tx/SignerEntries.h similarity index 97% rename from src/xrpld/app/tx/detail/SignerEntries.h rename to include/xrpl/tx/SignerEntries.h index fe01d6b1ee..1e9c5fcb53 100644 --- a/src/xrpld/app/tx/detail/SignerEntries.h +++ b/include/xrpl/tx/SignerEntries.h @@ -1,11 +1,10 @@ #pragma once -#include // NotTEC - #include // #include // beast::Journal #include // temMALFORMED #include // AccountID +#include // NotTEC #include #include diff --git a/src/xrpld/app/tx/detail/Transactor.h b/include/xrpl/tx/Transactor.h similarity index 99% rename from src/xrpld/app/tx/detail/Transactor.h rename to include/xrpl/tx/Transactor.h index 5cb95843d5..b4f155f42d 100644 --- a/src/xrpld/app/tx/detail/Transactor.h +++ b/include/xrpl/tx/Transactor.h @@ -1,12 +1,11 @@ #pragma once -#include -#include - #include #include #include #include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/apply.h b/include/xrpl/tx/apply.h similarity index 98% rename from src/xrpld/app/tx/apply.h rename to include/xrpl/tx/apply.h index c21e7c1925..dbba0807f0 100644 --- a/src/xrpld/app/tx/apply.h +++ b/include/xrpl/tx/apply.h @@ -1,11 +1,9 @@ #pragma once -#include -#include - #include #include #include +#include #include diff --git a/src/xrpld/app/tx/applySteps.h b/include/xrpl/tx/applySteps.h similarity index 100% rename from src/xrpld/app/tx/applySteps.h rename to include/xrpl/tx/applySteps.h diff --git a/src/xrpld/app/tx/detail/BookTip.h b/include/xrpl/tx/paths/BookTip.h similarity index 100% rename from src/xrpld/app/tx/detail/BookTip.h rename to include/xrpl/tx/paths/BookTip.h diff --git a/src/xrpld/app/paths/Flow.h b/include/xrpl/tx/paths/Flow.h similarity index 95% rename from src/xrpld/app/paths/Flow.h rename to include/xrpl/tx/paths/Flow.h index 1a46ce221a..32e8c3611b 100644 --- a/src/xrpld/app/paths/Flow.h +++ b/include/xrpl/tx/paths/Flow.h @@ -1,9 +1,8 @@ #pragma once -#include -#include - #include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/Offer.h b/include/xrpl/tx/paths/Offer.h similarity index 100% rename from src/xrpld/app/tx/detail/Offer.h rename to include/xrpl/tx/paths/Offer.h diff --git a/src/xrpld/app/tx/detail/OfferStream.h b/include/xrpl/tx/paths/OfferStream.h similarity index 98% rename from src/xrpld/app/tx/detail/OfferStream.h rename to include/xrpl/tx/paths/OfferStream.h index 2f6bda3fab..df96a1b6da 100644 --- a/src/xrpld/app/tx/detail/OfferStream.h +++ b/include/xrpl/tx/paths/OfferStream.h @@ -1,12 +1,11 @@ #pragma once -#include -#include - #include #include #include #include +#include +#include #include diff --git a/src/xrpld/app/paths/RippleCalc.h b/include/xrpl/tx/paths/RippleCalc.h similarity index 100% rename from src/xrpld/app/paths/RippleCalc.h rename to include/xrpl/tx/paths/RippleCalc.h diff --git a/src/xrpld/app/paths/detail/AmountSpec.h b/include/xrpl/tx/paths/detail/AmountSpec.h similarity index 100% rename from src/xrpld/app/paths/detail/AmountSpec.h rename to include/xrpl/tx/paths/detail/AmountSpec.h diff --git a/src/xrpld/app/paths/detail/FlatSets.h b/include/xrpl/tx/paths/detail/FlatSets.h similarity index 100% rename from src/xrpld/app/paths/detail/FlatSets.h rename to include/xrpl/tx/paths/detail/FlatSets.h diff --git a/src/xrpld/app/paths/detail/FlowDebugInfo.h b/include/xrpl/tx/paths/detail/FlowDebugInfo.h similarity index 99% rename from src/xrpld/app/paths/detail/FlowDebugInfo.h rename to include/xrpl/tx/paths/detail/FlowDebugInfo.h index d7b97a49d4..dc0ba17d4e 100644 --- a/src/xrpld/app/paths/detail/FlowDebugInfo.h +++ b/include/xrpl/tx/paths/detail/FlowDebugInfo.h @@ -1,10 +1,9 @@ #pragma once -#include - #include #include #include +#include #include diff --git a/src/xrpld/app/paths/detail/Steps.h b/include/xrpl/tx/paths/detail/Steps.h similarity index 99% rename from src/xrpld/app/paths/detail/Steps.h rename to include/xrpl/tx/paths/detail/Steps.h index 580b8c487e..762d5ebe5d 100644 --- a/src/xrpld/app/paths/detail/Steps.h +++ b/include/xrpl/tx/paths/detail/Steps.h @@ -1,13 +1,12 @@ #pragma once -#include - #include #include #include #include #include #include +#include #include diff --git a/src/xrpld/app/paths/detail/StrandFlow.h b/include/xrpl/tx/paths/detail/StrandFlow.h similarity index 98% rename from src/xrpld/app/paths/detail/StrandFlow.h rename to include/xrpl/tx/paths/detail/StrandFlow.h index aa3d00a822..01d77b73f0 100644 --- a/src/xrpld/app/paths/detail/StrandFlow.h +++ b/include/xrpl/tx/paths/detail/StrandFlow.h @@ -1,18 +1,17 @@ #pragma once -#include -#include -#include -#include -#include -#include -#include - #include #include #include #include #include +#include +#include +#include +#include +#include +#include +#include #include diff --git a/src/xrpld/app/tx/detail/AMMBid.h b/include/xrpl/tx/transactors/AMM/AMMBid.h similarity index 98% rename from src/xrpld/app/tx/detail/AMMBid.h rename to include/xrpl/tx/transactors/AMM/AMMBid.h index 83ea6e0729..b80bfe3bef 100644 --- a/src/xrpld/app/tx/detail/AMMBid.h +++ b/include/xrpl/tx/transactors/AMM/AMMBid.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/AMMClawback.h b/include/xrpl/tx/transactors/AMM/AMMClawback.h similarity index 97% rename from src/xrpld/app/tx/detail/AMMClawback.h rename to include/xrpl/tx/transactors/AMM/AMMClawback.h index 3da3c44605..2bfccfa202 100644 --- a/src/xrpld/app/tx/detail/AMMClawback.h +++ b/include/xrpl/tx/transactors/AMM/AMMClawback.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { class Sandbox; diff --git a/src/xrpld/app/paths/AMMContext.h b/include/xrpl/tx/transactors/AMM/AMMContext.h similarity index 100% rename from src/xrpld/app/paths/AMMContext.h rename to include/xrpl/tx/transactors/AMM/AMMContext.h diff --git a/src/xrpld/app/tx/detail/AMMCreate.h b/include/xrpl/tx/transactors/AMM/AMMCreate.h similarity index 98% rename from src/xrpld/app/tx/detail/AMMCreate.h rename to include/xrpl/tx/transactors/AMM/AMMCreate.h index 6f9fd77a2f..5deaa129ed 100644 --- a/src/xrpld/app/tx/detail/AMMCreate.h +++ b/include/xrpl/tx/transactors/AMM/AMMCreate.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/AMMDelete.h b/include/xrpl/tx/transactors/AMM/AMMDelete.h similarity index 94% rename from src/xrpld/app/tx/detail/AMMDelete.h rename to include/xrpl/tx/transactors/AMM/AMMDelete.h index 20c8f87262..1c0996f8a2 100644 --- a/src/xrpld/app/tx/detail/AMMDelete.h +++ b/include/xrpl/tx/transactors/AMM/AMMDelete.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/AMMDeposit.h b/include/xrpl/tx/transactors/AMM/AMMDeposit.h similarity index 99% rename from src/xrpld/app/tx/detail/AMMDeposit.h rename to include/xrpl/tx/transactors/AMM/AMMDeposit.h index 45c7995438..287d46ff07 100644 --- a/src/xrpld/app/tx/detail/AMMDeposit.h +++ b/include/xrpl/tx/transactors/AMM/AMMDeposit.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/misc/AMMHelpers.h b/include/xrpl/tx/transactors/AMM/AMMHelpers.h similarity index 100% rename from src/xrpld/app/misc/AMMHelpers.h rename to include/xrpl/tx/transactors/AMM/AMMHelpers.h diff --git a/src/xrpld/app/misc/AMMUtils.h b/include/xrpl/tx/transactors/AMM/AMMUtils.h similarity index 100% rename from src/xrpld/app/misc/AMMUtils.h rename to include/xrpl/tx/transactors/AMM/AMMUtils.h diff --git a/src/xrpld/app/tx/detail/AMMVote.h b/include/xrpl/tx/transactors/AMM/AMMVote.h similarity index 97% rename from src/xrpld/app/tx/detail/AMMVote.h rename to include/xrpl/tx/transactors/AMM/AMMVote.h index 2bc3da2301..ab04b30993 100644 --- a/src/xrpld/app/tx/detail/AMMVote.h +++ b/include/xrpl/tx/transactors/AMM/AMMVote.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/AMMWithdraw.h b/include/xrpl/tx/transactors/AMM/AMMWithdraw.h similarity index 99% rename from src/xrpld/app/tx/detail/AMMWithdraw.h rename to include/xrpl/tx/transactors/AMM/AMMWithdraw.h index 246c66100c..c15bb68644 100644 --- a/src/xrpld/app/tx/detail/AMMWithdraw.h +++ b/include/xrpl/tx/transactors/AMM/AMMWithdraw.h @@ -1,8 +1,7 @@ #pragma once -#include - #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/Batch.h b/include/xrpl/tx/transactors/Batch.h similarity index 96% rename from src/xrpld/app/tx/detail/Batch.h rename to include/xrpl/tx/transactors/Batch.h index 17abec38c3..0861deb094 100644 --- a/src/xrpld/app/tx/detail/Batch.h +++ b/include/xrpl/tx/transactors/Batch.h @@ -1,9 +1,8 @@ #pragma once -#include - #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/Change.h b/include/xrpl/tx/transactors/Change.h similarity index 93% rename from src/xrpld/app/tx/detail/Change.h rename to include/xrpl/tx/transactors/Change.h index 683b054ccb..1bf63ff0db 100644 --- a/src/xrpld/app/tx/detail/Change.h +++ b/include/xrpl/tx/transactors/Change.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/CancelCheck.h b/include/xrpl/tx/transactors/Check/CancelCheck.h similarity index 90% rename from src/xrpld/app/tx/detail/CancelCheck.h rename to include/xrpl/tx/transactors/Check/CancelCheck.h index f125b9af5b..8a0e42c7ca 100644 --- a/src/xrpld/app/tx/detail/CancelCheck.h +++ b/include/xrpl/tx/transactors/Check/CancelCheck.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/CashCheck.h b/include/xrpl/tx/transactors/Check/CashCheck.h similarity index 90% rename from src/xrpld/app/tx/detail/CashCheck.h rename to include/xrpl/tx/transactors/Check/CashCheck.h index 50a4f8a63a..138790cf34 100644 --- a/src/xrpld/app/tx/detail/CashCheck.h +++ b/include/xrpl/tx/transactors/Check/CashCheck.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/CreateCheck.h b/include/xrpl/tx/transactors/Check/CreateCheck.h similarity index 90% rename from src/xrpld/app/tx/detail/CreateCheck.h rename to include/xrpl/tx/transactors/Check/CreateCheck.h index b80536fe02..98950b68f2 100644 --- a/src/xrpld/app/tx/detail/CreateCheck.h +++ b/include/xrpl/tx/transactors/Check/CreateCheck.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/Clawback.h b/include/xrpl/tx/transactors/Clawback.h similarity index 91% rename from src/xrpld/app/tx/detail/Clawback.h rename to include/xrpl/tx/transactors/Clawback.h index 427edb25b4..7451266461 100644 --- a/src/xrpld/app/tx/detail/Clawback.h +++ b/include/xrpl/tx/transactors/Clawback.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/CreateTicket.h b/include/xrpl/tx/transactors/CreateTicket.h similarity index 98% rename from src/xrpld/app/tx/detail/CreateTicket.h rename to include/xrpl/tx/transactors/CreateTicket.h index dd424e3756..867ad99c12 100644 --- a/src/xrpld/app/tx/detail/CreateTicket.h +++ b/include/xrpl/tx/transactors/CreateTicket.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/Credentials.h b/include/xrpl/tx/transactors/Credentials.h similarity index 97% rename from src/xrpld/app/tx/detail/Credentials.h rename to include/xrpl/tx/transactors/Credentials.h index 02bccde198..8c96f40526 100644 --- a/src/xrpld/app/tx/detail/Credentials.h +++ b/include/xrpl/tx/transactors/Credentials.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/DID.h b/include/xrpl/tx/transactors/DID.h similarity index 95% rename from src/xrpld/app/tx/detail/DID.h rename to include/xrpl/tx/transactors/DID.h index a00039a999..8ab80bc694 100644 --- a/src/xrpld/app/tx/detail/DID.h +++ b/include/xrpl/tx/transactors/DID.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/DelegateSet.h b/include/xrpl/tx/transactors/Delegate/DelegateSet.h similarity index 92% rename from src/xrpld/app/tx/detail/DelegateSet.h rename to include/xrpl/tx/transactors/Delegate/DelegateSet.h index 2120674557..d5ea0f13cc 100644 --- a/src/xrpld/app/tx/detail/DelegateSet.h +++ b/include/xrpl/tx/transactors/Delegate/DelegateSet.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/misc/DelegateUtils.h b/include/xrpl/tx/transactors/Delegate/DelegateUtils.h similarity index 100% rename from src/xrpld/app/misc/DelegateUtils.h rename to include/xrpl/tx/transactors/Delegate/DelegateUtils.h diff --git a/src/xrpld/app/tx/detail/DeleteAccount.h b/include/xrpl/tx/transactors/DeleteAccount.h similarity index 93% rename from src/xrpld/app/tx/detail/DeleteAccount.h rename to include/xrpl/tx/transactors/DeleteAccount.h index 742d1f4257..f55888ee00 100644 --- a/src/xrpld/app/tx/detail/DeleteAccount.h +++ b/include/xrpl/tx/transactors/DeleteAccount.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/DeleteOracle.h b/include/xrpl/tx/transactors/DeleteOracle.h similarity index 95% rename from src/xrpld/app/tx/detail/DeleteOracle.h rename to include/xrpl/tx/transactors/DeleteOracle.h index 7d7cc340cb..7140a9096a 100644 --- a/src/xrpld/app/tx/detail/DeleteOracle.h +++ b/include/xrpl/tx/transactors/DeleteOracle.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/DepositPreauth.h b/include/xrpl/tx/transactors/DepositPreauth.h similarity index 93% rename from src/xrpld/app/tx/detail/DepositPreauth.h rename to include/xrpl/tx/transactors/DepositPreauth.h index f1afac3b18..24050da600 100644 --- a/src/xrpld/app/tx/detail/DepositPreauth.h +++ b/include/xrpl/tx/transactors/DepositPreauth.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/Escrow.h b/include/xrpl/tx/transactors/Escrow.h similarity index 97% rename from src/xrpld/app/tx/detail/Escrow.h rename to include/xrpl/tx/transactors/Escrow.h index cb99dcae06..0fd627e5a9 100644 --- a/src/xrpld/app/tx/detail/Escrow.h +++ b/include/xrpl/tx/transactors/Escrow.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/LedgerStateFix.h b/include/xrpl/tx/transactors/LedgerStateFix.h similarity index 92% rename from src/xrpld/app/tx/detail/LedgerStateFix.h rename to include/xrpl/tx/transactors/LedgerStateFix.h index 66fe124cff..728f8c651d 100644 --- a/src/xrpld/app/tx/detail/LedgerStateFix.h +++ b/include/xrpl/tx/transactors/LedgerStateFix.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/misc/LendingHelpers.h b/include/xrpl/tx/transactors/Lending/LendingHelpers.h similarity index 100% rename from src/xrpld/app/misc/LendingHelpers.h rename to include/xrpl/tx/transactors/Lending/LendingHelpers.h diff --git a/src/xrpld/app/tx/detail/LoanBrokerCoverClawback.h b/include/xrpl/tx/transactors/Lending/LoanBrokerCoverClawback.h similarity index 93% rename from src/xrpld/app/tx/detail/LoanBrokerCoverClawback.h rename to include/xrpl/tx/transactors/Lending/LoanBrokerCoverClawback.h index 139d50696a..b1e539392f 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerCoverClawback.h +++ b/include/xrpl/tx/transactors/Lending/LoanBrokerCoverClawback.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/LoanBrokerCoverDeposit.h b/include/xrpl/tx/transactors/Lending/LoanBrokerCoverDeposit.h similarity index 92% rename from src/xrpld/app/tx/detail/LoanBrokerCoverDeposit.h rename to include/xrpl/tx/transactors/Lending/LoanBrokerCoverDeposit.h index 3f683c6a62..8dda417443 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerCoverDeposit.h +++ b/include/xrpl/tx/transactors/Lending/LoanBrokerCoverDeposit.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/LoanBrokerCoverWithdraw.h b/include/xrpl/tx/transactors/Lending/LoanBrokerCoverWithdraw.h similarity index 93% rename from src/xrpld/app/tx/detail/LoanBrokerCoverWithdraw.h rename to include/xrpl/tx/transactors/Lending/LoanBrokerCoverWithdraw.h index 50d0b98fa5..52b14bfb67 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerCoverWithdraw.h +++ b/include/xrpl/tx/transactors/Lending/LoanBrokerCoverWithdraw.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/LoanBrokerDelete.h b/include/xrpl/tx/transactors/Lending/LoanBrokerDelete.h similarity index 92% rename from src/xrpld/app/tx/detail/LoanBrokerDelete.h rename to include/xrpl/tx/transactors/Lending/LoanBrokerDelete.h index cb44277f55..b9c9851c41 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerDelete.h +++ b/include/xrpl/tx/transactors/Lending/LoanBrokerDelete.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/LoanBrokerSet.h b/include/xrpl/tx/transactors/Lending/LoanBrokerSet.h similarity index 93% rename from src/xrpld/app/tx/detail/LoanBrokerSet.h rename to include/xrpl/tx/transactors/Lending/LoanBrokerSet.h index cda452bebe..ce1e069791 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerSet.h +++ b/include/xrpl/tx/transactors/Lending/LoanBrokerSet.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/LoanDelete.h b/include/xrpl/tx/transactors/Lending/LoanDelete.h similarity index 92% rename from src/xrpld/app/tx/detail/LoanDelete.h rename to include/xrpl/tx/transactors/Lending/LoanDelete.h index 37889d31fb..ff78d7db60 100644 --- a/src/xrpld/app/tx/detail/LoanDelete.h +++ b/include/xrpl/tx/transactors/Lending/LoanDelete.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/LoanManage.h b/include/xrpl/tx/transactors/Lending/LoanManage.h similarity index 96% rename from src/xrpld/app/tx/detail/LoanManage.h rename to include/xrpl/tx/transactors/Lending/LoanManage.h index 44b2b62b3d..26ed041ac7 100644 --- a/src/xrpld/app/tx/detail/LoanManage.h +++ b/include/xrpl/tx/transactors/Lending/LoanManage.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/LoanPay.h b/include/xrpl/tx/transactors/Lending/LoanPay.h similarity index 94% rename from src/xrpld/app/tx/detail/LoanPay.h rename to include/xrpl/tx/transactors/Lending/LoanPay.h index c947b1b6f8..2e3cce75ed 100644 --- a/src/xrpld/app/tx/detail/LoanPay.h +++ b/include/xrpl/tx/transactors/Lending/LoanPay.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/LoanSet.h b/include/xrpl/tx/transactors/Lending/LoanSet.h similarity index 93% rename from src/xrpld/app/tx/detail/LoanSet.h rename to include/xrpl/tx/transactors/Lending/LoanSet.h index e4bb79a36d..e9916b9d6b 100644 --- a/src/xrpld/app/tx/detail/LoanSet.h +++ b/include/xrpl/tx/transactors/Lending/LoanSet.h @@ -1,7 +1,7 @@ #pragma once -#include -#include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/MPTokenAuthorize.h b/include/xrpl/tx/transactors/MPT/MPTokenAuthorize.h similarity index 94% rename from src/xrpld/app/tx/detail/MPTokenAuthorize.h rename to include/xrpl/tx/transactors/MPT/MPTokenAuthorize.h index c887b70fa8..1f53dfc42d 100644 --- a/src/xrpld/app/tx/detail/MPTokenAuthorize.h +++ b/include/xrpl/tx/transactors/MPT/MPTokenAuthorize.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/MPTokenIssuanceCreate.h b/include/xrpl/tx/transactors/MPT/MPTokenIssuanceCreate.h similarity index 96% rename from src/xrpld/app/tx/detail/MPTokenIssuanceCreate.h rename to include/xrpl/tx/transactors/MPT/MPTokenIssuanceCreate.h index 56c20ed551..0ebde22a37 100644 --- a/src/xrpld/app/tx/detail/MPTokenIssuanceCreate.h +++ b/include/xrpl/tx/transactors/MPT/MPTokenIssuanceCreate.h @@ -1,9 +1,8 @@ #pragma once -#include - #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/MPTokenIssuanceDestroy.h b/include/xrpl/tx/transactors/MPT/MPTokenIssuanceDestroy.h similarity index 91% rename from src/xrpld/app/tx/detail/MPTokenIssuanceDestroy.h rename to include/xrpl/tx/transactors/MPT/MPTokenIssuanceDestroy.h index 89243944d0..c4a448032a 100644 --- a/src/xrpld/app/tx/detail/MPTokenIssuanceDestroy.h +++ b/include/xrpl/tx/transactors/MPT/MPTokenIssuanceDestroy.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/MPTokenIssuanceSet.h b/include/xrpl/tx/transactors/MPT/MPTokenIssuanceSet.h similarity index 93% rename from src/xrpld/app/tx/detail/MPTokenIssuanceSet.h rename to include/xrpl/tx/transactors/MPT/MPTokenIssuanceSet.h index 68794ca48c..dccd4e4cee 100644 --- a/src/xrpld/app/tx/detail/MPTokenIssuanceSet.h +++ b/include/xrpl/tx/transactors/MPT/MPTokenIssuanceSet.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/NFTokenAcceptOffer.h b/include/xrpl/tx/transactors/NFT/NFTokenAcceptOffer.h similarity index 95% rename from src/xrpld/app/tx/detail/NFTokenAcceptOffer.h rename to include/xrpl/tx/transactors/NFT/NFTokenAcceptOffer.h index 549c38d33b..d876a70362 100644 --- a/src/xrpld/app/tx/detail/NFTokenAcceptOffer.h +++ b/include/xrpl/tx/transactors/NFT/NFTokenAcceptOffer.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/NFTokenBurn.h b/include/xrpl/tx/transactors/NFT/NFTokenBurn.h similarity index 90% rename from src/xrpld/app/tx/detail/NFTokenBurn.h rename to include/xrpl/tx/transactors/NFT/NFTokenBurn.h index c2bc300ab8..8737997f03 100644 --- a/src/xrpld/app/tx/detail/NFTokenBurn.h +++ b/include/xrpl/tx/transactors/NFT/NFTokenBurn.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/NFTokenCancelOffer.h b/include/xrpl/tx/transactors/NFT/NFTokenCancelOffer.h similarity index 91% rename from src/xrpld/app/tx/detail/NFTokenCancelOffer.h rename to include/xrpl/tx/transactors/NFT/NFTokenCancelOffer.h index b1801ede25..bb8cd4c216 100644 --- a/src/xrpld/app/tx/detail/NFTokenCancelOffer.h +++ b/include/xrpl/tx/transactors/NFT/NFTokenCancelOffer.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/NFTokenCreateOffer.h b/include/xrpl/tx/transactors/NFT/NFTokenCreateOffer.h similarity index 91% rename from src/xrpld/app/tx/detail/NFTokenCreateOffer.h rename to include/xrpl/tx/transactors/NFT/NFTokenCreateOffer.h index ed54338f49..a48e53589d 100644 --- a/src/xrpld/app/tx/detail/NFTokenCreateOffer.h +++ b/include/xrpl/tx/transactors/NFT/NFTokenCreateOffer.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/NFTokenMint.h b/include/xrpl/tx/transactors/NFT/NFTokenMint.h similarity index 89% rename from src/xrpld/app/tx/detail/NFTokenMint.h rename to include/xrpl/tx/transactors/NFT/NFTokenMint.h index 52981ef467..c3a7db4581 100644 --- a/src/xrpld/app/tx/detail/NFTokenMint.h +++ b/include/xrpl/tx/transactors/NFT/NFTokenMint.h @@ -1,9 +1,8 @@ #pragma once -#include -#include - #include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/NFTokenModify.h b/include/xrpl/tx/transactors/NFT/NFTokenModify.h similarity index 90% rename from src/xrpld/app/tx/detail/NFTokenModify.h rename to include/xrpl/tx/transactors/NFT/NFTokenModify.h index f755746f1f..a64df65783 100644 --- a/src/xrpld/app/tx/detail/NFTokenModify.h +++ b/include/xrpl/tx/transactors/NFT/NFTokenModify.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/NFTokenUtils.h b/include/xrpl/tx/transactors/NFT/NFTokenUtils.h similarity index 98% rename from src/xrpld/app/tx/detail/NFTokenUtils.h rename to include/xrpl/tx/transactors/NFT/NFTokenUtils.h index 44d3cfb956..4e4150a369 100644 --- a/src/xrpld/app/tx/detail/NFTokenUtils.h +++ b/include/xrpl/tx/transactors/NFT/NFTokenUtils.h @@ -1,12 +1,11 @@ #pragma once -#include - #include #include #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/CancelOffer.h b/include/xrpl/tx/transactors/Offer/CancelOffer.h similarity index 91% rename from src/xrpld/app/tx/detail/CancelOffer.h rename to include/xrpl/tx/transactors/Offer/CancelOffer.h index 30a7129fb4..6107c3211f 100644 --- a/src/xrpld/app/tx/detail/CancelOffer.h +++ b/include/xrpl/tx/transactors/Offer/CancelOffer.h @@ -1,8 +1,7 @@ #pragma once -#include - #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/CreateOffer.h b/include/xrpl/tx/transactors/Offer/CreateOffer.h similarity index 97% rename from src/xrpld/app/tx/detail/CreateOffer.h rename to include/xrpl/tx/transactors/Offer/CreateOffer.h index 14f82c501e..cb15d08ace 100644 --- a/src/xrpld/app/tx/detail/CreateOffer.h +++ b/include/xrpl/tx/transactors/Offer/CreateOffer.h @@ -1,8 +1,7 @@ #pragma once -#include - #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/PayChan.h b/include/xrpl/tx/transactors/PayChan.h similarity index 97% rename from src/xrpld/app/tx/detail/PayChan.h rename to include/xrpl/tx/transactors/PayChan.h index 8748ec9383..cc23f029f2 100644 --- a/src/xrpld/app/tx/detail/PayChan.h +++ b/include/xrpl/tx/transactors/PayChan.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/Payment.h b/include/xrpl/tx/transactors/Payment.h similarity index 95% rename from src/xrpld/app/tx/detail/Payment.h rename to include/xrpl/tx/transactors/Payment.h index 192f2b0edb..bc5bc4fee3 100644 --- a/src/xrpld/app/tx/detail/Payment.h +++ b/include/xrpl/tx/transactors/Payment.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/misc/PermissionedDEXHelpers.h b/include/xrpl/tx/transactors/PermissionedDEXHelpers.h similarity index 100% rename from src/xrpld/app/misc/PermissionedDEXHelpers.h rename to include/xrpl/tx/transactors/PermissionedDEXHelpers.h diff --git a/src/xrpld/app/tx/detail/PermissionedDomainDelete.h b/include/xrpl/tx/transactors/PermissionedDomain/PermissionedDomainDelete.h similarity index 91% rename from src/xrpld/app/tx/detail/PermissionedDomainDelete.h rename to include/xrpl/tx/transactors/PermissionedDomain/PermissionedDomainDelete.h index 294fb794ae..b5c72413a2 100644 --- a/src/xrpld/app/tx/detail/PermissionedDomainDelete.h +++ b/include/xrpl/tx/transactors/PermissionedDomain/PermissionedDomainDelete.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/PermissionedDomainSet.h b/include/xrpl/tx/transactors/PermissionedDomain/PermissionedDomainSet.h similarity index 92% rename from src/xrpld/app/tx/detail/PermissionedDomainSet.h rename to include/xrpl/tx/transactors/PermissionedDomain/PermissionedDomainSet.h index 824104e50d..acf9194ee2 100644 --- a/src/xrpld/app/tx/detail/PermissionedDomainSet.h +++ b/include/xrpl/tx/transactors/PermissionedDomain/PermissionedDomainSet.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/SetAccount.h b/include/xrpl/tx/transactors/SetAccount.h similarity index 94% rename from src/xrpld/app/tx/detail/SetAccount.h rename to include/xrpl/tx/transactors/SetAccount.h index db59826347..3abfcb43bb 100644 --- a/src/xrpld/app/tx/detail/SetAccount.h +++ b/include/xrpl/tx/transactors/SetAccount.h @@ -1,8 +1,7 @@ #pragma once -#include - #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/SetOracle.h b/include/xrpl/tx/transactors/SetOracle.h similarity index 94% rename from src/xrpld/app/tx/detail/SetOracle.h rename to include/xrpl/tx/transactors/SetOracle.h index 6b47a5397e..be1a7b8821 100644 --- a/src/xrpld/app/tx/detail/SetOracle.h +++ b/include/xrpl/tx/transactors/SetOracle.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/SetRegularKey.h b/include/xrpl/tx/transactors/SetRegularKey.h similarity index 90% rename from src/xrpld/app/tx/detail/SetRegularKey.h rename to include/xrpl/tx/transactors/SetRegularKey.h index bc712b319a..bb1dd48a68 100644 --- a/src/xrpld/app/tx/detail/SetRegularKey.h +++ b/include/xrpl/tx/transactors/SetRegularKey.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/SetSignerList.h b/include/xrpl/tx/transactors/SetSignerList.h similarity index 94% rename from src/xrpld/app/tx/detail/SetSignerList.h rename to include/xrpl/tx/transactors/SetSignerList.h index cac9ce1288..f0c6c276e9 100644 --- a/src/xrpld/app/tx/detail/SetSignerList.h +++ b/include/xrpl/tx/transactors/SetSignerList.h @@ -1,10 +1,9 @@ #pragma once -#include -#include - #include #include +#include +#include #include #include diff --git a/src/xrpld/app/tx/detail/SetTrust.h b/include/xrpl/tx/transactors/SetTrust.h similarity index 93% rename from src/xrpld/app/tx/detail/SetTrust.h rename to include/xrpl/tx/transactors/SetTrust.h index 1081567a66..47ec26b6ad 100644 --- a/src/xrpld/app/tx/detail/SetTrust.h +++ b/include/xrpl/tx/transactors/SetTrust.h @@ -1,8 +1,7 @@ #pragma once -#include - #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/VaultClawback.h b/include/xrpl/tx/transactors/Vault/VaultClawback.h similarity index 93% rename from src/xrpld/app/tx/detail/VaultClawback.h rename to include/xrpl/tx/transactors/Vault/VaultClawback.h index c93289e641..131a1d87e7 100644 --- a/src/xrpld/app/tx/detail/VaultClawback.h +++ b/include/xrpl/tx/transactors/Vault/VaultClawback.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/VaultCreate.h b/include/xrpl/tx/transactors/Vault/VaultCreate.h similarity index 92% rename from src/xrpld/app/tx/detail/VaultCreate.h rename to include/xrpl/tx/transactors/Vault/VaultCreate.h index 20b18f5cc2..cc35cd765b 100644 --- a/src/xrpld/app/tx/detail/VaultCreate.h +++ b/include/xrpl/tx/transactors/Vault/VaultCreate.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/VaultDelete.h b/include/xrpl/tx/transactors/Vault/VaultDelete.h similarity index 90% rename from src/xrpld/app/tx/detail/VaultDelete.h rename to include/xrpl/tx/transactors/Vault/VaultDelete.h index 8d1f214885..f881a692fd 100644 --- a/src/xrpld/app/tx/detail/VaultDelete.h +++ b/include/xrpl/tx/transactors/Vault/VaultDelete.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/VaultDeposit.h b/include/xrpl/tx/transactors/Vault/VaultDeposit.h similarity index 90% rename from src/xrpld/app/tx/detail/VaultDeposit.h rename to include/xrpl/tx/transactors/Vault/VaultDeposit.h index 6c63308407..0943596f20 100644 --- a/src/xrpld/app/tx/detail/VaultDeposit.h +++ b/include/xrpl/tx/transactors/Vault/VaultDeposit.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/VaultSet.h b/include/xrpl/tx/transactors/Vault/VaultSet.h similarity index 91% rename from src/xrpld/app/tx/detail/VaultSet.h rename to include/xrpl/tx/transactors/Vault/VaultSet.h index 1e8a15291e..fb69f132b1 100644 --- a/src/xrpld/app/tx/detail/VaultSet.h +++ b/include/xrpl/tx/transactors/Vault/VaultSet.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/VaultWithdraw.h b/include/xrpl/tx/transactors/Vault/VaultWithdraw.h similarity index 90% rename from src/xrpld/app/tx/detail/VaultWithdraw.h rename to include/xrpl/tx/transactors/Vault/VaultWithdraw.h index f832c206f8..ffe14a7141 100644 --- a/src/xrpld/app/tx/detail/VaultWithdraw.h +++ b/include/xrpl/tx/transactors/Vault/VaultWithdraw.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/XChainBridge.h b/include/xrpl/tx/transactors/XChainBridge.h similarity index 99% rename from src/xrpld/app/tx/detail/XChainBridge.h rename to include/xrpl/tx/transactors/XChainBridge.h index 3d0c250f24..0a2fccc18b 100644 --- a/src/xrpld/app/tx/detail/XChainBridge.h +++ b/include/xrpl/tx/transactors/XChainBridge.h @@ -1,8 +1,7 @@ #pragma once -#include - #include +#include namespace xrpl { diff --git a/src/libxrpl/protocol/Protocol.cpp b/src/libxrpl/protocol/Protocol.cpp new file mode 100644 index 0000000000..6f86f49fc6 --- /dev/null +++ b/src/libxrpl/protocol/Protocol.cpp @@ -0,0 +1,15 @@ +#include + +namespace xrpl { +bool +isVotingLedger(LedgerIndex seq) +{ + return seq % FLAG_LEDGER_INTERVAL == 0; +} + +bool +isFlagLedger(LedgerIndex seq) +{ + return seq % FLAG_LEDGER_INTERVAL == 0; +} +} // namespace xrpl diff --git a/src/xrpld/app/misc/detail/LoadFeeTrack.cpp b/src/libxrpl/server/LoadFeeTrack.cpp similarity index 98% rename from src/xrpld/app/misc/detail/LoadFeeTrack.cpp rename to src/libxrpl/server/LoadFeeTrack.cpp index 91a40c6a9d..e3867f36f5 100644 --- a/src/xrpld/app/misc/detail/LoadFeeTrack.cpp +++ b/src/libxrpl/server/LoadFeeTrack.cpp @@ -1,9 +1,8 @@ -#include - #include #include #include #include +#include #include diff --git a/src/xrpld/app/tx/detail/ApplyContext.cpp b/src/libxrpl/tx/ApplyContext.cpp similarity index 97% rename from src/xrpld/app/tx/detail/ApplyContext.cpp rename to src/libxrpl/tx/ApplyContext.cpp index 71cb5cd936..1258d36a50 100644 --- a/src/xrpld/app/tx/detail/ApplyContext.cpp +++ b/src/libxrpl/tx/ApplyContext.cpp @@ -1,9 +1,8 @@ -#include -#include - #include #include #include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/InvariantCheck.cpp b/src/libxrpl/tx/InvariantCheck.cpp similarity index 99% rename from src/xrpld/app/tx/detail/InvariantCheck.cpp rename to src/libxrpl/tx/InvariantCheck.cpp index 24a37270ce..c1ba2ac4ea 100644 --- a/src/xrpld/app/tx/detail/InvariantCheck.cpp +++ b/src/libxrpl/tx/InvariantCheck.cpp @@ -1,9 +1,3 @@ -#include -#include -#include -#include -#include - #include #include #include @@ -21,6 +15,11 @@ #include #include #include +#include +#include +#include +#include +#include #include #include diff --git a/src/xrpld/app/tx/detail/SignerEntries.cpp b/src/libxrpl/tx/SignerEntries.cpp similarity index 95% rename from src/xrpld/app/tx/detail/SignerEntries.cpp rename to src/libxrpl/tx/SignerEntries.cpp index 3526148638..aca1f2c19a 100644 --- a/src/xrpld/app/tx/detail/SignerEntries.cpp +++ b/src/libxrpl/tx/SignerEntries.cpp @@ -1,8 +1,8 @@ -#include - #include #include #include +#include +#include #include #include diff --git a/src/xrpld/app/tx/detail/Transactor.cpp b/src/libxrpl/tx/Transactor.cpp similarity index 99% rename from src/xrpld/app/tx/detail/Transactor.cpp rename to src/libxrpl/tx/Transactor.cpp index 129c06fdd5..3545004efa 100644 --- a/src/xrpld/app/tx/detail/Transactor.cpp +++ b/src/libxrpl/tx/Transactor.cpp @@ -1,10 +1,3 @@ -#include -#include -#include -#include -#include -#include - #include #include #include @@ -17,6 +10,12 @@ #include #include #include +#include +#include +#include +#include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/apply.cpp b/src/libxrpl/tx/apply.cpp similarity index 99% rename from src/xrpld/app/tx/detail/apply.cpp rename to src/libxrpl/tx/apply.cpp index 0f7d2eb2a3..2d2df75173 100644 --- a/src/xrpld/app/tx/detail/apply.cpp +++ b/src/libxrpl/tx/apply.cpp @@ -1,11 +1,10 @@ -#include -#include - #include #include #include #include #include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/applySteps.cpp b/src/libxrpl/tx/applySteps.cpp similarity index 99% rename from src/xrpld/app/tx/detail/applySteps.cpp rename to src/libxrpl/tx/applySteps.cpp index 412b717428..3d5c1486f4 100644 --- a/src/xrpld/app/tx/detail/applySteps.cpp +++ b/src/libxrpl/tx/applySteps.cpp @@ -1,4 +1,4 @@ -#include +#include #pragma push_macro("TRANSACTION") #undef TRANSACTION diff --git a/src/xrpld/app/tx/detail/BookTip.cpp b/src/libxrpl/tx/paths/BookTip.cpp similarity index 97% rename from src/xrpld/app/tx/detail/BookTip.cpp rename to src/libxrpl/tx/paths/BookTip.cpp index 61010c0caa..f00da6d7c7 100644 --- a/src/xrpld/app/tx/detail/BookTip.cpp +++ b/src/libxrpl/tx/paths/BookTip.cpp @@ -1,4 +1,4 @@ -#include +#include namespace xrpl { diff --git a/src/xrpld/app/paths/Flow.cpp b/src/libxrpl/tx/paths/Flow.cpp similarity index 95% rename from src/xrpld/app/paths/Flow.cpp rename to src/libxrpl/tx/paths/Flow.cpp index 1f6d29bfb9..d1c25a353c 100644 --- a/src/xrpld/app/paths/Flow.cpp +++ b/src/libxrpl/tx/paths/Flow.cpp @@ -1,13 +1,12 @@ -#include -#include -#include -#include -#include - #include #include #include #include +#include +#include +#include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/OfferStream.cpp b/src/libxrpl/tx/paths/OfferStream.cpp similarity index 99% rename from src/xrpld/app/tx/detail/OfferStream.cpp rename to src/libxrpl/tx/paths/OfferStream.cpp index 9f013de607..ee74d94d7d 100644 --- a/src/xrpld/app/tx/detail/OfferStream.cpp +++ b/src/libxrpl/tx/paths/OfferStream.cpp @@ -1,10 +1,9 @@ -#include -#include - #include #include #include #include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/paths/RippleCalc.cpp b/src/libxrpl/tx/paths/RippleCalc.cpp similarity index 96% rename from src/xrpld/app/paths/RippleCalc.cpp rename to src/libxrpl/tx/paths/RippleCalc.cpp index 0667e1971c..ba40e031cc 100644 --- a/src/xrpld/app/paths/RippleCalc.cpp +++ b/src/libxrpl/tx/paths/RippleCalc.cpp @@ -1,10 +1,9 @@ -#include -#include -#include - #include #include #include +#include +#include +#include namespace xrpl { namespace path { diff --git a/src/xrpld/app/tx/detail/AMMBid.cpp b/src/libxrpl/tx/transactors/AMM/AMMBid.cpp similarity index 98% rename from src/xrpld/app/tx/detail/AMMBid.cpp rename to src/libxrpl/tx/transactors/AMM/AMMBid.cpp index 1d0c30c1f0..b54fb34be9 100644 --- a/src/xrpld/app/tx/detail/AMMBid.cpp +++ b/src/libxrpl/tx/transactors/AMM/AMMBid.cpp @@ -1,13 +1,12 @@ -#include -#include -#include - #include #include #include #include #include #include +#include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/AMMClawback.cpp b/src/libxrpl/tx/transactors/AMM/AMMClawback.cpp similarity index 97% rename from src/xrpld/app/tx/detail/AMMClawback.cpp rename to src/libxrpl/tx/transactors/AMM/AMMClawback.cpp index 6da899c578..19aebecb27 100644 --- a/src/xrpld/app/tx/detail/AMMClawback.cpp +++ b/src/libxrpl/tx/transactors/AMM/AMMClawback.cpp @@ -1,14 +1,13 @@ -#include -#include -#include -#include - #include #include #include #include #include #include +#include +#include +#include +#include #include diff --git a/src/xrpld/app/tx/detail/AMMCreate.cpp b/src/libxrpl/tx/transactors/AMM/AMMCreate.cpp similarity index 98% rename from src/xrpld/app/tx/detail/AMMCreate.cpp rename to src/libxrpl/tx/transactors/AMM/AMMCreate.cpp index 1131d21fd2..432fb716b7 100644 --- a/src/xrpld/app/tx/detail/AMMCreate.cpp +++ b/src/libxrpl/tx/transactors/AMM/AMMCreate.cpp @@ -1,7 +1,3 @@ -#include -#include -#include - #include #include #include @@ -9,6 +5,9 @@ #include #include #include +#include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/AMMDelete.cpp b/src/libxrpl/tx/transactors/AMM/AMMDelete.cpp similarity index 92% rename from src/xrpld/app/tx/detail/AMMDelete.cpp rename to src/libxrpl/tx/transactors/AMM/AMMDelete.cpp index f810f57758..d11e8f225c 100644 --- a/src/xrpld/app/tx/detail/AMMDelete.cpp +++ b/src/libxrpl/tx/transactors/AMM/AMMDelete.cpp @@ -1,10 +1,9 @@ -#include -#include - #include #include #include #include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/AMMDeposit.cpp b/src/libxrpl/tx/transactors/AMM/AMMDeposit.cpp similarity index 99% rename from src/xrpld/app/tx/detail/AMMDeposit.cpp rename to src/libxrpl/tx/transactors/AMM/AMMDeposit.cpp index af4ce51894..83917246c6 100644 --- a/src/xrpld/app/tx/detail/AMMDeposit.cpp +++ b/src/libxrpl/tx/transactors/AMM/AMMDeposit.cpp @@ -1,12 +1,11 @@ -#include -#include -#include - #include #include #include #include #include +#include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/misc/detail/AMMHelpers.cpp b/src/libxrpl/tx/transactors/AMM/AMMHelpers.cpp similarity index 99% rename from src/xrpld/app/misc/detail/AMMHelpers.cpp rename to src/libxrpl/tx/transactors/AMM/AMMHelpers.cpp index ff3474f33d..28e1b8adf7 100644 --- a/src/xrpld/app/misc/detail/AMMHelpers.cpp +++ b/src/libxrpl/tx/transactors/AMM/AMMHelpers.cpp @@ -1,4 +1,4 @@ -#include +#include namespace xrpl { diff --git a/src/xrpld/app/misc/detail/AMMUtils.cpp b/src/libxrpl/tx/transactors/AMM/AMMUtils.cpp similarity index 99% rename from src/xrpld/app/misc/detail/AMMUtils.cpp rename to src/libxrpl/tx/transactors/AMM/AMMUtils.cpp index 36a40f1709..0ae1903928 100644 --- a/src/xrpld/app/misc/detail/AMMUtils.cpp +++ b/src/libxrpl/tx/transactors/AMM/AMMUtils.cpp @@ -1,10 +1,9 @@ -#include -#include - #include #include #include #include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/AMMVote.cpp b/src/libxrpl/tx/transactors/AMM/AMMVote.cpp similarity index 98% rename from src/xrpld/app/tx/detail/AMMVote.cpp rename to src/libxrpl/tx/transactors/AMM/AMMVote.cpp index 05b23233a4..2ef281b70f 100644 --- a/src/xrpld/app/tx/detail/AMMVote.cpp +++ b/src/libxrpl/tx/transactors/AMM/AMMVote.cpp @@ -1,10 +1,9 @@ -#include -#include - #include #include #include #include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/AMMWithdraw.cpp b/src/libxrpl/tx/transactors/AMM/AMMWithdraw.cpp similarity index 99% rename from src/xrpld/app/tx/detail/AMMWithdraw.cpp rename to src/libxrpl/tx/transactors/AMM/AMMWithdraw.cpp index 58d1e066d6..bf00223660 100644 --- a/src/xrpld/app/tx/detail/AMMWithdraw.cpp +++ b/src/libxrpl/tx/transactors/AMM/AMMWithdraw.cpp @@ -1,11 +1,10 @@ -#include -#include -#include - #include #include #include #include +#include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/Batch.cpp b/src/libxrpl/tx/transactors/Batch.cpp similarity index 99% rename from src/xrpld/app/tx/detail/Batch.cpp rename to src/libxrpl/tx/transactors/Batch.cpp index f7f0d7ac60..faa756a56f 100644 --- a/src/xrpld/app/tx/detail/Batch.cpp +++ b/src/libxrpl/tx/transactors/Batch.cpp @@ -1,6 +1,3 @@ -#include -#include - #include #include #include @@ -9,6 +6,8 @@ #include #include #include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/Change.cpp b/src/libxrpl/tx/transactors/Change.cpp similarity index 99% rename from src/xrpld/app/tx/detail/Change.cpp rename to src/libxrpl/tx/transactors/Change.cpp index 478377a818..eea3da6072 100644 --- a/src/xrpld/app/tx/detail/Change.cpp +++ b/src/libxrpl/tx/transactors/Change.cpp @@ -1,12 +1,11 @@ -#include -#include - #include +#include #include #include #include #include #include +#include #include diff --git a/src/xrpld/app/tx/detail/CancelCheck.cpp b/src/libxrpl/tx/transactors/Check/CancelCheck.cpp similarity index 98% rename from src/xrpld/app/tx/detail/CancelCheck.cpp rename to src/libxrpl/tx/transactors/Check/CancelCheck.cpp index 7936b3b9ed..c9a947ae6a 100644 --- a/src/xrpld/app/tx/detail/CancelCheck.cpp +++ b/src/libxrpl/tx/transactors/Check/CancelCheck.cpp @@ -1,5 +1,3 @@ -#include - #include #include #include @@ -7,6 +5,7 @@ #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/CashCheck.cpp b/src/libxrpl/tx/transactors/Check/CashCheck.cpp similarity index 99% rename from src/xrpld/app/tx/detail/CashCheck.cpp rename to src/libxrpl/tx/transactors/Check/CashCheck.cpp index 633ab1133a..2f5b371c65 100644 --- a/src/xrpld/app/tx/detail/CashCheck.cpp +++ b/src/libxrpl/tx/transactors/Check/CashCheck.cpp @@ -1,6 +1,3 @@ -#include -#include - #include #include #include @@ -8,6 +5,8 @@ #include #include #include +#include +#include #include diff --git a/src/xrpld/app/tx/detail/CreateCheck.cpp b/src/libxrpl/tx/transactors/Check/CreateCheck.cpp similarity index 99% rename from src/xrpld/app/tx/detail/CreateCheck.cpp rename to src/libxrpl/tx/transactors/Check/CreateCheck.cpp index 7511f2df2e..8f3a0dbdb0 100644 --- a/src/xrpld/app/tx/detail/CreateCheck.cpp +++ b/src/libxrpl/tx/transactors/Check/CreateCheck.cpp @@ -1,11 +1,10 @@ -#include - #include #include #include #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/Clawback.cpp b/src/libxrpl/tx/transactors/Clawback.cpp similarity index 99% rename from src/xrpld/app/tx/detail/Clawback.cpp rename to src/libxrpl/tx/transactors/Clawback.cpp index ad4a2f24d0..4fddd26a67 100644 --- a/src/xrpld/app/tx/detail/Clawback.cpp +++ b/src/libxrpl/tx/transactors/Clawback.cpp @@ -1,11 +1,10 @@ -#include - #include #include #include #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/CreateTicket.cpp b/src/libxrpl/tx/transactors/CreateTicket.cpp similarity index 98% rename from src/xrpld/app/tx/detail/CreateTicket.cpp rename to src/libxrpl/tx/transactors/CreateTicket.cpp index 1ce067087c..de61e58b41 100644 --- a/src/xrpld/app/tx/detail/CreateTicket.cpp +++ b/src/libxrpl/tx/transactors/CreateTicket.cpp @@ -1,10 +1,9 @@ -#include - #include #include #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/Credentials.cpp b/src/libxrpl/tx/transactors/Credentials.cpp similarity index 99% rename from src/xrpld/app/tx/detail/Credentials.cpp rename to src/libxrpl/tx/transactors/Credentials.cpp index fc3019308a..2dccdf3c15 100644 --- a/src/xrpld/app/tx/detail/Credentials.cpp +++ b/src/libxrpl/tx/transactors/Credentials.cpp @@ -1,5 +1,3 @@ -#include - #include #include #include @@ -7,6 +5,7 @@ #include #include #include +#include #include diff --git a/src/xrpld/app/tx/detail/DID.cpp b/src/libxrpl/tx/transactors/DID.cpp similarity index 99% rename from src/xrpld/app/tx/detail/DID.cpp rename to src/libxrpl/tx/transactors/DID.cpp index 7219dcf60e..216be7ba75 100644 --- a/src/xrpld/app/tx/detail/DID.cpp +++ b/src/libxrpl/tx/transactors/DID.cpp @@ -1,11 +1,10 @@ -#include - #include #include #include #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/DelegateSet.cpp b/src/libxrpl/tx/transactors/Delegate/DelegateSet.cpp similarity index 98% rename from src/xrpld/app/tx/detail/DelegateSet.cpp rename to src/libxrpl/tx/transactors/Delegate/DelegateSet.cpp index 8dba3ef72e..b2020a60b0 100644 --- a/src/xrpld/app/tx/detail/DelegateSet.cpp +++ b/src/libxrpl/tx/transactors/Delegate/DelegateSet.cpp @@ -1,10 +1,9 @@ -#include - #include #include #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/misc/detail/DelegateUtils.cpp b/src/libxrpl/tx/transactors/Delegate/DelegateUtils.cpp similarity index 95% rename from src/xrpld/app/misc/detail/DelegateUtils.cpp rename to src/libxrpl/tx/transactors/Delegate/DelegateUtils.cpp index 74ec55cdee..eceb73503f 100644 --- a/src/xrpld/app/misc/detail/DelegateUtils.cpp +++ b/src/libxrpl/tx/transactors/Delegate/DelegateUtils.cpp @@ -1,6 +1,5 @@ -#include - #include +#include namespace xrpl { NotTEC diff --git a/src/xrpld/app/tx/detail/DeleteAccount.cpp b/src/libxrpl/tx/transactors/DeleteAccount.cpp similarity index 97% rename from src/xrpld/app/tx/detail/DeleteAccount.cpp rename to src/libxrpl/tx/transactors/DeleteAccount.cpp index 5d2d2e85a7..9b05bb3aa5 100644 --- a/src/xrpld/app/tx/detail/DeleteAccount.cpp +++ b/src/libxrpl/tx/transactors/DeleteAccount.cpp @@ -1,11 +1,3 @@ -#include -#include -#include -#include -#include -#include -#include - #include #include #include @@ -16,6 +8,13 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/DeleteOracle.cpp b/src/libxrpl/tx/transactors/DeleteOracle.cpp similarity index 97% rename from src/xrpld/app/tx/detail/DeleteOracle.cpp rename to src/libxrpl/tx/transactors/DeleteOracle.cpp index 9b62bffb5f..8f8a29f8a2 100644 --- a/src/xrpld/app/tx/detail/DeleteOracle.cpp +++ b/src/libxrpl/tx/transactors/DeleteOracle.cpp @@ -1,9 +1,8 @@ -#include - #include #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/DepositPreauth.cpp b/src/libxrpl/tx/transactors/DepositPreauth.cpp similarity index 99% rename from src/xrpld/app/tx/detail/DepositPreauth.cpp rename to src/libxrpl/tx/transactors/DepositPreauth.cpp index 023833212c..a72628b5be 100644 --- a/src/xrpld/app/tx/detail/DepositPreauth.cpp +++ b/src/libxrpl/tx/transactors/DepositPreauth.cpp @@ -1,11 +1,10 @@ -#include - #include #include #include #include #include #include +#include #include diff --git a/src/xrpld/app/tx/detail/Escrow.cpp b/src/libxrpl/tx/transactors/Escrow.cpp similarity index 99% rename from src/xrpld/app/tx/detail/Escrow.cpp rename to src/libxrpl/tx/transactors/Escrow.cpp index 2014dcc926..aff6d07cc3 100644 --- a/src/xrpld/app/tx/detail/Escrow.cpp +++ b/src/libxrpl/tx/transactors/Escrow.cpp @@ -1,6 +1,3 @@ -#include -#include - #include #include #include @@ -14,6 +11,8 @@ #include #include #include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/LedgerStateFix.cpp b/src/libxrpl/tx/transactors/LedgerStateFix.cpp similarity index 94% rename from src/xrpld/app/tx/detail/LedgerStateFix.cpp rename to src/libxrpl/tx/transactors/LedgerStateFix.cpp index 43001e2fbf..28028b6f2b 100644 --- a/src/xrpld/app/tx/detail/LedgerStateFix.cpp +++ b/src/libxrpl/tx/transactors/LedgerStateFix.cpp @@ -1,10 +1,9 @@ -#include -#include - #include #include #include #include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/misc/detail/LendingHelpers.cpp b/src/libxrpl/tx/transactors/Lending/LendingHelpers.cpp similarity index 99% rename from src/xrpld/app/misc/detail/LendingHelpers.cpp rename to src/libxrpl/tx/transactors/Lending/LendingHelpers.cpp index c0fd4c36d8..13bb321974 100644 --- a/src/xrpld/app/misc/detail/LendingHelpers.cpp +++ b/src/libxrpl/tx/transactors/Lending/LendingHelpers.cpp @@ -1,6 +1,6 @@ -#include +#include // DO NOT REMOVE forces header file include to sort first -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/LoanBrokerCoverClawback.cpp b/src/libxrpl/tx/transactors/Lending/LoanBrokerCoverClawback.cpp similarity index 98% rename from src/xrpld/app/tx/detail/LoanBrokerCoverClawback.cpp rename to src/libxrpl/tx/transactors/Lending/LoanBrokerCoverClawback.cpp index 7038752f8b..819ae54895 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerCoverClawback.cpp +++ b/src/libxrpl/tx/transactors/Lending/LoanBrokerCoverClawback.cpp @@ -1,8 +1,7 @@ -#include +#include // -#include - #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/LoanBrokerCoverDeposit.cpp b/src/libxrpl/tx/transactors/Lending/LoanBrokerCoverDeposit.cpp similarity index 96% rename from src/xrpld/app/tx/detail/LoanBrokerCoverDeposit.cpp rename to src/libxrpl/tx/transactors/Lending/LoanBrokerCoverDeposit.cpp index 3dd513414e..d112959fea 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerCoverDeposit.cpp +++ b/src/libxrpl/tx/transactors/Lending/LoanBrokerCoverDeposit.cpp @@ -1,8 +1,7 @@ -#include +#include // -#include - #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/LoanBrokerCoverWithdraw.cpp b/src/libxrpl/tx/transactors/Lending/LoanBrokerCoverWithdraw.cpp similarity index 97% rename from src/xrpld/app/tx/detail/LoanBrokerCoverWithdraw.cpp rename to src/libxrpl/tx/transactors/Lending/LoanBrokerCoverWithdraw.cpp index f2c8f28a84..43ff3659ef 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerCoverWithdraw.cpp +++ b/src/libxrpl/tx/transactors/Lending/LoanBrokerCoverWithdraw.cpp @@ -1,10 +1,9 @@ -#include +#include // -#include -#include - #include #include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/LoanBrokerDelete.cpp b/src/libxrpl/tx/transactors/Lending/LoanBrokerDelete.cpp similarity index 97% rename from src/xrpld/app/tx/detail/LoanBrokerDelete.cpp rename to src/libxrpl/tx/transactors/Lending/LoanBrokerDelete.cpp index 7c8b6c1f64..45227144fa 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerDelete.cpp +++ b/src/libxrpl/tx/transactors/Lending/LoanBrokerDelete.cpp @@ -1,8 +1,7 @@ -#include +#include // -#include - #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/LoanBrokerSet.cpp b/src/libxrpl/tx/transactors/Lending/LoanBrokerSet.cpp similarity index 98% rename from src/xrpld/app/tx/detail/LoanBrokerSet.cpp rename to src/libxrpl/tx/transactors/Lending/LoanBrokerSet.cpp index 9553402f15..cf1cbaa610 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerSet.cpp +++ b/src/libxrpl/tx/transactors/Lending/LoanBrokerSet.cpp @@ -1,8 +1,7 @@ -#include +#include // -#include - #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/LoanDelete.cpp b/src/libxrpl/tx/transactors/Lending/LoanDelete.cpp similarity index 97% rename from src/xrpld/app/tx/detail/LoanDelete.cpp rename to src/libxrpl/tx/transactors/Lending/LoanDelete.cpp index d975834d29..fb7f0f8cd4 100644 --- a/src/xrpld/app/tx/detail/LoanDelete.cpp +++ b/src/libxrpl/tx/transactors/Lending/LoanDelete.cpp @@ -1,8 +1,7 @@ -#include +#include // -#include - #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/LoanManage.cpp b/src/libxrpl/tx/transactors/Lending/LoanManage.cpp similarity index 99% rename from src/xrpld/app/tx/detail/LoanManage.cpp rename to src/libxrpl/tx/transactors/Lending/LoanManage.cpp index 8d0a79686c..6f524010d4 100644 --- a/src/xrpld/app/tx/detail/LoanManage.cpp +++ b/src/libxrpl/tx/transactors/Lending/LoanManage.cpp @@ -1,9 +1,8 @@ -#include +#include // -#include - #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/LoanPay.cpp b/src/libxrpl/tx/transactors/Lending/LoanPay.cpp similarity index 99% rename from src/xrpld/app/tx/detail/LoanPay.cpp rename to src/libxrpl/tx/transactors/Lending/LoanPay.cpp index 744e81d67d..089c862fbb 100644 --- a/src/xrpld/app/tx/detail/LoanPay.cpp +++ b/src/libxrpl/tx/transactors/Lending/LoanPay.cpp @@ -1,12 +1,11 @@ -#include +#include // -#include -#include - #include #include #include #include +#include +#include #include diff --git a/src/xrpld/app/tx/detail/LoanSet.cpp b/src/libxrpl/tx/transactors/Lending/LoanSet.cpp similarity index 99% rename from src/xrpld/app/tx/detail/LoanSet.cpp rename to src/libxrpl/tx/transactors/Lending/LoanSet.cpp index b7105f5df8..06209d9354 100644 --- a/src/xrpld/app/tx/detail/LoanSet.cpp +++ b/src/libxrpl/tx/transactors/Lending/LoanSet.cpp @@ -1,9 +1,8 @@ -#include +#include // -#include - #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/MPTokenAuthorize.cpp b/src/libxrpl/tx/transactors/MPT/MPTokenAuthorize.cpp similarity index 98% rename from src/xrpld/app/tx/detail/MPTokenAuthorize.cpp rename to src/libxrpl/tx/transactors/MPT/MPTokenAuthorize.cpp index 1eb9a0359a..75d51f39a5 100644 --- a/src/xrpld/app/tx/detail/MPTokenAuthorize.cpp +++ b/src/libxrpl/tx/transactors/MPT/MPTokenAuthorize.cpp @@ -1,9 +1,8 @@ -#include - #include #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/MPTokenIssuanceCreate.cpp b/src/libxrpl/tx/transactors/MPT/MPTokenIssuanceCreate.cpp similarity index 98% rename from src/xrpld/app/tx/detail/MPTokenIssuanceCreate.cpp rename to src/libxrpl/tx/transactors/MPT/MPTokenIssuanceCreate.cpp index 9a9dc6a11c..b135113499 100644 --- a/src/xrpld/app/tx/detail/MPTokenIssuanceCreate.cpp +++ b/src/libxrpl/tx/transactors/MPT/MPTokenIssuanceCreate.cpp @@ -1,8 +1,7 @@ -#include - #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/MPTokenIssuanceDestroy.cpp b/src/libxrpl/tx/transactors/MPT/MPTokenIssuanceDestroy.cpp similarity index 96% rename from src/xrpld/app/tx/detail/MPTokenIssuanceDestroy.cpp rename to src/libxrpl/tx/transactors/MPT/MPTokenIssuanceDestroy.cpp index cec06c5494..acdd004bae 100644 --- a/src/xrpld/app/tx/detail/MPTokenIssuanceDestroy.cpp +++ b/src/libxrpl/tx/transactors/MPT/MPTokenIssuanceDestroy.cpp @@ -1,8 +1,7 @@ -#include - #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/MPTokenIssuanceSet.cpp b/src/libxrpl/tx/transactors/MPT/MPTokenIssuanceSet.cpp similarity index 98% rename from src/xrpld/app/tx/detail/MPTokenIssuanceSet.cpp rename to src/libxrpl/tx/transactors/MPT/MPTokenIssuanceSet.cpp index cf3b15ed78..5bad3906a0 100644 --- a/src/xrpld/app/tx/detail/MPTokenIssuanceSet.cpp +++ b/src/libxrpl/tx/transactors/MPT/MPTokenIssuanceSet.cpp @@ -1,9 +1,8 @@ -#include -#include - #include #include #include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/NFTokenAcceptOffer.cpp b/src/libxrpl/tx/transactors/NFT/NFTokenAcceptOffer.cpp similarity index 99% rename from src/xrpld/app/tx/detail/NFTokenAcceptOffer.cpp rename to src/libxrpl/tx/transactors/NFT/NFTokenAcceptOffer.cpp index 349dc2c1ea..57f20fe124 100644 --- a/src/xrpld/app/tx/detail/NFTokenAcceptOffer.cpp +++ b/src/libxrpl/tx/transactors/NFT/NFTokenAcceptOffer.cpp @@ -1,10 +1,9 @@ -#include -#include - #include #include #include #include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/NFTokenBurn.cpp b/src/libxrpl/tx/transactors/NFT/NFTokenBurn.cpp similarity index 96% rename from src/xrpld/app/tx/detail/NFTokenBurn.cpp rename to src/libxrpl/tx/transactors/NFT/NFTokenBurn.cpp index a6146dcc4e..3aee6e26b3 100644 --- a/src/xrpld/app/tx/detail/NFTokenBurn.cpp +++ b/src/libxrpl/tx/transactors/NFT/NFTokenBurn.cpp @@ -1,9 +1,8 @@ -#include -#include - #include #include #include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/NFTokenCancelOffer.cpp b/src/libxrpl/tx/transactors/NFT/NFTokenCancelOffer.cpp similarity index 95% rename from src/xrpld/app/tx/detail/NFTokenCancelOffer.cpp rename to src/libxrpl/tx/transactors/NFT/NFTokenCancelOffer.cpp index f691a1b816..24f2b8687a 100644 --- a/src/xrpld/app/tx/detail/NFTokenCancelOffer.cpp +++ b/src/libxrpl/tx/transactors/NFT/NFTokenCancelOffer.cpp @@ -1,9 +1,8 @@ -#include -#include - #include #include #include +#include +#include #include diff --git a/src/xrpld/app/tx/detail/NFTokenCreateOffer.cpp b/src/libxrpl/tx/transactors/NFT/NFTokenCreateOffer.cpp similarity index 94% rename from src/xrpld/app/tx/detail/NFTokenCreateOffer.cpp rename to src/libxrpl/tx/transactors/NFT/NFTokenCreateOffer.cpp index fdf2444ebc..ecf106baaf 100644 --- a/src/xrpld/app/tx/detail/NFTokenCreateOffer.cpp +++ b/src/libxrpl/tx/transactors/NFT/NFTokenCreateOffer.cpp @@ -1,9 +1,8 @@ -#include -#include - #include #include #include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/NFTokenMint.cpp b/src/libxrpl/tx/transactors/NFT/NFTokenMint.cpp similarity index 99% rename from src/xrpld/app/tx/detail/NFTokenMint.cpp rename to src/libxrpl/tx/transactors/NFT/NFTokenMint.cpp index b00001e8fc..c03e351b0e 100644 --- a/src/xrpld/app/tx/detail/NFTokenMint.cpp +++ b/src/libxrpl/tx/transactors/NFT/NFTokenMint.cpp @@ -1,11 +1,10 @@ -#include - #include #include #include #include #include #include +#include #include diff --git a/src/xrpld/app/tx/detail/NFTokenModify.cpp b/src/libxrpl/tx/transactors/NFT/NFTokenModify.cpp similarity index 93% rename from src/xrpld/app/tx/detail/NFTokenModify.cpp rename to src/libxrpl/tx/transactors/NFT/NFTokenModify.cpp index 15be2d196a..316bcb0f27 100644 --- a/src/xrpld/app/tx/detail/NFTokenModify.cpp +++ b/src/libxrpl/tx/transactors/NFT/NFTokenModify.cpp @@ -1,8 +1,7 @@ -#include -#include - #include #include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/NFTokenUtils.cpp b/src/libxrpl/tx/transactors/NFT/NFTokenUtils.cpp similarity index 99% rename from src/xrpld/app/tx/detail/NFTokenUtils.cpp rename to src/libxrpl/tx/transactors/NFT/NFTokenUtils.cpp index 5581182204..638ee99e36 100644 --- a/src/xrpld/app/tx/detail/NFTokenUtils.cpp +++ b/src/libxrpl/tx/transactors/NFT/NFTokenUtils.cpp @@ -1,5 +1,3 @@ -#include - #include #include #include @@ -7,6 +5,7 @@ #include #include #include +#include #include #include diff --git a/src/xrpld/app/tx/detail/CancelOffer.cpp b/src/libxrpl/tx/transactors/Offer/CancelOffer.cpp similarity index 96% rename from src/xrpld/app/tx/detail/CancelOffer.cpp rename to src/libxrpl/tx/transactors/Offer/CancelOffer.cpp index 3b690cb730..3e5d2441e1 100644 --- a/src/xrpld/app/tx/detail/CancelOffer.cpp +++ b/src/libxrpl/tx/transactors/Offer/CancelOffer.cpp @@ -1,8 +1,7 @@ -#include - #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/CreateOffer.cpp b/src/libxrpl/tx/transactors/Offer/CreateOffer.cpp similarity index 99% rename from src/xrpld/app/tx/detail/CreateOffer.cpp rename to src/libxrpl/tx/transactors/Offer/CreateOffer.cpp index d40109f571..4b820014af 100644 --- a/src/xrpld/app/tx/detail/CreateOffer.cpp +++ b/src/libxrpl/tx/transactors/Offer/CreateOffer.cpp @@ -1,7 +1,3 @@ -#include -#include -#include - #include #include #include @@ -11,6 +7,9 @@ #include #include #include +#include +#include +#include namespace xrpl { TxConsequences diff --git a/src/xrpld/app/tx/detail/PayChan.cpp b/src/libxrpl/tx/transactors/PayChan.cpp similarity index 99% rename from src/xrpld/app/tx/detail/PayChan.cpp rename to src/libxrpl/tx/transactors/PayChan.cpp index 860784ecba..168b89a0f8 100644 --- a/src/xrpld/app/tx/detail/PayChan.cpp +++ b/src/libxrpl/tx/transactors/PayChan.cpp @@ -1,5 +1,3 @@ -#include - #include #include #include @@ -12,6 +10,7 @@ #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/Payment.cpp b/src/libxrpl/tx/transactors/Payment.cpp similarity index 99% rename from src/xrpld/app/tx/detail/Payment.cpp rename to src/libxrpl/tx/transactors/Payment.cpp index 19b2d8acc2..68a81e0d81 100644 --- a/src/xrpld/app/tx/detail/Payment.cpp +++ b/src/libxrpl/tx/transactors/Payment.cpp @@ -1,8 +1,3 @@ -#include -#include -#include -#include - #include #include #include @@ -10,6 +5,10 @@ #include #include #include +#include +#include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/misc/PermissionedDEXHelpers.cpp b/src/libxrpl/tx/transactors/PermissionedDomain/PermissionedDEXHelpers.cpp similarity index 97% rename from src/xrpld/app/misc/PermissionedDEXHelpers.cpp rename to src/libxrpl/tx/transactors/PermissionedDomain/PermissionedDEXHelpers.cpp index f88c2ab9d4..891e18ef69 100644 --- a/src/xrpld/app/misc/PermissionedDEXHelpers.cpp +++ b/src/libxrpl/tx/transactors/PermissionedDomain/PermissionedDEXHelpers.cpp @@ -1,6 +1,5 @@ -#include - #include +#include namespace xrpl { namespace permissioned_dex { diff --git a/src/xrpld/app/tx/detail/PermissionedDomainDelete.cpp b/src/libxrpl/tx/transactors/PermissionedDomain/PermissionedDomainDelete.cpp similarity index 95% rename from src/xrpld/app/tx/detail/PermissionedDomainDelete.cpp rename to src/libxrpl/tx/transactors/PermissionedDomain/PermissionedDomainDelete.cpp index f979637e27..1d54405688 100644 --- a/src/xrpld/app/tx/detail/PermissionedDomainDelete.cpp +++ b/src/libxrpl/tx/transactors/PermissionedDomain/PermissionedDomainDelete.cpp @@ -1,7 +1,6 @@ -#include - #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/PermissionedDomainSet.cpp b/src/libxrpl/tx/transactors/PermissionedDomain/PermissionedDomainSet.cpp similarity index 98% rename from src/xrpld/app/tx/detail/PermissionedDomainSet.cpp rename to src/libxrpl/tx/transactors/PermissionedDomain/PermissionedDomainSet.cpp index 19f68426d1..60400f480a 100644 --- a/src/xrpld/app/tx/detail/PermissionedDomainSet.cpp +++ b/src/libxrpl/tx/transactors/PermissionedDomain/PermissionedDomainSet.cpp @@ -1,9 +1,8 @@ -#include - #include #include #include #include +#include #include diff --git a/src/xrpld/app/tx/detail/SetAccount.cpp b/src/libxrpl/tx/transactors/SetAccount.cpp similarity index 99% rename from src/xrpld/app/tx/detail/SetAccount.cpp rename to src/libxrpl/tx/transactors/SetAccount.cpp index 41804c9211..fad6d1e318 100644 --- a/src/xrpld/app/tx/detail/SetAccount.cpp +++ b/src/libxrpl/tx/transactors/SetAccount.cpp @@ -1,6 +1,3 @@ -#include -#include - #include #include #include @@ -8,6 +5,8 @@ #include #include #include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/SetOracle.cpp b/src/libxrpl/tx/transactors/SetOracle.cpp similarity index 99% rename from src/xrpld/app/tx/detail/SetOracle.cpp rename to src/libxrpl/tx/transactors/SetOracle.cpp index 73ef1c7ae2..f7ca6a7563 100644 --- a/src/xrpld/app/tx/detail/SetOracle.cpp +++ b/src/libxrpl/tx/transactors/SetOracle.cpp @@ -1,11 +1,10 @@ -#include - #include #include #include #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/SetRegularKey.cpp b/src/libxrpl/tx/transactors/SetRegularKey.cpp similarity index 97% rename from src/xrpld/app/tx/detail/SetRegularKey.cpp rename to src/libxrpl/tx/transactors/SetRegularKey.cpp index a7f2acfbfe..0e68406f0d 100644 --- a/src/xrpld/app/tx/detail/SetRegularKey.cpp +++ b/src/libxrpl/tx/transactors/SetRegularKey.cpp @@ -1,8 +1,7 @@ -#include - #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/SetSignerList.cpp b/src/libxrpl/tx/transactors/SetSignerList.cpp similarity index 99% rename from src/xrpld/app/tx/detail/SetSignerList.cpp rename to src/libxrpl/tx/transactors/SetSignerList.cpp index f6a65d2711..8d736391c0 100644 --- a/src/xrpld/app/tx/detail/SetSignerList.cpp +++ b/src/libxrpl/tx/transactors/SetSignerList.cpp @@ -1,5 +1,3 @@ -#include - #include #include #include @@ -9,6 +7,7 @@ #include #include #include +#include #include #include diff --git a/src/xrpld/app/tx/detail/SetTrust.cpp b/src/libxrpl/tx/transactors/SetTrust.cpp similarity index 99% rename from src/xrpld/app/tx/detail/SetTrust.cpp rename to src/libxrpl/tx/transactors/SetTrust.cpp index ada6524008..2d1e94b967 100644 --- a/src/xrpld/app/tx/detail/SetTrust.cpp +++ b/src/libxrpl/tx/transactors/SetTrust.cpp @@ -1,6 +1,3 @@ -#include -#include - #include #include #include @@ -9,6 +6,8 @@ #include #include #include +#include +#include namespace { diff --git a/src/xrpld/app/tx/detail/VaultClawback.cpp b/src/libxrpl/tx/transactors/Vault/VaultClawback.cpp similarity index 99% rename from src/xrpld/app/tx/detail/VaultClawback.cpp rename to src/libxrpl/tx/transactors/Vault/VaultClawback.cpp index 5aa63fac1a..bbd68907de 100644 --- a/src/xrpld/app/tx/detail/VaultClawback.cpp +++ b/src/libxrpl/tx/transactors/Vault/VaultClawback.cpp @@ -1,5 +1,3 @@ -#include -// #include #include #include @@ -9,6 +7,8 @@ #include #include #include +#include +#include #include diff --git a/src/xrpld/app/tx/detail/VaultCreate.cpp b/src/libxrpl/tx/transactors/Vault/VaultCreate.cpp similarity index 97% rename from src/xrpld/app/tx/detail/VaultCreate.cpp rename to src/libxrpl/tx/transactors/Vault/VaultCreate.cpp index 6711a7e13f..c911c496ff 100644 --- a/src/xrpld/app/tx/detail/VaultCreate.cpp +++ b/src/libxrpl/tx/transactors/Vault/VaultCreate.cpp @@ -1,7 +1,3 @@ -#include -#include -#include - #include #include #include @@ -14,6 +10,9 @@ #include #include #include +#include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/VaultDelete.cpp b/src/libxrpl/tx/transactors/Vault/VaultDelete.cpp similarity index 99% rename from src/xrpld/app/tx/detail/VaultDelete.cpp rename to src/libxrpl/tx/transactors/Vault/VaultDelete.cpp index f5c388762f..7d8bf35e5f 100644 --- a/src/xrpld/app/tx/detail/VaultDelete.cpp +++ b/src/libxrpl/tx/transactors/Vault/VaultDelete.cpp @@ -1,5 +1,3 @@ -#include - #include #include #include @@ -7,6 +5,7 @@ #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/VaultDeposit.cpp b/src/libxrpl/tx/transactors/Vault/VaultDeposit.cpp similarity index 98% rename from src/xrpld/app/tx/detail/VaultDeposit.cpp rename to src/libxrpl/tx/transactors/Vault/VaultDeposit.cpp index d5fc0e4ad6..6f6b425227 100644 --- a/src/xrpld/app/tx/detail/VaultDeposit.cpp +++ b/src/libxrpl/tx/transactors/Vault/VaultDeposit.cpp @@ -1,6 +1,3 @@ -#include -#include - #include #include #include @@ -12,6 +9,8 @@ #include #include #include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/VaultSet.cpp b/src/libxrpl/tx/transactors/Vault/VaultSet.cpp similarity index 99% rename from src/xrpld/app/tx/detail/VaultSet.cpp rename to src/libxrpl/tx/transactors/Vault/VaultSet.cpp index c0aaf5bac6..5257a3089b 100644 --- a/src/xrpld/app/tx/detail/VaultSet.cpp +++ b/src/libxrpl/tx/transactors/Vault/VaultSet.cpp @@ -1,5 +1,3 @@ -#include - #include #include #include @@ -9,6 +7,7 @@ #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/VaultWithdraw.cpp b/src/libxrpl/tx/transactors/Vault/VaultWithdraw.cpp similarity index 99% rename from src/xrpld/app/tx/detail/VaultWithdraw.cpp rename to src/libxrpl/tx/transactors/Vault/VaultWithdraw.cpp index 88616e34f8..4d0a3c20a5 100644 --- a/src/xrpld/app/tx/detail/VaultWithdraw.cpp +++ b/src/libxrpl/tx/transactors/Vault/VaultWithdraw.cpp @@ -1,5 +1,3 @@ -#include - #include #include #include @@ -9,6 +7,7 @@ #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/XChainBridge.cpp b/src/libxrpl/tx/transactors/XChainBridge.cpp similarity index 99% rename from src/xrpld/app/tx/detail/XChainBridge.cpp rename to src/libxrpl/tx/transactors/XChainBridge.cpp index f4abb9145b..25b0e000db 100644 --- a/src/xrpld/app/tx/detail/XChainBridge.cpp +++ b/src/libxrpl/tx/transactors/XChainBridge.cpp @@ -1,8 +1,3 @@ -#include -#include -#include -#include - #include #include #include @@ -23,6 +18,10 @@ #include #include #include +#include +#include +#include +#include #include #include diff --git a/src/test/app/AMMCalc_test.cpp b/src/test/app/AMMCalc_test.cpp index bc50f02d3d..87a73689dc 100644 --- a/src/test/app/AMMCalc_test.cpp +++ b/src/test/app/AMMCalc_test.cpp @@ -1,8 +1,7 @@ #include -#include - #include +#include #include diff --git a/src/test/app/AMMClawback_test.cpp b/src/test/app/AMMClawback_test.cpp index 65cf7f0a60..bea57c139d 100644 --- a/src/test/app/AMMClawback_test.cpp +++ b/src/test/app/AMMClawback_test.cpp @@ -2,9 +2,8 @@ #include #include -#include - #include +#include namespace xrpl { namespace test { diff --git a/src/test/app/AMMExtended_test.cpp b/src/test/app/AMMExtended_test.cpp index 4eecb05905..421a278fd2 100644 --- a/src/test/app/AMMExtended_test.cpp +++ b/src/test/app/AMMExtended_test.cpp @@ -5,15 +5,15 @@ #include #include -#include -#include #include -#include -#include #include #include #include +#include +#include +#include +#include #include #include diff --git a/src/test/app/AMM_test.cpp b/src/test/app/AMM_test.cpp index 82ea2f6f70..bd6a405750 100644 --- a/src/test/app/AMM_test.cpp +++ b/src/test/app/AMM_test.cpp @@ -6,15 +6,14 @@ #include #include -#include -#include -#include -#include - #include #include #include #include +#include +#include +#include +#include #include diff --git a/src/test/app/AmendmentTable_test.cpp b/src/test/app/AmendmentTable_test.cpp index 1e4b096927..1c2cba15cc 100644 --- a/src/test/app/AmendmentTable_test.cpp +++ b/src/test/app/AmendmentTable_test.cpp @@ -1,13 +1,13 @@ #include #include -#include #include #include #include #include #include +#include #include #include #include diff --git a/src/test/app/Batch_test.cpp b/src/test/app/Batch_test.cpp index a4e00f26db..3df9ba5a5a 100644 --- a/src/test/app/Batch_test.cpp +++ b/src/test/app/Batch_test.cpp @@ -3,8 +3,6 @@ #include #include -#include -#include #include #include @@ -14,6 +12,8 @@ #include #include #include +#include +#include namespace xrpl { namespace test { diff --git a/src/test/app/EscrowToken_test.cpp b/src/test/app/EscrowToken_test.cpp index 1f3b3bab70..86f8f13d90 100644 --- a/src/test/app/EscrowToken_test.cpp +++ b/src/test/app/EscrowToken_test.cpp @@ -1,7 +1,5 @@ #include -#include - #include #include #include @@ -9,6 +7,7 @@ #include #include #include +#include #include #include diff --git a/src/test/app/Escrow_test.cpp b/src/test/app/Escrow_test.cpp index 652049270f..23c123409c 100644 --- a/src/test/app/Escrow_test.cpp +++ b/src/test/app/Escrow_test.cpp @@ -1,12 +1,11 @@ #include -#include - #include #include #include #include #include +#include #include #include diff --git a/src/test/app/FeeVote_test.cpp b/src/test/app/FeeVote_test.cpp index 15dd385d65..177c2a0bbe 100644 --- a/src/test/app/FeeVote_test.cpp +++ b/src/test/app/FeeVote_test.cpp @@ -2,7 +2,6 @@ #include #include -#include #include #include @@ -11,6 +10,7 @@ #include #include #include +#include namespace xrpl { namespace test { diff --git a/src/test/app/FixNFTokenPageLinks_test.cpp b/src/test/app/FixNFTokenPageLinks_test.cpp index 88f368e9cf..c64fdaaced 100644 --- a/src/test/app/FixNFTokenPageLinks_test.cpp +++ b/src/test/app/FixNFTokenPageLinks_test.cpp @@ -1,10 +1,9 @@ #include -#include -#include - #include #include +#include +#include namespace xrpl { diff --git a/src/test/app/Flow_test.cpp b/src/test/app/Flow_test.cpp index 551bd117d8..fb60cd20ad 100644 --- a/src/test/app/Flow_test.cpp +++ b/src/test/app/Flow_test.cpp @@ -1,14 +1,14 @@ #include #include -#include -#include #include #include #include #include #include +#include +#include namespace xrpl { namespace test { diff --git a/src/test/app/Invariants_test.cpp b/src/test/app/Invariants_test.cpp index 7558c951b0..d602d42883 100644 --- a/src/test/app/Invariants_test.cpp +++ b/src/test/app/Invariants_test.cpp @@ -2,9 +2,6 @@ #include #include -#include -#include - #include #include #include @@ -17,6 +14,8 @@ #include #include #include +#include +#include #include diff --git a/src/test/app/LedgerHistory_test.cpp b/src/test/app/LedgerHistory_test.cpp index eeca551f35..ddd9ebfdb4 100644 --- a/src/test/app/LedgerHistory_test.cpp +++ b/src/test/app/LedgerHistory_test.cpp @@ -3,11 +3,11 @@ #include #include -#include #include #include #include +#include #include #include diff --git a/src/test/app/LendingHelpers_test.cpp b/src/test/app/LendingHelpers_test.cpp index 58e4c5aaa4..e06d8ccbd1 100644 --- a/src/test/app/LendingHelpers_test.cpp +++ b/src/test/app/LendingHelpers_test.cpp @@ -5,13 +5,12 @@ #include #include -#include -#include -#include -#include - #include #include +#include +#include +#include +#include #include #include diff --git a/src/test/app/LoadFeeTrack_test.cpp b/src/test/app/LoadFeeTrack_test.cpp index 61174fc9e9..fed76288ef 100644 --- a/src/test/app/LoadFeeTrack_test.cpp +++ b/src/test/app/LoadFeeTrack_test.cpp @@ -1,8 +1,8 @@ -#include #include #include #include +#include namespace xrpl { diff --git a/src/test/app/LoanBroker_test.cpp b/src/test/app/LoanBroker_test.cpp index 58052e3fb1..b480e9535a 100644 --- a/src/test/app/LoanBroker_test.cpp +++ b/src/test/app/LoanBroker_test.cpp @@ -1,8 +1,7 @@ #include -#include - #include +#include namespace xrpl { namespace test { diff --git a/src/test/app/Loan_test.cpp b/src/test/app/Loan_test.cpp index 5deb1f179c..86ae41a2f3 100644 --- a/src/test/app/Loan_test.cpp +++ b/src/test/app/Loan_test.cpp @@ -3,14 +3,12 @@ #include #include -#include -#include -#include -#include - #include #include -// cspell: words LOANTODO +#include +#include +#include +#include #include diff --git a/src/test/app/NFTokenAuth_test.cpp b/src/test/app/NFTokenAuth_test.cpp index 1e7afc9bb0..899aea7cd5 100644 --- a/src/test/app/NFTokenAuth_test.cpp +++ b/src/test/app/NFTokenAuth_test.cpp @@ -1,6 +1,6 @@ #include -#include +#include namespace xrpl { diff --git a/src/test/app/NFTokenBurn_test.cpp b/src/test/app/NFTokenBurn_test.cpp index 915bb6ec79..7d6d07936d 100644 --- a/src/test/app/NFTokenBurn_test.cpp +++ b/src/test/app/NFTokenBurn_test.cpp @@ -1,9 +1,8 @@ #include -#include - #include #include +#include #include diff --git a/src/test/app/NFTokenDir_test.cpp b/src/test/app/NFTokenDir_test.cpp index 65bd97ec32..d6e2dab430 100644 --- a/src/test/app/NFTokenDir_test.cpp +++ b/src/test/app/NFTokenDir_test.cpp @@ -1,10 +1,9 @@ #include -#include - #include #include #include +#include #include diff --git a/src/test/app/NFToken_test.cpp b/src/test/app/NFToken_test.cpp index 1b9ce82d4a..7efbfbbd4c 100644 --- a/src/test/app/NFToken_test.cpp +++ b/src/test/app/NFToken_test.cpp @@ -1,10 +1,9 @@ #include -#include - #include #include #include +#include #include diff --git a/src/test/app/OfferStream_test.cpp b/src/test/app/OfferStream_test.cpp index 218653a5d4..becb190513 100644 --- a/src/test/app/OfferStream_test.cpp +++ b/src/test/app/OfferStream_test.cpp @@ -1,6 +1,5 @@ -#include - #include +#include namespace xrpl { diff --git a/src/test/app/PayStrand_test.cpp b/src/test/app/PayStrand_test.cpp index 9b534d9284..93cc8caf47 100644 --- a/src/test/app/PayStrand_test.cpp +++ b/src/test/app/PayStrand_test.cpp @@ -1,9 +1,6 @@ #include #include -#include -#include -#include #include #include @@ -11,6 +8,9 @@ #include #include #include +#include +#include +#include #include diff --git a/src/test/app/PermissionedDEX_test.cpp b/src/test/app/PermissionedDEX_test.cpp index 7a55866780..2129d2c2c4 100644 --- a/src/test/app/PermissionedDEX_test.cpp +++ b/src/test/app/PermissionedDEX_test.cpp @@ -2,8 +2,6 @@ #include #include -#include - #include #include #include @@ -18,6 +16,7 @@ #include #include #include +#include #include #include diff --git a/src/test/app/PermissionedDomains_test.cpp b/src/test/app/PermissionedDomains_test.cpp index 8485202144..ec969a105c 100644 --- a/src/test/app/PermissionedDomains_test.cpp +++ b/src/test/app/PermissionedDomains_test.cpp @@ -1,9 +1,8 @@ #include -#include - #include #include +#include #include #include diff --git a/src/test/app/PseudoTx_test.cpp b/src/test/app/PseudoTx_test.cpp index 29e13888c3..aa16df8e9c 100644 --- a/src/test/app/PseudoTx_test.cpp +++ b/src/test/app/PseudoTx_test.cpp @@ -1,8 +1,7 @@ #include -#include - #include +#include #include #include diff --git a/src/test/app/Regression_test.cpp b/src/test/app/Regression_test.cpp index 052b334ef5..a4d387dec1 100644 --- a/src/test/app/Regression_test.cpp +++ b/src/test/app/Regression_test.cpp @@ -3,13 +3,13 @@ #include #include -#include #include #include #include #include #include +#include namespace xrpl { namespace test { diff --git a/src/test/app/TheoreticalQuality_test.cpp b/src/test/app/TheoreticalQuality_test.cpp index 1f626ad477..b6b44625cc 100644 --- a/src/test/app/TheoreticalQuality_test.cpp +++ b/src/test/app/TheoreticalQuality_test.cpp @@ -1,16 +1,15 @@ #include #include -#include -#include -#include -#include - #include #include #include #include #include +#include +#include +#include +#include namespace xrpl { namespace test { diff --git a/src/test/app/TxQ_test.cpp b/src/test/app/TxQ_test.cpp index 13feceb74e..44b0c1ca3e 100644 --- a/src/test/app/TxQ_test.cpp +++ b/src/test/app/TxQ_test.cpp @@ -6,13 +6,13 @@ #include #include -#include #include -#include #include #include #include +#include +#include namespace xrpl { diff --git a/src/test/app/tx/apply_test.cpp b/src/test/app/tx/apply_test.cpp index eb684175de..44074baf03 100644 --- a/src/test/app/tx/apply_test.cpp +++ b/src/test/app/tx/apply_test.cpp @@ -2,10 +2,9 @@ #include -#include - #include #include +#include namespace xrpl { diff --git a/src/test/consensus/NegativeUNL_test.cpp b/src/test/consensus/NegativeUNL_test.cpp index 9e77f158a3..b8599744bf 100644 --- a/src/test/consensus/NegativeUNL_test.cpp +++ b/src/test/consensus/NegativeUNL_test.cpp @@ -4,10 +4,10 @@ #include #include #include -#include #include #include +#include namespace xrpl { namespace test { diff --git a/src/test/jtx/impl/AMM.cpp b/src/test/jtx/impl/AMM.cpp index f920858ea5..9049b5400c 100644 --- a/src/test/jtx/impl/AMM.cpp +++ b/src/test/jtx/impl/AMM.cpp @@ -1,13 +1,12 @@ #include #include -#include -#include - #include #include #include #include +#include +#include namespace xrpl { namespace test { diff --git a/src/test/jtx/impl/ledgerStateFixes.cpp b/src/test/jtx/impl/ledgerStateFixes.cpp index f1e6b6eda1..04860a5e3a 100644 --- a/src/test/jtx/impl/ledgerStateFixes.cpp +++ b/src/test/jtx/impl/ledgerStateFixes.cpp @@ -1,9 +1,8 @@ #include -#include - #include #include +#include namespace xrpl { namespace test { diff --git a/src/test/jtx/impl/token.cpp b/src/test/jtx/impl/token.cpp index 172bd75bc7..613e0710d4 100644 --- a/src/test/jtx/impl/token.cpp +++ b/src/test/jtx/impl/token.cpp @@ -1,10 +1,9 @@ #include #include -#include - #include #include +#include namespace xrpl { namespace test { diff --git a/src/test/rpc/AccountObjects_test.cpp b/src/test/rpc/AccountObjects_test.cpp index ab9fcf084e..664e96bbef 100644 --- a/src/test/rpc/AccountObjects_test.cpp +++ b/src/test/rpc/AccountObjects_test.cpp @@ -2,13 +2,12 @@ #include #include -#include - #include #include #include #include #include +#include #include diff --git a/src/test/rpc/AccountSet_test.cpp b/src/test/rpc/AccountSet_test.cpp index 2e238773f9..03fe4e3ede 100644 --- a/src/test/rpc/AccountSet_test.cpp +++ b/src/test/rpc/AccountSet_test.cpp @@ -1,12 +1,11 @@ #include -#include - #include #include #include #include #include +#include namespace xrpl { diff --git a/src/test/rpc/Feature_test.cpp b/src/test/rpc/Feature_test.cpp index c12988816e..c9afb38d3b 100644 --- a/src/test/rpc/Feature_test.cpp +++ b/src/test/rpc/Feature_test.cpp @@ -1,7 +1,6 @@ #include -#include - +#include #include #include diff --git a/src/test/rpc/JSONRPC_test.cpp b/src/test/rpc/JSONRPC_test.cpp index f0329748e1..b82719261b 100644 --- a/src/test/rpc/JSONRPC_test.cpp +++ b/src/test/rpc/JSONRPC_test.cpp @@ -1,7 +1,6 @@ #include #include -#include #include #include #include @@ -10,6 +9,7 @@ #include #include #include +#include namespace xrpl { diff --git a/src/test/rpc/LedgerEntry_test.cpp b/src/test/rpc/LedgerEntry_test.cpp index a66badf54b..68b869cbfc 100644 --- a/src/test/rpc/LedgerEntry_test.cpp +++ b/src/test/rpc/LedgerEntry_test.cpp @@ -5,8 +5,6 @@ #include #include -#include - #include #include #include @@ -15,6 +13,7 @@ #include #include + namespace xrpl { namespace test { diff --git a/src/test/rpc/Subscribe_test.cpp b/src/test/rpc/Subscribe_test.cpp index 99f664f42e..f6c5690856 100644 --- a/src/test/rpc/Subscribe_test.cpp +++ b/src/test/rpc/Subscribe_test.cpp @@ -3,7 +3,6 @@ #include #include -#include #include #include @@ -11,6 +10,7 @@ #include #include #include +#include #include #include diff --git a/src/test/server/ServerStatus_test.cpp b/src/test/server/ServerStatus_test.cpp index 5a91ad4b03..d84b750c87 100644 --- a/src/test/server/ServerStatus_test.cpp +++ b/src/test/server/ServerStatus_test.cpp @@ -4,12 +4,12 @@ #include #include -#include #include #include #include #include +#include #include #include diff --git a/src/xrpld/app/consensus/RCLConsensus.cpp b/src/xrpld/app/consensus/RCLConsensus.cpp index ad581585b1..3ed55a893f 100644 --- a/src/xrpld/app/consensus/RCLConsensus.cpp +++ b/src/xrpld/app/consensus/RCLConsensus.cpp @@ -7,8 +7,6 @@ #include #include #include -#include -#include #include #include #include @@ -21,9 +19,11 @@ #include #include #include +#include #include #include #include +#include #include #include diff --git a/src/xrpld/app/ledger/Ledger.cpp b/src/xrpld/app/ledger/Ledger.cpp index d75e4dd22e..566dce4720 100644 --- a/src/xrpld/app/ledger/Ledger.cpp +++ b/src/xrpld/app/ledger/Ledger.cpp @@ -878,18 +878,12 @@ Ledger::updateSkipList() bool Ledger::isFlagLedger() const { - return header_.seq % FLAG_LEDGER_INTERVAL == 0; + return ::xrpl::isFlagLedger(header_.seq); } bool Ledger::isVotingLedger() const { - return (header_.seq + 1) % FLAG_LEDGER_INTERVAL == 0; -} - -bool -isFlagLedger(LedgerIndex seq) -{ - return seq % FLAG_LEDGER_INTERVAL == 0; + return ::xrpl::isVotingLedger(header_.seq + 1); } static bool diff --git a/src/xrpld/app/ledger/Ledger.h b/src/xrpld/app/ledger/Ledger.h index cbfbc0030f..cfa82074a1 100644 --- a/src/xrpld/app/ledger/Ledger.h +++ b/src/xrpld/app/ledger/Ledger.h @@ -391,11 +391,6 @@ private: /** A ledger wrapped in a CachedView. */ using CachedLedger = CachedView; -std::uint32_t constexpr FLAG_LEDGER_INTERVAL = 256; -/** Returns true if the given ledgerIndex is a flag ledgerIndex */ -bool -isFlagLedger(LedgerIndex seq); - //------------------------------------------------------------------------------ // // API diff --git a/src/xrpld/app/ledger/OrderBookDBImpl.cpp b/src/xrpld/app/ledger/OrderBookDBImpl.cpp index 62c03fb7ca..5c9d46edb1 100644 --- a/src/xrpld/app/ledger/OrderBookDBImpl.cpp +++ b/src/xrpld/app/ledger/OrderBookDBImpl.cpp @@ -1,12 +1,11 @@ #include #include -#include -#include #include #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/ledger/detail/BuildLedger.cpp b/src/xrpld/app/ledger/detail/BuildLedger.cpp index 8321190add..688363c102 100644 --- a/src/xrpld/app/ledger/detail/BuildLedger.cpp +++ b/src/xrpld/app/ledger/detail/BuildLedger.cpp @@ -4,9 +4,9 @@ #include #include #include -#include #include +#include namespace xrpl { diff --git a/src/xrpld/app/ledger/detail/LedgerCleaner.cpp b/src/xrpld/app/ledger/detail/LedgerCleaner.cpp index f54c79f9c0..69ab17ba0e 100644 --- a/src/xrpld/app/ledger/detail/LedgerCleaner.cpp +++ b/src/xrpld/app/ledger/detail/LedgerCleaner.cpp @@ -1,10 +1,10 @@ #include #include #include -#include #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/ledger/detail/LedgerMaster.cpp b/src/xrpld/app/ledger/detail/LedgerMaster.cpp index 5538ebcb96..c6bd3963b4 100644 --- a/src/xrpld/app/ledger/detail/LedgerMaster.cpp +++ b/src/xrpld/app/ledger/detail/LedgerMaster.cpp @@ -5,8 +5,6 @@ #include #include #include -#include -#include #include #include #include @@ -23,12 +21,14 @@ #include #include #include +#include #include #include #include #include #include #include +#include #include #include diff --git a/src/xrpld/app/ledger/detail/OpenLedger.cpp b/src/xrpld/app/ledger/detail/OpenLedger.cpp index d621285619..bc7223f6d9 100644 --- a/src/xrpld/app/ledger/detail/OpenLedger.cpp +++ b/src/xrpld/app/ledger/detail/OpenLedger.cpp @@ -1,13 +1,13 @@ #include #include #include -#include #include #include #include #include #include +#include #include diff --git a/src/xrpld/app/main/Application.cpp b/src/xrpld/app/main/Application.cpp index f53ca9e36b..292ee0b462 100644 --- a/src/xrpld/app/main/Application.cpp +++ b/src/xrpld/app/main/Application.cpp @@ -15,8 +15,6 @@ #include #include #include -#include -#include #include #include #include @@ -25,7 +23,7 @@ #include #include #include -#include +#include #include #include #include @@ -42,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -50,7 +49,9 @@ #include #include #include +#include #include +#include #include #include diff --git a/src/xrpld/app/main/LoadManager.cpp b/src/xrpld/app/main/LoadManager.cpp index 5e3b572e1d..d9da8e5159 100644 --- a/src/xrpld/app/main/LoadManager.cpp +++ b/src/xrpld/app/main/LoadManager.cpp @@ -1,9 +1,9 @@ #include #include -#include #include #include +#include #include #include diff --git a/src/xrpld/app/misc/AmendmentTableImpl.h b/src/xrpld/app/misc/AmendmentTableImpl.h new file mode 100644 index 0000000000..fe7c067d5a --- /dev/null +++ b/src/xrpld/app/misc/AmendmentTableImpl.h @@ -0,0 +1,18 @@ +#pragma once + +#include + +#include + +namespace xrpl { + +std::unique_ptr +make_AmendmentTable( + ServiceRegistry& registry, + std::chrono::seconds majorityTime, + std::vector const& supported, + Section const& enabled, + Section const& vetoed, + beast::Journal journal); + +} // namespace xrpl diff --git a/src/xrpld/app/misc/NetworkOPs.cpp b/src/xrpld/app/misc/NetworkOPs.cpp index 44543e8910..e26a339d94 100644 --- a/src/xrpld/app/misc/NetworkOPs.cpp +++ b/src/xrpld/app/misc/NetworkOPs.cpp @@ -10,9 +10,7 @@ #include #include #include -#include #include -#include #include #include #include @@ -20,9 +18,9 @@ #include #include #include -#include #include #include +#include #include #include #include @@ -42,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -52,6 +51,8 @@ #include #include #include +#include +#include #include #include diff --git a/src/xrpld/app/misc/TxQ.h b/src/xrpld/app/misc/TxQ.h index b50ff1a0b5..a779741223 100644 --- a/src/xrpld/app/misc/TxQ.h +++ b/src/xrpld/app/misc/TxQ.h @@ -1,13 +1,12 @@ #pragma once -#include - #include #include #include #include #include #include +#include #include #include diff --git a/src/xrpld/app/misc/detail/AmendmentTable.cpp b/src/xrpld/app/misc/detail/AmendmentTable.cpp index 767a3d87f9..f7d662368e 100644 --- a/src/xrpld/app/misc/detail/AmendmentTable.cpp +++ b/src/xrpld/app/misc/detail/AmendmentTable.cpp @@ -1,7 +1,5 @@ -#include -#include - #include +#include #include #include #include diff --git a/src/xrpld/app/misc/detail/Transaction.cpp b/src/xrpld/app/misc/detail/Transaction.cpp index d45c49c3c4..04fb762ef2 100644 --- a/src/xrpld/app/misc/detail/Transaction.cpp +++ b/src/xrpld/app/misc/detail/Transaction.cpp @@ -1,7 +1,6 @@ #include #include #include -#include #include #include @@ -9,6 +8,7 @@ #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/misc/detail/TxQ.cpp b/src/xrpld/app/misc/detail/TxQ.cpp index 61741b73f0..e109e16834 100644 --- a/src/xrpld/app/misc/detail/TxQ.cpp +++ b/src/xrpld/app/misc/detail/TxQ.cpp @@ -1,12 +1,12 @@ #include #include #include -#include #include #include #include #include +#include #include #include diff --git a/src/xrpld/app/paths/AMMLiquidity.h b/src/xrpld/app/paths/AMMLiquidity.h index 441c3b6e3d..5c3ff2a8e6 100644 --- a/src/xrpld/app/paths/AMMLiquidity.h +++ b/src/xrpld/app/paths/AMMLiquidity.h @@ -1,13 +1,12 @@ #pragma once -#include -#include -#include - #include #include #include #include +#include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/paths/PathRequest.cpp b/src/xrpld/app/paths/PathRequest.cpp index 53a4e03752..02f2f1313b 100644 --- a/src/xrpld/app/paths/PathRequest.cpp +++ b/src/xrpld/app/paths/PathRequest.cpp @@ -1,9 +1,7 @@ #include -#include #include #include #include -#include #include #include #include @@ -13,7 +11,9 @@ #include #include #include +#include #include +#include #include #include diff --git a/src/xrpld/app/paths/Pathfinder.cpp b/src/xrpld/app/paths/Pathfinder.cpp index ea4fa2013a..980803f305 100644 --- a/src/xrpld/app/paths/Pathfinder.cpp +++ b/src/xrpld/app/paths/Pathfinder.cpp @@ -1,6 +1,5 @@ #include #include -#include #include #include @@ -10,6 +9,7 @@ #include #include #include +#include #include diff --git a/src/xrpld/app/paths/detail/BookStep.cpp b/src/xrpld/app/paths/detail/BookStep.cpp index b9c8aa4e67..a3c559940f 100644 --- a/src/xrpld/app/paths/detail/BookStep.cpp +++ b/src/xrpld/app/paths/detail/BookStep.cpp @@ -1,9 +1,5 @@ -#include #include #include -#include -#include -#include #include #include @@ -14,6 +10,10 @@ #include #include #include +#include +#include +#include +#include #include diff --git a/src/xrpld/app/paths/detail/DirectStep.cpp b/src/xrpld/app/paths/detail/DirectStep.cpp index 806204bae2..e4617708fc 100644 --- a/src/xrpld/app/paths/detail/DirectStep.cpp +++ b/src/xrpld/app/paths/detail/DirectStep.cpp @@ -1,5 +1,4 @@ #include -#include #include #include @@ -7,6 +6,7 @@ #include #include #include +#include #include diff --git a/src/xrpld/app/paths/detail/PaySteps.cpp b/src/xrpld/app/paths/detail/PaySteps.cpp index e891fb6321..6f8d1e93ac 100644 --- a/src/xrpld/app/paths/detail/PaySteps.cpp +++ b/src/xrpld/app/paths/detail/PaySteps.cpp @@ -1,10 +1,9 @@ -#include - #include #include #include #include #include +#include #include diff --git a/src/xrpld/app/paths/detail/XRPEndpointStep.cpp b/src/xrpld/app/paths/detail/XRPEndpointStep.cpp index 60f95a9b0b..1f1b908e64 100644 --- a/src/xrpld/app/paths/detail/XRPEndpointStep.cpp +++ b/src/xrpld/app/paths/detail/XRPEndpointStep.cpp @@ -1,6 +1,4 @@ -#include #include -#include #include #include @@ -9,6 +7,8 @@ #include #include #include +#include +#include #include diff --git a/src/xrpld/overlay/detail/PeerImp.cpp b/src/xrpld/overlay/detail/PeerImp.cpp index ca7364c756..91d64e26d4 100644 --- a/src/xrpld/overlay/detail/PeerImp.cpp +++ b/src/xrpld/overlay/detail/PeerImp.cpp @@ -3,10 +3,8 @@ #include #include #include -#include #include #include -#include #include #include #include @@ -19,7 +17,9 @@ #include #include #include +#include #include +#include #include #include diff --git a/src/xrpld/rpc/detail/LegacyPathFind.cpp b/src/xrpld/rpc/detail/LegacyPathFind.cpp index 9d9b7e138c..b0fa07d676 100644 --- a/src/xrpld/rpc/detail/LegacyPathFind.cpp +++ b/src/xrpld/rpc/detail/LegacyPathFind.cpp @@ -1,10 +1,10 @@ #include -#include #include #include #include #include +#include namespace xrpl { namespace RPC { diff --git a/src/xrpld/rpc/detail/RPCHelpers.cpp b/src/xrpld/rpc/detail/RPCHelpers.cpp index 4a0339b763..3edc7de97e 100644 --- a/src/xrpld/rpc/detail/RPCHelpers.cpp +++ b/src/xrpld/rpc/detail/RPCHelpers.cpp @@ -1,6 +1,5 @@ #include #include -#include #include #include #include @@ -11,6 +10,7 @@ #include #include #include +#include #include #include diff --git a/src/xrpld/rpc/detail/TransactionSign.cpp b/src/xrpld/rpc/detail/TransactionSign.cpp index 6f7d80b2a6..123123f36b 100644 --- a/src/xrpld/rpc/detail/TransactionSign.cpp +++ b/src/xrpld/rpc/detail/TransactionSign.cpp @@ -4,8 +4,6 @@ #include #include #include -#include // Validity::Valid -#include #include #include #include @@ -20,6 +18,8 @@ #include #include #include +#include // Validity::Valid +#include #include #include diff --git a/src/xrpld/rpc/detail/TransactionSign.h b/src/xrpld/rpc/detail/TransactionSign.h index 8d064d65d5..a12f60617d 100644 --- a/src/xrpld/rpc/detail/TransactionSign.h +++ b/src/xrpld/rpc/detail/TransactionSign.h @@ -1,9 +1,9 @@ #pragma once -#include #include #include +#include #include namespace xrpl { diff --git a/src/xrpld/rpc/handlers/AMMInfo.cpp b/src/xrpld/rpc/handlers/AMMInfo.cpp index 74e6f8944d..e4234096ee 100644 --- a/src/xrpld/rpc/handlers/AMMInfo.cpp +++ b/src/xrpld/rpc/handlers/AMMInfo.cpp @@ -1,5 +1,4 @@ #include -#include #include #include @@ -7,6 +6,7 @@ #include #include #include +#include #include diff --git a/src/xrpld/rpc/handlers/AccountObjects.cpp b/src/xrpld/rpc/handlers/AccountObjects.cpp index d9906efd70..7ef30255bc 100644 --- a/src/xrpld/rpc/handlers/AccountObjects.cpp +++ b/src/xrpld/rpc/handlers/AccountObjects.cpp @@ -1,4 +1,3 @@ -#include #include #include #include @@ -12,6 +11,7 @@ #include #include #include +#include #include diff --git a/src/xrpld/rpc/handlers/Feature1.cpp b/src/xrpld/rpc/handlers/Feature1.cpp index 6f9d440185..bd1e501506 100644 --- a/src/xrpld/rpc/handlers/Feature1.cpp +++ b/src/xrpld/rpc/handlers/Feature1.cpp @@ -1,8 +1,8 @@ #include #include -#include #include +#include #include #include #include diff --git a/src/xrpld/rpc/handlers/LedgerHandler.cpp b/src/xrpld/rpc/handlers/LedgerHandler.cpp index 343d21e3f5..d0572f42b2 100644 --- a/src/xrpld/rpc/handlers/LedgerHandler.cpp +++ b/src/xrpld/rpc/handlers/LedgerHandler.cpp @@ -1,6 +1,5 @@ #include #include -#include #include #include #include @@ -9,6 +8,7 @@ #include #include #include +#include namespace xrpl { namespace RPC { diff --git a/src/xrpld/rpc/handlers/NoRippleCheck.cpp b/src/xrpld/rpc/handlers/NoRippleCheck.cpp index 23ce82ef72..61e3bd61bd 100644 --- a/src/xrpld/rpc/handlers/NoRippleCheck.cpp +++ b/src/xrpld/rpc/handlers/NoRippleCheck.cpp @@ -1,5 +1,4 @@ #include -#include #include #include #include @@ -11,6 +10,7 @@ #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/rpc/handlers/Peers.cpp b/src/xrpld/rpc/handlers/Peers.cpp index 5232070b2b..b343c4050b 100644 --- a/src/xrpld/rpc/handlers/Peers.cpp +++ b/src/xrpld/rpc/handlers/Peers.cpp @@ -1,5 +1,4 @@ #include -#include #include #include #include @@ -7,6 +6,7 @@ #include #include +#include namespace xrpl { diff --git a/src/xrpld/rpc/handlers/Simulate.cpp b/src/xrpld/rpc/handlers/Simulate.cpp index 120dbfa2e5..c35322a35e 100644 --- a/src/xrpld/rpc/handlers/Simulate.cpp +++ b/src/xrpld/rpc/handlers/Simulate.cpp @@ -2,7 +2,6 @@ #include #include #include -#include #include #include #include @@ -16,6 +15,7 @@ #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/rpc/handlers/Submit.cpp b/src/xrpld/rpc/handlers/Submit.cpp index 5b29d35f50..2911d0ca45 100644 --- a/src/xrpld/rpc/handlers/Submit.cpp +++ b/src/xrpld/rpc/handlers/Submit.cpp @@ -1,12 +1,12 @@ #include #include -#include #include #include #include #include #include +#include namespace xrpl { From aa3c4fbcc4503170c7aaa342438cd46ea29031e9 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Wed, 18 Feb 2026 15:42:54 +0000 Subject: [PATCH 61/61] Apply suggestion from @pratikmankawde --- sanitizers/suppressions/asan.supp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sanitizers/suppressions/asan.supp b/sanitizers/suppressions/asan.supp index 256c77f32b..ddea8d2c02 100644 --- a/sanitizers/suppressions/asan.supp +++ b/sanitizers/suppressions/asan.supp @@ -14,4 +14,4 @@ interceptor_name:clock_gettime interceptor_name:__bzero interceptor_name:nudb -interceptor_name:coro # Suppress any flackiness +interceptor_name:boost # Suppress any flackiness