From e364dbde58adf2fec421a80fc8fd9b83ab6ef944 Mon Sep 17 00:00:00 2001 From: John Freeman Date: Fri, 29 Mar 2024 12:49:55 -0500 Subject: [PATCH 1/7] Enforce levelization with CMake Define each "module" of libxrpl as a separate OBJECT library in CMake. Link each one only to modules of a lower level. Then link all of them into libxrpl itself. --- Builds/levelization/results/loops.txt | 3 - Builds/levelization/results/ordering.txt | 2 +- cmake/RippledCore.cmake | 63 ++++++++++++++ cmake/RippledInstall.cmake | 8 ++ cmake/add_module.cmake | 37 +++++++++ cmake/isolate_headers.cmake | 46 +++++++++++ cmake/target_link_modules.cmake | 24 ++++++ include/xrpl/basics/Number.h | 10 +-- include/xrpl/basics/SHAMapHash.h | 8 ++ include/xrpl/basics/base_uint.h | 12 +++ .../xrpl/basics/partitioned_unordered_map.h | 19 ++++- include/xrpl/protocol/AmountConversions.h | 2 +- include/xrpl/{basics => protocol}/FeeUnits.h | 14 +++- include/xrpl/protocol/Fees.h | 2 +- include/xrpl/protocol/LedgerHeader.h | 2 +- include/xrpl/protocol/PayChan.h | 2 +- include/xrpl/protocol/Protocol.h | 1 + include/xrpl/protocol/Quality.h | 2 +- include/xrpl/protocol/STAmount.h | 2 +- include/xrpl/protocol/STObject.h | 2 +- include/xrpl/protocol/STValidation.h | 2 +- include/xrpl/protocol/SystemParameters.h | 2 +- include/xrpl/{basics => protocol}/XRPAmount.h | 21 +++-- src/libxrpl/basics/Number.cpp | 5 -- .../basics/partitioned_unordered_map.cpp | 82 ------------------- src/test/basics/FeeUnits_test.cpp | 2 +- src/test/basics/XRPAmount_test.cpp | 2 +- src/test/jtx/amount.h | 2 +- src/xrpld/app/misc/LoadFeeTrack.h | 3 +- src/xrpld/app/misc/detail/LoadFeeTrack.cpp | 2 +- src/xrpld/app/paths/Flow.cpp | 2 +- src/xrpld/app/paths/detail/AmountSpec.h | 2 +- src/xrpld/app/paths/detail/BookStep.cpp | 2 +- src/xrpld/app/paths/detail/FlowDebugInfo.h | 2 +- src/xrpld/app/paths/detail/PaySteps.cpp | 2 +- src/xrpld/app/paths/detail/StrandFlow.h | 2 +- .../app/paths/detail/XRPEndpointStep.cpp | 2 +- src/xrpld/app/tx/detail/ApplyContext.h | 2 +- src/xrpld/app/tx/detail/DeleteAccount.cpp | 2 +- src/xrpld/app/tx/detail/Escrow.cpp | 2 +- src/xrpld/app/tx/detail/InvariantCheck.cpp | 2 +- src/xrpld/app/tx/detail/PayChan.cpp | 2 +- src/xrpld/app/tx/detail/Transactor.h | 2 +- src/xrpld/app/tx/detail/XChainBridge.cpp | 2 +- src/xrpld/core/Config.h | 2 +- src/xrpld/ledger/OpenView.h | 2 +- src/xrpld/ledger/ReadView.h | 4 +- src/xrpld/ledger/detail/ApplyStateTable.h | 2 +- src/xrpld/ledger/detail/ApplyViewBase.h | 2 +- 49 files changed, 275 insertions(+), 149 deletions(-) create mode 100644 cmake/add_module.cmake create mode 100644 cmake/isolate_headers.cmake create mode 100644 cmake/target_link_modules.cmake rename include/xrpl/{basics => protocol}/FeeUnits.h (98%) rename include/xrpl/{basics => protocol}/XRPAmount.h (96%) delete mode 100644 src/libxrpl/basics/partitioned_unordered_map.cpp diff --git a/Builds/levelization/results/loops.txt b/Builds/levelization/results/loops.txt index f703a3a9d5d..61d289892d9 100644 --- a/Builds/levelization/results/loops.txt +++ b/Builds/levelization/results/loops.txt @@ -4,9 +4,6 @@ Loop: test.jtx test.toplevel Loop: test.jtx test.unit_test test.unit_test == test.jtx -Loop: xrpl.basics xrpl.json - xrpl.json ~= xrpl.basics - Loop: xrpld.app xrpld.core xrpld.app > xrpld.core diff --git a/Builds/levelization/results/ordering.txt b/Builds/levelization/results/ordering.txt index 2856d783a1f..57e40da4d2d 100644 --- a/Builds/levelization/results/ordering.txt +++ b/Builds/levelization/results/ordering.txt @@ -1,5 +1,4 @@ libxrpl.basics > xrpl.basics -libxrpl.basics > xrpl.protocol libxrpl.crypto > xrpl.basics libxrpl.json > xrpl.basics libxrpl.json > xrpl.json @@ -130,6 +129,7 @@ test.shamap > xrpl.protocol test.toplevel > test.csf test.toplevel > xrpl.json test.unit_test > xrpl.basics +xrpl.json > xrpl.basics xrpl.protocol > xrpl.basics xrpl.protocol > xrpl.json xrpl.resource > xrpl.basics diff --git a/cmake/RippledCore.cmake b/cmake/RippledCore.cmake index 18a424c484b..8f6e8a99bd2 100644 --- a/cmake/RippledCore.cmake +++ b/cmake/RippledCore.cmake @@ -47,6 +47,57 @@ target_link_libraries(xrpl.libpb gRPC::grpc++ ) +# TODO: Clean up the number of library targets later. +add_library(xrpl.imports.main INTERFACE) +target_link_libraries(xrpl.imports.main INTERFACE + LibArchive::LibArchive + OpenSSL::Crypto + Ripple::boost + Ripple::opts + Ripple::syslibs + absl::random_random + date::date + ed25519::ed25519 + secp256k1::secp256k1 + xxHash::xxhash +) + +include(add_module) +include(target_link_modules) + +# Level 01 +add_module(xrpl beast) +target_link_libraries(xrpl.libxrpl.beast PUBLIC + xrpl.imports.main + xrpl.libpb +) + +# Level 02 +add_module(xrpl basics) +target_link_libraries(xrpl.libxrpl.basics PUBLIC xrpl.libxrpl.beast) + +# Level 03 +add_module(xrpl json) +target_link_libraries(xrpl.libxrpl.json PUBLIC xrpl.libxrpl.basics) + +add_module(xrpl crypto) +target_link_libraries(xrpl.libxrpl.crypto PUBLIC xrpl.libxrpl.basics) + +# Level 04 +add_module(xrpl protocol) +target_link_libraries(xrpl.libxrpl.protocol PUBLIC + xrpl.libxrpl.crypto + xrpl.libxrpl.json +) + +# Level 05 +add_module(xrpl resource) +target_link_libraries(xrpl.libxrpl.resource PUBLIC xrpl.libxrpl.protocol) + +add_module(xrpl server) +target_link_libraries(xrpl.libxrpl.server PUBLIC xrpl.libxrpl.protocol) + + add_library(xrpl.libxrpl) set_target_properties(xrpl.libxrpl PROPERTIES OUTPUT_NAME xrpl) if(unity) @@ -60,7 +111,19 @@ file(GLOB_RECURSE sources CONFIGURE_DEPENDS ) target_sources(xrpl.libxrpl PRIVATE ${sources}) +target_link_modules(xrpl PUBLIC + basics + beast + crypto + json + protocol + resource + server +) + target_include_directories(xrpl.libxrpl + PRIVATE + $ PUBLIC $ $) diff --git a/cmake/RippledInstall.cmake b/cmake/RippledInstall.cmake index 3199c9a19b8..3a41aab8368 100644 --- a/cmake/RippledInstall.cmake +++ b/cmake/RippledInstall.cmake @@ -8,7 +8,15 @@ install ( opts ripple_syslibs ripple_boost + xrpl.imports.main xrpl.libpb + xrpl.libxrpl.basics + xrpl.libxrpl.beast + xrpl.libxrpl.crypto + xrpl.libxrpl.json + xrpl.libxrpl.protocol + xrpl.libxrpl.resource + xrpl.libxrpl.server xrpl.libxrpl EXPORT RippleExports LIBRARY DESTINATION lib diff --git a/cmake/add_module.cmake b/cmake/add_module.cmake new file mode 100644 index 00000000000..bcfce1bf600 --- /dev/null +++ b/cmake/add_module.cmake @@ -0,0 +1,37 @@ +include(isolate_headers) + +# Create an OBJECT library target named +# +# ${PROJECT_NAME}.lib${parent}.${name} +# +# with sources in src/lib${parent}/${name} +# and headers in include/${parent}/${name} +# that cannot include headers from other directories in include/ +# unless they come through linked libraries. +# +# add_module(parent a) +# add_module(parent b) +# target_link_libraries(project.libparent.b PUBLIC project.libparent.a) +function(add_module parent name) + set(target ${PROJECT_NAME}.lib${parent}.${name}) + add_library(${target} OBJECT) + file(GLOB_RECURSE sources CONFIGURE_DEPENDS + "${CMAKE_CURRENT_SOURCE_DIR}/src/lib${parent}/${name}/*.cpp" + ) + target_sources(${target} PRIVATE ${sources}) + target_include_directories(${target} PUBLIC + "$" + ) + isolate_headers( + ${target} + "${CMAKE_CURRENT_SOURCE_DIR}/include" + "${CMAKE_CURRENT_SOURCE_DIR}/include/${parent}/${name}" + PUBLIC + ) + isolate_headers( + ${target} + "${CMAKE_CURRENT_SOURCE_DIR}/src" + "${CMAKE_CURRENT_SOURCE_DIR}/src/lib${parent}/${name}" + PRIVATE + ) +endfunction() diff --git a/cmake/isolate_headers.cmake b/cmake/isolate_headers.cmake new file mode 100644 index 00000000000..61fc5105cac --- /dev/null +++ b/cmake/isolate_headers.cmake @@ -0,0 +1,46 @@ +# Consider include directory B nested under prefix A: +# +# /path/to/A/then/to/B/... +# +# Call C the relative path from A to B. +# C is what we want to write in `#include` directives: +# +# #include +# +# Examples, all from the `jobqueue` module: +# +# - Library public headers: +# B = /include/xrpl/jobqueue +# A = /include/ +# C = xrpl/jobqueue +# +# - Library private headers: +# B = /src/libxrpl/jobqueue +# A = /src/ +# C = libxrpl/jobqueue +# +# - Test private headers: +# B = /tests/jobqueue +# A = / +# C = tests/jobqueue +# +# To isolate headers from each other, +# we want to create a symlink Y that points to B, +# within a subdirectory X of the `CMAKE_BINARY_DIR`, +# that has the same relative path C between X and Y, +# and then add X as an include directory of the target, +# sometimes `PUBLIC` and sometimes `PRIVATE`. +# The Cs are all guaranteed to be unique. +# We can guarantee a unique X per target by using +# `${CMAKE_CURRENT_BINARY_DIR}/include/${target}`. +# +# isolate_headers(target A B scope) +function(isolate_headers target A B scope) + file(RELATIVE_PATH C "${A}" "${B}") + set(X "${CMAKE_CURRENT_BINARY_DIR}/include/${target}") + set(Y "${X}/${C}") + cmake_path(GET Y PARENT_PATH parent) + file(MAKE_DIRECTORY "${parent}") + file(CREATE_LINK "${B}" "${Y}" SYMBOLIC) + target_include_directories(${target} ${scope} "$") +endfunction() diff --git a/cmake/target_link_modules.cmake b/cmake/target_link_modules.cmake new file mode 100644 index 00000000000..acbf67903a1 --- /dev/null +++ b/cmake/target_link_modules.cmake @@ -0,0 +1,24 @@ +# Link a library to its modules (see: `add_module`) +# and remove the module sources from the library's sources. +# +# add_module(parent a) +# add_module(parent b) +# target_link_libraries(project.libparent.b PUBLIC project.libparent.a) +# add_library(project.libparent) +# target_link_modules(parent PUBLIC a b) +function(target_link_modules parent scope) + set(library ${PROJECT_NAME}.lib${parent}) + foreach(name ${ARGN}) + set(module ${library}.${name}) + get_target_property(sources ${library} SOURCES) + list(LENGTH sources before) + get_target_property(dupes ${module} SOURCES) + list(LENGTH dupes expected) + list(REMOVE_ITEM sources ${dupes}) + list(LENGTH sources after) + math(EXPR actual "${before} - ${after}") + message(STATUS "${module} with ${expected} sources took ${actual} sources from ${library}") + set_target_properties(${library} PROPERTIES SOURCES "${sources}") + target_link_libraries(${library} ${scope} ${module}) + endforeach() +endfunction() diff --git a/include/xrpl/basics/Number.h b/include/xrpl/basics/Number.h index 30ce3f73173..de20dc490ae 100644 --- a/include/xrpl/basics/Number.h +++ b/include/xrpl/basics/Number.h @@ -20,7 +20,6 @@ #ifndef RIPPLE_BASICS_NUMBER_H_INCLUDED #define RIPPLE_BASICS_NUMBER_H_INCLUDED -#include #include #include #include @@ -51,8 +50,6 @@ class Number explicit Number(rep mantissa, int exponent); explicit constexpr Number(rep mantissa, int exponent, unchecked) noexcept; - Number(XRPAmount const& x); - constexpr rep mantissa() const noexcept; constexpr int @@ -88,8 +85,7 @@ class Number static constexpr Number lowest() noexcept; - explicit operator XRPAmount() const; // round to nearest, even on tie - explicit operator rep() const; // round to nearest, even on tie + explicit operator rep() const; // round to nearest, even on tie friend constexpr bool operator==(Number const& x, Number const& y) noexcept @@ -206,10 +202,6 @@ inline Number::Number(rep mantissa) : Number{mantissa, 0} { } -inline Number::Number(XRPAmount const& x) : Number{x.drops()} -{ -} - inline constexpr Number::rep Number::mantissa() const noexcept { diff --git a/include/xrpl/basics/SHAMapHash.h b/include/xrpl/basics/SHAMapHash.h index 7e93ead78d3..2d2dcdc3efa 100644 --- a/include/xrpl/basics/SHAMapHash.h +++ b/include/xrpl/basics/SHAMapHash.h @@ -21,6 +21,7 @@ #define RIPPLE_BASICS_SHAMAP_HASH_H_INCLUDED #include +#include #include @@ -108,6 +109,13 @@ operator!=(SHAMapHash const& x, SHAMapHash const& y) return !(x == y); } +template <> +inline std::size_t +extract(SHAMapHash const& key) +{ + return *reinterpret_cast(key.as_uint256().data()); +} + } // namespace ripple #endif // RIPPLE_BASICS_SHAMAP_HASH_H_INCLUDED diff --git a/include/xrpl/basics/base_uint.h b/include/xrpl/basics/base_uint.h index 2b44d3072ee..9c58c959d02 100644 --- a/include/xrpl/basics/base_uint.h +++ b/include/xrpl/basics/base_uint.h @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -630,6 +631,17 @@ operator<<(std::ostream& out, base_uint const& u) return out << to_string(u); } +template <> +inline std::size_t +extract(uint256 const& key) +{ + std::size_t result; + // Use memcpy to avoid unaligned UB + // (will optimize to equivalent code) + std::memcpy(&result, key.data(), sizeof(std::size_t)); + return result; +} + #ifndef __INTELLISENSE__ static_assert(sizeof(uint128) == 128 / 8, "There should be no padding bytes"); static_assert(sizeof(uint160) == 160 / 8, "There should be no padding bytes"); diff --git a/include/xrpl/basics/partitioned_unordered_map.h b/include/xrpl/basics/partitioned_unordered_map.h index 08f4cba9d3e..6e8ada156fe 100644 --- a/include/xrpl/basics/partitioned_unordered_map.h +++ b/include/xrpl/basics/partitioned_unordered_map.h @@ -20,9 +20,12 @@ #ifndef RIPPLE_BASICS_PARTITIONED_UNORDERED_MAP_H #define RIPPLE_BASICS_PARTITIONED_UNORDERED_MAP_H +#include + #include #include #include +#include #include #include #include @@ -31,8 +34,18 @@ namespace ripple { template -std::size_t -partitioner(Key const& key, std::size_t const numPartitions); +static std::size_t +extract(Key const& key) +{ + return key; +} + +template <> +inline std::size_t +extract(std::string const& key) +{ + return ::beast::uhash<>{}(key); +} template < typename Key, @@ -211,7 +224,7 @@ class partitioned_unordered_map std::size_t partitioner(Key const& key) const { - return ripple::partitioner(key, partitions_); + return extract(key) % partitions_; } template diff --git a/include/xrpl/protocol/AmountConversions.h b/include/xrpl/protocol/AmountConversions.h index 0348e3c975d..c09218aa2eb 100644 --- a/include/xrpl/protocol/AmountConversions.h +++ b/include/xrpl/protocol/AmountConversions.h @@ -21,8 +21,8 @@ #define RIPPLE_PROTOCOL_AMOUNTCONVERSION_H_INCLUDED #include -#include #include +#include #include diff --git a/include/xrpl/basics/FeeUnits.h b/include/xrpl/protocol/FeeUnits.h similarity index 98% rename from include/xrpl/basics/FeeUnits.h rename to include/xrpl/protocol/FeeUnits.h index 9d5e6e216a4..265a58d4ae9 100644 --- a/include/xrpl/basics/FeeUnits.h +++ b/include/xrpl/protocol/FeeUnits.h @@ -19,22 +19,30 @@ #ifndef BASICS_FEES_H_INCLUDED #define BASICS_FEES_H_INCLUDED -#include +#include +#include +#include + #include -#include -#include +#include #include #include #include #include +#include +#include #include #include +#include namespace ripple { namespace feeunit { +/** "drops" are the smallest divisible amount of XRP. This is what most + of the code uses. */ +struct dropTag; /** "fee units" calculations are a not-really-unitless value that is used to express the cost of a given transaction vs. a reference transaction. They are primarily used by the Transactor classes. */ diff --git a/include/xrpl/protocol/Fees.h b/include/xrpl/protocol/Fees.h index 7b4671a91d9..4393f1a1d9c 100644 --- a/include/xrpl/protocol/Fees.h +++ b/include/xrpl/protocol/Fees.h @@ -20,7 +20,7 @@ #ifndef RIPPLE_PROTOCOL_FEES_H_INCLUDED #define RIPPLE_PROTOCOL_FEES_H_INCLUDED -#include +#include namespace ripple { diff --git a/include/xrpl/protocol/LedgerHeader.h b/include/xrpl/protocol/LedgerHeader.h index 663eb709be2..0b35979971a 100644 --- a/include/xrpl/protocol/LedgerHeader.h +++ b/include/xrpl/protocol/LedgerHeader.h @@ -21,11 +21,11 @@ #define RIPPLE_PROTOCOL_LEDGERHEADER_H_INCLUDED #include -#include #include #include #include #include +#include namespace ripple { diff --git a/include/xrpl/protocol/PayChan.h b/include/xrpl/protocol/PayChan.h index 8344120ccd6..b552b591af2 100644 --- a/include/xrpl/protocol/PayChan.h +++ b/include/xrpl/protocol/PayChan.h @@ -20,10 +20,10 @@ #ifndef RIPPLE_PROTOCOL_PAYCHAN_H_INCLUDED #define RIPPLE_PROTOCOL_PAYCHAN_H_INCLUDED -#include #include #include #include +#include namespace ripple { diff --git a/include/xrpl/protocol/Protocol.h b/include/xrpl/protocol/Protocol.h index 8d8a71dfef8..5aa14d2931b 100644 --- a/include/xrpl/protocol/Protocol.h +++ b/include/xrpl/protocol/Protocol.h @@ -22,6 +22,7 @@ #include #include +#include #include namespace ripple { diff --git a/include/xrpl/protocol/Quality.h b/include/xrpl/protocol/Quality.h index 1ee2cc9f686..12cdb77845e 100644 --- a/include/xrpl/protocol/Quality.h +++ b/include/xrpl/protocol/Quality.h @@ -21,9 +21,9 @@ #define RIPPLE_PROTOCOL_QUALITY_H_INCLUDED #include -#include #include #include +#include #include #include diff --git a/include/xrpl/protocol/STAmount.h b/include/xrpl/protocol/STAmount.h index 3eed0860f54..84e57ac40a2 100644 --- a/include/xrpl/protocol/STAmount.h +++ b/include/xrpl/protocol/STAmount.h @@ -24,11 +24,11 @@ #include #include #include -#include #include #include #include #include +#include #include namespace ripple { diff --git a/include/xrpl/protocol/STObject.h b/include/xrpl/protocol/STObject.h index b3cef83de5f..5e26ff2f465 100644 --- a/include/xrpl/protocol/STObject.h +++ b/include/xrpl/protocol/STObject.h @@ -21,10 +21,10 @@ #define RIPPLE_PROTOCOL_STOBJECT_H_INCLUDED #include -#include #include #include #include +#include #include #include #include diff --git a/include/xrpl/protocol/STValidation.h b/include/xrpl/protocol/STValidation.h index 6cae0971f51..4183021fc32 100644 --- a/include/xrpl/protocol/STValidation.h +++ b/include/xrpl/protocol/STValidation.h @@ -20,8 +20,8 @@ #ifndef RIPPLE_PROTOCOL_STVALIDATION_H_INCLUDED #define RIPPLE_PROTOCOL_STVALIDATION_H_INCLUDED -#include #include +#include #include #include #include diff --git a/include/xrpl/protocol/SystemParameters.h b/include/xrpl/protocol/SystemParameters.h index 7531a0d5fb9..af492340545 100644 --- a/include/xrpl/protocol/SystemParameters.h +++ b/include/xrpl/protocol/SystemParameters.h @@ -20,8 +20,8 @@ #ifndef RIPPLE_PROTOCOL_SYSTEMPARAMETERS_H_INCLUDED #define RIPPLE_PROTOCOL_SYSTEMPARAMETERS_H_INCLUDED -#include #include +#include #include #include diff --git a/include/xrpl/basics/XRPAmount.h b/include/xrpl/protocol/XRPAmount.h similarity index 96% rename from include/xrpl/basics/XRPAmount.h rename to include/xrpl/protocol/XRPAmount.h index 1d3b32f169b..6f8c7854087 100644 --- a/include/xrpl/basics/XRPAmount.h +++ b/include/xrpl/protocol/XRPAmount.h @@ -20,10 +20,11 @@ #ifndef RIPPLE_BASICS_XRPAMOUNT_H_INCLUDED #define RIPPLE_BASICS_XRPAMOUNT_H_INCLUDED +#include #include -#include #include #include +#include #include #include @@ -35,14 +36,6 @@ namespace ripple { -namespace feeunit { - -/** "drops" are the smallest divisible amount of XRP. This is what most - of the code uses. */ -struct dropTag; - -} // namespace feeunit - class XRPAmount : private boost::totally_ordered, private boost::additive, private boost::equality_comparable, @@ -61,6 +54,11 @@ class XRPAmount : private boost::totally_ordered, constexpr XRPAmount& operator=(XRPAmount const& other) = default; + explicit XRPAmount(Number const& x) + : XRPAmount(static_cast(x)) + { + } + constexpr XRPAmount(beast::Zero) : drops_(0) { } @@ -160,6 +158,11 @@ class XRPAmount : private boost::totally_ordered, return drops_ != 0; } + operator Number() const noexcept + { + return drops(); + } + /** Return the sign of the amount */ constexpr int signum() const noexcept diff --git a/src/libxrpl/basics/Number.cpp b/src/libxrpl/basics/Number.cpp index 14260b653a2..e24f224bf45 100644 --- a/src/libxrpl/basics/Number.cpp +++ b/src/libxrpl/basics/Number.cpp @@ -499,11 +499,6 @@ Number::operator rep() const return drops; } -Number::operator XRPAmount() const -{ - return XRPAmount{static_cast(*this)}; -} - std::string to_string(Number const& amount) { diff --git a/src/libxrpl/basics/partitioned_unordered_map.cpp b/src/libxrpl/basics/partitioned_unordered_map.cpp deleted file mode 100644 index a6d02cd2c6f..00000000000 --- a/src/libxrpl/basics/partitioned_unordered_map.cpp +++ /dev/null @@ -1,82 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of rippled: https://github.com/ripple/rippled - Copyright (c) 2021 Ripple Labs Inc. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - -#include - -#include -#include -#include -#include -#include -#include - -namespace ripple { - -static std::size_t -extract(uint256 const& key) -{ - std::size_t result; - // Use memcpy to avoid unaligned UB - // (will optimize to equivalent code) - std::memcpy(&result, key.data(), sizeof(std::size_t)); - return result; -} - -static std::size_t -extract(SHAMapHash const& key) -{ - return *reinterpret_cast(key.as_uint256().data()); -} - -static std::size_t -extract(LedgerIndex key) -{ - return static_cast(key); -} - -static std::size_t -extract(std::string const& key) -{ - return ::beast::uhash<>{}(key); -} - -template -std::size_t -partitioner(Key const& key, std::size_t const numPartitions) -{ - return extract(key) % numPartitions; -} - -template std::size_t -partitioner( - LedgerIndex const& key, - std::size_t const numPartitions); - -template std::size_t -partitioner(uint256 const& key, std::size_t const numPartitions); - -template std::size_t -partitioner(SHAMapHash const& key, std::size_t const numPartitions); - -template std::size_t -partitioner( - std::string const& key, - std::size_t const numPartitions); - -} // namespace ripple diff --git a/src/test/basics/FeeUnits_test.cpp b/src/test/basics/FeeUnits_test.cpp index 6608a072621..c32f98f1929 100644 --- a/src/test/basics/FeeUnits_test.cpp +++ b/src/test/basics/FeeUnits_test.cpp @@ -16,8 +16,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include #include +#include #include #include diff --git a/src/test/basics/XRPAmount_test.cpp b/src/test/basics/XRPAmount_test.cpp index c4c96dbfbde..f1032be365b 100644 --- a/src/test/basics/XRPAmount_test.cpp +++ b/src/test/basics/XRPAmount_test.cpp @@ -17,8 +17,8 @@ */ //============================================================================== -#include #include +#include namespace ripple { diff --git a/src/test/jtx/amount.h b/src/test/jtx/amount.h index c8e0d0c3701..e797a40b402 100644 --- a/src/test/jtx/amount.h +++ b/src/test/jtx/amount.h @@ -23,8 +23,8 @@ #include #include #include -#include #include +#include #include #include #include diff --git a/src/xrpld/app/misc/LoadFeeTrack.h b/src/xrpld/app/misc/LoadFeeTrack.h index 6c37864e2fd..875a7bb7dfa 100644 --- a/src/xrpld/app/misc/LoadFeeTrack.h +++ b/src/xrpld/app/misc/LoadFeeTrack.h @@ -20,10 +20,11 @@ #ifndef RIPPLE_CORE_LOADFEETRACK_H_INCLUDED #define RIPPLE_CORE_LOADFEETRACK_H_INCLUDED -#include #include #include #include +#include +#include #include #include #include diff --git a/src/xrpld/app/misc/detail/LoadFeeTrack.cpp b/src/xrpld/app/misc/detail/LoadFeeTrack.cpp index 1267af594d0..50fb0ac14db 100644 --- a/src/xrpld/app/misc/detail/LoadFeeTrack.cpp +++ b/src/xrpld/app/misc/detail/LoadFeeTrack.cpp @@ -20,10 +20,10 @@ #include #include #include -#include #include #include #include +#include #include #include diff --git a/src/xrpld/app/paths/Flow.cpp b/src/xrpld/app/paths/Flow.cpp index c21d40c33b5..5707a6d4553 100644 --- a/src/xrpld/app/paths/Flow.cpp +++ b/src/xrpld/app/paths/Flow.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include diff --git a/src/xrpld/app/paths/detail/AmountSpec.h b/src/xrpld/app/paths/detail/AmountSpec.h index 8a1117f9920..210880e4945 100644 --- a/src/xrpld/app/paths/detail/AmountSpec.h +++ b/src/xrpld/app/paths/detail/AmountSpec.h @@ -21,8 +21,8 @@ #define RIPPLE_PATH_IMPL_AMOUNTSPEC_H_INCLUDED #include -#include #include +#include #include diff --git a/src/xrpld/app/paths/detail/BookStep.cpp b/src/xrpld/app/paths/detail/BookStep.cpp index 96971a516fc..d72da0f657a 100644 --- a/src/xrpld/app/paths/detail/BookStep.cpp +++ b/src/xrpld/app/paths/detail/BookStep.cpp @@ -26,11 +26,11 @@ #include #include #include -#include #include #include #include #include +#include #include diff --git a/src/xrpld/app/paths/detail/FlowDebugInfo.h b/src/xrpld/app/paths/detail/FlowDebugInfo.h index 000db4e5714..81239de2f04 100644 --- a/src/xrpld/app/paths/detail/FlowDebugInfo.h +++ b/src/xrpld/app/paths/detail/FlowDebugInfo.h @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include diff --git a/src/xrpld/app/paths/detail/PaySteps.cpp b/src/xrpld/app/paths/detail/PaySteps.cpp index f28c1b96a7c..a2356b380b5 100644 --- a/src/xrpld/app/paths/detail/PaySteps.cpp +++ b/src/xrpld/app/paths/detail/PaySteps.cpp @@ -20,10 +20,10 @@ #include #include #include -#include #include #include #include +#include #include #include diff --git a/src/xrpld/app/paths/detail/StrandFlow.h b/src/xrpld/app/paths/detail/StrandFlow.h index 329a4cc643f..c5365b2384d 100644 --- a/src/xrpld/app/paths/detail/StrandFlow.h +++ b/src/xrpld/app/paths/detail/StrandFlow.h @@ -30,8 +30,8 @@ #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 ac88152c9dd..5ef9d99fddb 100644 --- a/src/xrpld/app/paths/detail/XRPEndpointStep.cpp +++ b/src/xrpld/app/paths/detail/XRPEndpointStep.cpp @@ -24,9 +24,9 @@ #include #include #include -#include #include #include +#include #include diff --git a/src/xrpld/app/tx/detail/ApplyContext.h b/src/xrpld/app/tx/detail/ApplyContext.h index 45de05a73db..6ffe7a4d576 100644 --- a/src/xrpld/app/tx/detail/ApplyContext.h +++ b/src/xrpld/app/tx/detail/ApplyContext.h @@ -23,9 +23,9 @@ #include #include #include -#include #include #include +#include #include #include diff --git a/src/xrpld/app/tx/detail/DeleteAccount.cpp b/src/xrpld/app/tx/detail/DeleteAccount.cpp index fb2f3fc507f..7cd629f56cd 100644 --- a/src/xrpld/app/tx/detail/DeleteAccount.cpp +++ b/src/xrpld/app/tx/detail/DeleteAccount.cpp @@ -24,10 +24,10 @@ #include #include #include -#include #include #include #include +#include #include #include #include diff --git a/src/xrpld/app/tx/detail/Escrow.cpp b/src/xrpld/app/tx/detail/Escrow.cpp index e34b675998d..572b37b55ce 100644 --- a/src/xrpld/app/tx/detail/Escrow.cpp +++ b/src/xrpld/app/tx/detail/Escrow.cpp @@ -25,12 +25,12 @@ #include #include #include -#include #include #include #include #include #include +#include #include #include diff --git a/src/xrpld/app/tx/detail/InvariantCheck.cpp b/src/xrpld/app/tx/detail/InvariantCheck.cpp index f855ad8578c..22ad62d9a29 100644 --- a/src/xrpld/app/tx/detail/InvariantCheck.cpp +++ b/src/xrpld/app/tx/detail/InvariantCheck.cpp @@ -22,9 +22,9 @@ #include #include #include -#include #include #include +#include #include #include #include diff --git a/src/xrpld/app/tx/detail/PayChan.cpp b/src/xrpld/app/tx/detail/PayChan.cpp index d17736c4738..94d489d8c22 100644 --- a/src/xrpld/app/tx/detail/PayChan.cpp +++ b/src/xrpld/app/tx/detail/PayChan.cpp @@ -21,13 +21,13 @@ #include #include #include -#include #include #include #include #include #include #include +#include #include #include diff --git a/src/xrpld/app/tx/detail/Transactor.h b/src/xrpld/app/tx/detail/Transactor.h index c587e5e1994..d7908749efd 100644 --- a/src/xrpld/app/tx/detail/Transactor.h +++ b/src/xrpld/app/tx/detail/Transactor.h @@ -22,8 +22,8 @@ #include #include -#include #include +#include namespace ripple { diff --git a/src/xrpld/app/tx/detail/XChainBridge.cpp b/src/xrpld/app/tx/detail/XChainBridge.cpp index f5633903567..14a234bfa02 100644 --- a/src/xrpld/app/tx/detail/XChainBridge.cpp +++ b/src/xrpld/app/tx/detail/XChainBridge.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include @@ -40,6 +39,7 @@ #include #include #include +#include #include #include #include diff --git a/src/xrpld/core/Config.h b/src/xrpld/core/Config.h index e63e6d2f356..22312d47748 100644 --- a/src/xrpld/core/Config.h +++ b/src/xrpld/core/Config.h @@ -21,10 +21,10 @@ #define RIPPLE_CORE_CONFIG_H_INCLUDED #include -#include #include #include #include +#include #include // VFALCO Breaks levelization #include diff --git a/src/xrpld/ledger/OpenView.h b/src/xrpld/ledger/OpenView.h index bd8627a18b2..c8e1911bf96 100644 --- a/src/xrpld/ledger/OpenView.h +++ b/src/xrpld/ledger/OpenView.h @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/xrpld/ledger/ReadView.h b/src/xrpld/ledger/ReadView.h index 50f1a7d98c1..00d29e4281c 100644 --- a/src/xrpld/ledger/ReadView.h +++ b/src/xrpld/ledger/ReadView.h @@ -21,12 +21,11 @@ #define RIPPLE_LEDGER_READVIEW_H_INCLUDED #include -#include #include -#include #include #include #include +#include #include #include #include @@ -35,6 +34,7 @@ #include #include #include +#include #include #include #include diff --git a/src/xrpld/ledger/detail/ApplyStateTable.h b/src/xrpld/ledger/detail/ApplyStateTable.h index d1616d095e5..e4c8b9ad656 100644 --- a/src/xrpld/ledger/detail/ApplyStateTable.h +++ b/src/xrpld/ledger/detail/ApplyStateTable.h @@ -23,10 +23,10 @@ #include #include #include -#include #include #include #include +#include #include namespace ripple { diff --git a/src/xrpld/ledger/detail/ApplyViewBase.h b/src/xrpld/ledger/detail/ApplyViewBase.h index 8305731b29e..8cc38e41430 100644 --- a/src/xrpld/ledger/detail/ApplyViewBase.h +++ b/src/xrpld/ledger/detail/ApplyViewBase.h @@ -24,7 +24,7 @@ #include #include #include -#include +#include namespace ripple { namespace detail { From 4e11039153640207832d1c68ab398864c3da4691 Mon Sep 17 00:00:00 2001 From: John Freeman Date: Fri, 20 Sep 2024 16:25:10 -0500 Subject: [PATCH 2/7] Rename module isolation directory --- cmake/isolate_headers.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/isolate_headers.cmake b/cmake/isolate_headers.cmake index 61fc5105cac..dfc73366594 100644 --- a/cmake/isolate_headers.cmake +++ b/cmake/isolate_headers.cmake @@ -37,7 +37,7 @@ # isolate_headers(target A B scope) function(isolate_headers target A B scope) file(RELATIVE_PATH C "${A}" "${B}") - set(X "${CMAKE_CURRENT_BINARY_DIR}/include/${target}") + set(X "${CMAKE_CURRENT_BINARY_DIR}/modules/${target}") set(Y "${X}/${C}") cmake_path(GET Y PARENT_PATH parent) file(MAKE_DIRECTORY "${parent}") From e0f3c5613a0ef29e75034ac66994dea1536c4cea Mon Sep 17 00:00:00 2001 From: John Freeman Date: Tue, 24 Sep 2024 08:44:30 -0500 Subject: [PATCH 3/7] Disable private headers for libxrpl --- cmake/RippledCore.cmake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmake/RippledCore.cmake b/cmake/RippledCore.cmake index aac7db77875..82056363444 100644 --- a/cmake/RippledCore.cmake +++ b/cmake/RippledCore.cmake @@ -122,8 +122,9 @@ target_link_modules(xrpl PUBLIC ) target_include_directories(xrpl.libxrpl - PRIVATE - $ + # No private headers for now. + # PRIVATE + # $ PUBLIC $ $) From 947440a5bd28f52fefb68a2d033881e6d46403e7 Mon Sep 17 00:00:00 2001 From: John Freeman Date: Tue, 24 Sep 2024 10:51:16 -0500 Subject: [PATCH 4/7] Disable non-module headers for libxrpl --- cmake/RippledCore.cmake | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/cmake/RippledCore.cmake b/cmake/RippledCore.cmake index 82056363444..459f8261aca 100644 --- a/cmake/RippledCore.cmake +++ b/cmake/RippledCore.cmake @@ -121,13 +121,14 @@ target_link_modules(xrpl PUBLIC server ) -target_include_directories(xrpl.libxrpl - # No private headers for now. - # PRIVATE - # $ - PUBLIC - $ - $) +# All headers in libxrpl are in modules. +# Uncomment this stanza if you have not yet moved new headers into a module. +# target_include_directories(xrpl.libxrpl +# PRIVATE +# $ +# PUBLIC +# $ +# $) target_compile_definitions(xrpl.libxrpl PUBLIC From b0a2105b4ba357e8bb638f0d64a15f51a45155ea Mon Sep 17 00:00:00 2001 From: John Freeman Date: Tue, 29 Oct 2024 17:50:01 -0500 Subject: [PATCH 5/7] Fix symlinks on non-admin Windows --- cmake/isolate_headers.cmake | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/cmake/isolate_headers.cmake b/cmake/isolate_headers.cmake index dfc73366594..f7b78de260a 100644 --- a/cmake/isolate_headers.cmake +++ b/cmake/isolate_headers.cmake @@ -41,6 +41,19 @@ function(isolate_headers target A B scope) set(Y "${X}/${C}") cmake_path(GET Y PARENT_PATH parent) file(MAKE_DIRECTORY "${parent}") - file(CREATE_LINK "${B}" "${Y}" SYMBOLIC) + + if(WIN32) + if(NOT IS_SYMLINK "${Y}") + file(TO_NATIVE_PATH "${B}" B) + file(TO_NATIVE_PATH "${Y}" Y) + execute_process(COMMAND cmd.exe /c mklink /J "${Y}" "${B}") + endif() + else() + file(CREATE_LINK "${B}" "${Y}" SYMBOLIC) + endif() + if(NOT IS_SYMLINK "${Y}") + message(ERROR "failed to create symlink: <${Y}>") + endif() + target_include_directories(${target} ${scope} "$") endfunction() From 8890adc8a6c9898dfc29b872d56719f4c19ef00c Mon Sep 17 00:00:00 2001 From: John Freeman Date: Sat, 2 Nov 2024 14:23:26 -0500 Subject: [PATCH 6/7] Fix symbolic links of install --- cmake/RippledInstall.cmake | 26 ++++++++++++++------------ cmake/create_symbolic_link.cmake | 20 ++++++++++++++++++++ cmake/isolate_headers.cmake | 17 +++-------------- 3 files changed, 37 insertions(+), 26 deletions(-) create mode 100644 cmake/create_symbolic_link.cmake diff --git a/cmake/RippledInstall.cmake b/cmake/RippledInstall.cmake index 3a41aab8368..2e0b7a9e82a 100644 --- a/cmake/RippledInstall.cmake +++ b/cmake/RippledInstall.cmake @@ -2,6 +2,8 @@ install stuff #]===================================================================] +include(create_symbolic_link) + install ( TARGETS common @@ -29,12 +31,12 @@ install( DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" ) -if(NOT WIN32) - install( - CODE "file(CREATE_LINK xrpl \ - \${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/ripple SYMBOLIC)" - ) -endif() +install(CODE " + set(CMAKE_MODULE_PATH \"${CMAKE_MODULE_PATH}\") + include(create_symbolic_link) + create_symbolic_link(xrpl \ + \${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/ripple) +") install (EXPORT RippleExports FILE RippleTargets.cmake @@ -63,12 +65,12 @@ if (is_root_project AND TARGET rippled) copy_if_not_exists(\"${CMAKE_CURRENT_SOURCE_DIR}/cfg/rippled-example.cfg\" etc rippled.cfg) copy_if_not_exists(\"${CMAKE_CURRENT_SOURCE_DIR}/cfg/validators-example.txt\" etc validators.txt) ") - if(NOT WIN32) - install( - CODE "file(CREATE_LINK rippled${suffix} \ - \${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/xrpld${suffix} SYMBOLIC)" - ) - endif() + install(CODE " + set(CMAKE_MODULE_PATH \"${CMAKE_MODULE_PATH}\") + include(create_symbolic_link) + create_symbolic_link(rippled${suffix} \ + \${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/xrpld${suffix}) + ") endif () install ( diff --git a/cmake/create_symbolic_link.cmake b/cmake/create_symbolic_link.cmake new file mode 100644 index 00000000000..60fcf2e0b57 --- /dev/null +++ b/cmake/create_symbolic_link.cmake @@ -0,0 +1,20 @@ +# file(CREATE_SYMLINK) only works on Windows with administrator privileges. +# https://stackoverflow.com/a/61244115/618906 +function(create_symbolic_link target link) + if(WIN32) + if(NOT IS_SYMLINK "${link}") + if(NOT IS_ABSOLUTE "${target}") + # Relative links work do not work on Windows. + set(target "${link}/../${target}") + endif() + file(TO_NATIVE_PATH "${target}" target) + file(TO_NATIVE_PATH "${link}" link) + execute_process(COMMAND cmd.exe /c mklink /J "${link}" "${target}") + endif() + else() + file(CREATE_LINK "${target}" "${link}" SYMBOLIC) + endif() + if(NOT IS_SYMLINK "${link}") + message(ERROR "failed to create symlink: <${link}>") + endif() +endfunction() diff --git a/cmake/isolate_headers.cmake b/cmake/isolate_headers.cmake index f7b78de260a..0a5a43a6a28 100644 --- a/cmake/isolate_headers.cmake +++ b/cmake/isolate_headers.cmake @@ -1,3 +1,5 @@ +include(create_symbolic_link) + # Consider include directory B nested under prefix A: # # /path/to/A/then/to/B/... @@ -41,19 +43,6 @@ function(isolate_headers target A B scope) set(Y "${X}/${C}") cmake_path(GET Y PARENT_PATH parent) file(MAKE_DIRECTORY "${parent}") - - if(WIN32) - if(NOT IS_SYMLINK "${Y}") - file(TO_NATIVE_PATH "${B}" B) - file(TO_NATIVE_PATH "${Y}" Y) - execute_process(COMMAND cmd.exe /c mklink /J "${Y}" "${B}") - endif() - else() - file(CREATE_LINK "${B}" "${Y}" SYMBOLIC) - endif() - if(NOT IS_SYMLINK "${Y}") - message(ERROR "failed to create symlink: <${Y}>") - endif() - + create_symbolic_link("${B}" "${Y}") target_include_directories(${target} ${scope} "$") endfunction() From ad16bbd91ebd66405e118c5eb2adf9efe89000cb Mon Sep 17 00:00:00 2001 From: John Freeman Date: Thu, 14 Nov 2024 17:36:44 -0600 Subject: [PATCH 7/7] Move IOUAmount from basics module to protocol --- include/xrpl/protocol/AmountConversions.h | 2 +- include/xrpl/{basics => protocol}/IOUAmount.h | 0 include/xrpl/protocol/Quality.h | 2 +- include/xrpl/protocol/STAmount.h | 2 +- src/libxrpl/{basics => protocol}/IOUAmount.cpp | 2 +- src/test/basics/IOUAmount_test.cpp | 2 +- src/test/basics/Number_test.cpp | 2 +- src/xrpld/app/misc/AMMHelpers.h | 2 +- src/xrpld/app/paths/Credit.h | 2 +- src/xrpld/app/paths/Flow.cpp | 2 +- src/xrpld/app/paths/detail/AmountSpec.h | 2 +- src/xrpld/app/paths/detail/BookStep.cpp | 2 +- src/xrpld/app/paths/detail/DirectStep.cpp | 2 +- src/xrpld/app/paths/detail/FlowDebugInfo.h | 2 +- src/xrpld/app/paths/detail/PaySteps.cpp | 2 +- src/xrpld/app/paths/detail/StrandFlow.h | 2 +- src/xrpld/app/paths/detail/XRPEndpointStep.cpp | 2 +- src/xrpld/ledger/ReadView.h | 2 +- 18 files changed, 17 insertions(+), 17 deletions(-) rename include/xrpl/{basics => protocol}/IOUAmount.h (100%) rename src/libxrpl/{basics => protocol}/IOUAmount.cpp (99%) diff --git a/include/xrpl/protocol/AmountConversions.h b/include/xrpl/protocol/AmountConversions.h index 602fbcec1fe..24d7a6de80d 100644 --- a/include/xrpl/protocol/AmountConversions.h +++ b/include/xrpl/protocol/AmountConversions.h @@ -20,7 +20,7 @@ #ifndef RIPPLE_PROTOCOL_AMOUNTCONVERSION_H_INCLUDED #define RIPPLE_PROTOCOL_AMOUNTCONVERSION_H_INCLUDED -#include +#include #include #include diff --git a/include/xrpl/basics/IOUAmount.h b/include/xrpl/protocol/IOUAmount.h similarity index 100% rename from include/xrpl/basics/IOUAmount.h rename to include/xrpl/protocol/IOUAmount.h diff --git a/include/xrpl/protocol/Quality.h b/include/xrpl/protocol/Quality.h index 12cdb77845e..712db3b04bb 100644 --- a/include/xrpl/protocol/Quality.h +++ b/include/xrpl/protocol/Quality.h @@ -20,8 +20,8 @@ #ifndef RIPPLE_PROTOCOL_QUALITY_H_INCLUDED #define RIPPLE_PROTOCOL_QUALITY_H_INCLUDED -#include #include +#include #include #include diff --git a/include/xrpl/protocol/STAmount.h b/include/xrpl/protocol/STAmount.h index b382ea63f33..96a326b7661 100644 --- a/include/xrpl/protocol/STAmount.h +++ b/include/xrpl/protocol/STAmount.h @@ -21,10 +21,10 @@ #define RIPPLE_PROTOCOL_STAMOUNT_H_INCLUDED #include -#include #include #include #include +#include #include #include #include diff --git a/src/libxrpl/basics/IOUAmount.cpp b/src/libxrpl/protocol/IOUAmount.cpp similarity index 99% rename from src/libxrpl/basics/IOUAmount.cpp rename to src/libxrpl/protocol/IOUAmount.cpp index a24e1b917f7..7fc879609ed 100644 --- a/src/libxrpl/basics/IOUAmount.cpp +++ b/src/libxrpl/protocol/IOUAmount.cpp @@ -17,8 +17,8 @@ */ //============================================================================== -#include #include +#include #include #include #include diff --git a/src/test/basics/IOUAmount_test.cpp b/src/test/basics/IOUAmount_test.cpp index e588a08dc02..306953d5ab9 100644 --- a/src/test/basics/IOUAmount_test.cpp +++ b/src/test/basics/IOUAmount_test.cpp @@ -17,8 +17,8 @@ */ //============================================================================== -#include #include +#include namespace ripple { diff --git a/src/test/basics/Number_test.cpp b/src/test/basics/Number_test.cpp index cf626354e0f..8a0a6702a63 100644 --- a/src/test/basics/Number_test.cpp +++ b/src/test/basics/Number_test.cpp @@ -17,9 +17,9 @@ */ //============================================================================== -#include #include #include +#include #include #include #include diff --git a/src/xrpld/app/misc/AMMHelpers.h b/src/xrpld/app/misc/AMMHelpers.h index 7ad0093a2e4..c6c0c808bfe 100644 --- a/src/xrpld/app/misc/AMMHelpers.h +++ b/src/xrpld/app/misc/AMMHelpers.h @@ -20,13 +20,13 @@ #ifndef RIPPLE_APP_MISC_AMMHELPERS_H_INCLUDED #define RIPPLE_APP_MISC_AMMHELPERS_H_INCLUDED -#include #include #include #include #include #include #include +#include #include #include #include diff --git a/src/xrpld/app/paths/Credit.h b/src/xrpld/app/paths/Credit.h index 1f9d5b04fe9..b71ec057ae1 100644 --- a/src/xrpld/app/paths/Credit.h +++ b/src/xrpld/app/paths/Credit.h @@ -21,7 +21,7 @@ #define RIPPLE_APP_PATHS_CREDIT_H_INCLUDED #include -#include +#include #include namespace ripple { diff --git a/src/xrpld/app/paths/Flow.cpp b/src/xrpld/app/paths/Flow.cpp index 5707a6d4553..754e0a25fbd 100644 --- a/src/xrpld/app/paths/Flow.cpp +++ b/src/xrpld/app/paths/Flow.cpp @@ -23,8 +23,8 @@ #include #include #include -#include #include +#include #include #include diff --git a/src/xrpld/app/paths/detail/AmountSpec.h b/src/xrpld/app/paths/detail/AmountSpec.h index 210880e4945..4c036e786ca 100644 --- a/src/xrpld/app/paths/detail/AmountSpec.h +++ b/src/xrpld/app/paths/detail/AmountSpec.h @@ -20,7 +20,7 @@ #ifndef RIPPLE_PATH_IMPL_AMOUNTSPEC_H_INCLUDED #define RIPPLE_PATH_IMPL_AMOUNTSPEC_H_INCLUDED -#include +#include #include #include diff --git a/src/xrpld/app/paths/detail/BookStep.cpp b/src/xrpld/app/paths/detail/BookStep.cpp index 7a170a12f04..a8c98657b59 100644 --- a/src/xrpld/app/paths/detail/BookStep.cpp +++ b/src/xrpld/app/paths/detail/BookStep.cpp @@ -24,11 +24,11 @@ #include #include #include -#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 7df06751140..f1fd4cf2edf 100644 --- a/src/xrpld/app/paths/detail/DirectStep.cpp +++ b/src/xrpld/app/paths/detail/DirectStep.cpp @@ -21,9 +21,9 @@ #include #include #include -#include #include #include +#include #include #include diff --git a/src/xrpld/app/paths/detail/FlowDebugInfo.h b/src/xrpld/app/paths/detail/FlowDebugInfo.h index 81239de2f04..fc8272a8b29 100644 --- a/src/xrpld/app/paths/detail/FlowDebugInfo.h +++ b/src/xrpld/app/paths/detail/FlowDebugInfo.h @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include diff --git a/src/xrpld/app/paths/detail/PaySteps.cpp b/src/xrpld/app/paths/detail/PaySteps.cpp index a2356b380b5..c55ef140829 100644 --- a/src/xrpld/app/paths/detail/PaySteps.cpp +++ b/src/xrpld/app/paths/detail/PaySteps.cpp @@ -19,10 +19,10 @@ #include #include -#include #include #include #include +#include #include #include diff --git a/src/xrpld/app/paths/detail/StrandFlow.h b/src/xrpld/app/paths/detail/StrandFlow.h index c5365b2384d..64e926c5259 100644 --- a/src/xrpld/app/paths/detail/StrandFlow.h +++ b/src/xrpld/app/paths/detail/StrandFlow.h @@ -28,9 +28,9 @@ #include #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 b0d3188c834..dbee7568368 100644 --- a/src/xrpld/app/paths/detail/XRPEndpointStep.cpp +++ b/src/xrpld/app/paths/detail/XRPEndpointStep.cpp @@ -22,9 +22,9 @@ #include #include #include -#include #include #include +#include #include #include diff --git a/src/xrpld/ledger/ReadView.h b/src/xrpld/ledger/ReadView.h index 00d29e4281c..595f0633e76 100644 --- a/src/xrpld/ledger/ReadView.h +++ b/src/xrpld/ledger/ReadView.h @@ -21,12 +21,12 @@ #define RIPPLE_LEDGER_READVIEW_H_INCLUDED #include -#include #include #include #include #include #include +#include #include #include #include